likec4 1.20.2 → 1.20.3

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.
@@ -0,0 +1,1855 @@
1
+ import*as lD from"node:fs";import{writeFileSync as dD,statSync as v1,readFileSync as Im,appendFileSync as b1,createReadStream as fD,createWriteStream as pD,existsSync as D1}from"node:fs";import jr,{sep as hD,resolve as E1,basename as R1}from"node:path";import{fileURLToPath as Nm,pathToFileURL as $1}from"node:url";import{isatty as T1}from"tty";import S1,{formatWithOptions as mD,debuglog as k1,stripVTControlCharacters as C1,inspect as Fd,promisify as A1,callbackify as lo,aborted as _1}from"node:util";import P1 from"util";import Rr from"path";import x1 from"os";import I1 from"crypto";import N1 from"net";import O1 from"url";import fo from"fs";import gD from"child_process";import{nonexhaustive as Oe,invariant as Ce,defaultTheme as Gn,DefaultRelationshipColor as va,hierarchyDistance as F1,DefaultThemeColor as po,nameFromFqn as Ld,nonNullable as dn,compareFqnHierarchically as L1,isThemeColor as yD,ComputedNode as Md,DefaultArrowType as us,extractStep as M1,ComputedView as ba,delay as B1,LinkedList as Om,DefaultLineStyle as z1,AsFqn as q1,stringHash as j1,parentFqn as Bd,compareNatural as wD,LikeC4Model as vD,sortByFqnHierarchically as bD,isScopedElementView as G1,computeColorValues as U1,compareRelations as W1,DeploymentElement as H1,FqnRef as Da,isSameHierarchy as DD,isAncestor as Fm,FqnExpr as Ea,isNonEmptyArray as ir,isAutoLayoutDirection as V1,isOrOperator as ED,isAndOperator as RD,hasAtLeast as K1}from"@likec4/core";import st,{cwd as Y1,platform as X1,hrtime as zd,execPath as J1,execArgv as Q1}from"node:process";import*as Lm from"node:tty";import $D from"node:tty";import{ComputedNode as TD}from"@likec4/core/types";import{EventEmitter as Z1}from"events";import{Buffer as Mm}from"buffer";import{Graphviz as Bm}from"@hpcc-js/wasm-graphviz";import{resolveRulesExtendedViews as eN}from"@likec4/core/compute-view";import{createLogger as tN}from"vite";import{ChildProcess as SD,spawnSync as nN,spawn as rN}from"node:child_process";import{StringDecoder as kD}from"node:string_decoder";import{setTimeout as CD,scheduler as AD,setImmediate as iN}from"node:timers/promises";import{constants as cs,cpus as sN}from"node:os";import{once as $n,addAbortListener as _D,EventEmitter as oN,on as qd,setMaxListeners as aN}from"node:events";import{serialize as uN}from"node:v8";import{Transform as cN,getDefaultHighWaterMark as jd,PassThrough as PD,Readable as ls,Writable as zm,Duplex as qm}from"node:stream";import{Buffer as jm}from"node:buffer";import{finished as Di}from"node:stream/promises";import{LikeC4Model as xD}from"@likec4/core/model";function Gm(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(t)==="[object Module]":!0}function Um(t,e,n=".",r){if(!Gm(e))return Um(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]]:Gm(o)&&Gm(i[s])?i[s]=Um(o,i[s],(n?`${n}.`:"")+s.toString(),r):i[s]=o))}return i}function lN(t){return(...e)=>e.reduce((n,r)=>Um(n,r,"",t),{})}const Wm=lN();function $t(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Un(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function dN(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Gd(t){return typeof t=="object"&&t!==null&&$t(t.container)&&Un(t.reference)&&typeof t.message=="string"}class ID{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return $t(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=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 Ei(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function ds(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function ND(t){return Ei(t)&&typeof t.fullText=="string"}class Ot{constructor(e,n){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?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Ot(()=>({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 en})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=fN(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,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 Ot(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?en:{done:!1,value:e(i)}})}filter(e){return new Ot(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return en})}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.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 Ot(()=>({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){const s=e(i);if(Ud(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return en})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new Ot(()=>({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(Ud(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return en})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new Ot(()=>{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 Ot(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?en:this.nextFn(n.state)))}distinct(e){return new Ot(()=>({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 en})}exclude(e,n){const r=new Set;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 fN(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Ud(t){return!!t&&typeof t[Symbol.iterator]=="function"}const ho=new Ot(()=>{},()=>en),en=Object.freeze({done:!0,value:void 0});function rt(...t){if(t.length===1){const e=t[0];if(e instanceof Ot)return e;if(Ud(e))return new Ot(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new Ot(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:en)}return t.length>1?new Ot(()=>({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++];Ud(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return en}):ho}class mo extends Ot{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 en})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Hm;(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})(Hm||(Hm={}));function Ra(t){return new mo(t,e=>Ei(e)?e.content:[],{includeRoot:!0})}function OD(t){return Ra(t).filter(ds)}function FD(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Wd(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function $a(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var $r;(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"})($r||($r={}));function LD(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return $r.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return $r.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?$r.Inside:n?$r.OverlapBack:r?$r.OverlapFront:$r.Outside}function Vm(t,e){return LD(t,e)>$r.After}const Km=/^[\w\p{L}]$/u;function Ri(t,e,n=Km){if(t){if(e>0){const r=e-t.offset,i=t.text.charAt(r);n.test(i)||e--}return Xm(t,e)}}function Hd(t,e){if(t){const n=BD(t,!0);if(n&&Ym(n,e))return n;if(ND(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Ym(s,e))return s}}}}function Ym(t,e){return ds(t)&&e.includes(t.tokenType.name)}function Xm(t,e){if(ds(t))return t;if(Ei(t)){const n=MD(t,e,!1);if(n)return Xm(n,e)}}function Vd(t,e){if(ds(t))return t;if(Ei(t)){const n=MD(t,e,!0);if(n)return Vd(n,e)}}function MD(t,e,n){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 BD(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 zD(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 pN(t){if(t.range.start.character===0)return t;const e=t.range.start.line;let n=t,r;for(;t.container;){const i=t.container,s=r??i.content.indexOf(t);if(s===0?(t=i,r=void 0):(r=s-1,t=i.content[r]),t.range.start.line!==e)break;n=t}return n}function qD(t,e){const n=hN(t,e);return n?n.parent.content.slice(n.a+1,n.b):[]}function hN(t,e){const n=jD(t),r=jD(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 jD(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()}const mN={__proto__:null,DefaultNameRegexp:Km,get RangeComparison(){return $r},compareRange:LD,findCommentNode:Hd,findDeclarationNodeAtOffset:Ri,findLeafNodeAtOffset:Xm,findLeafNodeBeforeOffset:Vd,flattenCst:OD,getInteriorNodes:qD,getNextNode:zD,getPreviousNode:BD,getStartlineNode:pN,inRange:Vm,isChildNode:FD,isCommentNode:Ym,streamCst:Ra,toDocumentSegment:$a,tokenToRange:Wd};class GD extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function Ta(t){throw new Error("Error! The input value was not handled.")}const Kd="AbstractRule",Yd="AbstractType",Jm="Condition",UD="TypeDefinition",Qm="ValueLiteral",Sa="AbstractElement";function Zm(t){return Ue.isInstance(t,Sa)}const Xd="ArrayLiteral",ka="ArrayType";function gN(t){return Ue.isInstance(t,ka)}const Ca="BooleanLiteral";function yN(t){return Ue.isInstance(t,Ca)}const Aa="Conjunction";function wN(t){return Ue.isInstance(t,Aa)}const _a="Disjunction";function vN(t){return Ue.isInstance(t,_a)}const Jd="Grammar",eg="GrammarImport",Pa="InferredType";function WD(t){return Ue.isInstance(t,Pa)}const xa="Interface";function HD(t){return Ue.isInstance(t,xa)}const tg="NamedArgument",Ia="Negation";function bN(t){return Ue.isInstance(t,Ia)}const Qd="NumberLiteral",Zd="Parameter",Na="ParameterReference";function DN(t){return Ue.isInstance(t,Na)}const Oa="ParserRule";function tn(t){return Ue.isInstance(t,Oa)}const Fa="ReferenceType";function EN(t){return Ue.isInstance(t,Fa)}const ef="ReturnType";function RN(t){return Ue.isInstance(t,ef)}const La="SimpleType";function VD(t){return Ue.isInstance(t,La)}const tf="StringLiteral",go="TerminalRule";function Gr(t){return Ue.isInstance(t,go)}const Ma="Type";function ng(t){return Ue.isInstance(t,Ma)}const rg="TypeAttribute",Ba="UnionType";function $N(t){return Ue.isInstance(t,Ba)}const za="Action";function fs(t){return Ue.isInstance(t,za)}const qa="Alternatives";function ig(t){return Ue.isInstance(t,qa)}const ja="Assignment";function Tr(t){return Ue.isInstance(t,ja)}const Ga="CharacterRange";function TN(t){return Ue.isInstance(t,Ga)}const Ua="CrossReference";function Wa(t){return Ue.isInstance(t,Ua)}const Ha="EndOfFile";function SN(t){return Ue.isInstance(t,Ha)}const Va="Group";function $i(t){return Ue.isInstance(t,Va)}const Ka="Keyword";function Sr(t){return Ue.isInstance(t,Ka)}const Ya="NegatedToken";function kN(t){return Ue.isInstance(t,Ya)}const Xa="RegexToken";function CN(t){return Ue.isInstance(t,Xa)}const Ja="RuleCall";function Ur(t){return Ue.isInstance(t,Ja)}const Qa="TerminalAlternatives";function AN(t){return Ue.isInstance(t,Qa)}const Za="TerminalGroup";function _N(t){return Ue.isInstance(t,Za)}const eu="TerminalRuleCall";function KD(t){return Ue.isInstance(t,eu)}const tu="UnorderedGroup";function sg(t){return Ue.isInstance(t,tu)}const nu="UntilToken";function PN(t){return Ue.isInstance(t,nu)}const ru="Wildcard";function xN(t){return Ue.isInstance(t,ru)}class YD extends ID{getAllTypes(){return[Sa,Kd,Yd,za,qa,Xd,ka,ja,Ca,Ga,Jm,Aa,Ua,_a,Ha,Jd,eg,Va,Pa,xa,Ka,tg,Ya,Ia,Qd,Zd,Na,Oa,Fa,Xa,ef,Ja,La,tf,Qa,Za,go,eu,Ma,rg,UD,Ba,tu,nu,Qm,ru]}computeIsSubtype(e,n){switch(e){case za:case qa:case ja:case Ga:case Ua:case Ha:case Va:case Ka:case Ya:case Xa:case Ja:case Qa:case Za:case eu:case tu:case nu:case ru:return this.isSubtype(Sa,n);case Xd:case Qd:case tf:return this.isSubtype(Qm,n);case ka:case Fa:case La:case Ba:return this.isSubtype(UD,n);case Ca:return this.isSubtype(Jm,n)||this.isSubtype(Qm,n);case Aa:case _a:case Ia:case Na:return this.isSubtype(Jm,n);case Pa:case xa:case Ma:return this.isSubtype(Yd,n);case Oa:return this.isSubtype(Kd,n)||this.isSubtype(Yd,n);case go:return this.isSubtype(Kd,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 Yd;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Kd;case"Grammar:usedGrammars":return Jd;case"NamedArgument:parameter":case"ParameterReference:parameter":return Zd;case"TerminalRuleCall:rule":return go;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Sa:return{name:Sa,properties:[{name:"cardinality"},{name:"lookahead"}]};case Xd:return{name:Xd,properties:[{name:"elements",defaultValue:[]}]};case ka:return{name:ka,properties:[{name:"elementType"}]};case Ca:return{name:Ca,properties:[{name:"true",defaultValue:!1}]};case Aa:return{name:Aa,properties:[{name:"left"},{name:"right"}]};case _a:return{name:_a,properties:[{name:"left"},{name:"right"}]};case Jd:return{name:Jd,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 eg:return{name:eg,properties:[{name:"path"}]};case Pa:return{name:Pa,properties:[{name:"name"}]};case xa:return{name:xa,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case tg:return{name:tg,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Ia:return{name:Ia,properties:[{name:"value"}]};case Qd:return{name:Qd,properties:[{name:"value"}]};case Zd:return{name:Zd,properties:[{name:"name"}]};case Na:return{name:Na,properties:[{name:"parameter"}]};case Oa:return{name:Oa,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 Fa:return{name:Fa,properties:[{name:"referenceType"}]};case ef:return{name:ef,properties:[{name:"name"}]};case La:return{name:La,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case tf:return{name:tf,properties:[{name:"value"}]};case go:return{name:go,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Ma:return{name:Ma,properties:[{name:"name"},{name:"type"}]};case rg:return{name:rg,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Ba:return{name:Ba,properties:[{name:"types",defaultValue:[]}]};case za:return{name:za,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case qa:return{name:qa,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case ja:return{name:ja,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case Ga:return{name:Ga,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Ua:return{name:Ua,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case Ha:return{name:Ha,properties:[{name:"cardinality"},{name:"lookahead"}]};case Va:return{name:Va,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case Ka:return{name:Ka,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Ya:return{name:Ya,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Xa:return{name:Xa,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Ja:return{name:Ja,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Qa:return{name:Qa,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Za:return{name:Za,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case eu:return{name:eu,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case tu:return{name:tu,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case nu:return{name:nu,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case ru:return{name:ru,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const Ue=new YD;function og(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{$t(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):$t(n)&&(n.$container=t,n.$containerProperty=e))}function nn(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Ti(t,e){let n=t;for(;n;){if(e(n))return!0;n=n.$container}return!1}function wt(t){const n=nf(t).$document;if(!n)throw new Error("AST node has no document.");return n}function nf(t){for(;t.$container;)t=t.$container;return t}function iu(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new Ot(()=>({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($t(s)){if(r.keyIndex++,ag(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($t(a)&&ag(a,n))return{done:!1,value:a}}r.arrayIndex=0}}r.keyIndex++}return en})}function kr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new mo(t,n=>iu(n,e))}function Wr(t,e){if(t){if(e?.range&&!ag(t,e.range))return new mo(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new mo(t,n=>iu(n,e),{includeRoot:!0})}function ag(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?Vm(r,e):!1}function rf(t){return new Ot(()=>({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(Un(r))return e.keyIndex++,{done:!1,value:{reference:r,container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(Un(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return en})}function IN(t,e=wt(t).parseResult.value){const n=[];return Wr(e).forEach(r=>{rf(r).forEach(i=>{i.reference.ref===t&&n.push(i.reference)})}),rt(n)}function ug(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.name]=XD(i.defaultValue))}function XD(t){return Array.isArray(t)?[...t.map(XD)]:t}function cg(t,e){const n={$type:t.$type};for(const[r,i]of Object.entries(t))if(!r.startsWith("$"))if($t(i))n[r]=cg(i,e);else if(Un(i))n[r]=e(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){const s=[];for(const o of i)$t(o)?s.push(cg(o,e)):Un(o)?s.push(e(n,r,o.$refNode,o.$refText)):s.push(o);n[r]=s}else n[r]=i;return og(n),n}const su={__proto__:null,assignMandatoryProperties:ug,copyAstNode:cg,findLocalReferences:IN,findRootNode:nf,getContainerOfType:nn,getDocument:wt,hasContainerOfType:Ti,linkContentToContainer:og,streamAllContents:kr,streamAst:Wr,streamContents:iu,streamReferences:rf};function Se(t){return t.charCodeAt(0)}function lg(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function ou(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function yo(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function NN(){throw Error("Internal Error - Should never get here!")}function JD(t){return t.type==="Character"}const sf=[];for(let t=Se("0");t<=Se("9");t++)sf.push(t);const of=[Se("_")].concat(sf);for(let t=Se("a");t<=Se("z");t++)of.push(t);for(let t=Se("A");t<=Se("Z");t++)of.push(t);const QD=[Se(" "),Se("\f"),Se(`
2
+ `),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")],ON=/[0-9a-fA-F]/,af=/[0-9]/,FN=/[1-9]/;class ZD{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const 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":ou(r,"global");break;case"i":ou(r,"ignoreCase");break;case"m":ou(r,"multiLine");break;case"u":ou(r,"unicode");break;case"y":ou(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break}yo(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return NN()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;yo(n);break}if(!(e===!0&&n===void 0)&&yo(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),yo(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[Se(`
3
+ `),Se("\r"),Se("\u2028"),Se("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,n=!1;switch(this.popChar()){case"d":e=sf;break;case"D":e=sf,n=!0;break;case"s":e=QD;break;case"S":e=QD,n=!0;break;case"w":e=of;break;case"W":e=of,n=!0;break}if(yo(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=Se("\f");break;case"n":e=Se(`
4
+ `);break;case"r":e=Se("\r");break;case"t":e=Se(" ");break;case"v":e=Se("\v");break}if(yo(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(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:Se(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
+ `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value: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,JD(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,JD(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else lg(r.value,e),e.push(Se("-")),lg(i.value,e)}else lg(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
6
+ `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value: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"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(FN.test(e)===!1)throw Error("Expecting a positive integer");for(;af.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(af.test(e)===!1)throw Error("Expecting an integer");for(;af.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
7
+ `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:Se(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return af.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
8
+ `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
9
+ `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let n="";for(let i=0;i<e;i++){const s=this.popChar();if(ON.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class uf{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const eE=/\r?\n/gm,LN=new ZD;class MN extends uf{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){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===`
10
+ `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=cf(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=!!`
11
+ `.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 dg=new MN;function BN(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),dg.reset(t),dg.visit(LN.pattern(t)),dg.multiline}catch{return!1}}const zN=`\f
12
+ \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function fg(t){const e=typeof t=="string"?new RegExp(t):t;return zN.some(n=>e.test(n))}function cf(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qN(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:cf(e)).join("")}function jN(t,e){const n=GN(t),r=e.match(n);return!!r&&r[0].length>0}function GN(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){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,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 lf(t){return t.rules.find(e=>tn(e)&&e.entry)}function tE(t){return t.rules.filter(e=>Gr(e)&&e.hidden)}function pg(t,e){const n=new Set,r=lf(t);if(!r)return new Set(t.rules);const i=[r].concat(tE(t));for(const o of i)nE(o,n,e);const s=new Set;for(const o of t.rules)(n.has(o.name)||Gr(o)&&o.hidden)&&s.add(o);return s}function nE(t,e,n){e.add(t.name),kr(t).forEach(r=>{if(Ur(r)||n&&KD(r)){const i=r.rule.ref;i&&!e.has(i.name)&&nE(i,e,n)}})}function hg(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=wg(t.type.ref);return e?.terminal}}function rE(t){return t.hidden&&!fg(cu(t))}function wo(t,e){return!t||!e?[]:mg(t,e,t.astNode,!0)}function rn(t,e,n){if(!t||!e)return;const r=mg(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 mg(t,e,n,r){if(!r){const i=nn(t.grammarSource,Tr);if(i&&i.feature===e)return[t]}return Ei(t)&&t.astNode===n?t.content.flatMap(i=>mg(i,e,n,!1)):[]}function gg(t,e){return t?yg(t,e,t?.astNode):[]}function au(t,e,n){if(!t)return;const r=yg(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 yg(t,e,n){if(t.astNode!==n)return[];if(Sr(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=Ra(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const o=i.value;o.astNode===n?Sr(o.grammarSource)&&o.grammarSource.value===e&&s.push(o):r.prune()}while(!i.done);return s}function iE(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=nn(t.grammarSource,Tr);if(r)return r;t=t.container}}function wg(t){let e=t;return WD(e)&&(fs(e.$container)?e=e.$container.$container:tn(e.$container)?e=e.$container:Ta(e.$container)),sE(t,e,new Map)}function sE(t,e,n){var r;function i(s,o){let a;return nn(s,Tr)||(a=sE(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 kr(e)){if(Tr(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Ur(s)&&tn(s.rule.ref))return i(s,s.rule.ref);if(VD(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function oE(t){const e=t.$container;if($i(e)){const n=e.elements,r=n.indexOf(t);for(let i=r-1;i>=0;i--){const s=n[i];if(fs(s))return s;{const o=kr(n[i]).find(fs);if(o)return o}}}if(Zm(e))return oE(e)}function vo(t,e){return t==="?"||t==="*"||$i(e)&&!!e.guardCondition}function aE(t){return t==="*"||t==="+"}function UN(t){return t==="+="}function df(t){return uE(t,new Set)}function uE(t,e){if(e.has(t))return!0;e.add(t);for(const n of kr(t))if(Ur(n)){if(!n.rule.ref||tn(n.rule.ref)&&!uE(n.rule.ref,e))return!1}else{if(Tr(n))return!1;if(fs(n))return!1}return!!t.definition}function WN(t){return vg(t.type,new Set)}function vg(t,e){if(e.has(t))return!0;if(e.add(t),gN(t))return!1;if(EN(t))return!1;if($N(t))return t.types.every(n=>vg(n,e));if(VD(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){const n=t.typeRef.ref;return ng(n)?vg(n.type,e):!1}else return!1}else return!1}function ps(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(tn(e))return e.name;if(HD(e)||ng(e))return e.name}}}function uu(t){var e;if(tn(t))return df(t)?t.name:(e=ps(t))!==null&&e!==void 0?e:t.name;if(HD(t)||ng(t)||RN(t))return t.name;if(fs(t)){const n=cE(t);if(n)return n}else if(WD(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function cE(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return uu(t.type.ref)}function HN(t){var e,n,r;return Gr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":df(t)?t.name:(r=ps(t))!==null&&r!==void 0?r:t.name}function lE(t){var e,n,r;return Gr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":(r=ps(t))!==null&&r!==void 0?r:t.name}function cu(t){const e={s:!1,i:!1,u:!1},n=bo(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const bg=/[\s\S]/.source;function bo(t,e){if(AN(t))return VN(t);if(_N(t))return KN(t);if(TN(t))return JN(t);if(KD(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return Hr(bo(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(kN(t))return XN(t);if(PN(t))return YN(t);if(CN(t)){const n=t.regex.lastIndexOf("/"),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")),Hr(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(xN(t))return Hr(bg,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function VN(t){return Hr(t.elements.map(e=>bo(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function KN(t){return Hr(t.elements.map(e=>bo(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function YN(t){return Hr(`${bg}*?${bo(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function XN(t){return Hr(`(?!${bo(t.terminal)})${bg}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function JN(t){return t.right?Hr(`[${Dg(t.left)}-${Dg(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):Hr(Dg(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function Dg(t){return cf(t.value)}function Hr(t,e){var n;return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}const ff={__proto__:null,findAssignment:iE,findNameAssignment:wg,findNodeForKeyword:au,findNodeForProperty:rn,findNodesForKeyword:gg,findNodesForKeywordInternal:yg,findNodesForProperty:wo,getActionAtElement:oE,getActionType:cE,getAllReachableRules:pg,getCrossReferenceTerminal:hg,getEntryRule:lf,getExplicitRuleType:ps,getHiddenRules:tE,getRuleType:lE,getRuleTypeName:HN,getTypeName:uu,isArrayCardinality:aE,isArrayOperator:UN,isCommentTerminal:rE,isDataType:WN,isDataTypeRule:df,isOptionalCardinality:vo,terminalRegex:cu};function QN(t){const e=[],n=t.Grammar;for(const r of n.rules)Gr(r)&&rE(r)&&BN(cu(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:Km}}var dE=typeof global=="object"&&global&&global.Object===Object&&global,ZN=typeof self=="object"&&self&&self.Object===Object&&self,Cr=dE||ZN||Function("return this")(),Wn=Cr.Symbol,fE=Object.prototype,eO=fE.hasOwnProperty,tO=fE.toString,lu=Wn?Wn.toStringTag:void 0;function nO(t){var e=eO.call(t,lu),n=t[lu];try{t[lu]=void 0;var r=!0}catch{}var i=tO.call(t);return r&&(e?t[lu]=n:delete t[lu]),i}var rO=Object.prototype,iO=rO.toString;function sO(t){return iO.call(t)}var oO="[object Null]",aO="[object Undefined]",pE=Wn?Wn.toStringTag:void 0;function Si(t){return t==null?t===void 0?aO:oO:pE&&pE in Object(t)?nO(t):sO(t)}function sr(t){return t!=null&&typeof t=="object"}var uO="[object Symbol]";function du(t){return typeof t=="symbol"||sr(t)&&Si(t)==uO}function pf(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 We=Array.isArray,hE=Wn?Wn.prototype:void 0,mE=hE?hE.toString:void 0;function gE(t){if(typeof t=="string")return t;if(We(t))return pf(t,gE)+"";if(du(t))return mE?mE.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var cO=/\s/;function lO(t){for(var e=t.length;e--&&cO.test(t.charAt(e)););return e}var dO=/^\s+/;function fO(t){return t&&t.slice(0,lO(t)+1).replace(dO,"")}function Hn(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var yE=NaN,pO=/^[-+]0x[0-9a-f]+$/i,hO=/^0b[01]+$/i,mO=/^0o[0-7]+$/i,gO=parseInt;function yO(t){if(typeof t=="number")return t;if(du(t))return yE;if(Hn(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Hn(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=fO(t);var n=hO.test(t);return n||mO.test(t)?gO(t.slice(2),n?2:8):pO.test(t)?yE:+t}var wO=1/0,vO=17976931348623157e292;function bO(t){if(!t)return t===0?t:0;if(t=yO(t),t===wO||t===-1/0){var e=t<0?-1:1;return e*vO}return t===t?t:0}function hf(t){var e=bO(t),n=e%1;return e===e?n?e-n:e:0}function hs(t){return t}var DO="[object AsyncFunction]",EO="[object Function]",RO="[object GeneratorFunction]",$O="[object Proxy]";function Vr(t){if(!Hn(t))return!1;var e=Si(t);return e==EO||e==RO||e==DO||e==$O}var Eg=Cr["__core-js_shared__"],wE=function(){var t=/[^.]+$/.exec(Eg&&Eg.keys&&Eg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function TO(t){return!!wE&&wE in t}var SO=Function.prototype,kO=SO.toString;function ms(t){if(t!=null){try{return kO.call(t)}catch{}try{return t+""}catch{}}return""}var CO=/[\\^$.*+?()[\]{}|]/g,AO=/^\[object .+?Constructor\]$/,_O=Function.prototype,PO=Object.prototype,xO=_O.toString,IO=PO.hasOwnProperty,NO=RegExp("^"+xO.call(IO).replace(CO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function OO(t){if(!Hn(t)||TO(t))return!1;var e=Vr(t)?NO:AO;return e.test(ms(t))}function FO(t,e){return t?.[e]}function gs(t,e){var n=FO(t,e);return OO(n)?n:void 0}var Rg=gs(Cr,"WeakMap"),vE=Object.create,LO=function(){function t(){}return function(e){if(!Hn(e))return{};if(vE)return vE(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function MO(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 Lt(){}function BO(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var zO=800,qO=16,jO=Date.now;function GO(t){var e=0,n=0;return function(){var r=jO(),i=qO-(r-n);if(n=r,i>0){if(++e>=zO)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function UO(t){return function(){return t}}var mf=function(){try{var t=gs(Object,"defineProperty");return t({},"",{}),t}catch{}}(),WO=mf?function(t,e){return mf(t,"toString",{configurable:!0,enumerable:!1,value:UO(e),writable:!0})}:hs,HO=GO(WO);function bE(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function DE(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 VO(t){return t!==t}function KO(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function $g(t,e,n){return e===e?KO(t,e,n):DE(t,VO,n)}function EE(t,e){var n=t==null?0:t.length;return!!n&&$g(t,e,0)>-1}var YO=9007199254740991,XO=/^(?:0|[1-9]\d*)$/;function gf(t,e){var n=typeof t;return e=e??YO,!!e&&(n=="number"||n!="symbol"&&XO.test(t))&&t>-1&&t%1==0&&t<e}function Tg(t,e,n){e=="__proto__"&&mf?mf(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 JO=Object.prototype,QO=JO.hasOwnProperty;function yf(t,e,n){var r=t[e];(!(QO.call(t,e)&&fu(r,n))||n===void 0&&!(e in t))&&Tg(t,e,n)}function Sg(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?Tg(n,a,u):yf(n,a,u)}return n}var RE=Math.max;function ZO(t,e,n){return e=RE(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=RE(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),MO(t,this,a)}}function kg(t,e){return HO(ZO(t,e,hs),t+"")}var eF=9007199254740991;function Cg(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=eF}function Ar(t){return t!=null&&Cg(t.length)&&!Vr(t)}function $E(t,e,n){if(!Hn(n))return!1;var r=typeof e;return(r=="number"?Ar(n)&&gf(e,n.length):r=="string"&&e in n)?fu(n[e],t):!1}function tF(t){return kg(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&&$E(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 nF=Object.prototype;function pu(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||nF;return t===n}function rF(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var iF="[object Arguments]";function TE(t){return sr(t)&&Si(t)==iF}var SE=Object.prototype,sF=SE.hasOwnProperty,oF=SE.propertyIsEnumerable,wf=TE(function(){return arguments}())?TE:function(t){return sr(t)&&sF.call(t,"callee")&&!oF.call(t,"callee")};function aF(){return!1}var kE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,CE=kE&&typeof module=="object"&&module&&!module.nodeType&&module,uF=CE&&CE.exports===kE,AE=uF?Cr.Buffer:void 0,cF=AE?AE.isBuffer:void 0,hu=cF||aF,lF="[object Arguments]",dF="[object Array]",fF="[object Boolean]",pF="[object Date]",hF="[object Error]",mF="[object Function]",gF="[object Map]",yF="[object Number]",wF="[object Object]",vF="[object RegExp]",bF="[object Set]",DF="[object String]",EF="[object WeakMap]",RF="[object ArrayBuffer]",$F="[object DataView]",TF="[object Float32Array]",SF="[object Float64Array]",kF="[object Int8Array]",CF="[object Int16Array]",AF="[object Int32Array]",_F="[object Uint8Array]",PF="[object Uint8ClampedArray]",xF="[object Uint16Array]",IF="[object Uint32Array]",mt={};mt[TF]=mt[SF]=mt[kF]=mt[CF]=mt[AF]=mt[_F]=mt[PF]=mt[xF]=mt[IF]=!0,mt[lF]=mt[dF]=mt[RF]=mt[fF]=mt[$F]=mt[pF]=mt[hF]=mt[mF]=mt[gF]=mt[yF]=mt[wF]=mt[vF]=mt[bF]=mt[DF]=mt[EF]=!1;function NF(t){return sr(t)&&Cg(t.length)&&!!mt[Si(t)]}function vf(t){return function(e){return t(e)}}var _E=typeof exports=="object"&&exports&&!exports.nodeType&&exports,mu=_E&&typeof module=="object"&&module&&!module.nodeType&&module,OF=mu&&mu.exports===_E,Ag=OF&&dE.process,ki=function(){try{var t=mu&&mu.require&&mu.require("util").types;return t||Ag&&Ag.binding&&Ag.binding("util")}catch{}}(),PE=ki&&ki.isTypedArray,_g=PE?vf(PE):NF,FF=Object.prototype,LF=FF.hasOwnProperty;function xE(t,e){var n=We(t),r=!n&&wf(t),i=!n&&!r&&hu(t),s=!n&&!r&&!i&&_g(t),o=n||r||i||s,a=o?rF(t.length,String):[],u=a.length;for(var c in t)(e||LF.call(t,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||gf(c,u)))&&a.push(c);return a}function IE(t,e){return function(n){return t(e(n))}}var MF=IE(Object.keys,Object),BF=Object.prototype,zF=BF.hasOwnProperty;function NE(t){if(!pu(t))return MF(t);var e=[];for(var n in Object(t))zF.call(t,n)&&n!="constructor"&&e.push(n);return e}function Vn(t){return Ar(t)?xE(t):NE(t)}var qF=Object.prototype,jF=qF.hasOwnProperty,xn=tF(function(t,e){if(pu(e)||Ar(e)){Sg(e,Vn(e),t);return}for(var n in e)jF.call(e,n)&&yf(t,n,e[n])});function GF(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var UF=Object.prototype,WF=UF.hasOwnProperty;function HF(t){if(!Hn(t))return GF(t);var e=pu(t),n=[];for(var r in t)r=="constructor"&&(e||!WF.call(t,r))||n.push(r);return n}function OE(t){return Ar(t)?xE(t,!0):HF(t)}var VF=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,KF=/^\w*$/;function Pg(t,e){if(We(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||du(t)?!0:KF.test(t)||!VF.test(t)||e!=null&&t in Object(e)}var gu=gs(Object,"create");function YF(){this.__data__=gu?gu(null):{},this.size=0}function XF(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var JF="__lodash_hash_undefined__",QF=Object.prototype,ZF=QF.hasOwnProperty;function eL(t){var e=this.__data__;if(gu){var n=e[t];return n===JF?void 0:n}return ZF.call(e,t)?e[t]:void 0}var tL=Object.prototype,nL=tL.hasOwnProperty;function rL(t){var e=this.__data__;return gu?e[t]!==void 0:nL.call(e,t)}var iL="__lodash_hash_undefined__";function sL(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=gu&&e===void 0?iL:e,this}function ys(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])}}ys.prototype.clear=YF,ys.prototype.delete=XF,ys.prototype.get=eL,ys.prototype.has=rL,ys.prototype.set=sL;function oL(){this.__data__=[],this.size=0}function bf(t,e){for(var n=t.length;n--;)if(fu(t[n][0],e))return n;return-1}var aL=Array.prototype,uL=aL.splice;function cL(t){var e=this.__data__,n=bf(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():uL.call(e,n,1),--this.size,!0}function lL(t){var e=this.__data__,n=bf(e,t);return n<0?void 0:e[n][1]}function dL(t){return bf(this.__data__,t)>-1}function fL(t,e){var n=this.__data__,r=bf(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Kr(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])}}Kr.prototype.clear=oL,Kr.prototype.delete=cL,Kr.prototype.get=lL,Kr.prototype.has=dL,Kr.prototype.set=fL;var yu=gs(Cr,"Map");function pL(){this.size=0,this.__data__={hash:new ys,map:new(yu||Kr),string:new ys}}function hL(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Df(t,e){var n=t.__data__;return hL(e)?n[typeof e=="string"?"string":"hash"]:n.map}function mL(t){var e=Df(this,t).delete(t);return this.size-=e?1:0,e}function gL(t){return Df(this,t).get(t)}function yL(t){return Df(this,t).has(t)}function wL(t,e){var n=Df(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function Yr(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])}}Yr.prototype.clear=pL,Yr.prototype.delete=mL,Yr.prototype.get=gL,Yr.prototype.has=yL,Yr.prototype.set=wL;var vL="Expected a function";function xg(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(vL);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(xg.Cache||Yr),n}xg.Cache=Yr;var bL=500;function DL(t){var e=xg(t,function(r){return n.size===bL&&n.clear(),r}),n=e.cache;return e}var EL=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,RL=/\\(\\)?/g,$L=DL(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(EL,function(n,r,i,s){e.push(i?s.replace(RL,"$1"):r||n)}),e});function TL(t){return t==null?"":gE(t)}function Ef(t,e){return We(t)?t:Pg(t,e)?[t]:$L(TL(t))}function wu(t){if(typeof t=="string"||du(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Ig(t,e){e=Ef(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 SL(t,e,n){var r=t==null?void 0:Ig(t,e);return r===void 0?n:r}function Ng(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var FE=Wn?Wn.isConcatSpreadable:void 0;function kL(t){return We(t)||wf(t)||!!(FE&&t&&t[FE])}function Og(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=kL),i||(i=[]);++s<o;){var a=t[s];n(a)?Ng(i,a):r||(i[i.length]=a)}return i}function Kn(t){var e=t==null?0:t.length;return e?Og(t):[]}var LE=IE(Object.getPrototypeOf,Object);function ME(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 CL(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 AL(){this.__data__=new Kr,this.size=0}function _L(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function PL(t){return this.__data__.get(t)}function xL(t){return this.__data__.has(t)}var IL=200;function NL(t,e){var n=this.__data__;if(n instanceof Kr){var r=n.__data__;if(!yu||r.length<IL-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Yr(r)}return n.set(t,e),this.size=n.size,this}function _r(t){var e=this.__data__=new Kr(t);this.size=e.size}_r.prototype.clear=AL,_r.prototype.delete=_L,_r.prototype.get=PL,_r.prototype.has=xL,_r.prototype.set=NL;function OL(t,e){return t&&Sg(e,Vn(e),t)}var BE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zE=BE&&typeof module=="object"&&module&&!module.nodeType&&module,FL=zE&&zE.exports===BE,qE=FL?Cr.Buffer:void 0,jE=qE?qE.allocUnsafe:void 0;function LL(t,e){var n=t.length,r=jE?jE(n):new t.constructor(n);return t.copy(r),r}function Fg(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 GE(){return[]}var ML=Object.prototype,BL=ML.propertyIsEnumerable,UE=Object.getOwnPropertySymbols,Lg=UE?function(t){return t==null?[]:(t=Object(t),Fg(UE(t),function(e){return BL.call(t,e)}))}:GE;function zL(t,e){return Sg(t,Lg(t),e)}var qL=Object.getOwnPropertySymbols,jL=qL?function(t){for(var e=[];t;)Ng(e,Lg(t)),t=LE(t);return e}:GE;function WE(t,e,n){var r=e(t);return We(t)?r:Ng(r,n(t))}function Mg(t){return WE(t,Vn,Lg)}function GL(t){return WE(t,OE,jL)}var Bg=gs(Cr,"DataView"),zg=gs(Cr,"Promise"),Do=gs(Cr,"Set"),HE="[object Map]",UL="[object Object]",VE="[object Promise]",KE="[object Set]",YE="[object WeakMap]",XE="[object DataView]",WL=ms(Bg),HL=ms(yu),VL=ms(zg),KL=ms(Do),YL=ms(Rg),Yn=Si;(Bg&&Yn(new Bg(new ArrayBuffer(1)))!=XE||yu&&Yn(new yu)!=HE||zg&&Yn(zg.resolve())!=VE||Do&&Yn(new Do)!=KE||Rg&&Yn(new Rg)!=YE)&&(Yn=function(t){var e=Si(t),n=e==UL?t.constructor:void 0,r=n?ms(n):"";if(r)switch(r){case WL:return XE;case HL:return HE;case VL:return VE;case KL:return KE;case YL:return YE}return e});var XL=Object.prototype,JL=XL.hasOwnProperty;function QL(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&JL.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Rf=Cr.Uint8Array;function ZL(t){var e=new t.constructor(t.byteLength);return new Rf(e).set(new Rf(t)),e}function eM(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var tM=/\w*$/;function nM(t){var e=new t.constructor(t.source,tM.exec(t));return e.lastIndex=t.lastIndex,e}var JE=Wn?Wn.prototype:void 0,QE=JE?JE.valueOf:void 0;function rM(t){return QE?Object(QE.call(t)):{}}function iM(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var sM="[object Boolean]",oM="[object Date]",aM="[object Map]",uM="[object Number]",cM="[object RegExp]",lM="[object Set]",dM="[object String]",fM="[object Symbol]",pM="[object ArrayBuffer]",hM="[object DataView]",mM="[object Float32Array]",gM="[object Float64Array]",yM="[object Int8Array]",wM="[object Int16Array]",vM="[object Int32Array]",bM="[object Uint8Array]",DM="[object Uint8ClampedArray]",EM="[object Uint16Array]",RM="[object Uint32Array]";function $M(t,e,n){var r=t.constructor;switch(e){case pM:return ZL(t);case sM:case oM:return new r(+t);case hM:return eM(t);case mM:case gM:case yM:case wM:case vM:case bM:case DM:case EM:case RM:return iM(t);case aM:return new r;case uM:case dM:return new r(t);case cM:return nM(t);case lM:return new r;case fM:return rM(t)}}function TM(t){return typeof t.constructor=="function"&&!pu(t)?LO(LE(t)):{}}var SM="[object Map]";function kM(t){return sr(t)&&Yn(t)==SM}var ZE=ki&&ki.isMap,CM=ZE?vf(ZE):kM,AM="[object Set]";function _M(t){return sr(t)&&Yn(t)==AM}var eR=ki&&ki.isSet,PM=eR?vf(eR):_M,tR="[object Arguments]",xM="[object Array]",IM="[object Boolean]",NM="[object Date]",OM="[object Error]",nR="[object Function]",FM="[object GeneratorFunction]",LM="[object Map]",MM="[object Number]",rR="[object Object]",BM="[object RegExp]",zM="[object Set]",qM="[object String]",jM="[object Symbol]",GM="[object WeakMap]",UM="[object ArrayBuffer]",WM="[object DataView]",HM="[object Float32Array]",VM="[object Float64Array]",KM="[object Int8Array]",YM="[object Int16Array]",XM="[object Int32Array]",JM="[object Uint8Array]",QM="[object Uint8ClampedArray]",ZM="[object Uint16Array]",e2="[object Uint32Array]",lt={};lt[tR]=lt[xM]=lt[UM]=lt[WM]=lt[IM]=lt[NM]=lt[HM]=lt[VM]=lt[KM]=lt[YM]=lt[XM]=lt[LM]=lt[MM]=lt[rR]=lt[BM]=lt[zM]=lt[qM]=lt[jM]=lt[JM]=lt[QM]=lt[ZM]=lt[e2]=!0,lt[OM]=lt[nR]=lt[GM]=!1;function $f(t,e,n,r,i,s){var o;if(o!==void 0)return o;if(!Hn(t))return t;var a=We(t);if(a)return o=QL(t),BO(t,o);var u=Yn(t),c=u==nR||u==FM;if(hu(t))return LL(t);if(u==rR||u==tR||c&&!i)return o=c?{}:TM(t),zL(t,OL(o,t));if(!lt[u])return i?t:{};o=$M(t,u),s||(s=new _r);var l=s.get(t);if(l)return l;s.set(t,o),PM(t)?t.forEach(function(p){o.add($f(p,e,n,p,t,s))}):CM(t)&&t.forEach(function(p,h){o.set(h,$f(p,e,n,h,t,s))});var d=Mg,f=a?void 0:d(t);return bE(f||t,function(p,h){f&&(h=p,p=t[h]),yf(o,h,$f(p,e,n,h,t,s))}),o}var t2=4;function Ht(t){return $f(t,t2)}function vu(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 n2="__lodash_hash_undefined__";function r2(t){return this.__data__.set(t,n2),this}function i2(t){return this.__data__.has(t)}function Eo(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Yr;++e<n;)this.add(t[e])}Eo.prototype.add=Eo.prototype.push=r2,Eo.prototype.has=i2;function iR(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 qg(t,e){return t.has(e)}var s2=1,o2=2;function sR(t,e,n,r,i,s){var o=n&s2,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 d=-1,f=!0,p=n&o2?new Eo:void 0;for(s.set(t,e),s.set(e,t);++d<a;){var h=t[d],w=e[d];if(r)var D=o?r(w,h,d,e,t,s):r(h,w,d,t,e,s);if(D!==void 0){if(D)continue;f=!1;break}if(p){if(!iR(e,function(g,v){if(!qg(p,v)&&(h===g||i(h,g,n,r,s)))return p.push(v)})){f=!1;break}}else if(!(h===w||i(h,w,n,r,s))){f=!1;break}}return s.delete(t),s.delete(e),f}function a2(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function jg(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var u2=1,c2=2,l2="[object Boolean]",d2="[object Date]",f2="[object Error]",p2="[object Map]",h2="[object Number]",m2="[object RegExp]",g2="[object Set]",y2="[object String]",w2="[object Symbol]",v2="[object ArrayBuffer]",b2="[object DataView]",oR=Wn?Wn.prototype:void 0,Gg=oR?oR.valueOf:void 0;function D2(t,e,n,r,i,s,o){switch(n){case b2:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case v2:return!(t.byteLength!=e.byteLength||!s(new Rf(t),new Rf(e)));case l2:case d2:case h2:return fu(+t,+e);case f2:return t.name==e.name&&t.message==e.message;case m2:case y2:return t==e+"";case p2:var a=a2;case g2:var u=r&u2;if(a||(a=jg),t.size!=e.size&&!u)return!1;var c=o.get(t);if(c)return c==e;r|=c2,o.set(t,e);var l=sR(a(t),a(e),r,i,s,o);return o.delete(t),l;case w2:if(Gg)return Gg.call(t)==Gg.call(e)}return!1}var E2=1,R2=Object.prototype,$2=R2.hasOwnProperty;function T2(t,e,n,r,i,s){var o=n&E2,a=Mg(t),u=a.length,c=Mg(e),l=c.length;if(u!=l&&!o)return!1;for(var d=u;d--;){var f=a[d];if(!(o?f in e:$2.call(e,f)))return!1}var p=s.get(t),h=s.get(e);if(p&&h)return p==e&&h==t;var w=!0;s.set(t,e),s.set(e,t);for(var D=o;++d<u;){f=a[d];var g=t[f],v=e[f];if(r)var E=o?r(v,g,f,e,t,s):r(g,v,f,t,e,s);if(!(E===void 0?g===v||i(g,v,n,r,s):E)){w=!1;break}D||(D=f=="constructor")}if(w&&!D){var k=t.constructor,P=e.constructor;k!=P&&"constructor"in t&&"constructor"in e&&!(typeof k=="function"&&k instanceof k&&typeof P=="function"&&P instanceof P)&&(w=!1)}return s.delete(t),s.delete(e),w}var S2=1,aR="[object Arguments]",uR="[object Array]",Tf="[object Object]",k2=Object.prototype,cR=k2.hasOwnProperty;function C2(t,e,n,r,i,s){var o=We(t),a=We(e),u=o?uR:Yn(t),c=a?uR:Yn(e);u=u==aR?Tf:u,c=c==aR?Tf:c;var l=u==Tf,d=c==Tf,f=u==c;if(f&&hu(t)){if(!hu(e))return!1;o=!0,l=!1}if(f&&!l)return s||(s=new _r),o||_g(t)?sR(t,e,n,r,i,s):D2(t,e,u,n,r,i,s);if(!(n&S2)){var p=l&&cR.call(t,"__wrapped__"),h=d&&cR.call(e,"__wrapped__");if(p||h){var w=p?t.value():t,D=h?e.value():e;return s||(s=new _r),i(w,D,n,r,s)}}return f?(s||(s=new _r),T2(t,e,n,r,i,s)):!1}function Ug(t,e,n,r,i){return t===e?!0:t==null||e==null||!sr(t)&&!sr(e)?t!==t&&e!==e:C2(t,e,n,r,Ug,i)}var A2=1,_2=2;function P2(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];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 _r,d;if(!(d===void 0?Ug(c,u,A2|_2,r,l):d))return!1}}return!0}function lR(t){return t===t&&!Hn(t)}function x2(t){for(var e=Vn(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,lR(i)]}return e}function dR(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function I2(t){var e=x2(t);return e.length==1&&e[0][2]?dR(e[0][0],e[0][1]):function(n){return n===t||P2(n,t,e)}}function N2(t,e){return t!=null&&e in Object(t)}function fR(t,e,n){e=Ef(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&&Cg(i)&&gf(o,i)&&(We(t)||wf(t)))}function O2(t,e){return t!=null&&fR(t,e,N2)}var F2=1,L2=2;function M2(t,e){return Pg(t)&&lR(e)?dR(wu(t),e):function(n){var r=SL(n,t);return r===void 0&&r===e?O2(n,t):Ug(e,r,F2|L2)}}function B2(t){return function(e){return e?.[t]}}function z2(t){return function(e){return Ig(e,t)}}function q2(t){return Pg(t)?B2(wu(t)):z2(t)}function or(t){return typeof t=="function"?t:t==null?hs:typeof t=="object"?We(t)?M2(t[0],t[1]):I2(t):q2(t)}function j2(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 G2(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 U2=G2();function W2(t,e){return t&&U2(t,e,Vn)}function H2(t,e){return function(n,r){if(n==null)return n;if(!Ar(n))return t(n,r);for(var i=n.length,s=-1,o=Object(n);++s<i&&r(o[s],s,o)!==!1;);return n}}var ws=H2(W2);function V2(t,e,n,r){return ws(t,function(i,s,o){e(r,i,n(i),o)}),r}function K2(t,e){return function(n,r){var i=We(n)?j2:V2,s=e?e():{};return i(n,t,or(r),s)}}var pR=Object.prototype,Y2=pR.hasOwnProperty,Wg=kg(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&$E(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],o=OE(s),a=-1,u=o.length;++a<u;){var c=o[a],l=t[c];(l===void 0||fu(l,pR[c])&&!Y2.call(t,c))&&(t[c]=s[c])}return t});function hR(t){return sr(t)&&Ar(t)}var X2=200;function J2(t,e,n,r){var i=-1,s=EE,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;e.length>=X2&&(s=qg,o=!1,e=new Eo(e));e:for(;++i<a;){var l=t[i],d=l;if(l=l!==0?l:0,o&&d===d){for(var f=c;f--;)if(e[f]===d)continue e;u.push(l)}else s(e,d,r)||u.push(l)}return u}var Sf=kg(function(t,e){return hR(t)?J2(t,Og(e,1,hR,!0)):[]});function Ro(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function Vt(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:hf(e),ME(t,e<0?0:e,r)):[]}function bu(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:hf(e),e=r-e,ME(t,0,e<0?0:e)):[]}function Q2(t){return typeof t=="function"?t:hs}function Re(t,e){var n=We(t)?bE:ws;return n(t,Q2(e))}function Z2(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 eB(t,e){var n=!0;return ws(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function ar(t,e,n){var r=We(t)?Z2:eB;return r(t,or(e))}function mR(t,e){var n=[];return ws(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function In(t,e){var n=We(t)?Fg:mR;return n(t,or(e))}function tB(t){return function(e,n,r){var i=Object(e);if(!Ar(e)){var s=or(n);e=Vn(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 nB=Math.max;function rB(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:hf(n);return i<0&&(i=nB(r+i,0)),DE(t,or(e),i)}var $o=tB(rB);function ur(t){return t&&t.length?t[0]:void 0}function iB(t,e){var n=-1,r=Ar(t)?Array(t.length):[];return ws(t,function(i,s,o){r[++n]=e(i,s,o)}),r}function he(t,e){var n=We(t)?pf:iB;return n(t,or(e))}function Nn(t,e){return Og(he(t,e))}var sB=Object.prototype,oB=sB.hasOwnProperty,aB=K2(function(t,e,n){oB.call(t,n)?t[n].push(e):Tg(t,n,[e])}),uB=Object.prototype,cB=uB.hasOwnProperty;function lB(t,e){return t!=null&&cB.call(t,e)}function $e(t,e){return t!=null&&fR(t,e,lB)}var dB="[object String]";function Tn(t){return typeof t=="string"||!We(t)&&sr(t)&&Si(t)==dB}function fB(t,e){return pf(e,function(n){return t[n]})}function Mt(t){return t==null?[]:fB(t,Vn(t))}var pB=Math.max;function fn(t,e,n,r){t=Ar(t)?t:Mt(t),n=n?hf(n):0;var i=t.length;return n<0&&(n=pB(i+n,0)),Tn(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&$g(t,e,n)>-1}function gR(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return $g(t,e,i)}var hB="[object Map]",mB="[object Set]",gB=Object.prototype,yB=gB.hasOwnProperty;function ot(t){if(t==null)return!0;if(Ar(t)&&(We(t)||typeof t=="string"||typeof t.splice=="function"||hu(t)||_g(t)||wf(t)))return!t.length;var e=Yn(t);if(e==hB||e==mB)return!t.size;if(pu(t))return!NE(t).length;for(var n in t)if(yB.call(t,n))return!1;return!0}var wB="[object RegExp]";function vB(t){return sr(t)&&Si(t)==wB}var yR=ki&&ki.isRegExp,Xr=yR?vf(yR):vB;function Jr(t){return t===void 0}function bB(t,e){return t<e}function DB(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&&!du(o):n(o,a)))var a=o,u=s}return u}function EB(t){return t&&t.length?DB(t,hs,bB):void 0}var RB="Expected a function";function $B(t){if(typeof t!="function")throw new TypeError(RB);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 TB(t,e,n,r){if(!Hn(t))return t;e=Ef(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];c=void 0,c===void 0&&(c=Hn(l)?l:gf(e[i+1])?[]:{})}yf(a,u,c),a=a[u]}return t}function SB(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=Ig(t,o);n(a,o)&&TB(s,Ef(o,t),a)}return s}function cr(t,e){if(t==null)return{};var n=pf(GL(t),function(r){return[r]});return e=or(e),SB(t,n,function(r,i){return e(r,i[0])})}function kB(t,e,n,r,i){return i(t,function(s,o,a){n=r?(r=!1,s):e(n,s,o,a)}),n}function pn(t,e,n){var r=We(t)?CL:kB,i=arguments.length<3;return r(t,or(e),n,i,ws)}function kf(t,e){var n=We(t)?Fg:mR;return n(t,$B(or(e)))}function CB(t,e){var n;return ws(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function wR(t,e,n){var r=We(t)?iR:CB;return r(t,or(e))}var AB=1/0,_B=Do&&1/jg(new Do([,-0]))[1]==AB?function(t){return new Do(t)}:Lt,PB=200;function vR(t,e,n){var r=-1,i=EE,s=t.length,o=!0,a=[],u=a;if(s>=PB){var c=e?null:_B(t);if(c)return jg(c);o=!1,i=qg,u=new Eo}else u=e?[]:a;e:for(;++r<s;){var l=t[r],d=e?e(l):l;if(l=l!==0?l:0,o&&d===d){for(var f=u.length;f--;)if(u[f]===d)continue e;e&&u.push(d),a.push(l)}else i(u,d,n)||(u!==a&&u.push(d),a.push(l))}return a}function Hg(t){return t&&t.length?vR(t):[]}function xB(t,e){return t&&t.length?vR(t,or(e)):[]}function Vg(t){console&&console.error&&console.error(`Error: ${t}`)}function bR(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function DR(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function ER(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function IB(t){return NB(t)?t.LABEL:t.name}function NB(t){return Tn(t.LABEL)&&t.LABEL!==""}class Pr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),Re(this.definition,n=>{n.accept(e)})}}class hn extends Pr{constructor(e){super([]),this.idx=1,xn(this,cr(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class To extends Pr{constructor(e){super(e.definition),this.orgText="",xn(this,cr(e,n=>n!==void 0))}}class Sn extends Pr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,xn(this,cr(e,n=>n!==void 0))}}class Kt extends Pr{constructor(e){super(e.definition),this.idx=1,xn(this,cr(e,n=>n!==void 0))}}class On extends Pr{constructor(e){super(e.definition),this.idx=1,xn(this,cr(e,n=>n!==void 0))}}class Fn extends Pr{constructor(e){super(e.definition),this.idx=1,xn(this,cr(e,n=>n!==void 0))}}class Tt extends Pr{constructor(e){super(e.definition),this.idx=1,xn(this,cr(e,n=>n!==void 0))}}class kn extends Pr{constructor(e){super(e.definition),this.idx=1,xn(this,cr(e,n=>n!==void 0))}}class Cn extends Pr{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,xn(this,cr(e,n=>n!==void 0))}}class gt{constructor(e){this.idx=1,xn(this,cr(e,n=>n!==void 0))}accept(e){e.visit(this)}}function OB(t){return he(t,Cf)}function Cf(t){function e(n){return he(n,Cf)}if(t instanceof hn){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return Tn(t.label)&&(n.label=t.label),n}else{if(t instanceof Sn)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Kt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof On)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Fn)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Cf(new gt({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof kn)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Cf(new gt({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Tt)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Cn)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof gt){const n={type:"Terminal",name:t.terminalType.name,label:IB(t.terminalType),idx:t.idx};Tn(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Xr(r)?r.source:r),n}else{if(t instanceof To)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class So{visit(e){const n=e;switch(n.constructor){case hn:return this.visitNonTerminal(n);case Sn:return this.visitAlternative(n);case Kt:return this.visitOption(n);case On:return this.visitRepetitionMandatory(n);case Fn:return this.visitRepetitionMandatoryWithSeparator(n);case kn:return this.visitRepetitionWithSeparator(n);case Tt:return this.visitRepetition(n);case Cn:return this.visitAlternation(n);case gt:return this.visitTerminal(n);case To: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 FB(t){return t instanceof Sn||t instanceof Kt||t instanceof Tt||t instanceof On||t instanceof Fn||t instanceof kn||t instanceof gt||t instanceof To}function Af(t,e=[]){return t instanceof Kt||t instanceof Tt||t instanceof kn?!0:t instanceof Cn?wR(t.definition,r=>Af(r,e)):t instanceof hn&&fn(e,t)?!1:t instanceof Pr?(t instanceof hn&&e.push(t),ar(t.definition,r=>Af(r,e))):!1}function LB(t){return t instanceof Cn}function xr(t){if(t instanceof hn)return"SUBRULE";if(t instanceof Kt)return"OPTION";if(t instanceof Cn)return"OR";if(t instanceof On)return"AT_LEAST_ONE";if(t instanceof Fn)return"AT_LEAST_ONE_SEP";if(t instanceof kn)return"MANY_SEP";if(t instanceof Tt)return"MANY";if(t instanceof gt)return"CONSUME";throw Error("non exhaustive match")}class _f{walk(e,n=[]){Re(e.definition,(r,i)=>{const s=Vt(e.definition,i+1);if(r instanceof hn)this.walkProdRef(r,s,n);else if(r instanceof gt)this.walkTerminal(r,s,n);else if(r instanceof Sn)this.walkFlat(r,s,n);else if(r instanceof Kt)this.walkOption(r,s,n);else if(r instanceof On)this.walkAtLeastOne(r,s,n);else if(r instanceof Fn)this.walkAtLeastOneSep(r,s,n);else if(r instanceof kn)this.walkManySep(r,s,n);else if(r instanceof Tt)this.walkMany(r,s,n);else if(r instanceof Cn)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 Kt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=RR(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new Kt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=RR(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);Re(e.definition,s=>{const o=new Sn({definition:[s]});this.walk(o,i)})}}function RR(t,e,n){return[new Kt({definition:[new gt({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function Du(t){if(t instanceof hn)return Du(t.referencedRule);if(t instanceof gt)return zB(t);if(FB(t))return MB(t);if(LB(t))return BB(t);throw Error("non exhaustive match")}function MB(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,o=!0;for(;i&&o;)s=n[r],o=Af(s),e=e.concat(Du(s)),r=r+1,i=n.length>r;return Hg(e)}function BB(t){const e=he(t.definition,n=>Du(n));return Hg(Kn(e))}function zB(t){return[t.terminalType]}const $R="_~IN~_";class qB extends _f{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=GB(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),o=new Sn({definition:s}),a=Du(o);this.follows[i]=a}}function jB(t){const e={};return Re(t,n=>{const r=new qB(n).startWalking();xn(e,r)}),e}function GB(t,e){return t.name+e+$R}let Pf={};const UB=new ZD;function xf(t){const e=t.toString();if(Pf.hasOwnProperty(e))return Pf[e];{const n=UB.pattern(e);return Pf[e]=n,n}}function WB(){Pf={}}const TR="Complement Sets are not supported for first char optimization",If=`Unable to use "first char" lexer optimizations:
13
+ `;function HB(t,e=!1){try{const n=xf(t);return Kg(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===TR)e&&bR(`${If} Unable to optimize: < ${t.toString()} >
14
+ Complement Sets cannot be automatically optimized.
15
+ This will disable the lexer's first char optimizations.
16
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
17
+ This will disable the lexer's first char optimizations.
18
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Vg(`${If}
19
+ Failed parsing: < ${t.toString()} >
20
+ Using the @chevrotain/regexp-to-ast library
21
+ Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Kg(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Kg(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":Nf(o.value,e,n);break;case"Set":if(o.complement===!0)throw Error(TR);Re(o.value,u=>{if(typeof u=="number")Nf(u,e,n);else{const c=u;if(n===!0)for(let l=c.from;l<=c.to;l++)Nf(l,e,n);else{for(let l=c.from;l<=c.to&&l<Ru;l++)Nf(l,e,n);if(c.to>=Ru){const l=c.from>=Ru?c.from:Ru,d=c.to,f=Ci(l),p=Ci(d);for(let h=f;h<=p;h++)e[h]=h}}}});break;case"Group":Kg(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"&&Yg(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Mt(e)}function Nf(t,e,n){const r=Ci(t);e[r]=r,n===!0&&VB(t,e)}function VB(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=Ci(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=Ci(i.charCodeAt(0));e[s]=s}}}function SR(t,e){return $o(t.value,n=>{if(typeof n=="number")return fn(e,n);{const r=n;return $o(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Yg(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?We(t.value)?ar(t.value,Yg):Yg(t.value):!1}class KB extends uf{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){fn(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?SR(e,this.targetCharCodes)===void 0&&(this.found=!0):SR(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Xg(t,e){if(e instanceof RegExp){const n=xf(e),r=new KB(t);return r.visit(n),r.found}else return $o(e,n=>fn(t,n.charCodeAt(0)))!==void 0}const vs="PATTERN",Eu="defaultMode",Of="modes";let kR=typeof new RegExp("(?:)").sticky=="boolean";function YB(t,e){e=Wg(e,{useSticky:kR,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
22
+ `],tracer:(v,E)=>E()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{wz()});let r;n("Reject Lexer.NA",()=>{r=kf(t,v=>v[vs]===An.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=he(r,v=>{const E=v[vs];if(Xr(E)){const k=E.source;return k.length===1&&k!=="^"&&k!=="$"&&k!=="."&&!E.ignoreCase?k:k.length===2&&k[0]==="\\"&&!fn(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],k[1])?k[1]:e.useSticky?AR(E):CR(E)}else{if(Vr(E))return i=!0,{exec:E};if(typeof E=="object")return i=!0,E;if(typeof E=="string"){if(E.length===1)return E;{const k=E.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),P=new RegExp(k);return e.useSticky?AR(P):CR(P)}}else throw Error("non exhaustive match")}})});let o,a,u,c,l;n("misc mapping",()=>{o=he(r,v=>v.tokenTypeIdx),a=he(r,v=>{const E=v.GROUP;if(E!==An.SKIPPED){if(Tn(E))return E;if(Jr(E))return!1;throw Error("non exhaustive match")}}),u=he(r,v=>{const E=v.LONGER_ALT;if(E)return We(E)?he(E,P=>gR(r,P)):[gR(r,E)]}),c=he(r,v=>v.PUSH_MODE),l=he(r,v=>$e(v,"POP_MODE"))});let d;n("Line Terminator Handling",()=>{const v=xR(e.lineTerminatorCharacters);d=he(r,E=>!1),e.positionTracking!=="onlyOffset"&&(d=he(r,E=>$e(E,"LINE_BREAKS")?!!E.LINE_BREAKS:PR(E,v)===!1&&Xg(v,E.PATTERN)))});let f,p,h,w;n("Misc Mapping #2",()=>{f=he(r,_R),p=he(s,mz),h=pn(r,(v,E)=>{const k=E.GROUP;return Tn(k)&&k!==An.SKIPPED&&(v[k]=[]),v},{}),w=he(s,(v,E)=>({pattern:s[E],longerAlt:u[E],canLineTerminator:d[E],isCustom:f[E],short:p[E],group:a[E],push:c[E],pop:l[E],tokenTypeIdx:o[E],tokenType:r[E]}))});let D=!0,g=[];return e.safeMode||n("First Char Optimization",()=>{g=pn(r,(v,E,k)=>{if(typeof E.PATTERN=="string"){const P=E.PATTERN.charCodeAt(0),G=Ci(P);Jg(v,G,w[k])}else if(We(E.START_CHARS_HINT)){let P;Re(E.START_CHARS_HINT,G=>{const W=typeof G=="string"?G.charCodeAt(0):G,Z=Ci(W);P!==Z&&(P=Z,Jg(v,Z,w[k]))})}else if(Xr(E.PATTERN))if(E.PATTERN.unicode)D=!1,e.ensureOptimizations&&Vg(`${If} Unable to analyze < ${E.PATTERN.toString()} > pattern.
23
+ The regexp unicode flag is not currently supported by the regexp-to-ast library.
24
+ This will disable the lexer's first char optimizations.
25
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const P=HB(E.PATTERN,e.ensureOptimizations);ot(P)&&(D=!1),Re(P,G=>{Jg(v,G,w[k])})}else e.ensureOptimizations&&Vg(`${If} TokenType: <${E.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
26
+ This will disable the lexer's first char optimizations.
27
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),D=!1;return v},[])}),{emptyGroups:h,patternIdxToConfig:w,charCodeToPatternIdxToConfig:g,hasCustom:i,canBeOptimized:D}}function XB(t,e){let n=[];const r=QB(t);n=n.concat(r.errors);const i=ZB(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(JB(s)),n=n.concat(az(s)),n=n.concat(uz(s,e)),n=n.concat(cz(s)),n}function JB(t){let e=[];const n=In(t,r=>Xr(r[vs]));return e=e.concat(tz(n)),e=e.concat(iz(n)),e=e.concat(sz(n)),e=e.concat(oz(n)),e=e.concat(nz(n)),e}function QB(t){const e=In(t,i=>!$e(i,vs)),n=he(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:St.MISSING_PATTERN,tokenTypes:[i]})),r=Sf(t,e);return{errors:n,valid:r}}function ZB(t){const e=In(t,i=>{const s=i[vs];return!Xr(s)&&!Vr(s)&&!$e(s,"exec")&&!Tn(s)}),n=he(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:St.INVALID_PATTERN,tokenTypes:[i]})),r=Sf(t,e);return{errors:n,valid:r}}const ez=/[^\\][$]/;function tz(t){class e extends uf{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=In(t,i=>{const s=i.PATTERN;try{const o=xf(s),a=new e;return a.visit(o),a.found}catch{return ez.test(s.source)}});return he(n,i=>({message:`Unexpected RegExp Anchor Error:
28
+ Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
29
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:St.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function nz(t){const e=In(t,r=>r.PATTERN.test(""));return he(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:St.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const rz=/[^\\[][\^]|^\^/;function iz(t){class e extends uf{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=In(t,i=>{const s=i.PATTERN;try{const o=xf(s),a=new e;return a.visit(o),a.found}catch{return rz.test(s.source)}});return he(n,i=>({message:`Unexpected RegExp Anchor Error:
30
+ Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
31
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:St.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function sz(t){const e=In(t,r=>{const i=r[vs];return i instanceof RegExp&&(i.multiline||i.global)});return he(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:St.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function oz(t){const e=[];let n=he(t,s=>pn(t,(o,a)=>(s.PATTERN.source===a.PATTERN.source&&!fn(e,a)&&a.PATTERN!==An.NA&&(e.push(a),o.push(a)),o),[]));n=vu(n);const r=In(n,s=>s.length>1);return he(r,s=>{const o=he(s,u=>u.name);return{message:`The same RegExp pattern ->${ur(s).PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:St.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function az(t){const e=In(t,r=>{if(!$e(r,"GROUP"))return!1;const i=r.GROUP;return i!==An.SKIPPED&&i!==An.NA&&!Tn(i)});return he(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:St.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function uz(t,e){const n=In(t,i=>i.PUSH_MODE!==void 0&&!fn(e,i.PUSH_MODE));return he(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:St.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function cz(t){const e=[],n=pn(t,(r,i,s)=>{const o=i.PATTERN;return o===An.NA||(Tn(o)?r.push({str:o,idx:s,tokenType:i}):Xr(o)&&dz(o)&&r.push({str:o.source,idx:s,tokenType:i})),r},[]);return Re(t,(r,i)=>{Re(n,({str:s,idx:o,tokenType:a})=>{if(i<o&&lz(s,r.PATTERN)){const u=`Token: ->${a.name}<- can never be matched.
32
+ Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
33
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:u,type:St.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),e}function lz(t,e){if(Xr(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(Vr(e))return e(t,0,[],{});if($e(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function dz(t){return $o([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function CR(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function AR(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function fz(t,e,n){const r=[];return $e(t,Eu)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Eu+`> property in its definition
34
+ `,type:St.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),$e(t,Of)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Of+`> property in its definition
35
+ `,type:St.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),$e(t,Of)&&$e(t,Eu)&&!$e(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Eu}: <${t.defaultMode}>which does not exist
36
+ `,type:St.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),$e(t,Of)&&Re(t.modes,(i,s)=>{Re(i,(o,a)=>{if(Jr(o))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${a}>
37
+ `,type:St.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if($e(o,"LONGER_ALT")){const u=We(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];Re(u,c=>{!Jr(c)&&!fn(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}>
38
+ `,type:St.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function pz(t,e,n){const r=[];let i=!1;const s=vu(Kn(Mt(t.modes))),o=kf(s,u=>u[vs]===An.NA),a=xR(n);return e&&Re(o,u=>{const c=PR(u,a);if(c!==!1){const d={message:yz(u,c),type:c.issue,tokenType:u};r.push(d)}else $e(u,"LINE_BREAKS")?u.LINE_BREAKS===!0&&(i=!0):Xg(a,u.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
39
+ This Lexer has been defined to track line and column information,
40
+ But none of the Token Types can be identified as matching a line terminator.
41
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
42
+ for details.`,type:St.NO_LINE_BREAKS_FLAGS}),r}function hz(t){const e={},n=Vn(t);return Re(n,r=>{const i=t[r];if(We(i))e[r]=[];else throw Error("non exhaustive match")}),e}function _R(t){const e=t.PATTERN;if(Xr(e))return!1;if(Vr(e))return!0;if($e(e,"exec"))return!0;if(Tn(e))return!1;throw Error("non exhaustive match")}function mz(t){return Tn(t)&&t.length===1?t.charCodeAt(0):!1}const gz={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.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 PR(t,e){if($e(t,"LINE_BREAKS"))return!1;if(Xr(t.PATTERN)){try{Xg(e,t.PATTERN)}catch(n){return{issue:St.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(Tn(t.PATTERN))return!1;if(_R(t))return{issue:St.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function yz(t,e){if(e.issue===St.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
43
+ The problem is in the <${t.name}> Token Type
44
+ Root cause: ${e.errMsg}.
45
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===St.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
46
+ The problem is in the <${t.name}> Token Type
47
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function xR(t){return he(t,n=>Tn(n)?n.charCodeAt(0):n)}function Jg(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Ru=256;let Ff=[];function Ci(t){return t<Ru?t:Ff[t]}function wz(){if(ot(Ff)){Ff=new Array(65536);for(let t=0;t<65536;t++)Ff[t]=t>255?255+~~(t/255):t}}function $u(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function Lf(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let IR=1;const NR={};function Tu(t){const e=vz(t);bz(e),Ez(e),Dz(e),Re(e,n=>{n.isParent=n.categoryMatches.length>0})}function vz(t){let e=Ht(t),n=t,r=!0;for(;r;){n=vu(Kn(he(n,s=>s.CATEGORIES)));const i=Sf(n,e);e=e.concat(i),ot(i)?r=!1:n=i}return e}function bz(t){Re(t,e=>{FR(e)||(NR[IR]=e,e.tokenTypeIdx=IR++),LR(e)&&!We(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),LR(e)||(e.CATEGORIES=[]),Rz(e)||(e.categoryMatches=[]),$z(e)||(e.categoryMatchesMap={})})}function Dz(t){Re(t,e=>{e.categoryMatches=[],Re(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(NR[r].tokenTypeIdx)})})}function Ez(t){Re(t,e=>{OR([],e)})}function OR(t,e){Re(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),Re(e.CATEGORIES,n=>{const r=t.concat(e);fn(r,n)||OR(r,n)})}function FR(t){return $e(t,"tokenTypeIdx")}function LR(t){return $e(t,"CATEGORIES")}function Rz(t){return $e(t,"categoryMatches")}function $z(t){return $e(t,"categoryMatchesMap")}function Tz(t){return $e(t,"tokenTypeIdx")}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 St;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(St||(St={}));const Su={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
48
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Qg,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Su);class An{constructor(e,n=Su){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.traceInitIndent++;const o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${o}--> <${i}>`);const{time:a,value:u}=DR(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.
49
+ a boolean 2nd argument is no longer supported`);this.config=xn({},Su,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===Su.lineTerminatorsPattern)this.config.lineTerminatorsPattern=gz;else if(this.config.lineTerminatorCharacters===Su.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
50
+ 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),We(e)?i={modes:{defaultMode:Ht(e)},defaultMode:Eu}:(s=!1,i=Ht(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(fz(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(pz(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Re(i.modes,(a,u)=>{i.modes[u]=kf(a,c=>Jr(c))});const o=Vn(i.modes);if(Re(i.modes,(a,u)=>{this.TRACE_INIT(`Mode: <${u}> processing`,()=>{if(this.modes.push(u),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(XB(a,o))}),ot(this.lexerDefinitionErrors)){Tu(a);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=YB(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]=c.charCodeToPatternIdxToConfig,this.emptyGroups=xn({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[u]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,!ot(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const u=he(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
51
+ `);throw new Error(`Errors detected in definition of Lexer:
52
+ `+u)}Re(this.lexerDefinitionWarning,a=>{bR(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(kR?(this.chopInput=hs,this.match=this.matchWithTest):(this.updateLastIndex=Lt,this.match=this.matchWithExec),s&&(this.handleModes=Lt),this.trackStartLines===!1&&(this.computeNewColumn=hs),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Lt),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const a=pn(this.canModeBeOptimized,(u,c,l)=>(c===!1&&u.push(l),u),[]);if(n.ensureOptimizations&&!ot(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
53
+ Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
54
+ Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{WB()}),this.TRACE_INIT("toFastProperties",()=>{ER(this)})})}tokenize(e,n=this.defaultMode){if(!ot(this.lexerDefinitionErrors)){const i=he(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
55
+ `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
56
+ `+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,o,a,u,c,l,d,f,p,h,w,D,g;const v=e,E=v.length;let k=0,P=0;const G=this.hasCustom?0:Math.floor(e.length/10),W=new Array(G),Z=[];let J=this.trackStartLines?1:void 0,fe=this.trackStartLines?1:void 0;const N=hz(this.emptyGroups),S=this.trackStartLines,$=this.config.lineTerminatorsPattern;let O=0,V=[],M=[];const H=[],Ee=[];Object.freeze(Ee);let te;function C(){return V}function me(Ie){const oe=Ci(Ie),be=M[oe];return be===void 0?Ee:be}const tt=Ie=>{if(H.length===1&&Ie.tokenType.PUSH_MODE===void 0){const oe=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Ie);Z.push({offset:Ie.startOffset,line:Ie.startLine,column:Ie.startColumn,length:Ie.image.length,message:oe})}else{H.pop();const oe=Ro(H);V=this.patternIdxToConfig[oe],M=this.charCodeToPatternIdxToConfig[oe],O=V.length;const be=this.canModeBeOptimized[oe]&&this.config.safeMode===!1;M&&be?te=me:te=C}};function pt(Ie){H.push(Ie),M=this.charCodeToPatternIdxToConfig[Ie],V=this.patternIdxToConfig[Ie],O=V.length,O=V.length;const oe=this.canModeBeOptimized[Ie]&&this.config.safeMode===!1;M&&oe?te=me:te=C}pt.call(this,n);let j;const K=this.config.recoveryEnabled;for(;k<E;){u=null;const Ie=v.charCodeAt(k),oe=te(Ie),be=oe.length;for(r=0;r<be;r++){j=oe[r];const ke=j.pattern;c=null;const ue=j.short;if(ue!==!1?Ie===ue&&(u=ke):j.isCustom===!0?(g=ke.exec(v,k,W,N),g!==null?(u=g[0],g.payload!==void 0&&(c=g.payload)):u=null):(this.updateLastIndex(ke,k),u=this.match(ke,e,k)),u!==null){if(a=j.longerAlt,a!==void 0){const x=a.length;for(s=0;s<x;s++){const B=V[a[s]],le=B.pattern;if(l=null,B.isCustom===!0?(g=le.exec(v,k,W,N),g!==null?(o=g[0],g.payload!==void 0&&(l=g.payload)):o=null):(this.updateLastIndex(le,k),o=this.match(le,e,k)),o&&o.length>u.length){u=o,c=l,j=B;break}}}break}}if(u!==null){if(d=u.length,f=j.group,f!==void 0&&(p=j.tokenTypeIdx,h=this.createTokenInstance(u,k,p,j.tokenType,J,fe,d),this.handlePayload(h,c),f===!1?P=this.addToken(W,P,h):N[f].push(h)),e=this.chopInput(e,d),k=k+d,fe=this.computeNewColumn(fe,d),S===!0&&j.canLineTerminator===!0){let ke=0,ue,x;$.lastIndex=0;do ue=$.test(u),ue===!0&&(x=$.lastIndex-1,ke++);while(ue===!0);ke!==0&&(J=J+ke,fe=d-x,this.updateTokenEndLineColumnLocation(h,f,x,ke,J,fe,d))}this.handleModes(j,tt,pt,h)}else{const ke=k,ue=J,x=fe;let B=K===!1;for(;B===!1&&k<E;)for(e=this.chopInput(e,1),k++,i=0;i<O;i++){const le=V[i],z=le.pattern,ce=le.short;if(ce!==!1?v.charCodeAt(k)===ce&&(B=!0):le.isCustom===!0?B=z.exec(v,k,W,N)!==null:(this.updateLastIndex(z,k),B=z.exec(e)!==null),B===!0)break}if(w=k-ke,fe=this.computeNewColumn(fe,w),D=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(v,ke,w,ue,x),Z.push({offset:ke,line:ue,column:x,length:w,message:D}),K===!1)break}}return this.hasCustom||(W.length=P),{tokens:W,groups:N,errors:Z}}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=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+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}}An.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 to for example to completely ignore whitespace.",An.NA=/NOT_APPLICABLE/;function ko(t){return MR(t)?t.LABEL:t.name}function MR(t){return Tn(t.LABEL)&&t.LABEL!==""}const Sz="parent",BR="categories",zR="label",qR="group",jR="push_mode",GR="pop_mode",UR="longer_alt",WR="line_breaks",HR="start_chars_hint";function VR(t){return kz(t)}function kz(t){const e=t.pattern,n={};if(n.name=t.name,Jr(e)||(n.PATTERN=e),$e(t,Sz))throw`The parent property is no longer supported.
57
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return $e(t,BR)&&(n.CATEGORIES=t[BR]),Tu([n]),$e(t,zR)&&(n.LABEL=t[zR]),$e(t,qR)&&(n.GROUP=t[qR]),$e(t,GR)&&(n.POP_MODE=t[GR]),$e(t,jR)&&(n.PUSH_MODE=t[jR]),$e(t,UR)&&(n.LONGER_ALT=t[UR]),$e(t,WR)&&(n.LINE_BREAKS=t[WR]),$e(t,HR)&&(n.START_CHARS_HINT=t[HR]),n}const Ai=VR({name:"EOF",pattern:An.NA});Tu([Ai]);function Zg(t,e,n,r,i,s,o,a){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function KR(t,e){return $u(t,e)}const Co={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${MR(t)?`--> ${ko(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}){const s="Expecting: ",a=`
58
+ but found: '`+ur(e).image+"'";if(r)return s+r+a;{const u=pn(t,(f,p)=>f.concat(p),[]),c=he(u,f=>`[${he(f,p=>ko(p)).join(", ")}]`),d=`one of these possible Token sequences:
59
+ ${he(c,(f,p)=>` ${p+1}. ${f}`).join(`
60
+ `)}`;return s+d+a}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",o=`
61
+ but found: '`+ur(e).image+"'";if(n)return i+n+o;{const u=`expecting at least one iteration which starts with one of these possible Token sequences::
62
+ <${he(t,c=>`[${he(c,l=>ko(l)).join(",")}]`).join(" ,")}>`;return i+u+o}}};Object.freeze(Co);const Cz={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
63
+ inside top level rule: ->`+t.name+"<-"}},bs={buildDuplicateFoundError(t,e){function n(l){return l instanceof gt?l.terminalType.name:l instanceof hn?l.nonTerminalName:""}const r=t.name,i=ur(e),s=i.idx,o=xr(i),a=n(i),u=s>0;let c=`->${o}${u?s:""}<- ${a?`with argument: ->${a}<-`:""}
64
+ appears more than once (${e.length} times) in the top level rule: ->${r}<-.
65
+ For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
66
+ `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
67
+ `),c},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
68
+ The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
69
+ To resolve this make sure each Terminal and Non-Terminal names are unique
70
+ This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
71
+ and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=he(t.prefixPath,i=>ko(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
72
+ in <OR${n}> inside <${t.topLevelRule.name}> Rule,
73
+ <${e}> may appears as a prefix path in all these alternatives.
74
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
75
+ For Further details.`},buildAlternationAmbiguityError(t){const e=he(t.prefixPath,i=>ko(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
76
+ <${e}> may appears as a prefix path in all these alternatives.
77
+ `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
78
+ For Further details.`,r},buildEmptyRepetitionError(t){let e=xr(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
79
+ This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
80
+ Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
81
+ <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
82
+ has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=he(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
83
+ rule: <${e}> can be invoked from itself (directly or indirectly)
84
+ without consuming any Tokens. The grammar path that causes this is:
85
+ ${r}
86
+ To fix this refactor your grammar to remove the left recursion.
87
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof To?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function Az(t,e){const n=new _z(t,e);return n.resolveRefs(),n.errors}class _z extends So{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){Re(Mt(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:mn.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Pz extends _f{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=Ht(this.path.ruleStack).reverse(),this.occurrenceStack=Ht(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===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){ot(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class xz extends Pz{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new Sn({definition:i});this.possibleTokTypes=Du(s),this.found=!0}}}class Mf extends _f{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Iz extends Mf{walkMany(e,n,r){if(e.idx===this.occurrence){const i=ur(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof gt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class YR extends Mf{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=ur(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof gt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class Nz extends Mf{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=ur(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof gt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class XR extends Mf{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=ur(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof gt&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function ey(t,e,n=[]){n=Ht(n);let r=[],i=0;function s(a){return a.concat(Vt(t,i+1))}function o(a){const u=ey(s(a),e,n);return r.concat(u)}for(;n.length<e&&i<t.length;){const a=t[i];if(a instanceof Sn)return o(a.definition);if(a instanceof hn)return o(a.definition);if(a instanceof Kt)r=o(a.definition);else if(a instanceof On){const u=a.definition.concat([new Tt({definition:a.definition})]);return o(u)}else if(a instanceof Fn){const u=[new Sn({definition:a.definition}),new Tt({definition:[new gt({terminalType:a.separator})].concat(a.definition)})];return o(u)}else if(a instanceof kn){const u=a.definition.concat([new Tt({definition:[new gt({terminalType:a.separator})].concat(a.definition)})]);r=o(u)}else if(a instanceof Tt){const u=a.definition.concat([new Tt({definition:a.definition})]);r=o(u)}else{if(a instanceof Cn)return Re(a.definition,u=>{ot(u.definition)===!1&&(r=o(u.definition))}),r;if(a instanceof gt)n.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:Vt(t,i)}),r}function JR(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const u=e.length,c=u-r-1,l=[],d=[];for(d.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!ot(d);){const f=d.pop();if(f===o){a&&Ro(d).idx<=c&&d.pop();continue}const p=f.def,h=f.idx,w=f.ruleStack,D=f.occurrenceStack;if(ot(p))continue;const g=p[0];if(g===i){const v={idx:h,def:Vt(p),ruleStack:bu(w),occurrenceStack:bu(D)};d.push(v)}else if(g instanceof gt)if(h<u-1){const v=h+1,E=e[v];if(n(E,g.terminalType)){const k={idx:v,def:Vt(p),ruleStack:w,occurrenceStack:D};d.push(k)}}else if(h===u-1)l.push({nextTokenType:g.terminalType,nextTokenOccurrence:g.idx,ruleStack:w,occurrenceStack:D}),a=!0;else throw Error("non exhaustive match");else if(g instanceof hn){const v=Ht(w);v.push(g.nonTerminalName);const E=Ht(D);E.push(g.idx);const k={idx:h,def:g.definition.concat(s,Vt(p)),ruleStack:v,occurrenceStack:E};d.push(k)}else if(g instanceof Kt){const v={idx:h,def:Vt(p),ruleStack:w,occurrenceStack:D};d.push(v),d.push(o);const E={idx:h,def:g.definition.concat(Vt(p)),ruleStack:w,occurrenceStack:D};d.push(E)}else if(g instanceof On){const v=new Tt({definition:g.definition,idx:g.idx}),E=g.definition.concat([v],Vt(p)),k={idx:h,def:E,ruleStack:w,occurrenceStack:D};d.push(k)}else if(g instanceof Fn){const v=new gt({terminalType:g.separator}),E=new Tt({definition:[v].concat(g.definition),idx:g.idx}),k=g.definition.concat([E],Vt(p)),P={idx:h,def:k,ruleStack:w,occurrenceStack:D};d.push(P)}else if(g instanceof kn){const v={idx:h,def:Vt(p),ruleStack:w,occurrenceStack:D};d.push(v),d.push(o);const E=new gt({terminalType:g.separator}),k=new Tt({definition:[E].concat(g.definition),idx:g.idx}),P=g.definition.concat([k],Vt(p)),G={idx:h,def:P,ruleStack:w,occurrenceStack:D};d.push(G)}else if(g instanceof Tt){const v={idx:h,def:Vt(p),ruleStack:w,occurrenceStack:D};d.push(v),d.push(o);const E=new Tt({definition:g.definition,idx:g.idx}),k=g.definition.concat([E],Vt(p)),P={idx:h,def:k,ruleStack:w,occurrenceStack:D};d.push(P)}else if(g instanceof Cn)for(let v=g.definition.length-1;v>=0;v--){const E=g.definition[v],k={idx:h,def:E.definition.concat(Vt(p)),ruleStack:w,occurrenceStack:D};d.push(k),d.push(o)}else if(g instanceof Sn)d.push({idx:h,def:g.definition.concat(Vt(p)),ruleStack:w,occurrenceStack:D});else if(g instanceof To)d.push(Oz(g,h,w,D));else throw Error("non exhaustive match")}return l}function Oz(t,e,n,r){const i=Ht(n);i.push(t.name);const s=Ht(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var bt;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(bt||(bt={}));function ty(t){if(t instanceof Kt||t==="Option")return bt.OPTION;if(t instanceof Tt||t==="Repetition")return bt.REPETITION;if(t instanceof On||t==="RepetitionMandatory")return bt.REPETITION_MANDATORY;if(t instanceof Fn||t==="RepetitionMandatoryWithSeparator")return bt.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof kn||t==="RepetitionWithSeparator")return bt.REPETITION_WITH_SEPARATOR;if(t instanceof Cn||t==="Alternation")return bt.ALTERNATION;throw Error("non exhaustive match")}function QR(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=ty(r);return s===bt.ALTERNATION?Bf(e,n,i):zf(e,n,s,i)}function Fz(t,e,n,r,i,s){const o=Bf(t,e,n),a=n$(o)?Lf:$u;return s(o,r,a,i)}function Lz(t,e,n,r,i,s){const o=zf(t,e,i,n),a=n$(o)?Lf:$u;return s(o[0],a,r)}function Mz(t,e,n,r){const i=t.length,s=ar(t,o=>ar(o,a=>a.length===1));if(e)return function(o){const a=he(o,u=>u.GATE);for(let u=0;u<i;u++){const c=t[u],l=c.length,d=a[u];if(!(d!==void 0&&d.call(this)===!1))e:for(let f=0;f<l;f++){const p=c[f],h=p.length;for(let w=0;w<h;w++){const D=this.LA(w+1);if(n(D,p[w])===!1)continue e}return u}}};if(s&&!r){const o=he(t,u=>Kn(u)),a=pn(o,(u,c,l)=>(Re(c,d=>{$e(u,d.tokenTypeIdx)||(u[d.tokenTypeIdx]=l),Re(d.categoryMatches,f=>{$e(u,f)||(u[f]=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],d=l.length;for(let f=0;f<d;f++){const p=this.LA(f+1);if(n(p,l[f])===!1)continue e}return o}}}}function Bz(t,e,n){const r=ar(t,s=>s.length===1),i=t.length;if(r&&!n){const s=Kn(t);if(s.length===1&&ot(s[0].categoryMatches)){const a=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{const o=pn(s,(a,u,c)=>(a[u.tokenTypeIdx]=!0,Re(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 zz extends _f{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){return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(e,n,r){this.checkIsTarget(e,bt.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,bt.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,bt.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,bt.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,bt.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class ZR extends So{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,bt.OPTION)}visitRepetition(e){this.checkIsTarget(e,bt.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,bt.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,bt.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,bt.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,bt.ALTERNATION)}}function e$(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function ny(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(o+u)}}e=i}return e}function qz(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 t$(t,e){const n=he(t,o=>ey([o],1)),r=e$(n.length),i=he(n,o=>{const a={};return Re(o,u=>{const c=ny(u.partialPath);Re(c,l=>{a[l]=!0})}),a});let s=n;for(let o=1;o<=e;o++){const a=s;s=e$(a.length);for(let u=0;u<a.length;u++){const c=a[u];for(let l=0;l<c.length;l++){const d=c[l].partialPath,f=c[l].suffixDef,p=ny(d);if(qz(i,p,u)||ot(f)||d.length===e){const w=r[u];if(ry(w,d)===!1){w.push(d);for(let D=0;D<p.length;D++){const g=p[D];i[u][g]=!0}}}else{const w=ey(f,o+1,d);s[u]=s[u].concat(w),Re(w,D=>{const g=ny(D.partialPath);Re(g,v=>{i[u][v]=!0})})}}}}return r}function Bf(t,e,n,r){const i=new ZR(t,bt.ALTERNATION,r);return e.accept(i),t$(i.result,n)}function zf(t,e,n,r){const i=new ZR(t,n);e.accept(i);const s=i.result,a=new zz(e,t,n).startWalking(),u=new Sn({definition:s}),c=new Sn({definition:a});return t$([u,c],r)}function ry(t,e){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 jz(t,e){return t.length<e.length&&ar(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function n$(t){return ar(t,e=>ar(e,n=>ar(n,r=>ot(r.categoryMatches))))}function Gz(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return he(e,n=>Object.assign({type:mn.CUSTOM_LOOKAHEAD_VALIDATION},n))}function Uz(t,e,n,r){const i=Nn(t,u=>Wz(u,n)),s=r3(t,e,n),o=Nn(t,u=>Zz(u,n)),a=Nn(t,u=>Kz(u,t,r,n));return i.concat(s,o,a)}function Wz(t,e){const n=new Vz;t.accept(n);const r=n.allProductions,i=aB(r,Hz),s=cr(i,a=>a.length>1);return he(Mt(s),a=>{const u=ur(a),c=e.buildDuplicateFoundError(t,a),l=xr(u),d={message:c,type:mn.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:u.idx},f=r$(u);return f&&(d.parameter=f),d})}function Hz(t){return`${xr(t)}_#_${t.idx}_#_${r$(t)}`}function r$(t){return t instanceof gt?t.terminalType.name:t instanceof hn?t.nonTerminalName:""}class Vz extends So{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function Kz(t,e,n,r){const i=[];if(pn(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:mn.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function Yz(t,e,n){const r=[];let i;return fn(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:mn.INVALID_RULE_OVERRIDE,ruleName:t})),r}function i$(t,e,n,r=[]){const i=[],s=qf(e.definition);if(ot(s))return[];{const o=t.name;fn(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:mn.LEFT_RECURSION,ruleName:o});const u=Sf(s,r.concat([t])),c=Nn(u,l=>{const d=Ht(r);return d.push(l),i$(t,l,n,d)});return i.concat(c)}}function qf(t){let e=[];if(ot(t))return e;const n=ur(t);if(n instanceof hn)e.push(n.referencedRule);else if(n instanceof Sn||n instanceof Kt||n instanceof On||n instanceof Fn||n instanceof kn||n instanceof Tt)e=e.concat(qf(n.definition));else if(n instanceof Cn)e=Kn(he(n.definition,s=>qf(s.definition)));else if(!(n instanceof gt))throw Error("non exhaustive match");const r=Af(n),i=t.length>1;if(r&&i){const s=Vt(t);return e.concat(qf(s))}else return e}class iy extends So{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Xz(t,e){const n=new iy;t.accept(n);const r=n.alternations;return Nn(r,s=>{const o=bu(s.definition);return Nn(o,(a,u)=>{const c=JR([a],[],$u,1);return ot(c)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:u}),type:mn.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:u+1}]:[]})})}function Jz(t,e,n){const r=new iy;t.accept(r);let i=r.alternations;return i=kf(i,o=>o.ignoreAmbiguities===!0),Nn(i,o=>{const a=o.idx,u=o.maxLookahead||e,c=Bf(a,t,u,o),l=t3(c,o,t,n),d=n3(c,o,t,n);return l.concat(d)})}class Qz extends So{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 Zz(t,e){const n=new iy;t.accept(n);const r=n.alternations;return Nn(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:mn.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function e3(t,e,n){const r=[];return Re(t,i=>{const s=new Qz;i.accept(s);const o=s.allProductions;Re(o,a=>{const u=ty(a),c=a.maxLookahead||e,l=a.idx,f=zf(l,i,u,c)[0];if(ot(Kn(f))){const p=n.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:p,type:mn.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function t3(t,e,n,r){const i=[],s=pn(t,(a,u,c)=>(e.definition[c].ignoreAmbiguities===!0||Re(u,l=>{const d=[c];Re(t,(f,p)=>{c!==p&&ry(f,l)&&e.definition[p].ignoreAmbiguities!==!0&&d.push(p)}),d.length>1&&!ry(i,l)&&(i.push(l),a.push({alts:d,path:l}))}),a),[]);return he(s,a=>{const u=he(a.alts,l=>l+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:u,prefixPath:a.path}),type:mn.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:a.alts}})}function n3(t,e,n,r){const i=pn(t,(o,a,u)=>{const c=he(a,l=>({idx:u,path:l}));return o.concat(c)},[]);return vu(Nn(i,o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];const u=o.idx,c=o.path,l=In(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<u&&jz(f.path,c));return he(l,f=>{const p=[f.idx+1,u+1],h=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:p,prefixPath:f.path}),type:mn.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:h,alternatives:p}})}))}function r3(t,e,n){const r=[],i=he(e,s=>s.name);return Re(t,s=>{const o=s.name;if(fn(i,o)){const a=n.buildNamespaceConflictError(s);r.push({message:a,type:mn.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),r}function i3(t){const e=Wg(t,{errMsgProvider:Cz}),n={};return Re(t.rules,r=>{n[r.name]=r}),Az(n,e.errMsgProvider)}function s3(t){return t=Wg(t,{errMsgProvider:bs}),Uz(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const s$="MismatchedTokenException",o$="NoViableAltException",a$="EarlyExitException",u$="NotAllInputParsedException",c$=[s$,o$,a$,u$];Object.freeze(c$);function jf(t){return fn(c$,t.name)}class Gf 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 l$ extends Gf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=s$}}class o3 extends Gf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=o$}}class a3 extends Gf{constructor(e,n){super(e,n),this.name=u$}}class u3 extends Gf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=a$}}const sy={},d$="InRuleRecoveryException";class c3 extends Error{constructor(e){super(e),this.name=d$}}class l3{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=$e(e,"recoveryEnabled")?e.recoveryEnabled:Qr.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=d3)}getTokenToInsert(e){const n=Zg(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){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 d=()=>{const f=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:f,ruleName:this.getCurrRuleFullName()}),h=new l$(p,c,this.LA(0));h.resyncedTokens=bu(a),this.SAVE_ERROR(h)};for(;!u;)if(this.tokenMatcher(l,i)){d();return}else if(r.call(this)){d(),e.apply(this,n);return}else this.tokenMatcher(l,s)?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(e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new c3("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||ot(n))return!1;const r=this.LA(1);return $o(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return fn(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=$o(e,s=>KR(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return sy;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return he(e,(r,i)=>i===0?sy:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=he(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Kn(e)}getFollowSetFromFollowKey(e){if(e===sy)return[Ai];const n=e.ruleName+e.idxInCallingRule+$R+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,Ai)||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 bu(n)}attemptInRepetitionRecovery(e,n,r,i,s,o,a){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=Ht(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return he(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function d3(t,e,n,r,i,s,o){const a=this.getKeyForAutomaticLookahead(r,i);let u=this.firstAfterRepMap[a];if(u===void 0){const f=this.getCurrRuleFullName(),p=this.getGAstProductions()[f];u=new s(p,i).startWalking(),this.firstAfterRepMap[a]=u}let c=u.token,l=u.occurrence;const d=u.isEndOfRule;this.RULE_STACK.length===1&&d&&c===void 0&&(c=Ai,l=1),!(c===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,l,o)&&this.tryInRepetitionRecovery(t,e,n,c)}const f3=4,_i=8,f$=1<<_i,p$=2<<_i,oy=3<<_i,ay=4<<_i,uy=5<<_i,Uf=6<<_i;function cy(t,e,n){return n|e|t}class ly{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:Qr.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(ot(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 Nn(e,n=>i$(n,n,bs))}validateEmptyOrAlternatives(e){return Nn(e,n=>Xz(n,bs))}validateAmbiguousAlternationAlternatives(e,n){return Nn(e,r=>Jz(r,n,bs))}validateSomeNonEmptyLookaheadPath(e,n){return e3(e,n,bs)}buildLookaheadForAlternation(e){return Fz(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Mz)}buildLookaheadForOptional(e){return Lz(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,ty(e.prodType),Bz)}}class p3{initLooksAhead(e){this.dynamicTokensEnabled=$e(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Qr.dynamicTokensEnabled,this.maxLookahead=$e(e,"maxLookahead")?e.maxLookahead:Qr.maxLookahead,this.lookaheadStrategy=$e(e,"lookaheadStrategy")?e.lookaheadStrategy:new ly({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){Re(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:u}=m3(n);Re(r,c=>{const l=c.idx===0?"":c.idx;this.TRACE_INIT(`${xr(c)}${l}`,()=>{const d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:n,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=cy(this.fullRuleNameToShort[n.name],f$,c.idx);this.setLaFuncCache(f,d)})}),Re(i,c=>{this.computeLookaheadFunc(n,c.idx,oy,"Repetition",c.maxLookahead,xr(c))}),Re(s,c=>{this.computeLookaheadFunc(n,c.idx,p$,"Option",c.maxLookahead,xr(c))}),Re(o,c=>{this.computeLookaheadFunc(n,c.idx,ay,"RepetitionMandatory",c.maxLookahead,xr(c))}),Re(a,c=>{this.computeLookaheadFunc(n,c.idx,Uf,"RepetitionMandatoryWithSeparator",c.maxLookahead,xr(c))}),Re(u,c=>{this.computeLookaheadFunc(n,c.idx,uy,"RepetitionWithSeparator",c.maxLookahead,xr(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,prodType:i}),u=cy(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(u,a)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return cy(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class h3 extends So{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const Wf=new h3;function m3(t){Wf.reset(),t.accept(Wf);const e=Wf.dslMethods;return Wf.reset(),e}function h$(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function m$(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function g3(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function y3(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const w3="name";function g$(t,e){Object.defineProperty(t,w3,{enumerable:!1,configurable:!0,writable:!1,value:e})}function v3(t,e){const n=Vn(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&&this[c.name](c.children,e)}}}function b3(t,e){const n=function(){};g$(n,t+"BaseSemantics");const r={visit:function(i,s){if(We(i)&&(i=i[0]),!Jr(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=E3(this,e);if(!ot(i)){const s=he(i,o=>o.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
88
+ ${s.join(`
89
+
90
+ `).replace(/\n/g,`
91
+ `)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function D3(t,e,n){const r=function(){};g$(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return Re(e,s=>{i[s]=v3}),r.prototype=i,r.prototype.constructor=r,r}var dy;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(dy||(dy={}));function E3(t,e){return R3(t,e)}function R3(t,e){const n=In(e,i=>Vr(t[i])===!1),r=he(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:dy.MISSING_METHOD,methodName:i}));return vu(r)}class $3{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=$e(e,"nodeLocationTracking")?e.nodeLocationTracking:Qr.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Lt,this.cstFinallyStateUpdate=Lt,this.cstPostTerminal=Lt,this.cstPostNonTerminal=Lt,this.cstPostRule=Lt;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=m$,this.setNodeLocationFromNode=m$,this.cstPostRule=Lt,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Lt,this.setNodeLocationFromNode=Lt,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=h$,this.setNodeLocationFromNode=h$,this.cstPostRule=Lt,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Lt,this.setNodeLocationFromNode=Lt,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Lt,this.setNodeLocationFromNode=Lt,this.cstPostRule=Lt,this.setInitialNodeLocation=Lt;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];g3(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];y3(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(Jr(this.baseCstVisitorConstructor)){const e=b3(this.className,Vn(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Jr(this.baseCstVisitorWithDefaultsConstructor)){const e=D3(this.className,Vn(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class T3{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Kf}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?Kf:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class S3{ACTION(e){return e.call(this)}consume(e,n,r){return this.consumeInternal(n,e,r)}subrule(e,n,r){return this.subruleInternal(n,e,r)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,n,r=Yf){if(fn(this.definedRulesNames,e)){const o={message:bs.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:mn.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=Yf){const i=Yz(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,n,r);return this[e]=s,s}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,n),!0}catch(i){if(jf(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return OB(Mt(this.gastProductionsCache))}}class k3{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Lf,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},$e(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
92
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
93
+ For Further details.`);if(We(e)){if(ot(e))throw Error(`A Token Vocabulary cannot be empty.
94
+ Note that the first argument for the parser constructor
95
+ 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.
96
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
97
+ For Further details.`)}if(We(e))this.tokensMap=pn(e,(s,o)=>(s[o.name]=o,s),{});else if($e(e,"modes")&&ar(Kn(Mt(e.modes)),Tz)){const s=Kn(Mt(e.modes)),o=Hg(s);this.tokensMap=pn(o,(a,u)=>(a[u.name]=u,a),{})}else if(Hn(e))this.tokensMap=Ht(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=Ai;const r=$e(e,"modes")?Kn(Mt(e.modes)):Mt(e),i=ar(r,s=>ot(s.categoryMatches));this.tokenMatcher=i?Lf:$u,Tu(Mt(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'
98
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=$e(r,"resyncEnabled")?r.resyncEnabled:Yf.resyncEnabled,s=$e(r,"recoveryValueFunc")?r.recoveryValueFunc:Yf.recoveryValueFunc,o=this.ruleShortNameIdx<<f3+_i;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 d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,l)}catch(d){return this.invokeRuleCatch(d,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(jf(e)){const o=e;if(s){const a=this.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(p$,n);return this.optionInternalLogic(e,n,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(ay,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(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,bt.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,ay,e,Nz)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Uf,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(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.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,XR],a,Uf,e,XR)}else throw this.raiseEarlyExitException(e,bt.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(oy,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){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,oy,e,Iz,o)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(uy,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.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,YR],a,uy,e,YR)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,Uf,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(f$,n),i=We(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 a3(n,e))}}subruleInternal(e,n,r){let i;try{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 jf(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):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 l$(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===d$?r:s}}else throw r}saveRecogState(){const e=this.errors,n=Ht(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Ai)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class C3{initErrorHandler(e){this._errors=[],this.errorMessageProvider=$e(e,"errorMessageProvider")?e.errorMessageProvider:Qr.errorMessageProvider}SAVE_ERROR(e){if(jf(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Ht(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Ht(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],a=zf(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 u3(c,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=Bf(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.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:a,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new o3(u,this.LA(1),a))}}class A3{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(Jr(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return JR([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=ur(e.ruleStack),i=this.getGAstProductions()[n];return new xz(i,e).startWalking()}}const Hf={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Hf);const y$=!0,w$=Math.pow(2,_i)-1,v$=VR({name:"RECORDING_PHASE_TOKEN",pattern:An.NA});Tu([v$]);const b$=Zg(v$,`This IToken indicates the Parser is in Recording Phase
99
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(b$);const _3={name:`This CSTNode indicates the Parser is in Recording Phase
100
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class P3{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(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.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`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 Kf}topLevelRuleRecord(e,n){try{const r=new To({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
101
+ This error was thrown during the "grammar recording phase" For more info see:
102
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return ku.call(this,Kt,e,n)}atLeastOneInternalRecord(e,n){ku.call(this,On,n,e)}atLeastOneSepFirstInternalRecord(e,n){ku.call(this,Fn,n,e,y$)}manyInternalRecord(e,n){ku.call(this,Tt,n,e)}manySepFirstInternalRecord(e,n){ku.call(this,kn,n,e,y$)}orInternalRecord(e,n){return x3.call(this,e,n)}subruleInternalRecord(e,n,r){if(Vf(n),!e||$e(e,"ruleName")===!1){const a=new Error(`<SUBRULE${D$(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
103
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=Ro(this.recordingProdStack),s=e.ruleName,o=new hn({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?_3:Hf}consumeInternalRecord(e,n,r){if(Vf(n),!FR(e)){const o=new Error(`<CONSUME${D$(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
104
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=Ro(this.recordingProdStack),s=new gt({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),b$}}function ku(t,e,n,r=!1){Vf(n);const i=Ro(this.recordingProdStack),s=Vr(e)?e:e.DEF,o=new t({definition:[],idx:n});return r&&(o.separator=e.SEP),$e(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),Hf}function x3(t,e){Vf(e);const n=Ro(this.recordingProdStack),r=We(t)===!1,i=r===!1?t:t.DEF,s=new Cn({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});$e(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const o=wR(i,a=>Vr(a.GATE));return s.hasPredicates=o,n.definition.push(s),Re(i,a=>{const u=new Sn({definition:[]});s.definition.push(u),$e(a,"IGNORE_AMBIGUITIES")?u.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:$e(a,"GATE")&&(u.ignoreAmbiguities=!0),this.recordingProdStack.push(u),a.ALT.call(this),this.recordingProdStack.pop()}),Hf}function D$(t){return t===0?"":`${t}`}function Vf(t){if(t<0||t>w$){const e=new Error(`Invalid DSL Method idx value: <${t}>
105
+ Idx value must be a none negative value smaller than ${w$+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class I3{initPerformanceTracer(e){if($e(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=Qr.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&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=DR(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 N3(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 Kf=Zg(Ai,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Kf);const Qr=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Co,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Yf=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var mn;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(mn||(mn={}));function E$(t=void 0){return function(){return t}}class Nd{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",()=>{ER(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),Re(this.definedRulesNames,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=i3({rules:Mt(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(ot(r)&&this.skipValidations===!1){const i=s3({rules:Mt(this.gastProductionsCache),tokenTypes:Mt(this.tokensMap),errMsgProvider:bs,grammarName:n}),s=Gz({lookaheadStrategy:this.lookaheadStrategy,rules:Mt(this.gastProductionsCache),tokenTypes:Mt(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),ot(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=jB(Mt(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:Mt(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Mt(this.gastProductionsCache))})),!Nd.DEFER_DEFINITION_ERRORS_HANDLING&&!ot(this.definitionErrors))throw e=he(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
106
+ ${e.join(`
107
+ -------------------------------
108
+ `)}`)})}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),$e(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
109
+ Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
110
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
111
+ For further details.`);this.skipValidations=$e(n,"skipValidations")?n.skipValidations:Qr.skipValidations}}Nd.DEFER_DEFINITION_ERRORS_HANDLING=!1,N3(Nd,[l3,p3,$3,T3,k3,S3,C3,A3,P3,I3]);class O3 extends Nd{constructor(e,n=Qr){const r=Ht(n);r.outputCst=!1,super(e,r)}}function Ao(t,e,n){return`${t.name}_${e}_${n}`}const Pi=1,F3=2,R$=4,$$=5,Cu=7,L3=8,M3=9,B3=10,z3=11,T$=12;class fy{constructor(e){this.target=e}isEpsilon(){return!1}}class py extends fy{constructor(e,n){super(e),this.tokenType=n}}class S$ extends fy{constructor(e){super(e)}isEpsilon(){return!0}}class hy extends fy{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function q3(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};j3(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Ds(e,i,i);s!==void 0&&Z3(e,i,s)}return e}function j3(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Gt(t,i,void 0,{type:F3}),o=Gt(t,i,void 0,{type:Cu});s.stop=o,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,o)}}function k$(t,e,n){return n instanceof gt?my(t,e,n.terminalType,n):n instanceof hn?Q3(t,e,n):n instanceof Cn?V3(t,e,n):n instanceof Kt?K3(t,e,n):n instanceof Tt?G3(t,e,n):n instanceof kn?U3(t,e,n):n instanceof On?W3(t,e,n):n instanceof Fn?H3(t,e,n):Ds(t,e,n)}function G3(t,e,n){const r=Gt(t,e,n,{type:$$});xi(t,r);const i=_o(t,e,r,n,Ds(t,e,n));return A$(t,e,n,i)}function U3(t,e,n){const r=Gt(t,e,n,{type:$$});xi(t,r);const i=_o(t,e,r,n,Ds(t,e,n)),s=my(t,e,n.separator,n);return A$(t,e,n,i,s)}function W3(t,e,n){const r=Gt(t,e,n,{type:R$});xi(t,r);const i=_o(t,e,r,n,Ds(t,e,n));return C$(t,e,n,i)}function H3(t,e,n){const r=Gt(t,e,n,{type:R$});xi(t,r);const i=_o(t,e,r,n,Ds(t,e,n)),s=my(t,e,n.separator,n);return C$(t,e,n,i,s)}function V3(t,e,n){const r=Gt(t,e,n,{type:Pi});xi(t,r);const i=he(n.definition,o=>k$(t,e,o));return _o(t,e,r,n,...i)}function K3(t,e,n){const r=Gt(t,e,n,{type:Pi});xi(t,r);const i=_o(t,e,r,n,Ds(t,e,n));return Y3(t,e,n,i)}function Ds(t,e,n){const r=In(he(n.definition,i=>k$(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:J3(t,r)}function C$(t,e,n,r,i){const s=r.left,o=r.right,a=Gt(t,e,n,{type:z3});xi(t,a);const u=Gt(t,e,n,{type:T$});return s.loopback=a,u.loopback=a,t.decisionMap[Ao(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=a,Pt(o,a),i===void 0?(Pt(a,s),Pt(a,u)):(Pt(a,u),Pt(a,i.left),Pt(i.right,s)),{left:s,right:u}}function A$(t,e,n,r,i){const s=r.left,o=r.right,a=Gt(t,e,n,{type:B3});xi(t,a);const u=Gt(t,e,n,{type:T$}),c=Gt(t,e,n,{type:M3});return a.loopback=c,u.loopback=c,Pt(a,s),Pt(a,u),Pt(o,c),i!==void 0?(Pt(c,u),Pt(c,i.left),Pt(i.right,s)):Pt(c,a),t.decisionMap[Ao(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=a,{left:a,right:u}}function Y3(t,e,n,r){const i=r.left,s=r.right;return Pt(i,s),t.decisionMap[Ao(e,"Option",n.idx)]=i,r}function xi(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function _o(t,e,n,r,...i){const s=Gt(t,e,r,{type:L3,start:n});n.end=s;for(const a of i)a!==void 0?(Pt(n,a.left),Pt(a.right,s)):Pt(n,s);const o={left:n,right:s};return t.decisionMap[Ao(e,X3(r),r.idx)]=n,o}function X3(t){if(t instanceof Cn)return"Alternation";if(t instanceof Kt)return"Option";if(t instanceof Tt)return"Repetition";if(t instanceof kn)return"RepetitionWithSeparator";if(t instanceof On)return"RepetitionMandatory";if(t instanceof Fn)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function J3(t,e){const n=e.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 hy,c=a,l=e[s+1].left;o.left.type===Pi&&o.right.type===Pi&&a!==void 0&&(u&&c.followState===o.right||a.target===o.right)?(u?c.followState=l:a.target=l,eq(t,o.right)):Pt(o.right,l)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function my(t,e,n,r){const i=Gt(t,e,r,{type:Pi}),s=Gt(t,e,r,{type:Pi});return gy(i,new py(s,n)),{left:i,right:s}}function Q3(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.get(r),s=Gt(t,e,n,{type:Pi}),o=Gt(t,e,n,{type:Pi}),a=new hy(i,r,o);return gy(s,a),{left:s,right:o}}function Z3(t,e,n){const r=t.ruleToStartState.get(e);Pt(r,n.left);const i=t.ruleToStopState.get(e);return Pt(n.right,i),{left:r,right:i}}function Pt(t,e){const n=new S$(e);gy(t,n)}function Gt(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(i),i}function gy(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function eq(t,e){t.states.splice(t.states.indexOf(e),1)}const Xf={};class yy{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=_$(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return he(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function _$(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function tq(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 P${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.predicates[r]===!0?"1":"0";return e}}const x$=new P$;class nq extends ly{constructor(e){var n;super(),this.logging=(n=e?.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=q3(e.rules),this.dfas=rq(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=Ao(r,"Alternation",n),l=this.atn.decisionMap[u].decision,d=he(QR({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),f=>he(f,p=>p[0]));if(I$(d,!1)&&!s){const f=pn(d,(p,h,w)=>(Re(h,D=>{D&&(p[D.tokenTypeIdx]=w,Re(D.categoryMatches,g=>{p[g]=w}))}),p),{});return i?function(p){var h;const w=this.LA(1),D=f[w.tokenTypeIdx];if(p!==void 0&&D!==void 0){const g=(h=p[D])===null||h===void 0?void 0:h.GATE;if(g!==void 0&&g.call(this)===!1)return}return D}:function(){const p=this.LA(1);return f[p.tokenTypeIdx]}}else return i?function(f){const p=new P$,h=f===void 0?0:f.length;for(let D=0;D<h;D++){const g=f?.[D].GATE;p.set(D,g===void 0||g.call(this))}const w=wy.call(this,o,l,p,a);return typeof w=="number"?w:void 0}:function(){const f=wy.call(this,o,l,x$,a);return typeof f=="number"?f:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,u=Ao(r,i,n),l=this.atn.decisionMap[u].decision,d=he(QR({maxLookahead:1,occurrence:n,prodType:i,rule:r}),f=>he(f,p=>p[0]));if(I$(d)&&d[0][0]&&!s){const f=d[0],p=Kn(f);if(p.length===1&&ot(p[0].categoryMatches)){const w=p[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===w}}else{const h=pn(p,(w,D)=>(D!==void 0&&(w[D.tokenTypeIdx]=!0,Re(D.categoryMatches,g=>{w[g]=!0})),w),{});return function(){const w=this.LA(1);return h[w.tokenTypeIdx]===!0}}}return function(){const f=wy.call(this,o,l,x$,a);return typeof f=="object"?!1:f===0}}}function I$(t,e=!0){const n=new Set;for(const r of t){const i=new Set;for(const s of r){if(s===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 rq(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=tq(t.decisionStates[r],r);return n}function wy(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const a=hq(i.atnStartState);s=F$(i,N$(a)),i.start=s}return iq.apply(this,[i,s,n,r])}function iq(t,e,n,r){let i=e,s=1;const o=[];let a=this.LA(s++);for(;;){let u=lq(i,a);if(u===void 0&&(u=sq.apply(this,[t,i,a,s,n,r])),u===Xf)return cq(o,i,a);if(u.isAcceptState===!0)return u.prediction;i=u,o.push(a),a=this.LA(s++)}}function sq(t,e,n,r,i,s){const o=dq(e.configs,n,i);if(o.size===0)return O$(t,e,n,Xf),Xf;let a=N$(o);const u=pq(o,i);if(u!==void 0)a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u;else if(wq(o)){const c=EB(o.alts);a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c,oq.apply(this,[t,r,o.alts,s])}return a=O$(t,e,n,a),a}function oq(t,e,n,r){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=aq({topLevelRule:o,ambiguityIndices:n,production:a,prefixPath:i});r(u)}function aq(t){const e=he(t.prefixPath,i=>ko(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${uq(t.production)}${n}> inside <${t.topLevelRule.name}> Rule,
112
+ <${e}> may appears as a prefix path in all these alternatives.
113
+ `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
114
+ For Further details.`,r}function uq(t){if(t instanceof hn)return"SUBRULE";if(t instanceof Kt)return"OPTION";if(t instanceof Cn)return"OR";if(t instanceof On)return"AT_LEAST_ONE";if(t instanceof Fn)return"AT_LEAST_ONE_SEP";if(t instanceof kn)return"MANY_SEP";if(t instanceof Tt)return"MANY";if(t instanceof gt)return"CONSUME";throw Error("non exhaustive match")}function cq(t,e,n){const r=Nn(e.configs.elements,s=>s.state.transitions),i=xB(r.filter(s=>s instanceof py).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function lq(t,e){return t.edges[e.tokenTypeIdx]}function dq(t,e,n){const r=new yy,i=[];for(const o of t.elements){if(n.is(o.alt)===!1)continue;if(o.state.type===Cu){i.push(o);continue}const a=o.state.transitions.length;for(let u=0;u<a;u++){const c=o.state.transitions[u],l=fq(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 yy;for(const o of r.elements)Jf(o,s)}if(i.length>0&&!gq(s))for(const o of i)s.add(o);return s}function fq(t,e){if(t instanceof py&&KR(e,t.tokenType))return t.target}function pq(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 N$(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function O$(t,e,n,r){return r=F$(t,r),e.edges[n.tokenTypeIdx]=r,r}function F$(t,e){if(e===Xf)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function hq(t){const e=new yy,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};Jf(s,e)}return e}function Jf(t,e){const n=t.state;if(n.type===Cu){if(t.stack.length>0){const i=[...t.stack],o={state:i.pop(),alt:t.alt,stack:i};Jf(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=mq(t,s);o!==void 0&&Jf(o,e)}}function mq(t,e){if(e instanceof S$)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof hy){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function gq(t){for(const e of t.elements)if(e.state.type===Cu)return!0;return!1}function yq(t){for(const e of t.elements)if(e.state.type!==Cu)return!1;return!0}function wq(t){if(yq(t))return!0;const e=vq(t.elements);return bq(e)&&!Dq(e)}function vq(t){const e=new Map;for(const n of t){const r=_$(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function bq(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function Dq(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var L$;(function(t){function e(n){return typeof n=="string"}t.is=e})(L$||(L$={}));var vy;(function(t){function e(n){return typeof n=="string"}t.is=e})(vy||(vy={}));var M$;(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})(M$||(M$={}));var Qf;(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})(Qf||(Qf={}));var Ze;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Qf.MAX_VALUE),i===Number.MAX_VALUE&&(i=Qf.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return L.objectLiteral(i)&&L.uinteger(i.line)&&L.uinteger(i.character)}t.is=n})(Ze||(Ze={}));var qe;(function(t){function e(r,i,s,o){if(L.uinteger(r)&&L.uinteger(i)&&L.uinteger(s)&&L.uinteger(o))return{start:Ze.create(r,i),end:Ze.create(s,o)};if(Ze.is(r)&&Ze.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 L.objectLiteral(i)&&Ze.is(i.start)&&Ze.is(i.end)}t.is=n})(qe||(qe={}));var Zf;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return L.objectLiteral(i)&&qe.is(i.range)&&(L.string(i.uri)||L.undefined(i.uri))}t.is=n})(Zf||(Zf={}));var B$;(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 L.objectLiteral(i)&&qe.is(i.targetRange)&&L.string(i.targetUri)&&qe.is(i.targetSelectionRange)&&(qe.is(i.originSelectionRange)||L.undefined(i.originSelectionRange))}t.is=n})(B$||(B$={}));var by;(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 L.objectLiteral(i)&&L.numberRange(i.red,0,1)&&L.numberRange(i.green,0,1)&&L.numberRange(i.blue,0,1)&&L.numberRange(i.alpha,0,1)}t.is=n})(by||(by={}));var z$;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return L.objectLiteral(i)&&qe.is(i.range)&&by.is(i.color)}t.is=n})(z$||(z$={}));var q$;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return L.objectLiteral(i)&&L.string(i.label)&&(L.undefined(i.textEdit)||_n.is(i))&&(L.undefined(i.additionalTextEdits)||L.typedArray(i.additionalTextEdits,_n.is))}t.is=n})(q$||(q$={}));var j$;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(j$||(j$={}));var G$;(function(t){function e(r,i,s,o,a,u){const c={startLine:r,endLine:i};return L.defined(s)&&(c.startCharacter=s),L.defined(o)&&(c.endCharacter=o),L.defined(a)&&(c.kind=a),L.defined(u)&&(c.collapsedText=u),c}t.create=e;function n(r){const i=r;return L.objectLiteral(i)&&L.uinteger(i.startLine)&&L.uinteger(i.startLine)&&(L.undefined(i.startCharacter)||L.uinteger(i.startCharacter))&&(L.undefined(i.endCharacter)||L.uinteger(i.endCharacter))&&(L.undefined(i.kind)||L.string(i.kind))}t.is=n})(G$||(G$={}));var Dy;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return L.defined(i)&&Zf.is(i.location)&&L.string(i.message)}t.is=n})(Dy||(Dy={}));var Au;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Au||(Au={}));var U$;(function(t){t.Unnecessary=1,t.Deprecated=2})(U$||(U$={}));var W$;(function(t){function e(n){const r=n;return L.objectLiteral(r)&&L.string(r.href)}t.is=e})(W$||(W$={}));var ep;(function(t){function e(r,i,s,o,a,u){let c={range:r,message:i};return L.defined(s)&&(c.severity=s),L.defined(o)&&(c.code=o),L.defined(a)&&(c.source=a),L.defined(u)&&(c.relatedInformation=u),c}t.create=e;function n(r){var i;let s=r;return L.defined(s)&&qe.is(s.range)&&L.string(s.message)&&(L.number(s.severity)||L.undefined(s.severity))&&(L.integer(s.code)||L.string(s.code)||L.undefined(s.code))&&(L.undefined(s.codeDescription)||L.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(L.string(s.source)||L.undefined(s.source))&&(L.undefined(s.relatedInformation)||L.typedArray(s.relatedInformation,Dy.is))}t.is=n})(ep||(ep={}));var Po;(function(t){function e(r,i,...s){let o={title:r,command:i};return L.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function n(r){let i=r;return L.defined(i)&&L.string(i.title)&&L.string(i.command)}t.is=n})(Po||(Po={}));var _n;(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 L.objectLiteral(o)&&L.string(o.newText)&&qe.is(o.range)}t.is=i})(_n||(_n={}));var Ey;(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 L.objectLiteral(i)&&L.string(i.label)&&(L.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(L.string(i.description)||i.description===void 0)}t.is=n})(Ey||(Ey={}));var xo;(function(t){function e(n){const r=n;return L.string(r)}t.is=e})(xo||(xo={}));var H$;(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 _n.is(o)&&(Ey.is(o.annotationId)||xo.is(o.annotationId))}t.is=i})(H$||(H$={}));var Ry;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return L.defined(i)&&Cy.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(Ry||(Ry={}));var $y;(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==="create"&&L.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||L.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||L.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}t.is=n})($y||($y={}));var Ty;(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.kind==="rename"&&L.string(i.oldUri)&&L.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||L.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||L.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}t.is=n})(Ty||(Ty={}));var Sy;(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;return i&&i.kind==="delete"&&L.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||L.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||L.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}t.is=n})(Sy||(Sy={}));var ky;(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=>L.string(i.kind)?$y.is(i)||Ty.is(i)||Sy.is(i):Ry.is(i)))}t.is=e})(ky||(ky={}));var V$;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return L.defined(i)&&L.string(i.uri)}t.is=n})(V$||(V$={}));var K$;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return L.defined(i)&&L.string(i.uri)&&L.integer(i.version)}t.is=n})(K$||(K$={}));var Cy;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return L.defined(i)&&L.string(i.uri)&&(i.version===null||L.integer(i.version))}t.is=n})(Cy||(Cy={}));var Y$;(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 L.defined(i)&&L.string(i.uri)&&L.string(i.languageId)&&L.integer(i.version)&&L.string(i.text)}t.is=n})(Y$||(Y$={}));var Ay;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(Ay||(Ay={}));var _u;(function(t){function e(n){const r=n;return L.objectLiteral(n)&&Ay.is(r.kind)&&L.string(r.value)}t.is=e})(_u||(_u={}));var xt;(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})(xt||(xt={}));var Xn;(function(t){t.PlainText=1,t.Snippet=2})(Xn||(Xn={}));var X$;(function(t){t.Deprecated=1})(X$||(X$={}));var J$;(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&&L.string(i.newText)&&qe.is(i.insert)&&qe.is(i.replace)}t.is=n})(J$||(J$={}));var Q$;(function(t){t.asIs=1,t.adjustIndentation=2})(Q$||(Q$={}));var Z$;(function(t){function e(n){const r=n;return r&&(L.string(r.detail)||r.detail===void 0)&&(L.string(r.description)||r.description===void 0)}t.is=e})(Z$||(Z$={}));var eT;(function(t){function e(n){return{label:n}}t.create=e})(eT||(eT={}));var tT;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(tT||(tT={}));var tp;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return L.string(i)||L.objectLiteral(i)&&L.string(i.language)&&L.string(i.value)}t.is=n})(tp||(tp={}));var nT;(function(t){function e(n){let r=n;return!!r&&L.objectLiteral(r)&&(_u.is(r.contents)||tp.is(r.contents)||L.typedArray(r.contents,tp.is))&&(n.range===void 0||qe.is(n.range))}t.is=e})(nT||(nT={}));var rT;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(rT||(rT={}));var iT;(function(t){function e(n,r,...i){let s={label:n};return L.defined(r)&&(s.documentation=r),L.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(iT||(iT={}));var sT;(function(t){t.Text=1,t.Read=2,t.Write=3})(sT||(sT={}));var oT;(function(t){function e(n,r){let i={range:n};return L.number(r)&&(i.kind=r),i}t.create=e})(oT||(oT={}));var lr;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(lr||(lr={}));var aT;(function(t){t.Deprecated=1})(aT||(aT={}));var uT;(function(t){function e(n,r,i,s,o){let a={name:n,kind:r,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(uT||(uT={}));var cT;(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})(cT||(cT={}));var lT;(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&&L.string(i.name)&&L.number(i.kind)&&qe.is(i.range)&&qe.is(i.selectionRange)&&(i.detail===void 0||L.string(i.detail))&&(i.deprecated===void 0||L.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(lT||(lT={}));var dT;(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"})(dT||(dT={}));var np;(function(t){t.Invoked=1,t.Automatic=2})(np||(np={}));var fT;(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 L.defined(i)&&L.typedArray(i.diagnostics,ep.is)&&(i.only===void 0||L.typedArray(i.only,L.string))&&(i.triggerKind===void 0||i.triggerKind===np.Invoked||i.triggerKind===np.Automatic)}t.is=n})(fT||(fT={}));var pT;(function(t){function e(r,i,s){let o={title:r},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Po.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function n(r){let i=r;return i&&L.string(i.title)&&(i.diagnostics===void 0||L.typedArray(i.diagnostics,ep.is))&&(i.kind===void 0||L.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Po.is(i.command))&&(i.isPreferred===void 0||L.boolean(i.isPreferred))&&(i.edit===void 0||ky.is(i.edit))}t.is=n})(pT||(pT={}));var hT;(function(t){function e(r,i){let s={range:r};return L.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return L.defined(i)&&qe.is(i.range)&&(L.undefined(i.command)||Po.is(i.command))}t.is=n})(hT||(hT={}));var mT;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return L.defined(i)&&L.uinteger(i.tabSize)&&L.boolean(i.insertSpaces)}t.is=n})(mT||(mT={}));var gT;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return L.defined(i)&&qe.is(i.range)&&(L.undefined(i.target)||L.string(i.target))}t.is=n})(gT||(gT={}));var yT;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return L.objectLiteral(i)&&qe.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(yT||(yT={}));var Be;(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="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(Be||(Be={}));var et;(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"})(et||(et={}));var wT;(function(t){function e(n){const r=n;return L.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})(wT||(wT={}));var vT;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&qe.is(i.range)&&L.string(i.text)}t.is=n})(vT||(vT={}));var bT;(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&&qe.is(i.range)&&L.boolean(i.caseSensitiveLookup)&&(L.string(i.variableName)||i.variableName===void 0)}t.is=n})(bT||(bT={}));var DT;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&qe.is(i.range)&&(L.string(i.expression)||i.expression===void 0)}t.is=n})(DT||(DT={}));var ET;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return L.defined(i)&&qe.is(r.stoppedLocation)}t.is=n})(ET||(ET={}));var _y;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(_y||(_y={}));var Py;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return L.objectLiteral(i)&&(i.tooltip===void 0||L.string(i.tooltip)||_u.is(i.tooltip))&&(i.location===void 0||Zf.is(i.location))&&(i.command===void 0||Po.is(i.command))}t.is=n})(Py||(Py={}));var RT;(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 L.objectLiteral(i)&&Ze.is(i.position)&&(L.string(i.label)||L.typedArray(i.label,Py.is))&&(i.kind===void 0||_y.is(i.kind))&&i.textEdits===void 0||L.typedArray(i.textEdits,_n.is)&&(i.tooltip===void 0||L.string(i.tooltip)||_u.is(i.tooltip))&&(i.paddingLeft===void 0||L.boolean(i.paddingLeft))&&(i.paddingRight===void 0||L.boolean(i.paddingRight))}t.is=n})(RT||(RT={}));var $T;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})($T||($T={}));var TT;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(TT||(TT={}));var ST;(function(t){function e(n){return{items:n}}t.create=e})(ST||(ST={}));var kT;(function(t){t.Invoked=0,t.Automatic=1})(kT||(kT={}));var CT;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(CT||(CT={}));var AT;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(AT||(AT={}));var _T;(function(t){function e(n){const r=n;return L.objectLiteral(r)&&vy.is(r.uri)&&L.string(r.name)}t.is=e})(_T||(_T={}));var PT;(function(t){function e(s,o,a,u){return new Eq(s,o,a,u)}t.create=e;function n(s){let o=s;return!!(L.defined(o)&&L.string(o.uri)&&(L.undefined(o.languageId)||L.string(o.languageId))&&L.uinteger(o.lineCount)&&L.func(o.getText)&&L.func(o.positionAt)&&L.func(o.offsetAt))}t.is=n;function r(s,o){let a=s.getText(),u=i(o,(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),c=a.length;for(let l=u.length-1;l>=0;l--){let d=u[l],f=s.offsetAt(d.range.start),p=s.offsetAt(d.range.end);if(p<=c)a=a.substring(0,f)+d.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=f}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,d=0,f=0;for(;l<u.length&&d<c.length;)o(u[l],c[d])<=0?s[f++]=u[l++]:s[f++]=c[d++];for(;l<u.length;)s[f++]=u[l++];for(;d<c.length;)s[f++]=c[d++];return s}})(PT||(PT={}));let Eq=class{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){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(i);r=s==="\r"||s===`
115
+ `,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
116
+ `&&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 Ze.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 Ze.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.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var L;(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,h,w){return e.call(p)==="[object Number]"&&h<=p&&p<=w}t.numberRange=a;function u(p){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 d(p){return p!==null&&typeof p=="object"}t.objectLiteral=d;function f(p,h){return Array.isArray(p)&&p.every(h)}t.typedArray=f})(L||(L={}));class Rq{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new IT(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new Iy;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new xy(e.startOffset,e.image.length,Wd(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(e);r>=0&&n.content.splice(r,1)}}addHiddenNodes(e){const n=[];for(const s of e){const o=new xy(s.startOffset,s.image.length,Wd(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=e),e.$cstNode=n;const r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}}class xT{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(){return this.root.fullText.substring(this.offset,this.end)}}class xy extends xT{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 Iy extends xT{constructor(){super(...arguments),this.content=new aD(this)}get children(){return this.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._rangeCache}else return{start:Ze.create(0,0),end:Ze.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 aD extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,aD.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.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 IT extends Iy{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const Ny=Symbol("Datatype");function Oy(t){return t.$type===Ny}const NT="\u200B",OT=t=>t.endsWith(NT)?t:t+NT;class FT{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition,r=e.LanguageMetaData.mode==="production";this.wrapper=new Cq(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.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class $q extends FT{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Rq,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(OT(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(df(e))return Ny;{const n=ps(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=i.call(this.wrapper,{});return this.nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:s,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{const i=!this.isRecording()&&e!==void 0;if(i){const o={$type:e};this.stack.push(o),e===Ny&&(o.value="")}let s;try{s=n(r)}catch{s=void 0}return s===void 0&&i&&(s=this.construct()),s}}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,isCrossRef:u}=this.getAssignment(r),c=this.current;if(a){const l=Sr(r)?i.image:this.converter.convert(i.image,o);this.assign(a.operator,a.feature,l,o,u)}else if(Oy(c)){let l=i.image;Sr(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));const a=this.wrapper.wrapSubrule(e,n,s);!this.isRecording()&&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(Oy(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.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 og(e),this.nodeBuilder.construct(e),this.stack.pop(),Oy(e)?this.converter.convert(e.value,e.$cstNode):(ug(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=nn(e,Tr);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?Wa(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&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class Tq{buildMismatchTokenMessage(e){return Co.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Co.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Co.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Co.buildEarlyExitMessage(e)}}class LT extends Tq{buildMismatchTokenMessage({expected:e,actual:n}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":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 Sq extends FT{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,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(OT(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();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()||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 kq={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new LT};class Cq extends O3{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},kq),{lookaheadStrategy:r?new ly({maxLookahead:n.maxLookahead}):new nq({logging:n.skipValidations?()=>{}:void 0})}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n){return this.RULE(e,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n)}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 MT(t,e,n){return Aq({parser:e,tokens:n,ruleNames:new Map},t),e}function Aq(t,e){const n=pg(e,!1),r=rt(e.rules).filter(tn).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,Es(s,i.definition))}}function Es(t,e,n=!1){let r;if(Sr(e))r=Fq(t,e);else if(fs(e))r=_q(t,e);else if(Tr(e))r=Es(t,e.terminal);else if(Wa(e))r=BT(t,e);else if(Ur(e))r=Pq(t,e);else if(ig(e))r=Iq(t,e);else if(sg(e))r=Nq(t,e);else if($i(e))r=Oq(t,e);else if(SN(e)){const i=t.consume++;r=()=>t.parser.consume(i,Ai,e)}else throw new GD(e.$cstNode,`Unexpected element type: ${e.$type}`);return zT(t,n?void 0:rp(e),r,e.cardinality)}function _q(t,e){const n=uu(e);return()=>t.parser.action(n,e)}function Pq(t,e){const n=e.rule.ref;if(tn(n)){const r=t.subrule++,i=n.fragment,s=e.arguments.length>0?xq(n,e.arguments):()=>({});return o=>t.parser.subrule(r,qT(t,n),i,e,s(o))}else if(Gr(n)){const r=t.consume++,i=Fy(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)Ta();else throw new GD(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function xq(t,e){const n=e.map(r=>Zr(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 Zr(t){if(vN(t)){const e=Zr(t.left),n=Zr(t.right);return r=>e(r)||n(r)}else if(wN(t)){const e=Zr(t.left),n=Zr(t.right);return r=>e(r)&&n(r)}else if(bN(t)){const e=Zr(t.value);return n=>!e(n)}else if(DN(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(yN(t)){const e=!!t.true;return()=>e}Ta()}function Iq(t,e){if(e.elements.length===1)return Es(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:Es(t,i,!0)},o=rp(i);o&&(s.GATE=Zr(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 Nq(t,e){if(e.elements.length===1)return Es(t,e.elements[0]);const n=[];for(const a of e.elements){const u={ALT:Es(t,a,!0)},c=rp(a);c&&(u.GATE=Zr(c)),n.push(u)}const r=t.or++,i=(a,u)=>{const c=u.getRuleStack().join("-");return`uGroup_${a}_${c}`},s=a=>t.parser.alternatives(r,n.map((u,c)=>{const l={ALT:()=>!0},d=t.parser;l.ALT=()=>{if(u.ALT(a),!d.isRecording()){const p=i(r,d);d.unorderedGroups.get(p)||d.unorderedGroups.set(p,[]);const h=d.unorderedGroups.get(p);typeof h?.[c]>"u"&&(h[c]=!0)}};const f=u.GATE;return f?l.GATE=()=>f(a):l.GATE=()=>{const p=d.unorderedGroups.get(i(r,d));return!p?.[c]},l})),o=zT(t,rp(e),s,"*");return a=>{o(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function Oq(t,e){const n=e.elements.map(r=>Es(t,r));return r=>n.forEach(i=>i(r))}function rp(t){if($i(t))return t.guardCondition}function BT(t,e,n=e.terminal){if(n)if(Ur(n)&&tn(n.rule.ref)){const r=n.rule.ref,i=t.subrule++;return s=>t.parser.subrule(i,qT(t,r),!1,e,s)}else if(Ur(n)&&Gr(n.rule.ref)){const r=t.consume++,i=Fy(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(Sr(n)){const r=t.consume++,i=Fy(t,n.value);return()=>t.parser.consume(r,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=wg(e.type.ref),i=r?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+uu(e.type.ref));return BT(t,e,i)}}function Fq(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 zT(t,e,n,r){const i=e&&Zr(e);if(!r)if(i){const s=t.or++;return o=>t.parser.alternatives(s,[{ALT:()=>n(o),GATE:()=>i(o)},{ALT:E$(),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:E$(),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 Ta()}function qT(t,e){const n=Lq(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Lq(t,e){if(tn(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!tn(r);)($i(r)||ig(r)||sg(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 Fy(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function Mq(t){const e=t.Grammar,n=t.parser.Lexer,r=new Sq(t);return MT(e,r,n.definition),r.finalize(),r}function Bq(t){const e=zq(t);return e.finalize(),e}function zq(t){const e=t.Grammar,n=t.parser.Lexer,r=new $q(t);return MT(e,r,n.definition)}class qq{constructor(){this.diagnostics=[]}buildTokens(e,n){const r=rt(pg(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return i.forEach(o=>{const a=o.PATTERN;typeof a=="object"&&a&&"test"in a&&fg(a)?s.unshift(o):s.push(o)}),s}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Gr).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=cu(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=fg(n)?An.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(e,e.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(e,n,r){return e.filter(tn).flatMap(i=>kr(i).filter(Sr)).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(qN(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&jN("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class jq{convert(e,n){let r=n.grammarSource;if(Wa(r)&&(r=hg(r)),Ur(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 ei.convertInt(n);case"STRING":return ei.convertString(n);case"ID":return ei.convertID(n)}switch((i=lE(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return ei.convertNumber(n);case"boolean":return ei.convertBoolean(n);case"bigint":return ei.convertBigint(n);case"date":return ei.convertDate(n);default:return n}}}var ei;(function(t){function e(c){let l="";for(let d=1;d<c.length-1;d++){const f=c.charAt(d);if(f==="\\"){const p=c.charAt(++d);l+=n(p)}else l+=f}return l}t.convertString=e;function n(c){switch(c){case"b":return"\b";case"f":return"\f";case"n":return`
117
+ `;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})(ei||(ei={}));var Gq=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $s={},ip={},jT;function Ts(){if(jT)return ip;jT=1,Object.defineProperty(ip,"__esModule",{value:!0});let t;function e(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}return function(n){function r(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");t=i}n.install=r}(e),ip.default=e,ip}var Yt={},GT;function Pu(){if(GT)return Yt;GT=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.stringArray=Yt.array=Yt.func=Yt.error=Yt.number=Yt.string=Yt.boolean=void 0;function t(a){return a===!0||a===!1}Yt.boolean=t;function e(a){return typeof a=="string"||a instanceof String}Yt.string=e;function n(a){return typeof a=="number"||a instanceof Number}Yt.number=n;function r(a){return a instanceof Error}Yt.error=r;function i(a){return typeof a=="function"}Yt.func=i;function s(a){return Array.isArray(a)}Yt.array=s;function o(a){return s(a)&&a.every(u=>e(u))}return Yt.stringArray=o,Yt}var Ss={},UT;function Io(){if(UT)return Ss;UT=1,Object.defineProperty(Ss,"__esModule",{value:!0}),Ss.Emitter=Ss.Event=void 0;const t=Ts();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(Ss.Event=e={}));class n{add(s,o=null,a){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(s),this._contexts.push(o),Array.isArray(a)&&a.push({dispose:()=>this.remove(s,o)})}remove(s,o=null){if(!this._callbacks)return;let a=!1;for(let u=0,c=this._callbacks.length;u<c;u++)if(this._callbacks[u]===s)if(this._contexts[u]===o){this._callbacks.splice(u,1),this._contexts.splice(u,1);return}else a=!0;if(a)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...s){if(!this._callbacks)return[];const o=[],a=this._callbacks.slice(0),u=this._contexts.slice(0);for(let c=0,l=a.length;c<l;c++)try{o.push(a[c].apply(u[c],s))}catch(d){(0,t.default)().console.error(d)}return o}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{constructor(s){this._options=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){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return Ss.Emitter=r,r._noop=function(){},Ss}var WT;function sp(){if(WT)return $s;WT=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.CancellationTokenSource=$s.CancellationToken=void 0;const t=Ts(),e=Pu(),n=Io();var r;(function(a){a.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),a.Cancelled=Object.freeze({isCancellationRequested:!0,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||($s.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(){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 $s.CancellationTokenSource=o,$s}var at=sp();function Uq(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let op=0,Wq=10;function Hq(){return op=performance.now(),new at.CancellationTokenSource}const ap=Symbol("OperationCancelled");function up(t){return t===ap}async function It(t){if(t===at.CancellationToken.None)return;const e=performance.now();if(e-op>=Wq&&(op=e,await Uq(),op=performance.now()),t.isCancellationRequested)throw ap}class Ly{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class Od{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(let r of e)if(Od.isIncremental(r)){const i=VT(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.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=HT(r.text,!1,s);if(u-a===l.length)for(let f=0,p=l.length;f<p;f++)c[f+a+1]=l[f];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 d=r.text.length-(o-s);if(d!==0)for(let f=a+1+l.length,p=c.length;f<p;f++)c[f]=c[f]+d}else if(Od.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=HT(this._content,!0)),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{line:0,character:e};for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return{line:s,character: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.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var cp;(function(t){function e(i,s,o,a){return new Od(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Od)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){let o=i.getText(),a=My(s.map(Vq),(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),u=0;const c=[];for(const l of a){let d=i.offsetAt(l.range.start);if(d<u)throw new Error("Overlapping edit");d>u&&c.push(o.substring(u,d)),l.newText.length&&c.push(l.newText),u=i.offsetAt(l.range.end)}return c.push(o.substr(u)),c.join("")}t.applyEdits=r})(cp||(cp={}));function My(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);My(r,e),My(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++]=i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function HT(t,e,n=0){const r=e?[n]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function VT(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 Vq(t){const e=VT(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var KT;(()=>{var t={470:i=>{function s(u){if(typeof u!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(u))}function o(u,c){for(var l,d="",f=0,p=-1,h=0,w=0;w<=u.length;++w){if(w<u.length)l=u.charCodeAt(w);else{if(l===47)break;l=47}if(l===47){if(!(p===w-1||h===1))if(p!==w-1&&h===2){if(d.length<2||f!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var D=d.lastIndexOf("/");if(D!==d.length-1){D===-1?(d="",f=0):f=(d=d.slice(0,D)).length-1-d.lastIndexOf("/"),p=w,h=0;continue}}else if(d.length===2||d.length===1){d="",f=0,p=w,h=0;continue}}c&&(d.length>0?d+="/..":d="..",f=2)}else d.length>0?d+="/"+u.slice(p+1,w):d=u.slice(p+1,w),f=w-p-1;p=w,h=0}else l===46&&h!==-1?++h:h=-1}return d}var a={resolve:function(){for(var u,c="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var f;d>=0?f=arguments[d]:(u===void 0&&(u=process.cwd()),f=u),s(f),f.length!==0&&(c=f+"/"+c,l=f.charCodeAt(0)===47)}return c=o(c,!l),l?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(u){if(s(u),u.length===0)return".";var c=u.charCodeAt(0)===47,l=u.charCodeAt(u.length-1)===47;return(u=o(u,!c)).length!==0||c||(u="."),u.length>0&&l&&(u+="/"),c?"/"+u:u},isAbsolute:function(u){return s(u),u.length>0&&u.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var u,c=0;c<arguments.length;++c){var l=arguments[c];s(l),l.length>0&&(u===void 0?u=l:u+="/"+l)}return u===void 0?".":a.normalize(u)},relative:function(u,c){if(s(u),s(c),u===c||(u=a.resolve(u))===(c=a.resolve(c)))return"";for(var l=1;l<u.length&&u.charCodeAt(l)===47;++l);for(var d=u.length,f=d-l,p=1;p<c.length&&c.charCodeAt(p)===47;++p);for(var h=c.length-p,w=f<h?f:h,D=-1,g=0;g<=w;++g){if(g===w){if(h>w){if(c.charCodeAt(p+g)===47)return c.slice(p+g+1);if(g===0)return c.slice(p+g)}else f>w&&(u.charCodeAt(l+g)===47?D=g:g===0&&(D=0));break}var v=u.charCodeAt(l+g);if(v!==c.charCodeAt(p+g))break;v===47&&(D=g)}var E="";for(g=l+D+1;g<=d;++g)g!==d&&u.charCodeAt(g)!==47||(E.length===0?E+="..":E+="/..");return E.length>0?E+c.slice(p+D):(p+=D,c.charCodeAt(p)===47&&++p,c.slice(p))},_makeLong:function(u){return u},dirname:function(u){if(s(u),u.length===0)return".";for(var c=u.charCodeAt(0),l=c===47,d=-1,f=!0,p=u.length-1;p>=1;--p)if((c=u.charCodeAt(p))===47){if(!f){d=p;break}}else f=!1;return d===-1?l?"/":".":l&&d===1?"//":u.slice(0,d)},basename:function(u,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');s(u);var l,d=0,f=-1,p=!0;if(c!==void 0&&c.length>0&&c.length<=u.length){if(c.length===u.length&&c===u)return"";var h=c.length-1,w=-1;for(l=u.length-1;l>=0;--l){var D=u.charCodeAt(l);if(D===47){if(!p){d=l+1;break}}else w===-1&&(p=!1,w=l+1),h>=0&&(D===c.charCodeAt(h)?--h==-1&&(f=l):(h=-1,f=w))}return d===f?f=w:f===-1&&(f=u.length),u.slice(d,f)}for(l=u.length-1;l>=0;--l)if(u.charCodeAt(l)===47){if(!p){d=l+1;break}}else f===-1&&(p=!1,f=l+1);return f===-1?"":u.slice(d,f)},extname:function(u){s(u);for(var c=-1,l=0,d=-1,f=!0,p=0,h=u.length-1;h>=0;--h){var w=u.charCodeAt(h);if(w!==47)d===-1&&(f=!1,d=h+1),w===46?c===-1?c=h:p!==1&&(p=1):c!==-1&&(p=-1);else if(!f){l=h+1;break}}return c===-1||d===-1||p===0||p===1&&c===d-1&&c===l+1?"":u.slice(c,d)},format:function(u){if(u===null||typeof u!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof u);return function(c,l){var d=l.dir||l.root,f=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+f:d+"/"+f:f}(0,u)},parse:function(u){s(u);var c={root:"",dir:"",base:"",ext:"",name:""};if(u.length===0)return c;var l,d=u.charCodeAt(0),f=d===47;f?(c.root="/",l=1):l=0;for(var p=-1,h=0,w=-1,D=!0,g=u.length-1,v=0;g>=l;--g)if((d=u.charCodeAt(g))!==47)w===-1&&(D=!1,w=g+1),d===46?p===-1?p=g:v!==1&&(v=1):p!==-1&&(v=-1);else if(!D){h=g+1;break}return p===-1||w===-1||v===0||v===1&&p===w-1&&p===h+1?w!==-1&&(c.base=c.name=h===0&&f?u.slice(1,w):u.slice(h,w)):(h===0&&f?(c.name=u.slice(1,p),c.base=u.slice(1,w)):(c.name=u.slice(h,p),c.base=u.slice(h,w)),c.ext=u.slice(p,w)),h>0?c.dir=u.slice(0,h-1):f&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}n.d=(i,s)=>{for(var o in s)n.o(s,o)&&!n.o(i,o)&&Object.defineProperty(i,o,{enumerable:!0,get:s[o]})},n.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),n.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var r={};(()=>{let i;n.r(r),n.d(r,{URI:()=>f,Utils:()=>fe}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,o=/^\//,a=/^\/\//;function u(N,S){if(!N.scheme&&S)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${N.authority}", path: "${N.path}", query: "${N.query}", fragment: "${N.fragment}"}`);if(N.scheme&&!s.test(N.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(N.path){if(N.authority){if(!o.test(N.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(N.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const c="",l="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri(S){return S instanceof f||!!S&&typeof S.authority=="string"&&typeof S.fragment=="string"&&typeof S.path=="string"&&typeof S.query=="string"&&typeof S.scheme=="string"&&typeof S.fsPath=="string"&&typeof S.with=="function"&&typeof S.toString=="function"}scheme;authority;path;query;fragment;constructor(S,$,O,V,M,H=!1){typeof S=="object"?(this.scheme=S.scheme||c,this.authority=S.authority||c,this.path=S.path||c,this.query=S.query||c,this.fragment=S.fragment||c):(this.scheme=function(Ee,te){return Ee||te?Ee:"file"}(S,H),this.authority=$||c,this.path=function(Ee,te){switch(Ee){case"https":case"http":case"file":te?te[0]!==l&&(te=l+te):te=l}return te}(this.scheme,O||c),this.query=V||c,this.fragment=M||c,u(this,H))}get fsPath(){return v(this)}with(S){if(!S)return this;let{scheme:$,authority:O,path:V,query:M,fragment:H}=S;return $===void 0?$=this.scheme:$===null&&($=c),O===void 0?O=this.authority:O===null&&(O=c),V===void 0?V=this.path:V===null&&(V=c),M===void 0?M=this.query:M===null&&(M=c),H===void 0?H=this.fragment:H===null&&(H=c),$===this.scheme&&O===this.authority&&V===this.path&&M===this.query&&H===this.fragment?this:new h($,O,V,M,H)}static parse(S,$=!1){const O=d.exec(S);return O?new h(O[2]||c,G(O[4]||c),G(O[5]||c),G(O[7]||c),G(O[9]||c),$):new h(c,c,c,c,c)}static file(S){let $=c;if(i&&(S=S.replace(/\\/g,l)),S[0]===l&&S[1]===l){const O=S.indexOf(l,2);O===-1?($=S.substring(2),S=l):($=S.substring(2,O),S=S.substring(O)||l)}return new h("file",$,S,c,c)}static from(S){const $=new h(S.scheme,S.authority,S.path,S.query,S.fragment);return u($,!0),$}toString(S=!1){return E(this,S)}toJSON(){return this}static revive(S){if(S){if(S instanceof f)return S;{const $=new h(S);return $._formatted=S.external,$._fsPath=S._sep===p?S.fsPath:null,$}}return S}}const p=i?1:void 0;class h extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString(S=!1){return S?E(this,!0):(this._formatted||(this._formatted=E(this,!1)),this._formatted)}toJSON(){const S={$mid:1};return this._fsPath&&(S.fsPath=this._fsPath,S._sep=p),this._formatted&&(S.external=this._formatted),this.path&&(S.path=this.path),this.scheme&&(S.scheme=this.scheme),this.authority&&(S.authority=this.authority),this.query&&(S.query=this.query),this.fragment&&(S.fragment=this.fragment),S}}const w={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function D(N,S,$){let O,V=-1;for(let M=0;M<N.length;M++){const H=N.charCodeAt(M);if(H>=97&&H<=122||H>=65&&H<=90||H>=48&&H<=57||H===45||H===46||H===95||H===126||S&&H===47||$&&H===91||$&&H===93||$&&H===58)V!==-1&&(O+=encodeURIComponent(N.substring(V,M)),V=-1),O!==void 0&&(O+=N.charAt(M));else{O===void 0&&(O=N.substr(0,M));const Ee=w[H];Ee!==void 0?(V!==-1&&(O+=encodeURIComponent(N.substring(V,M)),V=-1),O+=Ee):V===-1&&(V=M)}}return V!==-1&&(O+=encodeURIComponent(N.substring(V))),O!==void 0?O:N}function g(N){let S;for(let $=0;$<N.length;$++){const O=N.charCodeAt($);O===35||O===63?(S===void 0&&(S=N.substr(0,$)),S+=w[O]):S!==void 0&&(S+=N[$])}return S!==void 0?S:N}function v(N,S){let $;return $=N.authority&&N.path.length>1&&N.scheme==="file"?`//${N.authority}${N.path}`:N.path.charCodeAt(0)===47&&(N.path.charCodeAt(1)>=65&&N.path.charCodeAt(1)<=90||N.path.charCodeAt(1)>=97&&N.path.charCodeAt(1)<=122)&&N.path.charCodeAt(2)===58?N.path[1].toLowerCase()+N.path.substr(2):N.path,i&&($=$.replace(/\//g,"\\")),$}function E(N,S){const $=S?g:D;let O="",{scheme:V,authority:M,path:H,query:Ee,fragment:te}=N;if(V&&(O+=V,O+=":"),(M||V==="file")&&(O+=l,O+=l),M){let C=M.indexOf("@");if(C!==-1){const me=M.substr(0,C);M=M.substr(C+1),C=me.lastIndexOf(":"),C===-1?O+=$(me,!1,!1):(O+=$(me.substr(0,C),!1,!1),O+=":",O+=$(me.substr(C+1),!1,!0)),O+="@"}M=M.toLowerCase(),C=M.lastIndexOf(":"),C===-1?O+=$(M,!1,!0):(O+=$(M.substr(0,C),!1,!0),O+=M.substr(C))}if(H){if(H.length>=3&&H.charCodeAt(0)===47&&H.charCodeAt(2)===58){const C=H.charCodeAt(1);C>=65&&C<=90&&(H=`/${String.fromCharCode(C+32)}:${H.substr(3)}`)}else if(H.length>=2&&H.charCodeAt(1)===58){const C=H.charCodeAt(0);C>=65&&C<=90&&(H=`${String.fromCharCode(C+32)}:${H.substr(2)}`)}O+=$(H,!0,!1)}return Ee&&(O+="?",O+=$(Ee,!1,!1)),te&&(O+="#",O+=S?te:D(te,!1,!1)),O}function k(N){try{return decodeURIComponent(N)}catch{return N.length>3?N.substr(0,3)+k(N.substr(3)):N}}const P=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function G(N){return N.match(P)?N.replace(P,S=>k(S)):N}var W=n(470);const Z=W.posix||W,J="/";var fe;(function(N){N.joinPath=function(S,...$){return S.with({path:Z.join(S.path,...$)})},N.resolvePath=function(S,...$){let O=S.path,V=!1;O[0]!==J&&(O=J+O,V=!0);let M=Z.resolve(O,...$);return V&&M[0]===J&&!S.authority&&(M=M.substring(1)),S.with({path:M})},N.dirname=function(S){if(S.path.length===0||S.path===J)return S;let $=Z.dirname(S.path);return $.length===1&&$.charCodeAt(0)===46&&($=""),S.with({path:$})},N.basename=function(S){return Z.basename(S.path)},N.extname=function(S){return Z.extname(S.path)}})(fe||(fe={}))})(),KT=r})();const{URI:Xt,Utils:xu}=KT;var kt;(function(t){t.basename=xu.basename,t.dirname=xu.dirname,t.extname=xu.extname,t.joinPath=xu.joinPath,t.resolvePath=xu.resolvePath;function e(i,s){return i?.toString()===s?.toString()}t.equals=e;function n(i,s){const o=typeof i=="string"?i:i.path,a=typeof s=="string"?s:s.path,u=o.split("/").filter(p=>p.length>0),c=a.split("/").filter(p=>p.length>0);let l=0;for(;l<u.length&&u[l]===c[l];l++);const d="../".repeat(u.length-l),f=c.slice(l).join("/");return d+f}t.relative=n;function r(i){return Xt.parse(i.toString()).toString()}t.normalize=r})(kt||(kt={}));var je;(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"})(je||(je={}));class Kq{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=at.CancellationToken.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??Xt.parse(e.uri),at.CancellationToken.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromString(e,n,r){return at.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){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:je.Parsed,references:[],textDocument:r};else{const o=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:je.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(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=je.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=cp.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class Yq{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return rt(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||(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=je.Changed,r.precomputedScopes=void 0,r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=je.Changed,this.documentMap.delete(n)),r}}const By=Symbol("ref_resolving");class Xq{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=at.CancellationToken.None){for(const r of Wr(e.parseResult.value))await It(n),rf(r).forEach(i=>this.doLink(i,e))}doLink(e,n){var r;const i=e.reference;if(i._ref===void 0){i._ref=By;try{const s=this.getCandidate(e);if(Gd(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({},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($t(this._ref))return this._ref;if(dN(this._nodeDescription)){const u=s.loadAstNode(this._nodeDescription);this._ref=u??s.createLinkingError({reference:o,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=By;const u=nf(e).$document,c=s.getLinkedNode({reference:o,container:e,property:n});if(c.error&&u&&u.state<je.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===By)throw new Error(`Cyclic reference resolution detected: ${s.astNodeLocator.getAstNodePath(e)}/${n} (symbol '${i}')`);return $t(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Gd(this._ref)?this._ref:void 0}};return o}getLinkedNode(e){var n;try{const r=this.getCandidate(e);if(Gd(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?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=nf(e.container).$document;r&&r.state<je.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${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 lp(t){return typeof t.name=="string"}class YT{getName(e){if(lp(e))return e.name}getNameNode(e){return rn(e.$cstNode,"name")}}class Jq{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const n=iE(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(Un(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(Un(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||FD(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(e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>kt.equals(s.sourceUri,n.documentUri))),r.push(...i),rt(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=wt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:$a(n),local:!0}}}}class Ln{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return Hm.sum(rt(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.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 rt(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return rt(this.map.keys())}values(){return rt(this.map.values()).flat()}entriesGroupedByKey(){return rt(this.map.entries())}}class XT{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[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 JT{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=at.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=iu,i=at.CancellationToken.None){const s=[];this.exportNode(e,s,n);for(const o of r(e))await It(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=at.CancellationToken.None){const r=e.parseResult.value,i=new Ln;for(const s of kr(r))await It(n),this.processNode(s,e,i);return i}processNode(e,n,r){const i=e.$container;if(i){const s=this.nameProvider.getName(e);s&&r.add(i,this.descriptions.createDescription(e,s,n))}}}class ks{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.outerScope)return this.outerScope.getElement(e)}}class QT{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=rt(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}const dp={getElement(){},getAllElements(){return ho}};class ZT{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 Qq extends ZT{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,n){this.throwIfDisposed(),this.cache.set(e,n)}get(e,n){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(n){const r=n();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class eS extends ZT{constructor(e){super(),this.cache=new Map,this.converter=e??(n=>n)}has(e,n){return this.throwIfDisposed(),this.cacheForContext(e).has(n)}set(e,n,r){this.throwIfDisposed(),this.cacheForContext(e).set(n,r)}get(e,n,r){this.throwIfDisposed();const i=this.cacheForContext(e);if(i.has(n))return i.get(n);if(r){const s=r();return i.set(n,s),s}else return}delete(e,n){return this.throwIfDisposed(),this.cacheForContext(e).delete(n)}clear(e){if(this.throwIfDisposed(),e){const n=this.converter(e);this.cache.delete(n)}else this.cache.clear()}cacheForContext(e){const n=this.converter(e);let r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}}class tS extends eS{constructor(e,n){super(r=>r.toString()),n?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(n,r=>{this.clear(r.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{for(const s of i)this.clear(s)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{const s=r.concat(i);for(const o of s)this.clear(o)}))}}class nS extends Qq{constructor(e,n){super(),n?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(n,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class rS{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new nS(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=wt(e.container).precomputedScopes;if(i){let o=e.container;do{const a=i.get(o);a.length>0&&n.push(rt(a).filter(u=>this.reflection.isSubtype(u.type,r))),o=o.$container}while(o)}let s=this.getGlobalScope(r,e);for(let o=n.length-1;o>=0;o--)s=this.createScope(n[o],s);return s}createScope(e,n,r){return new ks(rt(e),n,r)}createScopeForNodes(e,n,r){const i=rt(e).map(s=>{const o=this.nameProvider.getName(s);if(o)return this.descriptions.createDescription(s,o)}).nonNullable();return new ks(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new QT(this.indexManager.allElements(e)))}}function Zq(t){return typeof t.$comment=="string"}function iS(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class ej{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,n){const r=n??{},i=n?.replacer,s=(a,u)=>this.replacer(a,u,r),o=i?(a,u)=>i(a,u,s):s;try{return this.currentDocument=wt(e),JSON.stringify(e,o,n?.space)}finally{this.currentDocument=void 0}}deserialize(e,n){const r=n??{},i=JSON.parse(e);return this.linkNode(i,i,r),i}replacer(e,n,{refText:r,sourceText:i,textRegions:s,comments:o,uriConverter:a}){var u,c,l,d;if(!this.ignoreProperties.has(e))if(Un(n)){const f=n.ref,p=r?n.$refText:void 0;if(f){const h=wt(f);let w="";this.currentDocument&&this.currentDocument!==h&&(a?w=a(h.uri,n):w=h.uri.toString());const D=this.astNodeLocator.getAstNodePath(f);return{$ref:`${w}#${D}`,$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($t(n)){let f;if(s&&(f=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&f?.$textRegion&&(f.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(f??(f=Object.assign({},n)),f.$sourceText=(d=n.$cstNode)===null||d===void 0?void 0:d.text),o){f??(f=Object.assign({},n));const p=this.commentProvider.getComment(n);p&&(f.$comment=p.replace(/\r/g,""))}return f??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={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const o=wo(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 d=c[l];iS(d)?c[l]=this.reviveReference(e,u,n,d,r):$t(d)&&this.linkNode(d,n,r,e,u,l)}else iS(c)?e[u]=this.reviveReference(e,u,n,c,r):$t(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.$refText,a=i.$error;if(i.$ref){const u=this.getRefNode(r,i.$ref,s.uriConverter);if($t(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):Xt.parse(n),c=this.langiumDocuments.getDocument(u);return c?c.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):Xt.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 tj{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=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);this.languageIdMap.set(n.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var n,r;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 i=(r=(n=this.textDocuments)===null||n===void 0?void 0:n.get(e))===null||r===void 0?void 0:r.languageId;if(i!==void 0){const a=this.languageIdMap.get(i);if(a)return a}const s=kt.extname(e),o=this.fileExtensionMap.get(s);if(!o)throw i?new Error(`The service registry contains no services for the extension '${s}' for language '${i}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return o}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function Iu(t){return{code:t}}var fp;(function(t){t.all=["fast","slow","built-in"]})(fp||(fp={}));class nj{constructor(e){this.entries=new Ln,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=="function"){const a={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,a)}else Ta()}}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(up(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"){this.entries.add("AstNode",n);return}for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,n)}getChecks(e,n){let r=rt(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 occurred 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 rj{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=at.CancellationToken.None){const i=e.parseResult,s=[];if(await It(r),(!n.categories||n.categories.includes("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)===dr.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)===dr.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)===dr.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(o){if(up(o))throw o;console.error("An error occurred during validation:",o)}return await It(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:zy(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:sj(c),source:this.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=Wd(i.token);if(s){const o={severity:zy("error"),range:s,message:i.message,data:Iu(dr.ParsingError),source:this.getSource()};n.push(o)}}}processLinkingErrors(e,n,r){for(const i of e.references){const s=i.error;if(s){const o={node:s.container,property:s.property,index:s.index,data:{code:dr.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=at.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=at.CancellationToken.None){var s;const o=this.validationRegistry.checksBefore;for(const a of o)await It(i),await a(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}async validateAstNodes(e,n,r,i=at.CancellationToken.None){await Promise.all(Wr(e).map(async s=>{await It(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=at.CancellationToken.None){var s;const o=this.validationRegistry.checksAfter;for(const a of o)await It(i),await a(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}toDiagnostic(e,n,r){return{message:n,range:ij(r),severity:zy(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 ij(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=rn(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=au(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function zy(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 sj(t){switch(t){case"error":return Iu(dr.LexingError);case"warning":return Iu(dr.LexingWarning);case"info":return Iu(dr.LexingInfo);case"hint":return Iu(dr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var dr;(function(t){t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(dr||(dr={}));class oj{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r){const i=r??wt(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=()=>{var u;return o??(o=$a((u=this.nameProvider.getNameNode(e))!==null&&u!==void 0?u:e.$cstNode))};return{node:e,name:n,get nameSegment(){return a()},selectionSegment:$a(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class aj{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=at.CancellationToken.None){const r=[],i=e.parseResult.value;for(const s of Wr(i))await It(n),rf(s).filter(o=>!Gd(o)).forEach(o=>{const a=this.createDescription(o);a&&r.push(a)});return r}createDescription(e){const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=wt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:$a(r),local:kt.equals(n.documentUri,i)}}}class uj{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({$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 cj=Io();class lj{constructor(e){this._ready=new Ly,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new cj.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(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])return this.settings[r][n]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var Cs;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(Cs||(Cs={}));class dj{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Ln,this.documentPhaseListeners=new Ln,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=je.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=at.CancellationToken.None){var i,s;for(const o of e){const a=o.uri.toString();if(o.state===je.Validated){if(typeof n.validation=="boolean"&&n.validation)o.state=je.IndexedReferences,o.diagnostics=void 0,this.buildState.delete(a);else if(typeof n.validation=="object"){const u=this.buildState.get(a),c=(i=u?.result)===null||i===void 0?void 0:i.validationChecks;if(c){const d=((s=n.validation.categories)!==null&&s!==void 0?s:fp.all).filter(f=>!c.includes(f));d.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:d})},result:u.result}),o.state=je.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=je.Changed,await this.emitUpdate(e.map(o=>o.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=at.CancellationToken.None){this.currentState=je.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=je.Changed,this.langiumDocuments.addDocument(u)}this.buildState.delete(o.toString())}const i=rt(e).concat(n).map(o=>o.toString()).toSet();this.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,je.ComputedScopes),o.diagnostics=void 0}),await this.emitUpdate(e,n),await It(r);const s=this.sortDocuments(this.langiumDocuments.all.filter(o=>{var a;return o.state<je.Linked||!(!((a=this.buildState.get(o.uri.toString()))===null||a===void 0)&&a.completed)}).toArray());await this.buildDocuments(s,this.updateBuildOptions,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(e),Cs.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,je.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,je.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,je.ComputedScopes,r,async s=>{const o=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await o.computeLocalScopes(s,r)}),await this.runCancelable(e,je.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,je.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,je.Validated,r,s=>this.validate(s,r));for(const s of e){const o=this.buildState.get(s.uri.toString());o&&(o.completed=!0)}}prepareBuild(e,n){for(const r of e){const i=r.uri.toString(),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 It(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),Cs.create(()=>{this.buildPhaseListeners.delete(e,n)})}onDocumentPhase(e,n){return this.documentPhaseListeners.add(e,n),Cs.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=at.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(ap):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(()=>{a.dispose(),u.dispose(),o(ap)})})}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(!up(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 It(r),await o(e,r)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,n){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:fp.all;c.result.validationChecks?c.result.validationChecks.push(...l):c.result.validationChecks=[...l]}}getBuildOptions(e){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 fj{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new eS,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=wt(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(o=>{kt.equals(o.targetUri,r)&&o.targetPath===n&&i.push(o)})}),rt(i)}allElements(e,n){let r=rt(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.delete(n)}async updateContent(e,n=at.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=at.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(e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class sS{constructor(e){this.initialBuildOptions={},this._ready=new Ly,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=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=at.CancellationToken.None){const r=await this.performStartup(e);await It(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(e){const n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),r=[],i=s=>{r.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,i))),this._ready.resolve(),r}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return Xt.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.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=kt.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=kt.extname(n.uri);return r.includes(s)}return!1}}class pj{buildUnexpectedCharactersMessage(e,n,r,i,s){return Qg.buildUnexpectedCharactersMessage(e,n,r,i,s)}buildUnableToPopLexerModeMessage(e){return Qg.buildUnableToPopLexerModeMessage(e)}}const hj={mode:"full"};class mj{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=aS(n)?Object.values(n):n,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new An(r,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,n=hj){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(aS(e))return e;const n=oS(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function gj(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function oS(t){return t&&"modes"in t&&"defaultMode"in t}function aS(t){return!gj(t)&&!oS(t)}function yj(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=Ze.create(0,0));const s=uS(t),o=jy(r),a=bj({lines:s,position:i,options:o});return Tj({index:0,tokens:a,position:i})}function wj(t,e){const n=jy(e),r=uS(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],o=n.start,a=n.end;return!!o?.exec(i)&&!!a?.exec(s)}function uS(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(eE)}const cS=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,vj=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function bj(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],d=0;if(u&&t.options.start){const p=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);p&&(d=p.index+p[0].length)}else{const p=(n=t.options.line)===null||n===void 0?void 0:n.exec(l);p&&(d=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,$j(l)),qy(l,d)>=l.length){if(i.length>0){const p=Ze.create(s,o);i.push({type:"break",content:"",range:qe.create(p,p)})}}else{cS.lastIndex=d;const p=cS.exec(l);if(p){const h=p[0],w=p[1],D=Ze.create(s,o+d),g=Ze.create(s,o+d+h.length);i.push({type:"tag",content:w,range:qe.create(D,g)}),d+=h.length,d=qy(l,d)}if(d<l.length){const h=l.substring(d),w=Array.from(h.matchAll(vj));i.push(...Dj(w,h,s,o+d))}}s++,o=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function Dj(t,e,n,r){const i=[];if(t.length===0){const s=Ze.create(n,r),o=Ze.create(n,r+e.length);i.push({type:"text",content:e,range:qe.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:qe.create(Ze.create(n,s+r),Ze.create(n,u+r))});let l=c.length+1;const d=a[1];if(i.push({type:"inline-tag",content:d,range:qe.create(Ze.create(n,s+l+r),Ze.create(n,s+l+d.length+r))}),l+=d.length,a.length===4){l+=a[2].length;const f=a[3];i.push({type:"text",content:f,range:qe.create(Ze.create(n,s+l+r),Ze.create(n,s+l+f.length+r))})}else i.push({type:"text",content:"",range:qe.create(Ze.create(n,s+l+r),Ze.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:qe.create(Ze.create(n,s+r),Ze.create(n,s+r+o.length))})}return i}const Ej=/\S/,Rj=/\s*$/;function qy(t,e){const n=t.substring(e).match(Ej);return n?e+n.index:t.length}function $j(t){const e=t.match(Rj);if(e&&typeof e.index=="number")return e.index}function Tj(t){var e,n,r,i;const s=Ze.create(t.position.line,t.position.character);if(t.tokens.length===0)return new pS([],qe.create(s,s));const o=[];for(;t.index<t.tokens.length;){const c=Sj(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!==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 pS(o,qe.create(a,u))}function Sj(t,e){const n=t.tokens[t.index];if(n.type==="tag")return dS(t,!1);if(n.type==="text"||n.type==="inline-tag")return lS(t);kj(n,e),t.index++}function kj(t,e){if(e){const n=new hS("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function lS(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(Cj(t)),r=e,e=t.tokens[t.index];return new Wy(i,qe.create(n.range.start,r.range.end))}function Cj(t){return t.tokens[t.index].type==="inline-tag"?dS(t,!0):fS(t)}function dS(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=fS(t);return new Uy(r,new Wy([s],s.range),e,qe.create(n.range.start,s.range.end))}else{const s=lS(t);return new Uy(r,s,e,qe.create(n.range.start,s.range.end))}else{const s=n.range;return new Uy(r,new Wy([],s),e,s)}}function fS(t){const e=t.tokens[t.index++];return new hS(e.content,e.range)}function jy(t){if(!t)return jy({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:Gy(e,!0),end:Gy(n,!1),line:Gy(r,!0)}}function Gy(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?cf(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class pS{constructor(e,n){this.elements=e,this.range=n}getTag(e){return this.getAllTags().find(n=>n.name===e)}getTags(e){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+=mS(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+=mS(n)+i}return n.trim()}}class Uy{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.content.toString();return this.content.inlines.length===1?e=`${e} ${n}`:this.content.inlines.length>1&&(e=`${e}
118
+ ${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=Aj(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.content.inlines.length>1&&(i=`${i}
119
+ ${n}`),this.inline?`{${i}}`:i}}function Aj(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=qy(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:_j(e,o)}}function _j(t,e){try{return Xt.parse(t,!0),`[${e}](${t})`}catch{return t}}class Wy{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";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+=`
120
+ `)}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+=`
121
+ `)}return n}}class hS{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function mS(t){return t.endsWith(`
122
+ `)?`
123
+ `:`
124
+
125
+ `}class Pj{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&wj(n))return yj(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.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=wt(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 xj{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return Zq(e)?e.$comment:(n=Hd(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class Ij{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class Nj{constructor(){this.previousTokenSource=new at.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=Hq();return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r=at.CancellationToken.None){const i=new Ly,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})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){up(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class Oj{constructor(e){this.grammarElementIdMap=new XT,this.tokenTypeIdMap=new XT,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.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 Wr(e))n.set(i,{});if(e.$cstNode)for(const i of Ra(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.$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)$t(a)?o.push(this.dehydrateAstNode(a,n)):Un(a)?o.push(this.dehydrateReference(a,n)):o.push(a)}else $t(s)?r[i]=this.dehydrateAstNode(s,n):Un(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)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return ND(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),Ei(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):ds(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(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 Wr(e))n.set(s,{});let i;if(e.$cstNode)for(const s of Ra(e.$cstNode)){let o;"fullText"in s?(o=new IT(s.fullText),i=o):"content"in s?o=new Iy:"tokenType"in s&&(o=this.hydrateCstLeafNode(s)),o&&(r.set(s,o),o.root=i)}return{astNodes:n,cstNodes:r}}hydrateAstNode(e,n){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)$t(a)?o.push(this.setParent(this.hydrateAstNode(a,n),r)):Un(a)?o.push(this.hydrateReference(a,r,i,n)):o.push(a)}else $t(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):Un(s)?r[i]=this.hydrateReference(s,r,i,n):s!==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),Ei(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),r=e.offset,i=e.length,s=e.startLine,o=e.startColumn,a=e.endLine,u=e.endColumn,c=e.hidden;return new xy(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(){let e=0;for(const n of Wr(this.grammar))Zm(n)&&this.grammarElementIdMap.set(n,e++)}}function gS(t){return{documentation:{CommentProvider:e=>new xj(e),DocumentationProvider:e=>new Pj(e)},parser:{AsyncParser:e=>new Ij(e),GrammarConfig:e=>QN(e),LangiumParser:e=>Bq(e),CompletionParser:e=>Mq(e),ValueConverter:()=>new jq,TokenBuilder:()=>new qq,Lexer:e=>new mj(e),ParserErrorMessageProvider:()=>new LT,LexerErrorMessageProvider:()=>new pj},workspace:{AstNodeLocator:()=>new uj,AstNodeDescriptionProvider:e=>new oj(e),ReferenceDescriptionProvider:e=>new aj(e)},references:{Linker:e=>new Xq(e),NameProvider:()=>new YT,ScopeProvider:e=>new rS(e),ScopeComputation:e=>new JT(e),References:e=>new Jq(e)},serializer:{Hydrator:e=>new Oj(e),JsonSerializer:e=>new ej(e)},validation:{DocumentValidator:e=>new rj(e),ValidationRegistry:e=>new nj(e)},shared:()=>t.shared}}function yS(t){return{ServiceRegistry:e=>new tj(e),workspace:{LangiumDocuments:e=>new Yq(e),LangiumDocumentFactory:e=>new Kq(e),DocumentBuilder:e=>new dj(e),IndexManager:e=>new fj(e),WorkspaceManager:e=>new sS(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new Nj,ConfigurationProvider:e=>new lj(e)}}}var pp;(function(t){t.merge=(e,n)=>mp(mp({},e),n)})(pp||(pp={}));function hp(t,e,n,r,i,s,o,a,u){const c=[t,e,n,r,i,s,o,a,u].reduce(mp,{});return vS(c)}const wS=Symbol("isProxy");function Hy(t){if(t&&t[wS])for(const e of Object.values(t))Hy(e);return t}function vS(t,e){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===wS?!0:DS(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(DS(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return n}const bS=Symbol();function DS(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]===bS)throw new Error('Cycle detected. Please make "'+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]=bS;try{t[e]=typeof i=="function"?i(r):vS(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function mp(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]=mp(i,r):t[n]=r}}return t}class Fj{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const ES={fileSystemProvider:()=>new Fj},Lj={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},Mj={AstReflection:()=>new YD};function Bj(){const t=hp(yS(ES),Mj),e=hp(gS({shared:t}),Lj);return t.ServiceRegistry.register(e),e}function zj(t){var e;const n=Bj(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Xt.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var qj={done:!0,hasNext:!1},Nu={done:!1,hasNext:!1},jj=()=>qj,Gj=t=>({hasNext:!0,next:t,done:!1});function Qe(t,...e){let n=t,r=e.map(s=>"lazy"in s?Uj(s):void 0),i=0;for(;i<e.length;){if(r[i]===void 0||!Wj(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(RS(u,o,s))break;let{isSingle:a}=s.at(-1);n=a?o[0]:o,i+=s.length}return n}function RS(t,e,n){if(n.length===0)return e.push(t),!1;let r=t,i=Nu,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(RS(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 Uj(t){let{lazy:e,lazyArgs:n}=t,r=e(...n);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}function Wj(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}function $S(t,e){let n=e.length-t.length;if(n===1){let[r,...i]=e;return Qe(r,{lazy:t,lazyArgs:i})}if(n===0){let r={lazy:t,lazyArgs:e};return Object.assign(i=>Qe(i,r),r)}throw new Error("Wrong number of arguments")}function Hj(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function ut(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return Hj(t,e,n);throw new Error("Wrong number of arguments")}function Ou(...t){return ut(Object.values,t)}function Vy(...t){return $S(Vj,t)}function Vj(){let t=new Set;return e=>t.has(e)?Nu:(t.add(e),{done:!1,hasNext:!0,next:e})}function Kj(...t){return ut(Yj,t,Xj)}var Yj=(t,e)=>e<0?[]:t.slice(0,e);function Xj(t){if(t<=0)return jj;let e=t;return n=>(e-=1,{done:e<=0,hasNext:!0,next:n})}function As(...t){return ut(Jj,t)}var Jj=(t,e)=>t.length>=e;function Qj(...t){return ut(Zj,t)}function Zj(t,e){return e(t),t}function TS(...t){return ut(eG,t)}function eG(t,e){let n=[...t];return n.sort(e),n}function Ky(...t){return ut(tG,t)}var tG=(t,e,n)=>t.reduce(e,n);function SS(...t){return ut(nG,t)}function nG(t){return[...t].reverse()}function Fu(...t){return ut(rG,t)}var rG=(t,e)=>t[e];function iG(...t){return ut(sG,t)}function sG(t,e){if(!As(e,1))return{...t};if(!As(e,2)){let{[e[0]]:r,...i}=t;return i}let n={...t};for(let r of e)delete n[r];return n}function Lu(...t){return ut(oG,t)}function oG(t,e){let n={};for(let[r,i]of Object.entries(t)){let s=e(i,r,t);n[r]=s}return n}function ae(t){return!!t}function Mu(...t){return ut(aG,t)}var aG=t=>t.at(-1);function gn(...t){return ut(uG,t,cG)}var uG=(t,e)=>t.map(e),cG=t=>(e,n,r)=>({done:!1,hasNext:!0,next:t(e,n,r)});function fr(...t){return ut(lG,t)}function lG(t,e){let n={};for(let[r,i]of t.entries()){let[s,o]=e(i,r,t);n[s]=o}return n}function gp(t){return typeof t=="number"&&!Number.isNaN(t)}function dG(t){return t instanceof Promise}function kS(t){return typeof t=="string"}function _s(t){return t===void 0?!0:typeof t=="string"||Array.isArray(t)?t.length===0:Object.keys(t).length===0}function fG(t){return t instanceof Error}function sn(t){return t!=null}function Dt(t){return t==null}function pG(t){return Array.isArray(t)}function Yy(t){return typeof t=="boolean"}function Jt(t){return t!==void 0}function hG(t,{triggerAt:e="end",minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:s=mG}){let o,a,u,c,l=()=>{let p=u;p!==void 0&&(u=void 0,t(p),i!==void 0&&(a=setTimeout(d,i)))},d=()=>{clearTimeout(a),a=void 0,o===void 0&&l()},f=()=>{clearTimeout(o),o=void 0,c=void 0,a===void 0&&l()};return{call:(...p)=>{let h=o===void 0&&a===void 0;if((e!=="start"||h)&&(u=s(u,...p)),!(o===void 0&&!h)){if(n!==void 0||r!==void 0||i===void 0){clearTimeout(o);let w=Date.now();c??=w;let D=r===void 0?n??0:Math.min(n??r,r-(w-c));o=setTimeout(f,D)}e!=="end"&&h&&l()}},cancel:()=>{clearTimeout(o),o=void 0,c=void 0,clearTimeout(a),a=void 0,u=void 0},flush:()=>{f(),d()},get isIdle(){return o===void 0&&a===void 0}}}var mG=()=>"";function Ps(...t){return ut(gG,t)}var gG=(t,e)=>{let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);if(s!==void 0){let{[s]:o}=n;o===void 0&&(o=[],n[s]=o),o.push(i)}}return n};function yG(){return wG}var wG=t=>t;function Xy(...t){return ut(vG,t)}function vG(t,e){let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);n[s]=i}return n}function Ii(...t){return ut(bG,t,DG)}var bG=(t,e)=>t.flatMap(e),DG=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 EG(...t){return ut(RG,t,$G)}function RG(t,e){return t.forEach(e),t}var $G=t=>(e,n,r)=>(t(e,n,r),{done:!1,hasNext:!0,next:e});function yp(...t){return ut(TG,t)}function TG(t,e){for(let[n,r]of Object.entries(t))e(r,n,t);return t}function wp(...t){return ut(Object.entries,t)}function Ge(...t){return ut(SG,t,kG)}var SG=(t,e)=>t.filter(e),kG=t=>(e,n,r)=>t(e,n,r)?{done:!1,hasNext:!0,next:e}:Nu,CS=t=>Object.assign(t,{single:!0});function AS(...t){return ut(CG,t,CS(AG))}var CG=(t,e)=>t.find(e),AG=t=>(e,n,r)=>t(e,n,r)?{done:!0,hasNext:!0,next:e}:Nu;function _S(...t){return ut(_G,t)}var _G=(t,e)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(e(r,n,t))return r}};function No(...t){return ut(PG,t,CS(xG))}var PG=([t])=>t,xG=()=>IG,IG=t=>({hasNext:!0,next:t,done:!0});function PS(...t){return ut(NG,t)}var NG=(t,e)=>[...t,...e];function OG(...t){return $S(FG,t)}function FG(t){if(t.length===0)return Gj;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),Nu)}}function LG(...t){return ut(MG,t)}var MG=(t,e)=>e.some(n=>n(t));function BG(...t){return ut(zG,t)}function zG(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 xS(...t){return ut(qG,t)}var qG=(t,{min:e,max:n})=>e!==void 0&&t<e?e:n!==void 0&&t>n?n:t,jG={reset:[0,0],bold:[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,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]},GG=Object.entries(jG);function Jy(t){return String(t)}Jy.open="",Jy.close="";function UG(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==="win32"||t&&n.TERM!=="dumb"||"CI"in n)||typeof window<"u"&&!!window.chrome}function WG(t=!1){let e=UG(t),n=(o,a,u,c)=>{let l="",d=0;do l+=o.substring(d,c)+u,d=c+a.length,c=o.indexOf(a,d);while(~c);return l+o.substring(d)},r=(o,a,u=o)=>{let c=l=>{let d=String(l),f=d.indexOf(a,o.length);return~f?o+n(d,a,u,f)+a:o+d+a};return c.open=o,c.close=a,c},i={isColorSupported:e},s=o=>`\x1B[${o}m`;for(let[o,a]of GG)i[o]=e?r(s(a[0]),s(a[1]),a[2]):Jy;return i}var yt=WG(T1(1)),Bu={},Ct={},IS;function Qy(){if(IS)return Ct;IS=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.thenable=Ct.typedArray=Ct.stringArray=Ct.array=Ct.func=Ct.error=Ct.number=Ct.string=Ct.boolean=void 0;function t(c){return c===!0||c===!1}Ct.boolean=t;function e(c){return typeof c=="string"||c instanceof String}Ct.string=e;function n(c){return typeof c=="number"||c instanceof Number}Ct.number=n;function r(c){return c instanceof Error}Ct.error=r;function i(c){return typeof c=="function"}Ct.func=i;function s(c){return Array.isArray(c)}Ct.array=s;function o(c){return s(c)&&c.every(l=>e(l))}Ct.stringArray=o;function a(c,l){return Array.isArray(c)&&c.every(l)}Ct.typedArray=a;function u(c){return c&&i(c.then)}return Ct.thenable=u,Ct}var He={},zu={},qu={},vp={},Zy={},ye={},NS;function OS(){if(NS)return ye;NS=1,Object.defineProperty(ye,"__esModule",{value:!0}),ye.Message=ye.NotificationType9=ye.NotificationType8=ye.NotificationType7=ye.NotificationType6=ye.NotificationType5=ye.NotificationType4=ye.NotificationType3=ye.NotificationType2=ye.NotificationType1=ye.NotificationType0=ye.NotificationType=ye.RequestType9=ye.RequestType8=ye.RequestType7=ye.RequestType6=ye.RequestType5=ye.RequestType4=ye.RequestType3=ye.RequestType2=ye.RequestType1=ye.RequestType=ye.RequestType0=ye.AbstractMessageSignature=ye.ParameterStructures=ye.ResponseError=ye.ErrorCodes=void 0;const t=Pu();var e;(function(S){S.ParseError=-32700,S.InvalidRequest=-32600,S.MethodNotFound=-32601,S.InvalidParams=-32602,S.InternalError=-32603,S.jsonrpcReservedErrorRangeStart=-32099,S.serverErrorStart=-32099,S.MessageWriteError=-32099,S.MessageReadError=-32098,S.PendingResponseRejected=-32097,S.ConnectionInactive=-32096,S.ServerNotInitialized=-32002,S.UnknownErrorCode=-32001,S.jsonrpcReservedErrorRangeEnd=-32e3,S.serverErrorEnd=-32e3})(e||(ye.ErrorCodes=e={}));class n extends Error{constructor($,O,V){super(O),this.code=t.number($)?$:e.UnknownErrorCode,this.data=V,Object.setPrototypeOf(this,n.prototype)}toJson(){const $={code:this.code,message:this.message};return this.data!==void 0&&($.data=this.data),$}}ye.ResponseError=n;class r{constructor($){this.kind=$}static is($){return $===r.auto||$===r.byName||$===r.byPosition}toString(){return this.kind}}ye.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class i{constructor($,O){this.method=$,this.numberOfParams=O}get parameterStructures(){return r.auto}}ye.AbstractMessageSignature=i;class s extends i{constructor($){super($,0)}}ye.RequestType0=s;class o extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.RequestType=o;class a extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.RequestType1=a;class u extends i{constructor($){super($,2)}}ye.RequestType2=u;class c extends i{constructor($){super($,3)}}ye.RequestType3=c;class l extends i{constructor($){super($,4)}}ye.RequestType4=l;class d extends i{constructor($){super($,5)}}ye.RequestType5=d;class f extends i{constructor($){super($,6)}}ye.RequestType6=f;class p extends i{constructor($){super($,7)}}ye.RequestType7=p;class h extends i{constructor($){super($,8)}}ye.RequestType8=h;class w extends i{constructor($){super($,9)}}ye.RequestType9=w;class D extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.NotificationType=D;class g extends i{constructor($){super($,0)}}ye.NotificationType0=g;class v extends i{constructor($,O=r.auto){super($,1),this._parameterStructures=O}get parameterStructures(){return this._parameterStructures}}ye.NotificationType1=v;class E extends i{constructor($){super($,2)}}ye.NotificationType2=E;class k extends i{constructor($){super($,3)}}ye.NotificationType3=k;class P extends i{constructor($){super($,4)}}ye.NotificationType4=P;class G extends i{constructor($){super($,5)}}ye.NotificationType5=G;class W extends i{constructor($){super($,6)}}ye.NotificationType6=W;class Z extends i{constructor($){super($,7)}}ye.NotificationType7=Z;class J extends i{constructor($){super($,8)}}ye.NotificationType8=J;class fe extends i{constructor($){super($,9)}}ye.NotificationType9=fe;var N;return function(S){function $(M){const H=M;return H&&t.string(H.method)&&(t.string(H.id)||t.number(H.id))}S.isRequest=$;function O(M){const H=M;return H&&t.string(H.method)&&M.id===void 0}S.isNotification=O;function V(M){const H=M;return H&&(H.result!==void 0||!!H.error)&&(t.string(H.id)||t.number(H.id)||H.id===null)}S.isResponse=V}(N||(ye.Message=N={})),ye}var ti={},FS;function LS(){if(FS)return ti;FS=1;var t;Object.defineProperty(ti,"__esModule",{value:!0}),ti.LRUCache=ti.LinkedMap=ti.Touch=void 0;var e;(function(i){i.None=0,i.First=1,i.AsOld=i.First,i.Last=2,i.AsNew=i.Last})(e||(ti.Touch=e={}));class n{constructor(){this[t]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(s){return this._map.has(s)}get(s,o=e.None){const a=this._map.get(s);if(a)return o!==e.None&&this.touch(a,o),a.value}set(s,o,a=e.None){let u=this._map.get(s);if(u)u.value=o,a!==e.None&&this.touch(u,a);else{switch(u={key:s,value:o,next:void 0,previous:void 0},a){case e.None:this.addItemLast(u);break;case e.First:this.addItemFirst(u);break;case e.Last:this.addItemLast(u);break;default:this.addItemLast(u);break}this._map.set(s,u),this._size++}return this}delete(s){return!!this.remove(s)}remove(s){const o=this._map.get(s);if(o)return this._map.delete(s),this.removeItem(o),this._size--,o.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const s=this._head;return this._map.delete(s.key),this.removeItem(s),this._size--,s.value}forEach(s,o){const a=this._state;let u=this._head;for(;u;){if(o?s.bind(o)(u.value,u.key,this):s(u.value,u.key,this),this._state!==a)throw new Error("LinkedMap got modified during iteration.");u=u.next}}keys(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const u={value:o.key,done:!1};return o=o.next,u}else return{value:void 0,done:!0}}};return a}values(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const u={value:o.value,done:!1};return o=o.next,u}else return{value:void 0,done:!0}}};return a}entries(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const u={value:[o.key,o.value],done:!1};return o=o.next,u}else return{value:void 0,done:!0}}};return a}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(s){if(s>=this.size)return;if(s===0){this.clear();return}let o=this._head,a=this.size;for(;o&&a>s;)this._map.delete(o.key),o=o.next,a--;this._head=o,this._size=a,o&&(o.previous=void 0),this._state++}addItemFirst(s){if(!this._head&&!this._tail)this._tail=s;else if(this._head)s.next=this._head,this._head.previous=s;else throw new Error("Invalid list");this._head=s,this._state++}addItemLast(s){if(!this._head&&!this._tail)this._head=s;else if(this._tail)s.previous=this._tail,this._tail.next=s;else throw new Error("Invalid list");this._tail=s,this._state++}removeItem(s){if(s===this._head&&s===this._tail)this._head=void 0,this._tail=void 0;else if(s===this._head){if(!s.next)throw new Error("Invalid list");s.next.previous=void 0,this._head=s.next}else if(s===this._tail){if(!s.previous)throw new Error("Invalid list");s.previous.next=void 0,this._tail=s.previous}else{const o=s.next,a=s.previous;if(!o||!a)throw new Error("Invalid list");o.previous=a,a.next=o}s.next=void 0,s.previous=void 0,this._state++}touch(s,o){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(o!==e.First&&o!==e.Last)){if(o===e.First){if(s===this._head)return;const a=s.next,u=s.previous;s===this._tail?(u.next=void 0,this._tail=u):(a.previous=u,u.next=a),s.previous=void 0,s.next=this._head,this._head.previous=s,this._head=s,this._state++}else if(o===e.Last){if(s===this._tail)return;const a=s.next,u=s.previous;s===this._head?(a.previous=void 0,this._head=a):(a.previous=u,u.next=a),s.next=void 0,s.previous=this._tail,this._tail.next=s,this._tail=s,this._state++}}}toJSON(){const s=[];return this.forEach((o,a)=>{s.push([a,o])}),s}fromJSON(s){this.clear();for(const[o,a]of s)this.set(o,a)}}ti.LinkedMap=n;class r extends n{constructor(s,o=1){super(),this._limit=s,this._ratio=Math.min(Math.max(0,o),1)}get limit(){return this._limit}set limit(s){this._limit=s,this.checkTrim()}get ratio(){return this._ratio}set ratio(s){this._ratio=Math.min(Math.max(0,s),1),this.checkTrim()}get(s,o=e.AsNew){return super.get(s,o)}peek(s){return super.get(s,e.None)}set(s,o){return super.set(s,o,e.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}return ti.LRUCache=r,ti}var ju={},MS;function HG(){if(MS)return ju;MS=1,Object.defineProperty(ju,"__esModule",{value:!0}),ju.Disposable=void 0;var t;return function(e){function n(r){return{dispose:r}}e.create=n}(t||(ju.Disposable=t={})),ju}var xs={},BS;function VG(){if(BS)return xs;BS=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.SharedArrayReceiverStrategy=xs.SharedArraySenderStrategy=void 0;const t=sp();var e;(function(o){o.Continue=0,o.Cancelled=1})(e||(e={}));class n{constructor(){this.buffers=new Map}enableCancellation(a){if(a.id===null)return;const u=new SharedArrayBuffer(4),c=new Int32Array(u,0,1);c[0]=e.Continue,this.buffers.set(a.id,u),a.$cancellationData=u}async sendCancellation(a,u){const c=this.buffers.get(u);if(c===void 0)return;const l=new Int32Array(c,0,1);Atomics.store(l,0,e.Cancelled)}cleanup(a){this.buffers.delete(a)}dispose(){this.buffers.clear()}}xs.SharedArraySenderStrategy=n;class r{constructor(a){this.data=new Int32Array(a,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===e.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class i{constructor(a){this.token=new r(a)}cancel(){}dispose(){}}class s{constructor(){this.kind="request"}createCancellationTokenSource(a){const u=a.$cancellationData;return u===void 0?new t.CancellationTokenSource:new i(u)}}return xs.SharedArrayReceiverStrategy=s,xs}var ni={},Gu={},zS;function qS(){if(zS)return Gu;zS=1,Object.defineProperty(Gu,"__esModule",{value:!0}),Gu.Semaphore=void 0;const t=Ts();class e{constructor(r=1){if(r<=0)throw new Error("Capacity must be greater than 0");this._capacity=r,this._active=0,this._waiting=[]}lock(r){return new Promise((i,s)=>{this._waiting.push({thunk:r,resolve:i,reject:s}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const r=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const i=r.thunk();i instanceof Promise?i.then(s=>{this._active--,r.resolve(s),this.runNext()},s=>{this._active--,r.reject(s),this.runNext()}):(this._active--,r.resolve(i),this.runNext())}catch(i){this._active--,r.reject(i),this.runNext()}}}return Gu.Semaphore=e,Gu}var jS;function KG(){if(jS)return ni;jS=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.ReadableStreamMessageReader=ni.AbstractMessageReader=ni.MessageReader=void 0;const t=Ts(),e=Pu(),n=Io(),r=qS();var i;(function(u){function c(l){let d=l;return d&&e.func(d.listen)&&e.func(d.dispose)&&e.func(d.onError)&&e.func(d.onClose)&&e.func(d.onPartialMessage)}u.is=c})(i||(ni.MessageReader=i={}));class s{constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter,this.partialMessageEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(c){this.errorEmitter.fire(this.asError(c))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(c){this.partialMessageEmitter.fire(c)}asError(c){return c instanceof Error?c:new Error(`Reader received error. Reason: ${e.string(c.message)?c.message:"unknown"}`)}}ni.AbstractMessageReader=s;var o;(function(u){function c(l){let d,f;const p=new Map;let h;const w=new Map;if(l===void 0||typeof l=="string")d=l??"utf-8";else{if(d=l.charset??"utf-8",l.contentDecoder!==void 0&&(f=l.contentDecoder,p.set(f.name,f)),l.contentDecoders!==void 0)for(const D of l.contentDecoders)p.set(D.name,D);if(l.contentTypeDecoder!==void 0&&(h=l.contentTypeDecoder,w.set(h.name,h)),l.contentTypeDecoders!==void 0)for(const D of l.contentTypeDecoders)w.set(D.name,D)}return h===void 0&&(h=(0,t.default)().applicationJson.decoder,w.set(h.name,h)),{charset:d,contentDecoder:f,contentDecoders:p,contentTypeDecoder:h,contentTypeDecoders:w}}u.fromOptions=c})(o||(o={}));class a extends s{constructor(c,l){super(),this.readable=c,this.options=o.fromOptions(l),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new r.Semaphore(1)}set partialMessageTimeout(c){this._partialMessageTimeout=c}get partialMessageTimeout(){return this._partialMessageTimeout}listen(c){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=c;const l=this.readable.onData(d=>{this.onData(d)});return this.readable.onError(d=>this.fireError(d)),this.readable.onClose(()=>this.fireClose()),l}onData(c){try{for(this.buffer.append(c);;){if(this.nextMessageLength===-1){const d=this.buffer.tryReadHeaders(!0);if(!d)return;const f=d.get("content-length");if(!f){this.fireError(new Error(`Header must provide a Content-Length property.
126
+ ${JSON.stringify(Object.fromEntries(d))}`));return}const p=parseInt(f);if(isNaN(p)){this.fireError(new Error(`Content-Length value must be a number. Got ${f}`));return}this.nextMessageLength=p}const l=this.buffer.tryReadBody(this.nextMessageLength);if(l===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const d=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(l):l,f=await this.options.contentTypeDecoder.decode(d,this.options);this.callback(f)}).catch(d=>{this.fireError(d)})}}catch(l){this.fireError(l)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((c,l)=>{this.partialMessageTimer=void 0,c===this.messageToken&&(this.firePartialMessage({messageToken:c,waitingTime:l}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return ni.ReadableStreamMessageReader=a,ni}var ri={},GS;function YG(){if(GS)return ri;GS=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.WriteableStreamMessageWriter=ri.AbstractMessageWriter=ri.MessageWriter=void 0;const t=Ts(),e=Pu(),n=qS(),r=Io(),i="Content-Length: ",s=`\r
127
+ `;var o;(function(l){function d(f){let p=f;return p&&e.func(p.dispose)&&e.func(p.onClose)&&e.func(p.onError)&&e.func(p.write)}l.is=d})(o||(ri.MessageWriter=o={}));class a{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(d,f,p){this.errorEmitter.fire([this.asError(d),f,p])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(d){return d instanceof Error?d:new Error(`Writer received error. Reason: ${e.string(d.message)?d.message:"unknown"}`)}}ri.AbstractMessageWriter=a;var u;(function(l){function d(f){return f===void 0||typeof f=="string"?{charset:f??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:f.charset??"utf-8",contentEncoder:f.contentEncoder,contentTypeEncoder:f.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}l.fromOptions=d})(u||(u={}));class c extends a{constructor(d,f){super(),this.writable=d,this.options=u.fromOptions(f),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(p=>this.fireError(p)),this.writable.onClose(()=>this.fireClose())}async write(d){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(d,this.options).then(p=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(p):p).then(p=>{const h=[];return h.push(i,p.byteLength.toString(),s),h.push(s),this.doWrite(d,h,p)},p=>{throw this.fireError(p),p}))}async doWrite(d,f,p){try{return await this.writable.write(f.join(""),"ascii"),this.writable.write(p)}catch(h){return this.handleError(h,d),Promise.reject(h)}}handleError(d,f){this.errorCount++,this.fireError(d,f,this.errorCount)}end(){this.writable.end()}}return ri.WriteableStreamMessageWriter=c,ri}var Uu={},US;function XG(){if(US)return Uu;US=1,Object.defineProperty(Uu,"__esModule",{value:!0}),Uu.AbstractMessageBuffer=void 0;const t=13,e=10,n=`\r
128
+ `;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: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),d=new Map,f=this.toString(l,"ascii").split(n);if(f.length<2)return d;for(let p=0;p<f.length-2;p++){const h=f[p],w=h.indexOf(":");if(w===-1)throw new Error(`Message header must separate key and value using ':'
129
+ ${h}`);const D=h.substr(0,w),g=h.substr(w+1).trim();d.set(s?D.toLowerCase():D,g)}return d}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(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 Uu.AbstractMessageBuffer=r,Uu}var ew={},WS;function JG(){return WS||(WS=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.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=Ts(),n=Pu(),r=OS(),i=LS(),s=Io(),o=sp();var a;(function($){$.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var u;(function($){function O(V){return typeof V=="string"||typeof V=="number"}$.is=O})(u||(t.ProgressToken=u={}));var c;(function($){$.type=new r.NotificationType("$/progress")})(c||(c={}));class l{constructor(){}}t.ProgressType=l;var d;(function($){function O(V){return n.func(V)}$.is=O})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function($){$[$.Off=0]="Off",$[$.Messages=1]="Messages",$[$.Compact=2]="Compact",$[$.Verbose=3]="Verbose"})(f||(t.Trace=f={}));var p;(function($){$.Off="off",$.Messages="messages",$.Compact="compact",$.Verbose="verbose"})(p||(t.TraceValues=p={})),function($){function O(M){if(!n.string(M))return $.Off;switch(M=M.toLowerCase(),M){case"off":return $.Off;case"messages":return $.Messages;case"compact":return $.Compact;case"verbose":return $.Verbose;default:return $.Off}}$.fromString=O;function V(M){switch(M){case $.Off:return"off";case $.Messages:return"messages";case $.Compact:return"compact";case $.Verbose:return"verbose";default:return"off"}}$.toString=V}(f||(t.Trace=f={}));var h;(function($){$.Text="text",$.JSON="json"})(h||(t.TraceFormat=h={})),function($){function O(V){return n.string(V)?(V=V.toLowerCase(),V==="json"?$.JSON:$.Text):$.Text}$.fromString=O}(h||(t.TraceFormat=h={}));var w;(function($){$.type=new r.NotificationType("$/setTrace")})(w||(t.SetTraceNotification=w={}));var D;(function($){$.type=new r.NotificationType("$/logTrace")})(D||(t.LogTraceNotification=D={}));var g;(function($){$[$.Closed=1]="Closed",$[$.Disposed=2]="Disposed",$[$.AlreadyListening=3]="AlreadyListening"})(g||(t.ConnectionErrors=g={}));class v extends Error{constructor(O,V){super(V),this.code=O,Object.setPrototypeOf(this,v.prototype)}}t.ConnectionError=v;var E;(function($){function O(V){const M=V;return M&&n.func(M.cancelUndispatched)}$.is=O})(E||(t.ConnectionStrategy=E={}));var k;(function($){function O(V){const M=V;return M&&(M.kind===void 0||M.kind==="id")&&n.func(M.createCancellationTokenSource)&&(M.dispose===void 0||n.func(M.dispose))}$.is=O})(k||(t.IdCancellationReceiverStrategy=k={}));var P;(function($){function O(V){const M=V;return M&&M.kind==="request"&&n.func(M.createCancellationTokenSource)&&(M.dispose===void 0||n.func(M.dispose))}$.is=O})(P||(t.RequestCancellationReceiverStrategy=P={}));var G;(function($){$.Message=Object.freeze({createCancellationTokenSource(V){return new o.CancellationTokenSource}});function O(V){return k.is(V)||P.is(V)}$.is=O})(G||(t.CancellationReceiverStrategy=G={}));var W;(function($){$.Message=Object.freeze({sendCancellation(V,M){return V.sendNotification(a.type,{id:M})},cleanup(V){}});function O(V){const M=V;return M&&n.func(M.sendCancellation)&&n.func(M.cleanup)}$.is=O})(W||(t.CancellationSenderStrategy=W={}));var Z;(function($){$.Message=Object.freeze({receiver:G.Message,sender:W.Message});function O(V){const M=V;return M&&G.is(M.receiver)&&W.is(M.sender)}$.is=O})(Z||(t.CancellationStrategy=Z={}));var J;(function($){function O(V){const M=V;return M&&n.func(M.handleMessage)}$.is=O})(J||(t.MessageStrategy=J={}));var fe;(function($){function O(V){const M=V;return M&&(Z.is(M.cancellationStrategy)||E.is(M.connectionStrategy)||J.is(M.messageStrategy))}$.is=O})(fe||(t.ConnectionOptions=fe={}));var N;(function($){$[$.New=1]="New",$[$.Listening=2]="Listening",$[$.Closed=3]="Closed",$[$.Disposed=4]="Disposed"})(N||(N={}));function S($,O,V,M){const H=V!==void 0?V:t.NullLogger;let Ee=0,te=0,C=0;const me="2.0";let tt;const pt=new Map;let j;const K=new Map,Ie=new Map;let oe,be=new i.LinkedMap,ke=new Map,ue=new Set,x=new Map,B=f.Off,le=h.Text,z,ce=N.New;const ze=new s.Emitter,Je=new s.Emitter,se=new s.Emitter,_e=new s.Emitter,ne=new s.Emitter,De=M&&M.cancellationStrategy?M.cancellationStrategy:Z.Message;function Le(R){if(R===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+R.toString()}function ht(R){return R===null?"res-unknown-"+(++C).toString():"res-"+R.toString()}function Ve(){return"not-"+(++te).toString()}function qt(R,q){r.Message.isRequest(q)?R.set(Le(q.id),q):r.Message.isResponse(q)?R.set(ht(q.id),q):R.set(Ve(),q)}function Ut(R){}function cn(){return ce===N.Listening}function Y(){return ce===N.Closed}function X(){return ce===N.Disposed}function de(){(ce===N.New||ce===N.Listening)&&(ce=N.Closed,Je.fire(void 0))}function Wt(R){ze.fire([R,void 0,void 0])}function jt(R){ze.fire(R)}$.onClose(de),$.onError(Wt),O.onClose(de),O.onError(jt);function br(){oe||be.size===0||(oe=(0,e.default)().timer.setImmediate(()=>{oe=void 0,es()}))}function wi(R){r.Message.isRequest(R)?ns(R):r.Message.isNotification(R)?vi(R):r.Message.isResponse(R)?rs(R):bi(R)}function es(){if(be.size===0)return;const R=be.shift();try{const q=M?.messageStrategy;J.is(q)?q.handleMessage(R,wi):wi(R)}finally{br()}}const ts=R=>{try{if(r.Message.isNotification(R)&&R.method===a.type.method){const q=R.params.id,ee=Le(q),re=be.get(ee);if(r.Message.isRequest(re)){const Ne=M?.connectionStrategy,Ke=Ne&&Ne.cancelUndispatched?Ne.cancelUndispatched(re,Ut):void 0;if(Ke&&(Ke.error!==void 0||Ke.result!==void 0)){be.delete(ee),x.delete(q),Ke.id=re.id,Dr(Ke,R.method,Date.now()),O.write(Ke).catch(()=>H.error("Sending response for canceled message failed."));return}}const Me=x.get(q);if(Me!==void 0){Me.cancel(),qr(R);return}else ue.add(q)}qt(be,R)}finally{br()}};function ns(R){if(X())return;function q(Pe,nt,Ye){const Ft={jsonrpc:me,id:R.id};Pe instanceof r.ResponseError?Ft.error=Pe.toJson():Ft.result=Pe===void 0?null:Pe,Dr(Ft,nt,Ye),O.write(Ft).catch(()=>H.error("Sending response failed."))}function ee(Pe,nt,Ye){const Ft={jsonrpc:me,id:R.id,error:Pe.toJson()};Dr(Ft,nt,Ye),O.write(Ft).catch(()=>H.error("Sending response failed."))}function re(Pe,nt,Ye){Pe===void 0&&(Pe=null);const Ft={jsonrpc:me,id:R.id,result:Pe};Dr(Ft,nt,Ye),O.write(Ft).catch(()=>H.error("Sending response failed."))}os(R);const Me=pt.get(R.method);let Ne,Ke;Me&&(Ne=Me.type,Ke=Me.handler);const ge=Date.now();if(Ke||tt){const Pe=R.id??String(Date.now()),nt=k.is(De.receiver)?De.receiver.createCancellationTokenSource(Pe):De.receiver.createCancellationTokenSource(R);R.id!==null&&ue.has(R.id)&&nt.cancel(),R.id!==null&&x.set(Pe,nt);try{let Ye;if(Ke)if(R.params===void 0){if(Ne!==void 0&&Ne.numberOfParams!==0){ee(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${R.method} defines ${Ne.numberOfParams} params but received none.`),R.method,ge);return}Ye=Ke(nt.token)}else if(Array.isArray(R.params)){if(Ne!==void 0&&Ne.parameterStructures===r.ParameterStructures.byName){ee(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${R.method} defines parameters by name but received parameters by position`),R.method,ge);return}Ye=Ke(...R.params,nt.token)}else{if(Ne!==void 0&&Ne.parameterStructures===r.ParameterStructures.byPosition){ee(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${R.method} defines parameters by position but received parameters by name`),R.method,ge);return}Ye=Ke(R.params,nt.token)}else tt&&(Ye=tt(R.method,R.params,nt.token));const Ft=Ye;Ye?Ft.then?Ft.then(ln=>{x.delete(Pe),q(ln,R.method,ge)},ln=>{x.delete(Pe),ln instanceof r.ResponseError?ee(ln,R.method,ge):ln&&n.string(ln.message)?ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${R.method} failed with message: ${ln.message}`),R.method,ge):ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${R.method} failed unexpectedly without providing any details.`),R.method,ge)}):(x.delete(Pe),q(Ye,R.method,ge)):(x.delete(Pe),re(Ye,R.method,ge))}catch(Ye){x.delete(Pe),Ye instanceof r.ResponseError?q(Ye,R.method,ge):Ye&&n.string(Ye.message)?ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${R.method} failed with message: ${Ye.message}`),R.method,ge):ee(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${R.method} failed unexpectedly without providing any details.`),R.method,ge)}}else ee(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${R.method}`),R.method,ge)}function rs(R){if(!X())if(R.id===null)R.error?H.error(`Received response message without id: Error is:
130
+ ${JSON.stringify(R.error,void 0,4)}`):H.error("Received response message without id. No further error information provided.");else{const q=R.id,ee=ke.get(q);if(as(R,ee),ee!==void 0){ke.delete(q);try{if(R.error){const re=R.error;ee.reject(new r.ResponseError(re.code,re.message,re.data))}else if(R.result!==void 0)ee.resolve(R.result);else throw new Error("Should never happen.")}catch(re){re.message?H.error(`Response handler '${ee.method}' failed with message: ${re.message}`):H.error(`Response handler '${ee.method}' failed unexpectedly.`)}}}}function vi(R){if(X())return;let q,ee;if(R.method===a.type.method){const re=R.params.id;ue.delete(re),qr(R);return}else{const re=K.get(R.method);re&&(ee=re.handler,q=re.type)}if(ee||j)try{if(qr(R),ee)if(R.params===void 0)q!==void 0&&q.numberOfParams!==0&&q.parameterStructures!==r.ParameterStructures.byName&&H.error(`Notification ${R.method} defines ${q.numberOfParams} params but received none.`),ee();else if(Array.isArray(R.params)){const re=R.params;R.method===c.type.method&&re.length===2&&u.is(re[0])?ee({token:re[0],value:re[1]}):(q!==void 0&&(q.parameterStructures===r.ParameterStructures.byName&&H.error(`Notification ${R.method} defines parameters by name but received parameters by position`),q.numberOfParams!==R.params.length&&H.error(`Notification ${R.method} defines ${q.numberOfParams} params but received ${re.length} arguments`)),ee(...re))}else q!==void 0&&q.parameterStructures===r.ParameterStructures.byPosition&&H.error(`Notification ${R.method} defines parameters by position but received parameters by name`),ee(R.params);else j&&j(R.method,R.params)}catch(re){re.message?H.error(`Notification handler '${R.method}' failed with message: ${re.message}`):H.error(`Notification handler '${R.method}' failed unexpectedly.`)}else se.fire(R)}function bi(R){if(!R){H.error("Received empty message.");return}H.error(`Received message which is neither a response nor a notification message:
131
+ ${JSON.stringify(R,null,4)}`);const q=R;if(n.string(q.id)||n.number(q.id)){const ee=q.id,re=ke.get(ee);re&&re.reject(new Error("The received response has neither a result nor an error property."))}}function Rn(R){if(R!=null)switch(B){case f.Verbose:return JSON.stringify(R,null,4);case f.Compact:return JSON.stringify(R);default:return}}function is(R){if(!(B===f.Off||!z))if(le===h.Text){let q;(B===f.Verbose||B===f.Compact)&&R.params&&(q=`Params: ${Rn(R.params)}
132
+
133
+ `),z.log(`Sending request '${R.method} - (${R.id})'.`,q)}else jn("send-request",R)}function ss(R){if(!(B===f.Off||!z))if(le===h.Text){let q;(B===f.Verbose||B===f.Compact)&&(R.params?q=`Params: ${Rn(R.params)}
134
+
135
+ `:q=`No parameters provided.
136
+
137
+ `),z.log(`Sending notification '${R.method}'.`,q)}else jn("send-notification",R)}function Dr(R,q,ee){if(!(B===f.Off||!z))if(le===h.Text){let re;(B===f.Verbose||B===f.Compact)&&(R.error&&R.error.data?re=`Error data: ${Rn(R.error.data)}
138
+
139
+ `:R.result?re=`Result: ${Rn(R.result)}
140
+
141
+ `:R.error===void 0&&(re=`No result returned.
142
+
143
+ `)),z.log(`Sending response '${q} - (${R.id})'. Processing request took ${Date.now()-ee}ms`,re)}else jn("send-response",R)}function os(R){if(!(B===f.Off||!z))if(le===h.Text){let q;(B===f.Verbose||B===f.Compact)&&R.params&&(q=`Params: ${Rn(R.params)}
144
+
145
+ `),z.log(`Received request '${R.method} - (${R.id})'.`,q)}else jn("receive-request",R)}function qr(R){if(!(B===f.Off||!z||R.method===D.type.method))if(le===h.Text){let q;(B===f.Verbose||B===f.Compact)&&(R.params?q=`Params: ${Rn(R.params)}
146
+
147
+ `:q=`No parameters provided.
148
+
149
+ `),z.log(`Received notification '${R.method}'.`,q)}else jn("receive-notification",R)}function as(R,q){if(!(B===f.Off||!z))if(le===h.Text){let ee;if((B===f.Verbose||B===f.Compact)&&(R.error&&R.error.data?ee=`Error data: ${Rn(R.error.data)}
150
+
151
+ `:R.result?ee=`Result: ${Rn(R.result)}
152
+
153
+ `:R.error===void 0&&(ee=`No result returned.
154
+
155
+ `)),q){const re=R.error?` Request failed: ${R.error.message} (${R.error.code}).`:"";z.log(`Received response '${q.method} - (${R.id})' in ${Date.now()-q.timerStart}ms.${re}`,ee)}else z.log(`Received response ${R.id} without active response promise.`,ee)}else jn("receive-response",R)}function jn(R,q){if(!z||B===f.Off)return;const ee={isLSPMessage:!0,type:R,message:q,timestamp:Date.now()};z.log(ee)}function rr(){if(Y())throw new v(g.Closed,"Connection is closed.");if(X())throw new v(g.Disposed,"Connection is disposed.")}function co(){if(cn())throw new v(g.AlreadyListening,"Connection is already listening")}function F(){if(!cn())throw new Error("Call listen() first.")}function b(R){return R===void 0?null:R}function A(R){if(R!==null)return R}function m(R){return R!=null&&!Array.isArray(R)&&typeof R=="object"}function T(R,q){switch(R){case r.ParameterStructures.auto:return m(q)?A(q):[b(q)];case r.ParameterStructures.byName:if(!m(q))throw new Error("Received parameters by name but param is not an object literal.");return A(q);case r.ParameterStructures.byPosition:return[b(q)];default:throw new Error(`Unknown parameter structure ${R.toString()}`)}}function y(R,q){let ee;const re=R.numberOfParams;switch(re){case 0:ee=void 0;break;case 1:ee=T(R.parameterStructures,q[0]);break;default:ee=[];for(let Me=0;Me<q.length&&Me<re;Me++)ee.push(b(q[Me]));if(q.length<re)for(let Me=q.length;Me<re;Me++)ee.push(null);break}return ee}const _={sendNotification:(R,...q)=>{rr();let ee,re;if(n.string(R)){ee=R;const Ne=q[0];let Ke=0,ge=r.ParameterStructures.auto;r.ParameterStructures.is(Ne)&&(Ke=1,ge=Ne);let Pe=q.length;const nt=Pe-Ke;switch(nt){case 0:re=void 0;break;case 1:re=T(ge,q[Ke]);break;default:if(ge===r.ParameterStructures.byName)throw new Error(`Received ${nt} parameters for 'by Name' notification parameter structure.`);re=q.slice(Ke,Pe).map(Ye=>b(Ye));break}}else{const Ne=q;ee=R.method,re=y(R,Ne)}const Me={jsonrpc:me,method:ee,params:re};return ss(Me),O.write(Me).catch(Ne=>{throw H.error("Sending notification failed."),Ne})},onNotification:(R,q)=>{rr();let ee;return n.func(R)?j=R:q&&(n.string(R)?(ee=R,K.set(R,{type:void 0,handler:q})):(ee=R.method,K.set(R.method,{type:R,handler:q}))),{dispose:()=>{ee!==void 0?K.delete(ee):j=void 0}}},onProgress:(R,q,ee)=>{if(Ie.has(q))throw new Error(`Progress handler for token ${q} already registered`);return Ie.set(q,ee),{dispose:()=>{Ie.delete(q)}}},sendProgress:(R,q,ee)=>_.sendNotification(c.type,{token:q,value:ee}),onUnhandledProgress:_e.event,sendRequest:(R,...q)=>{rr(),F();let ee,re,Me;if(n.string(R)){ee=R;const Pe=q[0],nt=q[q.length-1];let Ye=0,Ft=r.ParameterStructures.auto;r.ParameterStructures.is(Pe)&&(Ye=1,Ft=Pe);let ln=q.length;o.CancellationToken.is(nt)&&(ln=ln-1,Me=nt);const Er=ln-Ye;switch(Er){case 0:re=void 0;break;case 1:re=T(Ft,q[Ye]);break;default:if(Ft===r.ParameterStructures.byName)throw new Error(`Received ${Er} parameters for 'by Name' request parameter structure.`);re=q.slice(Ye,ln).map(w1=>b(w1));break}}else{const Pe=q;ee=R.method,re=y(R,Pe);const nt=R.numberOfParams;Me=o.CancellationToken.is(Pe[nt])?Pe[nt]:void 0}const Ne=Ee++;let Ke;Me&&(Ke=Me.onCancellationRequested(()=>{const Pe=De.sender.sendCancellation(_,Ne);return Pe===void 0?(H.log(`Received no promise from cancellation strategy when cancelling id ${Ne}`),Promise.resolve()):Pe.catch(()=>{H.log(`Sending cancellation messages for id ${Ne} failed`)})}));const ge={jsonrpc:me,id:Ne,method:ee,params:re};return is(ge),typeof De.sender.enableCancellation=="function"&&De.sender.enableCancellation(ge),new Promise(async(Pe,nt)=>{const Ye=Er=>{Pe(Er),De.sender.cleanup(Ne),Ke?.dispose()},Ft=Er=>{nt(Er),De.sender.cleanup(Ne),Ke?.dispose()},ln={method:ee,timerStart:Date.now(),resolve:Ye,reject:Ft};try{await O.write(ge),ke.set(Ne,ln)}catch(Er){throw H.error("Sending request failed."),ln.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,Er.message?Er.message:"Unknown reason")),Er}})},onRequest:(R,q)=>{rr();let ee=null;return d.is(R)?(ee=void 0,tt=R):n.string(R)?(ee=null,q!==void 0&&(ee=R,pt.set(R,{handler:q,type:void 0}))):q!==void 0&&(ee=R.method,pt.set(R.method,{type:R,handler:q})),{dispose:()=>{ee!==null&&(ee!==void 0?pt.delete(ee):tt=void 0)}}},hasPendingResponse:()=>ke.size>0,trace:async(R,q,ee)=>{let re=!1,Me=h.Text;ee!==void 0&&(n.boolean(ee)?re=ee:(re=ee.sendNotification||!1,Me=ee.traceFormat||h.Text)),B=R,le=Me,B===f.Off?z=void 0:z=q,re&&!Y()&&!X()&&await _.sendNotification(w.type,{value:f.toString(R)})},onError:ze.event,onClose:Je.event,onUnhandledNotification:se.event,onDispose:ne.event,end:()=>{O.end()},dispose:()=>{if(X())return;ce=N.Disposed,ne.fire(void 0);const R=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const q of ke.values())q.reject(R);ke=new Map,x=new Map,ue=new Set,be=new i.LinkedMap,n.func(O.dispose)&&O.dispose(),n.func($.dispose)&&$.dispose()},listen:()=>{rr(),co(),ce=N.Listening,$.listen(ts)},inspect:()=>{(0,e.default)().console.log("inspect")}};return _.onNotification(D.type,R=>{if(B===f.Off||!z)return;const q=B===f.Verbose||B===f.Compact;z.log(R.message,q?R.verbose:void 0)}),_.onNotification(c.type,R=>{const q=Ie.get(R.token);q?q(R.value):_e.fire(R)}),_}t.createMessageConnection=S}(ew)),ew}var HS;function tw(){return HS||(HS=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.AbstractMessageBuffer=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=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=OS();Object.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,get:function(){return e.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return e.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return e.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return e.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return e.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return e.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return e.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return e.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return e.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return e.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return e.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return e.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return e.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return e.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return e.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return e.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return e.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return e.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return e.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return e.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return e.ParameterStructures}});const n=LS();Object.defineProperty(t,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(t,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(t,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=HG();Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=Io();Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=sp();Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const o=VG();Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});const a=KG();Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const u=YG();Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return u.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return u.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return u.WriteableStreamMessageWriter}});const c=XG();Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return c.AbstractMessageBuffer}});const l=JG();Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return l.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){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}}),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}}),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",{enumerable:!0,get:function(){return l.MessageStrategy}});const d=Ts();t.RAL=d.default}(Zy)),Zy}var VS;function QG(){if(VS)return vp;VS=1,Object.defineProperty(vp,"__esModule",{value:!0});const t=P1,e=tw();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.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),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,d)=>{const f=p=>{p==null?l():d(p)};typeof u=="string"?this.stream.write(u,c,f):this.stream.write(u,f)})}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(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.RAL.install(s)}a.install=u}(o),vp.default=o,vp}var KS;function Is(){return KS||(KS=1,function(t){var e=qu.__createBinding||(Object.create?function(N,S,$,O){O===void 0&&(O=$);var V=Object.getOwnPropertyDescriptor(S,$);(!V||("get"in V?!S.__esModule:V.writable||V.configurable))&&(V={enumerable:!0,get:function(){return S[$]}}),Object.defineProperty(N,O,V)}:function(N,S,$,O){O===void 0&&(O=$),N[O]=S[$]}),n=qu.__exportStar||function(N,S){for(var $ in N)$!=="default"&&!Object.prototype.hasOwnProperty.call(S,$)&&e(S,N,$)};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=QG();r.default.install();const i=Rr,s=x1,o=I1,a=N1,u=tw();n(tw(),t);class c extends u.AbstractMessageReader{constructor(S){super(),this.process=S;let $=this.process;$.on("error",O=>this.fireError(O)),$.on("close",()=>this.fireClose())}listen(S){return this.process.on("message",S),u.Disposable.create(()=>this.process.off("message",S))}}t.IPCMessageReader=c;class l extends u.AbstractMessageWriter{constructor(S){super(),this.process=S,this.errorCount=0;const $=this.process;$.on("error",O=>this.fireError(O)),$.on("close",()=>this.fireClose)}write(S){try{return typeof this.process.send=="function"&&this.process.send(S,void 0,void 0,$=>{$?(this.errorCount++,this.handleError($,S)):this.errorCount=0}),Promise.resolve()}catch($){return this.handleError($,S),Promise.reject($)}}handleError(S,$){this.errorCount++,this.fireError(S,$,this.errorCount)}end(){}}t.IPCMessageWriter=l;class d extends u.AbstractMessageReader{constructor(S){super(),this.onData=new u.Emitter,S.on("close",()=>this.fireClose),S.on("error",$=>this.fireError($)),S.on("message",$=>{this.onData.fire($)})}listen(S){return this.onData.event(S)}}t.PortMessageReader=d;class f extends u.AbstractMessageWriter{constructor(S){super(),this.port=S,this.errorCount=0,S.on("close",()=>this.fireClose()),S.on("error",$=>this.fireError($))}write(S){try{return this.port.postMessage(S),Promise.resolve()}catch($){return this.handleError($,S),Promise.reject($)}}handleError(S,$){this.errorCount++,this.fireError(S,$,this.errorCount)}end(){}}t.PortMessageWriter=f;class p extends u.ReadableStreamMessageReader{constructor(S,$="utf-8"){super((0,r.default)().stream.asReadableStream(S),$)}}t.SocketMessageReader=p;class h extends u.WriteableStreamMessageWriter{constructor(S,$){super((0,r.default)().stream.asWritableStream(S),$),this.socket=S}dispose(){super.dispose(),this.socket.destroy()}}t.SocketMessageWriter=h;class w extends u.ReadableStreamMessageReader{constructor(S,$){super((0,r.default)().stream.asReadableStream(S),$)}}t.StreamMessageReader=w;class D extends u.WriteableStreamMessageWriter{constructor(S,$){super((0,r.default)().stream.asWritableStream(S),$)}}t.StreamMessageWriter=D;const g=process.env.XDG_RUNTIME_DIR,v=new Map([["linux",107],["darwin",103]]);function E(){const N=(0,o.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${N}-sock`;let S;g?S=i.join(g,`vscode-ipc-${N}.sock`):S=i.join(s.tmpdir(),`vscode-${N}.sock`);const $=v.get(process.platform);return $!==void 0&&S.length>$&&(0,r.default)().console.warn(`WARNING: IPC handle "${S}" is longer than ${$} characters.`),S}t.generateRandomPipeName=E;function k(N,S="utf-8"){let $;const O=new Promise((V,M)=>{$=V});return new Promise((V,M)=>{let H=(0,a.createServer)(Ee=>{H.close(),$([new p(Ee,S),new h(Ee,S)])});H.on("error",M),H.listen(N,()=>{H.removeListener("error",M),V({onConnected:()=>O})})})}t.createClientPipeTransport=k;function P(N,S="utf-8"){const $=(0,a.createConnection)(N);return[new p($,S),new h($,S)]}t.createServerPipeTransport=P;function G(N,S="utf-8"){let $;const O=new Promise((V,M)=>{$=V});return new Promise((V,M)=>{const H=(0,a.createServer)(Ee=>{H.close(),$([new p(Ee,S),new h(Ee,S)])});H.on("error",M),H.listen(N,"127.0.0.1",()=>{H.removeListener("error",M),V({onConnected:()=>O})})})}t.createClientSocketTransport=G;function W(N,S="utf-8"){const $=(0,a.createConnection)(N,"127.0.0.1");return[new p($,S),new h($,S)]}t.createServerSocketTransport=W;function Z(N){const S=N;return S.read!==void 0&&S.addListener!==void 0}function J(N){const S=N;return S.write!==void 0&&S.addListener!==void 0}function fe(N,S,$,O){$||($=u.NullLogger);const V=Z(N)?new w(N):N,M=J(S)?new D(S):S;return u.ConnectionStrategy.is(O)&&(O={connectionStrategy:O}),(0,u.createMessageConnection)(V,M,$,O)}t.createMessageConnection=fe}(qu)),qu}var nw,YS;function XS(){return YS||(YS=1,nw=Is()),nw}var Wu={};function ZG(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bp={exports:{}},JS;function rw(){return JS||(JS=1,function(t,e){(function(n){{var r=n(ZG,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=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=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=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(b){function A(m){return typeof m=="string"}b.is=A})(i||(r.DocumentUri=i={}));var s;(function(b){function A(m){return typeof m=="string"}b.is=A})(s||(r.URI=s={}));var o;(function(b){b.MIN_VALUE=-2147483648,b.MAX_VALUE=2147483647;function A(m){return typeof m=="number"&&b.MIN_VALUE<=m&&m<=b.MAX_VALUE}b.is=A})(o||(r.integer=o={}));var a;(function(b){b.MIN_VALUE=0,b.MAX_VALUE=2147483647;function A(m){return typeof m=="number"&&b.MIN_VALUE<=m&&m<=b.MAX_VALUE}b.is=A})(a||(r.uinteger=a={}));var u;(function(b){function A(T,y){return T===Number.MAX_VALUE&&(T=a.MAX_VALUE),y===Number.MAX_VALUE&&(y=a.MAX_VALUE),{line:T,character:y}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&F.uinteger(y.line)&&F.uinteger(y.character)}b.is=m})(u||(r.Position=u={}));var c;(function(b){function A(T,y,_,R){if(F.uinteger(T)&&F.uinteger(y)&&F.uinteger(_)&&F.uinteger(R))return{start:u.create(T,y),end:u.create(_,R)};if(u.is(T)&&u.is(y))return{start:T,end:y};throw new Error("Range#create called with invalid arguments[".concat(T,", ").concat(y,", ").concat(_,", ").concat(R,"]"))}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&u.is(y.start)&&u.is(y.end)}b.is=m})(c||(r.Range=c={}));var l;(function(b){function A(T,y){return{uri:T,range:y}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&c.is(y.range)&&(F.string(y.uri)||F.undefined(y.uri))}b.is=m})(l||(r.Location=l={}));var d;(function(b){function A(T,y,_,R){return{targetUri:T,targetRange:y,targetSelectionRange:_,originSelectionRange:R}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&c.is(y.targetRange)&&F.string(y.targetUri)&&c.is(y.targetSelectionRange)&&(c.is(y.originSelectionRange)||F.undefined(y.originSelectionRange))}b.is=m})(d||(r.LocationLink=d={}));var f;(function(b){function A(T,y,_,R){return{red:T,green:y,blue:_,alpha:R}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&F.numberRange(y.red,0,1)&&F.numberRange(y.green,0,1)&&F.numberRange(y.blue,0,1)&&F.numberRange(y.alpha,0,1)}b.is=m})(f||(r.Color=f={}));var p;(function(b){function A(T,y){return{range:T,color:y}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&c.is(y.range)&&f.is(y.color)}b.is=m})(p||(r.ColorInformation=p={}));var h;(function(b){function A(T,y,_){return{label:T,textEdit:y,additionalTextEdits:_}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&F.string(y.label)&&(F.undefined(y.textEdit)||W.is(y))&&(F.undefined(y.additionalTextEdits)||F.typedArray(y.additionalTextEdits,W.is))}b.is=m})(h||(r.ColorPresentation=h={}));var w;(function(b){b.Comment="comment",b.Imports="imports",b.Region="region"})(w||(r.FoldingRangeKind=w={}));var D;(function(b){function A(T,y,_,R,q,ee){var re={startLine:T,endLine:y};return F.defined(_)&&(re.startCharacter=_),F.defined(R)&&(re.endCharacter=R),F.defined(q)&&(re.kind=q),F.defined(ee)&&(re.collapsedText=ee),re}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&F.uinteger(y.startLine)&&F.uinteger(y.startLine)&&(F.undefined(y.startCharacter)||F.uinteger(y.startCharacter))&&(F.undefined(y.endCharacter)||F.uinteger(y.endCharacter))&&(F.undefined(y.kind)||F.string(y.kind))}b.is=m})(D||(r.FoldingRange=D={}));var g;(function(b){function A(T,y){return{location:T,message:y}}b.create=A;function m(T){var y=T;return F.defined(y)&&l.is(y.location)&&F.string(y.message)}b.is=m})(g||(r.DiagnosticRelatedInformation=g={}));var v;(function(b){b.Error=1,b.Warning=2,b.Information=3,b.Hint=4})(v||(r.DiagnosticSeverity=v={}));var E;(function(b){b.Unnecessary=1,b.Deprecated=2})(E||(r.DiagnosticTag=E={}));var k;(function(b){function A(m){var T=m;return F.objectLiteral(T)&&F.string(T.href)}b.is=A})(k||(r.CodeDescription=k={}));var P;(function(b){function A(T,y,_,R,q,ee){var re={range:T,message:y};return F.defined(_)&&(re.severity=_),F.defined(R)&&(re.code=R),F.defined(q)&&(re.source=q),F.defined(ee)&&(re.relatedInformation=ee),re}b.create=A;function m(T){var y,_=T;return F.defined(_)&&c.is(_.range)&&F.string(_.message)&&(F.number(_.severity)||F.undefined(_.severity))&&(F.integer(_.code)||F.string(_.code)||F.undefined(_.code))&&(F.undefined(_.codeDescription)||F.string((y=_.codeDescription)===null||y===void 0?void 0:y.href))&&(F.string(_.source)||F.undefined(_.source))&&(F.undefined(_.relatedInformation)||F.typedArray(_.relatedInformation,g.is))}b.is=m})(P||(r.Diagnostic=P={}));var G;(function(b){function A(T,y){for(var _=[],R=2;R<arguments.length;R++)_[R-2]=arguments[R];var q={title:T,command:y};return F.defined(_)&&_.length>0&&(q.arguments=_),q}b.create=A;function m(T){var y=T;return F.defined(y)&&F.string(y.title)&&F.string(y.command)}b.is=m})(G||(r.Command=G={}));var W;(function(b){function A(_,R){return{range:_,newText:R}}b.replace=A;function m(_,R){return{range:{start:_,end:_},newText:R}}b.insert=m;function T(_){return{range:_,newText:""}}b.del=T;function y(_){var R=_;return F.objectLiteral(R)&&F.string(R.newText)&&c.is(R.range)}b.is=y})(W||(r.TextEdit=W={}));var Z;(function(b){function A(T,y,_){var R={label:T};return y!==void 0&&(R.needsConfirmation=y),_!==void 0&&(R.description=_),R}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&F.string(y.label)&&(F.boolean(y.needsConfirmation)||y.needsConfirmation===void 0)&&(F.string(y.description)||y.description===void 0)}b.is=m})(Z||(r.ChangeAnnotation=Z={}));var J;(function(b){function A(m){var T=m;return F.string(T)}b.is=A})(J||(r.ChangeAnnotationIdentifier=J={}));var fe;(function(b){function A(_,R,q){return{range:_,newText:R,annotationId:q}}b.replace=A;function m(_,R,q){return{range:{start:_,end:_},newText:R,annotationId:q}}b.insert=m;function T(_,R){return{range:_,newText:"",annotationId:R}}b.del=T;function y(_){var R=_;return W.is(R)&&(Z.is(R.annotationId)||J.is(R.annotationId))}b.is=y})(fe||(r.AnnotatedTextEdit=fe={}));var N;(function(b){function A(T,y){return{textDocument:T,edits:y}}b.create=A;function m(T){var y=T;return F.defined(y)&&me.is(y.textDocument)&&Array.isArray(y.edits)}b.is=m})(N||(r.TextDocumentEdit=N={}));var S;(function(b){function A(T,y,_){var R={kind:"create",uri:T};return y!==void 0&&(y.overwrite!==void 0||y.ignoreIfExists!==void 0)&&(R.options=y),_!==void 0&&(R.annotationId=_),R}b.create=A;function m(T){var y=T;return y&&y.kind==="create"&&F.string(y.uri)&&(y.options===void 0||(y.options.overwrite===void 0||F.boolean(y.options.overwrite))&&(y.options.ignoreIfExists===void 0||F.boolean(y.options.ignoreIfExists)))&&(y.annotationId===void 0||J.is(y.annotationId))}b.is=m})(S||(r.CreateFile=S={}));var $;(function(b){function A(T,y,_,R){var q={kind:"rename",oldUri:T,newUri:y};return _!==void 0&&(_.overwrite!==void 0||_.ignoreIfExists!==void 0)&&(q.options=_),R!==void 0&&(q.annotationId=R),q}b.create=A;function m(T){var y=T;return y&&y.kind==="rename"&&F.string(y.oldUri)&&F.string(y.newUri)&&(y.options===void 0||(y.options.overwrite===void 0||F.boolean(y.options.overwrite))&&(y.options.ignoreIfExists===void 0||F.boolean(y.options.ignoreIfExists)))&&(y.annotationId===void 0||J.is(y.annotationId))}b.is=m})($||(r.RenameFile=$={}));var O;(function(b){function A(T,y,_){var R={kind:"delete",uri:T};return y!==void 0&&(y.recursive!==void 0||y.ignoreIfNotExists!==void 0)&&(R.options=y),_!==void 0&&(R.annotationId=_),R}b.create=A;function m(T){var y=T;return y&&y.kind==="delete"&&F.string(y.uri)&&(y.options===void 0||(y.options.recursive===void 0||F.boolean(y.options.recursive))&&(y.options.ignoreIfNotExists===void 0||F.boolean(y.options.ignoreIfNotExists)))&&(y.annotationId===void 0||J.is(y.annotationId))}b.is=m})(O||(r.DeleteFile=O={}));var V;(function(b){function A(m){var T=m;return T&&(T.changes!==void 0||T.documentChanges!==void 0)&&(T.documentChanges===void 0||T.documentChanges.every(function(y){return F.string(y.kind)?S.is(y)||$.is(y)||O.is(y):N.is(y)}))}b.is=A})(V||(r.WorkspaceEdit=V={}));var M=function(){function b(A,m){this.edits=A,this.changeAnnotations=m}return b.prototype.insert=function(A,m,T){var y,_;if(T===void 0?y=W.insert(A,m):J.is(T)?(_=T,y=fe.insert(A,m,T)):(this.assertChangeAnnotations(this.changeAnnotations),_=this.changeAnnotations.manage(T),y=fe.insert(A,m,_)),this.edits.push(y),_!==void 0)return _},b.prototype.replace=function(A,m,T){var y,_;if(T===void 0?y=W.replace(A,m):J.is(T)?(_=T,y=fe.replace(A,m,T)):(this.assertChangeAnnotations(this.changeAnnotations),_=this.changeAnnotations.manage(T),y=fe.replace(A,m,_)),this.edits.push(y),_!==void 0)return _},b.prototype.delete=function(A,m){var T,y;if(m===void 0?T=W.del(A):J.is(m)?(y=m,T=fe.del(A,m)):(this.assertChangeAnnotations(this.changeAnnotations),y=this.changeAnnotations.manage(m),T=fe.del(A,y)),this.edits.push(T),y!==void 0)return y},b.prototype.add=function(A){this.edits.push(A)},b.prototype.all=function(){return this.edits},b.prototype.clear=function(){this.edits.splice(0,this.edits.length)},b.prototype.assertChangeAnnotations=function(A){if(A===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},b}(),H=function(){function b(A){this._annotations=A===void 0?Object.create(null):A,this._counter=0,this._size=0}return b.prototype.all=function(){return this._annotations},Object.defineProperty(b.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),b.prototype.manage=function(A,m){var T;if(J.is(A)?T=A:(T=this.nextId(),m=A),this._annotations[T]!==void 0)throw new Error("Id ".concat(T," is already in use."));if(m===void 0)throw new Error("No annotation provided for id ".concat(T));return this._annotations[T]=m,this._size++,T},b.prototype.nextId=function(){return this._counter++,this._counter.toString()},b}(),Ee=function(){function b(A){var m=this;this._textEditChanges=Object.create(null),A!==void 0?(this._workspaceEdit=A,A.documentChanges?(this._changeAnnotations=new H(A.changeAnnotations),A.changeAnnotations=this._changeAnnotations.all(),A.documentChanges.forEach(function(T){if(N.is(T)){var y=new M(T.edits,m._changeAnnotations);m._textEditChanges[T.textDocument.uri]=y}})):A.changes&&Object.keys(A.changes).forEach(function(T){var y=new M(A.changes[T]);m._textEditChanges[T]=y})):this._workspaceEdit={}}return Object.defineProperty(b.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),b.prototype.getTextEditChange=function(A){if(me.is(A)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var m={uri:A.uri,version:A.version},T=this._textEditChanges[m.uri];if(!T){var y=[],_={textDocument:m,edits:y};this._workspaceEdit.documentChanges.push(_),T=new M(y,this._changeAnnotations),this._textEditChanges[m.uri]=T}return T}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var T=this._textEditChanges[A];if(!T){var y=[];this._workspaceEdit.changes[A]=y,T=new M(y),this._textEditChanges[A]=T}return T}},b.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new H,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},b.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},b.prototype.createFile=function(A,m,T){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var y;Z.is(m)||J.is(m)?y=m:T=m;var _,R;if(y===void 0?_=S.create(A,T):(R=J.is(y)?y:this._changeAnnotations.manage(y),_=S.create(A,T,R)),this._workspaceEdit.documentChanges.push(_),R!==void 0)return R},b.prototype.renameFile=function(A,m,T,y){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var _;Z.is(T)||J.is(T)?_=T:y=T;var R,q;if(_===void 0?R=$.create(A,m,y):(q=J.is(_)?_:this._changeAnnotations.manage(_),R=$.create(A,m,y,q)),this._workspaceEdit.documentChanges.push(R),q!==void 0)return q},b.prototype.deleteFile=function(A,m,T){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var y;Z.is(m)||J.is(m)?y=m:T=m;var _,R;if(y===void 0?_=O.create(A,T):(R=J.is(y)?y:this._changeAnnotations.manage(y),_=O.create(A,T,R)),this._workspaceEdit.documentChanges.push(_),R!==void 0)return R},b}();r.WorkspaceChange=Ee;var te;(function(b){function A(T){return{uri:T}}b.create=A;function m(T){var y=T;return F.defined(y)&&F.string(y.uri)}b.is=m})(te||(r.TextDocumentIdentifier=te={}));var C;(function(b){function A(T,y){return{uri:T,version:y}}b.create=A;function m(T){var y=T;return F.defined(y)&&F.string(y.uri)&&F.integer(y.version)}b.is=m})(C||(r.VersionedTextDocumentIdentifier=C={}));var me;(function(b){function A(T,y){return{uri:T,version:y}}b.create=A;function m(T){var y=T;return F.defined(y)&&F.string(y.uri)&&(y.version===null||F.integer(y.version))}b.is=m})(me||(r.OptionalVersionedTextDocumentIdentifier=me={}));var tt;(function(b){function A(T,y,_,R){return{uri:T,languageId:y,version:_,text:R}}b.create=A;function m(T){var y=T;return F.defined(y)&&F.string(y.uri)&&F.string(y.languageId)&&F.integer(y.version)&&F.string(y.text)}b.is=m})(tt||(r.TextDocumentItem=tt={}));var pt;(function(b){b.PlainText="plaintext",b.Markdown="markdown";function A(m){var T=m;return T===b.PlainText||T===b.Markdown}b.is=A})(pt||(r.MarkupKind=pt={}));var j;(function(b){function A(m){var T=m;return F.objectLiteral(m)&&pt.is(T.kind)&&F.string(T.value)}b.is=A})(j||(r.MarkupContent=j={}));var K;(function(b){b.Text=1,b.Method=2,b.Function=3,b.Constructor=4,b.Field=5,b.Variable=6,b.Class=7,b.Interface=8,b.Module=9,b.Property=10,b.Unit=11,b.Value=12,b.Enum=13,b.Keyword=14,b.Snippet=15,b.Color=16,b.File=17,b.Reference=18,b.Folder=19,b.EnumMember=20,b.Constant=21,b.Struct=22,b.Event=23,b.Operator=24,b.TypeParameter=25})(K||(r.CompletionItemKind=K={}));var Ie;(function(b){b.PlainText=1,b.Snippet=2})(Ie||(r.InsertTextFormat=Ie={}));var oe;(function(b){b.Deprecated=1})(oe||(r.CompletionItemTag=oe={}));var be;(function(b){function A(T,y,_){return{newText:T,insert:y,replace:_}}b.create=A;function m(T){var y=T;return y&&F.string(y.newText)&&c.is(y.insert)&&c.is(y.replace)}b.is=m})(be||(r.InsertReplaceEdit=be={}));var ke;(function(b){b.asIs=1,b.adjustIndentation=2})(ke||(r.InsertTextMode=ke={}));var ue;(function(b){function A(m){var T=m;return T&&(F.string(T.detail)||T.detail===void 0)&&(F.string(T.description)||T.description===void 0)}b.is=A})(ue||(r.CompletionItemLabelDetails=ue={}));var x;(function(b){function A(m){return{label:m}}b.create=A})(x||(r.CompletionItem=x={}));var B;(function(b){function A(m,T){return{items:m||[],isIncomplete:!!T}}b.create=A})(B||(r.CompletionList=B={}));var le;(function(b){function A(T){return T.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}b.fromPlainText=A;function m(T){var y=T;return F.string(y)||F.objectLiteral(y)&&F.string(y.language)&&F.string(y.value)}b.is=m})(le||(r.MarkedString=le={}));var z;(function(b){function A(m){var T=m;return!!T&&F.objectLiteral(T)&&(j.is(T.contents)||le.is(T.contents)||F.typedArray(T.contents,le.is))&&(m.range===void 0||c.is(m.range))}b.is=A})(z||(r.Hover=z={}));var ce;(function(b){function A(m,T){return T?{label:m,documentation:T}:{label:m}}b.create=A})(ce||(r.ParameterInformation=ce={}));var ze;(function(b){function A(m,T){for(var y=[],_=2;_<arguments.length;_++)y[_-2]=arguments[_];var R={label:m};return F.defined(T)&&(R.documentation=T),F.defined(y)?R.parameters=y:R.parameters=[],R}b.create=A})(ze||(r.SignatureInformation=ze={}));var Je;(function(b){b.Text=1,b.Read=2,b.Write=3})(Je||(r.DocumentHighlightKind=Je={}));var se;(function(b){function A(m,T){var y={range:m};return F.number(T)&&(y.kind=T),y}b.create=A})(se||(r.DocumentHighlight=se={}));var _e;(function(b){b.File=1,b.Module=2,b.Namespace=3,b.Package=4,b.Class=5,b.Method=6,b.Property=7,b.Field=8,b.Constructor=9,b.Enum=10,b.Interface=11,b.Function=12,b.Variable=13,b.Constant=14,b.String=15,b.Number=16,b.Boolean=17,b.Array=18,b.Object=19,b.Key=20,b.Null=21,b.EnumMember=22,b.Struct=23,b.Event=24,b.Operator=25,b.TypeParameter=26})(_e||(r.SymbolKind=_e={}));var ne;(function(b){b.Deprecated=1})(ne||(r.SymbolTag=ne={}));var De;(function(b){function A(m,T,y,_,R){var q={name:m,kind:T,location:{uri:_,range:y}};return R&&(q.containerName=R),q}b.create=A})(De||(r.SymbolInformation=De={}));var Le;(function(b){function A(m,T,y,_){return _!==void 0?{name:m,kind:T,location:{uri:y,range:_}}:{name:m,kind:T,location:{uri:y}}}b.create=A})(Le||(r.WorkspaceSymbol=Le={}));var ht;(function(b){function A(T,y,_,R,q,ee){var re={name:T,detail:y,kind:_,range:R,selectionRange:q};return ee!==void 0&&(re.children=ee),re}b.create=A;function m(T){var y=T;return y&&F.string(y.name)&&F.number(y.kind)&&c.is(y.range)&&c.is(y.selectionRange)&&(y.detail===void 0||F.string(y.detail))&&(y.deprecated===void 0||F.boolean(y.deprecated))&&(y.children===void 0||Array.isArray(y.children))&&(y.tags===void 0||Array.isArray(y.tags))}b.is=m})(ht||(r.DocumentSymbol=ht={}));var Ve;(function(b){b.Empty="",b.QuickFix="quickfix",b.Refactor="refactor",b.RefactorExtract="refactor.extract",b.RefactorInline="refactor.inline",b.RefactorRewrite="refactor.rewrite",b.Source="source",b.SourceOrganizeImports="source.organizeImports",b.SourceFixAll="source.fixAll"})(Ve||(r.CodeActionKind=Ve={}));var qt;(function(b){b.Invoked=1,b.Automatic=2})(qt||(r.CodeActionTriggerKind=qt={}));var Ut;(function(b){function A(T,y,_){var R={diagnostics:T};return y!=null&&(R.only=y),_!=null&&(R.triggerKind=_),R}b.create=A;function m(T){var y=T;return F.defined(y)&&F.typedArray(y.diagnostics,P.is)&&(y.only===void 0||F.typedArray(y.only,F.string))&&(y.triggerKind===void 0||y.triggerKind===qt.Invoked||y.triggerKind===qt.Automatic)}b.is=m})(Ut||(r.CodeActionContext=Ut={}));var cn;(function(b){function A(T,y,_){var R={title:T},q=!0;return typeof y=="string"?(q=!1,R.kind=y):G.is(y)?R.command=y:R.edit=y,q&&_!==void 0&&(R.kind=_),R}b.create=A;function m(T){var y=T;return y&&F.string(y.title)&&(y.diagnostics===void 0||F.typedArray(y.diagnostics,P.is))&&(y.kind===void 0||F.string(y.kind))&&(y.edit!==void 0||y.command!==void 0)&&(y.command===void 0||G.is(y.command))&&(y.isPreferred===void 0||F.boolean(y.isPreferred))&&(y.edit===void 0||V.is(y.edit))}b.is=m})(cn||(r.CodeAction=cn={}));var Y;(function(b){function A(T,y){var _={range:T};return F.defined(y)&&(_.data=y),_}b.create=A;function m(T){var y=T;return F.defined(y)&&c.is(y.range)&&(F.undefined(y.command)||G.is(y.command))}b.is=m})(Y||(r.CodeLens=Y={}));var X;(function(b){function A(T,y){return{tabSize:T,insertSpaces:y}}b.create=A;function m(T){var y=T;return F.defined(y)&&F.uinteger(y.tabSize)&&F.boolean(y.insertSpaces)}b.is=m})(X||(r.FormattingOptions=X={}));var de;(function(b){function A(T,y,_){return{range:T,target:y,data:_}}b.create=A;function m(T){var y=T;return F.defined(y)&&c.is(y.range)&&(F.undefined(y.target)||F.string(y.target))}b.is=m})(de||(r.DocumentLink=de={}));var Wt;(function(b){function A(T,y){return{range:T,parent:y}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&c.is(y.range)&&(y.parent===void 0||b.is(y.parent))}b.is=m})(Wt||(r.SelectionRange=Wt={}));var jt;(function(b){b.namespace="namespace",b.type="type",b.class="class",b.enum="enum",b.interface="interface",b.struct="struct",b.typeParameter="typeParameter",b.parameter="parameter",b.variable="variable",b.property="property",b.enumMember="enumMember",b.event="event",b.function="function",b.method="method",b.macro="macro",b.keyword="keyword",b.modifier="modifier",b.comment="comment",b.string="string",b.number="number",b.regexp="regexp",b.operator="operator",b.decorator="decorator"})(jt||(r.SemanticTokenTypes=jt={}));var br;(function(b){b.declaration="declaration",b.definition="definition",b.readonly="readonly",b.static="static",b.deprecated="deprecated",b.abstract="abstract",b.async="async",b.modification="modification",b.documentation="documentation",b.defaultLibrary="defaultLibrary"})(br||(r.SemanticTokenModifiers=br={}));var wi;(function(b){function A(m){var T=m;return F.objectLiteral(T)&&(T.resultId===void 0||typeof T.resultId=="string")&&Array.isArray(T.data)&&(T.data.length===0||typeof T.data[0]=="number")}b.is=A})(wi||(r.SemanticTokens=wi={}));var es;(function(b){function A(T,y){return{range:T,text:y}}b.create=A;function m(T){var y=T;return y!=null&&c.is(y.range)&&F.string(y.text)}b.is=m})(es||(r.InlineValueText=es={}));var ts;(function(b){function A(T,y,_){return{range:T,variableName:y,caseSensitiveLookup:_}}b.create=A;function m(T){var y=T;return y!=null&&c.is(y.range)&&F.boolean(y.caseSensitiveLookup)&&(F.string(y.variableName)||y.variableName===void 0)}b.is=m})(ts||(r.InlineValueVariableLookup=ts={}));var ns;(function(b){function A(T,y){return{range:T,expression:y}}b.create=A;function m(T){var y=T;return y!=null&&c.is(y.range)&&(F.string(y.expression)||y.expression===void 0)}b.is=m})(ns||(r.InlineValueEvaluatableExpression=ns={}));var rs;(function(b){function A(T,y){return{frameId:T,stoppedLocation:y}}b.create=A;function m(T){var y=T;return F.defined(y)&&c.is(T.stoppedLocation)}b.is=m})(rs||(r.InlineValueContext=rs={}));var vi;(function(b){b.Type=1,b.Parameter=2;function A(m){return m===1||m===2}b.is=A})(vi||(r.InlayHintKind=vi={}));var bi;(function(b){function A(T){return{value:T}}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&(y.tooltip===void 0||F.string(y.tooltip)||j.is(y.tooltip))&&(y.location===void 0||l.is(y.location))&&(y.command===void 0||G.is(y.command))}b.is=m})(bi||(r.InlayHintLabelPart=bi={}));var Rn;(function(b){function A(T,y,_){var R={position:T,label:y};return _!==void 0&&(R.kind=_),R}b.create=A;function m(T){var y=T;return F.objectLiteral(y)&&u.is(y.position)&&(F.string(y.label)||F.typedArray(y.label,bi.is))&&(y.kind===void 0||vi.is(y.kind))&&y.textEdits===void 0||F.typedArray(y.textEdits,W.is)&&(y.tooltip===void 0||F.string(y.tooltip)||j.is(y.tooltip))&&(y.paddingLeft===void 0||F.boolean(y.paddingLeft))&&(y.paddingRight===void 0||F.boolean(y.paddingRight))}b.is=m})(Rn||(r.InlayHint=Rn={}));var is;(function(b){function A(m){return{kind:"snippet",value:m}}b.createSnippet=A})(is||(r.StringValue=is={}));var ss;(function(b){function A(m,T,y,_){return{insertText:m,filterText:T,range:y,command:_}}b.create=A})(ss||(r.InlineCompletionItem=ss={}));var Dr;(function(b){function A(m){return{items:m}}b.create=A})(Dr||(r.InlineCompletionList=Dr={}));var os;(function(b){b.Invoked=0,b.Automatic=1})(os||(r.InlineCompletionTriggerKind=os={}));var qr;(function(b){function A(m,T){return{range:m,text:T}}b.create=A})(qr||(r.SelectedCompletionInfo=qr={}));var as;(function(b){function A(m,T){return{triggerKind:m,selectedCompletionInfo:T}}b.create=A})(as||(r.InlineCompletionContext=as={}));var jn;(function(b){function A(m){var T=m;return F.objectLiteral(T)&&s.is(T.uri)&&F.string(T.name)}b.is=A})(jn||(r.WorkspaceFolder=jn={})),r.EOL=[`
156
+ `,`\r
157
+ `,"\r"];var rr;(function(b){function A(_,R,q,ee){return new co(_,R,q,ee)}b.create=A;function m(_){var R=_;return!!(F.defined(R)&&F.string(R.uri)&&(F.undefined(R.languageId)||F.string(R.languageId))&&F.uinteger(R.lineCount)&&F.func(R.getText)&&F.func(R.positionAt)&&F.func(R.offsetAt))}b.is=m;function T(_,R){for(var q=_.getText(),ee=y(R,function(Pe,nt){var Ye=Pe.range.start.line-nt.range.start.line;return Ye===0?Pe.range.start.character-nt.range.start.character:Ye}),re=q.length,Me=ee.length-1;Me>=0;Me--){var Ne=ee[Me],Ke=_.offsetAt(Ne.range.start),ge=_.offsetAt(Ne.range.end);if(ge<=re)q=q.substring(0,Ke)+Ne.newText+q.substring(ge,q.length);else throw new Error("Overlapping edit");re=Ke}return q}b.applyEdits=T;function y(_,R){if(_.length<=1)return _;var q=_.length/2|0,ee=_.slice(0,q),re=_.slice(q);y(ee,R),y(re,R);for(var Me=0,Ne=0,Ke=0;Me<ee.length&&Ne<re.length;){var ge=R(ee[Me],re[Ne]);ge<=0?_[Ke++]=ee[Me++]:_[Ke++]=re[Ne++]}for(;Me<ee.length;)_[Ke++]=ee[Me++];for(;Ne<re.length;)_[Ke++]=re[Ne++];return _}})(rr||(r.TextDocument=rr={}));var co=function(){function b(A,m,T,y){this._uri=A,this._languageId=m,this._version=T,this._content=y,this._lineOffsets=void 0}return Object.defineProperty(b.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),b.prototype.getText=function(A){if(A){var m=this.offsetAt(A.start),T=this.offsetAt(A.end);return this._content.substring(m,T)}return this._content},b.prototype.update=function(A,m){this._content=A.text,this._version=m,this._lineOffsets=void 0},b.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var A=[],m=this._content,T=!0,y=0;y<m.length;y++){T&&(A.push(y),T=!1);var _=m.charAt(y);T=_==="\r"||_===`
158
+ `,_==="\r"&&y+1<m.length&&m.charAt(y+1)===`
159
+ `&&y++}T&&m.length>0&&A.push(m.length),this._lineOffsets=A}return this._lineOffsets},b.prototype.positionAt=function(A){A=Math.max(Math.min(A,this._content.length),0);var m=this.getLineOffsets(),T=0,y=m.length;if(y===0)return u.create(0,A);for(;T<y;){var _=Math.floor((T+y)/2);m[_]>A?y=_:T=_+1}var R=T-1;return u.create(R,A-m[R])},b.prototype.offsetAt=function(A){var m=this.getLineOffsets();if(A.line>=m.length)return this._content.length;if(A.line<0)return 0;var T=m[A.line],y=A.line+1<m.length?m[A.line+1]:this._content.length;return Math.max(Math.min(T+A.character,y),T)},Object.defineProperty(b.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),b}(),F;(function(b){var A=Object.prototype.toString;function m(ge){return typeof ge<"u"}b.defined=m;function T(ge){return typeof ge>"u"}b.undefined=T;function y(ge){return ge===!0||ge===!1}b.boolean=y;function _(ge){return A.call(ge)==="[object String]"}b.string=_;function R(ge){return A.call(ge)==="[object Number]"}b.number=R;function q(ge,Pe,nt){return A.call(ge)==="[object Number]"&&Pe<=ge&&ge<=nt}b.numberRange=q;function ee(ge){return A.call(ge)==="[object Number]"&&-2147483648<=ge&&ge<=2147483647}b.integer=ee;function re(ge){return A.call(ge)==="[object Number]"&&0<=ge&&ge<=2147483647}b.uinteger=re;function Me(ge){return A.call(ge)==="[object Function]"}b.func=Me;function Ne(ge){return ge!==null&&typeof ge=="object"}b.objectLiteral=Ne;function Ke(ge,Pe){return Array.isArray(ge)&&ge.every(Pe)}b.typedArray=Ke})(F||(F={}))})}(bp,bp.exports)),bp.exports}var yn={},QS;function Et(){if(QS)return yn;QS=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.ProtocolNotificationType=yn.ProtocolNotificationType0=yn.ProtocolRequestType=yn.ProtocolRequestType0=yn.RegistrationType=yn.MessageDirection=void 0;const t=Is();var e;(function(a){a.clientToServer="clientToServer",a.serverToClient="serverToClient",a.both="both"})(e||(yn.MessageDirection=e={}));class n{constructor(u){this.method=u}}yn.RegistrationType=n;class r extends t.RequestType0{constructor(u){super(u)}}yn.ProtocolRequestType0=r;class i extends t.RequestType{constructor(u){super(u,t.ParameterStructures.byName)}}yn.ProtocolRequestType=i;class s extends t.NotificationType0{constructor(u){super(u)}}yn.ProtocolNotificationType0=s;class o extends t.NotificationType{constructor(u){super(u,t.ParameterStructures.byName)}}return yn.ProtocolNotificationType=o,yn}var iw={},At={},ZS;function sw(){if(ZS)return At;ZS=1,Object.defineProperty(At,"__esModule",{value:!0}),At.objectLiteral=At.typedArray=At.stringArray=At.array=At.func=At.error=At.number=At.string=At.boolean=void 0;function t(c){return c===!0||c===!1}At.boolean=t;function e(c){return typeof c=="string"||c instanceof String}At.string=e;function n(c){return typeof c=="number"||c instanceof Number}At.number=n;function r(c){return c instanceof Error}At.error=r;function i(c){return typeof c=="function"}At.func=i;function s(c){return Array.isArray(c)}At.array=s;function o(c){return s(c)&&c.every(l=>e(l))}At.stringArray=o;function a(c,l){return Array.isArray(c)&&c.every(l)}At.typedArray=a;function u(c){return c!==null&&typeof c=="object"}return At.objectLiteral=u,At}var Hu={},ek;function e8(){if(ek)return Hu;ek=1,Object.defineProperty(Hu,"__esModule",{value:!0}),Hu.ImplementationRequest=void 0;const t=Et();var e;return function(n){n.method="textDocument/implementation",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Hu.ImplementationRequest=e={})),Hu}var Vu={},tk;function t8(){if(tk)return Vu;tk=1,Object.defineProperty(Vu,"__esModule",{value:!0}),Vu.TypeDefinitionRequest=void 0;const t=Et();var e;return function(n){n.method="textDocument/typeDefinition",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Vu.TypeDefinitionRequest=e={})),Vu}var Ns={},nk;function n8(){if(nk)return Ns;nk=1,Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.DidChangeWorkspaceFoldersNotification=Ns.WorkspaceFoldersRequest=void 0;const t=Et();var e;(function(r){r.method="workspace/workspaceFolders",r.messageDirection=t.MessageDirection.serverToClient,r.type=new t.ProtocolRequestType0(r.method)})(e||(Ns.WorkspaceFoldersRequest=e={}));var n;return function(r){r.method="workspace/didChangeWorkspaceFolders",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolNotificationType(r.method)}(n||(Ns.DidChangeWorkspaceFoldersNotification=n={})),Ns}var Ku={},rk;function r8(){if(rk)return Ku;rk=1,Object.defineProperty(Ku,"__esModule",{value:!0}),Ku.ConfigurationRequest=void 0;const t=Et();var e;return function(n){n.method="workspace/configuration",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)}(e||(Ku.ConfigurationRequest=e={})),Ku}var Os={},ik;function i8(){if(ik)return Os;ik=1,Object.defineProperty(Os,"__esModule",{value:!0}),Os.ColorPresentationRequest=Os.DocumentColorRequest=void 0;const t=Et();var e;(function(r){r.method="textDocument/documentColor",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)})(e||(Os.DocumentColorRequest=e={}));var n;return function(r){r.method="textDocument/colorPresentation",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)}(n||(Os.ColorPresentationRequest=n={})),Os}var Fs={},sk;function s8(){if(sk)return Fs;sk=1,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.FoldingRangeRefreshRequest=Fs.FoldingRangeRequest=void 0;const t=Et();var e;(function(r){r.method="textDocument/foldingRange",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)})(e||(Fs.FoldingRangeRequest=e={}));var n;return function(r){r.method="workspace/foldingRange/refresh",r.messageDirection=t.MessageDirection.serverToClient,r.type=new t.ProtocolRequestType0(r.method)}(n||(Fs.FoldingRangeRefreshRequest=n={})),Fs}var Yu={},ok;function o8(){if(ok)return Yu;ok=1,Object.defineProperty(Yu,"__esModule",{value:!0}),Yu.DeclarationRequest=void 0;const t=Et();var e;return function(n){n.method="textDocument/declaration",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Yu.DeclarationRequest=e={})),Yu}var Xu={},ak;function a8(){if(ak)return Xu;ak=1,Object.defineProperty(Xu,"__esModule",{value:!0}),Xu.SelectionRangeRequest=void 0;const t=Et();var e;return function(n){n.method="textDocument/selectionRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Xu.SelectionRangeRequest=e={})),Xu}var ii={},uk;function u8(){if(uk)return ii;uk=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.WorkDoneProgressCancelNotification=ii.WorkDoneProgressCreateRequest=ii.WorkDoneProgress=void 0;const t=Is(),e=Et();var n;(function(s){s.type=new t.ProgressType;function o(a){return a===s.type}s.is=o})(n||(ii.WorkDoneProgress=n={}));var r;(function(s){s.method="window/workDoneProgress/create",s.messageDirection=e.MessageDirection.serverToClient,s.type=new e.ProtocolRequestType(s.method)})(r||(ii.WorkDoneProgressCreateRequest=r={}));var i;return function(s){s.method="window/workDoneProgress/cancel",s.messageDirection=e.MessageDirection.clientToServer,s.type=new e.ProtocolNotificationType(s.method)}(i||(ii.WorkDoneProgressCancelNotification=i={})),ii}var si={},ck;function c8(){if(ck)return si;ck=1,Object.defineProperty(si,"__esModule",{value:!0}),si.CallHierarchyOutgoingCallsRequest=si.CallHierarchyIncomingCallsRequest=si.CallHierarchyPrepareRequest=void 0;const t=Et();var e;(function(i){i.method="textDocument/prepareCallHierarchy",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(e||(si.CallHierarchyPrepareRequest=e={}));var n;(function(i){i.method="callHierarchy/incomingCalls",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(si.CallHierarchyIncomingCallsRequest=n={}));var r;return function(i){i.method="callHierarchy/outgoingCalls",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)}(r||(si.CallHierarchyOutgoingCallsRequest=r={})),si}var wn={},lk;function l8(){if(lk)return wn;lk=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.SemanticTokensRefreshRequest=wn.SemanticTokensRangeRequest=wn.SemanticTokensDeltaRequest=wn.SemanticTokensRequest=wn.SemanticTokensRegistrationType=wn.TokenFormat=void 0;const t=Et();var e;(function(a){a.Relative="relative"})(e||(wn.TokenFormat=e={}));var n;(function(a){a.method="textDocument/semanticTokens",a.type=new t.RegistrationType(a.method)})(n||(wn.SemanticTokensRegistrationType=n={}));var r;(function(a){a.method="textDocument/semanticTokens/full",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method),a.registrationMethod=n.method})(r||(wn.SemanticTokensRequest=r={}));var i;(function(a){a.method="textDocument/semanticTokens/full/delta",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method),a.registrationMethod=n.method})(i||(wn.SemanticTokensDeltaRequest=i={}));var s;(function(a){a.method="textDocument/semanticTokens/range",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method),a.registrationMethod=n.method})(s||(wn.SemanticTokensRangeRequest=s={}));var o;return function(a){a.method="workspace/semanticTokens/refresh",a.messageDirection=t.MessageDirection.serverToClient,a.type=new t.ProtocolRequestType0(a.method)}(o||(wn.SemanticTokensRefreshRequest=o={})),wn}var Ju={},dk;function d8(){if(dk)return Ju;dk=1,Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.ShowDocumentRequest=void 0;const t=Et();var e;return function(n){n.method="window/showDocument",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)}(e||(Ju.ShowDocumentRequest=e={})),Ju}var Qu={},fk;function f8(){if(fk)return Qu;fk=1,Object.defineProperty(Qu,"__esModule",{value:!0}),Qu.LinkedEditingRangeRequest=void 0;const t=Et();var e;return function(n){n.method="textDocument/linkedEditingRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Qu.LinkedEditingRangeRequest=e={})),Qu}var Qt={},pk;function p8(){if(pk)return Qt;pk=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.WillDeleteFilesRequest=Qt.DidDeleteFilesNotification=Qt.DidRenameFilesNotification=Qt.WillRenameFilesRequest=Qt.DidCreateFilesNotification=Qt.WillCreateFilesRequest=Qt.FileOperationPatternKind=void 0;const t=Et();var e;(function(u){u.file="file",u.folder="folder"})(e||(Qt.FileOperationPatternKind=e={}));var n;(function(u){u.method="workspace/willCreateFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(n||(Qt.WillCreateFilesRequest=n={}));var r;(function(u){u.method="workspace/didCreateFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(r||(Qt.DidCreateFilesNotification=r={}));var i;(function(u){u.method="workspace/willRenameFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(i||(Qt.WillRenameFilesRequest=i={}));var s;(function(u){u.method="workspace/didRenameFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(s||(Qt.DidRenameFilesNotification=s={}));var o;(function(u){u.method="workspace/didDeleteFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(o||(Qt.DidDeleteFilesNotification=o={}));var a;return function(u){u.method="workspace/willDeleteFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)}(a||(Qt.WillDeleteFilesRequest=a={})),Qt}var oi={},hk;function h8(){if(hk)return oi;hk=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.MonikerRequest=oi.MonikerKind=oi.UniquenessLevel=void 0;const t=Et();var e;(function(i){i.document="document",i.project="project",i.group="group",i.scheme="scheme",i.global="global"})(e||(oi.UniquenessLevel=e={}));var n;(function(i){i.$import="import",i.$export="export",i.local="local"})(n||(oi.MonikerKind=n={}));var r;return function(i){i.method="textDocument/moniker",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)}(r||(oi.MonikerRequest=r={})),oi}var ai={},mk;function m8(){if(mk)return ai;mk=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.TypeHierarchySubtypesRequest=ai.TypeHierarchySupertypesRequest=ai.TypeHierarchyPrepareRequest=void 0;const t=Et();var e;(function(i){i.method="textDocument/prepareTypeHierarchy",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(e||(ai.TypeHierarchyPrepareRequest=e={}));var n;(function(i){i.method="typeHierarchy/supertypes",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(ai.TypeHierarchySupertypesRequest=n={}));var r;return function(i){i.method="typeHierarchy/subtypes",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)}(r||(ai.TypeHierarchySubtypesRequest=r={})),ai}var Ls={},gk;function g8(){if(gk)return Ls;gk=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.InlineValueRefreshRequest=Ls.InlineValueRequest=void 0;const t=Et();var e;(function(r){r.method="textDocument/inlineValue",r.messageDirection=t.MessageDirection.clientToServer,r.type=new t.ProtocolRequestType(r.method)})(e||(Ls.InlineValueRequest=e={}));var n;return function(r){r.method="workspace/inlineValue/refresh",r.messageDirection=t.MessageDirection.serverToClient,r.type=new t.ProtocolRequestType0(r.method)}(n||(Ls.InlineValueRefreshRequest=n={})),Ls}var ui={},yk;function y8(){if(yk)return ui;yk=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.InlayHintRefreshRequest=ui.InlayHintResolveRequest=ui.InlayHintRequest=void 0;const t=Et();var e;(function(i){i.method="textDocument/inlayHint",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(e||(ui.InlayHintRequest=e={}));var n;(function(i){i.method="inlayHint/resolve",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(ui.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||(ui.InlayHintRefreshRequest=r={})),ui}var Mn={},wk;function w8(){if(wk)return Mn;wk=1,Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.DiagnosticRefreshRequest=Mn.WorkspaceDiagnosticRequest=Mn.DocumentDiagnosticRequest=Mn.DocumentDiagnosticReportKind=Mn.DiagnosticServerCancellationData=void 0;const t=Is(),e=sw(),n=Et();var r;(function(u){function c(l){const d=l;return d&&e.boolean(d.retriggerRequest)}u.is=c})(r||(Mn.DiagnosticServerCancellationData=r={}));var i;(function(u){u.Full="full",u.Unchanged="unchanged"})(i||(Mn.DocumentDiagnosticReportKind=i={}));var s;(function(u){u.method="textDocument/diagnostic",u.messageDirection=n.MessageDirection.clientToServer,u.type=new n.ProtocolRequestType(u.method),u.partialResult=new t.ProgressType})(s||(Mn.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||(Mn.WorkspaceDiagnosticRequest=o={}));var a;return function(u){u.method="workspace/diagnostic/refresh",u.messageDirection=n.MessageDirection.serverToClient,u.type=new n.ProtocolRequestType0(u.method)}(a||(Mn.DiagnosticRefreshRequest=a={})),Mn}var Rt={},vk;function v8(){if(vk)return Rt;vk=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.DidCloseNotebookDocumentNotification=Rt.DidSaveNotebookDocumentNotification=Rt.DidChangeNotebookDocumentNotification=Rt.NotebookCellArrayChange=Rt.DidOpenNotebookDocumentNotification=Rt.NotebookDocumentSyncRegistrationType=Rt.NotebookDocument=Rt.NotebookCell=Rt.ExecutionSummary=Rt.NotebookCellKind=void 0;const t=rw(),e=sw(),n=Et();var r;(function(p){p.Markup=1,p.Code=2;function h(w){return w===1||w===2}p.is=h})(r||(Rt.NotebookCellKind=r={}));var i;(function(p){function h(g,v){const E={executionOrder:g};return(v===!0||v===!1)&&(E.success=v),E}p.create=h;function w(g){const v=g;return e.objectLiteral(v)&&t.uinteger.is(v.executionOrder)&&(v.success===void 0||e.boolean(v.success))}p.is=w;function D(g,v){return g===v?!0:g==null||v===null||v===void 0?!1:g.executionOrder===v.executionOrder&&g.success===v.success}p.equals=D})(i||(Rt.ExecutionSummary=i={}));var s;(function(p){function h(v,E){return{kind:v,document:E}}p.create=h;function w(v){const E=v;return e.objectLiteral(E)&&r.is(E.kind)&&t.DocumentUri.is(E.document)&&(E.metadata===void 0||e.objectLiteral(E.metadata))}p.is=w;function D(v,E){const k=new Set;return v.document!==E.document&&k.add("document"),v.kind!==E.kind&&k.add("kind"),v.executionSummary!==E.executionSummary&&k.add("executionSummary"),(v.metadata!==void 0||E.metadata!==void 0)&&!g(v.metadata,E.metadata)&&k.add("metadata"),(v.executionSummary!==void 0||E.executionSummary!==void 0)&&!i.equals(v.executionSummary,E.executionSummary)&&k.add("executionSummary"),k}p.diff=D;function g(v,E){if(v===E)return!0;if(v==null||E===null||E===void 0||typeof v!=typeof E||typeof v!="object")return!1;const k=Array.isArray(v),P=Array.isArray(E);if(k!==P)return!1;if(k&&P){if(v.length!==E.length)return!1;for(let G=0;G<v.length;G++)if(!g(v[G],E[G]))return!1}if(e.objectLiteral(v)&&e.objectLiteral(E)){const G=Object.keys(v),W=Object.keys(E);if(G.length!==W.length||(G.sort(),W.sort(),!g(G,W)))return!1;for(let Z=0;Z<G.length;Z++){const J=G[Z];if(!g(v[J],E[J]))return!1}}return!0}})(s||(Rt.NotebookCell=s={}));var o;(function(p){function h(D,g,v,E){return{uri:D,notebookType:g,version:v,cells:E}}p.create=h;function w(D){const g=D;return e.objectLiteral(g)&&e.string(g.uri)&&t.integer.is(g.version)&&e.typedArray(g.cells,s.is)}p.is=w})(o||(Rt.NotebookDocument=o={}));var a;(function(p){p.method="notebookDocument/sync",p.messageDirection=n.MessageDirection.clientToServer,p.type=new n.RegistrationType(p.method)})(a||(Rt.NotebookDocumentSyncRegistrationType=a={}));var u;(function(p){p.method="notebookDocument/didOpen",p.messageDirection=n.MessageDirection.clientToServer,p.type=new n.ProtocolNotificationType(p.method),p.registrationMethod=a.method})(u||(Rt.DidOpenNotebookDocumentNotification=u={}));var c;(function(p){function h(D){const g=D;return e.objectLiteral(g)&&t.uinteger.is(g.start)&&t.uinteger.is(g.deleteCount)&&(g.cells===void 0||e.typedArray(g.cells,s.is))}p.is=h;function w(D,g,v){const E={start:D,deleteCount:g};return v!==void 0&&(E.cells=v),E}p.create=w})(c||(Rt.NotebookCellArrayChange=c={}));var l;(function(p){p.method="notebookDocument/didChange",p.messageDirection=n.MessageDirection.clientToServer,p.type=new n.ProtocolNotificationType(p.method),p.registrationMethod=a.method})(l||(Rt.DidChangeNotebookDocumentNotification=l={}));var d;(function(p){p.method="notebookDocument/didSave",p.messageDirection=n.MessageDirection.clientToServer,p.type=new n.ProtocolNotificationType(p.method),p.registrationMethod=a.method})(d||(Rt.DidSaveNotebookDocumentNotification=d={}));var f;return function(p){p.method="notebookDocument/didClose",p.messageDirection=n.MessageDirection.clientToServer,p.type=new n.ProtocolNotificationType(p.method),p.registrationMethod=a.method}(f||(Rt.DidCloseNotebookDocumentNotification=f={})),Rt}var Zu={},bk;function b8(){if(bk)return Zu;bk=1,Object.defineProperty(Zu,"__esModule",{value:!0}),Zu.InlineCompletionRequest=void 0;const t=Et();var e;return function(n){n.method="textDocument/inlineCompletion",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)}(e||(Zu.InlineCompletionRequest=e={})),Zu}var Dk;function D8(){return Dk||(Dk=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceSymbolRequest=t.CodeActionResolveRequest=t.CodeActionRequest=t.DocumentSymbolRequest=t.DocumentHighlightRequest=t.ReferencesRequest=t.DefinitionRequest=t.SignatureHelpRequest=t.SignatureHelpTriggerKind=t.HoverRequest=t.CompletionResolveRequest=t.CompletionRequest=t.CompletionTriggerKind=t.PublishDiagnosticsNotification=t.WatchKind=t.RelativePattern=t.FileChangeType=t.DidChangeWatchedFilesNotification=t.WillSaveTextDocumentWaitUntilRequest=t.WillSaveTextDocumentNotification=t.TextDocumentSaveReason=t.DidSaveTextDocumentNotification=t.DidCloseTextDocumentNotification=t.DidChangeTextDocumentNotification=t.TextDocumentContentChangeEvent=t.DidOpenTextDocumentNotification=t.TextDocumentSyncKind=t.TelemetryEventNotification=t.LogMessageNotification=t.ShowMessageRequest=t.ShowMessageNotification=t.MessageType=t.DidChangeConfigurationNotification=t.ExitNotification=t.ShutdownRequest=t.InitializedNotification=t.InitializeErrorCodes=t.InitializeRequest=t.WorkDoneProgressOptions=t.TextDocumentRegistrationOptions=t.StaticRegistrationOptions=t.PositionEncodingKind=t.FailureHandlingKind=t.ResourceOperationKind=t.UnregistrationRequest=t.RegistrationRequest=t.DocumentSelector=t.NotebookCellTextDocumentFilter=t.NotebookDocumentFilter=t.TextDocumentFilter=void 0,t.MonikerRequest=t.MonikerKind=t.UniquenessLevel=t.WillDeleteFilesRequest=t.DidDeleteFilesNotification=t.WillRenameFilesRequest=t.DidRenameFilesNotification=t.WillCreateFilesRequest=t.DidCreateFilesNotification=t.FileOperationPatternKind=t.LinkedEditingRangeRequest=t.ShowDocumentRequest=t.SemanticTokensRegistrationType=t.SemanticTokensRefreshRequest=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=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=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=t.InlineValueRequest=t.TypeHierarchySupertypesRequest=t.TypeHierarchySubtypesRequest=t.TypeHierarchyPrepareRequest=void 0;const e=Et(),n=rw(),r=sw(),i=e8();Object.defineProperty(t,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=t8();Object.defineProperty(t,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=n8();Object.defineProperty(t,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),Object.defineProperty(t,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=r8();Object.defineProperty(t,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const u=i8();Object.defineProperty(t,"DocumentColorRequest",{enumerable:!0,get:function(){return u.DocumentColorRequest}}),Object.defineProperty(t,"ColorPresentationRequest",{enumerable:!0,get:function(){return u.ColorPresentationRequest}});const c=s8();Object.defineProperty(t,"FoldingRangeRequest",{enumerable:!0,get:function(){return c.FoldingRangeRequest}}),Object.defineProperty(t,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return c.FoldingRangeRefreshRequest}});const l=o8();Object.defineProperty(t,"DeclarationRequest",{enumerable:!0,get:function(){return l.DeclarationRequest}});const d=a8();Object.defineProperty(t,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=u8();Object.defineProperty(t,"WorkDoneProgress",{enumerable:!0,get:function(){return f.WorkDoneProgress}}),Object.defineProperty(t,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return f.WorkDoneProgressCreateRequest}}),Object.defineProperty(t,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return f.WorkDoneProgressCancelNotification}});const p=c8();Object.defineProperty(t,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return p.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(t,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return p.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(t,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return p.CallHierarchyPrepareRequest}});const h=l8();Object.defineProperty(t,"TokenFormat",{enumerable:!0,get:function(){return h.TokenFormat}}),Object.defineProperty(t,"SemanticTokensRequest",{enumerable:!0,get:function(){return h.SemanticTokensRequest}}),Object.defineProperty(t,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return h.SemanticTokensDeltaRequest}}),Object.defineProperty(t,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return h.SemanticTokensRangeRequest}}),Object.defineProperty(t,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return h.SemanticTokensRefreshRequest}}),Object.defineProperty(t,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return h.SemanticTokensRegistrationType}});const w=d8();Object.defineProperty(t,"ShowDocumentRequest",{enumerable:!0,get:function(){return w.ShowDocumentRequest}});const D=f8();Object.defineProperty(t,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return D.LinkedEditingRangeRequest}});const g=p8();Object.defineProperty(t,"FileOperationPatternKind",{enumerable:!0,get:function(){return g.FileOperationPatternKind}}),Object.defineProperty(t,"DidCreateFilesNotification",{enumerable:!0,get:function(){return g.DidCreateFilesNotification}}),Object.defineProperty(t,"WillCreateFilesRequest",{enumerable:!0,get:function(){return g.WillCreateFilesRequest}}),Object.defineProperty(t,"DidRenameFilesNotification",{enumerable:!0,get:function(){return g.DidRenameFilesNotification}}),Object.defineProperty(t,"WillRenameFilesRequest",{enumerable:!0,get:function(){return g.WillRenameFilesRequest}}),Object.defineProperty(t,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return g.DidDeleteFilesNotification}}),Object.defineProperty(t,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return g.WillDeleteFilesRequest}});const v=h8();Object.defineProperty(t,"UniquenessLevel",{enumerable:!0,get:function(){return v.UniquenessLevel}}),Object.defineProperty(t,"MonikerKind",{enumerable:!0,get:function(){return v.MonikerKind}}),Object.defineProperty(t,"MonikerRequest",{enumerable:!0,get:function(){return v.MonikerRequest}});const E=m8();Object.defineProperty(t,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return E.TypeHierarchyPrepareRequest}}),Object.defineProperty(t,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return E.TypeHierarchySubtypesRequest}}),Object.defineProperty(t,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return E.TypeHierarchySupertypesRequest}});const k=g8();Object.defineProperty(t,"InlineValueRequest",{enumerable:!0,get:function(){return k.InlineValueRequest}}),Object.defineProperty(t,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return k.InlineValueRefreshRequest}});const P=y8();Object.defineProperty(t,"InlayHintRequest",{enumerable:!0,get:function(){return P.InlayHintRequest}}),Object.defineProperty(t,"InlayHintResolveRequest",{enumerable:!0,get:function(){return P.InlayHintResolveRequest}}),Object.defineProperty(t,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return P.InlayHintRefreshRequest}});const G=w8();Object.defineProperty(t,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return G.DiagnosticServerCancellationData}}),Object.defineProperty(t,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return G.DocumentDiagnosticReportKind}}),Object.defineProperty(t,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return G.DocumentDiagnosticRequest}}),Object.defineProperty(t,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return G.WorkspaceDiagnosticRequest}}),Object.defineProperty(t,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return G.DiagnosticRefreshRequest}});const W=v8();Object.defineProperty(t,"NotebookCellKind",{enumerable:!0,get:function(){return W.NotebookCellKind}}),Object.defineProperty(t,"ExecutionSummary",{enumerable:!0,get:function(){return W.ExecutionSummary}}),Object.defineProperty(t,"NotebookCell",{enumerable:!0,get:function(){return W.NotebookCell}}),Object.defineProperty(t,"NotebookDocument",{enumerable:!0,get:function(){return W.NotebookDocument}}),Object.defineProperty(t,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return W.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(t,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return W.DidOpenNotebookDocumentNotification}}),Object.defineProperty(t,"NotebookCellArrayChange",{enumerable:!0,get:function(){return W.NotebookCellArrayChange}}),Object.defineProperty(t,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return W.DidChangeNotebookDocumentNotification}}),Object.defineProperty(t,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return W.DidSaveNotebookDocumentNotification}}),Object.defineProperty(t,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return W.DidCloseNotebookDocumentNotification}});const Z=b8();Object.defineProperty(t,"InlineCompletionRequest",{enumerable:!0,get:function(){return Z.InlineCompletionRequest}});var J;(function(m){function T(y){const _=y;return r.string(_)||r.string(_.language)||r.string(_.scheme)||r.string(_.pattern)}m.is=T})(J||(t.TextDocumentFilter=J={}));var fe;(function(m){function T(y){const _=y;return r.objectLiteral(_)&&(r.string(_.notebookType)||r.string(_.scheme)||r.string(_.pattern))}m.is=T})(fe||(t.NotebookDocumentFilter=fe={}));var N;(function(m){function T(y){const _=y;return r.objectLiteral(_)&&(r.string(_.notebook)||fe.is(_.notebook))&&(_.language===void 0||r.string(_.language))}m.is=T})(N||(t.NotebookCellTextDocumentFilter=N={}));var S;(function(m){function T(y){if(!Array.isArray(y))return!1;for(let _ of y)if(!r.string(_)&&!J.is(_)&&!N.is(_))return!1;return!0}m.is=T})(S||(t.DocumentSelector=S={}));var $;(function(m){m.method="client/registerCapability",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolRequestType(m.method)})($||(t.RegistrationRequest=$={}));var O;(function(m){m.method="client/unregisterCapability",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolRequestType(m.method)})(O||(t.UnregistrationRequest=O={}));var V;(function(m){m.Create="create",m.Rename="rename",m.Delete="delete"})(V||(t.ResourceOperationKind=V={}));var M;(function(m){m.Abort="abort",m.Transactional="transactional",m.TextOnlyTransactional="textOnlyTransactional",m.Undo="undo"})(M||(t.FailureHandlingKind=M={}));var H;(function(m){m.UTF8="utf-8",m.UTF16="utf-16",m.UTF32="utf-32"})(H||(t.PositionEncodingKind=H={}));var Ee;(function(m){function T(y){const _=y;return _&&r.string(_.id)&&_.id.length>0}m.hasId=T})(Ee||(t.StaticRegistrationOptions=Ee={}));var te;(function(m){function T(y){const _=y;return _&&(_.documentSelector===null||S.is(_.documentSelector))}m.is=T})(te||(t.TextDocumentRegistrationOptions=te={}));var C;(function(m){function T(_){const R=_;return r.objectLiteral(R)&&(R.workDoneProgress===void 0||r.boolean(R.workDoneProgress))}m.is=T;function y(_){const R=_;return R&&r.boolean(R.workDoneProgress)}m.hasWorkDoneProgress=y})(C||(t.WorkDoneProgressOptions=C={}));var me;(function(m){m.method="initialize",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(me||(t.InitializeRequest=me={}));var tt;(function(m){m.unknownProtocolVersion=1})(tt||(t.InitializeErrorCodes=tt={}));var pt;(function(m){m.method="initialized",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(pt||(t.InitializedNotification=pt={}));var j;(function(m){m.method="shutdown",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType0(m.method)})(j||(t.ShutdownRequest=j={}));var K;(function(m){m.method="exit",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType0(m.method)})(K||(t.ExitNotification=K={}));var Ie;(function(m){m.method="workspace/didChangeConfiguration",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(Ie||(t.DidChangeConfigurationNotification=Ie={}));var oe;(function(m){m.Error=1,m.Warning=2,m.Info=3,m.Log=4,m.Debug=5})(oe||(t.MessageType=oe={}));var be;(function(m){m.method="window/showMessage",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolNotificationType(m.method)})(be||(t.ShowMessageNotification=be={}));var ke;(function(m){m.method="window/showMessageRequest",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolRequestType(m.method)})(ke||(t.ShowMessageRequest=ke={}));var ue;(function(m){m.method="window/logMessage",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolNotificationType(m.method)})(ue||(t.LogMessageNotification=ue={}));var x;(function(m){m.method="telemetry/event",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolNotificationType(m.method)})(x||(t.TelemetryEventNotification=x={}));var B;(function(m){m.None=0,m.Full=1,m.Incremental=2})(B||(t.TextDocumentSyncKind=B={}));var le;(function(m){m.method="textDocument/didOpen",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(le||(t.DidOpenTextDocumentNotification=le={}));var z;(function(m){function T(_){let R=_;return R!=null&&typeof R.text=="string"&&R.range!==void 0&&(R.rangeLength===void 0||typeof R.rangeLength=="number")}m.isIncremental=T;function y(_){let R=_;return R!=null&&typeof R.text=="string"&&R.range===void 0&&R.rangeLength===void 0}m.isFull=y})(z||(t.TextDocumentContentChangeEvent=z={}));var ce;(function(m){m.method="textDocument/didChange",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(ce||(t.DidChangeTextDocumentNotification=ce={}));var ze;(function(m){m.method="textDocument/didClose",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(ze||(t.DidCloseTextDocumentNotification=ze={}));var Je;(function(m){m.method="textDocument/didSave",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(Je||(t.DidSaveTextDocumentNotification=Je={}));var se;(function(m){m.Manual=1,m.AfterDelay=2,m.FocusOut=3})(se||(t.TextDocumentSaveReason=se={}));var _e;(function(m){m.method="textDocument/willSave",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(_e||(t.WillSaveTextDocumentNotification=_e={}));var ne;(function(m){m.method="textDocument/willSaveWaitUntil",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(ne||(t.WillSaveTextDocumentWaitUntilRequest=ne={}));var De;(function(m){m.method="workspace/didChangeWatchedFiles",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolNotificationType(m.method)})(De||(t.DidChangeWatchedFilesNotification=De={}));var Le;(function(m){m.Created=1,m.Changed=2,m.Deleted=3})(Le||(t.FileChangeType=Le={}));var ht;(function(m){function T(y){const _=y;return r.objectLiteral(_)&&(n.URI.is(_.baseUri)||n.WorkspaceFolder.is(_.baseUri))&&r.string(_.pattern)}m.is=T})(ht||(t.RelativePattern=ht={}));var Ve;(function(m){m.Create=1,m.Change=2,m.Delete=4})(Ve||(t.WatchKind=Ve={}));var qt;(function(m){m.method="textDocument/publishDiagnostics",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolNotificationType(m.method)})(qt||(t.PublishDiagnosticsNotification=qt={}));var Ut;(function(m){m.Invoked=1,m.TriggerCharacter=2,m.TriggerForIncompleteCompletions=3})(Ut||(t.CompletionTriggerKind=Ut={}));var cn;(function(m){m.method="textDocument/completion",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(cn||(t.CompletionRequest=cn={}));var Y;(function(m){m.method="completionItem/resolve",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(Y||(t.CompletionResolveRequest=Y={}));var X;(function(m){m.method="textDocument/hover",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(X||(t.HoverRequest=X={}));var de;(function(m){m.Invoked=1,m.TriggerCharacter=2,m.ContentChange=3})(de||(t.SignatureHelpTriggerKind=de={}));var Wt;(function(m){m.method="textDocument/signatureHelp",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(Wt||(t.SignatureHelpRequest=Wt={}));var jt;(function(m){m.method="textDocument/definition",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(jt||(t.DefinitionRequest=jt={}));var br;(function(m){m.method="textDocument/references",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(br||(t.ReferencesRequest=br={}));var wi;(function(m){m.method="textDocument/documentHighlight",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(wi||(t.DocumentHighlightRequest=wi={}));var es;(function(m){m.method="textDocument/documentSymbol",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(es||(t.DocumentSymbolRequest=es={}));var ts;(function(m){m.method="textDocument/codeAction",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(ts||(t.CodeActionRequest=ts={}));var ns;(function(m){m.method="codeAction/resolve",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(ns||(t.CodeActionResolveRequest=ns={}));var rs;(function(m){m.method="workspace/symbol",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(rs||(t.WorkspaceSymbolRequest=rs={}));var vi;(function(m){m.method="workspaceSymbol/resolve",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(vi||(t.WorkspaceSymbolResolveRequest=vi={}));var bi;(function(m){m.method="textDocument/codeLens",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(bi||(t.CodeLensRequest=bi={}));var Rn;(function(m){m.method="codeLens/resolve",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(Rn||(t.CodeLensResolveRequest=Rn={}));var is;(function(m){m.method="workspace/codeLens/refresh",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolRequestType0(m.method)})(is||(t.CodeLensRefreshRequest=is={}));var ss;(function(m){m.method="textDocument/documentLink",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(ss||(t.DocumentLinkRequest=ss={}));var Dr;(function(m){m.method="documentLink/resolve",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(Dr||(t.DocumentLinkResolveRequest=Dr={}));var os;(function(m){m.method="textDocument/formatting",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(os||(t.DocumentFormattingRequest=os={}));var qr;(function(m){m.method="textDocument/rangeFormatting",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(qr||(t.DocumentRangeFormattingRequest=qr={}));var as;(function(m){m.method="textDocument/rangesFormatting",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(as||(t.DocumentRangesFormattingRequest=as={}));var jn;(function(m){m.method="textDocument/onTypeFormatting",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(jn||(t.DocumentOnTypeFormattingRequest=jn={}));var rr;(function(m){m.Identifier=1})(rr||(t.PrepareSupportDefaultBehavior=rr={}));var co;(function(m){m.method="textDocument/rename",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(co||(t.RenameRequest=co={}));var F;(function(m){m.method="textDocument/prepareRename",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(F||(t.PrepareRenameRequest=F={}));var b;(function(m){m.method="workspace/executeCommand",m.messageDirection=e.MessageDirection.clientToServer,m.type=new e.ProtocolRequestType(m.method)})(b||(t.ExecuteCommandRequest=b={}));var A;(function(m){m.method="workspace/applyEdit",m.messageDirection=e.MessageDirection.serverToClient,m.type=new e.ProtocolRequestType("workspace/applyEdit")})(A||(t.ApplyWorkspaceEditRequest=A={}))}(iw)),iw}var ec={},Ek;function E8(){if(Ek)return ec;Ek=1,Object.defineProperty(ec,"__esModule",{value:!0}),ec.createProtocolConnection=void 0;const t=Is();function e(n,r,i,s){return t.ConnectionStrategy.is(s)&&(s={connectionStrategy:s}),(0,t.createMessageConnection)(n,r,i,s)}return ec.createProtocolConnection=e,ec}var Rk;function R8(){return Rk||(Rk=1,function(t){var e=Wu.__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=Wu.__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.LSPErrorCodes=t.createProtocolConnection=void 0,n(Is(),t),n(rw(),t),n(Et(),t),n(D8(),t);var r=E8();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={}))}(Wu)),Wu}var $k;function _t(){return $k||($k=1,function(t){var e=zu.__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=zu.__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.createProtocolConnection=void 0;const r=XS();n(XS(),t),n(R8(),t);function i(s,o,a,u){return(0,r.createMessageConnection)(s,o,a,u)}t.createProtocolConnection=i}(zu)),zu}var Bn={},Tk;function Sk(){if(Tk)return Bn;Tk=1,Object.defineProperty(Bn,"__esModule",{value:!0}),Bn.generateUuid=Bn.parse=Bn.isUUID=Bn.v4=Bn.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(){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._randomHex(),e._randomHex(),e._randomHex()].join(""))}}e._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"],e._timeHighBits=["8","9","a","b"],Bn.empty=new t("00000000-0000-0000-0000-000000000000");function n(){return new e}Bn.v4=n;const r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function i(a){return r.test(a)}Bn.isUUID=i;function s(a){if(!i(a))throw new Error("invalid uuid");return new t(a)}Bn.parse=s;function o(){return n().asHex()}return Bn.generateUuid=o,Bn}var ci={},kk;function $8(){if(kk)return ci;kk=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.attachPartialResult=ci.ProgressFeature=ci.attachWorkDone=void 0;const t=_t(),e=Sk();class n{constructor(f,p){this._connection=f,this._token=p,n.Instances.set(this._token,this)}begin(f,p,h,w){let D={kind:"begin",title:f,percentage:p,message:h,cancellable:w};this._connection.sendProgress(t.WorkDoneProgress.type,this._token,D)}report(f,p){let h={kind:"report"};typeof f=="number"?(h.percentage=f,p!==void 0&&(h.message=p)):h.message=f,this._connection.sendProgress(t.WorkDoneProgress.type,this._token,h)}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(f,p){super(f,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(){}}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(d,f){if(f===void 0||f.workDoneToken===void 0)return new i;const p=f.workDoneToken;return delete f.workDoneToken,new n(d,p)}ci.attachWorkDone=o;const a=d=>class extends d{constructor(){super(),this._progressSupported=!1}initialize(f){super.initialize(f),f?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(t.WorkDoneProgressCancelNotification.type,p=>{let h=n.Instances.get(p.token);(h instanceof r||h instanceof s)&&h.cancel()}))}attachWorkDoneProgress(f){return f===void 0?new i:new n(this.connection,f)}createWorkDoneProgress(){if(this._progressSupported){const f=(0,e.generateUuid)();return this.connection.sendRequest(t.WorkDoneProgressCreateRequest.type,{token:f}).then(()=>new r(this.connection,f))}else return Promise.resolve(new s)}};ci.ProgressFeature=a;var u;(function(d){d.type=new t.ProgressType})(u||(u={}));class c{constructor(f,p){this._connection=f,this._token=p}report(f){this._connection.sendProgress(u.type,this._token,f)}}function l(d,f){if(f===void 0||f.partialResultToken===void 0)return;const p=f.partialResultToken;return delete f.partialResultToken,new c(d,p)}return ci.attachPartialResult=l,ci}var tc={},Ck;function T8(){if(Ck)return tc;Ck=1,Object.defineProperty(tc,"__esModule",{value:!0}),tc.ConfigurationFeature=void 0;const t=_t(),e=Qy(),n=r=>class extends r{getConfiguration(i){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 tc.ConfigurationFeature=n,tc}var nc={},Ak;function S8(){if(Ak)return nc;Ak=1,Object.defineProperty(nc,"__esModule",{value:!0}),nc.WorkspaceFoldersFeature=void 0;const t=_t(),e=n=>class extends n{constructor(){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(){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 nc.WorkspaceFoldersFeature=e,nc}var rc={},_k;function k8(){if(_k)return rc;_k=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.CallHierarchyFeature=void 0;const t=_t(),e=n=>class extends n{get callHierarchy(){return{onPrepare:r=>this.connection.onRequest(t.CallHierarchyPrepareRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),void 0)),onIncomingCalls:r=>{const i=t.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(i,(s,o)=>r(s,o,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))},onOutgoingCalls:r=>{const i=t.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(i,(s,o)=>r(s,o,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return rc.CallHierarchyFeature=e,rc}var li={},Pk;function xk(){if(Pk)return li;Pk=1,Object.defineProperty(li,"__esModule",{value:!0}),li.SemanticTokensBuilder=li.SemanticTokensDiff=li.SemanticTokensFeature=void 0;const t=_t(),e=i=>class extends i{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(t.SemanticTokensRefreshRequest.type),on:s=>{const o=t.SemanticTokensRequest.type;return this.connection.onRequest(o,(a,u)=>s(a,u,this.attachWorkDoneProgress(a),this.attachPartialResultProgress(o,a)))},onDelta:s=>{const o=t.SemanticTokensDeltaRequest.type;return this.connection.onRequest(o,(a,u)=>s(a,u,this.attachWorkDoneProgress(a),this.attachPartialResultProgress(o,a)))},onRange:s=>{const o=t.SemanticTokensRangeRequest.type;return this.connection.onRequest(o,(a,u)=>s(a,u,this.attachWorkDoneProgress(a),this.attachPartialResultProgress(o,a)))}}}};li.SemanticTokensFeature=e;class n{constructor(s,o){this.originalSequence=s,this.modifiedSequence=o}computeDiff(){const s=this.originalSequence.length,o=this.modifiedSequence.length;let a=0;for(;a<o&&a<s&&this.originalSequence[a]===this.modifiedSequence[a];)a++;if(a<o&&a<s){let u=s-1,c=o-1;for(;u>=a&&c>=a&&this.originalSequence[u]===this.modifiedSequence[c];)u--,c--;(u<a||c<a)&&(u++,c++);const l=u-a+1,d=this.modifiedSequence.slice(a,c+1);return d.length===1&&d[0]===this.originalSequence[u]?[{start:a,deleteCount:l-1}]:[{start:a,deleteCount:l,data:d}]}else return a<o?[{start:a,deleteCount:0,data:this.modifiedSequence.slice(a)}]:a<s?[{start:a,deleteCount:s-a}]:[]}}li.SemanticTokensDiff=n;class r{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(s,o,a,u,c){let l=s,d=o;this._dataLen>0&&(l-=this._prevLine,l===0&&(d-=this._prevChar)),this._data[this._dataLen++]=l,this._data[this._dataLen++]=d,this._data[this._dataLen++]=a,this._data[this._dataLen++]=u,this._data[this._dataLen++]=c,this._prevLine=s,this._prevChar=o}get id(){return this._id.toString()}previousResult(s){this.id===s&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new n(this._prevData,this._data).computeDiff()}:this.build()}}return li.SemanticTokensBuilder=r,li}var ic={},Ik;function C8(){if(Ik)return ic;Ik=1,Object.defineProperty(ic,"__esModule",{value:!0}),ic.ShowDocumentFeature=void 0;const t=_t(),e=n=>class extends n{showDocument(r){return this.connection.sendRequest(t.ShowDocumentRequest.type,r)}};return ic.ShowDocumentFeature=e,ic}var sc={},Nk;function A8(){if(Nk)return sc;Nk=1,Object.defineProperty(sc,"__esModule",{value:!0}),sc.FileOperationsFeature=void 0;const t=_t(),e=n=>class extends n{onDidCreateFiles(r){return this.connection.onNotification(t.DidCreateFilesNotification.type,i=>{r(i)})}onDidRenameFiles(r){return this.connection.onNotification(t.DidRenameFilesNotification.type,i=>{r(i)})}onDidDeleteFiles(r){return this.connection.onNotification(t.DidDeleteFilesNotification.type,i=>{r(i)})}onWillCreateFiles(r){return this.connection.onRequest(t.WillCreateFilesRequest.type,(i,s)=>r(i,s))}onWillRenameFiles(r){return this.connection.onRequest(t.WillRenameFilesRequest.type,(i,s)=>r(i,s))}onWillDeleteFiles(r){return this.connection.onRequest(t.WillDeleteFilesRequest.type,(i,s)=>r(i,s))}};return sc.FileOperationsFeature=e,sc}var oc={},Ok;function _8(){if(Ok)return oc;Ok=1,Object.defineProperty(oc,"__esModule",{value:!0}),oc.LinkedEditingRangeFeature=void 0;const t=_t(),e=n=>class extends n{onLinkedEditingRange(r){return this.connection.onRequest(t.LinkedEditingRangeRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),void 0))}};return oc.LinkedEditingRangeFeature=e,oc}var ac={},Fk;function P8(){if(Fk)return ac;Fk=1,Object.defineProperty(ac,"__esModule",{value:!0}),ac.TypeHierarchyFeature=void 0;const t=_t(),e=n=>class extends n{get typeHierarchy(){return{onPrepare:r=>this.connection.onRequest(t.TypeHierarchyPrepareRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),void 0)),onSupertypes:r=>{const i=t.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(i,(s,o)=>r(s,o,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))},onSubtypes:r=>{const i=t.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(i,(s,o)=>r(s,o,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return ac.TypeHierarchyFeature=e,ac}var uc={},Lk;function x8(){if(Lk)return uc;Lk=1,Object.defineProperty(uc,"__esModule",{value:!0}),uc.InlineValueFeature=void 0;const t=_t(),e=n=>class extends n{get inlineValue(){return{refresh:()=>this.connection.sendRequest(t.InlineValueRefreshRequest.type),on:r=>this.connection.onRequest(t.InlineValueRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i)))}}};return uc.InlineValueFeature=e,uc}var cc={},Mk;function I8(){if(Mk)return cc;Mk=1,Object.defineProperty(cc,"__esModule",{value:!0}),cc.FoldingRangeFeature=void 0;const t=_t(),e=n=>class extends n{get foldingRange(){return{refresh:()=>this.connection.sendRequest(t.FoldingRangeRefreshRequest.type),on:r=>{const i=t.FoldingRangeRequest.type;return this.connection.onRequest(i,(s,o)=>r(s,o,this.attachWorkDoneProgress(s),this.attachPartialResultProgress(i,s)))}}}};return cc.FoldingRangeFeature=e,cc}var lc={},Bk;function N8(){if(Bk)return lc;Bk=1,Object.defineProperty(lc,"__esModule",{value:!0}),lc.InlayHintFeature=void 0;const t=_t(),e=n=>class extends n{get inlayHint(){return{refresh:()=>this.connection.sendRequest(t.InlayHintRefreshRequest.type),on:r=>this.connection.onRequest(t.InlayHintRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i))),resolve:r=>this.connection.onRequest(t.InlayHintResolveRequest.type,(i,s)=>r(i,s))}}};return lc.InlayHintFeature=e,lc}var dc={},zk;function O8(){if(zk)return dc;zk=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.DiagnosticFeature=void 0;const t=_t(),e=n=>class extends n{get diagnostics(){return{refresh:()=>this.connection.sendRequest(t.DiagnosticRefreshRequest.type),on:r=>this.connection.onRequest(t.DocumentDiagnosticRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),this.attachPartialResultProgress(t.DocumentDiagnosticRequest.partialResult,i))),onWorkspace:r=>this.connection.onRequest(t.WorkspaceDiagnosticRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i),this.attachPartialResultProgress(t.WorkspaceDiagnosticRequest.partialResult,i)))}}};return dc.DiagnosticFeature=e,dc}var Ms={},fc={},qk;function jk(){if(qk)return fc;qk=1,Object.defineProperty(fc,"__esModule",{value:!0}),fc.TextDocuments=void 0;const t=_t();class e{constructor(r){this._configuration=r,this._syncedDocuments=new Map,this._onDidChangeContent=new t.Emitter,this._onDidOpen=new t.Emitter,this._onDidClose=new t.Emitter,this._onDidSave=new t.Emitter,this._onWillSave=new t.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(r){this._willSaveWaitUntil=r}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(r){return this._syncedDocuments.get(r)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(r){r.__textDocumentSync=t.TextDocumentSyncKind.Incremental;const i=[];return i.push(r.onDidOpenTextDocument(s=>{const o=s.textDocument,a=this._configuration.create(o.uri,o.languageId,o.version,o.text);this._syncedDocuments.set(o.uri,a);const u=Object.freeze({document:a});this._onDidOpen.fire(u),this._onDidChangeContent.fire(u)})),i.push(r.onDidChangeTextDocument(s=>{const o=s.textDocument,a=s.contentChanges;if(a.length===0)return;const{version:u}=o;if(u==null)throw new Error(`Received document change event for ${o.uri} without valid version identifier`);let c=this._syncedDocuments.get(o.uri);c!==void 0&&(c=this._configuration.update(c,a,u),this._syncedDocuments.set(o.uri,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),i.push(r.onDidCloseTextDocument(s=>{let o=this._syncedDocuments.get(s.textDocument.uri);o!==void 0&&(this._syncedDocuments.delete(s.textDocument.uri),this._onDidClose.fire(Object.freeze({document:o})))})),i.push(r.onWillSaveTextDocument(s=>{let o=this._syncedDocuments.get(s.textDocument.uri);o!==void 0&&this._onWillSave.fire(Object.freeze({document:o,reason:s.reason}))})),i.push(r.onWillSaveTextDocumentWaitUntil((s,o)=>{let a=this._syncedDocuments.get(s.textDocument.uri);return a!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:a,reason:s.reason}),o):[]})),i.push(r.onDidSaveTextDocument(s=>{let o=this._syncedDocuments.get(s.textDocument.uri);o!==void 0&&this._onDidSave.fire(Object.freeze({document:o}))})),t.Disposable.create(()=>{i.forEach(s=>s.dispose())})}}return fc.TextDocuments=e,fc}var Gk;function Uk(){if(Gk)return Ms;Gk=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.NotebookDocuments=Ms.NotebookSyncFeature=void 0;const t=_t(),e=jk(),n=s=>class extends s{get synchronization(){return{onDidOpenNotebookDocument:o=>this.connection.onNotification(t.DidOpenNotebookDocumentNotification.type,a=>{o(a)}),onDidChangeNotebookDocument:o=>this.connection.onNotification(t.DidChangeNotebookDocumentNotification.type,a=>{o(a)}),onDidSaveNotebookDocument:o=>this.connection.onNotification(t.DidSaveNotebookDocumentNotification.type,a=>{o(a)}),onDidCloseNotebookDocument:o=>this.connection.onNotification(t.DidCloseNotebookDocumentNotification.type,a=>{o(a)})}}};Ms.NotebookSyncFeature=n;class r{onDidOpenTextDocument(o){return this.openHandler=o,t.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(o){this.openHandler&&this.openHandler(o)}onDidChangeTextDocument(o){return this.changeHandler=o,t.Disposable.create(()=>{this.changeHandler=o})}changeTextDocument(o){this.changeHandler&&this.changeHandler(o)}onDidCloseTextDocument(o){return this.closeHandler=o,t.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(o){this.closeHandler&&this.closeHandler(o)}onWillSaveTextDocument(){return r.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return r.NULL_DISPOSE}onDidSaveTextDocument(){return r.NULL_DISPOSE}}r.NULL_DISPOSE=Object.freeze({dispose:()=>{}});class i{constructor(o){o instanceof e.TextDocuments?this._cellTextDocuments=o:this._cellTextDocuments=new e.TextDocuments(o),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new t.Emitter,this._onDidChange=new t.Emitter,this._onDidSave=new t.Emitter,this._onDidClose=new t.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(o){return this._cellTextDocuments.get(o.document)}getNotebookDocument(o){return this.notebookDocuments.get(o)}getNotebookCell(o){const a=this.notebookCellMap.get(o);return a&&a[0]}findNotebookDocumentForCell(o){const a=typeof o=="string"?o:o.document,u=this.notebookCellMap.get(a);return u&&u[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(o){const a=new r,u=[];return u.push(this.cellTextDocuments.listen(a)),u.push(o.notebooks.synchronization.onDidOpenNotebookDocument(c=>{this.notebookDocuments.set(c.notebookDocument.uri,c.notebookDocument);for(const l of c.cellTextDocuments)a.openTextDocument({textDocument:l});this.updateCellMap(c.notebookDocument),this._onDidOpen.fire(c.notebookDocument)})),u.push(o.notebooks.synchronization.onDidChangeNotebookDocument(c=>{const l=this.notebookDocuments.get(c.notebookDocument.uri);if(l===void 0)return;l.version=c.notebookDocument.version;const d=l.metadata;let f=!1;const p=c.change;p.metadata!==void 0&&(f=!0,l.metadata=p.metadata);const h=[],w=[],D=[],g=[];if(p.cells!==void 0){const G=p.cells;if(G.structure!==void 0){const W=G.structure.array;if(l.cells.splice(W.start,W.deleteCount,...W.cells!==void 0?W.cells:[]),G.structure.didOpen!==void 0)for(const Z of G.structure.didOpen)a.openTextDocument({textDocument:Z}),h.push(Z.uri);if(G.structure.didClose)for(const Z of G.structure.didClose)a.closeTextDocument({textDocument:Z}),w.push(Z.uri)}if(G.data!==void 0){const W=new Map(G.data.map(Z=>[Z.document,Z]));for(let Z=0;Z<=l.cells.length;Z++){const J=W.get(l.cells[Z].document);if(J!==void 0){const fe=l.cells.splice(Z,1,J);if(D.push({old:fe[0],new:J}),W.delete(J.document),W.size===0)break}}}if(G.textContent!==void 0)for(const W of G.textContent)a.changeTextDocument({textDocument:W.document,contentChanges:W.changes}),g.push(W.document.uri)}this.updateCellMap(l);const v={notebookDocument:l};f&&(v.metadata={old:d,new:l.metadata});const E=[];for(const G of h)E.push(this.getNotebookCell(G));const k=[];for(const G of w)k.push(this.getNotebookCell(G));const P=[];for(const G of g)P.push(this.getNotebookCell(G));(E.length>0||k.length>0||D.length>0||P.length>0)&&(v.cells={added:E,removed:k,changed:{data:D,textContent:P}}),(v.metadata!==void 0||v.cells!==void 0)&&this._onDidChange.fire(v)})),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 d of c.cellTextDocuments)a.closeTextDocument({textDocument:d});this.notebookDocuments.delete(c.notebookDocument.uri);for(const d of l.cells)this.notebookCellMap.delete(d.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 Ms.NotebookDocuments=i,Ms}var pc={},Wk;function F8(){if(Wk)return pc;Wk=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.MonikerFeature=void 0;const t=_t(),e=n=>class extends n{get moniker(){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 pc.MonikerFeature=e,pc}var Hk;function Vk(){if(Hk)return He;Hk=1,Object.defineProperty(He,"__esModule",{value:!0}),He.createConnection=He.combineFeatures=He.combineNotebooksFeatures=He.combineLanguagesFeatures=He.combineWorkspaceFeatures=He.combineWindowFeatures=He.combineClientFeatures=He.combineTracerFeatures=He.combineTelemetryFeatures=He.combineConsoleFeatures=He._NotebooksImpl=He._LanguagesImpl=He.BulkUnregistration=He.BulkRegistration=He.ErrorMessageTracker=void 0;const t=_t(),e=Qy(),n=Sk(),r=$8(),i=T8(),s=S8(),o=k8(),a=xk(),u=C8(),c=A8(),l=_8(),d=P8(),f=x8(),p=I8(),h=N8(),w=O8(),D=Uk(),g=F8();function v(ue){if(ue!==null)return ue}class E{constructor(){this._messages=Object.create(null)}add(x){let B=this._messages[x];B||(B=0),B++,this._messages[x]=B}sendErrors(x){Object.keys(this._messages).forEach(B=>{x.window.showErrorMessage(B)})}}He.ErrorMessageTracker=E;class k{constructor(){}rawAttach(x){this._rawConnection=x}attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(x){}initialize(x){}error(x){this.send(t.MessageType.Error,x)}warn(x){this.send(t.MessageType.Warning,x)}info(x){this.send(t.MessageType.Info,x)}log(x){this.send(t.MessageType.Log,x)}debug(x){this.send(t.MessageType.Debug,x)}send(x,B){this._rawConnection&&this._rawConnection.sendNotification(t.LogMessageNotification.type,{type:x,message:B}).catch(()=>{(0,t.RAL)().console.error("Sending log message failed")})}}class P{constructor(){}attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(x){}fillServerCapabilities(x){}showErrorMessage(x,...B){let le={type:t.MessageType.Error,message:x,actions:B};return this.connection.sendRequest(t.ShowMessageRequest.type,le).then(v)}showWarningMessage(x,...B){let le={type:t.MessageType.Warning,message:x,actions:B};return this.connection.sendRequest(t.ShowMessageRequest.type,le).then(v)}showInformationMessage(x,...B){let le={type:t.MessageType.Info,message:x,actions:B};return this.connection.sendRequest(t.ShowMessageRequest.type,le).then(v)}}const G=(0,u.ShowDocumentFeature)((0,r.ProgressFeature)(P));var W;(function(ue){function x(){return new Z}ue.create=x})(W||(He.BulkRegistration=W={}));class Z{constructor(){this._registrations=[],this._registered=new Set}add(x,B){const le=e.string(x)?x:x.method;if(this._registered.has(le))throw new Error(`${le} is already added to this registration`);const z=n.generateUuid();this._registrations.push({id:z,method:le,registerOptions:B||{}}),this._registered.add(le)}asRegistrationParams(){return{registrations:this._registrations}}}var J;(function(ue){function x(){return new fe(void 0,[])}ue.create=x})(J||(He.BulkUnregistration=J={}));class fe{constructor(x,B){this._connection=x,this._unregistrations=new Map,B.forEach(le=>{this._unregistrations.set(le.method,le)})}get isAttached(){return!!this._connection}attach(x){this._connection=x}add(x){this._unregistrations.set(x.method,x)}dispose(){let x=[];for(let le of this._unregistrations.values())x.push(le);let B={unregisterations:x};this._connection.sendRequest(t.UnregistrationRequest.type,B).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(x){const B=e.string(x)?x:x.method,le=this._unregistrations.get(B);if(!le)return!1;let z={unregisterations:[le]};return this._connection.sendRequest(t.UnregistrationRequest.type,z).then(()=>{this._unregistrations.delete(B)},ce=>{this._connection.console.info(`Un-registering request handler for ${le.id} failed.`)}),!0}}class N{attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(x){}fillServerCapabilities(x){}register(x,B,le){return x instanceof Z?this.registerMany(x):x instanceof fe?this.registerSingle1(x,B,le):this.registerSingle2(x,B)}registerSingle1(x,B,le){const z=e.string(B)?B:B.method,ce=n.generateUuid();let ze={registrations:[{id:ce,method:z,registerOptions:le||{}}]};return x.isAttached||x.attach(this.connection),this.connection.sendRequest(t.RegistrationRequest.type,ze).then(Je=>(x.add({id:ce,method:z}),x),Je=>(this.connection.console.info(`Registering request handler for ${z} failed.`),Promise.reject(Je)))}registerSingle2(x,B){const le=e.string(x)?x:x.method,z=n.generateUuid();let ce={registrations:[{id:z,method:le,registerOptions:B||{}}]};return this.connection.sendRequest(t.RegistrationRequest.type,ce).then(ze=>t.Disposable.create(()=>{this.unregisterSingle(z,le).catch(()=>{this.connection.console.info(`Un-registering capability with id ${z} failed.`)})}),ze=>(this.connection.console.info(`Registering request handler for ${le} failed.`),Promise.reject(ze)))}unregisterSingle(x,B){let le={unregisterations:[{id:x,method:B}]};return this.connection.sendRequest(t.UnregistrationRequest.type,le).catch(()=>{this.connection.console.info(`Un-registering request handler for ${x} failed.`)})}registerMany(x){let B=x.asRegistrationParams();return this.connection.sendRequest(t.RegistrationRequest.type,B).then(()=>new fe(this._connection,B.registrations.map(le=>({id:le.id,method:le.method}))),le=>(this.connection.console.info("Bulk registration failed."),Promise.reject(le)))}}class S{constructor(){}attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(x){}fillServerCapabilities(x){}applyEdit(x){function B(z){return z&&!!z.edit}let le=B(x)?x:{edit:x};return this.connection.sendRequest(t.ApplyWorkspaceEditRequest.type,le)}}const $=(0,c.FileOperationsFeature)((0,s.WorkspaceFoldersFeature)((0,i.ConfigurationFeature)(S)));class O{constructor(){this._trace=t.Trace.Off}attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(x){}fillServerCapabilities(x){}set trace(x){this._trace=x}log(x,B){this._trace!==t.Trace.Off&&this.connection.sendNotification(t.LogTraceNotification.type,{message:x,verbose:this._trace===t.Trace.Verbose?B:void 0}).catch(()=>{})}}class V{constructor(){}attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(x){}fillServerCapabilities(x){}logEvent(x){this.connection.sendNotification(t.TelemetryEventNotification.type,x).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}}class M{constructor(){}attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(x){}fillServerCapabilities(x){}attachWorkDoneProgress(x){return(0,r.attachWorkDone)(this.connection,x)}attachPartialResultProgress(x,B){return(0,r.attachPartialResult)(this.connection,B)}}He._LanguagesImpl=M;const H=(0,p.FoldingRangeFeature)((0,g.MonikerFeature)((0,w.DiagnosticFeature)((0,h.InlayHintFeature)((0,f.InlineValueFeature)((0,d.TypeHierarchyFeature)((0,l.LinkedEditingRangeFeature)((0,a.SemanticTokensFeature)((0,o.CallHierarchyFeature)(M)))))))));class Ee{constructor(){}attach(x){this._connection=x}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(x){}fillServerCapabilities(x){}attachWorkDoneProgress(x){return(0,r.attachWorkDone)(this.connection,x)}attachPartialResultProgress(x,B){return(0,r.attachPartialResult)(this.connection,B)}}He._NotebooksImpl=Ee;const te=(0,D.NotebookSyncFeature)(Ee);function C(ue,x){return function(B){return x(ue(B))}}He.combineConsoleFeatures=C;function me(ue,x){return function(B){return x(ue(B))}}He.combineTelemetryFeatures=me;function tt(ue,x){return function(B){return x(ue(B))}}He.combineTracerFeatures=tt;function pt(ue,x){return function(B){return x(ue(B))}}He.combineClientFeatures=pt;function j(ue,x){return function(B){return x(ue(B))}}He.combineWindowFeatures=j;function K(ue,x){return function(B){return x(ue(B))}}He.combineWorkspaceFeatures=K;function Ie(ue,x){return function(B){return x(ue(B))}}He.combineLanguagesFeatures=Ie;function oe(ue,x){return function(B){return x(ue(B))}}He.combineNotebooksFeatures=oe;function be(ue,x){function B(z,ce,ze){return z&&ce?ze(z,ce):z||ce}return{__brand:"features",console:B(ue.console,x.console,C),tracer:B(ue.tracer,x.tracer,tt),telemetry:B(ue.telemetry,x.telemetry,me),client:B(ue.client,x.client,pt),window:B(ue.window,x.window,j),workspace:B(ue.workspace,x.workspace,K),languages:B(ue.languages,x.languages,Ie),notebooks:B(ue.notebooks,x.notebooks,oe)}}He.combineFeatures=be;function ke(ue,x,B){const le=B&&B.console?new(B.console(k)):new k,z=ue(le);le.rawAttach(z);const ce=B&&B.tracer?new(B.tracer(O)):new O,ze=B&&B.telemetry?new(B.telemetry(V)):new V,Je=B&&B.client?new(B.client(N)):new N,se=B&&B.window?new(B.window(G)):new G,_e=B&&B.workspace?new(B.workspace($)):new $,ne=B&&B.languages?new(B.languages(H)):new H,De=B&&B.notebooks?new(B.notebooks(te)):new te,Le=[le,ce,ze,Je,se,_e,ne,De];function ht(Y){return Y instanceof Promise?Y:e.thenable(Y)?new Promise((X,de)=>{Y.then(Wt=>X(Wt),Wt=>de(Wt))}):Promise.resolve(Y)}let Ve,qt,Ut,cn={listen:()=>z.listen(),sendRequest:(Y,...X)=>z.sendRequest(e.string(Y)?Y:Y.method,...X),onRequest:(Y,X)=>z.onRequest(Y,X),sendNotification:(Y,X)=>{const de=e.string(Y)?Y:Y.method;return z.sendNotification(de,X)},onNotification:(Y,X)=>z.onNotification(Y,X),onProgress:z.onProgress,sendProgress:z.sendProgress,onInitialize:Y=>(qt=Y,{dispose:()=>{qt=void 0}}),onInitialized:Y=>z.onNotification(t.InitializedNotification.type,Y),onShutdown:Y=>(Ve=Y,{dispose:()=>{Ve=void 0}}),onExit:Y=>(Ut=Y,{dispose:()=>{Ut=void 0}}),get console(){return le},get telemetry(){return ze},get tracer(){return ce},get client(){return Je},get window(){return se},get workspace(){return _e},get languages(){return ne},get notebooks(){return De},onDidChangeConfiguration:Y=>z.onNotification(t.DidChangeConfigurationNotification.type,Y),onDidChangeWatchedFiles:Y=>z.onNotification(t.DidChangeWatchedFilesNotification.type,Y),__textDocumentSync:void 0,onDidOpenTextDocument:Y=>z.onNotification(t.DidOpenTextDocumentNotification.type,Y),onDidChangeTextDocument:Y=>z.onNotification(t.DidChangeTextDocumentNotification.type,Y),onDidCloseTextDocument:Y=>z.onNotification(t.DidCloseTextDocumentNotification.type,Y),onWillSaveTextDocument:Y=>z.onNotification(t.WillSaveTextDocumentNotification.type,Y),onWillSaveTextDocumentWaitUntil:Y=>z.onRequest(t.WillSaveTextDocumentWaitUntilRequest.type,Y),onDidSaveTextDocument:Y=>z.onNotification(t.DidSaveTextDocumentNotification.type,Y),sendDiagnostics:Y=>z.sendNotification(t.PublishDiagnosticsNotification.type,Y),onHover:Y=>z.onRequest(t.HoverRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),void 0)),onCompletion:Y=>z.onRequest(t.CompletionRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onCompletionResolve:Y=>z.onRequest(t.CompletionResolveRequest.type,Y),onSignatureHelp:Y=>z.onRequest(t.SignatureHelpRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),void 0)),onDeclaration:Y=>z.onRequest(t.DeclarationRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onDefinition:Y=>z.onRequest(t.DefinitionRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onTypeDefinition:Y=>z.onRequest(t.TypeDefinitionRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onImplementation:Y=>z.onRequest(t.ImplementationRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onReferences:Y=>z.onRequest(t.ReferencesRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onDocumentHighlight:Y=>z.onRequest(t.DocumentHighlightRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onDocumentSymbol:Y=>z.onRequest(t.DocumentSymbolRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onWorkspaceSymbol:Y=>z.onRequest(t.WorkspaceSymbolRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onWorkspaceSymbolResolve:Y=>z.onRequest(t.WorkspaceSymbolResolveRequest.type,Y),onCodeAction:Y=>z.onRequest(t.CodeActionRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onCodeActionResolve:Y=>z.onRequest(t.CodeActionResolveRequest.type,(X,de)=>Y(X,de)),onCodeLens:Y=>z.onRequest(t.CodeLensRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onCodeLensResolve:Y=>z.onRequest(t.CodeLensResolveRequest.type,(X,de)=>Y(X,de)),onDocumentFormatting:Y=>z.onRequest(t.DocumentFormattingRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),void 0)),onDocumentRangeFormatting:Y=>z.onRequest(t.DocumentRangeFormattingRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),void 0)),onDocumentOnTypeFormatting:Y=>z.onRequest(t.DocumentOnTypeFormattingRequest.type,(X,de)=>Y(X,de)),onRenameRequest:Y=>z.onRequest(t.RenameRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),void 0)),onPrepareRename:Y=>z.onRequest(t.PrepareRenameRequest.type,(X,de)=>Y(X,de)),onDocumentLinks:Y=>z.onRequest(t.DocumentLinkRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onDocumentLinkResolve:Y=>z.onRequest(t.DocumentLinkResolveRequest.type,(X,de)=>Y(X,de)),onDocumentColor:Y=>z.onRequest(t.DocumentColorRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onColorPresentation:Y=>z.onRequest(t.ColorPresentationRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onFoldingRanges:Y=>z.onRequest(t.FoldingRangeRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onSelectionRanges:Y=>z.onRequest(t.SelectionRangeRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),(0,r.attachPartialResult)(z,X))),onExecuteCommand:Y=>z.onRequest(t.ExecuteCommandRequest.type,(X,de)=>Y(X,de,(0,r.attachWorkDone)(z,X),void 0)),dispose:()=>z.dispose()};for(let Y of Le)Y.attach(cn);return z.onRequest(t.InitializeRequest.type,Y=>{x.initialize(Y),e.string(Y.trace)&&(ce.trace=t.Trace.fromString(Y.trace));for(let X of Le)X.initialize(Y.capabilities);if(qt){let X=qt(Y,new t.CancellationTokenSource().token,(0,r.attachWorkDone)(z,Y),void 0);return ht(X).then(de=>{if(de instanceof t.ResponseError)return de;let Wt=de;Wt||(Wt={capabilities:{}});let jt=Wt.capabilities;jt||(jt={},Wt.capabilities=jt),jt.textDocumentSync===void 0||jt.textDocumentSync===null?jt.textDocumentSync=e.number(cn.__textDocumentSync)?cn.__textDocumentSync:t.TextDocumentSyncKind.None:!e.number(jt.textDocumentSync)&&!e.number(jt.textDocumentSync.change)&&(jt.textDocumentSync.change=e.number(cn.__textDocumentSync)?cn.__textDocumentSync:t.TextDocumentSyncKind.None);for(let br of Le)br.fillServerCapabilities(jt);return Wt})}else{let X={capabilities:{textDocumentSync:t.TextDocumentSyncKind.None}};for(let de of Le)de.fillServerCapabilities(X.capabilities);return X}}),z.onRequest(t.ShutdownRequest.type,()=>{if(x.shutdownReceived=!0,Ve)return Ve(new t.CancellationTokenSource().token)}),z.onNotification(t.ExitNotification.type,()=>{try{Ut&&Ut()}finally{x.shutdownReceived?x.exit(0):x.exit(1)}}),z.onNotification(t.SetTraceNotification.type,Y=>{ce.trace=t.Trace.fromString(Y.value)}),cn}return He.createConnection=ke,He}var vn={},Kk;function L8(){if(Kk)return vn;Kk=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.resolveModulePath=vn.FileSystem=vn.resolveGlobalYarnPath=vn.resolveGlobalNodePath=vn.resolve=vn.uriToFilePath=void 0;const t=O1,e=Rr,n=fo,r=gD;function i(d){let f=t.parse(d);if(f.protocol!=="file:"||!f.path)return;let p=f.path.split("/");for(var h=0,w=p.length;h<w;h++)p[h]=decodeURIComponent(p[h]);if(process.platform==="win32"&&p.length>1){let D=p[0],g=p[1];D.length===0&&g.length>1&&g[1]===":"&&p.shift()}return e.normalize(p.join("/"))}vn.uriToFilePath=i;function s(){return process.platform==="win32"}function o(d,f,p,h){const w="NODE_PATH",D=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((g,v)=>{let E=process.env,k=Object.create(null);Object.keys(E).forEach(P=>k[P]=E[P]),f&&n.existsSync(f)&&(k[w]?k[w]=f+e.delimiter+k[w]:k[w]=f,h&&h(`NODE_PATH value is: ${k[w]}`)),k.ELECTRON_RUN_AS_NODE="1";try{let P=(0,r.fork)("",[],{cwd:p,env:k,execArgv:["-e",D]});if(P.pid===void 0){v(new Error(`Starting process to resolve node module ${d} failed`));return}P.on("error",W=>{v(W)}),P.on("message",W=>{W.c==="r"&&(P.send({c:"e"}),W.s?g(W.r):v(new Error(`Failed to resolve module: ${d}`)))});let G={c:"rs",a:d};P.send(G)}catch(P){v(P)}})}vn.resolve=o;function a(d){let f="npm";const p=Object.create(null);Object.keys(process.env).forEach(D=>p[D]=process.env[D]),p.NO_UPDATE_NOTIFIER="true";const h={encoding:"utf8",env:p};s()&&(f="npm.cmd",h.shell=!0);let w=()=>{};try{process.on("SIGPIPE",w);let D=(0,r.spawnSync)(f,["config","get","prefix"],h).stdout;if(!D){d&&d("'npm config get prefix' didn't return a value.");return}let g=D.trim();return d&&d(`'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.removeListener("SIGPIPE",w)}}vn.resolveGlobalNodePath=a;function u(d){let f="yarn",p={encoding:"utf8"};s()&&(f="yarn.cmd",p.shell=!0);let h=()=>{};try{process.on("SIGPIPE",h);let w=(0,r.spawnSync)(f,["global","dir","--json"],p),D=w.stdout;if(!D){d&&(d("'yarn global dir' didn't return a value."),w.stderr&&d(w.stderr));return}let g=D.trim().split(/\r?\n/);for(let v of g)try{let E=JSON.parse(v);if(E.type==="log")return e.join(E.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",h)}}vn.resolveGlobalYarnPath=u;var c;(function(d){let f;function p(){return f!==void 0||(process.platform==="win32"?f=!1:f=!n.existsSync(__filename.toUpperCase())||!n.existsSync(__filename.toLowerCase())),f}d.isCaseSensitive=p;function h(w,D){return p()?e.normalize(D).indexOf(e.normalize(w))===0:e.normalize(D).toLowerCase().indexOf(e.normalize(w).toLowerCase())===0}d.isParent=h})(c||(vn.FileSystem=c={}));function l(d,f,p,h){return p?(e.isAbsolute(p)||(p=e.join(d,p)),o(f,p,p,h).then(w=>c.isParent(p,w)?w:Promise.reject(new Error(`Failed to load ${f} from node path location.`))).then(void 0,w=>o(f,a(h),d,h))):o(f,a(h),d,h)}return vn.resolveModulePath=l,vn}var ow,Yk;function Xk(){return Yk||(Yk=1,ow=_t()),ow}var hc={},mc={},Jk;function M8(){if(Jk)return mc;Jk=1,Object.defineProperty(mc,"__esModule",{value:!0}),mc.InlineCompletionFeature=void 0;const t=_t(),e=n=>class extends n{get inlineCompletion(){return{on:r=>this.connection.onRequest(t.InlineCompletionRequest.type,(i,s)=>r(i,s,this.attachWorkDoneProgress(i)))}}};return mc.InlineCompletionFeature=e,mc}var Qk;function B8(){return Qk||(Qk=1,function(t){var e=hc.__createBinding||(Object.create?function(u,c,l,d){d===void 0&&(d=l);var f=Object.getOwnPropertyDescriptor(c,l);(!f||("get"in f?!c.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return c[l]}}),Object.defineProperty(u,d,f)}:function(u,c,l,d){d===void 0&&(d=l),u[d]=c[l]}),n=hc.__exportStar||function(u,c){for(var l in u)l!=="default"&&!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=xk();Object.defineProperty(t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});const i=M8();n(_t(),t);const s=jk();Object.defineProperty(t,"TextDocuments",{enumerable:!0,get:function(){return s.TextDocuments}});const o=Uk();Object.defineProperty(t,"NotebookDocuments",{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(Vk(),t);var a;(function(u){u.all={__brand:"features",languages:i.InlineCompletionFeature}})(a||(t.ProposedFeatures=a={}))}(hc)),hc}var Zk;function eC(){return Zk||(Zk=1,function(t){var e=Bu.__createBinding||(Object.create?function(g,v,E,k){k===void 0&&(k=E);var P=Object.getOwnPropertyDescriptor(v,E);(!P||("get"in P?!v.__esModule:P.writable||P.configurable))&&(P={enumerable:!0,get:function(){return v[E]}}),Object.defineProperty(g,k,P)}:function(g,v,E,k){k===void 0&&(k=E),g[k]=v[E]}),n=Bu.__exportStar||function(g,v){for(var E in g)E!=="default"&&!Object.prototype.hasOwnProperty.call(v,E)&&e(v,g,E)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=t.Files=void 0;const r=S1,i=Qy(),s=Vk(),o=L8(),a=Xk();n(Xk(),t),n(B8(),t);var u;(function(g){g.uriToFilePath=o.uriToFilePath,g.resolveGlobalNodePath=o.resolveGlobalNodePath,g.resolveGlobalYarnPath=o.resolveGlobalYarnPath,g.resolve=o.resolve,g.resolveModulePath=o.resolveModulePath})(u||(t.Files=u={}));function c(){}let l=!1,d;function f(){const g="--clientProcessId";function v(E){try{let k=parseInt(E);isNaN(k)||(d=setInterval(()=>{try{process.kill(k,0)}catch{process.exit(l?0:1)}},3e3))}catch{}}for(let E=2;E<process.argv.length;E++){let k=process.argv[E];if(k===g&&E+1<process.argv.length){v(process.argv[E+1]);return}else{let P=k.split("=");P[0]===g&&v(P[1])}}}f();const p={initialize:g=>{const v=g.processId;i.number(v)&&d===void 0&&setInterval(()=>{try{process.kill(v,0)}catch{process.exit(l?0:1)}},3e3)},get shutdownReceived(){return l},set shutdownReceived(g){l=g},exit:g=>{process.exit(g)}};function h(g,v,E,k){let P,G,W,Z;return g!==void 0&&g.__brand==="features"&&(P=g,g=v,v=E,E=k),a.ConnectionStrategy.is(g)||a.ConnectionOptions.is(g)?Z=g:(G=g,W=v,Z=E),w(G,W,Z,P)}t.createConnection=h;function w(g,v,E,k){let P=!1;if(!g&&!v&&process.argv.length>2){let J,fe,N=process.argv.slice(2);for(let S=0;S<N.length;S++){let $=N[S];if($==="--node-ipc"){g=new a.IPCMessageReader(process),v=new a.IPCMessageWriter(process);break}else if($==="--stdio"){P=!0,g=process.stdin,v=process.stdout;break}else if($==="--socket"){J=parseInt(N[S+1]);break}else if($==="--pipe"){fe=N[S+1];break}else{var G=$.split("=");if(G[0]==="--socket"){J=parseInt(G[1]);break}else if(G[0]==="--pipe"){fe=G[1];break}}}if(J){let S=(0,a.createServerSocketTransport)(J);g=S[0],v=S[1]}else if(fe){let S=(0,a.createServerPipeTransport)(fe);g=S[0],v=S[1]}}var W="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!g)throw new Error("Connection input stream is not set. "+W);if(!v)throw new Error("Connection output stream is not set. "+W);if(i.func(g.read)&&i.func(g.on)){let J=g;J.on("end",()=>{process.exit(l?0:1)}),J.on("close",()=>{process.exit(l?0:1)})}const Z=J=>{const fe=(0,a.createProtocolConnection)(g,v,J,E);return P&&D(J),fe};return(0,s.createConnection)(Z,p,k)}function D(g){function v(k){return k.map(P=>typeof P=="string"?P:(0,r.inspect)(P)).join(" ")}const E=new Map;console.assert=function(P,...G){if(!P)if(G.length===0)g.error("Assertion failed");else{const[W,...Z]=G;g.error(`Assertion failed: ${W} ${v(Z)}`)}},console.count=function(P="default"){const G=String(P);let W=E.get(G)??0;W+=1,E.set(G,W),g.log(`${G}: ${G}`)},console.countReset=function(P){P===void 0?E.clear():E.delete(String(P))},console.debug=function(...P){g.log(v(P))},console.dir=function(P,G){g.log((0,r.inspect)(P,G))},console.log=function(...P){g.log(v(P))},console.error=function(...P){g.error(v(P))},console.trace=function(...P){const G=new Error().stack.replace(/(.+\n){2}/,"");let W="Trace";P.length!==0&&(W+=`: ${v(P)}`),g.log(`${W}
160
+ ${G}`)},console.warn=function(...P){g.warn(v(P))}}}(Bu)),Bu}var we=eC();function tC(t,e){const n={stacks:t,tokens:e};return z8(n),n.stacks.flat().forEach(i=>{i.property=void 0}),rC(n.stacks).map(i=>i[i.length-1])}function aw(t){const{next:e,cardinalities:n,visited:r,plus:i}=t,s=[],o=e.feature;if(r.has(o))return[];$i(o)||r.add(o);let a,u=o;for(;u.$container;)if($i(u.$container)){a=u.$container;break}else if(Zm(u.$container))u=u.$container;else break;if(aE(u.cardinality)){const c=Oo({next:{feature:u,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(...nC({feature:a,type:e.type},c+1,n,r,i)),s.every(l=>vo(l.feature.cardinality,l.feature)||vo(n.get(l.feature))||i.has(l.feature))&&s.push(...aw({next:{feature:a,type:e.type},cardinalities:n,visited:r,plus:i}))}return s}function uw(t){return $t(t)&&(t={feature:t}),Oo({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function Oo(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($i(u))return o.has(u)?[]:(o.add(u),nC(i,0,s,o,a).map(l=>Dp(l,u.cardinality,s)));if(ig(u)||sg(u))return u.elements.flatMap(l=>Oo({next:{feature:l,type:c,property:i.property},cardinalities:s,visited:o,plus:a})).map(l=>Dp(l,u.cardinality,s));if(Tr(u)){const l={feature:u.terminal,type:c,property:(e=i.property)!==null&&e!==void 0?e:u.feature};return Oo({next:l,cardinalities:s,visited:o,plus:a}).map(d=>Dp(d,u.cardinality,s))}else{if(fs(u))return aw({next:{feature:u,type:uu(u),property:(n=i.property)!==null&&n!==void 0?n:u.feature},cardinalities:s,visited:o,plus:a});if(Ur(u)&&tn(u.rule.ref)){const l=u.rule.ref,d={feature:l.definition,type:l.fragment||l.dataType?void 0:(r=ps(l))!==null&&r!==void 0?r:l.name,property:i.property};return Oo({next:d,cardinalities:s,visited:o,plus:a}).map(f=>Dp(f,u.cardinality,s))}else return[i]}}function Dp(t,e,n){return n.set(t.feature,e),t}function nC(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(...Oo({next:a,cardinalities:n,visited:r,plus:i})),!!vo((s=a.feature.cardinality)!==null&&s!==void 0?s:n.get(a.feature),a.feature)););return o}function z8(t){for(const e of t.tokens){const n=rC(t.stacks,e);t.stacks=n}}function rC(t,e){const n=[];for(const r of t)n.push(...q8(r,e));return n}function q8(t,e){const n=new Map,r=new Set(t.map(s=>s.feature).filter(j8)),i=[];for(;t.length>0;){const s=t.pop(),o=aw({next:s,cardinalities:n,plus:r,visited:new Set}).filter(a=>e?cw(a.feature,e):!0);for(const a of o)i.push([...t,a]);if(!o.every(a=>vo(a.feature.cardinality,a.feature)||vo(n.get(a.feature))))break}return i}function j8(t){if(t.cardinality==="+")return!0;const e=nn(t,Tr);return!!(e&&e.cardinality==="+")}function cw(t,e){if(Sr(t))return t.value===e.image;if(Ur(t))return G8(t.rule.ref,e);if(Wa(t)){const n=hg(t);if(n)return cw(n,e)}return!1}function G8(t,e){return tn(t)?uw(t.definition).some(r=>cw(r.feature,e)):Gr(t)?cu(t).test(e.image):!1}function U8(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 iC{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.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 d=this.fillCompletionItem(c,l);d&&i.push(d)},a=c=>Sr(c.feature)?c.feature.value:c.feature,u=[];for(const c of s)if(await Promise.all(rt(c.features).distinct(a).exclude(u).map(l=>this.completionFor(c,l,o))),u.push(...c.features),!this.continueCompletion(i))break;return we.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return rt(e).distinct(n=>`${n.kind}_${n.label}_${n.detail}`).toArray()}findFeaturesAt(e,n){const r=e.getText({start:we.Position.create(0,0),end:e.positionAt(n)}),i=this.completionParser.parse(r),s=i.tokens;if(i.tokenIndex===0){const u=lf(this.grammar),c=uw({feature:u.definition,type:ps(u)});return s.length>0?(s.shift(),tC(c.map(l=>[l]),s)):c}const o=[...s].splice(i.tokenIndex);return tC([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[v,E]=l,k=(r=Vd(s,v))===null||r===void 0?void 0:r.astNode;yield Object.assign(Object.assign({},c),{node:k,tokenOffset:v,tokenEndOffset:E,features:this.findFeaturesAt(o,v)})}const{nextTokenStart:d,nextTokenEnd:f,previousTokenStart:p,previousTokenEnd:h}=this.backtrackToAnyToken(a,u);let w=d;u<=d&&p!==void 0&&(w=p);const D=(i=Vd(s,w))===null||i===void 0?void 0:i.astNode;let g=!0;if(p!==void 0&&h!==void 0&&h===u&&(yield Object.assign(Object.assign({},c),{node:D,tokenOffset:p,tokenEndOffset:h,features:this.findFeaturesAt(o,p)}),g=this.performNextTokenCompletion(e,a.substring(p,h),p,h),g&&(yield Object.assign(Object.assign({},c),{node:D,tokenOffset:h,tokenEndOffset:h,features:this.findFeaturesAt(o,h)}))),D)g&&(yield Object.assign(Object.assign({},c),{node:D,tokenOffset:d,tokenEndOffset:f,features:this.findFeaturesAt(o,d)}));else{const v=lf(this.grammar);if(!v)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},c),{tokenOffset:d,tokenEndOffset:f,features:uw(v.definition)})}}performNextTokenCompletion(e,n,r,i){return new RegExp("\\P{L}$","u").test(n)}findDataTypeRuleStart(e,n){var r,i;let s=Ri(e,n,this.grammarConfig.nameRegexp),o=!!(!((r=nn(s?.grammarSource,tn))===null||r===void 0)&&r.dataType);if(o){for(;o;)s=s?.container,o=!!(!((i=nn(s?.grammarSource,tn))===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?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(Sr(n.feature))return this.completionForKeyword(e,n.feature,r);if(Wa(n.feature)&&e.node)return this.completionForCrossReference(e,n,r)}completionForCrossReference(e,n,r){const i=nn(n.feature,Tr);let s=e.node;if(i&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},ug(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.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 we.CompletionItemKind.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(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().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(s,n)){const o=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:r,range:{start:o,end:a}}}else return}}class W8{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,n,r){const i=e.parseResult.value;if(i.$cstNode){const s=i.$cstNode,o=Ri(s,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,n)}}collectLocationLinks(e,n){var r;const i=this.findLink(e);if(i)return[we.LocationLink.create(i.targetDocument.textDocument.uri,((r=i.target.astNode.$cstNode)!==null&&r!==void 0?r:i.target).range,i.target.range,i.source.range)]}findLink(e){const n=this.references.findDeclarationNode(e);if(n?.astNode){const r=wt(n.astNode);if(n&&r)return{source:e,target:n,targetDocument:r}}}}class sC{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,n,r){const i=e.parseResult.value.$cstNode;if(!i)return;const s=Ri(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(!s)return;const o=this.references.findDeclaration(s);if(o){const a=kt.equals(wt(o).uri,e.uri),u={documentUri:e.uri,includeDeclaration:a};return this.references.findReferences(o,u).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return we.DocumentHighlight.create(e.segment.range)}}class H8{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){const r=[];for(const i of iu(n)){const s=this.getSymbol(e,i);r.push(...s)}if(r.length>0)return r}}class V8{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.LanguageServer.onInitialized(r=>{n&&this.registerFileWatcher(e)})}registerFileWatcher(e){const n=rt(e.ServiceRegistry.all).flatMap(r=>r.LanguageMetaData.fileExtensions).map(r=>r.startsWith(".")?r.substring(1):r).distinct().toArray();if(n.length>0){const r=e.lsp.Connection,i={watchers:[{globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(",")}}`}]};r?.client.register(we.DidChangeWatchedFilesNotification.type,i)}}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([Xt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){const n=rt(e.changes).filter(i=>i.type!==we.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Xt.parse(i.uri)).toArray(),r=rt(e.changes).filter(i=>i.type===we.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Xt.parse(i.uri)).toArray();this.fireDocumentUpdate(n,r)}}class K8{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=e.parseResult)===null||r===void 0?void 0:r.value;if(i){if(this.shouldProcessContent(i)){const s=kr(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.$cstNode;if(i){for(const s of OD(i))if(this.commentNames.includes(s.tokenType.name)){const o=this.toFoldingRange(e,s,we.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)),we.FoldingRange.create(s.line,o.line,s.character,o.character,r)}includeLastFoldingLine(e,n){if(n===we.FoldingRangeKind.Comment)return!1;const r=e.text,i=r.charAt(r.length-1);return!(i==="}"||i===")"||i==="]")}}class Y8{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 oC<=e&&e<=aC&&X8<=n&&n<=J8||e===uC&&n!==uC}toUpperCharCode(e){return oC<=e&&e<=aC?e-32:e}}const oC=97,aC=122,X8=65,J8=90,uC=95;class cC{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,n){var r,i;const s=(i=(r=e.parseResult)===null||r===void 0?void 0:r.value)===null||i===void 0?void 0:i.$cstNode;if(s){const o=e.textDocument.offsetAt(n.position),a=Ri(s,o,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>o){const u=this.references.findDeclaration(a);if(u)return this.getAstNodeHoverContent(u)}}}}class Q8 extends cC{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){const n=this.documentationProvider.getDocumentation(e);if(n)return{contents:{kind:"markdown",value:n}}}}var Ep=_t();const Z8={[we.SemanticTokenTypes.class]:0,[we.SemanticTokenTypes.comment]:1,[we.SemanticTokenTypes.enum]:2,[we.SemanticTokenTypes.enumMember]:3,[we.SemanticTokenTypes.event]:4,[we.SemanticTokenTypes.function]:5,[we.SemanticTokenTypes.interface]:6,[we.SemanticTokenTypes.keyword]:7,[we.SemanticTokenTypes.macro]:8,[we.SemanticTokenTypes.method]:9,[we.SemanticTokenTypes.modifier]:10,[we.SemanticTokenTypes.namespace]:11,[we.SemanticTokenTypes.number]:12,[we.SemanticTokenTypes.operator]:13,[we.SemanticTokenTypes.parameter]:14,[we.SemanticTokenTypes.property]:15,[we.SemanticTokenTypes.regexp]:16,[we.SemanticTokenTypes.string]:17,[we.SemanticTokenTypes.struct]:18,[we.SemanticTokenTypes.type]:19,[we.SemanticTokenTypes.typeParameter]:20,[we.SemanticTokenTypes.variable]:21,[we.SemanticTokenTypes.decorator]:22},eU={[we.SemanticTokenModifiers.abstract]:1,[we.SemanticTokenModifiers.async]:2,[we.SemanticTokenModifiers.declaration]:4,[we.SemanticTokenModifiers.defaultLibrary]:8,[we.SemanticTokenModifiers.definition]:16,[we.SemanticTokenModifiers.deprecated]:32,[we.SemanticTokenModifiers.documentation]:64,[we.SemanticTokenModifiers.modification]:128,[we.SemanticTokenModifiers.readonly]:256,[we.SemanticTokenModifiers.static]:512};function tU(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];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 nU extends we.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(){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 rU{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.initialize((r=n.capabilities.textDocument)===null||r===void 0?void 0:r.semanticTokens)})}initialize(e){this.clientCapabilities=e}get tokenTypes(){return Z8}get tokenModifiers(){return eU}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,n,r=at.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightRange(e,n,r=at.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=at.CancellationToken.None){return this.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(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 nU;return this.tokensBuilders.set(e.uri.toString(),r),r}async computeHighlighting(e,n,r){const i=e.parseResult.value,s=Wr(i,{range:this.currentRange}).iterator();let o;do if(o=s.next(),!o.done){await It(r);const a=o.value;this.highlightElement(a,n)==="prune"&&s.prune()}while(!o.done)}highlightToken(e){var n;const{range:r,type:i}=e;let s=e.modifier;if(this.currentRange&&!Vm(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 d=this.tokenModifiers[l];a|=d}}const u=r.start.line,c=r.end.line;if(u===c){const l=r.start.character,d=r.end.character-l;this.currentTokensBuilder.push(u,l,d,o,a)}else if(!((n=this.clientCapabilities)===null||n===void 0)&&n.multilineTokenSupport){const l=r.start.character,d=this.currentDocument.textDocument.offsetAt(r.start),f=this.currentDocument.textDocument.offsetAt(r.end);this.currentTokensBuilder.push(u,l,f-d,o,a)}else{const l=r.start;let d=this.currentDocument.textDocument.offsetAt({line:u+1,character:0});this.currentTokensBuilder.push(l.line,l.character,d-l.character-1,o,a);for(let f=u+1;f<c;f++){const p=d;d=this.currentDocument.textDocument.offsetAt({line:f+1,character:0}),this.currentTokensBuilder.push(f,0,d-p-1,o,a)}this.currentTokensBuilder.push(c,0,r.end.character,o,a)}}highlightProperty(e){const n=[];if(typeof e.index=="number"){const s=rn(e.node.$cstNode,e.property,e.index);s&&n.push(s)}else n.push(...wo(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=au(n.$cstNode,r,s);u&&a.push(u)}else a.push(...gg(n.$cstNode,r));for(const u of a)this.highlightNode({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 lC;(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+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}})(lC||(lC={}));function iU(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 sU{constructor(e){this.onInitializeEmitter=new Ep.Emitter,this.onInitializedEmitter=new Ep.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(){Hy(this.services),this.services.ServiceRegistry.all.forEach(e=>Hy(e))}hasService(e){return this.services.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(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.Formatter}),l=u.map(te=>{var C,me;return(me=(C=te.lsp)===null||C===void 0?void 0:C.Formatter)===null||me===void 0?void 0:me.formatOnTypeOptions}).find(te=>!!te),d=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.CodeActionProvider}),f=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.SemanticTokenProvider}),p=tU(u.map(te=>{var C,me;return(me=(C=te.lsp)===null||C===void 0?void 0:C.SemanticTokenProvider)===null||me===void 0?void 0:me.semanticTokensOptions})),h=(i=(r=this.services.lsp)===null||r===void 0?void 0:r.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,w=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.DocumentLinkProvider}),D=iU(u.map(te=>{var C,me;return(me=(C=te.lsp)===null||C===void 0?void 0:C.SignatureHelp)===null||me===void 0?void 0:me.signatureHelpOptions})),g=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.TypeProvider}),v=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.ImplementationProvider}),E=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.CompletionProvider}),k=U8(u.map(te=>{var C,me;return(me=(C=te.lsp)===null||C===void 0?void 0:C.CompletionProvider)===null||me===void 0?void 0:me.completionOptions})),P=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.ReferencesProvider}),G=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.DocumentSymbolProvider}),W=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.DefinitionProvider}),Z=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.DocumentHighlightProvider}),J=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.FoldingRangeProvider}),fe=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.HoverProvider}),N=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.RenameProvider}),S=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.CallHierarchyProvider}),$=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.TypeHierarchyProvider}),O=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.CodeLensProvider}),V=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.DeclarationProvider}),M=this.hasService(te=>{var C;return(C=te.lsp)===null||C===void 0?void 0:C.InlayHintProvider}),H=(s=this.services.lsp)===null||s===void 0?void 0:s.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:a},executeCommandProvider:h&&{commands:h},textDocumentSync:{change:Ep.TextDocumentSyncKind.Incremental,openClose:!0,save:!!o.didSaveDocument,willSave:!!o.willSaveDocument,willSaveWaitUntil:!!o.willSaveDocumentWaitUntil},completionProvider:E?k:void 0,referencesProvider:P,documentSymbolProvider:G,definitionProvider:W,typeDefinitionProvider:g,documentHighlightProvider:Z,codeActionProvider:d,documentFormattingProvider:c,documentRangeFormattingProvider:c,documentOnTypeFormattingProvider:l,foldingRangeProvider:J,hoverProvider:fe,renameProvider:N?{prepareProvider:!0}:void 0,semanticTokensProvider:f?p:void 0,signatureHelpProvider:D,implementationProvider:v,callHierarchyProvider:S?{}:void 0,typeHierarchyProvider:$?{}:void 0,documentLinkProvider:w?{resolveProvider:!1}:void 0,codeLensProvider:O?{resolveProvider:!1}:void 0,declarationProvider:V,inlayHintProvider:M?{resolveProvider:!1}:void 0,workspaceSymbolProvider:H?{resolveProvider:!!H.resolveSymbol}:void 0}}}initialized(e){this.fireInitializedOnDefaultServices(e),this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(e){this.services.workspace.ConfigurationProvider.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(Ep.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(e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}}class oU{getSymbolKind(e){return we.SymbolKind.Field}getCompletionItemKind(e){return we.CompletionItemKind.Reference}}class aU{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=Ri(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);return s?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(we.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}}class uU{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;if(!s)return;const o=e.textDocument.offsetAt(n.position),a=Ri(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(d=>{const f=_n.replace(d.segment.range,n.newName),p=d.sourceUri.toString();i[p]?i[p].push(f):i[p]=[f]}),{changes:i}}prepareRename(e,n,r){return this.renameNodeRange(e,n.position)}renameNodeRange(e,n){const r=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(n);if(r&&i){const s=Ri(r,i,this.grammarConfig.nameRegexp);if(!s)return;if(this.references.findDeclaration(s)||this.isNameNode(s))return s.range}}isNameNode(e){return e?.astNode&&lp(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}}class dC{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,n=at.CancellationToken.None){const r=[],i=e.query.toLowerCase();for(const s of this.indexManager.allElements())if(await It(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 cU{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new we.Emitter,this._onDidOpen=new we.Emitter,this._onDidClose=new we.Emitter,this._onDidSave=new we.Emitter,this._onWillSave=new we.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(kt.normalize(e))}set(e){const n=kt.normalize(e.uri);let r=!0;this._syncedDocuments.has(n)&&(r=!1),this._syncedDocuments.set(n,e);const i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),r}delete(e){const n=kt.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=we.TextDocumentSyncKind.Incremental;const n=[];return n.push(e.onDidOpenTextDocument(r=>{const i=r.textDocument,s=kt.normalize(i.uri),o=this._configuration.create(s,i.languageId,i.version,i.text);this._syncedDocuments.set(s,o);const a=Object.freeze({document:o});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),n.push(e.onDidChangeTextDocument(r=>{const i=r.textDocument,s=r.contentChanges;if(s.length===0)return;const{version:o}=i;if(o==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);const a=kt.normalize(i.uri);let u=this._syncedDocuments.get(a);u!==void 0&&(u=this._configuration.update(u,s,o),this._syncedDocuments.set(a,u),this._onDidChangeContent.fire(Object.freeze({document:u})))})),n.push(e.onDidCloseTextDocument(r=>{const i=kt.normalize(r.textDocument.uri),s=this._syncedDocuments.get(i);s!==void 0&&(this._syncedDocuments.delete(i),this._onDidClose.fire(Object.freeze({document:s})))})),n.push(e.onWillSaveTextDocument(r=>{const i=this._syncedDocuments.get(kt.normalize(r.textDocument.uri));i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{const s=this._syncedDocuments.get(kt.normalize(r.textDocument.uri));return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{const i=this._syncedDocuments.get(kt.normalize(r.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),we.Disposable.create(()=>{n.forEach(r=>r.dispose())})}}function lU(t){return pp.merge(gS(t),dU(t))}function dU(t){return{lsp:{CompletionProvider:e=>new iC(e),DocumentSymbolProvider:e=>new H8(e),HoverProvider:e=>new Q8(e),FoldingRangeProvider:e=>new K8(e),ReferencesProvider:e=>new aU(e),DefinitionProvider:e=>new W8(e),DocumentHighlightProvider:e=>new sC(e),RenameProvider:e=>new uU(e)},shared:()=>t.shared}}function fU(t){return pp.merge(yS(t),pU(t))}function pU(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new sU(e),DocumentUpdateHandler:e=>new V8(e),WorkspaceSymbolProvider:e=>new dC(e),NodeKindProvider:()=>new oU,FuzzyMatcher:()=>new Y8},workspace:{TextDocuments:()=>new cU(cp)}}}class hU{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new mU(e,this.collector)}formatDocument(e,n){const r=e.parseResult;return r.lexerErrors.length===0&&r.parserErrors.length===0?this.doDocumentFormat(e,n.options):[]}isFormatRangeErrorFree(e,n){const r=e.parseResult;return r.lexerErrors.length||r.parserErrors.length?Math.min(...r.lexerErrors.map(s=>{var o;return(o=s.line)!==null&&o!==void 0?o:Number.MAX_VALUE}),...r.parserErrors.map(s=>{var o;return(o=s.token.startLine)!==null&&o!==void 0?o:Number.MAX_VALUE}))>n.end.line:!0}formatDocumentRange(e,n){return this.isFormatRangeErrorFree(e,n.range)?this.doDocumentFormat(e,n.options,n.range):[]}formatDocumentOnType(e,n){const r={start:{character:0,line:n.position.line},end:n.position};return this.isFormatRangeErrorFree(e,r)?this.doDocumentFormat(e,n.options,r):[]}get formatOnTypeOptions(){}doDocumentFormat(e,n,r){const i=new Map,s=(a,u,c)=>{var l,d;const f=this.nodeModeToKey(a,u),p=i.get(f),h=(l=c.options.priority)!==null&&l!==void 0?l:0,w=(d=p?.options.priority)!==null&&d!==void 0?d:0;(!p||w<=h)&&i.set(f,c)};this.collector=s,this.iterateAstFormatting(e,r);const o=this.iterateCstFormatting(e,i,n,r);return this.avoidOverlappingEdits(e.textDocument,o)}avoidOverlappingEdits(e,n){const r=[];for(const i of n){let s=r[r.length-1];for(;s;){const o=e.offsetAt(i.range.start),a=e.offsetAt(s.range.end);if(o<a)r.pop(),s=r[r.length-1];else break}r.push(i)}return r.filter(i=>this.isNecessary(i,e))}iterateAstFormatting(e,n){const r=e.parseResult.value;this.format(r);const i=kr(r).iterator();let s;do if(s=i.next(),!s.done){const o=s.value;this.insideRange(o.$cstNode.range,n)?this.format(o):i.prune()}while(!s.done)}nodeModeToKey(e,n){return`${e.offset}:${e.end}:${n}`}insideRange(e,n){return!n||e.start.line<=n.start.line&&e.end.line>=n.end.line||e.start.line>=n.start.line&&e.end.line<=n.end.line||e.start.line<=n.end.line&&e.end.line>=n.end.line}isNecessary(e,n){return e.newText!==n.getText(e.range).replace(/\r/g,"")}iterateCstFormatting(e,n,r,i){const s={indentation:0,options:r,document:e.textDocument},o=[],u=this.iterateCstTree(e,s).iterator();let c,l;do if(l=u.next(),!l.done){const d=l.value,f=ds(d),p=this.nodeModeToKey(d,"prepend"),h=n.get(p);if(n.delete(p),h){const g=this.createTextEdit(c,d,h,s);for(const v of g)v&&this.insideRange(v.range,i)&&o.push(v)}const w=this.nodeModeToKey(d,"append"),D=n.get(w);if(n.delete(w),D){const g=zD(d);if(g){const v=this.createTextEdit(d,g,D,s);for(const E of v)E&&this.insideRange(E.range,i)&&o.push(E)}}if(!h&&d.hidden){const g=this.createHiddenTextEdits(c,d,void 0,s);for(const v of g)v&&this.insideRange(v.range,i)&&o.push(v)}f&&(c=d)}while(!l.done);return o}createHiddenTextEdits(e,n,r,i){var s;const o=n.range.start.line;if(e&&e.range.end.line===o)return[];const a=[],u={start:{character:0,line:o},end:n.range.start},c=i.document.getText(u),l=this.findFittingMove(u,(s=r?.moves)!==null&&s!==void 0?s:[],i),d=this.getExistingIndentationCharacterCount(c,i),p=this.getIndentationCharacterCount(i,l)-d;if(p===0)return[];let h="";p>0&&(h=(i.options.insertSpaces?" ":" ").repeat(p));const w=n.text.split(`
161
+ `);w[0]=c+w[0];for(let D=0;D<w.length;D++){const g=o+D,v={character:0,line:g};if(p>0)a.push({newText:h,range:{start:v,end:v}});else{const E=w[D];let k=0;for(;k<E.length;k++){const P=E.charAt(k);if(P!==" "&&P!==" ")break}a.push({newText:"",range:{start:v,end:{line:g,character:Math.min(k,Math.abs(p))}}})}}return a}getExistingIndentationCharacterCount(e,n){const r=" ".repeat(n.options.tabSize);return(n.options.insertSpaces?e.replaceAll(" ",r):e.replaceAll(r," ")).length}getIndentationCharacterCount(e,n){let r=e.indentation;return n&&n.tabs&&(r+=n.tabs),(e.options.insertSpaces?e.options.tabSize:1)*r}createTextEdit(e,n,r,i){var s;if(n.hidden)return this.createHiddenTextEdits(e,n,r,i);if(e&&(e.range.end.line>n.range.start.line||e.range.end.line===n.range.start.line&&e.range.end.character>n.range.start.character))return[];const o={start:(s=e?.range.end)!==null&&s!==void 0?s:{character:0,line:0},end:n.range.start},a=this.findFittingMove(o,r.moves,i);if(!a)return[];const u=a.characters,c=a.lines,l=a.tabs,d=i.indentation;i.indentation+=l??0;const f=[];return u!==void 0?e?.hidden||f.push(this.createSpaceTextEdit(o,u,r.options)):c!==void 0?f.push(this.createLineTextEdit(o,c,i,r.options)):l!==void 0&&f.push(this.createTabTextEdit(o,!!e,i)),ds(n)&&(i.indentation=d),f}createSpaceTextEdit(e,n,r){if(e.start.line===e.end.line){const s=e.end.character-e.start.character;n=this.fitIntoOptions(n,s,r)}return{newText:" ".repeat(n),range:e}}createLineTextEdit(e,n,r,i){const s=e.end.line-e.start.line;n=this.fitIntoOptions(n,s,i);const a=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation);return{newText:`${`
162
+ `.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:`${`
163
+ `.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 mo(i,s=>this.iterateCst(s,n)):ho}iterateCst(e,n){if(!Ei(e))return ho;const r=n.indentation;return new Ot(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(n.indentation=r,en))}}class mU{constructor(e,n){this.astNode=e,this.collector=n}node(e){return new vr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){const n=[];for(const r of e)r.$cstNode&&n.push(r.$cstNode);return new vr(n,this.collector)}property(e,n){const r=rn(this.astNode.$cstNode,e,n);return new vr(r?[r]:[],this.collector)}properties(...e){const n=[];for(const r of e){const i=wo(this.astNode.$cstNode,r);n.push(...i)}return new vr(n,this.collector)}keyword(e,n){const r=au(this.astNode.$cstNode,e,n);return new vr(r?[r]:[],this.collector)}keywords(...e){const n=[];for(const r of e){const i=gg(this.astNode.$cstNode,r);n.push(...i)}return new vr(n,this.collector)}cst(e){return new vr([...e],this.collector)}interior(e,n){const r=e.nodes,i=n.nodes;if(r.length!==1||i.length!==1)return new vr([],this.collector);let s=r[0],o=i[0];if(s.offset>o.offset){const a=s;s=o,o=a}return new vr(qD(s,o),this.collector)}}class vr{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 vr(this.nodes.slice(e,n),this.collector)}}var Ni;(function(t){function e(...l){return{options:{},moves:l.flatMap(d=>d.moves).sort(c)}}t.fit=e;function n(l){return i(0,l)}t.noSpace=n;function r(l){return i(1,l)}t.oneSpace=r;function i(l,d){return{options:d??{},moves:[{characters:l}]}}t.spaces=i;function s(l){return o(1,l)}t.newLine=s;function o(l,d){return{options:d??{},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,d){var f,p,h,w,D,g;const v=(f=l.lines)!==null&&f!==void 0?f:0,E=(p=d.lines)!==null&&p!==void 0?p:0,k=(h=l.tabs)!==null&&h!==void 0?h:0,P=(w=d.tabs)!==null&&w!==void 0?w:0,G=(D=l.characters)!==null&&D!==void 0?D:0,W=(g=d.characters)!==null&&g!==void 0?g:0;return v<E?-1:v>E?1:k<P?-1:k>P?1:G<W?-1:G>W?1:0}})(Ni||(Ni={}));var lw,fC;function gU(){return fC||(fC=1,lw=eC()),lw}gU();var gc={},yc={},wc={},Bs={},Oi={},di={},pC;function hC(){if(pC)return di;pC=1,Object.defineProperty(di,"__esModule",{value:!0}),di.normalizePath=di.convertSlashes=di.cleanPath=void 0;const t=Rr;function e(s){let o=(0,t.normalize)(s);return o.length>1&&o[o.length-1]===t.sep&&(o=o.substring(0,o.length-1)),o}di.cleanPath=e;const n=/[\\/]/g;function r(s,o){return s.replace(n,o)}di.convertSlashes=r;function i(s,o){const{resolvePaths:a,normalizePath:u,pathSeparator:c}=o,l=process.platform==="win32"&&s.includes("/")||s.startsWith(".");if(a&&(s=(0,t.resolve)(s)),(u||l)&&(s=e(s)),s===".")return"";const d=s[s.length-1]!==c;return r(d?s+c:s,c)}return di.normalizePath=i,di}var fi={},mC;function yU(){if(mC)return fi;mC=1,Object.defineProperty(fi,"__esModule",{value:!0}),fi.build=fi.joinDirectoryPath=fi.joinPathWithBasePath=void 0;const t=Rr,e=hC();function n(a,u){return u+a}fi.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}fi.joinDirectoryPath=s;function o(a,u){const{relativePaths:c,includeBasePath:l}=u;return c&&a?r(a,u):l?n:i}return fi.build=o,fi}var vc={},gC;function wU(){if(gC)return vc;gC=1,Object.defineProperty(vc,"__esModule",{value:!0}),vc.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(d=>d(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){const{includeDirs:u,filters:c,relativePaths:l}=a;return u?l?c&&c.length?e(o):t(o):c&&c.length?r:n:i}return vc.build=s,vc}var bc={},yC;function vU(){if(yC)return bc;yC=1,Object.defineProperty(bc,"__esModule",{value:!0}),bc.build=void 0;const t=(o,a,u,c)=>{c.every(l=>l(o,!1))&&u.files++},e=(o,a,u,c)=>{c.every(l=>l(o,!1))&&a.push(o)},n=(o,a,u,c)=>{u.files++},r=(o,a)=>{a.push(o)},i=()=>{};function s(o){const{excludeFiles:a,filters:u,onlyCounts:c}=o;return a?i:u&&u.length?c?t:e:c?n:r}return bc.build=s,bc}var Dc={},wC;function bU(){if(wC)return Dc;wC=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.build=void 0;const t=r=>r,e=()=>[""].slice(0,0);function n(r){return r.group?e:t}return Dc.build=n,Dc}var Ec={},vC;function DU(){if(vC)return Ec;vC=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.build=void 0;const t=(r,i,s)=>{r.push({directory:i,files:s,dir:i})},e=()=>{};function n(r){return r.group?t:e}return Ec.build=n,Ec}var Fo={},bC;function EU(){if(bC)return Fo;bC=1;var t=Fo.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.build=void 0;const e=t(fo),n=Rr,r=function(u,c,l){const{queue:d,options:{suppressErrors:f}}=c;d.enqueue(),e.default.realpath(u,(p,h)=>{if(p)return d.dequeue(f?null:p,c);e.default.stat(h,(w,D)=>{if(w)return d.dequeue(f?null:w,c);if(D.isDirectory()&&o(u,h,c))return d.dequeue(null,c);l(D,h),d.dequeue(null,c)})})},i=function(u,c,l){const{queue:d,options:{suppressErrors:f}}=c;d.enqueue();try{const p=e.default.realpathSync(u),h=e.default.statSync(p);if(h.isDirectory()&&o(u,p,c))return;l(h,p)}catch(p){if(!f)throw p}};function s(u,c){return!u.resolveSymlinks||u.excludeSymlinks?null:c?i:r}Fo.build=s;function o(u,c,l){if(l.options.useRealPaths)return a(c,l);let d=(0,n.dirname)(u),f=1;for(;d!==l.root&&f<2;){const p=l.symlinks.get(d);!!p&&(p===c||p.startsWith(c)||c.startsWith(p))?f++:d=(0,n.dirname)(d)}return l.symlinks.set(u,c),f>1}function a(u,c){return c.visited.includes(u+c.options.pathSeparator)}return Fo}var Rc={},DC;function RU(){if(DC)return Rc;DC=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.build=void 0;const t=l=>l.counts,e=l=>l.groups,n=l=>l.paths,r=l=>l.paths.slice(0,l.options.maxFiles),i=(l,d,f)=>(u(d,f,l.counts,l.options.suppressErrors),null),s=(l,d,f)=>(u(d,f,l.paths,l.options.suppressErrors),null),o=(l,d,f)=>(u(d,f,l.paths.slice(0,l.options.maxFiles),l.options.suppressErrors),null),a=(l,d,f)=>(u(d,f,l.groups,l.options.suppressErrors),null);function u(l,d,f,p){d(l&&!p?l:null,f)}function c(l,d){const{onlyCounts:f,group:p,maxFiles:h}=l;return f?d?t:i:p?d?e:a:h?d?r:o:d?n:s}return Rc.build=c,Rc}var Lo={},EC;function $U(){if(EC)return Lo;EC=1;var t=Lo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.build=void 0;const e=t(fo),n={withFileTypes:!0},r=(o,a,u,c,l)=>{if(c<0)return o.queue.dequeue(null,o);o.visited.push(a),o.counts.directories++,o.queue.enqueue(),e.default.readdir(a||".",n,(d,f=[])=>{l(f,u,c),o.queue.dequeue(o.options.suppressErrors?null:d,o)})},i=(o,a,u,c,l)=>{if(c<0)return;o.visited.push(a),o.counts.directories++;let d=[];try{d=e.default.readdirSync(a||".",n)}catch(f){if(!o.options.suppressErrors)throw f}l(d,u,c)};function s(o){return o?i:r}return Lo.build=s,Lo}var $c={},RC;function TU(){if(RC)return $c;RC=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.Queue=void 0;class t{onQueueEmpty;count=0;constructor(n){this.onQueueEmpty=n}enqueue(){this.count++}dequeue(n,r){(--this.count<=0||n)&&this.onQueueEmpty(n,r)}}return $c.Queue=t,$c}var Tc={},$C;function SU(){if($C)return Tc;$C=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.Counter=void 0;class t{_files=0;_directories=0;set files(n){this._files=n}get files(){return this._files}set directories(n){this._directories=n}get directories(){return this._directories}get dirs(){return this._directories}}return Tc.Counter=t,Tc}var TC;function SC(){if(TC)return Oi;TC=1;var t=Oi.__createBinding||(Object.create?function(D,g,v,E){E===void 0&&(E=v);var k=Object.getOwnPropertyDescriptor(g,v);(!k||("get"in k?!g.__esModule:k.writable||k.configurable))&&(k={enumerable:!0,get:function(){return g[v]}}),Object.defineProperty(D,E,k)}:function(D,g,v,E){E===void 0&&(E=v),D[E]=g[v]}),e=Oi.__setModuleDefault||(Object.create?function(D,g){Object.defineProperty(D,"default",{enumerable:!0,value:g})}:function(D,g){D.default=g}),n=Oi.__importStar||function(D){if(D&&D.__esModule)return D;var g={};if(D!=null)for(var v in D)v!=="default"&&Object.prototype.hasOwnProperty.call(D,v)&&t(g,D,v);return e(g,D),g};Object.defineProperty(Oi,"__esModule",{value:!0}),Oi.Walker=void 0;const r=Rr,i=hC(),s=n(yU()),o=n(wU()),a=n(vU()),u=n(bU()),c=n(DU()),l=n(EU()),d=n(RU()),f=n($U()),p=TU(),h=SU();class w{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(g,v,E){this.isSynchronous=!E,this.callbackInvoker=d.build(v,this.isSynchronous),this.root=(0,i.normalizePath)(g,v),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new h.Counter,options:v,queue:new p.Queue((k,P)=>this.callbackInvoker(P,k,E)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=s.build(this.root,v),this.pushDirectory=o.build(this.root,v),this.pushFile=a.build(v),this.getArray=u.build(v),this.groupFiles=c.build(v),this.resolveSymlink=l.build(v,this.isSynchronous),this.walkDirectory=f.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(g,v,E)=>{const{paths:k,options:{filters:P,resolveSymlinks:G,excludeSymlinks:W,exclude:Z,maxFiles:J,signal:fe,useRealPaths:N,pathSeparator:S}}=this.state;if(fe&&fe.aborted||J&&k.length>J)return;this.pushDirectory(v,k,P);const $=this.getArray(this.state.paths);for(let O=0;O<g.length;++O){const V=g[O];if(V.isFile()||V.isSymbolicLink()&&!G&&!W){const M=this.joinPath(V.name,v);this.pushFile(M,$,this.state.counts,P)}else if(V.isDirectory()){let M=s.joinDirectoryPath(V.name,v,this.state.options.pathSeparator);if(Z&&Z(V.name,M))continue;this.walkDirectory(this.state,M,M,E-1,this.walk)}else if(V.isSymbolicLink()&&this.resolveSymlink){let M=s.joinPathWithBasePath(V.name,v);this.resolveSymlink(M,this.state,(H,Ee)=>{if(H.isDirectory()){if(Ee=(0,i.normalizePath)(Ee,this.state.options),Z&&Z(V.name,Ee))return;this.walkDirectory(this.state,Ee,N?Ee:M+S,E-1,this.walk)}else{Ee=N?Ee:M;const te=(0,r.basename)(Ee),C=(0,i.normalizePath)((0,r.dirname)(Ee),this.state.options);Ee=this.joinPath(te,C),this.pushFile(Ee,$,this.state.counts,P)}})}}this.groupFiles(this.state.groups,v,$)}}return Oi.Walker=w,Oi}var kC;function kU(){if(kC)return Bs;kC=1,Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.callback=Bs.promise=void 0;const t=SC();function e(r,i){return new Promise((s,o)=>{n(r,i,(a,u)=>{if(a)return o(a);s(u)})})}Bs.promise=e;function n(r,i,s){new t.Walker(r,i,s).start()}return Bs.callback=n,Bs}var Sc={},CC;function CU(){if(CC)return Sc;CC=1,Object.defineProperty(Sc,"__esModule",{value:!0}),Sc.sync=void 0;const t=SC();function e(n,r){return new t.Walker(n,r).start()}return Sc.sync=e,Sc}var AC;function AU(){if(AC)return wc;AC=1,Object.defineProperty(wc,"__esModule",{value:!0}),wc.APIBuilder=void 0;const t=kU(),e=CU();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 wc.APIBuilder=n,wc}var dw={},fw,_C;function Rp(){if(_C)return fw;_C=1;const t="\\\\/",e=`[^${t}]`,n="\\.",r="\\+",i="\\?",s="\\/",o="(?=.)",a="[^/]",u=`(?:${s}|$)`,c=`(?:^|${s})`,l=`${n}{1,2}${u}`,d=`(?!${n})`,f=`(?!${c}${l})`,p=`(?!${n}{0,1}${u})`,h=`(?!${l})`,w=`[^.${s}]`,D=`${a}*?`,v={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:d,NO_DOTS:f,NO_DOT_SLASH:p,NO_DOTS_SLASH:h,QMARK_NO_DOT:w,STAR:D,START_ANCHOR:c,SEP:"/"},E={...v,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:`(?!${n}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},k={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 fw={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:k,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},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,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,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(P){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${P.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(P){return P===!0?E:v}},fw}var PC;function $p(){return PC||(PC=1,function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Rp();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=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===""?a[a.length-2]:u}}(dw)),dw}var pw,xC;function _U(){if(xC)return pw;xC=1;const t=$p(),{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:d,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:p,CHAR_RIGHT_PARENTHESES:h,CHAR_RIGHT_SQUARE_BRACKET:w}=Rp(),D=E=>E===a||E===r,g=E=>{E.isPrefix!==!0&&(E.depth=E.isGlobstar?1/0:1)};return pw=(E,k)=>{const P=k||{},G=E.length-1,W=P.parts===!0||P.scanToEnd===!0,Z=[],J=[],fe=[];let N=E,S=-1,$=0,O=0,V=!1,M=!1,H=!1,Ee=!1,te=!1,C=!1,me=!1,tt=!1,pt=!1,j=!1,K=0,Ie,oe,be={value:"",depth:0,isGlob:!1};const ke=()=>S>=G,ue=()=>N.charCodeAt(S+1),x=()=>(Ie=oe,N.charCodeAt(++S));for(;S<G;){oe=x();let ze;if(oe===r){me=be.backslashes=!0,oe=x(),oe===u&&(C=!0);continue}if(C===!0||oe===u){for(K++;ke()!==!0&&(oe=x());){if(oe===r){me=be.backslashes=!0,x();continue}if(oe===u){K++;continue}if(C!==!0&&oe===s&&(oe=x())===s){if(V=be.isBrace=!0,H=be.isGlob=!0,j=!0,W===!0)continue;break}if(C!==!0&&oe===i){if(V=be.isBrace=!0,H=be.isGlob=!0,j=!0,W===!0)continue;break}if(oe===p&&(K--,K===0)){C=!1,V=be.isBrace=!0,j=!0;break}}if(W===!0)continue;break}if(oe===a){if(Z.push(S),J.push(be),be={value:"",depth:0,isGlob:!1},j===!0)continue;if(Ie===s&&S===$+1){$+=2;continue}O=S+1;continue}if(P.noext!==!0&&(oe===d||oe===n||oe===e||oe===f||oe===o)===!0&&ue()===c){if(H=be.isGlob=!0,Ee=be.isExtglob=!0,j=!0,oe===o&&S===$&&(pt=!0),W===!0){for(;ke()!==!0&&(oe=x());){if(oe===r){me=be.backslashes=!0,oe=x();continue}if(oe===h){H=be.isGlob=!0,j=!0;break}}continue}break}if(oe===e){if(Ie===e&&(te=be.isGlobstar=!0),H=be.isGlob=!0,j=!0,W===!0)continue;break}if(oe===f){if(H=be.isGlob=!0,j=!0,W===!0)continue;break}if(oe===l){for(;ke()!==!0&&(ze=x());){if(ze===r){me=be.backslashes=!0,x();continue}if(ze===w){M=be.isBracket=!0,H=be.isGlob=!0,j=!0;break}}if(W===!0)continue;break}if(P.nonegate!==!0&&oe===o&&S===$){tt=be.negated=!0,$++;continue}if(P.noparen!==!0&&oe===c){if(H=be.isGlob=!0,W===!0){for(;ke()!==!0&&(oe=x());){if(oe===c){me=be.backslashes=!0,oe=x();continue}if(oe===h){j=!0;break}}continue}break}if(H===!0){if(j=!0,W===!0)continue;break}}P.noext===!0&&(Ee=!1,H=!1);let B=N,le="",z="";$>0&&(le=N.slice(0,$),N=N.slice($),O-=$),B&&H===!0&&O>0?(B=N.slice(0,O),z=N.slice(O)):H===!0?(B="",z=N):B=N,B&&B!==""&&B!=="/"&&B!==N&&D(B.charCodeAt(B.length-1))&&(B=B.slice(0,-1)),P.unescape===!0&&(z&&(z=t.removeBackslashes(z)),B&&me===!0&&(B=t.removeBackslashes(B)));const ce={prefix:le,input:E,start:$,base:B,glob:z,isBrace:V,isBracket:M,isGlob:H,isExtglob:Ee,isGlobstar:te,negated:tt,negatedExtglob:pt};if(P.tokens===!0&&(ce.maxDepth=0,D(oe)||J.push(be),ce.tokens=J),P.parts===!0||P.tokens===!0){let ze;for(let Je=0;Je<Z.length;Je++){const se=ze?ze+1:$,_e=Z[Je],ne=E.slice(se,_e);P.tokens&&(Je===0&&$!==0?(J[Je].isPrefix=!0,J[Je].value=le):J[Je].value=ne,g(J[Je]),ce.maxDepth+=J[Je].depth),(Je!==0||ne!=="")&&fe.push(ne),ze=_e}if(ze&&ze+1<E.length){const Je=E.slice(ze+1);fe.push(Je),P.tokens&&(J[J.length-1].value=Je,g(J[J.length-1]),ce.maxDepth+=J[J.length-1].depth)}ce.slashes=Z,ce.parts=fe}return ce},pw}var hw,IC;function PU(){if(IC)return hw;IC=1;const t=Rp(),e=$p(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:o}=t,a=(l,d)=>{if(typeof d.expandRange=="function")return d.expandRange(...l,d);l.sort();const f=`[${l.join("-")}]`;try{new RegExp(f)}catch{return l.map(h=>e.escapeRegex(h)).join("..")}return f},u=(l,d)=>`Missing ${l}: "${d}" - use "\\\\${d}" to match literal characters`,c=(l,d)=>{if(typeof l!="string")throw new TypeError("Expected a string");l=o[l]||l;const f={...d},p=typeof f.maxLength=="number"?Math.min(n,f.maxLength):n;let h=l.length;if(h>p)throw new SyntaxError(`Input length: ${h}, exceeds maximum allowed length: ${p}`);const w={type:"bos",value:"",output:f.prepend||""},D=[w],g=f.capture?"":"?:",v=t.globChars(f.windows),E=t.extglobChars(v),{DOT_LITERAL:k,PLUS_LITERAL:P,SLASH_LITERAL:G,ONE_CHAR:W,DOTS_SLASH:Z,NO_DOT:J,NO_DOT_SLASH:fe,NO_DOTS_SLASH:N,QMARK:S,QMARK_NO_DOT:$,STAR:O,START_ANCHOR:V}=v,M=se=>`(${g}(?:(?!${V}${se.dot?Z:k}).)*?)`,H=f.dot?"":J,Ee=f.dot?S:$;let te=f.bash===!0?M(f):O;f.capture&&(te=`(${te})`),typeof f.noext=="boolean"&&(f.noextglob=f.noext);const C={input:l,index:-1,start:0,dot:f.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:D};l=e.removePrefix(l,C),h=l.length;const me=[],tt=[],pt=[];let j=w,K;const Ie=()=>C.index===h-1,oe=C.peek=(se=1)=>l[C.index+se],be=C.advance=()=>l[++C.index]||"",ke=()=>l.slice(C.index+1),ue=(se="",_e=0)=>{C.consumed+=se,C.index+=_e},x=se=>{C.output+=se.output!=null?se.output:se.value,ue(se.value)},B=()=>{let se=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)be(),C.start++,se++;return se%2===0?!1:(C.negated=!0,C.start++,!0)},le=se=>{C[se]++,pt.push(se)},z=se=>{C[se]--,pt.pop()},ce=se=>{if(j.type==="globstar"){const _e=C.braces>0&&(se.type==="comma"||se.type==="brace"),ne=se.extglob===!0||me.length&&(se.type==="pipe"||se.type==="paren");se.type!=="slash"&&se.type!=="paren"&&!_e&&!ne&&(C.output=C.output.slice(0,-j.output.length),j.type="star",j.value="*",j.output=te,C.output+=j.output)}if(me.length&&se.type!=="paren"&&(me[me.length-1].inner+=se.value),(se.value||se.output)&&x(se),j&&j.type==="text"&&se.type==="text"){j.output=(j.output||j.value)+se.value,j.value+=se.value;return}se.prev=j,D.push(se),j=se},ze=(se,_e)=>{const ne={...E[_e],conditions:1,inner:""};ne.prev=j,ne.parens=C.parens,ne.output=C.output;const De=(f.capture?"(":"")+ne.open;le("parens"),ce({type:se,value:_e,output:C.output?"":W}),ce({type:"paren",extglob:!0,value:be(),output:De}),me.push(ne)},Je=se=>{let _e=se.close+(f.capture?")":""),ne;if(se.type==="negate"){let De=te;if(se.inner&&se.inner.length>1&&se.inner.includes("/")&&(De=M(f)),(De!==te||Ie()||/^\)+$/.test(ke()))&&(_e=se.close=`)$))${De}`),se.inner.includes("*")&&(ne=ke())&&/^\.[^\\/.]+$/.test(ne)){const Le=c(ne,{...d,fastpaths:!1}).output;_e=se.close=`)${Le})${De})`}se.prev.type==="bos"&&(C.negatedExtglob=!0)}ce({type:"paren",extglob:!0,value:K,output:_e}),z("parens")};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(l)){let se=!1,_e=l.replace(s,(ne,De,Le,ht,Ve,qt)=>ht==="\\"?(se=!0,ne):ht==="?"?De?De+ht+(Ve?S.repeat(Ve.length):""):qt===0?Ee+(Ve?S.repeat(Ve.length):""):S.repeat(Le.length):ht==="."?k.repeat(Le.length):ht==="*"?De?De+ht+(Ve?te:""):te:De?ne:`\\${ne}`);return se===!0&&(f.unescape===!0?_e=_e.replace(/\\/g,""):_e=_e.replace(/\\+/g,ne=>ne.length%2===0?"\\\\":ne?"\\":"")),_e===l&&f.contains===!0?(C.output=l,C):(C.output=e.wrapOutput(_e,C,d),C)}for(;!Ie();){if(K=be(),K==="\0")continue;if(K==="\\"){const ne=oe();if(ne==="/"&&f.bash!==!0||ne==="."||ne===";")continue;if(!ne){K+="\\",ce({type:"text",value:K});continue}const De=/^\\+/.exec(ke());let Le=0;if(De&&De[0].length>2&&(Le=De[0].length,C.index+=Le,Le%2!==0&&(K+="\\")),f.unescape===!0?K=be():K+=be(),C.brackets===0){ce({type:"text",value:K});continue}}if(C.brackets>0&&(K!=="]"||j.value==="["||j.value==="[^")){if(f.posix!==!1&&K===":"){const ne=j.value.slice(1);if(ne.includes("[")&&(j.posix=!0,ne.includes(":"))){const De=j.value.lastIndexOf("["),Le=j.value.slice(0,De),ht=j.value.slice(De+2),Ve=r[ht];if(Ve){j.value=Le+Ve,C.backtrack=!0,be(),!w.output&&D.indexOf(j)===1&&(w.output=W);continue}}}(K==="["&&oe()!==":"||K==="-"&&oe()==="]")&&(K=`\\${K}`),K==="]"&&(j.value==="["||j.value==="[^")&&(K=`\\${K}`),f.posix===!0&&K==="!"&&j.value==="["&&(K="^"),j.value+=K,x({value:K});continue}if(C.quotes===1&&K!=='"'){K=e.escapeRegex(K),j.value+=K,x({value:K});continue}if(K==='"'){C.quotes=C.quotes===1?0:1,f.keepQuotes===!0&&ce({type:"text",value:K});continue}if(K==="("){le("parens"),ce({type:"paren",value:K});continue}if(K===")"){if(C.parens===0&&f.strictBrackets===!0)throw new SyntaxError(u("opening","("));const ne=me[me.length-1];if(ne&&C.parens===ne.parens+1){Je(me.pop());continue}ce({type:"paren",value:K,output:C.parens?")":"\\)"}),z("parens");continue}if(K==="["){if(f.nobracket===!0||!ke().includes("]")){if(f.nobracket!==!0&&f.strictBrackets===!0)throw new SyntaxError(u("closing","]"));K=`\\${K}`}else le("brackets");ce({type:"bracket",value:K});continue}if(K==="]"){if(f.nobracket===!0||j&&j.type==="bracket"&&j.value.length===1){ce({type:"text",value:K,output:`\\${K}`});continue}if(C.brackets===0){if(f.strictBrackets===!0)throw new SyntaxError(u("opening","["));ce({type:"text",value:K,output:`\\${K}`});continue}z("brackets");const ne=j.value.slice(1);if(j.posix!==!0&&ne[0]==="^"&&!ne.includes("/")&&(K=`/${K}`),j.value+=K,x({value:K}),f.literalBrackets===!1||e.hasRegexChars(ne))continue;const De=e.escapeRegex(j.value);if(C.output=C.output.slice(0,-j.value.length),f.literalBrackets===!0){C.output+=De,j.value=De;continue}j.value=`(${g}${De}|${j.value})`,C.output+=j.value;continue}if(K==="{"&&f.nobrace!==!0){le("braces");const ne={type:"brace",value:K,output:"(",outputIndex:C.output.length,tokensIndex:C.tokens.length};tt.push(ne),ce(ne);continue}if(K==="}"){const ne=tt[tt.length-1];if(f.nobrace===!0||!ne){ce({type:"text",value:K,output:K});continue}let De=")";if(ne.dots===!0){const Le=D.slice(),ht=[];for(let Ve=Le.length-1;Ve>=0&&(D.pop(),Le[Ve].type!=="brace");Ve--)Le[Ve].type!=="dots"&&ht.unshift(Le[Ve].value);De=a(ht,f),C.backtrack=!0}if(ne.comma!==!0&&ne.dots!==!0){const Le=C.output.slice(0,ne.outputIndex),ht=C.tokens.slice(ne.tokensIndex);ne.value=ne.output="\\{",K=De="\\}",C.output=Le;for(const Ve of ht)C.output+=Ve.output||Ve.value}ce({type:"brace",value:K,output:De}),z("braces"),tt.pop();continue}if(K==="|"){me.length>0&&me[me.length-1].conditions++,ce({type:"text",value:K});continue}if(K===","){let ne=K;const De=tt[tt.length-1];De&&pt[pt.length-1]==="braces"&&(De.comma=!0,ne="|"),ce({type:"comma",value:K,output:ne});continue}if(K==="/"){if(j.type==="dot"&&C.index===C.start+1){C.start=C.index+1,C.consumed="",C.output="",D.pop(),j=w;continue}ce({type:"slash",value:K,output:G});continue}if(K==="."){if(C.braces>0&&j.type==="dot"){j.value==="."&&(j.output=k);const ne=tt[tt.length-1];j.type="dots",j.output+=K,j.value+=K,ne.dots=!0;continue}if(C.braces+C.parens===0&&j.type!=="bos"&&j.type!=="slash"){ce({type:"text",value:K,output:k});continue}ce({type:"dot",value:K,output:k});continue}if(K==="?"){if(!(j&&j.value==="(")&&f.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){ze("qmark",K);continue}if(j&&j.type==="paren"){const De=oe();let Le=K;(j.value==="("&&!/[!=<:]/.test(De)||De==="<"&&!/<([!=]|\w+>)/.test(ke()))&&(Le=`\\${K}`),ce({type:"text",value:K,output:Le});continue}if(f.dot!==!0&&(j.type==="slash"||j.type==="bos")){ce({type:"qmark",value:K,output:$});continue}ce({type:"qmark",value:K,output:S});continue}if(K==="!"){if(f.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){ze("negate",K);continue}if(f.nonegate!==!0&&C.index===0){B();continue}}if(K==="+"){if(f.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){ze("plus",K);continue}if(j&&j.value==="("||f.regex===!1){ce({type:"plus",value:K,output:P});continue}if(j&&(j.type==="bracket"||j.type==="paren"||j.type==="brace")||C.parens>0){ce({type:"plus",value:K});continue}ce({type:"plus",value:P});continue}if(K==="@"){if(f.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){ce({type:"at",extglob:!0,value:K,output:""});continue}ce({type:"text",value:K});continue}if(K!=="*"){(K==="$"||K==="^")&&(K=`\\${K}`);const ne=i.exec(ke());ne&&(K+=ne[0],C.index+=ne[0].length),ce({type:"text",value:K});continue}if(j&&(j.type==="globstar"||j.star===!0)){j.type="star",j.star=!0,j.value+=K,j.output=te,C.backtrack=!0,C.globstar=!0,ue(K);continue}let se=ke();if(f.noextglob!==!0&&/^\([^?]/.test(se)){ze("star",K);continue}if(j.type==="star"){if(f.noglobstar===!0){ue(K);continue}const ne=j.prev,De=ne.prev,Le=ne.type==="slash"||ne.type==="bos",ht=De&&(De.type==="star"||De.type==="globstar");if(f.bash===!0&&(!Le||se[0]&&se[0]!=="/")){ce({type:"star",value:K,output:""});continue}const Ve=C.braces>0&&(ne.type==="comma"||ne.type==="brace"),qt=me.length&&(ne.type==="pipe"||ne.type==="paren");if(!Le&&ne.type!=="paren"&&!Ve&&!qt){ce({type:"star",value:K,output:""});continue}for(;se.slice(0,3)==="/**";){const Ut=l[C.index+4];if(Ut&&Ut!=="/")break;se=se.slice(3),ue("/**",3)}if(ne.type==="bos"&&Ie()){j.type="globstar",j.value+=K,j.output=M(f),C.output=j.output,C.globstar=!0,ue(K);continue}if(ne.type==="slash"&&ne.prev.type!=="bos"&&!ht&&Ie()){C.output=C.output.slice(0,-(ne.output+j.output).length),ne.output=`(?:${ne.output}`,j.type="globstar",j.output=M(f)+(f.strictSlashes?")":"|$)"),j.value+=K,C.globstar=!0,C.output+=ne.output+j.output,ue(K);continue}if(ne.type==="slash"&&ne.prev.type!=="bos"&&se[0]==="/"){const Ut=se[1]!==void 0?"|$":"";C.output=C.output.slice(0,-(ne.output+j.output).length),ne.output=`(?:${ne.output}`,j.type="globstar",j.output=`${M(f)}${G}|${G}${Ut})`,j.value+=K,C.output+=ne.output+j.output,C.globstar=!0,ue(K+be()),ce({type:"slash",value:"/",output:""});continue}if(ne.type==="bos"&&se[0]==="/"){j.type="globstar",j.value+=K,j.output=`(?:^|${G}|${M(f)}${G})`,C.output=j.output,C.globstar=!0,ue(K+be()),ce({type:"slash",value:"/",output:""});continue}C.output=C.output.slice(0,-j.output.length),j.type="globstar",j.output=M(f),j.value+=K,C.output+=j.output,C.globstar=!0,ue(K);continue}const _e={type:"star",value:K,output:te};if(f.bash===!0){_e.output=".*?",(j.type==="bos"||j.type==="slash")&&(_e.output=H+_e.output),ce(_e);continue}if(j&&(j.type==="bracket"||j.type==="paren")&&f.regex===!0){_e.output=K,ce(_e);continue}(C.index===C.start||j.type==="slash"||j.type==="dot")&&(j.type==="dot"?(C.output+=fe,j.output+=fe):f.dot===!0?(C.output+=N,j.output+=N):(C.output+=H,j.output+=H),oe()!=="*"&&(C.output+=W,j.output+=W)),ce(_e)}for(;C.brackets>0;){if(f.strictBrackets===!0)throw new SyntaxError(u("closing","]"));C.output=e.escapeLast(C.output,"["),z("brackets")}for(;C.parens>0;){if(f.strictBrackets===!0)throw new SyntaxError(u("closing",")"));C.output=e.escapeLast(C.output,"("),z("parens")}for(;C.braces>0;){if(f.strictBrackets===!0)throw new SyntaxError(u("closing","}"));C.output=e.escapeLast(C.output,"{"),z("braces")}if(f.strictSlashes!==!0&&(j.type==="star"||j.type==="bracket")&&ce({type:"maybe_slash",value:"",output:`${G}?`}),C.backtrack===!0){C.output="";for(const se of C.tokens)C.output+=se.output!=null?se.output:se.value,se.suffix&&(C.output+=se.suffix)}return C};return c.fastpaths=(l,d)=>{const f={...d},p=typeof f.maxLength=="number"?Math.min(n,f.maxLength):n,h=l.length;if(h>p)throw new SyntaxError(`Input length: ${h}, exceeds maximum allowed length: ${p}`);l=o[l]||l;const{DOT_LITERAL:w,SLASH_LITERAL:D,ONE_CHAR:g,DOTS_SLASH:v,NO_DOT:E,NO_DOTS:k,NO_DOTS_SLASH:P,STAR:G,START_ANCHOR:W}=t.globChars(f.windows),Z=f.dot?k:E,J=f.dot?P:E,fe=f.capture?"":"?:",N={negated:!1,prefix:""};let S=f.bash===!0?".*?":G;f.capture&&(S=`(${S})`);const $=H=>H.noglobstar===!0?S:`(${fe}(?:(?!${W}${H.dot?v:w}).)*?)`,O=H=>{switch(H){case"*":return`${Z}${g}${S}`;case".*":return`${w}${g}${S}`;case"*.*":return`${Z}${S}${w}${g}${S}`;case"*/*":return`${Z}${S}${D}${g}${J}${S}`;case"**":return Z+$(f);case"**/*":return`(?:${Z}${$(f)}${D})?${J}${g}${S}`;case"**/*.*":return`(?:${Z}${$(f)}${D})?${J}${S}${w}${g}${S}`;case"**/.*":return`(?:${Z}${$(f)}${D})?${w}${g}${S}`;default:{const Ee=/^(.*?)\.(\w+)$/.exec(H);if(!Ee)return;const te=O(Ee[1]);return te?te+w+Ee[2]:void 0}}},V=e.removePrefix(l,N);let M=O(V);return M&&f.strictSlashes!==!0&&(M+=`${D}?`),M},hw=c,hw}var mw,NC;function xU(){if(NC)return mw;NC=1;const t=_U(),e=PU(),n=$p(),r=Rp(),i=o=>o&&typeof o=="object"&&!Array.isArray(o),s=(o,a,u=!1)=>{if(Array.isArray(o)){const D=o.map(v=>s(v,a,u));return v=>{for(const E of D){const k=E(v);if(k)return k}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||{},d=l.windows,f=c?s.compileRe(o,a):s.makeRe(o,a,!1,!0),p=f.state;delete f.state;let h=()=>!1;if(l.ignore){const D={...a,ignore:null,onMatch:null,onResult:null};h=s(l.ignore,D,u)}const w=(D,g=!1)=>{const{isMatch:v,match:E,output:k}=s.test(D,f,a,{glob:o,posix:d}),P={glob:o,state:p,regex:f,posix:d,input:D,output:k,match:E,isMatch:v};return typeof l.onResult=="function"&&l.onResult(P),v===!1?(P.isMatch=!1,g?P:!1):h(D)?(typeof l.onIgnore=="function"&&l.onIgnore(P),P.isMatch=!1,g?P:!1):(typeof l.onMatch=="function"&&l.onMatch(P),g?P:!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 d=u||{},f=d.format||(l?n.toPosixSlashes:null);let p=o===c,h=p&&f?f(o):o;return p===!1&&(h=f?f(o):o,p=h===c),(p===!1||d.capture===!0)&&(d.matchBase===!0||d.basename===!0?p=s.matchBase(o,a,u,l):p=a.exec(h)),{isMatch:!!p,match:p,output:h}},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||{},d=l.contains?"":"^",f=l.contains?"":"$";let p=`${d}(?:${o.output})${f}`;o&&o.negated===!0&&(p=`^(?!${p}).*$`);const h=s.toRegex(p,a);return c===!0&&(h.state=o),h},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?"i":""))}catch(u){if(a&&a.debug===!0)throw u;return/$^/}},s.constants=r,mw=s,mw}var gw,OC;function IU(){if(OC)return gw;OC=1;const t=xU(),e=$p();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),gw=n,gw}var FC;function NU(){if(FC)return yc;FC=1,Object.defineProperty(yc,"__esModule",{value:!0}),yc.Builder=void 0;const t=Rr,e=AU();var n=null;try{require.resolve("picomatch"),n=IU()}catch{}class r{globCache={};options={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){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=!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("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 yc.Builder=r,yc}var yw={},LC;function OU(){return LC||(LC=1,Object.defineProperty(yw,"__esModule",{value:!0})),yw}var MC;function FU(){return MC||(MC=1,function(t){var e=gc.__createBinding||(Object.create?function(i,s,o,a){a===void 0&&(a=o);var u=Object.getOwnPropertyDescriptor(s,o);(!u||("get"in u?!s.__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=gc.__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=NU();Object.defineProperty(t,"fdir",{enumerable:!0,get:function(){return r.Builder}}),n(OU(),t)}(gc)),gc}var LU=FU();class MU{constructor(){this.encoding="utf-8"}readFile(e){return lD.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await lD.promises.readdir(e.fsPath,{withFileTypes:!0})).map(r=>({dirent:r,isFile:r.isFile(),isDirectory:r.isDirectory(),uri:kt.joinPath(e,r.name)}))}}const ww="DeploymentElement";function BC(t){return U.isInstance(t,ww)}const vw="DeploymentNodeOrElementKind",Tp="DeploymentViewRule";function BU(t){return U.isInstance(t,Tp)}const kc="DynamicViewRule";function Sp(t){return U.isInstance(t,kc)}const Cc="ElementExpression";function bw(t){return U.isInstance(t,Cc)}const kp="ElementPredicate";function zU(t){return U.isInstance(t,kp)}const Cp="ElementPredicateOrWhere";function qU(t){return U.isInstance(t,Cp)}const zs="ElementProperty";function jU(t){return U.isInstance(t,zs)}const Dw="ExpressionV2";function GU(t){return U.isInstance(t,Dw)}const Ac="FqnExpr";function UU(t){return U.isInstance(t,Ac)}const Ew="FqnReferenceable",qs="LikeC4View";function Rw(t){return U.isInstance(t,qs)}const Ap="MetadataProperty";function Mo(t){return U.isInstance(t,Ap)}const $w="Predicate";function WU(t){return U.isInstance(t,$w)}const _c="Referenceable",_p="RelationExpr";function zC(t){return U.isInstance(t,_p)}const Pp="RelationExpression";function Tw(t){return U.isInstance(t,Pp)}const xp="RelationPredicate";function HU(t){return U.isInstance(t,xp)}const Ip="RelationPredicateOrWhere";function VU(t){return U.isInstance(t,Ip)}const Np="RelationPredicateOrWhereV2";function KU(t){return U.isInstance(t,Np)}const Pc="RelationProperty",Op="RelationshipStyleProperty";function qC(t){return U.isInstance(t,Op)}const Bo="StringProperty";function jC(t){return U.isInstance(t,Bo)}const xc="StyleProperty";function Sw(t){return U.isInstance(t,xc)}const Fp="ViewProperty";function YU(t){return U.isInstance(t,Fp)}const Ic="ViewRule";function XU(t){return U.isInstance(t,Ic)}const Lp="ViewRulePredicate";function Mp(t){return U.isInstance(t,Lp)}const Bp="ViewRuleStyleOrGlobalRef";function kw(t){return U.isInstance(t,Bp)}const Nc="WhereElement";function GC(t){return U.isInstance(t,Nc)}const Oc="WhereElementExpression";function JU(t){return U.isInstance(t,Oc)}const UC="WhereExpression",zp="WhereKindEqual";function QU(t){return U.isInstance(t,zp)}const Fc="WhereRelation";function WC(t){return U.isInstance(t,Fc)}const Lc="WhereRelationExpression";function ZU(t){return U.isInstance(t,Lc)}const qp="WhereTagEqual";function e4(t){return U.isInstance(t,qp)}const Mc="ArrowProperty";function Bc(t){return U.isInstance(t,Mc)}const zc="BorderProperty";function jp(t){return U.isInstance(t,zc)}const qc="ColorProperty";function js(t){return U.isInstance(t,qc)}const Gs="CustomColor",Gp="CustomElementProperties";function t4(t){return U.isInstance(t,Gp)}const Up="CustomRelationProperties";function n4(t){return U.isInstance(t,Up)}const Fi="DeployedInstance";function pr(t){return U.isInstance(t,Fi)}const Wp="DeployedInstanceBody";function r4(t){return U.isInstance(t,Wp)}const Li="DeploymentNode";function bn(t){return U.isInstance(t,Li)}const Hp="DeploymentNodeBody";function i4(t){return U.isInstance(t,Hp)}const Mi="DeploymentNodeKind",Vp="DeploymentRelation";function Bi(t){return U.isInstance(t,Vp)}const Kp="DeploymentRelationBody";function s4(t){return U.isInstance(t,Kp)}const jc="DeploymentView";function Cw(t){return U.isInstance(t,jc)}const Yp="DeploymentViewBody";function o4(t){return U.isInstance(t,Yp)}const Gc="DeploymentViewRulePredicate";function zo(t){return U.isInstance(t,Gc)}const Xp="DeploymentViewRulePredicateExpression";function a4(t){return U.isInstance(t,Xp)}const Uc="DeploymentViewRuleStyle";function HC(t){return U.isInstance(t,Uc)}const Wc="DirectedRelationExpr";function Aw(t){return U.isInstance(t,Wc)}const Hc="DirectedRelationExpression";function _w(t){return U.isInstance(t,Hc)}const qo="DynamicView";function VC(t){return U.isInstance(t,qo)}const Jp="DynamicViewBody";function u4(t){return U.isInstance(t,Jp)}const Vc="DynamicViewGlobalPredicateRef";function KC(t){return U.isInstance(t,Vc)}const Kc="DynamicViewIncludePredicate";function c4(t){return U.isInstance(t,Kc)}const Qp="DynamicViewParallelSteps";function Pw(t){return U.isInstance(t,Qp)}const Zp="DynamicViewPredicateIterator";function YC(t){return U.isInstance(t,Zp)}const xw="DynamicViewRef",eh="DynamicViewStep";function Iw(t){return U.isInstance(t,eh)}const Jn="Element";function zn(t){return U.isInstance(t,Jn)}const th="ElementBody";function Yc(t){return U.isInstance(t,th)}const Xc="ElementDescedantsExpression";function Nw(t){return U.isInstance(t,Xc)}const nh="ElementExpressionsIterator";function l4(t){return U.isInstance(t,nh)}const pi="ElementKind";function d4(t){return U.isInstance(t,pi)}const Jc="ElementKindExpression";function rh(t){return U.isInstance(t,Jc)}const Qc="ElementPredicateWhere";function Ow(t){return U.isInstance(t,Qc)}const Zc="ElementPredicateWith";function ih(t){return U.isInstance(t,Zc)}const el="ElementRef";function tl(t){return U.isInstance(t,el)}const nl="ElementStringProperty";function rl(t){return U.isInstance(t,nl)}const il="ElementStyleProperty";function zi(t){return U.isInstance(t,il)}const sl="ElementTagExpression";function sh(t){return U.isInstance(t,sl)}const jo="ElementView";function oh(t){return U.isInstance(t,jo)}const ah="ElementViewBody";function XC(t){return U.isInstance(t,ah)}const Fw="ElementViewRef",ol="ExcludePredicate";function al(t){return U.isInstance(t,ol)}const ul="ExpandElementExpression";function JC(t){return U.isInstance(t,ul)}const Us="ExtendElement";function Go(t){return U.isInstance(t,Us)}const uh="ExtendElementBody";function QC(t){return U.isInstance(t,uh)}const ch="FqnElementRef";function ZC(t){return U.isInstance(t,ch)}const lh="FqnExpressions";function f4(t){return U.isInstance(t,lh)}const dh="FqnRef";function eA(t){return U.isInstance(t,dh)}const cl="FqnRefExpr";function Lw(t){return U.isInstance(t,cl)}const Uo="GlobalDynamicPredicateGroup";function fh(t){return U.isInstance(t,Uo)}const Wo="GlobalPredicateGroup";function ph(t){return U.isInstance(t,Wo)}const Ho="Globals";function Mw(t){return U.isInstance(t,Ho)}const hh="GlobalStyle";function ll(t){return U.isInstance(t,hh)}const mh="GlobalStyleGroup";function Vo(t){return U.isInstance(t,mh)}const dl="GlobalStyleId",fl="IconProperty";function Ir(t){return U.isInstance(t,fl)}const pl="IncludePredicate";function gh(t){return U.isInstance(t,pl)}const hl="IncomingRelationExpr";function Bw(t){return U.isInstance(t,hl)}const ml="IncomingRelationExpression";function tA(t){return U.isInstance(t,ml)}const gl="InOutRelationExpr";function nA(t){return U.isInstance(t,gl)}const yl="InOutRelationExpression";function zw(t){return U.isInstance(t,yl)}const Ws="LibIcon";function p4(t){return U.isInstance(t,Ws)}const yh="LikeC4Grammar";function h4(t){return U.isInstance(t,yh)}const wh="LikeC4Lib";function rA(t){return U.isInstance(t,wh)}const wl="LineProperty";function vl(t){return U.isInstance(t,wl)}const bl="LinkProperty";function vh(t){return U.isInstance(t,bl)}const Dl="MetadataAttribute";function m4(t){return U.isInstance(t,Dl)}const El="MetadataBody";function g4(t){return U.isInstance(t,El)}const Ko="Model";function iA(t){return U.isInstance(t,Ko)}const Yo="ModelDeployments";function sA(t){return U.isInstance(t,Yo)}const Xo="ModelViews";function Rl(t){return U.isInstance(t,Xo)}const $l="MultipleProperty";function qw(t){return U.isInstance(t,$l)}const bh="NavigateToProperty";function Dh(t){return U.isInstance(t,bh)}const Tl="NotationProperty";function Jo(t){return U.isInstance(t,Tl)}const Sl="NotesProperty";function oA(t){return U.isInstance(t,Sl)}const kl="OpacityProperty";function Eh(t){return U.isInstance(t,kl)}const Cl="OutgoingRelationExpr";function jw(t){return U.isInstance(t,Cl)}const Al="OutgoingRelationExpression";function Gw(t){return U.isInstance(t,Al)}const Rh="Predicates";function aA(t){return U.isInstance(t,Rh)}const $h="Relation";function Nr(t){return U.isInstance(t,$h)}const Th="RelationBody";function y4(t){return U.isInstance(t,Th)}const _l="RelationNavigateToProperty";function Pl(t){return U.isInstance(t,_l)}const xl="RelationPredicateWhere";function Uw(t){return U.isInstance(t,xl)}const Il="RelationPredicateWhereV2";function w4(t){return U.isInstance(t,Il)}const Nl="RelationPredicateWith";function Ww(t){return U.isInstance(t,Nl)}const qi="RelationshipKind";function v4(t){return U.isInstance(t,qi)}const Ol="RelationStringProperty";function Fl(t){return U.isInstance(t,Ol)}const Ll="RelationStyleProperty";function Sh(t){return U.isInstance(t,Ll)}const Ml="ShapeProperty";function kh(t){return U.isInstance(t,Ml)}const Ch="SpecificationColor";function Ah(t){return U.isInstance(t,Ch)}const Qo="SpecificationDeploymentNodeKind";function Zo(t){return U.isInstance(t,Qo)}const ea="SpecificationElementKind";function ta(t){return U.isInstance(t,ea)}const Bl="SpecificationElementStringProperty";function Hw(t){return U.isInstance(t,Bl)}const na="SpecificationRelationshipKind";function ra(t){return U.isInstance(t,na)}const zl="SpecificationRelationshipStringProperty";function uA(t){return U.isInstance(t,zl)}const ia="SpecificationRule";function Vw(t){return U.isInstance(t,ia)}const sa="SpecificationTag";function _h(t){return U.isInstance(t,sa)}const ji="Tag";function cA(t){return U.isInstance(t,ji)}const Ph="Tags";function Kw(t){return U.isInstance(t,Ph)}const Yw="ViewRef",ql="ViewRuleAutoLayout";function jl(t){return U.isInstance(t,ql)}const Gl="ViewRuleGlobalPredicateRef";function lA(t){return U.isInstance(t,Gl)}const Ul="ViewRuleGlobalStyle";function dA(t){return U.isInstance(t,Ul)}const Wl="ViewRuleGroup";function xh(t){return U.isInstance(t,Wl)}const Hl="ViewRuleStyle";function Vl(t){return U.isInstance(t,Hl)}const Kl="ViewStringProperty";function b4(t){return U.isInstance(t,Kl)}const Yl="WhereBinaryExpression";function D4(t){return U.isInstance(t,Yl)}const Xl="WhereElementKind";function E4(t){return U.isInstance(t,Xl)}const Jl="WhereElementNegation";function fA(t){return U.isInstance(t,Jl)}const Ql="WhereElementTag";function R4(t){return U.isInstance(t,Ql)}const Zl="WhereRelationKind";function pA(t){return U.isInstance(t,Zl)}const ed="WhereRelationNegation";function hA(t){return U.isInstance(t,ed)}const td="WhereRelationParticipantKind";function mA(t){return U.isInstance(t,td)}const nd="WhereRelationParticipantTag";function gA(t){return U.isInstance(t,nd)}const rd="WhereRelationTag";function $4(t){return U.isInstance(t,rd)}const id="WildcardExpression";function Hs(t){return U.isInstance(t,id)}class yA extends ID{getAllTypes(){return[Mc,zc,qc,Gs,Gp,Up,Fi,Wp,ww,Li,Hp,Mi,vw,Vp,Kp,jc,Yp,Tp,Gc,Xp,Uc,Wc,Hc,qo,Jp,Vc,Kc,Qp,Zp,xw,kc,eh,Jn,th,Xc,Cc,nh,pi,Jc,kp,Cp,Qc,Zc,zs,el,nl,il,sl,jo,ah,Fw,ol,ul,Dw,Us,uh,ch,Ac,lh,dh,cl,Ew,Uo,Wo,hh,mh,dl,Ho,fl,gl,yl,pl,hl,ml,Ws,yh,wh,qs,wl,bl,Dl,El,Ap,Ko,Yo,Xo,$l,bh,Tl,Sl,kl,Cl,Al,$w,Rh,_c,$h,Th,_p,Pp,_l,xp,Ip,Np,xl,Il,Nl,Pc,Ol,Ll,qi,Op,Ml,Ch,Qo,ea,Bl,na,zl,ia,sa,Bo,xc,ji,Ph,Fp,Yw,Ic,ql,Gl,Ul,Wl,Lp,Hl,Bp,Kl,Yl,Nc,Oc,Xl,Jl,Ql,UC,zp,Fc,Lc,Zl,ed,td,nd,rd,qp,id]}computeIsSubtype(e,n){switch(e){case Mc:case wl:return this.isSubtype(Op,n);case zc:case $l:case kl:case Ml:return this.isSubtype(xc,n);case qc:return this.isSubtype(Op,n)||this.isSubtype(xc,n);case Fi:case Li:return this.isSubtype(ww,n)||this.isSubtype(_c,n);case Mi:case pi:return this.isSubtype(vw,n);case jc:case qo:case jo:return this.isSubtype(qs,n);case Gc:case Uc:return this.isSubtype(Tp,n);case Wc:case hl:case gl:case Cl:return this.isSubtype(_p,n);case Hc:case ml:case yl:case Al:return this.isSubtype(Pp,n);case Vc:case Kc:return this.isSubtype(kc,n);case Jn:return this.isSubtype(Ew,n)||this.isSubtype(_c,n);case Xc:case Jc:case el:case sl:case ul:return this.isSubtype(Cc,n);case Cc:case Qc:return this.isSubtype(Cp,n);case kp:case xp:return this.isSubtype($w,n);case Cp:case Zc:return this.isSubtype(kp,n);case nl:return this.isSubtype(zs,n)||this.isSubtype(Bo,n);case il:return this.isSubtype(zs,n);case ol:case pl:return this.isSubtype(Lp,n);case Us:case _c:return this.isSubtype(Ew,n);case Ac:case Np:return this.isSubtype(Dw,n);case cl:return this.isSubtype(Ac,n);case fl:return this.isSubtype(zs,n)||this.isSubtype(xc,n);case bl:return this.isSubtype(zs,n)||this.isSubtype(Pc,n)||this.isSubtype(Fp,n);case Dl:case Tl:case Sl:case Bl:case zl:return this.isSubtype(Bo,n);case El:return this.isSubtype(Ap,n);case Ap:return this.isSubtype(zs,n)||this.isSubtype(Pc,n);case _p:case Il:return this.isSubtype(Np,n);case Pp:case xl:return this.isSubtype(Ip,n);case _l:case Ll:return this.isSubtype(Pc,n);case Ip:case Nl:return this.isSubtype(xp,n);case Ol:return this.isSubtype(Pc,n)||this.isSubtype(Bo,n);case ql:return this.isSubtype(Tp,n)||this.isSubtype(kc,n)||this.isSubtype(Ic,n);case Gl:case Wl:case Lp:return this.isSubtype(Ic,n);case Ul:case Hl:return this.isSubtype(Bp,n);case Bp:return this.isSubtype(kc,n)||this.isSubtype(Ic,n);case Kl:return this.isSubtype(Bo,n)||this.isSubtype(Fp,n);case Yl:return this.isSubtype(Oc,n)||this.isSubtype(Lc,n);case Nc:case Jl:return this.isSubtype(Oc,n);case Oc:case Lc:return this.isSubtype(UC,n);case Xl:return this.isSubtype(Nc,n)||this.isSubtype(zp,n);case Ql:return this.isSubtype(Nc,n)||this.isSubtype(qp,n);case Fc:case ed:return this.isSubtype(Lc,n);case Zl:case td:return this.isSubtype(zp,n)||this.isSubtype(Fc,n);case nd:case rd:return this.isSubtype(Fc,n)||this.isSubtype(qp,n);case id:return this.isSubtype(Cc,n)||this.isSubtype(Ac,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"ColorProperty:customColor":return Gs;case"DeploymentNode:kind":return Mi;case"DeploymentRelation:kind":case"DynamicViewStep:kind":case"OutgoingRelationExpr:kind":case"OutgoingRelationExpression:kind":case"Relation:kind":case"WhereRelationKind:value":return qi;case"DynamicViewGlobalPredicateRef:predicate":return Uo;case"DynamicViewRef:view":return qo;case"Element:kind":case"ElementKindExpression:kind":case"WhereElementKind:value":return pi;case"ElementRef:el":case"FqnElementRef:el":return Jn;case"ElementTagExpression:tag":case"Tags:values":case"WhereElementTag:value":case"WhereRelationParticipantTag:value":case"WhereRelationTag:value":return ji;case"ElementViewRef:view":return jo;case"FqnRef:value":return _c;case"IconProperty:libicon":return Ws;case"ViewRef:view":return qs;case"ViewRuleGlobalPredicateRef:predicate":return Wo;case"ViewRuleGlobalStyle:style":return dl;case"WhereRelationParticipantKind:value":return vw;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Mc:return{name:Mc,properties:[{name:"key"},{name:"value"}]};case zc:return{name:zc,properties:[{name:"key"},{name:"value"}]};case qc:return{name:qc,properties:[{name:"customColor"},{name:"key"},{name:"themeColor"}]};case Gs:return{name:Gs,properties:[{name:"name"}]};case Gp:return{name:Gp,properties:[{name:"props",defaultValue:[]}]};case Up:return{name:Up,properties:[{name:"props",defaultValue:[]}]};case Fi:return{name:Fi,properties:[{name:"body"},{name:"element"},{name:"name"},{name:"title"}]};case Wp:return{name:Wp,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case Li:return{name:Li,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"title"}]};case Hp:return{name:Hp,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case Mi:return{name:Mi,properties:[{name:"name"}]};case Vp:return{name:Vp,properties:[{name:"body"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case Kp:return{name:Kp,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case jc:return{name:jc,properties:[{name:"body"},{name:"name"}]};case Yp:return{name:Yp,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case Gc:return{name:Gc,properties:[{name:"expr"},{name:"isInclude",defaultValue:!1}]};case Xp:return{name:Xp,properties:[{name:"prev"},{name:"value"}]};case Uc:return{name:Uc,properties:[{name:"props",defaultValue:[]},{name:"targets"}]};case Wc:return{name:Wc,properties:[{name:"source"},{name:"target"}]};case Hc:return{name:Hc,properties:[{name:"source"},{name:"target"}]};case qo:return{name:qo,properties:[{name:"body"},{name:"name"}]};case Jp:return{name:Jp,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"steps",defaultValue:[]},{name:"tags"}]};case Vc:return{name:Vc,properties:[{name:"predicate"}]};case Kc:return{name:Kc,properties:[{name:"predicates"}]};case Qp:return{name:Qp,properties:[{name:"steps",defaultValue:[]}]};case Zp:return{name:Zp,properties:[{name:"prev"},{name:"value"}]};case xw:return{name:xw,properties:[{name:"view"}]};case eh:return{name:eh,properties:[{name:"custom"},{name:"isBackward",defaultValue:!1},{name:"kind"},{name:"source"},{name:"target"},{name:"title"}]};case Jn:return{name:Jn,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"props",defaultValue:[]}]};case th:return{name:th,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case Xc:return{name:Xc,properties:[{name:"parent"},{name:"suffix"}]};case nh:return{name:nh,properties:[{name:"prev"},{name:"value"}]};case pi:return{name:pi,properties:[{name:"name"}]};case Jc:return{name:Jc,properties:[{name:"isEqual",defaultValue:!1},{name:"kind"}]};case Qc:return{name:Qc,properties:[{name:"subject"},{name:"where"}]};case Zc:return{name:Zc,properties:[{name:"custom"},{name:"subject"}]};case el:return{name:el,properties:[{name:"el"},{name:"parent"}]};case nl:return{name:nl,properties:[{name:"key"},{name:"value"}]};case il:return{name:il,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case sl:return{name:sl,properties:[{name:"isEqual",defaultValue:!1},{name:"tag"}]};case jo:return{name:jo,properties:[{name:"body"},{name:"extends"},{name:"name"},{name:"viewOf"}]};case ah:return{name:ah,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case Fw:return{name:Fw,properties:[{name:"view"}]};case ol:return{name:ol,properties:[{name:"predicates"}]};case ul:return{name:ul,properties:[{name:"expand"}]};case Us:return{name:Us,properties:[{name:"body"},{name:"element"}]};case uh:return{name:uh,properties:[{name:"elements",defaultValue:[]}]};case ch:return{name:ch,properties:[{name:"el"},{name:"parent"}]};case lh:return{name:lh,properties:[{name:"prev"},{name:"value"}]};case dh:return{name:dh,properties:[{name:"parent"},{name:"value"}]};case cl:return{name:cl,properties:[{name:"ref"},{name:"selector"}]};case Uo:return{name:Uo,properties:[{name:"name"},{name:"predicates",defaultValue:[]}]};case Wo:return{name:Wo,properties:[{name:"name"},{name:"predicates",defaultValue:[]}]};case Ho:return{name:Ho,properties:[{name:"name"},{name:"predicates",defaultValue:[]},{name:"styles",defaultValue:[]}]};case hh:return{name:hh,properties:[{name:"id"},{name:"props",defaultValue:[]},{name:"target"}]};case mh:return{name:mh,properties:[{name:"id"},{name:"styles",defaultValue:[]}]};case dl:return{name:dl,properties:[{name:"name"}]};case fl:return{name:fl,properties:[{name:"key"},{name:"libicon"},{name:"value"}]};case pl:return{name:pl,properties:[{name:"predicates"}]};case hl:return{name:hl,properties:[{name:"to"}]};case ml:return{name:ml,properties:[{name:"to"}]};case gl:return{name:gl,properties:[{name:"inout"}]};case yl:return{name:yl,properties:[{name:"inout"}]};case Ws:return{name:Ws,properties:[{name:"name"}]};case yh:return{name:yh,properties:[{name:"deployments",defaultValue:[]},{name:"globals",defaultValue:[]},{name:"likec4lib",defaultValue:[]},{name:"models",defaultValue:[]},{name:"specifications",defaultValue:[]},{name:"views",defaultValue:[]}]};case wh:return{name:wh,properties:[{name:"icons",defaultValue:[]}]};case wl:return{name:wl,properties:[{name:"key"},{name:"value"}]};case bl:return{name:bl,properties:[{name:"key"},{name:"title"},{name:"value"}]};case Dl:return{name:Dl,properties:[{name:"key"},{name:"value"}]};case El:return{name:El,properties:[{name:"props",defaultValue:[]}]};case Ko:return{name:Ko,properties:[{name:"elements",defaultValue:[]},{name:"name"}]};case Yo:return{name:Yo,properties:[{name:"elements",defaultValue:[]},{name:"name"}]};case Xo:return{name:Xo,properties:[{name:"name"},{name:"styles",defaultValue:[]},{name:"views",defaultValue:[]}]};case $l:return{name:$l,properties:[{name:"key"},{name:"value"}]};case bh:return{name:bh,properties:[{name:"key"},{name:"value"}]};case Tl:return{name:Tl,properties:[{name:"key"},{name:"value"}]};case Sl:return{name:Sl,properties:[{name:"key"},{name:"value"}]};case kl:return{name:kl,properties:[{name:"key"},{name:"value"}]};case Cl:return{name:Cl,properties:[{name:"from"},{name:"isBidirectional",defaultValue:!1},{name:"kind"}]};case Al:return{name:Al,properties:[{name:"from"},{name:"isBidirectional",defaultValue:!1},{name:"kind"}]};case Rh:return{name:Rh,properties:[{name:"prev"},{name:"value"}]};case $h:return{name:$h,properties:[{name:"body"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case Th:return{name:Th,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case _l:return{name:_l,properties:[{name:"key"},{name:"value"}]};case xl:return{name:xl,properties:[{name:"subject"},{name:"where"}]};case Il:return{name:Il,properties:[{name:"subject"},{name:"where"}]};case Nl:return{name:Nl,properties:[{name:"custom"},{name:"subject"}]};case qi:return{name:qi,properties:[{name:"name"}]};case Ol:return{name:Ol,properties:[{name:"key"},{name:"value"}]};case Ll:return{name:Ll,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case Ml:return{name:Ml,properties:[{name:"key"},{name:"value"}]};case Ch:return{name:Ch,properties:[{name:"color"},{name:"name"}]};case Qo:return{name:Qo,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case ea:return{name:ea,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Bl:return{name:Bl,properties:[{name:"key"},{name:"value"}]};case na:return{name:na,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case zl:return{name:zl,properties:[{name:"key"},{name:"value"}]};case ia:return{name:ia,properties:[{name:"colors",defaultValue:[]},{name:"deploymentNodes",defaultValue:[]},{name:"elements",defaultValue:[]},{name:"name"},{name:"relationships",defaultValue:[]},{name:"tags",defaultValue:[]}]};case sa:return{name:sa,properties:[{name:"tag"}]};case ji:return{name:ji,properties:[{name:"name"}]};case Ph:return{name:Ph,properties:[{name:"prev"},{name:"values",defaultValue:[]}]};case Yw:return{name:Yw,properties:[{name:"view"}]};case ql:return{name:ql,properties:[{name:"direction"},{name:"nodeSep"},{name:"rankSep"}]};case Gl:return{name:Gl,properties:[{name:"predicate"}]};case Ul:return{name:Ul,properties:[{name:"style"}]};case Wl:return{name:Wl,properties:[{name:"groupRules",defaultValue:[]},{name:"props",defaultValue:[]},{name:"title"}]};case Hl:return{name:Hl,properties:[{name:"props",defaultValue:[]},{name:"target"}]};case Kl:return{name:Kl,properties:[{name:"key"},{name:"value"}]};case Yl:return{name:Yl,properties:[{name:"left"},{name:"operator"},{name:"right"}]};case Xl:return{name:Xl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Jl:return{name:Jl,properties:[{name:"value"}]};case Ql:return{name:Ql,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Zl:return{name:Zl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case ed:return{name:ed,properties:[{name:"value"}]};case td:return{name:td,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"participant"},{name:"value"}]};case nd:return{name:nd,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"participant"},{name:"value"}]};case rd:return{name:rd,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case id:return{name:id,properties:[{name:"isWildcard",defaultValue:!1}]};default:return{name:e,properties:[]}}}}const U=new yA;let wA;const T4=()=>wA??(wA=zj(`{"$type":"Grammar","isDeclared":true,"name":"LikeC4","rules":[{"$type":"ParserRule","entry":true,"name":"LikeC4Grammar","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"specifications","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"models","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]}},{"$type":"Assignment","feature":"globals","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@119"},"arguments":[]}},{"$type":"Assignment","feature":"deployments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]}},{"$type":"Assignment","feature":"likec4lib","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LikeC4Lib","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"likec4lib"},{"$type":"Keyword","value":"{"},{"$type":"Keyword","value":"icons"},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"icons","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LibIcon","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@145"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Tag","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationshipKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColor","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@149"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentNodeKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRule","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"specification"}},{"$type":"Keyword","value":"{"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"relationships","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"colors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"deploymentNodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationElementKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"element"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@134"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationElementStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"notation"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationDeploymentNodeKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"deploymentNode"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@134"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationTag","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"tag"},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationColor","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"color"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"color","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@144"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRelationshipKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"relationship"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@137"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRelationshipStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"notation"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Model","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"model"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Element","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@166"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false}}]}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":false},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@134"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExtendElement","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"extend"},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExtendElementBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnElementRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@163"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@163"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@17"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Tags","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"values","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"+"},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Tags"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"values","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"*"}],"cardinality":"*"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Relation","parameters":[{"$type":"Parameter","name":"isExplicit"}],"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","guardCondition":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@26/parameters@0"}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}}]},{"$type":"Group","guardCondition":{"$type":"Negation","value":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@26/parameters@0"}}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},"cardinality":"?"}]}]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Keyword","value":"->"}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Assignment","feature":"technology","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"wildcard":false},{"$type":"ParserRule","name":"RelationBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@94"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationStyleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"style"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@137"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataProperty","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"metadata"},{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataAttribute","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ModelViews","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"views"}},{"$type":"Keyword","value":"{"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]}},{"$type":"Assignment","feature":"styles","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LikeC4ViewRule","returnType":{"$ref":"#/types@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"extends"},{"$type":"Assignment","feature":"extends","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"of"},{"$type":"Assignment","feature":"viewOf","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}}]}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"dynamic"},{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@36"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@37"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@43"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@43"},"arguments":[]},"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}]}},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewLayoutDirection","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"TopBottom"},{"$type":"Keyword","value":"LeftRight"},{"$type":"Keyword","value":"BottomTop"},{"$type":"Keyword","value":"RightLeft"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@132"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@127"},"arguments":[]}]},"cardinality":"*"},{"$type":"Assignment","feature":"groupRules","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@83"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewParallelSteps","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"parallel"},{"$type":"Keyword","value":"par"}]},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewStep","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBackward","operator":"?=","terminal":{"$type":"Keyword","value":"<-"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@92"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRulePredicate","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"IncludePredicate"}},{"$type":"Keyword","value":"include"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExcludePredicate"}},{"$type":"Keyword","value":"exclude"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Predicates","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@53"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Predicates"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@53"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Predicate","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@67"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleGlobalPredicateRef","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"global"},{"$type":"Keyword","value":"predicate"},{"$type":"Assignment","feature":"predicate","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@120"},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicates","inferredType":{"$type":"InferredType","name":"ElementPredicate"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@57"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementPredicateWith"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicateOrWhere","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementPredicateWhere"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementOr","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"or"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementAnd","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"and"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementPrimary","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@63"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementNegation","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"not"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElement","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementTag"}},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementExpression","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@66"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementSelectorExpression","inferredType":{"$type":"InferredType","name":"ElementExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WildcardExpression"}},{"$type":"Assignment","feature":"isWildcard","operator":"?=","terminal":{"$type":"Keyword","value":"*"}}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementTagExpression"}},{"$type":"Keyword","value":"element.tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@152"},"arguments":[]},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementKindExpression"}},{"$type":"Keyword","value":"element.kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@152"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementDescedantsExpression","inferredType":{"$type":"InferredType","name":"ElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExpandElementExpression"},"feature":"expand","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@160"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementDescedantsExpression"},"feature":"parent","operator":"="},{"$type":"Assignment","feature":"suffix","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@161"},"arguments":[]}}]}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@68"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicates","inferredType":{"$type":"InferredType","name":"RelationPredicate"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@69"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWith"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@92"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicateOrWhere","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@76"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWhere"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationOr","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@72"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"or"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@72"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationAnd","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@73"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"and"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@73"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationPrimary","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@74"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@75"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationNegation","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"not"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelation","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationTag"}},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationParticipantTag"}},{"$type":"Assignment","feature":"participant","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@143"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@163"},"arguments":[]},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@147"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationParticipantKind"}},{"$type":"Assignment","feature":"participant","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@143"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@163"},"arguments":[]},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@151"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationExpression","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@77"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@79"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"InOutRelationExpressions","inferredType":{"$type":"InferredType","name":"RelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@78"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"InOutRelationExpression"},"feature":"inout","operator":"="},{"$type":"Keyword","value":"->"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IncomingRelationExpression","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"->"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DirectedRelationExpressions","inferredType":{"$type":"InferredType","name":"RelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DirectedRelationExpression"},"feature":"source","operator":"="},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OutgoingRelationExpression","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBidirectional","operator":"?=","terminal":{"$type":"Keyword","value":"<->"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]},"deprecatedSyntax":false}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementExpressionsIterator","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementExpressionsIterator"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewIncludePredicate","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"include"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@84"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewGlobalPredicateRef","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"global"},{"$type":"Keyword","value":"predicate"},{"$type":"Assignment","feature":"predicate","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@121"},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewPredicateIterator","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DynamicViewPredicateIterator"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@133"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleGlobalStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"global"},{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"style","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@122"},"deprecatedSyntax":false}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleStyleOrGlobalRef","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@85"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@86"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleAutoLayout","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"autoLayout"},{"$type":"Assignment","feature":"direction","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"rankSep","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@170"},"arguments":[]}},{"$type":"Assignment","feature":"nodeSep","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@170"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NotationProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"notation"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NotesProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"notes"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomElementProperties","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@93"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@133"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomRelationProperties","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@94"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@137"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NavigateToProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"navigateTo"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationNavigateToProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"navigateTo"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@40"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ModelDeployments","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"deployment"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentNode","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@166"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}}]}]},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@97"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentNodeBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@98"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeployedInstance","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@166"},"arguments":[]}],"cardinality":"?"},{"$type":"Keyword","value":"instanceOf"},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@99"},"arguments":[]},"cardinality":"?"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeployedInstanceBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@163"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@7"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentRelation","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]}},{"$type":"Assignment","feature":"technology","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@102"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentRelationBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"deployment"},{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@104"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@43"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@105"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@106"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRuleStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"targets","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@118"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@133"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRulePredicate","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isInclude","operator":"?=","terminal":{"$type":"Keyword","value":"include"}},{"$type":"Keyword","value":"exclude"}]},{"$type":"Assignment","feature":"expr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DeploymentViewRulePredicateExpression","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@109"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DeploymentViewRulePredicateExpression"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@109"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExpressionV2","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicateOrWhereV2","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@113"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWhereV2"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnExpr","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WildcardExpression"}},{"$type":"Assignment","feature":"isWildcard","operator":"?=","terminal":{"$type":"Keyword","value":"*"}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@112"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnRefExpr","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"ref","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]}},{"$type":"Assignment","feature":"selector","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@160"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@161"},"arguments":[]}]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationExpr","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@114"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@116"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"InOutRelationExpr","inferredType":{"$type":"InferredType","name":"RelationExpr"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@115"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"InOutRelationExpr"},"feature":"inout","operator":"="},{"$type":"Keyword","value":"->"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IncomingRelationExpr","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"->"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DirectedRelationExpr","inferredType":{"$type":"InferredType","name":"RelationExpr"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@117"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DirectedRelationExpr"},"feature":"source","operator":"="},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OutgoingRelationExpr","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBidirectional","operator":"?=","terminal":{"$type":"Keyword","value":"<->"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@148"},"arguments":[]},"deprecatedSyntax":false}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnExpressions","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnExpressions"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Globals","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"global"}},{"$type":"Keyword","value":"{"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"predicates","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@120"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@121"},"arguments":[]}]},"cardinality":"*"},{"$type":"Assignment","feature":"styles","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@124"},"arguments":[]}]},"cardinality":"*"}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalPredicateGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"predicateGroup"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"predicates","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalDynamicPredicateGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"dynamicPredicateGroup"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"predicates","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalStyleId","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@122"},"arguments":[]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@133"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"GlobalStyleGroup","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"styleGroup"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@122"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"styles","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@85"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LinkProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"link"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@146"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@168"},"arguments":[]},"cardinality":"?"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ColorProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"color"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"themeColor","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@141"},"arguments":[]}},{"$type":"Assignment","feature":"customColor","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@6"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@149"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OpacityProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"opacity"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@167"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MultipleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"multiple"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@138"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"icon"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"libicon","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@145"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"none"},{"$type":"RuleCall","rule":{"$ref":"#/rules@146"},"arguments":[]}]}}]},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ShapeProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"shape"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@142"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BorderStyleValue","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]},{"$type":"Keyword","value":"none"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BorderProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"border"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@131"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"StyleProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@130"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@132"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@127"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementStyleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"style"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@133"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"line"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrowProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"head"},{"$type":"Keyword","value":"tail"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@140"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationshipStyleProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@135"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@136"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Boolean","dataType":"boolean","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"true"},{"$type":"Keyword","value":"false"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineOptions","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"solid"},{"$type":"Keyword","value":"dashed"},{"$type":"Keyword","value":"dotted"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrowType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"none"},{"$type":"Keyword","value":"normal"},{"$type":"Keyword","value":"onormal"},{"$type":"Keyword","value":"dot"},{"$type":"Keyword","value":"odot"},{"$type":"Keyword","value":"diamond"},{"$type":"Keyword","value":"odiamond"},{"$type":"Keyword","value":"crow"},{"$type":"Keyword","value":"open"},{"$type":"Keyword","value":"vee"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ThemeColor","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"primary"},{"$type":"Keyword","value":"secondary"},{"$type":"Keyword","value":"muted"},{"$type":"Keyword","value":"slate"},{"$type":"Keyword","value":"blue"},{"$type":"Keyword","value":"indigo"},{"$type":"Keyword","value":"sky"},{"$type":"Keyword","value":"red"},{"$type":"Keyword","value":"gray"},{"$type":"Keyword","value":"green"},{"$type":"Keyword","value":"amber"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementShape","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rectangle"},{"$type":"Keyword","value":"person"},{"$type":"Keyword","value":"browser"},{"$type":"Keyword","value":"mobile"},{"$type":"Keyword","value":"cylinder"},{"$type":"Keyword","value":"storage"},{"$type":"Keyword","value":"queue"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Participant","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"source"},{"$type":"Keyword","value":"target"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColorValue","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@162"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@171"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@170"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconId","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@157"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Uri","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@158"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@159"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TagId","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@162"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DotId","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@164"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@150"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColorId","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@142"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@140"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Id","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@169"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@142"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@141"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@140"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@139"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@143"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"},{"$type":"Keyword","value":"group"},{"$type":"Keyword","value":"node"},{"$type":"Keyword","value":"deployment"},{"$type":"Keyword","value":"instance"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EqOperator","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@166"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@165"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"is"}},{"$type":"Assignment","feature":"not","operator":"?=","terminal":{"$type":"Keyword","value":"not"},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"IsEqual","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isEqual","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@166"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@165"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","hidden":true,"name":"BLOCK_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/[\\\\r\\\\n]+/"},"fragment":false},{"$type":"TerminalRule","name":"LIB_ICON","definition":{"$type":"RegexToken","regex":"/(aws|azure|gcp|tech):[-\\\\w]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"URI_WITH_SCHEMA","definition":{"$type":"RegexToken","regex":"/\\\\w+:\\\\/\\\\/\\\\S+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"URI_RELATIVE","definition":{"$type":"RegexToken","regex":"/\\\\.{0,2}\\\\/[^\\\\/]\\\\S+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotUnderscore","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\._(?![_a-zA-Z])/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotWildcard","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\.\\\\*{1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Hash","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"#"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"StickyDot","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\./"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Dot","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"."}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NotEqual","definition":{"$type":"RegexToken","regex":"/\\\\!\\\\={1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Eq","definition":{"$type":"RegexToken","regex":"/\\\\={1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Percent","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\d+%/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"String","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"IdTerminal","definition":{"$type":"RegexToken","regex":"/[_]*[a-zA-Z][-\\\\w]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Number","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/\\\\b\\\\d+\\\\b/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Hex","definition":{"$type":"RegexToken","regex":"/\\\\b[a-zA-Z0-9]+\\\\b/"},"fragment":false,"hidden":false}],"types":[{"$type":"Type","name":"LikeC4View","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@36"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@37"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@103"}}]}},{"$type":"Type","name":"StringProperty","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@20"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@44"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@29"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@33"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@10"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@89"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@90"}}]}},{"$type":"Type","name":"DeploymentNodeOrElementKind","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@3"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@7"}}]}},{"$type":"Type","name":"WhereTagEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@63/definition/elements@0/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@75/definition/elements@0/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@75/definition/elements@2/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereKindEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@63/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@75/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@75/definition/elements@3/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereExpression","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@58"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@70"}}]}},{"$type":"Type","name":"DeploymentElement","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@96"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@98"}}]}},{"$type":"Type","name":"Referenceable","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@96"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@98"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@17"}}]}},{"$type":"Type","name":"FqnReferenceable","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/types@7"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@17"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@21"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"usedGrammars":[]}`)),Xw={languageId:"likec4",fileExtensions:[".c4",".likec4",".like-c4"],caseInsensitive:!1,mode:"production"},S4={skipValidations:!0,recoveryEnabled:!0,nodeLocationTracking:"full"},k4={AstReflection:()=>new yA},C4={Grammar:()=>T4(),LanguageMetaData:()=>Xw,parser:{ParserConfig:()=>S4}},vt={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},vA={silent:{level:-1},fatal:{level:vt.fatal},error:{level:vt.error},warn:{level:vt.warn},log:{level:vt.log},info:{level:vt.info},success:{level:vt.success},fail:{level:vt.fail},ready:{level:vt.info},start:{level:vt.info},box:{level:vt.info},debug:{level:vt.debug},trace:{level:vt.trace},verbose:{level:vt.verbose}};function Jw(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(t)==="[object Module]":!0}function Qw(t,e,n=".",r){if(!Jw(e))return Qw(t,{},n);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const o=t[s];o!=null&&(Array.isArray(o)&&Array.isArray(i[s])?i[s]=[...o,...i[s]]:Jw(o)&&Jw(i[s])?i[s]=Qw(o,i[s],(n?`${n}.`:"")+s.toString()):i[s]=o)}return i}function A4(t){return(...e)=>e.reduce((n,r)=>Qw(n,r,""),{})}const _4=A4();function P4(t){return Object.prototype.toString.call(t)==="[object Object]"}function x4(t){return!(!P4(t)||!t.message&&!t.args||t.stack)}let Zw=!1;const bA=[];let Dn=class y1{options;_lastLog;_mockFn;constructor(e={}){const n=e.types||vA;this.options=_4({...e,defaults:{...e.defaults},level:ev(e.level,n),reporters:[...e.reporters||[]]},{types:vA,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const r in n){const i={type:r,...this.options.defaults,...n[r]};this[r]=this._wrapLogFn(i),this[r].raw=this._wrapLogFn(i,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=ev(e,this.options.types,this.options.level)}prompt(e,n){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(e,n)}create(e){const n=new y1({...this.options,...e});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){const n=this.options.reporters.indexOf(e);if(n!==-1)return this.options.reporters.splice(n,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(const e in this.options.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(const e in this.options.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(e,n){e&&(e.__write||(e.__write=e.write),e.write=r=>{this[n].raw(String(r).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){Zw=!0}resumeLogs(){Zw=!1;const e=bA.splice(0);for(const n of e)n[0]._logFn(n[1],n[2])}mockTypes(e){const n=e||this.options.mockFn;if(this._mockFn=n,typeof n=="function")for(const r in this.options.types)this[r]=n(r,this.options.types[r])||this[r],this[r].raw=this[r]}_wrapLogFn(e,n){return(...r)=>{if(Zw){bA.push([this,e,r,n]);return}return this._logFn(e,r,n)}}_logFn(e,n,r){if((e.level||0)>this.level)return!1;const i={date:new Date,args:[],...e,level:ev(e.level,this.options.types)};!r&&n.length===1&&x4(n[0])?Object.assign(i,n[0]):i.args=[...n],i.message&&(i.args.unshift(i.message),delete i.message),i.additional&&(Array.isArray(i.additional)||(i.additional=i.additional.split(`
164
+ `)),i.args.push(`
165
+ `+i.additional.join(`
166
+ `)),delete i.additional),i.type=typeof i.type=="string"?i.type.toLowerCase():"log",i.tag=typeof i.tag=="string"?i.tag:"";const s=(a=!1)=>{const u=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&u>0){const c=[...this._lastLog.object.args];u>1&&c.push(`(repeated ${u} times)`),this._log({...this._lastLog.object,args:c}),this._lastLog.count=1}a&&(this._lastLog.object=i,this._log(i))};clearTimeout(this._lastLog.timeout);const o=this._lastLog.time&&i.date?i.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=i.date,o<this.options.throttle)try{const a=JSON.stringify([i.type,i.tag,i.args]),u=this._lastLog.serialized===a;if(this._lastLog.serialized=a,u&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(s,this.options.throttle);return}}catch{}s(!0)}_log(e){for(const n of this.options.reporters)n.log(e,{options:this.options})}};function ev(t,e={},n=3){return t===void 0?n:typeof t=="number"?t:e[t]&&e[t].level!==void 0?e[t].level:n}Dn.prototype.add=Dn.prototype.addReporter,Dn.prototype.remove=Dn.prototype.removeReporter,Dn.prototype.clear=Dn.prototype.removeReporter,Dn.prototype.withScope=Dn.prototype.withTag,Dn.prototype.mock=Dn.prototype.mockTypes,Dn.prototype.pause=Dn.prototype.pauseLogs,Dn.prototype.resume=Dn.prototype.resumeLogs;function I4(t={}){return new Dn(t)}function DA(t){const e=process.cwd()+hD;return t.split(`
167
+ `).splice(1).map(n=>n.trim().replace("file://","").replace(e,""))}function N4(t,e){return(e.__write||e.write).call(e,t)}const tv=t=>t?`[${t}]`:"";class EA{formatStack(e,n){const r=" ".repeat((n?.errorLevel||0)+1);return r+DA(e).join(`
168
+ ${r}`)}formatError(e,n){const r=e.message??mD(n,e),i=e.stack?this.formatStack(e.stack,n):"",s=n?.errorLevel||0,o=s>0?`${" ".repeat(s)}[cause]: `:"",a=e.cause?`
169
+
170
+ `+this.formatError(e.cause,{...n,errorLevel:s+1}):"";return o+r+`
171
+ `+i+a}formatArgs(e,n){const r=e.map(i=>i&&typeof i.stack=="string"?this.formatError(i,n):i);return mD(n,...r)}formatDate(e,n){return n.date?e.toLocaleTimeString():""}filterAndJoin(e){return e.filter(Boolean).join(" ")}formatLogObj(e,n){const r=this.formatArgs(e.args,n);return e.type==="box"?`
172
+ `+[tv(e.tag),e.title&&e.title,...r.split(`
173
+ `)].filter(Boolean).map(i=>" > "+i).join(`
174
+ `)+`
175
+ `:this.filterAndJoin([tv(e.type),tv(e.tag),r])}log(e,n){const r=this.formatLogObj(e,{columns:n.options.stdout.columns||0,...n.options.formatOptions});return N4(r+`
176
+ `,e.level<2?n.options.stderr||process.stderr:n.options.stdout||process.stdout)}}const{env:Gi={},argv:RA=[],platform:O4=""}=typeof process>"u"?{}:process,F4="NO_COLOR"in Gi||RA.includes("--no-color"),L4="FORCE_COLOR"in Gi||RA.includes("--color"),M4=O4==="win32",$A=Gi.TERM==="dumb",B4=Lm&&Lm.isatty&&Lm.isatty(1)&&Gi.TERM&&!$A,z4="CI"in Gi&&("GITHUB_ACTIONS"in Gi||"GITLAB_CI"in Gi||"CIRCLECI"in Gi),q4=!F4&&(L4||M4&&!$A||B4||z4);function TA(t,e,n,r,i=e.slice(0,Math.max(0,t))+r,s=e.slice(Math.max(0,t+n.length)),o=s.indexOf(n)){return i+(o<0?s:TA(o,s,n,r))}function j4(t,e,n,r,i){return t<0?n+e+r:n+TA(t,e,r,i)+r}function G4(t,e,n=t,r=t.length+1){return i=>i||!(i===""||i===void 0)?j4((""+i).indexOf(e,r),i,t,e,n):""}function Ae(t,e,n){return G4(`\x1B[${t}m`,`\x1B[${e}m`,n)}const SA={reset:Ae(0,0),bold:Ae(1,22,"\x1B[22m\x1B[1m"),dim:Ae(2,22,"\x1B[22m\x1B[2m"),italic:Ae(3,23),underline:Ae(4,24),inverse:Ae(7,27),hidden:Ae(8,28),strikethrough:Ae(9,29),black:Ae(30,39),red:Ae(31,39),green:Ae(32,39),yellow:Ae(33,39),blue:Ae(34,39),magenta:Ae(35,39),cyan:Ae(36,39),white:Ae(37,39),gray:Ae(90,39),bgBlack:Ae(40,49),bgRed:Ae(41,49),bgGreen:Ae(42,49),bgYellow:Ae(43,49),bgBlue:Ae(44,49),bgMagenta:Ae(45,49),bgCyan:Ae(46,49),bgWhite:Ae(47,49),blackBright:Ae(90,39),redBright:Ae(91,39),greenBright:Ae(92,39),yellowBright:Ae(93,39),blueBright:Ae(94,39),magentaBright:Ae(95,39),cyanBright:Ae(96,39),whiteBright:Ae(97,39),bgBlackBright:Ae(100,49),bgRedBright:Ae(101,49),bgGreenBright:Ae(102,49),bgYellowBright:Ae(103,49),bgBlueBright:Ae(104,49),bgMagentaBright:Ae(105,49),bgCyanBright:Ae(106,49),bgWhiteBright:Ae(107,49)};function U4(t=q4){return t?SA:Object.fromEntries(Object.keys(SA).map(e=>[e,String]))}const Pn=U4();function W4(t,e="reset"){return Pn[t]||Pn[e]}const H4=[String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");function oa(t){return t.replace(new RegExp(H4,"g"),"")}const kA={solid:{tl:"\u250C",tr:"\u2510",bl:"\u2514",br:"\u2518",h:"\u2500",v:"\u2502"},double:{tl:"\u2554",tr:"\u2557",bl:"\u255A",br:"\u255D",h:"\u2550",v:"\u2551"},doubleSingle:{tl:"\u2553",tr:"\u2556",bl:"\u2559",br:"\u255C",h:"\u2500",v:"\u2551"},doubleSingleRounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2500",v:"\u2551"},singleThick:{tl:"\u250F",tr:"\u2513",bl:"\u2517",br:"\u251B",h:"\u2501",v:"\u2503"},singleDouble:{tl:"\u2552",tr:"\u2555",bl:"\u2558",br:"\u255B",h:"\u2550",v:"\u2502"},singleDoubleRounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2550",v:"\u2502"},rounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2500",v:"\u2502"}},V4={borderColor:"white",borderStyle:"rounded",valign:"center",padding:2,marginLeft:1,marginTop:1,marginBottom:1};function K4(t,e={}){const n={...e,style:{...V4,...e.style}},r=t.split(`
177
+ `),i=[],s=W4(n.style.borderColor),o={...typeof n.style.borderStyle=="string"?kA[n.style.borderStyle]||kA.solid:n.style.borderStyle};if(s)for(const p in o)o[p]=s(o[p]);const a=n.style.padding%2===0?n.style.padding:n.style.padding+1,u=r.length+a,c=Math.max(...r.map(p=>oa(p).length))+a,l=c+a,d=n.style.marginLeft>0?" ".repeat(n.style.marginLeft):"";if(n.style.marginTop>0&&i.push("".repeat(n.style.marginTop)),n.title){const p=s?s(n.title):n.title,h=o.h.repeat(Math.floor((c-oa(n.title).length)/2)),w=o.h.repeat(c-oa(n.title).length-oa(h).length+a);i.push(`${d}${o.tl}${h}${p}${w}${o.tr}`)}else i.push(`${d}${o.tl}${o.h.repeat(l)}${o.tr}`);const f=n.style.valign==="center"?Math.floor((u-r.length)/2):n.style.valign==="top"?u-r.length-a:u-r.length;for(let p=0;p<u;p++)if(p<f||p>=f+r.length)i.push(`${d}${o.v}${" ".repeat(l)}${o.v}`);else{const h=r[p-f],w=" ".repeat(a),D=" ".repeat(c-oa(h).length);i.push(`${d}${o.v}${w}${h}${D}${o.v}`)}return i.push(`${d}${o.bl}${o.h.repeat(l)}${o.br}`),n.style.marginBottom>0&&i.push("".repeat(n.style.marginBottom)),i.join(`
178
+ `)}const Ih=Object.create(null),sd=t=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(t?Ih:globalThis),Ui=new Proxy(Ih,{get(t,e){return sd()[e]??Ih[e]},has(t,e){const n=sd();return e in n||e in Ih},set(t,e,n){const r=sd(!0);return r[e]=n,!0},deleteProperty(t,e){if(!e)return!1;const n=sd(!0);return delete n[e],!0},ownKeys(){const t=sd(!0);return Object.keys(t)}}),Y4=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",X4=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function J4(){if(globalThis.process?.env)for(const t of X4){const e=t[1]||t[0];if(globalThis.process?.env[e])return{name:t[0].toLowerCase(),...t[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const CA=J4();CA.name;function Vs(t){return t?t!=="false":!1}const Q4=globalThis.process?.platform||"",Z4=Vs(Ui.CI)||CA.ci!==!1,e6=Vs(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),t6=Vs(Ui.DEBUG),AA=Y4==="test"||Vs(Ui.TEST);Vs(Ui.MINIMAL);const n6=/^win/i.test(Q4);!Vs(Ui.NO_COLOR)&&(Vs(Ui.FORCE_COLOR)||(e6||n6)&&Ui.TERM);const r6=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null;Number(r6?.split(".")[0]);const i6=globalThis.process||Object.create(null),_A={versions:{}};new Proxy(i6,{get(t,e){if(e==="env")return Ui;if(e in t)return t[e];if(e in _A)return _A[e]}});const s6=globalThis.process?.release?.name==="node",o6=!!globalThis.Bun||!!globalThis.process?.versions?.bun,a6=!!globalThis.Deno,u6=!!globalThis.fastly,c6=!!globalThis.Netlify,l6=!!globalThis.EdgeRuntime,d6=globalThis.navigator?.userAgent==="Cloudflare-Workers",f6=[[c6,"netlify"],[l6,"edge-light"],[d6,"workerd"],[u6,"fastly"],[a6,"deno"],[o6,"bun"],[s6,"node"]];function p6(){const t=f6.find(e=>e[0]);if(t)return{name:t[1]}}const h6=p6();h6?.name;function m6({onlyFirst:t=!1}={}){const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}const g6=m6();function y6(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(g6,"")}function w6(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function v6(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function b6(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101631&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129673||t>=129679&&t<=129734||t>=129742&&t<=129756||t>=129759&&t<=129769||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function D6(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function E6(t,{ambiguousAsWide:e=!1}={}){return D6(t),v6(t)||b6(t)||e&&w6(t)?2:1}const R6=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,$6=globalThis.Intl?.Segmenter?new Intl.Segmenter:{segment:t=>t.split("")},T6=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function S6(t,e={}){if(typeof t!="string"||t.length===0)return 0;const{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=e;if(r||(t=y6(t)),t.length===0)return 0;let i=0;const s={ambiguousAsWide:!n};for(const{segment:o}of $6.segment(t)){const a=o.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!T6.test(o)){if(R6().test(o)){i+=2;continue}i+=E6(a,s)}}return i}function k6(){const{env:t}=st,{TERM:e,TERM_PROGRAM:n}=t;return st.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const C6={info:"cyan",fail:"red",success:"green",ready:"green",start:"magenta"},A6={0:"red",1:"yellow"},_6=k6(),Or=(t,e)=>_6?t:e,PA={error:Or("\u2716","\xD7"),fatal:Or("\u2716","\xD7"),ready:Or("\u2714","\u221A"),warn:Or("\u26A0","\u203C"),info:Or("\u2139","i"),success:Or("\u2714","\u221A"),debug:Or("\u2699","D"),trace:Or("\u2192","\u2192"),fail:Or("\u2716","\xD7"),start:Or("\u25D0","o"),log:""};function xA(t){return typeof Intl!="object"||!Intl.Segmenter?oa(t).length:S6(t)}class P6 extends EA{formatStack(e,n){const r=" ".repeat((n?.errorLevel||0)+1);return`
179
+ ${r}`+DA(e).map(i=>" "+i.replace(/^at +/,s=>Pn.gray(s)).replace(/\((.+)\)/,(s,o)=>`(${Pn.cyan(o)})`)).join(`
180
+ ${r}`)}formatType(e,n,r){const i=C6[e.type]||A6[e.level]||"gray";if(n)return I6(i)(Pn.black(` ${e.type.toUpperCase()} `));const s=typeof PA[e.type]=="string"?PA[e.type]:e.icon||e.type;return s?x6(i)(s):""}formatLogObj(e,n){const[r,...i]=this.formatArgs(e.args,n).split(`
181
+ `);if(e.type==="box")return K4(Nh(r+(i.length>0?`
182
+ `+i.join(`
183
+ `):"")),{title:e.title?Nh(e.title):void 0,style:e.style});const s=this.formatDate(e.date,n),o=s&&Pn.gray(s),a=e.badge??e.level<2,u=this.formatType(e,a,n),c=e.tag?Pn.gray(e.tag):"";let l;const d=this.filterAndJoin([u,Nh(r)]),f=this.filterAndJoin(n.columns?[c,o]:[c]),p=(n.columns||0)-xA(d)-xA(f)-2;if(l=p>0&&(n.columns||0)>=80?d+" ".repeat(p)+f:(f?`${Pn.gray(`[${f}]`)} `:"")+d,l+=Nh(i.length>0?`
184
+ `+i.join(`
185
+ `):""),e.type==="trace"){const h=new Error("Trace: "+e.message);l+=this.formatStack(h.stack||"")}return a?`
186
+ `+l+`
187
+ `:l}}function Nh(t){return t.replace(/`([^`]+)`/gm,(e,n)=>Pn.cyan(n)).replace(/\s+_([^_]+)_\s+/gm,(e,n)=>` ${Pn.underline(n)} `)}function x6(t="white"){return Pn[t]||Pn.white}function I6(t="bgWhite"){return Pn[`bg${t[0].toUpperCase()}${t.slice(1)}`]||Pn.bgWhite}function IA(t={}){let e=N6();return process.env.CONSOLA_LEVEL&&(e=Number.parseInt(process.env.CONSOLA_LEVEL)??e),I4({level:e,defaults:{level:e},stdout:process.stdout,stderr:process.stderr,prompt:(...n)=>import("../chunks/prompt.mjs").then(r=>r.prompt(...n)),reporters:t.reporters||[t.fancy??!(Z4||AA)?new P6:new EA],...t})}function N6(){return t6?vt.debug:AA?vt.warn:vt.info}IA();const O6=t=>{nv.forEach(e=>{F6(t,e)})},nv=["name","message","stack","cause","errors"],F6=(t,e)=>{const n=rv(t,e);if(n!==void 0){if(L6(n)){hi(t,e,t[e]);return}M6(n)&&NA(t,e,n)}},rv=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?void 0:rv(r,e)},L6=({get:t,set:e})=>t!==void 0&&e===void 0,M6=({enumerable:t,writable:e})=>t||!e,hi=(t,e,n)=>{NA(t,e,{value:n})},NA=(t,e,n)=>{Object.defineProperty(t,e,{...n,..."get"in n||"set"in n?{}:{writable:!0},enumerable:!1,configurable:!0})},B6=(t,e)=>{if(Array.isArray(t.errors)){const n=t.errors.filter(z6).map(e).filter(Boolean);hi(t,"errors",n)}else q6(t)?hi(t,"errors",[]):t.errors!==void 0&&j6(t)},z6=t=>t!==void 0,q6=t=>"AggregateError"in globalThis&&(t.name==="AggregateError"||t instanceof AggregateError),j6=t=>{delete t.errors,t.errors!==void 0&&hi(t,"errors",[])},G6=(t,e)=>{if(!("cause"in t))return;const n=t.cause===void 0?t.cause:e(t.cause);n===void 0?delete t.cause:hi(t,"cause",n)},U6=t=>W6(t)||H6(t),W6=t=>{try{return t instanceof Error}catch{return!1}},H6=t=>{try{return V6.has(Object.prototype.toString.call(t))}catch{return!1}},V6=new Set(["[object Error]","[object DOMException]","[object DOMError]","[object Exception]"]);function Oh(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}const K6=t=>!Object.isExtensible(t)||nv.some(e=>Y6(t,e)||X6(t,e)),Y6=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);return n!==void 0&&!n.configurable},X6=(t,e)=>{try{return t[e],!1}catch{return!0}},iv=t=>{const e=J6(t.message,t.name);hi(t,"stack",e)},J6=(t="",e="Error")=>{const n=Q6(e),{stack:r}=new n(t);return typeof r=="string"&&r!==""?r:`${e}: ${t}`},Q6=t=>{const e={value:t,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",e);return Object.defineProperty(n.prototype,"name",e),n},Z6=t=>{const e={};for(const n of eW(t))try{const r=t[n],{enumerable:i,configurable:s,writable:o=!0}=rv(t,n);Object.defineProperty(e,n,{value:r,enumerable:i,configurable:s,writable:o})}catch{}return e},eW=t=>{const e=tW(t);for(const n of nv)nW(t,n)&&e.push(n);return e},tW=t=>{try{return Reflect.ownKeys(t)}catch{return[]}},nW=(t,e)=>{try{return e in t&&!Object.hasOwn(t,e)}catch{return!1}},OA=t=>{const{name:e,message:n,stack:r,cause:i,errors:s,...o}=Z6(t),a=rW(n,o),u=aW(e,a);return n===a&&uW(u,o),Object.entries({name:e,stack:r,cause:i,errors:s}).forEach(([c,l])=>{cW(u,c,l)}),r===void 0&&iv(u),u},rW=(t,e)=>typeof t=="string"&&t!==""?t:oW(iW(e)),iW=t=>{try{return JSON.stringify(t)}catch{return sW(t)}},sW=t=>{try{return String(t)}catch{return"Invalid error"}},oW=t=>t.length<FA?t:`${t.slice(0,FA)}...`,FA=1e3,aW=(t,e)=>t==="AggregateError"&&"AggregateError"in globalThis?new AggregateError([],e):t in LA?new LA[t](e):new Error(e),LA={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},uW=(t,e)=>{for(const n in e)n in t||(t[n]=e[n])},cW=(t,e,n)=>{n!==void 0&&hi(t,e,n)},lW=t=>{try{const e=new Error(String(t));return iv(e),e}catch(e){return e}},{toString:dW}=Object.prototype,fW=t=>pW(t)?OA(t):U6(t)?hW(t)?OA(t):t:lW(t),pW=t=>{try{return Oh(t)}catch{return!1}},hW=t=>mW(t)||K6(t)||gW(t),mW=t=>{try{return dW.call(t)==="[object Object]"}catch{return!0}},gW=t=>typeof t.constructor!="function"||typeof t.constructor.name!="string"||t.constructor.name===""||t.constructor.prototype!==Object.getPrototypeOf(t),Fh=(t,{shallow:e=!1}={})=>MA(t,[],e),MA=(t,e,n)=>{if(e.includes(t))return;const r=n?yW:s=>MA(s,[...e,t],n),i=fW(t);return wW(i,r),i},yW=t=>t,wW=(t,e)=>{vW(t),bW(t),DW(t),G6(t,e),B6(t,e),O6(t)},vW=t=>{if(Lh(t.name))return;const e=Object.getPrototypeOf(t).name,n=Lh(e)?e:t.constructor.name;hi(t,"name",n)},bW=t=>{Lh(t.message)||hi(t,"message","")},DW=t=>{Lh(t.stack)||iv(t)},Lh=t=>typeof t=="string"&&t!=="",EW=(t,e,n=t.name)=>{if(RW(e),typeof n!="string")throw new TypeError(`currentName must be a string: ${n}`);return n},RW=t=>{if(!$W(t))throw new TypeError(`ErrorClass must be a class: ${t}`);if(!BA(t.prototype))throw new TypeError(`ErrorClass must inherit from Error: ${t}`);if(!TW(t))throw new TypeError(`ErrorClass must be have a valid constructor: ${t}`)},$W=t=>typeof t=="function"&&typeof t.prototype=="object"&&t.prototype!==null,BA=t=>t!==null&&(t.name==="Error"||BA(Object.getPrototypeOf(t))),TW=t=>typeof t.prototype.constructor=="function",zA=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0,configurable:!0})},SW=(t,e)=>{Object.getPrototypeOf(t)!==e.prototype&&(kW(t,e),GA(t,"constructor"),CW(t,e))},kW=(t,e)=>{Object.setPrototypeOf(t,e.prototype)},CW=(t,e)=>{GA(t,"name");const n=qA(e.prototype);t.name!==n&&zA(t,"name",n)},qA=t=>AW(t)??_W(t)??qA(Object.getPrototypeOf(t)),AW=t=>Object.hasOwn(t,"name")&&jA(t.name)?t.name:void 0,_W=t=>typeof t.constructor=="function"&&jA(t.constructor.name)?t.constructor.name:void 0,jA=t=>typeof t=="string"&&t!=="",GA=(t,e)=>{Object.hasOwn(t,e)&&delete t[e]},PW=(t,e)=>{if(!xW(t,e))return;const n=NW(t,e);zA(t,"stack",n)},xW=(t,e)=>e!==t.name&&e!==""&&t.stack.includes(e)&&IW(),IW=()=>{class t extends Error{}const e={value:UA,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(t,"name",e),Object.defineProperty(t.prototype,"name",e);const{stack:n}=new t("");return typeof n=="string"&&n.includes(UA)},UA="SetErrorClassError",NW=({name:t,stack:e},n)=>{if(e.startsWith(`${n}: `))return e.replace(n,t);const r=OW(n,t),[i,s]=r.find(([o])=>e.includes(o));return e.replace(i,s)},OW=(t,e)=>[[`
188
+ ${t}: `,`
189
+ ${e}: `],[`${t}: `,`${e}: `],[`${t} `,`${e} `],[t,e]],FW=(t,e,n)=>{const r=Fh(t),i=EW(r,e,n);return SW(r,e),PW(r,i),r},LW=(t,e)=>e.configurable===!1?MW(t,e):qW(t,e),MW=(t,e)=>({...e,...BW(t,e),...zW(t,e)}),BW=(t,e)=>e.writable===!0&&t.writable===!1?{writable:!1}:{},zW=(t,e)=>t.hasValue&&"value"in e&&e.writable===!0?{value:t.value}:{},qW=(t,e)=>{const n=od(t.enumerable,e.enumerable,!0),r=od(t.writable,e.writable,!0),i=od(t.configurable,e.configurable,!0);return{...jW(t,e,r),enumerable:n,configurable:i}},jW=(t,e,n)=>t.hasValue?{value:t.value,writable:n}:!WA(t)&&!WA(e)?{value:e.value,writable:n}:{get:od(t.get,e.get),set:od(t.set,e.set)},WA=({get:t,set:e})=>t!==void 0||e!==void 0,od=(t,e,n)=>t??e??n,GW=(t,e,n)=>{if(!UW(t))throw new TypeError(`Argument must be an object: ${t}`);if(!WW(e))throw new TypeError(`Property key must be a string, a symbol or an integer: ${e}`);return HW(n)},UW=t=>typeof t=="object"&&t!==null,WW=t=>{const e=typeof t;return e==="string"||e==="symbol"||e==="number"},HW=t=>{if(!Oh(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 VW({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}},VW=({enumerable:t,writable:e,configurable:n,get:r,set:i,unknownProps:s,hasValue:o})=>{HA(o,r,"get"),HA(o,i,"set"),sv(t,"enumerable"),sv(e,"writable"),sv(n,"configurable"),YW(s)},HA=(t,e,n)=>{if(KW(e,n),t&&e!==void 0)throw new TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${e}`)},KW=(t,e)=>{if(t!==void 0&&typeof t!="function")throw new TypeError(`Descriptor property "${e}" must be a function: ${t}`)},sv=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`Descriptor property "${e}" must be a boolean: ${t}`)},YW=t=>{const[e]=Object.keys(t);if(e!==void 0)throw new TypeError(`Unknown descriptor property "${e}": ${t[e]}`)},XW=(t,e,n)=>{const r=GW(t,e,n),i=VA(t,e),s=LW(r,i);return JW(t,e,s),t},VA=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?{}:VA(r,e)},JW=(t,e,n)=>{try{Object.defineProperty(t,e,n)}catch{}},QW=(t,e,n)=>{if(n!==void 0)return KA(t,e,n);try{delete t[e]}catch{}if(t[e]!==void 0)return KA(t,e)},KA=(t,e,n)=>{const r=ZW(e);XW(t,e,{value:n,...r})},ZW=t=>typeof t=="string"&&t.startsWith("_")?{enumerable:!1}:{},e9=t=>t9(t)||n9(t),t9=t=>{try{return t instanceof Error}catch{return!1}},n9=t=>{try{return r9.has(Object.prototype.toString.call(t))}catch{return!1}},r9=new Set(["[object Error]","[object DOMException]","[object DOMError]","[object Exception]"]),i9=(t,e,n={})=>{if(YA(t,"First argument"),YA(e,"Second argument"),!Oh(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}},YA=(t,e)=>{if(t===void 0)throw new TypeError(`${e} is required.`);if(!s9(t))throw new TypeError(`${e} must be a plain object or an error: ${t}`)},s9=t=>Oh(t)||e9(t),o9=({error:t,props:e,propName:n,soft:r})=>a9(n)||!l9.call(e,n)||r&&t[n]!==void 0,a9=t=>t in u9||c9.has(t),u9=new Error("check"),c9=new Set(["prototype","errors","cause"]),{propertyIsEnumerable:l9}=Object.prototype,d9=(t,e,n)=>{const{soft:r}=i9(t,e,n);for(const i of Reflect.ownKeys(e))f9({error:t,props:e,propName:i,soft:r});return t},f9=({error:t,props:e,propName:n,soft:r})=>{o9({error:t,props:e,propName:n,soft:r})||QW(t,n,e[n])},Mh=(t,e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!1,configurable:!0})},p9=(t,e)=>{if(t.errors===void 0)return;const n=t.errors.map(r=>e(r).error).filter(Boolean);Mh(t,"errors",n)},h9=({target:t,source:e,parent:n,child:r})=>{if(!XA(t)){m9(t,e);return}XA(e)&&Mh(t,"errors",[...r.errors,...n.errors])},m9=(t,e)=>{e.errors!==void 0&&Mh(t,"errors",e.errors)},XA=t=>t.errors!==void 0&&t.errors.length!==0,g9=(t,e,n=t.message)=>{if(typeof e!="string")throw new TypeError(`newMessage must be a string: ${e}`);if(typeof n!="string")throw new TypeError(`currentMessage must be a string: ${n}`);return n},y9=({name:t,stack:e},n,r)=>r!==""&&e.includes(r)?w9({name:t,stack:e,newMessage:n,currentMessage:r}):b9(t,e,n),w9=({name:t,stack:e,newMessage:n,currentMessage:r})=>{const i=v9(t,n,r),[s,o]=i.find(([a])=>e.includes(a));return e.replace(s,o)},v9=(t,e,n)=>[[`${t}: ${n}`,`${t}: ${e}`],[`: ${n}`,`: ${e}`],[`
190
+ ${n}`,`
191
+ ${e}`],[` ${n}`,` ${e}`],[n,e]],b9=(t,e,n)=>{const r=`${t}: `,i=n.trimEnd();return e===t||e.startsWith(`${t}
192
+ `)?e.replace(t,`${r}${i}`):e.startsWith(r)?e.replace(r,`${r}${i}
193
+ `):`${r}${i}
194
+ ${e}`},D9=(t,e,n)=>{const r=Fh(t),i=g9(r,e,n);return QA(r,"message",e),E9(r,e,i),r},E9=(t,e,n)=>{if(e===n||!R9())return;const r=y9(t,e,n);QA(t,"stack",r)},R9=()=>{const{stack:t}=new Error(JA);return typeof t=="string"&&t.includes(JA)},JA="set-error-message test message",QA=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0,configurable:!0})},ZA=(t,e,n)=>{if(typeof e!="string")throw new TypeError(`Second argument must be a message string: ${e}`);const r=Fh(t),i=$9(e,r.message);return D9(r,i,n)},$9=(t,e)=>{const n=t.trim(),r=e.trim();return n===""?r:r===""?n:T9(n,r,t)},T9=(t,e,n)=>t.endsWith(S9)?n.endsWith(k9)?`${t}
195
+ ${e}`:`${t} ${e}`:`${e}
196
+ ${t}`,S9=":",k9=`
197
+ `,C9=({parent:t,child:e,target:n,stackError:r})=>{const i=t.message;return n.message=e.message,ZA(n,i,r.message)},A9=(t,e)=>e0(t)===e,e0=t=>typeof t=="object"&&t!==null?t.stack:void 0,_9=({wrap:t,target:e,source:n,childHasStack:r})=>t===r?e:(Mh(e,"stack",n.stack),n),P9=t=>{const{wrap:e,name:n}=t;return typeof e!="boolean"?n==="Error":(Object.hasOwn(t,"wrap")&&delete t.wrap,e)},x9=t=>t0(t,[]).error,t0=(t,e)=>{if(e.includes(t))return{};const n=u=>t0(u,[...e,t]),r=e0(t),i=Fh(t,{shallow:!0}),s=A9(i,r);p9(i,n);const{parent:o,childHasStack:a}=I9(i,n);return{error:o,errorHasStack:s||a}},I9=(t,e)=>{const n=P9(t);if(t.cause===void 0)return{parent:t,childHasStack:!1};const{error:r,errorHasStack:i}=e(t.cause);return delete t.cause,{parent:N9({parent:t,child:r,childHasStack:i,wrap:n}),childHasStack:i}},N9=({parent:t,child:e,childHasStack:n,wrap:r})=>{if(e===void 0)return t;const[i,s]=r?[e,t]:[t,e],o=_9({wrap:r,target:i,source:s,childHasStack:n}),a=FW(i,i.constructor,o.name),u=C9({parent:t,child:e,target:a,stackError:o});return h9({target:u,source:s,parent:t,child:e}),d9(u,s,{soft:!r})};function n0(t){return function(e,n){if(typeof n?.toJSON=="function"&&(n=n.toJSON()),!(n!==null&&typeof n=="object"))return n;if(t.has(n))return"[Circular]";t.add(n);const r=Array.isArray(n)?[]:{};for(const[i,s]of Object.entries(n))r[i]=n0(t)(i,s);return t.delete(n),r}}function r0(t,{indentation:e}={}){return JSON.stringify(t,n0(new WeakSet),e)}const O9=t=>t.split(`
198
+ `).map(e=>e.trim().replace("file://",""));function F9(t,e=O9){const n={message:""},r=t.args.find(s=>s instanceof Error);if(!r)return n.message=t.args.map(s=>typeof s=="string"?s:r0(s)).join("; "),typeof t.tag=="string"&&t.tag.length>0&&(n.message=`[${t.tag}] ${n.message}`),n;const i=t.args.reduce((s,o)=>{if(o===r)return s;const a=typeof o=="string"?o:r0(o);return ZA(s,a)},x9(r));if(n.message=i.message,n.error={message:i.message,name:i.name},i.stack){const s=e(i.stack);n.error.stack=s.join(`
199
+ `),n.message+=`
200
+ `+s.slice(1).map(o=>" "+o).join(`
201
+ `)}return typeof t.tag=="string"&&t.tag.length>0&&(n.message=`[${t.tag}] ${n.message}`),n}function L9(t){const e=Y1()+hD;return t.split(`
202
+ `).map(n=>n.trim().replace("file://","").replace(e,""))}function M9(t){return F9(t,L9)}const i0=vt.debug,Bt=IA({level:i0,defaults:{level:i0},throttle:2,throttleMin:500,formatOptions:{colors:!0,compact:!1,date:!1}}),Fe=Bt.withTag("lsp");function s0(t){Fe.error(t)}function ve(t){Fe.warn(t)}function B9(t){Fe.level=vt[t]}function z9(t){const e={log:(n,r)=>{const{message:i,error:s}=M9(n);switch(n.type){case"silent":break;case"verbose":case"trace":{t.tracer.log(i);break}case"debug":{t.console.debug(i);break}case"log":{t.console.log(i);break}case"info":case"box":case"ready":case"start":case"success":{t.console.info(i);break}case"warn":{t.console.warn(i);break}case"fail":case"error":case"fatal":{t.console.error(i),s?t.telemetry.logEvent({eventName:"error",...s}):t.telemetry.logEvent({eventName:"error",message:i});break}default:Oe(n.type)}}};Bt.setReporters([e]),Fe.setReporters(Bt.options.reporters)}const q9={fileSystemProvider:()=>new G9},j9=t=>Xw.fileExtensions.some(e=>t.endsWith(e));let G9=class extends MU{async readDirectory(e){const n=[];try{const r=await new LU.fdir().withSymlinks().withFullPaths().filter(j9).crawl(e.fsPath).withPromise();for(const i of r)n.push({isFile:!0,isDirectory:!1,uri:Xt.file(i)})}catch(r){Fe.error(r)}return n}};var U9=Object.getOwnPropertyNames,W9=Object.getOwnPropertySymbols,H9=Object.prototype.hasOwnProperty;function o0(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Bh(t){return function(n,r,i){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 a0(t){return U9(t).concat(W9(t))}var V9=Object.hasOwn||function(t,e){return H9.call(t,e)};function Ks(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var K9="__v",Y9="__o",X9="_owner",u0=Object.getOwnPropertyDescriptor,c0=Object.keys;function J9(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function Q9(t,e){return Ks(t.getTime(),e.getTime())}function Z9(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function eH(t,e){return t===e}function l0(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,d=0;(a=c.next())&&!a.done;){if(i[d]){d++;continue}var f=o.value,p=a.value;if(n.equals(f[0],p[0],u,d,t,e,n)&&n.equals(f[1],p[1],f[0],p[0],t,e,n)){l=i[d]=!0;break}d++}if(!l)return!1;u++}return!0}var tH=Ks;function nH(t,e,n){var r=c0(t),i=r.length;if(c0(e).length!==i)return!1;for(;i-- >0;)if(!f0(t,e,n,r[i]))return!1;return!0}function ad(t,e,n){var r=a0(t),i=r.length;if(a0(e).length!==i)return!1;for(var s,o,a;i-- >0;)if(s=r[i],!f0(t,e,n,s)||(o=u0(t,s),a=u0(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function rH(t,e){return Ks(t.valueOf(),e.valueOf())}function iH(t,e){return t.source===e.source&&t.flags===e.flags}function d0(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 sH(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 oH(t,e){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 f0(t,e,n,r){return(r===X9||r===Y9||r===K9)&&(t.$$typeof||e.$$typeof)?!0:V9(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var aH="[object Arguments]",uH="[object Boolean]",cH="[object Date]",lH="[object Error]",dH="[object Map]",fH="[object Number]",pH="[object Object]",hH="[object RegExp]",mH="[object Set]",gH="[object String]",yH="[object URL]",wH=Array.isArray,p0=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,h0=Object.assign,vH=Object.prototype.toString.call.bind(Object.prototype.toString);function bH(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,d=t.areTypedArraysEqual,f=t.areUrlsEqual;return function(h,w,D){if(h===w)return!0;if(h==null||w==null)return!1;var g=typeof h;if(g!==typeof w)return!1;if(g!=="object")return g==="number"?o(h,w,D):g==="function"?i(h,w,D):!1;var v=h.constructor;if(v!==w.constructor)return!1;if(v===Object)return a(h,w,D);if(wH(h))return e(h,w,D);if(p0!=null&&p0(h))return d(h,w,D);if(v===Date)return n(h,w,D);if(v===RegExp)return c(h,w,D);if(v===Map)return s(h,w,D);if(v===Set)return l(h,w,D);var E=vH(h);return E===cH?n(h,w,D):E===hH?c(h,w,D):E===dH?s(h,w,D):E===mH?l(h,w,D):E===pH?typeof h.then!="function"&&typeof w.then!="function"&&a(h,w,D):E===yH?f(h,w,D):E===lH?r(h,w,D):E===aH?a(h,w,D):E===uH||E===fH||E===gH?u(h,w,D):!1}}function DH(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?ad:J9,areDatesEqual:Q9,areErrorsEqual:Z9,areFunctionsEqual:eH,areMapsEqual:r?o0(l0,ad):l0,areNumbersEqual:tH,areObjectsEqual:r?ad:nH,arePrimitiveWrappersEqual:rH,areRegExpsEqual:iH,areSetsEqual:r?o0(d0,ad):d0,areTypedArraysEqual:r?ad:sH,areUrlsEqual:oH};if(n&&(i=h0({},i,n(i))),e){var s=Bh(i.areArraysEqual),o=Bh(i.areMapsEqual),a=Bh(i.areObjectsEqual),u=Bh(i.areSetsEqual);i=h0({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:u})}return i}function EH(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function RH(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(),d=l.cache,f=d===void 0?e?new WeakMap:void 0:d,p=l.meta;return n(u,c,{cache:f,equals:i,meta:p,strict:s})};if(e)return function(u,c){return n(u,c,{cache:new WeakMap,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 ov=Wi();Wi({strict:!0}),Wi({circular:!0}),Wi({circular:!0,strict:!0}),Wi({createInternalComparator:function(){return Ks}}),Wi({strict:!0,createInternalComparator:function(){return Ks}}),Wi({circular:!0,createInternalComparator:function(){return Ks}}),Wi({circular:!0,createInternalComparator:function(){return Ks},strict:!0});function Wi(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,s=t.strict,o=s===void 0?!1:s,a=DH(t),u=bH(a),c=r?r(u):EH(u);return RH({circular:n,comparator:u,createState:i,equals:c,strict:o})}function m0(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}}const g0=(t,e)=>t.width>e.width+10||t.height>e.height+10;function $H(t,e){if(t.hash===e.hash)return{diagram:m0(t,e)};if(ov(t.autoLayout,e.autoLayout)&&t.nodes.every(r=>{const i=e.nodes[r.id];return!!i&&(r.children.length>0&&i.isCompound||r.children.length===0&&!i.isCompound)&&(i.isCompound||g0(r,i)===!1)})&&t.edges.every(r=>{const i=e.edges[r.id];return!!i&&(!r.labelBBox&&!i.labelBBox||!!r.labelBBox&&!!i.labelBBox&&r.labelBBox.width<=i.labelBBox.width&&r.labelBBox.height<=i.labelBBox.height)}))return{diagram:m0(t,e)};const n=t.nodes.reduce((r,i)=>{const s=e.nodes[i.id];if(i.children.length>0||!s)return r;const o={id:i.id,center:{x:Math.round(s.x+s.width/2),y:Math.round(s.y+s.height/2)}};return s.isCompound||g0(i,s)||(o.fixedsize={width:s.width,height:s.height}),r.push(o),r},[]);return{relayout:{x:e.x,y:e.y,height:e.height,nodes:n,edges:wp(e.edges).flatMap(([r,i])=>i.dotpos?{id:r,dotpos:i.dotpos}:[])}}}function y0(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function av(t){return typeof t=="object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function w0(t){return av(t)||y0(t)}function ud(t){return typeof t=="string"||w0(t)}function TH(t){return Array.isArray(t)&&t.every(ud)}function SH(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function v0(t){if(w0(t))return t;const[e,n,r]=t.split(":");return SH(r)?{id:e,port:n,compass:r}:{id:e,port:n}}function kH(t){if(t.length<2&&(ud(t[0])&&ud(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.map(e=>v0(e))}const zh=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function CH(t){return Object.assign(Object.seal(Object.assign({},zh)),t)}function AH(...t){const[e,...n]=t;return(...r)=>n.reduce((i,s)=>s(i),e(...r))}function Qn(t,...e){return AH(t,...e)}const _H=t=>(...e)=>n=>t(n,...e),PH=t=>({[Symbol.iterator]:t}),hr=_H((t,e)=>Array.from(PH(function*(){for(const n of t)yield e(n)})));class b0{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 Xe=b0.prototype.createElement.bind(new b0),xH=/\r?\n/;function mr(t){return e=>e.join(t)}function IH(t){return e=>t+e+t}function Hi(t,e){return n=>t+n+e}function qh(t){return e=>t+e}const D0=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),jh=t=>t.split(xH),cd=(t,e,n)=>Qn(jh,hr(qh(t==="space"?" ".repeat(e):`
203
+ `)),mr(n)),Ys=t=>{switch(t){case"crlf":return`\r
204
+ `;case"lf":return`
205
+ `}},NH={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const n=Ys(t.endOfLine);return Qn(hr(t.print),mr(n),cd(t.indentStyle,t.indentSize,n),Hi(`${e.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(e.children)}},OH={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},FH={match(t){return t.type==="Comment"},print(t,e){const n=Ys(t.endOfLine);switch(e.kind){case"Block":return Qn(jh,hr(qh(" * ")),mr(n),Hi(`/**${n}`,`${n} */`))(e.value);case"Macro":return Qn(jh,hr(qh("# ")),mr(n))(e.value);case"Slash":default:return Qn(jh,hr(qh("// ")),mr(n))(e.value)}}},LH={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join(Ys(t.endOfLine))}},MH={match(t){return t.type==="Edge"},print(t,e){const n=Qn(hr(t.print),mr(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${n};`;const r=Ys(t.endOfLine),i=Qn(hr(t.print),mr(r),cd(t.indentStyle,t.indentSize,r),Hi(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},BH={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=Ys(t.endOfLine),i=Qn(hr(t.print),mr(r),cd(t.indentStyle,t.indentSize,r),Hi(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},zH=Qn(D0,IH('"')),qH=Hi("<",">"),jH={match(t){return t.type==="Literal"},print(t,e){switch(e.quoted){case"html":return qH(e.value);case!0:return zH(e.value);case!1:default:return D0(e.value)}}},GH={match(t){return t.type==="Node"},print(t,e){const n=t.print(e.id);if(e.children.length===0)return`${n};`;const r=Ys(t.endOfLine),i=Qn(hr(t.print),mr(r),cd(t.indentStyle,t.indentSize,r),Hi(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},UH={match(t){return t.type==="NodeRefGroup"},print(t,e){return Qn(hr(t.print),mr(" "),Hi("{","}"))(e.children)}},WH={match(t){return t.type==="NodeRef"},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(":")}},HH={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=Ys(t.endOfLine),i=Qn(hr(t.print),mr(r),cd(t.indentStyle,t.indentSize,r),Hi(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},VH=[NH,OH,FH,LH,MH,BH,jH,GH,UH,WH,HH];class KH{options;#e=[...VH];constructor(e={}){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 YH(t,e){const n=new KH(e).print(t);if(!n)throw new Error;return n}function Gh(t,e){if(typeof e=="string"){const n=e.trim();return/^<.+>$/ms.test(n)?Xe("Attribute",{key:Xe("Literal",{value:t,quoted:!1},[]),value:Xe("Literal",{value:n.slice(1,n.length-1),quoted:"html"},[])},[]):Xe("Attribute",{key:Xe("Literal",{value:t,quoted:!1},[]),value:Xe("Literal",{value:e,quoted:!0},[])},[])}return Xe("Attribute",{key:Xe("Literal",{value:t,quoted:!1},[]),value:Xe("Literal",{value:String(e),quoted:!1},[])},[])}function Xs(t,e){return Xe("Comment",{kind:e,value:t},[])}function E0(t,e){return Array.from(function*(){for(const[n,r]of e.values)yield Gh(n,r);for(const n of Object.values(e.attributes))n.size>0&&(n.comment&&(yield Xs(n.comment,t.commentKind)),yield t.convert(n));for(const n of e.nodes)n.comment&&(yield Xs(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.subgraphs)n.comment&&(yield Xs(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.edges)n.comment&&(yield Xs(n.comment,t.commentKind)),yield t.convert(n)}())}const XH={match(t){return t.$$type==="AttributeList"},convert(t,e){return Xe("AttributeList",{kind:e.$$kind},e.values.map(([n,r])=>Gh(n,r)))}},JH={match(t){return t.$$type==="Edge"},convert(t,e){return Xe("Edge",{targets:e.targets.map(n=>av(n)?Xe("NodeRef",{id:Xe("Literal",{value:n.id,quoted:!0},[])},[]):y0(n)?Xe("NodeRef",{id:Xe("Literal",{value:n.id,quoted:!0},[]),port:n.port?Xe("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?Xe("Literal",{value:n.compass,quoted:!0},[]):void 0},[]):Xe("NodeRefGroup",{},n.map(r=>av(r)?Xe("NodeRef",{id:Xe("Literal",{value:r.id,quoted:!0},[])},[]):Xe("NodeRef",{id:Xe("Literal",{value:r.id,quoted:!0},[]),port:r.port?Xe("Literal",{value:r.port,quoted:!0},[]):void 0,compass:r.compass?Xe("Literal",{value:r.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[Xs(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>Gh(n,r))])}},QH={match(t){return t.$$type==="Graph"},convert(t,e){return Xe("Dot",{},[...e.comment?[Xs(e.comment,t.commentKind)]:[],Xe("Graph",{directed:e.directed,strict:e.strict,id:e.id?Xe("Literal",{value:e.id,quoted:!0},[]):void 0},E0(t,e))])}},ZH={match(t){return t.$$type==="Node"},convert(t,e){return Xe("Node",{id:Xe("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[Xs(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>Gh(n,r))])}},e7={match(t){return t.$$type==="Subgraph"},convert(t,e){return Xe("Subgraph",{id:e.id?Xe("Literal",{value:e.id,quoted:!0},[]):void 0},E0(t,e))}},t7=[XH,JH,ZH,QH,e7];class n7{options;#e=[...t7];constructor(e={}){this.options=e}convert(e){const n=[...this.#e],{commentKind:r="Slash"}=this.options,i={commentKind:r,convert(s){for(const o of n)if(o.match(s))return o.convert(i,s);throw Error()}};return i.convert(e)}}function r7(t,e){return new n7(e).convert(t)}const I=new Proxy(Object.freeze({}),{get:(t,e)=>e});class uv{}class cv extends uv{#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(e);for(const[r,i]of n)this.set(r,i)}clear(){this.#e.clear()}}class lv extends cv{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,n){super(n),this.$$kind=e}}class R0 extends cv{#e=zh;id;comment;attributes=Object.freeze({graph:new lv("Graph"),edge:new lv("Edge"),node:new lv("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,subgraphs:new Set};with(e){this.#e=CH(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){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=>TH(s)?kH(s):v0(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.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(o),o}typeof e=="object"&&e!==null&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}}class $0 extends R0{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 i7 extends $0{get directed(){return!0}}let s7=class extends $0{get directed(){return!1}};class o7 extends R0{get $$type(){return"Subgraph"}id;constructor(...e){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 T0 extends cv{comment}let a7=class extends uv{id;get $$type(){return"Node"}comment;attributes;constructor(e,n){super(),this.id=e,this.attributes=new T0(n)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class u7 extends uv{targets;get $$type(){return"Edge"}comment;attributes;constructor(e,n){if(super(),this.targets=e,e.length<2&&(ud(e[0])&&ud(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new T0(n)}}Object.assign(zh,{Graph:s7,Digraph:i7,Subgraph:o7,Node:a7,Edge:u7});function S0(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 k0(t,e=zh){return Object.freeze({digraph:S0.call(e,!0,t),graph:S0.call(e,!1,t)})}const C0=k0(!1),c7=C0.digraph;C0.graph;const l7=k0(!0);function A0(t,e){const n=r7(t,e?.convert);return YH(n,e?.print)}var dv,_0;function d7(){if(_0)return dv;_0=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(`
206
+ `).map(o=>t(o)).join(`
207
+ `)}dv=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||`
208
+ `+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"),d=r.match(l)||[],f=o+d.map(function(p){return p.slice(-1)===`
209
+ `&&(p=p.slice(0,p.length-1)),u(p)}).join(a);return i.trim===!0&&(f=e(f)),f};function n(r){return r}return dv}var f7=d7();const p7=Rs(f7),Uh={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<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 Uh.hue2rgb(s,i,t+1/3)*255;case"g":return Uh.hue2rgb(s,i,t)*255;case"b":return Uh.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: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}}},h7={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},m7={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},xe={channel:Uh,lang:h7,unit:m7},Vi={};for(let t=0;t<=255;t++)Vi[t]=xe.unit.dec2hex(t);const on={ALL:0,RGB:1,HSL:2};class g7{constructor(){this.type=on.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=on.ALL}is(e){return this.type===e}}class y7{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new g7}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=on.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=xe.channel.rgb2hsl(e,"h")),r===void 0&&(e.s=xe.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=xe.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=xe.channel.hsl2rgb(e,"r")),r===void 0&&(e.g=xe.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=xe.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(on.HSL)&&n!==void 0?n:(this._ensureHSL(),xe.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(on.HSL)&&n!==void 0?n:(this._ensureHSL(),xe.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(on.HSL)&&n!==void 0?n:(this._ensureHSL(),xe.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(on.RGB)&&n!==void 0?n:(this._ensureRGB(),xe.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(on.RGB)&&n!==void 0?n:(this._ensureRGB(),xe.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(on.RGB)&&n!==void 0?n:(this._ensureRGB(),xe.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(on.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(on.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(on.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(on.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(on.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(on.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const fv=new y7({r:0,g:0,b:0,a:0},"transparent"),aa={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(aa.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,s=i%4===0,o=i>4,a=o?1:17,u=o?8:4,c=s?0:-1,l=o?255:15;return fv.set({r:(r>>u*(c+3)&l)*a,g:(r>>u*(c+2)&l)*a,b:(r>>u*(c+1)&l)*a,a:s?(r&l)*a/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${Vi[Math.round(e)]}${Vi[Math.round(n)]}${Vi[Math.round(r)]}${Vi[Math.round(i*255)]}`:`#${Vi[Math.round(e)]}${Vi[Math.round(n)]}${Vi[Math.round(r)]}`}},Js={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(Js.hueRe);if(e){const[,n,r]=e;switch(r){case"grad":return xe.channel.clamp.h(parseFloat(n)*.9);case"rad":return xe.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return xe.channel.clamp.h(parseFloat(n)*360)}}return xe.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(Js.re);if(!n)return;const[,r,i,s,o,a]=n;return fv.set({h:Js._hue2deg(r),s:xe.channel.clamp.s(parseFloat(i)),l:xe.channel.clamp.l(parseFloat(s)),a:o?xe.channel.clamp.a(a?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${xe.lang.round(e)}, ${xe.lang.round(n)}%, ${xe.lang.round(r)}%, ${i})`:`hsl(${xe.lang.round(e)}, ${xe.lang.round(n)}%, ${xe.lang.round(r)}%)`}},ld={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=ld.colors[t];if(e)return aa.parse(e)},stringify:t=>{const e=aa.stringify(t);for(const n in ld.colors)if(ld.colors[n]===e)return n}},dd={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const n=t.match(dd.re);if(!n)return;const[,r,i,s,o,a,u,c,l]=n;return fv.set({r:xe.channel.clamp.r(i?parseFloat(r)*2.55:parseFloat(r)),g:xe.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:xe.channel.clamp.b(u?parseFloat(a)*2.55:parseFloat(a)),a:c?xe.channel.clamp.a(l?parseFloat(c)/100:parseFloat(c)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${xe.lang.round(e)}, ${xe.lang.round(n)}, ${xe.lang.round(r)}, ${xe.lang.round(i)})`:`rgb(${xe.lang.round(e)}, ${xe.lang.round(n)}, ${xe.lang.round(r)})`}},Ki={format:{keyword:ld,hex:aa,rgb:dd,rgba:dd,hsl:Js,hsla:Js},parse:t=>{if(typeof t!="string")return t;const e=aa.parse(t)||dd.parse(t)||Js.parse(t)||ld.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(on.HSL)||t.data.r===void 0?Js.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?dd.stringify(t):aa.stringify(t)},w7=(t,e)=>{const n=Ki.parse(t);for(const r in e)n[r]=xe.channel.clamp[r](e[r]);return Ki.stringify(n)},P0=t=>Ki.format.hex.stringify(Ki.parse(t)),v7=(t,e,n)=>{const r=Ki.parse(t),i=r[e],s=xe.channel.clamp[e](i+n);return i!==s&&(r[e]=s),Ki.stringify(r)},b7=(t,e)=>v7(t,"a",-.3),D7=(t,e)=>{const n=Ki.parse(t),r={};for(const i in e)e[i]&&(r[i]=n[i]+e[i]);return w7(t,r)},E7=(t,e)=>{const n=Ki.parse(t),r={},i=(s,o,a)=>o>0?(a-s)*o/100:s*o/100;for(const s in e)r[s]=i(n[s],e[s],xe.channel.max[s]);return D7(t,r)};function qn(t){return t.children.length>0}function an(t){switch(t){case"open":return"vee";default:return t}}function Fr(t){return Array.isArray(t)?[Fr(t[0]),Fr(t[1])]:(Ce(isFinite(t),`Invalid not finite point value ${t}`),Math.round(t))}const x0=t=>(Ce(isFinite(t),`Invalid not finite inch value ${t}`),Math.floor(t*72)),dt=t=>Math.ceil(t/72*1e3)/1e3,Zn=t=>Math.ceil(t);Zn(40).toString();function I0(t,e){return P0(E7(t,{l:-35-5*e,s:-15-5*e}))}function R7(t){return P0(b7(t))}function $7(t){return t.trim().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function N0(t,{maxchars:e,maxLines:n,sanitize:r=yG()}){let i=p7(t,{width:e,indent:"",escape:r}).split(`
210
+ `);return Jt(n)&&n>0&&i.length>n&&(i=i.slice(0,n-1)),i}function Qs({text:t,maxchars:e,fontsize:n,maxLines:r,bold:i,color:s}){let o=N0(t,{maxchars:e,maxLines:r,sanitize:$7}).join("<BR/>");i&&(o=`<B>${o}</B>`);const a=s?` COLOR="${s}"`:"";return`<FONT POINT-SIZE="${Zn(n)}"${a}>${o}</FONT>`}function T7(t,e){const n=ae(t.icon),r=[Qs({text:t.title,fontsize:19,maxchars:35,maxLines:3})];if(ae(t.technology?.trim())&&r.push(Qs({text:t.technology,fontsize:12,maxchars:n?35:45,maxLines:1,color:e.loContrast})),ae(t.description?.trim())&&r.push(Qs({text:t.description,fontsize:14,maxchars:n?35:45,maxLines:5,color:e.loContrast})),r.length===1&&!n)return`<${r[0]}>`;const i=n?(s,o,a)=>{let u=`<TD ALIGN="TEXT" BALIGN="LEFT">${s}</TD>`;if(o===0){const c=a.length>1?` ROWSPAN="${a.length}"`:"";let l=76;(t.shape==="queue"||t.shape==="mobile")&&(l+=20),u=`<TD${c} WIDTH="${l}"> </TD>${u}`,u=`${u}<TD${c} WIDTH="16"> </TD>`}return`<TR>${u}</TR>`}:s=>`<TR><TD>${s}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="6">${r.map(i).join("")}</TABLE>>`}function S7(t,e){const n=Qs({text:t.title.toUpperCase(),maxchars:50,fontsize:11,maxLines:1,bold:!0,color:e});return n.includes("<BR/>")?`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="TEXT" BALIGN="LEFT">${n}</TD></TR></TABLE>>`:`<${n}>`}const Wh=40,O0=5,pv=`BGCOLOR="${Gn.relationships[va].labelBgColor}A0"`;function F0({label:t,technology:e}){const n=[];if(ae(t?.trim())&&n.push(Qs({text:t,maxchars:Wh,fontsize:14,maxLines:O0,bold:t==="[...]"})),ae(e?.trim())&&n.push(Qs({text:`[ ${e} ]`,fontsize:12,maxLines:1,maxchars:Wh})),n.length===0)return null;const r=n.map(i=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT">${i}</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${pv}>${r}</TABLE>>`}function k7(t,e){const n=`<TABLE BORDER="0" CELLPADDING="6" ${pv}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${Zn(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return ae(e?.trim())?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${n}</TD>`,`<TD ${pv} CELLPADDING="3">`,Qs({text:e,maxchars:Wh,fontsize:14,maxLines:5}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${n}>`}var hv,L0;function mv(){if(L0)return hv;L0=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>=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"},hv=t,hv}var C7=mv();const er=Rs(C7);var Hh={},M0;function A7(){return M0||(M0=1,Hh.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Hh.SYMBOL_SUPPORT=typeof Symbol<"u"),Hh}var gv,B0;function z0(){if(B0)return gv;B0=1;var t=mv(),e=A7(),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(s):typeof s!="object"||s===null?null:r&&typeof s[Symbol.iterator]=="function"?s[Symbol.iterator]():typeof s.next=="function"?s:null}return gv=function(o){var a=i(o);if(!a)throw new Error("obliterator: target is not iterable nor a valid iterator.");return a},gv}var yv,q0;function _7(){if(q0)return yv;q0=1;var t=z0();return yv=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}},yv}var P7=_7();const j0=Rs(P7);var wv,G0;function x7(){if(G0)return wv;G0=1;var t=mv(),e=z0();return wv=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})},wv}var I7=x7();const mi=Rs(I7);function N7(){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=N7;typeof Object.assign=="function"&&(zt=Object.assign);function tr(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 Zt(t){return typeof t=="object"&&t!==null}function U0(t){let e;for(e in t)return!1;return!0}function nr(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function gr(t,e,n){const r={enumerable:!0,configurable:!0};typeof n=="function"?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function W0(t){return!(!Zt(t)||t.attributes&&!Array.isArray(t.attributes))}function O7(){let t=Math.floor(Math.random()*256)&255;return()=>t++}class vv extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class pe extends vv{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,pe.prototype.constructor)}}class ie extends vv{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ie.prototype.constructor)}}class Te extends vv{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Te.prototype.constructor)}}function H0(t,e){this.key=t,this.attributes=e,this.clear()}H0.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function V0(t,e){this.key=t,this.attributes=e,this.clear()}V0.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function K0(t,e){this.key=t,this.attributes=e,this.clear()}K0.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function ua(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}ua.prototype.attach=function(){let t="out",e="in";this.undirected&&(t=e="undirected");const n=this.source.key,r=this.target.key;this.source[t][r]=this,!(this.undirected&&n===r)&&(this.target[e][n]=this)},ua.prototype.attachMulti=function(){let t="out",e="in";const n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");const i=this.source[t],s=i[r];if(typeof s>"u"){i[r]=this,this.undirected&&n===r||(this.target[e][n]=this);return}s.previous=this,this.next=s,i[r]=this,this.target[e][n]=this},ua.prototype.detach=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},ua.prototype.detachMulti=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Y0=0,X0=1,F7=2,J0=3;function gi(t,e,n,r,i,s,o){let a,u,c,l;if(r=""+r,n===Y0){if(a=t._nodes.get(r),!a)throw new ie(`Graph.${e}: could not find the "${r}" node in the graph.`);c=i,l=s}else if(n===J0){if(i=""+i,u=t._edges.get(i),!u)throw new ie(`Graph.${e}: could not find the "${i}" edge in the graph.`);const d=u.source.key,f=u.target.key;if(r===d)a=u.target;else if(r===f)a=u.source;else throw new ie(`Graph.${e}: the "${r}" node is not attached to the "${i}" edge (${d}, ${f}).`);c=s,l=o}else{if(u=t._edges.get(r),!u)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`);n===X0?a=u.source:a=u.target,c=i,l=s}return[a,c,l]}function L7(t,e,n){t.prototype[e]=function(r,i,s){const[o,a]=gi(this,e,n,r,i,s);return o.attributes[a]}}function M7(t,e,n){t.prototype[e]=function(r,i){const[s]=gi(this,e,n,r,i);return s.attributes}}function B7(t,e,n){t.prototype[e]=function(r,i,s){const[o,a]=gi(this,e,n,r,i,s);return o.attributes.hasOwnProperty(a)}}function z7(t,e,n){t.prototype[e]=function(r,i,s,o){const[a,u,c]=gi(this,e,n,r,i,s,o);return a.attributes[u]=c,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:u}),this}}function q7(t,e,n){t.prototype[e]=function(r,i,s,o){const[a,u,c]=gi(this,e,n,r,i,s,o);if(typeof c!="function")throw new pe(`Graph.${e}: updater should be a function.`);const l=a.attributes,d=c(l[u]);return l[u]=d,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:u}),this}}function j7(t,e,n){t.prototype[e]=function(r,i,s){const[o,a]=gi(this,e,n,r,i,s);return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}function G7(t,e,n){t.prototype[e]=function(r,i,s){const[o,a]=gi(this,e,n,r,i,s);if(!Zt(a))throw new pe(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function U7(t,e,n){t.prototype[e]=function(r,i,s){const[o,a]=gi(this,e,n,r,i,s);if(!Zt(a))throw new pe(`Graph.${e}: provided attributes are not a plain object.`);return zt(o.attributes,a),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:a}),this}}function W7(t,e,n){t.prototype[e]=function(r,i,s){const[o,a]=gi(this,e,n,r,i,s);if(typeof a!="function")throw new pe(`Graph.${e}: provided updater is not a function.`);return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const H7=[{name:t=>`get${t}Attribute`,attacher:L7},{name:t=>`get${t}Attributes`,attacher:M7},{name:t=>`has${t}Attribute`,attacher:B7},{name:t=>`set${t}Attribute`,attacher:z7},{name:t=>`update${t}Attribute`,attacher:q7},{name:t=>`remove${t}Attribute`,attacher:j7},{name:t=>`replace${t}Attributes`,attacher:G7},{name:t=>`merge${t}Attributes`,attacher:U7},{name:t=>`update${t}Attributes`,attacher:W7}];function V7(t){H7.forEach(function({name:e,attacher:n}){n(t,e("Node"),Y0),n(t,e("Source"),X0),n(t,e("Target"),F7),n(t,e("Opposite"),J0)})}function K7(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,a=""+i;if(i=arguments[2],s=tr(this,o,a,n),!s)throw new ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return s.attributes[i]}}function Y7(t,e,n){t.prototype[e]=function(r){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,o=""+arguments[1];if(i=tr(this,s,o,n),!i)throw new ie(`Graph.${e}: could not find an edge for the given path ("${s}" - "${o}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return i.attributes}}function X7(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,a=""+i;if(i=arguments[2],s=tr(this,o,a,n),!s)throw new ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return s.attributes.hasOwnProperty(i)}}function J7(t,e,n){t.prototype[e]=function(r,i,s){let o;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,u=""+i;if(i=arguments[2],s=arguments[3],o=tr(this,a,u,n),!o)throw new ie(`Graph.${e}: could not find an edge for the given path ("${a}" - "${u}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return o.attributes[i]=s,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function Q7(t,e,n){t.prototype[e]=function(r,i,s){let o;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,u=""+i;if(i=arguments[2],s=arguments[3],o=tr(this,a,u,n),!o)throw new ie(`Graph.${e}: could not find an edge for the given path ("${a}" - "${u}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof s!="function")throw new pe(`Graph.${e}: updater should be a function.`);return o.attributes[i]=s(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function Z7(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,a=""+i;if(i=arguments[2],s=tr(this,o,a,n),!s)throw new ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return delete s.attributes[i],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:i}),this}}function eV(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,a=""+i;if(i=arguments[2],s=tr(this,o,a,n),!s)throw new ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!Zt(i))throw new pe(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function tV(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,a=""+i;if(i=arguments[2],s=tr(this,o,a,n),!s)throw new ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!Zt(i))throw new pe(`Graph.${e}: provided attributes are not a plain object.`);return zt(s.attributes,i),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:i}),this}}function nV(t,e,n){t.prototype[e]=function(r,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Te(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Te(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,a=""+i;if(i=arguments[2],s=tr(this,o,a,n),!s)throw new ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(n!=="mixed")throw new Te(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new ie(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof i!="function")throw new pe(`Graph.${e}: provided updater is not a function.`);return s.attributes=i(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const rV=[{name:t=>`get${t}Attribute`,attacher:K7},{name:t=>`get${t}Attributes`,attacher:Y7},{name:t=>`has${t}Attribute`,attacher:X7},{name:t=>`set${t}Attribute`,attacher:J7},{name:t=>`update${t}Attribute`,attacher:Q7},{name:t=>`remove${t}Attribute`,attacher:Z7},{name:t=>`replace${t}Attributes`,attacher:eV},{name:t=>`merge${t}Attributes`,attacher:tV},{name:t=>`update${t}Attributes`,attacher:nV}];function iV(t){rV.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}const sV=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function oV(t,e,n,r){let i=!1;for(const s in e){if(s===r)continue;const o=e[s];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),t&&i)return o.key}}function aV(t,e,n,r){let i,s,o,a=!1;for(const u in e)if(u!==r){i=e[u];do{if(s=i.source,o=i.target,a=n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),t&&a)return i.key;i=i.next}while(i!==void 0)}}function bv(t,e){const n=Object.keys(t),r=n.length;let i,s=0;return new er(function(){do if(i)i=i.next;else{if(s>=r)return{done:!0};const a=n[s++];if(a===e){i=void 0;continue}i=t[a]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}})}function uV(t,e,n,r){const i=e[n];if(!i)return;const s=i.source,o=i.target;if(r(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&t)return i.key}function cV(t,e,n,r){let i=e[n];if(!i)return;let s=!1;do{if(s=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&s)return i.key;i=i.next}while(i!==void 0)}function Dv(t,e){let n=t[e];return n.next!==void 0?new er(function(){if(!n)return{done:!0};const r={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:r}}):er.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function lV(t,e){if(t.size===0)return[];if(e==="mixed"||e===t.type)return typeof Array.from=="function"?Array.from(t._edges.keys()):j0(t._edges.keys(),t._edges.size);const n=e==="undirected"?t.undirectedSize:t.directedSize,r=new Array(n),i=e==="undirected",s=t._edges.values();let o=0,a,u;for(;a=s.next(),a.done!==!0;)u=a.value,u.undirected===i&&(r[o++]=u.key);return r}function Q0(t,e,n,r){if(e.size===0)return;const i=n!=="mixed"&&n!==e.type,s=n==="undirected";let o,a,u=!1;const c=e._edges.values();for(;o=c.next(),o.done!==!0;){if(a=o.value,i&&a.undirected!==s)continue;const{key:l,attributes:d,source:f,target:p}=a;if(u=r(l,d,f.key,p.key,f.attributes,p.attributes,a.undirected),t&&u)return l}}function dV(t,e){if(t.size===0)return er.empty();const n=e!=="mixed"&&e!==t.type,r=e==="undirected",i=t._edges.values();return new er(function(){let o,a;for(;;){if(o=i.next(),o.done)return o;if(a=o.value,!(n&&a.undirected!==r))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}})}function Ev(t,e,n,r,i,s){const o=e?aV:oV;let a;if(n!=="undirected"&&(r!=="out"&&(a=o(t,i.in,s),t&&a)||r!=="in"&&(a=o(t,i.out,s,r?void 0:i.key),t&&a))||n!=="directed"&&(a=o(t,i.undirected,s),t&&a))return a}function fV(t,e,n,r){const i=[];return Ev(!1,t,e,n,r,function(s){i.push(s)}),i}function pV(t,e,n){let r=er.empty();return t!=="undirected"&&(e!=="out"&&typeof n.in<"u"&&(r=mi(r,bv(n.in))),e!=="in"&&typeof n.out<"u"&&(r=mi(r,bv(n.out,e?void 0:n.key)))),t!=="directed"&&typeof n.undirected<"u"&&(r=mi(r,bv(n.undirected))),r}function Rv(t,e,n,r,i,s,o){const a=n?cV:uV;let u;if(e!=="undirected"&&(typeof i.in<"u"&&r!=="out"&&(u=a(t,i.in,s,o),t&&u)||typeof i.out<"u"&&r!=="in"&&(r||i.key!==s)&&(u=a(t,i.out,s,o),t&&u))||e!=="directed"&&typeof i.undirected<"u"&&(u=a(t,i.undirected,s,o),t&&u))return u}function hV(t,e,n,r,i){const s=[];return Rv(!1,t,e,n,r,i,function(o){s.push(o)}),s}function mV(t,e,n,r){let i=er.empty();return t!=="undirected"&&(typeof n.in<"u"&&e!=="out"&&r in n.in&&(i=mi(i,Dv(n.in,r))),typeof n.out<"u"&&e!=="in"&&r in n.out&&(e||n.key!==r)&&(i=mi(i,Dv(n.out,r)))),t!=="directed"&&typeof n.undirected<"u"&&r in n.undirected&&(i=mi(i,Dv(n.undirected,r))),i}function gV(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(s,o){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return lV(this,r);if(arguments.length===1){s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new ie(`Graph.${n}: could not find the "${s}" node in the graph.`);return fV(this.multi,r==="mixed"?this.type:r,i,a)}if(arguments.length===2){s=""+s,o=""+o;const a=this._nodes.get(s);if(!a)throw new ie(`Graph.${n}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(o))throw new ie(`Graph.${n}: could not find the "${o}" target node in the graph.`);return hV(r,this.multi,i,a,o)}throw new pe(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function yV(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,d){if(!(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)){if(arguments.length===1)return d=c,Q0(!1,this,r,d);if(arguments.length===2){c=""+c,d=l;const f=this._nodes.get(c);if(typeof f>"u")throw new ie(`Graph.${s}: could not find the "${c}" node in the graph.`);return Ev(!1,this.multi,r==="mixed"?this.type:r,i,f,d)}if(arguments.length===3){c=""+c,l=""+l;const f=this._nodes.get(c);if(!f)throw new ie(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(l))throw new ie(`Graph.${s}: could not find the "${l}" target node in the graph.`);return Rv(!1,r,this.multi,i,f,l,d)}throw new pe(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+n[0].toUpperCase()+n.slice(1);t.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();let d;if(c.length===0){let f=0;r!=="directed"&&(f+=this.undirectedSize),r!=="undirected"&&(f+=this.directedSize),d=new Array(f);let p=0;c.push((h,w,D,g,v,E,k)=>{d[p++]=l(h,w,D,g,v,E,k)})}else d=[],c.push((f,p,h,w,D,g,v)=>{d.push(l(f,p,h,w,D,g,v))});return this[s].apply(this,c),d};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop(),d=[];return c.push((f,p,h,w,D,g,v)=>{l(f,p,h,w,D,g,v)&&d.push(f)}),this[s].apply(this,c),d};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(){let c=Array.prototype.slice.call(arguments);if(c.length<2||c.length>4)throw new pe(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${c.length}).`);if(typeof c[c.length-1]=="function"&&typeof c[c.length-2]!="function")throw new pe(`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 l,d;c.length===2?(l=c[0],d=c[1],c=[]):c.length===3?(l=c[1],d=c[2],c=[c[0]]):c.length===4&&(l=c[2],d=c[3],c=[c[0],c[1]]);let f=d;return c.push((p,h,w,D,g,v,E)=>{f=l(f,p,h,w,D,g,v,E)}),this[s].apply(this,c),f}}function wV(t,e){const{name:n,type:r,direction:i}=e,s="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(u,c,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return l=u,Q0(!0,this,r,l);if(arguments.length===2){u=""+u,l=c;const d=this._nodes.get(u);if(typeof d>"u")throw new ie(`Graph.${s}: could not find the "${u}" node in the graph.`);return Ev(!0,this.multi,r==="mixed"?this.type:r,i,d,l)}if(arguments.length===3){u=""+u,c=""+c;const d=this._nodes.get(u);if(!d)throw new ie(`Graph.${s}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(c))throw new ie(`Graph.${s}: could not find the "${c}" target node in the graph.`);return Rv(!0,r,this.multi,i,d,c,l)}throw new pe(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),c=u.pop();return u.push((d,f,p,h,w,D,g)=>c(d,f,p,h,w,D,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((d,f,p,h,w,D,g)=>!c(d,f,p,h,w,D,g)),!this[s].apply(this,u)}}function vV(t,e){const{name:n,type:r,direction:i}=e,s=n.slice(0,-1)+"Entries";t.prototype[s]=function(o,a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return er.empty();if(!arguments.length)return dV(this,r);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new ie(`Graph.${s}: could not find the "${o}" node in the graph.`);return pV(r,i,u)}if(arguments.length===2){o=""+o,a=""+a;const u=this._nodes.get(o);if(!u)throw new ie(`Graph.${s}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new ie(`Graph.${s}: could not find the "${a}" target node in the graph.`);return mV(r,i,u,a)}throw new pe(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function bV(t){sV.forEach(e=>{gV(t,e),yV(t,e),wV(t,e),vV(t,e)})}const DV=[{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:"undirectedNeighbors",type:"undirected"}];function Vh(){this.A=null,this.B=null}Vh.prototype.wrap=function(t){this.A===null?this.A=t:this.B===null&&(this.B=t)},Vh.prototype.has=function(t){return this.A!==null&&t in this.A||this.B!==null&&t in this.B};function fd(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 $v(t,e,n,r,i){if(e!=="mixed"){if(e==="undirected")return fd(t,null,r,r.undirected,i);if(typeof n=="string")return fd(t,null,r,r[n],i)}const s=new Vh;let o;if(e!=="undirected"){if(n!=="out"){if(o=fd(t,null,r,r.in,i),t&&o)return o;s.wrap(r.in)}if(n!=="in"){if(o=fd(t,s,r,r.out,i),t&&o)return o;s.wrap(r.out)}}if(e!=="directed"&&(o=fd(t,s,r,r.undirected,i),t&&o))return o}function EV(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 $v(!1,t,e,n,function(i){r.push(i)}),r}function pd(t,e,n){const r=Object.keys(n),i=r.length;let s=0;return new er(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 RV(t,e,n){if(t!=="mixed"){if(t==="undirected")return pd(null,n,n.undirected);if(typeof e=="string")return pd(null,n,n[e])}let r=er.empty();const i=new Vh;return t!=="undirected"&&(e!=="out"&&(r=mi(r,pd(i,n,n.in))),e!=="in"&&(r=mi(r,pd(i,n,n.out)))),t!=="directed"&&(r=mi(r,pd(i,n,n.undirected))),r}function $V(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 ie(`Graph.${n}: could not find the "${s}" node in the graph.`);return EV(r==="mixed"?this.type:r,i,o)}}function TV(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){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;c=""+c;const d=this._nodes.get(c);if(typeof d>"u")throw new ie(`Graph.${s}: could not find the "${c}" node in the graph.`);$v(!1,r==="mixed"?this.type:r,i,d,l)};const o="map"+n[0].toUpperCase()+n.slice(1);t.prototype[o]=function(c,l){const d=[];return this[s](c,(f,p)=>{d.push(l(f,p))}),d};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(c,l){const d=[];return this[s](c,(f,p)=>{l(f,p)&&d.push(f)}),d};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(c,l,d){if(arguments.length<3)throw new pe(`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 f=d;return this[s](c,(p,h)=>{f=l(f,p,h)}),f}}function SV(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!=="mixed"&&r!==this.type)return;c=""+c;const d=this._nodes.get(c);if(typeof d>"u")throw new ie(`Graph.${o}: could not find the "${c}" node in the graph.`);return $v(!0,r==="mixed"?this.type:r,i,d,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,(f,p)=>!l(f,p))}}function kV(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)return er.empty();o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new ie(`Graph.${s}: could not find the "${o}" node in the graph.`);return RV(r==="mixed"?this.type:r,i,a)}}function CV(t){DV.forEach(e=>{$V(t,e),TV(t,e),SV(t,e),kV(t,e)})}function Kh(t,e,n,r,i){const s=r._nodes.values(),o=r.type;let a,u,c,l,d,f;for(;a=s.next(),a.done!==!0;){let p=!1;if(u=a.value,o!=="undirected"){l=u.out;for(c in l){d=l[c];do f=d.target,p=!0,i(u.key,f.key,u.attributes,f.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}if(o!=="directed"){l=u.undirected;for(c in l)if(!(e&&u.key>c)){d=l[c];do f=d.target,f.key!==c&&(f=d.source),p=!0,i(u.key,f.key,u.attributes,f.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}n&&!p&&i(u.key,null,u.attributes,null,null,null,null)}}function AV(t,e){const n={key:t};return U0(e.attributes)||(n.attributes=zt({},e.attributes)),n}function _V(t,e,n){const r={key:e,source:n.source.key,target:n.target.key};return U0(n.attributes)||(r.attributes=zt({},n.attributes)),t==="mixed"&&n.undirected&&(r.undirected=!0),r}function PV(t){if(!Zt(t))throw new pe('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 pe("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!Zt(t.attributes)||t.attributes===null))throw new pe("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function xV(t){if(!Zt(t))throw new pe('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new pe("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new pe("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!Zt(t.attributes)||t.attributes===null))throw new pe("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&typeof t.undirected!="boolean")throw new pe("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const IV=O7(),NV=new Set(["directed","undirected","mixed"]),Z0=new Set(["domain","_events","_eventsCount","_maxListeners"]),OV=[{name:t=>`${t}Edge`,generateKey:!0},{name:t=>`${t}DirectedEdge`,generateKey:!0,type:"directed"},{name:t=>`${t}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:t=>`${t}EdgeWithKey`},{name:t=>`${t}DirectedEdgeWithKey`,type:"directed"},{name:t=>`${t}UndirectedEdgeWithKey`,type:"undirected"}],FV={allowSelfLoops:!0,multi:!1,type:"mixed"};function LV(t,e,n){if(n&&!Zt(n))throw new pe(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new Te(`Graph.addNode: the "${e}" node already exist in the graph.`);const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function e_(t,e,n){const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function t_(t,e,n,r,i,s,o,a){if(!r&&t.type==="undirected")throw new Te(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&t.type==="directed")throw new Te(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!Zt(a))throw new pe(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(s=""+s,o=""+o,a=a||{},!t.allowSelfLoops&&s===o)throw new Te(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=t._nodes.get(s),c=t._nodes.get(o);if(!u)throw new ie(`Graph.${e}: source node "${s}" not found.`);if(!c)throw new ie(`Graph.${e}: target node "${o}" not found.`);const l={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 Te(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!t.multi&&(r?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new Te(`Graph.${e}: an edge linking "${s}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const d=new ua(r,i,u,c,a);t._edges.set(i,d);const f=s===o;return r?(u.undirectedDegree++,c.undirectedDegree++,f&&(u.undirectedLoops++,t._undirectedSelfLoopCount++)):(u.outDegree++,c.inDegree++,f&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?d.attachMulti():d.attach(),r?t._undirectedSize++:t._directedSize++,l.key=i,t.emit("edgeAdded",l),i}function MV(t,e,n,r,i,s,o,a,u){if(!r&&t.type==="undirected")throw new Te(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&t.type==="directed")throw new Te(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(u){if(typeof a!="function")throw new pe(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!Zt(a))throw new pe(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`)}s=""+s,o=""+o;let c;if(u&&(c=a,a=void 0),!t.allowSelfLoops&&s===o)throw new Te(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l=t._nodes.get(s),d=t._nodes.get(o),f,p;if(!n&&(f=t._edges.get(i),f)){if((f.source.key!==s||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==s))throw new Te(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${s}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!t.multi&&l&&(p=r?l.undirected[o]:l.out[o]),p){const v=[p.key,!1,!1,!1];if(u?!c:!a)return v;if(u){const E=p.attributes;p.attributes=c(E),t.emit("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 v}a=a||{},u&&c&&(a=c(a));const h={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 Te(`Graph.${e}: the "${i}" edge already exists in the graph.`);let w=!1,D=!1;l||(l=e_(t,s,{}),w=!0,s===o&&(d=l,D=!0)),d||(d=e_(t,o,{}),D=!0),f=new ua(r,i,l,d,a),t._edges.set(i,f);const g=s===o;return r?(l.undirectedDegree++,d.undirectedDegree++,g&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,d.inDegree++,g&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?f.attachMulti():f.attach(),r?t._undirectedSize++:t._directedSize++,h.key=i,t.emit("edgeAdded",h),[i,!0,w,D]}function ca(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--,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 it extends Z1{constructor(e){if(super(),e=zt({},FV,e),typeof e.multi!="boolean")throw new pe(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!NV.has(e.type))throw new pe(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new pe(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const n=e.type==="mixed"?H0:e.type==="directed"?V0:K0;nr(this,"NodeDataClass",n);const r="geid_"+IV()+"_";let i=0;const s=()=>{let o;do o=r+i++;while(this._edges.has(o));return o};nr(this,"_attributes",{}),nr(this,"_nodes",new Map),nr(this,"_edges",new Map),nr(this,"_directedSize",0),nr(this,"_undirectedSize",0),nr(this,"_directedSelfLoopCount",0),nr(this,"_undirectedSelfLoopCount",0),nr(this,"_edgeKeyGenerator",s),nr(this,"_options",e),Z0.forEach(o=>nr(this,o,this[o])),gr(this,"order",()=>this._nodes.size),gr(this,"size",()=>this._edges.size),gr(this,"directedSize",()=>this._directedSize),gr(this,"undirectedSize",()=>this._undirectedSize),gr(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),gr(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),gr(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),gr(this,"multi",this._options.multi),gr(this,"type",this._options.type),gr(this,"allowSelfLoops",this._options.allowSelfLoops),gr(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.type==="undirected")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,n=""+n;const r=this._nodes.get(e);return r?r.out.hasOwnProperty(n):!1}throw new pe(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,n){if(this.type==="directed")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,n=""+n;const r=this._nodes.get(e);return r?r.undirected.hasOwnProperty(n):!1}throw new pe(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,n){if(arguments.length===1){const r=""+e;return this._edges.has(r)}else if(arguments.length===2){e=""+e,n=""+n;const r=this._nodes.get(e);return r?typeof r.out<"u"&&r.out.hasOwnProperty(n)||typeof r.undirected<"u"&&r.undirected.hasOwnProperty(n):!1}throw new pe(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,n){if(this.type==="undirected")return;if(e=""+e,n=""+n,this.multi)throw new Te("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const r=this._nodes.get(e);if(!r)throw new ie(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(n))throw new ie(`Graph.directedEdge: could not find the "${n}" target node in the graph.`);const i=r.out&&r.out[n]||void 0;if(i)return i.key}undirectedEdge(e,n){if(this.type==="directed")return;if(e=""+e,n=""+n,this.multi)throw new Te("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const r=this._nodes.get(e);if(!r)throw new ie(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(n))throw new ie(`Graph.undirectedEdge: could not find the "${n}" target node in the graph.`);const i=r.undirected&&r.undirected[n]||void 0;if(i)return i.key}edge(e,n){if(this.multi)throw new Te("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(n))throw new ie(`Graph.edge: could not find the "${n}" target node in the graph.`);const i=r.out&&r.out[n]||r.undirected&&r.undirected[n]||void 0;if(i)return i.key}areDirectedNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:n in r.in||n in r.out}areOutNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:n in r.out}areInNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:n in r.in}areUndirectedNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:n in r.undirected}areNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(n in r.in||n in r.out)||this.type!=="directed"&&n in r.undirected}areInboundNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&n in r.in||this.type!=="directed"&&n in r.undirected}areOutboundNeighbors(e,n){e=""+e,n=""+n;const r=this._nodes.get(e);if(!r)throw new ie(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&n in r.out||this.type!=="directed"&&n in r.undirected}inDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree}outDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.outDegree}directedDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree}undirectedDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree}inboundDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree),r}outboundDegree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.outDegree),r}degree(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.degree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree),r}inDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree-n.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.outDegree-n.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree-n.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree-n.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=n.undirectedDegree,i+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree,i+=n.directedLoops),r-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=n.undirectedDegree,i+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.outDegree,i+=n.directedLoops),r-i}degreeWithoutSelfLoops(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=n.undirectedDegree,i+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree,i+=n.directedLoops*2),r-i}source(e){e=""+e;const n=this._edges.get(e);if(!n)throw new ie(`Graph.source: could not find the "${e}" edge in the graph.`);return n.source.key}target(e){e=""+e;const n=this._edges.get(e);if(!n)throw new ie(`Graph.target: could not find the "${e}" edge in the graph.`);return n.target.key}extremities(e){e=""+e;const n=this._edges.get(e);if(!n)throw new ie(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[n.source.key,n.target.key]}opposite(e,n){e=""+e,n=""+n;const r=this._edges.get(n);if(!r)throw new ie(`Graph.opposite: could not find the "${n}" edge in the graph.`);const i=r.source.key,s=r.target.key;if(e===i)return s;if(e===s)return i;throw new ie(`Graph.opposite: the "${e}" node is not attached to the "${n}" edge (${i}, ${s}).`)}hasExtremity(e,n){e=""+e,n=""+n;const r=this._edges.get(e);if(!r)throw new ie(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return r.source.key===n||r.target.key===n}isUndirected(e){e=""+e;const n=this._edges.get(e);if(!n)throw new ie(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return n.undirected}isDirected(e){e=""+e;const n=this._edges.get(e);if(!n)throw new ie(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!n.undirected}isSelfLoop(e){e=""+e;const n=this._edges.get(e);if(!n)throw new ie(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return n.source===n.target}addNode(e,n){return LV(this,e,n).key}mergeNode(e,n){if(n&&!Zt(n))throw new pe(`Graph.mergeNode: invalid attributes. Expecting an object but got "${n}"`);e=""+e,n=n||{};let r=this._nodes.get(e);return r?(n&&(zt(r.attributes,n),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:r.attributes,data:n})),[e,!1]):(r=new this.NodeDataClass(e,n),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:n}),[e,!0])}updateNode(e,n){if(n&&typeof n!="function")throw new pe(`Graph.updateNode: invalid updater function. Expecting a function but got "${n}"`);e=""+e;let r=this._nodes.get(e);if(r){if(n){const s=r.attributes;r.attributes=n(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:r.attributes})}return[e,!1]}const i=n?n({}):{};return r=new this.NodeDataClass(e,i),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const n=this._nodes.get(e);if(!n)throw new ie(`Graph.dropNode: could not find the "${e}" node in the graph.`);let r;if(this.type!=="undirected"){for(const i in n.out){r=n.out[i];do ca(this,r),r=r.next;while(r)}for(const i in n.in){r=n.in[i];do ca(this,r),r=r.next;while(r)}}if(this.type!=="directed")for(const i in n.undirected){r=n.undirected[i];do ca(this,r),r=r.next;while(r)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})}dropEdge(e){let n;if(arguments.length>1){const r=""+arguments[0],i=""+arguments[1];if(n=tr(this,r,i,this.type),!n)throw new ie(`Graph.dropEdge: could not find the "${r}" -> "${i}" edge in the graph.`)}else if(e=""+e,n=this._edges.get(e),!n)throw new ie(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return ca(this,n),this}dropDirectedEdge(e,n){if(arguments.length<2)throw new Te("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Te("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,n=""+n;const r=tr(this,e,n,"directed");if(!r)throw new ie(`Graph.dropDirectedEdge: could not find a "${e}" -> "${n}" edge in the graph.`);return ca(this,r),this}dropUndirectedEdge(e,n){if(arguments.length<2)throw new Te("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Te("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const r=tr(this,e,n,"undirected");if(!r)throw new ie(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${n}" edge in the graph.`);return ca(this,r),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let n;for(;n=e.next(),n.done!==!0;)n.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,n){return this._attributes[e]=n,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,n){if(typeof n!="function")throw new pe("Graph.updateAttribute: updater should be a function.");const r=this._attributes[e];return this._attributes[e]=n(r),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!Zt(e))throw new pe("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(!Zt(e))throw new pe("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")throw new pe("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 pe("Graph.updateEachNodeAttributes: expecting an updater function.");if(n&&!W0(n))throw new pe("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._nodes.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 pe("Graph.updateEachEdgeAttributes: expecting an updater function.");if(n&&!W0(n))throw new pe("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.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 pe("Graph.forEachAdjacencyEntry: expecting a callback.");Kh(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new pe("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Kh(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new pe("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Kh(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new pe("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Kh(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):j0(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new pe("Graph.forEachNode: expecting a callback.");const n=this._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 pe("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 pe("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(i.key,i.attributes);return s}someNode(e){if(typeof e!="function")throw new pe("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 pe("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 pe("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 pe("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new pe("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 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 er(()=>{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++]=AV(s,i)});const r=new Array(this._edges.size);return n=0,this._edges.forEach((i,s)=>{r[n++]=_V(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 it)return e.forEachNode((u,c)=>{n?this.mergeNode(u,c):this.addNode(u,c)}),e.forEachEdge((u,c,l,d,f,p,h)=>{n?h?this.mergeUndirectedEdgeWithKey(u,l,d,c):this.mergeDirectedEdgeWithKey(u,l,d,c):h?this.addUndirectedEdgeWithKey(u,l,d,c):this.addDirectedEdgeWithKey(u,l,d,c)}),this;if(!Zt(e))throw new pe("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!Zt(e.attributes))throw new pe("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 pe("Graph.import: invalid nodes. Expecting an array.");for(r=0,i=s.length;r<i;r++){o=s[r],PV(o);const{key:u,attributes:c}=o;n?this.mergeNode(u,c):this.addNode(u,c)}}if(e.edges){let u=!1;if(this.type==="undirected"&&(u=!0),s=e.edges,!Array.isArray(s))throw new pe("Graph.import: invalid edges. Expecting an array.");for(r=0,i=s.length;r<i;r++){a=s[r],xV(a);const{source:c,target:l,attributes:d,undirected:f=u}=a;let p;"key"in a?(p=n?f?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:f?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,p.call(this,a.key,c,l,d)):(p=n?f?this.mergeUndirectedEdge:this.mergeDirectedEdge:f?this.addUndirectedEdge:this.addDirectedEdge,p.call(this,c,l,d))}}return this}nullCopy(e){const n=new it(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 Te(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new Te("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 Te("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not 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,t_(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.key,d;s.undirected&&c>l&&(d=c,c=l,l=d);const f=`(${c})${a}(${l})`;o.startsWith("geid_")?this.multi&&(typeof r[f]>"u"?r[f]=0:r[f]++,u+=`${r[f]}. `):u+=`[${o}]: `,u+=f,n[u]=s.attributes});const i={};for(const s in this)this.hasOwnProperty(s)&&!Z0.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(i[s]=this[s]);return i.attributes=this._attributes,i.nodes=e,i.edges=n,nr(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(it.prototype[Symbol.for("nodejs.util.inspect.custom")]=it.prototype.inspect),OV.forEach(t=>{["add","merge","update"].forEach(e=>{const n=t.name(e),r=e==="add"?t_:MV;t.generateKey?it.prototype[n]=function(i,s,o){return r(this,n,!0,(t.type||this.type)==="undirected",null,i,s,o,e==="update")}:it.prototype[n]=function(i,s,o,a){return r(this,n,!1,(t.type||this.type)==="undirected",i,s,o,a,e==="update")}})}),V7(it),iV(it),bV(it),CV(it);class n_ extends it{constructor(e){const n=zt({type:"directed"},e);if("multi"in n&&n.multi!==!1)throw new pe("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="directed")throw new pe('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class r_ extends it{constructor(e){const n=zt({type:"undirected"},e);if("multi"in n&&n.multi!==!1)throw new pe("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="undirected")throw new pe('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class i_ extends it{constructor(e){const n=zt({multi:!0},e);if("multi"in n&&n.multi!==!0)throw new pe("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(n)}}class s_ extends it{constructor(e){const n=zt({type:"directed",multi:!0},e);if("multi"in n&&n.multi!==!0)throw new pe("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="directed")throw new pe('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class o_ extends it{constructor(e){const n=zt({type:"undirected",multi:!0},e);if("multi"in n&&n.multi!==!0)throw new pe("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="undirected")throw new pe('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}function la(t){t.from=function(e,n){const r=zt({},e.options,n),i=new t(r);return i.import(e),i}}la(it),la(n_),la(r_),la(i_),la(s_),la(o_),it.Graph=it,it.DirectedGraph=n_,it.UndirectedGraph=r_,it.MultiGraph=i_,it.MultiDirectedGraph=s_,it.MultiUndirectedGraph=o_,it.InvalidArgumentsGraphError=pe,it.NotFoundGraphError=ie,it.UsageGraphError=Te;const Tv="dashed",Sv=Gn.font;class kv{constructor(e){this.view=e,this.compoundIds=new Set(e.nodes.filter(qn).map(r=>r.id)),this.edgesWithCompounds=new Set(this.compoundIds.size>0?e.edges.filter(r=>this.compoundIds.has(r.source)||this.compoundIds.has(r.target)).map(r=>r.id):[]);for(const r of e.nodes)this.graphology.addNode(r.id,{origin:r,level:r.level,depth:r.depth??0,modelRef:TD.modelRef(r),deploymentRef:TD.deploymentRef(r),maxConnectedHierarchyDistance:0});for(const r of e.edges){let i=this.graphology.getNodeAttribute(r.source,"deploymentRef"),s=this.graphology.getNodeAttribute(r.target,"deploymentRef");(i===null||s===null)&&(i=this.graphology.getNodeAttribute(r.source,"modelRef"),s=this.graphology.getNodeAttribute(r.target,"modelRef"));let o=-1;i!==null&&s!==null?o=F1(i,s):Bt.warn(`Edge ${r.id} of view ${e.id} is invalid, sourceFqn: ${i}, targetFqn: ${s}`),this.graphology.addEdgeWithKey(r.id,r.source,r.target,{origin:r,hierarchyDistance:o,weight:1}),o>this.graphology.getNodeAttribute(r.source,"maxConnectedHierarchyDistance")&&this.graphology.mergeNodeAttributes(r.source,{maxConnectedHierarchyDistance:o}),o>this.graphology.getNodeAttribute(r.target,"maxConnectedHierarchyDistance")&&this.graphology.mergeNodeAttributes(r.target,{maxConnectedHierarchyDistance:o})}this.graphology.forEachEdge((r,{hierarchyDistance:i},s,o,a,u)=>{const c=Math.max(a.maxConnectedHierarchyDistance,u.maxConnectedHierarchyDistance);if(c>i)this.graphology.mergeEdgeAttributes(r,{weight:c-i+1});else{const l=this.graphology.directedDegree(s),d=this.graphology.directedDegree(o);l===1&&d===1&&i>1&&this.graphology.mergeEdgeAttributes(r,{weight:i})}});const n=this.graphvizModel=this.createGraph();this.applyNodeAttributes(n.attributes.node),this.applyEdgeAttributes(n.attributes.edge)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphology=new it({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(u);if(qn(c))n(c,a);else{const l=dn(this.getGraphNode(c.id),`Graphviz Node not found for ${c.id}`);a.node(l.id)}}},r=[];for(const i of this.view.nodes)if(qn(i))Dt(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(){const e=this.graphvizModel;return this.build(e),this.postBuild(e),A0(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){const e=this.view.autoLayout,n=c7({[I.bgcolor]:"transparent",[I.layout]:"dot",[I.compound]:!0,[I.rankdir]:e.direction,[I.TBbalance]:"min",[I.splines]:"spline",[I.outputorder]:"nodesfirst",[I.nodesep]:dt(e.nodeSep??110),[I.ranksep]:dt(e.rankSep??120),[I.pad]:dt(15),[I.fontname]:Sv});return n.attributes.graph.apply({[I.fontsize]:Zn(15),[I.labeljust]:e.direction==="RL"?"r":"l",[I.labelloc]:e.direction==="BT"?"b":"t",[I.margin]:50.1}),n}applyNodeAttributes(e){e.apply({[I.fontname]:Sv,[I.shape]:"rect",[I.width]:dt(320),[I.height]:dt(180),[I.fillcolor]:Gn.elements[po].fill,[I.fontcolor]:Gn.elements[po].hiContrast,[I.color]:Gn.elements[po].stroke,[I.style]:"filled",[I.penwidth]:0})}applyEdgeAttributes(e){e.apply({[I.arrowsize]:.75,[I.fontname]:Sv,[I.fontsize]:Zn(14),[I.penwidth]:Zn(2),[I.color]:Gn.relationships[va].lineColor,[I.fontcolor]:Gn.relationships[va].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(e),e)}generateGraphvizId(e){const n=qn(e);let r=Ld(e.id).toLowerCase(),i=this.checkNodeId(r,n);if(i!==null)return i;r=Ld(e.id).toLowerCase();let s=1;do i=this.checkNodeId(r+"_"+s++,n);while(i===null);return i}elementToSubgraph(e,n){Ce(qn(e),"node should be compound"),Ce(gp(e.depth),"node.depth should be defined");const r=this.getElementColorValues(e.color),i=R7(r.loContrast);return n.apply({[I.likec4_id]:e.id,[I.likec4_level]:e.level,[I.likec4_depth]:e.depth,[I.fillcolor]:I0(r.fill,e.depth),[I.color]:I0(r.stroke,e.depth),[I.style]:"filled",[I.margin]:Zn(e.children.length>1?40:32)}),_s(e.title.trim())||n.set(I.label,S7(e,i)),n}elementToNode(e,n){Ce(!qn(e),"node should not be compound");const r=ae(e.icon),i=this.getElementColorValues(e.color);switch(n.attributes.apply({[I.likec4_id]:e.id,[I.likec4_level]:e.level,[I.label]:T7(e,i),[I.margin]:`${dt(r?10:26)},${dt(26)}`}),e.color!==po&&n.attributes.apply({[I.fillcolor]:i.fill,[I.fontcolor]:i.hiContrast,[I.color]:i.stroke}),e.shape){case"cylinder":case"storage":{n.attributes.apply({[I.margin]:`${dt(r?10:26)},${dt(0)}`,[I.penwidth]:Zn(2),[I.shape]:"cylinder"});break}case"browser":{n.attributes.apply({[I.margin]:`${dt(r?10:30)},${dt(32)}`});break}case"mobile":{n.attributes.apply({[I.margin]:`${dt(r?10:30)},${dt(26)}`});break}case"queue":{n.attributes.apply({[I.width]:dt(320),[I.height]:dt(165),[I.margin]:`${dt(r?10:30)},${dt(26)}`});break}}return n}leafElements(e){return e===null?this.view.nodes.filter(n=>!qn(n)):this.computedNode(e).children.flatMap(n=>{const r=this.computedNode(n);return qn(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.descendants(r.id)]})}computedNode(e){return dn(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||(Ce(qn(r),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,Ce(s,`subgraph ${e} not found`),r=dn(n(this.leafElements(e)),`leaf element in ${e} not found`),i=dn(this.getGraphNode(r.id),`source graphviz node ${r.id} not found`)),[r,i,s]}findInternalEdges(e){if(e===null)return this.view.edges.slice();const n=this.computedNode(e);return Qe(this.descendants(e),Ii(r=>PS(r.inEdges,r.outEdges)),Vy(),OG(PS(n.inEdges,n.outEdges)),gn(r=>this.view.edges.find(i=>i.id===r)),Ge(ae))}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=Qe(this.view.nodes,Ge(qn),gn(r=>r.id),TS(L1),SS(),gn(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}}),Ge(({edges:r})=>r.length>1&&r.length<8),Kj(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=dn(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),a=dn(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);n.add(s.source),n.add(s.target),o.attributes.set(I.group,r.id),a.attributes.set(I.group,r.id)}catch(o){Bt.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=dt(a.center.x)+r,l=dt(e-a.center.y);a.fixedsize?u.attributes.apply({[I.pos]:`${c},${l}!`,[I.pin]:!0,[I.width]:dt(a.fixedsize.width),[I.height]:dt(a.fixedsize.height),[I.fixedsize]:!0}):u.attributes.set(I.pos,`${c},${l}`)}for(const[o,a]of this.edges.entries()){a.attributes.delete(I.weight),a.attributes.delete(I.minlen),a.attributes.delete(I.constraint);const u=n.edges.find(c=>c.id===o)?.dotpos;u&&!s&&a.attributes.set(I.pos,u)}return this.graphvizModel.apply({[I.layout]:"fdp",[I.overlap]:"vpsc",[I.sep]:"+50,50",[I.esep]:"+10,10",[I.start]:"random2",[I.splines]:"compound"}),this.graphvizModel.delete(I.compound),this.graphvizModel.delete(I.rankdir),this.graphvizModel.delete(I.nodesep),this.graphvizModel.delete(I.ranksep),this.graphvizModel.delete(I.pack),this.graphvizModel.delete(I.pad),this.graphvizModel.delete(I.packmode),this.graphvizModel.attributes.graph.delete(I.margin),this}getRelationshipColorValues(e){return yD(e)?Gn.relationships[e]:this.view.customColorDefinitions[e]?.relationships??Gn.relationships[po]}getElementColorValues(e){return yD(e)?Gn.elements[e]:this.view.customColorDefinitions[e]?.elements??Gn.elements[po]}}class BV extends kv{createGraph(){const e=super.createGraph(),n=this.view.autoLayout;return e.delete(I.TBbalance),e.apply({[I.nodesep]:dt(n.nodeSep??130),[I.ranksep]:dt(n.rankSep??130)}),e}postBuild(e){Qe(this.view.nodes,gn(n=>({node:n,graphvizNode:this.getGraphNode(n.id)})),Ps(({node:n,graphvizNode:r})=>{if(r!=null)return Md.modelRef(n)??void 0}),Ou(),Ge(As(2)),EG(n=>{e.subgraph({[I.rank]:"same"},r=>{for(const{graphvizNode:i}of n)r.node(dn(i).id)})}),Qj(()=>{e.set(I.newrank,!0),e.set(I.clusterrank,"global"),e.delete(I.pack),e.delete(I.packmode)}))}elementToSubgraph(e,n){const r=super.elementToSubgraph(e,n);return e.children.length>1&&r.set(I.margin,Zn(50)),r}addEdge(e,n){const[r,i]=[e.source,e.target],[s,o,a]=this.edgeEndpoint(r,g=>Mu(g)),[u,c,l]=this.edgeEndpoint(i,No),d=sn(l)||sn(a),f=n.edge([o,c],{[I.likec4_id]:e.id,[I.style]:e.line??Tv});l&&f.attributes.set(I.lhead,l),a&&f.attributes.set(I.ltail,a);const p=this.graphology.getEdgeAttribute(e.id,"weight");p>1&&!this.graphology.hasDirectedEdge(e.target,e.source)&&f.attributes.set(I.weight,p);const h=F0(e);if(h&&f.attributes.set(d?I.xlabel:I.label,h),e.color){const g=this.getRelationshipColorValues(e.color);f.attributes.apply({[I.color]:g.lineColor,[I.fontcolor]:g.labelColor})}let[w,D]=[e.head??us,e.tail??"none"];return w==="none"&&D==="none"?(f.attributes.apply({[I.arrowtail]:"none",[I.arrowhead]:"none",[I.dir]:"none"}),f):e.dir==="both"?(f.attributes.apply({[I.arrowhead]:an(w),[I.arrowtail]:an(e.tail??w),[I.dir]:"both"}),!d&&Md.modelRef(s)!==Md.modelRef(u)&&f.attributes.set(I.constraint,!1),f):(w!==us&&f.attributes.set(I.arrowhead,an(w)),D!=="none"&&f.attributes.set(I.arrowtail,an(D)),f)}}class uD extends kv{static toDot(e){return new uD(e).print()}postBuild(e){e.set(I.TBbalance,"max")}addEdge(e,n){const{nodes:r}=this.view,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[o,a,u]=this.edgeEndpoint(i,k=>Mu(k)),[c,l,d]=this.edgeEndpoint(s,No),f=n.edge([a,l],{[I.likec4_id]:e.id,[I.style]:e.line??Tv});if(d&&f.attributes.set(I.lhead,d),u&&f.attributes.set(I.ltail,u),e.color&&e.color!==va){const k=this.getRelationshipColorValues(e.color);f.attributes.apply({[I.color]:k.lineColor,[I.fontcolor]:k.labelColor})}const p=[e.label?.trim(),e.technology?.trim()].filter(ae).join(`
211
+ `),h=M1(e.id),w=k7(h,p);f.attributes.set(I.label,w);const D=this.graphology.getEdgeAttribute(e.id,"weight");e.source!==e.target&&D>1&&f.attributes.set(I.weight,D);const g=r.findIndex(k=>k.id===i);r.findIndex(k=>k.id===s)<g&&e.dir!=="back"&&f.attributes.apply({[I.constraint]:!1});let[v,E]=[e.head??us,e.tail??"none"];return e.dir==="back"?(f.attributes.apply({[I.arrowtail]:an(v),[I.minlen]:0,[I.dir]:"back"}),E!=="none"&&f.attributes.apply({[I.arrowhead]:an(E),[I.dir]:"both"}),f):v==="none"&&E==="none"||v!=="none"&&E!=="none"?(f.attributes.apply({[I.arrowhead]:an(v),[I.arrowtail]:an(E),[I.dir]:"both"}),f):v==="none"?(f.attributes.delete(I.arrowhead),f.attributes.apply({[I.arrowtail]:an(E),[I.minlen]:0,[I.dir]:"back"}),f):(v!==us&&f.attributes.set(I.arrowhead,an(v)),f)}}class zV extends kv{postBuild(e){this.assignGroups();const n=new Set,r=this.view.nodes.reduce((s,o)=>(qn(o)&&(n.add(o.id),s.push(o)),s),[]);let i=!1;for(const s of r){const o=Qe(s.children,Ge(l=>!this.compoundIds.has(l)),gn(l=>this.computedNode(l)),Ge(l=>l.inEdges.length===0&&l.outEdges.length===0));if(o.length<=2)continue;let a=2;switch(!0){case o.length>11:a=4;break;case o.length>4:a=3;break}const u=dn(this.getSubgraph(s.id),`Subgraph not found for ${s.id}`);let c=null;BG(o,a).forEach(l=>{const d=l.length>1?u.createSubgraph({[I.rank]:"same"}):null;l.forEach((f,p)=>{const h=this.getGraphNode(f.id);h&&(d?.node(h.id),p===0&&(c&&u.edge([c,h],{[I.style]:"invis"}),c=h))}),i=i||!!d})}i&&(e.set(I.newrank,!0),e.set(I.clusterrank,"global"))}addEdge(e,n){const[r,i]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[s,o,a]=this.edgeEndpoint(r,E=>Mu(E)),[u,c,l]=this.edgeEndpoint(i,No),d=e.parent,f=this.graphology.getEdgeAttributes(e.id),p=n.edge([o,c],{[I.likec4_id]:e.id,[I.style]:e.line??Tv});l&&p.attributes.set(I.lhead,l),a&&p.attributes.set(I.ltail,a);const h=sn(l)||sn(a);!this.graphology.hasDirectedEdge(e.target,e.source)&&f.weight>1&&p.attributes.set(I.weight,f.weight);const w=F0(e);if(w&&p.attributes.set(h?I.xlabel:I.label,w),e.color){const E=this.getRelationshipColorValues(e.color);p.attributes.apply({[I.color]:E.lineColor,[I.fontcolor]:E.labelColor})}let[D,g]=[e.head??us,e.tail??"none"];if(e.dir==="back")return p.attributes.apply({[I.arrowtail]:an(D),[I.dir]:"back"}),g!=="none"&&p.attributes.apply({[I.arrowhead]:an(g),[I.dir]:"both",[I.minlen]:0}),p;if(D==="none"&&g==="none")return p.attributes.apply({[I.arrowtail]:"none",[I.arrowhead]:"none",[I.dir]:"none",[I.minlen]:0,[I.constraint]:!1}),p;if(D!=="none"&&g!=="none")return p.attributes.apply({[I.arrowhead]:an(D),[I.arrowtail]:an(g),[I.dir]:"both",[I.minlen]:0}),p;if(D!==us&&p.attributes.set(I.arrowhead,an(D)),g!=="none"&&p.attributes.set(I.arrowtail,an(g)),this.view.edges.length===1)return p;let v;return d===null&&s.parent==null&&u.parent==null?v=this.view.edges.filter(E=>{if(E.id===e.id||E.parent!==null||E.source===e.source&&E.target===e.target||E.source===e.target&&E.target===e.source)return!1;const k=this.computedNode(E.source),P=this.computedNode(E.target);return qn(k)||qn(P)?!1:k.parent==null&&P.parent==null}):v=this.findInternalEdges(d).filter(E=>!(E.id===e.id||E.source===e.source&&E.target===e.target||E.source===e.target&&E.target===e.source)),v.length===0&&(d===null||this.leafElements(d).length<=3)&&p.attributes.set(I.minlen,0),p}}function Yh(t){const[e,n,r,i]=t?t.split(",").map(a=>Fr(+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 qV(t){try{const[e,n]=t.split(",");return{x:Fr(parseFloat(e)),y:Fr(parseFloat(n))}}catch(e){throw new Error(`Failed on parsing pos: ${t}`,{cause:e})}}function a_(t){const{x:e,y:n}=qV(t.pos),r=x0(parseFloat(t.width)),i=x0(parseFloat(t.height));return{x:e-Math.round(r/2),y:n-Math.round(i/2),width:r,height:i}}function u_(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=Fr(c.size);continue}if(c.op==="T"){let l=Fr(c.pt[0])-e,d=Fr(c.width);switch(c.align){case"r":l-=d;break;case"c":l-=Math.round(d/2);break}r=Math.min(r,l),s=Math.max(s,l+d);let f=Fr(c.pt[1])-n;i=Math.min(i,Math.round(f-a)),o=Math.max(o,f)}}}catch(c){return Bt.warn(`Failed on parsing label draw ops: ${c}
212
+ ${JSON.stringify(t,null,2)}`),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 c_({_draw_:t,likec4_id:e="???"},n="<unknown view>"){try{const r=t.filter(s=>s.op.toLowerCase()==="b");Ce(As(r,1),`view ${n} edge ${e} should have at least one bezier draw op`),r.length>1&&Bt.warn(`view ${n} edge ${e} has more than one bezier draw op, using the first one only`);const i=r[0].points.map(s=>Fr(s));return Ce(As(i,2),`view ${n} edge ${e} should have at least two points`),i}catch(r){throw new Error(`failed on parsing view ${n} edge ${e} _draw_:
213
+ ${JSON.stringify(t,null,2)}`,{cause:r})}}function jV(t,{id:e,source:n,target:r,dir:i,label:s,description:o,...a},u){const c=u_(t._ldraw_??t._tldraw_??t._hldraw_),l=t.dir==="back"||i==="back";return s=s&&c?N0(s,{maxchars:Wh,maxLines:O0}).join(`
214
+ `):null,{id:e,source:n,target:r,label:s,...ae(o)&&{description:o},...ae(t.pos)&&{dotpos:t.pos},points:c_(t,u),labelBBox:c,...l?{dir:"back"}:{},...a}}function l_(t,e){const n=JSON.parse(t),r=Yh(n.bb),{nodes:i,edges:s,manualLayout:o,...a}=e,u={...a,bounds:r,nodes:[],edges:[]},c=n.objects??[];for(const d of i){const f=c.find(p=>p.likec4_id===d.id);Ce(f,`View ${a.id} node ${d.id} not found in graphviz output`);try{const{x:p,y:h,width:w,height:D}="bb"in f?Yh(f.bb):a_(f),g=[p,h];u.nodes.push({...d,position:g,width:w,height:D,labelBBox:u_(f._ldraw_,g)??{x:p,y:h,width:w,height:D}})}catch(p){throw new Error(`Failed on parsing node ${d.id}:
215
+ ${JSON.stringify(f,null,2)}`,{cause:p})}}const l=n.edges??[];for(const d of s){const f=l.find(p=>p.likec4_id===d.id);if(!f){Bt.warn(`View ${a.id} edge ${d.id} not found in graphviz output, skipping`);continue}u.edges.push(jV(f,d,a.id))}return u}const Xh=t=>String(t+1).padStart(2,"0");function GV(t){const e=JSON.parse(t),n=Yh(e.bb),r={nodes:[],edges:[],bounds:n},i=new Map,s=e.objects??[];for(const o of s){if(!o.likec4_type)continue;const a=Xh(o._gvid),u=o.likec4_path??"",c=i.get(o._gvid),{x:l,y:d,width:f,height:p}="bb"in o?Yh(o.bb):a_(o),h={x:l,y:d};if(o.likec4_type==="view")Ce(o.likec4_id,`View ${o} has no likec4_id`),r.nodes.push({id:a,type:"view",parentId:c?.id??null,height:p,width:f,position:h,label:o.label??"",viewId:o.likec4_id});else{const w={id:a,type:o.likec4_type,parentId:c?.id??null,height:p,width:f,position:h,path:u,label:o.label??""},D=[..."subgraphs"in o?o.subgraphs:[],..."nodes"in o?o.nodes:[]];for(const g of D)i.set(g,w);r.nodes.push(w)}}for(const o of e.edges??[])try{const a=Xh(o.tail),u=Xh(o.head);r.edges.push({id:`link${Xh(o._gvid)}`,source:a,target:u,points:c_(o)})}catch(a){Bt.warn(a)}return r}const d_=Gn.font,Jh="/";class cD{static toDot(e){return new cD(e).print()}subgraphs=new Map;graphvizModel;constructor(e){const n=this.graphvizModel=l7.graph({[I.layout]:"osage",[I.pack]:Zn(100),[I.packmode]:"array_ltc",[I.pad]:dt(15),[I.fontname]:d_,[I.splines]:"polyline",[I.esep]:"+20"});n.attributes.graph.apply({[I.fontsize]:Zn(20),[I.labeljust]:"l",[I.labelloc]:"t"}),n.attributes.node.apply({[I.fontname]:d_,[I.shape]:"rect",[I.width]:dt(400),[I.height]:dt(300),[I.fixedsize]:!0,[I.fontsize]:10}),n.attributes.edge.apply({[I.penwidth]:Zn(2)});const r=new Set(e.map(u=>u.relativePath??""));let i=0,s=[...e];const o=r.size>1;o&&s.sort((u,c)=>{const l=u.relativePath?.split(Jh)??[""],d=c.relativePath?.split(Jh)??[""];l.push(u.title??"Untitled"),d.push(c.title??"Untitled");const f=l.length,p=d.length;switch(i=Math.max(i,f,p),!0){case f>p:return-1;case f<p:return 1;default:{for(let h=0;h<f;h++){const w=l[h].localeCompare(d[h]);if(w!==0)return w}return 0}}});const a=new Map;s.forEach((u,c)=>{this.addView(o?u:{...u,relativePath:""},c+i);const l=u.nodes.reduce((d,f)=>(f.navigateTo&&d.add(f.navigateTo),d),new Set);l.size>0&&a.set(u.id,l)});for(const[u,c]of a)for(const l of c)n.edge([u,l])}getParentForPath(e){if(e==="")return this.graphvizModel;const n=e.toLowerCase();let r=this.subgraphs.get(n);if(!r){const i=n.endsWith(".c4")||n.endsWith(".likec4"),s=e.includes(Jh)?e.slice(0,e.lastIndexOf(Jh)):"";r=this.getParentForPath(s).subgraph("cluster"+String(this.subgraphs.size+1),{[I.likec4_type]:i?"file":"folder",[I.likec4_path]:e,[I.sortv]:this.subgraphs.size,[I.label]:ae(s)?e.slice(s.length+1):e}),this.subgraphs.set(n,r)}return r}addView(e,n=0){return this.getParentForPath(e.relativePath??"").node(e.id,{[I.likec4_type]:"view",[I.likec4_id]:e.id,[I.sortv]:n,[I.label]:e.title||"Untitled"})}print(){return A0(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}}const f_=t=>{switch(!0){case ba.isDynamic(t):return new uD(t);case ba.isDeployment(t):return new BV(t);case ba.isElement(t):return new zV(t);default:Oe(t)}};class p_{constructor(e){this.graphviz=e}get port(){return this.graphviz}changePort(e){this.graphviz=e}async layout(e){try{let n=await this.dot(e);const r=await this.graphviz.layoutJson(n);let i=l_(r,e);if(e.manualLayout){const s=$H(i,e.manualLayout);if(s.diagram)i=s.diagram;else{if(s.relayout.nodes.length>0){const o=f_(e);if(o.hasEdgesWithCompounds)Bt.warn(`Manual layout for view ${e.id} is ignored, as edges with compounds are not supported`);else{o.applyManualLayout(s.relayout);const a=await this.graphviz.layoutJson(o.print());i=l_(a,e)}}i.hasLayoutDrift=!0}}return n=n.split(`
216
+ `).filter(s=>!(s.includes("margin")&&s.includes("50.1"))).join(`
217
+ `),{dot:n,diagram:i}}catch(n){throw new Error(`Error during layout: ${e.id}`,{cause:n})}}async svg(e){let n=await this.dot(e);return n=n.split(`
218
+ `).filter(r=>!(r.includes("margin")&&r.includes("50.1"))).join(`
219
+ `),{svg:await this.graphviz.svg(n),dot:n}}async dot(e){let n=f_(e).print();if(!ba.isElement(e))return n;try{return await this.graphviz.unflatten(n)}catch(r){return Bt.warn(`Error during unflatten: ${e.id}`,r),n}}async layoutOverviewGraph(e){if(e.length===0)return Promise.resolve({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}});const n=cD.toDot(e),r=await this.graphviz.layoutJson(n);return GV(r)}}class UV{value;next;constructor(e){this.value=e}}class WV{#e;#t;#n;constructor(){this.clear()}enqueue(e){const n=new UV(e);this.#e?(this.#t.next=n,this.#t=n):(this.#e=n,this.#t=n),this.#n++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}}function Cv(t){h_(t);const e=new WV;let n=0;const r=()=>{n<t&&e.size>0&&(e.dequeue()(),n++)},i=()=>{n--,r()},s=async(u,c,l)=>{const d=(async()=>u(...l))();c(d);try{await d}catch{}i()},o=(u,c,l)=>{new Promise(d=>{e.enqueue(d)}).then(s.bind(void 0,u,c,l)),(async()=>(await Promise.resolve(),n<t&&r()))()},a=(u,...c)=>new Promise(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){h_(u),t=u,queueMicrotask(()=>{for(;n<t&&e.size>0;)r()})}}}),a}function h_(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 HV=Cv(1);class wa{static _graphviz=null;graphviz(){return Promise.resolve().then(()=>wa._graphviz??=Bm.load())}async attempt(e,n,r){return await HV(async()=>{const i=Bt.withTag("graphviz-wasm");try{return await r()}catch(s){i.error(`FAILED GraphvizWasm.${e}`,s),i.warn(`FAILED DOT:
220
+ ${n}`),Bm.unload(),wa._graphviz=null}i.warn("Retrying..."),await B1(50,300);try{return await r()}finally{Bm.unload(),wa._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,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"))}}function En(t){return t.el.ref}function Qh(t){const e=[t.el.$refText];let n=t.parent;for(;n;)e.push(n.el.$refText),n=n.parent;return e.length===1?e[0]:e.reverse().join(".")}const hd=Symbol.for("idattr"),Zh={writeId(t,e){return t[hd]=e,t},readId(t){return t[hd]}},md={writeId(t,e){return Dt(e)?t[hd]=void 0:t[hd]=e,t},readId(t){return t[hd]}};function gd(t){return t.textDocument.languageId===Xw.languageId}function Av(t){return gd(t)&&t.state>=je.IndexedContent&&!!t.c4fqnIndex}function da(t){return gd(t)&&t.state==je.Validated&&!!t.c4Specification&&!!t.c4Elements&&!!t.c4Relations&&!!t.c4Views&&!!t.c4fqnIndex&&!!t.c4Deployments&&!!t.c4DeploymentRelations}function*VV(t){const e=Om.from(t.parseResult.value.models.flatMap(i=>i.elements)),n=[];let r;for(;r=e.shift();){if(Nr(r)){n.push(r);continue}if(Go(r)){if(r.body&&r.body.elements.length>0)for(const i of r.body.elements)e.push(i);continue}if(r.body&&r.body.elements.length>0)for(const i of r.body.elements)e.push(i);yield r}yield*n}function*KV(t){const e=Om.from(t.parseResult.value.deployments.flatMap(i=>i.elements)),n=[];let r;for(;r=e.shift();){if(Bi(r)){n.push(r);continue}if(bn(r)&&r.body&&r.body.elements.length>0)for(const i of r.body.elements)e.push(i);yield r}yield*n}function YV(t){const e=En(t.target);if(!e)throw new Error("RelationRefError: Invalid reference to target");if(Jt(t.source)){const n=En(t.source);if(!n)throw new Error("RelationRefError: Invalid reference to source");return{source:n,target:e}}if(!Yc(t.$container))throw new Error("RelationRefError: Invalid container for sourceless relation");return{source:t.$container.$container,target:e}}function m_({value:t}){const e=parseFloat(t);return isNaN(e)?100:xS(e,{min:0,max:100})}function Yi(t,e){const n={};if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case jp(r):{ae(r.value)&&(n.border=r.value);break}case js(r):{const i=yd(r);ae(i)&&(n.color=i);break}case kh(r):{ae(r.value)&&(n.shape=r.value);break}case Ir(r):{const i=r.libicon?.ref?.name??r.value;ae(i)&&(n.icon=i);break}case Eh(r):{n.opacity=m_(r);break}case qw(r):{n.multiple=Yy(r.value)?r.value:!1;break}default:Oe(r)}return n}function XV(t,e){const n={};if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case js(r):{const i=yd(r);ae(i)&&(n.color=i);break}case vl(r):{n.line=r.value;break}case Bc(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 _v(t,e){const{color:n,line:r,head:i,tail:s}=XV(t?.filter(qC),e);return{...n&&n!==va?{color:n}:{},...r&&r!==z1?{line:r}:{},...i&&i!==us?{head:i}:{},...s?{tail:s}:{}}}function yd(t){return t?.themeColor??t?.customColor?.$refText}function Pv(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 JV(t){switch(t){case"TB":return"TopBottom";case"BT":return"BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:Oe(t)}}function g_(t){if(bw(t))return t;if(Ow(t))return t.subject;if(ih(t))return g_(t.subject);Oe(t)}class QV{parser;locator;constructor(e){this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getDocumentation(e){try{if(bn(e)){const n=wt(e),r=this.parser.forDocument(n).parseDeploymentNode(e),i=[r.id];return r.title!==e.name&&i.push(" ",`**${r.title}**`),i.join(`
221
+ `)}if(pr(e)){const n=wt(e),r=this.parser.forDocument(n).parseDeployedInstance(e),i=this.locator.getParsedElement(r.element),s=[r.id,`_instance of_ ${r.element}`];return i&&s.push(" ",`**${i.title}**`),s.join(`
222
+ `)}if(zn(e)){const n=wt(e),r=this.parser.forDocument(n).parseElement(e);return r?[r.id," ",`**${r.title}**`].join(`
223
+ `):void 0}}catch(n){ve(n)}}}function ZV(t,e){return[t,e]=xv(t,e)>0?[e,t]:[t,e],e5(t.range,e.range.start)}function xv(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 e5(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 em(t){return t.range.start.line!=t.range.end.line}const Q={newLine:Ni.newLine({allowMore:!0}),oneSpace:Ni.oneSpace(),noSpace:Ni.noSpace(),indent:Ni.indent({allowMore:!0}),noIndent:Ni.noIndent()};class t5 extends hU{format(e){this.removeIndentFromTopLevelStatements(e),this.indentContentInBraces(e),this.formatSpecificationRule(e),this.formatGlobals(e),this.formatElementDeclaration(e),this.formatRelation(e),this.formatMetadataProperty(e),this.formatDeploymentNodeDeclaration(e),this.formatDeployedInstance(e),this.formatDeploymentRelation(e),this.formatView(e),this.formatViewRuleGroup(e),this.formatViewRuleGlobalStyle(e),this.formatViewRuleGlobalPredicate(e),this.formatIncludeExcludeExpressions(e),this.formatDeploymentViewRulePredicateExpressions(e),this.formatWhereExpression(e),this.formatWhereExpressionV2(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,Kw,(n,r)=>{r.cst(wo(n.$cstNode,"values").slice(1)).prepend(Q.oneSpace),r.keywords(",").prepend(Q.noSpace).append(Q.oneSpace)})}formatDeploymentRelation(e){this.on(e,Bi,(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace),r.keywords("-[").append(Q.noSpace),r.nodes(...Ge([n.target,n.tags],ae)).prepend(Q.oneSpace),r.properties("title","technology").prepend(Q.oneSpace)})}formatRelation(e){this.on(e,Nr,(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace),r.keywords("-[").append(Q.noSpace),r.nodes(...Ge([n.target,n.tags],ae)).prepend(Q.oneSpace),r.properties("title","technology").prepend(Q.oneSpace)}),this.on(e,Iw,(n,r)=>{r.keywords("->","<-").surround(Q.oneSpace);const i=r.property("kind");i.nodes[0]?.text.startsWith(".")&&i.surround(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace).append(Q.oneSpace),r.keywords("-[").prepend(Q.oneSpace).append(Q.noSpace),r.properties("title").prepend(Q.oneSpace)}),this.on(e,_w)?.property("target").prepend(Q.oneSpace),this.on(e,Gw,(n,r)=>{r.property("from").append(Q.oneSpace),r.keywords("]->").prepend(Q.noSpace),r.keywords("-[").append(Q.noSpace)}),this.on(e,tA)?.keywords("->").append(Q.oneSpace),this.on(e,zw)?.keyword("->").prepend(Q.oneSpace)}removeIndentFromTopLevelStatements(e){(iA(e)||Vw(e)||Rl(e)||rA(e)||Mw(e)||sA(e))&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib","global","deployments").prepend(Q.noIndent)}indentContentInBraces(e){if(rA(e)||Vw(e)||ta(e)||ra(e)||Zo(e)||Mw(e)||ll(e)||Vo(e)||ph(e)||fh(e)||Vo(e)||iA(e)||Yc(e)||QC(e)||y4(e)||Sh(e)||g4(e)||Rl(e)||XC(e)||u4(e)||o4(e)||Vl(e)||xh(e)||t4(e)||n4(e)||zi(e)||Pw(e)||sA(e)||i4(e)||s4(e)||r4(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||!ZV(o,a))&&n.cst([a]).prepend(Q.indent),o=a;r.prepend(Q.noIndent).prepend(Q.oneSpace),i.prepend(Q.noIndent).prepend(Ni.newLine({allowMore:!0}))}}appendKeywordsWithSpace(e){this.on(e,d4)?.keywords("element").append(Q.oneSpace)}formatView(e){this.on(e,oh,(n,r)=>{(n.extends||n.viewOf||n.name)&&r.keywords("view").append(Q.oneSpace),r.keywords("of","extends").surround(Q.oneSpace)}),this.on(e,VC)?.keywords("dynamic","view").append(Q.oneSpace),this.on(e,Cw)?.keywords("deployment","view").append(Q.oneSpace)}formatLeafProperty(e){if(rl(e)||Fl(e)||b4(e)||Jo(e)||Hw(e)||uA(e)||js(e)||vl(e)||Bc(e)||Ir(e)||kh(e)||jp(e)||Eh(e)||qw(e)){const n=this.getNodeFormatter(e),r=n.keyword(":"),i=n.keywords("title","description","technology","notation","color","line","head","tail","icon","shape","border","opacity","multiple");r.nodes.length===0?i.append(Q.oneSpace):r.prepend(Q.noSpace).append(Q.oneSpace),n.keyword(";").prepend(Q.noSpace).append(Q.newLine)}}formatLinkProperty(e){this.on(e,vh,(n,r)=>{r.keyword("link").append(Q.oneSpace),r.property("value").append(Q.oneSpace),r.keyword(":").prepend(Q.noSpace).append(Q.oneSpace),r.keyword(";").prepend(Q.noSpace).append(Q.newLine)})}formatNavigateToProperty(e){this.on(e,Dh)?.property("key").append(Q.oneSpace)}formatAutolayoutProperty(e){this.on(e,jl,(n,r)=>{r.keyword("autoLayout").append(Q.oneSpace),r.property("rankSep").prepend(Q.oneSpace),r.property("nodeSep").prepend(Q.oneSpace)})}formatMetadataProperty(e){this.on(e,m4,(n,r)=>{r.property("key").append(Q.oneSpace),r.keyword(":").prepend(Q.noSpace).append(Q.oneSpace),r.keyword(";").prepend(Q.noSpace).append(Q.newLine)})}formatElementDeclaration(e){this.on(e,zn,(n,r)=>{const i=rn(n.$cstNode,"kind"),s=rn(n.$cstNode,"name");s&&i&&(xv(s,i)>0?r.cst([i]).append(Q.oneSpace):(r.cst([s]).append(Q.oneSpace),r.cst([i]).prepend(Q.oneSpace))),r.properties("props").prepend(Q.oneSpace)})}formatGlobals(e){this.on(e,ll,(n,r)=>{r.keyword("style").append(Q.oneSpace),r.property("id").append(Q.oneSpace)}),this.on(e,Vo,(n,r)=>{r.keyword("styleGroup").append(Q.oneSpace)}),this.on(e,ph,(n,r)=>{r.keyword("predicateGroup").append(Q.oneSpace)}),this.on(e,fh,(n,r)=>{r.keyword("dynamicPredicateGroup").append(Q.oneSpace)})}formatSpecificationRule(e){if((ta(e)||ra(e)||_h(e)||Zo(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag","deploymentNode").append(Q.oneSpace),Ah(e)){const n=this.getNodeFormatter(e);n.keyword("color").append(Q.oneSpace),n.property("name").append(Q.oneSpace)}}formatWithPredicate(e){const n=this.getNodeFormatter(e);(ih(e)||Ww(e))&&n.keyword("with").prepend(Q.oneSpace)}formatDeploymentNodeDeclaration(e){this.on(e,bn,(n,r)=>{const i=rn(n.$cstNode,"kind"),s=rn(n.$cstNode,"name");s&&i&&(xv(s,i)>0?r.cst([i]).append(Q.oneSpace):(r.cst([s]).append(Q.oneSpace),r.cst([i]).prepend(Q.oneSpace))),r.properties("title").prepend(Q.oneSpace)})}formatDeployedInstance(e){this.on(e,pr,(n,r)=>{const i=n.$cstNode?.content.find(s=>s.text==="=");i&&r.cst([i]).surround(Q.oneSpace),r.keyword("instanceOf").append(Q.oneSpace),r.property("title").prepend(Q.oneSpace)})}formatViewRuleGlobalStyle(e){this.on(e,dA,(n,r)=>{r.keywords("global","style").append(Q.oneSpace)})}formatViewRuleGlobalPredicate(e){const n=this.getNodeFormatter(e);(lA(e)||KC(e))&&n.keywords("global","predicate").append(Q.oneSpace)}formatViewRuleGroup(e){this.on(e,xh,(n,r)=>{r.keyword("group").append(Q.oneSpace)})}formatViewRuleStyle(e){this.on(e,Vl)?.keyword("style").append(Q.oneSpace),this.on(e,HC)?.keyword("style").append(Q.oneSpace),this.on(e,l4)?.keyword(",").prepend(Q.noSpace).append(Q.oneSpace),this.on(e,f4)?.keyword(",").prepend(Q.noSpace).append(Q.oneSpace)}formatWhereExpression(e){(VU(e)||qU(e))&&this.getNodeFormatter(e).keyword("where").append(Q.oneSpace)}formatWhereExpressionV2(e){KU(e)&&this.getNodeFormatter(e).keyword("where").append(Q.oneSpace)}formatWhereRelationExpression(e){if(this.on(e,ZU,(n,r)=>{r.property("operator").surround(Q.oneSpace)}),this.on(e,hA,(n,r)=>{r.keyword("not").append(Q.oneSpace)}),WC(e)||$4(e)||pA(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(Q.oneSpace),n.property("not").surround(Q.oneSpace)}}formatWhereElementExpression(e){if(this.on(e,JU,(n,r)=>{r.property("operator").surround(Q.oneSpace)}),this.on(e,fA,(n,r)=>{r.keyword("not").append(Q.oneSpace)}),GC(e)||R4(e)||E4(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(Q.oneSpace),n.property("not").surround(Q.oneSpace)}}formatIncludeExcludeExpressions(e){if(Sp(e)||gh(e)||al(e)||zo(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!em(e.$cstNode))&&n.keywords("include","exclude").append(Q.oneSpace)}if(YC(e)||aA(e)||aA(e)){const n=this.getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&em(r?.$cstNode);i&&n.property("value").prepend(Q.indent),n.keyword(",").prepend(Q.noSpace).append(i?Q.newLine:Q.oneSpace)}}formatRelationExpression(e){this.on(e,Bw,(n,r)=>{r.keyword("->").append(Q.oneSpace)}),this.on(e,nA,(n,r)=>{r.keyword("->").prepend(Q.oneSpace)}),this.on(e,jw,(n,r)=>{r.keywords("->","<->").prepend(Q.oneSpace),r.keywords("-[").prepend(Q.oneSpace).append(Q.noSpace),r.keywords("]->").prepend(Q.noSpace).append(Q.oneSpace);const i=r.property("kind");i.nodes[0]?.text.startsWith(".")&&i.surround(Q.oneSpace)}),this.on(e,Aw,(n,r)=>{r.property("target").prepend(Q.oneSpace)})}formatDeploymentViewRulePredicateExpressions(e){if(Sp(e)||gh(e)||al(e)||zo(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!em(e.$cstNode))&&n.keywords("include","exclude").append(Q.oneSpace)}if(a4(e)){const n=this.getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&em(r?.$cstNode);i&&n.property("value").prepend(Q.indent),n.keyword(",").prepend(Q.noSpace).append(i?Q.newLine:Q.oneSpace)}}findPredicateExpressionRoot(e){let n=e.$container;for(;;){if(!n||Sp(n)||gh(n)||al(n)||zo(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}}class n5{constructor(e){this.services=e}async provideCodeLens(e,n,r){return e.state!==je.Validated&&(Fe.debug(`Waiting for document ${e.uri.path} to be validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(je.Validated,e.uri,r),Fe.debug(`Document ${e.uri.path} is validated`)),da(e)?e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=Zh.readId(i),o=i.$cstNode?.range;return!o||!s?[]:{range:{start:o.start,end:{line:o.start.line,character:o.start.character+4}},command:{command:"likec4.open-preview",arguments:[s],title:"open preview"}}}):void 0}}const Iv=["color","shape","icon","border","opacity","multiple"].join(",");class r5 extends iC{completionOptions={triggerCharacters:["."]};completionForKeyword(e,n,r){if(this.filterKeyword(e,n)){if(n.value==="deployment"&&Ti(e.node,Rl))return r(e,{label:n.value,detail:"Insert deployment view",kind:xt.Class,insertTextFormat:Xn.Snippet,insertText:["deployment view ${1:view_${TM_FILENAME_BASE}_${CURRENT_SECOND}} {"," title '${2:Untitled}'"," "," include $0","}"].join(`
224
+ `)});if(["title","description","technology"].includes(n.value))return r(e,{label:n.value,kind:xt.Property,insertTextFormat:Xn.Snippet,insertText:`${n.value} '\${0}'`});if(["views","specification","model","deployment","with"].includes(n.value))return r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:xt.Module,insertTextFormat:Xn.Snippet,insertText:`${n.value} {
225
+ $0
226
+ }`});if(n.value==="group")return r(e,{label:n.value,detail:"Insert group block",kind:xt.Class,insertTextFormat:Xn.Snippet,insertText:["group '${1:Title}' {"," $0","}"].join(`
227
+ `)});if(n.value==="dynamic"&&Ti(e.node,Rl))return r(e,{label:n.value,detail:"Insert dynamic view",kind:xt.Class,insertTextFormat:Xn.Snippet,insertText:["dynamic view ${1:view_${TM_FILENAME_BASE}_${CURRENT_SECOND}} {"," title '${2:Untitled}'"," "," $0","}"].join(`
228
+ `)});if(n.value==="style"&&e.node)return Ti(e.node,ll)?r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:xt.Module,insertTextFormat:Xn.Snippet,insertText:`${n.value} \${1:name} \${2:*} {
229
+ \${3|${Iv}|} $0
230
+ }`}):Ti(e.node,LG([Rl,Vo]))?r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:xt.Module,insertTextFormat:Xn.Snippet,insertText:`${n.value} \${1:*} {
231
+ \${2|${Iv}|} $0
232
+ }`}):r(e,{label:n.value,detail:`Insert ${n.value} block`,kind:xt.Module,insertTextFormat:Xn.Snippet,insertText:`${n.value} {
233
+ \${1|${Iv}|} $0
234
+ }`});if(n.value==="extend")return r(e,{label:n.value,detail:"Extend another view",kind:xt.Class,insertTextFormat:Xn.Snippet,insertText:`extend \${1:element} {
235
+ $0
236
+ }`});if(n.value==="autoLayout")return r(e,{label:n.value,kind:xt.Class,insertTextFormat:Xn.Snippet,insertText:"autoLayout ${1|TopBottom,BottomTop,LeftRight,RightLeft|}$0"});r(e,{label:n.value,kind:this.getKeywordCompletionItemKind(n),detail:"Keyword",sortText:"1"})}}}class i5 extends sC{createDocumentHighlight(e){return we.DocumentHighlight.create(e.segment.range,we.DocumentHighlightKind.Read)}}const s5=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,o5=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,a5=/^([/\\]\s*){2,}[^/\\]/;function y_(t){return["./","../"].some(e=>t.startsWith(e))}function Nv(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?s5.test(t):o5.test(t)||(e.acceptRelative?a5.test(t):!1)}function u5(t="",e){return t.endsWith("/")}function c5(t="",e){return(u5(t)?t.slice(0,-1):t)||"/"}function l5(t="",e){return t.endsWith("/")?t:t+"/"}function tm(t=""){return t.startsWith("/")}function w_(t=""){return(tm(t)?t.slice(1):t)||"/"}function d5(t=""){return tm(t)?t:"/"+t}function f5(t,e){if(p5(e))return t;const n=c5(e);if(!t.startsWith(n))return t;const r=t.slice(n.length);return r[0]==="/"?r:"/"+r}function p5(t){return!t||t==="/"}function nm(t=""){const[e="",n="",r=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:n,hash:r}}class h5{constructor(e){this.services=e}getDocumentLinks(e,n){return da(e)?kr(e.parseResult.value).filter(vh).map(r=>{try{const i=rn(r.$cstNode,"value")?.range,s=this.resolveLink(e,r.value);if(i&&Nv(s))return{range:i,target:s}}catch(i){ve(i)}return null}).nonNullable().toArray():[]}resolveLink(e,n){if(Nv(n)||tm(n))return n;const r=y_(n)?new URL(e.uri.toString(!0)):this.services.shared.workspace.WorkspaceManager.workspaceURL;return new URL(n,r).toString()}relativeLink(e,n){if(tm(n))return w_(n);if(y_(n)){const r=new URL(e.uri.toString(!0)),i=new URL(n,r).toString();return w_(f5(i,this.services.shared.workspace.WorkspaceManager.workspaceURL.toString()))}return null}}class m5{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;getSymbols({parseResult:{value:{specifications:e,models:n,deployments:r,views:i,likec4lib:s}}}){return[...s.map(o=>()=>this.getLikec4LibSymbol(o)),...e.map(o=>()=>this.getSpecSymbol(o)),...n.map(o=>()=>this.getModelSymbol(o)),...r.map(o=>()=>this.getDeploymentModelSymbol(o)),...i.map(o=>()=>this.getModelViewsSymbol(o))].flatMap(o=>{try{return o()??[]}catch(a){return ve(a),[]}})}getLikec4LibSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.icons.map(i=>this.getLibIconSymbol(i)).filter(ae);return r.length===0?[]:[{kind:lr.Namespace,name:"icons",range:n.range,selectionRange:au(n,"icons")?.range??n.range,children:r}]}getSpecSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=rn(n,"name");if(!r)return[];const i=Qe([...e.elements,...e.tags,...e.relationships],gn(s=>{try{if(ta(s)||ra(s)||Zo(s))return this.getKindSymbol(s);if(_h(s))return this.getTagSymbol(s)}catch(o){return ve(o),null}Oe(s)}),Ge(ae));return i.length===0?[]:[{kind:lr.Namespace,name:e.name,range:n.range,selectionRange:r.range,children:i}]}getModelSymbol(e){const n=e.$cstNode;if(!n)return[];const r=rn(n,"name");return r?[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.elements.flatMap(i=>this.getElementsSymbol(i))}]:[]}getDeploymentModelSymbol(e){const n=e.$cstNode;if(!n)return[];const r=rn(n,"name");return r?[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.elements.flatMap(i=>this.getDeploymentElementSymbol(i))}]:[]}getElementsSymbol(e){try{if(Go(e))return this.getExtendElementSymbol(e);if(zn(e))return this.getElementSymbol(e)}catch(n){ve(n)}return[]}getExtendElementSymbol(e){const n=e.$cstNode,r=e.element.$cstNode,i=e.body;return!n||!r?[]:[{kind:this.symbolKind(e),name:Qh(e.element),range:n.range,selectionRange:r.range,children:i.elements.flatMap(s=>this.getElementsSymbol(s))}]}getElementSymbol(e){const n=e.$cstNode,r=rn(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=rn(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||_s(e.kind.name)?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||_s(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||_s(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?rn(n,"name"):null;return r?[{kind:this.symbolKind(e),name:r.text,range:n.range,selectionRange:r.range,children:[]}]:[]}getDeploymentElementSymbol(e){try{if(bn(e))return this.getDeploymentNodeSymbol(e);if(pr(e))return this.getDeployedInstanceSymbol(e)}catch(n){ve(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.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=wt(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(e)}}var Ov,v_;function g5(){return v_||(v_=1,Ov=t=>{const e=t.match(/^[ \t]*(?=\S)/gm);return e?e.reduce((n,r)=>Math.min(n,r.length),1/0):0}),Ov}var y5=g5();const w5=Rs(y5);function Fv(t){const e=w5(t);if(e===0)return t;const n=new RegExp(`^[ \\t]{${e}}`,"gm");return t.replace(n,"")}class v5 extends cC{parser;locator;constructor(e){super(e),this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getAstNodeHoverContent(e){if(cA(e))return{contents:{kind:"markdown",value:Fv(`
237
+ tag: \`${e.name}\`
238
+ `)}};if(bn(e)){const n=wt(e),r=this.parser.forDocument(n).parseDeploymentNode(e),i=[r.id+" "];return r.title!==e.name&&i.push(`### ${r.title}`),i.push("Deployment: `"+r.kind+"` "),{contents:{kind:"markdown",value:i.join(`
239
+ `)}}}if(pr(e)){const n=wt(e),r=this.parser.forDocument(n).parseDeployedInstance(e),i=this.locator.getParsedElement(r.element),s=[r.id+" ",`instance of \`${r.element}\``];return i&&s.push(`### ${i.title}`,"Element: `"+i.kind+"` "),{contents:{kind:"markdown",value:s.join(`
240
+ `)}}}if(zn(e)){const n=this.locator.getParsedElement(e);return n?{contents:{kind:"markdown",value:[n.id,`### ${n.title}`,"Element: `"+n.kind+"` "].join(`
241
+ `)}}:void 0}}}class b5 extends rU{highlightElement(e,n){if(zn(e)||bn(e))return this.highlightNameAndKind(e,n);if(pr(e)){"name"in e&&n({node:e,property:"name",type:Be.variable,modifier:[et.definition,et.readonly]});return}if(Rw(e))return this.highlightView(e,n);if(v4(e))return n({node:e,property:"name",type:Be.function});if(p4(e))return n({node:e,property:"name",type:Be.type,modifier:[et.definition]}),"prune";if(Gw(e)&&"kind"in e){n({node:e,property:"kind",type:Be.function});return}if(Nr(e)&&"kind"in e&&n({node:e,property:"kind",type:Be.function}),Dh(e)||Pl(e))return n({node:e,property:"key",type:Be.property}),n({node:e,property:"value",type:Be.variable,modifier:[et.definition,et.readonly]}),"prune";if((Nw(e)||Hs(e))&&e.$cstNode)return n({cst:e.$cstNode,type:Be.variable,modifier:[et.definition,et.readonly]}),"prune";if(Lw(e)){e.selector&&n({node:e,property:"selector",type:Be.variable,modifier:[et.definition,et.readonly]});return}if(pA(e)&&ae(e.value)){n({node:e,property:"value",type:Be.function});return}if((GC(e)||WC(e))&&ae(e.value)){n({node:e,property:"value",type:Be.type,modifier:[et.definition,et.readonly]});return}if((mA(e)||gA(e))&&n({node:e,property:"participant",type:Be.keyword}),rh(e)&&ae(e.kind))return n({node:e,property:"kind",type:Be.type,modifier:[et.definition]}),"prune";if(sh(e)&&ae(e.tag))return n({node:e,property:"tag",type:Be.type,modifier:[et.definition]}),"prune";if(eA(e))return n({node:e,property:"value",type:e.parent?Be.property:Be.variable,modifier:[et.definition,et.readonly]}),e.parent?void 0:"prune";if(tl(e)||ZC(e))return n({node:e,property:"el",type:e.parent?Be.property:Be.variable,modifier:[et.definition,et.readonly]}),e.parent?void 0:"prune";if(Ah(e)){n({node:e,keyword:"color",type:Be.keyword}),n({node:e,property:"name",type:Be.type,modifier:[et.declaration,et.readonly]});return}if((ta(e)||ra(e)||Zo(e))&&n({node:e,property:"kind",type:Be.type,modifier:[et.declaration,et.readonly]}),Kw(e))return n({node:e,property:"values",type:Be.interface});if(cA(e))return n({node:e,property:"name",type:Be.type,modifier:[et.definition]});if((Sh(e)||zi(e)&&Yc(e.$container))&&n({node:e,property:"key",type:Be.property}),Eh(e))return n({node:e,property:"key",type:Be.property}),n({node:e,property:"value",type:Be.number}),"prune";if(vh(e)||Ir(e)||jC(e))return n({node:e,property:"key",type:Be.property}),Ir(e)&&(e.libicon||e.value==="none")?(n({node:e,property:e.libicon?"libicon":"value",type:Be.enum,modifier:[et.defaultLibrary]}),"prune"):("value"in e&&e.value&&n({node:e,property:"value",type:Be.string}),"prune");if(js(e)||kh(e)||Bc(e)||vl(e)||jp(e))return n({node:e,property:"key",type:Be.property}),"value"in e&&n({node:e,property:"value",type:Be.enum}),"prune"}highlightNameAndKind(e,n){n({node:e,property:"name",type:Be.variable,modifier:[et.declaration,et.readonly]}),n({node:e,property:"kind",type:Be.keyword,modifier:[]})}highlightView(e,n){e.name&&n({node:e,property:"name",type:Be.variable,modifier:[et.declaration,et.readonly,"local"]})}}class D5{constructor(e){this.services=e,this.Names=e.references.NameProvider,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.documentCache=e.DocumentCache}Names;langiumDocuments;documentCache;documents(){return this.langiumDocuments.all.filter(e=>gd(e)&&e.state>=je.IndexedContent)}get(e){return e.state<je.IndexedContent&&ve(`Document ${e.uri.path} is not indexed`),this.documentCache.get(e.uri,"DeploymentsIndex",()=>this.createDocumentIndex(e))}nested(e){const n=this.getFqn(e);return this.documents().flatMap(r=>this.get(r).nested(n))}byFqn(e){return this.documents().flatMap(n=>this.get(n).byFqn(e))}getFqn(e){let n=md.readId(e);if(ae(n))return n;const r=[this.Names.getNameStrict(e)];let i=e,s;for(;s=nn(i.$container,bn);)r.push(this.Names.getNameStrict(s)),i=s;return n=r.reduceRight((o,a)=>`${o}.${a}`),md.writeId(e,n),n}createDocumentIndex(e){const n=e.parseResult.value.deployments.flatMap(l=>l.elements);if(n.length===0)return xm.EMPTY;const r=new Array,i=new Ln,s=new Ln,o=this.Names,a=this.services.workspace.AstNodeDescriptionProvider,u=l=>{const d={...a.createDescription(l.node,l.name,e),fqn:l.fqn};return md.writeId(l.node,l.fqn),s.add(l.fqn,d),d},c=(l,d)=>{const f=[],p=l.body?.elements;if(!p||p.length===0)return[];const h=new Set;for(const w of p)if(!Bi(w))try{const D=o.getName(w);if(ae(D)){const g=`${d}.${D}`,v=u({node:w,name:D,fqn:g});i.add(d,v),h.add(v.name),bn(w)&&w.body&&f.push(...c(w,g))}}catch(D){ve(D)}return f.length>0&&Qe(f,Ps(Fu("name")),yp((w,D)=>{w.length>1||h.has(D)||i.add(d,w[0])})),i.get(d)};for(const l of n)try{if(Bi(l))continue;const d=o.getName(l);ae(d)&&(r.push(u({node:l,name:d,fqn:d})),c(l,d))}catch(d){ve(d)}return new xm(r,i,s)}}class xm{constructor(e,n,r){this._rootNodes=e,this._nested=n,this._byfqn=r}static EMPTY=new xm([],new Ln,new Ln);rootNodes(){return this._rootNodes}byFqn(e){return this._byfqn.get(e)}nested(e){return this._nested.get(e)}unique(){const e=[];return Qe([...this._byfqn.values()],Ps(Fu("name")),yp(n=>{n.length===1&&e.push(n[0])})),e}}const{findNodeForProperty:E5}=ff,{toDocumentSegment:b_}=mN;function R5(t,e,n){const r=E5(e.$cstNode,"name");return{documentUri:n.uri,name:e.name,...e.$cstNode&&{selectionSegment:b_(e.$cstNode)},...r&&{nameSegment:b_(r)},path:t.getAstNodePath(e),type:Jn}}function $5(t,e){const n=t.c4fqnIndex=new Ln,r=t.parseResult.value.models.flatMap(a=>a.elements);if(r.length===0)return;const i=e.workspace.AstNodeLocator,s=Om.from(r.map(a=>[a,null]));let o;for(;o=s.shift();)try{const[a,u]=o;if(Nr(a))continue;if(Go(a)){if(Jt(a.body)&&!_s(a.body.elements)){const c=Qh(a.element);for(const l of a.body.elements)Nr(l)||s.push([l,c])}continue}if(zn(a)){const c=q1(a.name,u);if(n.add(c,{...R5(i,a,t),fqn:c}),md.writeId(a,c),Jt(a.body)&&!_s(a.body.elements))for(const l of a.body.elements)Nr(l)||s.push([l,c]);continue}Oe(a)}catch(a){s0(a)}}class Lv{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){s0(n)}}throwIfDisposed(){if(this.isDisposed)throw new Error("This has already been disposed")}}function wd(...t){var e=t.length>1?t.join(":::"):t[0];return j1(e)}class T5 extends Lv{constructor(e){super(),this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.onDispose(e.shared.workspace.DocumentBuilder.onBuildPhase(je.IndexedContent,async(n,r)=>{for(const i of n)if(gd(i)){delete i.c4fqnIndex,delete i.c4Elements,delete i.c4Specification,delete i.c4Relations,delete i.c4Deployments,delete i.c4DeploymentRelations,delete i.c4Globals,delete i.c4Views;try{$5(i,e)}catch(s){ve(s)}}return await Promise.resolve()})),Fe.debug("[FqnIndex] Created")}langiumDocuments;get documents(){return this.langiumDocuments.all.filter(Av)}entries(e){return this.documents.flatMap(n=>n.c4fqnIndex.keys().filter(e).flatMap(r=>n.c4fqnIndex.get(r)))}getFqn(e){return md.readId(e)??null}byFqn(e){return this.documents.flatMap(n=>n.c4fqnIndex.get(e))}directChildrenOf(e){return rt([e]).flatMap(n=>{const r=this.entries(i=>Bd(i)===n).map(i=>[i.name,i]).toArray();return r.length===0?[]:new Ln(r).entriesGroupedByKey().flatMap(([i,s])=>s.length===1?s:[]).iterator()})}uniqueDescedants(e){return new Ot(()=>{const n=`${e}.`,r=new Set,i=[],s=new Ln;if(this.entries(o=>o.startsWith(n)).forEach(o=>{const a=Ld(o.fqn),u={...o,name:a};Bd(o.fqn)===e?(r.add(a),s.add(a,u)):i.push(u)}),s.size+i.length===0)return null;for(const o of i)r.has(o.name)||s.add(o.name,o);return s.entriesGroupedByKey().flatMap(([o,a])=>a.length===1?a:[]).iterator()},n=>n?n.next():en)}}function S5(t){const e=new Map;for(const n of t)if(ba.isElement(n)&&n.viewOf&&Dt(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=Md.modelRef(i);if(i.navigateTo||!s)continue;const o=AS(e.get(s)??[],a=>a!==n);o&&(i.navigateTo=o)}return t}function k5(t,e="/"){const n=Qe(t,gn(u=>u.docUri),Ge(ae),Vy());if(n.length===0)return"";if(n.length===1){const u=nm(n[0]).pathname.split(e);return u.length<=1?e:(u.pop(),u.join(e)+e)}Ce(As(n,2),"Expected at least 2 unique URIs");const[r,...i]=n,s=nm(r).pathname.split(e);let o=s.length;for(const u of i){if(u===r)continue;const c=nm(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 C5(t){const e="/",n=k5(t,e);return t.map(r=>{if(!r.docUri)return{view:r,parts:[]};let i=nm(r.docUri).pathname;return n.length>0?(Ce(i.startsWith(n),`Expect path "${i}" 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=wD(r.parts[s],i.parts[s]);if(o!==0)return o}return wD(r.view.title??r.view.id,i.view.title??i.view.id)}).map(({parts:r,view:i})=>({...i,relativePath:r.join(e)}))}function A5(t,e){const n={tags:new Set,deployments:{},elements:{},relationships:{},colors:{}},r={predicates:{},dynamicPredicates:{},styles:{}};for(const g of e){const{c4Specification:v,c4Globals:E}=g;v.tags.forEach(k=>n.tags.add(k)),Object.assign(n.elements,v.elements),Object.assign(n.relationships,v.relationships),Object.assign(n.colors,v.colors),Object.assign(n.deployments,v.deployments),Object.assign(r.predicates,E.predicates),Object.assign(r.dynamicPredicates,E.dynamicPredicates),Object.assign(r.styles,E.styles)}function i(g,v){return gn(v,E=>{try{const k=t.lsp.DocumentLinkProvider.relativeLink(g,E.url);if(k&&k!==E.url)return{...E,relative:k}}catch(k){ve(k)}return E})}const s=Lu(n.colors,g=>U1(g.color));function o(g){return({tags:v,links:E,style:{color:k,shape:P,icon:G,opacity:W,border:Z,multiple:J},id:fe,kind:N,title:S,description:$,technology:O,metadata:V})=>{try{const M=n.elements[N];if(!M)return Fe.warn(`No kind '${N}' found for ${fe}`),null;const H=E?i(g,E):null;return k??=M.style.color,P??=M.style.shape,G??=M.style.icon,W??=M.style.opacity,Z??=M.style.border,O??=M.technology,J??=M.style.multiple,{...k&&{color:k},...P&&{shape:P},...G&&{icon:G},...V&&!_s(V)&&{metadata:V},...M.notation&&{notation:M.notation},style:{...Z&&{border:Z},...Yy(J)&&{multiple:J},...gp(W)&&{opacity:W}},links:H,tags:v??null,technology:O??null,description:$??null,title:S,kind:N,id:fe}}catch(M){ve(M)}return null}}const a=Qe(e,Ii(g=>gn(g.c4Elements,o(g))),Ge(ae),bD,Ky((g,v)=>{const E=Bd(v.id);return E&&Dt(g[E])?(ve(`No parent found for ${v.id}`),g):(g[v.id]=v,g)},{}));function u(g){return({astPath:v,source:E,target:k,kind:P,links:G,id:W,...Z})=>{if(Dt(a[E])||Dt(a[k]))return Fe.warn(`Invalid relation ${W} at ${g.uri.path} ${v}, source: ${E}(${!!a[E]}), target: ${k}(${!!a[k]})`),null;const J=G?i(g,G):null;return sn(P)&&P in n.relationships?{...n.relationships[P],...Z,...J&&{links:J},source:E,target:k,kind:P,id:W}:{...J&&{links:J},...Z,source:E,target:k,id:W}}}const c=Qe(e,Ii(g=>gn(g.c4Relations,u(g))),Ge(ae),TS(W1),SS(),Xy(Fu("id")));function l(g){return v=>{if(!H1.isDeploymentNode(v)){if(!v.links||v.links.length===0)return v;const E=i(g,v.links);return{...v,links:E}}try{const E=n.deployments[v.kind];if(!E)return Fe.warn(`No kind '${v.kind}' found for ${v.id}`),null;let{technology:k=E.technology,notation:P=E.notation,links:G,style:W}=v;return{...v,...P&&{notation:P},...k&&{technology:k},style:{border:"dashed",opacity:10,...E.style,...W},links:G?i(g,G):null}}catch(E){ve(E)}return null}}const d=Qe(e,Ii(g=>gn(g.c4Deployments,l(g))),Ge(ae),bD,Ky((g,v)=>{const E=Bd(v.id);return E&&Dt(g[E])?(ve(`No parent found for deployment element ${v.id}`),g):(g[v.id]=v,g)},{}));function f(g){return({astPath:v,source:E,target:k,kind:P,links:G,id:W,...Z})=>{if(Dt(d[E.id])||Dt(d[k.id]))return Fe.warn(`Invalid deployment relation ${W} at ${g.uri.path} ${v}, source: ${E.id}(${!!d[E.id]}), target: ${k.id}(${!!d[k.id]})`),null;const J=G?i(g,G):null;return sn(P)&&P in n.relationships?{...n.relationships[P],...Z,...J&&{links:J},source:E,target:k,kind:P,id:W}:{...J&&{links:J},...Z,source:E,target:k,id:W}}}const p=Qe(e,Ii(g=>gn(g.c4DeploymentRelations,f(g))),Ge(ae),Ky((g,v)=>Jt(g[v.id])?(ve(`Duplicate deployment relation ${v.id}`),g):(g[v.id]=v,g),{}));function h(g){const v=g.uri.toString();return E=>{let{id:k,title:P,description:G,tags:W,links:Z,astPath:J,...fe}=E;E.__==="element"&&Dt(P)&&"viewOf"in E&&(P=a[E.viewOf]?.title??null),Dt(P)&&k==="index"&&(P="Landscape view");const N=Z?i(g,Z):null;return{...fe,customColorDefinitions:s,tags:W,links:N,docUri:v,description:G,title:P,id:k}}}const w=Qe(e,Ii(g=>gn(g.c4Views,h(g))),C5);w.some(g=>g.id==="index")||w.unshift({__:"element",id:"index",title:"Landscape view",description:null,tags:null,links:null,customColorDefinitions:s,rules:[{include:[{wildcard:!0}]}]});const D=Qe(w,Xy(Fu("id")),eN);return{specification:{tags:Array.from(n.tags),elements:n.elements,relationships:n.relationships,deployments:n.deployments},elements:a,relations:c,globals:r,views:D,deployments:{elements:d,relations:p}}}const D_="ParsedLikeC4Model",Mv="ComputedLikeC4Model";class _5 extends Lv{constructor(e){super(),this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments;const n=e.likec4.ModelParser;this.onDispose(e.shared.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.notifyListeners(i)})),this.onDispose(e.shared.workspace.DocumentBuilder.onBuildPhase(je.Validated,async(r,i)=>{let s=[];Fe.debug(`[ModelBuilder] onValidated (${r.length} docs)`);for(const o of r)try{s.push(n.parse(o).uri)}catch(a){ve(a)}await It(i),s.length>0&&this.notifyListeners(s)})),Fe.debug("[ModelBuilder] Created")}langiumDocuments;listeners=[];unsafeSyncBuildModel(){const e=this.documents();return e.length===0?(Fe.debug("[ModelBuilder] No documents to build model from"),null):this.services.WorkspaceCache.get(D_,()=>(Fe.debug(`[ModelBuilder] buildModel (${e.length} docs)`),A5(this.services,e)))}async buildModel(e){return this.services.WorkspaceCache.get(D_)||await this.services.shared.workspace.WorkspaceLock.read(async()=>(e&&await It(e),this.unsafeSyncBuildModel()))}previousViews={};unsafeSyncBuildComputedModel(e){const n=this.services.WorkspaceCache,r=this.services.WorkspaceCache;return n.get(Mv,()=>{const i=vD.makeCompute(e),s=[];for(const a of Ou(e.views)){const u=i(a);if(!u.isSuccess){ve(u.error);continue}s.push(u.view)}S5(s);const o=fr(s,a=>{const u=this.previousViews[a.id],c=u&&ov(a,u)?u:a;return r.set(E_(a.id),c),[a.id,c]});return this.previousViews={...o},{...iG(e,["views"]),views:o}})}async buildComputedModel(e){const n=this.services.WorkspaceCache;return n.has(Mv)?n.get(Mv):await this.services.shared.workspace.WorkspaceLock.read(async()=>{e&&await It(e);const r=this.unsafeSyncBuildModel();return r?this.unsafeSyncBuildComputedModel(r):null})}async computeView(e,n){const r=this.services.WorkspaceCache,i=E_(e);return r.has(i)?r.get(i):await this.services.shared.workspace.WorkspaceLock.read(async()=>(n&&await It(n),r.get(i,()=>{const s=this.unsafeSyncBuildModel(),o=s?.views[e];if(!o)return Fe.warn(`[ModelBuilder] Cannot find view ${e}`),null;const a=vD.makeCompute(s)(o);if(!a.isSuccess)return ve(a.error),null;let u=a.view;const c=Qe(s.views,Ou(),Ge(G1),Ge(d=>d.id!==e),Ps(d=>d.viewOf));for(const d of u.nodes)if(!d.navigateTo){const f=c[d.id];f&&(d.navigateTo=f[0].id)}const l=this.previousViews[e];return l&&ov(u,l)?u=l:this.previousViews[e]=u,u})))}onModelParsed(e){return this.listeners.push(e),Cs.create(()=>{const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)})}documents(){return this.langiumDocuments.all.filter(da).toArray()}notifyListeners(e){for(const n of this.listeners)try{n(e)}catch(r){ve(r)}}}function E_(t){return`computed-view-${t}`}const{findNodeForKeyword:P5,findNodeForProperty:rm}=ff,{getDocument:x5}=su;class I5{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex,this.langiumDocuments=e.shared.workspace.LangiumDocuments}fqnIndex;deploymentsIndex;langiumDocuments;documents(){return this.langiumDocuments.all.filter(da)}getParsedElement(e){if(kS(e)){const i=e,s=this.fqnIndex.byFqn(e).head();if(!s)return null;const o=this.langiumDocuments.getDocument(s.documentUri);return!o||!da(o)?null:o.c4Elements.find(a=>a.id===i)??null}const n=this.fqnIndex.getFqn(e);if(!n)return null;const r=x5(e);return da(r)?r.c4Elements.find(i=>i.id===n)??null:null}locateElement(e,n){const r=this.fqnIndex.byFqn(e).head(),i=r?.nameSegment??r?.selectionSegment;return!r||!i?null:{uri:r.documentUri.toString(),range:i.range}}locateDeploymentElement(e,n){const r=this.deploymentsIndex.byFqn(e).head(),i=r?.nameSegment??r?.selectionSegment;return!r||!i?null:{uri:r.documentUri.toString(),range:i.range}}locateRelation(e){for(const n of this.documents()){const r=n.c4Relations.find(o=>o.id===e)??n.c4DeploymentRelations.find(o=>o.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(!Nr(i)&&!Bi(i))continue;let s=i.title?rm(i.$cstNode,"title"):void 0;if(s??=i.kind?rm(i.$cstNode,"kind"):void 0,s??=rm(i.$cstNode,"target"),s??=i.$cstNode,!!s)return{uri:n.uri.toString(),range:s.range}}return null}locateViewAst(e){for(const n of this.documents()){const r=n.c4Views.find(s=>s.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(Rw(i))return{doc:n,view:r,viewAst:i}}return null}locateView(e){const n=this.locateViewAst(e);if(!n)return null;const r=n.viewAst;let i=r.name?rm(r.$cstNode,"name"):void 0;return i??=P5(r.$cstNode,"view"),i??=r.$cstNode,i?{uri:n.doc.uri.toString(),range:i.range}:null}}const Zs=["this","it","self","super","likec4lib","global"];function ft(t){return async function(e,n,r){try{const i=t(e,n,r);dG(i)&&await i;return}catch(i){const s=i instanceof Error?i.message:String(i);n("error",`Validation failed: ${s}`,{node:e}),ve(i)}}}const{getDocument:N5}=su,O5=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=dn(n.getNameNode(r),"name CstNode not found").range;Zs.includes(s)&&i("error",`Reserved word: ${s}`,{node:r,range:o});const a=e.getFqn(r);e.byFqn(a).limit(2).toArray().length>1&&i("error",`Duplicate node name "${a}"`,{node:r,range:o})})},F5=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=dn(n.getNameNode(r),"name CstNode not found").range;Zs.includes(s)&&i("error",`Reserved word: ${s}`,{node:r,range:o});const a=e.getFqn(r);e.byFqn(a).limit(2).toArray().length>1&&i("error",`Duplicate instance name "${a}"`,{node:r,range:o})})},L5=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{if(!n.source?.value?.ref){let u=n.source?.$cstNode?.text??"";r("error",`DeploymentRelation source '${u}' not resolved`,{node:n,property:"source"});return}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=N5(n),s=e.forDocument(i),o=s.parseFqnRef(n.source);if(Da.isModelRef(o)){r("error","DeploymentRelation must refer deployment element",{node:n,property:"source"});return}const a=s.parseFqnRef(n.target);if(Da.isModelRef(a)){r("error","DeploymentRelation must refer deployment element",{node:n,property:"target"});return}DD(o.deployment,a.deployment)&&r("error","Invalid parent-child relationship",{node:n})})},M5=t=>ft((e,n)=>{const r=g_(e.value);switch(!0){case rh(r):case sh(r):case Hs(r):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:e});return}}}),B5=t=>{const e=t.likec4.FqnIndex;return ft((n,r)=>{const i=En(n.source),s=i&&e.getFqn(i);s||r("error","Source not found (not parsed/indexed yet)",{node:n,property:"source"});const o=En(n.target),a=o&&e.getFqn(o);a||r("error","Target not found (not parsed/indexed yet)",{node:n,property:"target"}),s&&a&&(Fm(s,a)||Fm(a,s))&&r("error","Invalid parent-child relationship",{node:n})})},{getDocument:z5}=su,q5=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}Zs.includes(r.name)&&i("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const o=z5(r).uri,a=n.getAstNodePath(r),u=e.byFqn(s).filter(c=>c.documentUri!==o||c.path!==a).head();if(u){const c=u.documentUri!==o;i("error",`Duplicate element name ${r.name!==s?r.name+" ("+s+")":r.name}`,{node:r,property:"name",...c&&{relatedInformation:[{location:{range:u.nameSegment?.range??u.selectionSegment?.range,uri:u.documentUri.toString()},message:"conflicting element"}]}})}})},j5=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"})}),G5=t=>(e,n)=>{const r=e.$container;r.props.some(i=>Ir(i)&&i!==e)&&n("error","Icon must be defined once",{node:e}),zi(r)&&Yc(r.$container)&&r.$container.props.some(i=>Ir(i))&&n("warning","Redundant as icon defined on element",{node:e})},U5=t=>(e,n)=>{Ti(e,Iw)||n("error","Notes can be defined only inside dynamic view",{node:e})},W5=t=>{const e=t.likec4.FqnIndex;return ft((n,r)=>{const i=En(n.target),s=i&&e.getFqn(i);s||r("error","Target not resolved",{node:n,property:"target"});let o;if(Jt(n.source)){if(o=En(n.source),!o)return r("error","Source not resolved",{node:n,property:"source"})}else{if(!Yc(n.$container))return r("error","Sourceless relation must be nested",{node:n});o=n.$container.$container}const a=e.getFqn(o);a||r("error","Source not resolved",{node:n}),a&&s&&DD(a,s)&&r("error","Invalid parent-child relationship",{node:n})})},H5=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})}),V5=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one specification per document",{node:e,property:"name"})}),K5=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one model per document",{node:e,property:"name"})}),Y5=t=>ft((e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one global block per document",{node:e,property:"name"})}),X5=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Zs.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=e.allElements(pi).filter(s=>s.name===n.name&&s.node!==n).head();if(i){const s=i.documentUri!==wt(n).uri;r("error",`Duplicate element kind '${n.name}'`,{node:n,property:"name",...s&&{relatedInformation:[{location:{range:i.nameSegment.range,uri:i.documentUri.toString()},message:"conflicting definition"}]}})}})},J5=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Zs.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=e.allElements(Mi).filter(s=>s.name===n.name&&s.node!==n).head();if(i){const s=i.documentUri!==wt(n).uri;r("error",`Duplicate deploymentNode kind '${n.name}'`,{node:n,property:"name",...s&&{relatedInformation:[{location:{range:i.nameSegment.range,uri:i.documentUri.toString()},message:"conflicting definition"}]}})}})},Q5=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{const i="#"+n.name,s=e.allElements(ji).filter(o=>o.name===i&&o.node!==n).head();if(s){const o=s.documentUri!==wt(n).uri;r("error",`Duplicate tag '${n.name}'`,{node:n,property:"name",...o&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}})},Z5=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{Zs.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(qi).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate RelationshipKind '${n.name}'`,{node:n,property:"name"})})},R_=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{const i=e.allElements(Wo),s=e.allElements(Uo);i.concat(s).filter(o=>o.name===n.name).limit(2).count()>1&&r("error",`Duplicate GlobalPredicateGroup or GlobalDynamicPredicateGroup name '${n.name}'`,{node:n,property:"name"})})},eK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{e.allElements(dl).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate GlobalStyleId name '${n.name}'`,{node:n,property:"name"})})},tK=t=>{const e=t.shared.workspace.IndexManager;return ft((n,r)=>{n.name&&(Zs.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(qs).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate view '${n.name}'`,{node:n,property:"name"}))})},nK=t=>ft((e,n)=>{const r=nn(e,Mp);al(r)&&n("error",'Invalid usage inside "exclude"',{node:e});const i=Ow(e.subject)?e.subject.subject:e.subject;switch(!0){case tl(i):case Nw(i):case JC(i):case Hs(i):return;case rh(i):case sh(i):n("error","Invalid target (expect reference to specific element)",{node:e,property:"subject"});return;default:Oe(i)}}),rK=t=>ft((e,n)=>{Ti(e,Tw)&&n("warning","Redundant usage, expand predicate resolves parent element only when used in relations",{node:e})}),iK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{if(n.$container.$type!=="DeploymentViewRulePredicateExpression")return;const i=nn(n,zo);if(!i||i.isInclude!==!0)return;const s=wt(n),o=e.forDocument(s),a="Model reference is allowed in exclude predicate only";if(Aw(n)){Ea.isModelRef(o.parseFqnExpr(n.source.from))&&r("error",a,{node:n.source,property:"from"}),Ea.isModelRef(o.parseFqnExpr(n.target))&&r("error",a,{node:n,property:"target"});return}let u;if(Bw(n)?u=n.to:jw(n)?u=n.from:u=n.inout.to,Ea.isModelRef(o.parseFqnExpr(u))){r("error",a,{node:n});return}})},sK=t=>{const e=t.likec4.ModelParser;return ft((n,r)=>{const i=n.ref.value.ref;if(Dt(i)){r("error","Invalid empty reference",{node:n});return}const s=wt(n),o=e.forDocument(s).parseFqnRefExpr(n);if(n.$container.$type==="DeploymentViewRulePredicateExpression"){if(Ea.isModelRef(o)){r("error","Deployment view predicate must reference deployment model",{node:n});return}if(Ea.isDeploymentRef(o)&&Da.isInsideInstanceRef(o.ref)){r("error","Must reference deployment nodes or instances, but not internals",{node:n});return}}!bn(i)&&sn(n.selector)&&r("warning",`Selector '${n.selector}' applies to deployment nodes only, ignored here`,{node:n,property:"selector"})})},oK=t=>ft((e,n)=>{if(Hs(e.to)&&!zw(e.$container)){const r=nn(e,oh);Dt(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),aK=t=>ft((e,n)=>{if(Hs(e.from)&&!_w(e.$container)){const r=nn(e,oh);Dt(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),uK=t=>ft((e,n)=>{const r=nn(e,Mp);al(r)&&n("error",'Invalid usage inside "exclude"',{node:e})});function cK(t){return e=>t.some(n=>n(e))}const lK=cK([Mw,ph,fh,ll,Vo,YC,ih,Ww,bw,Tw,Pw,Iw,BU,zo,GU,zC,Lw,YU,Sw,WU,Kw,XU,Sp,Rw,kw,pr,bn,Bi,qC,Mo,Nr,jU,jC,Dh,zn,Go,ta,ra,Zo,_h,Ah,Vw]),dK=t=>{let e=t;for(;e&&!h4(e);){if(lK(e))return e;e=e.$container}};function fK(t){const e=t.state>=je.Validated?t.diagnostics?.filter(r=>r.severity===Au.Error)??[]:[],n=new WeakSet;for(const{node:r}of e){if(Dt(r)||n.has(r))continue;n.add(r);const i=dK(r);i&&n.add(i)}return{isValid:r=>!n.has(r),invalidNodes:n}}function pK(t){Fe.debug("registerValidationChecks"),t.validation.ValidationRegistry.register({DeployedInstance:F5(t),DeploymentNodeKind:J5(t),DeploymentNode:O5(t),DeploymentRelation:L5(t),FqnRefExpr:sK(t),RelationExpr:iK(t),NotesProperty:U5(),OpacityProperty:j5(),IconProperty:G5(),SpecificationRule:V5(),Model:K5(),Globals:Y5(),GlobalPredicateGroup:R_(t),GlobalDynamicPredicateGroup:R_(t),GlobalStyleId:eK(t),DynamicViewStep:B5(t),LikeC4View:tK(t),Element:q5(t),ElementKind:X5(t),Relation:W5(t),RelationBody:H5(),Tag:Q5(t),DynamicViewPredicateIterator:M5(),ElementPredicateWith:nK(),RelationPredicateWith:uK(),ExpandElementExpression:rK(),RelationshipKind:Z5(t),IncomingRelationExpression:oK(),OutgoingRelationExpression:aK()});const e=t.shared.lsp.Connection;e&&t.shared.workspace.DocumentBuilder.onUpdate((n,r)=>{for(const i of r)Fe.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]})})}function Lr(t){return sn(t)?ct(t).split(`
242
+ `).join(" "):void 0}function ct(t){return sn(t)?Fv(t).trim():void 0}class hK{constructor(e,n){this.services=e,this.doc=n,this.isValid=fK(n).isValid}isValid;resolveFqn(e){if(BC(e))return this.services.likec4.DeploymentsIndex.getFqn(e);if(Go(e))return Qh(e.element);const n=this.services.likec4.FqnIndex.getFqn(e);return Ce(n,`Not indexed element: ${this.getAstNodePath(e)}`),n}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){if(!(!e||!this.isValid(e)))return fr(e.props,n=>[n.key,ct(n.value)])}convertTags(e){return this.parseTags(e)}parseTags(e){let n=e?.tags;if(!n)return null;const r=[];for(;n;){try{if(this.isValid(n)){const i=n.values.map(s=>s.ref?.name).filter(ae);i.length>0&&r.push(...i)}}catch{}n=n.prev}return r.reverse(),ir(r)?r:null}convertLinks(e){return this.parseLinks(e)}parseLinks(e){if(!(!e?.props||e.props.length===0))return Qe(e.props,Ge(vh),Ii(n=>{if(!this.isValid(n))return[];const r=n.value;if(ae(r)){const i=ae(n.title)?Lr(n.title):void 0;return i?{url:r,title:i}:{url:r}}return[]}))}}function mK(t){return class extends t{parseDeployment(){const e=this.doc;for(const n of KV(e))try{switch(!0){case Bi(n):{this.isValid(n)&&e.c4DeploymentRelations.push(this.parseDeploymentRelation(n));break}case pr(n):e.c4Deployments.push(this.parseDeployedInstance(n));break;case bn(n):{e.c4Deployments.push(this.parseDeploymentNode(n));break}default:Oe(n)}}catch(r){ve(r)}}parseDeploymentNode(e){const n=this.isValid,r=this.resolveFqn(e),i=dn(e.kind.ref,"DeploymentKind not resolved").name,s=this.convertTags(e.body),o=e.body?.props.find(zi)?.props,a=Yi(o,n),u=this.getMetadata(e.body?.props.find(Mo)),c=Qe(e.body?.props??[],Ge(n),Ge(rl),fr(w=>[w.key,w.value||void 0])),l=ct(e.title??c.title),d=ct(c.description),f=Lr(c.technology),p=this.convertLinks(e.body),h=e.body?.props.find(Ir);if(h&&n(h)){const w=h.libicon?.ref?.name??h.value;ae(w)&&(a.icon=w)}return{id:r,kind:i,title:l??Ld(r),...u&&{metadata:u},...s&&{tags:s},...p&&ir(p)&&{links:p},...ae(f)&&{technology:f},...ae(d)&&{description:d},style:a}}parseDeployedInstance(e){const n=this.isValid,r=this.resolveFqn(e),i=this.resolveFqn(dn(En(e.element),"DeployedInstance element not found")),s=this.convertTags(e.body),o=e.body?.props.find(zi)?.props,a=Yi(o,n),u=this.getMetadata(e.body?.props.find(Mo)),c=Qe(e.body?.props??[],Ge(n),Ge(rl),fr(w=>[w.key,w.value||void 0])),l=ct(e.title??c.title),d=ct(c.description),f=Lr(c.technology),p=this.convertLinks(e.body),h=e.body?.props.find(Ir);if(h&&n(h)){const w=h.libicon?.ref?.name??h.value;ae(w)&&(a.icon=w)}return{id:r,element:i,...u&&{metadata:u},...l&&{title:l},...s&&{tags:s},...p&&ir(p)&&{links:p},...ae(f)&&{technology:f},...ae(d)&&{description:d},style:a}}parseDeploymentRelation(e){const n=this.isValid,r=this.getAstNodePath(e),i=Da.toDeploymentRef(this.parseFqnRef(e.source)),s=Da.toDeploymentRef(this.parseFqnRef(e.target)),o=this.convertTags(e)??this.convertTags(e.body),a=this.convertLinks(e.body),u=e.kind?.ref?.name,c=this.getMetadata(e.body?.props.find(Mo)),l=fr(e.body?.props.filter(Fl)??[],D=>[D.key,D.value]),d=Qe(e.body?.props??[],Ge(Pl),gn(D=>D.value.view.ref?.name),Ge(ae),No()),f=ct(e.title??l.title),p=ct(l.description),h=Lr(e.technology)??ct(l.technology),w=e.body?.props.find(Sh);return{id:wd("deployment",r,i.id,s.id),source:i,target:s,...f&&{title:f},...c&&{metadata:c},...ae(h)&&{technology:h},...ae(p)&&{description:p},...u&&{kind:u},...o&&{tags:o},...ir(a)&&{links:a},..._v(w?.props,n),...d&&{navigateTo:d},astPath:r}}}}function gK(t){for(var e=t.length,n=0,r=0;r<e;){var i=t.charCodeAt(r++);if(i&4294967168)if(!(i&4294965248))n+=2;else{if(i>=55296&&i<=56319&&r<e){var s=t.charCodeAt(r);(s&64512)===56320&&(++r,i=((i&1023)<<10)+(s&1023)+65536)}i&4294901760?n+=4:n+=3}else{n++;continue}}return n}function yK(t,e,n){for(var r=t.length,i=n,s=0;s<r;){var o=t.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){var a=t.charCodeAt(s);(a&64512)===56320&&(++s,o=((o&1023)<<10)+(a&1023)+65536)}o&4294901760?(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128):(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128)}else{e[i++]=o;continue}e[i++]=o&63|128}}var wK=new TextEncoder,vK=50;function bK(t,e,n){wK.encodeInto(t,e.subarray(n))}function DK(t,e,n){t.length>vK?bK(t,e,n):yK(t,e,n)}var EK=4096;function $_(t,e,n){for(var r=e,i=r+n,s=[],o="";r<i;){var a=t[r++];if(!(a&128))s.push(a);else if((a&224)===192){var u=t[r++]&63;s.push((a&31)<<6|u)}else if((a&240)===224){var u=t[r++]&63,c=t[r++]&63;s.push((a&31)<<12|u<<6|c)}else if((a&248)===240){var u=t[r++]&63,c=t[r++]&63,l=t[r++]&63,d=(a&7)<<18|u<<12|c<<6|l;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(a);s.length>=EK&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var RK=new TextDecoder,$K=200;function TK(t,e,n){var r=t.subarray(e,e+n);return RK.decode(r)}function SK(t,e,n){return n>$K?TK(t,e,n):$_(t,e,n)}var im=function(){function t(e,n){this.type=e,this.data=n}return t}(),kK=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mr=function(t){kK(e,t);function e(n){var r=t.call(this,n)||this,i=Object.create(e.prototype);return Object.setPrototypeOf(r,i),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:e.name}),r}return e}(Error),vd=4294967295;function CK(t,e,n){var r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function T_(t,e,n){var r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function S_(t,e){var n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function AK(t,e){var n=t.getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}var _K=-1,PK=4294967296-1,xK=17179869184-1;function IK(t){var e=t.sec,n=t.nsec;if(e>=0&&n>=0&&e<=xK)if(n===0&&e<=PK){var r=new Uint8Array(4),i=new DataView(r.buffer);return i.setUint32(0,e),r}else{var s=e/4294967296,o=e&4294967295,r=new Uint8Array(8),i=new DataView(r.buffer);return i.setUint32(0,n<<2|s&3),i.setUint32(4,o),r}else{var r=new Uint8Array(12),i=new DataView(r.buffer);return i.setUint32(0,n),T_(i,4,e),r}}function NK(t){var e=t.getTime(),n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,i=Math.floor(r/1e9);return{sec:n+i,nsec:r-i*1e9}}function OK(t){if(t instanceof Date){var e=NK(t);return IK(e)}else return null}function FK(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:{var n=e.getUint32(0),r=0;return{sec:n,nsec:r}}case 8:{var i=e.getUint32(0),s=e.getUint32(4),n=(i&3)*4294967296+s,r=i>>>2;return{sec:n,nsec:r}}case 12:{var n=S_(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new Mr("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(t.length))}}function LK(t){var e=FK(t);return new Date(e.sec*1e3+e.nsec/1e6)}var MK={type:_K,encode:OK,decode:LK},k_=function(){function t(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(MK)}return t.prototype.register=function(e){var n=e.type,r=e.encode,i=e.decode;if(n>=0)this.encoders[n]=r,this.decoders[n]=i;else{var s=1+n;this.builtInEncoders[s]=r,this.builtInDecoders[s]=i}},t.prototype.tryToEncode=function(e,n){for(var r=0;r<this.builtInEncoders.length;r++){var i=this.builtInEncoders[r];if(i!=null){var s=i(e,n);if(s!=null){var o=-1-r;return new im(o,s)}}}for(var r=0;r<this.encoders.length;r++){var i=this.encoders[r];if(i!=null){var s=i(e,n);if(s!=null){var o=r;return new im(o,s)}}}return e instanceof im?e:null},t.prototype.decode=function(e,n,r){var i=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return i?i(e,n,r):new im(n,e)},t.defaultCodec=new t,t}();function BK(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function sm(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):BK(t)?new Uint8Array(t):Uint8Array.from(t)}function zK(t){if(t instanceof ArrayBuffer)return new DataView(t);var e=sm(t);return new DataView(e.buffer,e.byteOffset,e.byteLength)}var qK=100,jK=2048,GK=function(){function t(e){var n,r,i,s,o,a,u,c;this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:k_.defaultCodec,this.context=e?.context,this.useBigInt64=(r=e?.useBigInt64)!==null&&r!==void 0?r:!1,this.maxDepth=(i=e?.maxDepth)!==null&&i!==void 0?i:qK,this.initialBufferSize=(s=e?.initialBufferSize)!==null&&s!==void 0?s:jK,this.sortKeys=(o=e?.sortKeys)!==null&&o!==void 0?o:!1,this.forceFloat32=(a=e?.forceFloat32)!==null&&a!==void 0?a:!1,this.ignoreUndefined=(u=e?.ignoreUndefined)!==null&&u!==void 0?u:!1,this.forceIntegerToFloat=(c=e?.forceIntegerToFloat)!==null&&c!==void 0?c:!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return t.prototype.reinitializeState=function(){this.pos=0},t.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},t.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},t.prototype.doEncode=function(e,n){if(n>this.maxDepth)throw new Error("Too deep objects in depth ".concat(n));e==null?this.encodeNil():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)},t.prototype.ensureBufferSizeToWrite=function(e){var n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)},t.prototype.resizeBuffer=function(e){var n=new ArrayBuffer(e),r=new Uint8Array(n),i=new DataView(n);r.set(this.bytes),this.view=i,this.bytes=r},t.prototype.encodeNil=function(){this.writeU8(192)},t.prototype.encodeBoolean=function(e){e===!1?this.writeU8(194):this.writeU8(195)},t.prototype.encodeNumber=function(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)},t.prototype.encodeNumberAsFloat=function(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},t.prototype.encodeBigInt64=function(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))},t.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error("Too long string: ".concat(e," bytes in UTF-8"))},t.prototype.encodeString=function(e){var n=5,r=gK(e);this.ensureBufferSizeToWrite(n+r),this.writeStringHeader(r),DK(e,this.bytes,this.pos),this.pos+=r},t.prototype.encodeObject=function(e,n){var r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)))},t.prototype.encodeBinary=function(e){var n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error("Too large binary: ".concat(n));var r=sm(e);this.writeU8a(r)},t.prototype.encodeArray=function(e,n){var r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error("Too large array: ".concat(r));for(var i=0,s=e;i<s.length;i++){var o=s[i];this.doEncode(o,n+1)}},t.prototype.countWithoutUndefined=function(e,n){for(var r=0,i=0,s=n;i<s.length;i++){var o=s[i];e[o]!==void 0&&r++}return r},t.prototype.encodeMap=function(e,n){var r=Object.keys(e);this.sortKeys&&r.sort();var i=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error("Too large map object: ".concat(i));for(var s=0,o=r;s<o.length;s++){var a=o[s],u=e[a];this.ignoreUndefined&&u===void 0||(this.encodeString(a),this.doEncode(u,n+1))}},t.prototype.encodeExtension=function(e){var n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error("Too large extension object: ".concat(n));this.writeI8(e.type),this.writeU8a(e.data)},t.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},t.prototype.writeU8a=function(e){var n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n},t.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},t.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},t.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},t.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},t.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},t.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},t.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},t.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),CK(this.view,this.pos,e),this.pos+=8},t.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),T_(this.view,this.pos,e),this.pos+=8},t.prototype.writeBigUint64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8},t.prototype.writeBigInt64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8},t}();function UK(t,e){var n=new GK(e);return n.encodeSharedRef(t)}function Bv(t){return"".concat(t<0?"-":"","0x").concat(Math.abs(t).toString(16).padStart(2,"0"))}var WK=16,HK=16,VK=function(){function t(e,n){e===void 0&&(e=WK),n===void 0&&(n=HK),this.maxKeyLength=e,this.maxLengthPerKey=n,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return t.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},t.prototype.find=function(e,n,r){var i=this.caches[r-1];e:for(var s=0,o=i;s<o.length;s++){for(var a=o[s],u=a.bytes,c=0;c<r;c++)if(u[c]!==e[n+c])continue e;return a.str}return null},t.prototype.store=function(e,n){var r=this.caches[e.length-1],i={bytes:e,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)},t.prototype.decode=function(e,n,r){var i=this.find(e,n,r);if(i!=null)return this.hit++,i;this.miss++;var s=$_(e,n,r),o=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(o,s),s},t}(),KK=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(l){try{c(r.next(l))}catch(d){o(d)}}function u(l){try{c(r.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):i(l.value).then(a,u)}c((r=r.apply(t,e||[])).next())})},zv=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(l){return u([c,l])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(l){c=[6,l],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},C_=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(c){s({value:c,done:a})},o)}},fa=function(t){return this instanceof fa?(this.v=t,this):new fa(t)},YK=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(h){return Promise.resolve(h).then(p,d)}}function a(p,h){r[p]&&(i[p]=function(w){return new Promise(function(D,g){s.push([p,w,D,g])>1||u(p,w)})},h&&(i[p]=h(i[p])))}function u(p,h){try{c(r[p](h))}catch(w){f(s[0][3],w)}}function c(p){p.value instanceof fa?Promise.resolve(p.value.v).then(l,d):f(s[0][2],p)}function l(p){u("next",p)}function d(p){u("throw",p)}function f(p,h){p(h),s.shift(),s.length&&u(s[0][0],s[0][1])}},qv="array",bd="map_key",A_="map_value",XK=function(t){return typeof t=="string"||typeof t=="number"},JK=function(){function t(){this.stack=[],this.stackHeadPosition=-1}return Object.defineProperty(t.prototype,"length",{get:function(){return this.stackHeadPosition+1},enumerable:!1,configurable:!0}),t.prototype.top=function(){return this.stack[this.stackHeadPosition]},t.prototype.pushArrayState=function(e){var n=this.getUninitializedStateFromPool();n.type=qv,n.position=0,n.size=e,n.array=new Array(e)},t.prototype.pushMapState=function(e){var n=this.getUninitializedStateFromPool();n.type=bd,n.readCount=0,n.size=e,n.map={}},t.prototype.getUninitializedStateFromPool=function(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){var e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]},t.prototype.release=function(e){var n=this.stack[this.stackHeadPosition];if(n!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===qv){var r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===bd||e.type===A_){var r=e;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--},t.prototype.reset=function(){this.stack.length=0,this.stackHeadPosition=-1},t}(),Dd=-1,jv=new DataView(new ArrayBuffer(0)),QK=new Uint8Array(jv.buffer);try{jv.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")}var Gv=RangeError,__=new Gv("Insufficient data"),ZK=new VK,eY=function(){function t(e){var n,r,i,s,o,a,u,c;this.totalPos=0,this.pos=0,this.view=jv,this.bytes=QK,this.headByte=Dd,this.stack=new JK,this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:k_.defaultCodec,this.context=e?.context,this.useBigInt64=(r=e?.useBigInt64)!==null&&r!==void 0?r:!1,this.rawStrings=(i=e?.rawStrings)!==null&&i!==void 0?i:!1,this.maxStrLength=(s=e?.maxStrLength)!==null&&s!==void 0?s:vd,this.maxBinLength=(o=e?.maxBinLength)!==null&&o!==void 0?o:vd,this.maxArrayLength=(a=e?.maxArrayLength)!==null&&a!==void 0?a:vd,this.maxMapLength=(u=e?.maxMapLength)!==null&&u!==void 0?u:vd,this.maxExtLength=(c=e?.maxExtLength)!==null&&c!==void 0?c:vd,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:ZK}return t.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=Dd,this.stack.reset()},t.prototype.setBuffer=function(e){this.bytes=sm(e),this.view=zK(this.bytes),this.pos=0},t.prototype.appendBuffer=function(e){if(this.headByte===Dd&&!this.hasRemaining(1))this.setBuffer(e);else{var n=this.bytes.subarray(this.pos),r=sm(e),i=new Uint8Array(n.length+r.length);i.set(n),i.set(r,n.length),this.setBuffer(i)}},t.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},t.prototype.createExtraByteError=function(e){var n=this,r=n.view,i=n.pos;return new RangeError("Extra ".concat(r.byteLength-i," of ").concat(r.byteLength," byte(s) found at buffer[").concat(e,"]"))},t.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n},t.prototype.decodeMulti=function(e){return zv(this,function(n){switch(n.label){case 0:this.reinitializeState(),this.setBuffer(e),n.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return n.sent(),[3,1];case 3:return[2]}})},t.prototype.decodeAsync=function(e){return KK(this,void 0,void 0,function(){var n,r,i,s,o,a,u,c,l,d,f,p,h,w,D;return zv(this,function(g){switch(g.label){case 0:n=!1,g.label=1;case 1:g.trys.push([1,6,7,12]),l=!0,d=C_(e),g.label=2;case 2:return[4,d.next()];case 3:if(f=g.sent(),p=f.done,!!p)return[3,5];if(D=f.value,l=!1,i=D,n)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i);try{r=this.doDecodeSync(),n=!0}catch(v){if(!(v instanceof Gv))throw v}this.totalPos+=this.pos,g.label=4;case 4:return l=!0,[3,2];case 5:return[3,12];case 6:return s=g.sent(),h={error:s},[3,12];case 7:return g.trys.push([7,,10,11]),!l&&!p&&(w=d.return)?[4,w.call(d)]:[3,9];case 8:g.sent(),g.label=9;case 9:return[3,11];case 10:if(h)throw h.error;return[7];case 11:return[7];case 12:if(n){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,r]}throw o=this,a=o.headByte,u=o.pos,c=o.totalPos,new RangeError("Insufficient data in parsing ".concat(Bv(a)," at ").concat(c," (").concat(u," in the current buffer)"))}})})},t.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},t.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},t.prototype.decodeMultiAsync=function(e,n){return YK(this,arguments,function(){var i,s,o,a,u,c,l,d,f,p,h,w;return zv(this,function(D){switch(D.label){case 0:i=n,s=-1,D.label=1;case 1:D.trys.push([1,13,14,19]),o=!0,a=C_(e),D.label=2;case 2:return[4,fa(a.next())];case 3:if(u=D.sent(),f=u.done,!!f)return[3,12];if(w=u.value,o=!1,c=w,n&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(c),i&&(s=this.readArraySize(),i=!1,this.complete()),D.label=4;case 4:D.trys.push([4,9,,10]),D.label=5;case 5:return[4,fa(this.doDecodeSync())];case 6:return[4,D.sent()];case 7:return D.sent(),--s===0?[3,8]:[3,5];case 8:return[3,10];case 9:if(l=D.sent(),!(l instanceof Gv))throw l;return[3,10];case 10:this.totalPos+=this.pos,D.label=11;case 11:return o=!0,[3,2];case 12:return[3,19];case 13:return d=D.sent(),p={error:d},[3,19];case 14:return D.trys.push([14,,17,18]),!o&&!f&&(h=a.return)?[4,fa(h.call(a))]:[3,16];case 15:D.sent(),D.label=16;case 16:return[3,18];case 17:if(p)throw p.error;return[7];case 18:return[7];case 19:return[2]}})})},t.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),n=void 0;if(e>=224)n=e-256;else if(e<192)if(e<128)n=e;else if(e<144){var r=e-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e<160){var r=e-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else{var i=e-160;n=this.decodeString(i,0)}else if(e===192)n=null;else if(e===194)n=!1;else if(e===195)n=!0;else if(e===202)n=this.readF32();else if(e===203)n=this.readF64();else if(e===204)n=this.readU8();else if(e===205)n=this.readU16();else if(e===206)n=this.readU32();else if(e===207)this.useBigInt64?n=this.readU64AsBigInt():n=this.readU64();else if(e===208)n=this.readI8();else if(e===209)n=this.readI16();else if(e===210)n=this.readI32();else if(e===211)this.useBigInt64?n=this.readI64AsBigInt():n=this.readI64();else if(e===217){var i=this.lookU8();n=this.decodeString(i,1)}else if(e===218){var i=this.lookU16();n=this.decodeString(i,2)}else if(e===219){var i=this.lookU32();n=this.decodeString(i,4)}else if(e===220){var r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else if(e===221){var r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else if(e===222){var r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e===223){var r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e===196){var r=this.lookU8();n=this.decodeBinary(r,1)}else if(e===197){var r=this.lookU16();n=this.decodeBinary(r,2)}else if(e===198){var r=this.lookU32();n=this.decodeBinary(r,4)}else if(e===212)n=this.decodeExtension(1,0);else if(e===213)n=this.decodeExtension(2,0);else if(e===214)n=this.decodeExtension(4,0);else if(e===215)n=this.decodeExtension(8,0);else if(e===216)n=this.decodeExtension(16,0);else if(e===199){var r=this.lookU8();n=this.decodeExtension(r,1)}else if(e===200){var r=this.lookU16();n=this.decodeExtension(r,2)}else if(e===201){var r=this.lookU32();n=this.decodeExtension(r,4)}else throw new Mr("Unrecognized type byte: ".concat(Bv(e)));this.complete();for(var s=this.stack;s.length>0;){var o=s.top();if(o.type===qv)if(o.array[o.position]=n,o.position++,o.position===o.size)n=o.array,s.release(o);else continue e;else if(o.type===bd){if(!XK(n))throw new Mr("The type of key must be string or number but "+typeof n);if(n==="__proto__")throw new Mr("The key __proto__ is not allowed");o.key=n,o.type=A_;continue e}else if(o.map[o.key]=n,o.readCount++,o.readCount===o.size)n=o.map,s.release(o);else{o.key=null,o.type=bd;continue e}}return n}},t.prototype.readHeadByte=function(){return this.headByte===Dd&&(this.headByte=this.readU8()),this.headByte},t.prototype.complete=function(){this.headByte=Dd},t.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new Mr("Unrecognized array type byte: ".concat(Bv(e)))}}},t.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Mr("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.pushMapState(e)},t.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new Mr("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.pushArrayState(e)},t.prototype.decodeString=function(e,n){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,n):this.decodeBinary(e,n)},t.prototype.decodeUtf8String=function(e,n){var r;if(e>this.maxStrLength)throw new Mr("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+n+e)throw __;var i=this.pos+n,s;return this.stateIsMapKey()&&(!((r=this.keyDecoder)===null||r===void 0)&&r.canBeCached(e))?s=this.keyDecoder.decode(this.bytes,i,e):s=SK(this.bytes,i,e),this.pos+=n+e,s},t.prototype.stateIsMapKey=function(){if(this.stack.length>0){var e=this.stack.top();return e.type===bd}return!1},t.prototype.decodeBinary=function(e,n){if(e>this.maxBinLength)throw new Mr("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+n))throw __;var r=this.pos+n,i=this.bytes.subarray(r,r+e);return this.pos+=n+e,i},t.prototype.decodeExtension=function(e,n){if(e>this.maxExtLength)throw new Mr("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var r=this.view.getInt8(this.pos+n),i=this.decodeBinary(e,n+1);return this.extensionCodec.decode(i,r,this.context)},t.prototype.lookU8=function(){return this.view.getUint8(this.pos)},t.prototype.lookU16=function(){return this.view.getUint16(this.pos)},t.prototype.lookU32=function(){return this.view.getUint32(this.pos)},t.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},t.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},t.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},t.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},t.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},t.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},t.prototype.readU64=function(){var e=AK(this.view,this.pos);return this.pos+=8,e},t.prototype.readI64=function(){var e=S_(this.view,this.pos);return this.pos+=8,e},t.prototype.readU64AsBigInt=function(){var e=this.view.getBigUint64(this.pos);return this.pos+=8,e},t.prototype.readI64AsBigInt=function(){var e=this.view.getBigInt64(this.pos);return this.pos+=8,e},t.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},t.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},t}();function tY(t,e){var n=new eY(e);return n.decode(t)}const nY=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",rY=(t,e=0,n=t.byteLength-e)=>{if(!nY(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Mm.from(t,e,n)},P_=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Mm.from(t,e):Mm.from(t)},iY=/^[A-Za-z0-9+/]*={0,2}$/,sY=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!iY.exec(t))throw new TypeError("Invalid base64 string.");const e=P_(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},oY=t=>{const e=P_(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},aY=t=>{let e;if(typeof t=="string"?e=oY(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return rY(e.buffer,e.byteOffset,e.byteLength).toString("base64")},{getDocument:uY}=su;function cY({nodes:t,edges:e,...n}){return{...n,nodes:Lu(t,({x:r,y:i,width:s,height:o,isCompound:a,...u})=>({...u,b:[r,i,s,o],c:a})),edges:Lu(e,({points:r,controlPoints:i,labelBBox:s,dotpos:o,...a})=>({...!!i&&{cp:i},...!!s&&{l:s},...!!o&&{dp:o},...a,p:r}))}}function lY({nodes:t,edges:e,autoLayout:n,...r}){return{...r,autoLayout:V1(n)?{direction:n}:n,nodes:Lu(t,({b:i,c:s,...o})=>({x:i[0],y:i[1],width:i[2],height:i[3],isCompound:s,...o})),edges:Lu(e,({p:i,cp:s,l:o,dp:a,...u})=>({...!!s&&{controlPoints:s},...!!o&&{labelBBox:o},...!!a&&{dotpos:a},...u,points:i}))}}const x_=500;function dY(t){const e=UK(cY(t)),n=aY(e),r=[];let i=0;for(;i<n.length;)r.push(" * "+n.slice(i,Math.min(i+x_,n.length))),i+=x_;return r.unshift("/**"," * @likec4-generated(v1)"),r.push(" */"),r.join(`
243
+ `)}function I_(t){return t.includes("@likec4-generated")}function fY(t){if(!I_(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
244
+ `).filter(r=>!r.includes("**")&&!r.includes("@likec4-")&&!r.includes("*/")).map(r=>r.replaceAll("*","").trim()).join(""),n=sY(e);return lY(tY(n))}function Uv(t){const e=Hd(t.$cstNode,["BLOCK_COMMENT"]);if(!(!e||!I_(e.text)))try{return fY(e.text)}catch(n){const r=uY(t);Fe.warn(n),Fe.warn(`Ignoring manual layout of "${t.name??"unnamed"}" at ${r.uri.fsPath}:${1+(e.range.start.line||0)}`);return}}function pY(t){return class extends t{parseDeploymentView(e){const n=e.body;Ce(n,"DynamicElementView body is not defined");const r=n.props.filter(this.isValid),i=this.getAstNodePath(e);let s=e.name;s||(s="deployment_"+wd(this.doc.uri.toString(),i));const o=Lr(r.find(d=>d.key==="title")?.value)??null,a=ct(r.find(d=>d.key==="description")?.value)??null,u=this.convertTags(n),c=this.convertLinks(n);Zh.writeId(e,s);const l=Uv(e);return{__:"deployment",id:s,astPath:i,title:o,description:a,tags:u,links:ir(c)?c:null,rules:n.rules.flatMap(d=>{try{return this.isValid(d)?this.parseDeploymentViewRule(d):[]}catch(f){return ve(f),[]}}),...l&&{manualLayout:l}}}parseDeploymentViewRule(e){if(zo(e))return this.parseDeploymentViewRulePredicate(e);if(jl(e))return Pv(e);if(HC(e))return this.parseDeploymentViewRuleStyle(e);Oe(e)}parseDeploymentViewRulePredicate(e){const n=[];let r=e.expr;for(;r;){try{const i=r.value;if(sn(i)&&this.isValid(i))switch(!0){case UU(i):n.unshift(this.parseFqnExpr(i));break;case zC(i):n.unshift(this.parseRelationExpr(i));break;case w4(i):n.unshift(this.parseRelationWhereExpr(i));break;default:Oe(i)}}catch(i){ve(i)}r=r.prev}return e.isInclude?{include:n}:{exclude:n}}parseDeploymentViewRuleStyle(e){const n=e.props.filter(Sw),r=e.props.find(Jo),i=ct(r?.value);return{targets:this.parseFqnExpressions(e.targets),...i&&{notation:i},style:{...Yi(n,this.isValid)}}}}}function hY(t){let e;for(;e=t.value?.ref;){if(bn(e))return null;if(pr(e))return e;if(Dt(t.parent))return null;t=t.parent}return null}const N_=({operator:t,not:e},n)=>t.startsWith("!=")?{neq:n}:t.startsWith("=")?{eq:n}:e?{neq:n}:{eq:n};function O_(t){return!mA(t)&&!gA(t)?null:t.participant}function pa(t){switch(!0){case e4(t):{const e=t.value?.ref?.name,n=O_(t);Ce(e,"Expected tag name");const r={tag:N_(t,e)};return n?{participant:n,operator:r}:r}case QU(t):{const e=t.value?.ref?.name,n=O_(t);Ce(e,"Expected kind name");const r={kind:N_(t,e)};return n?{participant:n,operator:r}:r}case(fA(t)||hA(t)):return{not:pa(t.value)};case D4(t):{const e=pa(t.left),n=pa(t.right),r=t.operator.toLowerCase();switch(r){case"and":{const i=[RD(e)?e.and:e,RD(n)?n.and:n].flat();return Ce(ir(i),"Expected non-empty array"),{and:i}}case"or":{const i=[ED(e)?e.or:e,ED(n)?n.or:n].flat();return Ce(ir(i),"Expected non-empty array"),{or:i}}default:Oe(r)}}default:Oe(t)}}function mY(t){return class extends t{parseFqnRef(e){const n=dn(e.value.ref,`FqnRef is empty ${e.$cstNode?.range.start.line}:${e.$cstNode?.range.start.character}`);if(zn(n)){const r=hY(e);if(!r)return{model:this.resolveFqn(n)};const i=this.resolveFqn(r),s=this.resolveFqn(n);return{deployment:i,element:s}}if(BC(n))return{deployment:this.resolveFqn(n)};Oe(n)}parseFqnExpr(e){if(Hs(e))return{wildcard:!0};if(Lw(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{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{sn(r.value)&&this.isValid(r.value)&&n.push(this.parseFqnExpr(r.value))}catch(i){ve(i)}r=r.prev}return n.reverse()}parseRelationWhereExpr(e){return{where:{expr:this.parseRelationExpr(e.subject),condition:e.where?pa(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationExpr(e){if(Uw(e),Aw(e))return{source:this.parseFqnExpr(e.source.from),target:this.parseFqnExpr(e.target),isBidirectional:e.source.isBidirectional};if(nA(e))return{inout:this.parseFqnExpr(e.inout.to)};if(jw(e))return{outgoing:this.parseFqnExpr(e.from)};if(Bw(e))return{incoming:this.parseFqnExpr(e.to)};Oe(e)}}}function gY(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(!ae(u))continue;if(u in n.predicates){Fe.warn(`Global predicate named "${u}" is already defined`);continue}this.parseAndStoreGlobalPredicateGroupOrDynamic(a,u,n)}catch(u){ve(u)}const o=i.flatMap(a=>a.styles.filter(r));for(const a of o)try{const u=a.id.name;if(!ae(u))continue;if(u in n.styles){Fe.warn(`Global style named "${u}" is already defined`);continue}const c=this.parseGlobalStyleOrGroup(a);c.length>0&&(n.styles[u]=c)}catch(u){ve(u)}}parseAndStoreGlobalPredicateGroupOrDynamic(e,n,r){if(ph(e)){const i=this.parseGlobalPredicateGroup(e);i.length>0&&(r.predicates[n]=i);return}if(fh(e)){const i=this.parseGlobalDynamicPredicateGroup(e);i.length>0&&(r.dynamicPredicates[n]=i);return}Oe(e)}parseGlobalPredicateGroup(e){return e.predicates.map(n=>this.parseViewRulePredicate(n))}parseGlobalDynamicPredicateGroup(e){return e.predicates.map(n=>this.parseDynamicViewIncludePredicate(n))}parseGlobalStyleOrGroup(e){if(ll(e))return[this.parseViewRuleStyle(e)];if(Vo(e))return e.styles.map(n=>this.parseViewRuleStyle(n));Oe(e)}}}function yY(t){return class extends t{parseModel(){const e=this.doc;for(const n of VV(e))try{if(zn(n)){e.c4Elements.push(this.parseElement(n));continue}if(Nr(n)){this.isValid(n)&&e.c4Relations.push(this.parseRelation(n));continue}Oe(n)}catch(r){ve(r)}}parseElement(e){const n=this.isValid,r=this.resolveFqn(e),i=dn(e.kind.ref,"Element kind is not resolved").name,s=this.parseTags(e.body),o=e.body?.props.find(zi)?.props,a=Yi(o,n),u=this.getMetadata(e.body?.props.find(Mo)),c=this.getAstNodePath(e);let[l,d,f]=e.props??[];const p=Qe(e.body?.props??[],Ge(n),Ge(rl),fr(D=>[D.key,D.value||void 0]));l=ct(l??p.title),d=ct(p.description??d),f=Lr(p.technology??f);const h=this.parseLinks(e.body),w=e.body?.props.find(Ir);if(w&&n(w)){const D=w.libicon?.ref?.name??w.value;ae(D)&&(a.icon=D)}return{id:r,kind:i,astPath:c,title:l??e.name,...u&&{metadata:u},...s&&{tags:s},...h&&ir(h)&&{links:h},...ae(f)&&{technology:f},...ae(d)&&{description:d},style:a}}parseRelation(e){const n=this.isValid,r=YV(e),i=this.resolveFqn(r.target),s=this.resolveFqn(r.source),o=this.parseTags(e)??this.parseTags(e.body),a=this.parseLinks(e.body),u=e.kind?.ref?.name,c=this.getMetadata(e.body?.props.find(Mo)),l=this.getAstNodePath(e),d=fr(e.body?.props.filter(Fl).filter(g=>sn(g.value))??[],g=>[g.key,g.value]),f=Qe(e.body?.props??[],Ge(Pl),gn(g=>g.value.view.ref?.name),Ge(ae),No()),p=ct(e.title??d.title)??"",h=ct(d.description),w=Lr(e.technology)??ct(d.technology),D=e.body?.props.find(Sh);return{id:wd(l,s,i),astPath:l,source:s,target:i,title:p,...c&&{metadata:c},...ae(w)&&{technology:w},...ae(h)&&{description:h},...u&&{kind:u},...o&&{tags:o},...ir(a)&&{links:a},..._v(D?.props,n),...f&&{navigateTo:f}}}}}function wY(t){return class extends t{parsePredicate(e){if(zU(e))return this.parseElementPredicate(e);if(HU(e))return this.parseRelationPredicate(e);Oe(e)}parseElementPredicate(e){if(ih(e))return this.parseElementPredicateWith(e);if(Ow(e))return this.parseElementPredicateWhere(e);if(bw(e))return this.parseElementExpression(e);Oe(e)}parseElementExpressionsIterator(e){const n=[];let r=e;for(;r;){try{r.value&&n.unshift(this.parseElementExpression(r.value))}catch(i){ve(i)}r=r.prev}return n}parseElementExpression(e){if(Hs(e))return{wildcard:!0};if(rh(e))return Ce(e.kind?.ref,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.ref.name,isEqual:e.isEqual};if(sh(e)){Ce(e.tag?.ref,"ElementTagExpr tag is not resolved: "+e.$cstNode?.text);let n=e.tag.$refText;return n.startsWith("#")&&(n=n.slice(1)),{elementTag:n,isEqual:e.isEqual}}if(JC(e)){const n=En(e.expand);return Ce(n,"Element not found "+e.expand.$cstNode?.text),{expanded:this.resolveFqn(n)}}if(Nw(e)){const n=En(e.parent);return Ce(n,"Element not found "+e.parent.$cstNode?.text),{element:this.resolveFqn(n),isChildren:e.suffix===".*",isDescendants:e.suffix===".**"}}if(tl(e)){const n=En(e);return Ce(n,"Element not found "+e.$cstNode?.text),{element:this.resolveFqn(n)}}Oe(e)}parseElementPredicateWhere(e){return{where:{expr:this.parseElementExpression(e.subject),condition:e.where?pa(e.where):{kind:{neq:"--always-true--"}}}}}parseElementPredicateWith(e){const n=this.parseElementPredicate(e.subject);return(e.custom?.props??[]).reduce((r,i)=>{if(!this.isValid(i))return r;if(Dh(i)){const s=i.value.view.$refText;return ae(s)&&(r.custom.navigateTo=s),r}if(rl(i))return Jt(i.value)&&(r.custom[i.key]=ct(i.value)||""),r;if(Ir(i)){const s=i.libicon?.ref?.name??i.value;return Jt(s)&&(r.custom[i.key]=s),r}if(js(i)){const s=yd(i);return Jt(s)&&(r.custom[i.key]=s),r}if(kh(i)||jp(i))return Jt(i.value)&&(r.custom[i.key]=i.value),r;if(Eh(i))return Jt(i.value)&&(r.custom[i.key]=m_(i)),r;if(Jo(i))return ae(i.value)&&(r.custom[i.key]=ct(i.value)),r;if(qw(i))return Yy(i.value)&&(r.custom[i.key]=i.value),r;Oe(i)},{custom:{expr:n}})}parseRelationPredicate(e){if(Ww(e)){let n=Uw(e.subject)?this.parseRelationPredicateWhere(e.subject):this.parseRelationExpression(e.subject);return this.parseRelationPredicateWith(e,n)}if(Uw(e))return this.parseRelationPredicateWhere(e);if(Tw(e))return this.parseRelationExpression(e);Oe(e)}parseRelationPredicateWhere(e){return{where:{expr:this.parseRelationExpression(e.subject),condition:e.where?pa(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicateWith(e,n){return(e.custom?.props??[]).reduce((r,i)=>{if(Fl(i)||Jo(i)||oA(i))return Jt(i.value)&&(r.customRelation[i.key]=ct(i.value)??""),r;if(Bc(i))return ae(i.value)&&(r.customRelation[i.key]=i.value),r;if(js(i)){const s=yd(i);return ae(s)&&(r.customRelation[i.key]=s),r}if(vl(i))return ae(i.value)&&(r.customRelation[i.key]=i.value),r;if(Pl(i)){const s=i.value.view.ref?.name;return ae(s)&&(r.customRelation.navigateTo=s),r}Oe(i)},{customRelation:{relation:n}})}parseRelationExpression(e){if(_w(e))return{source:this.parseElementExpression(e.source.from),target:this.parseElementExpression(e.target),isBidirectional:e.source.isBidirectional};if(zw(e))return{inout:this.parseElementExpression(e.inout.to)};if(Gw(e))return{outgoing:this.parseElementExpression(e.from)};if(tA(e))return{incoming:this.parseElementExpression(e.to)};Oe(e)}}}function vY(t){return class extends t{parseSpecification(){const{parseResult:{value:{specifications:e}},c4Specification:n}=this.doc,r=this.isValid,i=e.flatMap(c=>c.elements.filter(this.isValid));for(const{kind:c,props:l}of i)try{const d=c.name;if(!ae(d))continue;if(d in n.elements){Fe.warn(`Element kind "${d}" is already defined`);continue}const f=l.find(zi),p=Qe(l.filter(Hw)??[],Ge(h=>this.isValid(h)&&sn(h.value)),fr(h=>[h.key,ct(h.value)]));n.elements[d]={...p,style:{...Yi(f?.props,this.isValid)}}}catch(d){ve(d)}const s=e.flatMap(c=>c.relationships.filter(this.isValid));for(const{kind:c,props:l}of s)try{const d=c.name;if(!ae(d))continue;if(d in n.relationships){Fe.warn(`Relationship kind "${d}" is already defined`);continue}const f=Qe(l.filter(uA)??[],Ge(p=>this.isValid(p)&&sn(p.value)),fr(p=>[p.key,ct(p.value)]));n.relationships[d]={...f,..._v(l,this.isValid)}}catch(d){ve(d)}const o=e.flatMap(c=>c.tags.filter(this.isValid));for(const c of o){const l=c.tag.name;ae(l)&&n.tags.add(l)}const a=e.flatMap(c=>c.deploymentNodes.filter(r));for(const c of a)try{Object.assign(n.deployments,this.parseSpecificationDeploymentNodeKind(c))}catch(l){ve(l)}const u=e.flatMap(c=>c.colors.filter(r));for(const{name:c,color:l}of u)try{const d=c.name;if(d in n.colors){Fe.warn(`Custom color "${d}" is already defined`);continue}n.colors[d]={color:l}}catch(d){ve(d)}}parseSpecificationDeploymentNodeKind({kind:e,props:n}){const r=e.name;if(!ae(r))throw new Error("DeploymentNodeKind name is not resolved");const i=n.find(zi),s=Qe(n.filter(Hw)??[],Ge(o=>this.isValid(o)&&sn(o.value)),fr(o=>[o.key,ct(o.value)]));return{[r]:{...s,style:{...Yi(i?.props,this.isValid)}}}}}}function bY(t){return class extends t{parseViews(){const e=this.isValid;for(const n of this.doc.parseResult.value.views){const r=n.styles.flatMap(i=>{try{return e(i)?this.parseViewRuleStyleOrGlobalRef(i):[]}catch(s){return ve(s),[]}});for(const i of n.views)try{if(!e(i))continue;switch(!0){case oh(i):this.doc.c4Views.push(this.parseElementView(i,r));break;case VC(i):this.doc.c4Views.push(this.parseDynamicElementView(i,r));break;case Cw(i):this.doc.c4Views.push(this.parseDeploymentView(i));break;default:Oe(i)}}catch(s){ve(s)}}}parseElementView(e,n){const r=e.body;Ce(r,"ElementView body is not defined");const i=this.getAstNodePath(e);let s=null;if("viewOf"in e){const p=En(e.viewOf),h=p&&this.resolveFqn(p);h?s=h:Fe.warn("viewOf is not resolved: "+e.$cstNode?.text)}let o=e.name;o||(o="view_"+wd(this.doc.uri.toString(),i,s??""));const a=Lr(r.props.find(p=>p.key==="title")?.value)??null,u=ct(r.props.find(p=>p.key==="description")?.value)??null,c=this.convertTags(r),l=this.convertLinks(r),d=Uv(e),f={__:"element",id:o,astPath:i,title:a,description:u,tags:c,links:ir(l)?l:null,rules:[...n,...r.rules.flatMap(p=>{try{return this.isValid(p)?this.parseViewRule(p):[]}catch(h){return ve(h),[]}})],...s&&{viewOf:s},...d&&{manualLayout:d}};if(Zh.writeId(e,f.id),"extends"in e){const p=e.extends.view.ref;return Ce(p?.name,"view extends is not resolved: "+e.$cstNode?.text),Object.assign(f,{extends:p.name})}return f}parseViewRule(e){if(Mp(e))return this.parseViewRulePredicate(e);if(lA(e))return this.parseViewRuleGlobalPredicateRef(e);if(kw(e))return this.parseViewRuleStyleOrGlobalRef(e);if(jl(e))return Pv(e);if(xh(e))return this.parseViewRuleGroup(e);Oe(e)}parseViewRulePredicate(e){const n=[];let r=e.predicates;for(;r;){const{value:i,prev:s}=r;try{ae(i)&&this.isValid(i)&&n.unshift(this.parsePredicate(i))}catch(o){ve(o)}if(!s)break;r=s}return gh(e)?{include:n}:{exclude:n}}parseViewRuleGlobalPredicateRef(e){return{predicateId:e.predicate.$refText}}parseViewRuleStyleOrGlobalRef(e){if(Vl(e))return this.parseViewRuleStyle(e);if(dA(e))return this.parseViewRuleGlobalStyle(e);Oe(e)}parseViewRuleGroup(e){const n=[];for(const r of e.groupRules)try{if(!this.isValid(r))continue;if(Mp(r)){n.push(this.parseViewRulePredicate(r));continue}if(xh(r)){n.push(this.parseViewRuleGroup(r));continue}Oe(r)}catch(i){ve(i)}return{title:Lr(e.title)??null,groupRules:n,...Yi(e.props,this.isValid)}}parseViewRuleStyle(e){const n=e.props.filter(Sw),r=e.target,i=e.props.find(Jo);return this.parseRuleStyle(n,r,i)}parseRuleStyle(e,n,r){const i=Yi(e,this.isValid),s=ct(r?.value);return{targets:this.parseElementExpressionsIterator(n),...s&&{notation:s},style:{...i}}}parseViewRuleGlobalStyle(e){return{styleId:e.style.$refText}}parseDynamicElementView(e,n){const r=e.body;Ce(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_"+wd(this.doc.uri.toString(),o));const u=Lr(s.find(p=>p.key==="title")?.value)??null,c=ct(s.find(p=>p.key==="description")?.value)??null,l=this.convertTags(r),d=this.convertLinks(r);Zh.writeId(e,a);const f=Uv(e);return{__:"dynamic",id:a,astPath:o,title:u,description:c,tags:l,links:ir(d)?d:null,rules:[...n,...r.rules.flatMap(p=>{try{return i(p)?this.parseDynamicViewRule(p):[]}catch(h){return ve(h),[]}},[])],steps:r.steps.reduce((p,h)=>{try{i(h)&&(Pw(h)?p.push(this.parseDynamicParallelSteps(h)):p.push(this.parseDynamicStep(h)))}catch(w){ve(w)}return p},[]),...f&&{manualLayout:f}}}parseDynamicViewRule(e){if(c4(e))return this.parseDynamicViewIncludePredicate(e);if(KC(e))return this.parseViewRuleGlobalPredicateRef(e);if(kw(e))return this.parseViewRuleStyleOrGlobalRef(e);if(jl(e))return Pv(e);Oe(e)}parseDynamicViewIncludePredicate(e){const n=[];let r=e.predicates;for(;r;){try{if(sn(r.value)&&this.isValid(r.value)){const i=this.parseElementPredicate(r.value);n.unshift(i)}}catch(i){ve(i)}r=r.prev}return{include:n}}parseDynamicParallelSteps(e){return{__parallel:e.steps.map(n=>this.parseDynamicStep(n))}}parseDynamicStep(e){const n=En(e.source);if(!n)throw new Error("Invalid reference to source");const r=En(e.target);if(!r)throw new Error("Invalid reference to target");let i=this.resolveFqn(n),s=this.resolveFqn(r);const o=ct(e.title)??null;let a={source:i,target:s,title:o};if(e.isBackward&&(a={source:s,target:i,title:o,isBackward:!0}),!pG(e.custom?.props))return a;for(const u of e.custom.props)try{switch(!0){case Pl(u):{const c=u.value.view.ref?.name;ae(c)&&(a.navigateTo=c);break}case Fl(u):case Jo(u):case oA(u):{Jt(u.value)&&(a[u.key]=ct(u.value)??"");break}case Bc(u):{Jt(u.value)&&(a[u.key]=u.value);break}case js(u):{const c=yd(u);Jt(c)&&(a[u.key]=c);break}case vl(u):{Jt(u.value)&&(a[u.key]=u.value);break}default:Oe(u)}}catch(c){ve(c)}return a}}}const DY=Qe(hK,mY,yY,mK,pY,wY,vY,bY,gY);class EY extends DY{}class RY{constructor(e){this.services=e,this.cachedParsers=new tS(e.shared,je.Validated)}cachedParsers;parse(e){Ce(Av(e),`Not a FqnIndexedDocument: ${e.uri.toString(!0)}`);try{e=Object.assign(e,{c4Specification:{tags:new Set,elements:{},relationships:{},colors:{},deployments:{}},c4Elements:[],c4Relations:[],c4Deployments:[],c4DeploymentRelations:[],c4Globals:{predicates:{},dynamicPredicates:{},styles:{}},c4Views:[]});const n=this.forDocument(e);return n.parseSpecification(),n.parseModel(),n.parseGlobals(),n.parseDeployment(),n.parseViews(),n.doc}catch(n){throw new Error(`Error parsing document ${e.uri.toString()}`,{cause:n})}}forDocument(e){return Ce(Av(e),`Not a FqnIndexedDocument: ${e.uri.toString(!0)}`),this.cachedParsers.get(e.uri,"DocumentParser",()=>new EY(this.services,e))}}const{findNodeForKeyword:$Y,findNodeForProperty:Yae}=ff,TY=(t,e,n=0)=>{const r=n>0?" ".repeat(n):"";return[r+`style ${t} {`,...wp(e).map(([i,s])=>r+` ${i} ${i==="opacity"?s.toString()+"%":s}`),r+"}"]},SY=(t,e)=>n=>{if(!Vl(n))return!1;const r=n.target.value;if(!r||ae(n.target.prev)||!tl(r))return!1;const i=r.el.ref;return(i?e.getFqn(i):null)===t};function kY(t,{view:e,viewAst:n,targets:r,style:i}){Ce(n.body,`View ${e.id} has no body`);const s=n.$cstNode;Ce(s,"viewCstNode");const o=Mu(n.body.rules)?.$cstNode?.range.end??n.body.$cstNode?.range.end;Ce(o,"insertPos is not defined");const a=s.range.start.character+2,u=t.likec4.FqnIndex,c=Ge(n.body.rules,Vl),l=e.__==="element"?e.viewOf:null,d=[],f=[];r.forEach(D=>{const g=_S(c,SY(D,u)),v=l&&Fm(l,D)?D.substring(l.length+1):D;g?d.push({fqn:v,rule:g}):f.push({fqn:v})});const p={start:o,end:o},h=D=>{D.start.line<=p.start.line&&(D.start.line==p.start.line?p.start.character=Math.min(D.start.character,p.start.character):p.start=D.start),D.end.line>=p.end.line&&(D.end.line==p.end.line?p.end.character=Math.max(D.end.character,p.end.character):p.end=D.end)},w=[];if(f.length>0){const D=f.flatMap(({fqn:g})=>TY(g,i,a));w.push(_n.insert(o,`
245
+ `+D.join(`
246
+ `))),p.start={line:o.line+1,character:a},p.end={line:o.line+D.length,character:Mu(D)?.length??0}}if(d.length>0)for(const{rule:D}of d){const g=D.$cstNode;Ce(g,"RuleCstNode not found");for(const[v,E]of wp(i)){const k=v==="opacity"?E.toString()+"%":E,P=D.props.find(J=>J.key===v);if(P&&P.$cstNode){const{range:{start:J,end:fe}}=P.$cstNode;h({start:J,end:fe}),w.push(_n.replace({start:J,end:fe},v+" "+k));continue}const G=$Y(g,"{")?.range.end;Ce(G,"Opening brace not found");const W=" ".repeat(2+g.range.start.character),Z=W+v+" "+k;w.push(_n.insert(G,`
247
+ `+Z)),h({start:{line:G.line+1,character:W.length},end:{line:G.line+1,character:Z.length}})}}return{modifiedRange:p,edits:w}}const{findNodeForProperty:Xae,findNodeForKeyword:CY}=ff;function AY(t,{view:e,viewAst:n,layout:r}){Ce(n.body,`View ${e.id} has no body`);const i=n.$cstNode;Ce(i,"viewCstNode");const s=JV(r.direction),o=_S(n.body.rules,jl);let a=`autoLayout ${s}`;if(gp(r.rankSep)&&(a+=` ${r.rankSep}`,gp(r.nodeSep)&&(a+=` ${r.nodeSep}`)),o&&o.$cstNode)return _n.replace(o.$cstNode.range,a);const u=CY(n.body.$cstNode,"}")?.range.start;Ce(u,"Closing brace not found");const c=` ${a}
248
+ `;return _n.insert(u,c)}function _Y(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===0)return t;const s=i?/^/gm:/^(?!\s*$)/gm;return t.replace(s,r.repeat(e))}function PY(t,{viewAst:e,layout:n}){Ce(e.$cstNode,"invalid view.$cstNode");const r=Hd(e.$cstNode,["BLOCK_COMMENT"]);let i=dY(n);return e.$cstNode.range.start.character>0&&(i=_Y(i,e.$cstNode.range.start.character)),r?_n.replace(r.range,i.trimStart()):_n.insert({line:e.$cstNode.range.start.line,character:0},i+`
249
+ `)}class xY{constructor(e){this.services=e,this.locator=e.likec4.ModelLocator}locator;async applyChange(e){const n=this.services.shared.lsp.Connection;Ce(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:{[a.uri]:s}}});if(!u.applied){n.window.showErrorMessage(`Failed to apply changes ${u.failureReason}`);return}r={uri:a.uri,range:o}})}catch(i){Bt.error(`Failed to apply change ${e.change.op} ${e.viewId}`,i)}return r}convertToTextEdit({viewId:e,change:n}){const r=this.locator.locateViewAst(e);if(!r)throw new Error(`LikeC4ModelChanges: view not found: ${e}`);switch(n.op){case"change-element-style":return{doc:r.doc,...kY(this.services,{...r,targets:n.targets,style:n.style})};case"change-autolayout":{const s=AY(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:s.range,edits:[s]}}case"save-manual-layout":const i=PY(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:i.range,edits:[i]};default:Oe(n)}}}class IY extends YT{constructor(e){super(),this.services=e}getNameStrict(e){return dn(this.getName(e),`Failed getName for ${this.services.workspace.AstNodeLocator.getAstNodePath(e)}`)}getName(e){if(lp(e))return e.name;if(pr(e))return e.element.el.$refText}getNameNode(e){if(lp(e))return super.getNameNode(e);if(pr(e))return e.element.el.$refNode}}function NY(t){return Qe(t,Ps(e=>`${e.type}.${e.name}`),wp(),Ii(([e,n])=>n.length===1?n:[]))}class OY extends JT{constructor(e){super(e)}async computeExports(e,n){const r=[];try{const{specifications:i,models:s,views:o,globals:a,likec4lib:u,deployments:c}=e.parseResult.value;this.exportLibrary(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){ve(i)}return r}exportViews(e,n,r){const i=e?.flatMap(s=>s.views);if(!(Dt(i)||i.length===0))for(const s of i)try{ae(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(o){ve(o)}}exportGlobals(e,n,r){if(!(Dt(e)||e.length===0)){for(const i of e.flatMap(s=>s.predicates))try{const s=i;ae(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(s){ve(s)}for(const i of e.flatMap(s=>s.styles))try{const s=i.id;ae(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(s){ve(s)}}}exportModel(e,n,r){if(!(Dt(e)||e.length===0))for(const i of e.flatMap(s=>s.elements))try{zn(i)&&ae(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){ve(s)}}exportLibrary(e,n,r){if(!Dt(e))try{for(const i of e.flatMap(s=>s.icons))n.push(this.descriptions.createDescription(i,i.name,r))}catch(i){ve(i)}}exportSpecification(e,n,r){if(!(Dt(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 Zo(i):case ta(i):{ae(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r));continue}case _h(i):{ae(i.tag.name)&&n.push(this.descriptions.createDescription(i.tag,"#"+i.tag.name,r));continue}case ra(i):{ae(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r),this.descriptions.createDescription(i.kind,"."+i.kind.name,r));continue}case Ah(i):{ae(i.name.name)&&n.push(this.descriptions.createDescription(i.name,i.name.name,r));continue}default:Oe(i)}}catch(s){ve(s)}}exportDeployments(e,n,r){const i=e?.flatMap(s=>s.elements);if(!(Dt(i)||i.length===0))for(const s of i)try{bn(s)&&ae(s.name)&&n.push(this.descriptions.createDescription(s,s.name,r))}catch(o){ve(o)}}computeLocalScopes(e,n){return new Promise(r=>{const i=e.parseResult.value,s=[],o=new Ln;for(const a of i.models)try{s.push(...this.processContainer(a,o,e))}catch(u){ve(u)}for(const a of i.deployments)try{s.push(...this.processDeployments(a,o,e))}catch(u){ve(u)}NY(s).forEach(a=>{o.add(i,a)}),r(o)})}processContainer(e,n,r){const i=new Ln,s=[];for(const a of e.elements){if(Nr(a))continue;let u;if(zn(a)?(ae(a.name)&&i.add(a.name,this.descriptions.createDescription(a,a.name,r)),u=a.body):Go(a)&&(u=a.body),u&&u.elements.length>0)try{s.push(...this.processContainer(u,n,r))}catch(c){ve(c)}}s.length&&Qe(s,Ge(a=>!i.has(a.name)),Ps(a=>a.name),yp((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 Set,s=[];for(const o of e.elements){if(Bi(o))continue;let a=this.nameProvider.getName(o);if(ae(a)){const u=this.descriptions.createDescription(o,a,r);n.add(e,u),i.add(u.name)}if(bn(o)&&o.body)try{s.push(...this.processDeployments(o.body,n,r))}catch(u){ve(u)}}return s.length>0&&Qe(s,Ge(o=>!i.has(o.name)),Ps(o=>o.name),yp((o,a)=>{o.length===1&&n.add(e,o[0])})),[...n.get(e).values()]}}const{getDocument:FY}=su;class LY extends rS{deploymentsIndex;fqnIndex;constructor(e){super(e),this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex}directChildrenOf(e){return this.fqnIndex.directChildrenOf(e)}uniqueDescedants(e){return new Ot(()=>{const n=e(),r=n&&this.fqnIndex.getFqn(n);return r?this.fqnIndex.uniqueDescedants(r).iterator():null},n=>n?n.next():en)}scopeElementRef(e){return this.uniqueDescedants(()=>e.el.ref)}scopeExtendElement({element:e}){return rt([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>En(e)))}scopeElementView({viewOf:e,extends:n}){return e?rt([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>En(e))):n?rt([n]).flatMap(r=>{const i=r.view.ref;return i?this.scopeElementView(i):ho}):ho}getScope(e){try{const n=this.reflection.getReferenceType(e);try{const r=e.container;if(eA(r))return this.getScopeForFqnRef(r,e);if(n!==Jn)return this.getGlobalScope(n,e);if(ZC(r)&&e.property==="el"){const i=r.parent;return i?new ks(this.directChildrenOf(Qh(i))):this.getGlobalScope(n,e)}if(tl(r)&&e.property==="el"){const i=r.parent;if(i)return new ks(this.scopeElementRef(i));if(e.reference.$refText==="this"||e.reference.$refText==="it"){const s=nn(r,zn);return s?new QT([this.descriptions.createDescription(s,e.reference.$refText)]):dp}}return this.computeScope(e)}catch(r){return Fe.warn(r),this.getGlobalScope(n,e)}}catch(n){return Fe.warn(n),dp}}getScopeForFqnRef(e,n){const r=e.parent;if(!r)return this.createScope(this.computeScope(n,Li).getAllElements(),this.createScope(this.computeScope(n,Fi).getAllElements(),Ti(e,Cw)?this.computeScope(n,Jn):dp));const i=r.value.ref;return i?bn(i)?new ks(this.deploymentsIndex.nested(i)):pr(i)?new ks(this.scopeElementRef(i.element)):zn(i)?new ks(this.uniqueDescedants(()=>i)):Oe(i):dp}computeScope(e,n=this.reflection.getReferenceType(e)){const r=this.reflection.isSubtype(n,Jn),i=[],s=FY(e.container).precomputedScopes;if(!s)return this.getGlobalScope(n,e);const o=u=>this.reflection.isSubtype(u.type,n);let a=e.container;for(;a;){const u=s.get(a).filter(o);u.length>0&&i.push(rt(u)),r&&QC(a)&&i.push(this.scopeExtendElement(a.$container)),r&&XC(a)&&i.push(this.scopeElementView(a.$container)),a=a.$container}return i.reduceRight((u,c)=>this.createScope(c,u),this.getGlobalScope(n,e))}}const MY=`likec4lib { icons {
250
+ aws:activate
251
+ aws:alexa-for-business
252
+ aws:amplify
253
+ aws:apache-mxnet-on-aws
254
+ aws:api-gateway
255
+ aws:app-config
256
+ aws:app-flow
257
+ aws:app-mesh
258
+ aws:app-runner
259
+ aws:app-stream
260
+ aws:app-sync
261
+ aws:application-auto-scaling
262
+ aws:application-composer
263
+ aws:application-cost-profiler
264
+ aws:application-discovery-service
265
+ aws:application-migration-service
266
+ aws:artifact
267
+ aws:athena
268
+ aws:audit-manager
269
+ aws:augmented-ai-a2i
270
+ aws:aurora
271
+ aws:auto-scaling
272
+ aws:backint-agent
273
+ aws:backup
274
+ aws:batch
275
+ aws:billing-conductor
276
+ aws:bottlerocket
277
+ aws:braket
278
+ aws:budgets
279
+ aws:certificate-manager
280
+ aws:chatbot
281
+ aws:chime
282
+ aws:chime-sdk
283
+ aws:chime-voice-connector
284
+ aws:clean-rooms
285
+ aws:client-vpn
286
+ aws:cloud-control-api
287
+ aws:cloud-development-kit
288
+ aws:cloud-directory
289
+ aws:cloud-formation
290
+ aws:cloud-front
291
+ aws:cloud-hsm
292
+ aws:cloud-map
293
+ aws:cloud-search
294
+ aws:cloud-shell
295
+ aws:cloud-trail
296
+ aws:cloud-wan
297
+ aws:cloud-watch
298
+ aws:cloud9
299
+ aws:code-artifact
300
+ aws:code-build
301
+ aws:code-catalyst
302
+ aws:code-commit
303
+ aws:code-deploy
304
+ aws:code-guru
305
+ aws:code-pipeline
306
+ aws:code-star
307
+ aws:code-whisperer
308
+ aws:cognito
309
+ aws:command-line-interface
310
+ aws:comprehend
311
+ aws:comprehend-medical
312
+ aws:compute-optimizer
313
+ aws:config
314
+ aws:connect
315
+ aws:console-mobile-application
316
+ aws:control-tower
317
+ aws:corretto
318
+ aws:cost-and-usage-report
319
+ aws:cost-explorer
320
+ aws:data-exchange
321
+ aws:data-pipeline
322
+ aws:data-sync
323
+ aws:data-zone
324
+ aws:database-migration-service
325
+ aws:deep-composer
326
+ aws:deep-learning-amis
327
+ aws:deep-learning-containers
328
+ aws:deep-lens
329
+ aws:deep-racer
330
+ aws:detective
331
+ aws:dev-ops-guru
332
+ aws:device-farm
333
+ aws:direct-connect
334
+ aws:directory-service
335
+ aws:distro-for-open-telemetry
336
+ aws:document-db
337
+ aws:dynamo-db
338
+ aws:ec2
339
+ aws:ec2-auto-scaling
340
+ aws:ec2-image-builder
341
+ aws:ecs-anywhere
342
+ aws:efs
343
+ aws:eks-anywhere
344
+ aws:eks-cloud
345
+ aws:eks-distro
346
+ aws:elasti-cache
347
+ aws:elastic-beanstalk
348
+ aws:elastic-block-store
349
+ aws:elastic-container-registry
350
+ aws:elastic-container-service
351
+ aws:elastic-disaster-recovery
352
+ aws:elastic-fabric-adapter
353
+ aws:elastic-inference
354
+ aws:elastic-kubernetes-service
355
+ aws:elastic-load-balancing
356
+ aws:elastic-transcoder
357
+ aws:elemental-appliances-software
358
+ aws:elemental-conductor
359
+ aws:elemental-delta
360
+ aws:elemental-link
361
+ aws:elemental-live
362
+ aws:elemental-media-connect
363
+ aws:elemental-media-convert
364
+ aws:elemental-media-live
365
+ aws:elemental-media-package
366
+ aws:elemental-media-store
367
+ aws:elemental-media-tailor
368
+ aws:elemental-server
369
+ aws:emr
370
+ aws:event-bridge
371
+ aws:express-workflows
372
+ aws:fargate
373
+ aws:fault-injection-simulator
374
+ aws:file-cache
375
+ aws:fin-space
376
+ aws:firewall-manager
377
+ aws:forecast
378
+ aws:fraud-detector
379
+ aws:free-rtos
380
+ aws:fsx
381
+ aws:fsx-for-lustre
382
+ aws:fsx-for-net-app-ontap
383
+ aws:fsx-for-open-zfs
384
+ aws:fsx-for-wfs
385
+ aws:game-kit
386
+ aws:game-lift
387
+ aws:game-sparks
388
+ aws:genomics-cli
389
+ aws:global-accelerator
390
+ aws:glue
391
+ aws:glue-data-brew
392
+ aws:glue-elastic-views
393
+ aws:ground-station
394
+ aws:guard-duty
395
+ aws:health-lake
396
+ aws:honeycode
397
+ aws:iam-identity-center
398
+ aws:identity-and-access-management
399
+ aws:inspector
400
+ aws:interactive-video-service
401
+ aws:io-t-1-click
402
+ aws:io-t-analytics
403
+ aws:io-t-button
404
+ aws:io-t-core
405
+ aws:io-t-device-defender
406
+ aws:io-t-device-management
407
+ aws:io-t-edu-kit
408
+ aws:io-t-events
409
+ aws:io-t-express-link
410
+ aws:io-t-fleet-wise
411
+ aws:io-t-greengrass
412
+ aws:io-t-robo-runner
413
+ aws:io-t-site-wise
414
+ aws:io-t-things-graph
415
+ aws:io-t-twin-maker
416
+ aws:iq
417
+ aws:kendra
418
+ aws:key-management-service
419
+ aws:keyspaces
420
+ aws:kinesis
421
+ aws:kinesis-data-analytics
422
+ aws:kinesis-data-streams
423
+ aws:kinesis-firehose
424
+ aws:kinesis-video-streams
425
+ aws:lake-formation
426
+ aws:lambda
427
+ aws:launch-wizard
428
+ aws:lex
429
+ aws:license-manager
430
+ aws:lightsail
431
+ aws:local-zones
432
+ aws:location-service
433
+ aws:lookout-for-equipment
434
+ aws:lookout-for-metrics
435
+ aws:lookout-for-vision
436
+ aws:lumberyard
437
+ aws:macie
438
+ aws:mainframe-modernization
439
+ aws:managed-blockchain
440
+ aws:managed-grafana
441
+ aws:managed-service-for-prometheus
442
+ aws:managed-services
443
+ aws:managed-streaming-for-apache-kafka
444
+ aws:managed-workflows-for-apache-airflow
445
+ aws:management-console
446
+ aws:marketplace-dark
447
+ aws:marketplace-light
448
+ aws:memory-db-for-redis
449
+ aws:migration-evaluator
450
+ aws:migration-hub
451
+ aws:monitron
452
+ aws:mq
453
+ aws:neptune
454
+ aws:network-firewall
455
+ aws:neuron
456
+ aws:nice-dcv
457
+ aws:nice-engin-frame
458
+ aws:nimble-studio
459
+ aws:nitro-enclaves
460
+ aws:omics
461
+ aws:open-3d-engine
462
+ aws:open-search-service
463
+ aws:ops-works
464
+ aws:organizations
465
+ aws:outposts-family
466
+ aws:outposts-rack
467
+ aws:outposts-servers
468
+ aws:panorama
469
+ aws:parallel-cluster
470
+ aws:personal-health-dashboard
471
+ aws:personalize
472
+ aws:pinpoint
473
+ aws:pinpoint-apis
474
+ aws:polly
475
+ aws:private-5g
476
+ aws:private-certificate-authority
477
+ aws:private-link
478
+ aws:professional-services
479
+ aws:proton
480
+ aws:quantum-ledger-database
481
+ aws:quick-sight
482
+ aws:rds
483
+ aws:rds-on-vmware
484
+ aws:re-post
485
+ aws:red-hat-open-shift-service-on-aws
486
+ aws:redshift
487
+ aws:rekognition
488
+ aws:reserved-instance-reporting
489
+ aws:resilience-hub
490
+ aws:resource-access-manager
491
+ aws:resource-explorer
492
+ aws:robo-maker
493
+ aws:route-53
494
+ aws:s3-on-outposts
495
+ aws:sage-maker
496
+ aws:sage-maker-ground-truth
497
+ aws:sage-maker-studio-lab
498
+ aws:savings-plans
499
+ aws:secrets-manager
500
+ aws:security-hub
501
+ aws:security-lake
502
+ aws:server-migration-service
503
+ aws:serverless-application-repository
504
+ aws:service-catalog
505
+ aws:service-management-connector
506
+ aws:shield
507
+ aws:signer
508
+ aws:sim-space-weaver
509
+ aws:simple-email-service
510
+ aws:simple-notification-service
511
+ aws:simple-queue-service
512
+ aws:simple-storage-service
513
+ aws:simple-storage-service-glacier
514
+ aws:site-to-site-vpn
515
+ aws:snowball
516
+ aws:snowball-edge
517
+ aws:snowcone
518
+ aws:snowmobile
519
+ aws:step-functions
520
+ aws:storage-gateway
521
+ aws:sumerian
522
+ aws:supply-chain
523
+ aws:support
524
+ aws:systems-manager
525
+ aws:tensor-flow-on-aws
526
+ aws:textract
527
+ aws:thinkbox-deadline
528
+ aws:thinkbox-frost
529
+ aws:thinkbox-krakatoa
530
+ aws:thinkbox-sequoia
531
+ aws:thinkbox-stoke
532
+ aws:thinkbox-xmesh
533
+ aws:timestream
534
+ aws:tools-and-sdks
535
+ aws:torch-serve
536
+ aws:training-certification
537
+ aws:transcribe
538
+ aws:transfer-family
539
+ aws:transit-gateway
540
+ aws:translate
541
+ aws:trusted-advisor
542
+ aws:verified-access
543
+ aws:verified-permissions
544
+ aws:virtual-private-cloud
545
+ aws:vmware-cloud-on-aws
546
+ aws:vpc-lattice
547
+ aws:waf
548
+ aws:wavelength
549
+ aws:well-architected-tool
550
+ aws:wickr
551
+ aws:work-docs
552
+ aws:work-docs-sdk
553
+ aws:work-link
554
+ aws:work-mail
555
+ aws:work-spaces-family
556
+ aws:x-ray
557
+ azure:abs-member
558
+ azure:active-directory-connect-health
559
+ azure:activity-log
560
+ azure:administrative-units
561
+ azure:advisor
562
+ azure:ai-studio
563
+ azure:aks-automatic
564
+ azure:aks-istio
565
+ azure:alerts
566
+ azure:all-resources
567
+ azure:analysis-services
568
+ azure:anomaly-detector
569
+ azure:api-center
570
+ azure:api-connections
571
+ azure:api-management-services
572
+ azure:api-proxy
573
+ azure:app-compliance-automation
574
+ azure:app-configuration
575
+ azure:app-registrations
576
+ azure:app-service-certificates
577
+ azure:app-service-domains
578
+ azure:app-service-environments
579
+ azure:app-service-plans
580
+ azure:app-services
581
+ azure:app-space
582
+ azure:app-space-component
583
+ azure:applens
584
+ azure:application-gateway-containers
585
+ azure:application-gateways
586
+ azure:application-group
587
+ azure:application-insights
588
+ azure:application-security-groups
589
+ azure:aquila
590
+ azure:arc-data-services
591
+ azure:arc-kubernetes
592
+ azure:arc-machines
593
+ azure:arc-sql-managed-instance
594
+ azure:arc-sql-server
595
+ azure:atm-multistack
596
+ azure:auto-scale
597
+ azure:automanaged-vm
598
+ azure:automation-accounts
599
+ azure:availability-sets
600
+ azure:avs-vm
601
+ azure:azure-a
602
+ azure:azure-ad-b2c
603
+ azure:azure-api-for-fhir
604
+ azure:azure-applied-ai-services
605
+ azure:azure-arc
606
+ azure:azure-attestation
607
+ azure:azure-backup-center
608
+ azure:azure-blockchain-service
609
+ azure:azure-center-for-sap
610
+ azure:azure-chaos-studio
611
+ azure:azure-cloud-shell
612
+ azure:azure-communication-services
613
+ azure:azure-communications-gateway
614
+ azure:azure-compute-galleries
615
+ azure:azure-cosmos-db
616
+ azure:azure-data-catalog
617
+ azure:azure-data-explorer-clusters
618
+ azure:azure-database-maria-db-server
619
+ azure:azure-database-migration-services
620
+ azure:azure-database-my-sql-server
621
+ azure:azure-database-postgre-sql-server
622
+ azure:azure-database-postgre-sql-server-group
623
+ azure:azure-databox-gateway
624
+ azure:azure-databricks
625
+ azure:azure-deployment-environments
626
+ azure:azure-dev-ops
627
+ azure:azure-dev-tunnels
628
+ azure:azure-edge-hardware-center
629
+ azure:azure-experimentation-studio
630
+ azure:azure-fileshares
631
+ azure:azure-firewall-manager
632
+ azure:azure-firewall-policy
633
+ azure:azure-hcp-cache
634
+ azure:azure-hpc-workbenches
635
+ azure:azure-hybrid-center
636
+ azure:azure-information-protection
637
+ azure:azure-io-t-operations
638
+ azure:azure-lighthouse
639
+ azure:azure-load-testing
640
+ azure:azure-managed-grafana
641
+ azure:azure-maps-accounts
642
+ azure:azure-media-service
643
+ azure:azure-migrate
644
+ azure:azure-monitor-dashboard
645
+ azure:azure-monitor-pipeline
646
+ azure:azure-monitors-for-sap-solutions
647
+ azure:azure-net-app-files
648
+ azure:azure-network-function-manager
649
+ azure:azure-network-function-manager-functions
650
+ azure:azure-object-understanding
651
+ azure:azure-open-ai
652
+ azure:azure-operator-5g-core
653
+ azure:azure-operator-insights
654
+ azure:azure-operator-nexus
655
+ azure:azure-operator-service-manager
656
+ azure:azure-orbital
657
+ azure:azure-programmable-connectivity
658
+ azure:azure-purview-accounts
659
+ azure:azure-quotas
660
+ azure:azure-red-hat-open-shift
661
+ azure:azure-sentinel
662
+ azure:azure-service-bus
663
+ azure:azure-sphere
664
+ azure:azure-spring-apps
665
+ azure:azure-sql
666
+ azure:azure-sql-edge
667
+ azure:azure-sql-server-stretch-databases
668
+ azure:azure-sql-vm
669
+ azure:azure-stack
670
+ azure:azure-stack-edge
671
+ azure:azure-stack-hci-sizer
672
+ azure:azure-storage-mover
673
+ azure:azure-support-center-blue
674
+ azure:azure-sustainability
675
+ azure:azure-synapse-analytics
676
+ azure:azure-token-service
677
+ azure:azure-video-indexer
678
+ azure:azure-virtual-desktop
679
+ azure:azure-vmware-solution
680
+ azure:azure-workbooks
681
+ azure:azurite
682
+ azure:backlog
683
+ azure:backup-vault
684
+ azure:bare-metal-infrastructure
685
+ azure:bastions
686
+ azure:batch-accounts
687
+ azure:batch-ai
688
+ azure:biz-talk
689
+ azure:blob-block
690
+ azure:blob-page
691
+ azure:blockchain-applications
692
+ azure:blueprints
693
+ azure:bonsai
694
+ azure:bot-services
695
+ azure:branch
696
+ azure:browser
697
+ azure:bug
698
+ azure:builds
699
+ azure:business-process-tracking
700
+ azure:cache
701
+ azure:cache-redis
702
+ azure:capacity
703
+ azure:capacity-reservation-groups
704
+ azure:cdn-profiles
705
+ azure:central-service-instance-for-sap
706
+ azure:ceres
707
+ azure:change-analysis
708
+ azure:client-apps
709
+ azure:cloud-services-classic
710
+ azure:cloud-services-extended-support
711
+ azure:cloud-test
712
+ azure:code
713
+ azure:code-optimization
714
+ azure:cognitive-search
715
+ azure:cognitive-services
716
+ azure:cognitive-services-decisions
717
+ azure:collaborative-service
718
+ azure:commit
719
+ azure:community-images
720
+ azure:compliance
721
+ azure:compliance-center
722
+ azure:compute-fleet
723
+ azure:computer-vision
724
+ azure:conditional-access
725
+ azure:confidential-ledgers
726
+ azure:connected-cache
727
+ azure:connected-vehicle-platform
728
+ azure:connections
729
+ azure:consortium
730
+ azure:container-apps-environments
731
+ azure:container-instances
732
+ azure:container-registries
733
+ azure:container-services-deprecated
734
+ azure:content-moderators
735
+ azure:content-safety
736
+ azure:controls
737
+ azure:controls-horizontal
738
+ azure:cost-alerts
739
+ azure:cost-analysis
740
+ azure:cost-budgets
741
+ azure:cost-export
742
+ azure:cost-management
743
+ azure:cost-management-and-billing
744
+ azure:counter
745
+ azure:cubes
746
+ azure:custom-ip-prefix
747
+ azure:custom-vision
748
+ azure:customer-lockbox-for-microsoft-azure
749
+ azure:dashboard
750
+ azure:dashboard-hub
751
+ azure:data-box
752
+ azure:data-collection-rules
753
+ azure:data-factories
754
+ azure:data-lake-analytics
755
+ azure:data-lake-storage-gen1
756
+ azure:data-lake-store-gen1
757
+ azure:data-share-invitations
758
+ azure:data-shares
759
+ azure:database-instance-for-sap
760
+ azure:ddo-s-protection-plans
761
+ azure:dedicated-hsm
762
+ azure:defender-cm-local-manager
763
+ azure:defender-dcs-controller
764
+ azure:defender-distributer-control-system
765
+ azure:defender-engineering-station
766
+ azure:defender-external-management
767
+ azure:defender-freezer-monitor
768
+ azure:defender-historian
769
+ azure:defender-hmi
770
+ azure:defender-industrial-packaging-system
771
+ azure:defender-industrial-printer
772
+ azure:defender-industrial-robot
773
+ azure:defender-industrial-scale-system
774
+ azure:defender-marquee
775
+ azure:defender-meter
776
+ azure:defender-plc
777
+ azure:defender-pneumatic-device
778
+ azure:defender-programable-board
779
+ azure:defender-relay
780
+ azure:defender-robot-controller
781
+ azure:defender-rtu
782
+ azure:defender-sensor
783
+ azure:defender-slot
784
+ azure:defender-web-guiding-system
785
+ azure:detonation
786
+ azure:dev-console
787
+ azure:dev-ops-starter
788
+ azure:dev-test-labs
789
+ azure:device-compliance
790
+ azure:device-configuration
791
+ azure:device-enrollment
792
+ azure:device-provisioning-services
793
+ azure:device-security-apple
794
+ azure:device-security-google
795
+ azure:device-security-windows
796
+ azure:device-update-io-t-hub
797
+ azure:devices
798
+ azure:diagnostics-settings
799
+ azure:digital-twins
800
+ azure:disk-encryption-sets
801
+ azure:disk-pool
802
+ azure:disks
803
+ azure:disks-classic
804
+ azure:disks-snapshots
805
+ azure:dns-multistack
806
+ azure:dns-private-resolver
807
+ azure:dns-security-policy
808
+ azure:dns-zones
809
+ azure:download
810
+ azure:e-books
811
+ azure:edge-management
812
+ azure:education
813
+ azure:elastic-job-agents
814
+ azure:elastic-san
815
+ azure:endpoint-analytics
816
+ azure:enterprise-applications
817
+ azure:entra-connect
818
+ azure:entra-connect-health
819
+ azure:entra-connect-sync
820
+ azure:entra-domain-services
821
+ azure:entra-global-secure-access
822
+ azure:entra-id-protection
823
+ azure:entra-identity-custom-roles
824
+ azure:entra-identity-licenses
825
+ azure:entra-identity-risky-signins
826
+ azure:entra-identity-risky-users
827
+ azure:entra-identity-roles-and-administrators
828
+ azure:entra-internet-access
829
+ azure:entra-managed-identities
830
+ azure:entra-private-access
831
+ azure:entra-privleged-identity-management
832
+ azure:entra-verified-id
833
+ azure:error
834
+ azure:event-grid-domains
835
+ azure:event-grid-subscriptions
836
+ azure:event-grid-topics
837
+ azure:event-hub-clusters
838
+ azure:event-hubs
839
+ azure:exchange-access
840
+ azure:exchange-on-premises-access
841
+ azure:express-route-circuits
842
+ azure:express-route-direct
843
+ azure:express-route-traffic-collector
844
+ azure:extended-security-updates
845
+ azure:extensions
846
+ azure:external-identities
847
+ azure:face-apis
848
+ azure:feature-previews
849
+ azure:fhir-service
850
+ azure:fiji
851
+ azure:file
852
+ azure:files
853
+ azure:firewalls
854
+ azure:folder-blank
855
+ azure:folder-website
856
+ azure:form-recognizers
857
+ azure:free-services
858
+ azure:front-door-and-cdn-profiles
859
+ azure:ftp
860
+ azure:function-apps
861
+ azure:gear
862
+ azure:genomics
863
+ azure:genomics-accounts
864
+ azure:globe-error
865
+ azure:globe-success
866
+ azure:globe-warning
867
+ azure:groups
868
+ azure:guide
869
+ azure:hd-insight-clusters
870
+ azure:hdi-aks-cluster
871
+ azure:heart
872
+ azure:help-and-support
873
+ azure:host-groups
874
+ azure:host-pools
875
+ azure:hosts
876
+ azure:ic-m-troubleshooting
877
+ azure:identity-governance
878
+ azure:identity-multi-factor-authentication
879
+ azure:identity-secure-score
880
+ azure:image
881
+ azure:image-definitions
882
+ azure:image-templates
883
+ azure:image-versions
884
+ azure:images
885
+ azure:immersive-readers
886
+ azure:import-export-jobs
887
+ azure:industrial-io-t
888
+ azure:information
889
+ azure:infrastructure-backup
890
+ azure:input-output
891
+ azure:instance-pools
892
+ azure:integration-accounts
893
+ azure:integration-environments
894
+ azure:integration-service-environments
895
+ azure:internet-analyzer-profiles
896
+ azure:intune
897
+ azure:intune-app-protection
898
+ azure:intune-for-education
899
+ azure:intune-trends
900
+ azure:io-t-central-applications
901
+ azure:io-t-edge
902
+ azure:io-t-hub
903
+ azure:ip-address-manager
904
+ azure:ip-groups
905
+ azure:journey-hub
906
+ azure:key-vaults
907
+ azure:keys
908
+ azure:kubernetes-fleet-manager
909
+ azure:kubernetes-services
910
+ azure:lab-accounts
911
+ azure:lab-services
912
+ azure:language
913
+ azure:language-understanding
914
+ azure:launch-portal
915
+ azure:learn
916
+ azure:load-balancer-hub
917
+ azure:load-balancers
918
+ azure:load-test
919
+ azure:load-testing
920
+ azure:local-network-gateways
921
+ azure:location
922
+ azure:log-analytics-query-pack
923
+ azure:log-analytics-workspaces
924
+ azure:log-streaming
925
+ azure:logic-apps
926
+ azure:logic-apps-custom-connector
927
+ azure:machine-learning
928
+ azure:machine-learning-studio-classic-web-services
929
+ azure:machine-learning-studio-web-service-plans
930
+ azure:machine-learning-studio-workspaces
931
+ azure:machines-azure-arc
932
+ azure:maintenance-configuration
933
+ azure:managed-applications-center
934
+ azure:managed-database
935
+ azure:managed-desktop
936
+ azure:managed-dev-ops-pools
937
+ azure:managed-file-shares
938
+ azure:managed-identities
939
+ azure:managed-instance-apache-cassandra
940
+ azure:managed-service-fabric
941
+ azure:management-groups
942
+ azure:management-portal
943
+ azure:marketplace
944
+ azure:marketplace-management
945
+ azure:med-tech-service
946
+ azure:media
947
+ azure:media-file
948
+ azure:mesh-applications
949
+ azure:metrics
950
+ azure:metrics-advisor
951
+ azure:microsoft-defender-easm
952
+ azure:microsoft-defender-for-cloud
953
+ azure:microsoft-defender-for-io-t
954
+ azure:microsoft-dev-box
955
+ azure:mindaro
956
+ azure:mission-landing-zone
957
+ azure:mobile
958
+ azure:mobile-engagement
959
+ azure:mobile-networks
960
+ azure:modular-data-center
961
+ azure:module
962
+ azure:monitor
963
+ azure:monitor-health-models
964
+ azure:multi-tenancy
965
+ azure:multifactor-authentication
966
+ azure:my-customers
967
+ azure:nat
968
+ azure:network-interfaces
969
+ azure:network-managers
970
+ azure:network-security-groups
971
+ azure:network-security-perimeters
972
+ azure:network-watcher
973
+ azure:notification-hub-namespaces
974
+ azure:notification-hubs
975
+ azure:offers
976
+ azure:on-premises-data-gateways
977
+ azure:open-supply-chain-platform
978
+ azure:operation-log-classic
979
+ azure:oracle-database
980
+ azure:os-images-classic
981
+ azure:osconfig
982
+ azure:outbound-connection
983
+ azure:partner-namespace
984
+ azure:partner-registration
985
+ azure:partner-topic
986
+ azure:peering-service
987
+ azure:peerings
988
+ azure:personalizers
989
+ azure:plans
990
+ azure:policy
991
+ azure:power
992
+ azure:power-bi-embedded
993
+ azure:power-platform
994
+ azure:power-up
995
+ azure:powershell
996
+ azure:preview-features
997
+ azure:private-endpoints
998
+ azure:private-link
999
+ azure:private-link-service
1000
+ azure:private-link-services
1001
+ azure:process-explorer
1002
+ azure:production-ready-database
1003
+ azure:proximity-placement-groups
1004
+ azure:public-ip-addresses
1005
+ azure:public-ip-addresses-classic
1006
+ azure:public-ip-prefixes
1007
+ azure:qn-a-makers
1008
+ azure:quickstart-center
1009
+ azure:recent
1010
+ azure:recovery-services-vaults
1011
+ azure:region-management
1012
+ azure:relays
1013
+ azure:remote-rendering
1014
+ azure:reservations
1015
+ azure:reserved-capacity
1016
+ azure:reserved-ip-addresses-classic
1017
+ azure:resource-explorer
1018
+ azure:resource-graph-explorer
1019
+ azure:resource-group-list
1020
+ azure:resource-groups
1021
+ azure:resource-guard
1022
+ azure:resource-linked
1023
+ azure:resource-management-private-link
1024
+ azure:resource-mover
1025
+ azure:resources-provider
1026
+ azure:restore-points
1027
+ azure:restore-points-collections
1028
+ azure:route-filters
1029
+ azure:route-tables
1030
+ azure:rtos
1031
+ azure:savings-plans
1032
+ azure:scheduler
1033
+ azure:scheduler-job-collections
1034
+ azure:scvmm-management-servers
1035
+ azure:search
1036
+ azure:search-grid
1037
+ azure:security
1038
+ azure:security-baselines
1039
+ azure:send-grid-accounts
1040
+ azure:server-farm
1041
+ azure:serverless-search
1042
+ azure:service-catalog-mad
1043
+ azure:service-endpoint-policies
1044
+ azure:service-fabric-clusters
1045
+ azure:service-health
1046
+ azure:service-providers
1047
+ azure:shared-image-galleries
1048
+ azure:signal-r
1049
+ azure:software-as-a-service
1050
+ azure:software-updates
1051
+ azure:solutions
1052
+ azure:sonic-dash
1053
+ azure:spatial-anchor-accounts
1054
+ azure:speech-services
1055
+ azure:spot-vm
1056
+ azure:spot-vmss
1057
+ azure:sql-data-warehouses
1058
+ azure:sql-database
1059
+ azure:sql-elastic-pools
1060
+ azure:sql-managed-instance
1061
+ azure:sql-server
1062
+ azure:sql-server-registries
1063
+ azure:ssd
1064
+ azure:ssh-keys
1065
+ azure:ssis-lift-and-shift-ir
1066
+ azure:stack-hci-premium
1067
+ azure:static-apps
1068
+ azure:stor-simple-data-managers
1069
+ azure:stor-simple-device-managers
1070
+ azure:storage-accounts
1071
+ azure:storage-accounts-classic
1072
+ azure:storage-actions
1073
+ azure:storage-azure-files
1074
+ azure:storage-container
1075
+ azure:storage-explorer
1076
+ azure:storage-functions
1077
+ azure:storage-queue
1078
+ azure:storage-sync-services
1079
+ azure:stream-analytics-jobs
1080
+ azure:subnet
1081
+ azure:subscriptions
1082
+ azure:system-topic
1083
+ azure:table
1084
+ azure:tag
1085
+ azure:tags
1086
+ azure:targets-management
1087
+ azure:template-specs
1088
+ azure:templates
1089
+ azure:tenant-properties
1090
+ azure:tenant-status
1091
+ azure:test-base
1092
+ azure:tfs-vc-repository
1093
+ azure:time-series-data-sets
1094
+ azure:time-series-insights-access-policies
1095
+ azure:time-series-insights-environments
1096
+ azure:time-series-insights-event-sources
1097
+ azure:toolbox
1098
+ azure:traffic-manager-profiles
1099
+ azure:translator-text
1100
+ azure:troubleshoot
1101
+ azure:universal-print
1102
+ azure:update-management-center
1103
+ azure:updates
1104
+ azure:user-privacy
1105
+ azure:user-settings
1106
+ azure:user-subscriptions
1107
+ azure:users
1108
+ azure:verifiable-credentials
1109
+ azure:verification-as-a-service
1110
+ azure:versions
1111
+ azure:video-analyzers
1112
+ azure:virtual-clusters
1113
+ azure:virtual-enclaves
1114
+ azure:virtual-instance-for-sap
1115
+ azure:virtual-machine
1116
+ azure:virtual-machines-classic
1117
+ azure:virtual-network-gateways
1118
+ azure:virtual-networks
1119
+ azure:virtual-networks-classic
1120
+ azure:virtual-router
1121
+ azure:virtual-visits-builder
1122
+ azure:virtual-wan-hub
1123
+ azure:virtual-wans
1124
+ azure:vm-app-definitions
1125
+ azure:vm-app-versions
1126
+ azure:vm-image-version
1127
+ azure:vm-images-classic
1128
+ azure:vm-scale-sets
1129
+ azure:wac
1130
+ azure:wac-installer
1131
+ azure:web-app-database
1132
+ azure:web-application-firewall-policies-waf
1133
+ azure:web-jobs
1134
+ azure:web-slots
1135
+ azure:web-test
1136
+ azure:website-power
1137
+ azure:website-staging
1138
+ azure:windows-notification-services
1139
+ azure:windows10-core-services
1140
+ azure:workbooks
1141
+ azure:worker-container-app
1142
+ azure:workflow
1143
+ azure:workspace-gateway
1144
+ azure:workspaces
1145
+ gcp:access-context-manager
1146
+ gcp:administration
1147
+ gcp:advanced-agent-modeling
1148
+ gcp:advanced-solutions-lab
1149
+ gcp:agent-assist
1150
+ gcp:ai-hub
1151
+ gcp:ai-platform
1152
+ gcp:ai-platform-unified
1153
+ gcp:analytics-hub
1154
+ gcp:anthos
1155
+ gcp:anthos-config-management
1156
+ gcp:anthos-service-mesh
1157
+ gcp:api
1158
+ gcp:api-analytics
1159
+ gcp:api-monetization
1160
+ gcp:apigee-api-platform
1161
+ gcp:apigee-sense
1162
+ gcp:app-engine
1163
+ gcp:artifact-registry
1164
+ gcp:asset-inventory
1165
+ gcp:assured-workloads
1166
+ gcp:auto-ml
1167
+ gcp:auto-ml-natural-language
1168
+ gcp:auto-ml-tables
1169
+ gcp:auto-ml-translation
1170
+ gcp:auto-ml-video-intelligence
1171
+ gcp:auto-ml-vision
1172
+ gcp:bare-metal-solutions
1173
+ gcp:batch
1174
+ gcp:beyondcorp
1175
+ gcp:big-query
1176
+ gcp:bigtable
1177
+ gcp:billing
1178
+ gcp:binary-authorization
1179
+ gcp:catalog
1180
+ gcp:certificate-authority-service
1181
+ gcp:certificate-manager
1182
+ gcp:cloud-api-gateway
1183
+ gcp:cloud-apis
1184
+ gcp:cloud-armor
1185
+ gcp:cloud-asset-inventory
1186
+ gcp:cloud-audit-logs
1187
+ gcp:cloud-build
1188
+ gcp:cloud-cdn
1189
+ gcp:cloud-code
1190
+ gcp:cloud-composer
1191
+ gcp:cloud-data-fusion
1192
+ gcp:cloud-deploy
1193
+ gcp:cloud-deployment-manager
1194
+ gcp:cloud-dns
1195
+ gcp:cloud-domains
1196
+ gcp:cloud-ekm
1197
+ gcp:cloud-endpoints
1198
+ gcp:cloud-external-ip-addresses
1199
+ gcp:cloud-firewall-rules
1200
+ gcp:cloud-for-marketing
1201
+ gcp:cloud-functions
1202
+ gcp:cloud-generic
1203
+ gcp:cloud-gpu
1204
+ gcp:cloud-healthcare-api
1205
+ gcp:cloud-healthcare-marketplace
1206
+ gcp:cloud-hsm
1207
+ gcp:cloud-ids
1208
+ gcp:cloud-inference-api
1209
+ gcp:cloud-interconnect
1210
+ gcp:cloud-jobs-api
1211
+ gcp:cloud-load-balancing
1212
+ gcp:cloud-logging
1213
+ gcp:cloud-media-edge
1214
+ gcp:cloud-monitoring
1215
+ gcp:cloud-nat
1216
+ gcp:cloud-natural-language-api
1217
+ gcp:cloud-network
1218
+ gcp:cloud-ops
1219
+ gcp:cloud-optimization-ai
1220
+ gcp:cloud-optimization-ai-fleet-routing-api
1221
+ gcp:cloud-router
1222
+ gcp:cloud-routes
1223
+ gcp:cloud-run
1224
+ gcp:cloud-run-for-anthos
1225
+ gcp:cloud-scheduler
1226
+ gcp:cloud-security-scanner
1227
+ gcp:cloud-shell
1228
+ gcp:cloud-spanner
1229
+ gcp:cloud-sql
1230
+ gcp:cloud-storage
1231
+ gcp:cloud-tasks
1232
+ gcp:cloud-test-lab
1233
+ gcp:cloud-tpu
1234
+ gcp:cloud-translation-api
1235
+ gcp:cloud-vision-api
1236
+ gcp:cloud-vpn
1237
+ gcp:compute-engine
1238
+ gcp:configuration-management
1239
+ gcp:connectivity-test
1240
+ gcp:connectors
1241
+ gcp:contact-center-ai
1242
+ gcp:container-optimized-os
1243
+ gcp:container-registry
1244
+ gcp:data-catalog
1245
+ gcp:data-labeling
1246
+ gcp:data-layers
1247
+ gcp:data-loss-prevention-api
1248
+ gcp:data-qn-a
1249
+ gcp:data-studio
1250
+ gcp:data-transfer
1251
+ gcp:database-migration-service
1252
+ gcp:dataflow
1253
+ gcp:datalab
1254
+ gcp:dataplex
1255
+ gcp:datapol
1256
+ gcp:dataprep
1257
+ gcp:dataproc
1258
+ gcp:dataproc-metastore
1259
+ gcp:datashare
1260
+ gcp:datastore
1261
+ gcp:datastream
1262
+ gcp:debugger
1263
+ gcp:developer-portal
1264
+ gcp:dialogflow
1265
+ gcp:dialogflow-cx
1266
+ gcp:dialogflow-insights
1267
+ gcp:document-ai
1268
+ gcp:early-access-center
1269
+ gcp:error-reporting
1270
+ gcp:eventarc
1271
+ gcp:filestore
1272
+ gcp:financial-services-marketplace
1273
+ gcp:firestore
1274
+ gcp:fleet-engine
1275
+ gcp:free-trial
1276
+ gcp:game-servers
1277
+ gcp:gce-systems-management
1278
+ gcp:genomics
1279
+ gcp:gke-on-prem
1280
+ gcp:google-cloud-marketplace
1281
+ gcp:google-kubernetes-engine
1282
+ gcp:google-maps-platform
1283
+ gcp:healthcare-nlp-api
1284
+ gcp:home
1285
+ gcp:identity-and-access-management
1286
+ gcp:identity-aware-proxy
1287
+ gcp:identity-platform
1288
+ gcp:iot-core
1289
+ gcp:iot-edge
1290
+ gcp:key-access-justifications
1291
+ gcp:key-management-service
1292
+ gcp:kuberun
1293
+ gcp:launcher
1294
+ gcp:local-ssd
1295
+ gcp:looker
1296
+ gcp:managed-service-for-microsoft-active-directory
1297
+ gcp:media-translation-api
1298
+ gcp:memorystore
1299
+ gcp:migrate-for-anthos
1300
+ gcp:migrate-for-compute-engine
1301
+ gcp:my-cloud
1302
+ gcp:network-connectivity-center
1303
+ gcp:network-intelligence-center
1304
+ gcp:network-security
1305
+ gcp:network-tiers
1306
+ gcp:network-topology
1307
+ gcp:onboarding
1308
+ gcp:os-configuration-management
1309
+ gcp:os-inventory-management
1310
+ gcp:os-patch-management
1311
+ gcp:partner-interconnect
1312
+ gcp:partner-portal
1313
+ gcp:performance-dashboard
1314
+ gcp:permissions
1315
+ gcp:persistent-disk
1316
+ gcp:phishing-protection
1317
+ gcp:policy-analyzer
1318
+ gcp:premium-network-tier
1319
+ gcp:private-connectivity
1320
+ gcp:private-service-connect
1321
+ gcp:producer-portal
1322
+ gcp:profiler
1323
+ gcp:project
1324
+ gcp:pub-sub
1325
+ gcp:quantum-engine
1326
+ gcp:quotas
1327
+ gcp:real-world-insights
1328
+ gcp:recommendations-ai
1329
+ gcp:release-notes
1330
+ gcp:retail-api
1331
+ gcp:risk-manager
1332
+ gcp:runtime-config
1333
+ gcp:secret-manager
1334
+ gcp:security
1335
+ gcp:security-command-center
1336
+ gcp:security-health-advisor
1337
+ gcp:security-key-enforcement
1338
+ gcp:service-discovery
1339
+ gcp:speech-to-text
1340
+ gcp:stackdriver
1341
+ gcp:standard-network-tier
1342
+ gcp:stream-suite
1343
+ gcp:support
1344
+ gcp:tensorflow-enterprise
1345
+ gcp:text-to-speech
1346
+ gcp:tools-for-powershell
1347
+ gcp:trace
1348
+ gcp:traffic-director
1349
+ gcp:transfer
1350
+ gcp:transfer-appliance
1351
+ gcp:user-preferences
1352
+ gcp:vertex-ai
1353
+ gcp:video-intelligence-api
1354
+ gcp:virtual-private-cloud
1355
+ gcp:visual-inspection
1356
+ gcp:vmware-engine
1357
+ gcp:web-risk
1358
+ gcp:web-security-scanner
1359
+ gcp:workflows
1360
+ gcp:workload-identity-pool
1361
+ tech:aarch64
1362
+ tech:adobe-illustrator
1363
+ tech:adobe-photoshop
1364
+ tech:adobe-premiere-pro
1365
+ tech:adobe-xd
1366
+ tech:adonis-js
1367
+ tech:after-effects
1368
+ tech:airflow
1369
+ tech:akka
1370
+ tech:algolia
1371
+ tech:alpine-js
1372
+ tech:amazon-web-services
1373
+ tech:anaconda
1374
+ tech:android
1375
+ tech:android-studio
1376
+ tech:angular
1377
+ tech:angular-js
1378
+ tech:ansible
1379
+ tech:ant-design
1380
+ tech:apache
1381
+ tech:apl
1382
+ tech:appcelerator
1383
+ tech:apple
1384
+ tech:apple-safari
1385
+ tech:appwrite
1386
+ tech:arch-linux
1387
+ tech:arduino
1388
+ tech:argo-cd
1389
+ tech:astro
1390
+ tech:atom
1391
+ tech:autodesk-maya
1392
+ tech:autodesk-shot-grid
1393
+ tech:awk
1394
+ tech:azios
1395
+ tech:azure
1396
+ tech:azure-devops
1397
+ tech:azure-sql-database
1398
+ tech:babel
1399
+ tech:backbone-js
1400
+ tech:ballerina
1401
+ tech:bamboo
1402
+ tech:bash
1403
+ tech:behance
1404
+ tech:bitbucket
1405
+ tech:blender
1406
+ tech:bootstrap
1407
+ tech:bower
1408
+ tech:browserstack
1409
+ tech:bulma
1410
+ tech:bun
1411
+ tech:c
1412
+ tech:cairo-graphics
1413
+ tech:cake-php
1414
+ tech:canva
1415
+ tech:capacitor
1416
+ tech:cassandra
1417
+ tech:cent-os
1418
+ tech:chrome
1419
+ tech:circle-ci
1420
+ tech:clarity
1421
+ tech:clion
1422
+ tech:clojure
1423
+ tech:clojure-script
1424
+ tech:cloudflare
1425
+ tech:cloudflare-workers
1426
+ tech:cmake
1427
+ tech:code-igniter
1428
+ tech:code-pen
1429
+ tech:codeac
1430
+ tech:codecov
1431
+ tech:coffee-script
1432
+ tech:composer
1433
+ tech:confluence
1434
+ tech:consul
1435
+ tech:contao
1436
+ tech:corejs
1437
+ tech:cosmosdb
1438
+ tech:couchdb
1439
+ tech:cplusplus
1440
+ tech:crystal
1441
+ tech:csharp
1442
+ tech:css3
1443
+ tech:cucumber
1444
+ tech:cypress
1445
+ tech:d3js
1446
+ tech:dart
1447
+ tech:data-grip
1448
+ tech:data-spell
1449
+ tech:dbeaver
1450
+ tech:debian
1451
+ tech:deno
1452
+ tech:devicon
1453
+ tech:digital-ocean
1454
+ tech:discord-js
1455
+ tech:django
1456
+ tech:django-rest
1457
+ tech:docker
1458
+ tech:doctrine
1459
+ tech:dropwizard
1460
+ tech:drupal
1461
+ tech:eclipse-ceylon
1462
+ tech:eclipse-ide
1463
+ tech:eclipse-vert-x
1464
+ tech:elasticbeats
1465
+ tech:elasticsearch
1466
+ tech:electron
1467
+ tech:eleventy-11ty
1468
+ tech:elixir
1469
+ tech:elm
1470
+ tech:embedded-c
1471
+ tech:ember-js
1472
+ tech:envoy
1473
+ tech:erlang
1474
+ tech:eslint
1475
+ tech:express
1476
+ tech:facebook
1477
+ tech:fast-api
1478
+ tech:fastify
1479
+ tech:fauna
1480
+ tech:feathers
1481
+ tech:fedora
1482
+ tech:figma
1483
+ tech:file-zilla
1484
+ tech:firebase
1485
+ tech:firefox
1486
+ tech:flask
1487
+ tech:flutter
1488
+ tech:fortran
1489
+ tech:foundation
1490
+ tech:fsharp
1491
+ tech:gatling
1492
+ tech:gatsby
1493
+ tech:gazebo
1494
+ tech:gcc
1495
+ tech:gentoo
1496
+ tech:ghost
1497
+ tech:gimp
1498
+ tech:git
1499
+ tech:gitbook
1500
+ tech:github
1501
+ tech:github-actions
1502
+ tech:github-codespaces
1503
+ tech:gitlab
1504
+ tech:gitpod
1505
+ tech:gitter
1506
+ tech:gnu-emacs
1507
+ tech:go
1508
+ tech:go-land
1509
+ tech:godot-engine
1510
+ tech:google
1511
+ tech:google-cloud
1512
+ tech:gradle
1513
+ tech:grafana
1514
+ tech:grails
1515
+ tech:graphql
1516
+ tech:groovy
1517
+ tech:grunt-js
1518
+ tech:gulp-js
1519
+ tech:hadoop
1520
+ tech:handlebars
1521
+ tech:hardhat
1522
+ tech:harvester
1523
+ tech:hashicorp-vault
1524
+ tech:haskell
1525
+ tech:haxe
1526
+ tech:helm
1527
+ tech:heroku
1528
+ tech:hibernate
1529
+ tech:homebrew
1530
+ tech:html5
1531
+ tech:hugo
1532
+ tech:ibm-spss-statistics
1533
+ tech:ie10
1534
+ tech:ifttt
1535
+ tech:influxdb
1536
+ tech:inkscape
1537
+ tech:insomnia
1538
+ tech:intellij-idea
1539
+ tech:ionic
1540
+ tech:jaeger
1541
+ tech:jamstack
1542
+ tech:jasmine
1543
+ tech:java
1544
+ tech:javascript
1545
+ tech:jeet
1546
+ tech:jekyll
1547
+ tech:jenkins
1548
+ tech:jest
1549
+ tech:jetbrains
1550
+ tech:jira
1551
+ tech:jira-align
1552
+ tech:jquery
1553
+ tech:json
1554
+ tech:jule
1555
+ tech:julia
1556
+ tech:junit
1557
+ tech:jupyter
1558
+ tech:k3os
1559
+ tech:k3s
1560
+ tech:kafka
1561
+ tech:kaggle
1562
+ tech:karate
1563
+ tech:karma
1564
+ tech:keras
1565
+ tech:kibana
1566
+ tech:knex-js
1567
+ tech:knockout
1568
+ tech:kotlin
1569
+ tech:krakenjs
1570
+ tech:ktor
1571
+ tech:kubernetes
1572
+ tech:labview
1573
+ tech:laravel
1574
+ tech:latex
1575
+ tech:less-js
1576
+ tech:linkedin
1577
+ tech:linux
1578
+ tech:liquibase
1579
+ tech:livewire
1580
+ tech:llvm
1581
+ tech:logstash
1582
+ tech:lua
1583
+ tech:lumen
1584
+ tech:magento
1585
+ tech:markdown
1586
+ tech:material-ui
1587
+ tech:materialize
1588
+ tech:matlab
1589
+ tech:matplotlib
1590
+ tech:maven
1591
+ tech:meteor-js
1592
+ tech:microsoft-sql-server
1593
+ tech:minitab
1594
+ tech:mob-x
1595
+ tech:mocha
1596
+ tech:modx
1597
+ tech:moleculer
1598
+ tech:mongodb
1599
+ tech:mongoose-js
1600
+ tech:moodle
1601
+ tech:ms-dos
1602
+ tech:mysql
1603
+ tech:nano
1604
+ tech:nerog
1605
+ tech:nestjs
1606
+ tech:net
1607
+ tech:net-core
1608
+ tech:network-x
1609
+ tech:new4j
1610
+ tech:nextjs
1611
+ tech:nginx
1612
+ tech:nhibernate
1613
+ tech:nim
1614
+ tech:nimble
1615
+ tech:nix
1616
+ tech:nodejs
1617
+ tech:nodemon
1618
+ tech:nodewebkit
1619
+ tech:npm
1620
+ tech:nuget
1621
+ tech:num-py
1622
+ tech:nuxt-js
1623
+ tech:objective-c
1624
+ tech:ocaml
1625
+ tech:oh-my-zsh
1626
+ tech:okta
1627
+ tech:open-al
1628
+ tech:open-api
1629
+ tech:open-cl
1630
+ tech:open-cv
1631
+ tech:open-gl
1632
+ tech:open-stack
1633
+ tech:open-suse
1634
+ tech:open-telemetry
1635
+ tech:opera
1636
+ tech:oracle
1637
+ tech:p5js
1638
+ tech:packer
1639
+ tech:pandas
1640
+ tech:perl
1641
+ tech:pf-sense
1642
+ tech:phalcon
1643
+ tech:phoenix-framework
1644
+ tech:photon-engine
1645
+ tech:php
1646
+ tech:php-storm
1647
+ tech:playwrite
1648
+ tech:ploty
1649
+ tech:podman
1650
+ tech:polygon
1651
+ tech:portainer
1652
+ tech:postcss
1653
+ tech:postgresql
1654
+ tech:postman
1655
+ tech:powershell
1656
+ tech:processing
1657
+ tech:prometheus
1658
+ tech:protractor
1659
+ tech:purescript
1660
+ tech:putty
1661
+ tech:pycharm
1662
+ tech:pyscript
1663
+ tech:pytest
1664
+ tech:python
1665
+ tech:python-poetry
1666
+ tech:pytorch
1667
+ tech:qodana
1668
+ tech:qt
1669
+ tech:quarkus
1670
+ tech:quasar
1671
+ tech:qwik
1672
+ tech:r
1673
+ tech:rabbitmq
1674
+ tech:rancher
1675
+ tech:raspberrypi
1676
+ tech:reach
1677
+ tech:react
1678
+ tech:react-bootstrap
1679
+ tech:realm
1680
+ tech:red-cube-s-epic-compiler-thingy-programming-re-ct
1681
+ tech:redhat
1682
+ tech:redis
1683
+ tech:redux
1684
+ tech:ren-py
1685
+ tech:rider
1686
+ tech:robot-operating-system-ros
1687
+ tech:rocksdb
1688
+ tech:rollup-js
1689
+ tech:rspec
1690
+ tech:rstudio
1691
+ tech:ruby
1692
+ tech:ruby-mine
1693
+ tech:ruby-on-rails
1694
+ tech:rust
1695
+ tech:salesforce
1696
+ tech:sanity
1697
+ tech:sass
1698
+ tech:scala
1699
+ tech:scalingo
1700
+ tech:sdl
1701
+ tech:selenium
1702
+ tech:sema-software
1703
+ tech:sequelize
1704
+ tech:shopware
1705
+ tech:sketch
1706
+ tech:slack
1707
+ tech:socket-io
1708
+ tech:solid-js
1709
+ tech:solidity
1710
+ tech:sonarqube
1711
+ tech:sourcetree
1712
+ tech:spark
1713
+ tech:splunk
1714
+ tech:spring
1715
+ tech:sql-developer
1716
+ tech:sqlalchemy
1717
+ tech:sqlite
1718
+ tech:ssh
1719
+ tech:stackoverflow
1720
+ tech:stata
1721
+ tech:storybook
1722
+ tech:streamlit
1723
+ tech:stylus
1724
+ tech:subversion
1725
+ tech:svelte
1726
+ tech:swagger
1727
+ tech:swift
1728
+ tech:symfony
1729
+ tech:tailwind-css
1730
+ tech:tauri
1731
+ tech:tensorflow
1732
+ tech:terraform
1733
+ tech:tex
1734
+ tech:the-algorithms
1735
+ tech:three-js
1736
+ tech:titanium-sdk
1737
+ tech:tomcat
1738
+ tech:tortoise-git
1739
+ tech:tower
1740
+ tech:traefik-mesh
1741
+ tech:traefik-proxy
1742
+ tech:travis-ci
1743
+ tech:trello
1744
+ tech:twitter
1745
+ tech:typescript
1746
+ tech:typo3
1747
+ tech:ubuntu
1748
+ tech:uml
1749
+ tech:unity
1750
+ tech:unix
1751
+ tech:unreal-engine
1752
+ tech:uwsgi
1753
+ tech:v8
1754
+ tech:vagrant
1755
+ tech:vala
1756
+ tech:vercel
1757
+ tech:veutify
1758
+ tech:vim
1759
+ tech:visualstudio
1760
+ tech:vite
1761
+ tech:vitejs
1762
+ tech:vscode
1763
+ tech:vsphere
1764
+ tech:vue
1765
+ tech:vue-storefront
1766
+ tech:vyper
1767
+ tech:webassembly
1768
+ tech:webflow
1769
+ tech:weblate
1770
+ tech:webpack
1771
+ tech:webstorm
1772
+ tech:windows8
1773
+ tech:windows11
1774
+ tech:woo-commerce
1775
+ tech:wordpress
1776
+ tech:xamarin
1777
+ tech:xcode
1778
+ tech:xml
1779
+ tech:yaml
1780
+ tech:yarn
1781
+ tech:yii-framework
1782
+ tech:yuno-host
1783
+ tech:zend-framework
1784
+ tech:zig
1785
+ }}`,F_="likec4builtin",BY=`${F_}:///likec4/lib/icons.c4`;var Xi=Is();const zY=new Xi.NotificationType("likec4/onDidChangeModel"),qY=new Xi.RequestType0("likec4/fetchModel"),jY=new Xi.RequestType("likec4/fetchComputedModel"),GY=new Xi.RequestType("likec4/computeView"),UY=new Xi.RequestType("likec4/layout-view"),WY=new Xi.RequestType("likec4/build"),HY=new Xi.RequestType("likec4/locate"),VY=new Xi.RequestType("likec4/change-view");class KY extends Lv{constructor(e){super(),this.services=e}init(){const e=this.services.likec4.ModelBuilder,n=this.services.likec4.ModelLocator,r=this.services.likec4.ModelChanges,i=this.services.likec4.Views,s=this.services.shared.lsp.Connection;if(!s){Fe.info("[ServerRpc] no connection, not initializing");return}Fe.info("[ServerRpc] init");const o=this.services.shared.workspace.LangiumDocuments,a=this.services.shared.workspace.DocumentBuilder,u=hG(()=>{s.sendNotification(zY,"").catch(l=>(Fe.warn(`[ServerRpc] error sending onDidChangeModel: ${l}`),Promise.resolve()))},{minQuietPeriodMs:250,maxBurstDurationMs:1e3,minGapMs:200});let c=!0;this.onDispose(e.onModelParsed(()=>u.call()),s.onRequest(jY,async({cleanCaches:l},d)=>(l&&(this.services.WorkspaceCache.clear(),this.services.DocumentCache.clear()),{model:await e.buildComputedModel(d)})),s.onRequest(qY,async l=>({model:await e.buildModel(l)})),s.onRequest(GY,async({viewId:l},d)=>({view:await e.computeView(l,d)})),s.onRequest(UY,async({viewId:l},d)=>({result:await i.layoutView(l,d)})),s.onRequest(WY,async({docs:l},d)=>{const f=l.map(w=>Xt.parse(w)),p=w=>f.every(D=>!kt.equals(D,w)),h=o.all.filter(w=>gd(w)&&p(w.uri)&&w.uri.scheme!==F_).map(w=>w.uri).toArray();Fe.debug(`[ServerRpc] received request to build:
1786
+ changed (total ${f.length}):${l.map(w=>`
1787
+ - `+w).join("")}
1788
+ deleted (total ${h.length}):${h.map(w=>`
1789
+ - `+w.toString()).join(`
1790
+ `)}`),!c&&f.length+h.length>0&&await Promise.allSettled([...f,...h].map(async w=>{const D=w.toString();Fe.debug(`clear diagnostics for ${D}`);try{await s.sendDiagnostics({uri:D,diagnostics:[]})}catch(g){Fe.warn(`error clearing diagnostics for ${D}: ${g}`)}})),c=!1,await It(d),await a.update(f,h,d)}),s.onRequest(HY,l=>{switch(!0){case"element"in l:return n.locateElement(l.element,l.property??"name");case"relation"in l:return n.locateRelation(l.relation);case"view"in l:return n.locateView(l.view);case"deployment"in l:return n.locateDeploymentElement(l.deployment,l.property??"name");default:Oe(l)}}),s.onRequest(VY,async(l,d)=>await r.applyChange(l)),Cs.create(()=>{u.cancel()}))}}class YY{constructor(e){this.services=e}getSymbolKind(e){const n=$t(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Jn,Us,Li,Fi):return lr.Constructor;case r(Ko,Xo,Yo,Ho,ia):return lr.Namespace;case r(qs):return lr.Class;case r(ji,Ws,Gs,sa):return lr.EnumMember;case r(qi,na):return lr.Event;case r(pi,Mi,ea,Qo):return lr.TypeParameter}return lr.Field}getCompletionItemKind(e){const n=$t(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Gs):return xt.Color;case r(Jn,Li,Fi,Us):return xt.Constructor;case r(Ko,Xo,Yo,Ho,ia):return xt.Module;case r(qs):return xt.Class;case r(ji,Ws,Gs,sa):return xt.EnumMember;case r(qi,na):return xt.Event;case r(pi,ea,Mi,Qo):return xt.TypeParameter;default:return xt.Reference}}}class XY extends sS{documentFactory;constructor(e){super(e),this.documentFactory=e.workspace.LangiumDocumentFactory}async loadAdditionalDocuments(e,n){n(this.documentFactory.fromString(MY,Xt.parse(BY))),await super.loadAdditionalDocuments(e,n)}workspace(){return this.folders&&K1(this.folders,1)?this.folders[0]:null}get workspaceUri(){const e=this.workspace();return Ce(e,"Workspace not initialized"),Xt.parse(e.uri)}get workspaceURL(){const e=this.workspace();return Ce(e,"Workspace not initialized"),new URL(e.uri)}}class JY extends dC{}class QY{constructor(e){this.services=e}cache=new WeakMap;viewsWithReportedErrors=new Set;get layouter(){return this.services.likec4.Layouter}async computedViews(e){const n=await this.services.likec4.ModelBuilder.buildComputedModel(e);return n?Ou(n.views):[]}async layoutAllViews(e){const n=await this.computedViews(e);if(n.length===0)return[];const r=[],i=[];for(const s of n)this.viewsWithReportedErrors.delete(s.id),i.push(this.layouter.layout(s).then(o=>(this.cache.set(s,o),o)).catch(o=>(this.cache.delete(s),ve(o),Promise.reject(o))));for(const s of await Promise.allSettled(i))s.status==="fulfilled"&&r.push(s.value);return r}async layoutView(e,n){const r=await this.services.likec4.ModelBuilder.buildComputedModel(n);if(!r)return null;const i=r.views[e];if(!i)return null;let s=this.cache.get(i);if(s)return s;try{const o=await this.layouter.layout(i);return this.viewsWithReportedErrors.delete(e),this.cache.set(i,o),o}catch(o){if(!this.viewsWithReportedErrors.has(e)){const a=o instanceof Error?o.message:""+o;this.services.shared.lsp.Connection?.window.showErrorMessage(`LikeC4: ${a}`),this.viewsWithReportedErrors.add(e)}return Fe.error(o),Promise.reject(o)}}async diagrams(){return(await this.layoutAllViews()).map(e=>e.diagram)}async viewsAsGraphvizOut(){const e="All-LayoutedViews-DotWithSvg",n=this.services.WorkspaceCache;if(n.has(e))return await Promise.resolve(n.get(e));const r=(await this.computedViews()).map(async o=>{const{dot:a,svg:u}=await this.layouter.svg(o);return{id:o.id,dot:a,svg:u}}),i=[],s=await Promise.allSettled(r);for(const o of s)o.status==="fulfilled"?i.push(o.value):ve(o.reason);return n.set(e,i),i}async overviewGraph(){const e="OverviewGraph",n=this.services.WorkspaceCache;if(n.has(e))return await Promise.resolve(n.get(e));const r=await this.computedViews(),i=await this.layouter.layoutOverviewGraph(r);return n.set(e,i),i}}const ZY={lsp:{NodeKindProvider:t=>new YY(t),WorkspaceSymbolProvider:t=>new JY(t)},workspace:{WorkspaceManager:t=>new XY(t)}};function Nt(t){return e=>new t(e)}const eX={documentation:{DocumentationProvider:Nt(QV)},WorkspaceCache:t=>new nS(t.shared),DocumentCache:t=>new tS(t.shared),Rpc:Nt(KY),likec4:{Layouter:t=>(Fe.debug("Creating GraphvizLayouter with GraphvizWasmAdapter"),new p_(new wa)),Views:Nt(QY),DeploymentsIndex:Nt(D5),ModelChanges:Nt(xY),FqnIndex:Nt(T5),ModelParser:Nt(RY),ModelBuilder:Nt(_5),ModelLocator:Nt(I5)},lsp:{CompletionProvider:Nt(r5),DocumentHighlightProvider:Nt(i5),DocumentSymbolProvider:Nt(m5),SemanticTokenProvider:Nt(b5),HoverProvider:Nt(v5),CodeLensProvider:Nt(n5),DocumentLinkProvider:Nt(h5),Formatter:Nt(t5)},references:{NameProvider:Nt(IY),ScopeComputation:Nt(OY),ScopeProvider:Nt(LY)}};function tX(t,e,n,r){const i=nX(t),s=[lU({shared:i}),C4,eX,e,n,r].reduce(L_,{}),o=hp(s);return i.ServiceRegistry.register(o),pK(o),t.connection?o.Rpc.init():i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:o}}function nX(t={}){const e={...ES,...t};return t.connection&&z9(t.connection),hp(fU(e),k4,ZY)}function L_(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]=L_(i,r):t[n]=r}}return t}function un(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}const Wv=(t,e)=>{const n=M_(t);if(typeof n!="string")throw new TypeError(`${e} must be a string or a file URL: ${n}.`);return n},M_=t=>t instanceof URL?Nm(t):t,B_=(t,e=[],n={})=>{const r=Wv(t,"First argument"),[i,s]=un(e)?[[],e]:[e,n];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(u=>typeof u=="object"&&u!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);const o=i.map(String),a=o.find(u=>u.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!un(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[r,o,s]},{toString:z_}=Object.prototype,rX=t=>z_.call(t)==="[object ArrayBuffer]",yr=t=>z_.call(t)==="[object Uint8Array]",Ed=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),iX=new TextEncoder,q_=t=>iX.encode(t),sX=new TextDecoder,j_=t=>sX.decode(t),oX=(t,e)=>aX(t,e).join(""),aX=(t,e)=>{if(e==="utf8"&&t.every(s=>typeof s=="string"))return t;const n=new kD(e),r=t.map(s=>typeof s=="string"?q_(s):s).map(s=>n.write(s)),i=n.end();return i===""?r:[...r,i]},Hv=t=>t.length===1&&yr(t[0])?t[0]:G_(uX(t)),uX=t=>t.map(e=>typeof e=="string"?q_(e):e),G_=t=>{const e=new Uint8Array(cX(t));let n=0;for(const r of t)e.set(r,n),n+=r.length;return e},cX=t=>{let e=0;for(const n of t)e+=n.length;return e},lX=t=>Array.isArray(t)&&Array.isArray(t.raw),dX=(t,e)=>{let n=[];for(const[s,o]of t.entries())n=fX({templates:t,expressions:e,tokens:n,index:s,template:o});if(n.length===0)throw new TypeError("Template script must not be empty");const[r,...i]=n;return[r,i,{}]},fX=({templates:t,expressions:e,tokens:n,index:r,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[r]}`);const{nextTokens:s,leadingWhitespaces:o,trailingWhitespaces:a}=pX(i,t.raw[r]),u=W_(n,s,o);if(r===e.length)return u;const c=e[r],l=Array.isArray(c)?c.map(d=>H_(d)):[H_(c)];return W_(u,l,a)},pX=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};const n=[];let r=0;const i=U_.has(e[0]);for(let o=0,a=0;o<t.length;o+=1,a+=1){const u=e[a];if(U_.has(u))r!==o&&n.push(t.slice(r,o)),r=o+1;else if(u==="\\"){const c=e[a+1];c==="u"&&e[a+2]==="{"?a=e.indexOf("}",a+3):a+=hX[c]??1}}const s=r===t.length;return s||n.push(t.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:s}},U_=new Set([" "," ","\r",`
1791
+ `]),hX={x:3,u:5},W_=(t,e,n)=>n||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],H_=t=>{const e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(un(t)&&("stdout"in t||"isMaxBuffer"in t))return mX(t);throw t instanceof SD||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},mX=({stdout:t})=>{if(typeof t=="string")return t;if(yr(t))return j_(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)},eo=t=>Vv.includes(t),Vv=[st.stdin,st.stdout,st.stderr],Br=["stdin","stdout","stderr"],V_=t=>Br[t]??`stdio[${t}]`,gX=t=>{const e={...t};for(const n of J_)e[n]=K_(t,n);return e},K_=(t,e)=>{const n=Array.from({length:yX(t)+1}),r=wX(t[e],n,e);return RX(r,e)},yX=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Br.length):Br.length,wX=(t,e,n)=>un(t)?vX(t,e,n):e.fill(t),vX=(t,e,n)=>{for(const r of Object.keys(t).sort(bX))for(const i of DX(r,n,e))e[i]=t[r];return e},bX=(t,e)=>Y_(t)<Y_(e)?1:-1,Y_=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,DX=(t,e,n)=>{if(t==="ipc")return[n.length-1];const r=X_(t);if(r===void 0||r===0)throw new TypeError(`"${e}.${t}" is invalid.
1792
+ It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(r>=n.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist.
1793
+ Please set the "stdio" option to ensure that file descriptor exists.`);return r==="all"?[1,2]:[r]},X_=t=>{if(t==="all")return t;if(Br.includes(t))return Br.indexOf(t);const e=EX.exec(t);if(e!==null)return Number(e[1])},EX=/^fd(\d+)$/,RX=(t,e)=>t.map(n=>n===void 0?TX[e]:n),$X=k1("execa").enabled?"full":"none",TX={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:$X,stripFinalNewline:!0},J_=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Rd=(t,e)=>e==="ipc"?t.at(-1):t[e],Kv=({verbose:t},e)=>Xv(t,e)!=="none",Yv=({verbose:t},e)=>!["none","short"].includes(Xv(t,e)),SX=({verbose:t},e)=>{const n=Xv(t,e);return Jv(n)?n:void 0},Xv=(t,e)=>e===void 0?kX(t):Rd(t,e),kX=t=>t.find(e=>Jv(e))??Qv.findLast(e=>t.includes(e)),Jv=t=>typeof t=="function",Qv=["none","short","full"],CX=(t,e)=>{const n=[t,...e],r=n.join(" "),i=n.map(s=>NX(Q_(s))).join(" ");return{command:r,escapedCommand:i}},Zv=t=>C1(t).split(`
1794
+ `).map(e=>Q_(e)).join(`
1795
+ `),Q_=t=>t.replaceAll(PX,e=>AX(e)),AX=t=>{const e=xX[t];if(e!==void 0)return e;const n=t.codePointAt(0),r=n.toString(16);return n<=IX?`\\u${r.padStart(4,"0")}`:`\\U${r}`},_X=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},PX=_X(),xX={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},IX=65535,NX=t=>OX.test(t)?t:X1==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,OX=/^[\w./-]+$/;function FX(){return st.platform!=="win32"?st.env.TERM!=="linux":!!st.env.WT_SESSION||!!st.env.TERMINUS_SUBLIME||st.env.ConEmuTask==="{cmd::Cmder}"||st.env.TERM_PROGRAM==="Terminus-Sublime"||st.env.TERM_PROGRAM==="vscode"||st.env.TERM==="xterm-256color"||st.env.TERM==="alacritty"||st.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Z_={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},LX={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},MX={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},BX={...Z_,...LX},zX={...Z_,...MX},qX=FX(),eb=qX?BX:zX,jX=$D.WriteStream.prototype.hasColors(),om=(t,e)=>{if(!jX)return i=>i;const n=`\x1B[${t}m`,r=`\x1B[${e}m`;return i=>{const s=i+"";let o=s.indexOf(r);if(o===-1)return n+s+r;let a=n,u=0;for(;o!==-1;)a+=s.slice(u,o)+n,u=o+r.length,o=s.indexOf(r,u);return a+=s.slice(u)+r,a}},GX=om(1,22),tb=om(90,39),UX=om(91,39),WX=om(93,39),HX=({type:t,message:e,timestamp:n,piped:r,commandId:i,result:{failed:s=!1}={},options:{reject:o=!0}})=>{const a=VX(n),u=KX[t]({failed:s,reject:o,piped:r}),c=YX[t]({reject:o});return`${tb(`[${a}]`)} ${tb(`[${i}]`)} ${c(u)} ${c(e)}`},VX=t=>`${am(t.getHours(),2)}:${am(t.getMinutes(),2)}:${am(t.getSeconds(),2)}.${am(t.getMilliseconds(),3)}`,am=(t,e)=>String(t).padStart(e,"0"),eP=({failed:t,reject:e})=>t?e?eb.cross:eb.warning:eb.tick,KX={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:eP,duration:eP},tP=t=>t,YX={command:()=>GX,output:()=>tP,ipc:()=>tP,error:({reject:t})=>t?UX:WX,duration:()=>tb},XX=(t,e,n)=>{const r=SX(e,n);return t.map(({verboseLine:i,verboseObject:s})=>JX(i,s,r)).filter(i=>i!==void 0).map(i=>QX(i)).join("")},JX=(t,e,n)=>{if(n===void 0)return t;const r=n(t,e);if(typeof r=="string")return r},QX=t=>t.endsWith(`
1796
+ `)?t:`${t}
1797
+ `,$d=({type:t,verboseMessage:e,fdNumber:n,verboseInfo:r,result:i})=>{const s=ZX({type:t,result:i,verboseInfo:r}),o=eJ(e,s),a=XX(o,r,n);dD(nJ,a)},ZX=({type:t,result:e,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...s}}})=>({type:t,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:e,options:s}),eJ=(t,e)=>t.split(`
1798
+ `).map(n=>tJ({...e,message:n})),tJ=t=>({verboseLine:HX(t),verboseObject:t}),nJ=2,nP=t=>{const e=typeof t=="string"?t:Fd(t);return Zv(e).replaceAll(" "," ".repeat(rJ))},rJ=2,iJ=(t,e)=>{Kv(e)&&$d({type:"command",verboseMessage:t,verboseInfo:e})},sJ=(t,e,n)=>{uJ(t);const r=oJ(t);return{verbose:t,escapedCommand:e,commandId:r,rawOptions:n}},oJ=t=>Kv({verbose:t})?aJ++:void 0;let aJ=0n;const uJ=t=>{for(const e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Qv.includes(e)&&!Jv(e)){const n=Qv.map(r=>`'${r}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${n} or a function.`)}}},rP=()=>zd.bigint(),iP=t=>Number(zd.bigint()-t)/1e6,sP=(t,e,n)=>{const r=rP(),{command:i,escapedCommand:s}=CX(t,e),o=K_(n,"verbose"),a=sJ(o,s,{...n});return iJ(s,a),{command:i,escapedCommand:s,startTime:r,verboseInfo:a}};var to={exports:{}},nb,oP;function cJ(){if(oP)return nb;oP=1,nb=r,r.sync=i;var t=fo;function e(s,o){var a=o.pathExt!==void 0?o.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var u=0;u<a.length;u++){var c=a[u].toLowerCase();if(c&&s.substr(-c.length).toLowerCase()===c)return!0}return!1}function n(s,o,a){return!s.isSymbolicLink()&&!s.isFile()?!1:e(o,a)}function r(s,o,a){t.stat(s,function(u,c){a(u,u?!1:n(c,s,o))})}function i(s,o){return n(t.statSync(s),s,o)}return nb}var rb,aP;function lJ(){if(aP)return rb;aP=1,rb=e,e.sync=n;var t=fo;function e(s,o,a){t.stat(s,function(u,c){a(u,u?!1:r(c,o))})}function n(s,o){return r(t.statSync(s),o)}function r(s,o){return s.isFile()&&i(s,o)}function i(s,o){var a=s.mode,u=s.uid,c=s.gid,l=o.uid!==void 0?o.uid:process.getuid&&process.getuid(),d=o.gid!==void 0?o.gid:process.getgid&&process.getgid(),f=parseInt("100",8),p=parseInt("010",8),h=parseInt("001",8),w=f|p,D=a&h||a&p&&c===d||a&f&&u===l||a&w&&l===0;return D}return rb}var ib,uP;function dJ(){if(uP)return ib;uP=1;var t;process.platform==="win32"||Gq.TESTING_WINDOWS?t=cJ():t=lJ(),ib=e,e.sync=n;function e(r,i,s){if(typeof i=="function"&&(s=i,i={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,a){e(r,i||{},function(u,c){u?a(u):o(c)})})}t(r,i||{},function(o,a){o&&(o.code==="EACCES"||i&&i.ignoreErrors)&&(o=null,a=!1),s(o,a)})}function n(r,i){try{return t.sync(r,i||{})}catch(s){if(i&&i.ignoreErrors||s.code==="EACCES")return!1;throw s}}return ib}var sb,cP;function fJ(){if(cP)return sb;cP=1;const t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",e=Rr,n=t?";":":",r=dJ(),i=u=>Object.assign(new Error(`not found: ${u}`),{code:"ENOENT"}),s=(u,c)=>{const l=c.colon||n,d=u.match(/\//)||t&&u.match(/\\/)?[""]:[...t?[process.cwd()]:[],...(c.path||process.env.PATH||"").split(l)],f=t?c.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",p=t?f.split(l):[""];return t&&u.indexOf(".")!==-1&&p[0]!==""&&p.unshift(""),{pathEnv:d,pathExt:p,pathExtExe:f}},o=(u,c,l)=>{typeof c=="function"&&(l=c,c={}),c||(c={});const{pathEnv:d,pathExt:f,pathExtExe:p}=s(u,c),h=[],w=g=>new Promise((v,E)=>{if(g===d.length)return c.all&&h.length?v(h):E(i(u));const k=d[g],P=/^".*"$/.test(k)?k.slice(1,-1):k,G=e.join(P,u),W=!P&&/^\.[\\\/]/.test(u)?u.slice(0,2)+G:G;v(D(W,g,0))}),D=(g,v,E)=>new Promise((k,P)=>{if(E===f.length)return k(w(v+1));const G=f[E];r(g+G,{pathExt:p},(W,Z)=>{if(!W&&Z)if(c.all)h.push(g+G);else return k(g+G);return k(D(g,v,E+1))})});return l?w(0).then(g=>l(null,g),l):w(0)},a=(u,c)=>{c=c||{};const{pathEnv:l,pathExt:d,pathExtExe:f}=s(u,c),p=[];for(let h=0;h<l.length;h++){const w=l[h],D=/^".*"$/.test(w)?w.slice(1,-1):w,g=e.join(D,u),v=!D&&/^\.[\\\/]/.test(u)?u.slice(0,2)+g:g;for(let E=0;E<d.length;E++){const k=v+d[E];try{if(r.sync(k,{pathExt:f}))if(c.all)p.push(k);else return k}catch{}}}if(c.all&&p.length)return p;if(c.nothrow)return null;throw i(u)};return sb=o,o.sync=a,sb}var um={exports:{}},lP;function pJ(){if(lP)return um.exports;lP=1;const t=(e={})=>{const n=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};return um.exports=t,um.exports.default=t,um.exports}var ob,dP;function hJ(){if(dP)return ob;dP=1;const t=Rr,e=fJ(),n=pJ();function r(s,o){const a=s.options.env||process.env,u=process.cwd(),c=s.options.cwd!=null,l=c&&process.chdir!==void 0&&!process.chdir.disabled;if(l)try{process.chdir(s.options.cwd)}catch{}let d;try{d=e.sync(s.command,{path:a[n({env:a})],pathExt:o?t.delimiter:void 0})}catch{}finally{l&&process.chdir(u)}return d&&(d=t.resolve(c?s.options.cwd:"",d)),d}function i(s){return r(s)||r(s,!0)}return ob=i,ob}var cm={},fP;function mJ(){if(fP)return cm;fP=1;const t=/([()\][%!^"`<>&|;, *?])/g;function e(r){return r=r.replace(t,"^$1"),r}function n(r,i){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(t,"^$1"),i&&(r=r.replace(t,"^$1")),r}return cm.command=e,cm.argument=n,cm}var ab,pP;function gJ(){return pP||(pP=1,ab=/^#!(.*)/),ab}var ub,hP;function yJ(){if(hP)return ub;hP=1;const t=gJ();return ub=(e="")=>{const n=e.match(t);if(!n)return null;const[r,i]=n[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?i:i?`${s} ${i}`:s},ub}var cb,mP;function wJ(){if(mP)return cb;mP=1;const t=fo,e=yJ();function n(r){const s=Buffer.alloc(150);let o;try{o=t.openSync(r,"r"),t.readSync(o,s,0,150,0),t.closeSync(o)}catch{}return e(s.toString())}return cb=n,cb}var lb,gP;function vJ(){if(gP)return lb;gP=1;const t=Rr,e=hJ(),n=mJ(),r=wJ(),i=process.platform==="win32",s=/\.(?:com|exe)$/i,o=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function a(l){l.file=e(l);const d=l.file&&r(l.file);return d?(l.args.unshift(l.file),l.command=d,e(l)):l.file}function u(l){if(!i)return l;const d=a(l),f=!s.test(d);if(l.options.forceShell||f){const p=o.test(d);l.command=t.normalize(l.command),l.command=n.command(l.command),l.args=l.args.map(w=>n.argument(w,p));const h=[l.command].concat(l.args).join(" ");l.args=["/d","/s","/c",`"${h}"`],l.command=process.env.comspec||"cmd.exe",l.options.windowsVerbatimArguments=!0}return l}function c(l,d,f){d&&!Array.isArray(d)&&(f=d,d=null),d=d?d.slice(0):[],f=Object.assign({},f);const p={command:l,args:d,options:f,file:void 0,original:{command:l,args:d}};return f.shell?p:u(p)}return lb=c,lb}var db,yP;function bJ(){if(yP)return db;yP=1;const t=process.platform==="win32";function e(s,o){return Object.assign(new Error(`${o} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${o} ${s.command}`,path:s.command,spawnargs:s.args})}function n(s,o){if(!t)return;const a=s.emit;s.emit=function(u,c){if(u==="exit"){const l=r(c,o);if(l)return a.call(s,"error",l)}return a.apply(s,arguments)}}function r(s,o){return t&&s===1&&!o.file?e(o.original,"spawn"):null}function i(s,o){return t&&s===1&&!o.file?e(o.original,"spawnSync"):null}return db={hookChildProcess:n,verifyENOENT:r,verifyENOENTSync:i,notFoundError:e},db}var wP;function DJ(){if(wP)return to.exports;wP=1;const t=gD,e=vJ(),n=bJ();function r(s,o,a){const u=e(s,o,a),c=t.spawn(u.command,u.args,u.options);return n.hookChildProcess(c,u),c}function i(s,o,a){const u=e(s,o,a),c=t.spawnSync(u.command,u.args,u.options);return c.error=c.error||n.verifyENOENTSync(c.status,u),c}return to.exports=r,to.exports.spawn=r,to.exports.sync=i,to.exports._parse=e,to.exports._enoent=n,to.exports}var EJ=DJ();const RJ=Rs(EJ);function vP(t={}){const{env:e=process.env,platform:n=process.platform}=t;return n!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"}const $J=({cwd:t=st.cwd(),path:e=st.env[vP()],preferLocal:n=!0,execPath:r=st.execPath,addExecPath:i=!0}={})=>{const s=t instanceof URL?Nm(t):t,o=jr.resolve(s),a=[];return n&&TJ(a,o),i&&SJ(a,r,o),[...a,e].join(jr.delimiter)},TJ=(t,e)=>{let n;for(;n!==e;)t.push(jr.join(e,"node_modules/.bin")),n=e,e=jr.resolve(e,"..")},SJ=(t,e,n)=>{const r=e instanceof URL?Nm(e):e;t.push(jr.resolve(n,r,".."))},kJ=({env:t=st.env,...e}={})=>{t={...t};const n=vP({env:t});return e.path=t[n],t[n]=$J(e),t},CJ=(t,e,n)=>{const r=n?hb:pb,i=t instanceof Td?{}:{cause:t};return new r(e,i)};class Td extends Error{}const bP=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,DP,{value:!0,writable:!1,enumerable:!1,configurable:!1})},AJ=t=>fb(t)&&DP in t,DP=Symbol("isExecaError"),fb=t=>Object.prototype.toString.call(t)==="[object Error]";class pb extends Error{}bP(pb,pb.name);class hb extends Error{}bP(hb,hb.name);const _J=()=>{const t=RP-EP+1;return Array.from({length:t},PJ)},PJ=(t,e)=>({name:`SIGRT${e+1}`,number:EP+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),EP=34,RP=64,xJ=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],$P=()=>{const t=_J();return[...xJ,...t].map(IJ)},IJ=({name:t,number:e,description:n,action:r,forced:i=!1,standard:s})=>{const{signals:{[t]:o}}=cs,a=o!==void 0;return{name:t,number:a?o:e,description:n,supported:a,action:r,forced:i,standard:s}},NJ=()=>{const t=$P();return Object.fromEntries(t.map(OJ))},OJ=({name:t,number:e,description:n,supported:r,action:i,forced:s,standard:o})=>[t,{name:t,number:e,description:n,supported:r,action:i,forced:s,standard:o}],FJ=NJ(),LJ=()=>{const t=$P(),e=RP+1,n=Array.from({length:e},(r,i)=>MJ(i,t));return Object.assign({},...n)},MJ=(t,e)=>{const n=BJ(t,e);if(n===void 0)return{};const{name:r,description:i,supported:s,action:o,forced:a,standard:u}=n;return{[t]:{name:r,number:t,description:i,supported:s,action:o,forced:a,standard:u}}},BJ=(t,e)=>{const n=e.find(({name:r})=>cs.signals[r]===t);return n!==void 0?n:e.find(r=>r.number===t)};LJ();const zJ=t=>{const e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return TP(t,e)},qJ=t=>t===0?t:TP(t,"`subprocess.kill()`'s argument"),TP=(t,e)=>{if(Number.isInteger(t))return jJ(t,e);if(typeof t=="string")return UJ(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer.
1799
+ ${mb()}`)},jJ=(t,e)=>{if(SP.has(t))return SP.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist.
1800
+ ${mb()}`)},GJ=()=>new Map(Object.entries(cs.signals).reverse().map(([t,e])=>[e,t])),SP=GJ(),UJ=(t,e)=>{if(t in cs.signals)return t;throw t.toUpperCase()in cs.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist.
1801
+ ${mb()}`)},mb=()=>`Available signal names: ${WJ()}.
1802
+ Available signal numbers: ${HJ()}.`,WJ=()=>Object.keys(cs.signals).sort().map(t=>`'${t}'`).join(", "),HJ=()=>[...new Set(Object.values(cs.signals).sort((t,e)=>t-e))].join(", "),kP=t=>FJ[t].description,VJ=t=>{if(t===!1)return t;if(t===!0)return KJ;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},KJ=1e3*5,YJ=({kill:t,options:{forceKillAfterDelay:e,killSignal:n},onInternalError:r,context:i,controller:s},o,a)=>{const{signal:u,error:c}=XJ(o,a,n);JJ(c,r);const l=t(u);return QJ({kill:t,signal:u,forceKillAfterDelay:e,killSignal:n,killResult:l,context:i,controller:s}),l},XJ=(t,e,n)=>{const[r=n,i]=fb(t)?[void 0,t]:[t,e];if(typeof r!="string"&&!Number.isInteger(r))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!fb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:qJ(r),error:i}},JJ=(t,e)=>{t!==void 0&&e.reject(t)},QJ=async({kill:t,signal:e,forceKillAfterDelay:n,killSignal:r,killResult:i,context:s,controller:o})=>{e===r&&i&&CP({kill:t,forceKillAfterDelay:n,context:s,controllerSignal:o.signal})},CP=async({kill:t,forceKillAfterDelay:e,context:n,controllerSignal:r})=>{if(e!==!1)try{await CD(e,void 0,{signal:r}),t("SIGKILL")&&(n.isForcefullyTerminated??=!0)}catch{}},AP=async(t,e)=>{t.aborted||await $n(t,"abort",{signal:e})},ZJ=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},eQ=({subprocess:t,cancelSignal:e,gracefulCancel:n,context:r,controller:i})=>e===void 0||n?[]:[tQ(t,e,r,i)],tQ=async(t,e,n,{signal:r})=>{throw await AP(e,r),n.terminationReason??="cancel",t.kill(),e.reason},gb=({methodName:t,isSubprocess:e,ipc:n,isConnected:r})=>{nQ(t,e,n),_P(t,e,r)},nQ=(t,e,n)=>{if(!n)throw new Error(`${wr(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},_P=(t,e,n)=>{if(!n)throw new Error(`${wr(t,e)} cannot be used: the ${Ji(e)} has already exited or disconnected.`)},rQ=t=>{throw new Error(`${wr("getOneMessage",t)} could not complete: the ${Ji(t)} exited or disconnected.`)},iQ=t=>{throw new Error(`${wr("sendMessage",t)} failed: the ${Ji(t)} is sending a message too, instead of listening to incoming messages.
1803
+ This can be fixed by both sending a message and listening to incoming messages at the same time:
1804
+
1805
+ const [receivedMessage] = await Promise.all([
1806
+ ${wr("getOneMessage",t)},
1807
+ ${wr("sendMessage",t,"message, {strict: true}")},
1808
+ ]);`)},PP=(t,e)=>new Error(`${wr("sendMessage",e)} failed when sending an acknowledgment response to the ${Ji(e)}.`,{cause:t}),sQ=t=>{throw new Error(`${wr("sendMessage",t)} failed: the ${Ji(t)} is not listening to incoming messages.`)},oQ=t=>{throw new Error(`${wr("sendMessage",t)} failed: the ${Ji(t)} exited without listening to incoming messages.`)},aQ=()=>new Error(`\`cancelSignal\` aborted: the ${Ji(!0)} disconnected.`),uQ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},cQ=({error:t,methodName:e,isSubprocess:n})=>{if(t.code==="EPIPE")throw new Error(`${wr(e,n)} cannot be used: the ${Ji(n)} is disconnecting.`,{cause:t})},lQ=({error:t,methodName:e,isSubprocess:n,message:r})=>{if(dQ(t))throw new Error(`${wr(e,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:t})},dQ=({code:t,message:e})=>fQ.has(t)||pQ.some(n=>e.includes(n)),fQ=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),pQ=["could not be cloned","circular structure","call stack size exceeded"],wr=(t,e,n="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${hQ(e)}${t}(${n})`,hQ=t=>t?"":"subprocess.",Ji=t=>t?"parent process":"subprocess",yb=t=>{t.connected&&t.disconnect()},Sd=()=>{const t={},e=new Promise((n,r)=>{Object.assign(t,{resolve:n,reject:r})});return Object.assign(e,t)},xP=(t,e="stdin")=>{const{options:r,fileDescriptors:i}=no.get(t),s=IP(i,e,!0),o=t.stdio[s];if(o===null)throw new TypeError(NP(s,e,r,!0));return o},wb=(t,e="stdout")=>{const{options:r,fileDescriptors:i}=no.get(t),s=IP(i,e,!1),o=s==="all"?t.all:t.stdio[s];if(o==null)throw new TypeError(NP(s,e,r,!1));return o},no=new WeakMap,IP=(t,e,n)=>{const r=mQ(e,n);return gQ(r,e,n,t),r},mQ=(t,e)=>{const n=X_(t);if(n!==void 0)return n;const{validOptions:r,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${kd(e)}" must not be "${t}".
1809
+ It must be ${r} or "fd3", "fd4" (and so on).
1810
+ It is optional and defaults to "${i}".`)},gQ=(t,e,n,r)=>{const i=r[OP(t)];if(i===void 0)throw new TypeError(`"${kd(n)}" must not be ${e}. That file descriptor does not exist.
1811
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!n)throw new TypeError(`"${kd(n)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&n)throw new TypeError(`"${kd(n)}" must not be ${e}. It must be a writable stream, not readable.`)},NP=(t,e,n,r)=>{if(t==="all"&&!n.all)return`The "all" option must be true to use "from: 'all'".`;const{optionName:i,optionValue:s}=yQ(t,n);return`The "${i}: ${vb(s)}" option is incompatible with using "${kd(r)}: ${vb(e)}".
1812
+ Please set this option with "pipe" instead.`},yQ=(t,{stdin:e,stdout:n,stderr:r,stdio:i})=>{const s=OP(t);return s===0&&e!==void 0?{optionName:"stdin",optionValue:e}:s===1&&n!==void 0?{optionName:"stdout",optionValue:n}:s===2&&r!==void 0?{optionName:"stderr",optionValue:r}:{optionName:`stdio[${s}]`,optionValue:i[s]}},OP=t=>t==="all"?1:t,kd=t=>t?"to":"from",vb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream",lm=(t,e,n)=>{const r=t.getMaxListeners();r===0||r===Number.POSITIVE_INFINITY||(t.setMaxListeners(r+e),_D(n,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))},FP=(t,e)=>{e&&bb(t)},bb=t=>{t.refCounted()},LP=(t,e)=>{e&&Db(t)},Db=t=>{t.unrefCounted()},wQ=(t,e)=>{e&&(Db(t),Db(t))},vQ=(t,e)=>{e&&(bb(t),bb(t))},bQ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r},i)=>{if(kQ(i)||BQ(i))return;dm.has(t)||dm.set(t,[]);const s=dm.get(t);if(s.push(i),!(s.length>1))for(;s.length>0;){await xQ(t,r,i),await AD.yield();const o=await SQ({wrappedMessage:s[0],anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r});s.shift(),r.emit("message",o),r.emit("message:done")}},DQ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{UP();const s=dm.get(t);for(;s?.length>0;)await $n(r,"message:done");t.removeListener("message",i),vQ(e,n),r.connected=!1,r.emit("disconnect")},dm=new WeakMap,fm=(t,e,n)=>{if(pm.has(t))return pm.get(t);const r=new oN;return r.connected=!0,pm.set(t,r),EQ({ipcEmitter:r,anyProcess:t,channel:e,isSubprocess:n}),r},pm=new WeakMap,EQ=({ipcEmitter:t,anyProcess:e,channel:n,isSubprocess:r})=>{const i=bQ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t});e.on("message",i),e.once("disconnect",DQ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t,boundOnMessage:i})),wQ(n,r)},MP=t=>{const e=pm.get(t);return e===void 0?t.channel!==null:e.connected},RQ=({anyProcess:t,channel:e,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;const s=fm(t,e,n),o=Eb(t,s);return{id:$Q++,type:mm,message:r,hasListeners:o}};let $Q=0n;const TQ=(t,e)=>{if(!(e?.type!==mm||e.hasListeners))for(const{id:n}of t)n!==void 0&&hm[n].resolve({isDeadlock:!0,hasListeners:!1})},SQ=async({wrappedMessage:t,anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(t?.type!==mm||!e.connected)return t;const{id:s,message:o}=t,a={id:s,type:BP,message:Eb(e,i)};try{await zP({anyProcess:e,channel:n,isSubprocess:r,ipc:!0},a)}catch(u){i.emit("strict:error",u)}return o},kQ=t=>{if(t?.type!==BP)return!1;const{id:e,message:n}=t;return hm[e]?.resolve({isDeadlock:!1,hasListeners:n}),!0},CQ=async(t,e,n)=>{if(t?.type!==mm)return;const r=Sd();hm[t.id]=r;const i=new AbortController;try{const{isDeadlock:s,hasListeners:o}=await Promise.race([r,AQ(e,n,i)]);s&&iQ(n),o||sQ(n)}finally{i.abort(),delete hm[t.id]}},hm={},AQ=async(t,e,{signal:n})=>{lm(t,1,n),await $n(t,"disconnect",{signal:n}),oQ(e)},mm="execa:ipc:request",BP="execa:ipc:response",_Q=(t,e,n)=>{Cd.has(t)||Cd.set(t,new Set);const r=Cd.get(t),i=Sd(),s=n?e.id:void 0,o={onMessageSent:i,id:s};return r.add(o),{outgoingMessages:r,outgoingMessage:o}},PQ=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},xQ=async(t,e,n)=>{for(;!Eb(t,e)&&Cd.get(t)?.size>0;){const r=[...Cd.get(t)];TQ(r,n),await Promise.all(r.map(({onMessageSent:i})=>i))}},Cd=new WeakMap,Eb=(t,e)=>e.listenerCount("message")>IQ(t),IQ=t=>no.has(t)&&!Rd(no.get(t).options.buffer,"ipc")?1:0,zP=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},i,{strict:s=!1}={})=>{const o="sendMessage";return gb({methodName:o,isSubprocess:n,ipc:r,isConnected:t.connected}),NQ({anyProcess:t,channel:e,methodName:o,isSubprocess:n,message:i,strict:s})},NQ=async({anyProcess:t,channel:e,methodName:n,isSubprocess:r,message:i,strict:s})=>{const o=RQ({anyProcess:t,channel:e,isSubprocess:r,message:i,strict:s}),a=_Q(t,o,s);try{await qP({anyProcess:t,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(u){throw yb(t),u}finally{PQ(a)}},qP=async({anyProcess:t,methodName:e,isSubprocess:n,wrappedMessage:r,message:i})=>{const s=OQ(t);try{await Promise.all([CQ(r,t,n),s(r)])}catch(o){throw cQ({error:o,methodName:e,isSubprocess:n}),lQ({error:o,methodName:e,isSubprocess:n,message:i}),o}},OQ=t=>{if(Rb.has(t))return Rb.get(t);const e=A1(t.send.bind(t));return Rb.set(t,e),e},Rb=new WeakMap,FQ=(t,e)=>{const n="cancelSignal";return _P(n,!1,t.connected),qP({anyProcess:t,methodName:n,isSubprocess:!1,wrappedMessage:{type:GP,message:e},message:e})},LQ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>(await MQ({anyProcess:t,channel:e,isSubprocess:n,ipc:r}),$b.signal),MQ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>{if(!jP){if(jP=!0,!r){uQ();return}if(e===null){UP();return}fm(t,e,n),await AD.yield()}};let jP=!1;const BQ=t=>t?.type!==GP?!1:($b.abort(t.message),!0),GP="execa:ipc:cancel",UP=()=>{$b.abort(aQ())},$b=new AbortController,zQ=({gracefulCancel:t,cancelSignal:e,ipc:n,serialization:r})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},qQ=({subprocess:t,cancelSignal:e,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:s})=>n?[jQ({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:i,controller:s})]:[],jQ=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{await AP(e,i);const s=GQ(e);throw await FQ(t,s),CP({kill:t.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??="gracefulCancel",e.reason},GQ=({reason:t})=>{if(!(t instanceof DOMException))return t;const e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e},UQ=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},WQ=(t,e,n,r)=>e===0||e===void 0?[]:[HQ(t,e,n,r)],HQ=async(t,e,n,{signal:r})=>{throw await CD(e,void 0,{signal:r}),n.terminationReason??="timeout",t.kill(),new Td},VQ=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},KQ=(t,e,{node:n=!1,nodePath:r=J1,nodeOptions:i=Q1.filter(u=>!u.startsWith("--inspect")),cwd:s,execPath:o,...a})=>{if(o!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');const u=Wv(r,'The "nodePath" option'),c=jr.resolve(s,u),l={...a,nodePath:c,node:n,cwd:s};if(!n)return[t,e,l];if(jr.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[c,[...i,t,...e],{ipc:!0,...l,shell:!1}]},YQ=({ipcInput:t,ipc:e,serialization:n})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");QQ[n](t)}},XQ=t=>{try{uN(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},JQ=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},QQ={advanced:XQ,json:JQ},ZQ=async(t,e)=>{e!==void 0&&await t.sendMessage(e)},eZ=({encoding:t})=>{if(Tb.has(t))return;const e=nZ(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${gm(t)}\`.
1813
+ Please rename it to ${gm(e)}.`);const n=[...Tb].map(r=>gm(r)).join(", ");throw new TypeError(`Invalid option \`encoding: ${gm(t)}\`.
1814
+ Please rename it to one of: ${n}.`)},tZ=new Set(["utf8","utf16le"]),ro=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),Tb=new Set([...tZ,...ro]),nZ=t=>{if(t===null)return"buffer";if(typeof t!="string")return;const e=t.toLowerCase();if(e in WP)return WP[e];if(Tb.has(e))return e},WP={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},gm=t=>typeof t=="string"?`"${t}"`:String(t),rZ=(t=HP())=>{const e=Wv(t,'The "cwd" option');return jr.resolve(e)},HP=()=>{try{return st.cwd()}catch(t){throw t.message=`The current directory does not exist.
1815
+ ${t.message}`,t}},iZ=(t,e)=>{if(e===HP())return t;let n;try{n=v1(e)}catch(r){return`The "cwd" option is invalid: ${e}.
1816
+ ${r.message}
1817
+ ${t}`}return n.isDirectory()?t:`The "cwd" option is not a directory: ${e}.
1818
+ ${t}`},VP=(t,e,n)=>{n.cwd=rZ(n.cwd);const[r,i,s]=KQ(t,e,n),{command:o,args:a,options:u}=RJ._parse(r,i,s),c=gX(u),l=sZ(c);return UQ(l),eZ(l),YQ(l),ZJ(l),zQ(l),l.shell=M_(l.shell),l.env=oZ(l),l.killSignal=zJ(l.killSignal),l.forceKillAfterDelay=VJ(l.forceKillAfterDelay),l.lines=l.lines.map((d,f)=>d&&!ro.has(l.encoding)&&l.buffer[f]),st.platform==="win32"&&jr.basename(o,".exe")==="cmd"&&a.unshift("/q"),{file:o,commandArguments:a,options:l}},sZ=({extendEnv:t=!0,preferLocal:e=!1,cwd:n,localDir:r=n,encoding:i="utf8",reject:s=!0,cleanup:o=!0,all:a=!1,windowsHide:u=!0,killSignal:c="SIGTERM",forceKillAfterDelay:l=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:h="advanced",...w})=>({...w,extendEnv:t,preferLocal:e,cwd:n,localDirectory:r,encoding:i,reject:s,cleanup:o,all:a,windowsHide:u,killSignal:c,forceKillAfterDelay:l,gracefulCancel:d,ipcInput:f,ipc:p,serialization:h}),oZ=({env:t,extendEnv:e,preferLocal:n,node:r,localDirectory:i,nodePath:s})=>{const o=e?{...st.env,...t}:t;return n||r?kJ({env:o,cwd:i,execPath:s,preferLocal:n,addExecPath:r}):o};function Sb(t){if(typeof t=="string")return aZ(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return uZ(t)}const aZ=t=>t.at(-1)===KP?t.slice(0,t.at(-2)===YP?-2:-1):t,uZ=t=>t.at(-1)===cZ?t.subarray(0,t.at(-2)===lZ?-2:-1):t,KP=`
1819
+ `,cZ=KP.codePointAt(0),YP="\r",lZ=YP.codePointAt(0);function io(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function XP(t,{checkOpen:e=!0}={}){return io(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function ym(t,{checkOpen:e=!0}={}){return io(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function JP(t,e){return XP(t,e)&&ym(t,e)}const dZ=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);let fZ=class{#e;#t;#n=!1;#r=void 0;constructor(e,n){this.#e=e,this.#t=n}next(){const e=()=>this.#s();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){const n=()=>this.#i(e);return this.#r?this.#r.then(n,n):n()}async#s(){if(this.#n)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(n){throw this.#r=void 0,this.#n=!0,this.#e.releaseLock(),n}return e.done&&(this.#r=void 0,this.#n=!0,this.#e.releaseLock()),e}async#i(e){if(this.#n)return{done:!0,value:e};if(this.#n=!0,!this.#t){const n=this.#e.cancel(e);return this.#e.releaseLock(),await n,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}};const kb=Symbol();function QP(){return this[kb].next()}Object.defineProperty(QP,"name",{value:"next"});function ZP(t){return this[kb].return(t)}Object.defineProperty(ZP,"name",{value:"return"});const pZ=Object.create(dZ,{next:{enumerable:!0,configurable:!0,writable:!0,value:QP},return:{enumerable:!0,configurable:!0,writable:!0,value:ZP}});function hZ({preventCancel:t=!1}={}){const e=this.getReader(),n=new fZ(e,t),r=Object.create(pZ);return r[kb]=n,r}const mZ=t=>{if(ym(t,{checkOpen:!1})&&Cb.on!==void 0)return yZ(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(gZ.call(t)==="[object ReadableStream]")return hZ.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:gZ}=Object.prototype,yZ=async function*(t){const e=new AbortController,n={};wZ(t,e,n);try{for await(const[r]of Cb.on(t,"data",{signal:e.signal}))yield r}catch(r){if(n.error!==void 0)throw n.error;if(!e.signal.aborted)throw r}finally{t.destroy()}},wZ=async(t,e,n)=>{try{await Cb.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(r){n.error=r}finally{e.abort()}},Cb={},Ab=async(t,{init:e,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,finalize:a},{maxBuffer:u=Number.POSITIVE_INFINITY}={})=>{const c=mZ(t),l=e();l.length=0;try{for await(const d of c){const f=bZ(d),p=n[f](d,l);ex({convertedChunk:p,state:l,getSize:r,truncateChunk:i,addChunk:s,maxBuffer:u})}return vZ({state:l,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,maxBuffer:u}),a(l)}catch(d){const f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(l),f}},vZ=({state:t,getSize:e,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:s})=>{const o=i(t);o!==void 0&&ex({convertedChunk:o,state:t,getSize:e,truncateChunk:n,addChunk:r,maxBuffer:s})},ex=({convertedChunk:t,state:e,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:s})=>{const o=n(t),a=e.length+o;if(a<=s){tx(t,e,i,a);return}const u=r(t,s-e.length);throw u!==void 0&&tx(u,e,i,s),new wm},tx=(t,e,n,r)=>{e.contents=n(t,e,r),e.length=r},bZ=t=>{const e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";const n=nx.call(t);return n==="[object ArrayBuffer]"?"arrayBuffer":n==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&nx.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:nx}=Object.prototype;class wm extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}const so=t=>t,_b=()=>{},rx=({contents:t})=>t,ix=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},sx=t=>t.length;async function DZ(t,e){return Ab(t,TZ,e)}const EZ=()=>({contents:[]}),RZ=()=>1,$Z=(t,{contents:e})=>(e.push(t),e),TZ={init:EZ,convertChunk:{string:so,buffer:so,arrayBuffer:so,dataView:so,typedArray:so,others:so},getSize:RZ,truncateChunk:_b,addChunk:$Z,getFinalChunk:_b,finalize:rx};async function SZ(t,e){return Ab(t,OZ,e)}const kZ=()=>({contents:new ArrayBuffer(0)}),CZ=t=>AZ.encode(t),AZ=new TextEncoder,ox=t=>new Uint8Array(t),ax=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),_Z=(t,e)=>t.slice(0,e),PZ=(t,{contents:e,length:n},r)=>{const i=lx()?IZ(e,r):xZ(e,r);return new Uint8Array(i).set(t,n),i},xZ=(t,e)=>{if(e<=t.byteLength)return t;const n=new ArrayBuffer(ux(e));return new Uint8Array(n).set(new Uint8Array(t),0),n},IZ=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;const n=new ArrayBuffer(e,{maxByteLength:ux(e)});return new Uint8Array(n).set(new Uint8Array(t),0),n},ux=t=>cx**Math.ceil(Math.log(t)/Math.log(cx)),cx=2,NZ=({contents:t,length:e})=>lx()?t:t.slice(0,e),lx=()=>"resize"in ArrayBuffer.prototype,OZ={init:kZ,convertChunk:{string:CZ,buffer:ox,arrayBuffer:ox,dataView:ax,typedArray:ax,others:ix},getSize:sx,truncateChunk:_Z,addChunk:PZ,getFinalChunk:_b,finalize:NZ};async function FZ(t,e){return Ab(t,qZ,e)}const LZ=()=>({contents:"",textDecoder:new TextDecoder}),vm=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),MZ=(t,{contents:e})=>e+t,BZ=(t,e)=>t.slice(0,e),zZ=({textDecoder:t})=>{const e=t.decode();return e===""?void 0:e},qZ={init:LZ,convertChunk:{string:so,buffer:vm,arrayBuffer:vm,dataView:vm,typedArray:vm,others:ix},getSize:sx,truncateChunk:BZ,addChunk:MZ,getFinalChunk:zZ,finalize:rx},jZ=({error:t,stream:e,readableObjectMode:n,lines:r,encoding:i,fdNumber:s})=>{if(!(t instanceof wm))throw t;if(s==="all")return t;const o=GZ(n,r,i);throw t.maxBufferInfo={fdNumber:s,unit:o},e.destroy(),t},GZ=(t,e,n)=>t?"objects":e?"lines":n==="buffer"?"bytes":"characters",UZ=(t,e,n)=>{if(e.length!==n)return;const r=new wm;throw r.maxBufferInfo={fdNumber:"ipc"},r},WZ=(t,e)=>{const{streamName:n,threshold:r,unit:i}=HZ(t,e);return`Command's ${n} was larger than ${r} ${i}`},HZ=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};const{maxBufferInfo:{fdNumber:n,unit:r}}=t;delete t.maxBufferInfo;const i=Rd(e,n);return n==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:V_(n),threshold:i,unit:r}},VZ=(t,e,n)=>t?.code==="ENOBUFS"&&e!==null&&e.some(r=>r!==null&&r.length>Pb(n)),KZ=(t,e,n)=>{if(!e)return t;const r=Pb(n);return t.length>r?t.slice(0,r):t},Pb=([,t])=>t,YZ=({stdio:t,all:e,ipcOutput:n,originalError:r,signal:i,signalDescription:s,exitCode:o,escapedCommand:a,timedOut:u,isCanceled:c,isGracefullyCanceled:l,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:h,maxBuffer:w,timeout:D,cwd:g})=>{const v=r?.code,E=XZ({originalError:r,timedOut:u,timeout:D,isMaxBuffer:d,maxBuffer:w,errorCode:v,signal:i,signalDescription:s,exitCode:o,isCanceled:c,isGracefullyCanceled:l,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:h}),k=QZ(r,g),P=k===void 0?"":`
1820
+ ${k}`,G=`${E}: ${a}${P}`,W=e===void 0?[t[2],t[1]]:[e],Z=[G,...W,...t.slice(3),n.map(J=>ZZ(J)).join(`
1821
+ `)].map(J=>Zv(Sb(eee(J)))).filter(Boolean).join(`
1822
+
1823
+ `);return{originalMessage:k,shortMessage:G,message:Z}},XZ=({originalError:t,timedOut:e,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:s,signal:o,signalDescription:a,exitCode:u,isCanceled:c,isGracefullyCanceled:l,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{const h=JZ(d,f);return e?`Command timed out after ${n} milliseconds${h}`:l?o===void 0?`Command was gracefully canceled with exit code ${u}`:d?`Command was gracefully canceled${h}`:`Command was gracefully canceled with ${o} (${a})`:c?`Command was canceled${h}`:r?`${WZ(t,i)}${h}`:s!==void 0?`Command failed with ${s}${h}`:d?`Command was killed with ${p} (${kP(p)})${h}`:o!==void 0?`Command was killed with ${o} (${a})`:u!==void 0?`Command failed with exit code ${u}`:"Command failed"},JZ=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",QZ=(t,e)=>{if(t instanceof Td)return;const n=AJ(t)?t.originalMessage:String(t?.message??t),r=Zv(iZ(n,e));return r===""?void 0:r},ZZ=t=>typeof t=="string"?t:Fd(t),eee=t=>Array.isArray(t)?t.map(e=>Sb(dx(e))).filter(Boolean).join(`
1824
+ `):dx(t),dx=t=>typeof t=="string"?t:yr(t)?j_(t):"",fx=({command:t,escapedCommand:e,stdio:n,all:r,ipcOutput:i,options:{cwd:s},startTime:o})=>px({command:t,escapedCommand:e,cwd:s,durationMs:iP(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),xb=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:o})=>Ib({error:t,command:e,escapedCommand:n,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:o}),Ib=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:u,exitCode:c,signal:l,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:h,timeout:w=h,forceKillAfterDelay:D,killSignal:g,cwd:v,maxBuffer:E},isSync:k})=>{const{exitCode:P,signal:G,signalDescription:W}=nee(c,l),{originalMessage:Z,shortMessage:J,message:fe}=YZ({stdio:d,all:f,ipcOutput:p,originalError:t,signal:G,signalDescription:W,exitCode:P,escapedCommand:n,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:u,forceKillAfterDelay:D,killSignal:g,maxBuffer:E,timeout:w,cwd:v}),N=CJ(t,fe,k);return Object.assign(N,tee({error:N,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:u,exitCode:P,signal:G,signalDescription:W,stdio:d,all:f,ipcOutput:p,cwd:v,originalMessage:Z,shortMessage:J})),N},tee=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:u,exitCode:c,signal:l,signalDescription:d,stdio:f,all:p,ipcOutput:h,cwd:w,originalMessage:D,shortMessage:g})=>px({shortMessage:g,originalMessage:D,command:e,escapedCommand:n,cwd:w,durationMs:iP(r),failed:!0,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isTerminated:l!==void 0,isMaxBuffer:a,isForcefullyTerminated:u,exitCode:c,signal:l,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:h,pipedFrom:[]}),px=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),nee=(t,e)=>{const n=t===null?void 0:t,r=e===null?void 0:e,i=r===void 0?void 0:kP(e);return{exitCode:n,signal:r,signalDescription:i}},hx=t=>Number.isFinite(t)?t:0;function ree(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(hx(t*1e3)%1e3),nanoseconds:Math.trunc(hx(t*1e6)%1e3)}}function iee(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function see(t){switch(typeof t){case"number":{if(Number.isFinite(t))return ree(t);break}case"bigint":return iee(t)}throw new TypeError("Expected a finite number or bigint")}const oee=t=>t===0||t===0n,aee=(t,e)=>e===1||e===1n?t:`${t}s`,uee=1e-7,cee=24n*60n*60n*1000n;function mx(t,e){const n=typeof t=="bigint";if(!n&&!Number.isFinite(t))throw new TypeError("Expected 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,d)=>{const f=Math.floor(l*10**d+uee);return(Math.round(f)/10**d).toFixed(d)},o=(l,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&oee(l)&&!(e.colonNotation&&f==="m"))){if(p??=String(l),e.colonNotation){const h=p.includes(".")?p.split(".")[0].length:p.length,w=i.length>0?2:1;p="0".repeat(Math.max(0,w-h))+p}else p+=e.verbose?" "+aee(d,l):f;i.push(p)}},a=see(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),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(o(l,"second","s"),e.formatSubMilliseconds)o(d,"millisecond","ms"),o(f,"microsecond","\xB5s"),o(p,"nanosecond","ns");else{const h=d+f/1e3+p/1e6,w=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,D=h>=1?Math.round(h):Math.ceil(h),g=w?h.toFixed(w):D;o(Number.parseFloat(g),"millisecond","ms",g)}}else{const l=(n?Number(t%cee):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=s(l,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.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)}const lee=(t,e)=>{t.failed&&$d({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})},dee=(t,e)=>{Kv(e)&&(lee(t,e),fee(t,e))},fee=(t,e)=>{const n=`(done in ${mx(t.durationMs)})`;$d({type:"duration",verboseMessage:n,verboseInfo:e,result:t})},Nb=(t,e,{reject:n})=>{if(dee(t,e),t.failed&&n)throw t;return t},pee=(t,e)=>ha(t)?"asyncGenerator":bx(t)?"generator":Fb(t)?"fileUrl":vee(t)?"filePath":Eee(t)?"webStream":io(t,{checkOpen:!1})?"native":yr(t)?"uint8Array":Ree(t)?"asyncIterable":$ee(t)?"iterable":Mb(t)?gx({transform:t},e):yee(t)?hee(t,e):"native",hee=(t,e)=>JP(t.transform,{checkOpen:!1})?mee(t,e):Mb(t.transform)?gx(t,e):gee(t,e),mee=(t,e)=>(yx(t,e,"Duplex stream"),"duplex"),gx=(t,e)=>(yx(t,e,"web TransformStream"),"webTransform"),yx=({final:t,binary:e,objectMode:n},r,i)=>{wx(t,`${r}.final`,i),wx(e,`${r}.binary`,i),Ob(n,`${r}.objectMode`)},wx=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${n}.`)},gee=({transform:t,final:e,binary:n,objectMode:r},i)=>{if(t!==void 0&&!vx(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(JP(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(Mb(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!vx(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return Ob(n,`${i}.binary`),Ob(r,`${i}.objectMode`),ha(t)||ha(e)?"asyncGenerator":"generator"},Ob=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},vx=t=>ha(t)||bx(t),ha=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",bx=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",yee=t=>un(t)&&(t.transform!==void 0||t.final!==void 0),Fb=t=>Object.prototype.toString.call(t)==="[object URL]",wee=t=>Fb(t)&&t.protocol!=="file:",vee=t=>un(t)&&Object.keys(t).length===1&&Dx(t.file),Dx=t=>typeof t=="string",bee=(t,e)=>t==="native"&&typeof e=="string"&&!Dee.has(e),Dee=new Set(["ipc","ignore","inherit","overlapped","pipe"]),Ex=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Lb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Eee=t=>Ex(t)||Lb(t),Mb=t=>Ex(t?.readable)&&Lb(t?.writable),Ree=t=>Rx(t)&&typeof t[Symbol.asyncIterator]=="function",$ee=t=>Rx(t)&&typeof t[Symbol.iterator]=="function",Rx=t=>typeof t=="object"&&t!==null,oo=new Set(["generator","asyncGenerator","duplex","webTransform"]),$x=new Set(["fileUrl","filePath","fileNumber"]),Tx=new Set(["fileUrl","filePath"]),Tee=new Set([...Tx,"webStream","nodeStream"]),See=new Set(["webTransform","duplex"]),bm={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"},Sx=(t,e,n,r)=>r==="output"?kee(t,e,n):Cee(t,e,n),kee=(t,e,n)=>{const r=e!==0&&n[e-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t??r}},Cee=(t,e,n)=>{const r=e===0?t===!0:n[e-1].value.readableObjectMode,i=e!==n.length-1&&(t??r);return{writableObjectMode:r,readableObjectMode:i}},Aee=(t,e)=>{const n=t.findLast(({type:r})=>oo.has(r));return n===void 0?!1:e==="input"?n.value.writableObjectMode:n.value.readableObjectMode},_ee=(t,e,n,r)=>[...t.filter(({type:i})=>!oo.has(i)),...Pee(t,e,n,r)],Pee=(t,e,n,{encoding:r})=>{const i=t.filter(({type:o})=>oo.has(o)),s=Array.from({length:i.length});for(const[o,a]of Object.entries(i))s[o]=xee({stdioItem:a,index:Number(o),newTransforms:s,optionName:e,direction:n,encoding:r});return Fee(s,n)},xee=({stdioItem:t,stdioItem:{type:e},index:n,newTransforms:r,optionName:i,direction:s,encoding:o})=>e==="duplex"?Iee({stdioItem:t,optionName:i}):e==="webTransform"?Nee({stdioItem:t,index:n,newTransforms:r,direction:s}):Oee({stdioItem:t,index:n,newTransforms:r,direction:s,encoding:o}),Iee=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:n,readableObjectMode:r},objectMode:i=r}},optionName:s})=>{if(i&&!r)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&r)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:n,readableObjectMode:r}}},Nee=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i})=>{const{transform:s,objectMode:o}=un(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:u}=Sx(o,n,r,i);return{...t,value:{transform:s,writableObjectMode:a,readableObjectMode:u}}},Oee=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i,encoding:s})=>{const{transform:o,final:a,binary:u=!1,preserveNewlines:c=!1,objectMode:l}=un(e)?e:{transform:e},d=u||ro.has(s),{writableObjectMode:f,readableObjectMode:p}=Sx(l,n,r,i);return{...t,value:{transform:o,final:a,binary:d,preserveNewlines:c,writableObjectMode:f,readableObjectMode:p}}},Fee=(t,e)=>e==="input"?t.reverse():t,Lee=(t,e,n)=>{const r=t.map(i=>Mee(i,e));if(r.includes("input")&&r.includes("output"))throw new TypeError(`The \`${n}\` option must not be an array of both readable and writable values.`);return r.find(Boolean)??qee},Mee=({type:t,value:e},n)=>Bee[n]??kx[t](e),Bee=["input","output","output"],ma=()=>{},Bb=()=>"input",kx={generator:ma,asyncGenerator:ma,fileUrl:ma,filePath:ma,iterable:Bb,asyncIterable:Bb,uint8Array:Bb,webStream:t=>Lb(t)?"output":"input",nodeStream(t){return ym(t,{checkOpen:!1})?XP(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:ma,duplex:ma,native(t){const e=zee(t);if(e!==void 0)return e;if(io(t,{checkOpen:!1}))return kx.nodeStream(t)}},zee=t=>{if([0,st.stdin].includes(t))return"input";if([1,2,st.stdout,st.stderr].includes(t))return"output"},qee="output",jee=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t,Gee=({stdio:t,ipc:e,buffer:n,...r},i,s)=>{const o=Uee(t,r).map((a,u)=>Cx(a,u));return s?Hee(o,n,i):jee(o,e)},Uee=(t,e)=>{if(t===void 0)return Br.map(r=>e[r]);if(Wee(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Br.map(r=>`\`${r}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,Br.length);return Array.from({length:n},(r,i)=>t[i])},Wee=t=>Br.some(e=>t[e]!==void 0),Cx=(t,e)=>Array.isArray(t)?t.map(n=>Cx(n,e)):t??(e>=Br.length?"ignore":"pipe"),Hee=(t,e,n)=>t.map((r,i)=>!e[i]&&i!==0&&!Yv(n,i)&&Vee(r)?"ignore":r),Vee=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe"),Kee=({stdioItem:t,stdioItem:{type:e},isStdioArray:n,fdNumber:r,direction:i,isSync:s})=>!n||e!=="native"?t:s?Yee({stdioItem:t,fdNumber:r,direction:i}):Qee({stdioItem:t,fdNumber:r}),Yee=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r,direction:i})=>{const s=Xee({value:e,optionName:n,fdNumber:r,direction:i});if(s!==void 0)return s;if(io(e,{checkOpen:!1}))throw new TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Xee=({value:t,optionName:e,fdNumber:n,direction:r})=>{const i=Jee(t,n);if(i!==void 0){if(r==="output")return{type:"fileNumber",value:i,optionName:e};if($D.isatty(i))throw new TypeError(`The \`${e}: ${vb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Ed(Im(i)),optionName:e}}},Jee=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;const n=Vv.indexOf(t);if(n!==-1)return n},Qee=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r})=>e==="inherit"?{type:"nodeStream",value:Ax(r,e,n),optionName:n}:typeof e=="number"?{type:"nodeStream",value:Ax(e,e,n),optionName:n}:io(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:n}:t,Ax=(t,e,n)=>{const r=Vv[t];if(r===void 0)throw new TypeError(`The \`${n}: ${e}\` option is invalid: no such standard stream.`);return r},Zee=({input:t,inputFile:e},n)=>n===0?[...ete(t),...nte(e)]:[],ete=t=>t===void 0?[]:[{type:tte(t),value:t,optionName:"input"}],tte=t=>{if(ym(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(yr(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},nte=t=>t===void 0?[]:[{...rte(t),optionName:"inputFile"}],rte=t=>{if(Fb(t))return{type:"fileUrl",value:t};if(Dx(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")},ite=t=>t.filter((e,n)=>t.every((r,i)=>e.value!==r.value||n>=i||e.type==="generator"||e.type==="asyncGenerator")),ste=({stdioItem:{type:t,value:e,optionName:n},direction:r,fileDescriptors:i,isSync:s})=>{const o=ote(i,t);if(o.length!==0){if(s){ate({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});return}if(Tee.has(t))return _x({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});See.has(t)&&cte({otherStdioItems:o,type:t,value:e,optionName:n})}},ote=(t,e)=>t.flatMap(({direction:n,stdioItems:r})=>r.filter(i=>i.type===e).map(i=>({...i,direction:n}))),ate=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{Tx.has(e)&&_x({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})},_x=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{const s=t.filter(a=>ute(a,n));if(s.length===0)return;const o=s.find(a=>a.direction!==i);return Px(o,r,e),i==="output"?s[0].stream:void 0},ute=({type:t,value:e},n)=>t==="filePath"?e.file===n.file:t==="fileUrl"?e.href===n.href:e===n,cte=({otherStdioItems:t,type:e,value:n,optionName:r})=>{const i=t.find(({value:{transform:s}})=>s===n.transform);Px(i,r,e)},Px=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${bm[n]} that is the same.`)},xx=(t,e,n,r)=>{const s=Gee(e,n,r).map((a,u)=>lte({stdioOption:a,fdNumber:u,options:e,isSync:r})),o=wte({initialFileDescriptors:s,addProperties:t,options:e,isSync:r});return e.stdio=o.map(({stdioItems:a})=>Dte(a)),o},lte=({stdioOption:t,fdNumber:e,options:n,isSync:r})=>{const i=V_(e),{stdioItems:s,isStdioArray:o}=dte({stdioOption:t,fdNumber:e,options:n,optionName:i}),a=Lee(s,e,i),u=s.map(d=>Kee({stdioItem:d,isStdioArray:o,fdNumber:e,direction:a,isSync:r})),c=_ee(u,i,a,n),l=Aee(c,a);return yte(c,l),{direction:a,objectMode:l,stdioItems:c}},dte=({stdioOption:t,fdNumber:e,options:n,optionName:r})=>{const s=[...(Array.isArray(t)?t:[t]).map(u=>fte(u,r)),...Zee(n,e)],o=ite(s),a=o.length>1;return pte(o,a,r),mte(o),{stdioItems:o,isStdioArray:a}},fte=(t,e)=>({type:pee(t,e),value:t,optionName:e}),pte=(t,e,n)=>{if(t.length===0)throw new TypeError(`The \`${n}\` option must not be an empty array.`);if(e){for(const{value:r,optionName:i}of t)if(hte.has(r))throw new Error(`The \`${i}\` option must not include \`${r}\`.`)}},hte=new Set(["ignore","ipc"]),mte=t=>{for(const e of t)gte(e)},gte=({type:t,value:e,optionName:n})=>{if(wee(e))throw new TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
1825
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(bee(t,e))throw new TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},yte=(t,e)=>{if(!e)return;const n=t.find(({type:r})=>$x.has(r));if(n!==void 0)throw new TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},wte=({initialFileDescriptors:t,addProperties:e,options:n,isSync:r})=>{const i=[];try{for(const s of t)i.push(vte({fileDescriptor:s,fileDescriptors:i,addProperties:e,options:n,isSync:r}));return i}catch(s){throw Ix(i),s}},vte=({fileDescriptor:{direction:t,objectMode:e,stdioItems:n},fileDescriptors:r,addProperties:i,options:s,isSync:o})=>{const a=n.map(u=>bte({stdioItem:u,addProperties:i,direction:t,options:s,fileDescriptors:r,isSync:o}));return{direction:t,objectMode:e,stdioItems:a}},bte=({stdioItem:t,addProperties:e,direction:n,options:r,fileDescriptors:i,isSync:s})=>{const o=ste({stdioItem:t,direction:n,fileDescriptors:i,isSync:s});return o!==void 0?{...t,stream:o}:{...t,...e[n][t.type](t,r)}},Ix=t=>{for(const{stdioItems:e}of t)for(const{stream:n}of e)n!==void 0&&!eo(n)&&n.destroy()},Dte=t=>{if(t.length>1)return t.some(({value:r})=>r==="overlapped")?"overlapped":"pipe";const[{type:e,value:n}]=t;return e==="native"?n:"pipe"},Ete=(t,e)=>xx($te,t,e,!0),zr=({type:t,optionName:e})=>{Nx(e,bm[t])},Rte=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&Nx(t,`"${e}"`),{}),Nx=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},Ox={generator(){},asyncGenerator:zr,webStream:zr,nodeStream:zr,webTransform:zr,duplex:zr,asyncIterable:zr,native:Rte},$te={input:{...Ox,fileUrl:({value:t})=>({contents:[Ed(Im(t))]}),filePath:({value:{file:t}})=>({contents:[Ed(Im(t))]}),fileNumber:zr,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...Ox,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t}})=>({path:t}),fileNumber:({value:t})=>({path:t}),iterable:zr,string:zr,uint8Array:zr}},ga=(t,{stripFinalNewline:e},n)=>Fx(e,n)&&t!==void 0&&!Array.isArray(t)?Sb(t):t,Fx=(t,e)=>e==="all"?t[1]||t[2]:t[e],Lx=(t,e,n,r)=>t||n?void 0:zx(e,r),Mx=(t,e,n)=>n?t.flatMap(r=>Bx(r,e)):Bx(t,e),Bx=(t,e)=>{const{transform:n,final:r}=zx(e,{});return[...n(t),...r()]},zx=(t,e)=>(e.previousChunks="",{transform:Tte.bind(void 0,e,t),final:kte.bind(void 0,e)}),Tte=function*(t,e,n){if(typeof n!="string"){yield n;return}let{previousChunks:r}=t,i=-1;for(let s=0;s<n.length;s+=1)if(n[s]===`
1826
+ `){const o=Ste(n,s,e,t);let a=n.slice(i+1,s+1-o);r.length>0&&(a=zb(r,a),r=""),yield a,i=s}i!==n.length-1&&(r=zb(r,n.slice(i+1))),t.previousChunks=r},Ste=(t,e,n,r)=>n?0:(r.isWindowsNewline=e!==0&&t[e-1]==="\r",r.isWindowsNewline?2:1),kte=function*({previousChunks:t}){t.length>0&&(yield t)},Cte=({binary:t,preserveNewlines:e,readableObjectMode:n,state:r})=>t||e||n?void 0:{transform:Ate.bind(void 0,r)},Ate=function*({isWindowsNewline:t=!1},e){const{unixNewline:n,windowsNewline:r,LF:i,concatBytes:s}=typeof e=="string"?_te:xte;if(e.at(-1)===i){yield e;return}yield s(e,t?r:n)},zb=(t,e)=>`${t}${e}`,_te={windowsNewline:`\r
1827
+ `,unixNewline:`
1828
+ `,LF:`
1829
+ `,concatBytes:zb},Pte=(t,e)=>{const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n},xte={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Pte},Ite=(t,e)=>t?void 0:Nte.bind(void 0,e),Nte=function*(t,e){if(typeof e!="string"&&!yr(e)&&!jm.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Ote=(t,e)=>t?Fte.bind(void 0,e):Lte.bind(void 0,e),Fte=function*(t,e){qx(t,e),yield e},Lte=function*(t,e){if(qx(t,e),typeof e!="string"&&!yr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},qx=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
1830
+ Instead, \`yield\` should either be called with a value, or not be called at all. For example:
1831
+ if (condition) { yield value; }`)},jx=(t,e,n)=>{if(n)return;if(t)return{transform:Mte.bind(void 0,new TextEncoder)};const r=new kD(e);return{transform:Bte.bind(void 0,r),final:zte.bind(void 0,r)}},Mte=function*(t,e){jm.isBuffer(e)?yield Ed(e):typeof e=="string"?yield t.encode(e):yield e},Bte=function*(t,e){yield yr(e)?t.write(e):e},zte=function*(t){const e=t.end();e!==""&&(yield e)},Gx=lo(async(t,e,n,r)=>{e.currentIterable=t(...n);try{for await(const i of e.currentIterable)r.push(i)}finally{delete e.currentIterable}}),qb=async function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=Ute}=e[n];for await(const i of r(t))yield*qb(i,e,n+1)},qte=async function*(t){for(const[e,{final:n}]of Object.entries(t))yield*jte(n,Number(e),t)},jte=async function*(t,e,n){if(t!==void 0)for await(const r of t())yield*qb(r,n,e+1)},Gte=lo(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Ute=function*(t){yield t},Ux=(t,e,n,r)=>{try{for(const i of t(...e))n.push(i);r()}catch(i){r(i)}},Wte=(t,e)=>[...e.flatMap(n=>[...Ad(n,t,0)]),...jb(t)],Ad=function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=Vte}=e[n];for(const i of r(t))yield*Ad(i,e,n+1)},jb=function*(t){for(const[e,{final:n}]of Object.entries(t))yield*Hte(n,Number(e),t)},Hte=function*(t,e,n){if(t!==void 0)for(const r of t())yield*Ad(r,n,e+1)},Vte=function*(t){yield t},Wx=({value:t,value:{transform:e,final:n,writableObjectMode:r,readableObjectMode:i},optionName:s},{encoding:o})=>{const a={},u=Vx(t,o,s),c=ha(e),l=ha(n),d=c?Gx.bind(void 0,qb,a):Ux.bind(void 0,Ad),f=c||l?Gx.bind(void 0,qte,a):Ux.bind(void 0,jb),p=c||l?Gte.bind(void 0,a):void 0;return{stream:new cN({writableObjectMode:r,writableHighWaterMark:jd(r),readableObjectMode:i,readableHighWaterMark:jd(i),transform(w,D,g){d([w,u,0],this,g)},flush(w){f([u],this,w)},destroy:p})}},Hx=(t,e,n,r)=>{const i=e.filter(({type:o})=>o==="generator"),s=r?i.reverse():i;for(const{value:o,optionName:a}of s){const u=Vx(o,n,a);t=Wte(u,t)}return t},Vx=({transform:t,final:e,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:s},o,a)=>{const u={};return[{transform:Ite(r,a)},jx(n,o,r),Lx(n,s,r,u),{transform:t,final:e},{transform:Ote(i,a)},Cte({binary:n,preserveNewlines:s,readableObjectMode:i,state:u})].filter(Boolean)},Kte=(t,e)=>{for(const n of Yte(t))Xte(t,n,e)},Yte=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Xte=(t,e,n)=>{const{stdioItems:r}=t[e],i=r.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){const[{type:a,optionName:u}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${u}\`, can be ${bm[a]} with synchronous methods.`)}const o=i.map(({contents:a})=>a).map(a=>Jte(a,r));n.input=Hv(o)},Jte=(t,e)=>{const n=Hx(t,e,"utf8",!0);return Qte(n),Hv(n)},Qte=t=>{const e=t.find(n=>typeof n!="string"&&!yr(n));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)},Kx=({stdioItems:t,encoding:e,verboseInfo:n,fdNumber:r})=>r!=="all"&&Yv(n,r)&&!ro.has(e)&&Zte(r)&&(t.some(({type:i,value:s})=>i==="native"&&ene.has(s))||t.every(({type:i})=>oo.has(i))),Zte=t=>t===1||t===2,ene=new Set(["pipe","overlapped"]),tne=async(t,e,n,r)=>{for await(const i of t)rne(e)||Yx(i,n,r)},nne=(t,e,n)=>{for(const r of t)Yx(r,e,n)},rne=t=>t._readableState.pipes.length>0,Yx=(t,e,n)=>{const r=nP(t);$d({type:"output",verboseMessage:r,fdNumber:e,verboseInfo:n})},ine=({fileDescriptors:t,syncResult:{output:e},options:n,isMaxBuffer:r,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};const s={},o=new Set([]);return{output:e.map((u,c)=>sne({result:u,fileDescriptors:t,fdNumber:c,state:s,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...s}},sne=({result:t,fileDescriptors:e,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:u,lines:c,stripFinalNewline:l,maxBuffer:d})=>{if(t===null)return;const f=KZ(t,s,d),p=Ed(f),{stdioItems:h,objectMode:w}=e[n],D=one([p],h,u,r),{serializedResult:g,finalResult:v=g}=ane({chunks:D,objectMode:w,encoding:u,lines:c,stripFinalNewline:l,fdNumber:n});une({serializedResult:g,fdNumber:n,state:r,verboseInfo:o,encoding:u,stdioItems:h,objectMode:w});const E=a[n]?v:void 0;try{return r.error===void 0&&cne(g,h,i),E}catch(k){return r.error=k,E}},one=(t,e,n,r)=>{try{return Hx(t,e,n,!1)}catch(i){return r.error=i,t}},ane=({chunks:t,objectMode:e,encoding:n,lines:r,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(n==="buffer")return{serializedResult:Hv(t)};const o=oX(t,n);return r[s]?{serializedResult:o,finalResult:Mx(o,!i[s],e)}:{serializedResult:o}},une=({serializedResult:t,fdNumber:e,state:n,verboseInfo:r,encoding:i,stdioItems:s,objectMode:o})=>{if(!Kx({stdioItems:s,encoding:i,verboseInfo:r,fdNumber:e}))return;const a=Mx(t,!1,o);try{nne(a,e,r)}catch(u){n.error??=u}},cne=(t,e,n)=>{for(const{path:r}of e.filter(({type:i})=>$x.has(i))){const i=typeof r=="string"?r:r.toString();n.has(i)?b1(r,t):(n.add(i),dD(r,t))}},lne=([,t,e],n)=>{if(n.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ga(e,n,"all")]:Array.isArray(e)?[ga(t,n,"all"),...e]:yr(t)&&yr(e)?G_([t,e]):`${t}${e}`},dne=async(t,e)=>{const[n,r]=await fne(t);return e.isForcefullyTerminated??=!1,[n,r]},fne=async t=>{const[e,n]=await Promise.allSettled([$n(t,"spawn"),$n(t,"exit")]);return e.status==="rejected"?[]:n.status==="rejected"?Xx(t):n.value},Xx=async t=>{try{return await $n(t,"exit")}catch{return Xx(t)}},pne=async t=>{const[e,n]=await t;if(!hne(e,n)&&Jx(e,n))throw new Td;return[e,n]},hne=(t,e)=>t===void 0&&e===void 0,Jx=(t,e)=>t!==0||e!==null,mne=({error:t,status:e,signal:n,output:r},{maxBuffer:i})=>{const s=gne(t,e,n),o=s?.code==="ETIMEDOUT",a=VZ(s,r,i);return{resultError:s,exitCode:e,signal:n,timedOut:o,isMaxBuffer:a}},gne=(t,e,n)=>t!==void 0?t:Jx(e,n)?new Td:void 0,yne=(t,e,n)=>{const{file:r,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:u,options:c,fileDescriptors:l}=wne(t,e,n),d=Dne({file:r,commandArguments:i,options:c,command:s,escapedCommand:o,verboseInfo:u,fileDescriptors:l,startTime:a});return Nb(d,u,c)},wne=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=sP(t,e,n),a=vne(n),{file:u,commandArguments:c,options:l}=VP(t,e,a);bne(l);const d=Ete(l,o);return{file:u,commandArguments:c,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},vne=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,bne=({ipc:t,ipcInput:e,detached:n,cancelSignal:r})=>{e&&Dm("ipcInput"),t&&Dm("ipc: true"),n&&Dm("detached: true"),r&&Dm("cancelSignal")},Dm=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Dne=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{const u=Ene({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:a});if(u.failed)return u;const{resultError:c,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p}=mne(u,n),{output:h,error:w=c}=ine({fileDescriptors:o,syncResult:u,options:n,isMaxBuffer:p,verboseInfo:s}),D=h.map((v,E)=>ga(v,n,E)),g=ga(lne(h,n),n,"all");return $ne({error:w,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p,stdio:D,all:g,options:n,command:r,escapedCommand:i,startTime:a})},Ene=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{Kte(s,n);const a=Rne(n);return nN(t,e,a)}catch(a){return xb({error:a,command:r,escapedCommand:i,fileDescriptors:s,options:n,startTime:o,isSync:!0})}},Rne=({encoding:t,maxBuffer:e,...n})=>({...n,encoding:"buffer",maxBuffer:Pb(e)}),$ne=({error:t,exitCode:e,signal:n,timedOut:r,isMaxBuffer:i,stdio:s,all:o,options:a,command:u,escapedCommand:c,startTime:l})=>t===void 0?fx({command:u,escapedCommand:c,stdio:s,all:o,ipcOutput:[],options:a,startTime:l}):Ib({error:t,command:u,escapedCommand:c,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:n,stdio:s,all:o,ipcOutput:[],options:a,startTime:l,isSync:!0}),Tne=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0,filter:s}={})=>(gb({methodName:"getOneMessage",isSubprocess:n,ipc:r,isConnected:MP(t)}),Sne({anyProcess:t,channel:e,isSubprocess:n,filter:s,reference:i})),Sne=async({anyProcess:t,channel:e,isSubprocess:n,filter:r,reference:i})=>{FP(e,i);const s=fm(t,e,n),o=new AbortController;try{return await Promise.race([kne(s,r,o),Cne(s,n,o),Ane(s,n,o)])}catch(a){throw yb(t),a}finally{o.abort(),LP(e,i)}},kne=async(t,e,{signal:n})=>{if(e===void 0){const[r]=await $n(t,"message",{signal:n});return r}for await(const[r]of qd(t,"message",{signal:n}))if(e(r))return r},Cne=async(t,e,{signal:n})=>{await $n(t,"disconnect",{signal:n}),rQ(e)},Ane=async(t,e,{signal:n})=>{const[r]=await $n(t,"strict:error",{signal:n});throw PP(r,e)},_ne=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0}={})=>Qx({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),Qx=({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:i,reference:s})=>{gb({methodName:"getEachMessage",isSubprocess:n,ipc:r,isConnected:MP(t)}),FP(e,s);const o=fm(t,e,n),a=new AbortController,u={};return Pne(t,o,a),xne({ipcEmitter:o,isSubprocess:n,controller:a,state:u}),Ine({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:a,state:u,reference:s})},Pne=async(t,e,n)=>{try{await $n(e,"disconnect",{signal:n.signal}),n.abort()}catch{}},xne=async({ipcEmitter:t,isSubprocess:e,controller:n,state:r})=>{try{const[i]=await $n(t,"strict:error",{signal:n.signal});r.error=PP(i,e),n.abort()}catch{}},Ine=async function*({anyProcess:t,channel:e,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(const[u]of qd(n,"message",{signal:s.signal}))Zx(o),yield u}catch{Zx(o)}finally{s.abort(),LP(e,a),r||yb(t),i&&await t}},Zx=({error:t})=>{if(t)throw t},Nne=(t,{ipc:e})=>{Object.assign(t,eI(t,!1,e))},One=()=>{const t=st,e=!0,n=st.channel!==void 0;return{...eI(t,e,n),getCancelSignal:LQ.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}},eI=(t,e,n)=>({sendMessage:zP.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getOneMessage:Tne.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getEachMessage:_ne.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}),Fne=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,verboseInfo:o})=>{Ix(r);const a=new SD;Lne(a,r),Object.assign(a,{readable:Mne,writable:Bne,duplex:zne});const u=xb({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:!1}),c=qne(u,o,i);return{subprocess:a,promise:c}},Lne=(t,e)=>{const n=_d(),r=_d(),i=_d(),s=Array.from({length:e.length-3},_d),o=_d(),a=[n,r,i,...s];Object.assign(t,{stdin:n,stdout:r,stderr:i,all:o,stdio:a})},_d=()=>{const t=new PD;return t.end(),t},Mne=()=>new ls({read(){}}),Bne=()=>new zm({write(){}}),zne=()=>new qm({read(){},write(){}}),qne=async(t,e,n)=>Nb(t,e,n),jne=(t,e)=>xx(Gne,t,e,!1),Pd=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${bm[t]}.`)},tI={fileNumber:Pd,generator:Wx,asyncGenerator:Wx,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:n}}){const r=e||n;return{stream:qm.fromWeb(t,{objectMode:r})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Gne={input:{...tI,fileUrl:({value:t})=>({stream:fD(t)}),filePath:({value:{file:t}})=>({stream:fD(t)}),webStream:({value:t})=>({stream:ls.fromWeb(t)}),iterable:({value:t})=>({stream:ls.from(t)}),asyncIterable:({value:t})=>({stream:ls.from(t)}),string:({value:t})=>({stream:ls.from(t)}),uint8Array:({value:t})=>({stream:ls.from(jm.from(t))})},output:{...tI,fileUrl:({value:t})=>({stream:pD(t)}),filePath:({value:{file:t}})=>({stream:pD(t)}),webStream:({value:t})=>({stream:zm.fromWeb(t)}),iterable:Pd,asyncIterable:Pd,string:Pd,uint8Array:Pd}};function Gb(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(const i of t)Ub(i);const e=t.some(({readableObjectMode:i})=>i),n=Une(t,e),r=new Wne({objectMode:e,writableHighWaterMark:n,readableHighWaterMark:n});for(const i of t)r.add(i);return r}const Une=(t,e)=>{if(t.length===0)return jd(e);const n=t.filter(({readableObjectMode:r})=>r===e).map(({readableHighWaterMark:r})=>r);return Math.max(...n)};class Wne extends PD{#e=new Set([]);#t=new Set([]);#n=new Set([]);#r;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(Ub(e),this.#e.has(e))return;this.#e.add(e),this.#r??=Hne(this,this.#e,this.#s);const n=Yne({passThroughStream:this,stream:e,streams:this.#e,ended:this.#t,aborted:this.#n,onFinished:this.#r,unpipeEvent:this.#s});this.#i.set(e,n),e.pipe(this,{end:!1})}async remove(e){if(Ub(e),!this.#e.has(e))return!1;const n=this.#i.get(e);return n===void 0?!1:(this.#i.delete(e),e.unpipe(this),await n,!0)}}const Hne=async(t,e,n)=>{Em(t,tre);const r=new AbortController;try{await Promise.race([Vne(t,r),Kne(t,e,n,r)])}finally{r.abort(),Em(t,-2)}},Vne=async(t,{signal:e})=>{try{await Di(t,{signal:e,cleanup:!0})}catch(n){throw nI(t,n),n}},Kne=async(t,e,n,{signal:r})=>{for await(const[i]of qd(t,"unpipe",{signal:r}))e.has(i)&&i.emit(n)},Ub=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Yne=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,onFinished:s,unpipeEvent:o})=>{Em(t,nre);const a=new AbortController;try{await Promise.race([Xne(s,e,a),Jne({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:a}),Qne({stream:e,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),Em(t,-1)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?Wb(t):Zne(t))},Xne=async(t,e,{signal:n})=>{try{await t,n.aborted||Wb(e)}catch(r){n.aborted||nI(e,r)}},Jne=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:{signal:s}})=>{try{await Di(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),n.has(e)&&r.add(e)}catch(o){if(s.aborted||!n.has(e))return;rI(o)?i.add(e):iI(t,o)}},Qne=async({stream:t,streams:e,ended:n,aborted:r,unpipeEvent:i,controller:{signal:s}})=>{if(await $n(t,i,{signal:s}),!t.readable)return $n(s,"abort",{signal:s});e.delete(t),n.delete(t),r.delete(t)},Zne=t=>{t.writable&&t.end()},nI=(t,e)=>{rI(e)?Wb(t):iI(t,e)},rI=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Wb=t=>{(t.readable||t.writable)&&t.destroy()},iI=(t,e)=>{t.destroyed||(t.once("error",ere),t.destroy(e))},ere=()=>{},Em=(t,e)=>{const n=t.getMaxListeners();n!==0&&n!==Number.POSITIVE_INFINITY&&t.setMaxListeners(n+e)},tre=2,nre=1,Rm=(t,e)=>{t.pipe(e),rre(t,e),ire(t,e)},rre=async(t,e)=>{if(!(eo(t)||eo(e))){try{await Di(t,{cleanup:!0,readable:!0,writable:!1})}catch{}sI(e)}},sI=t=>{t.writable&&t.end()},ire=async(t,e)=>{if(!(eo(t)||eo(e))){try{await Di(e,{cleanup:!0,readable:!1,writable:!0})}catch{}oI(t)}},oI=t=>{t.readable&&t.destroy()},sre=(t,e,n)=>{const r=new Map;for(const[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(const{stream:a}of s.filter(({type:u})=>oo.has(u)))ore(t,a,o,i);for(const{stream:a}of s.filter(({type:u})=>!oo.has(u)))ure({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(const[i,s]of r.entries()){const o=s.length===1?s[0]:Gb(s);Rm(o,i)}},ore=(t,e,n,r)=>{n==="output"?Rm(t.stdio[r],e):Rm(e,t.stdio[r]);const i=are[r];i!==void 0&&(t[i]=e),t.stdio[r]=e},are=["stdin","stdout","stderr"],ure=({subprocess:t,stream:e,direction:n,fdNumber:r,pipeGroups:i,controller:s})=>{if(e===void 0)return;cre(e,s);const[o,a]=n==="output"?[e,t.stdio[r]]:[t.stdio[r],e],u=i.get(o)??[];i.set(o,[...u,a])},cre=(t,{signal:e})=>{eo(t)&&lm(t,lre,e)},lre=2,ya=[];ya.push("SIGHUP","SIGINT","SIGTERM"),process.platform!=="win32"&&ya.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&ya.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const $m=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",Hb=Symbol.for("signal-exit emitter"),Vb=globalThis,dre=Object.defineProperty.bind(Object);class fre{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Vb[Hb])return Vb[Hb];dre(Vb,Hb,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){const r=this.listeners[e],i=r.indexOf(n);i!==-1&&(i===0&&r.length===1?r.length=0:r.splice(i,1))}emit(e,n,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(const s of this.listeners[e])i=s(n,r)===!0||i;return e==="exit"&&(i=this.emit("afterExit",n,r)||i),i}}class aI{}const pre=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}});class hre extends aI{onExit(){return()=>{}}load(){}unload(){}}class mre extends aI{#e=Kb.platform==="win32"?"SIGINT":"SIGHUP";#t=new fre;#n;#r;#s;#i={};#o=!1;constructor(e){super(),this.#n=e,this.#i={};for(const n of ya)this.#i[n]=()=>{const r=this.#n.listeners(n);let{count:i}=this.#t;const s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),r.length===i){this.unload();const o=this.#t.emit("exit",null,n),a=n==="SIGHUP"?this.#e:n;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#r=e.emit}onExit(e,n){if(!$m(this.#n))return()=>{};this.#o===!1&&this.load();const r=n?.alwaysLast?"afterExit":"exit";return this.#t.on(r,e),()=>{this.#t.removeListener(r,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(const e of ya)try{const n=this.#i[e];n&&this.#n.on(e,n)}catch{}this.#n.emit=(e,...n)=>this.#u(e,...n),this.#n.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,ya.forEach(e=>{const n=this.#i[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#n.removeListener(e,n)}catch{}}),this.#n.emit=this.#r,this.#n.reallyExit=this.#s,this.#t.count-=1)}#a(e){return $m(this.#n)?(this.#n.exitCode=e||0,this.#t.emit("exit",this.#n.exitCode,null),this.#s.call(this.#n,this.#n.exitCode)):0}#u(e,...n){const r=this.#r;if(e==="exit"&&$m(this.#n)){typeof n[0]=="number"&&(this.#n.exitCode=n[0]);const i=r.call(this.#n,e,...n);return this.#t.emit("exit",this.#n.exitCode,null),i}else return r.call(this.#n,e,...n)}}const Kb=globalThis.process,{onExit:gre,load:Qae,unload:Zae}=pre($m(Kb)?new mre(Kb):new hre),yre=(t,{cleanup:e,detached:n},{signal:r})=>{if(!e||n)return;const i=gre(()=>{t.kill()});_D(r,()=>{i()})},wre=({source:t,sourcePromise:e,boundOptions:n,createNested:r},...i)=>{const s=rP(),{destination:o,destinationStream:a,destinationError:u,from:c,unpipeSignal:l}=vre(n,r,i),{sourceStream:d,sourceError:f}=Dre(t,c),{options:p,fileDescriptors:h}=no.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:u,unpipeSignal:l,fileDescriptors:h,startTime:s}},vre=(t,e,n)=>{try{const{destination:r,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=bre(t,e,...n),a=xP(r,s);return{destination:r,destinationStream:a,from:i,unpipeSignal:o}}catch(r){return{destinationError:r}}},bre=(t,e,n,...r)=>{if(Array.isArray(n))return{destination:e(uI,t)(n,...r),pipeOptions:t};if(typeof n=="string"||n instanceof URL){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');const[i,s,o]=B_(n,...r);return{destination:e(uI)(i,s,o),pipeOptions:o}}if(no.has(n)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:n,pipeOptions:r[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},uI=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),Dre=(t,e)=>{try{return{sourceStream:wb(t,e)}}catch(n){return{sourceError:n}}},Ere=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:s,startTime:o})=>{const a=Rre({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r});if(a!==void 0)throw cI({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},Rre=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r})=>{if(e!==void 0&&r!==void 0)return r;if(r!==void 0)return oI(t),r;if(e!==void 0)return sI(n),e},cI=({error:t,fileDescriptors:e,sourceOptions:n,startTime:r})=>xb({error:t,command:lI,escapedCommand:lI,fileDescriptors:e,options:n,startTime:r,isSync:!1}),lI="source.pipe(destination)",$re=async t=>{const[{status:e,reason:n,value:r=n},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(r)||o.pipedFrom.push(r),i==="rejected")throw o;if(e==="rejected")throw r;return o},Tre=(t,e,n)=>{const r=Tm.has(e)?kre(t,e):Sre(t,e);return lm(t,Are,n.signal),lm(e,_re,n.signal),Cre(e),r},Sre=(t,e)=>{const n=Gb([t]);return Rm(n,e),Tm.set(e,n),n},kre=(t,e)=>{const n=Tm.get(e);return n.add(t),n},Cre=async t=>{try{await Di(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Tm.delete(t)},Tm=new WeakMap,Are=2,_re=1,Pre=(t,e)=>t===void 0?[]:[xre(t,e)],xre=async(t,{sourceStream:e,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:s})=>{await _1(t,e),await n.remove(e);const o=new Error("Pipe canceled by `unpipeSignal` option.");throw cI({error:o,fileDescriptors:r,sourceOptions:i,startTime:s})},Yb=(t,...e)=>{if(un(e[0]))return Yb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});const{destination:n,...r}=wre(t,...e),i=Ire({...r,destination:n});return i.pipe=Yb.bind(void 0,{...t,source:n,sourcePromise:i,boundOptions:{}}),i},Ire=async({sourcePromise:t,sourceStream:e,sourceOptions:n,sourceError:r,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:u,startTime:c})=>{const l=Nre(t,i);Ere({sourceStream:e,sourceError:r,destinationStream:s,destinationError:o,fileDescriptors:u,sourceOptions:n,startTime:c});const d=new AbortController;try{const f=Tre(e,s,d);return await Promise.race([$re(l),...Pre(a,{sourceStream:e,mergedStream:f,sourceOptions:n,fileDescriptors:u,startTime:c})])}finally{d.abort()}},Nre=(t,e)=>Promise.allSettled([t,e]),dI=({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:r,encoding:i,preserveNewlines:s})=>{const o=new AbortController;return Ore(e,o),pI({stream:t,controller:o,binary:n,shouldEncode:!t.readableObjectMode&&r,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},Ore=async(t,e)=>{try{await t}catch{}finally{e.abort()}},fI=({stream:t,onStreamEnd:e,lines:n,encoding:r,stripFinalNewline:i,allMixed:s})=>{const o=new AbortController;Fre(e,o,t);const a=t.readableObjectMode&&!s;return pI({stream:t,controller:o,binary:r==="buffer",shouldEncode:!a,encoding:r,shouldSplit:!a&&n,preserveNewlines:!i})},Fre=async(t,e,n)=>{try{await t}catch{n.destroy()}finally{e.abort()}},pI=({stream:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})=>{const a=qd(t,"data",{signal:e.signal,highWaterMark:mI,highWatermark:mI});return Lre({onStdoutChunk:a,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})},hI=jd(!0),mI=hI,Lre=async function*({onStdoutChunk:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o}){const a=Mre({binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(const[u]of t)yield*Ad(u,a,0)}catch(u){if(!e.signal.aborted)throw u}finally{yield*jb(a)}},Mre=({binary:t,shouldEncode:e,encoding:n,shouldSplit:r,preserveNewlines:i})=>[jx(t,n,!e),Lx(t,i,!r,{})].filter(Boolean),Bre=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:u,verboseInfo:c,streamInfo:l})=>{const d=zre({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:a,verboseInfo:c,streamInfo:l});if(!i){await Promise.all([qre(t),d]);return}const f=Fx(u,n),p=fI({stream:t,onStreamEnd:e,lines:o,encoding:r,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([jre({stream:t,iterable:p,fdNumber:n,encoding:r,maxBuffer:s,lines:o}),d]);return h},zre=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!Kx({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:s,fdNumber:n}))return;const a=fI({stream:t,onStreamEnd:e,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i});await tne(a,t,n,s)},qre=async t=>{await iN(),t.readableFlowing===null&&t.resume()},jre=async({stream:t,stream:{readableObjectMode:e},iterable:n,fdNumber:r,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await DZ(n,{maxBuffer:s}):i==="buffer"?new Uint8Array(await SZ(n,{maxBuffer:s})):await FZ(n,{maxBuffer:s})}catch(a){return yI(jZ({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:r}))}},gI=async t=>{try{return await t}catch(e){return yI(e)}},yI=({bufferedData:t})=>rX(t)?new Uint8Array(t):t,Xb=async(t,e,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{const s=Gre(t,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],Di(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||Hre(a,e,n,r)}finally{o.abort()}},Gre=(t,{originalStreams:[e],subprocess:n})=>{const r={stdinCleanedUp:!1};return t===e&&Ure(t,n,r),r},Ure=(t,e,n)=>{const{_destroy:r}=t;t._destroy=(...i)=>{Wre(e,n),r.call(t,...i)}},Wre=({exitCode:t,signalCode:e},n)=>{(t!==null||e!==null)&&(n.stdinCleanedUp=!0)},Hre=(t,e,n,r)=>{if(!Vre(t,e,n,r))throw t},Vre=(t,e,n,r=!0)=>n.propagating?vI(t)||Jb(t):(n.propagating=!0,wI(n,e)===r?vI(t):Jb(t)),wI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Jb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",vI=t=>t?.code==="EPIPE",Kre=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((u,c)=>bI({stream:u,fdNumber:c,encoding:e,buffer:n[c],maxBuffer:r[c],lines:i[c],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),bI=async({stream:t,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:u,streamInfo:c})=>{if(!t)return;const l=Xb(t,e,c);if(wI(c,e)){await l;return}const[d]=await Promise.all([Bre({stream:t,onStreamEnd:l,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:u,streamInfo:c}),l]);return d},Yre=({stdout:t,stderr:e},{all:n})=>n&&(t||e)?Gb([t,e].filter(Boolean)):void 0,Xre=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>bI({...Jre(t,n),fdNumber:"all",encoding:e,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:Qre(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Jre=({stdout:t,stderr:e,all:n},[,r,i])=>{const s=r||i;return s?r?i?{stream:n,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:n,buffer:s}},Qre=({all:t,stdout:e,stderr:n})=>t&&e&&n&&e.readableObjectMode!==n.readableObjectMode,Zre=t=>Yv(t,"ipc"),eie=(t,e)=>{const n=nP(t);$d({type:"ipc",verboseMessage:n,fdNumber:"ipc",verboseInfo:e})},tie=async({subprocess:t,buffer:e,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:s})=>{if(!r)return i;const o=Zre(s),a=Rd(e,"ipc"),u=Rd(n,"ipc");for await(const c of Qx({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))a&&(UZ(t,i,u),i.push(c)),o&&eie(c,s);return i},nie=async(t,e)=>(await Promise.allSettled([t]),e),rie=async({subprocess:t,options:{encoding:e,buffer:n,maxBuffer:r,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:u,stripFinalNewline:c,ipc:l,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:w,onInternalError:D,controller:g})=>{const v=dne(t,f),E={originalStreams:w,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},k=Kre({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:c,verboseInfo:p,streamInfo:E}),P=Xre({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:c,verboseInfo:p,streamInfo:E}),G=[],W=tie({subprocess:t,buffer:n,maxBuffer:r,ipc:l,ipcOutput:G,verboseInfo:p}),Z=iie(w,t,E),J=sie(h,E);try{return await Promise.race([Promise.all([{},pne(v),Promise.all(k),P,W,ZQ(t,d),...Z,...J]),D,oie(t,g),...WQ(t,s,f,g),...eQ({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:g}),...qQ({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:u,context:f,controller:g})])}catch(fe){return f.terminationReason??="other",Promise.all([{error:fe},v,Promise.all(k.map(N=>gI(N))),gI(P),nie(W,G),Promise.allSettled(Z),Promise.allSettled(J)])}},iie=(t,e,n)=>t.map((r,i)=>r===e.stdio[i]?void 0:Xb(r,i,n)),sie=(t,e)=>t.flatMap(({stdioItems:n},r)=>n.filter(({value:i,stream:s=i})=>io(s,{checkOpen:!1})&&!eo(s)).map(({type:i,value:s,stream:o=s})=>Xb(o,r,e,{isSameDirection:oo.has(i),stopOnExit:i==="native"}))),oie=async(t,{signal:e})=>{const[n]=await $n(t,"error",{signal:e});throw n},aie=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Qb=(t,e,n)=>{const r=t[n];r.has(e)||r.set(e,[]);const i=r.get(e),s=Sd();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Sm=async({resolve:t,promises:e},n)=>{t();const[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...e])]);return!r},DI=async t=>{if(t!==void 0)try{await EI(t)}catch{}},uie=async t=>{if(t!==void 0)try{await RI(t)}catch{}},EI=async t=>{await Di(t,{cleanup:!0,readable:!1,writable:!0})},RI=async t=>{await Di(t,{cleanup:!0,readable:!0,writable:!1})},$I=async(t,e)=>{if(await t,e)throw e},TI=(t,e,n)=>{n&&!Jb(n)?t.destroy(n):e&&t.destroy()},cie=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,binary:i=!0,preserveNewlines:s=!0}={})=>{const o=i||ro.has(n),{subprocessStdout:a,waitReadableDestroy:u}=SI(t,r,e),{readableEncoding:c,readableObjectMode:l,readableHighWaterMark:d}=kI(a,o),{read:f,onStdoutDataDone:p}=CI({subprocessStdout:a,subprocess:t,binary:o,encoding:n,preserveNewlines:s}),h=new ls({read:f,destroy:lo(_I.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:u})),highWaterMark:d,objectMode:l,encoding:c});return AI({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},SI=(t,e,n)=>{const r=wb(t,e),i=Qb(n,r,"readableDestroy");return{subprocessStdout:r,waitReadableDestroy:i}},kI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n},r)=>r?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:hI},CI=({subprocessStdout:t,subprocess:e,binary:n,encoding:r,preserveNewlines:i})=>{const s=Sd(),o=dI({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){lie(this,o,s)},onStdoutDataDone:s}},lie=async(t,e,n)=>{try{const{value:r,done:i}=await e.next();i?n.resolve():t.push(r)}catch{}},AI=async({subprocessStdout:t,onStdoutDataDone:e,readable:n,subprocess:r,subprocessStdin:i})=>{try{await RI(t),await r,await DI(i),await e,n.readable&&n.push(null)}catch(s){await DI(i),PI(n,s)}},_I=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:n},r)=>{await Sm(n,e)&&(PI(t,r),await $I(e,r))},PI=(t,e)=>{TI(t,t.readable,e)},die=({subprocess:t,concurrentStreams:e},{to:n}={})=>{const{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}=xI(t,n,e),o=new zm({...II(r,t,i),destroy:lo(OI.bind(void 0,{subprocessStdin:r,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return NI(r,o),o},xI=(t,e,n)=>{const r=xP(t,e),i=Qb(n,r,"writableFinal"),s=Qb(n,r,"writableDestroy");return{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}},II=(t,e,n)=>({write:fie.bind(void 0,t),final:lo(pie.bind(void 0,t,e,n))}),fie=(t,e,n,r)=>{t.write(e,n)?r():t.once("drain",r)},pie=async(t,e,n)=>{await Sm(n,e)&&(t.writable&&t.end(),await e)},NI=async(t,e,n)=>{try{await EI(t),e.writable&&e.end()}catch(r){await uie(n),FI(e,r)}},OI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await Sm(n,e),await Sm(r,e)&&(FI(t,i),await $I(e,i))},FI=(t,e)=>{TI(t,t.writable,e)},hie=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{const a=s||ro.has(n),{subprocessStdout:u,waitReadableDestroy:c}=SI(t,r,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=xI(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:w}=kI(u,a),{read:D,onStdoutDataDone:g}=CI({subprocessStdout:u,subprocess:t,binary:a,encoding:n,preserveNewlines:o}),v=new qm({read:D,...II(l,t,d),destroy:lo(mie.bind(void 0,{subprocessStdout:u,subprocessStdin:l,subprocess:t,waitReadableDestroy:c,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:w,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:h,writableObjectMode:l.writableObjectMode,encoding:p});return AI({subprocessStdout:u,onStdoutDataDone:g,readable:v,subprocess:t,subprocessStdin:l}),NI(l,v,u),v},mie=async({subprocessStdout:t,subprocessStdin:e,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([_I({subprocessStdout:t,subprocess:n,waitReadableDestroy:r},o),OI({subprocessStdin:e,subprocess:n,waitWritableFinal:i,waitWritableDestroy:s},o)])},LI=(t,e,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{const s=r||ro.has(e),o=wb(t,n),a=dI({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return gie(a,o,t)},gie=async function*(t,e,n){try{yield*t}finally{e.readable&&e.destroy(),await n}},yie=(t,{encoding:e})=>{const n=aie();t.readable=cie.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.writable=die.bind(void 0,{subprocess:t,concurrentStreams:n}),t.duplex=hie.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.iterable=LI.bind(void 0,t,e),t[Symbol.asyncIterator]=LI.bind(void 0,t,e,{})},wie=(t,e)=>{for(const[n,r]of bie){const i=r.value.bind(e);Reflect.defineProperty(t,n,{...r,value:i})}},vie=(async()=>{})().constructor.prototype,bie=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(vie,t)]),Die=(t,e,n,r)=>{const{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:u,verboseInfo:c,options:l,fileDescriptors:d}=Eie(t,e,n),{subprocess:f,promise:p}=$ie({file:i,commandArguments:s,options:l,startTime:u,verboseInfo:c,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=Yb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:r}),wie(f,p),no.set(f,{options:l,fileDescriptors:d}),f},Eie=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=sP(t,e,n),{file:a,commandArguments:u,options:c}=VP(t,e,n),l=Rie(c),d=jne(l,o);return{file:a,commandArguments:u,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},Rie=({timeout:t,signal:e,...n})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...n,timeoutDuration:t}},$ie=({file:t,commandArguments:e,options:n,startTime:r,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let u;try{u=rN(t,e,n)}catch(h){return Fne({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:n,startTime:r,verboseInfo:i})}const c=new AbortController;aN(Number.POSITIVE_INFINITY,c.signal);const l=[...u.stdio];sre(u,a,c),yre(u,n,c);const d={},f=Sd();u.kill=YJ.bind(void 0,{kill:u.kill.bind(u),options:n,onInternalError:f,context:d,controller:c}),u.all=Yre(u,n),yie(u,n),Nne(u,n);const p=Tie({subprocess:u,options:n,startTime:r,verboseInfo:i,fileDescriptors:a,originalStreams:l,command:s,escapedCommand:o,context:d,onInternalError:f,controller:c});return{subprocess:u,promise:p}},Tie=async({subprocess:t,options:e,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:u,onInternalError:c,controller:l})=>{const[d,[f,p],h,w,D]=await rie({subprocess:t,options:e,context:u,verboseInfo:r,fileDescriptors:i,originalStreams:s,onInternalError:c,controller:l});l.abort(),c.resolve();const g=h.map((k,P)=>ga(k,e,P)),v=ga(w,e,"all"),E=Sie({errorInfo:d,exitCode:f,signal:p,stdio:g,all:v,ipcOutput:D,context:u,options:e,command:o,escapedCommand:a,startTime:n});return Nb(E,r,e)},Sie=({errorInfo:t,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,context:o,options:a,command:u,escapedCommand:c,startTime:l})=>"error"in t?Ib({error:t.error,command:u,escapedCommand:c,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof wm,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,options:a,startTime:l,isSync:!1}):fx({command:u,escapedCommand:c,stdio:r,all:i,ipcOutput:s,options:a,startTime:l}),Zb=(t,e)=>{const n=Object.fromEntries(Object.entries(e).map(([r,i])=>[r,kie(r,t[r],i)]));return{...t,...n}},kie=(t,e,n)=>Cie.has(t)&&un(e)&&un(n)?{...e,...n}:n,Cie=new Set(["env",...J_]),ao=(t,e,n,r)=>{const i=(o,a,u)=>ao(o,a,n,u),s=(...o)=>Aie({mapArguments:t,deepOptions:n,boundOptions:e,setBoundExeca:r,createNested:i},...o);return r!==void 0&&r(s,i,e),s},Aie=({mapArguments:t,deepOptions:e={},boundOptions:n={},setBoundExeca:r,createNested:i},s,...o)=>{if(un(s))return i(t,Zb(n,s),r);const{file:a,commandArguments:u,options:c,isSync:l}=_ie({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:n});return l?yne(a,u,c):Die(a,u,c,i)},_ie=({mapArguments:t,firstArgument:e,nextArguments:n,deepOptions:r,boundOptions:i})=>{const s=lX(e)?dX(e,n):[e,...n],[o,a,u]=B_(...s),c=Zb(Zb(r,i),u),{file:l=o,commandArguments:d=a,options:f=c,isSync:p=!1}=t({file:o,commandArguments:a,options:c});return{file:l,commandArguments:d,options:f,isSync:p}},Pie=({file:t,commandArguments:e})=>MI(t,e),xie=({file:t,commandArguments:e})=>({...MI(t,e),isSync:!0}),MI=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);const[n,...r]=Iie(t);return{file:n,commandArguments:r}},Iie=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);const e=t.trim();if(e==="")return[];const n=[];for(const r of e.split(Nie)){const i=n.at(-1);i&&i.endsWith("\\")?n[n.length-1]=`${i.slice(0,-1)} ${r}`:n.push(r)}return n},Nie=/ +/g,Oie=(t,e,n)=>{t.sync=e(Lie,n),t.s=t.sync},Fie=({options:t})=>BI(t),Lie=({options:t})=>({...BI(t),isSync:!0}),BI=t=>({options:{...Mie(t),...t}}),Mie=({input:t,inputFile:e,stdio:n})=>t===void 0&&e===void 0&&n===void 0?{stdin:"inherit"}:{},Bie={preferLocal:!0},eD=ao(()=>({}));ao(()=>({isSync:!0})),ao(Pie),ao(xie),ao(VQ),ao(Fie,{},Bie,Oie),One();const tD=Cv(sN().length||1);class zie{constructor(e="dot"){this.path=e}async unflatten(e){return await tD(async()=>{const n=Bt.withTag("graphviz-binary"),r=await eD("unflatten",["-l 1","-c 3"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});return r instanceof Error&&(r.stdout?n.warn(`Command: '${r.command}' failed: ${r.stderr}
1832
+
1833
+ but returned
1834
+ ${r.stdout}`):n.error(`Command: '${r.command}' failed: ${r.stderr}
1835
+
1836
+ nothing returned, ignoring...`)),r.stdout&&(e=r.stdout.replaceAll(/\t\[/g," [").replaceAll(/\t/g," ")),e})}async layoutJson(e){return await tD(async()=>{const n=Bt.withTag("graphviz-binary"),r=await eD(this.path,["-Tjson","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(r instanceof Error){if(!r.stdout)throw n.error(`Command: '${r.command}' nothing returned and failed: "${r.stderr}"`),n.warn(`FAILED DOT:
1837
+ ${e}`),r;n.warn(`Command: '${r.command}' returned result but also failed "${r.stderr}"`)}return r.stdout})}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){return await tD(async()=>{const n=Bt.withTag("graphviz-binary"),r=await eD(this.path,["-Tsvg","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(r instanceof Error){if(n.warn(`DOT:
1838
+ ${e}`),!r.stdout)throw n.error(`Command: '${r.command}' nothing returned and failed: ${r.stderr}`),r;n.warn(`Command: '${r.command}' returned result but also failed ${r.stderr}`)}return r.stdout})}}const zI="1.20.3",qie=t=>{nD.forEach(e=>{jie(t,e)})},nD=["name","message","stack","cause","errors"],jie=(t,e)=>{const n=rD(t,e);if(n!==void 0){if(Gie(n)){yi(t,e,t[e]);return}Uie(n)&&qI(t,e,n)}},rD=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?void 0:rD(r,e)},Gie=({get:t,set:e})=>t!==void 0&&e===void 0,Uie=({enumerable:t,writable:e})=>t||!e,yi=(t,e,n)=>{qI(t,e,{value:n})},qI=(t,e,n)=>{Object.defineProperty(t,e,{...n,..."get"in n||"set"in n?{}:{writable:!0},enumerable:!1,configurable:!0})},Wie=(t,e)=>{if(Array.isArray(t.errors)){const n=t.errors.filter(Hie).map(e).filter(Boolean);yi(t,"errors",n)}else Vie(t)?yi(t,"errors",[]):t.errors!==void 0&&Kie(t)},Hie=t=>t!==void 0,Vie=t=>"AggregateError"in globalThis&&(t.name==="AggregateError"||t instanceof AggregateError),Kie=t=>{delete t.errors,t.errors!==void 0&&yi(t,"errors",[])},Yie=(t,e)=>{if(!("cause"in t))return;const n=t.cause===void 0?t.cause:e(t.cause);n===void 0?delete t.cause:yi(t,"cause",n)},Xie=t=>Jie(t)||Qie(t),Jie=t=>{try{return t instanceof Error}catch{return!1}},Qie=t=>{try{return Zie.has(Object.prototype.toString.call(t))}catch{return!1}},Zie=new Set(["[object Error]","[object DOMException]","[object DOMError]","[object Exception]"]),ese=t=>!Object.isExtensible(t)||nD.some(e=>tse(t,e)||nse(t,e)),tse=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);return n!==void 0&&!n.configurable},nse=(t,e)=>{try{return t[e],!1}catch{return!0}},iD=t=>{const e=rse(t.message,t.name);yi(t,"stack",e)},rse=(t="",e="Error")=>{const n=ise(e),{stack:r}=new n(t);return typeof r=="string"&&r!==""?r:`${e}: ${t}`},ise=t=>{const e={value:t,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",e);return Object.defineProperty(n.prototype,"name",e),n},sse=t=>{const e={};for(const n of ose(t))try{const r=t[n],{enumerable:i,configurable:s,writable:o=!0}=rD(t,n);Object.defineProperty(e,n,{value:r,enumerable:i,configurable:s,writable:o})}catch{}return e},ose=t=>{const e=ase(t);for(const n of nD)use(t,n)&&e.push(n);return e},ase=t=>{try{return Reflect.ownKeys(t)}catch{return[]}},use=(t,e)=>{try{return e in t&&!Object.hasOwn(t,e)}catch{return!1}},jI=t=>{const{name:e,message:n,stack:r,cause:i,errors:s,...o}=sse(t),a=cse(n,o),u=pse(e,a);return n===a&&hse(u,o),Object.entries({name:e,stack:r,cause:i,errors:s}).forEach(([c,l])=>{mse(u,c,l)}),r===void 0&&iD(u),u},cse=(t,e)=>typeof t=="string"&&t!==""?t:fse(lse(e)),lse=t=>{try{return JSON.stringify(t)}catch{return dse(t)}},dse=t=>{try{return String(t)}catch{return"Invalid error"}},fse=t=>t.length<GI?t:`${t.slice(0,GI)}...`,GI=1e3,pse=(t,e)=>t==="AggregateError"&&"AggregateError"in globalThis?new AggregateError([],e):t in UI?new UI[t](e):new Error(e),UI={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},hse=(t,e)=>{for(const n in e)n in t||(t[n]=e[n])},mse=(t,e,n)=>{n!==void 0&&yi(t,e,n)},gse=t=>{try{const e=new Error(String(t));return iD(e),e}catch(e){return e}},{toString:yse}=Object.prototype,wse=t=>vse(t)?jI(t):Xie(t)?bse(t)?jI(t):t:gse(t),vse=t=>{try{return un(t)}catch{return!1}},bse=t=>Dse(t)||ese(t)||Ese(t),Dse=t=>{try{return yse.call(t)==="[object Object]"}catch{return!0}},Ese=t=>typeof t.constructor!="function"||typeof t.constructor.name!="string"||t.constructor.name===""||t.constructor.prototype!==Object.getPrototypeOf(t),km=(t,{shallow:e=!1}={})=>WI(t,[],e),WI=(t,e,n)=>{if(e.includes(t))return;const r=n?Rse:s=>WI(s,[...e,t],n),i=wse(t);return $se(i,r),i},Rse=t=>t,$se=(t,e)=>{Tse(t),Sse(t),kse(t),Yie(t,e),Wie(t,e),qie(t)},Tse=t=>{if(Cm(t.name))return;const e=Object.getPrototypeOf(t).name,n=Cm(e)?e:t.constructor.name;yi(t,"name",n)},Sse=t=>{Cm(t.message)||yi(t,"message","")},kse=t=>{Cm(t.stack)||iD(t)},Cm=t=>typeof t=="string"&&t!=="",Cse=(t,e,n=t.name)=>{if(Ase(e),typeof n!="string")throw new TypeError(`currentName must be a string: ${n}`);return n},Ase=t=>{if(!_se(t))throw new TypeError(`ErrorClass must be a class: ${t}`);if(!HI(t.prototype))throw new TypeError(`ErrorClass must inherit from Error: ${t}`);if(!Pse(t))throw new TypeError(`ErrorClass must be have a valid constructor: ${t}`)},_se=t=>typeof t=="function"&&typeof t.prototype=="object"&&t.prototype!==null,HI=t=>t!==null&&(t.name==="Error"||HI(Object.getPrototypeOf(t))),Pse=t=>typeof t.prototype.constructor=="function",VI=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0,configurable:!0})},xse=(t,e)=>{Object.getPrototypeOf(t)!==e.prototype&&(Ise(t,e),XI(t,"constructor"),Nse(t,e))},Ise=(t,e)=>{Object.setPrototypeOf(t,e.prototype)},Nse=(t,e)=>{XI(t,"name");const n=KI(e.prototype);t.name!==n&&VI(t,"name",n)},KI=t=>Ose(t)??Fse(t)??KI(Object.getPrototypeOf(t)),Ose=t=>Object.hasOwn(t,"name")&&YI(t.name)?t.name:void 0,Fse=t=>typeof t.constructor=="function"&&YI(t.constructor.name)?t.constructor.name:void 0,YI=t=>typeof t=="string"&&t!=="",XI=(t,e)=>{Object.hasOwn(t,e)&&delete t[e]},Lse=(t,e)=>{if(!Mse(t,e))return;const n=zse(t,e);VI(t,"stack",n)},Mse=(t,e)=>e!==t.name&&e!==""&&t.stack.includes(e)&&Bse(),Bse=()=>{class t extends Error{}const e={value:JI,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(t,"name",e),Object.defineProperty(t.prototype,"name",e);const{stack:n}=new t("");return typeof n=="string"&&n.includes(JI)},JI="SetErrorClassError",zse=({name:t,stack:e},n)=>{if(e.startsWith(`${n}: `))return e.replace(n,t);const r=qse(n,t),[i,s]=r.find(([o])=>e.includes(o));return e.replace(i,s)},qse=(t,e)=>[[`
1839
+ ${t}: `,`
1840
+ ${e}: `],[`${t}: `,`${e}: `],[`${t} `,`${e} `],[t,e]],jse=(t,e,n)=>{const r=km(t),i=Cse(r,e,n);return xse(r,e),Lse(r,i),r},Gse=(t,e)=>e.configurable===!1?Use(t,e):Vse(t,e),Use=(t,e)=>({...e,...Wse(t,e),...Hse(t,e)}),Wse=(t,e)=>e.writable===!0&&t.writable===!1?{writable:!1}:{},Hse=(t,e)=>t.hasValue&&"value"in e&&e.writable===!0?{value:t.value}:{},Vse=(t,e)=>{const n=xd(t.enumerable,e.enumerable,!0),r=xd(t.writable,e.writable,!0),i=xd(t.configurable,e.configurable,!0);return{...Kse(t,e,r),enumerable:n,configurable:i}},Kse=(t,e,n)=>t.hasValue?{value:t.value,writable:n}:!QI(t)&&!QI(e)?{value:e.value,writable:n}:{get:xd(t.get,e.get),set:xd(t.set,e.set)},QI=({get:t,set:e})=>t!==void 0||e!==void 0,xd=(t,e,n)=>t??e??n,Yse=(t,e,n)=>{if(!Xse(t))throw new TypeError(`Argument must be an object: ${t}`);if(!Jse(e))throw new TypeError(`Property key must be a string, a symbol or an integer: ${e}`);return Qse(n)},Xse=t=>typeof t=="object"&&t!==null,Jse=t=>{const e=typeof t;return e==="string"||e==="symbol"||e==="number"},Qse=t=>{if(!un(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 Zse({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}},Zse=({enumerable:t,writable:e,configurable:n,get:r,set:i,unknownProps:s,hasValue:o})=>{ZI(o,r,"get"),ZI(o,i,"set"),sD(t,"enumerable"),sD(e,"writable"),sD(n,"configurable"),toe(s)},ZI=(t,e,n)=>{if(eoe(e,n),t&&e!==void 0)throw new TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${e}`)},eoe=(t,e)=>{if(t!==void 0&&typeof t!="function")throw new TypeError(`Descriptor property "${e}" must be a function: ${t}`)},sD=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`Descriptor property "${e}" must be a boolean: ${t}`)},toe=t=>{const[e]=Object.keys(t);if(e!==void 0)throw new TypeError(`Unknown descriptor property "${e}": ${t[e]}`)},noe=(t,e,n)=>{const r=Yse(t,e,n),i=e1(t,e),s=Gse(r,i);return roe(t,e,s),t},e1=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t,e);if(n!==void 0)return n;const r=Object.getPrototypeOf(t);return r===null?{}:e1(r,e)},roe=(t,e,n)=>{try{Object.defineProperty(t,e,n)}catch{}},ioe=(t,e,n)=>{if(n!==void 0)return t1(t,e,n);try{delete t[e]}catch{}if(t[e]!==void 0)return t1(t,e)},t1=(t,e,n)=>{const r=soe(e);noe(t,e,{value:n,...r})},soe=t=>typeof t=="string"&&t.startsWith("_")?{enumerable:!1}:{},ooe=t=>aoe(t)||uoe(t),aoe=t=>{try{return t instanceof Error}catch{return!1}},uoe=t=>{try{return coe.has(Object.prototype.toString.call(t))}catch{return!1}},coe=new Set(["[object Error]","[object DOMException]","[object DOMError]","[object Exception]"]),loe=(t,e,n={})=>{if(n1(t,"First argument"),n1(e,"Second argument"),!un(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}},n1=(t,e)=>{if(t===void 0)throw new TypeError(`${e} is required.`);if(!doe(t))throw new TypeError(`${e} must be a plain object or an error: ${t}`)},doe=t=>un(t)||ooe(t),foe=({error:t,props:e,propName:n,soft:r})=>poe(n)||!goe.call(e,n)||r&&t[n]!==void 0,poe=t=>t in hoe||moe.has(t),hoe=new Error("check"),moe=new Set(["prototype","errors","cause"]),{propertyIsEnumerable:goe}=Object.prototype,yoe=(t,e,n)=>{const{soft:r}=loe(t,e,n);for(const i of Reflect.ownKeys(e))woe({error:t,props:e,propName:i,soft:r});return t},woe=({error:t,props:e,propName:n,soft:r})=>{foe({error:t,props:e,propName:n,soft:r})||ioe(t,n,e[n])},Am=(t,e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!1,configurable:!0})},voe=(t,e)=>{if(t.errors===void 0)return;const n=t.errors.map(r=>e(r).error).filter(Boolean);Am(t,"errors",n)},boe=({target:t,source:e,parent:n,child:r})=>{if(!r1(t)){Doe(t,e);return}r1(e)&&Am(t,"errors",[...r.errors,...n.errors])},Doe=(t,e)=>{e.errors!==void 0&&Am(t,"errors",e.errors)},r1=t=>t.errors!==void 0&&t.errors.length!==0,Eoe=(t,e,n=t.message)=>{if(typeof e!="string")throw new TypeError(`newMessage must be a string: ${e}`);if(typeof n!="string")throw new TypeError(`currentMessage must be a string: ${n}`);return n},Roe=({name:t,stack:e},n,r)=>r!==""&&e.includes(r)?$oe({name:t,stack:e,newMessage:n,currentMessage:r}):Soe(t,e,n),$oe=({name:t,stack:e,newMessage:n,currentMessage:r})=>{const i=Toe(t,n,r),[s,o]=i.find(([a])=>e.includes(a));return e.replace(s,o)},Toe=(t,e,n)=>[[`${t}: ${n}`,`${t}: ${e}`],[`: ${n}`,`: ${e}`],[`
1841
+ ${n}`,`
1842
+ ${e}`],[` ${n}`,` ${e}`],[n,e]],Soe=(t,e,n)=>{const r=`${t}: `,i=n.trimEnd();return e===t||e.startsWith(`${t}
1843
+ `)?e.replace(t,`${r}${i}`):e.startsWith(r)?e.replace(r,`${r}${i}
1844
+ `):`${r}${i}
1845
+ ${e}`},koe=(t,e,n)=>{const r=km(t),i=Eoe(r,e,n);return s1(r,"message",e),Coe(r,e,i),r},Coe=(t,e,n)=>{if(e===n||!Aoe())return;const r=Roe(t,e,n);s1(t,"stack",r)},Aoe=()=>{const{stack:t}=new Error(i1);return typeof t=="string"&&t.includes(i1)},i1="set-error-message test message",s1=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0,configurable:!0})},_oe=(t,e,n)=>{if(typeof e!="string")throw new TypeError(`Second argument must be a message string: ${e}`);const r=km(t),i=Poe(e,r.message);return koe(r,i,n)},Poe=(t,e)=>{const n=t.trim(),r=e.trim();return n===""?r:r===""?n:xoe(n,r,t)},xoe=(t,e,n)=>t.endsWith(Ioe)?n.endsWith(Noe)?`${t}
1846
+ ${e}`:`${t} ${e}`:`${e}
1847
+ ${t}`,Ioe=":",Noe=`
1848
+ `,Ooe=({parent:t,child:e,target:n,stackError:r})=>{const i=t.message;return n.message=e.message,_oe(n,i,r.message)},Foe=(t,e)=>o1(t)===e,o1=t=>typeof t=="object"&&t!==null?t.stack:void 0,Loe=({wrap:t,target:e,source:n,childHasStack:r})=>t===r?e:(Am(e,"stack",n.stack),n),Moe=t=>{const{wrap:e,name:n}=t;return typeof e!="boolean"?n==="Error":(Object.hasOwn(t,"wrap")&&delete t.wrap,e)},Boe=t=>a1(t,[]).error,a1=(t,e)=>{if(e.includes(t))return{};const n=c=>a1(c,[...e,t]),r=o1(t),i=km(t,{shallow:!0}),s=Foe(i,r);voe(i,n);const{parent:o,childHasStack:a}=zoe(i,n);return{error:o,errorHasStack:s||a}},zoe=(t,e)=>{const n=Moe(t);if(t.cause===void 0)return{parent:t,childHasStack:!1};const{error:r,errorHasStack:i}=e(t.cause);return delete t.cause,{parent:qoe({parent:t,child:r,childHasStack:i,wrap:n}),childHasStack:i}},qoe=({parent:t,child:e,childHasStack:n,wrap:r})=>{if(e===void 0)return t;const[i,s]=r?[e,t]:[t,e],o=Loe({wrap:r,target:i,source:s,childHasStack:n}),a=jse(i,i.constructor,o.name),u=Ooe({parent:t,child:e,target:a,stackError:o});return boe({target:u,source:s,parent:t,child:e}),yoe(u,s,{soft:!r})},_m=Object.create(null),Id=t=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(t?_m:globalThis),Qi=new Proxy(_m,{get(t,e){return Id()[e]??_m[e]},has(t,e){const n=Id();return e in n||e in _m},set(t,e,n){const r=Id(!0);return r[e]=n,!0},deleteProperty(t,e){if(!e)return!1;const n=Id(!0);return delete n[e],!0},ownKeys(){const t=Id(!0);return Object.keys(t)}}),joe=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",Goe=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function Uoe(){if(globalThis.process?.env)for(const t of Goe){const e=t[1]||t[0];if(globalThis.process?.env[e])return{name:t[0].toLowerCase(),...t[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const u1=Uoe();u1.name;function uo(t){return t?t!=="false":!1}const Woe=globalThis.process?.platform||"",Pm=uo(Qi.CI)||u1.ci!==!1,c1=uo(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY);uo(Qi.DEBUG);const Hoe=joe==="test"||uo(Qi.TEST);uo(Qi.MINIMAL);const Voe=/^win/i.test(Woe);!uo(Qi.NO_COLOR)&&(uo(Qi.FORCE_COLOR)||(c1||Voe)&&Qi.TERM);const Koe=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null;Number(Koe?.split(".")[0]);const Yoe=globalThis.process||Object.create(null),l1={versions:{}};new Proxy(Yoe,{get(t,e){if(e==="env")return Qi;if(e in t)return t[e];if(e in l1)return l1[e]}});const Xoe=globalThis.process?.release?.name==="node",Joe=!!globalThis.Bun||!!globalThis.process?.versions?.bun,Qoe=!!globalThis.Deno,Zoe=!!globalThis.fastly,eae=!!globalThis.Netlify,tae=!!globalThis.EdgeRuntime,nae=globalThis.navigator?.userAgent==="Cloudflare-Workers",rae=[[eae,"netlify"],[tae,"edge-light"],[nae,"workerd"],[Zoe,"fastly"],[Qoe,"deno"],[Joe,"bun"],[Xoe,"node"]];function iae(){const t=rae.find(e=>e[0]);if(t)return{name:t[1]}}const sae=iae();sae?.name;const d1=yt.bold(yt.bgRed(yt.white("ERROR"))),f1=yt.bold(yt.yellow("WARN")),oae=yt.bold(yt.green("INFO"));function p1(t){const e=tN("info",{prefix:t,allowClearScreen:!Pm}),n=!Pm;return{...e,info(r,i){e.info(`${oae} ${r}`,{timestamp:n,...i})},warn(r,i){if(r instanceof Error){e.warn(`${f1} ${yt.red(r.name+" "+r.message)}
1849
+ ${Fd(r,{colors:!0})}`,{timestamp:n,...i});return}e.warn(`${f1} ${r}`,{timestamp:n,...i})},error(r,i){if(r instanceof Error){const s=Boe(r);e.error(`${d1} ${yt.red(s.message)}
1850
+ ${Fd(s,{colors:!0})}`,{timestamp:n,error:r,...i});return}e.error(`${d1} ${r}`,{timestamp:n,...i})}}}const oD=()=>{},aae={info:oD,warn:oD,error:oD},uae=1e6;function h1(t){const[e,n]=zd(t),r=e*1e3+n/uae;return{ms:r,pretty:mx(r)}}function cae(t){const e=zd();return{stopAndLog(n="done in "){n=yt.green(`${n}${h1(e).pretty}`),t?t.info(n):Bt.success(n)}}}class lae{constructor(e){this.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(`${yt.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,n=this.services.likec4.ModelBuilder,r=this.services.shared.workspace.LangiumDocuments,i=this.services.shared.workspace.DocumentBuilder,s=r.all.toArray();if(s.length===0)throw e.error("no LikeC4 sources found"),new Error("no LikeC4 sources found");e.info(`${yt.dim("workspace:")} found ${s.length} source files`),await i.build(s,{validation:!0});const o=await n.buildComputedModel(),a=Ou(o?.views??{}).length;if(a===0){e.warn(`${yt.dim("workspace:")} no views found`);return}e.info(`${yt.dim("workspace:")} ${yt.green(`\u2713 computed ${a} views`)}`);const u=await this.services.likec4.Views.diagrams();u.length===a?e.info(`${yt.dim("workspace:")} ${yt.green("\u2713 all views layouted")}`):e.warn(`${yt.dim("workspace:")} ${yt.yellow(`\u2717 layouted ${u.length} views`)}`)}}function dae(t){return e=>new t(e)}const fae={logger:()=>{throw new Error("Logger must be provided")},likec4:{Layouter:()=>{throw new Error("Layouter must be provided")}},cli:{Workspace:dae(lae)}};function m1(t){const e=Wm(t,{useFileSystem:!0,logger:"default",graphviz:"wasm"});let n;switch(e.logger){case!1:n=aae;break;case"vite":n=p1("c4:lsp ");break;case"default":n=Bt.withTag("lsp");break;default:n=e.logger}const r=e.graphviz==="binary";n.info(`${yt.dim("version")} ${zI}`),n.info(`${yt.dim("layout")} ${r?"binary":"wasm"}`);const i={logger:()=>n,likec4:{Layouter:()=>new p_(r===!0?new zie:new wa)}};return B9(e.logger===!1?"silent":"info"),e.logger!==!1&&e.logger!=="default"&&Fe.setReporters([{log:({level:s,...o},a)=>{const u=o.tag||"",c=o.args.map(d=>fG(d)?d.stack??d.message:typeof d=="string"?d:String(d));u&&c.unshift(`[${u}]`);const l=c.join(" ");switch(!0){case s>=vt.debug:break;case s>=vt.info:{n.info(l);break}case s>=vt.log:{n.info(l);break}case s>=vt.warn:{n.warn(l);break}case s>=vt.fatal:{n.error(l);break}}}}]),tX(e.useFileSystem?q9:{},fae,i).likec4}const g1=t=>new Error(`Invalid model:
1851
+ ${t.getErrors().map(e=>` ${e.sourceFsPath}:${e.line} ${e.message.slice(0,200)}`).join(`
1852
+ `)}`);class Zi{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=m1(Wm(n,{useFileSystem:!1,logger:!1,graphviz:"wasm"})),i=Xt.from({scheme:"virtual",path:"/workspace"});await r.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"});const s=kt.joinPath(i,"source.likec4");r.shared.workspace.LangiumDocuments.createDocument(s,e),await r.cli.Workspace.init();const o=new Zi(i.path,r,n?.printErrors??!0);return n?.throwIfInvalid===!0&&o.hasErrors()?(o.dispose(),Promise.reject(g1(o))):o}static likec4Instances=new Map;static async fromWorkspace(e="",n){const r=E1(e);if(!D1(r))throw new Error(`Workspace not found: ${r}`);let i=Zi.likec4Instances.get(r);if(!i){const s=m1(Wm(n,{useFileSystem:!0,logger:"default",graphviz:"wasm"}));await s.cli.Workspace.initWorkspace({uri:$1(r).toString(),name:R1(r)}),await s.cli.Workspace.init(),i=new Zi(r,s,n?.printErrors??!0),Zi.likec4Instances.set(r,i)}return n?.throwIfInvalid===!0&&i.hasErrors()?(i.dispose(),Promise.reject(g1(i))):i}modelComputedRef;modelLayoutedRef;logger;get viewsService(){return this.langium.likec4.Views}get LangiumDocuments(){return this.langium.shared.workspace.LangiumDocuments}async diagrams(){return await this.langium.likec4.Views.diagrams()}computedModel(){let e=this.modelComputedRef?.deref();if(!e){const n=this.langium.likec4.ModelBuilder.unsafeSyncBuildModel();if(!n)throw new Error("Failed to build model");const r=this.langium.likec4.ModelBuilder.unsafeSyncBuildComputedModel(n);e=xD.create(r),this.modelComputedRef=new WeakRef(e)}return e}async layoutedModel(){let e=this.modelLayoutedRef?.deref();if(!e){const n=await this.langium.likec4.ModelBuilder.buildComputedModel();if(!n)throw new Error("Failed to build model");const r=await this.viewsService.diagrams();e=xD.create({...n,__:"layouted",views:Xy(r,Fu("id"))}),this.modelLayoutedRef=new WeakRef(e)}return e}getErrors(){return this.LangiumDocuments.all.toArray().flatMap(e=>(e.diagnostics??[]).filter(n=>n.severity===Au.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===Au.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(`
1853
+ `);return a.length>10&&(a.length=10,a.push("...")),a.map((u,c)=>c===0?" "+yt.dim(`Line ${o}: `)+yt.red(u):" ".repeat(10)+yt.red(u))}).join(`
1854
+ `);this.logger.error(`Invalid ${n.uri.fsPath}
1855
+ ${i}`)}}return e}async notifyUpdate({changed:e,removed:n}){this.modelLayoutedRef=void 0,this.modelComputedRef=void 0;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?[Xt.file(e)]:[],n?[Xt.file(n)]:[],s),i=!s.isCancellationRequested}),i}catch(i){return this.logger.error(i),!1}}onModelUpdate(e){const n=this.langium.likec4.ModelBuilder.onModelParsed(()=>e());return()=>{n.dispose()}}dispose(){for(const[e,n]of Zi.likec4Instances)n===this&&Zi.likec4Instances.delete(e)}}export{Bt as H,Zi as L,eE as N,mo as T,wo as a,Vy as b,Ge as c,ae as d,Cv as e,AS as f,wt as g,Rs as h,$t as i,p1 as j,Nv as k,fr as l,d5 as m,Dt as n,No as o,yt as p,h1 as q,Fv as r,cae as s,kS as t,xS as u,As as v,l5 as w,Qe as x,vt as y,zI as z};