likec4 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1221 @@
1
+ import*as Cb from"node:fs";import{writeFileSync as Ab,statSync as vN,readFileSync as xp,appendFileSync as wN,createReadStream as Ib,createWriteStream as Pb,existsSync as bN}from"node:fs";import Mr,{sep as TN,resolve as EN,basename as RN}from"node:path";import{fileURLToPath as Np,pathToFileURL as SN}from"node:url";import{isatty as $N}from"tty";import kN,{formatWithOptions as _N,debuglog as CN,stripVTControlCharacters as AN,inspect as xb,promisify as IN,callbackify as so,aborted as PN}from"node:util";import{ChildProcess as Nb,spawnSync as xN,spawn as NN}from"node:child_process";import{StringDecoder as Ob}from"node:string_decoder";import Ge,{platform as ON,hrtime as Eu,execPath as DN,execArgv as LN}from"node:process";import Db from"node:tty";import Lb from"child_process";import $a from"path";import Ru from"fs";import{setTimeout as Mb,scheduler as Fb,setImmediate as MN}from"node:timers/promises";import{constants as ws}from"node:os";import{once as nn,addAbortListener as jb,EventEmitter as FN,on as Su,setMaxListeners as jN}from"node:events";import{serialize as UN}from"node:v8";import{Transform as BN,getDefaultHighWaterMark as $u,PassThrough as Ub,Readable as bs,Writable as Op,Duplex as Dp}from"node:stream";import{Buffer as Lp}from"node:buffer";import{finished as Ti}from"node:stream/promises";import"node:worker_threads";import{createLogger as qN}from"vite";import WN from"util";import GN from"os";import Bb from"crypto";import zN from"net";import HN from"url";import{Buffer as Mp}from"buffer";import{Graphviz as Fp}from"@hpcc-js/wasm-graphviz";function at(t,e){if(typeof t>"u"||t==null)throw new Error(e??`Expected defined value, but received ${t}`);return t}function ce(t,e){if(!t)throw new Error(e??"Invariant failed")}function Se(t){throw new Error(`NonExhaustive value: ${t}`)}function VN(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function ku(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return VN(t,e,n);throw new Error("Wrong number of arguments")}function KN(t){return e=>!t(e)}function ka(t){return t==null}function YN(t){return Array.isArray(t)}function XN(...t){return ku(JN,t)}var JN=(t,e)=>e.every(n=>n(t));function QN(...t){return ku(ZN,t)}var ZN=(t,e)=>e.some(n=>n(t));function eO(t,e){return e?e+"."+t:t}const tO=["solid","dashed","dotted","none"],nO=["rectangle","person","browser","mobile","cylinder","storage","queue"],_u="primary",qb="rectangle";function Wb(t){return"element"in t}function Gb(t){return"expanded"in t}function zb(t){return"custom"in t&&(Cu(t.custom.expr)||jp(t.custom.expr))}function Hb(t){return"wildcard"in t}function Vb(t){return"elementKind"in t&&"isEqual"in t}function Kb(t){return"elementTag"in t&&"isEqual"in t}function Cu(t){return Wb(t)||Hb(t)||Vb(t)||Kb(t)||Gb(t)}function jp(t){return"where"in t&&Cu(t.where.expr)}function rO(t){return Cu(t)||jp(t)||zb(t)}function Yb(t){return"source"in t&&"target"in t}function Xb(t){return"inout"in t}function Jb(t){return"incoming"in t}function Qb(t){return"outgoing"in t}function Up(t){return Yb(t)||Xb(t)||Jb(t)||Qb(t)}function Zb(t){return"where"in t&&Up(t.where.expr)}function e0(t){return"customRelation"in t}function iO(t){return Up(t)||Zb(t)||e0(t)}const re={__proto__:null,isCustomElement:zb,isCustomRelationExpr:e0,isElement:Cu,isElementKindExpr:Vb,isElementPredicateExpr:rO,isElementRef:Wb,isElementTagExpr:Kb,isElementWhere:jp,isExpandedElementExpr:Gb,isInOut:Xb,isIncoming:Jb,isOutgoing:Qb,isRelation:Yb,isRelationExpression:Up,isRelationPredicateExpr:iO,isRelationWhere:Zb,isWildcard:Hb},sO=t=>"tag"in t,oO=t=>"kind"in t,aO=t=>"not"in t,Bp=t=>"and"in t,qp=t=>"or"in t;function oo(t){switch(!0){case sO(t):{if("eq"in t.tag){const n=t.tag.eq;return r=>Array.isArray(r.tags)&&r.tags.includes(n)}const e=t.tag.neq;return n=>!Array.isArray(n.tags)||!n.tags.includes(e)}case oO(t):{if("eq"in t.kind){const n=t.kind.eq;return r=>r.kind===n}const e=t.kind.neq;return n=>ka(n.kind)||n.kind!==e}case aO(t):{const e=oo(t.not);return KN(e)}case Bp(t):{const e=t.and.map(oo);return XN(e)}case qp(t):{const e=t.or.map(oo);return QN(e)}default:Se(t)}}const t0="dashed",ao="normal",co="gray",cO=["amber","blue","gray","slate","green","indigo","muted","primary","red","secondary","sky"];function n0(t){return t in cO}function lO(t){return"include"in t&&Array.isArray(t.include)||"exclude"in t&&Array.isArray(t.exclude)}function uO(t){return"style"in t&&"targets"in t}function r0(t){return"autoLayout"in t}function dO(t){return"include"in t&&Array.isArray(t.include)}function fO(t){return"__parallel"in t&&YN(t.__parallel)}function Au(t){return ka(t.__)||t.__==="element"}function i0(t){return Au(t)&&"extends"in t}function s0(t){return Au(t)&&"viewOf"in t}function o0(t,e){const n=`step-${String(t).padStart(2,"0")}`;return e?`${n}.${e}`:n}function a0(t){return t.startsWith("step-")}function c0(t){if(!a0(t))throw new Error(`Invalid step edge id: ${t}`);return parseFloat(t.slice(5))}function Wp(t){return t.__==="dynamic"}function hO(t){return ka(t.__)||t.__==="element"}const Ts=(t,e=0,n=1)=>zp(Hp(e,t),n),Gp=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let e=0;e<=3;e++)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]=Ts(t[e],0,255)):e===3&&(t[e]=Ts(t[e],0,1));return t},l0={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])l0[`[object ${t}]`]=t.toLowerCase();function ye(t){return l0[Object.prototype.toString.call(t)]||"object"}const fe=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):ye(t[0])=="object"&&e?e.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0),lo=t=>{if(t.length<2)return null;const e=t.length-1;return ye(t[e])=="string"?t[e].toLowerCase():null},{PI:Iu,min:zp,max:Hp}=Math,kn=t=>Math.round(t*100)/100,Vp=t=>Math.round(t*100)/100,Fr=Iu*2,Kp=Iu/3,pO=Iu/180,gO=180/Iu,de={format:{},autodetect:[]};let K=class{constructor(...e){const n=this;if(ye(e[0])==="object"&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let r=lo(e),i=!1;if(!r){i=!0,de.sorted||(de.autodetect=de.autodetect.sort((s,o)=>o.p-s.p),de.sorted=!0);for(let s of de.autodetect)if(r=s.test(...e),r)break}if(de.format[r]){const s=de.format[r].apply(null,i?e:e.slice(0,-1));n._rgb=Gp(s)}else throw new Error("unknown format: "+e);n._rgb.length===3&&n._rgb.push(1)}toString(){return ye(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const mO="3.0.0",be=(...t)=>new K(...t);be.version=mO;const uo={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",cyan:"#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",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",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",maroon2:"#7f0000",maroon3:"#b03060",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",purple2:"#7f007f",purple3:"#a020f0",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",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},yO=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,vO=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,u0=t=>{if(t.match(yO)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16),n=e>>16,r=e>>8&255,i=e&255;return[n,r,i,1]}if(t.match(vO)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16),n=e>>24&255,r=e>>16&255,i=e>>8&255,s=Math.round((e&255)/255*100)/100;return[n,r,i,s]}throw new Error(`unknown hex color: ${t}`)},{round:Pu}=Math,d0=(...t)=>{let[e,n,r,i]=fe(t,"rgba"),s=lo(t)||"auto";i===void 0&&(i=1),s==="auto"&&(s=i<1?"rgba":"rgb"),e=Pu(e),n=Pu(n),r=Pu(r);let o="000000"+(e<<16|n<<8|r).toString(16);o=o.substr(o.length-6);let a="0"+Pu(i*255).toString(16);switch(a=a.substr(a.length-2),s.toLowerCase()){case"rgba":return`#${o}${a}`;case"argb":return`#${a}${o}`;default:return`#${o}`}};K.prototype.name=function(){const t=d0(this._rgb,"rgb");for(let e of Object.keys(uo))if(uo[e]===t)return e.toLowerCase();return t},de.format.named=t=>{if(t=t.toLowerCase(),uo[t])return u0(uo[t]);throw new Error("unknown color name: "+t)},de.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&ye(t)==="string"&&uo[t.toLowerCase()])return"named"}}),K.prototype.alpha=function(t,e=!1){return t!==void 0&&ye(t)==="number"?e?(this._rgb[3]=t,this):new K([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},K.prototype.clipped=function(){return this._rgb._clipped||!1};const ur={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},wO=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function jr(t){const e=wO.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);ur.labWhitePoint=t,ur.Xn=e[0],ur.Zn=e[1]}function _a(){return ur.labWhitePoint}const Yp=(...t)=>{t=fe(t,"lab");const[e,n,r]=t,[i,s,o]=bO(e,n,r),[a,c,l]=f0(i,s,o);return[a,c,l,t.length>3?t[3]:1]},bO=(t,e,n)=>{const{kE:r,kK:i,kKE:s,Xn:o,Yn:a,Zn:c}=ur,l=(t+16)/116,u=.002*e+l,d=l-.005*n,f=u*u*u,h=d*d*d,p=f>r?f:(116*u-16)/i,y=t>s?Math.pow((t+16)/116,3):t/i,R=h>r?h:(116*d-16)/i,b=p*o,v=y*a,T=R*c;return[b,v,T]},Xp=t=>{const e=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*e},f0=(t,e,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:i,MtxXYZ2RGB:s,RefWhiteRGB:o,Xn:a,Yn:c,Zn:l}=ur,u=a*r.m00+c*r.m10+l*r.m20,d=a*r.m01+c*r.m11+l*r.m21,f=a*r.m02+c*r.m12+l*r.m22,h=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,p=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,y=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,R=(t*r.m00+e*r.m10+n*r.m20)*(h/u),b=(t*r.m01+e*r.m11+n*r.m21)*(p/d),v=(t*r.m02+e*r.m12+n*r.m22)*(y/f),T=R*i.m00+b*i.m10+v*i.m20,_=R*i.m01+b*i.m11+v*i.m21,N=R*i.m02+b*i.m12+v*i.m22,F=Xp(T*s.m00+_*s.m10+N*s.m20),P=Xp(T*s.m01+_*s.m11+N*s.m21),G=Xp(T*s.m02+_*s.m12+N*s.m22);return[F*255,P*255,G*255]},Jp=(...t)=>{const[e,n,r,...i]=fe(t,"rgb"),[s,o,a]=h0(e,n,r),[c,l,u]=TO(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]};function TO(t,e,n){const{Xn:r,Yn:i,Zn:s,kE:o,kK:a}=ur,c=t/r,l=e/i,u=n/s,d=c>o?Math.pow(c,1/3):(a*c+16)/116,f=l>o?Math.pow(l,1/3):(a*l+16)/116,h=u>o?Math.pow(u,1/3):(a*u+16)/116;return[116*f-16,500*(d-f),200*(f-h)]}function Qp(t){const e=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*e}const h0=(t,e,n)=>{t=Qp(t/255),e=Qp(e/255),n=Qp(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:i,MtxAdaptMaI:s,Xn:o,Yn:a,Zn:c,As:l,Bs:u,Cs:d}=ur;let f=t*r.m00+e*r.m10+n*r.m20,h=t*r.m01+e*r.m11+n*r.m21,p=t*r.m02+e*r.m12+n*r.m22;const y=o*i.m00+a*i.m10+c*i.m20,R=o*i.m01+a*i.m11+c*i.m21,b=o*i.m02+a*i.m12+c*i.m22;let v=f*i.m00+h*i.m10+p*i.m20,T=f*i.m01+h*i.m11+p*i.m21,_=f*i.m02+h*i.m12+p*i.m22;return v*=y/l,T*=R/u,_*=b/d,f=v*s.m00+T*s.m10+_*s.m20,h=v*s.m01+T*s.m11+_*s.m21,p=v*s.m02+T*s.m12+_*s.m22,[f,h,p]};K.prototype.lab=function(){return Jp(this._rgb)};const EO=(...t)=>new K(...t,"lab");Object.assign(be,{lab:EO,getLabWhitePoint:_a,setLabWhitePoint:jr}),de.format.lab=Yp,de.autodetect.push({p:2,test:(...t)=>{if(t=fe(t,"lab"),ye(t)==="array"&&t.length===3)return"lab"}}),K.prototype.darken=function(t=1){const e=this,n=e.lab();return n[0]-=ur.Kn*t,new K(n,"lab").alpha(e.alpha(),!0)},K.prototype.brighten=function(t=1){return this.darken(-t)},K.prototype.darker=K.prototype.darken,K.prototype.brighter=K.prototype.brighten,K.prototype.get=function(t){const[e,n]=t.split("."),r=this[e]();if(n){const i=e.indexOf(n)-(e.substr(0,2)==="ok"?2:0);if(i>-1)return r[i];throw new Error(`unknown channel ${n} in mode ${e}`)}else return r};const{pow:RO}=Math,SO=1e-7,$O=20;K.prototype.luminance=function(t,e="rgb"){if(t!==void 0&&ye(t)==="number"){if(t===0)return new K([0,0,0,this._rgb[3]],"rgb");if(t===1)return new K([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=$O;const i=(o,a)=>{const c=o.interpolate(a,.5,e),l=c.luminance();return Math.abs(t-l)<SO||!r--?c:l>t?i(o,c):i(c,a)},s=(n>t?i(new K([0,0,0]),this):i(this,new K([255,255,255]))).rgb();return new K([...s,this._rgb[3]])}return kO(...this._rgb.slice(0,3))};const kO=(t,e,n)=>(t=Zp(t),e=Zp(e),n=Zp(n),.2126*t+.7152*e+.0722*n),Zp=t=>(t/=255,t<=.03928?t/12.92:RO((t+.055)/1.055,2.4)),Ft={},Ca=(t,e,n=.5,...r)=>{let i=r[0]||"lrgb";if(!Ft[i]&&!r.length&&(i=Object.keys(Ft)[0]),!Ft[i])throw new Error(`interpolation mode ${i} is not defined`);return ye(t)!=="object"&&(t=new K(t)),ye(e)!=="object"&&(e=new K(e)),Ft[i](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))};K.prototype.mix=K.prototype.interpolate=function(t,e=.5,...n){return Ca(this,t,e,...n)},K.prototype.premultiply=function(t=!1){const e=this._rgb,n=e[3];return t?(this._rgb=[e[0]*n,e[1]*n,e[2]*n,n],this):new K([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};const{sin:_O,cos:CO}=Math,p0=(...t)=>{let[e,n,r]=fe(t,"lch");return isNaN(r)&&(r=0),r=r*pO,[e,CO(r)*n,_O(r)*n]},eg=(...t)=>{t=fe(t,"lch");const[e,n,r]=t,[i,s,o]=p0(e,n,r),[a,c,l]=Yp(i,s,o);return[a,c,l,t.length>3?t[3]:1]},AO=(...t)=>{const e=fe(t,"hcl").reverse();return eg(...e)},{sqrt:IO,atan2:PO,round:xO}=Math,g0=(...t)=>{const[e,n,r]=fe(t,"lab"),i=IO(n*n+r*r);let s=(PO(r,n)*gO+360)%360;return xO(i*1e4)===0&&(s=Number.NaN),[e,i,s]},tg=(...t)=>{const[e,n,r,...i]=fe(t,"rgb"),[s,o,a]=Jp(e,n,r),[c,l,u]=g0(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]};K.prototype.lch=function(){return tg(this._rgb)},K.prototype.hcl=function(){return tg(this._rgb).reverse()};const NO=(...t)=>new K(...t,"lch"),OO=(...t)=>new K(...t,"hcl");Object.assign(be,{lch:NO,hcl:OO}),de.format.lch=eg,de.format.hcl=AO,["lch","hcl"].forEach(t=>de.autodetect.push({p:2,test:(...e)=>{if(e=fe(e,t),ye(e)==="array"&&e.length===3)return t}})),K.prototype.saturate=function(t=1){const e=this,n=e.lch();return n[1]+=ur.Kn*t,n[1]<0&&(n[1]=0),new K(n,"lch").alpha(e.alpha(),!0)},K.prototype.desaturate=function(t=1){return this.saturate(-t)},K.prototype.set=function(t,e,n=!1){const[r,i]=t.split("."),s=this[r]();if(i){const o=r.indexOf(i)-(r.substr(0,2)==="ok"?2:0);if(o>-1){if(ye(e)=="string")switch(e.charAt(0)){case"+":s[o]+=+e;break;case"-":s[o]+=+e;break;case"*":s[o]*=+e.substr(1);break;case"/":s[o]/=+e.substr(1);break;default:s[o]=+e}else if(ye(e)==="number")s[o]=e;else throw new Error("unsupported value for Color.set");const a=new K(s,r);return n?(this._rgb=a._rgb,this):a}throw new Error(`unknown channel ${i} in mode ${r}`)}else return s},K.prototype.tint=function(t=.5,...e){return Ca(this,"white",t,...e)},K.prototype.shade=function(t=.5,...e){return Ca(this,"black",t,...e)};const DO=(t,e,n)=>{const r=t._rgb,i=e._rgb;return new K(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"rgb")};Ft.rgb=DO;const{sqrt:ng,pow:fo}=Math,LO=(t,e,n)=>{const[r,i,s]=t._rgb,[o,a,c]=e._rgb;return new K(ng(fo(r,2)*(1-n)+fo(o,2)*n),ng(fo(i,2)*(1-n)+fo(a,2)*n),ng(fo(s,2)*(1-n)+fo(c,2)*n),"rgb")};Ft.lrgb=LO;const MO=(t,e,n)=>{const r=t.lab(),i=e.lab();return new K(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"lab")};Ft.lab=MO;const ho=(t,e,n,r)=>{let i,s;r==="hsl"?(i=t.hsl(),s=e.hsl()):r==="hsv"?(i=t.hsv(),s=e.hsv()):r==="hcg"?(i=t.hcg(),s=e.hcg()):r==="hsi"?(i=t.hsi(),s=e.hsi()):r==="lch"||r==="hcl"?(r="hcl",i=t.hcl(),s=e.hcl()):r==="oklch"&&(i=t.oklch().reverse(),s=e.oklch().reverse());let o,a,c,l,u,d;(r.substr(0,1)==="h"||r==="oklch")&&([o,c,u]=i,[a,l,d]=s);let f,h,p,y;return!isNaN(o)&&!isNaN(a)?(a>o&&a-o>180?y=a-(o+360):a<o&&o-a>180?y=a+360-o:y=a-o,h=o+n*y):isNaN(o)?isNaN(a)?h=Number.NaN:(h=a,(u==1||u==0)&&r!="hsv"&&(f=l)):(h=o,(d==1||d==0)&&r!="hsv"&&(f=c)),f===void 0&&(f=c+n*(l-c)),p=u+n*(d-u),r==="oklch"?new K([p,f,h],r):new K([h,f,p],r)},m0=(t,e,n)=>ho(t,e,n,"lch");Ft.lch=m0,Ft.hcl=m0;const FO=t=>{if(ye(t)=="number"&&t>=0&&t<=16777215){const e=t>>16,n=t>>8&255,r=t&255;return[e,n,r,1]}throw new Error("unknown num color: "+t)},jO=(...t)=>{const[e,n,r]=fe(t,"rgb");return(e<<16)+(n<<8)+r};K.prototype.num=function(){return jO(this._rgb)};const UO=(...t)=>new K(...t,"num");Object.assign(be,{num:UO}),de.format.num=FO,de.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&ye(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return"num"}});const BO=(t,e,n)=>{const r=t.num(),i=e.num();return new K(r+n*(i-r),"num")};Ft.num=BO;const{floor:qO}=Math,WO=(...t)=>{t=fe(t,"hcg");let[e,n,r]=t,i,s,o;r=r*255;const a=n*255;if(n===0)i=s=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const c=qO(e),l=e-c,u=r*(1-n),d=u+a*(1-l),f=u+a*l,h=u+a;switch(c){case 0:[i,s,o]=[h,f,u];break;case 1:[i,s,o]=[d,h,u];break;case 2:[i,s,o]=[u,h,f];break;case 3:[i,s,o]=[u,d,h];break;case 4:[i,s,o]=[f,u,h];break;case 5:[i,s,o]=[h,u,d];break}}return[i,s,o,t.length>3?t[3]:1]},GO=(...t)=>{const[e,n,r]=fe(t,"rgb"),i=zp(e,n,r),s=Hp(e,n,r),o=s-i,a=o*100/255,c=i/(255-o)*100;let l;return o===0?l=Number.NaN:(e===s&&(l=(n-r)/o),n===s&&(l=2+(r-e)/o),r===s&&(l=4+(e-n)/o),l*=60,l<0&&(l+=360)),[l,a,c]};K.prototype.hcg=function(){return GO(this._rgb)};const zO=(...t)=>new K(...t,"hcg");be.hcg=zO,de.format.hcg=WO,de.autodetect.push({p:1,test:(...t)=>{if(t=fe(t,"hcg"),ye(t)==="array"&&t.length===3)return"hcg"}});const HO=(t,e,n)=>ho(t,e,n,"hcg");Ft.hcg=HO;const{cos:po}=Math,VO=(...t)=>{t=fe(t,"hsi");let[e,n,r]=t,i,s,o;return isNaN(e)&&(e=0),isNaN(n)&&(n=0),e>360&&(e-=360),e<0&&(e+=360),e/=360,e<1/3?(o=(1-n)/3,i=(1+n*po(Fr*e)/po(Kp-Fr*e))/3,s=1-(o+i)):e<2/3?(e-=1/3,i=(1-n)/3,s=(1+n*po(Fr*e)/po(Kp-Fr*e))/3,o=1-(i+s)):(e-=2/3,s=(1-n)/3,o=(1+n*po(Fr*e)/po(Kp-Fr*e))/3,i=1-(s+o)),i=Ts(r*i*3),s=Ts(r*s*3),o=Ts(r*o*3),[i*255,s*255,o*255,t.length>3?t[3]:1]},{min:KO,sqrt:YO,acos:XO}=Math,JO=(...t)=>{let[e,n,r]=fe(t,"rgb");e/=255,n/=255,r/=255;let i;const s=KO(e,n,r),o=(e+n+r)/3,a=o>0?1-s/o:0;return a===0?i=NaN:(i=(e-n+(e-r))/2,i/=YO((e-n)*(e-n)+(e-r)*(n-r)),i=XO(i),r>n&&(i=Fr-i),i/=Fr),[i*360,a,o]};K.prototype.hsi=function(){return JO(this._rgb)};const QO=(...t)=>new K(...t,"hsi");be.hsi=QO,de.format.hsi=VO,de.autodetect.push({p:2,test:(...t)=>{if(t=fe(t,"hsi"),ye(t)==="array"&&t.length===3)return"hsi"}});const ZO=(t,e,n)=>ho(t,e,n,"hsi");Ft.hsi=ZO;const rg=(...t)=>{t=fe(t,"hsl");const[e,n,r]=t;let i,s,o;if(n===0)i=s=o=r*255;else{const a=[0,0,0],c=[0,0,0],l=r<.5?r*(1+n):r+n-r*n,u=2*r-l,d=e/360;a[0]=d+1/3,a[1]=d,a[2]=d-1/3;for(let f=0;f<3;f++)a[f]<0&&(a[f]+=1),a[f]>1&&(a[f]-=1),6*a[f]<1?c[f]=u+(l-u)*6*a[f]:2*a[f]<1?c[f]=l:3*a[f]<2?c[f]=u+(l-u)*(2/3-a[f])*6:c[f]=u;[i,s,o]=[c[0]*255,c[1]*255,c[2]*255]}return t.length>3?[i,s,o,t[3]]:[i,s,o,1]},y0=(...t)=>{t=fe(t,"rgba");let[e,n,r]=t;e/=255,n/=255,r/=255;const i=zp(e,n,r),s=Hp(e,n,r),o=(s+i)/2;let a,c;return s===i?(a=0,c=Number.NaN):a=o<.5?(s-i)/(s+i):(s-i)/(2-s-i),e==s?c=(n-r)/(s-i):n==s?c=2+(r-e)/(s-i):r==s&&(c=4+(e-n)/(s-i)),c*=60,c<0&&(c+=360),t.length>3&&t[3]!==void 0?[c,a,o,t[3]]:[c,a,o]};K.prototype.hsl=function(){return y0(this._rgb)};const eD=(...t)=>new K(...t,"hsl");be.hsl=eD,de.format.hsl=rg,de.autodetect.push({p:2,test:(...t)=>{if(t=fe(t,"hsl"),ye(t)==="array"&&t.length===3)return"hsl"}});const tD=(t,e,n)=>ho(t,e,n,"hsl");Ft.hsl=tD;const{floor:nD}=Math,rD=(...t)=>{t=fe(t,"hsv");let[e,n,r]=t,i,s,o;if(r*=255,n===0)i=s=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const a=nD(e),c=e-a,l=r*(1-n),u=r*(1-n*c),d=r*(1-n*(1-c));switch(a){case 0:[i,s,o]=[r,d,l];break;case 1:[i,s,o]=[u,r,l];break;case 2:[i,s,o]=[l,r,d];break;case 3:[i,s,o]=[l,u,r];break;case 4:[i,s,o]=[d,l,r];break;case 5:[i,s,o]=[r,l,u];break}}return[i,s,o,t.length>3?t[3]:1]},{min:iD,max:sD}=Math,oD=(...t)=>{t=fe(t,"rgb");let[e,n,r]=t;const i=iD(e,n,r),s=sD(e,n,r),o=s-i;let a,c,l;return l=s/255,s===0?(a=Number.NaN,c=0):(c=o/s,e===s&&(a=(n-r)/o),n===s&&(a=2+(r-e)/o),r===s&&(a=4+(e-n)/o),a*=60,a<0&&(a+=360)),[a,c,l]};K.prototype.hsv=function(){return oD(this._rgb)};const aD=(...t)=>new K(...t,"hsv");be.hsv=aD,de.format.hsv=rD,de.autodetect.push({p:2,test:(...t)=>{if(t=fe(t,"hsv"),ye(t)==="array"&&t.length===3)return"hsv"}});const cD=(t,e,n)=>ho(t,e,n,"hsv");Ft.hsv=cD;function xu(t,e){let n=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map(o=>[o]));let r=e[0].length,i=e[0].map((o,a)=>e.map(c=>c[a])),s=t.map(o=>i.map(a=>Array.isArray(o)?o.reduce((c,l,u)=>c+l*(a[u]||0),0):a.reduce((c,l)=>c+l*o,0)));return n===1&&(s=s[0]),r===1?s.map(o=>o[0]):s}const ig=(...t)=>{t=fe(t,"lab");const[e,n,r,...i]=t,[s,o,a]=lD([e,n,r]),[c,l,u]=f0(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]};function lD(t){var e=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],n=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],r=xu(n,t);return xu(e,r.map(i=>i**3))}const sg=(...t)=>{const[e,n,r,...i]=fe(t,"rgb"),s=h0(e,n,r);return[...uD(s),...i.length>0&&i[0]<1?[i[0]]:[]]};function uD(t){const e=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],n=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],r=xu(e,t);return xu(n,r.map(i=>Math.cbrt(i)))}K.prototype.oklab=function(){return sg(this._rgb)};const dD=(...t)=>new K(...t,"oklab");Object.assign(be,{oklab:dD}),de.format.oklab=ig,de.autodetect.push({p:2,test:(...t)=>{if(t=fe(t,"oklab"),ye(t)==="array"&&t.length===3)return"oklab"}});const fD=(t,e,n)=>{const r=t.oklab(),i=e.oklab();return new K(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"oklab")};Ft.oklab=fD;const hD=(t,e,n)=>ho(t,e,n,"oklch");Ft.oklch=hD;const{pow:og,sqrt:ag,PI:cg,cos:v0,sin:w0,atan2:pD}=Math,gD=(t,e="lrgb",n=null)=>{const r=t.length;n||(n=Array.from(new Array(r)).map(()=>1));const i=r/n.reduce(function(d,f){return d+f});if(n.forEach((d,f)=>{n[f]*=i}),t=t.map(d=>new K(d)),e==="lrgb")return mD(t,n);const s=t.shift(),o=s.get(e),a=[];let c=0,l=0;for(let d=0;d<o.length;d++)if(o[d]=(o[d]||0)*n[0],a.push(isNaN(o[d])?0:n[0]),e.charAt(d)==="h"&&!isNaN(o[d])){const f=o[d]/180*cg;c+=v0(f)*n[0],l+=w0(f)*n[0]}let u=s.alpha()*n[0];t.forEach((d,f)=>{const h=d.get(e);u+=d.alpha()*n[f+1];for(let p=0;p<o.length;p++)if(!isNaN(h[p]))if(a[p]+=n[f+1],e.charAt(p)==="h"){const y=h[p]/180*cg;c+=v0(y)*n[f+1],l+=w0(y)*n[f+1]}else o[p]+=h[p]*n[f+1]});for(let d=0;d<o.length;d++)if(e.charAt(d)==="h"){let f=pD(l/a[d],c/a[d])/cg*180;for(;f<0;)f+=360;for(;f>=360;)f-=360;o[d]=f}else o[d]=o[d]/a[d];return u/=r,new K(o,e).alpha(u>.99999?1:u,!0)},mD=(t,e)=>{const n=t.length,r=[0,0,0,0];for(let i=0;i<t.length;i++){const s=t[i],o=e[i]/n,a=s._rgb;r[0]+=og(a[0],2)*o,r[1]+=og(a[1],2)*o,r[2]+=og(a[2],2)*o,r[3]+=a[3]*o}return r[0]=ag(r[0]),r[1]=ag(r[1]),r[2]=ag(r[2]),r[3]>.9999999&&(r[3]=1),new K(Gp(r))},{pow:yD}=Math;function Nu(t){let e="rgb",n=be("#ccc"),r=0,i=[0,1],s=[],o=[0,0],a=!1,c=[],l=!1,u=0,d=1,f=!1,h={},p=!0,y=1;const R=function(P){if(P=P||["#fff","#000"],P&&ye(P)==="string"&&be.brewer&&be.brewer[P.toLowerCase()]&&(P=be.brewer[P.toLowerCase()]),ye(P)==="array"){P.length===1&&(P=[P[0],P[0]]),P=P.slice(0);for(let G=0;G<P.length;G++)P[G]=be(P[G]);s.length=0;for(let G=0;G<P.length;G++)s.push(G/(P.length-1))}return N(),c=P},b=function(P){if(a!=null){const G=a.length-1;let B=0;for(;B<G&&P>=a[B];)B++;return B-1}return 0};let v=P=>P,T=P=>P;const _=function(P,G){let B,W;if(G==null&&(G=!1),isNaN(P)||P===null)return n;G?W=P:a&&a.length>2?W=b(P)/(a.length-2):d!==u?W=(P-u)/(d-u):W=1,W=T(W),G||(W=v(W)),y!==1&&(W=yD(W,y)),W=o[0]+W*(1-o[0]-o[1]),W=Ts(W,0,1);const I=Math.floor(W*1e4);if(p&&h[I])B=h[I];else{if(ye(c)==="array")for(let k=0;k<s.length;k++){const S=s[k];if(W<=S){B=c[k];break}if(W>=S&&k===s.length-1){B=c[k];break}if(W>S&&W<s[k+1]){W=(W-S)/(s[k+1]-S),B=be.interpolate(c[k],c[k+1],W,e);break}}else ye(c)==="function"&&(B=c(W));p&&(h[I]=B)}return B};var N=()=>h={};R(t);const F=function(P){const G=be(_(P));return l&&G[l]?G[l]():G};return F.classes=function(P){if(P!=null){if(ye(P)==="array")a=P,i=[P[0],P[P.length-1]];else{const G=be.analyze(i);P===0?a=[G.min,G.max]:a=be.limits(G,"e",P)}return F}return a},F.domain=function(P){if(!arguments.length)return i;u=P[0],d=P[P.length-1],s=[];const G=c.length;if(P.length===G&&u!==d)for(let B of Array.from(P))s.push((B-u)/(d-u));else{for(let B=0;B<G;B++)s.push(B/(G-1));if(P.length>2){const B=P.map((I,k)=>k/(P.length-1)),W=P.map(I=>(I-u)/(d-u));W.every((I,k)=>B[k]===I)||(T=I=>{if(I<=0||I>=1)return I;let k=0;for(;I>=W[k+1];)k++;const S=(I-W[k])/(W[k+1]-W[k]);return B[k]+S*(B[k+1]-B[k])})}}return i=[u,d],F},F.mode=function(P){return arguments.length?(e=P,N(),F):e},F.range=function(P,G){return R(P),F},F.out=function(P){return l=P,F},F.spread=function(P){return arguments.length?(r=P,F):r},F.correctLightness=function(P){return P==null&&(P=!0),f=P,N(),f?v=function(G){const B=_(0,!0).lab()[0],W=_(1,!0).lab()[0],I=B>W;let k=_(G,!0).lab()[0];const S=B+(W-B)*G;let M=k-S,q=0,j=1,z=20;for(;Math.abs(M)>.01&&z-- >0;)(function(){return I&&(M*=-1),M<0?(q=G,G+=(j-G)*.5):(j=G,G+=(q-G)*.5),k=_(G,!0).lab()[0],M=k-S})();return G}:v=G=>G,F},F.padding=function(P){return P!=null?(ye(P)==="number"&&(P=[P,P]),o=P,F):o},F.colors=function(P,G){arguments.length<2&&(G="hex");let B=[];if(arguments.length===0)B=c.slice(0);else if(P===1)B=[F(.5)];else if(P>1){const W=i[0],I=i[1]-W;B=vD(0,P).map(k=>F(W+k/(P-1)*I))}else{t=[];let W=[];if(a&&a.length>2)for(let I=1,k=a.length,S=1<=k;S?I<k:I>k;S?I++:I--)W.push((a[I-1]+a[I])*.5);else W=i;B=W.map(I=>F(I))}return be[G]&&(B=B.map(W=>W[G]())),B},F.cache=function(P){return P!=null?(p=P,F):p},F.gamma=function(P){return P!=null?(y=P,F):y},F.nodata=function(P){return P!=null?(n=be(P),F):n},F}function vD(t,e,n){let r=[],i=t<e,s=e;for(let o=t;i?o<s:o>s;i?o++:o--)r.push(o);return r}const wD=function(t){let e=[1,1];for(let n=1;n<t;n++){let r=[1];for(let i=1;i<=e.length;i++)r[i]=(e[i]||0)+e[i-1];e=r}return e},bD=function(t){let e,n,r,i;if(t=t.map(s=>new K(s)),t.length===2)[n,r]=t.map(s=>s.lab()),e=function(s){const o=[0,1,2].map(a=>n[a]+s*(r[a]-n[a]));return new K(o,"lab")};else if(t.length===3)[n,r,i]=t.map(s=>s.lab()),e=function(s){const o=[0,1,2].map(a=>(1-s)*(1-s)*n[a]+2*(1-s)*s*r[a]+s*s*i[a]);return new K(o,"lab")};else if(t.length===4){let s;[n,r,i,s]=t.map(o=>o.lab()),e=function(o){const a=[0,1,2].map(c=>(1-o)*(1-o)*(1-o)*n[c]+3*(1-o)*(1-o)*o*r[c]+3*(1-o)*o*o*i[c]+o*o*o*s[c]);return new K(a,"lab")}}else if(t.length>=5){let s,o,a;s=t.map(c=>c.lab()),a=t.length-1,o=wD(a),e=function(c){const l=1-c,u=[0,1,2].map(d=>s.reduce((f,h,p)=>f+o[p]*l**(a-p)*c**p*h[d],0));return new K(u,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return e},TD=t=>{const e=bD(t);return e.scale=()=>Nu(e),e},{round:b0}=Math;K.prototype.rgb=function(t=!0){return t===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(b0)},K.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map((e,n)=>n<3?t===!1?e:b0(e):e)};const ED=(...t)=>new K(...t,"rgb");Object.assign(be,{rgb:ED}),de.format.rgb=(...t)=>{const e=fe(t,"rgba");return e[3]===void 0&&(e[3]=1),e},de.autodetect.push({p:3,test:(...t)=>{if(t=fe(t,"rgba"),ye(t)==="array"&&(t.length===3||t.length===4&&ye(t[3])=="number"&&t[3]>=0&&t[3]<=1))return"rgb"}});const zn=(t,e,n)=>{if(!zn[n])throw new Error("unknown blend mode "+n);return zn[n](t,e)},Ei=t=>(e,n)=>{const r=be(n).rgb(),i=be(e).rgb();return be.rgb(t(r,i))},Ri=t=>(e,n)=>{const r=[];return r[0]=t(e[0],n[0]),r[1]=t(e[1],n[1]),r[2]=t(e[2],n[2]),r},RD=t=>t,SD=(t,e)=>t*e/255,$D=(t,e)=>t>e?e:t,kD=(t,e)=>t>e?t:e,_D=(t,e)=>255*(1-(1-t/255)*(1-e/255)),CD=(t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255)),AD=(t,e)=>255*(1-(1-e/255)/(t/255)),ID=(t,e)=>t===255?255:(t=255*(e/255)/(1-t/255),t>255?255:t);zn.normal=Ei(Ri(RD)),zn.multiply=Ei(Ri(SD)),zn.screen=Ei(Ri(_D)),zn.overlay=Ei(Ri(CD)),zn.darken=Ei(Ri($D)),zn.lighten=Ei(Ri(kD)),zn.dodge=Ei(Ri(ID)),zn.burn=Ei(Ri(AD));const{pow:PD,sin:xD,cos:ND}=Math;function OD(t=300,e=-1.5,n=1,r=1,i=[0,1]){let s=0,o;ye(i)==="array"?o=i[1]-i[0]:(o=0,i=[i,i]);const a=function(c){const l=Fr*((t+120)/360+e*c),u=PD(i[0]+o*c,r),d=(s!==0?n[0]+c*s:n)*u*(1-u)/2,f=ND(l),h=xD(l),p=u+d*(-.14861*f+1.78277*h),y=u+d*(-.29227*f-.90649*h),R=u+d*(1.97294*f);return be(Gp([p*255,y*255,R*255,1]))};return a.start=function(c){return c==null?t:(t=c,a)},a.rotations=function(c){return c==null?e:(e=c,a)},a.gamma=function(c){return c==null?r:(r=c,a)},a.hue=function(c){return c==null?n:(n=c,ye(n)==="array"?(s=n[1]-n[0],s===0&&(n=n[1])):s=0,a)},a.lightness=function(c){return c==null?i:(ye(c)==="array"?(i=c,o=c[1]-c[0]):(i=[c,c],o=0),a)},a.scale=()=>be.scale(a),a.hue(n),a}const DD="0123456789abcdef",{floor:LD,random:MD}=Math,FD=()=>{let t="#";for(let e=0;e<6;e++)t+=DD.charAt(LD(MD()*16));return new K(t,"hex")},{log:T0,pow:jD,floor:UD,abs:BD}=Math;function E0(t,e=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return ye(t)==="object"&&(t=Object.values(t)),t.forEach(r=>{e&&ye(r)==="object"&&(r=r[e]),r!=null&&!isNaN(r)&&(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(r,i)=>R0(n,r,i),n}function R0(t,e="equal",n=7){ye(t)=="array"&&(t=E0(t));const{min:r,max:i}=t,s=t.values.sort((a,c)=>a-c);if(n===1)return[r,i];const o=[];if(e.substr(0,1)==="c"&&(o.push(r),o.push(i)),e.substr(0,1)==="e"){o.push(r);for(let a=1;a<n;a++)o.push(r+a/n*(i-r));o.push(i)}else if(e.substr(0,1)==="l"){if(r<=0)throw new Error("Logarithmic scales are only possible for values > 0");const a=Math.LOG10E*T0(r),c=Math.LOG10E*T0(i);o.push(r);for(let l=1;l<n;l++)o.push(jD(10,a+l/n*(c-a)));o.push(i)}else if(e.substr(0,1)==="q"){o.push(r);for(let a=1;a<n;a++){const c=(s.length-1)*a/n,l=UD(c);if(l===c)o.push(s[l]);else{const u=c-l;o.push(s[l]*(1-u)+s[l+1]*u)}}o.push(i)}else if(e.substr(0,1)==="k"){let a;const c=s.length,l=new Array(c),u=new Array(n);let d=!0,f=0,h=null;h=[],h.push(r);for(let R=1;R<n;R++)h.push(r+R/n*(i-r));for(h.push(i);d;){for(let b=0;b<n;b++)u[b]=0;for(let b=0;b<c;b++){const v=s[b];let T=Number.MAX_VALUE,_;for(let N=0;N<n;N++){const F=BD(h[N]-v);F<T&&(T=F,_=N),u[_]++,l[b]=_}}const R=new Array(n);for(let b=0;b<n;b++)R[b]=null;for(let b=0;b<c;b++)a=l[b],R[a]===null?R[a]=s[b]:R[a]+=s[b];for(let b=0;b<n;b++)R[b]*=1/u[b];d=!1;for(let b=0;b<n;b++)if(R[b]!==h[b]){d=!0;break}h=R,f++,f>200&&(d=!1)}const p={};for(let R=0;R<n;R++)p[R]=[];for(let R=0;R<c;R++)a=l[R],p[a].push(s[R]);let y=[];for(let R=0;R<n;R++)y.push(p[R][0]),y.push(p[R][p[R].length-1]);y=y.sort((R,b)=>R-b),o.push(y[0]);for(let R=1;R<y.length;R+=2){const b=y[R];!isNaN(b)&&o.indexOf(b)===-1&&o.push(b)}}return o}const qD=(t,e)=>{t=new K(t),e=new K(e);const n=t.luminance(),r=e.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)},{sqrt:Ur,pow:wt,min:WD,max:GD,atan2:S0,abs:$0,cos:Ou,sin:k0,exp:zD,PI:_0}=Math;function HD(t,e,n=1,r=1,i=1){var s=function(xt){return 360*xt/(2*_0)},o=function(xt){return 2*_0*xt/360};t=new K(t),e=new K(e);const[a,c,l]=Array.from(t.lab()),[u,d,f]=Array.from(e.lab()),h=(a+u)/2,p=Ur(wt(c,2)+wt(l,2)),y=Ur(wt(d,2)+wt(f,2)),R=(p+y)/2,b=.5*(1-Ur(wt(R,7)/(wt(R,7)+wt(25,7)))),v=c*(1+b),T=d*(1+b),_=Ur(wt(v,2)+wt(l,2)),N=Ur(wt(T,2)+wt(f,2)),F=(_+N)/2,P=s(S0(l,v)),G=s(S0(f,T)),B=P>=0?P:P+360,W=G>=0?G:G+360,I=$0(B-W)>180?(B+W+360)/2:(B+W)/2,k=1-.17*Ou(o(I-30))+.24*Ou(o(2*I))+.32*Ou(o(3*I+6))-.2*Ou(o(4*I-63));let S=W-B;S=$0(S)<=180?S:W<=B?S+360:S-360,S=2*Ur(_*N)*k0(o(S)/2);const M=u-a,q=N-_,j=1+.015*wt(h-50,2)/Ur(20+wt(h-50,2)),z=1+.045*F,J=1+.015*F*k,U=30*zD(-wt((I-275)/25,2)),le=-(2*Ur(wt(F,7)/(wt(F,7)+wt(25,7))))*k0(2*o(U)),tt=Ur(wt(M/(n*j),2)+wt(q/(r*z),2)+wt(S/(i*J),2)+le*(q/(r*z))*(S/(i*J)));return GD(0,WD(100,tt))}function VD(t,e,n="lab"){t=new K(t),e=new K(e);const r=t.get(n),i=e.get(n);let s=0;for(let o in r){const a=(r[o]||0)-(i[o]||0);s+=a*a}return Math.sqrt(s)}const KD=(...t)=>{try{return new K(...t),!0}catch{return!1}},YD={cool(){return Nu([be.hsl(180,1,.9),be.hsl(250,.7,.4)])},hot(){return Nu(["#000","#f00","#ff0","#fff"]).mode("rgb")}},Du={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]};for(let t of Object.keys(Du))Du[t.toLowerCase()]=Du[t];const XD=(...t)=>{t=fe(t,"cmyk");const[e,n,r,i]=t,s=t.length>4?t[4]:1;return i===1?[0,0,0,s]:[e>=1?0:255*(1-e)*(1-i),n>=1?0:255*(1-n)*(1-i),r>=1?0:255*(1-r)*(1-i),s]},{max:C0}=Math,JD=(...t)=>{let[e,n,r]=fe(t,"rgb");e=e/255,n=n/255,r=r/255;const i=1-C0(e,C0(n,r)),s=i<1?1/(1-i):0,o=(1-e-i)*s,a=(1-n-i)*s,c=(1-r-i)*s;return[o,a,c,i]};K.prototype.cmyk=function(){return JD(this._rgb)};const QD=(...t)=>new K(...t,"cmyk");Object.assign(be,{cmyk:QD}),de.format.cmyk=XD,de.autodetect.push({p:2,test:(...t)=>{if(t=fe(t,"cmyk"),ye(t)==="array"&&t.length===4)return"cmyk"}});const ZD=(...t)=>{const e=fe(t,"hsla");let n=lo(t)||"lsa";return e[0]=kn(e[0]||0)+"deg",e[1]=kn(e[1]*100)+"%",e[2]=kn(e[2]*100)+"%",n==="hsla"||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),n="hsla"):e.length=3,`${n.substr(0,3)}(${e.join(" ")})`},eL=(...t)=>{const e=fe(t,"lab");let n=lo(t)||"lab";return e[0]=kn(e[0])+"%",e[1]=kn(e[1]),e[2]=kn(e[2]),n==="laba"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lab(${e.join(" ")})`},tL=(...t)=>{const e=fe(t,"lch");let n=lo(t)||"lab";return e[0]=kn(e[0])+"%",e[1]=kn(e[1]),e[2]=kn(e[2])+"deg",n==="lcha"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lch(${e.join(" ")})`},nL=(...t)=>{const e=fe(t,"lab");return e[0]=kn(e[0]*100)+"%",e[1]=Vp(e[1]),e[2]=Vp(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`},A0=(...t)=>{const[e,n,r,...i]=fe(t,"rgb"),[s,o,a]=sg(e,n,r),[c,l,u]=g0(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]},rL=(...t)=>{const e=fe(t,"lab");return e[0]=kn(e[0]*100)+"%",e[1]=Vp(e[1]),e[2]=kn(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklch(${e.join(" ")})`},{round:lg}=Math,iL=(...t)=>{const e=fe(t,"rgba");let n=lo(t)||"rgb";if(n.substr(0,3)==="hsl")return ZD(y0(e),n);if(n.substr(0,3)==="lab"){const r=_a();jr("d50");const i=eL(Jp(e),n);return jr(r),i}if(n.substr(0,3)==="lch"){const r=_a();jr("d50");const i=tL(tg(e),n);return jr(r),i}return n.substr(0,5)==="oklab"?nL(sg(e)):n.substr(0,5)==="oklch"?rL(A0(e)):(e[0]=lg(e[0]),e[1]=lg(e[1]),e[2]=lg(e[2]),(n==="rgba"||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),n="rgba"),`${n.substr(0,3)}(${e.slice(0,n==="rgb"?3:4).join(" ")})`)},I0=(...t)=>{t=fe(t,"lch");const[e,n,r,...i]=t,[s,o,a]=p0(e,n,r),[c,l,u]=ig(s,o,a);return[c,l,u,...i.length>0&&i[0]<1?[i[0]]:[]]},P0=/^rgb\(\s*(-?\d+) \s*(-?\d+)\s* \s*(-?\d+)\s*\)$/,x0=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,N0=/^rgba?\(\s*(-?\d+) \s*(-?\d+)\s* \s*(-?\d+)\s*\/\s*([01]|[01]?\.\d+)\)$/,O0=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,D0=/^rgb\(\s*(-?\d+(?:\.\d+)?)% \s*(-?\d+(?:\.\d+)?)%\s* \s*(-?\d+(?:\.\d+)?)%\s*\)$/,L0=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,M0=/^rgba?\(\s*(-?\d+(?:\.\d+)?)% \s*(-?\d+(?:\.\d+)?)%\s* \s*(-?\d+(?:\.\d+)?)%\s*\/\s*([01]|[01]?\.\d+)\)$/,F0=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,j0=/^hsl\(\s*(-?\d+(?:\.\d+)?)deg \s*(-?\d+(?:\.\d+)?)%\s* \s*(-?\d+(?:\.\d+)?)%\s*\)$/,U0=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,B0=/^hsla?\(\s*(-?\d+(?:\.\d+)?)deg \s*(-?\d+(?:\.\d+)?)%\s* \s*(-?\d+(?:\.\d+)?)%\s*\/\s*([01]|[01]?\.\d+)\)$/,q0=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,W0=/^lab\(\s*(-?\d+(?:\.\d+)?%?) \s*(-?\d+(?:\.\d+)?%?) \s*(-?\d+(?:\.\d+)?%?)\s*(?:\/\s*(\d+(?:\.\d+)?))?\)?$/,G0=/^lch\(\s*(-?\d+(?:\.\d+)?%?) \s*((?:-?\d+(?:\.\d+)?%?)|none) \s*(-?\d+(?:\.\d+)?(?:deg)?|none)\s*(?:\/\s*(\d+(?:\.\d+)?))?\)?$/,z0=/^oklab\(\s*(-?\d+(?:\.\d+)?%?) \s*(-?\d+(?:\.\d+)?%?) \s*(-?\d+(?:\.\d+)?%?)\s*(?:\/\s*(\d+(?:\.\d+)?))?\)?$/,H0=/^oklch\(\s*(-?\d+(?:\.\d+)?%?) \s*(?:(-?\d+(?:\.\d+)?%?)|none) \s*(-?\d+(?:\.\d+)?(?:deg)?|none)\s*(?:\/\s*(\d+(?:\.\d+)?))?\)?$/,{round:Aa}=Math,Lu=t=>t.map((e,n)=>n<=2?Ts(Aa(e),0,255):e),dr=(t,e=0,n=100,r=!1)=>(typeof t=="string"&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,r?t=e+(t+1)*.5*(n-e):t=e+t*(n-e)),+t),Mu=(t,e)=>t==="none"?e:t,ug=t=>{t=t.toLowerCase().trim();let e;if(de.format.named)try{return de.format.named(t)}catch{}if((e=t.match(P0))||(e=t.match(x0))){const n=e.slice(1,4);for(let r=0;r<3;r++)n[r]=+n[r];return n[3]=1,n}if((e=t.match(N0))||(e=t.match(O0))){const n=e.slice(1,5);for(let r=0;r<4;r++)n[r]=+n[r];return n}if((e=t.match(D0))||(e=t.match(L0))){const n=e.slice(1,4);for(let r=0;r<3;r++)n[r]=Aa(n[r]*2.55);return n[3]=1,n}if((e=t.match(M0))||(e=t.match(F0))){const n=e.slice(1,5);for(let r=0;r<3;r++)n[r]=Aa(n[r]*2.55);return n[3]=+n[3],n}if((e=t.match(j0))||(e=t.match(U0))){const n=e.slice(1,4);n[1]*=.01,n[2]*=.01;const r=rg(n);for(let i=0;i<3;i++)r[i]=Aa(r[i]);return r[3]=1,r}if((e=t.match(B0))||(e=t.match(q0))){const n=e.slice(1,4);n[1]*=.01,n[2]*=.01;const r=rg(n);for(let i=0;i<3;i++)r[i]=Aa(r[i]);return r[3]=+e[4],r}if(e=t.match(W0)){const n=e.slice(1,4);n[0]=dr(n[0],0,100),n[1]=dr(n[1],-125,125,!0),n[2]=dr(n[2],-125,125,!0);const r=_a();jr("d50");const i=Lu(Yp(n));return jr(r),i[3]=e[4]!==void 0?+e[4]:1,i}if(e=t.match(G0)){const n=e.slice(1,4);n[0]=dr(n[0],0,100),n[1]=dr(Mu(n[1],0),0,150,!1),n[2]=+Mu(n[2].replace("deg",""),0);const r=_a();jr("d50");const i=Lu(eg(n));return jr(r),i[3]=e[4]!==void 0?+e[4]:1,i}if(e=t.match(z0)){const n=e.slice(1,4);n[0]=dr(n[0],0,1),n[1]=dr(n[1],-.4,.4,!0),n[2]=dr(n[2],-.4,.4,!0);const r=Lu(ig(n));return r[3]=e[4]!==void 0?+e[4]:1,r}if(e=t.match(H0)){const n=e.slice(1,4);n[0]=dr(n[0],0,1),n[1]=dr(Mu(n[1],0),0,.4,!1),n[2]=+Mu(n[2].replace("deg",""),0);const r=Lu(I0(n));return r[3]=e[4]!==void 0?+e[4]:1,r}};ug.test=t=>P0.test(t)||N0.test(t)||D0.test(t)||M0.test(t)||j0.test(t)||B0.test(t)||W0.test(t)||G0.test(t)||z0.test(t)||H0.test(t)||x0.test(t)||O0.test(t)||L0.test(t)||F0.test(t)||U0.test(t)||q0.test(t),K.prototype.css=function(t){return iL(this._rgb,t)};const sL=(...t)=>new K(...t,"css");be.css=sL,de.format.css=ug,de.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&ye(t)==="string"&&ug.test(t))return"css"}}),de.format.gl=(...t)=>{const e=fe(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};const oL=(...t)=>new K(...t,"gl");be.gl=oL,K.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]},K.prototype.hex=function(t){return d0(this._rgb,t)};const aL=(...t)=>new K(...t,"hex");be.hex=aL,de.format.hex=u0,de.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&ye(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:Fu}=Math,V0=t=>{const e=t/100;let n,r,i;return e<66?(n=255,r=e<6?0:-155.25485562709179-.44596950469579133*(r=e-2)+104.49216199393888*Fu(r),i=e<20?0:-254.76935184120902+.8274096064007395*(i=e-10)+115.67994401066147*Fu(i)):(n=351.97690566805693+.114206453784165*(n=e-55)-40.25366309332127*Fu(n),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*Fu(r),i=255),[n,r,i,1]},{round:cL}=Math,lL=(...t)=>{const e=fe(t,"rgb"),n=e[0],r=e[2];let i=1e3,s=4e4;const o=.4;let a;for(;s-i>o;){a=(s+i)*.5;const c=V0(a);c[2]/c[0]>=r/n?s=a:i=a}return cL(a)};K.prototype.temp=K.prototype.kelvin=K.prototype.temperature=function(){return lL(this._rgb)};const dg=(...t)=>new K(...t,"temp");Object.assign(be,{temp:dg,kelvin:dg,temperature:dg}),de.format.temp=de.format.kelvin=de.format.temperature=V0,K.prototype.oklch=function(){return A0(this._rgb)};const uL=(...t)=>new K(...t,"oklch");Object.assign(be,{oklch:uL}),de.format.oklch=I0,de.autodetect.push({p:2,test:(...t)=>{if(t=fe(t,"oklch"),ye(t)==="array"&&t.length===3)return"oklch"}}),Object.assign(be,{analyze:E0,average:gD,bezier:TD,blend:zn,brewer:Du,Color:K,colors:uo,contrast:qD,cubehelix:OD,deltaE:HD,distance:VD,input:de,interpolate:Ca,limits:R0,mix:Ca,random:FD,scale:Nu,scales:YD,valid:KD});const fg=[.96,.907,.805,.697,.605,.547,.518,.445,.395,.34],K0=[.32,.16,.08,.04,0,0,.04,.08,.16,.32];function dL(t){const e=t.get("hsl.l");return fg.reduce((n,r)=>Math.abs(r-e)<Math.abs(n-e)?r:n)}function fL(t){const e=be(t),n=dL(e),r=fg.findIndex(s=>s===n),i=fg.map(s=>e.set("hsl.l",s)).map(s=>be(s)).map((s,o)=>{const a=K0[o]-K0[r];return a>=0?s.saturate(a):s.desaturate(a*-1)});return{baseColorIndex:r,colors:i}}function hL(t){return fL(t).colors.map(e=>e.hex())}const Y0={fill:"#3b82f6",stroke:"#2563eb",hiContrast:"#eff6ff",loContrast:"#bfdbfe"},X0={fill:"#0284c7",stroke:"#0369a1",hiContrast:"#f0f9ff",loContrast:"#B6ECF7"},J0={fill:"#64748b",stroke:"#475569",hiContrast:"#f8fafc",loContrast:"#cbd5e1"},Q0={primary:Y0,blue:Y0,secondary:X0,sky:X0,muted:J0,slate:J0,gray:{fill:"#737373",stroke:"#525252",hiContrast:"#fafafa",loContrast:"#d4d4d4"},red:{fill:"#AC4D39",stroke:"#853A2D",hiContrast:"#FBD3CB",loContrast:"#f5b2a3"},green:{fill:"#428a4f",stroke:"#2d5d39",hiContrast:"#f8fafc",loContrast:"#c2f0c2"},amber:{fill:"#A35829",stroke:"#7E451D",hiContrast:"#FFE0C2",loContrast:"#f9b27c"},indigo:{fill:"#6366f1",stroke:"#4f46e5",hiContrast:"#eef2ff",loContrast:"#c7d2fe"}},pL={lineColor:"#6E6E6E",labelBgColor:"#18191b",labelColor:"#C6C6C6"},Z0={lineColor:"#64748b",labelBgColor:"#0f172a",labelColor:"#cbd5e1"},eT={lineColor:"#3b82f6",labelBgColor:"#172554",labelColor:"#60a5fa"},tT={lineColor:"#0ea5e9",labelBgColor:"#082f49",labelColor:"#38bdf8"},nT={amber:{lineColor:"#b45309",labelBgColor:"#78350f",labelColor:"#FFE0C2"},blue:eT,gray:pL,green:{lineColor:"#15803d",labelBgColor:"#052e16",labelColor:"#22c55e"},indigo:{lineColor:"#6366f1",labelBgColor:"#1e1b4b",labelColor:"#818cf8"},muted:Z0,primary:eT,red:{lineColor:"#AC4D39",labelBgColor:"#b91c1c",labelColor:"#f5b2a3"},secondary:tT,sky:tT,slate:Z0},_n={elements:Q0,relationships:nT,font:"Arial",shadow:"#0a0a0a"};function gL(t){if(t.match(/^#([0-9a-f]{3}){1,2}$/i)){const e=hL(t);return{elements:{fill:e[6],stroke:e[7],hiContrast:e[0],loContrast:e[1]},relationships:{lineColor:e[4],labelColor:e[3],labelBgColor:e[9]}}}else return{elements:_n.elements.primary,relationships:_n.relationships.primary}}function hg(...t){return ku(Object.values,t)}function rT(...t){return ku(mL,t)}var mL=(t,e)=>t.length>=e;function pt(t){return typeof t=="string"}function iT(t){return!!t}function yL(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var sT={exports:{}},oT=function(t,e){var n,r,i=1,s=0,o=0,a=String.alphabet;function c(l,u,d){if(d){for(n=u;d=c(l,n),d<76&&d>65;)++n;return+l.slice(u-1,n)}return d=a&&a.indexOf(l.charAt(u)),d>-1?d+76:(d=l.charCodeAt(u)||0,d<45||d>127?d:d<46?65:d<48?d-1:d<58?d+18:d<65?d-11:d<91?d+11:d<97?d-37:d<123?d+5:d-63)}if((t+="")!=(e+="")){for(;i;)if(r=c(t,s++),i=c(e,o++),r<76&&i<76&&r>66&&i>66&&(r=c(t,s,s),i=c(e,o,s=n),o=n),r!=i)return r<i?-1:1}return 0};try{sT.exports=oT}catch{String.naturalCompare=oT}var vL=sT.exports;const wL=yL(vL);function pg(t,e){return t===e?0:pt(t)?pt(e)?wL(t,e):1:pt(e)?-1:0}function ju(t){return t!=null&&typeof t=="string"}function Es(t){return!!t&&Array.isArray(t)&&t.length>0}function Ia(t){const e=t.lastIndexOf(".");return e>0?t.slice(e+1):t}function fr(...t){const e=ju(t[0])?t[0]:t[0].id;return(ju(t[1])?t[1]:t[1].id).startsWith(e+".")}function Uu(t,e){const n=ju(t)?t:t.id,r=ju(e)?e:e.id;return n===r||r.startsWith(n+".")||n.startsWith(r+".")}function aT(t){const e=t.flatMap(n=>[r=>r.id===n.id,r=>fr(n,r)]);return n=>e.some(r=>r(n))}function bL(t){const e=aT(t);return n=>!e(n)}function Rs(t,e){const n=bt(t),r=bt(e);if(n===r)return n;if(!n||!r)return null;const i=t.split("."),s=e.split(".");let o=null;for(;i.length>1&&s.length>1&&i[0]&&i[0]===s[0];)o=o?`${o}.${i[0]}`:i[0],i.shift(),s.shift();return o}function bt(t){const e=t.lastIndexOf(".");return e>0?t.slice(0,e):null}function cT(t){const e=t+".";return n=>!!n.parent&&(n.parent===t||n.parent.startsWith(e))}function Hn(t){const e=t.split(".");return e.pop(),e.length===0?[]:e.reduce((n,r,i)=>i===0?(n.push(r),n):(n.unshift(`${n[0]}.${r}`),n),[])}function go(t,e){const n=t.split(".").length,r=e.split(".").length;switch(!0){case n>r:return 1;case n<r:return-1;default:return 0}}function gg(t,e){return go(t.id,e.id)}function TL(t){return t.map(e=>({item:e,fqn:e.id.split(".")})).sort((e,n)=>e.fqn.length-n.fqn.length).map(({item:e})=>e)}class ro{constructor(e,n){this.view=e,this.model=n;for(const r of e.nodes){const i=new ro.Element(r,this);this.#t.set(r.id,i),ka(r.parent)&&this.#e.add(i)}this.#n=new Map(e.edges.map(r=>[r.id,new ro.Connection(r,this)]))}#e=new Set;#t=new Map;#n;get id(){return this.view.id}get title(){return this.view.title}get viewOf(){return this.view.__!=="dynamic"&&this.view.viewOf?this.model.element(this.view.viewOf):null}get tags(){return this.view.tags??[]}roots(){return[...this.#e]}elements(){return[...this.#t.values()]}element(e){return at(this.#t.get(e),`LikeC4ViewModel.Element ${e} in view ${this.view.id} not found`)}hasElement(e){return this.#t.has(e)}connections(){return[...this.#n.values()]}connection(e){return at(this.#n.get(e),`Connection ${e} in view ${this.view.id} not found`)}findConnections(e,n,r="direct"){const i=pt(e)?e:e.id,s=pt(n)?n:n.id;return this.connections().filter(o=>o.source.id===i&&o.target.id===s||r==="both"&&o.source.id===s&&o.target.id===i)}parent(e){const n=this.element(pt(e)?e:e.id);return n.node.parent?this.element(n.node.parent):null}children(e){return this.element(pt(e)?e:e.id).node.children.map(n=>this.element(n))}siblings(e){const n=pt(e)?e:e.id,r=this.parent(n);return(r?this.children(r):this.roots()).filter(i=>i.id!==n)}ancestors(e){let n=pt(e)?e:e.id;const r=[];let i;for(;i=this.parent(n);)r.push(i),n=i.id;return r}descendants(e){return this.children(e).flatMap(n=>[n,...this.descendants(n.id)])}incoming(e,n="all"){const r=this.element(pt(e)?e:e.id),i=r.node.inEdges.map(s=>at(this.#n.get(s),`Edge ${s} not found`));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.target.id===r.id:s.target.id!==r.id)}incomers(e,n="all"){return this.incoming(e,n).map(r=>r.source)}outgoing(e,n="all"){const r=this.element(pt(e)?e:e.id),i=r.node.outEdges.map(s=>at(this.#n.get(s),`Edge ${s} not found`));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.source.id===r.id:s.source.id!==r.id)}outgoers(e,n="all"){return this.outgoing(e,n).map(r=>r.target)}}(t=>{class e{constructor(i,s){this.node=i,this.viewmodel=s}get id(){return this.node.id}get title(){return this.node.title}get kind(){return this.node.kind}get isRoot(){return ka(this.node.parent)}get hasNested(){return this.node.children.length>0}get shape(){return this.node.shape}get color(){return this.node.color}get tags(){return this.node.tags??[]}model(){return this.viewmodel.model.element(this.id)}parent(){return this.node.parent?this.viewmodel.element(this.node.parent):null}metadata(i,s){return this.model().metadata(i)??s}hasMetadata(i){return this.model().hasMetadata(i)}ancestors(){return this.viewmodel.ancestors(this)}siblings(){return this.viewmodel.siblings(this)}descendants(){return this.viewmodel.descendants(this)}children(){return this.viewmodel.children(this)}incoming(i="all"){return this.viewmodel.incoming(this,i)}incomers(i="all"){return this.viewmodel.incomers(this,i)}outgoing(i="all"){return this.viewmodel.outgoing(this,i)}outgoers(i="all"){return this.viewmodel.outgoers(this,i)}connectionsTo(i){return this.viewmodel.findConnections(this,i)}}t.Element=e;class n{constructor(i,s){this.edge=i,this.viewmodel=s}get id(){return this.edge.id}get source(){return this.viewmodel.element(this.edge.source)}get target(){return this.viewmodel.element(this.edge.target)}get tags(){return this.edge.tags??[]}relationships(){return this.edge.relations.map(i=>at(this.viewmodel.model.relationship(i)))}}t.Connection=n})(ro||(ro={}));const mg=Set,yg=Map;let Bu=class Ap{constructor(e){this.computed=e;for(const n of hg(e.elements))this.addElement(n);for(const n of hg(e.relations))this.addRelation(n);this.#l=new Map(hg(e.views).map(n=>[n.id,new ro(n,this)]))}#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=new Map;#s=new yg;#o=new yg;#a=new yg;#c=new Map;#l;static from(e){return new Ap(e)}roots(){return[...this.#r]}elements(){return[...this.#e.values()]}element(e){return at(this.#e.get(e),`Element ${e} not found`)}relationships(){return[...this.#i.values()]}relationship(e){return at(this.#i.get(e),`Relation ${e} not found`)}views(){return[...this.#l.values()]}view(e){return at(this.#l.get(e),`View ${e} not found`)}parent(e){const n=pt(e)?e:e.id;return this.#t.get(n)||null}children(e){const n=pt(e)?e:e.id;return this._childrenOf(n)}siblings(e){const n=pt(e)?e:e.id,r=this.#t.get(n);return(r?this._childrenOf(r.id):this.roots()).filter(i=>i.id!==n)}ancestors(e){let n=pt(e)?e:e.id;const r=[];let i;for(;i=this.#t.get(n);)r.push(i),n=i.id;return r}descendants(e){const n=pt(e)?e:e.id;return this._childrenOf(n).flatMap(r=>[r,...this.descendants(r.id)])}incoming(e,n="all"){const r=pt(e)?e:e.id,i=Array.from(this._incomingTo(r));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.target.id===r:s.target.id!==r)}incomers(e,n="all"){return this.incoming(e,n).map(r=>r.source)}outgoing(e,n="all"){const r=pt(e)?e:e.id,i=Array.from(this._outgoingFrom(r));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.source.id===r:s.source.id!==r)}outgoers(e,n="all"){return this.outgoing(e,n).map(r=>r.target)}internal(e){const n=pt(e)?e:e.id;return Array.from(this._internalOf(n))}ascendingSiblings(e){const n=pt(e)?e:e.id;let r=this.#c.get(n);return r||(r=[...this.siblings(n),...this.ancestors(n).flatMap(i=>this.siblings(i.id))],this.#c.set(n,r)),r.slice()}viewsWithElement(e){const n=pt(e)?e:e.id;return[...this.#l.values()].filter(r=>r.hasElement(n))}addElement(e){if(this.#e.has(e.id))throw new Error(`Element ${e.id} already exists`);const n=new Ap.Element(e,this);this.#e.set(n.id,n);const r=bt(n.id);r?(this.#t.set(n.id,this.element(r)),this._childrenOf(r).push(n)):this.#r.add(n)}addRelation(e){if(this.#i.has(e.id))throw new Error(`Relation ${e.id} already exists`);const n=new Ap.Relationship(e,this);this.#i.set(n.id,n),this._incomingTo(e.target).add(n),this._outgoingFrom(e.source).add(n);const r=Rs(e.source,e.target);if(r)for(const i of[r,...Hn(r)])this._internalOf(i).add(n);for(const i of Hn(e.source)){if(i===r)break;this._outgoingFrom(i).add(n)}for(const i of Hn(e.target)){if(i===r)break;this._incomingTo(i).add(n)}}_childrenOf(e){let n=this.#n.get(e);return n||(n=[],this.#n.set(e,n)),n}_incomingTo(e){let n=this.#s.get(e);return n||(n=new mg,this.#s.set(e,n)),n}_outgoingFrom(e){let n=this.#o.get(e);return n||(n=new mg,this.#o.set(e,n)),n}_internalOf(e){let n=this.#a.get(e);return n||(n=new mg,this.#a.set(e,n)),n}};(t=>{class e{constructor(i,s){this.element=i,this.model=s}get id(){return this.element.id}get title(){return this.element.title}get kind(){return this.element.kind}get isRoot(){return bt(this.element.id)===null}get hasNested(){return this.model.children(this).length>0}get shape(){return this.element.shape??qb}get color(){return this.element.color??_u}get tags(){return this.element.tags??[]}parent(){return this.model.parent(this)}metadata(i,s){return this.element.metadata?.[i]??s}hasMetadata(i){return iT(this.element.metadata?.[i])}ancestors(){return this.model.ancestors(this)}siblings(){return this.model.siblings(this)}descendants(){return this.model.descendants(this)}children(){return this.model.children(this)}views(){return this.model.viewsWithElement(this)}incoming(i){return this.model.incoming(this,i)}incomers(i){return this.model.incomers(this,i)}outgoing(i){return this.model.outgoing(this,i)}outgoers(i){return this.model.outgoers(this,i)}internal(){return this.model.internal(this)}}t.Element=e;class n{constructor(i,s){this.relationship=i,this.model=s}get id(){return this.relationship.id}get title(){return this.relationship.title}get kind(){return this.relationship.kind??null}get tags(){return this.relationship.tags??[]}get source(){return this.model.element(this.relationship.source)}get target(){return this.model.element(this.relationship.target)}metadata(i,s){return this.relationship.metadata?.[i]??s}hasMetadata(i){return iT(this.relationship.metadata?.[i])}}t.Relationship=n})(Bu||(Bu={}));const EL="LIKEC4_DELAY";function lT(t=100){return new Promise(e=>{setTimeout(()=>{e(EL)},t)})}const Pa=(t,e)=>{const n=Rs(t.source,t.target),r=Rs(e.source,e.target);if(n&&!r)return 1;if(!n&&r)return-1;const i=n&&r?go(n,r):0;if(i!==0)return i;const s=go(t.source,e.source);return s!==0?s:go(t.target,e.target)};function ct(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function Cn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function RL(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function qu(t){return typeof t=="object"&&t!==null&&ct(t.container)&&Cn(t.reference)&&typeof t.message=="string"}class uT{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return ct(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 Br(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Ss(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function dT(t){return Br(t)&&typeof t.fullText=="string"}class St{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 St(()=>({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 jt})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=SL(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 St(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?jt:{done:!1,value:e(i)}})}filter(e){return new St(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return jt})}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 St(()=>({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(Wu(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return jt})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new St(()=>({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(Wu(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return jt})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new St(()=>{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 St(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?jt:this.nextFn(n.state)))}distinct(e){return new St(()=>({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 jt})}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 SL(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Wu(t){return!!t&&typeof t[Symbol.iterator]=="function"}const mo=new St(()=>{},()=>jt),jt=Object.freeze({done:!0,value:void 0});function Le(...t){if(t.length===1){const e=t[0];if(e instanceof St)return e;if(Wu(e))return new St(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new St(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:jt)}return t.length>1?new St(()=>({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++];Wu(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return jt}):mo}class yo extends St{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 jt})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var vg;(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})(vg||(vg={}));function xa(t){return new yo(t,e=>Br(e)?e.content:[],{includeRoot:!0})}function fT(t){return xa(t).filter(Ss)}function hT(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Gu(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Na(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var hr;(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"})(hr||(hr={}));function pT(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return hr.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return hr.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?hr.Inside:n?hr.OverlapBack:r?hr.OverlapFront:hr.Outside}function wg(t,e){return pT(t,e)>hr.After}const bg=/^[\w\p{L}]$/u;function Si(t,e,n=bg){if(t){if(e>0){const r=e-t.offset,i=t.text.charAt(r);n.test(i)||e--}return Eg(t,e)}}function zu(t,e){if(t){const n=mT(t,!0);if(n&&Tg(n,e))return n;if(dT(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Tg(s,e))return s}}}}function Tg(t,e){return Ss(t)&&e.includes(t.tokenType.name)}function Eg(t,e){if(Ss(t))return t;if(Br(t)){const n=gT(t,e,!1);if(n)return Eg(n,e)}}function Hu(t,e){if(Ss(t))return t;if(Br(t)){const n=gT(t,e,!0);if(n)return Hu(n,e)}}function gT(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 mT(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 yT(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 $L(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 vT(t,e){const n=kL(t,e);return n?n.parent.content.slice(n.a+1,n.b):[]}function kL(t,e){const n=wT(t),r=wT(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 wT(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 _L={__proto__:null,DefaultNameRegexp:bg,get RangeComparison(){return hr},compareRange:pT,findCommentNode:zu,findDeclarationNodeAtOffset:Si,findLeafNodeAtOffset:Eg,findLeafNodeBeforeOffset:Hu,flattenCst:fT,getInteriorNodes:vT,getNextNode:yT,getPreviousNode:mT,getStartlineNode:$L,inRange:wg,isChildNode:hT,isCommentNode:Tg,streamCst:xa,toDocumentSegment:Na,tokenToRange:Gu};class bT extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function Vu(t){throw new Error("Error! The input value was not handled.")}const Ku="AbstractRule",Yu="AbstractType",Rg="Condition",TT="TypeDefinition",Sg="ValueLiteral",Oa="AbstractElement";function $g(t){return $e.isInstance(t,Oa)}const Xu="ArrayLiteral",Da="ArrayType";function CL(t){return $e.isInstance(t,Da)}const La="BooleanLiteral";function AL(t){return $e.isInstance(t,La)}const Ma="Conjunction";function IL(t){return $e.isInstance(t,Ma)}const Fa="Disjunction";function PL(t){return $e.isInstance(t,Fa)}const Ju="Grammar",kg="GrammarImport",ja="InferredType";function ET(t){return $e.isInstance(t,ja)}const Ua="Interface";function RT(t){return $e.isInstance(t,Ua)}const _g="NamedArgument",Ba="Negation";function xL(t){return $e.isInstance(t,Ba)}const Qu="NumberLiteral",Zu="Parameter",qa="ParameterReference";function NL(t){return $e.isInstance(t,qa)}const Wa="ParserRule";function Ut(t){return $e.isInstance(t,Wa)}const Ga="ReferenceType";function OL(t){return $e.isInstance(t,Ga)}const ed="ReturnType";function DL(t){return $e.isInstance(t,ed)}const za="SimpleType";function ST(t){return $e.isInstance(t,za)}const td="StringLiteral",vo="TerminalRule";function qr(t){return $e.isInstance(t,vo)}const Ha="Type";function Cg(t){return $e.isInstance(t,Ha)}const Ag="TypeAttribute",Va="UnionType";function LL(t){return $e.isInstance(t,Va)}const Ka="Action";function $s(t){return $e.isInstance(t,Ka)}const Ya="Alternatives";function Ig(t){return $e.isInstance(t,Ya)}const Xa="Assignment";function pr(t){return $e.isInstance(t,Xa)}const Ja="CharacterRange";function ML(t){return $e.isInstance(t,Ja)}const Qa="CrossReference";function Za(t){return $e.isInstance(t,Qa)}const ec="EndOfFile";function FL(t){return $e.isInstance(t,ec)}const tc="Group";function $i(t){return $e.isInstance(t,tc)}const nc="Keyword";function gr(t){return $e.isInstance(t,nc)}const rc="NegatedToken";function jL(t){return $e.isInstance(t,rc)}const ic="RegexToken";function UL(t){return $e.isInstance(t,ic)}const sc="RuleCall";function Wr(t){return $e.isInstance(t,sc)}const oc="TerminalAlternatives";function BL(t){return $e.isInstance(t,oc)}const ac="TerminalGroup";function qL(t){return $e.isInstance(t,ac)}const cc="TerminalRuleCall";function $T(t){return $e.isInstance(t,cc)}const lc="UnorderedGroup";function Pg(t){return $e.isInstance(t,lc)}const uc="UntilToken";function WL(t){return $e.isInstance(t,uc)}const dc="Wildcard";function GL(t){return $e.isInstance(t,dc)}class kT extends uT{getAllTypes(){return[Oa,Ku,Yu,Ka,Ya,Xu,Da,Xa,La,Ja,Rg,Ma,Qa,Fa,ec,Ju,kg,tc,ja,Ua,nc,_g,rc,Ba,Qu,Zu,qa,Wa,Ga,ic,ed,sc,za,td,oc,ac,vo,cc,Ha,Ag,TT,Va,lc,uc,Sg,dc]}computeIsSubtype(e,n){switch(e){case Ka:case Ya:case Xa:case Ja:case Qa:case ec:case tc:case nc:case rc:case ic:case sc:case oc:case ac:case cc:case lc:case uc:case dc:return this.isSubtype(Oa,n);case Xu:case Qu:case td:return this.isSubtype(Sg,n);case Da:case Ga:case za:case Va:return this.isSubtype(TT,n);case La:return this.isSubtype(Rg,n)||this.isSubtype(Sg,n);case Ma:case Fa:case Ba:case qa:return this.isSubtype(Rg,n);case ja:case Ua:case Ha:return this.isSubtype(Yu,n);case Wa:return this.isSubtype(Ku,n)||this.isSubtype(Yu,n);case vo:return this.isSubtype(Ku,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 Yu;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Ku;case"Grammar:usedGrammars":return Ju;case"NamedArgument:parameter":case"ParameterReference:parameter":return Zu;case"TerminalRuleCall:rule":return vo;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Oa:return{name:Oa,properties:[{name:"cardinality"},{name:"lookahead"}]};case Xu:return{name:Xu,properties:[{name:"elements",defaultValue:[]}]};case Da:return{name:Da,properties:[{name:"elementType"}]};case La:return{name:La,properties:[{name:"true",defaultValue:!1}]};case Ma:return{name:Ma,properties:[{name:"left"},{name:"right"}]};case Fa:return{name:Fa,properties:[{name:"left"},{name:"right"}]};case Ju:return{name:Ju,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 kg:return{name:kg,properties:[{name:"path"}]};case ja:return{name:ja,properties:[{name:"name"}]};case Ua:return{name:Ua,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case _g:return{name:_g,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Ba:return{name:Ba,properties:[{name:"value"}]};case Qu:return{name:Qu,properties:[{name:"value"}]};case Zu:return{name:Zu,properties:[{name:"name"}]};case qa:return{name:qa,properties:[{name:"parameter"}]};case Wa:return{name:Wa,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 Ga:return{name:Ga,properties:[{name:"referenceType"}]};case ed:return{name:ed,properties:[{name:"name"}]};case za:return{name:za,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case td:return{name:td,properties:[{name:"value"}]};case vo:return{name:vo,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Ha:return{name:Ha,properties:[{name:"name"},{name:"type"}]};case Ag:return{name:Ag,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Va:return{name:Va,properties:[{name:"types",defaultValue:[]}]};case Ka:return{name:Ka,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Ya:return{name:Ya,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Xa:return{name:Xa,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case Ja:return{name:Ja,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Qa:return{name:Qa,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case ec:return{name:ec,properties:[{name:"cardinality"},{name:"lookahead"}]};case tc:return{name:tc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case nc:return{name:nc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case rc:return{name:rc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case ic:return{name:ic,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case sc:return{name:sc,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case oc:return{name:oc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case ac:return{name:ac,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case cc:return{name:cc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case lc:return{name:lc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case uc:return{name:uc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case dc:return{name:dc,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const $e=new kT;function xg(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{ct(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):ct(n)&&(n.$container=t,n.$containerProperty=e))}function rn(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Ng(t,e){let n=t;for(;n;){if(e(n))return!0;n=n.$container}return!1}function At(t){const n=_T(t).$document;if(!n)throw new Error("AST node has no document.");return n}function _T(t){for(;t.$container;)t=t.$container;return t}function fc(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new St(()=>({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(ct(s)){if(r.keyIndex++,Og(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(ct(a)&&Og(a,n))return{done:!1,value:a}}r.arrayIndex=0}}r.keyIndex++}return jt})}function mr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new yo(t,n=>fc(n,e))}function Gr(t,e){if(t){if(e?.range&&!Og(t,e.range))return new yo(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new yo(t,n=>fc(n,e),{includeRoot:!0})}function Og(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?wg(r,e):!1}function nd(t){return new St(()=>({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(Cn(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(Cn(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return jt})}function zL(t,e=At(t).parseResult.value){const n=[];return Gr(e).forEach(r=>{nd(r).forEach(i=>{i.reference.ref===t&&n.push(i.reference)})}),Le(n)}function Dg(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]=CT(i.defaultValue))}function CT(t){return Array.isArray(t)?[...t.map(CT)]:t}function Lg(t,e){const n={$type:t.$type};for(const[r,i]of Object.entries(t))if(!r.startsWith("$"))if(ct(i))n[r]=Lg(i,e);else if(Cn(i))n[r]=e(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){const s=[];for(const o of i)ct(o)?s.push(Lg(o,e)):Cn(o)?s.push(e(n,r,o.$refNode,o.$refText)):s.push(o);n[r]=s}else n[r]=i;return xg(n),n}const rd={__proto__:null,assignMandatoryProperties:Dg,copyAstNode:Lg,findLocalReferences:zL,findRootNode:_T,getContainerOfType:rn,getDocument:At,hasContainerOfType:Ng,linkContentToContainer:xg,streamAllContents:mr,streamAst:Gr,streamContents:fc,streamReferences:nd};function ae(t){return t.charCodeAt(0)}function Mg(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function hc(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function wo(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function HL(){throw Error("Internal Error - Should never get here!")}function AT(t){return t.type==="Character"}const id=[];for(let t=ae("0");t<=ae("9");t++)id.push(t);const sd=[ae("_")].concat(id);for(let t=ae("a");t<=ae("z");t++)sd.push(t);for(let t=ae("A");t<=ae("Z");t++)sd.push(t);const IT=[ae(" "),ae("\f"),ae(`
2
+ `),ae("\r"),ae(" "),ae("\v"),ae(" "),ae("\xA0"),ae("\u1680"),ae("\u2000"),ae("\u2001"),ae("\u2002"),ae("\u2003"),ae("\u2004"),ae("\u2005"),ae("\u2006"),ae("\u2007"),ae("\u2008"),ae("\u2009"),ae("\u200A"),ae("\u2028"),ae("\u2029"),ae("\u202F"),ae("\u205F"),ae("\u3000"),ae("\uFEFF")],VL=/[0-9a-fA-F]/,od=/[0-9]/,KL=/[1-9]/;class PT{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":hc(r,"global");break;case"i":hc(r,"ignoreCase");break;case"m":hc(r,"multiLine");break;case"u":hc(r,"unicode");break;case"y":hc(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}wo(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return HL()}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;wo(n);break}if(!(e===!0&&n===void 0)&&wo(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()),wo(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[ae(`
3
+ `),ae("\r"),ae("\u2028"),ae("\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=id;break;case"D":e=id,n=!0;break;case"s":e=IT;break;case"S":e=IT,n=!0;break;case"w":e=sd;break;case"W":e=sd,n=!0;break}if(wo(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=ae("\f");break;case"n":e=ae(`
4
+ `);break;case"r":e=ae("\r");break;case"t":e=ae(" ");break;case"v":e=ae("\v");break}if(wo(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:ae("\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:ae(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:ae(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,AT(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,AT(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Mg(r.value,e),e.push(ae("-")),Mg(i.value,e)}else Mg(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:ae("\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(KL.test(e)===!1)throw Error("Expecting a positive integer");for(;od.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(od.test(e)===!1)throw Error("Expecting an integer");for(;od.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:ae(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 od.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(VL.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 ad{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 xT=/\r?\n/gm,YL=new PT;class XL extends ad{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=cd(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 Fg=new XL;function JL(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Fg.reset(t),Fg.visit(YL.pattern(t)),Fg.multiline}catch{return!1}}const QL=`\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 jg(t){const e=typeof t=="string"?new RegExp(t):t;return QL.some(n=>e.test(n))}function cd(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZL(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:cd(e)).join("")}function eM(t,e){const n=tM(t),r=e.match(n);return!!r&&r[0].length>0}function tM(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",o;function a(l){s+=n.substr(r,l),r+=l}function c(l){s+="(?:"+n.substr(r,l)+"|$)",r+=l}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?n[r+2]==="{"?c(n.indexOf("}",r)-r+1):c(6):c(2);break;case"p":case"P":e.unicode?c(n.indexOf("}",r)-r+1):c(2);break;case"k":c(n.indexOf(">",r)-r+1);break;default:c(2);break}break;case"[":o=/\[(?:\\.|.)*?\]/g,o.lastIndex=r,o=o.exec(n)||[],c(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):c(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:c(1);break}return s}return new RegExp(i(),t.flags)}function ld(t){return t.rules.find(e=>Ut(e)&&e.entry)}function NT(t){return t.rules.filter(e=>qr(e)&&e.hidden)}function Ug(t,e){const n=new Set,r=ld(t);if(!r)return new Set(t.rules);const i=[r].concat(NT(t));for(const o of i)OT(o,n,e);const s=new Set;for(const o of t.rules)(n.has(o.name)||qr(o)&&o.hidden)&&s.add(o);return s}function OT(t,e,n){e.add(t.name),mr(t).forEach(r=>{if(Wr(r)||n&&$T(r)){const i=r.rule.ref;i&&!e.has(i.name)&&OT(i,e,n)}})}function Bg(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=zg(t.type.ref);return e?.terminal}}function DT(t){return t.hidden&&!jg(mc(t))}function bo(t,e){return!t||!e?[]:qg(t,e,t.astNode,!0)}function mn(t,e,n){if(!t||!e)return;const r=qg(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 qg(t,e,n,r){if(!r){const i=rn(t.grammarSource,pr);if(i&&i.feature===e)return[t]}return Br(t)&&t.astNode===n?t.content.flatMap(i=>qg(i,e,n,!1)):[]}function Wg(t,e){return t?Gg(t,e,t?.astNode):[]}function pc(t,e,n){if(!t)return;const r=Gg(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 Gg(t,e,n){if(t.astNode!==n)return[];if(gr(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=xa(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const o=i.value;o.astNode===n?gr(o.grammarSource)&&o.grammarSource.value===e&&s.push(o):r.prune()}while(!i.done);return s}function LT(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=rn(t.grammarSource,pr);if(r)return r;t=t.container}}function zg(t){let e=t;return ET(e)&&($s(e.$container)?e=e.$container.$container:Ut(e.$container)?e=e.$container:Vu(e.$container)),MT(t,e,new Map)}function MT(t,e,n){var r;function i(s,o){let a;return rn(s,pr)||(a=MT(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 mr(e)){if(pr(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Wr(s)&&Ut(s.rule.ref))return i(s,s.rule.ref);if(ST(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function FT(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($s(s))return s;{const o=mr(n[i]).find($s);if(o)return o}}}if($g(e))return FT(e)}function To(t,e){return t==="?"||t==="*"||$i(e)&&!!e.guardCondition}function jT(t){return t==="*"||t==="+"}function nM(t){return t==="+="}function ud(t){return UT(t,new Set)}function UT(t,e){if(e.has(t))return!0;e.add(t);for(const n of mr(t))if(Wr(n)){if(!n.rule.ref||Ut(n.rule.ref)&&!UT(n.rule.ref,e))return!1}else{if(pr(n))return!1;if($s(n))return!1}return!!t.definition}function rM(t){return Hg(t.type,new Set)}function Hg(t,e){if(e.has(t))return!0;if(e.add(t),CL(t))return!1;if(OL(t))return!1;if(LL(t))return t.types.every(n=>Hg(n,e));if(ST(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 Cg(n)?Hg(n.type,e):!1}else return!1}else return!1}function ks(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(Ut(e))return e.name;if(RT(e)||Cg(e))return e.name}}}function gc(t){var e;if(Ut(t))return ud(t)?t.name:(e=ks(t))!==null&&e!==void 0?e:t.name;if(RT(t)||Cg(t)||DL(t))return t.name;if($s(t)){const n=BT(t);if(n)return n}else if(ET(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function BT(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return gc(t.type.ref)}function iM(t){var e,n,r;return qr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":ud(t)?t.name:(r=ks(t))!==null&&r!==void 0?r:t.name}function qT(t){var e,n,r;return qr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":(r=ks(t))!==null&&r!==void 0?r:t.name}function mc(t){const e={s:!1,i:!1,u:!1},n=Eo(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const Vg=/[\s\S]/.source;function Eo(t,e){if(BL(t))return sM(t);if(qL(t))return oM(t);if(ML(t))return lM(t);if($T(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return zr(Eo(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(jL(t))return cM(t);if(WL(t))return aM(t);if(UL(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")),zr(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(GL(t))return zr(Vg,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function sM(t){return zr(t.elements.map(e=>Eo(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function oM(t){return zr(t.elements.map(e=>Eo(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function aM(t){return zr(`${Vg}*?${Eo(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function cM(t){return zr(`(?!${Eo(t.terminal)})${Vg}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function lM(t){return t.right?zr(`[${Kg(t.left)}-${Kg(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):zr(Kg(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function Kg(t){return cd(t.value)}function zr(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 dd={__proto__:null,findAssignment:LT,findNameAssignment:zg,findNodeForKeyword:pc,findNodeForProperty:mn,findNodesForKeyword:Wg,findNodesForKeywordInternal:Gg,findNodesForProperty:bo,getActionAtElement:FT,getActionType:BT,getAllReachableRules:Ug,getCrossReferenceTerminal:Bg,getEntryRule:ld,getExplicitRuleType:ks,getHiddenRules:NT,getRuleType:qT,getRuleTypeName:iM,getTypeName:gc,isArrayCardinality:jT,isArrayOperator:nM,isCommentTerminal:DT,isDataType:rM,isDataTypeRule:ud,isOptionalCardinality:To,terminalRegex:mc};function uM(t){const e=[],n=t.Grammar;for(const r of n.rules)qr(r)&&DT(r)&&JL(mc(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:bg}}var WT=typeof global=="object"&&global&&global.Object===Object&&global,dM=typeof self=="object"&&self&&self.Object===Object&&self,yr=WT||dM||Function("return this")(),An=yr.Symbol,GT=Object.prototype,fM=GT.hasOwnProperty,hM=GT.toString,yc=An?An.toStringTag:void 0;function pM(t){var e=fM.call(t,yc),n=t[yc];try{t[yc]=void 0;var r=!0}catch{}var i=hM.call(t);return r&&(e?t[yc]=n:delete t[yc]),i}var gM=Object.prototype,mM=gM.toString;function yM(t){return mM.call(t)}var vM="[object Null]",wM="[object Undefined]",zT=An?An.toStringTag:void 0;function ki(t){return t==null?t===void 0?wM:vM:zT&&zT in Object(t)?pM(t):yM(t)}function Vn(t){return t!=null&&typeof t=="object"}var bM="[object Symbol]";function vc(t){return typeof t=="symbol"||Vn(t)&&ki(t)==bM}function fd(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 ke=Array.isArray,TM=1/0,HT=An?An.prototype:void 0,VT=HT?HT.toString:void 0;function KT(t){if(typeof t=="string")return t;if(ke(t))return fd(t,KT)+"";if(vc(t))return VT?VT.call(t):"";var e=t+"";return e=="0"&&1/t==-TM?"-0":e}var EM=/\s/;function RM(t){for(var e=t.length;e--&&EM.test(t.charAt(e)););return e}var SM=/^\s+/;function $M(t){return t&&t.slice(0,RM(t)+1).replace(SM,"")}function In(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var YT=NaN,kM=/^[-+]0x[0-9a-f]+$/i,_M=/^0b[01]+$/i,CM=/^0o[0-7]+$/i,AM=parseInt;function IM(t){if(typeof t=="number")return t;if(vc(t))return YT;if(In(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=In(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=$M(t);var n=_M.test(t);return n||CM.test(t)?AM(t.slice(2),n?2:8):kM.test(t)?YT:+t}var XT=1/0,PM=17976931348623157e292;function xM(t){if(!t)return t===0?t:0;if(t=IM(t),t===XT||t===-XT){var e=t<0?-1:1;return e*PM}return t===t?t:0}function hd(t){var e=xM(t),n=e%1;return e===e?n?e-n:e:0}function _s(t){return t}var NM="[object AsyncFunction]",OM="[object Function]",DM="[object GeneratorFunction]",LM="[object Proxy]";function Hr(t){if(!In(t))return!1;var e=ki(t);return e==OM||e==DM||e==NM||e==LM}var Yg=yr["__core-js_shared__"],JT=function(){var t=/[^.]+$/.exec(Yg&&Yg.keys&&Yg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function MM(t){return!!JT&&JT in t}var FM=Function.prototype,jM=FM.toString;function Cs(t){if(t!=null){try{return jM.call(t)}catch{}try{return t+""}catch{}}return""}var UM=/[\\^$.*+?()[\]{}|]/g,BM=/^\[object .+?Constructor\]$/,qM=Function.prototype,WM=Object.prototype,GM=qM.toString,zM=WM.hasOwnProperty,HM=RegExp("^"+GM.call(zM).replace(UM,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function VM(t){if(!In(t)||MM(t))return!1;var e=Hr(t)?HM:BM;return e.test(Cs(t))}function KM(t,e){return t?.[e]}function As(t,e){var n=KM(t,e);return VM(n)?n:void 0}var Xg=As(yr,"WeakMap"),QT=Object.create,YM=function(){function t(){}return function(e){if(!In(e))return{};if(QT)return QT(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function XM(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 kt(){}function JM(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var QM=800,ZM=16,e2=Date.now;function t2(t){var e=0,n=0;return function(){var r=e2(),i=ZM-(r-n);if(n=r,i>0){if(++e>=QM)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function n2(t){return function(){return t}}var pd=function(){try{var t=As(Object,"defineProperty");return t({},"",{}),t}catch{}}(),r2=pd?function(t,e){return pd(t,"toString",{configurable:!0,enumerable:!1,value:n2(e),writable:!0})}:_s,i2=t2(r2);function ZT(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function eE(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 s2(t){return t!==t}function o2(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function Jg(t,e,n){return e===e?o2(t,e,n):eE(t,s2,n)}function tE(t,e){var n=t==null?0:t.length;return!!n&&Jg(t,e,0)>-1}var a2=9007199254740991,c2=/^(?:0|[1-9]\d*)$/;function gd(t,e){var n=typeof t;return e=e??a2,!!e&&(n=="number"||n!="symbol"&&c2.test(t))&&t>-1&&t%1==0&&t<e}function Qg(t,e,n){e=="__proto__"&&pd?pd(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function wc(t,e){return t===e||t!==t&&e!==e}var l2=Object.prototype,u2=l2.hasOwnProperty;function md(t,e,n){var r=t[e];(!(u2.call(t,e)&&wc(r,n))||n===void 0&&!(e in t))&&Qg(t,e,n)}function Zg(t,e,n,r){var i=!n;n||(n={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=void 0;c===void 0&&(c=t[a]),i?Qg(n,a,c):md(n,a,c)}return n}var nE=Math.max;function d2(t,e,n){return e=nE(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=nE(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),XM(t,this,a)}}function em(t,e){return i2(d2(t,e,_s),t+"")}var f2=9007199254740991;function tm(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=f2}function vr(t){return t!=null&&tm(t.length)&&!Hr(t)}function rE(t,e,n){if(!In(n))return!1;var r=typeof e;return(r=="number"?vr(n)&&gd(e,n.length):r=="string"&&e in n)?wc(n[e],t):!1}function h2(t){return em(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&&rE(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 p2=Object.prototype;function bc(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||p2;return t===n}function g2(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var m2="[object Arguments]";function iE(t){return Vn(t)&&ki(t)==m2}var sE=Object.prototype,y2=sE.hasOwnProperty,v2=sE.propertyIsEnumerable,yd=iE(function(){return arguments}())?iE:function(t){return Vn(t)&&y2.call(t,"callee")&&!v2.call(t,"callee")},gt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ro(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function w2(){return!1}var oE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,aE=oE&&typeof module=="object"&&module&&!module.nodeType&&module,b2=aE&&aE.exports===oE,cE=b2?yr.Buffer:void 0,T2=cE?cE.isBuffer:void 0,Tc=T2||w2,E2="[object Arguments]",R2="[object Array]",S2="[object Boolean]",$2="[object Date]",k2="[object Error]",_2="[object Function]",C2="[object Map]",A2="[object Number]",I2="[object Object]",P2="[object RegExp]",x2="[object Set]",N2="[object String]",O2="[object WeakMap]",D2="[object ArrayBuffer]",L2="[object DataView]",M2="[object Float32Array]",F2="[object Float64Array]",j2="[object Int8Array]",U2="[object Int16Array]",B2="[object Int32Array]",q2="[object Uint8Array]",W2="[object Uint8ClampedArray]",G2="[object Uint16Array]",z2="[object Uint32Array]",ze={};ze[M2]=ze[F2]=ze[j2]=ze[U2]=ze[B2]=ze[q2]=ze[W2]=ze[G2]=ze[z2]=!0,ze[E2]=ze[R2]=ze[D2]=ze[S2]=ze[L2]=ze[$2]=ze[k2]=ze[_2]=ze[C2]=ze[A2]=ze[I2]=ze[P2]=ze[x2]=ze[N2]=ze[O2]=!1;function H2(t){return Vn(t)&&tm(t.length)&&!!ze[ki(t)]}function vd(t){return function(e){return t(e)}}var lE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ec=lE&&typeof module=="object"&&module&&!module.nodeType&&module,V2=Ec&&Ec.exports===lE,nm=V2&&WT.process,_i=function(){try{var t=Ec&&Ec.require&&Ec.require("util").types;return t||nm&&nm.binding&&nm.binding("util")}catch{}}(),uE=_i&&_i.isTypedArray,rm=uE?vd(uE):H2,K2=Object.prototype,Y2=K2.hasOwnProperty;function dE(t,e){var n=ke(t),r=!n&&yd(t),i=!n&&!r&&Tc(t),s=!n&&!r&&!i&&rm(t),o=n||r||i||s,a=o?g2(t.length,String):[],c=a.length;for(var l in t)(e||Y2.call(t,l))&&!(o&&(l=="length"||i&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||gd(l,c)))&&a.push(l);return a}function fE(t,e){return function(n){return t(e(n))}}var X2=fE(Object.keys,Object),J2=Object.prototype,Q2=J2.hasOwnProperty;function hE(t){if(!bc(t))return X2(t);var e=[];for(var n in Object(t))Q2.call(t,n)&&n!="constructor"&&e.push(n);return e}function Pn(t){return vr(t)?dE(t):hE(t)}var Z2=Object.prototype,eF=Z2.hasOwnProperty,yn=h2(function(t,e){if(bc(e)||vr(e)){Zg(e,Pn(e),t);return}for(var n in e)eF.call(e,n)&&md(t,n,e[n])});function tF(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var nF=Object.prototype,rF=nF.hasOwnProperty;function iF(t){if(!In(t))return tF(t);var e=bc(t),n=[];for(var r in t)r=="constructor"&&(e||!rF.call(t,r))||n.push(r);return n}function pE(t){return vr(t)?dE(t,!0):iF(t)}var sF=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,oF=/^\w*$/;function im(t,e){if(ke(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||vc(t)?!0:oF.test(t)||!sF.test(t)||e!=null&&t in Object(e)}var Rc=As(Object,"create");function aF(){this.__data__=Rc?Rc(null):{},this.size=0}function cF(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var lF="__lodash_hash_undefined__",uF=Object.prototype,dF=uF.hasOwnProperty;function fF(t){var e=this.__data__;if(Rc){var n=e[t];return n===lF?void 0:n}return dF.call(e,t)?e[t]:void 0}var hF=Object.prototype,pF=hF.hasOwnProperty;function gF(t){var e=this.__data__;return Rc?e[t]!==void 0:pF.call(e,t)}var mF="__lodash_hash_undefined__";function yF(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Rc&&e===void 0?mF:e,this}function Is(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])}}Is.prototype.clear=aF,Is.prototype.delete=cF,Is.prototype.get=fF,Is.prototype.has=gF,Is.prototype.set=yF;function vF(){this.__data__=[],this.size=0}function wd(t,e){for(var n=t.length;n--;)if(wc(t[n][0],e))return n;return-1}var wF=Array.prototype,bF=wF.splice;function TF(t){var e=this.__data__,n=wd(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():bF.call(e,n,1),--this.size,!0}function EF(t){var e=this.__data__,n=wd(e,t);return n<0?void 0:e[n][1]}function RF(t){return wd(this.__data__,t)>-1}function SF(t,e){var n=this.__data__,r=wd(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Vr(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])}}Vr.prototype.clear=vF,Vr.prototype.delete=TF,Vr.prototype.get=EF,Vr.prototype.has=RF,Vr.prototype.set=SF;var Sc=As(yr,"Map");function $F(){this.size=0,this.__data__={hash:new Is,map:new(Sc||Vr),string:new Is}}function kF(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function bd(t,e){var n=t.__data__;return kF(e)?n[typeof e=="string"?"string":"hash"]:n.map}function _F(t){var e=bd(this,t).delete(t);return this.size-=e?1:0,e}function CF(t){return bd(this,t).get(t)}function AF(t){return bd(this,t).has(t)}function IF(t,e){var n=bd(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,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=$F,Kr.prototype.delete=_F,Kr.prototype.get=CF,Kr.prototype.has=AF,Kr.prototype.set=IF;var PF="Expected a function";function sm(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(PF);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(sm.Cache||Kr),n}sm.Cache=Kr;var xF=500;function NF(t){var e=sm(t,function(r){return n.size===xF&&n.clear(),r}),n=e.cache;return e}var OF=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,DF=/\\(\\)?/g,LF=NF(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(OF,function(n,r,i,s){e.push(i?s.replace(DF,"$1"):r||n)}),e});function MF(t){return t==null?"":KT(t)}function Td(t,e){return ke(t)?t:im(t,e)?[t]:LF(MF(t))}var FF=1/0;function $c(t){if(typeof t=="string"||vc(t))return t;var e=t+"";return e=="0"&&1/t==-FF?"-0":e}function om(t,e){e=Td(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[$c(e[n++])];return n&&n==r?t:void 0}function jF(t,e,n){var r=t==null?void 0:om(t,e);return r===void 0?n:r}function am(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var gE=An?An.isConcatSpreadable:void 0;function UF(t){return ke(t)||yd(t)||!!(gE&&t&&t[gE])}function cm(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=UF),i||(i=[]);++s<o;){var a=t[s];n(a)?am(i,a):r||(i[i.length]=a)}return i}function xn(t){var e=t==null?0:t.length;return e?cm(t):[]}var mE=fE(Object.getPrototypeOf,Object);function yE(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 BF(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 qF(){this.__data__=new Vr,this.size=0}function WF(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function GF(t){return this.__data__.get(t)}function zF(t){return this.__data__.has(t)}var HF=200;function VF(t,e){var n=this.__data__;if(n instanceof Vr){var r=n.__data__;if(!Sc||r.length<HF-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Kr(r)}return n.set(t,e),this.size=n.size,this}function wr(t){var e=this.__data__=new Vr(t);this.size=e.size}wr.prototype.clear=qF,wr.prototype.delete=WF,wr.prototype.get=GF,wr.prototype.has=zF,wr.prototype.set=VF;function KF(t,e){return t&&Zg(e,Pn(e),t)}var vE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wE=vE&&typeof module=="object"&&module&&!module.nodeType&&module,YF=wE&&wE.exports===vE,bE=YF?yr.Buffer:void 0,TE=bE?bE.allocUnsafe:void 0;function XF(t,e){var n=t.length,r=TE?TE(n):new t.constructor(n);return t.copy(r),r}function lm(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 EE(){return[]}var JF=Object.prototype,QF=JF.propertyIsEnumerable,RE=Object.getOwnPropertySymbols,um=RE?function(t){return t==null?[]:(t=Object(t),lm(RE(t),function(e){return QF.call(t,e)}))}:EE;function ZF(t,e){return Zg(t,um(t),e)}var e3=Object.getOwnPropertySymbols,t3=e3?function(t){for(var e=[];t;)am(e,um(t)),t=mE(t);return e}:EE;function SE(t,e,n){var r=e(t);return ke(t)?r:am(r,n(t))}function dm(t){return SE(t,Pn,um)}function n3(t){return SE(t,pE,t3)}var fm=As(yr,"DataView"),hm=As(yr,"Promise"),So=As(yr,"Set"),$E="[object Map]",r3="[object Object]",kE="[object Promise]",_E="[object Set]",CE="[object WeakMap]",AE="[object DataView]",i3=Cs(fm),s3=Cs(Sc),o3=Cs(hm),a3=Cs(So),c3=Cs(Xg),Nn=ki;(fm&&Nn(new fm(new ArrayBuffer(1)))!=AE||Sc&&Nn(new Sc)!=$E||hm&&Nn(hm.resolve())!=kE||So&&Nn(new So)!=_E||Xg&&Nn(new Xg)!=CE)&&(Nn=function(t){var e=ki(t),n=e==r3?t.constructor:void 0,r=n?Cs(n):"";if(r)switch(r){case i3:return AE;case s3:return $E;case o3:return kE;case a3:return _E;case c3:return CE}return e});var l3=Object.prototype,u3=l3.hasOwnProperty;function d3(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&u3.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Ed=yr.Uint8Array;function f3(t){var e=new t.constructor(t.byteLength);return new Ed(e).set(new Ed(t)),e}function h3(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var p3=/\w*$/;function g3(t){var e=new t.constructor(t.source,p3.exec(t));return e.lastIndex=t.lastIndex,e}var IE=An?An.prototype:void 0,PE=IE?IE.valueOf:void 0;function m3(t){return PE?Object(PE.call(t)):{}}function y3(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var v3="[object Boolean]",w3="[object Date]",b3="[object Map]",T3="[object Number]",E3="[object RegExp]",R3="[object Set]",S3="[object String]",$3="[object Symbol]",k3="[object ArrayBuffer]",_3="[object DataView]",C3="[object Float32Array]",A3="[object Float64Array]",I3="[object Int8Array]",P3="[object Int16Array]",x3="[object Int32Array]",N3="[object Uint8Array]",O3="[object Uint8ClampedArray]",D3="[object Uint16Array]",L3="[object Uint32Array]";function M3(t,e,n){var r=t.constructor;switch(e){case k3:return f3(t);case v3:case w3:return new r(+t);case _3:return h3(t);case C3:case A3:case I3:case P3:case x3:case N3:case O3:case D3:case L3:return y3(t);case b3:return new r;case T3:case S3:return new r(t);case E3:return g3(t);case R3:return new r;case $3:return m3(t)}}function F3(t){return typeof t.constructor=="function"&&!bc(t)?YM(mE(t)):{}}var j3="[object Map]";function U3(t){return Vn(t)&&Nn(t)==j3}var xE=_i&&_i.isMap,B3=xE?vd(xE):U3,q3="[object Set]";function W3(t){return Vn(t)&&Nn(t)==q3}var NE=_i&&_i.isSet,G3=NE?vd(NE):W3,OE="[object Arguments]",z3="[object Array]",H3="[object Boolean]",V3="[object Date]",K3="[object Error]",DE="[object Function]",Y3="[object GeneratorFunction]",X3="[object Map]",J3="[object Number]",LE="[object Object]",Q3="[object RegExp]",Z3="[object Set]",ej="[object String]",tj="[object Symbol]",nj="[object WeakMap]",rj="[object ArrayBuffer]",ij="[object DataView]",sj="[object Float32Array]",oj="[object Float64Array]",aj="[object Int8Array]",cj="[object Int16Array]",lj="[object Int32Array]",uj="[object Uint8Array]",dj="[object Uint8ClampedArray]",fj="[object Uint16Array]",hj="[object Uint32Array]",We={};We[OE]=We[z3]=We[rj]=We[ij]=We[H3]=We[V3]=We[sj]=We[oj]=We[aj]=We[cj]=We[lj]=We[X3]=We[J3]=We[LE]=We[Q3]=We[Z3]=We[ej]=We[tj]=We[uj]=We[dj]=We[fj]=We[hj]=!0,We[K3]=We[DE]=We[nj]=!1;function Rd(t,e,n,r,i,s){var o;if(o!==void 0)return o;if(!In(t))return t;var a=ke(t);if(a)return o=d3(t),JM(t,o);var c=Nn(t),l=c==DE||c==Y3;if(Tc(t))return XF(t);if(c==LE||c==OE||l&&!i)return o=l?{}:F3(t),ZF(t,KF(o,t));if(!We[c])return i?t:{};o=M3(t,c),s||(s=new wr);var u=s.get(t);if(u)return u;s.set(t,o),G3(t)?t.forEach(function(h){o.add(Rd(h,e,n,h,t,s))}):B3(t)&&t.forEach(function(h,p){o.set(p,Rd(h,e,n,p,t,s))});var d=dm,f=a?void 0:d(t);return ZT(f||t,function(h,p){f&&(p=h,h=t[p]),md(o,p,Rd(h,e,n,p,t,s))}),o}var pj=4;function Ot(t){return Rd(t,pj)}function kc(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 gj="__lodash_hash_undefined__";function mj(t){return this.__data__.set(t,gj),this}function yj(t){return this.__data__.has(t)}function $o(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Kr;++e<n;)this.add(t[e])}$o.prototype.add=$o.prototype.push=mj,$o.prototype.has=yj;function ME(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 pm(t,e){return t.has(e)}var vj=1,wj=2;function FE(t,e,n,r,i,s){var o=n&vj,a=t.length,c=e.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(t),u=s.get(e);if(l&&u)return l==e&&u==t;var d=-1,f=!0,h=n&wj?new $o:void 0;for(s.set(t,e),s.set(e,t);++d<a;){var p=t[d],y=e[d];if(r)var R=o?r(y,p,d,e,t,s):r(p,y,d,t,e,s);if(R!==void 0){if(R)continue;f=!1;break}if(h){if(!ME(e,function(b,v){if(!pm(h,v)&&(p===b||i(p,b,n,r,s)))return h.push(v)})){f=!1;break}}else if(!(p===y||i(p,y,n,r,s))){f=!1;break}}return s.delete(t),s.delete(e),f}function bj(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function gm(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var Tj=1,Ej=2,Rj="[object Boolean]",Sj="[object Date]",$j="[object Error]",kj="[object Map]",_j="[object Number]",Cj="[object RegExp]",Aj="[object Set]",Ij="[object String]",Pj="[object Symbol]",xj="[object ArrayBuffer]",Nj="[object DataView]",jE=An?An.prototype:void 0,mm=jE?jE.valueOf:void 0;function Oj(t,e,n,r,i,s,o){switch(n){case Nj:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case xj:return!(t.byteLength!=e.byteLength||!s(new Ed(t),new Ed(e)));case Rj:case Sj:case _j:return wc(+t,+e);case $j:return t.name==e.name&&t.message==e.message;case Cj:case Ij:return t==e+"";case kj:var a=bj;case Aj:var c=r&Tj;if(a||(a=gm),t.size!=e.size&&!c)return!1;var l=o.get(t);if(l)return l==e;r|=Ej,o.set(t,e);var u=FE(a(t),a(e),r,i,s,o);return o.delete(t),u;case Pj:if(mm)return mm.call(t)==mm.call(e)}return!1}var Dj=1,Lj=Object.prototype,Mj=Lj.hasOwnProperty;function Fj(t,e,n,r,i,s){var o=n&Dj,a=dm(t),c=a.length,l=dm(e),u=l.length;if(c!=u&&!o)return!1;for(var d=c;d--;){var f=a[d];if(!(o?f in e:Mj.call(e,f)))return!1}var h=s.get(t),p=s.get(e);if(h&&p)return h==e&&p==t;var y=!0;s.set(t,e),s.set(e,t);for(var R=o;++d<c;){f=a[d];var b=t[f],v=e[f];if(r)var T=o?r(v,b,f,e,t,s):r(b,v,f,t,e,s);if(!(T===void 0?b===v||i(b,v,n,r,s):T)){y=!1;break}R||(R=f=="constructor")}if(y&&!R){var _=t.constructor,N=e.constructor;_!=N&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof N=="function"&&N instanceof N)&&(y=!1)}return s.delete(t),s.delete(e),y}var jj=1,UE="[object Arguments]",BE="[object Array]",Sd="[object Object]",Uj=Object.prototype,qE=Uj.hasOwnProperty;function Bj(t,e,n,r,i,s){var o=ke(t),a=ke(e),c=o?BE:Nn(t),l=a?BE:Nn(e);c=c==UE?Sd:c,l=l==UE?Sd:l;var u=c==Sd,d=l==Sd,f=c==l;if(f&&Tc(t)){if(!Tc(e))return!1;o=!0,u=!1}if(f&&!u)return s||(s=new wr),o||rm(t)?FE(t,e,n,r,i,s):Oj(t,e,c,n,r,i,s);if(!(n&jj)){var h=u&&qE.call(t,"__wrapped__"),p=d&&qE.call(e,"__wrapped__");if(h||p){var y=h?t.value():t,R=p?e.value():e;return s||(s=new wr),i(y,R,n,r,s)}}return f?(s||(s=new wr),Fj(t,e,n,r,i,s)):!1}function ym(t,e,n,r,i){return t===e?!0:t==null||e==null||!Vn(t)&&!Vn(e)?t!==t&&e!==e:Bj(t,e,n,r,ym,i)}var qj=1,Wj=2;function Gj(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],c=t[a],l=o[1];if(o[2]){if(c===void 0&&!(a in t))return!1}else{var u=new wr,d;if(!(d===void 0?ym(l,c,qj|Wj,r,u):d))return!1}}return!0}function WE(t){return t===t&&!In(t)}function zj(t){for(var e=Pn(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,WE(i)]}return e}function GE(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function Hj(t){var e=zj(t);return e.length==1&&e[0][2]?GE(e[0][0],e[0][1]):function(n){return n===t||Gj(n,t,e)}}function Vj(t,e){return t!=null&&e in Object(t)}function zE(t,e,n){e=Td(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=$c(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&&tm(i)&&gd(o,i)&&(ke(t)||yd(t)))}function Kj(t,e){return t!=null&&zE(t,e,Vj)}var Yj=1,Xj=2;function Jj(t,e){return im(t)&&WE(e)?GE($c(t),e):function(n){var r=jF(n,t);return r===void 0&&r===e?Kj(n,t):ym(e,r,Yj|Xj)}}function Qj(t){return function(e){return e?.[t]}}function Zj(t){return function(e){return om(e,t)}}function eU(t){return im(t)?Qj($c(t)):Zj(t)}function Kn(t){return typeof t=="function"?t:t==null?_s:typeof t=="object"?ke(t)?Jj(t[0],t[1]):Hj(t):eU(t)}function tU(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 nU(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var c=o[++i];if(n(s[c],c,s)===!1)break}return e}}var rU=nU();function iU(t,e){return t&&rU(t,e,Pn)}function sU(t,e){return function(n,r){if(n==null)return n;if(!vr(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 Ps=sU(iU);function oU(t,e,n,r){return Ps(t,function(i,s,o){e(r,i,n(i),o)}),r}function aU(t,e){return function(n,r){var i=ke(n)?tU:oU,s=e?e():{};return i(n,t,Kn(r),s)}}var HE=Object.prototype,cU=HE.hasOwnProperty,vm=em(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&rE(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],o=pE(s),a=-1,c=o.length;++a<c;){var l=o[a],u=t[l];(u===void 0||wc(u,HE[l])&&!cU.call(t,l))&&(t[l]=s[l])}return t});function VE(t){return Vn(t)&&vr(t)}var lU=200;function uU(t,e,n,r){var i=-1,s=tE,o=!0,a=t.length,c=[],l=e.length;if(!a)return c;e.length>=lU&&(s=pm,o=!1,e=new $o(e));e:for(;++i<a;){var u=t[i],d=u;if(u=u!==0?u:0,o&&d===d){for(var f=l;f--;)if(e[f]===d)continue e;c.push(u)}else s(e,d,r)||c.push(u)}return c}var $d=em(function(t,e){return VE(t)?uU(t,cm(e,1,VE,!0)):[]});function ko(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function Dt(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:hd(e),yE(t,e<0?0:e,r)):[]}function _c(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:hd(e),e=r-e,yE(t,0,e<0?0:e)):[]}function dU(t){return typeof t=="function"?t:_s}function ie(t,e){var n=ke(t)?ZT:Ps;return n(t,dU(e))}function fU(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 hU(t,e){var n=!0;return Ps(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Yn(t,e,n){var r=ke(t)?fU:hU;return r(t,Kn(e))}function KE(t,e){var n=[];return Ps(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function vn(t,e){var n=ke(t)?lm:KE;return n(t,Kn(e))}function pU(t){return function(e,n,r){var i=Object(e);if(!vr(e)){var s=Kn(n);e=Pn(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 gU=Math.max;function mU(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:hd(n);return i<0&&(i=gU(r+i,0)),eE(t,Kn(e),i)}var _o=pU(mU);function Xn(t){return t&&t.length?t[0]:void 0}function yU(t,e){var n=-1,r=vr(t)?Array(t.length):[];return Ps(t,function(i,s,o){r[++n]=e(i,s,o)}),r}function Z(t,e){var n=ke(t)?fd:yU;return n(t,Kn(e))}function wn(t,e){return cm(Z(t,e))}var vU=Object.prototype,wU=vU.hasOwnProperty,bU=aU(function(t,e,n){wU.call(t,n)?t[n].push(e):Qg(t,n,[e])}),TU=Object.prototype,EU=TU.hasOwnProperty;function RU(t,e){return t!=null&&EU.call(t,e)}function oe(t,e){return t!=null&&zE(t,e,RU)}var SU="[object String]";function sn(t){return typeof t=="string"||!ke(t)&&Vn(t)&&ki(t)==SU}function $U(t,e){return fd(e,function(n){return t[n]})}function _t(t){return t==null?[]:$U(t,Pn(t))}var kU=Math.max;function Ht(t,e,n,r){t=vr(t)?t:_t(t),n=n&&!r?hd(n):0;var i=t.length;return n<0&&(n=kU(i+n,0)),sn(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Jg(t,e,n)>-1}function YE(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return Jg(t,e,i)}var _U="[object Map]",CU="[object Set]",AU=Object.prototype,IU=AU.hasOwnProperty;function Be(t){if(t==null)return!0;if(vr(t)&&(ke(t)||typeof t=="string"||typeof t.splice=="function"||Tc(t)||rm(t)||yd(t)))return!t.length;var e=Nn(t);if(e==_U||e==CU)return!t.size;if(bc(t))return!hE(t).length;for(var n in t)if(IU.call(t,n))return!1;return!0}var PU="[object RegExp]";function xU(t){return Vn(t)&&ki(t)==PU}var XE=_i&&_i.isRegExp,Yr=XE?vd(XE):xU;function Xr(t){return t===void 0}function NU(t,e){return t<e}function OU(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&&!vc(o):n(o,a)))var a=o,c=s}return c}function DU(t){return t&&t.length?OU(t,_s,NU):void 0}var LU="Expected a function";function MU(t){if(typeof t!="function")throw new TypeError(LU);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 FU(t,e,n,r){if(!In(t))return t;e=Td(e,t);for(var i=-1,s=e.length,o=s-1,a=t;a!=null&&++i<s;){var c=$c(e[i]),l=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=o){var u=a[c];l=void 0,l===void 0&&(l=In(u)?u:gd(e[i+1])?[]:{})}md(a,c,l),a=a[c]}return t}function jU(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=om(t,o);n(a,o)&&FU(s,Td(o,t),a)}return s}function Jn(t,e){if(t==null)return{};var n=fd(n3(t),function(r){return[r]});return e=Kn(e),jU(t,n,function(r,i){return e(r,i[0])})}function UU(t,e,n,r,i){return i(t,function(s,o,a){n=r?(r=!1,s):e(n,s,o,a)}),n}function Vt(t,e,n){var r=ke(t)?BF:UU,i=arguments.length<3;return r(t,Kn(e),n,i,Ps)}function kd(t,e){var n=ke(t)?lm:KE;return n(t,MU(Kn(e)))}function BU(t,e){var n;return Ps(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function JE(t,e,n){var r=ke(t)?ME:BU;return r(t,Kn(e))}var qU=1/0,WU=So&&1/gm(new So([,-0]))[1]==qU?function(t){return new So(t)}:kt,GU=200;function QE(t,e,n){var r=-1,i=tE,s=t.length,o=!0,a=[],c=a;if(s>=GU){var l=e?null:WU(t);if(l)return gm(l);o=!1,i=pm,c=new $o}else c=e?[]:a;e:for(;++r<s;){var u=t[r],d=e?e(u):u;if(u=u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.push(d),a.push(u)}else i(c,d,n)||(c!==a&&c.push(d),a.push(u))}return a}function wm(t){return t&&t.length?QE(t):[]}function zU(t,e){return t&&t.length?QE(t,Kn(e)):[]}function bm(t){console&&console.error&&console.error(`Error: ${t}`)}function ZE(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function eR(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function tR(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function HU(t){return VU(t)?t.LABEL:t.name}function VU(t){return sn(t.LABEL)&&t.LABEL!==""}class br{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),ie(this.definition,n=>{n.accept(e)})}}class Kt extends br{constructor(e){super([]),this.idx=1,yn(this,Jn(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Co extends br{constructor(e){super(e.definition),this.orgText="",yn(this,Jn(e,n=>n!==void 0))}}class on extends br{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,yn(this,Jn(e,n=>n!==void 0))}}class Lt extends br{constructor(e){super(e.definition),this.idx=1,yn(this,Jn(e,n=>n!==void 0))}}class bn extends br{constructor(e){super(e.definition),this.idx=1,yn(this,Jn(e,n=>n!==void 0))}}class Tn extends br{constructor(e){super(e.definition),this.idx=1,yn(this,Jn(e,n=>n!==void 0))}}class lt extends br{constructor(e){super(e.definition),this.idx=1,yn(this,Jn(e,n=>n!==void 0))}}class an extends br{constructor(e){super(e.definition),this.idx=1,yn(this,Jn(e,n=>n!==void 0))}}class cn extends br{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,yn(this,Jn(e,n=>n!==void 0))}}class He{constructor(e){this.idx=1,yn(this,Jn(e,n=>n!==void 0))}accept(e){e.visit(this)}}function KU(t){return Z(t,_d)}function _d(t){function e(n){return Z(n,_d)}if(t instanceof Kt){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return sn(t.label)&&(n.label=t.label),n}else{if(t instanceof on)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Lt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof bn)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Tn)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:_d(new He({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof an)return{type:"RepetitionWithSeparator",idx:t.idx,separator:_d(new He({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof lt)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 He){const n={type:"Terminal",name:t.terminalType.name,label:HU(t.terminalType),idx:t.idx};sn(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Yr(r)?r.source:r),n}else{if(t instanceof Co)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class Ao{visit(e){const n=e;switch(n.constructor){case Kt:return this.visitNonTerminal(n);case on:return this.visitAlternative(n);case Lt:return this.visitOption(n);case bn:return this.visitRepetitionMandatory(n);case Tn:return this.visitRepetitionMandatoryWithSeparator(n);case an:return this.visitRepetitionWithSeparator(n);case lt:return this.visitRepetition(n);case cn:return this.visitAlternation(n);case He:return this.visitTerminal(n);case Co: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 YU(t){return t instanceof on||t instanceof Lt||t instanceof lt||t instanceof bn||t instanceof Tn||t instanceof an||t instanceof He||t instanceof Co}function Cd(t,e=[]){return t instanceof Lt||t instanceof lt||t instanceof an?!0:t instanceof cn?JE(t.definition,r=>Cd(r,e)):t instanceof Kt&&Ht(e,t)?!1:t instanceof br?(t instanceof Kt&&e.push(t),Yn(t.definition,r=>Cd(r,e))):!1}function XU(t){return t instanceof cn}function Tr(t){if(t instanceof Kt)return"SUBRULE";if(t instanceof Lt)return"OPTION";if(t instanceof cn)return"OR";if(t instanceof bn)return"AT_LEAST_ONE";if(t instanceof Tn)return"AT_LEAST_ONE_SEP";if(t instanceof an)return"MANY_SEP";if(t instanceof lt)return"MANY";if(t instanceof He)return"CONSUME";throw Error("non exhaustive match")}class Ad{walk(e,n=[]){ie(e.definition,(r,i)=>{const s=Dt(e.definition,i+1);if(r instanceof Kt)this.walkProdRef(r,s,n);else if(r instanceof He)this.walkTerminal(r,s,n);else if(r instanceof on)this.walkFlat(r,s,n);else if(r instanceof Lt)this.walkOption(r,s,n);else if(r instanceof bn)this.walkAtLeastOne(r,s,n);else if(r instanceof Tn)this.walkAtLeastOneSep(r,s,n);else if(r instanceof an)this.walkManySep(r,s,n);else if(r instanceof lt)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 Lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=nR(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new Lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=nR(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);ie(e.definition,s=>{const o=new on({definition:[s]});this.walk(o,i)})}}function nR(t,e,n){return[new Lt({definition:[new He({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function Cc(t){if(t instanceof Kt)return Cc(t.referencedRule);if(t instanceof He)return ZU(t);if(YU(t))return JU(t);if(XU(t))return QU(t);throw Error("non exhaustive match")}function JU(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,o=!0;for(;i&&o;)s=n[r],o=Cd(s),e=e.concat(Cc(s)),r=r+1,i=n.length>r;return wm(e)}function QU(t){const e=Z(t.definition,n=>Cc(n));return wm(xn(e))}function ZU(t){return[t.terminalType]}const rR="_~IN~_";class eB extends Ad{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=nB(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),o=new on({definition:s}),a=Cc(o);this.follows[i]=a}}function tB(t){const e={};return ie(t,n=>{const r=new eB(n).startWalking();yn(e,r)}),e}function nB(t,e){return t.name+e+rR}let Id={};const rB=new PT;function Pd(t){const e=t.toString();if(Id.hasOwnProperty(e))return Id[e];{const n=rB.pattern(e);return Id[e]=n,n}}function iB(){Id={}}const iR="Complement Sets are not supported for first char optimization",xd=`Unable to use "first char" lexer optimizations:
13
+ `;function sB(t,e=!1){try{const n=Pd(t);return Tm(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===iR)e&&ZE(`${xd} 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.`),bm(`${xd}
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 Tm(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Tm(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":Nd(o.value,e,n);break;case"Set":if(o.complement===!0)throw Error(iR);ie(o.value,c=>{if(typeof c=="number")Nd(c,e,n);else{const l=c;if(n===!0)for(let u=l.from;u<=l.to;u++)Nd(u,e,n);else{for(let u=l.from;u<=l.to&&u<Ic;u++)Nd(u,e,n);if(l.to>=Ic){const u=l.from>=Ic?l.from:Ic,d=l.to,f=Ci(u),h=Ci(d);for(let p=f;p<=h;p++)e[p]=p}}}});break;case"Group":Tm(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"&&Em(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return _t(e)}function Nd(t,e,n){const r=Ci(t);e[r]=r,n===!0&&oB(t,e)}function oB(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 Ht(e,n);{const r=n;return _o(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Em(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?ke(t.value)?Yn(t.value,Em):Em(t.value):!1}class aB extends ad{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){Ht(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 Rm(t,e){if(e instanceof RegExp){const n=Pd(e),r=new aB(t);return r.visit(n),r.found}else return _o(e,n=>Ht(t,n.charCodeAt(0)))!==void 0}const xs="PATTERN",Ac="defaultMode",Od="modes";let oR=typeof new RegExp("(?:)").sticky=="boolean";function cB(t,e){e=vm(e,{useSticky:oR,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
22
+ `],tracer:(v,T)=>T()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{PB()});let r;n("Reject Lexer.NA",()=>{r=kd(t,v=>v[xs]===ln.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=Z(r,v=>{const T=v[xs];if(Yr(T)){const _=T.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!T.ignoreCase?_:_.length===2&&_[0]==="\\"&&!Ht(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?cR(T):aR(T)}else{if(Hr(T))return i=!0,{exec:T};if(typeof T=="object")return i=!0,T;if(typeof T=="string"){if(T.length===1)return T;{const _=T.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),N=new RegExp(_);return e.useSticky?cR(N):aR(N)}}else throw Error("non exhaustive match")}})});let o,a,c,l,u;n("misc mapping",()=>{o=Z(r,v=>v.tokenTypeIdx),a=Z(r,v=>{const T=v.GROUP;if(T!==ln.SKIPPED){if(sn(T))return T;if(Xr(T))return!1;throw Error("non exhaustive match")}}),c=Z(r,v=>{const T=v.LONGER_ALT;if(T)return ke(T)?Z(T,N=>YE(r,N)):[YE(r,T)]}),l=Z(r,v=>v.PUSH_MODE),u=Z(r,v=>oe(v,"POP_MODE"))});let d;n("Line Terminator Handling",()=>{const v=dR(e.lineTerminatorCharacters);d=Z(r,T=>!1),e.positionTracking!=="onlyOffset"&&(d=Z(r,T=>oe(T,"LINE_BREAKS")?!!T.LINE_BREAKS:uR(T,v)===!1&&Rm(v,T.PATTERN)))});let f,h,p,y;n("Misc Mapping #2",()=>{f=Z(r,lR),h=Z(s,CB),p=Vt(r,(v,T)=>{const _=T.GROUP;return sn(_)&&_!==ln.SKIPPED&&(v[_]=[]),v},{}),y=Z(s,(v,T)=>({pattern:s[T],longerAlt:c[T],canLineTerminator:d[T],isCustom:f[T],short:h[T],group:a[T],push:l[T],pop:u[T],tokenTypeIdx:o[T],tokenType:r[T]}))});let R=!0,b=[];return e.safeMode||n("First Char Optimization",()=>{b=Vt(r,(v,T,_)=>{if(typeof T.PATTERN=="string"){const N=T.PATTERN.charCodeAt(0),F=Ci(N);Sm(v,F,y[_])}else if(ke(T.START_CHARS_HINT)){let N;ie(T.START_CHARS_HINT,F=>{const P=typeof F=="string"?F.charCodeAt(0):F,G=Ci(P);N!==G&&(N=G,Sm(v,G,y[_]))})}else if(Yr(T.PATTERN))if(T.PATTERN.unicode)R=!1,e.ensureOptimizations&&bm(`${xd} Unable to analyze < ${T.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 N=sB(T.PATTERN,e.ensureOptimizations);Be(N)&&(R=!1),ie(N,F=>{Sm(v,F,y[_])})}else e.ensureOptimizations&&bm(`${xd} TokenType: <${T.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`),R=!1;return v},[])}),{emptyGroups:p,patternIdxToConfig:y,charCodeToPatternIdxToConfig:b,hasCustom:i,canBeOptimized:R}}function lB(t,e){let n=[];const r=dB(t);n=n.concat(r.errors);const i=fB(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(uB(s)),n=n.concat(bB(s)),n=n.concat(TB(s,e)),n=n.concat(EB(s)),n}function uB(t){let e=[];const n=vn(t,r=>Yr(r[xs]));return e=e.concat(pB(n)),e=e.concat(yB(n)),e=e.concat(vB(n)),e=e.concat(wB(n)),e=e.concat(gB(n)),e}function dB(t){const e=vn(t,i=>!oe(i,xs)),n=Z(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:ut.MISSING_PATTERN,tokenTypes:[i]})),r=$d(t,e);return{errors:n,valid:r}}function fB(t){const e=vn(t,i=>{const s=i[xs];return!Yr(s)&&!Hr(s)&&!oe(s,"exec")&&!sn(s)}),n=Z(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:ut.INVALID_PATTERN,tokenTypes:[i]})),r=$d(t,e);return{errors:n,valid:r}}const hB=/[^\\][$]/;function pB(t){class e extends ad{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=vn(t,i=>{const s=i.PATTERN;try{const o=Pd(s),a=new e;return a.visit(o),a.found}catch{return hB.test(s.source)}});return Z(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:ut.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function gB(t){const e=vn(t,r=>r.PATTERN.test(""));return Z(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:ut.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const mB=/[^\\[][\^]|^\^/;function yB(t){class e extends ad{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=vn(t,i=>{const s=i.PATTERN;try{const o=Pd(s),a=new e;return a.visit(o),a.found}catch{return mB.test(s.source)}});return Z(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:ut.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function vB(t){const e=vn(t,r=>{const i=r[xs];return i instanceof RegExp&&(i.multiline||i.global)});return Z(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ut.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function wB(t){const e=[];let n=Z(t,s=>Vt(t,(o,a)=>(s.PATTERN.source===a.PATTERN.source&&!Ht(e,a)&&a.PATTERN!==ln.NA&&(e.push(a),o.push(a)),o),[]));n=kc(n);const r=vn(n,s=>s.length>1);return Z(r,s=>{const o=Z(s,c=>c.name);return{message:`The same RegExp pattern ->${Xn(s).PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:ut.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function bB(t){const e=vn(t,r=>{if(!oe(r,"GROUP"))return!1;const i=r.GROUP;return i!==ln.SKIPPED&&i!==ln.NA&&!sn(i)});return Z(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ut.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function TB(t,e){const n=vn(t,i=>i.PUSH_MODE!==void 0&&!Ht(e,i.PUSH_MODE));return Z(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:ut.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function EB(t){const e=[],n=Vt(t,(r,i,s)=>{const o=i.PATTERN;return o===ln.NA||(sn(o)?r.push({str:o,idx:s,tokenType:i}):Yr(o)&&SB(o)&&r.push({str:o.source,idx:s,tokenType:i})),r},[]);return ie(t,(r,i)=>{ie(n,({str:s,idx:o,tokenType:a})=>{if(i<o&&RB(s,r.PATTERN)){const c=`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:c,type:ut.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),e}function RB(t,e){if(Yr(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(Hr(e))return e(t,0,[],{});if(oe(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function SB(t){return _o([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function aR(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function cR(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function $B(t,e,n){const r=[];return oe(t,Ac)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ac+`> property in its definition
34
+ `,type:ut.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),oe(t,Od)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Od+`> property in its definition
35
+ `,type:ut.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),oe(t,Od)&&oe(t,Ac)&&!oe(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Ac}: <${t.defaultMode}>which does not exist
36
+ `,type:ut.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),oe(t,Od)&&ie(t.modes,(i,s)=>{ie(i,(o,a)=>{if(Xr(o))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${a}>
37
+ `,type:ut.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(oe(o,"LONGER_ALT")){const c=ke(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];ie(c,l=>{!Xr(l)&&!Ht(i,l)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${o.name}> outside of mode <${s}>
38
+ `,type:ut.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function kB(t,e,n){const r=[];let i=!1;const s=kc(xn(_t(t.modes))),o=kd(s,c=>c[xs]===ln.NA),a=dR(n);return e&&ie(o,c=>{const l=uR(c,a);if(l!==!1){const d={message:IB(c,l),type:l.issue,tokenType:c};r.push(d)}else oe(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Rm(a,c.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:ut.NO_LINE_BREAKS_FLAGS}),r}function _B(t){const e={},n=Pn(t);return ie(n,r=>{const i=t[r];if(ke(i))e[r]=[];else throw Error("non exhaustive match")}),e}function lR(t){const e=t.PATTERN;if(Yr(e))return!1;if(Hr(e))return!0;if(oe(e,"exec"))return!0;if(sn(e))return!1;throw Error("non exhaustive match")}function CB(t){return sn(t)&&t.length===1?t.charCodeAt(0):!1}const AB={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 uR(t,e){if(oe(t,"LINE_BREAKS"))return!1;if(Yr(t.PATTERN)){try{Rm(e,t.PATTERN)}catch(n){return{issue:ut.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(sn(t.PATTERN))return!1;if(lR(t))return{issue:ut.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function IB(t,e){if(e.issue===ut.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===ut.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 dR(t){return Z(t,n=>sn(n)?n.charCodeAt(0):n)}function Sm(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Ic=256;let Dd=[];function Ci(t){return t<Ic?t:Dd[t]}function PB(){if(Be(Dd)){Dd=new Array(65536);for(let t=0;t<65536;t++)Dd[t]=t>255?255+~~(t/255):t}}function Pc(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function Ld(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let fR=1;const hR={};function xc(t){const e=xB(t);NB(e),DB(e),OB(e),ie(e,n=>{n.isParent=n.categoryMatches.length>0})}function xB(t){let e=Ot(t),n=t,r=!0;for(;r;){n=kc(xn(Z(n,s=>s.CATEGORIES)));const i=$d(n,e);e=e.concat(i),Be(i)?r=!1:n=i}return e}function NB(t){ie(t,e=>{gR(e)||(hR[fR]=e,e.tokenTypeIdx=fR++),mR(e)&&!ke(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),mR(e)||(e.CATEGORIES=[]),LB(e)||(e.categoryMatches=[]),MB(e)||(e.categoryMatchesMap={})})}function OB(t){ie(t,e=>{e.categoryMatches=[],ie(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(hR[r].tokenTypeIdx)})})}function DB(t){ie(t,e=>{pR([],e)})}function pR(t,e){ie(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),ie(e.CATEGORIES,n=>{const r=t.concat(e);Ht(r,n)||pR(r,n)})}function gR(t){return oe(t,"tokenTypeIdx")}function mR(t){return oe(t,"CATEGORIES")}function LB(t){return oe(t,"categoryMatches")}function MB(t){return oe(t,"categoryMatchesMap")}function FB(t){return oe(t,"tokenTypeIdx")}const jB={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 ut;(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"})(ut||(ut={}));const Nc={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
48
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:jB,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Nc);class ln{constructor(e,n=Nc){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:c}=eR(s),l=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(`${o}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}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=yn({},Nc,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===Nc.lineTerminatorsPattern)this.config.lineTerminatorsPattern=AB;else if(this.config.lineTerminatorCharacters===Nc.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),ke(e)?i={modes:{defaultMode:Ot(e)},defaultMode:Ac}:(s=!1,i=Ot(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat($B(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(kB(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},ie(i.modes,(a,c)=>{i.modes[c]=kd(a,l=>Xr(l))});const o=Pn(i.modes);if(ie(i.modes,(a,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(lB(a,o))}),Be(this.lexerDefinitionErrors)){xc(a);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=cB(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=l.charCodeToPatternIdxToConfig,this.emptyGroups=yn({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Be(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=Z(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
51
+ `);throw new Error(`Errors detected in definition of Lexer:
52
+ `+c)}ie(this.lexerDefinitionWarning,a=>{ZE(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(oR?(this.chopInput=_s,this.match=this.matchWithTest):(this.updateLastIndex=kt,this.match=this.matchWithExec),s&&(this.handleModes=kt),this.trackStartLines===!1&&(this.computeNewColumn=_s),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=kt),/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=Vt(this.canModeBeOptimized,(c,l,u)=>(l===!1&&c.push(u),c),[]);if(n.ensureOptimizations&&!Be(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",()=>{iB()}),this.TRACE_INIT("toFastProperties",()=>{tR(this)})})}tokenize(e,n=this.defaultMode){if(!Be(this.lexerDefinitionErrors)){const i=Z(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,c,l,u,d,f,h,p,y,R,b;const v=e,T=v.length;let _=0,N=0;const F=this.hasCustom?0:Math.floor(e.length/10),P=new Array(F),G=[];let B=this.trackStartLines?1:void 0,W=this.trackStartLines?1:void 0;const I=_B(this.emptyGroups),k=this.trackStartLines,S=this.config.lineTerminatorsPattern;let M=0,q=[],j=[];const z=[],J=[];Object.freeze(J);let U;function le(){return q}function tt(je){const ot=Ci(je),yt=j[ot];return yt===void 0?J:yt}const xt=je=>{if(z.length===1&&je.tokenType.PUSH_MODE===void 0){const ot=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(je);G.push({offset:je.startOffset,line:je.startLine,column:je.startColumn,length:je.image.length,message:ot})}else{z.pop();const ot=ko(z);q=this.patternIdxToConfig[ot],j=this.charCodeToPatternIdxToConfig[ot],M=q.length;const yt=this.canModeBeOptimized[ot]&&this.config.safeMode===!1;j&&yt?U=tt:U=le}};function Zt(je){z.push(je),j=this.charCodeToPatternIdxToConfig[je],q=this.patternIdxToConfig[je],M=q.length,M=q.length;const ot=this.canModeBeOptimized[je]&&this.config.safeMode===!1;j&&ot?U=tt:U=le}Zt.call(this,n);let qe;const gn=this.config.recoveryEnabled;for(;_<T;){c=null;const je=v.charCodeAt(_),ot=U(je),yt=ot.length;for(r=0;r<yt;r++){qe=ot[r];const Ue=qe.pattern;l=null;const vt=qe.short;if(vt!==!1?je===vt&&(c=Ue):qe.isCustom===!0?(b=Ue.exec(v,_,P,I),b!==null?(c=b[0],b.payload!==void 0&&(l=b.payload)):c=null):(this.updateLastIndex(Ue,_),c=this.match(Ue,e,_)),c!==null){if(a=qe.longerAlt,a!==void 0){const Je=a.length;for(s=0;s<Je;s++){const he=q[a[s]],nt=he.pattern;if(u=null,he.isCustom===!0?(b=nt.exec(v,_,P,I),b!==null?(o=b[0],b.payload!==void 0&&(u=b.payload)):o=null):(this.updateLastIndex(nt,_),o=this.match(nt,e,_)),o&&o.length>c.length){c=o,l=u,qe=he;break}}}break}}if(c!==null){if(d=c.length,f=qe.group,f!==void 0&&(h=qe.tokenTypeIdx,p=this.createTokenInstance(c,_,h,qe.tokenType,B,W,d),this.handlePayload(p,l),f===!1?N=this.addToken(P,N,p):I[f].push(p)),e=this.chopInput(e,d),_=_+d,W=this.computeNewColumn(W,d),k===!0&&qe.canLineTerminator===!0){let Ue=0,vt,Je;S.lastIndex=0;do vt=S.test(c),vt===!0&&(Je=S.lastIndex-1,Ue++);while(vt===!0);Ue!==0&&(B=B+Ue,W=d-Je,this.updateTokenEndLineColumnLocation(p,f,Je,Ue,B,W,d))}this.handleModes(qe,xt,Zt,p)}else{const Ue=_,vt=B,Je=W;let he=gn===!1;for(;he===!1&&_<T;)for(e=this.chopInput(e,1),_++,i=0;i<M;i++){const nt=q[i],Oe=nt.pattern,Nt=nt.short;if(Nt!==!1?v.charCodeAt(_)===Nt&&(he=!0):nt.isCustom===!0?he=Oe.exec(v,_,P,I)!==null:(this.updateLastIndex(Oe,_),he=Oe.exec(e)!==null),he===!0)break}if(y=_-Ue,W=this.computeNewColumn(W,y),R=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(v,Ue,y,vt,Je),G.push({offset:Ue,line:vt,column:Je,length:y,message:R}),gn===!1)break}}return this.hasCustom||(P.length=N),{tokens:P,groups:I,errors:G}}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 c,l;n!==void 0&&(c=r===a-1,l=c?-1:0,i===1&&c===!0||(e.endLine=s+l,e.endColumn=o-1+-l))}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}}ln.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.",ln.NA=/NOT_APPLICABLE/;function Io(t){return yR(t)?t.LABEL:t.name}function yR(t){return sn(t.LABEL)&&t.LABEL!==""}const UB="parent",vR="categories",wR="label",bR="group",TR="push_mode",ER="pop_mode",RR="longer_alt",SR="line_breaks",$R="start_chars_hint";function kR(t){return BB(t)}function BB(t){const e=t.pattern,n={};if(n.name=t.name,Xr(e)||(n.PATTERN=e),oe(t,UB))throw`The parent property is no longer supported.
57
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return oe(t,vR)&&(n.CATEGORIES=t[vR]),xc([n]),oe(t,wR)&&(n.LABEL=t[wR]),oe(t,bR)&&(n.GROUP=t[bR]),oe(t,ER)&&(n.POP_MODE=t[ER]),oe(t,TR)&&(n.PUSH_MODE=t[TR]),oe(t,RR)&&(n.LONGER_ALT=t[RR]),oe(t,SR)&&(n.LINE_BREAKS=t[SR]),oe(t,$R)&&(n.START_CHARS_HINT=t[$R]),n}const Ai=kR({name:"EOF",pattern:ln.NA});xc([Ai]);function $m(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 _R(t,e){return Pc(t,e)}const Po={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${yR(t)?`--> ${Io(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: '`+Xn(e).image+"'";if(r)return s+r+a;{const c=Vt(t,(f,h)=>f.concat(h),[]),l=Z(c,f=>`[${Z(f,h=>Io(h)).join(", ")}]`),d=`one of these possible Token sequences:
59
+ ${Z(l,(f,h)=>` ${h+1}. ${f}`).join(`
60
+ `)}`;return s+d+a}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",o=`
61
+ but found: '`+Xn(e).image+"'";if(n)return i+n+o;{const c=`expecting at least one iteration which starts with one of these possible Token sequences::
62
+ <${Z(t,l=>`[${Z(l,u=>Io(u)).join(",")}]`).join(" ,")}>`;return i+c+o}}};Object.freeze(Po);const qB={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
63
+ inside top level rule: ->`+t.name+"<-"}},Ns={buildDuplicateFoundError(t,e){function n(u){return u instanceof He?u.terminalType.name:u instanceof Kt?u.nonTerminalName:""}const r=t.name,i=Xn(e),s=i.idx,o=Tr(i),a=n(i),c=s>0;let l=`->${o}${c?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 l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,`
67
+ `),l},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=Z(t.prefixPath,i=>Io(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=Z(t.prefixPath,i=>Io(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=Tr(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=Z(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 Co?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function WB(t,e){const n=new GB(t,e);return n.resolveRefs(),n.errors}class GB extends Ao{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){ie(_t(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:Yt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class zB extends Ad{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=Ot(this.path.ruleStack).reverse(),this.occurrenceStack=Ot(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(){Be(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class HB extends zB{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 on({definition:i});this.possibleTokTypes=Cc(s),this.found=!0}}}class Md extends Ad{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 VB extends Md{walkMany(e,n,r){if(e.idx===this.occurrence){const i=Xn(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof He&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class CR extends Md{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=Xn(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof He&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class KB extends Md{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=Xn(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof He&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class AR extends Md{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Xn(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof He&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function km(t,e,n=[]){n=Ot(n);let r=[],i=0;function s(a){return a.concat(Dt(t,i+1))}function o(a){const c=km(s(a),e,n);return r.concat(c)}for(;n.length<e&&i<t.length;){const a=t[i];if(a instanceof on)return o(a.definition);if(a instanceof Kt)return o(a.definition);if(a instanceof Lt)r=o(a.definition);else if(a instanceof bn){const c=a.definition.concat([new lt({definition:a.definition})]);return o(c)}else if(a instanceof Tn){const c=[new on({definition:a.definition}),new lt({definition:[new He({terminalType:a.separator})].concat(a.definition)})];return o(c)}else if(a instanceof an){const c=a.definition.concat([new lt({definition:[new He({terminalType:a.separator})].concat(a.definition)})]);r=o(c)}else if(a instanceof lt){const c=a.definition.concat([new lt({definition:a.definition})]);r=o(c)}else{if(a instanceof cn)return ie(a.definition,c=>{Be(c.definition)===!1&&(r=o(c.definition))}),r;if(a instanceof He)n.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:Dt(t,i)}),r}function IR(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const c=e.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Be(d);){const f=d.pop();if(f===o){a&&ko(d).idx<=l&&d.pop();continue}const h=f.def,p=f.idx,y=f.ruleStack,R=f.occurrenceStack;if(Be(h))continue;const b=h[0];if(b===i){const v={idx:p,def:Dt(h),ruleStack:_c(y),occurrenceStack:_c(R)};d.push(v)}else if(b instanceof He)if(p<c-1){const v=p+1,T=e[v];if(n(T,b.terminalType)){const _={idx:v,def:Dt(h),ruleStack:y,occurrenceStack:R};d.push(_)}}else if(p===c-1)u.push({nextTokenType:b.terminalType,nextTokenOccurrence:b.idx,ruleStack:y,occurrenceStack:R}),a=!0;else throw Error("non exhaustive match");else if(b instanceof Kt){const v=Ot(y);v.push(b.nonTerminalName);const T=Ot(R);T.push(b.idx);const _={idx:p,def:b.definition.concat(s,Dt(h)),ruleStack:v,occurrenceStack:T};d.push(_)}else if(b instanceof Lt){const v={idx:p,def:Dt(h),ruleStack:y,occurrenceStack:R};d.push(v),d.push(o);const T={idx:p,def:b.definition.concat(Dt(h)),ruleStack:y,occurrenceStack:R};d.push(T)}else if(b instanceof bn){const v=new lt({definition:b.definition,idx:b.idx}),T=b.definition.concat([v],Dt(h)),_={idx:p,def:T,ruleStack:y,occurrenceStack:R};d.push(_)}else if(b instanceof Tn){const v=new He({terminalType:b.separator}),T=new lt({definition:[v].concat(b.definition),idx:b.idx}),_=b.definition.concat([T],Dt(h)),N={idx:p,def:_,ruleStack:y,occurrenceStack:R};d.push(N)}else if(b instanceof an){const v={idx:p,def:Dt(h),ruleStack:y,occurrenceStack:R};d.push(v),d.push(o);const T=new He({terminalType:b.separator}),_=new lt({definition:[T].concat(b.definition),idx:b.idx}),N=b.definition.concat([_],Dt(h)),F={idx:p,def:N,ruleStack:y,occurrenceStack:R};d.push(F)}else if(b instanceof lt){const v={idx:p,def:Dt(h),ruleStack:y,occurrenceStack:R};d.push(v),d.push(o);const T=new lt({definition:b.definition,idx:b.idx}),_=b.definition.concat([T],Dt(h)),N={idx:p,def:_,ruleStack:y,occurrenceStack:R};d.push(N)}else if(b instanceof cn)for(let v=b.definition.length-1;v>=0;v--){const T=b.definition[v],_={idx:p,def:T.definition.concat(Dt(h)),ruleStack:y,occurrenceStack:R};d.push(_),d.push(o)}else if(b instanceof on)d.push({idx:p,def:b.definition.concat(Dt(h)),ruleStack:y,occurrenceStack:R});else if(b instanceof Co)d.push(YB(b,p,y,R));else throw Error("non exhaustive match")}return u}function YB(t,e,n,r){const i=Ot(n);i.push(t.name);const s=Ot(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var rt;(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"})(rt||(rt={}));function _m(t){if(t instanceof Lt||t==="Option")return rt.OPTION;if(t instanceof lt||t==="Repetition")return rt.REPETITION;if(t instanceof bn||t==="RepetitionMandatory")return rt.REPETITION_MANDATORY;if(t instanceof Tn||t==="RepetitionMandatoryWithSeparator")return rt.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof an||t==="RepetitionWithSeparator")return rt.REPETITION_WITH_SEPARATOR;if(t instanceof cn||t==="Alternation")return rt.ALTERNATION;throw Error("non exhaustive match")}function PR(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=_m(r);return s===rt.ALTERNATION?Fd(e,n,i):jd(e,n,s,i)}function XB(t,e,n,r,i,s){const o=Fd(t,e,n),a=DR(o)?Ld:Pc;return s(o,r,a,i)}function JB(t,e,n,r,i,s){const o=jd(t,e,i,n),a=DR(o)?Ld:Pc;return s(o[0],a,r)}function QB(t,e,n,r){const i=t.length,s=Yn(t,o=>Yn(o,a=>a.length===1));if(e)return function(o){const a=Z(o,c=>c.GATE);for(let c=0;c<i;c++){const l=t[c],u=l.length,d=a[c];if(!(d!==void 0&&d.call(this)===!1))e:for(let f=0;f<u;f++){const h=l[f],p=h.length;for(let y=0;y<p;y++){const R=this.LA(y+1);if(n(R,h[y])===!1)continue e}return c}}};if(s&&!r){const o=Z(t,c=>xn(c)),a=Vt(o,(c,l,u)=>(ie(l,d=>{oe(c,d.tokenTypeIdx)||(c[d.tokenTypeIdx]=u),ie(d.categoryMatches,f=>{oe(c,f)||(c[f]=u)})}),c),{});return function(){const c=this.LA(1);return a[c.tokenTypeIdx]}}else return function(){for(let o=0;o<i;o++){const a=t[o],c=a.length;e:for(let l=0;l<c;l++){const u=a[l],d=u.length;for(let f=0;f<d;f++){const h=this.LA(f+1);if(n(h,u[f])===!1)continue e}return o}}}}function ZB(t,e,n){const r=Yn(t,s=>s.length===1),i=t.length;if(r&&!n){const s=xn(t);if(s.length===1&&Be(s[0].categoryMatches)){const a=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{const o=Vt(s,(a,c,l)=>(a[c.tokenTypeIdx]=!0,ie(c.categoryMatches,u=>{a[u]=!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 c=0;c<a;c++){const l=this.LA(c+1);if(e(l,o[c])===!1)continue e}return!0}return!1}}class e4 extends Ad{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,rt.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,rt.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,rt.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,rt.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,rt.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class xR extends Ao{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,rt.OPTION)}visitRepetition(e){this.checkIsTarget(e,rt.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,rt.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,rt.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,rt.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,rt.ALTERNATION)}}function NR(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function Cm(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 c="_"+r.categoryMatches[a];i.push(o+c)}}e=i}return e}function t4(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 OR(t,e){const n=Z(t,o=>km([o],1)),r=NR(n.length),i=Z(n,o=>{const a={};return ie(o,c=>{const l=Cm(c.partialPath);ie(l,u=>{a[u]=!0})}),a});let s=n;for(let o=1;o<=e;o++){const a=s;s=NR(a.length);for(let c=0;c<a.length;c++){const l=a[c];for(let u=0;u<l.length;u++){const d=l[u].partialPath,f=l[u].suffixDef,h=Cm(d);if(t4(i,h,c)||Be(f)||d.length===e){const y=r[c];if(Am(y,d)===!1){y.push(d);for(let R=0;R<h.length;R++){const b=h[R];i[c][b]=!0}}}else{const y=km(f,o+1,d);s[c]=s[c].concat(y),ie(y,R=>{const b=Cm(R.partialPath);ie(b,v=>{i[c][v]=!0})})}}}}return r}function Fd(t,e,n,r){const i=new xR(t,rt.ALTERNATION,r);return e.accept(i),OR(i.result,n)}function jd(t,e,n,r){const i=new xR(t,n);e.accept(i);const s=i.result,a=new e4(e,t,n).startWalking(),c=new on({definition:s}),l=new on({definition:a});return OR([c,l],r)}function Am(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 n4(t,e){return t.length<e.length&&Yn(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function DR(t){return Yn(t,e=>Yn(e,n=>Yn(n,r=>Be(r.categoryMatches))))}function r4(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return Z(e,n=>Object.assign({type:Yt.CUSTOM_LOOKAHEAD_VALIDATION},n))}function i4(t,e,n,r){const i=wn(t,c=>s4(c,n)),s=y4(t,e,n),o=wn(t,c=>h4(c,n)),a=wn(t,c=>c4(c,t,r,n));return i.concat(s,o,a)}function s4(t,e){const n=new a4;t.accept(n);const r=n.allProductions,i=bU(r,o4),s=Jn(i,a=>a.length>1);return Z(_t(s),a=>{const c=Xn(a),l=e.buildDuplicateFoundError(t,a),u=Tr(c),d={message:l,type:Yt.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:u,occurrence:c.idx},f=LR(c);return f&&(d.parameter=f),d})}function o4(t){return`${Tr(t)}_#_${t.idx}_#_${LR(t)}`}function LR(t){return t instanceof He?t.terminalType.name:t instanceof Kt?t.nonTerminalName:""}class a4 extends Ao{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 c4(t,e,n,r){const i=[];if(Vt(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:Yt.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function l4(t,e,n){const r=[];let i;return Ht(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:Yt.INVALID_RULE_OVERRIDE,ruleName:t})),r}function MR(t,e,n,r=[]){const i=[],s=Ud(e.definition);if(Be(s))return[];{const o=t.name;Ht(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:Yt.LEFT_RECURSION,ruleName:o});const c=$d(s,r.concat([t])),l=wn(c,u=>{const d=Ot(r);return d.push(u),MR(t,u,n,d)});return i.concat(l)}}function Ud(t){let e=[];if(Be(t))return e;const n=Xn(t);if(n instanceof Kt)e.push(n.referencedRule);else if(n instanceof on||n instanceof Lt||n instanceof bn||n instanceof Tn||n instanceof an||n instanceof lt)e=e.concat(Ud(n.definition));else if(n instanceof cn)e=xn(Z(n.definition,s=>Ud(s.definition)));else if(!(n instanceof He))throw Error("non exhaustive match");const r=Cd(n),i=t.length>1;if(r&&i){const s=Dt(t);return e.concat(Ud(s))}else return e}class Im extends Ao{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function u4(t,e){const n=new Im;t.accept(n);const r=n.alternations;return wn(r,s=>{const o=_c(s.definition);return wn(o,(a,c)=>{const l=IR([a],[],Pc,1);return Be(l)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:c}),type:Yt.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:c+1}]:[]})})}function d4(t,e,n){const r=new Im;t.accept(r);let i=r.alternations;return i=kd(i,o=>o.ignoreAmbiguities===!0),wn(i,o=>{const a=o.idx,c=o.maxLookahead||e,l=Fd(a,t,c,o),u=g4(l,o,t,n),d=m4(l,o,t,n);return u.concat(d)})}class f4 extends Ao{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 h4(t,e){const n=new Im;t.accept(n);const r=n.alternations;return wn(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:Yt.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function p4(t,e,n){const r=[];return ie(t,i=>{const s=new f4;i.accept(s);const o=s.allProductions;ie(o,a=>{const c=_m(a),l=a.maxLookahead||e,u=a.idx,f=jd(u,i,c,l)[0];if(Be(xn(f))){const h=n.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:h,type:Yt.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function g4(t,e,n,r){const i=[],s=Vt(t,(a,c,l)=>(e.definition[l].ignoreAmbiguities===!0||ie(c,u=>{const d=[l];ie(t,(f,h)=>{l!==h&&Am(f,u)&&e.definition[h].ignoreAmbiguities!==!0&&d.push(h)}),d.length>1&&!Am(i,u)&&(i.push(u),a.push({alts:d,path:u}))}),a),[]);return Z(s,a=>{const c=Z(a.alts,u=>u+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:Yt.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:a.alts}})}function m4(t,e,n,r){const i=Vt(t,(o,a,c)=>{const l=Z(a,u=>({idx:c,path:u}));return o.concat(l)},[]);return kc(wn(i,o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];const c=o.idx,l=o.path,u=vn(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<c&&n4(f.path,l));return Z(u,f=>{const h=[f.idx+1,c+1],p=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:h,prefixPath:f.path}),type:Yt.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:p,alternatives:h}})}))}function y4(t,e,n){const r=[],i=Z(e,s=>s.name);return ie(t,s=>{const o=s.name;if(Ht(i,o)){const a=n.buildNamespaceConflictError(s);r.push({message:a,type:Yt.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),r}function v4(t){const e=vm(t,{errMsgProvider:qB}),n={};return ie(t.rules,r=>{n[r.name]=r}),WB(n,e.errMsgProvider)}function w4(t){return t=vm(t,{errMsgProvider:Ns}),i4(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const FR="MismatchedTokenException",jR="NoViableAltException",UR="EarlyExitException",BR="NotAllInputParsedException",qR=[FR,jR,UR,BR];Object.freeze(qR);function Bd(t){return Ht(qR,t.name)}class qd 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 WR extends qd{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=FR}}class b4 extends qd{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=jR}}class T4 extends qd{constructor(e,n){super(e,n),this.name=BR}}class E4 extends qd{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=UR}}const Pm={},GR="InRuleRecoveryException";class R4 extends Error{constructor(e){super(e),this.name=GR}}class S4{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=oe(e,"recoveryEnabled")?e.recoveryEnabled:Jr.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=$4)}getTokenToInsert(e){const n=$m(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 c=!1;const l=this.LA(1);let u=this.LA(1);const d=()=>{const f=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:f,ruleName:this.getCurrRuleFullName()}),p=new WR(h,l,this.LA(0));p.resyncedTokens=_c(a),this.SAVE_ERROR(p)};for(;!c;)if(this.tokenMatcher(u,i)){d();return}else if(r.call(this)){d(),e.apply(this,n);return}else this.tokenMatcher(u,s)?c=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,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 R4("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||Be(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 Ht(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=_o(e,s=>_R(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Pm;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 Z(e,(r,i)=>i===0?Pm:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=Z(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return xn(e)}getFollowSetFromFollowKey(e){if(e===Pm)return[Ai];const n=e.ruleName+e.idxInCallingRule+rR+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 _c(n)}attemptInRepetitionRecovery(e,n,r,i,s,o,a){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=Ot(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return Z(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function $4(t,e,n,r,i,s,o){const a=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[a];if(c===void 0){const f=this.getCurrRuleFullName(),h=this.getGAstProductions()[f];c=new s(h,i).startWalking(),this.firstAfterRepMap[a]=c}let l=c.token,u=c.occurrence;const d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&l===void 0&&(l=Ai,u=1),!(l===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(l,u,o)&&this.tryInRepetitionRecovery(t,e,n,l)}const k4=4,Ii=8,zR=1<<Ii,HR=2<<Ii,xm=3<<Ii,Nm=4<<Ii,Om=5<<Ii,Wd=6<<Ii;function Dm(t,e,n){return n|e|t}class Lm{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:Jr.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(Be(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 wn(e,n=>MR(n,n,Ns))}validateEmptyOrAlternatives(e){return wn(e,n=>u4(n,Ns))}validateAmbiguousAlternationAlternatives(e,n){return wn(e,r=>d4(r,n,Ns))}validateSomeNonEmptyLookaheadPath(e,n){return p4(e,n,Ns)}buildLookaheadForAlternation(e){return XB(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,QB)}buildLookaheadForOptional(e){return JB(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,_m(e.prodType),ZB)}}class _4{initLooksAhead(e){this.dynamicTokensEnabled=oe(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Jr.dynamicTokensEnabled,this.maxLookahead=oe(e,"maxLookahead")?e.maxLookahead:Jr.maxLookahead,this.lookaheadStrategy=oe(e,"lookaheadStrategy")?e.lookaheadStrategy:new Lm({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){ie(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=A4(n);ie(r,l=>{const u=l.idx===0?"":l.idx;this.TRACE_INIT(`${Tr(l)}${u}`,()=>{const d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:l.idx,rule:n,maxLookahead:l.maxLookahead||this.maxLookahead,hasPredicates:l.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=Dm(this.fullRuleNameToShort[n.name],zR,l.idx);this.setLaFuncCache(f,d)})}),ie(i,l=>{this.computeLookaheadFunc(n,l.idx,xm,"Repetition",l.maxLookahead,Tr(l))}),ie(s,l=>{this.computeLookaheadFunc(n,l.idx,HR,"Option",l.maxLookahead,Tr(l))}),ie(o,l=>{this.computeLookaheadFunc(n,l.idx,Nm,"RepetitionMandatory",l.maxLookahead,Tr(l))}),ie(a,l=>{this.computeLookaheadFunc(n,l.idx,Wd,"RepetitionMandatoryWithSeparator",l.maxLookahead,Tr(l))}),ie(c,l=>{this.computeLookaheadFunc(n,l.idx,Om,"RepetitionWithSeparator",l.maxLookahead,Tr(l))})})})}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}),c=Dm(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return Dm(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class C4 extends Ao{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 Gd=new C4;function A4(t){Gd.reset(),t.accept(Gd);const e=Gd.dslMethods;return Gd.reset(),e}function VR(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function KR(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 I4(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function P4(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const x4="name";function YR(t,e){Object.defineProperty(t,x4,{enumerable:!1,configurable:!0,writable:!1,value:e})}function N4(t,e){const n=Pn(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],o=t[s],a=o.length;for(let c=0;c<a;c++){const l=o[c];l.tokenTypeIdx===void 0&&this[l.name](l.children,e)}}}function O4(t,e){const n=function(){};YR(n,t+"BaseSemantics");const r={visit:function(i,s){if(ke(i)&&(i=i[0]),!Xr(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=L4(this,e);if(!Be(i)){const s=Z(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 D4(t,e,n){const r=function(){};YR(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return ie(e,s=>{i[s]=N4}),r.prototype=i,r.prototype.constructor=r,r}var Mm;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Mm||(Mm={}));function L4(t,e){return M4(t,e)}function M4(t,e){const n=vn(e,i=>Hr(t[i])===!1),r=Z(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:Mm.MISSING_METHOD,methodName:i}));return kc(r)}class F4{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=oe(e,"nodeLocationTracking")?e.nodeLocationTracking:Jr.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=kt,this.cstFinallyStateUpdate=kt,this.cstPostTerminal=kt,this.cstPostNonTerminal=kt,this.cstPostRule=kt;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=KR,this.setNodeLocationFromNode=KR,this.cstPostRule=kt,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=kt,this.setNodeLocationFromNode=kt,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=VR,this.setNodeLocationFromNode=VR,this.cstPostRule=kt,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=kt,this.setNodeLocationFromNode=kt,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=kt,this.setNodeLocationFromNode=kt,this.cstPostRule=kt,this.setInitialNodeLocation=kt;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];I4(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];P4(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(Xr(this.baseCstVisitorConstructor)){const e=O4(this.className,Pn(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Xr(this.baseCstVisitorWithDefaultsConstructor)){const e=D4(this.className,Pn(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 j4{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)):Vd}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?Vd: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 U4{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=Kd){if(Ht(this.definedRulesNames,e)){const o={message:Ns.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Yt.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=Kd){const i=l4(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(Bd(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return KU(_t(this.gastProductionsCache))}}class B4{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ld,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},oe(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(ke(e)){if(Be(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(ke(e))this.tokensMap=Vt(e,(s,o)=>(s[o.name]=o,s),{});else if(oe(e,"modes")&&Yn(xn(_t(e.modes)),FB)){const s=xn(_t(e.modes)),o=wm(s);this.tokensMap=Vt(o,(a,c)=>(a[c.name]=c,a),{})}else if(In(e))this.tokensMap=Ot(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=oe(e,"modes")?xn(_t(e.modes)):_t(e),i=Yn(r,s=>Be(s.categoryMatches));this.tokenMatcher=i?Ld:Pc,xc(_t(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=oe(r,"resyncEnabled")?r.resyncEnabled:Kd.resyncEnabled,s=oe(r,"recoveryValueFunc")?r.recoveryValueFunc:Kd.recoveryValueFunc,o=this.ruleShortNameIdx<<k4+Ii;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let a;return this.outputCst===!0?a=function(...u){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,u);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(...u){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,u)}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(Bd(e)){const o=e;if(s){const a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(o.resyncedTokens=this.reSyncTo(a),this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return r(e);else{if(this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,o.partialCstResult=c}throw o}}else{if(i)return this.moveToTerminatedState(),r(e);throw o}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(HR,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(Nm,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,rt.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,Nm,e,KB)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Wd,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,AR],a,Wd,e,AR)}else throw this.raiseEarlyExitException(e,rt.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(xm,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 c=i;i=()=>a.call(this)&&c.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,xm,e,VB,o)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Om,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,CR],a,Om,e,CR)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,Wd,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(zR,n),i=ke(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 T4(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 Bd(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 WR(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===GR?r:s}}else throw r}saveRecogState(){const e=this.errors,n=Ot(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 q4{initErrorHandler(e){this._errors=[],this.errorMessageProvider=oe(e,"errorMessageProvider")?e.errorMessageProvider:Jr.errorMessageProvider}SAVE_ERROR(e){if(Bd(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Ot(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Ot(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],a=jd(e,s,n,this.maxLookahead)[0],c=[];for(let u=1;u<=this.maxLookahead;u++)c.push(this.LA(u));const l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:c,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new E4(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=Fd(e,i,this.maxLookahead),o=[];for(let l=1;l<=this.maxLookahead;l++)o.push(this.LA(l));const a=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:a,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new b4(c,this.LA(1),a))}}class W4{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(Xr(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return IR([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=Xn(e.ruleStack),i=this.getGAstProductions()[n];return new HB(i,e).startWalking()}}const zd={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(zd);const XR=!0,JR=Math.pow(2,Ii)-1,QR=kR({name:"RECORDING_PHASE_TOKEN",pattern:ln.NA});xc([QR]);const ZR=$m(QR,`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(ZR);const G4={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 z4{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 Vd}topLevelRuleRecord(e,n){try{const r=new Co({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 Oc.call(this,Lt,e,n)}atLeastOneInternalRecord(e,n){Oc.call(this,bn,n,e)}atLeastOneSepFirstInternalRecord(e,n){Oc.call(this,Tn,n,e,XR)}manyInternalRecord(e,n){Oc.call(this,lt,n,e)}manySepFirstInternalRecord(e,n){Oc.call(this,an,n,e,XR)}orInternalRecord(e,n){return H4.call(this,e,n)}subruleInternalRecord(e,n,r){if(Hd(n),!e||oe(e,"ruleName")===!1){const a=new Error(`<SUBRULE${eS(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=ko(this.recordingProdStack),s=e.ruleName,o=new Kt({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?G4:zd}consumeInternalRecord(e,n,r){if(Hd(n),!gR(e)){const o=new Error(`<CONSUME${eS(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=ko(this.recordingProdStack),s=new He({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),ZR}}function Oc(t,e,n,r=!1){Hd(n);const i=ko(this.recordingProdStack),s=Hr(e)?e:e.DEF,o=new t({definition:[],idx:n});return r&&(o.separator=e.SEP),oe(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),zd}function H4(t,e){Hd(e);const n=ko(this.recordingProdStack),r=ke(t)===!1,i=r===!1?t:t.DEF,s=new cn({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});oe(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const o=JE(i,a=>Hr(a.GATE));return s.hasPredicates=o,n.definition.push(s),ie(i,a=>{const c=new on({definition:[]});s.definition.push(c),oe(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:oe(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),zd}function eS(t){return t===0?"":`${t}`}function Hd(t){if(t<0||t>JR){const e=new Error(`Invalid DSL Method idx value: <${t}>
105
+ Idx value must be a none negative value smaller than ${JR+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class V4{initPerformanceTracer(e){if(oe(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=Jr.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}=eR(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 K4(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 Vd=$m(Ai,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Vd);const Jr=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Po,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Kd=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Yt;(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"})(Yt||(Yt={}));function tS(t=void 0){return function(){return t}}class bu{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",()=>{tR(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),ie(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=v4({rules:_t(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(Be(r)&&this.skipValidations===!1){const i=w4({rules:_t(this.gastProductionsCache),tokenTypes:_t(this.tokensMap),errMsgProvider:Ns,grammarName:n}),s=r4({lookaheadStrategy:this.lookaheadStrategy,rules:_t(this.gastProductionsCache),tokenTypes:_t(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),Be(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=tB(_t(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:_t(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(_t(this.gastProductionsCache))})),!bu.DEFER_DEFINITION_ERRORS_HANDLING&&!Be(this.definitionErrors))throw e=Z(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),oe(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=oe(n,"skipValidations")?n.skipValidations:Jr.skipValidations}}bu.DEFER_DEFINITION_ERRORS_HANDLING=!1,K4(bu,[S4,_4,F4,j4,B4,U4,q4,W4,z4,V4]);class Y4 extends bu{constructor(e,n=Jr){const r=Ot(n);r.outputCst=!1,super(e,r)}}function xo(t,e,n){return`${t.name}_${e}_${n}`}const Pi=1,X4=2,nS=4,rS=5,Dc=7,J4=8,Q4=9,Z4=10,e5=11,iS=12;class Fm{constructor(e){this.target=e}isEpsilon(){return!1}}class jm extends Fm{constructor(e,n){super(e),this.tokenType=n}}class sS extends Fm{constructor(e){super(e)}isEpsilon(){return!0}}class Um extends Fm{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function t5(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};n5(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Os(e,i,i);s!==void 0&&h5(e,i,s)}return e}function n5(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=It(t,i,void 0,{type:X4}),o=It(t,i,void 0,{type:Dc});s.stop=o,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,o)}}function oS(t,e,n){return n instanceof He?Bm(t,e,n.terminalType,n):n instanceof Kt?f5(t,e,n):n instanceof cn?a5(t,e,n):n instanceof Lt?c5(t,e,n):n instanceof lt?r5(t,e,n):n instanceof an?i5(t,e,n):n instanceof bn?s5(t,e,n):n instanceof Tn?o5(t,e,n):Os(t,e,n)}function r5(t,e,n){const r=It(t,e,n,{type:rS});xi(t,r);const i=No(t,e,r,n,Os(t,e,n));return cS(t,e,n,i)}function i5(t,e,n){const r=It(t,e,n,{type:rS});xi(t,r);const i=No(t,e,r,n,Os(t,e,n)),s=Bm(t,e,n.separator,n);return cS(t,e,n,i,s)}function s5(t,e,n){const r=It(t,e,n,{type:nS});xi(t,r);const i=No(t,e,r,n,Os(t,e,n));return aS(t,e,n,i)}function o5(t,e,n){const r=It(t,e,n,{type:nS});xi(t,r);const i=No(t,e,r,n,Os(t,e,n)),s=Bm(t,e,n.separator,n);return aS(t,e,n,i,s)}function a5(t,e,n){const r=It(t,e,n,{type:Pi});xi(t,r);const i=Z(n.definition,o=>oS(t,e,o));return No(t,e,r,n,...i)}function c5(t,e,n){const r=It(t,e,n,{type:Pi});xi(t,r);const i=No(t,e,r,n,Os(t,e,n));return l5(t,e,n,i)}function Os(t,e,n){const r=vn(Z(n.definition,i=>oS(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:d5(t,r)}function aS(t,e,n,r,i){const s=r.left,o=r.right,a=It(t,e,n,{type:e5});xi(t,a);const c=It(t,e,n,{type:iS});return s.loopback=a,c.loopback=a,t.decisionMap[xo(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=a,Tt(o,a),i===void 0?(Tt(a,s),Tt(a,c)):(Tt(a,c),Tt(a,i.left),Tt(i.right,s)),{left:s,right:c}}function cS(t,e,n,r,i){const s=r.left,o=r.right,a=It(t,e,n,{type:Z4});xi(t,a);const c=It(t,e,n,{type:iS}),l=It(t,e,n,{type:Q4});return a.loopback=l,c.loopback=l,Tt(a,s),Tt(a,c),Tt(o,l),i!==void 0?(Tt(l,c),Tt(l,i.left),Tt(i.right,s)):Tt(l,a),t.decisionMap[xo(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=a,{left:a,right:c}}function l5(t,e,n,r){const i=r.left,s=r.right;return Tt(i,s),t.decisionMap[xo(e,"Option",n.idx)]=i,r}function xi(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function No(t,e,n,r,...i){const s=It(t,e,r,{type:J4,start:n});n.end=s;for(const a of i)a!==void 0?(Tt(n,a.left),Tt(a.right,s)):Tt(n,s);const o={left:n,right:s};return t.decisionMap[xo(e,u5(r),r.idx)]=n,o}function u5(t){if(t instanceof cn)return"Alternation";if(t instanceof Lt)return"Option";if(t instanceof lt)return"Repetition";if(t instanceof an)return"RepetitionWithSeparator";if(t instanceof bn)return"RepetitionMandatory";if(t instanceof Tn)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function d5(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 c=a instanceof Um,l=a,u=e[s+1].left;o.left.type===Pi&&o.right.type===Pi&&a!==void 0&&(c&&l.followState===o.right||a.target===o.right)?(c?l.followState=u:a.target=u,p5(t,o.right)):Tt(o.right,u)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function Bm(t,e,n,r){const i=It(t,e,r,{type:Pi}),s=It(t,e,r,{type:Pi});return qm(i,new jm(s,n)),{left:i,right:s}}function f5(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.get(r),s=It(t,e,n,{type:Pi}),o=It(t,e,n,{type:Pi}),a=new Um(i,r,o);return qm(s,a),{left:s,right:o}}function h5(t,e,n){const r=t.ruleToStartState.get(e);Tt(r,n.left);const i=t.ruleToStopState.get(e);return Tt(n.right,i),{left:r,right:i}}function Tt(t,e){const n=new sS(e);qm(t,n)}function It(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 qm(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function p5(t,e){t.states.splice(t.states.indexOf(e),1)}const Yd={};class Wm{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=lS(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return Z(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function lS(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function g5(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 uS{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 dS=new uS;class m5 extends Lm{constructor(e){var n;super(),this.logging=(n=e?.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=t5(e.rules),this.dfas=y5(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,c=xo(r,"Alternation",n),u=this.atn.decisionMap[c].decision,d=Z(PR({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),f=>Z(f,h=>h[0]));if(fS(d,!1)&&!s){const f=Vt(d,(h,p,y)=>(ie(p,R=>{R&&(h[R.tokenTypeIdx]=y,ie(R.categoryMatches,b=>{h[b]=y}))}),h),{});return i?function(h){var p;const y=this.LA(1),R=f[y.tokenTypeIdx];if(h!==void 0&&R!==void 0){const b=(p=h[R])===null||p===void 0?void 0:p.GATE;if(b!==void 0&&b.call(this)===!1)return}return R}:function(){const h=this.LA(1);return f[h.tokenTypeIdx]}}else return i?function(f){const h=new uS,p=f===void 0?0:f.length;for(let R=0;R<p;R++){const b=f?.[R].GATE;h.set(R,b===void 0||b.call(this))}const y=Gm.call(this,o,u,h,a);return typeof y=="number"?y:void 0}:function(){const f=Gm.call(this,o,u,dS,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,c=xo(r,i,n),u=this.atn.decisionMap[c].decision,d=Z(PR({maxLookahead:1,occurrence:n,prodType:i,rule:r}),f=>Z(f,h=>h[0]));if(fS(d)&&d[0][0]&&!s){const f=d[0],h=xn(f);if(h.length===1&&Be(h[0].categoryMatches)){const y=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===y}}else{const p=Vt(h,(y,R)=>(R!==void 0&&(y[R.tokenTypeIdx]=!0,ie(R.categoryMatches,b=>{y[b]=!0})),y),{});return function(){const y=this.LA(1);return p[y.tokenTypeIdx]===!0}}}return function(){const f=Gm.call(this,o,u,dS,a);return typeof f=="object"?!1:f===0}}}function fS(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 y5(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=g5(t.decisionStates[r],r);return n}function Gm(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const a=C5(i.atnStartState);s=gS(i,hS(a)),i.start=s}return v5.apply(this,[i,s,n,r])}function v5(t,e,n,r){let i=e,s=1;const o=[];let a=this.LA(s++);for(;;){let c=S5(i,a);if(c===void 0&&(c=w5.apply(this,[t,i,a,s,n,r])),c===Yd)return R5(o,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,o.push(a),a=this.LA(s++)}}function w5(t,e,n,r,i,s){const o=$5(e.configs,n,i);if(o.size===0)return pS(t,e,n,Yd),Yd;let a=hS(o);const c=_5(o,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(x5(o)){const l=DU(o.alts);a.isAcceptState=!0,a.prediction=l,a.configs.uniqueAlt=l,b5.apply(this,[t,r,o.alts,s])}return a=pS(t,e,n,a),a}function b5(t,e,n,r){const i=[];for(let l=1;l<=e;l++)i.push(this.LA(l).tokenType);const s=t.atnStartState,o=s.rule,a=s.production,c=T5({topLevelRule:o,ambiguityIndices:n,production:a,prefixPath:i});r(c)}function T5(t){const e=Z(t.prefixPath,i=>Io(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${E5(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 E5(t){if(t instanceof Kt)return"SUBRULE";if(t instanceof Lt)return"OPTION";if(t instanceof cn)return"OR";if(t instanceof bn)return"AT_LEAST_ONE";if(t instanceof Tn)return"AT_LEAST_ONE_SEP";if(t instanceof an)return"MANY_SEP";if(t instanceof lt)return"MANY";if(t instanceof He)return"CONSUME";throw Error("non exhaustive match")}function R5(t,e,n){const r=wn(e.configs.elements,s=>s.state.transitions),i=zU(r.filter(s=>s instanceof jm).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function S5(t,e){return t.edges[e.tokenTypeIdx]}function $5(t,e,n){const r=new Wm,i=[];for(const o of t.elements){if(n.is(o.alt)===!1)continue;if(o.state.type===Dc){i.push(o);continue}const a=o.state.transitions.length;for(let c=0;c<a;c++){const l=o.state.transitions[c],u=k5(l,e);u!==void 0&&r.add({state:u,alt:o.alt,stack:o.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new Wm;for(const o of r.elements)Xd(o,s)}if(i.length>0&&!I5(s))for(const o of i)s.add(o);return s}function k5(t,e){if(t instanceof jm&&_R(e,t.tokenType))return t.target}function _5(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 hS(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function pS(t,e,n,r){return r=gS(t,r),e.edges[n.tokenTypeIdx]=r,r}function gS(t,e){if(e===Yd)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 C5(t){const e=new Wm,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};Xd(s,e)}return e}function Xd(t,e){const n=t.state;if(n.type===Dc){if(t.stack.length>0){const i=[...t.stack],o={state:i.pop(),alt:t.alt,stack:i};Xd(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=A5(t,s);o!==void 0&&Xd(o,e)}}function A5(t,e){if(e instanceof sS)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Um){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function I5(t){for(const e of t.elements)if(e.state.type===Dc)return!0;return!1}function P5(t){for(const e of t.elements)if(e.state.type!==Dc)return!1;return!0}function x5(t){if(P5(t))return!0;const e=N5(t.elements);return O5(e)&&!D5(e)}function N5(t){const e=new Map;for(const n of t){const r=lS(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function O5(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function D5(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var mS;(function(t){function e(n){return typeof n=="string"}t.is=e})(mS||(mS={}));var zm;(function(t){function e(n){return typeof n=="string"}t.is=e})(zm||(zm={}));var yS;(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})(yS||(yS={}));var Jd;(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})(Jd||(Jd={}));var xe;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Jd.MAX_VALUE),i===Number.MAX_VALUE&&(i=Jd.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return O.objectLiteral(i)&&O.uinteger(i.line)&&O.uinteger(i.character)}t.is=n})(xe||(xe={}));var Ee;(function(t){function e(r,i,s,o){if(O.uinteger(r)&&O.uinteger(i)&&O.uinteger(s)&&O.uinteger(o))return{start:xe.create(r,i),end:xe.create(s,o)};if(xe.is(r)&&xe.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 O.objectLiteral(i)&&xe.is(i.start)&&xe.is(i.end)}t.is=n})(Ee||(Ee={}));var Qd;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return O.objectLiteral(i)&&Ee.is(i.range)&&(O.string(i.uri)||O.undefined(i.uri))}t.is=n})(Qd||(Qd={}));var vS;(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 O.objectLiteral(i)&&Ee.is(i.targetRange)&&O.string(i.targetUri)&&Ee.is(i.targetSelectionRange)&&(Ee.is(i.originSelectionRange)||O.undefined(i.originSelectionRange))}t.is=n})(vS||(vS={}));var Hm;(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 O.objectLiteral(i)&&O.numberRange(i.red,0,1)&&O.numberRange(i.green,0,1)&&O.numberRange(i.blue,0,1)&&O.numberRange(i.alpha,0,1)}t.is=n})(Hm||(Hm={}));var wS;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return O.objectLiteral(i)&&Ee.is(i.range)&&Hm.is(i.color)}t.is=n})(wS||(wS={}));var bS;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return O.objectLiteral(i)&&O.string(i.label)&&(O.undefined(i.textEdit)||Xt.is(i))&&(O.undefined(i.additionalTextEdits)||O.typedArray(i.additionalTextEdits,Xt.is))}t.is=n})(bS||(bS={}));var TS;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(TS||(TS={}));var ES;(function(t){function e(r,i,s,o,a,c){const l={startLine:r,endLine:i};return O.defined(s)&&(l.startCharacter=s),O.defined(o)&&(l.endCharacter=o),O.defined(a)&&(l.kind=a),O.defined(c)&&(l.collapsedText=c),l}t.create=e;function n(r){const i=r;return O.objectLiteral(i)&&O.uinteger(i.startLine)&&O.uinteger(i.startLine)&&(O.undefined(i.startCharacter)||O.uinteger(i.startCharacter))&&(O.undefined(i.endCharacter)||O.uinteger(i.endCharacter))&&(O.undefined(i.kind)||O.string(i.kind))}t.is=n})(ES||(ES={}));var Vm;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return O.defined(i)&&Qd.is(i.location)&&O.string(i.message)}t.is=n})(Vm||(Vm={}));var Lc;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Lc||(Lc={}));var RS;(function(t){t.Unnecessary=1,t.Deprecated=2})(RS||(RS={}));var SS;(function(t){function e(n){const r=n;return O.objectLiteral(r)&&O.string(r.href)}t.is=e})(SS||(SS={}));var Zd;(function(t){function e(r,i,s,o,a,c){let l={range:r,message:i};return O.defined(s)&&(l.severity=s),O.defined(o)&&(l.code=o),O.defined(a)&&(l.source=a),O.defined(c)&&(l.relatedInformation=c),l}t.create=e;function n(r){var i;let s=r;return O.defined(s)&&Ee.is(s.range)&&O.string(s.message)&&(O.number(s.severity)||O.undefined(s.severity))&&(O.integer(s.code)||O.string(s.code)||O.undefined(s.code))&&(O.undefined(s.codeDescription)||O.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(O.string(s.source)||O.undefined(s.source))&&(O.undefined(s.relatedInformation)||O.typedArray(s.relatedInformation,Vm.is))}t.is=n})(Zd||(Zd={}));var Oo;(function(t){function e(r,i,...s){let o={title:r,command:i};return O.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function n(r){let i=r;return O.defined(i)&&O.string(i.title)&&O.string(i.command)}t.is=n})(Oo||(Oo={}));var Xt;(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 O.objectLiteral(o)&&O.string(o.newText)&&Ee.is(o.range)}t.is=i})(Xt||(Xt={}));var Km;(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 O.objectLiteral(i)&&O.string(i.label)&&(O.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(O.string(i.description)||i.description===void 0)}t.is=n})(Km||(Km={}));var Do;(function(t){function e(n){const r=n;return O.string(r)}t.is=e})(Do||(Do={}));var $S;(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 Xt.is(o)&&(Km.is(o.annotationId)||Do.is(o.annotationId))}t.is=i})($S||($S={}));var Ym;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return O.defined(i)&&ey.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(Ym||(Ym={}));var Xm;(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"&&O.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||O.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||O.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Do.is(i.annotationId))}t.is=n})(Xm||(Xm={}));var Jm;(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"&&O.string(i.oldUri)&&O.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||O.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||O.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Do.is(i.annotationId))}t.is=n})(Jm||(Jm={}));var Qm;(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"&&O.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||O.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||O.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Do.is(i.annotationId))}t.is=n})(Qm||(Qm={}));var Zm;(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=>O.string(i.kind)?Xm.is(i)||Jm.is(i)||Qm.is(i):Ym.is(i)))}t.is=e})(Zm||(Zm={}));var kS;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return O.defined(i)&&O.string(i.uri)}t.is=n})(kS||(kS={}));var _S;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return O.defined(i)&&O.string(i.uri)&&O.integer(i.version)}t.is=n})(_S||(_S={}));var ey;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return O.defined(i)&&O.string(i.uri)&&(i.version===null||O.integer(i.version))}t.is=n})(ey||(ey={}));var CS;(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 O.defined(i)&&O.string(i.uri)&&O.string(i.languageId)&&O.integer(i.version)&&O.string(i.text)}t.is=n})(CS||(CS={}));var ty;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(ty||(ty={}));var Mc;(function(t){function e(n){const r=n;return O.objectLiteral(n)&&ty.is(r.kind)&&O.string(r.value)}t.is=e})(Mc||(Mc={}));var Er;(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})(Er||(Er={}));var AS;(function(t){t.PlainText=1,t.Snippet=2})(AS||(AS={}));var IS;(function(t){t.Deprecated=1})(IS||(IS={}));var PS;(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&&O.string(i.newText)&&Ee.is(i.insert)&&Ee.is(i.replace)}t.is=n})(PS||(PS={}));var xS;(function(t){t.asIs=1,t.adjustIndentation=2})(xS||(xS={}));var NS;(function(t){function e(n){const r=n;return r&&(O.string(r.detail)||r.detail===void 0)&&(O.string(r.description)||r.description===void 0)}t.is=e})(NS||(NS={}));var OS;(function(t){function e(n){return{label:n}}t.create=e})(OS||(OS={}));var DS;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(DS||(DS={}));var ef;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return O.string(i)||O.objectLiteral(i)&&O.string(i.language)&&O.string(i.value)}t.is=n})(ef||(ef={}));var LS;(function(t){function e(n){let r=n;return!!r&&O.objectLiteral(r)&&(Mc.is(r.contents)||ef.is(r.contents)||O.typedArray(r.contents,ef.is))&&(n.range===void 0||Ee.is(n.range))}t.is=e})(LS||(LS={}));var MS;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(MS||(MS={}));var FS;(function(t){function e(n,r,...i){let s={label:n};return O.defined(r)&&(s.documentation=r),O.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(FS||(FS={}));var jS;(function(t){t.Text=1,t.Read=2,t.Write=3})(jS||(jS={}));var US;(function(t){function e(n,r){let i={range:n};return O.number(r)&&(i.kind=r),i}t.create=e})(US||(US={}));var Qn;(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})(Qn||(Qn={}));var BS;(function(t){t.Deprecated=1})(BS||(BS={}));var qS;(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})(qS||(qS={}));var WS;(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})(WS||(WS={}));var GS;(function(t){function e(r,i,s,o,a,c){let l={name:r,detail:i,kind:s,range:o,selectionRange:a};return c!==void 0&&(l.children=c),l}t.create=e;function n(r){let i=r;return i&&O.string(i.name)&&O.number(i.kind)&&Ee.is(i.range)&&Ee.is(i.selectionRange)&&(i.detail===void 0||O.string(i.detail))&&(i.deprecated===void 0||O.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(GS||(GS={}));var zS;(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"})(zS||(zS={}));var tf;(function(t){t.Invoked=1,t.Automatic=2})(tf||(tf={}));var HS;(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 O.defined(i)&&O.typedArray(i.diagnostics,Zd.is)&&(i.only===void 0||O.typedArray(i.only,O.string))&&(i.triggerKind===void 0||i.triggerKind===tf.Invoked||i.triggerKind===tf.Automatic)}t.is=n})(HS||(HS={}));var VS;(function(t){function e(r,i,s){let o={title:r},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Oo.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&&O.string(i.title)&&(i.diagnostics===void 0||O.typedArray(i.diagnostics,Zd.is))&&(i.kind===void 0||O.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Oo.is(i.command))&&(i.isPreferred===void 0||O.boolean(i.isPreferred))&&(i.edit===void 0||Zm.is(i.edit))}t.is=n})(VS||(VS={}));var KS;(function(t){function e(r,i){let s={range:r};return O.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return O.defined(i)&&Ee.is(i.range)&&(O.undefined(i.command)||Oo.is(i.command))}t.is=n})(KS||(KS={}));var YS;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return O.defined(i)&&O.uinteger(i.tabSize)&&O.boolean(i.insertSpaces)}t.is=n})(YS||(YS={}));var XS;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return O.defined(i)&&Ee.is(i.range)&&(O.undefined(i.target)||O.string(i.target))}t.is=n})(XS||(XS={}));var JS;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return O.objectLiteral(i)&&Ee.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(JS||(JS={}));var Pe;(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"})(Pe||(Pe={}));var it;(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"})(it||(it={}));var QS;(function(t){function e(n){const r=n;return O.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})(QS||(QS={}));var ZS;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&Ee.is(i.range)&&O.string(i.text)}t.is=n})(ZS||(ZS={}));var e$;(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&&Ee.is(i.range)&&O.boolean(i.caseSensitiveLookup)&&(O.string(i.variableName)||i.variableName===void 0)}t.is=n})(e$||(e$={}));var t$;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&Ee.is(i.range)&&(O.string(i.expression)||i.expression===void 0)}t.is=n})(t$||(t$={}));var n$;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return O.defined(i)&&Ee.is(r.stoppedLocation)}t.is=n})(n$||(n$={}));var ny;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(ny||(ny={}));var ry;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return O.objectLiteral(i)&&(i.tooltip===void 0||O.string(i.tooltip)||Mc.is(i.tooltip))&&(i.location===void 0||Qd.is(i.location))&&(i.command===void 0||Oo.is(i.command))}t.is=n})(ry||(ry={}));var r$;(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 O.objectLiteral(i)&&xe.is(i.position)&&(O.string(i.label)||O.typedArray(i.label,ry.is))&&(i.kind===void 0||ny.is(i.kind))&&i.textEdits===void 0||O.typedArray(i.textEdits,Xt.is)&&(i.tooltip===void 0||O.string(i.tooltip)||Mc.is(i.tooltip))&&(i.paddingLeft===void 0||O.boolean(i.paddingLeft))&&(i.paddingRight===void 0||O.boolean(i.paddingRight))}t.is=n})(r$||(r$={}));var i$;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(i$||(i$={}));var s$;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(s$||(s$={}));var o$;(function(t){function e(n){return{items:n}}t.create=e})(o$||(o$={}));var a$;(function(t){t.Invoked=0,t.Automatic=1})(a$||(a$={}));var c$;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(c$||(c$={}));var l$;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(l$||(l$={}));var u$;(function(t){function e(n){const r=n;return O.objectLiteral(r)&&zm.is(r.uri)&&O.string(r.name)}t.is=e})(u$||(u$={}));var d$;(function(t){function e(s,o,a,c){return new L5(s,o,a,c)}t.create=e;function n(s){let o=s;return!!(O.defined(o)&&O.string(o.uri)&&(O.undefined(o.languageId)||O.string(o.languageId))&&O.uinteger(o.lineCount)&&O.func(o.getText)&&O.func(o.positionAt)&&O.func(o.offsetAt))}t.is=n;function r(s,o){let a=s.getText(),c=i(o,(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),l=a.length;for(let u=c.length-1;u>=0;u--){let d=c[u],f=s.offsetAt(d.range.start),h=s.offsetAt(d.range.end);if(h<=l)a=a.substring(0,f)+d.newText+a.substring(h,a.length);else throw new Error("Overlapping edit");l=f}return a}t.applyEdits=r;function i(s,o){if(s.length<=1)return s;const a=s.length/2|0,c=s.slice(0,a),l=s.slice(a);i(c,o),i(l,o);let u=0,d=0,f=0;for(;u<c.length&&d<l.length;)o(c[u],l[d])<=0?s[f++]=c[u++]:s[f++]=l[d++];for(;u<c.length;)s[f++]=c[u++];for(;d<l.length;)s[f++]=l[d++];return s}})(d$||(d$={}));let L5=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 xe.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 xe.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 O;(function(t){const e=Object.prototype.toString;function n(h){return typeof h<"u"}t.defined=n;function r(h){return typeof h>"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function o(h){return e.call(h)==="[object Number]"}t.number=o;function a(h,p,y){return e.call(h)==="[object Number]"&&p<=h&&h<=y}t.numberRange=a;function c(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=c;function l(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=l;function u(h){return e.call(h)==="[object Function]"}t.func=u;function d(h){return h!==null&&typeof h=="object"}t.objectLiteral=d;function f(h,p){return Array.isArray(h)&&h.every(p)}t.typedArray=f})(O||(O={}));class M5{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new h$(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new sy;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new iy(e.startOffset,e.image.length,Gu(e),e.tokenType,!1);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)}}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)}addHiddenTokens(e){for(const n of e){const r=new iy(n.startOffset,n.image.length,Gu(n),n.tokenType,!0);r.root=this.rootNode,this.addHiddenToken(this.rootNode,r)}}addHiddenToken(e,n){const{offset:r,end:i}=n;for(let s=0;s<e.content.length;s++){const o=e.content[s],{offset:a,end:c}=o;if(Br(o)&&r>a&&i<c){this.addHiddenToken(o,n);return}else if(i<=a){e.content.splice(s,0,n);return}}e.content.push(n)}}class f${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 iy extends f${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 sy extends f${constructor(){super(...arguments),this.content=new Sb(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:xe.create(0,0),end:xe.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 Sb extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,Sb.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 h$ extends sy{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const oy=Symbol("Datatype");function ay(t){return t.$type===oy}const p$="\u200B",g$=t=>t.endsWith(p$)?t:t+p$;class m${constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition;this.wrapper=new q5(n,Object.assign(Object.assign({},e.parser.ParserConfig),{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 F5 extends m${get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new M5,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(g$(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(ud(e))return oy;{const n=ks(e);return n??e.name}}}parse(e,n={}){this.nodeBuilder.buildRootNode(e);const r=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.addHiddenTokens(r.hidden),this.unorderedGroups.clear(),{value:s,lexerErrors:r.errors,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{if(!this.isRecording()){const s={$type:e};this.stack.push(s),e===oy&&(s.value="")}let i;try{i=n(r)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.nodeBuilder.buildLeafNode(i,r),{assignment:o,isCrossRef:a}=this.getAssignment(r),c=this.current;if(o){const l=gr(r)?i.image:this.converter.convert(i.image,s);this.assign(o.operator,o.feature,l,s,a)}else if(ay(c)){let l=i.image;gr(r)||(l=this.converter.convert(l,s).toString()),c.value+=l}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i){let s;this.isRecording()||(s=this.nodeBuilder.buildCompositeNode(r));const o=this.wrapper.wrapSubrule(e,n,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(o,r,s)}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(ay(o))o.value+=e.toString();else if(typeof e=="object"&&e){const a=e.$type,c=this.assignWithoutOverride(e,o);a&&(c.$type=a);const l=c;this.stack.pop(),this.stack.push(l)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.operator){r=this.construct(),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 xg(e),this.nodeBuilder.construct(e),this.stack.pop(),ay(e)?this.converter.convert(e.value,e.$cstNode):(Dg(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=rn(e,pr);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?Za(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 j5{buildMismatchTokenMessage(e){return Po.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Po.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Po.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Po.buildEarlyExitMessage(e)}}class y$ extends j5{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 U5 extends m${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);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(g$(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){this.before(r),this.wrapper.wrapSubrule(e,n,i),this.after(r)}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 B5={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new y$};class q5 extends Y4{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},B5),{lookaheadStrategy:r?new Lm({maxLookahead:n.maxLookahead}):new m5}),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 v$(t,e,n){return W5({parser:e,tokens:n,ruleNames:new Map},t),e}function W5(t,e){const n=Ug(e,!1),r=Le(e.rules).filter(Ut).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,Ds(s,i.definition))}}function Ds(t,e,n=!1){let r;if(gr(e))r=X5(t,e);else if($s(e))r=G5(t,e);else if(pr(e))r=Ds(t,e.terminal);else if(Za(e))r=w$(t,e);else if(Wr(e))r=z5(t,e);else if(Ig(e))r=V5(t,e);else if(Pg(e))r=K5(t,e);else if($i(e))r=Y5(t,e);else if(FL(e)){const i=t.consume++;r=()=>t.parser.consume(i,Ai,e)}else throw new bT(e.$cstNode,`Unexpected element type: ${e.$type}`);return b$(t,n?void 0:nf(e),r,e.cardinality)}function G5(t,e){const n=gc(e);return()=>t.parser.action(n,e)}function z5(t,e){const n=e.rule.ref;if(Ut(n)){const r=t.subrule++,i=e.arguments.length>0?H5(n,e.arguments):()=>({});return s=>t.parser.subrule(r,T$(t,n),e,i(s))}else if(qr(n)){const r=t.consume++,i=cy(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)Vu();else throw new bT(e.$cstNode,`Undefined rule type: ${e.$type}`)}function H5(t,e){const n=e.map(r=>Qr(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 Qr(t){if(PL(t)){const e=Qr(t.left),n=Qr(t.right);return r=>e(r)||n(r)}else if(IL(t)){const e=Qr(t.left),n=Qr(t.right);return r=>e(r)&&n(r)}else if(xL(t)){const e=Qr(t.value);return n=>!e(n)}else if(NL(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(AL(t)){const e=!!t.true;return()=>e}Vu()}function V5(t,e){if(e.elements.length===1)return Ds(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:Ds(t,i,!0)},o=nf(i);o&&(s.GATE=Qr(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 K5(t,e){if(e.elements.length===1)return Ds(t,e.elements[0]);const n=[];for(const a of e.elements){const c={ALT:Ds(t,a,!0)},l=nf(a);l&&(c.GATE=Qr(l)),n.push(c)}const r=t.or++,i=(a,c)=>{const l=c.getRuleStack().join("-");return`uGroup_${a}_${l}`},s=a=>t.parser.alternatives(r,n.map((c,l)=>{const u={ALT:()=>!0},d=t.parser;u.ALT=()=>{if(c.ALT(a),!d.isRecording()){const h=i(r,d);d.unorderedGroups.get(h)||d.unorderedGroups.set(h,[]);const p=d.unorderedGroups.get(h);typeof p?.[l]>"u"&&(p[l]=!0)}};const f=c.GATE;return f?u.GATE=()=>f(a):u.GATE=()=>{const h=d.unorderedGroups.get(i(r,d));return!h?.[l]},u})),o=b$(t,nf(e),s,"*");return a=>{o(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function Y5(t,e){const n=e.elements.map(r=>Ds(t,r));return r=>n.forEach(i=>i(r))}function nf(t){if($i(t))return t.guardCondition}function w$(t,e,n=e.terminal){if(n)if(Wr(n)&&Ut(n.rule.ref)){const r=t.subrule++;return i=>t.parser.subrule(r,T$(t,n.rule.ref),e,i)}else if(Wr(n)&&qr(n.rule.ref)){const r=t.consume++,i=cy(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(gr(n)){const r=t.consume++,i=cy(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=zg(e.type.ref),i=r?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+gc(e.type.ref));return w$(t,e,i)}}function X5(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 b$(t,e,n,r){const i=e&&Qr(e);if(!r)if(i){const s=t.or++;return o=>t.parser.alternatives(s,[{ALT:()=>n(o),GATE:()=>i(o)},{ALT:tS(),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:tS(),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 Vu()}function T$(t,e){const n=J5(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function J5(t,e){if(Ut(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!Ut(r);)($i(r)||Ig(r)||Pg(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 cy(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function Q5(t){const e=t.Grammar,n=t.parser.Lexer,r=new U5(t);return v$(e,r,n.definition),r.finalize(),r}function Z5(t){const e=eq(t);return e.finalize(),e}function eq(t){const e=t.Grammar,n=t.parser.Lexer,r=new F5(t);return v$(e,r,n.definition)}class tq{buildTokens(e,n){const r=Le(Ug(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&&jg(a)?s.unshift(o):s.push(o)}),s}buildTerminalTokens(e){return e.filter(qr).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=mc(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=jg(n)?ln.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")?!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(Ut).flatMap(i=>mr(i).filter(gr)).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){return{name:e.value,PATTERN:this.buildKeywordPattern(e,r),LONGER_ALT:this.findLongerAlt(e,n)}}buildKeywordPattern(e,n){return n?new RegExp(ZL(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&eM("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class nq{convert(e,n){let r=n.grammarSource;if(Za(r)&&(r=Bg(r)),Wr(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 Zr.convertInt(n);case"STRING":return Zr.convertString(n);case"ID":return Zr.convertID(n)}switch((i=qT(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Zr.convertNumber(n);case"boolean":return Zr.convertBoolean(n);case"bigint":return Zr.convertBigint(n);case"date":return Zr.convertDate(n);default:return n}}}var Zr;(function(t){function e(l){let u="";for(let d=1;d<l.length-1;d++){const f=l.charAt(d);if(f==="\\"){const h=l.charAt(++d);u+=n(h)}else u+=f}return u}t.convertString=e;function n(l){switch(l){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 l}}function r(l){return l.charAt(0)==="^"?l.substring(1):l}t.convertID=r;function i(l){return parseInt(l)}t.convertInt=i;function s(l){return BigInt(l)}t.convertBigint=s;function o(l){return new Date(l)}t.convertDate=o;function a(l){return Number(l)}t.convertNumber=a;function c(l){return l.toLowerCase()==="true"}t.convertBoolean=c})(Zr||(Zr={}));var Ni={},ei={};Object.defineProperty(ei,"__esModule",{value:!0});let ly;function uy(){if(ly===void 0)throw new Error("No runtime abstraction layer installed");return ly}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");ly=n}t.install=e})(uy||(uy={})),ei.default=uy;var Et={};Object.defineProperty(Et,"__esModule",{value:!0}),Et.stringArray=Et.array=Et.func=Et.error=Et.number=Et.string=Et.boolean=void 0;function rq(t){return t===!0||t===!1}Et.boolean=rq;function E$(t){return typeof t=="string"||t instanceof String}Et.string=E$;function iq(t){return typeof t=="number"||t instanceof Number}Et.number=iq;function sq(t){return t instanceof Error}Et.error=sq;function oq(t){return typeof t=="function"}Et.func=oq;function R$(t){return Array.isArray(t)}Et.array=R$;function aq(t){return R$(t)&&t.every(e=>E$(e))}Et.stringArray=aq;var Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});var S$=Rr.Emitter=Rr.Event=void 0;const cq=ei;var $$;(function(t){const e={dispose(){}};t.None=function(){return e}})($$||(Rr.Event=$$={}));class lq{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{n.push(r[s].apply(i[s],e))}catch(a){(0,cq.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}let k$=class hN{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new lq),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=hN._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};S$=Rr.Emitter=k$,k$._noop=function(){};var Qe;Object.defineProperty(Ni,"__esModule",{value:!0});var dy=Ni.CancellationTokenSource=Qe=Ni.CancellationToken=void 0;const uq=ei,dq=Et,fy=Rr;var rf;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:fy.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:fy.Event.None});function e(n){const r=n;return r&&(r===t.None||r===t.Cancelled||dq.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(rf||(Qe=Ni.CancellationToken=rf={}));const fq=Object.freeze(function(t,e){const n=(0,uq.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}});class _${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?fq:(this._emitter||(this._emitter=new fy.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class hq{get token(){return this._token||(this._token=new _$),this._token}cancel(){this._token?this._token.cancel():this._token=rf.Cancelled}dispose(){this._token?this._token instanceof _$&&this._token.dispose():this._token=rf.None}}dy=Ni.CancellationTokenSource=hq;function pq(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let C$=0,gq=10;const sf=Symbol("OperationCancelled");function of(t){return t===sf}async function Pt(t){if(t===Qe.None)return;const e=Date.now();if(e-C$>=gq&&(C$=e,await pq()),t.isCancellationRequested)throw sf}class hy{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class Tu{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(Tu.isIncremental(r)){const i=I$(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),c=Math.max(i.end.line,0);let l=this._lineOffsets;const u=A$(r.text,!1,s);if(c-a===u.length)for(let f=0,h=u.length;f<h;f++)l[f+a+1]=u[f];else u.length<1e4?l.splice(a+1,c-a,...u):this._lineOffsets=l=l.slice(0,a+1).concat(u,l.slice(c+1));const d=r.text.length-(o-s);if(d!==0)for(let f=a+1+u.length,h=l.length;f<h;f++)l[f]=l[f]+d}else if(Tu.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=A$(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 af;(function(t){function e(i,s,o,a){return new Tu(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Tu)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=py(s.map(mq),(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),c=0;const l=[];for(const u of a){let d=i.offsetAt(u.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&l.push(o.substring(c,d)),u.newText.length&&l.push(u.newText),c=i.offsetAt(u.range.end)}return l.push(o.substr(c)),l.join("")}t.applyEdits=r})(af||(af={}));function py(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);py(r,e),py(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 A$(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 I$(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 mq(t){const e=I$(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var P$;(()=>{var t={470:i=>{function s(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function o(c,l){for(var u,d="",f=0,h=-1,p=0,y=0;y<=c.length;++y){if(y<c.length)u=c.charCodeAt(y);else{if(u===47)break;u=47}if(u===47){if(!(h===y-1||p===1))if(h!==y-1&&p===2){if(d.length<2||f!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var R=d.lastIndexOf("/");if(R!==d.length-1){R===-1?(d="",f=0):f=(d=d.slice(0,R)).length-1-d.lastIndexOf("/"),h=y,p=0;continue}}else if(d.length===2||d.length===1){d="",f=0,h=y,p=0;continue}}l&&(d.length>0?d+="/..":d="..",f=2)}else d.length>0?d+="/"+c.slice(h+1,y):d=c.slice(h+1,y),f=y-h-1;h=y,p=0}else u===46&&p!==-1?++p:p=-1}return d}var a={resolve:function(){for(var c,l="",u=!1,d=arguments.length-1;d>=-1&&!u;d--){var f;d>=0?f=arguments[d]:(c===void 0&&(c=process.cwd()),f=c),s(f),f.length!==0&&(l=f+"/"+l,u=f.charCodeAt(0)===47)}return l=o(l,!u),u?l.length>0?"/"+l:"/":l.length>0?l:"."},normalize:function(c){if(s(c),c.length===0)return".";var l=c.charCodeAt(0)===47,u=c.charCodeAt(c.length-1)===47;return(c=o(c,!l)).length!==0||l||(c="."),c.length>0&&u&&(c+="/"),l?"/"+c:c},isAbsolute:function(c){return s(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,l=0;l<arguments.length;++l){var u=arguments[l];s(u),u.length>0&&(c===void 0?c=u:c+="/"+u)}return c===void 0?".":a.normalize(c)},relative:function(c,l){if(s(c),s(l),c===l||(c=a.resolve(c))===(l=a.resolve(l)))return"";for(var u=1;u<c.length&&c.charCodeAt(u)===47;++u);for(var d=c.length,f=d-u,h=1;h<l.length&&l.charCodeAt(h)===47;++h);for(var p=l.length-h,y=f<p?f:p,R=-1,b=0;b<=y;++b){if(b===y){if(p>y){if(l.charCodeAt(h+b)===47)return l.slice(h+b+1);if(b===0)return l.slice(h+b)}else f>y&&(c.charCodeAt(u+b)===47?R=b:b===0&&(R=0));break}var v=c.charCodeAt(u+b);if(v!==l.charCodeAt(h+b))break;v===47&&(R=b)}var T="";for(b=u+R+1;b<=d;++b)b!==d&&c.charCodeAt(b)!==47||(T.length===0?T+="..":T+="/..");return T.length>0?T+l.slice(h+R):(h+=R,l.charCodeAt(h)===47&&++h,l.slice(h))},_makeLong:function(c){return c},dirname:function(c){if(s(c),c.length===0)return".";for(var l=c.charCodeAt(0),u=l===47,d=-1,f=!0,h=c.length-1;h>=1;--h)if((l=c.charCodeAt(h))===47){if(!f){d=h;break}}else f=!1;return d===-1?u?"/":".":u&&d===1?"//":c.slice(0,d)},basename:function(c,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');s(c);var u,d=0,f=-1,h=!0;if(l!==void 0&&l.length>0&&l.length<=c.length){if(l.length===c.length&&l===c)return"";var p=l.length-1,y=-1;for(u=c.length-1;u>=0;--u){var R=c.charCodeAt(u);if(R===47){if(!h){d=u+1;break}}else y===-1&&(h=!1,y=u+1),p>=0&&(R===l.charCodeAt(p)?--p==-1&&(f=u):(p=-1,f=y))}return d===f?f=y:f===-1&&(f=c.length),c.slice(d,f)}for(u=c.length-1;u>=0;--u)if(c.charCodeAt(u)===47){if(!h){d=u+1;break}}else f===-1&&(h=!1,f=u+1);return f===-1?"":c.slice(d,f)},extname:function(c){s(c);for(var l=-1,u=0,d=-1,f=!0,h=0,p=c.length-1;p>=0;--p){var y=c.charCodeAt(p);if(y!==47)d===-1&&(f=!1,d=p+1),y===46?l===-1?l=p:h!==1&&(h=1):l!==-1&&(h=-1);else if(!f){u=p+1;break}}return l===-1||d===-1||h===0||h===1&&l===d-1&&l===u+1?"":c.slice(l,d)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return function(l,u){var d=u.dir||u.root,f=u.base||(u.name||"")+(u.ext||"");return d?d===u.root?d+f:d+"/"+f:f}(0,c)},parse:function(c){s(c);var l={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return l;var u,d=c.charCodeAt(0),f=d===47;f?(l.root="/",u=1):u=0;for(var h=-1,p=0,y=-1,R=!0,b=c.length-1,v=0;b>=u;--b)if((d=c.charCodeAt(b))!==47)y===-1&&(R=!1,y=b+1),d===46?h===-1?h=b:v!==1&&(v=1):h!==-1&&(v=-1);else if(!R){p=b+1;break}return h===-1||y===-1||v===0||v===1&&h===y-1&&h===p+1?y!==-1&&(l.base=l.name=p===0&&f?c.slice(1,y):c.slice(p,y)):(p===0&&f?(l.name=c.slice(1,h),l.base=c.slice(1,y)):(l.name=c.slice(p,h),l.base=c.slice(p,y)),l.ext=c.slice(h,y)),p>0?l.dir=c.slice(0,p-1):f&&(l.dir="/"),l},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:()=>W}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,o=/^\//,a=/^\/\//;function c(I,k){if(!I.scheme&&k)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${I.authority}", path: "${I.path}", query: "${I.query}", fragment: "${I.fragment}"}`);if(I.scheme&&!s.test(I.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(I.path){if(I.authority){if(!o.test(I.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(I.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const l="",u="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri(k){return k instanceof f||!!k&&typeof k.authority=="string"&&typeof k.fragment=="string"&&typeof k.path=="string"&&typeof k.query=="string"&&typeof k.scheme=="string"&&typeof k.fsPath=="string"&&typeof k.with=="function"&&typeof k.toString=="function"}scheme;authority;path;query;fragment;constructor(k,S,M,q,j,z=!1){typeof k=="object"?(this.scheme=k.scheme||l,this.authority=k.authority||l,this.path=k.path||l,this.query=k.query||l,this.fragment=k.fragment||l):(this.scheme=function(J,U){return J||U?J:"file"}(k,z),this.authority=S||l,this.path=function(J,U){switch(J){case"https":case"http":case"file":U?U[0]!==u&&(U=u+U):U=u}return U}(this.scheme,M||l),this.query=q||l,this.fragment=j||l,c(this,z))}get fsPath(){return v(this)}with(k){if(!k)return this;let{scheme:S,authority:M,path:q,query:j,fragment:z}=k;return S===void 0?S=this.scheme:S===null&&(S=l),M===void 0?M=this.authority:M===null&&(M=l),q===void 0?q=this.path:q===null&&(q=l),j===void 0?j=this.query:j===null&&(j=l),z===void 0?z=this.fragment:z===null&&(z=l),S===this.scheme&&M===this.authority&&q===this.path&&j===this.query&&z===this.fragment?this:new p(S,M,q,j,z)}static parse(k,S=!1){const M=d.exec(k);return M?new p(M[2]||l,F(M[4]||l),F(M[5]||l),F(M[7]||l),F(M[9]||l),S):new p(l,l,l,l,l)}static file(k){let S=l;if(i&&(k=k.replace(/\\/g,u)),k[0]===u&&k[1]===u){const M=k.indexOf(u,2);M===-1?(S=k.substring(2),k=u):(S=k.substring(2,M),k=k.substring(M)||u)}return new p("file",S,k,l,l)}static from(k){const S=new p(k.scheme,k.authority,k.path,k.query,k.fragment);return c(S,!0),S}toString(k=!1){return T(this,k)}toJSON(){return this}static revive(k){if(k){if(k instanceof f)return k;{const S=new p(k);return S._formatted=k.external,S._fsPath=k._sep===h?k.fsPath:null,S}}return k}}const h=i?1:void 0;class p extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString(k=!1){return k?T(this,!0):(this._formatted||(this._formatted=T(this,!1)),this._formatted)}toJSON(){const k={$mid:1};return this._fsPath&&(k.fsPath=this._fsPath,k._sep=h),this._formatted&&(k.external=this._formatted),this.path&&(k.path=this.path),this.scheme&&(k.scheme=this.scheme),this.authority&&(k.authority=this.authority),this.query&&(k.query=this.query),this.fragment&&(k.fragment=this.fragment),k}}const y={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 R(I,k,S){let M,q=-1;for(let j=0;j<I.length;j++){const z=I.charCodeAt(j);if(z>=97&&z<=122||z>=65&&z<=90||z>=48&&z<=57||z===45||z===46||z===95||z===126||k&&z===47||S&&z===91||S&&z===93||S&&z===58)q!==-1&&(M+=encodeURIComponent(I.substring(q,j)),q=-1),M!==void 0&&(M+=I.charAt(j));else{M===void 0&&(M=I.substr(0,j));const J=y[z];J!==void 0?(q!==-1&&(M+=encodeURIComponent(I.substring(q,j)),q=-1),M+=J):q===-1&&(q=j)}}return q!==-1&&(M+=encodeURIComponent(I.substring(q))),M!==void 0?M:I}function b(I){let k;for(let S=0;S<I.length;S++){const M=I.charCodeAt(S);M===35||M===63?(k===void 0&&(k=I.substr(0,S)),k+=y[M]):k!==void 0&&(k+=I[S])}return k!==void 0?k:I}function v(I,k){let S;return S=I.authority&&I.path.length>1&&I.scheme==="file"?`//${I.authority}${I.path}`:I.path.charCodeAt(0)===47&&(I.path.charCodeAt(1)>=65&&I.path.charCodeAt(1)<=90||I.path.charCodeAt(1)>=97&&I.path.charCodeAt(1)<=122)&&I.path.charCodeAt(2)===58?I.path[1].toLowerCase()+I.path.substr(2):I.path,i&&(S=S.replace(/\//g,"\\")),S}function T(I,k){const S=k?b:R;let M="",{scheme:q,authority:j,path:z,query:J,fragment:U}=I;if(q&&(M+=q,M+=":"),(j||q==="file")&&(M+=u,M+=u),j){let le=j.indexOf("@");if(le!==-1){const tt=j.substr(0,le);j=j.substr(le+1),le=tt.lastIndexOf(":"),le===-1?M+=S(tt,!1,!1):(M+=S(tt.substr(0,le),!1,!1),M+=":",M+=S(tt.substr(le+1),!1,!0)),M+="@"}j=j.toLowerCase(),le=j.lastIndexOf(":"),le===-1?M+=S(j,!1,!0):(M+=S(j.substr(0,le),!1,!0),M+=j.substr(le))}if(z){if(z.length>=3&&z.charCodeAt(0)===47&&z.charCodeAt(2)===58){const le=z.charCodeAt(1);le>=65&&le<=90&&(z=`/${String.fromCharCode(le+32)}:${z.substr(3)}`)}else if(z.length>=2&&z.charCodeAt(1)===58){const le=z.charCodeAt(0);le>=65&&le<=90&&(z=`${String.fromCharCode(le+32)}:${z.substr(2)}`)}M+=S(z,!0,!1)}return J&&(M+="?",M+=S(J,!1,!1)),U&&(M+="#",M+=k?U:R(U,!1,!1)),M}function _(I){try{return decodeURIComponent(I)}catch{return I.length>3?I.substr(0,3)+_(I.substr(3)):I}}const N=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function F(I){return I.match(N)?I.replace(N,k=>_(k)):I}var P=n(470);const G=P.posix||P,B="/";var W;(function(I){I.joinPath=function(k,...S){return k.with({path:G.join(k.path,...S)})},I.resolvePath=function(k,...S){let M=k.path,q=!1;M[0]!==B&&(M=B+M,q=!0);let j=G.resolve(M,...S);return q&&j[0]===B&&!k.authority&&(j=j.substring(1)),k.with({path:j})},I.dirname=function(k){if(k.path.length===0||k.path===B)return k;let S=G.dirname(k.path);return S.length===1&&S.charCodeAt(0)===46&&(S=""),k.with({path:S})},I.basename=function(k){return G.basename(k.path)},I.extname=function(k){return G.extname(k.path)}})(W||(W={}))})(),P$=r})();const{URI:Jt,Utils:Fc}=P$;var On;(function(t){t.basename=Fc.basename,t.dirname=Fc.dirname,t.extname=Fc.extname,t.joinPath=Fc.joinPath,t.resolvePath=Fc.resolvePath;function e(r,i){return r?.toString()===i?.toString()}t.equals=e;function n(r,i){const s=typeof r=="string"?r:r.path,o=typeof i=="string"?i:i.path,a=s.split("/").filter(f=>f.length>0),c=o.split("/").filter(f=>f.length>0);let l=0;for(;l<a.length&&a[l]===c[l];l++);const u="../".repeat(a.length-l),d=c.slice(l).join("/");return u+d}t.relative=n})(On||(On={}));var Ne;(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"})(Ne||(Ne={}));class yq{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=Qe.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??Jt.parse(e.uri),Qe.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromString(e,n,r){return Qe.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:Ne.Parsed,references:[],textDocument:r};else{const o=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:Ne.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 c=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:c})}return s!==a&&(e.parseResult=await this.parseAsync(e.uri,a,n),e.parseResult.value.$document=e),e.state=Ne.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=af.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class vq{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return Le(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=Ne.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=Ne.Changed,this.documentMap.delete(n)),r}}class wq{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=Qe.None){for(const r of Gr(e.parseResult.value))await Pt(n),nd(r).forEach(i=>this.doLink(i,e))}doLink(e,n){const r=e.reference;if(r._ref===void 0){try{const i=this.getCandidate(e);if(qu(i))r._ref=i;else if(r._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){const s=this.loadAstNode(i);r._ref=s??this.createLinkingError(e,i)}}catch(i){r._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${r.$refText}': ${i}`})}n.references.push(r)}}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(ct(this._ref))return this._ref;if(RL(this._nodeDescription)){const c=s.loadAstNode(this._nodeDescription);this._ref=c??s.createLinkingError({reference:o,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){const c=s.getLinkedNode({reference:o,container:e,property:n});if(c.error&&At(e).state<Ne.ComputedScopes)return;this._ref=(a=c.node)!==null&&a!==void 0?a:c.error,this._nodeDescription=c.descr,At(e).references.push(this)}return ct(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return qu(this._ref)?this._ref:void 0}};return o}getLinkedNode(e){try{const n=this.getCandidate(e);if(qu(n))return{error:n};const r=this.loadAstNode(n);return r?{node:r,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${n}`})}}}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=At(e.container);r.state<Ne.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 x$(t){return typeof t.name=="string"}class bq{getName(e){if(x$(e))return e.name}getNameNode(e){return mn(e.$cstNode,"name")}}class Tq{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const n=LT(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(Cn(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(Cn(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||hT(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=>On.equals(s.sourceUri,n.documentUri))),r.push(...i),Le(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=At(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:Na(n),local:!0}}}}class Sr{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return vg.sum(Le(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 Le(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return Le(this.map.keys())}values(){return Le(this.map.values()).flat()}entriesGroupedByKey(){return Le(this.map.entries())}}class N${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 O${constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=Qe.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=fc,i=Qe.None){const s=[];this.exportNode(e,s,n);for(const o of r(e))await Pt(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=Qe.None){const r=e.parseResult.value,i=new Sr;for(const s of mr(r))await Pt(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 jc{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 D${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=Le(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}const L$={getElement(){},getAllElements(){return mo}};class M${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 Eq extends M${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 Rq extends M${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 F$ extends Eq{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class j${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 F$(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=At(e.container).precomputedScopes;if(i){let o=e.container;do{const a=i.get(o);a.length>0&&n.push(Le(a).filter(c=>this.reflection.isSubtype(c.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 jc(Le(e),n,r)}createScopeForNodes(e,n,r){const i=Le(e).map(s=>{const o=this.nameProvider.getName(s);if(o)return this.descriptions.createDescription(s,o)}).nonNullable();return new jc(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new D$(this.indexManager.allElements(e)))}}function Sq(t){return typeof t.$comment=="string"}function U$(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class $q{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?.replacer,i=(o,a)=>this.replacer(o,a,n),s=r?(o,a)=>r(o,a,i):i;try{return this.currentDocument=At(e),JSON.stringify(e,s,n?.space)}finally{this.currentDocument=void 0}}deserialize(e,n={}){const r=JSON.parse(e);return this.linkNode(r,r,n),r}replacer(e,n,{refText:r,sourceText:i,textRegions:s,comments:o,uriConverter:a}){var c,l,u,d;if(!this.ignoreProperties.has(e))if(Cn(n)){const f=n.ref,h=r?n.$refText:void 0;if(f){const p=At(f);let y="";this.currentDocument&&this.currentDocument!==p&&(a?y=a(p.uri,n):y=p.uri.toString());const R=this.astNodeLocator.getAstNodePath(f);return{$ref:`${y}#${R}`,$refText:h}}else return{$error:(l=(c=n.error)===null||c===void 0?void 0:c.message)!==null&&l!==void 0?l:"Could not resolve reference",$refText:h}}else if(ct(n)){let f;if(s&&(f=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&f?.$textRegion&&(f.$textRegion.documentURI=(u=this.currentDocument)===null||u===void 0?void 0:u.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 h=this.commentProvider.getComment(n);h&&(f.$comment=h.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=bo(e.$cstNode,s).map(n);o.length!==0&&(i[s]=o)}),e}}linkNode(e,n,r,i,s,o){for(const[c,l]of Object.entries(e))if(Array.isArray(l))for(let u=0;u<l.length;u++){const d=l[u];U$(d)?l[u]=this.reviveReference(e,c,n,d,r):ct(d)&&this.linkNode(d,n,r,e,c,u)}else U$(l)?e[c]=this.reviveReference(e,c,n,l,r):ct(l)&&this.linkNode(l,n,r,e,c);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 c=this.getRefNode(r,i.$ref,s.uriConverter);if(ct(c))return o||(o=this.nameProvider.getName(c)),{$refText:o??"",ref:c};a=c}if(a){const c={$refText:o??""};return c.error={container:e,property:n,message:a,reference:c},c}else return}getRefNode(e,n,r){try{const i=n.indexOf("#");if(i===0){const c=this.astNodeLocator.getAstNode(e,n.substring(1));return c||"Could not resolve path: "+n}if(i<0){const c=r?r(n):Jt.parse(n),l=this.langiumDocuments.getDocument(c);return l?l.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):Jt.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 kq{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.toString()))===null||r===void 0?void 0:r.languageId;if(i!==void 0){const a=this.languageIdMap.get(i);if(a)return a}const s=On.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 B$(t){return{code:t}}var cf;(function(t){t.all=["fast","slow","built-in"]})(cf||(cf={}));class _q{constructor(e){this.entries=new Sr,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 c={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,c)}else if(typeof o=="function"){const a={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,a)}}}wrapValidationException(e,n){return async(r,i,s)=>{try{await e.call(n,r,i,s)}catch(o){if(of(o))throw o;console.error("An error occurred during validation:",o);const a=o instanceof Error?o.message:String(o);o instanceof Error&&o.stack&&console.error(o.stack),i("error","An error occurred during validation: "+a,{node:r})}}}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=Le(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}}class Cq{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=Qe.None){const i=e.parseResult,s=[];if(await Pt(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)===Oi.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)===Oi.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)===Oi.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(o){if(of(o))throw o;console.error("An error occurred during validation:",o)}return await Pt(r),s}processLexingErrors(e,n,r){for(const i of e.lexerErrors){const s={severity:gy("error"),range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:B$(Oi.LexingError),source:this.getSource()};n.push(s)}}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=Gu(i.token);if(s){const o={severity:gy("error"),range:s,message:i.message,data:B$(Oi.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:Oi.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=Qe.None){const i=[],s=(o,a,c)=>{i.push(this.toDiagnostic(o,a,c))};return await Promise.all(Gr(e).map(async o=>{await Pt(r);const a=this.validationRegistry.getChecks(o.$type,n.categories);for(const c of a)await c(o,s,r)})),i}toDiagnostic(e,n,r){return{message:n,range:Aq(r),severity:gy(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 Aq(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=mn(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=pc(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 gy(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)}}var Oi;(function(t){t.LexingError="lexing-error",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(Oi||(Oi={}));class Iq{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r=At(e)){n??(n=this.nameProvider.getName(e));const i=this.astNodeLocator.getAstNodePath(e);if(!n)throw new Error(`Node at path ${i} has no name.`);let s;const o=()=>{var a;return s??(s=Na((a=this.nameProvider.getNameNode(e))!==null&&a!==void 0?a:e.$cstNode))};return{node:e,name:n,get nameSegment(){return o()},selectionSegment:Na(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}}class Pq{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=Qe.None){const r=[],i=e.parseResult.value;for(const s of Gr(i))await Pt(n),nd(s).filter(o=>!qu(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=At(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:Na(r),local:On.equals(n.documentUri,i)}}}class xq{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),c=parseInt(s.substring(o+1)),l=i[a];return l?.[c]}return i[s]},e)}}class Nq{constructor(e){this._ready=new hy,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new S$,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 Ls;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(Ls||(Ls={}));class Oq{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Sr,this.documentPhaseListeners=new Sr,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Ne.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=Qe.None){var i,s;for(const o of e){const a=o.uri.toString();if(o.state===Ne.Validated){if(typeof n.validation=="boolean"&&n.validation)o.state=Ne.IndexedReferences,o.diagnostics=void 0,this.buildState.delete(a);else if(typeof n.validation=="object"){const c=this.buildState.get(a),l=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(l){const d=((s=n.validation.categories)!==null&&s!==void 0?s:cf.all).filter(f=>!l.includes(f));d.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:d})},result:c.result}),o.state=Ne.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=Ne.Changed,await this.emitUpdate(e.map(o=>o.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=Qe.None){this.currentState=Ne.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 c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},o);c.state=Ne.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(o.toString())}const i=Le(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,Ne.ComputedScopes),o.diagnostics=void 0}),await this.emitUpdate(e,n),await Pt(r);const s=this.sortDocuments(this.langiumDocuments.all.filter(o=>{var a;return o.state<Ne.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){var n;const r=new Map;for(const i of e)r.set(i,!!(!((n=this.textDocuments)===null||n===void 0)&&n.get(i.uri.toString())));return e.sort((i,s)=>{const o=r.get(i),a=r.get(s);return o&&!a?-1:!o&&a?1:0})}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),Ls.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,Ne.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,Ne.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,Ne.ComputedScopes,r,async s=>{const o=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await o.computeLocalScopes(s,r)}),await this.runCancelable(e,Ne.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,Ne.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,Ne.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 Pt(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),Ls.create(()=>{this.buildPhaseListeners.delete(e,n)})}onDocumentPhase(e,n){return this.documentPhaseListeners.add(e,n),Ls.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=Qe.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(sf):new Promise((s,o)=>{const a=this.onBuildPhase(e,()=>{if(a.dispose(),c.dispose(),i){const l=this.langiumDocuments.getDocument(i);s(l?.uri)}else s(void 0)}),c=r.onCancellationRequested(()=>{a.dispose(),c.dispose(),o(sf)})})}async notifyDocumentPhase(e,n,r){const i=this.documentPhaseListeners.get(n);for(const s of i)try{await s(e,r)}catch(o){if(!of(o))throw o}}async notifyBuildPhase(e,n,r){if(e.length===0)return;const i=this.buildPhaseListeners.get(n);for(const s of i)await Pt(r),await s(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,c=await s.validateDocument(e,a,n);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;const l=this.buildState.get(e.uri.toString());if(l){(r=l.result)!==null&&r!==void 0||(l.result={});const u=(i=a?.categories)!==null&&i!==void 0?i:cf.all;l.result.validationChecks?l.result.validationChecks.push(...u):l.result.validationChecks=[...u]}}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 Dq{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Rq,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=At(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(o=>{On.equals(o.targetUri,r)&&o.targetPath===n&&i.push(o)})}),Le(i)}allElements(e,n){let r=Le(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=Qe.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=Qe.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 q${constructor(e){this.initialBuildOptions={},this._ready=new hy,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}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=Qe.None){const r=await this.performStartup(e);await Pt(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 Jt.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=On.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=On.extname(n.uri);return r.includes(s)}return!1}}class Lq{constructor(e){const n=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=G$(n)?Object.values(n):n;this.chevrotainLexer=new ln(r,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var n;const r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:(n=r.groups.hidden)!==null&&n!==void 0?n:[]}}toTokenTypeDictionary(e){if(G$(e))return e;const n=W$(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function Mq(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function W$(t){return t&&"modes"in t&&"defaultMode"in t}function G$(t){return!Mq(t)&&!W$(t)}function Fq(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=xe.create(0,0));const s=z$(t),o=yy(r),a=Bq({lines:s,position:i,options:o});return Hq({index:0,tokens:a,position:i})}function jq(t,e){const n=yy(e),r=z$(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 z$(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(xT)}const H$=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,Uq=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Bq(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 c=a===0,l=a===t.lines.length-1;let u=t.lines[a],d=0;if(c&&t.options.start){const h=(e=t.options.start)===null||e===void 0?void 0:e.exec(u);h&&(d=h.index+h[0].length)}else{const h=(n=t.options.line)===null||n===void 0?void 0:n.exec(u);h&&(d=h.index+h[0].length)}if(l){const h=(r=t.options.end)===null||r===void 0?void 0:r.exec(u);h&&(u=u.substring(0,h.index))}if(u=u.substring(0,zq(u)),my(u,d)>=u.length){if(i.length>0){const h=xe.create(s,o);i.push({type:"break",content:"",range:Ee.create(h,h)})}}else{H$.lastIndex=d;const h=H$.exec(u);if(h){const p=h[0],y=h[1],R=xe.create(s,o+d),b=xe.create(s,o+d+p.length);i.push({type:"tag",content:y,range:Ee.create(R,b)}),d+=p.length,d=my(u,d)}if(d<u.length){const p=u.substring(d),y=Array.from(p.matchAll(Uq));i.push(...qq(y,p,s,o+d))}}s++,o=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function qq(t,e,n,r){const i=[];if(t.length===0){const s=xe.create(n,r),o=xe.create(n,r+e.length);i.push({type:"text",content:e,range:Ee.create(s,o)})}else{let s=0;for(const a of t){const c=a.index,l=e.substring(s,c);l.length>0&&i.push({type:"text",content:e.substring(s,c),range:Ee.create(xe.create(n,s+r),xe.create(n,c+r))});let u=l.length+1;const d=a[1];if(i.push({type:"inline-tag",content:d,range:Ee.create(xe.create(n,s+u+r),xe.create(n,s+u+d.length+r))}),u+=d.length,a.length===4){u+=a[2].length;const f=a[3];i.push({type:"text",content:f,range:Ee.create(xe.create(n,s+u+r),xe.create(n,s+u+f.length+r))})}else i.push({type:"text",content:"",range:Ee.create(xe.create(n,s+u+r),xe.create(n,s+u+r))});s=c+a[0].length}const o=e.substring(s);o.length>0&&i.push({type:"text",content:o,range:Ee.create(xe.create(n,s+r),xe.create(n,s+r+o.length))})}return i}const Wq=/\S/,Gq=/\s*$/;function my(t,e){const n=t.substring(e).match(Wq);return n?e+n.index:t.length}function zq(t){const e=t.match(Gq);if(e&&typeof e.index=="number")return e.index}function Hq(t){var e,n,r,i;const s=xe.create(t.position.line,t.position.character);if(t.tokens.length===0)return new X$([],Ee.create(s,s));const o=[];for(;t.index<t.tokens.length;){const l=Vq(t,o[o.length-1]);l&&o.push(l)}const a=(n=(e=o[0])===null||e===void 0?void 0:e.range.start)!==null&&n!==void 0?n:s,c=(i=(r=o[o.length-1])===null||r===void 0?void 0:r.range.end)!==null&&i!==void 0?i:s;return new X$(o,Ee.create(a,c))}function Vq(t,e){const n=t.tokens[t.index];if(n.type==="tag")return K$(t,!1);if(n.type==="text"||n.type==="inline-tag")return V$(t);Kq(n,e),t.index++}function Kq(t,e){if(e){const n=new J$("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function V$(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(Yq(t)),r=e,e=t.tokens[t.index];return new by(i,Ee.create(n.range.start,r.range.end))}function Yq(t){return t.tokens[t.index].type==="inline-tag"?K$(t,!0):Y$(t)}function K$(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=Y$(t);return new wy(r,new by([s],s.range),e,Ee.create(n.range.start,s.range.end))}else{const s=V$(t);return new wy(r,s,e,Ee.create(n.range.start,s.range.end))}else{const s=n.range;return new wy(r,new by([],s),e,s)}}function Y$(t){const e=t.tokens[t.index++];return new J$(e.content,e.range)}function yy(t){if(!t)return yy({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:vy(e,!0),end:vy(n,!1),line:vy(r,!0)}}function vy(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?cd(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class X${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+=Q$(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+=Q$(n)+i}return n.trim()}}class wy{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=Xq(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 Xq(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let o=e;if(s>0){const c=my(e,s);o=e.substring(c),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:Jq(e,o)}}function Jq(t,e){try{return Jt.parse(t,!0),`[${e}](${t})`}catch{return t}}class by{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 J${constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function Q$(t){return t.endsWith(`
122
+ `)?`
123
+ `:`
124
+
125
+ `}class Qq{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&jq(n))return Fq(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,c=s.documentUri.with({fragment:`L${o},${a}`});return`[${r}](${c.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=At(e).precomputedScopes;if(!i)return;let s=e;do{const a=i.get(s).find(c=>c.name===n);if(a)return a;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class Zq{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return Sq(e)?e.$comment:(n=zu(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class e8{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e){return Promise.resolve(this.syncParser.parse(e))}}class t8{constructor(){this.previousTokenSource=new dy,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=new dy;return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r){const i=new hy,s={action:n,deferred:i,cancellationToken:r??Qe.None};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){of(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class n8{constructor(e){this.grammarElementIdMap=new N$,this.tokenTypeIdMap=new N$,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors.map(n=>Object.assign(Object.assign({},n),{message:n.message})),parserErrors:e.parserErrors.map(n=>Object.assign(Object.assign({},n),{message:n.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of Gr(e))n.set(i,{});if(e.$cstNode)for(const i of xa(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)ct(a)?o.push(this.dehydrateAstNode(a,n)):Cn(a)?o.push(this.dehydrateReference(a,n)):o.push(a)}else ct(s)?r[i]=this.dehydrateAstNode(s,n):Cn(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 dT(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),Br(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):Ss(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,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of Gr(e))n.set(s,{});let i;if(e.$cstNode)for(const s of xa(e.$cstNode)){let o;"fullText"in s?(o=new h$(s.fullText),i=o):"content"in s?o=new sy:"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)ct(a)?o.push(this.setParent(this.hydrateAstNode(a,n),r)):Cn(a)?o.push(this.hydrateReference(a,r,i,n)):o.push(a)}else ct(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):Cn(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),Br(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,c=e.endColumn,l=e.hidden;return new iy(r,i,{start:{line:s,character:o},end:{line:a,character:c}},n,l)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap();const n=this.grammarElementIdMap.getKey(e);if(n)return n;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(const n of Gr(this.grammar))$g(n)&&this.grammarElementIdMap.set(n,e++)}}function Z$(t){return{documentation:{CommentProvider:e=>new Zq(e),DocumentationProvider:e=>new Qq(e)},parser:{AsyncParser:e=>new e8(e),GrammarConfig:e=>uM(e),LangiumParser:e=>Z5(e),CompletionParser:e=>Q5(e),ValueConverter:()=>new nq,TokenBuilder:()=>new tq,Lexer:e=>new Lq(e),ParserErrorMessageProvider:()=>new y$},workspace:{AstNodeLocator:()=>new xq,AstNodeDescriptionProvider:e=>new Iq(e),ReferenceDescriptionProvider:e=>new Pq(e)},references:{Linker:e=>new wq(e),NameProvider:()=>new bq,ScopeProvider:e=>new j$(e),ScopeComputation:e=>new O$(e),References:e=>new Tq(e)},serializer:{Hydrator:e=>new n8(e),JsonSerializer:e=>new $q(e)},validation:{DocumentValidator:e=>new Cq(e),ValidationRegistry:e=>new _q(e)},shared:()=>t.shared}}function ek(t){return{ServiceRegistry:e=>new kq(e),workspace:{LangiumDocuments:e=>new vq(e),LangiumDocumentFactory:e=>new yq(e),DocumentBuilder:e=>new Oq(e),IndexManager:e=>new Dq(e),WorkspaceManager:e=>new q$(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new t8,ConfigurationProvider:e=>new Nq(e)}}}var lf;(function(t){t.merge=(e,n)=>df(df({},e),n)})(lf||(lf={}));function uf(t,e,n,r,i,s,o,a,c){const l=[t,e,n,r,i,s,o,a,c].reduce(df,{});return tk(l)}const Ty=Symbol("isProxy");function Ey(t){if(t&&t[Ty])for(const e of Object.values(t))Ey(e);return t}function tk(t,e){const n=new Proxy({},{deleteProperty:()=>!1,get:(r,i)=>rk(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(rk(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Reflect.ownKeys(t),Ty]});return n[Ty]=!0,n}const nk=Symbol();function rk(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]===nk)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]=nk;try{t[e]=typeof i=="function"?i(r):tk(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function df(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]=df(i,r):t[n]=r}}return t}class r8{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const ik={fileSystemProvider:()=>new r8},i8={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},s8={AstReflection:()=>new kT};function o8(){const t=uf(ek(ik),s8),e=uf(Z$({shared:t}),i8);return t.ServiceRegistry.register(e),e}function a8(t){var e;const n=o8(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Jt.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var c8={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]},l8=Object.entries(c8);function Ry(t){return String(t)}Ry.open="",Ry.close="";function u8(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 d8(t=!1){let e=u8(t),n=(o,a,c,l)=>{let u="",d=0;do u+=o.substring(d,l)+c,d=l+a.length,l=o.indexOf(a,d);while(~l);return u+o.substring(d)},r=(o,a,c=o)=>{let l=u=>{let d=String(u),f=d.indexOf(a,o.length);return~f?o+n(d,a,c,f)+a:o+d+a};return l.open=o,l.close=a,l},i={isColorSupported:e},s=o=>`\x1B[${o}m`;for(let[o,a]of l8)i[o]=e?r(s(a[0]),s(a[1]),a[2]):Ry;return i}var Ze=d8($N(1)),se={},dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.thenable=dt.typedArray=dt.stringArray=dt.array=dt.func=dt.error=dt.number=dt.string=dt.boolean=void 0;function f8(t){return t===!0||t===!1}dt.boolean=f8;function sk(t){return typeof t=="string"||t instanceof String}dt.string=sk;function h8(t){return typeof t=="number"||t instanceof Number}dt.number=h8;function p8(t){return t instanceof Error}dt.error=p8;function ok(t){return typeof t=="function"}dt.func=ok;function ak(t){return Array.isArray(t)}dt.array=ak;function g8(t){return ak(t)&&t.every(e=>sk(e))}dt.stringArray=g8;function m8(t,e){return Array.isArray(t)&&t.every(e)}dt.typedArray=m8;function y8(t){return t&&ok(t.then)}dt.thenable=y8;var _e={},Ve={},un={},Sy={},$y={},ne={},ck;function lk(){if(ck)return ne;ck=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.Message=ne.NotificationType9=ne.NotificationType8=ne.NotificationType7=ne.NotificationType6=ne.NotificationType5=ne.NotificationType4=ne.NotificationType3=ne.NotificationType2=ne.NotificationType1=ne.NotificationType0=ne.NotificationType=ne.RequestType9=ne.RequestType8=ne.RequestType7=ne.RequestType6=ne.RequestType5=ne.RequestType4=ne.RequestType3=ne.RequestType2=ne.RequestType1=ne.RequestType=ne.RequestType0=ne.AbstractMessageSignature=ne.ParameterStructures=ne.ResponseError=ne.ErrorCodes=void 0;const t=Et;var e;(function(k){k.ParseError=-32700,k.InvalidRequest=-32600,k.MethodNotFound=-32601,k.InvalidParams=-32602,k.InternalError=-32603,k.jsonrpcReservedErrorRangeStart=-32099,k.serverErrorStart=-32099,k.MessageWriteError=-32099,k.MessageReadError=-32098,k.PendingResponseRejected=-32097,k.ConnectionInactive=-32096,k.ServerNotInitialized=-32002,k.UnknownErrorCode=-32001,k.jsonrpcReservedErrorRangeEnd=-32e3,k.serverErrorEnd=-32e3})(e||(ne.ErrorCodes=e={}));class n extends Error{constructor(S,M,q){super(M),this.code=t.number(S)?S:e.UnknownErrorCode,this.data=q,Object.setPrototypeOf(this,n.prototype)}toJson(){const S={code:this.code,message:this.message};return this.data!==void 0&&(S.data=this.data),S}}ne.ResponseError=n;class r{constructor(S){this.kind=S}static is(S){return S===r.auto||S===r.byName||S===r.byPosition}toString(){return this.kind}}ne.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class i{constructor(S,M){this.method=S,this.numberOfParams=M}get parameterStructures(){return r.auto}}ne.AbstractMessageSignature=i;class s extends i{constructor(S){super(S,0)}}ne.RequestType0=s;class o extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}ne.RequestType=o;class a extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}ne.RequestType1=a;class c extends i{constructor(S){super(S,2)}}ne.RequestType2=c;class l extends i{constructor(S){super(S,3)}}ne.RequestType3=l;class u extends i{constructor(S){super(S,4)}}ne.RequestType4=u;class d extends i{constructor(S){super(S,5)}}ne.RequestType5=d;class f extends i{constructor(S){super(S,6)}}ne.RequestType6=f;class h extends i{constructor(S){super(S,7)}}ne.RequestType7=h;class p extends i{constructor(S){super(S,8)}}ne.RequestType8=p;class y extends i{constructor(S){super(S,9)}}ne.RequestType9=y;class R extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}ne.NotificationType=R;class b extends i{constructor(S){super(S,0)}}ne.NotificationType0=b;class v extends i{constructor(S,M=r.auto){super(S,1),this._parameterStructures=M}get parameterStructures(){return this._parameterStructures}}ne.NotificationType1=v;class T extends i{constructor(S){super(S,2)}}ne.NotificationType2=T;class _ extends i{constructor(S){super(S,3)}}ne.NotificationType3=_;class N extends i{constructor(S){super(S,4)}}ne.NotificationType4=N;class F extends i{constructor(S){super(S,5)}}ne.NotificationType5=F;class P extends i{constructor(S){super(S,6)}}ne.NotificationType6=P;class G extends i{constructor(S){super(S,7)}}ne.NotificationType7=G;class B extends i{constructor(S){super(S,8)}}ne.NotificationType8=B;class W extends i{constructor(S){super(S,9)}}ne.NotificationType9=W;var I;return function(k){function S(j){const z=j;return z&&t.string(z.method)&&(t.string(z.id)||t.number(z.id))}k.isRequest=S;function M(j){const z=j;return z&&t.string(z.method)&&j.id===void 0}k.isNotification=M;function q(j){const z=j;return z&&(z.result!==void 0||!!z.error)&&(t.string(z.id)||t.number(z.id)||z.id===null)}k.isResponse=q}(I||(ne.Message=I={})),ne}var ti={},uk;function dk(){if(uk)return ti;uk=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 c=this._map.get(s);if(c)c.value=o,a!==e.None&&this.touch(c,a);else{switch(c={key:s,value:o,next:void 0,previous:void 0},a){case e.None:this.addItemLast(c);break;case e.First:this.addItemFirst(c);break;case e.Last:this.addItemLast(c);break;default:this.addItemLast(c);break}this._map.set(s,c),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 c=this._head;for(;c;){if(o?s.bind(o)(c.value,c.key,this):s(c.value,c.key,this),this._state!==a)throw new Error("LinkedMap got modified during iteration.");c=c.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 c={value:o.key,done:!1};return o=o.next,c}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 c={value:o.value,done:!1};return o=o.next,c}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 c={value:[o.key,o.value],done:!1};return o=o.next,c}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,c=s.previous;s===this._tail?(c.next=void 0,this._tail=c):(a.previous=c,c.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,c=s.previous;s===this._head?(a.previous=void 0,this._head=a):(a.previous=c,c.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 Uc={},fk;function v8(){if(fk)return Uc;fk=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.Disposable=void 0;var t;return function(e){function n(r){return{dispose:r}}e.create=n}(t||(Uc.Disposable=t={})),Uc}var Ms={},hk;function w8(){if(hk)return Ms;hk=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.SharedArrayReceiverStrategy=Ms.SharedArraySenderStrategy=void 0;const t=Ni;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 c=new SharedArrayBuffer(4),l=new Int32Array(c,0,1);l[0]=e.Continue,this.buffers.set(a.id,c),a.$cancellationData=c}async sendCancellation(a,c){const l=this.buffers.get(c);if(l===void 0)return;const u=new Int32Array(l,0,1);Atomics.store(u,0,e.Cancelled)}cleanup(a){this.buffers.delete(a)}dispose(){this.buffers.clear()}}Ms.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 c=a.$cancellationData;return c===void 0?new t.CancellationTokenSource:new i(c)}}return Ms.SharedArrayReceiverStrategy=s,Ms}var ni={},Bc={},pk;function gk(){if(pk)return Bc;pk=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.Semaphore=void 0;const t=ei;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 Bc.Semaphore=e,Bc}var mk;function b8(){if(mk)return ni;mk=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.ReadableStreamMessageReader=ni.AbstractMessageReader=ni.MessageReader=void 0;const t=ei,e=Et,n=Rr,r=gk();var i;(function(c){function l(u){let d=u;return d&&e.func(d.listen)&&e.func(d.dispose)&&e.func(d.onError)&&e.func(d.onClose)&&e.func(d.onPartialMessage)}c.is=l})(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(l){this.errorEmitter.fire(this.asError(l))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(l){this.partialMessageEmitter.fire(l)}asError(l){return l instanceof Error?l:new Error(`Reader received error. Reason: ${e.string(l.message)?l.message:"unknown"}`)}}ni.AbstractMessageReader=s;var o;(function(c){function l(u){let d,f;const h=new Map;let p;const y=new Map;if(u===void 0||typeof u=="string")d=u??"utf-8";else{if(d=u.charset??"utf-8",u.contentDecoder!==void 0&&(f=u.contentDecoder,h.set(f.name,f)),u.contentDecoders!==void 0)for(const R of u.contentDecoders)h.set(R.name,R);if(u.contentTypeDecoder!==void 0&&(p=u.contentTypeDecoder,y.set(p.name,p)),u.contentTypeDecoders!==void 0)for(const R of u.contentTypeDecoders)y.set(R.name,R)}return p===void 0&&(p=(0,t.default)().applicationJson.decoder,y.set(p.name,p)),{charset:d,contentDecoder:f,contentDecoders:h,contentTypeDecoder:p,contentTypeDecoders:y}}c.fromOptions=l})(o||(o={}));class a extends s{constructor(l,u){super(),this.readable=l,this.options=o.fromOptions(u),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(l){this._partialMessageTimeout=l}get partialMessageTimeout(){return this._partialMessageTimeout}listen(l){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=l;const u=this.readable.onData(d=>{this.onData(d)});return this.readable.onError(d=>this.fireError(d)),this.readable.onClose(()=>this.fireClose()),u}onData(l){try{for(this.buffer.append(l);;){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 h=parseInt(f);if(isNaN(h)){this.fireError(new Error(`Content-Length value must be a number. Got ${f}`));return}this.nextMessageLength=h}const u=this.buffer.tryReadBody(this.nextMessageLength);if(u===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(u):u,f=await this.options.contentTypeDecoder.decode(d,this.options);this.callback(f)}).catch(d=>{this.fireError(d)})}}catch(u){this.fireError(u)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((l,u)=>{this.partialMessageTimer=void 0,l===this.messageToken&&(this.firePartialMessage({messageToken:l,waitingTime:u}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return ni.ReadableStreamMessageReader=a,ni}var ri={},yk;function T8(){if(yk)return ri;yk=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.WriteableStreamMessageWriter=ri.AbstractMessageWriter=ri.MessageWriter=void 0;const t=ei,e=Et,n=gk(),r=Rr,i="Content-Length: ",s=`\r
127
+ `;var o;(function(u){function d(f){let h=f;return h&&e.func(h.dispose)&&e.func(h.onClose)&&e.func(h.onError)&&e.func(h.write)}u.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,h){this.errorEmitter.fire([this.asError(d),f,h])}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 c;(function(u){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}}u.fromOptions=d})(c||(c={}));class l extends a{constructor(d,f){super(),this.writable=d,this.options=c.fromOptions(f),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(h=>this.fireError(h)),this.writable.onClose(()=>this.fireClose())}async write(d){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(d,this.options).then(h=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(h):h).then(h=>{const p=[];return p.push(i,h.byteLength.toString(),s),p.push(s),this.doWrite(d,p,h)},h=>{throw this.fireError(h),h}))}async doWrite(d,f,h){try{return await this.writable.write(f.join(""),"ascii"),this.writable.write(h)}catch(p){return this.handleError(p,d),Promise.reject(p)}}handleError(d,f){this.errorCount++,this.fireError(d,f,this.errorCount)}end(){this.writable.end()}}return ri.WriteableStreamMessageWriter=l,ri}var qc={},vk;function E8(){if(vk)return qc;vk=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.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,c=0,l=0;e:for(;a<this._chunks.length;){const h=this._chunks[a];for(c=0;c<h.length;){switch(h[c]){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,c++;break e;default:o=0}break;default:o=0}c++}l+=h.byteLength,a++}if(o!==4)return;const u=this._read(l+c),d=new Map,f=this.toString(u,"ascii").split(n);if(f.length<2)return d;for(let h=0;h<f.length-2;h++){const p=f[h],y=p.indexOf(":");if(y===-1)throw new Error(`Message header must separate key and value using ':'
129
+ ${p}`);const R=p.substr(0,y),b=p.substr(y+1).trim();d.set(s?R.toLowerCase():R,b)}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 l=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(l)}if(this._chunks[0].byteLength>s){const l=this._chunks[0],u=this.asNative(l,s);return this._chunks[0]=l.slice(s),this._totalLength-=s,u}const o=this.allocNative(s);let a=0,c=0;for(;s>0;){const l=this._chunks[c];if(l.byteLength>s){const u=l.slice(0,s);o.set(u,a),a+=s,this._chunks[c]=l.slice(s),this._totalLength-=s,s-=s}else o.set(l,a),a+=l.byteLength,this._chunks.shift(),this._totalLength-=l.byteLength,s-=l.byteLength}return o}}return qc.AbstractMessageBuffer=r,qc}var ky={},wk;function R8(){return wk||(wk=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=ei,n=Et,r=lk(),i=dk(),s=Rr,o=Ni;var a;(function(S){S.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var c;(function(S){function M(q){return typeof q=="string"||typeof q=="number"}S.is=M})(c||(t.ProgressToken=c={}));var l;(function(S){S.type=new r.NotificationType("$/progress")})(l||(l={}));class u{constructor(){}}t.ProgressType=u;var d;(function(S){function M(q){return n.func(q)}S.is=M})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function(S){S[S.Off=0]="Off",S[S.Messages=1]="Messages",S[S.Compact=2]="Compact",S[S.Verbose=3]="Verbose"})(f||(t.Trace=f={}));var h;(function(S){S.Off="off",S.Messages="messages",S.Compact="compact",S.Verbose="verbose"})(h||(t.TraceValues=h={})),function(S){function M(j){if(!n.string(j))return S.Off;switch(j=j.toLowerCase(),j){case"off":return S.Off;case"messages":return S.Messages;case"compact":return S.Compact;case"verbose":return S.Verbose;default:return S.Off}}S.fromString=M;function q(j){switch(j){case S.Off:return"off";case S.Messages:return"messages";case S.Compact:return"compact";case S.Verbose:return"verbose";default:return"off"}}S.toString=q}(f||(t.Trace=f={}));var p;(function(S){S.Text="text",S.JSON="json"})(p||(t.TraceFormat=p={})),function(S){function M(q){return n.string(q)?(q=q.toLowerCase(),q==="json"?S.JSON:S.Text):S.Text}S.fromString=M}(p||(t.TraceFormat=p={}));var y;(function(S){S.type=new r.NotificationType("$/setTrace")})(y||(t.SetTraceNotification=y={}));var R;(function(S){S.type=new r.NotificationType("$/logTrace")})(R||(t.LogTraceNotification=R={}));var b;(function(S){S[S.Closed=1]="Closed",S[S.Disposed=2]="Disposed",S[S.AlreadyListening=3]="AlreadyListening"})(b||(t.ConnectionErrors=b={}));class v extends Error{constructor(M,q){super(q),this.code=M,Object.setPrototypeOf(this,v.prototype)}}t.ConnectionError=v;var T;(function(S){function M(q){const j=q;return j&&n.func(j.cancelUndispatched)}S.is=M})(T||(t.ConnectionStrategy=T={}));var _;(function(S){function M(q){const j=q;return j&&(j.kind===void 0||j.kind==="id")&&n.func(j.createCancellationTokenSource)&&(j.dispose===void 0||n.func(j.dispose))}S.is=M})(_||(t.IdCancellationReceiverStrategy=_={}));var N;(function(S){function M(q){const j=q;return j&&j.kind==="request"&&n.func(j.createCancellationTokenSource)&&(j.dispose===void 0||n.func(j.dispose))}S.is=M})(N||(t.RequestCancellationReceiverStrategy=N={}));var F;(function(S){S.Message=Object.freeze({createCancellationTokenSource(q){return new o.CancellationTokenSource}});function M(q){return _.is(q)||N.is(q)}S.is=M})(F||(t.CancellationReceiverStrategy=F={}));var P;(function(S){S.Message=Object.freeze({sendCancellation(q,j){return q.sendNotification(a.type,{id:j})},cleanup(q){}});function M(q){const j=q;return j&&n.func(j.sendCancellation)&&n.func(j.cleanup)}S.is=M})(P||(t.CancellationSenderStrategy=P={}));var G;(function(S){S.Message=Object.freeze({receiver:F.Message,sender:P.Message});function M(q){const j=q;return j&&F.is(j.receiver)&&P.is(j.sender)}S.is=M})(G||(t.CancellationStrategy=G={}));var B;(function(S){function M(q){const j=q;return j&&n.func(j.handleMessage)}S.is=M})(B||(t.MessageStrategy=B={}));var W;(function(S){function M(q){const j=q;return j&&(G.is(j.cancellationStrategy)||T.is(j.connectionStrategy)||B.is(j.messageStrategy))}S.is=M})(W||(t.ConnectionOptions=W={}));var I;(function(S){S[S.New=1]="New",S[S.Listening=2]="Listening",S[S.Closed=3]="Closed",S[S.Disposed=4]="Disposed"})(I||(I={}));function k(S,M,q,j){const z=q!==void 0?q:t.NullLogger;let J=0,U=0,le=0;const tt="2.0";let xt;const Zt=new Map;let qe;const gn=new Map,je=new Map;let ot,yt=new i.LinkedMap,Ue=new Map,vt=new Set,Je=new Map,he=f.Off,nt=p.Text,Oe,Nt=I.New;const Or=new s.Emitter,li=new s.Emitter,ui=new s.Emitter,di=new s.Emitter,fi=new s.Emitter,en=j&&j.cancellationStrategy?j.cancellationStrategy:G.Message;function hi(E){if(E===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+E.toString()}function os(E){return E===null?"res-unknown-"+(++le).toString():"res-"+E.toString()}function as(){return"not-"+(++U).toString()}function Dr(E,L){r.Message.isRequest(L)?E.set(hi(L.id),L):r.Message.isResponse(L)?E.set(os(L.id),L):E.set(as(),L)}function cs(E){}function pi(){return Nt===I.Listening}function gi(){return Nt===I.Closed}function Sn(){return Nt===I.Disposed}function mi(){(Nt===I.New||Nt===I.Listening)&&(Nt=I.Closed,li.fire(void 0))}function ls(E){Or.fire([E,void 0,void 0])}function us(E){Or.fire(E)}S.onClose(mi),S.onError(ls),M.onClose(mi),M.onError(us);function yi(){ot||yt.size===0||(ot=(0,e.default)().timer.setImmediate(()=>{ot=void 0,ds()}))}function vi(E){r.Message.isRequest(E)?hs(E):r.Message.isNotification(E)?wi(E):r.Message.isResponse(E)?ps(E):bi(E)}function ds(){if(yt.size===0)return;const E=yt.shift();try{const L=j?.messageStrategy;B.is(L)?L.handleMessage(E,vi):vi(E)}finally{yi()}}const fs=E=>{try{if(r.Message.isNotification(E)&&E.method===a.type.method){const L=E.params.id,H=hi(L),Y=yt.get(H);if(r.Message.isRequest(Y)){const me=j?.connectionStrategy,Ce=me&&me.cancelUndispatched?me.cancelUndispatched(Y,cs):void 0;if(Ce&&(Ce.error!==void 0||Ce.result!==void 0)){yt.delete(H),Je.delete(L),Ce.id=Y.id,cr(Ce,E.method,Date.now()),M.write(Ce).catch(()=>z.error("Sending response for canceled message failed."));return}}const we=Je.get(L);if(we!==void 0){we.cancel(),Lr(E);return}else vt.add(L)}Dr(yt,E)}finally{yi()}};function hs(E){if(Sn())return;function L(pe,De,Ae){const $t={jsonrpc:tt,id:E.id};pe instanceof r.ResponseError?$t.error=pe.toJson():$t.result=pe===void 0?null:pe,cr($t,De,Ae),M.write($t).catch(()=>z.error("Sending response failed."))}function H(pe,De,Ae){const $t={jsonrpc:tt,id:E.id,error:pe.toJson()};cr($t,De,Ae),M.write($t).catch(()=>z.error("Sending response failed."))}function Y(pe,De,Ae){pe===void 0&&(pe=null);const $t={jsonrpc:tt,id:E.id,result:pe};cr($t,De,Ae),M.write($t).catch(()=>z.error("Sending response failed."))}ys(E);const we=Zt.get(E.method);let me,Ce;we&&(me=we.type,Ce=we.handler);const te=Date.now();if(Ce||xt){const pe=E.id??String(Date.now()),De=_.is(en.receiver)?en.receiver.createCancellationTokenSource(pe):en.receiver.createCancellationTokenSource(E);E.id!==null&&vt.has(E.id)&&De.cancel(),E.id!==null&&Je.set(pe,De);try{let Ae;if(Ce)if(E.params===void 0){if(me!==void 0&&me.numberOfParams!==0){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines ${me.numberOfParams} params but received none.`),E.method,te);return}Ae=Ce(De.token)}else if(Array.isArray(E.params)){if(me!==void 0&&me.parameterStructures===r.ParameterStructures.byName){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by name but received parameters by position`),E.method,te);return}Ae=Ce(...E.params,De.token)}else{if(me!==void 0&&me.parameterStructures===r.ParameterStructures.byPosition){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by position but received parameters by name`),E.method,te);return}Ae=Ce(E.params,De.token)}else xt&&(Ae=xt(E.method,E.params,De.token));const $t=Ae;Ae?$t.then?$t.then(zt=>{Je.delete(pe),L(zt,E.method,te)},zt=>{Je.delete(pe),zt instanceof r.ResponseError?H(zt,E.method,te):zt&&n.string(zt.message)?H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${zt.message}`),E.method,te):H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,te)}):(Je.delete(pe),L(Ae,E.method,te)):(Je.delete(pe),Y(Ae,E.method,te))}catch(Ae){Je.delete(pe),Ae instanceof r.ResponseError?L(Ae,E.method,te):Ae&&n.string(Ae.message)?H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${Ae.message}`),E.method,te):H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,te)}}else H(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${E.method}`),E.method,te)}function ps(E){if(!Sn())if(E.id===null)E.error?z.error(`Received response message without id: Error is:
130
+ ${JSON.stringify(E.error,void 0,4)}`):z.error("Received response message without id. No further error information provided.");else{const L=E.id,H=Ue.get(L);if(vs(E,H),H!==void 0){Ue.delete(L);try{if(E.error){const Y=E.error;H.reject(new r.ResponseError(Y.code,Y.message,Y.data))}else if(E.result!==void 0)H.resolve(E.result);else throw new Error("Should never happen.")}catch(Y){Y.message?z.error(`Response handler '${H.method}' failed with message: ${Y.message}`):z.error(`Response handler '${H.method}' failed unexpectedly.`)}}}}function wi(E){if(Sn())return;let L,H;if(E.method===a.type.method){const Y=E.params.id;vt.delete(Y),Lr(E);return}else{const Y=gn.get(E.method);Y&&(H=Y.handler,L=Y.type)}if(H||qe)try{if(Lr(E),H)if(E.params===void 0)L!==void 0&&L.numberOfParams!==0&&L.parameterStructures!==r.ParameterStructures.byName&&z.error(`Notification ${E.method} defines ${L.numberOfParams} params but received none.`),H();else if(Array.isArray(E.params)){const Y=E.params;E.method===l.type.method&&Y.length===2&&c.is(Y[0])?H({token:Y[0],value:Y[1]}):(L!==void 0&&(L.parameterStructures===r.ParameterStructures.byName&&z.error(`Notification ${E.method} defines parameters by name but received parameters by position`),L.numberOfParams!==E.params.length&&z.error(`Notification ${E.method} defines ${L.numberOfParams} params but received ${Y.length} arguments`)),H(...Y))}else L!==void 0&&L.parameterStructures===r.ParameterStructures.byPosition&&z.error(`Notification ${E.method} defines parameters by position but received parameters by name`),H(E.params);else qe&&qe(E.method,E.params)}catch(Y){Y.message?z.error(`Notification handler '${E.method}' failed with message: ${Y.message}`):z.error(`Notification handler '${E.method}' failed unexpectedly.`)}else ui.fire(E)}function bi(E){if(!E){z.error("Received empty message.");return}z.error(`Received message which is neither a response nor a notification message:
131
+ ${JSON.stringify(E,null,4)}`);const L=E;if(n.string(L.id)||n.number(L.id)){const H=L.id,Y=Ue.get(H);Y&&Y.reject(new Error("The received response has neither a result nor an error property."))}}function tn(E){if(E!=null)switch(he){case f.Verbose:return JSON.stringify(E,null,4);case f.Compact:return JSON.stringify(E);default:return}}function gs(E){if(!(he===f.Off||!Oe))if(nt===p.Text){let L;(he===f.Verbose||he===f.Compact)&&E.params&&(L=`Params: ${tn(E.params)}
132
+
133
+ `),Oe.log(`Sending request '${E.method} - (${E.id})'.`,L)}else $n("send-request",E)}function ms(E){if(!(he===f.Off||!Oe))if(nt===p.Text){let L;(he===f.Verbose||he===f.Compact)&&(E.params?L=`Params: ${tn(E.params)}
134
+
135
+ `:L=`No parameters provided.
136
+
137
+ `),Oe.log(`Sending notification '${E.method}'.`,L)}else $n("send-notification",E)}function cr(E,L,H){if(!(he===f.Off||!Oe))if(nt===p.Text){let Y;(he===f.Verbose||he===f.Compact)&&(E.error&&E.error.data?Y=`Error data: ${tn(E.error.data)}
138
+
139
+ `:E.result?Y=`Result: ${tn(E.result)}
140
+
141
+ `:E.error===void 0&&(Y=`No result returned.
142
+
143
+ `)),Oe.log(`Sending response '${L} - (${E.id})'. Processing request took ${Date.now()-H}ms`,Y)}else $n("send-response",E)}function ys(E){if(!(he===f.Off||!Oe))if(nt===p.Text){let L;(he===f.Verbose||he===f.Compact)&&E.params&&(L=`Params: ${tn(E.params)}
144
+
145
+ `),Oe.log(`Received request '${E.method} - (${E.id})'.`,L)}else $n("receive-request",E)}function Lr(E){if(!(he===f.Off||!Oe||E.method===R.type.method))if(nt===p.Text){let L;(he===f.Verbose||he===f.Compact)&&(E.params?L=`Params: ${tn(E.params)}
146
+
147
+ `:L=`No parameters provided.
148
+
149
+ `),Oe.log(`Received notification '${E.method}'.`,L)}else $n("receive-notification",E)}function vs(E,L){if(!(he===f.Off||!Oe))if(nt===p.Text){let H;if((he===f.Verbose||he===f.Compact)&&(E.error&&E.error.data?H=`Error data: ${tn(E.error.data)}
150
+
151
+ `:E.result?H=`Result: ${tn(E.result)}
152
+
153
+ `:E.error===void 0&&(H=`No result returned.
154
+
155
+ `)),L){const Y=E.error?` Request failed: ${E.error.message} (${E.error.code}).`:"";Oe.log(`Received response '${L.method} - (${E.id})' in ${Date.now()-L.timerStart}ms.${Y}`,H)}else Oe.log(`Received response ${E.id} without active response promise.`,H)}else $n("receive-response",E)}function $n(E,L){if(!Oe||he===f.Off)return;const H={isLSPMessage:!0,type:E,message:L,timestamp:Date.now()};Oe.log(H)}function Gn(){if(gi())throw new v(b.Closed,"Connection is closed.");if(Sn())throw new v(b.Disposed,"Connection is disposed.")}function io(){if(pi())throw new v(b.AlreadyListening,"Connection is already listening")}function x(){if(!pi())throw new Error("Call listen() first.")}function w(E){return E===void 0?null:E}function C(E){if(E!==null)return E}function g(E){return E!=null&&!Array.isArray(E)&&typeof E=="object"}function $(E,L){switch(E){case r.ParameterStructures.auto:return g(L)?C(L):[w(L)];case r.ParameterStructures.byName:if(!g(L))throw new Error("Received parameters by name but param is not an object literal.");return C(L);case r.ParameterStructures.byPosition:return[w(L)];default:throw new Error(`Unknown parameter structure ${E.toString()}`)}}function m(E,L){let H;const Y=E.numberOfParams;switch(Y){case 0:H=void 0;break;case 1:H=$(E.parameterStructures,L[0]);break;default:H=[];for(let we=0;we<L.length&&we<Y;we++)H.push(w(L[we]));if(L.length<Y)for(let we=L.length;we<Y;we++)H.push(null);break}return H}const A={sendNotification:(E,...L)=>{Gn();let H,Y;if(n.string(E)){H=E;const me=L[0];let Ce=0,te=r.ParameterStructures.auto;r.ParameterStructures.is(me)&&(Ce=1,te=me);let pe=L.length;const De=pe-Ce;switch(De){case 0:Y=void 0;break;case 1:Y=$(te,L[Ce]);break;default:if(te===r.ParameterStructures.byName)throw new Error(`Received ${De} parameters for 'by Name' notification parameter structure.`);Y=L.slice(Ce,pe).map(Ae=>w(Ae));break}}else{const me=L;H=E.method,Y=m(E,me)}const we={jsonrpc:tt,method:H,params:Y};return ms(we),M.write(we).catch(me=>{throw z.error("Sending notification failed."),me})},onNotification:(E,L)=>{Gn();let H;return n.func(E)?qe=E:L&&(n.string(E)?(H=E,gn.set(E,{type:void 0,handler:L})):(H=E.method,gn.set(E.method,{type:E,handler:L}))),{dispose:()=>{H!==void 0?gn.delete(H):qe=void 0}}},onProgress:(E,L,H)=>{if(je.has(L))throw new Error(`Progress handler for token ${L} already registered`);return je.set(L,H),{dispose:()=>{je.delete(L)}}},sendProgress:(E,L,H)=>A.sendNotification(l.type,{token:L,value:H}),onUnhandledProgress:di.event,sendRequest:(E,...L)=>{Gn(),x();let H,Y,we;if(n.string(E)){H=E;const pe=L[0],De=L[L.length-1];let Ae=0,$t=r.ParameterStructures.auto;r.ParameterStructures.is(pe)&&(Ae=1,$t=pe);let zt=L.length;o.CancellationToken.is(De)&&(zt=zt-1,we=De);const lr=zt-Ae;switch(lr){case 0:Y=void 0;break;case 1:Y=$($t,L[Ae]);break;default:if($t===r.ParameterStructures.byName)throw new Error(`Received ${lr} parameters for 'by Name' request parameter structure.`);Y=L.slice(Ae,zt).map(yN=>w(yN));break}}else{const pe=L;H=E.method,Y=m(E,pe);const De=E.numberOfParams;we=o.CancellationToken.is(pe[De])?pe[De]:void 0}const me=J++;let Ce;we&&(Ce=we.onCancellationRequested(()=>{const pe=en.sender.sendCancellation(A,me);return pe===void 0?(z.log(`Received no promise from cancellation strategy when cancelling id ${me}`),Promise.resolve()):pe.catch(()=>{z.log(`Sending cancellation messages for id ${me} failed`)})}));const te={jsonrpc:tt,id:me,method:H,params:Y};return gs(te),typeof en.sender.enableCancellation=="function"&&en.sender.enableCancellation(te),new Promise(async(pe,De)=>{const Ae=lr=>{pe(lr),en.sender.cleanup(me),Ce?.dispose()},$t=lr=>{De(lr),en.sender.cleanup(me),Ce?.dispose()},zt={method:H,timerStart:Date.now(),resolve:Ae,reject:$t};try{await M.write(te),Ue.set(me,zt)}catch(lr){throw z.error("Sending request failed."),zt.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,lr.message?lr.message:"Unknown reason")),lr}})},onRequest:(E,L)=>{Gn();let H=null;return d.is(E)?(H=void 0,xt=E):n.string(E)?(H=null,L!==void 0&&(H=E,Zt.set(E,{handler:L,type:void 0}))):L!==void 0&&(H=E.method,Zt.set(E.method,{type:E,handler:L})),{dispose:()=>{H!==null&&(H!==void 0?Zt.delete(H):xt=void 0)}}},hasPendingResponse:()=>Ue.size>0,trace:async(E,L,H)=>{let Y=!1,we=p.Text;H!==void 0&&(n.boolean(H)?Y=H:(Y=H.sendNotification||!1,we=H.traceFormat||p.Text)),he=E,nt=we,he===f.Off?Oe=void 0:Oe=L,Y&&!gi()&&!Sn()&&await A.sendNotification(y.type,{value:f.toString(E)})},onError:Or.event,onClose:li.event,onUnhandledNotification:ui.event,onDispose:fi.event,end:()=>{M.end()},dispose:()=>{if(Sn())return;Nt=I.Disposed,fi.fire(void 0);const E=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const L of Ue.values())L.reject(E);Ue=new Map,Je=new Map,vt=new Set,yt=new i.LinkedMap,n.func(M.dispose)&&M.dispose(),n.func(S.dispose)&&S.dispose()},listen:()=>{Gn(),io(),Nt=I.Listening,S.listen(fs)},inspect:()=>{(0,e.default)().console.log("inspect")}};return A.onNotification(R.type,E=>{if(he===f.Off||!Oe)return;const L=he===f.Verbose||he===f.Compact;Oe.log(E.message,L?E.verbose:void 0)}),A.onNotification(l.type,E=>{const L=je.get(E.token);L?L(E.value):di.fire(E)}),A}t.createMessageConnection=k}(ky)),ky}var bk;function _y(){return bk||(bk=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=lk();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=dk();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=v8();Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=Rr;Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=Ni;Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const o=w8();Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});const a=b8();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 c=T8();Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});const l=E8();Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});const u=R8();Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}});const d=ei;t.RAL=d.default}($y)),$y}Object.defineProperty(Sy,"__esModule",{value:!0});const Tk=WN,ii=_y();class Pp extends ii.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return Pp.emptyBuffer}fromString(e,n){return Buffer.from(e,n)}toString(e,n){return e instanceof Buffer?e.toString(n):new Tk.TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,n):Buffer.from(e,0,n)}allocNative(e){return Buffer.allocUnsafe(e)}}Pp.emptyBuffer=Buffer.allocUnsafe(0);class S8{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ii.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ii.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ii.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),ii.Disposable.create(()=>this.stream.off("data",e))}}class $8{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ii.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ii.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ii.Disposable.create(()=>this.stream.off("end",e))}write(e,n){return new Promise((r,i)=>{const s=o=>{o==null?r():i(o)};typeof e=="string"?this.stream.write(e,n,s):this.stream.write(e,s)})}end(){this.stream.end()}}const Ek=Object.freeze({messageBuffer:Object.freeze({create:t=>new Pp(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(n){return Promise.reject(n)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new Tk.TextDecoder(e.charset).decode(t)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:t=>new S8(t),asWritableStream:t=>new $8(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){const r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){const n=setImmediate(t,...e);return{dispose:()=>clearImmediate(n)}},setInterval(t,e,...n){const r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function Cy(){return Ek}(function(t){function e(){ii.RAL.install(Ek)}t.install=e})(Cy||(Cy={})),Sy.default=Cy,function(t){var e=gt&&gt.__createBinding||(Object.create?function(I,k,S,M){M===void 0&&(M=S);var q=Object.getOwnPropertyDescriptor(k,S);(!q||("get"in q?!k.__esModule:q.writable||q.configurable))&&(q={enumerable:!0,get:function(){return k[S]}}),Object.defineProperty(I,M,q)}:function(I,k,S,M){M===void 0&&(M=S),I[M]=k[S]}),n=gt&&gt.__exportStar||function(I,k){for(var S in I)S!=="default"&&!Object.prototype.hasOwnProperty.call(k,S)&&e(k,I,S)};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=Sy;r.default.install();const i=$a,s=GN,o=Bb,a=zN,c=_y();n(_y(),t);class l extends c.AbstractMessageReader{constructor(k){super(),this.process=k;let S=this.process;S.on("error",M=>this.fireError(M)),S.on("close",()=>this.fireClose())}listen(k){return this.process.on("message",k),c.Disposable.create(()=>this.process.off("message",k))}}t.IPCMessageReader=l;class u extends c.AbstractMessageWriter{constructor(k){super(),this.process=k,this.errorCount=0;const S=this.process;S.on("error",M=>this.fireError(M)),S.on("close",()=>this.fireClose)}write(k){try{return typeof this.process.send=="function"&&this.process.send(k,void 0,void 0,S=>{S?(this.errorCount++,this.handleError(S,k)):this.errorCount=0}),Promise.resolve()}catch(S){return this.handleError(S,k),Promise.reject(S)}}handleError(k,S){this.errorCount++,this.fireError(k,S,this.errorCount)}end(){}}t.IPCMessageWriter=u;class d extends c.AbstractMessageReader{constructor(k){super(),this.onData=new c.Emitter,k.on("close",()=>this.fireClose),k.on("error",S=>this.fireError(S)),k.on("message",S=>{this.onData.fire(S)})}listen(k){return this.onData.event(k)}}t.PortMessageReader=d;class f extends c.AbstractMessageWriter{constructor(k){super(),this.port=k,this.errorCount=0,k.on("close",()=>this.fireClose()),k.on("error",S=>this.fireError(S))}write(k){try{return this.port.postMessage(k),Promise.resolve()}catch(S){return this.handleError(S,k),Promise.reject(S)}}handleError(k,S){this.errorCount++,this.fireError(k,S,this.errorCount)}end(){}}t.PortMessageWriter=f;class h extends c.ReadableStreamMessageReader{constructor(k,S="utf-8"){super((0,r.default)().stream.asReadableStream(k),S)}}t.SocketMessageReader=h;class p extends c.WriteableStreamMessageWriter{constructor(k,S){super((0,r.default)().stream.asWritableStream(k),S),this.socket=k}dispose(){super.dispose(),this.socket.destroy()}}t.SocketMessageWriter=p;class y extends c.ReadableStreamMessageReader{constructor(k,S){super((0,r.default)().stream.asReadableStream(k),S)}}t.StreamMessageReader=y;class R extends c.WriteableStreamMessageWriter{constructor(k,S){super((0,r.default)().stream.asWritableStream(k),S)}}t.StreamMessageWriter=R;const b=process.env.XDG_RUNTIME_DIR,v=new Map([["linux",107],["darwin",103]]);function T(){const I=(0,o.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${I}-sock`;let k;b?k=i.join(b,`vscode-ipc-${I}.sock`):k=i.join(s.tmpdir(),`vscode-${I}.sock`);const S=v.get(process.platform);return S!==void 0&&k.length>S&&(0,r.default)().console.warn(`WARNING: IPC handle "${k}" is longer than ${S} characters.`),k}t.generateRandomPipeName=T;function _(I,k="utf-8"){let S;const M=new Promise((q,j)=>{S=q});return new Promise((q,j)=>{let z=(0,a.createServer)(J=>{z.close(),S([new h(J,k),new p(J,k)])});z.on("error",j),z.listen(I,()=>{z.removeListener("error",j),q({onConnected:()=>M})})})}t.createClientPipeTransport=_;function N(I,k="utf-8"){const S=(0,a.createConnection)(I);return[new h(S,k),new p(S,k)]}t.createServerPipeTransport=N;function F(I,k="utf-8"){let S;const M=new Promise((q,j)=>{S=q});return new Promise((q,j)=>{const z=(0,a.createServer)(J=>{z.close(),S([new h(J,k),new p(J,k)])});z.on("error",j),z.listen(I,"127.0.0.1",()=>{z.removeListener("error",j),q({onConnected:()=>M})})})}t.createClientSocketTransport=F;function P(I,k="utf-8"){const S=(0,a.createConnection)(I,"127.0.0.1");return[new h(S,k),new p(S,k)]}t.createServerSocketTransport=P;function G(I){const k=I;return k.read!==void 0&&k.addListener!==void 0}function B(I){const k=I;return k.write!==void 0&&k.addListener!==void 0}function W(I,k,S,M){S||(S=c.NullLogger);const q=G(I)?new y(I):I,j=B(k)?new R(k):k;return c.ConnectionStrategy.is(M)&&(M={connectionStrategy:M}),(0,c.createMessageConnection)(q,j,S,M)}t.createMessageConnection=W}(un);var Rk=un,Sk={};function k8(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 Ay={exports:{}};(function(t,e){(function(n){{var r=n(k8,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(w){function C(g){return typeof g=="string"}w.is=C})(i||(r.DocumentUri=i={}));var s;(function(w){function C(g){return typeof g=="string"}w.is=C})(s||(r.URI=s={}));var o;(function(w){w.MIN_VALUE=-2147483648,w.MAX_VALUE=2147483647;function C(g){return typeof g=="number"&&w.MIN_VALUE<=g&&g<=w.MAX_VALUE}w.is=C})(o||(r.integer=o={}));var a;(function(w){w.MIN_VALUE=0,w.MAX_VALUE=2147483647;function C(g){return typeof g=="number"&&w.MIN_VALUE<=g&&g<=w.MAX_VALUE}w.is=C})(a||(r.uinteger=a={}));var c;(function(w){function C($,m){return $===Number.MAX_VALUE&&($=a.MAX_VALUE),m===Number.MAX_VALUE&&(m=a.MAX_VALUE),{line:$,character:m}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&x.uinteger(m.line)&&x.uinteger(m.character)}w.is=g})(c||(r.Position=c={}));var l;(function(w){function C($,m,A,E){if(x.uinteger($)&&x.uinteger(m)&&x.uinteger(A)&&x.uinteger(E))return{start:c.create($,m),end:c.create(A,E)};if(c.is($)&&c.is(m))return{start:$,end:m};throw new Error("Range#create called with invalid arguments[".concat($,", ").concat(m,", ").concat(A,", ").concat(E,"]"))}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&c.is(m.start)&&c.is(m.end)}w.is=g})(l||(r.Range=l={}));var u;(function(w){function C($,m){return{uri:$,range:m}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&l.is(m.range)&&(x.string(m.uri)||x.undefined(m.uri))}w.is=g})(u||(r.Location=u={}));var d;(function(w){function C($,m,A,E){return{targetUri:$,targetRange:m,targetSelectionRange:A,originSelectionRange:E}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&l.is(m.targetRange)&&x.string(m.targetUri)&&l.is(m.targetSelectionRange)&&(l.is(m.originSelectionRange)||x.undefined(m.originSelectionRange))}w.is=g})(d||(r.LocationLink=d={}));var f;(function(w){function C($,m,A,E){return{red:$,green:m,blue:A,alpha:E}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&x.numberRange(m.red,0,1)&&x.numberRange(m.green,0,1)&&x.numberRange(m.blue,0,1)&&x.numberRange(m.alpha,0,1)}w.is=g})(f||(r.Color=f={}));var h;(function(w){function C($,m){return{range:$,color:m}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&l.is(m.range)&&f.is(m.color)}w.is=g})(h||(r.ColorInformation=h={}));var p;(function(w){function C($,m,A){return{label:$,textEdit:m,additionalTextEdits:A}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&x.string(m.label)&&(x.undefined(m.textEdit)||P.is(m))&&(x.undefined(m.additionalTextEdits)||x.typedArray(m.additionalTextEdits,P.is))}w.is=g})(p||(r.ColorPresentation=p={}));var y;(function(w){w.Comment="comment",w.Imports="imports",w.Region="region"})(y||(r.FoldingRangeKind=y={}));var R;(function(w){function C($,m,A,E,L,H){var Y={startLine:$,endLine:m};return x.defined(A)&&(Y.startCharacter=A),x.defined(E)&&(Y.endCharacter=E),x.defined(L)&&(Y.kind=L),x.defined(H)&&(Y.collapsedText=H),Y}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&x.uinteger(m.startLine)&&x.uinteger(m.startLine)&&(x.undefined(m.startCharacter)||x.uinteger(m.startCharacter))&&(x.undefined(m.endCharacter)||x.uinteger(m.endCharacter))&&(x.undefined(m.kind)||x.string(m.kind))}w.is=g})(R||(r.FoldingRange=R={}));var b;(function(w){function C($,m){return{location:$,message:m}}w.create=C;function g($){var m=$;return x.defined(m)&&u.is(m.location)&&x.string(m.message)}w.is=g})(b||(r.DiagnosticRelatedInformation=b={}));var v;(function(w){w.Error=1,w.Warning=2,w.Information=3,w.Hint=4})(v||(r.DiagnosticSeverity=v={}));var T;(function(w){w.Unnecessary=1,w.Deprecated=2})(T||(r.DiagnosticTag=T={}));var _;(function(w){function C(g){var $=g;return x.objectLiteral($)&&x.string($.href)}w.is=C})(_||(r.CodeDescription=_={}));var N;(function(w){function C($,m,A,E,L,H){var Y={range:$,message:m};return x.defined(A)&&(Y.severity=A),x.defined(E)&&(Y.code=E),x.defined(L)&&(Y.source=L),x.defined(H)&&(Y.relatedInformation=H),Y}w.create=C;function g($){var m,A=$;return x.defined(A)&&l.is(A.range)&&x.string(A.message)&&(x.number(A.severity)||x.undefined(A.severity))&&(x.integer(A.code)||x.string(A.code)||x.undefined(A.code))&&(x.undefined(A.codeDescription)||x.string((m=A.codeDescription)===null||m===void 0?void 0:m.href))&&(x.string(A.source)||x.undefined(A.source))&&(x.undefined(A.relatedInformation)||x.typedArray(A.relatedInformation,b.is))}w.is=g})(N||(r.Diagnostic=N={}));var F;(function(w){function C($,m){for(var A=[],E=2;E<arguments.length;E++)A[E-2]=arguments[E];var L={title:$,command:m};return x.defined(A)&&A.length>0&&(L.arguments=A),L}w.create=C;function g($){var m=$;return x.defined(m)&&x.string(m.title)&&x.string(m.command)}w.is=g})(F||(r.Command=F={}));var P;(function(w){function C(A,E){return{range:A,newText:E}}w.replace=C;function g(A,E){return{range:{start:A,end:A},newText:E}}w.insert=g;function $(A){return{range:A,newText:""}}w.del=$;function m(A){var E=A;return x.objectLiteral(E)&&x.string(E.newText)&&l.is(E.range)}w.is=m})(P||(r.TextEdit=P={}));var G;(function(w){function C($,m,A){var E={label:$};return m!==void 0&&(E.needsConfirmation=m),A!==void 0&&(E.description=A),E}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&x.string(m.label)&&(x.boolean(m.needsConfirmation)||m.needsConfirmation===void 0)&&(x.string(m.description)||m.description===void 0)}w.is=g})(G||(r.ChangeAnnotation=G={}));var B;(function(w){function C(g){var $=g;return x.string($)}w.is=C})(B||(r.ChangeAnnotationIdentifier=B={}));var W;(function(w){function C(A,E,L){return{range:A,newText:E,annotationId:L}}w.replace=C;function g(A,E,L){return{range:{start:A,end:A},newText:E,annotationId:L}}w.insert=g;function $(A,E){return{range:A,newText:"",annotationId:E}}w.del=$;function m(A){var E=A;return P.is(E)&&(G.is(E.annotationId)||B.is(E.annotationId))}w.is=m})(W||(r.AnnotatedTextEdit=W={}));var I;(function(w){function C($,m){return{textDocument:$,edits:m}}w.create=C;function g($){var m=$;return x.defined(m)&&tt.is(m.textDocument)&&Array.isArray(m.edits)}w.is=g})(I||(r.TextDocumentEdit=I={}));var k;(function(w){function C($,m,A){var E={kind:"create",uri:$};return m!==void 0&&(m.overwrite!==void 0||m.ignoreIfExists!==void 0)&&(E.options=m),A!==void 0&&(E.annotationId=A),E}w.create=C;function g($){var m=$;return m&&m.kind==="create"&&x.string(m.uri)&&(m.options===void 0||(m.options.overwrite===void 0||x.boolean(m.options.overwrite))&&(m.options.ignoreIfExists===void 0||x.boolean(m.options.ignoreIfExists)))&&(m.annotationId===void 0||B.is(m.annotationId))}w.is=g})(k||(r.CreateFile=k={}));var S;(function(w){function C($,m,A,E){var L={kind:"rename",oldUri:$,newUri:m};return A!==void 0&&(A.overwrite!==void 0||A.ignoreIfExists!==void 0)&&(L.options=A),E!==void 0&&(L.annotationId=E),L}w.create=C;function g($){var m=$;return m&&m.kind==="rename"&&x.string(m.oldUri)&&x.string(m.newUri)&&(m.options===void 0||(m.options.overwrite===void 0||x.boolean(m.options.overwrite))&&(m.options.ignoreIfExists===void 0||x.boolean(m.options.ignoreIfExists)))&&(m.annotationId===void 0||B.is(m.annotationId))}w.is=g})(S||(r.RenameFile=S={}));var M;(function(w){function C($,m,A){var E={kind:"delete",uri:$};return m!==void 0&&(m.recursive!==void 0||m.ignoreIfNotExists!==void 0)&&(E.options=m),A!==void 0&&(E.annotationId=A),E}w.create=C;function g($){var m=$;return m&&m.kind==="delete"&&x.string(m.uri)&&(m.options===void 0||(m.options.recursive===void 0||x.boolean(m.options.recursive))&&(m.options.ignoreIfNotExists===void 0||x.boolean(m.options.ignoreIfNotExists)))&&(m.annotationId===void 0||B.is(m.annotationId))}w.is=g})(M||(r.DeleteFile=M={}));var q;(function(w){function C(g){var $=g;return $&&($.changes!==void 0||$.documentChanges!==void 0)&&($.documentChanges===void 0||$.documentChanges.every(function(m){return x.string(m.kind)?k.is(m)||S.is(m)||M.is(m):I.is(m)}))}w.is=C})(q||(r.WorkspaceEdit=q={}));var j=function(){function w(C,g){this.edits=C,this.changeAnnotations=g}return w.prototype.insert=function(C,g,$){var m,A;if($===void 0?m=P.insert(C,g):B.is($)?(A=$,m=W.insert(C,g,$)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage($),m=W.insert(C,g,A)),this.edits.push(m),A!==void 0)return A},w.prototype.replace=function(C,g,$){var m,A;if($===void 0?m=P.replace(C,g):B.is($)?(A=$,m=W.replace(C,g,$)):(this.assertChangeAnnotations(this.changeAnnotations),A=this.changeAnnotations.manage($),m=W.replace(C,g,A)),this.edits.push(m),A!==void 0)return A},w.prototype.delete=function(C,g){var $,m;if(g===void 0?$=P.del(C):B.is(g)?(m=g,$=W.del(C,g)):(this.assertChangeAnnotations(this.changeAnnotations),m=this.changeAnnotations.manage(g),$=W.del(C,m)),this.edits.push($),m!==void 0)return m},w.prototype.add=function(C){this.edits.push(C)},w.prototype.all=function(){return this.edits},w.prototype.clear=function(){this.edits.splice(0,this.edits.length)},w.prototype.assertChangeAnnotations=function(C){if(C===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},w}(),z=function(){function w(C){this._annotations=C===void 0?Object.create(null):C,this._counter=0,this._size=0}return w.prototype.all=function(){return this._annotations},Object.defineProperty(w.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),w.prototype.manage=function(C,g){var $;if(B.is(C)?$=C:($=this.nextId(),g=C),this._annotations[$]!==void 0)throw new Error("Id ".concat($," is already in use."));if(g===void 0)throw new Error("No annotation provided for id ".concat($));return this._annotations[$]=g,this._size++,$},w.prototype.nextId=function(){return this._counter++,this._counter.toString()},w}(),J=function(){function w(C){var g=this;this._textEditChanges=Object.create(null),C!==void 0?(this._workspaceEdit=C,C.documentChanges?(this._changeAnnotations=new z(C.changeAnnotations),C.changeAnnotations=this._changeAnnotations.all(),C.documentChanges.forEach(function($){if(I.is($)){var m=new j($.edits,g._changeAnnotations);g._textEditChanges[$.textDocument.uri]=m}})):C.changes&&Object.keys(C.changes).forEach(function($){var m=new j(C.changes[$]);g._textEditChanges[$]=m})):this._workspaceEdit={}}return Object.defineProperty(w.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}),w.prototype.getTextEditChange=function(C){if(tt.is(C)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g={uri:C.uri,version:C.version},$=this._textEditChanges[g.uri];if(!$){var m=[],A={textDocument:g,edits:m};this._workspaceEdit.documentChanges.push(A),$=new j(m,this._changeAnnotations),this._textEditChanges[g.uri]=$}return $}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var $=this._textEditChanges[C];if(!$){var m=[];this._workspaceEdit.changes[C]=m,$=new j(m),this._textEditChanges[C]=$}return $}},w.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new z,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},w.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},w.prototype.createFile=function(C,g,$){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var m;G.is(g)||B.is(g)?m=g:$=g;var A,E;if(m===void 0?A=k.create(C,$):(E=B.is(m)?m:this._changeAnnotations.manage(m),A=k.create(C,$,E)),this._workspaceEdit.documentChanges.push(A),E!==void 0)return E},w.prototype.renameFile=function(C,g,$,m){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var A;G.is($)||B.is($)?A=$:m=$;var E,L;if(A===void 0?E=S.create(C,g,m):(L=B.is(A)?A:this._changeAnnotations.manage(A),E=S.create(C,g,m,L)),this._workspaceEdit.documentChanges.push(E),L!==void 0)return L},w.prototype.deleteFile=function(C,g,$){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var m;G.is(g)||B.is(g)?m=g:$=g;var A,E;if(m===void 0?A=M.create(C,$):(E=B.is(m)?m:this._changeAnnotations.manage(m),A=M.create(C,$,E)),this._workspaceEdit.documentChanges.push(A),E!==void 0)return E},w}();r.WorkspaceChange=J;var U;(function(w){function C($){return{uri:$}}w.create=C;function g($){var m=$;return x.defined(m)&&x.string(m.uri)}w.is=g})(U||(r.TextDocumentIdentifier=U={}));var le;(function(w){function C($,m){return{uri:$,version:m}}w.create=C;function g($){var m=$;return x.defined(m)&&x.string(m.uri)&&x.integer(m.version)}w.is=g})(le||(r.VersionedTextDocumentIdentifier=le={}));var tt;(function(w){function C($,m){return{uri:$,version:m}}w.create=C;function g($){var m=$;return x.defined(m)&&x.string(m.uri)&&(m.version===null||x.integer(m.version))}w.is=g})(tt||(r.OptionalVersionedTextDocumentIdentifier=tt={}));var xt;(function(w){function C($,m,A,E){return{uri:$,languageId:m,version:A,text:E}}w.create=C;function g($){var m=$;return x.defined(m)&&x.string(m.uri)&&x.string(m.languageId)&&x.integer(m.version)&&x.string(m.text)}w.is=g})(xt||(r.TextDocumentItem=xt={}));var Zt;(function(w){w.PlainText="plaintext",w.Markdown="markdown";function C(g){var $=g;return $===w.PlainText||$===w.Markdown}w.is=C})(Zt||(r.MarkupKind=Zt={}));var qe;(function(w){function C(g){var $=g;return x.objectLiteral(g)&&Zt.is($.kind)&&x.string($.value)}w.is=C})(qe||(r.MarkupContent=qe={}));var gn;(function(w){w.Text=1,w.Method=2,w.Function=3,w.Constructor=4,w.Field=5,w.Variable=6,w.Class=7,w.Interface=8,w.Module=9,w.Property=10,w.Unit=11,w.Value=12,w.Enum=13,w.Keyword=14,w.Snippet=15,w.Color=16,w.File=17,w.Reference=18,w.Folder=19,w.EnumMember=20,w.Constant=21,w.Struct=22,w.Event=23,w.Operator=24,w.TypeParameter=25})(gn||(r.CompletionItemKind=gn={}));var je;(function(w){w.PlainText=1,w.Snippet=2})(je||(r.InsertTextFormat=je={}));var ot;(function(w){w.Deprecated=1})(ot||(r.CompletionItemTag=ot={}));var yt;(function(w){function C($,m,A){return{newText:$,insert:m,replace:A}}w.create=C;function g($){var m=$;return m&&x.string(m.newText)&&l.is(m.insert)&&l.is(m.replace)}w.is=g})(yt||(r.InsertReplaceEdit=yt={}));var Ue;(function(w){w.asIs=1,w.adjustIndentation=2})(Ue||(r.InsertTextMode=Ue={}));var vt;(function(w){function C(g){var $=g;return $&&(x.string($.detail)||$.detail===void 0)&&(x.string($.description)||$.description===void 0)}w.is=C})(vt||(r.CompletionItemLabelDetails=vt={}));var Je;(function(w){function C(g){return{label:g}}w.create=C})(Je||(r.CompletionItem=Je={}));var he;(function(w){function C(g,$){return{items:g||[],isIncomplete:!!$}}w.create=C})(he||(r.CompletionList=he={}));var nt;(function(w){function C($){return $.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}w.fromPlainText=C;function g($){var m=$;return x.string(m)||x.objectLiteral(m)&&x.string(m.language)&&x.string(m.value)}w.is=g})(nt||(r.MarkedString=nt={}));var Oe;(function(w){function C(g){var $=g;return!!$&&x.objectLiteral($)&&(qe.is($.contents)||nt.is($.contents)||x.typedArray($.contents,nt.is))&&(g.range===void 0||l.is(g.range))}w.is=C})(Oe||(r.Hover=Oe={}));var Nt;(function(w){function C(g,$){return $?{label:g,documentation:$}:{label:g}}w.create=C})(Nt||(r.ParameterInformation=Nt={}));var Or;(function(w){function C(g,$){for(var m=[],A=2;A<arguments.length;A++)m[A-2]=arguments[A];var E={label:g};return x.defined($)&&(E.documentation=$),x.defined(m)?E.parameters=m:E.parameters=[],E}w.create=C})(Or||(r.SignatureInformation=Or={}));var li;(function(w){w.Text=1,w.Read=2,w.Write=3})(li||(r.DocumentHighlightKind=li={}));var ui;(function(w){function C(g,$){var m={range:g};return x.number($)&&(m.kind=$),m}w.create=C})(ui||(r.DocumentHighlight=ui={}));var di;(function(w){w.File=1,w.Module=2,w.Namespace=3,w.Package=4,w.Class=5,w.Method=6,w.Property=7,w.Field=8,w.Constructor=9,w.Enum=10,w.Interface=11,w.Function=12,w.Variable=13,w.Constant=14,w.String=15,w.Number=16,w.Boolean=17,w.Array=18,w.Object=19,w.Key=20,w.Null=21,w.EnumMember=22,w.Struct=23,w.Event=24,w.Operator=25,w.TypeParameter=26})(di||(r.SymbolKind=di={}));var fi;(function(w){w.Deprecated=1})(fi||(r.SymbolTag=fi={}));var en;(function(w){function C(g,$,m,A,E){var L={name:g,kind:$,location:{uri:A,range:m}};return E&&(L.containerName=E),L}w.create=C})(en||(r.SymbolInformation=en={}));var hi;(function(w){function C(g,$,m,A){return A!==void 0?{name:g,kind:$,location:{uri:m,range:A}}:{name:g,kind:$,location:{uri:m}}}w.create=C})(hi||(r.WorkspaceSymbol=hi={}));var os;(function(w){function C($,m,A,E,L,H){var Y={name:$,detail:m,kind:A,range:E,selectionRange:L};return H!==void 0&&(Y.children=H),Y}w.create=C;function g($){var m=$;return m&&x.string(m.name)&&x.number(m.kind)&&l.is(m.range)&&l.is(m.selectionRange)&&(m.detail===void 0||x.string(m.detail))&&(m.deprecated===void 0||x.boolean(m.deprecated))&&(m.children===void 0||Array.isArray(m.children))&&(m.tags===void 0||Array.isArray(m.tags))}w.is=g})(os||(r.DocumentSymbol=os={}));var as;(function(w){w.Empty="",w.QuickFix="quickfix",w.Refactor="refactor",w.RefactorExtract="refactor.extract",w.RefactorInline="refactor.inline",w.RefactorRewrite="refactor.rewrite",w.Source="source",w.SourceOrganizeImports="source.organizeImports",w.SourceFixAll="source.fixAll"})(as||(r.CodeActionKind=as={}));var Dr;(function(w){w.Invoked=1,w.Automatic=2})(Dr||(r.CodeActionTriggerKind=Dr={}));var cs;(function(w){function C($,m,A){var E={diagnostics:$};return m!=null&&(E.only=m),A!=null&&(E.triggerKind=A),E}w.create=C;function g($){var m=$;return x.defined(m)&&x.typedArray(m.diagnostics,N.is)&&(m.only===void 0||x.typedArray(m.only,x.string))&&(m.triggerKind===void 0||m.triggerKind===Dr.Invoked||m.triggerKind===Dr.Automatic)}w.is=g})(cs||(r.CodeActionContext=cs={}));var pi;(function(w){function C($,m,A){var E={title:$},L=!0;return typeof m=="string"?(L=!1,E.kind=m):F.is(m)?E.command=m:E.edit=m,L&&A!==void 0&&(E.kind=A),E}w.create=C;function g($){var m=$;return m&&x.string(m.title)&&(m.diagnostics===void 0||x.typedArray(m.diagnostics,N.is))&&(m.kind===void 0||x.string(m.kind))&&(m.edit!==void 0||m.command!==void 0)&&(m.command===void 0||F.is(m.command))&&(m.isPreferred===void 0||x.boolean(m.isPreferred))&&(m.edit===void 0||q.is(m.edit))}w.is=g})(pi||(r.CodeAction=pi={}));var gi;(function(w){function C($,m){var A={range:$};return x.defined(m)&&(A.data=m),A}w.create=C;function g($){var m=$;return x.defined(m)&&l.is(m.range)&&(x.undefined(m.command)||F.is(m.command))}w.is=g})(gi||(r.CodeLens=gi={}));var Sn;(function(w){function C($,m){return{tabSize:$,insertSpaces:m}}w.create=C;function g($){var m=$;return x.defined(m)&&x.uinteger(m.tabSize)&&x.boolean(m.insertSpaces)}w.is=g})(Sn||(r.FormattingOptions=Sn={}));var mi;(function(w){function C($,m,A){return{range:$,target:m,data:A}}w.create=C;function g($){var m=$;return x.defined(m)&&l.is(m.range)&&(x.undefined(m.target)||x.string(m.target))}w.is=g})(mi||(r.DocumentLink=mi={}));var ls;(function(w){function C($,m){return{range:$,parent:m}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&l.is(m.range)&&(m.parent===void 0||w.is(m.parent))}w.is=g})(ls||(r.SelectionRange=ls={}));var us;(function(w){w.namespace="namespace",w.type="type",w.class="class",w.enum="enum",w.interface="interface",w.struct="struct",w.typeParameter="typeParameter",w.parameter="parameter",w.variable="variable",w.property="property",w.enumMember="enumMember",w.event="event",w.function="function",w.method="method",w.macro="macro",w.keyword="keyword",w.modifier="modifier",w.comment="comment",w.string="string",w.number="number",w.regexp="regexp",w.operator="operator",w.decorator="decorator"})(us||(r.SemanticTokenTypes=us={}));var yi;(function(w){w.declaration="declaration",w.definition="definition",w.readonly="readonly",w.static="static",w.deprecated="deprecated",w.abstract="abstract",w.async="async",w.modification="modification",w.documentation="documentation",w.defaultLibrary="defaultLibrary"})(yi||(r.SemanticTokenModifiers=yi={}));var vi;(function(w){function C(g){var $=g;return x.objectLiteral($)&&($.resultId===void 0||typeof $.resultId=="string")&&Array.isArray($.data)&&($.data.length===0||typeof $.data[0]=="number")}w.is=C})(vi||(r.SemanticTokens=vi={}));var ds;(function(w){function C($,m){return{range:$,text:m}}w.create=C;function g($){var m=$;return m!=null&&l.is(m.range)&&x.string(m.text)}w.is=g})(ds||(r.InlineValueText=ds={}));var fs;(function(w){function C($,m,A){return{range:$,variableName:m,caseSensitiveLookup:A}}w.create=C;function g($){var m=$;return m!=null&&l.is(m.range)&&x.boolean(m.caseSensitiveLookup)&&(x.string(m.variableName)||m.variableName===void 0)}w.is=g})(fs||(r.InlineValueVariableLookup=fs={}));var hs;(function(w){function C($,m){return{range:$,expression:m}}w.create=C;function g($){var m=$;return m!=null&&l.is(m.range)&&(x.string(m.expression)||m.expression===void 0)}w.is=g})(hs||(r.InlineValueEvaluatableExpression=hs={}));var ps;(function(w){function C($,m){return{frameId:$,stoppedLocation:m}}w.create=C;function g($){var m=$;return x.defined(m)&&l.is($.stoppedLocation)}w.is=g})(ps||(r.InlineValueContext=ps={}));var wi;(function(w){w.Type=1,w.Parameter=2;function C(g){return g===1||g===2}w.is=C})(wi||(r.InlayHintKind=wi={}));var bi;(function(w){function C($){return{value:$}}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&(m.tooltip===void 0||x.string(m.tooltip)||qe.is(m.tooltip))&&(m.location===void 0||u.is(m.location))&&(m.command===void 0||F.is(m.command))}w.is=g})(bi||(r.InlayHintLabelPart=bi={}));var tn;(function(w){function C($,m,A){var E={position:$,label:m};return A!==void 0&&(E.kind=A),E}w.create=C;function g($){var m=$;return x.objectLiteral(m)&&c.is(m.position)&&(x.string(m.label)||x.typedArray(m.label,bi.is))&&(m.kind===void 0||wi.is(m.kind))&&m.textEdits===void 0||x.typedArray(m.textEdits,P.is)&&(m.tooltip===void 0||x.string(m.tooltip)||qe.is(m.tooltip))&&(m.paddingLeft===void 0||x.boolean(m.paddingLeft))&&(m.paddingRight===void 0||x.boolean(m.paddingRight))}w.is=g})(tn||(r.InlayHint=tn={}));var gs;(function(w){function C(g){return{kind:"snippet",value:g}}w.createSnippet=C})(gs||(r.StringValue=gs={}));var ms;(function(w){function C(g,$,m,A){return{insertText:g,filterText:$,range:m,command:A}}w.create=C})(ms||(r.InlineCompletionItem=ms={}));var cr;(function(w){function C(g){return{items:g}}w.create=C})(cr||(r.InlineCompletionList=cr={}));var ys;(function(w){w.Invoked=0,w.Automatic=1})(ys||(r.InlineCompletionTriggerKind=ys={}));var Lr;(function(w){function C(g,$){return{range:g,text:$}}w.create=C})(Lr||(r.SelectedCompletionInfo=Lr={}));var vs;(function(w){function C(g,$){return{triggerKind:g,selectedCompletionInfo:$}}w.create=C})(vs||(r.InlineCompletionContext=vs={}));var $n;(function(w){function C(g){var $=g;return x.objectLiteral($)&&s.is($.uri)&&x.string($.name)}w.is=C})($n||(r.WorkspaceFolder=$n={})),r.EOL=[`
156
+ `,`\r
157
+ `,"\r"];var Gn;(function(w){function C(A,E,L,H){return new io(A,E,L,H)}w.create=C;function g(A){var E=A;return!!(x.defined(E)&&x.string(E.uri)&&(x.undefined(E.languageId)||x.string(E.languageId))&&x.uinteger(E.lineCount)&&x.func(E.getText)&&x.func(E.positionAt)&&x.func(E.offsetAt))}w.is=g;function $(A,E){for(var L=A.getText(),H=m(E,function(pe,De){var Ae=pe.range.start.line-De.range.start.line;return Ae===0?pe.range.start.character-De.range.start.character:Ae}),Y=L.length,we=H.length-1;we>=0;we--){var me=H[we],Ce=A.offsetAt(me.range.start),te=A.offsetAt(me.range.end);if(te<=Y)L=L.substring(0,Ce)+me.newText+L.substring(te,L.length);else throw new Error("Overlapping edit");Y=Ce}return L}w.applyEdits=$;function m(A,E){if(A.length<=1)return A;var L=A.length/2|0,H=A.slice(0,L),Y=A.slice(L);m(H,E),m(Y,E);for(var we=0,me=0,Ce=0;we<H.length&&me<Y.length;){var te=E(H[we],Y[me]);te<=0?A[Ce++]=H[we++]:A[Ce++]=Y[me++]}for(;we<H.length;)A[Ce++]=H[we++];for(;me<Y.length;)A[Ce++]=Y[me++];return A}})(Gn||(r.TextDocument=Gn={}));var io=function(){function w(C,g,$,m){this._uri=C,this._languageId=g,this._version=$,this._content=m,this._lineOffsets=void 0}return Object.defineProperty(w.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),w.prototype.getText=function(C){if(C){var g=this.offsetAt(C.start),$=this.offsetAt(C.end);return this._content.substring(g,$)}return this._content},w.prototype.update=function(C,g){this._content=C.text,this._version=g,this._lineOffsets=void 0},w.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var C=[],g=this._content,$=!0,m=0;m<g.length;m++){$&&(C.push(m),$=!1);var A=g.charAt(m);$=A==="\r"||A===`
158
+ `,A==="\r"&&m+1<g.length&&g.charAt(m+1)===`
159
+ `&&m++}$&&g.length>0&&C.push(g.length),this._lineOffsets=C}return this._lineOffsets},w.prototype.positionAt=function(C){C=Math.max(Math.min(C,this._content.length),0);var g=this.getLineOffsets(),$=0,m=g.length;if(m===0)return c.create(0,C);for(;$<m;){var A=Math.floor(($+m)/2);g[A]>C?m=A:$=A+1}var E=$-1;return c.create(E,C-g[E])},w.prototype.offsetAt=function(C){var g=this.getLineOffsets();if(C.line>=g.length)return this._content.length;if(C.line<0)return 0;var $=g[C.line],m=C.line+1<g.length?g[C.line+1]:this._content.length;return Math.max(Math.min($+C.character,m),$)},Object.defineProperty(w.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),w}(),x;(function(w){var C=Object.prototype.toString;function g(te){return typeof te<"u"}w.defined=g;function $(te){return typeof te>"u"}w.undefined=$;function m(te){return te===!0||te===!1}w.boolean=m;function A(te){return C.call(te)==="[object String]"}w.string=A;function E(te){return C.call(te)==="[object Number]"}w.number=E;function L(te,pe,De){return C.call(te)==="[object Number]"&&pe<=te&&te<=De}w.numberRange=L;function H(te){return C.call(te)==="[object Number]"&&-2147483648<=te&&te<=2147483647}w.integer=H;function Y(te){return C.call(te)==="[object Number]"&&0<=te&&te<=2147483647}w.uinteger=Y;function we(te){return C.call(te)==="[object Function]"}w.func=we;function me(te){return te!==null&&typeof te=="object"}w.objectLiteral=me;function Ce(te,pe){return Array.isArray(te)&&te.every(pe)}w.typedArray=Ce})(x||(x={}))})})(Ay,Ay.exports);var Iy=Ay.exports,Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.ProtocolNotificationType=Te.ProtocolNotificationType0=Te.ProtocolRequestType=Te.ProtocolRequestType0=Te.RegistrationType=Te.MessageDirection=void 0;const Lo=un;var $k;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})($k||(Te.MessageDirection=$k={}));class _8{constructor(e){this.method=e}}Te.RegistrationType=_8;class C8 extends Lo.RequestType0{constructor(e){super(e)}}Te.ProtocolRequestType0=C8;class A8 extends Lo.RequestType{constructor(e){super(e,Lo.ParameterStructures.byName)}}Te.ProtocolRequestType=A8;class I8 extends Lo.NotificationType0{constructor(e){super(e)}}Te.ProtocolNotificationType0=I8;class P8 extends Lo.NotificationType{constructor(e){super(e,Lo.ParameterStructures.byName)}}Te.ProtocolNotificationType=P8;var kk={},ft={};Object.defineProperty(ft,"__esModule",{value:!0}),ft.objectLiteral=ft.typedArray=ft.stringArray=ft.array=ft.func=ft.error=ft.number=ft.string=ft.boolean=void 0;function x8(t){return t===!0||t===!1}ft.boolean=x8;function _k(t){return typeof t=="string"||t instanceof String}ft.string=_k;function N8(t){return typeof t=="number"||t instanceof Number}ft.number=N8;function O8(t){return t instanceof Error}ft.error=O8;function D8(t){return typeof t=="function"}ft.func=D8;function Ck(t){return Array.isArray(t)}ft.array=Ck;function L8(t){return Ck(t)&&t.every(e=>_k(e))}ft.stringArray=L8;function M8(t,e){return Array.isArray(t)&&t.every(e)}ft.typedArray=M8;function F8(t){return t!==null&&typeof t=="object"}ft.objectLiteral=F8;var ff={};Object.defineProperty(ff,"__esModule",{value:!0}),ff.ImplementationRequest=void 0;const Ak=Te;var Ik;(function(t){t.method="textDocument/implementation",t.messageDirection=Ak.MessageDirection.clientToServer,t.type=new Ak.ProtocolRequestType(t.method)})(Ik||(ff.ImplementationRequest=Ik={}));var hf={};Object.defineProperty(hf,"__esModule",{value:!0}),hf.TypeDefinitionRequest=void 0;const Pk=Te;var xk;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=Pk.MessageDirection.clientToServer,t.type=new Pk.ProtocolRequestType(t.method)})(xk||(hf.TypeDefinitionRequest=xk={}));var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.DidChangeWorkspaceFoldersNotification=Mo.WorkspaceFoldersRequest=void 0;const pf=Te;var Nk;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=pf.MessageDirection.serverToClient,t.type=new pf.ProtocolRequestType0(t.method)})(Nk||(Mo.WorkspaceFoldersRequest=Nk={}));var Ok;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=pf.MessageDirection.clientToServer,t.type=new pf.ProtocolNotificationType(t.method)})(Ok||(Mo.DidChangeWorkspaceFoldersNotification=Ok={}));var gf={};Object.defineProperty(gf,"__esModule",{value:!0}),gf.ConfigurationRequest=void 0;const Dk=Te;var Lk;(function(t){t.method="workspace/configuration",t.messageDirection=Dk.MessageDirection.serverToClient,t.type=new Dk.ProtocolRequestType(t.method)})(Lk||(gf.ConfigurationRequest=Lk={}));var Fo={};Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.ColorPresentationRequest=Fo.DocumentColorRequest=void 0;const mf=Te;var Mk;(function(t){t.method="textDocument/documentColor",t.messageDirection=mf.MessageDirection.clientToServer,t.type=new mf.ProtocolRequestType(t.method)})(Mk||(Fo.DocumentColorRequest=Mk={}));var Fk;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=mf.MessageDirection.clientToServer,t.type=new mf.ProtocolRequestType(t.method)})(Fk||(Fo.ColorPresentationRequest=Fk={}));var jo={};Object.defineProperty(jo,"__esModule",{value:!0}),jo.FoldingRangeRefreshRequest=jo.FoldingRangeRequest=void 0;const yf=Te;var jk;(function(t){t.method="textDocument/foldingRange",t.messageDirection=yf.MessageDirection.clientToServer,t.type=new yf.ProtocolRequestType(t.method)})(jk||(jo.FoldingRangeRequest=jk={}));var Uk;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=yf.MessageDirection.serverToClient,t.type=new yf.ProtocolRequestType0(t.method)})(Uk||(jo.FoldingRangeRefreshRequest=Uk={}));var vf={};Object.defineProperty(vf,"__esModule",{value:!0}),vf.DeclarationRequest=void 0;const Bk=Te;var qk;(function(t){t.method="textDocument/declaration",t.messageDirection=Bk.MessageDirection.clientToServer,t.type=new Bk.ProtocolRequestType(t.method)})(qk||(vf.DeclarationRequest=qk={}));var wf={};Object.defineProperty(wf,"__esModule",{value:!0}),wf.SelectionRangeRequest=void 0;const Wk=Te;var Gk;(function(t){t.method="textDocument/selectionRange",t.messageDirection=Wk.MessageDirection.clientToServer,t.type=new Wk.ProtocolRequestType(t.method)})(Gk||(wf.SelectionRangeRequest=Gk={}));var Di={};Object.defineProperty(Di,"__esModule",{value:!0}),Di.WorkDoneProgressCancelNotification=Di.WorkDoneProgressCreateRequest=Di.WorkDoneProgress=void 0;const j8=un,bf=Te;var zk;(function(t){t.type=new j8.ProgressType;function e(n){return n===t.type}t.is=e})(zk||(Di.WorkDoneProgress=zk={}));var Hk;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=bf.MessageDirection.serverToClient,t.type=new bf.ProtocolRequestType(t.method)})(Hk||(Di.WorkDoneProgressCreateRequest=Hk={}));var Vk;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=bf.MessageDirection.clientToServer,t.type=new bf.ProtocolNotificationType(t.method)})(Vk||(Di.WorkDoneProgressCancelNotification=Vk={}));var Li={};Object.defineProperty(Li,"__esModule",{value:!0}),Li.CallHierarchyOutgoingCallsRequest=Li.CallHierarchyIncomingCallsRequest=Li.CallHierarchyPrepareRequest=void 0;const Uo=Te;var Kk;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Uo.MessageDirection.clientToServer,t.type=new Uo.ProtocolRequestType(t.method)})(Kk||(Li.CallHierarchyPrepareRequest=Kk={}));var Yk;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Uo.MessageDirection.clientToServer,t.type=new Uo.ProtocolRequestType(t.method)})(Yk||(Li.CallHierarchyIncomingCallsRequest=Yk={}));var Xk;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Uo.MessageDirection.clientToServer,t.type=new Uo.ProtocolRequestType(t.method)})(Xk||(Li.CallHierarchyOutgoingCallsRequest=Xk={}));var dn={};Object.defineProperty(dn,"__esModule",{value:!0}),dn.SemanticTokensRefreshRequest=dn.SemanticTokensRangeRequest=dn.SemanticTokensDeltaRequest=dn.SemanticTokensRequest=dn.SemanticTokensRegistrationType=dn.TokenFormat=void 0;const si=Te;var Jk;(function(t){t.Relative="relative"})(Jk||(dn.TokenFormat=Jk={}));var Wc;(function(t){t.method="textDocument/semanticTokens",t.type=new si.RegistrationType(t.method)})(Wc||(dn.SemanticTokensRegistrationType=Wc={}));var Qk;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolRequestType(t.method),t.registrationMethod=Wc.method})(Qk||(dn.SemanticTokensRequest=Qk={}));var Zk;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolRequestType(t.method),t.registrationMethod=Wc.method})(Zk||(dn.SemanticTokensDeltaRequest=Zk={}));var e1;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolRequestType(t.method),t.registrationMethod=Wc.method})(e1||(dn.SemanticTokensRangeRequest=e1={}));var t1;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=si.MessageDirection.serverToClient,t.type=new si.ProtocolRequestType0(t.method)})(t1||(dn.SemanticTokensRefreshRequest=t1={}));var Tf={};Object.defineProperty(Tf,"__esModule",{value:!0}),Tf.ShowDocumentRequest=void 0;const n1=Te;var r1;(function(t){t.method="window/showDocument",t.messageDirection=n1.MessageDirection.serverToClient,t.type=new n1.ProtocolRequestType(t.method)})(r1||(Tf.ShowDocumentRequest=r1={}));var Ef={};Object.defineProperty(Ef,"__esModule",{value:!0}),Ef.LinkedEditingRangeRequest=void 0;const i1=Te;var s1;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=i1.MessageDirection.clientToServer,t.type=new i1.ProtocolRequestType(t.method)})(s1||(Ef.LinkedEditingRangeRequest=s1={}));var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.WillDeleteFilesRequest=Bt.DidDeleteFilesNotification=Bt.DidRenameFilesNotification=Bt.WillRenameFilesRequest=Bt.DidCreateFilesNotification=Bt.WillCreateFilesRequest=Bt.FileOperationPatternKind=void 0;const Dn=Te;var o1;(function(t){t.file="file",t.folder="folder"})(o1||(Bt.FileOperationPatternKind=o1={}));var a1;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Dn.MessageDirection.clientToServer,t.type=new Dn.ProtocolRequestType(t.method)})(a1||(Bt.WillCreateFilesRequest=a1={}));var c1;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Dn.MessageDirection.clientToServer,t.type=new Dn.ProtocolNotificationType(t.method)})(c1||(Bt.DidCreateFilesNotification=c1={}));var l1;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Dn.MessageDirection.clientToServer,t.type=new Dn.ProtocolRequestType(t.method)})(l1||(Bt.WillRenameFilesRequest=l1={}));var u1;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Dn.MessageDirection.clientToServer,t.type=new Dn.ProtocolNotificationType(t.method)})(u1||(Bt.DidRenameFilesNotification=u1={}));var d1;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Dn.MessageDirection.clientToServer,t.type=new Dn.ProtocolNotificationType(t.method)})(d1||(Bt.DidDeleteFilesNotification=d1={}));var f1;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Dn.MessageDirection.clientToServer,t.type=new Dn.ProtocolRequestType(t.method)})(f1||(Bt.WillDeleteFilesRequest=f1={}));var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.MonikerRequest=Mi.MonikerKind=Mi.UniquenessLevel=void 0;const h1=Te;var p1;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(p1||(Mi.UniquenessLevel=p1={}));var g1;(function(t){t.$import="import",t.$export="export",t.local="local"})(g1||(Mi.MonikerKind=g1={}));var m1;(function(t){t.method="textDocument/moniker",t.messageDirection=h1.MessageDirection.clientToServer,t.type=new h1.ProtocolRequestType(t.method)})(m1||(Mi.MonikerRequest=m1={}));var Fi={};Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.TypeHierarchySubtypesRequest=Fi.TypeHierarchySupertypesRequest=Fi.TypeHierarchyPrepareRequest=void 0;const Bo=Te;var y1;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Bo.MessageDirection.clientToServer,t.type=new Bo.ProtocolRequestType(t.method)})(y1||(Fi.TypeHierarchyPrepareRequest=y1={}));var v1;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Bo.MessageDirection.clientToServer,t.type=new Bo.ProtocolRequestType(t.method)})(v1||(Fi.TypeHierarchySupertypesRequest=v1={}));var w1;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Bo.MessageDirection.clientToServer,t.type=new Bo.ProtocolRequestType(t.method)})(w1||(Fi.TypeHierarchySubtypesRequest=w1={}));var qo={};Object.defineProperty(qo,"__esModule",{value:!0}),qo.InlineValueRefreshRequest=qo.InlineValueRequest=void 0;const Rf=Te;var b1;(function(t){t.method="textDocument/inlineValue",t.messageDirection=Rf.MessageDirection.clientToServer,t.type=new Rf.ProtocolRequestType(t.method)})(b1||(qo.InlineValueRequest=b1={}));var T1;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=Rf.MessageDirection.serverToClient,t.type=new Rf.ProtocolRequestType0(t.method)})(T1||(qo.InlineValueRefreshRequest=T1={}));var ji={};Object.defineProperty(ji,"__esModule",{value:!0}),ji.InlayHintRefreshRequest=ji.InlayHintResolveRequest=ji.InlayHintRequest=void 0;const Wo=Te;var E1;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(E1||(ji.InlayHintRequest=E1={}));var R1;(function(t){t.method="inlayHint/resolve",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(R1||(ji.InlayHintResolveRequest=R1={}));var S1;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Wo.MessageDirection.serverToClient,t.type=new Wo.ProtocolRequestType0(t.method)})(S1||(ji.InlayHintRefreshRequest=S1={}));var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.DiagnosticRefreshRequest=Ln.WorkspaceDiagnosticRequest=Ln.DocumentDiagnosticRequest=Ln.DocumentDiagnosticReportKind=Ln.DiagnosticServerCancellationData=void 0;const $1=un,U8=ft,Go=Te;var k1;(function(t){function e(n){const r=n;return r&&U8.boolean(r.retriggerRequest)}t.is=e})(k1||(Ln.DiagnosticServerCancellationData=k1={}));var _1;(function(t){t.Full="full",t.Unchanged="unchanged"})(_1||(Ln.DocumentDiagnosticReportKind=_1={}));var C1;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method),t.partialResult=new $1.ProgressType})(C1||(Ln.DocumentDiagnosticRequest=C1={}));var A1;(function(t){t.method="workspace/diagnostic",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method),t.partialResult=new $1.ProgressType})(A1||(Ln.WorkspaceDiagnosticRequest=A1={}));var I1;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Go.MessageDirection.serverToClient,t.type=new Go.ProtocolRequestType0(t.method)})(I1||(Ln.DiagnosticRefreshRequest=I1={}));var ht={};Object.defineProperty(ht,"__esModule",{value:!0}),ht.DidCloseNotebookDocumentNotification=ht.DidSaveNotebookDocumentNotification=ht.DidChangeNotebookDocumentNotification=ht.NotebookCellArrayChange=ht.DidOpenNotebookDocumentNotification=ht.NotebookDocumentSyncRegistrationType=ht.NotebookDocument=ht.NotebookCell=ht.ExecutionSummary=ht.NotebookCellKind=void 0;const Gc=Iy,Zn=ft,$r=Te;var Py;(function(t){t.Markup=1,t.Code=2;function e(n){return n===1||n===2}t.is=e})(Py||(ht.NotebookCellKind=Py={}));var xy;(function(t){function e(i,s){const o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function n(i){const s=i;return Zn.objectLiteral(s)&&Gc.uinteger.is(s.executionOrder)&&(s.success===void 0||Zn.boolean(s.success))}t.is=n;function r(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=r})(xy||(ht.ExecutionSummary=xy={}));var Sf;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function n(s){const o=s;return Zn.objectLiteral(o)&&Py.is(o.kind)&&Gc.DocumentUri.is(o.document)&&(o.metadata===void 0||Zn.objectLiteral(o.metadata))}t.is=n;function r(s,o){const a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!xy.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=r;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;const a=Array.isArray(s),c=Array.isArray(o);if(a!==c)return!1;if(a&&c){if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1}if(Zn.objectLiteral(s)&&Zn.objectLiteral(o)){const l=Object.keys(s),u=Object.keys(o);if(l.length!==u.length||(l.sort(),u.sort(),!i(l,u)))return!1;for(let d=0;d<l.length;d++){const f=l[d];if(!i(s[f],o[f]))return!1}}return!0}})(Sf||(ht.NotebookCell=Sf={}));var P1;(function(t){function e(r,i,s,o){return{uri:r,notebookType:i,version:s,cells:o}}t.create=e;function n(r){const i=r;return Zn.objectLiteral(i)&&Zn.string(i.uri)&&Gc.integer.is(i.version)&&Zn.typedArray(i.cells,Sf.is)}t.is=n})(P1||(ht.NotebookDocument=P1={}));var zo;(function(t){t.method="notebookDocument/sync",t.messageDirection=$r.MessageDirection.clientToServer,t.type=new $r.RegistrationType(t.method)})(zo||(ht.NotebookDocumentSyncRegistrationType=zo={}));var x1;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=$r.MessageDirection.clientToServer,t.type=new $r.ProtocolNotificationType(t.method),t.registrationMethod=zo.method})(x1||(ht.DidOpenNotebookDocumentNotification=x1={}));var N1;(function(t){function e(r){const i=r;return Zn.objectLiteral(i)&&Gc.uinteger.is(i.start)&&Gc.uinteger.is(i.deleteCount)&&(i.cells===void 0||Zn.typedArray(i.cells,Sf.is))}t.is=e;function n(r,i,s){const o={start:r,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=n})(N1||(ht.NotebookCellArrayChange=N1={}));var O1;(function(t){t.method="notebookDocument/didChange",t.messageDirection=$r.MessageDirection.clientToServer,t.type=new $r.ProtocolNotificationType(t.method),t.registrationMethod=zo.method})(O1||(ht.DidChangeNotebookDocumentNotification=O1={}));var D1;(function(t){t.method="notebookDocument/didSave",t.messageDirection=$r.MessageDirection.clientToServer,t.type=new $r.ProtocolNotificationType(t.method),t.registrationMethod=zo.method})(D1||(ht.DidSaveNotebookDocumentNotification=D1={}));var L1;(function(t){t.method="notebookDocument/didClose",t.messageDirection=$r.MessageDirection.clientToServer,t.type=new $r.ProtocolNotificationType(t.method),t.registrationMethod=zo.method})(L1||(ht.DidCloseNotebookDocumentNotification=L1={}));var $f={};Object.defineProperty($f,"__esModule",{value:!0}),$f.InlineCompletionRequest=void 0;const M1=Te;var F1;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=M1.MessageDirection.clientToServer,t.type=new M1.ProtocolRequestType(t.method)})(F1||($f.InlineCompletionRequest=F1={})),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=Te,n=Iy,r=ft,i=ff;Object.defineProperty(t,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=hf;Object.defineProperty(t,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=Mo;Object.defineProperty(t,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),Object.defineProperty(t,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=gf;Object.defineProperty(t,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=Fo;Object.defineProperty(t,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(t,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const l=jo;Object.defineProperty(t,"FoldingRangeRequest",{enumerable:!0,get:function(){return l.FoldingRangeRequest}}),Object.defineProperty(t,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return l.FoldingRangeRefreshRequest}});const u=vf;Object.defineProperty(t,"DeclarationRequest",{enumerable:!0,get:function(){return u.DeclarationRequest}});const d=wf;Object.defineProperty(t,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=Di;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 h=Li;Object.defineProperty(t,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(t,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(t,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return h.CallHierarchyPrepareRequest}});const p=dn;Object.defineProperty(t,"TokenFormat",{enumerable:!0,get:function(){return p.TokenFormat}}),Object.defineProperty(t,"SemanticTokensRequest",{enumerable:!0,get:function(){return p.SemanticTokensRequest}}),Object.defineProperty(t,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return p.SemanticTokensDeltaRequest}}),Object.defineProperty(t,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return p.SemanticTokensRangeRequest}}),Object.defineProperty(t,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return p.SemanticTokensRefreshRequest}}),Object.defineProperty(t,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return p.SemanticTokensRegistrationType}});const y=Tf;Object.defineProperty(t,"ShowDocumentRequest",{enumerable:!0,get:function(){return y.ShowDocumentRequest}});const R=Ef;Object.defineProperty(t,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return R.LinkedEditingRangeRequest}});const b=Bt;Object.defineProperty(t,"FileOperationPatternKind",{enumerable:!0,get:function(){return b.FileOperationPatternKind}}),Object.defineProperty(t,"DidCreateFilesNotification",{enumerable:!0,get:function(){return b.DidCreateFilesNotification}}),Object.defineProperty(t,"WillCreateFilesRequest",{enumerable:!0,get:function(){return b.WillCreateFilesRequest}}),Object.defineProperty(t,"DidRenameFilesNotification",{enumerable:!0,get:function(){return b.DidRenameFilesNotification}}),Object.defineProperty(t,"WillRenameFilesRequest",{enumerable:!0,get:function(){return b.WillRenameFilesRequest}}),Object.defineProperty(t,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return b.DidDeleteFilesNotification}}),Object.defineProperty(t,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return b.WillDeleteFilesRequest}});const v=Mi;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 T=Fi;Object.defineProperty(t,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return T.TypeHierarchyPrepareRequest}}),Object.defineProperty(t,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return T.TypeHierarchySubtypesRequest}}),Object.defineProperty(t,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return T.TypeHierarchySupertypesRequest}});const _=qo;Object.defineProperty(t,"InlineValueRequest",{enumerable:!0,get:function(){return _.InlineValueRequest}}),Object.defineProperty(t,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return _.InlineValueRefreshRequest}});const N=ji;Object.defineProperty(t,"InlayHintRequest",{enumerable:!0,get:function(){return N.InlayHintRequest}}),Object.defineProperty(t,"InlayHintResolveRequest",{enumerable:!0,get:function(){return N.InlayHintResolveRequest}}),Object.defineProperty(t,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return N.InlayHintRefreshRequest}});const F=Ln;Object.defineProperty(t,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return F.DiagnosticServerCancellationData}}),Object.defineProperty(t,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return F.DocumentDiagnosticReportKind}}),Object.defineProperty(t,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return F.DocumentDiagnosticRequest}}),Object.defineProperty(t,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return F.WorkspaceDiagnosticRequest}}),Object.defineProperty(t,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return F.DiagnosticRefreshRequest}});const P=ht;Object.defineProperty(t,"NotebookCellKind",{enumerable:!0,get:function(){return P.NotebookCellKind}}),Object.defineProperty(t,"ExecutionSummary",{enumerable:!0,get:function(){return P.ExecutionSummary}}),Object.defineProperty(t,"NotebookCell",{enumerable:!0,get:function(){return P.NotebookCell}}),Object.defineProperty(t,"NotebookDocument",{enumerable:!0,get:function(){return P.NotebookDocument}}),Object.defineProperty(t,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return P.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(t,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return P.DidOpenNotebookDocumentNotification}}),Object.defineProperty(t,"NotebookCellArrayChange",{enumerable:!0,get:function(){return P.NotebookCellArrayChange}}),Object.defineProperty(t,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return P.DidChangeNotebookDocumentNotification}}),Object.defineProperty(t,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return P.DidSaveNotebookDocumentNotification}}),Object.defineProperty(t,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return P.DidCloseNotebookDocumentNotification}});const G=$f;Object.defineProperty(t,"InlineCompletionRequest",{enumerable:!0,get:function(){return G.InlineCompletionRequest}});var B;(function(g){function $(m){const A=m;return r.string(A)||r.string(A.language)||r.string(A.scheme)||r.string(A.pattern)}g.is=$})(B||(t.TextDocumentFilter=B={}));var W;(function(g){function $(m){const A=m;return r.objectLiteral(A)&&(r.string(A.notebookType)||r.string(A.scheme)||r.string(A.pattern))}g.is=$})(W||(t.NotebookDocumentFilter=W={}));var I;(function(g){function $(m){const A=m;return r.objectLiteral(A)&&(r.string(A.notebook)||W.is(A.notebook))&&(A.language===void 0||r.string(A.language))}g.is=$})(I||(t.NotebookCellTextDocumentFilter=I={}));var k;(function(g){function $(m){if(!Array.isArray(m))return!1;for(let A of m)if(!r.string(A)&&!B.is(A)&&!I.is(A))return!1;return!0}g.is=$})(k||(t.DocumentSelector=k={}));var S;(function(g){g.method="client/registerCapability",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(S||(t.RegistrationRequest=S={}));var M;(function(g){g.method="client/unregisterCapability",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(M||(t.UnregistrationRequest=M={}));var q;(function(g){g.Create="create",g.Rename="rename",g.Delete="delete"})(q||(t.ResourceOperationKind=q={}));var j;(function(g){g.Abort="abort",g.Transactional="transactional",g.TextOnlyTransactional="textOnlyTransactional",g.Undo="undo"})(j||(t.FailureHandlingKind=j={}));var z;(function(g){g.UTF8="utf-8",g.UTF16="utf-16",g.UTF32="utf-32"})(z||(t.PositionEncodingKind=z={}));var J;(function(g){function $(m){const A=m;return A&&r.string(A.id)&&A.id.length>0}g.hasId=$})(J||(t.StaticRegistrationOptions=J={}));var U;(function(g){function $(m){const A=m;return A&&(A.documentSelector===null||k.is(A.documentSelector))}g.is=$})(U||(t.TextDocumentRegistrationOptions=U={}));var le;(function(g){function $(A){const E=A;return r.objectLiteral(E)&&(E.workDoneProgress===void 0||r.boolean(E.workDoneProgress))}g.is=$;function m(A){const E=A;return E&&r.boolean(E.workDoneProgress)}g.hasWorkDoneProgress=m})(le||(t.WorkDoneProgressOptions=le={}));var tt;(function(g){g.method="initialize",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(tt||(t.InitializeRequest=tt={}));var xt;(function(g){g.unknownProtocolVersion=1})(xt||(t.InitializeErrorCodes=xt={}));var Zt;(function(g){g.method="initialized",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(Zt||(t.InitializedNotification=Zt={}));var qe;(function(g){g.method="shutdown",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType0(g.method)})(qe||(t.ShutdownRequest=qe={}));var gn;(function(g){g.method="exit",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType0(g.method)})(gn||(t.ExitNotification=gn={}));var je;(function(g){g.method="workspace/didChangeConfiguration",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(je||(t.DidChangeConfigurationNotification=je={}));var ot;(function(g){g.Error=1,g.Warning=2,g.Info=3,g.Log=4,g.Debug=5})(ot||(t.MessageType=ot={}));var yt;(function(g){g.method="window/showMessage",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(yt||(t.ShowMessageNotification=yt={}));var Ue;(function(g){g.method="window/showMessageRequest",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(Ue||(t.ShowMessageRequest=Ue={}));var vt;(function(g){g.method="window/logMessage",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(vt||(t.LogMessageNotification=vt={}));var Je;(function(g){g.method="telemetry/event",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(Je||(t.TelemetryEventNotification=Je={}));var he;(function(g){g.None=0,g.Full=1,g.Incremental=2})(he||(t.TextDocumentSyncKind=he={}));var nt;(function(g){g.method="textDocument/didOpen",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(nt||(t.DidOpenTextDocumentNotification=nt={}));var Oe;(function(g){function $(A){let E=A;return E!=null&&typeof E.text=="string"&&E.range!==void 0&&(E.rangeLength===void 0||typeof E.rangeLength=="number")}g.isIncremental=$;function m(A){let E=A;return E!=null&&typeof E.text=="string"&&E.range===void 0&&E.rangeLength===void 0}g.isFull=m})(Oe||(t.TextDocumentContentChangeEvent=Oe={}));var Nt;(function(g){g.method="textDocument/didChange",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(Nt||(t.DidChangeTextDocumentNotification=Nt={}));var Or;(function(g){g.method="textDocument/didClose",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(Or||(t.DidCloseTextDocumentNotification=Or={}));var li;(function(g){g.method="textDocument/didSave",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(li||(t.DidSaveTextDocumentNotification=li={}));var ui;(function(g){g.Manual=1,g.AfterDelay=2,g.FocusOut=3})(ui||(t.TextDocumentSaveReason=ui={}));var di;(function(g){g.method="textDocument/willSave",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(di||(t.WillSaveTextDocumentNotification=di={}));var fi;(function(g){g.method="textDocument/willSaveWaitUntil",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(fi||(t.WillSaveTextDocumentWaitUntilRequest=fi={}));var en;(function(g){g.method="workspace/didChangeWatchedFiles",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(en||(t.DidChangeWatchedFilesNotification=en={}));var hi;(function(g){g.Created=1,g.Changed=2,g.Deleted=3})(hi||(t.FileChangeType=hi={}));var os;(function(g){function $(m){const A=m;return r.objectLiteral(A)&&(n.URI.is(A.baseUri)||n.WorkspaceFolder.is(A.baseUri))&&r.string(A.pattern)}g.is=$})(os||(t.RelativePattern=os={}));var as;(function(g){g.Create=1,g.Change=2,g.Delete=4})(as||(t.WatchKind=as={}));var Dr;(function(g){g.method="textDocument/publishDiagnostics",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(Dr||(t.PublishDiagnosticsNotification=Dr={}));var cs;(function(g){g.Invoked=1,g.TriggerCharacter=2,g.TriggerForIncompleteCompletions=3})(cs||(t.CompletionTriggerKind=cs={}));var pi;(function(g){g.method="textDocument/completion",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(pi||(t.CompletionRequest=pi={}));var gi;(function(g){g.method="completionItem/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(gi||(t.CompletionResolveRequest=gi={}));var Sn;(function(g){g.method="textDocument/hover",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Sn||(t.HoverRequest=Sn={}));var mi;(function(g){g.Invoked=1,g.TriggerCharacter=2,g.ContentChange=3})(mi||(t.SignatureHelpTriggerKind=mi={}));var ls;(function(g){g.method="textDocument/signatureHelp",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ls||(t.SignatureHelpRequest=ls={}));var us;(function(g){g.method="textDocument/definition",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(us||(t.DefinitionRequest=us={}));var yi;(function(g){g.method="textDocument/references",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(yi||(t.ReferencesRequest=yi={}));var vi;(function(g){g.method="textDocument/documentHighlight",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(vi||(t.DocumentHighlightRequest=vi={}));var ds;(function(g){g.method="textDocument/documentSymbol",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ds||(t.DocumentSymbolRequest=ds={}));var fs;(function(g){g.method="textDocument/codeAction",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(fs||(t.CodeActionRequest=fs={}));var hs;(function(g){g.method="codeAction/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(hs||(t.CodeActionResolveRequest=hs={}));var ps;(function(g){g.method="workspace/symbol",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ps||(t.WorkspaceSymbolRequest=ps={}));var wi;(function(g){g.method="workspaceSymbol/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(wi||(t.WorkspaceSymbolResolveRequest=wi={}));var bi;(function(g){g.method="textDocument/codeLens",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(bi||(t.CodeLensRequest=bi={}));var tn;(function(g){g.method="codeLens/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(tn||(t.CodeLensResolveRequest=tn={}));var gs;(function(g){g.method="workspace/codeLens/refresh",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType0(g.method)})(gs||(t.CodeLensRefreshRequest=gs={}));var ms;(function(g){g.method="textDocument/documentLink",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ms||(t.DocumentLinkRequest=ms={}));var cr;(function(g){g.method="documentLink/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(cr||(t.DocumentLinkResolveRequest=cr={}));var ys;(function(g){g.method="textDocument/formatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ys||(t.DocumentFormattingRequest=ys={}));var Lr;(function(g){g.method="textDocument/rangeFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Lr||(t.DocumentRangeFormattingRequest=Lr={}));var vs;(function(g){g.method="textDocument/rangesFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(vs||(t.DocumentRangesFormattingRequest=vs={}));var $n;(function(g){g.method="textDocument/onTypeFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})($n||(t.DocumentOnTypeFormattingRequest=$n={}));var Gn;(function(g){g.Identifier=1})(Gn||(t.PrepareSupportDefaultBehavior=Gn={}));var io;(function(g){g.method="textDocument/rename",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(io||(t.RenameRequest=io={}));var x;(function(g){g.method="textDocument/prepareRename",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(x||(t.PrepareRenameRequest=x={}));var w;(function(g){g.method="workspace/executeCommand",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(w||(t.ExecuteCommandRequest=w={}));var C;(function(g){g.method="workspace/applyEdit",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType("workspace/applyEdit")})(C||(t.ApplyWorkspaceEditRequest=C={}))}(kk);var kf={};Object.defineProperty(kf,"__esModule",{value:!0}),kf.createProtocolConnection=void 0;const j1=un;function B8(t,e,n,r){return j1.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,j1.createMessageConnection)(t,e,n,r)}kf.createProtocolConnection=B8,function(t){var e=gt&&gt.__createBinding||(Object.create?function(s,o,a,c){c===void 0&&(c=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,c,l)}:function(s,o,a,c){c===void 0&&(c=a),s[c]=o[a]}),n=gt&&gt.__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(un,t),n(Iy,t),n(Te,t),n(kk,t);var r=kf;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={}))}(Sk),function(t){var e=gt&&gt.__createBinding||(Object.create?function(s,o,a,c){c===void 0&&(c=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,c,l)}:function(s,o,a,c){c===void 0&&(c=a),s[c]=o[a]}),n=gt&&gt.__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=Rk;n(Rk,t),n(Sk,t);function i(s,o,a,c){return(0,r.createMessageConnection)(s,o,a,c)}t.createProtocolConnection=i}(Ve);var En={};Object.defineProperty(En,"__esModule",{value:!0}),En.generateUuid=En.parse=En.isUUID=En.v4=En.empty=void 0;class Ny{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}}class ve extends Ny{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return ve._oneOf(ve._chars)}constructor(){super([ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),"-",ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),"-","4",ve._randomHex(),ve._randomHex(),ve._randomHex(),"-",ve._oneOf(ve._timeHighBits),ve._randomHex(),ve._randomHex(),ve._randomHex(),"-",ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex(),ve._randomHex()].join(""))}}ve._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"],ve._timeHighBits=["8","9","a","b"],En.empty=new Ny("00000000-0000-0000-0000-000000000000");function U1(){return new ve}En.v4=U1;const q8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function B1(t){return q8.test(t)}En.isUUID=B1;function W8(t){if(!B1(t))throw new Error("invalid uuid");return new Ny(t)}En.parse=W8;function G8(){return U1().asHex()}En.generateUuid=G8;var Ui={};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.attachPartialResult=Ui.ProgressFeature=Ui.attachWorkDone=void 0;const Bi=Ve,z8=En;class ss{constructor(e,n){this._connection=e,this._token=n,ss.Instances.set(this._token,this)}begin(e,n,r,i){let s={kind:"begin",title:e,percentage:n,message:r,cancellable:i};this._connection.sendProgress(Bi.WorkDoneProgress.type,this._token,s)}report(e,n){let r={kind:"report"};typeof e=="number"?(r.percentage=e,n!==void 0&&(r.message=n)):r.message=e,this._connection.sendProgress(Bi.WorkDoneProgress.type,this._token,r)}done(){ss.Instances.delete(this._token),this._connection.sendProgress(Bi.WorkDoneProgress.type,this._token,{kind:"end"})}}ss.Instances=new Map;class q1 extends ss{constructor(e,n){super(e,n),this._source=new Bi.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}}class Oy{constructor(){}begin(){}report(){}done(){}}class W1 extends Oy{constructor(){super(),this._source=new Bi.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}}function H8(t,e){if(e===void 0||e.workDoneToken===void 0)return new Oy;const n=e.workDoneToken;return delete e.workDoneToken,new ss(t,n)}Ui.attachWorkDone=H8;const V8=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(Bi.WorkDoneProgressCancelNotification.type,n=>{let r=ss.Instances.get(n.token);(r instanceof q1||r instanceof W1)&&r.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Oy:new ss(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){const e=(0,z8.generateUuid)();return this.connection.sendRequest(Bi.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new q1(this.connection,e))}else return Promise.resolve(new W1)}};Ui.ProgressFeature=V8;var Dy;(function(t){t.type=new Bi.ProgressType})(Dy||(Dy={}));class K8{constructor(e,n){this._connection=e,this._token=n}report(e){this._connection.sendProgress(Dy.type,this._token,e)}}function Y8(t,e){if(e===void 0||e.partialResultToken===void 0)return;const n=e.partialResultToken;return delete e.partialResultToken,new K8(t,n)}Ui.attachPartialResult=Y8;var _f={};Object.defineProperty(_f,"__esModule",{value:!0}),_f.ConfigurationFeature=void 0;const X8=Ve,J8=dt,Q8=t=>class extends t{getConfiguration(e){return e?J8.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let n={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(X8.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(e)?r:r[0]:Array.isArray(e)?[]:null)}};_f.ConfigurationFeature=Q8;var Cf={};Object.defineProperty(Cf,"__esModule",{value:!0}),Cf.WorkspaceFoldersFeature=void 0;const Af=Ve,Z8=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let n=e.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Af.Emitter,this.connection.onNotification(Af.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);const n=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Af.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(Af.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Cf.WorkspaceFoldersFeature=Z8;var If={};Object.defineProperty(If,"__esModule",{value:!0}),If.CallHierarchyFeature=void 0;const Ly=Ve,e6=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(Ly.CallHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:e=>{const n=Ly.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:e=>{const n=Ly.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};If.CallHierarchyFeature=e6;var oi={};Object.defineProperty(oi,"__esModule",{value:!0}),oi.SemanticTokensBuilder=oi.SemanticTokensDiff=oi.SemanticTokensFeature=void 0;const Pf=Ve,t6=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Pf.SemanticTokensRefreshRequest.type),on:e=>{const n=Pf.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:e=>{const n=Pf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:e=>{const n=Pf.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};oi.SemanticTokensFeature=t6;class G1{constructor(e,n){this.originalSequence=e,this.modifiedSequence=n}computeDiff(){const e=this.originalSequence.length,n=this.modifiedSequence.length;let r=0;for(;r<n&&r<e&&this.originalSequence[r]===this.modifiedSequence[r];)r++;if(r<n&&r<e){let i=e-1,s=n-1;for(;i>=r&&s>=r&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<r||s<r)&&(i++,s++);const o=i-r+1,a=this.modifiedSequence.slice(r,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:r,deleteCount:o-1}]:[{start:r,deleteCount:o,data:a}]}else return r<n?[{start:r,deleteCount:0,data:this.modifiedSequence.slice(r)}]:r<e?[{start:r,deleteCount:e-r}]:[]}}oi.SemanticTokensDiff=G1;let n6=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,n,r,i,s){let o=e,a=n;this._dataLen>0&&(o-=this._prevLine,o===0&&(a-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=a,this._data[this._dataLen++]=r,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,this._prevLine=e,this._prevChar=n}get id(){return this._id.toString()}previousResult(e){this.id===e&&(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 G1(this._prevData,this._data).computeDiff()}:this.build()}};oi.SemanticTokensBuilder=n6;var xf={};Object.defineProperty(xf,"__esModule",{value:!0}),xf.ShowDocumentFeature=void 0;const r6=Ve,i6=t=>class extends t{showDocument(e){return this.connection.sendRequest(r6.ShowDocumentRequest.type,e)}};xf.ShowDocumentFeature=i6;var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.FileOperationsFeature=void 0;const Ho=Ve,s6=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Ho.DidCreateFilesNotification.type,n=>{e(n)})}onDidRenameFiles(e){return this.connection.onNotification(Ho.DidRenameFilesNotification.type,n=>{e(n)})}onDidDeleteFiles(e){return this.connection.onNotification(Ho.DidDeleteFilesNotification.type,n=>{e(n)})}onWillCreateFiles(e){return this.connection.onRequest(Ho.WillCreateFilesRequest.type,(n,r)=>e(n,r))}onWillRenameFiles(e){return this.connection.onRequest(Ho.WillRenameFilesRequest.type,(n,r)=>e(n,r))}onWillDeleteFiles(e){return this.connection.onRequest(Ho.WillDeleteFilesRequest.type,(n,r)=>e(n,r))}};Nf.FileOperationsFeature=s6;var Of={};Object.defineProperty(Of,"__esModule",{value:!0}),Of.LinkedEditingRangeFeature=void 0;const o6=Ve,a6=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(o6.LinkedEditingRangeRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0))}};Of.LinkedEditingRangeFeature=a6;var Df={};Object.defineProperty(Df,"__esModule",{value:!0}),Df.TypeHierarchyFeature=void 0;const My=Ve,c6=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(My.TypeHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:e=>{const n=My.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:e=>{const n=My.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Df.TypeHierarchyFeature=c6;var Lf={};Object.defineProperty(Lf,"__esModule",{value:!0}),Lf.InlineValueFeature=void 0;const z1=Ve,l6=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(z1.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(z1.InlineValueRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};Lf.InlineValueFeature=l6;var Mf={};Object.defineProperty(Mf,"__esModule",{value:!0}),Mf.FoldingRangeFeature=void 0;const H1=Ve,u6=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(H1.FoldingRangeRefreshRequest.type),on:e=>{const n=H1.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Mf.FoldingRangeFeature=u6;var Ff={};Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.InlayHintFeature=void 0;const Fy=Ve,d6=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Fy.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Fy.InlayHintRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n))),resolve:e=>this.connection.onRequest(Fy.InlayHintResolveRequest.type,(n,r)=>e(n,r))}}};Ff.InlayHintFeature=d6;var jf={};Object.defineProperty(jf,"__esModule",{value:!0}),jf.DiagnosticFeature=void 0;const zc=Ve,f6=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(zc.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(zc.DocumentDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(zc.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:e=>this.connection.onRequest(zc.WorkspaceDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(zc.WorkspaceDiagnosticRequest.partialResult,n)))}}};jf.DiagnosticFeature=f6;var Fs={},Hc={};Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.TextDocuments=void 0;const js=Ve;class h6{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new js.Emitter,this._onDidOpen=new js.Emitter,this._onDidClose=new js.Emitter,this._onDidSave=new js.Emitter,this._onWillSave=new js.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(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=js.TextDocumentSyncKind.Incremental;const n=[];return n.push(e.onDidOpenTextDocument(r=>{const i=r.textDocument,s=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,s);const o=Object.freeze({document:s});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),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`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,s,o),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),n.push(e.onDidCloseTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),n.push(e.onWillSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{let s=this._syncedDocuments.get(r.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),js.Disposable.create(()=>{n.forEach(r=>r.dispose())})}}Hc.TextDocuments=h6,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.NotebookDocuments=Fs.NotebookSyncFeature=void 0;const Mn=Ve,V1=Hc,p6=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Mn.DidOpenNotebookDocumentNotification.type,n=>{e(n)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Mn.DidChangeNotebookDocumentNotification.type,n=>{e(n)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Mn.DidSaveNotebookDocumentNotification.type,n=>{e(n)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Mn.DidCloseNotebookDocumentNotification.type,n=>{e(n)})}}};Fs.NotebookSyncFeature=p6;class Sa{onDidOpenTextDocument(e){return this.openHandler=e,Mn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Mn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Mn.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return Sa.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return Sa.NULL_DISPOSE}onDidSaveTextDocument(){return Sa.NULL_DISPOSE}}Sa.NULL_DISPOSE=Object.freeze({dispose:()=>{}});class g6{constructor(e){e instanceof V1.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new V1.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Mn.Emitter,this._onDidChange=new Mn.Emitter,this._onDidSave=new Mn.Emitter,this._onDidClose=new Mn.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){const n=this.notebookCellMap.get(e);return n&&n[0]}findNotebookDocumentForCell(e){const n=typeof e=="string"?e:e.document,r=this.notebookCellMap.get(n);return r&&r[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(e){const n=new Sa,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(const s of i.cellTextDocuments)n.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),r.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);if(s===void 0)return;s.version=i.notebookDocument.version;const o=s.metadata;let a=!1;const c=i.change;c.metadata!==void 0&&(a=!0,s.metadata=c.metadata);const l=[],u=[],d=[],f=[];if(c.cells!==void 0){const b=c.cells;if(b.structure!==void 0){const v=b.structure.array;if(s.cells.splice(v.start,v.deleteCount,...v.cells!==void 0?v.cells:[]),b.structure.didOpen!==void 0)for(const T of b.structure.didOpen)n.openTextDocument({textDocument:T}),l.push(T.uri);if(b.structure.didClose)for(const T of b.structure.didClose)n.closeTextDocument({textDocument:T}),u.push(T.uri)}if(b.data!==void 0){const v=new Map(b.data.map(T=>[T.document,T]));for(let T=0;T<=s.cells.length;T++){const _=v.get(s.cells[T].document);if(_!==void 0){const N=s.cells.splice(T,1,_);if(d.push({old:N[0],new:_}),v.delete(_.document),v.size===0)break}}}if(b.textContent!==void 0)for(const v of b.textContent)n.changeTextDocument({textDocument:v.document,contentChanges:v.changes}),f.push(v.document.uri)}this.updateCellMap(s);const h={notebookDocument:s};a&&(h.metadata={old:o,new:s.metadata});const p=[];for(const b of l)p.push(this.getNotebookCell(b));const y=[];for(const b of u)y.push(this.getNotebookCell(b));const R=[];for(const b of f)R.push(this.getNotebookCell(b));(p.length>0||y.length>0||d.length>0||R.length>0)&&(h.cells={added:p,removed:y,changed:{data:d,textContent:R}}),(h.metadata!==void 0||h.cells!==void 0)&&this._onDidChange.fire(h)})),r.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),r.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(const o of i.cellTextDocuments)n.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(const o of s.cells)this.notebookCellMap.delete(o.document)}})),Mn.Disposable.create(()=>{r.forEach(i=>i.dispose())})}updateCellMap(e){for(const n of e.cells)this.notebookCellMap.set(n.document,[n,e])}}Fs.NotebookDocuments=g6;var Uf={};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.MonikerFeature=void 0;const m6=Ve,y6=t=>class extends t{get moniker(){return{on:e=>{const n=m6.MonikerRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Uf.MonikerFeature=y6,Object.defineProperty(_e,"__esModule",{value:!0}),_e.createConnection=_e.combineFeatures=_e.combineNotebooksFeatures=_e.combineLanguagesFeatures=_e.combineWorkspaceFeatures=_e.combineWindowFeatures=_e.combineClientFeatures=_e.combineTracerFeatures=_e.combineTelemetryFeatures=_e.combineConsoleFeatures=_e._NotebooksImpl=_e._LanguagesImpl=_e.BulkUnregistration=_e.BulkRegistration=_e.ErrorMessageTracker=void 0;const X=Ve,Fn=dt,jy=En,ue=Ui,v6=_f,w6=Cf,b6=If,T6=oi,E6=xf,R6=Nf,S6=Of,$6=Df,k6=Lf,_6=Mf,C6=Ff,A6=jf,I6=Fs,P6=Uf;function Uy(t){if(t!==null)return t}class x6{constructor(){this._messages=Object.create(null)}add(e){let n=this._messages[e];n||(n=0),n++,this._messages[e]=n}sendErrors(e){Object.keys(this._messages).forEach(n=>{e.window.showErrorMessage(n)})}}_e.ErrorMessageTracker=x6;class K1{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(X.MessageType.Error,e)}warn(e){this.send(X.MessageType.Warning,e)}info(e){this.send(X.MessageType.Info,e)}log(e){this.send(X.MessageType.Log,e)}debug(e){this.send(X.MessageType.Debug,e)}send(e,n){this._rawConnection&&this._rawConnection.sendNotification(X.LogMessageNotification.type,{type:e,message:n}).catch(()=>{(0,X.RAL)().console.error("Sending log message failed")})}}class N6{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...n){let r={type:X.MessageType.Error,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(Uy)}showWarningMessage(e,...n){let r={type:X.MessageType.Warning,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(Uy)}showInformationMessage(e,...n){let r={type:X.MessageType.Info,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(Uy)}}const Y1=(0,E6.ShowDocumentFeature)((0,ue.ProgressFeature)(N6));var X1;(function(t){function e(){return new J1}t.create=e})(X1||(_e.BulkRegistration=X1={}));class J1{constructor(){this._registrations=[],this._registered=new Set}add(e,n){const r=Fn.string(e)?e:e.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);const i=jy.generateUuid();this._registrations.push({id:i,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}}var Q1;(function(t){function e(){return new By(void 0,[])}t.create=e})(Q1||(_e.BulkUnregistration=Q1={}));class By{constructor(e,n){this._connection=e,this._unregistrations=new Map,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let r of this._unregistrations.values())e.push(r);let n={unregisterations:e};this._connection.sendRequest(X.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){const n=Fn.string(e)?e:e.method,r=this._unregistrations.get(n);if(!r)return!1;let i={unregisterations:[r]};return this._connection.sendRequest(X.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(n)},s=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}}class Z1{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,n,r){return e instanceof J1?this.registerMany(e):e instanceof By?this.registerSingle1(e,n,r):this.registerSingle2(e,n)}registerSingle1(e,n,r){const i=Fn.string(n)?n:n.method,s=jy.generateUuid();let o={registrations:[{id:s,method:i,registerOptions:r||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(X.RegistrationRequest.type,o).then(a=>(e.add({id:s,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,n){const r=Fn.string(e)?e:e.method,i=jy.generateUuid();let s={registrations:[{id:i,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(X.RegistrationRequest.type,s).then(o=>X.Disposable.create(()=>{this.unregisterSingle(i,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(o)))}unregisterSingle(e,n){let r={unregisterations:[{id:e,method:n}]};return this.connection.sendRequest(X.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let n=e.asRegistrationParams();return this.connection.sendRequest(X.RegistrationRequest.type,n).then(()=>new By(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}}class O6{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function n(i){return i&&!!i.edit}let r=n(e)?e:{edit:e};return this.connection.sendRequest(X.ApplyWorkspaceEditRequest.type,r)}}const e_=(0,R6.FileOperationsFeature)((0,w6.WorkspaceFoldersFeature)((0,v6.ConfigurationFeature)(O6)));class t_{constructor(){this._trace=X.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,n){this._trace!==X.Trace.Off&&this.connection.sendNotification(X.LogTraceNotification.type,{message:e,verbose:this._trace===X.Trace.Verbose?n:void 0}).catch(()=>{})}}class n_{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(X.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}}class r_{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ue.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ue.attachPartialResult)(this.connection,n)}}_e._LanguagesImpl=r_;const i_=(0,_6.FoldingRangeFeature)((0,P6.MonikerFeature)((0,A6.DiagnosticFeature)((0,C6.InlayHintFeature)((0,k6.InlineValueFeature)((0,$6.TypeHierarchyFeature)((0,S6.LinkedEditingRangeFeature)((0,T6.SemanticTokensFeature)((0,b6.CallHierarchyFeature)(r_)))))))));class s_{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ue.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ue.attachPartialResult)(this.connection,n)}}_e._NotebooksImpl=s_;const o_=(0,I6.NotebookSyncFeature)(s_);function a_(t,e){return function(n){return e(t(n))}}_e.combineConsoleFeatures=a_;function c_(t,e){return function(n){return e(t(n))}}_e.combineTelemetryFeatures=c_;function l_(t,e){return function(n){return e(t(n))}}_e.combineTracerFeatures=l_;function u_(t,e){return function(n){return e(t(n))}}_e.combineClientFeatures=u_;function d_(t,e){return function(n){return e(t(n))}}_e.combineWindowFeatures=d_;function f_(t,e){return function(n){return e(t(n))}}_e.combineWorkspaceFeatures=f_;function h_(t,e){return function(n){return e(t(n))}}_e.combineLanguagesFeatures=h_;function p_(t,e){return function(n){return e(t(n))}}_e.combineNotebooksFeatures=p_;function D6(t,e){function n(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:n(t.console,e.console,a_),tracer:n(t.tracer,e.tracer,l_),telemetry:n(t.telemetry,e.telemetry,c_),client:n(t.client,e.client,u_),window:n(t.window,e.window,d_),workspace:n(t.workspace,e.workspace,f_),languages:n(t.languages,e.languages,h_),notebooks:n(t.notebooks,e.notebooks,p_)}}_e.combineFeatures=D6;function L6(t,e,n){const r=n&&n.console?new(n.console(K1)):new K1,i=t(r);r.rawAttach(i);const s=n&&n.tracer?new(n.tracer(t_)):new t_,o=n&&n.telemetry?new(n.telemetry(n_)):new n_,a=n&&n.client?new(n.client(Z1)):new Z1,c=n&&n.window?new(n.window(Y1)):new Y1,l=n&&n.workspace?new(n.workspace(e_)):new e_,u=n&&n.languages?new(n.languages(i_)):new i_,d=n&&n.notebooks?new(n.notebooks(o_)):new o_,f=[r,s,o,a,c,l,u,d];function h(v){return v instanceof Promise?v:Fn.thenable(v)?new Promise((T,_)=>{v.then(N=>T(N),N=>_(N))}):Promise.resolve(v)}let p,y,R,b={listen:()=>i.listen(),sendRequest:(v,...T)=>i.sendRequest(Fn.string(v)?v:v.method,...T),onRequest:(v,T)=>i.onRequest(v,T),sendNotification:(v,T)=>{const _=Fn.string(v)?v:v.method;return i.sendNotification(_,T)},onNotification:(v,T)=>i.onNotification(v,T),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:v=>(y=v,{dispose:()=>{y=void 0}}),onInitialized:v=>i.onNotification(X.InitializedNotification.type,v),onShutdown:v=>(p=v,{dispose:()=>{p=void 0}}),onExit:v=>(R=v,{dispose:()=>{R=void 0}}),get console(){return r},get telemetry(){return o},get tracer(){return s},get client(){return a},get window(){return c},get workspace(){return l},get languages(){return u},get notebooks(){return d},onDidChangeConfiguration:v=>i.onNotification(X.DidChangeConfigurationNotification.type,v),onDidChangeWatchedFiles:v=>i.onNotification(X.DidChangeWatchedFilesNotification.type,v),__textDocumentSync:void 0,onDidOpenTextDocument:v=>i.onNotification(X.DidOpenTextDocumentNotification.type,v),onDidChangeTextDocument:v=>i.onNotification(X.DidChangeTextDocumentNotification.type,v),onDidCloseTextDocument:v=>i.onNotification(X.DidCloseTextDocumentNotification.type,v),onWillSaveTextDocument:v=>i.onNotification(X.WillSaveTextDocumentNotification.type,v),onWillSaveTextDocumentWaitUntil:v=>i.onRequest(X.WillSaveTextDocumentWaitUntilRequest.type,v),onDidSaveTextDocument:v=>i.onNotification(X.DidSaveTextDocumentNotification.type,v),sendDiagnostics:v=>i.sendNotification(X.PublishDiagnosticsNotification.type,v),onHover:v=>i.onRequest(X.HoverRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),void 0)),onCompletion:v=>i.onRequest(X.CompletionRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onCompletionResolve:v=>i.onRequest(X.CompletionResolveRequest.type,v),onSignatureHelp:v=>i.onRequest(X.SignatureHelpRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),void 0)),onDeclaration:v=>i.onRequest(X.DeclarationRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onDefinition:v=>i.onRequest(X.DefinitionRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onTypeDefinition:v=>i.onRequest(X.TypeDefinitionRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onImplementation:v=>i.onRequest(X.ImplementationRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onReferences:v=>i.onRequest(X.ReferencesRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onDocumentHighlight:v=>i.onRequest(X.DocumentHighlightRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onDocumentSymbol:v=>i.onRequest(X.DocumentSymbolRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onWorkspaceSymbol:v=>i.onRequest(X.WorkspaceSymbolRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onWorkspaceSymbolResolve:v=>i.onRequest(X.WorkspaceSymbolResolveRequest.type,v),onCodeAction:v=>i.onRequest(X.CodeActionRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onCodeActionResolve:v=>i.onRequest(X.CodeActionResolveRequest.type,(T,_)=>v(T,_)),onCodeLens:v=>i.onRequest(X.CodeLensRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onCodeLensResolve:v=>i.onRequest(X.CodeLensResolveRequest.type,(T,_)=>v(T,_)),onDocumentFormatting:v=>i.onRequest(X.DocumentFormattingRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),void 0)),onDocumentRangeFormatting:v=>i.onRequest(X.DocumentRangeFormattingRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),void 0)),onDocumentOnTypeFormatting:v=>i.onRequest(X.DocumentOnTypeFormattingRequest.type,(T,_)=>v(T,_)),onRenameRequest:v=>i.onRequest(X.RenameRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),void 0)),onPrepareRename:v=>i.onRequest(X.PrepareRenameRequest.type,(T,_)=>v(T,_)),onDocumentLinks:v=>i.onRequest(X.DocumentLinkRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onDocumentLinkResolve:v=>i.onRequest(X.DocumentLinkResolveRequest.type,(T,_)=>v(T,_)),onDocumentColor:v=>i.onRequest(X.DocumentColorRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onColorPresentation:v=>i.onRequest(X.ColorPresentationRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onFoldingRanges:v=>i.onRequest(X.FoldingRangeRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onSelectionRanges:v=>i.onRequest(X.SelectionRangeRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),(0,ue.attachPartialResult)(i,T))),onExecuteCommand:v=>i.onRequest(X.ExecuteCommandRequest.type,(T,_)=>v(T,_,(0,ue.attachWorkDone)(i,T),void 0)),dispose:()=>i.dispose()};for(let v of f)v.attach(b);return i.onRequest(X.InitializeRequest.type,v=>{e.initialize(v),Fn.string(v.trace)&&(s.trace=X.Trace.fromString(v.trace));for(let T of f)T.initialize(v.capabilities);if(y){let T=y(v,new X.CancellationTokenSource().token,(0,ue.attachWorkDone)(i,v),void 0);return h(T).then(_=>{if(_ instanceof X.ResponseError)return _;let N=_;N||(N={capabilities:{}});let F=N.capabilities;F||(F={},N.capabilities=F),F.textDocumentSync===void 0||F.textDocumentSync===null?F.textDocumentSync=Fn.number(b.__textDocumentSync)?b.__textDocumentSync:X.TextDocumentSyncKind.None:!Fn.number(F.textDocumentSync)&&!Fn.number(F.textDocumentSync.change)&&(F.textDocumentSync.change=Fn.number(b.__textDocumentSync)?b.__textDocumentSync:X.TextDocumentSyncKind.None);for(let P of f)P.fillServerCapabilities(F);return N})}else{let T={capabilities:{textDocumentSync:X.TextDocumentSyncKind.None}};for(let _ of f)_.fillServerCapabilities(T.capabilities);return T}}),i.onRequest(X.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,p)return p(new X.CancellationTokenSource().token)}),i.onNotification(X.ExitNotification.type,()=>{try{R&&R()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(X.SetTraceNotification.type,v=>{s.trace=X.Trace.fromString(v.value)}),b}_e.createConnection=L6;var fn={};Object.defineProperty(fn,"__esModule",{value:!0}),fn.resolveModulePath=fn.FileSystem=fn.resolveGlobalYarnPath=fn.resolveGlobalNodePath=fn.resolve=fn.uriToFilePath=void 0;const M6=HN,er=$a,qy=Ru,Wy=Lb;function F6(t){let e=M6.parse(t);if(e.protocol!=="file:"||!e.path)return;let n=e.path.split("/");for(var r=0,i=n.length;r<i;r++)n[r]=decodeURIComponent(n[r]);if(process.platform==="win32"&&n.length>1){let s=n[0],o=n[1];s.length===0&&o.length>1&&o[1]===":"&&n.shift()}return er.normalize(n.join("/"))}fn.uriToFilePath=F6;function Gy(){return process.platform==="win32"}function Bf(t,e,n,r){const i="NODE_PATH",s=["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((o,a)=>{let c=process.env,l=Object.create(null);Object.keys(c).forEach(u=>l[u]=c[u]),e&&qy.existsSync(e)&&(l[i]?l[i]=e+er.delimiter+l[i]:l[i]=e,r&&r(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,Wy.fork)("",[],{cwd:n,env:l,execArgv:["-e",s]});if(u.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}u.on("error",f=>{a(f)}),u.on("message",f=>{f.c==="r"&&(u.send({c:"e"}),f.s?o(f.r):a(new Error(`Failed to resolve module: ${t}`)))});let d={c:"rs",a:t};u.send(d)}catch(u){a(u)}})}fn.resolve=Bf;function zy(t){let e="npm";const n=Object.create(null);Object.keys(process.env).forEach(s=>n[s]=process.env[s]),n.NO_UPDATE_NOTIFIER="true";const r={encoding:"utf8",env:n};Gy()&&(e="npm.cmd",r.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,Wy.spawnSync)(e,["config","get","prefix"],r).stdout;if(!s){t&&t("'npm config get prefix' didn't return a value.");return}let o=s.trim();return t&&t(`'npm config get prefix' value is: ${o}`),o.length>0?Gy()?er.join(o,"node_modules"):er.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}fn.resolveGlobalNodePath=zy;function j6(t){let e="yarn",n={encoding:"utf8"};Gy()&&(e="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let i=(0,Wy.spawnSync)(e,["global","dir","--json"],n),s=i.stdout;if(!s){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let o=s.trim().split(/\r?\n/);for(let a of o)try{let c=JSON.parse(a);if(c.type==="log")return er.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}fn.resolveGlobalYarnPath=j6;var Hy;(function(t){let e;function n(){return e!==void 0||(process.platform==="win32"?e=!1:e=!qy.existsSync(__filename.toUpperCase())||!qy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=n;function r(i,s){return n()?er.normalize(s).indexOf(er.normalize(i))===0:er.normalize(s).toLowerCase().indexOf(er.normalize(i).toLowerCase())===0}t.isParent=r})(Hy||(fn.FileSystem=Hy={}));function U6(t,e,n,r){return n?(er.isAbsolute(n)||(n=er.join(t,n)),Bf(e,n,n,r).then(i=>Hy.isParent(n,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>Bf(e,zy(r),t,r))):Bf(e,zy(r),t,r)}fn.resolveModulePath=U6;var g_=Ve,m_={},qf={};Object.defineProperty(qf,"__esModule",{value:!0}),qf.InlineCompletionFeature=void 0;const B6=Ve,q6=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(B6.InlineCompletionRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};qf.InlineCompletionFeature=q6,function(t){var e=gt&&gt.__createBinding||(Object.create?function(c,l,u,d){d===void 0&&(d=u);var f=Object.getOwnPropertyDescriptor(l,u);(!f||("get"in f?!l.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(c,d,f)}:function(c,l,u,d){d===void 0&&(d=u),c[d]=l[u]}),n=gt&&gt.__exportStar||function(c,l){for(var u in c)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,c,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.ProposedFeatures=t.NotebookDocuments=t.TextDocuments=t.SemanticTokensBuilder=void 0;const r=oi;Object.defineProperty(t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});const i=qf;n(Ve,t);const s=Hc;Object.defineProperty(t,"TextDocuments",{enumerable:!0,get:function(){return s.TextDocuments}});const o=Fs;Object.defineProperty(t,"NotebookDocuments",{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(_e,t);var a;(function(c){c.all={__brand:"features",languages:i.InlineCompletionFeature}})(a||(t.ProposedFeatures=a={}))}(m_),function(t){var e=gt&&gt.__createBinding||(Object.create?function(b,v,T,_){_===void 0&&(_=T);var N=Object.getOwnPropertyDescriptor(v,T);(!N||("get"in N?!v.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return v[T]}}),Object.defineProperty(b,_,N)}:function(b,v,T,_){_===void 0&&(_=T),b[_]=v[T]}),n=gt&&gt.__exportStar||function(b,v){for(var T in b)T!=="default"&&!Object.prototype.hasOwnProperty.call(v,T)&&e(v,b,T)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=t.Files=void 0;const r=kN,i=dt,s=_e,o=fn,a=g_;n(g_,t),n(m_,t);var c;(function(b){b.uriToFilePath=o.uriToFilePath,b.resolveGlobalNodePath=o.resolveGlobalNodePath,b.resolveGlobalYarnPath=o.resolveGlobalYarnPath,b.resolve=o.resolve,b.resolveModulePath=o.resolveModulePath})(c||(t.Files=c={}));function l(){}let u=!1,d;function f(){const b="--clientProcessId";function v(T){try{let _=parseInt(T);isNaN(_)||(d=setInterval(()=>{try{process.kill(_,0)}catch{process.exit(u?0:1)}},3e3))}catch{}}for(let T=2;T<process.argv.length;T++){let _=process.argv[T];if(_===b&&T+1<process.argv.length){v(process.argv[T+1]);return}else{let N=_.split("=");N[0]===b&&v(N[1])}}}f();const h={initialize:b=>{const v=b.processId;i.number(v)&&d===void 0&&setInterval(()=>{try{process.kill(v,0)}catch{process.exit(u?0:1)}},3e3)},get shutdownReceived(){return u},set shutdownReceived(b){u=b},exit:b=>{process.exit(b)}};function p(b,v,T,_){let N,F,P,G;return b!==void 0&&b.__brand==="features"&&(N=b,b=v,v=T,T=_),a.ConnectionStrategy.is(b)||a.ConnectionOptions.is(b)?G=b:(F=b,P=v,G=T),y(F,P,G,N)}t.createConnection=p;function y(b,v,T,_){let N=!1;if(!b&&!v&&process.argv.length>2){let B,W,I=process.argv.slice(2);for(let k=0;k<I.length;k++){let S=I[k];if(S==="--node-ipc"){b=new a.IPCMessageReader(process),v=new a.IPCMessageWriter(process);break}else if(S==="--stdio"){N=!0,b=process.stdin,v=process.stdout;break}else if(S==="--socket"){B=parseInt(I[k+1]);break}else if(S==="--pipe"){W=I[k+1];break}else{var F=S.split("=");if(F[0]==="--socket"){B=parseInt(F[1]);break}else if(F[0]==="--pipe"){W=F[1];break}}}if(B){let k=(0,a.createServerSocketTransport)(B);b=k[0],v=k[1]}else if(W){let k=(0,a.createServerPipeTransport)(W);b=k[0],v=k[1]}}var P="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!b)throw new Error("Connection input stream is not set. "+P);if(!v)throw new Error("Connection output stream is not set. "+P);if(i.func(b.read)&&i.func(b.on)){let B=b;B.on("end",()=>{process.exit(u?0:1)}),B.on("close",()=>{process.exit(u?0:1)})}const G=B=>{const W=(0,a.createProtocolConnection)(b,v,B,T);return N&&R(B),W};return(0,s.createConnection)(G,h,_)}function R(b){function v(_){return _.map(N=>typeof N=="string"?N:(0,r.inspect)(N)).join(" ")}const T=new Map;console.assert=function(N,...F){if(!N)if(F.length===0)b.error("Assertion failed");else{const[P,...G]=F;b.error(`Assertion failed: ${P} ${v(G)}`)}},console.count=function(N="default"){const F=String(N);let P=T.get(F)??0;P+=1,T.set(F,P),b.log(`${F}: ${F}`)},console.countReset=function(N){N===void 0?T.clear():T.delete(String(N))},console.debug=function(...N){b.log(v(N))},console.dir=function(N,F){b.log((0,r.inspect)(N,F))},console.log=function(...N){b.log(v(N))},console.error=function(...N){b.error(v(N))},console.trace=function(...N){const F=new Error().stack.replace(/(.+\n){2}/,"");let P="Trace";N.length!==0&&(P+=`: ${v(N)}`),b.log(`${P}
160
+ ${F}`)},console.warn=function(...N){b.warn(v(N))}}}(se);function y_(t,e){const n={stacks:t,tokens:e};return W6(n),n.stacks.flat().forEach(i=>{i.property=void 0}),w_(n.stacks).map(i=>i[i.length-1])}function Vy(t){const{next:e,cardinalities:n,visited:r,plus:i}=t,s=[],o=e.feature;if(r.has(o))return[];r.add(o);let a,c=o;for(;c.$container;)if($i(c.$container)){a=c.$container;break}else if($g(c.$container))c=c.$container;else break;if(jT(c.cardinality)){const l=Vo({next:{feature:c,type:e.type},cardinalities:n,visited:r,plus:i});for(const u of l)i.add(u.feature);s.push(...l)}if(a){const l=a.elements.indexOf(c);l!==void 0&&l<a.elements.length-1&&s.push(...v_({feature:a,type:e.type},l+1,n,r,i)),s.every(u=>To(u.feature.cardinality,u.feature)||To(n.get(u.feature))||i.has(u.feature))&&s.push(...Vy({next:{feature:a,type:e.type},cardinalities:n,visited:r,plus:i}))}return s}function Ky(t){return ct(t)&&(t={feature:t}),Vo({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function Vo(t){var e,n,r;const{next:i,cardinalities:s,visited:o,plus:a}=t;if(i===void 0)return[];const{feature:c,type:l}=i;if($i(c)){if(o.has(c))return[];o.add(c)}if($i(c))return v_(i,0,s,o,a).map(u=>Wf(u,c.cardinality,s));if(Ig(c)||Pg(c))return c.elements.flatMap(u=>Vo({next:{feature:u,type:l,property:i.property},cardinalities:s,visited:o,plus:a})).map(u=>Wf(u,c.cardinality,s));if(pr(c)){const u={feature:c.terminal,type:l,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return Vo({next:u,cardinalities:s,visited:o,plus:a}).map(d=>Wf(d,c.cardinality,s))}else{if($s(c))return Vy({next:{feature:c,type:gc(c),property:(n=i.property)!==null&&n!==void 0?n:c.feature},cardinalities:s,visited:o,plus:a});if(Wr(c)&&Ut(c.rule.ref)){const u=c.rule.ref,d={feature:u.definition,type:u.fragment||u.dataType?void 0:(r=ks(u))!==null&&r!==void 0?r:u.name,property:i.property};return Vo({next:d,cardinalities:s,visited:o,plus:a}).map(f=>Wf(f,c.cardinality,s))}else return[i]}}function Wf(t,e,n){return n.set(t.feature,e),t}function v_(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(...Vo({next:a,cardinalities:n,visited:r,plus:i})),!!To((s=a.feature.cardinality)!==null&&s!==void 0?s:n.get(a.feature),a.feature)););return o}function W6(t){for(const e of t.tokens){const n=w_(t.stacks,e);t.stacks=n}}function w_(t,e){const n=[];for(const r of t)n.push(...G6(r,e));return n}function G6(t,e){const n=new Map,r=new Set(t.map(s=>s.feature).filter(z6)),i=[];for(;t.length>0;){const s=t.pop(),o=Vy({next:s,cardinalities:n,plus:r,visited:new Set}).filter(a=>e?Yy(a.feature,e):!0);for(const a of o)i.push([...t,a]);if(!o.every(a=>To(a.feature.cardinality,a.feature)||To(n.get(a.feature))))break}return i}function z6(t){if(t.cardinality==="+")return!0;const e=rn(t,pr);return!!(e&&e.cardinality==="+")}function Yy(t,e){if(gr(t))return t.value===e.image;if(Wr(t))return H6(t.rule.ref,e);if(Za(t)){const n=Bg(t);if(n)return Yy(n,e)}return!1}function H6(t,e){return Ut(t)?Ky(t.definition).some(r=>Yy(r.feature,e)):qr(t)?mc(t).test(e.image):!1}function V6(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 b_{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){const r=[],i=this.buildContexts(e,n.position),s=(c,l)=>{const u=this.fillCompletionItem(c,l);u&&r.push(u)},o=c=>gr(c.feature)?c.feature.value:c.feature,a=[];for(const c of i)if(await Promise.all(Le(c.features).distinct(o).exclude(a).map(l=>this.completionFor(c,l,s))),a.push(...c.features),!this.continueCompletion(r))break;return se.CompletionList.create(this.deduplicateItems(r),!0)}deduplicateItems(e){return Le(e).distinct(n=>`${n.kind}_${n.label}_${n.detail}`).toArray()}findFeaturesAt(e,n){const r=e.getText({start:se.Position.create(0,0),end:e.positionAt(n)}),i=this.completionParser.parse(r),s=i.tokens;if(i.tokenIndex===0){const c=ld(this.grammar),l=Ky({feature:c.definition,type:ks(c)});return s.length>0?(s.shift(),y_(l.map(u=>[u]),s)):l}const o=[...s].splice(i.tokenIndex);return y_([i.elementStack.map(c=>({feature:c}))],o)}*buildContexts(e,n){var r,i;const s=e.parseResult.value.$cstNode;if(!s)return;const o=e.textDocument,a=o.getText(),c=o.offsetAt(n),l={document:e,textDocument:o,offset:c,position:n},u=this.findDataTypeRuleStart(s,c);if(u){const[v,T]=u,_=(r=Hu(s,v))===null||r===void 0?void 0:r.astNode;yield Object.assign(Object.assign({},l),{node:_,tokenOffset:v,tokenEndOffset:T,features:this.findFeaturesAt(o,v)})}const{nextTokenStart:d,nextTokenEnd:f,previousTokenStart:h,previousTokenEnd:p}=this.backtrackToAnyToken(a,c);let y=d;c<=d&&h!==void 0&&(y=h);const R=(i=Hu(s,y))===null||i===void 0?void 0:i.astNode;let b=!0;if(h!==void 0&&p!==void 0&&p===c&&(yield Object.assign(Object.assign({},l),{node:R,tokenOffset:h,tokenEndOffset:p,features:this.findFeaturesAt(o,h)}),b=this.performNextTokenCompletion(e,a.substring(h,p),h,p),b&&(yield Object.assign(Object.assign({},l),{node:R,tokenOffset:p,tokenEndOffset:p,features:this.findFeaturesAt(o,p)}))),R)b&&(yield Object.assign(Object.assign({},l),{node:R,tokenOffset:d,tokenEndOffset:f,features:this.findFeaturesAt(o,d)}));else{const v=ld(this.grammar);if(!v)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},l),{tokenOffset:d,tokenEndOffset:f,features:Ky(v.definition)})}}performNextTokenCompletion(e,n,r,i){return/\P{L}$/u.test(n)}findDataTypeRuleStart(e,n){var r,i;let s=Si(e,n,this.grammarConfig.nameRegexp),o=!!(!((r=rn(s?.grammarSource,Ut))===null||r===void 0)&&r.dataType);if(o){for(;o;)s=s?.container,o=!!(!((i=rn(s?.grammarSource,Ut))===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(gr(n.feature))return this.completionForKeyword(e,n.feature,r);if(Za(n.feature)&&e.node)return this.completionForCrossReference(e,n,r)}completionForCrossReference(e,n,r){const i=rn(n.feature,pr);let s=e.node;if(i&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},Dg(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 se.CompletionItemKind.Keyword}filterKeyword(e,n){return/\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 l=this.nameProvider.getName(n.node);if(!l)return;s=l}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 K6{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,n){const r=e.parseResult.value;if(r.$cstNode){const i=r.$cstNode,s=Si(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(s)return this.collectLocationLinks(s,n)}}collectLocationLinks(e,n){var r;const i=this.findLink(e);if(i)return[se.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=At(n.astNode);if(n&&r)return{source:e,target:n,targetDocument:r}}}}class T_{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,n){const r=e.parseResult.value.$cstNode;if(!r)return;const i=Si(r,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(!i)return;const s=this.references.findDeclaration(i);if(s){const o=On.equals(At(s).uri,e.uri),a={documentUri:e.uri,includeDeclaration:o};return this.references.findReferences(s,a).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return se.DocumentHighlight.create(e.segment.range)}}class Y6{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e){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 fc(n)){const s=this.getSymbol(e,i);r.push(...s)}if(r.length>0)return r}}class X6{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=Le(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(se.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([Jt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){const n=Le(e.changes).filter(i=>i.type!==se.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Jt.parse(i.uri)).toArray(),r=Le(e.changes).filter(i=>i.type===se.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Jt.parse(i.uri)).toArray();this.fireDocumentUpdate(n,r)}}class J6{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e){const n=[],r=i=>n.push(i);return this.collectFolding(e,r),n}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=mr(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 fT(i))if(this.commentNames.includes(s.tokenType.name)){const o=this.toFoldingRange(e,s,se.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)),se.FoldingRange.create(s.line,o.line,s.character,o.character,r)}includeLastFoldingLine(e,n){if(n===se.FoldingRangeKind.Comment)return!1;const r=e.text,i=r.charAt(r.length-1);return!(i==="}"||i===")"||i==="]")}}class Q6{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 c=n.charCodeAt(a),l=e.charCodeAt(s);if((c===l||this.toUpperCharCode(c)===this.toUpperCharCode(l))&&(r||(r=i===void 0||this.isWordTransition(i,c)),r&&s++,s===e.length))return!0;i=c}return!1}isWordTransition(e,n){return E_<=e&&e<=R_&&Z6<=n&&n<=eW||e===S_&&n!==S_}toUpperCharCode(e){return E_<=e&&e<=R_?e-32:e}}const E_=97,R_=122,Z6=65,eW=90,S_=95;class $_{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=Si(s,o,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>o){const c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c)}}}}class tW extends $_{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}}}}const Xy={[se.SemanticTokenTypes.class]:0,[se.SemanticTokenTypes.comment]:1,[se.SemanticTokenTypes.enum]:2,[se.SemanticTokenTypes.enumMember]:3,[se.SemanticTokenTypes.event]:4,[se.SemanticTokenTypes.function]:5,[se.SemanticTokenTypes.interface]:6,[se.SemanticTokenTypes.keyword]:7,[se.SemanticTokenTypes.macro]:8,[se.SemanticTokenTypes.method]:9,[se.SemanticTokenTypes.modifier]:10,[se.SemanticTokenTypes.namespace]:11,[se.SemanticTokenTypes.number]:12,[se.SemanticTokenTypes.operator]:13,[se.SemanticTokenTypes.parameter]:14,[se.SemanticTokenTypes.property]:15,[se.SemanticTokenTypes.regexp]:16,[se.SemanticTokenTypes.string]:17,[se.SemanticTokenTypes.struct]:18,[se.SemanticTokenTypes.type]:19,[se.SemanticTokenTypes.typeParameter]:20,[se.SemanticTokenTypes.variable]:21,[se.SemanticTokenTypes.decorator]:22},k_={[se.SemanticTokenModifiers.abstract]:1,[se.SemanticTokenModifiers.async]:2,[se.SemanticTokenModifiers.declaration]:4,[se.SemanticTokenModifiers.defaultLibrary]:8,[se.SemanticTokenModifiers.definition]:16,[se.SemanticTokenModifiers.deprecated]:32,[se.SemanticTokenModifiers.documentation]:64,[se.SemanticTokenModifiers.modification]:128,[se.SemanticTokenModifiers.readonly]:256,[se.SemanticTokenModifiers.static]:512},nW={legend:{tokenTypes:Object.keys(Xy),tokenModifiers:Object.keys(k_)},full:{delta:!0},range:!0};class rW extends se.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 iW{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}async semanticHighlight(e,n,r=Qe.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=Qe.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=Qe.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 rW;return this.tokensBuilders.set(e.uri.toString(),r),r}async computeHighlighting(e,n,r){const i=e.parseResult.value,s=Gr(i,{range:this.currentRange}).iterator();let o;do if(o=s.next(),!o.done){await Pt(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&&!wg(r,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;const o=Xy[i];let a=0;if(s!==void 0){typeof s=="string"&&(s=[s]);for(const u of s){const d=k_[u];a|=d}}const c=r.start.line,l=r.end.line;if(c===l){const u=r.start.character,d=r.end.character-u;this.currentTokensBuilder.push(c,u,d,o,a)}else if(!((n=this.clientCapabilities)===null||n===void 0)&&n.multilineTokenSupport){const u=r.start.character,d=this.currentDocument.textDocument.offsetAt(r.start),f=this.currentDocument.textDocument.offsetAt(r.end);this.currentTokensBuilder.push(c,u,f-d,o,a)}else{const u=r.start;let d=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(u.line,u.character,d-u.character-1,o,a);for(let f=c+1;f<l;f++){const h=d;d=this.currentDocument.textDocument.offsetAt({line:f+1,character:0}),this.currentTokensBuilder.push(f,0,d-h-1,o,a)}this.currentTokensBuilder.push(l,0,r.end.character,o,a)}}highlightProperty(e){const n=[];if(typeof e.index=="number"){const s=mn(e.node.$cstNode,e.property,e.index);s&&n.push(s)}else n.push(...bo(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 c=pc(n.$cstNode,r,s);c&&a.push(c)}else a.push(...Wg(n.$cstNode,r));for(const c of a)this.highlightNode({node:c,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 __;(function(t){function e(r,i){const s=new Map;Object.entries(Xy).forEach(([c,l])=>s.set(l,c));let o=0,a=0;return n(r.data,5).map(c=>{o+=c[0],c[0]!==0&&(a=0),a+=c[1];const l=c[2];return{offset:i.textDocument.offsetAt({line:o,character:a}),tokenType:s.get(c[3]),tokenModifiers:c[4],text:i.textDocument.getText({start:{line:o,character:a},end:{line:o,character:a+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}})(__||(__={}));function sW(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 oW{constructor(e){this.onInitializeEmitter=new Ve.Emitter,this.onInitializedEmitter=new Ve.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(){Ey(this.services),this.services.ServiceRegistry.all.forEach(e=>Ey(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,c=this.services.ServiceRegistry.all,l=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.Formatter}),u=c.map(J=>{var U,le;return(le=(U=J.lsp)===null||U===void 0?void 0:U.Formatter)===null||le===void 0?void 0:le.formatOnTypeOptions}).find(J=>!!J),d=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.CodeActionProvider}),f=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.SemanticTokenProvider}),h=(i=(r=this.services.lsp)===null||r===void 0?void 0:r.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,p=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.DocumentLinkProvider}),y=sW(c.map(J=>{var U,le;return(le=(U=J.lsp)===null||U===void 0?void 0:U.SignatureHelp)===null||le===void 0?void 0:le.signatureHelpOptions})),R=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.TypeProvider}),b=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.ImplementationProvider}),v=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.CompletionProvider}),T=V6(c.map(J=>{var U,le;return(le=(U=J.lsp)===null||U===void 0?void 0:U.CompletionProvider)===null||le===void 0?void 0:le.completionOptions})),_=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.ReferencesProvider}),N=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.DocumentSymbolProvider}),F=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.DefinitionProvider}),P=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.DocumentHighlightProvider}),G=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.FoldingRangeProvider}),B=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.HoverProvider}),W=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.RenameProvider}),I=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.CallHierarchyProvider}),k=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.TypeHierarchyProvider}),S=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.CodeLensProvider}),M=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.DeclarationProvider}),q=this.hasService(J=>{var U;return(U=J.lsp)===null||U===void 0?void 0:U.InlayHintProvider}),j=(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:Ve.TextDocumentSyncKind.Incremental,openClose:!0,save:!!o.didSaveDocument,willSave:!!o.willSaveDocument,willSaveWaitUntil:!!o.willSaveDocumentWaitUntil},completionProvider:v?T:void 0,referencesProvider:_,documentSymbolProvider:N,definitionProvider:F,typeDefinitionProvider:R,documentHighlightProvider:P,codeActionProvider:d,documentFormattingProvider:l,documentRangeFormattingProvider:l,documentOnTypeFormattingProvider:u,foldingRangeProvider:G,hoverProvider:B,renameProvider:W?{prepareProvider:!0}:void 0,semanticTokensProvider:f?nW:void 0,signatureHelpProvider:y,implementationProvider:b,callHierarchyProvider:I?{}:void 0,typeHierarchyProvider:k?{}:void 0,documentLinkProvider:p?{resolveProvider:!1}:void 0,codeLensProvider:S?{resolveProvider:!1}:void 0,declarationProvider:M,inlayHintProvider:q?{resolveProvider:!1}:void 0,workspaceSymbolProvider:j?{resolveProvider:!!j.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(Ve.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 aW{getSymbolKind(e){return se.SymbolKind.Field}getCompletionItemKind(e){return se.CompletionItemKind.Reference}}class cW{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,n){const r=e.parseResult.value.$cstNode;if(!r)return[];const i=Si(r,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,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(se.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}}class lW{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,n){const r={},i=e.parseResult.value.$cstNode;if(!i)return;const s=e.textDocument.offsetAt(n.position),o=Si(i,s,this.grammarConfig.nameRegexp);if(!o)return;const a=this.references.findDeclaration(o);if(!a)return;const c={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(a,c).forEach(u=>{const d=Xt.replace(u.segment.range,n.newName),f=u.sourceUri.toString();r[f]?r[f].push(d):r[f]=[d]}),{changes:r}}prepareRename(e,n){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=Si(r,i,this.grammarConfig.nameRegexp);if(!s)return;if(this.references.findDeclaration(s)||this.isNameNode(s))return s.range}}isNameNode(e){return e?.astNode&&x$(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}}class C_{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,n=Qe.None){const r=[],i=e.query.toLowerCase();for(const s of this.indexManager.allElements())if(await Pt(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()}}}}function uW(t){return lf.merge(Z$(t),dW(t))}function dW(t){return{lsp:{CompletionProvider:e=>new b_(e),DocumentSymbolProvider:e=>new Y6(e),HoverProvider:e=>new tW(e),FoldingRangeProvider:e=>new J6(e),ReferencesProvider:e=>new cW(e),DefinitionProvider:e=>new K6(e),DocumentHighlightProvider:e=>new T_(e),RenameProvider:e=>new lW(e)},shared:()=>t.shared}}function fW(t){return lf.merge(ek(t),hW(t))}function hW(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new oW(e),DocumentUpdateHandler:e=>new X6(e),WorkspaceSymbolProvider:e=>new C_(e),NodeKindProvider:()=>new aW,FuzzyMatcher:()=>new Q6},workspace:{TextDocuments:()=>new se.TextDocuments(af)}}}class pW{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new gW(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,c,l)=>{var u,d;const f=this.nodeModeToKey(a,c),h=i.get(f),p=(u=l.options.priority)!==null&&u!==void 0?u:0,y=(d=h?.options.priority)!==null&&d!==void 0?d:0;(!h||y<=p)&&i.set(f,l)};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){const s=r[r.length-1];if(s){const o=e.offsetAt(i.range.start),a=e.offsetAt(s.range.end);o<a&&r.pop()}r.push(i)}return r}iterateAstFormatting(e,n){const r=e.parseResult.value;this.format(r);const i=mr(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!0}iterateCstFormatting(e,n,r,i){const s={indentation:0,options:r,document:e.textDocument},o=[],c=this.iterateCstTree(e,s).iterator();let l,u;do if(u=c.next(),!u.done){const d=u.value,f=Ss(d),h=this.nodeModeToKey(d,"prepend"),p=n.get(h);if(n.delete(h),p){const b=this.createTextEdit(l,d,p,s);for(const v of b)v&&this.insideRange(v.range,i)&&o.push(v)}const y=this.nodeModeToKey(d,"append"),R=n.get(y);if(n.delete(y),R){const b=yT(d);if(b){const v=this.createTextEdit(d,b,R,s);for(const T of v)T&&this.insideRange(T.range,i)&&o.push(T)}}if(!p&&d.hidden){const b=this.createHiddenTextEdits(l,d,void 0,s);for(const v of b)v&&this.insideRange(v.range,i)&&o.push(v)}f&&(l=d)}while(!u.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=[],c={start:{character:0,line:o},end:n.range.start},l=i.document.getText(c),u=this.findFittingMove(c,(s=r?.moves)!==null&&s!==void 0?s:[],i),d=this.getExistingIndentationCharacterCount(l,i),h=this.getIndentationCharacterCount(i,u)-d;if(h===0)return[];let p="";h>0&&(p=(i.options.insertSpaces?" ":" ").repeat(h));const y=n.text.split(`
161
+ `);y[0]=l+y[0];for(let R=0;R<y.length;R++){const b=o+R,v={character:0,line:b};if(h>0)a.push({newText:p,range:{start:v,end:v}});else{const T=y[R];let _=0;for(;_<T.length;_++){const N=T.charAt(_);if(N!==" "&&N!==" ")break}a.push({newText:"",range:{start:v,end:{line:b,character:Math.min(_,Math.abs(h))}}})}}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);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 c=a.characters,l=a.lines,u=a.tabs,d=i.indentation;i.indentation+=u??0;const f=[];return c!==void 0?f.push(this.createSpaceTextEdit(o,c,r.options)):l!==void 0?f.push(this.createLineTextEdit(o,l,i,r.options)):u!==void 0&&f.push(this.createTabTextEdit(o,!!e,i)),Ss(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 yo(i,s=>this.iterateCst(s,n)):mo}iterateCst(e,n){if(!Br(e))return mo;const r=n.indentation;return new St(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(n.indentation=r,jt))}}class gW{constructor(e,n){this.astNode=e,this.collector=n}node(e){return new ar(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){const n=[];for(const r of e)r.$cstNode&&n.push(r.$cstNode);return new ar(n,this.collector)}property(e,n){const r=mn(this.astNode.$cstNode,e,n);return new ar(r?[r]:[],this.collector)}properties(...e){const n=[];for(const r of e){const i=bo(this.astNode.$cstNode,r);n.push(...i)}return new ar(n,this.collector)}keyword(e,n){const r=pc(this.astNode.$cstNode,e,n);return new ar(r?[r]:[],this.collector)}keywords(...e){const n=[];for(const r of e){const i=Wg(this.astNode.$cstNode,r);n.push(...i)}return new ar(n,this.collector)}cst(e){return new ar([...e],this.collector)}interior(e,n){const r=e.nodes,i=n.nodes;if(r.length!==1||i.length!==1)return new ar([],this.collector);let s=r[0],o=i[0];if(s.offset>o.offset){const a=s;s=o,o=a}return new ar(vT(s,o),this.collector)}}class ar{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 ar(this.nodes.slice(e,n),this.collector)}}var qi;(function(t){function e(...u){return{options:{},moves:u.flatMap(d=>d.moves).sort(l)}}t.fit=e;function n(u){return i(0,u)}t.noSpace=n;function r(u){return i(1,u)}t.oneSpace=r;function i(u,d){return{options:d??{},moves:[{characters:u}]}}t.spaces=i;function s(u){return o(1,u)}t.newLine=s;function o(u,d){return{options:d??{},moves:[{lines:u}]}}t.newLines=o;function a(u){return{options:u??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function c(u){return{options:u??{},moves:[{tabs:0}]}}t.noIndent=c;function l(u,d){var f,h,p,y,R,b;const v=(f=u.lines)!==null&&f!==void 0?f:0,T=(h=d.lines)!==null&&h!==void 0?h:0,_=(p=u.tabs)!==null&&p!==void 0?p:0,N=(y=d.tabs)!==null&&y!==void 0?y:0,F=(R=u.characters)!==null&&R!==void 0?R:0,P=(b=d.characters)!==null&&b!==void 0?b:0;return v<T?-1:v>T?1:_<N?-1:_>N?1:F<P?-1:F>P?1:0}})(qi||(qi={}));const Ke={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},A_={silent:{level:-1},fatal:{level:Ke.fatal},error:{level:Ke.error},warn:{level:Ke.warn},log:{level:Ke.log},info:{level:Ke.info},success:{level:Ke.success},fail:{level:Ke.fail},ready:{level:Ke.info},start:{level:Ke.info},box:{level:Ke.info},debug:{level:Ke.debug},trace:{level:Ke.trace},verbose:{level:Ke.verbose}};function Jy(t){return t!==null&&typeof t=="object"}function Qy(t,e,n=".",r){if(!Jy(e))return Qy(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]]:Jy(o)&&Jy(i[s])?i[s]=Qy(o,i[s],(n?`${n}.`:"")+s.toString()):i[s]=o)}return i}function mW(t){return(...e)=>e.reduce((n,r)=>Qy(n,r,""),{})}const yW=mW();function vW(t){return Object.prototype.toString.call(t)==="[object Object]"}function wW(t){return!(!vW(t)||!t.message&&!t.args||t.stack)}let Zy=!1;const I_=[];let Qt=class pN{constructor(e={}){const n=e.types||A_;this.options=yW({...e,defaults:{...e.defaults},level:ev(e.level,n),reporters:[...e.reporters||[]]},{types:A_,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 pN({...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>=0)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(){Zy=!0}resumeLogs(){Zy=!1;const e=I_.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(Zy){I_.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&&wW(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 c=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&c>0){const l=[...this._lastLog.object.args];c>1&&l.push(`(repeated ${c} times)`),this._log({...this._lastLog.object,args:l}),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]),c=this._lastLog.serialized===a;if(this._lastLog.serialized=a,c&&(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}Qt.prototype.add=Qt.prototype.addReporter,Qt.prototype.remove=Qt.prototype.removeReporter,Qt.prototype.clear=Qt.prototype.removeReporter,Qt.prototype.withScope=Qt.prototype.withTag,Qt.prototype.mock=Qt.prototype.mockTypes,Qt.prototype.pause=Qt.prototype.pauseLogs,Qt.prototype.resume=Qt.prototype.resumeLogs;function bW(t={}){return new Qt(t)}function TW(t){const e=process.cwd()+TN;return t.split(`
167
+ `).splice(1).map(n=>n.trim().replace("file://","").replace(e,""))}function EW(t,e){return(e.__write||e.write).call(e,t)}const tv=t=>t?`[${t}]`:"";let RW=class{formatStack(e,n){return" "+TW(e).join(`
168
+ `)}formatArgs(e,n){const r=e.map(i=>i&&typeof i.stack=="string"?i.message+`
169
+ `+this.formatStack(i.stack,n):i);return _N(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"?`
170
+ `+[tv(e.tag),e.title&&e.title,...r.split(`
171
+ `)].filter(Boolean).map(i=>" > "+i).join(`
172
+ `)+`
173
+ `: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 EW(r+`
174
+ `,e.level<2?n.options.stderr||process.stderr:n.options.stdout||process.stdout)}};function P_(t={}){let e=Ke.info;return process.env.CONSOLA_LEVEL&&(e=Number.parseInt(process.env.CONSOLA_LEVEL)??e),bW({level:e,defaults:{level:e},stdout:process.stdout,stderr:process.stderr,reporters:t.reporters||[new RW],...t})}P_();const Me=P_({level:Ke.debug,formatOptions:{colors:!0,date:!1}});var SW={done:!0,hasNext:!1},Ko={done:!1,hasNext:!1},x_=()=>SW,$W=t=>({hasNext:!0,next:t,done:!1});function Ye(t,...e){let n=t,r=e.map(s=>"lazy"in s?kW(s):void 0),i=0;for(;i<e.length;){if(r[i]===void 0||!_W(n)){let c=e[i];n=c(n),i+=1;continue}let s=[];for(let c=i;c<e.length;c++){let l=r[c];if(l===void 0||(s.push(l),l.isSingle))break}let o=[];for(let c of n)if(N_(c,o,s))break;let{isSingle:a}=s.at(-1);n=a?o[0]:o,i+=s.length}return n}function N_(t,e,n){if(n.length===0)return e.push(t),!1;let r=t,i=Ko,s=!1;for(let[o,a]of n.entries()){let{index:c,items:l}=a;if(l.push(r),i=a(r,c,l),a.index+=1,i.hasNext){if(i.hasMany??!1){for(let u of i.next)if(N_(u,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 kW(t){let{lazy:e,lazyArgs:n}=t,r=e(...n);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}function _W(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}function nv(t,e){let n=e.length-t.length;if(n===1){let[r,...i]=e;return Ye(r,{lazy:t,lazyArgs:i})}if(n===0){let r={lazy:t,lazyArgs:e};return Object.assign(i=>Ye(i,r),r)}throw new Error("Wrong number of arguments")}function CW(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function Fe(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return CW(t,e,n);throw new Error("Wrong number of arguments")}function Gf(...t){return Fe(Object.values,t)}function kr(...t){return nv(AW,t)}function AW(){let t=new Set;return e=>t.has(e)?Ko:(t.add(e),{done:!1,hasNext:!0,next:e})}function IW(...t){return Fe(PW,t,xW)}var PW=(t,e)=>e<0?[]:t.slice(0,e);function xW(t){if(t<=0)return x_;let e=t;return n=>(e-=1,{done:e<=0,hasNext:!0,next:n})}function tr(...t){return Fe(NW,t)}var NW=(t,e)=>t.length>=e,O_={asc:(t,e)=>t>e,desc:(t,e)=>t<e};function OW(t,e){let[n,...r]=e;if(!DW(n)){let s=rv(...r);return t(n,s)}let i=rv(n,...r);return s=>t(s,i)}function rv(t,e,...n){let r=typeof t=="function"?t:t[0],i=typeof t=="function"?"asc":t[1],{[i]:s}=O_,o=e===void 0?void 0:rv(e,...n);return(a,c)=>{let l=r(a),u=r(c);return s(l,u)?1:s(u,l)?-1:o?.(a,c)??0}}function DW(t){if(D_(t))return!0;if(typeof t!="object"||!Array.isArray(t))return!1;let[e,n,...r]=t;return D_(e)&&typeof n=="string"&&n in O_&&r.length===0}var D_=t=>typeof t=="function"&&t.length===1;function zf(...t){return Fe(LW,t)}function LW(t,e){let n=[...t];return n.sort(e),n}function MW(...t){return OW(FW,t)}var FW=(t,e)=>[...t].sort(e);function L_(...t){return Fe(jW,t)}var jW=(t,e,n)=>t.reduce(e,n);function M_(...t){return Fe(UW,t)}function UW(t){return[...t].reverse()}function iv(...t){return e=>Ye(e,...t)}function ai(...t){return Fe(BW,t)}var BW=(t,e)=>t[e];function F_(...t){return Fe(qW,t)}function qW(t,e){let n={...t};for(let[r,i]of Object.entries(n))e(i,r,t)&&delete n[r];return n}function jn(...t){return Fe(WW,t)}var WW=t=>t.length===1?t[0]:void 0;function j_(...t){return Fe(GW,t)}function GW(t,e){let n={};for(let r of e)r in t&&(n[r]=t[r]);return n}function U_(...t){return Fe(zW,t)}function zW(t,e){if(!tr(e,1))return{...t};if(!tr(e,2)){let{[e[0]]:r,...i}=t;return i}let n={...t};for(let r of e)delete n[r];return n}function Vc(...t){return Fe(HW,t)}var HW=t=>t.at(-1);function st(...t){return Fe(VW,t,KW)}var VW=(t,e)=>t.map(e),KW=t=>(e,n,r)=>({done:!1,hasNext:!0,next:t(e,n,r)});function ci(...t){return Fe(YW,t)}function YW(t,e){let n={};for(let[r,i]of t.entries()){let[s,o]=e(i,r,t);n[s]=o}return n}function Wi(...t){return Fe(XW,t)}function XW(t,e){let n={};for(let[r,i]of Object.entries(t)){let s=e(i,r,t);n[r]=s}return n}function Gi(t){return typeof t=="string"}function Q(t){return!!t}function JW(t){return t!==null}function _r(t){return t!=null}function Rt(t){return t==null}function B_(t){return typeof t=="number"&&!Number.isNaN(t)}function q_(t){return Array.isArray(t)}function Ct(t){return t!==void 0}function zi(t){return t===void 0?!0:typeof t=="string"||Array.isArray(t)?t.length===0:Object.keys(t).length===0}function W_(...t){return Fe(QW,t)}function QW(t,e){let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);n[s]=i}return n}function ZW(...t){return nv(eG,t)}function eG(t){if(t.length===0)return x_;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?Ko:(r===1?e.delete(n):e.set(n,r-1),{hasNext:!0,next:n,done:e.size===0})}}function Hi(...t){return Fe(tG,t,nG)}var tG=(t,e)=>t.flatMap(e),nG=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 rG(...t){return Fe(iG,t,sG)}function iG(t,e){return t.forEach(e),t}var sG=t=>(e,n,r)=>(t(e,n,r),{done:!1,hasNext:!0,next:e});function Hf(...t){return Fe(oG,t)}var oG=(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 Xe(...t){return Fe(aG,t,cG)}var aG=(t,e)=>t.filter(e),cG=t=>(e,n,r)=>t(e,n,r)?{done:!1,hasNext:!0,next:e}:Ko,G_=t=>Object.assign(t,{single:!0});function z_(...t){return Fe(lG,t,G_(uG))}var lG=(t,e)=>t.find(e),uG=t=>(e,n,r)=>t(e,n,r)?{done:!0,hasNext:!0,next:e}:Ko;function dG(...t){return Fe(fG,t)}var fG=(t,e)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(e(r,n,t))return r}};function Kc(...t){return Fe(hG,t,G_(pG))}var hG=([t])=>t,pG=()=>gG,gG=t=>({hasNext:!0,next:t,done:!0});function Yo(...t){return Fe(Object.entries,t)}function mG(t,{waitMs:e,timing:n="trailing",maxWaitMs:r}){if(r!==void 0&&e!==void 0&&r<e)throw new Error(`debounce: maxWaitMs (${r}) cannot be less than waitMs (${e})`);let i,s,o,a,c=()=>{if(s!==void 0){let f=s;s=void 0,clearTimeout(f)}if(o===void 0)throw new Error("REMEDA[debounce]: latestCallArgs was unexpectedly undefined.");let d=o;o=void 0,a=t(...d)},l=()=>{if(i===void 0)return;let d=i;i=void 0,clearTimeout(d),o!==void 0&&c()},u=d=>{o=d,r!==void 0&&s===void 0&&(s=setTimeout(c,r))};return{call:(...d)=>{if(i===void 0)n==="trailing"?u(d):a=t(...d);else{n!=="leading"&&u(d);let f=i;i=void 0,clearTimeout(f)}return i=setTimeout(l,e??r??0),a},cancel:()=>{if(i!==void 0){let d=i;i=void 0,clearTimeout(d)}if(s!==void 0){let d=s;s=void 0,clearTimeout(d)}o=void 0},flush:()=>(l(),a),get isPending(){return i!==void 0},get cachedValue(){return a}}}function yG(...t){return nv(vG,t)}function vG(t){if(t.length===0)return $W;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),Ko)}}function H_(...t){return Fe(wG,t)}var wG=(t,e)=>e.every(n=>n(t));function bG(...t){return Fe(TG,t)}var TG=(t,e)=>e.some(n=>n(t));function EG(...t){return Fe(RG,t)}function RG(t,e){if(e<1)throw new RangeError(`chunk: A chunk size of '${e}' 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 V_(...t){return Fe(SG,t)}var SG=(t,{min:e,max:n})=>e!==void 0&&t<e?e:n!==void 0&&t>n?n:t;function $G(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 kG(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 _G(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 CG=new TextEncoder,AG=50;function IG(t,e,n){CG.encodeInto(t,e.subarray(n))}function PG(t,e,n){t.length>AG?IG(t,e,n):_G(t,e,n)}var xG=4096;function K_(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 c=t[r++]&63;s.push((a&31)<<6|c)}else if((a&240)===224){var c=t[r++]&63,l=t[r++]&63;s.push((a&31)<<12|c<<6|l)}else if((a&248)===240){var c=t[r++]&63,l=t[r++]&63,u=t[r++]&63,d=(a&7)<<18|c<<12|l<<6|u;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(a);s.length>=xG&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var NG=new TextDecoder,OG=200;function DG(t,e,n){var r=t.subarray(e,e+n);return NG.decode(r)}function LG(t,e,n){return n>OG?DG(t,e,n):K_(t,e,n)}var Vf=function(){function t(e,n){this.type=e,this.data=n}return t}(),MG=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)}}(),Cr=function(t){MG(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),Yc=4294967295;function FG(t,e,n){var r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function Y_(t,e,n){var r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function X_(t,e){var n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function jG(t,e){var n=t.getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}var UG=-1,BG=4294967296-1,qG=17179869184-1;function WG(t){var e=t.sec,n=t.nsec;if(e>=0&&n>=0&&e<=qG)if(n===0&&e<=BG){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),Y_(i,4,e),r}}function GG(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 zG(t){if(t instanceof Date){var e=GG(t);return WG(e)}else return null}function HG(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=X_(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new Cr("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(t.length))}}function VG(t){var e=HG(t);return new Date(e.sec*1e3+e.nsec/1e6)}var KG={type:UG,encode:zG,decode:VG},J_=function(){function t(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(KG)}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 Vf(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 Vf(o,s)}}}return e instanceof Vf?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 Vf(n,e)},t.defaultCodec=new t,t}();function Kf(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}function YG(t){if(t instanceof ArrayBuffer)return new DataView(t);var e=Kf(t);return new DataView(e.buffer,e.byteOffset,e.byteLength)}var XG=100,JG=2048,QG=function(){function t(e){var n,r,i,s,o,a,c,l;this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:J_.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:XG,this.initialBufferSize=(s=e?.initialBufferSize)!==null&&s!==void 0?s:JG,this.sortKeys=(o=e?.sortKeys)!==null&&o!==void 0?o:!1,this.forceFloat32=(a=e?.forceFloat32)!==null&&a!==void 0?a:!1,this.ignoreUndefined=(c=e?.ignoreUndefined)!==null&&c!==void 0?c:!1,this.forceIntegerToFloat=(l=e?.forceIntegerToFloat)!==null&&l!==void 0?l:!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=kG(e);this.ensureBufferSizeToWrite(n+r),this.writeStringHeader(r),PG(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=Kf(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],c=e[a];this.ignoreUndefined&&c===void 0||(this.encodeString(a),this.doEncode(c,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),FG(this.view,this.pos,e),this.pos+=8},t.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),Y_(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 ZG(t,e){var n=new QG(e);return n.encodeSharedRef(t)}function sv(t){return"".concat(t<0?"-":"","0x").concat(Math.abs(t).toString(16).padStart(2,"0"))}var ez=16,tz=16,nz=function(){function t(e,n){e===void 0&&(e=ez),n===void 0&&(n=tz),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],c=a.bytes,l=0;l<r;l++)if(c[l]!==e[n+l])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=K_(e,n,r),o=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(o,s),s},t}(),rz=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(u){try{l(r.next(u))}catch(d){o(d)}}function c(u){try{l(r.throw(u))}catch(d){o(d)}}function l(u){u.done?s(u.value):i(u.value).then(a,c)}l((r=r.apply(t,e||[])).next())})},ov=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;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}s[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(u){l=[6,u],i=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Q_=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,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}},Xo=function(t){return this instanceof Xo?(this.v=t,this):new Xo(t)},iz=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={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(f){r[f]&&(i[f]=function(h){return new Promise(function(p,y){s.push([f,h,p,y])>1||a(f,h)})})}function a(f,h){try{c(r[f](h))}catch(p){d(s[0][3],p)}}function c(f){f.value instanceof Xo?Promise.resolve(f.value.v).then(l,u):d(s[0][2],f)}function l(f){a("next",f)}function u(f){a("throw",f)}function d(f,h){f(h),s.shift(),s.length&&a(s[0][0],s[0][1])}},Z_="array",Yf="map_key",sz="map_value",oz=function(t){return typeof t=="string"||typeof t=="number"},Xc=-1,av=new DataView(new ArrayBuffer(0)),az=new Uint8Array(av.buffer);try{av.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 cv=RangeError,eC=new cv("Insufficient data"),cz=new nz,lz=function(){function t(e){var n,r,i,s,o,a,c;this.totalPos=0,this.pos=0,this.view=av,this.bytes=az,this.headByte=Xc,this.stack=[],this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:J_.defaultCodec,this.context=e?.context,this.useBigInt64=(r=e?.useBigInt64)!==null&&r!==void 0?r:!1,this.maxStrLength=(i=e?.maxStrLength)!==null&&i!==void 0?i:Yc,this.maxBinLength=(s=e?.maxBinLength)!==null&&s!==void 0?s:Yc,this.maxArrayLength=(o=e?.maxArrayLength)!==null&&o!==void 0?o:Yc,this.maxMapLength=(a=e?.maxMapLength)!==null&&a!==void 0?a:Yc,this.maxExtLength=(c=e?.maxExtLength)!==null&&c!==void 0?c:Yc,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:cz}return t.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=Xc,this.stack.length=0},t.prototype.setBuffer=function(e){this.bytes=Kf(e),this.view=YG(this.bytes),this.pos=0},t.prototype.appendBuffer=function(e){if(this.headByte===Xc&&!this.hasRemaining(1))this.setBuffer(e);else{var n=this.bytes.subarray(this.pos),r=Kf(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 ov(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){var n,r,i,s,o,a,c;return rz(this,void 0,void 0,function(){var l,u,d,f,h,p,y,R;return ov(this,function(b){switch(b.label){case 0:l=!1,b.label=1;case 1:b.trys.push([1,6,7,12]),n=!0,r=Q_(e),b.label=2;case 2:return[4,r.next()];case 3:if(i=b.sent(),s=i.done,!!s)return[3,5];c=i.value,n=!1;try{if(d=c,l)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d);try{u=this.doDecodeSync(),l=!0}catch(v){if(!(v instanceof cv))throw v}this.totalPos+=this.pos}finally{n=!0}b.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return f=b.sent(),o={error:f},[3,12];case 7:return b.trys.push([7,,10,11]),!n&&!s&&(a=r.return)?[4,a.call(r)]:[3,9];case 8:b.sent(),b.label=9;case 9:return[3,11];case 10:if(o)throw o.error;return[7];case 11:return[7];case 12:if(l){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,u]}throw h=this,p=h.headByte,y=h.pos,R=h.totalPos,new RangeError("Insufficient data in parsing ".concat(sv(p)," at ").concat(R," (").concat(y," 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 iz(this,arguments,function(){var i,s,o,a,c,l,u,d,f,h,p,y;return ov(this,function(R){switch(R.label){case 0:i=n,s=-1,R.label=1;case 1:R.trys.push([1,15,16,21]),o=!0,a=Q_(e),R.label=2;case 2:return[4,Xo(a.next())];case 3:if(c=R.sent(),f=c.done,!!f)return[3,14];y=c.value,o=!1,R.label=4;case 4:if(R.trys.push([4,,12,13]),l=y,n&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(l),i&&(s=this.readArraySize(),i=!1,this.complete()),R.label=5;case 5:R.trys.push([5,10,,11]),R.label=6;case 6:return[4,Xo(this.doDecodeSync())];case 7:return[4,R.sent()];case 8:return R.sent(),--s===0?[3,9]:[3,6];case 9:return[3,11];case 10:if(u=R.sent(),!(u instanceof cv))throw u;return[3,11];case 11:return this.totalPos+=this.pos,[3,13];case 12:return o=!0,[7];case 13:return[3,2];case 14:return[3,21];case 15:return d=R.sent(),h={error:d},[3,21];case 16:return R.trys.push([16,,19,20]),!o&&!f&&(p=a.return)?[4,Xo(p.call(a))]:[3,18];case 17:R.sent(),R.label=18;case 18:return[3,20];case 19:if(h)throw h.error;return[7];case 20:return[7];case 21: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.decodeUtf8String(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.decodeUtf8String(i,1)}else if(e===218){var i=this.lookU16();n=this.decodeUtf8String(i,2)}else if(e===219){var i=this.lookU32();n=this.decodeUtf8String(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 Cr("Unrecognized type byte: ".concat(sv(e)));this.complete();for(var s=this.stack;s.length>0;){var o=s[s.length-1];if(o.type===Z_)if(o.array[o.position]=n,o.position++,o.position===o.size)s.pop(),n=o.array;else continue e;else if(o.type===Yf){if(!oz(n))throw new Cr("The type of key must be string or number but "+typeof n);if(n==="__proto__")throw new Cr("The key __proto__ is not allowed");o.key=n,o.type=sz;continue e}else if(o.map[o.key]=n,o.readCount++,o.readCount===o.size)s.pop(),n=o.map;else{o.key=null,o.type=Yf;continue e}}return n}},t.prototype.readHeadByte=function(){return this.headByte===Xc&&(this.headByte=this.readU8()),this.headByte},t.prototype.complete=function(){this.headByte=Xc},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 Cr("Unrecognized array type byte: ".concat(sv(e)))}}},t.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Cr("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:Yf,size:e,key:null,readCount:0,map:{}})},t.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new Cr("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:Z_,size:e,array:new Array(e),position:0})},t.prototype.decodeUtf8String=function(e,n){var r;if(e>this.maxStrLength)throw new Cr("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+n+e)throw eC;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=LG(this.bytes,i,e),this.pos+=n+e,s},t.prototype.stateIsMapKey=function(){if(this.stack.length>0){var e=this.stack[this.stack.length-1];return e.type===Yf}return!1},t.prototype.decodeBinary=function(e,n){if(e>this.maxBinLength)throw new Cr("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+n))throw eC;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 Cr("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=jG(this.view,this.pos);return this.pos+=8,e},t.prototype.readI64=function(){var e=X_(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 uz(t,e){var n=new lz(e);return n.decode(t)}const dz=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",fz=(t,e=0,n=t.byteLength-e)=>{if(!dz(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Mp.from(t,e,n)},tC=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Mp.from(t,e):Mp.from(t)},hz=/^[A-Za-z0-9+/]*={0,2}$/,pz=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!hz.exec(t))throw new TypeError("Invalid base64 string.");const e=tC(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},gz=t=>{const e=tC(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},mz=t=>{let e;if(typeof t=="string"?e=gz(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 fz(e.buffer,e.byteOffset,e.byteLength).toString("base64")},yz=`likec4lib {
175
+ icons {
176
+ aws:activate
177
+ aws:alexa-for-business
178
+ aws:amplify
179
+ aws:apache-mxnet-on-aws
180
+ aws:api-gateway
181
+ aws:app-config
182
+ aws:app-flow
183
+ aws:app-mesh
184
+ aws:app-runner
185
+ aws:app-stream
186
+ aws:app-sync
187
+ aws:application-auto-scaling
188
+ aws:application-composer
189
+ aws:application-cost-profiler
190
+ aws:application-discovery-service
191
+ aws:application-migration-service
192
+ aws:artifact
193
+ aws:athena
194
+ aws:audit-manager
195
+ aws:augmented-ai-a2i
196
+ aws:aurora
197
+ aws:auto-scaling
198
+ aws:backint-agent
199
+ aws:backup
200
+ aws:batch
201
+ aws:billing-conductor
202
+ aws:bottlerocket
203
+ aws:braket
204
+ aws:budgets
205
+ aws:certificate-manager
206
+ aws:chatbot
207
+ aws:chime
208
+ aws:chime-sdk
209
+ aws:chime-voice-connector
210
+ aws:clean-rooms
211
+ aws:client-vpn
212
+ aws:cloud-control-api
213
+ aws:cloud-development-kit
214
+ aws:cloud-directory
215
+ aws:cloud-formation
216
+ aws:cloud-front
217
+ aws:cloud-hsm
218
+ aws:cloud-map
219
+ aws:cloud-search
220
+ aws:cloud-shell
221
+ aws:cloud-trail
222
+ aws:cloud-wan
223
+ aws:cloud-watch
224
+ aws:cloud9
225
+ aws:code-artifact
226
+ aws:code-build
227
+ aws:code-catalyst
228
+ aws:code-commit
229
+ aws:code-deploy
230
+ aws:code-guru
231
+ aws:code-pipeline
232
+ aws:code-star
233
+ aws:code-whisperer
234
+ aws:cognito
235
+ aws:command-line-interface
236
+ aws:comprehend
237
+ aws:comprehend-medical
238
+ aws:compute-optimizer
239
+ aws:config
240
+ aws:connect
241
+ aws:console-mobile-application
242
+ aws:control-tower
243
+ aws:corretto
244
+ aws:cost-and-usage-report
245
+ aws:cost-explorer
246
+ aws:data-exchange
247
+ aws:data-pipeline
248
+ aws:data-sync
249
+ aws:data-zone
250
+ aws:database-migration-service
251
+ aws:deep-composer
252
+ aws:deep-learning-amis
253
+ aws:deep-learning-containers
254
+ aws:deep-lens
255
+ aws:deep-racer
256
+ aws:detective
257
+ aws:dev-ops-guru
258
+ aws:device-farm
259
+ aws:direct-connect
260
+ aws:directory-service
261
+ aws:distro-for-open-telemetry
262
+ aws:document-db
263
+ aws:dynamo-db
264
+ aws:ec2
265
+ aws:ec2-auto-scaling
266
+ aws:ec2-image-builder
267
+ aws:ecs-anywhere
268
+ aws:efs
269
+ aws:eks-anywhere
270
+ aws:eks-cloud
271
+ aws:eks-distro
272
+ aws:elasti-cache
273
+ aws:elastic-beanstalk
274
+ aws:elastic-block-store
275
+ aws:elastic-container-registry
276
+ aws:elastic-container-service
277
+ aws:elastic-disaster-recovery
278
+ aws:elastic-fabric-adapter
279
+ aws:elastic-inference
280
+ aws:elastic-kubernetes-service
281
+ aws:elastic-load-balancing
282
+ aws:elastic-transcoder
283
+ aws:elemental-appliances-software
284
+ aws:elemental-conductor
285
+ aws:elemental-delta
286
+ aws:elemental-link
287
+ aws:elemental-live
288
+ aws:elemental-media-connect
289
+ aws:elemental-media-convert
290
+ aws:elemental-media-live
291
+ aws:elemental-media-package
292
+ aws:elemental-media-store
293
+ aws:elemental-media-tailor
294
+ aws:elemental-server
295
+ aws:emr
296
+ aws:event-bridge
297
+ aws:express-workflows
298
+ aws:fargate
299
+ aws:fault-injection-simulator
300
+ aws:file-cache
301
+ aws:fin-space
302
+ aws:firewall-manager
303
+ aws:forecast
304
+ aws:fraud-detector
305
+ aws:free-rtos
306
+ aws:fsx
307
+ aws:fsx-for-lustre
308
+ aws:fsx-for-net-app-ontap
309
+ aws:fsx-for-open-zfs
310
+ aws:fsx-for-wfs
311
+ aws:game-kit
312
+ aws:game-lift
313
+ aws:game-sparks
314
+ aws:genomics-cli
315
+ aws:global-accelerator
316
+ aws:glue
317
+ aws:glue-data-brew
318
+ aws:glue-elastic-views
319
+ aws:ground-station
320
+ aws:guard-duty
321
+ aws:health-lake
322
+ aws:honeycode
323
+ aws:iam-identity-center
324
+ aws:identity-and-access-management
325
+ aws:inspector
326
+ aws:interactive-video-service
327
+ aws:io-t-1-click
328
+ aws:io-t-analytics
329
+ aws:io-t-button
330
+ aws:io-t-core
331
+ aws:io-t-device-defender
332
+ aws:io-t-device-management
333
+ aws:io-t-edu-kit
334
+ aws:io-t-events
335
+ aws:io-t-express-link
336
+ aws:io-t-fleet-wise
337
+ aws:io-t-greengrass
338
+ aws:io-t-robo-runner
339
+ aws:io-t-site-wise
340
+ aws:io-t-things-graph
341
+ aws:io-t-twin-maker
342
+ aws:iq
343
+ aws:kendra
344
+ aws:key-management-service
345
+ aws:keyspaces
346
+ aws:kinesis
347
+ aws:kinesis-data-analytics
348
+ aws:kinesis-data-streams
349
+ aws:kinesis-firehose
350
+ aws:kinesis-video-streams
351
+ aws:lake-formation
352
+ aws:lambda
353
+ aws:launch-wizard
354
+ aws:lex
355
+ aws:license-manager
356
+ aws:lightsail
357
+ aws:local-zones
358
+ aws:location-service
359
+ aws:lookout-for-equipment
360
+ aws:lookout-for-metrics
361
+ aws:lookout-for-vision
362
+ aws:lumberyard
363
+ aws:macie
364
+ aws:mainframe-modernization
365
+ aws:managed-blockchain
366
+ aws:managed-grafana
367
+ aws:managed-service-for-prometheus
368
+ aws:managed-services
369
+ aws:managed-streaming-for-apache-kafka
370
+ aws:managed-workflows-for-apache-airflow
371
+ aws:management-console
372
+ aws:marketplace-dark
373
+ aws:marketplace-light
374
+ aws:memory-db-for-redis
375
+ aws:migration-evaluator
376
+ aws:migration-hub
377
+ aws:monitron
378
+ aws:mq
379
+ aws:neptune
380
+ aws:network-firewall
381
+ aws:neuron
382
+ aws:nice-dcv
383
+ aws:nice-engin-frame
384
+ aws:nimble-studio
385
+ aws:nitro-enclaves
386
+ aws:omics
387
+ aws:open-3d-engine
388
+ aws:open-search-service
389
+ aws:ops-works
390
+ aws:organizations
391
+ aws:outposts-family
392
+ aws:outposts-rack
393
+ aws:outposts-servers
394
+ aws:panorama
395
+ aws:parallel-cluster
396
+ aws:personal-health-dashboard
397
+ aws:personalize
398
+ aws:pinpoint
399
+ aws:pinpoint-apis
400
+ aws:polly
401
+ aws:private-5g
402
+ aws:private-certificate-authority
403
+ aws:private-link
404
+ aws:professional-services
405
+ aws:proton
406
+ aws:quantum-ledger-database
407
+ aws:quick-sight
408
+ aws:rds
409
+ aws:rds-on-vmware
410
+ aws:re-post
411
+ aws:red-hat-open-shift-service-on-aws
412
+ aws:redshift
413
+ aws:rekognition
414
+ aws:reserved-instance-reporting
415
+ aws:resilience-hub
416
+ aws:resource-access-manager
417
+ aws:resource-explorer
418
+ aws:robo-maker
419
+ aws:route-53
420
+ aws:s3-on-outposts
421
+ aws:sage-maker
422
+ aws:sage-maker-ground-truth
423
+ aws:sage-maker-studio-lab
424
+ aws:savings-plans
425
+ aws:secrets-manager
426
+ aws:security-hub
427
+ aws:security-lake
428
+ aws:server-migration-service
429
+ aws:serverless-application-repository
430
+ aws:service-catalog
431
+ aws:service-management-connector
432
+ aws:shield
433
+ aws:signer
434
+ aws:sim-space-weaver
435
+ aws:simple-email-service
436
+ aws:simple-notification-service
437
+ aws:simple-queue-service
438
+ aws:simple-storage-service
439
+ aws:simple-storage-service-glacier
440
+ aws:site-to-site-vpn
441
+ aws:snowball
442
+ aws:snowball-edge
443
+ aws:snowcone
444
+ aws:snowmobile
445
+ aws:step-functions
446
+ aws:storage-gateway
447
+ aws:sumerian
448
+ aws:supply-chain
449
+ aws:support
450
+ aws:systems-manager
451
+ aws:tensor-flow-on-aws
452
+ aws:textract
453
+ aws:thinkbox-deadline
454
+ aws:thinkbox-frost
455
+ aws:thinkbox-krakatoa
456
+ aws:thinkbox-sequoia
457
+ aws:thinkbox-stoke
458
+ aws:thinkbox-xmesh
459
+ aws:timestream
460
+ aws:tools-and-sdks
461
+ aws:torch-serve
462
+ aws:training-certification
463
+ aws:transcribe
464
+ aws:transfer-family
465
+ aws:transit-gateway
466
+ aws:translate
467
+ aws:trusted-advisor
468
+ aws:verified-access
469
+ aws:verified-permissions
470
+ aws:virtual-private-cloud
471
+ aws:vmware-cloud-on-aws
472
+ aws:vpc-lattice
473
+ aws:waf
474
+ aws:wavelength
475
+ aws:well-architected-tool
476
+ aws:wickr
477
+ aws:work-docs
478
+ aws:work-docs-sdk
479
+ aws:work-link
480
+ aws:work-mail
481
+ aws:work-spaces-family
482
+ aws:x-ray
483
+ gcp:access-context-manager
484
+ gcp:administration
485
+ gcp:advanced-agent-modeling
486
+ gcp:advanced-solutions-lab
487
+ gcp:agent-assist
488
+ gcp:ai-hub
489
+ gcp:ai-platform
490
+ gcp:ai-platform-unified
491
+ gcp:analytics-hub
492
+ gcp:anthos
493
+ gcp:anthos-config-management
494
+ gcp:anthos-service-mesh
495
+ gcp:api
496
+ gcp:api-analytics
497
+ gcp:api-monetization
498
+ gcp:apigee-api-platform
499
+ gcp:apigee-sense
500
+ gcp:app-engine
501
+ gcp:artifact-registry
502
+ gcp:asset-inventory
503
+ gcp:assured-workloads
504
+ gcp:auto-ml
505
+ gcp:auto-ml-natural-language
506
+ gcp:auto-ml-tables
507
+ gcp:auto-ml-translation
508
+ gcp:auto-ml-video-intelligence
509
+ gcp:auto-ml-vision
510
+ gcp:bare-metal-solutions
511
+ gcp:batch
512
+ gcp:beyondcorp
513
+ gcp:big-query
514
+ gcp:bigtable
515
+ gcp:billing
516
+ gcp:binary-authorization
517
+ gcp:catalog
518
+ gcp:certificate-authority-service
519
+ gcp:certificate-manager
520
+ gcp:cloud-api-gateway
521
+ gcp:cloud-apis
522
+ gcp:cloud-armor
523
+ gcp:cloud-asset-inventory
524
+ gcp:cloud-audit-logs
525
+ gcp:cloud-build
526
+ gcp:cloud-cdn
527
+ gcp:cloud-code
528
+ gcp:cloud-composer
529
+ gcp:cloud-data-fusion
530
+ gcp:cloud-deploy
531
+ gcp:cloud-deployment-manager
532
+ gcp:cloud-dns
533
+ gcp:cloud-domains
534
+ gcp:cloud-ekm
535
+ gcp:cloud-endpoints
536
+ gcp:cloud-external-ip-addresses
537
+ gcp:cloud-firewall-rules
538
+ gcp:cloud-for-marketing
539
+ gcp:cloud-functions
540
+ gcp:cloud-generic
541
+ gcp:cloud-gpu
542
+ gcp:cloud-healthcare-api
543
+ gcp:cloud-healthcare-marketplace
544
+ gcp:cloud-hsm
545
+ gcp:cloud-ids
546
+ gcp:cloud-inference-api
547
+ gcp:cloud-interconnect
548
+ gcp:cloud-jobs-api
549
+ gcp:cloud-load-balancing
550
+ gcp:cloud-logging
551
+ gcp:cloud-media-edge
552
+ gcp:cloud-monitoring
553
+ gcp:cloud-nat
554
+ gcp:cloud-natural-language-api
555
+ gcp:cloud-network
556
+ gcp:cloud-ops
557
+ gcp:cloud-optimization-ai
558
+ gcp:cloud-optimization-ai-fleet-routing-api
559
+ gcp:cloud-router
560
+ gcp:cloud-routes
561
+ gcp:cloud-run
562
+ gcp:cloud-run-for-anthos
563
+ gcp:cloud-scheduler
564
+ gcp:cloud-security-scanner
565
+ gcp:cloud-shell
566
+ gcp:cloud-spanner
567
+ gcp:cloud-sql
568
+ gcp:cloud-storage
569
+ gcp:cloud-tasks
570
+ gcp:cloud-test-lab
571
+ gcp:cloud-tpu
572
+ gcp:cloud-translation-api
573
+ gcp:cloud-vision-api
574
+ gcp:cloud-vpn
575
+ gcp:compute-engine
576
+ gcp:configuration-management
577
+ gcp:connectivity-test
578
+ gcp:connectors
579
+ gcp:contact-center-ai
580
+ gcp:container-optimized-os
581
+ gcp:container-registry
582
+ gcp:data-catalog
583
+ gcp:data-labeling
584
+ gcp:data-layers
585
+ gcp:data-loss-prevention-api
586
+ gcp:data-qn-a
587
+ gcp:data-studio
588
+ gcp:data-transfer
589
+ gcp:database-migration-service
590
+ gcp:dataflow
591
+ gcp:datalab
592
+ gcp:dataplex
593
+ gcp:datapol
594
+ gcp:dataprep
595
+ gcp:dataproc
596
+ gcp:dataproc-metastore
597
+ gcp:datashare
598
+ gcp:datastore
599
+ gcp:datastream
600
+ gcp:debugger
601
+ gcp:developer-portal
602
+ gcp:dialogflow
603
+ gcp:dialogflow-cx
604
+ gcp:dialogflow-insights
605
+ gcp:document-ai
606
+ gcp:early-access-center
607
+ gcp:error-reporting
608
+ gcp:eventarc
609
+ gcp:filestore
610
+ gcp:financial-services-marketplace
611
+ gcp:firestore
612
+ gcp:fleet-engine
613
+ gcp:free-trial
614
+ gcp:game-servers
615
+ gcp:gce-systems-management
616
+ gcp:genomics
617
+ gcp:gke-on-prem
618
+ gcp:google-cloud-marketplace
619
+ gcp:google-kubernetes-engine
620
+ gcp:google-maps-platform
621
+ gcp:healthcare-nlp-api
622
+ gcp:home
623
+ gcp:identity-and-access-management
624
+ gcp:identity-aware-proxy
625
+ gcp:identity-platform
626
+ gcp:iot-core
627
+ gcp:iot-edge
628
+ gcp:key-access-justifications
629
+ gcp:key-management-service
630
+ gcp:kuberun
631
+ gcp:launcher
632
+ gcp:local-ssd
633
+ gcp:looker
634
+ gcp:managed-service-for-microsoft-active-directory
635
+ gcp:media-translation-api
636
+ gcp:memorystore
637
+ gcp:migrate-for-anthos
638
+ gcp:migrate-for-compute-engine
639
+ gcp:my-cloud
640
+ gcp:network-connectivity-center
641
+ gcp:network-intelligence-center
642
+ gcp:network-security
643
+ gcp:network-tiers
644
+ gcp:network-topology
645
+ gcp:onboarding
646
+ gcp:os-configuration-management
647
+ gcp:os-inventory-management
648
+ gcp:os-patch-management
649
+ gcp:partner-interconnect
650
+ gcp:partner-portal
651
+ gcp:performance-dashboard
652
+ gcp:permissions
653
+ gcp:persistent-disk
654
+ gcp:phishing-protection
655
+ gcp:policy-analyzer
656
+ gcp:premium-network-tier
657
+ gcp:private-connectivity
658
+ gcp:private-service-connect
659
+ gcp:producer-portal
660
+ gcp:profiler
661
+ gcp:project
662
+ gcp:pub-sub
663
+ gcp:quantum-engine
664
+ gcp:quotas
665
+ gcp:real-world-insights
666
+ gcp:recommendations-ai
667
+ gcp:release-notes
668
+ gcp:retail-api
669
+ gcp:risk-manager
670
+ gcp:runtime-config
671
+ gcp:secret-manager
672
+ gcp:security
673
+ gcp:security-command-center
674
+ gcp:security-health-advisor
675
+ gcp:security-key-enforcement
676
+ gcp:service-discovery
677
+ gcp:speech-to-text
678
+ gcp:stackdriver
679
+ gcp:standard-network-tier
680
+ gcp:stream-suite
681
+ gcp:support
682
+ gcp:tensorflow-enterprise
683
+ gcp:text-to-speech
684
+ gcp:tools-for-powershell
685
+ gcp:trace
686
+ gcp:traffic-director
687
+ gcp:transfer
688
+ gcp:transfer-appliance
689
+ gcp:user-preferences
690
+ gcp:vertex-ai
691
+ gcp:video-intelligence-api
692
+ gcp:virtual-private-cloud
693
+ gcp:visual-inspection
694
+ gcp:vmware-engine
695
+ gcp:web-risk
696
+ gcp:web-security-scanner
697
+ gcp:workflows
698
+ gcp:workload-identity-pool
699
+ tech:aarch64
700
+ tech:adobe-illustrator
701
+ tech:adobe-photoshop
702
+ tech:adobe-premiere-pro
703
+ tech:adobe-xd
704
+ tech:adonis-js
705
+ tech:after-effects
706
+ tech:airflow
707
+ tech:akka
708
+ tech:algolia
709
+ tech:alpine-js
710
+ tech:amazon-web-services
711
+ tech:anaconda
712
+ tech:android
713
+ tech:android-studio
714
+ tech:angular
715
+ tech:angular-js
716
+ tech:ansible
717
+ tech:ant-design
718
+ tech:apache
719
+ tech:apl
720
+ tech:appcelerator
721
+ tech:apple
722
+ tech:apple-safari
723
+ tech:appwrite
724
+ tech:arch-linux
725
+ tech:arduino
726
+ tech:argo-cd
727
+ tech:astro
728
+ tech:atom
729
+ tech:autodesk-maya
730
+ tech:autodesk-shot-grid
731
+ tech:awk
732
+ tech:azios
733
+ tech:azure
734
+ tech:azure-devops
735
+ tech:azure-sql-database
736
+ tech:babel
737
+ tech:backbone-js
738
+ tech:ballerina
739
+ tech:bamboo
740
+ tech:bash
741
+ tech:behance
742
+ tech:bitbucket
743
+ tech:blender
744
+ tech:bootstrap
745
+ tech:bower
746
+ tech:browserstack
747
+ tech:bulma
748
+ tech:bun
749
+ tech:c
750
+ tech:cairo-graphics
751
+ tech:cake-php
752
+ tech:canva
753
+ tech:capacitor
754
+ tech:cassandra
755
+ tech:cent-os
756
+ tech:chrome
757
+ tech:circle-ci
758
+ tech:clarity
759
+ tech:clion
760
+ tech:clojure
761
+ tech:clojure-script
762
+ tech:cloudflare
763
+ tech:cloudflare-workers
764
+ tech:cmake
765
+ tech:code-igniter
766
+ tech:code-pen
767
+ tech:codeac
768
+ tech:codecov
769
+ tech:coffee-script
770
+ tech:composer
771
+ tech:confluence
772
+ tech:consul
773
+ tech:contao
774
+ tech:corejs
775
+ tech:cosmosdb
776
+ tech:couchdb
777
+ tech:cplusplus
778
+ tech:crystal
779
+ tech:csharp
780
+ tech:css3
781
+ tech:cucumber
782
+ tech:cypress
783
+ tech:d3js
784
+ tech:dart
785
+ tech:data-grip
786
+ tech:data-spell
787
+ tech:dbeaver
788
+ tech:debian
789
+ tech:deno
790
+ tech:devicon
791
+ tech:digital-ocean
792
+ tech:discord-js
793
+ tech:django
794
+ tech:django-rest
795
+ tech:docker
796
+ tech:doctrine
797
+ tech:dropwizard
798
+ tech:drupal
799
+ tech:eclipse-ceylon
800
+ tech:eclipse-ide
801
+ tech:eclipse-vert-x
802
+ tech:elasticbeats
803
+ tech:elasticsearch
804
+ tech:electron
805
+ tech:eleventy-11ty
806
+ tech:elixir
807
+ tech:elm
808
+ tech:embedded-c
809
+ tech:ember-js
810
+ tech:envoy
811
+ tech:erlang
812
+ tech:eslint
813
+ tech:express
814
+ tech:facebook
815
+ tech:fast-api
816
+ tech:fastify
817
+ tech:fauna
818
+ tech:feathers
819
+ tech:fedora
820
+ tech:figma
821
+ tech:file-zilla
822
+ tech:firebase
823
+ tech:firefox
824
+ tech:flask
825
+ tech:flutter
826
+ tech:fortran
827
+ tech:foundation
828
+ tech:fsharp
829
+ tech:gatling
830
+ tech:gatsby
831
+ tech:gazebo
832
+ tech:gcc
833
+ tech:gentoo
834
+ tech:ghost
835
+ tech:gimp
836
+ tech:git
837
+ tech:gitbook
838
+ tech:github
839
+ tech:github-actions
840
+ tech:github-codespaces
841
+ tech:gitlab
842
+ tech:gitpod
843
+ tech:gitter
844
+ tech:gnu-emacs
845
+ tech:go
846
+ tech:go-land
847
+ tech:godot-engine
848
+ tech:google
849
+ tech:google-cloud
850
+ tech:gradle
851
+ tech:grafana
852
+ tech:grails
853
+ tech:graphql
854
+ tech:groovy
855
+ tech:grunt-js
856
+ tech:gulp-js
857
+ tech:hadoop
858
+ tech:handlebars
859
+ tech:hardhat
860
+ tech:harvester
861
+ tech:hashicorp-vault
862
+ tech:haskell
863
+ tech:haxe
864
+ tech:helm
865
+ tech:heroku
866
+ tech:hibernate
867
+ tech:homebrew
868
+ tech:html5
869
+ tech:hugo
870
+ tech:ibm-spss-statistics
871
+ tech:ie10
872
+ tech:ifttt
873
+ tech:influxdb
874
+ tech:inkscape
875
+ tech:insomnia
876
+ tech:intellij-idea
877
+ tech:ionic
878
+ tech:jaeger
879
+ tech:jamstack
880
+ tech:jasmine
881
+ tech:java
882
+ tech:javascript
883
+ tech:jeet
884
+ tech:jekyll
885
+ tech:jenkins
886
+ tech:jest
887
+ tech:jetbrains
888
+ tech:jira
889
+ tech:jira-align
890
+ tech:jquery
891
+ tech:json
892
+ tech:jule
893
+ tech:julia
894
+ tech:junit
895
+ tech:jupyter
896
+ tech:k3os
897
+ tech:k3s
898
+ tech:kafka
899
+ tech:kaggle
900
+ tech:karate
901
+ tech:karma
902
+ tech:keras
903
+ tech:kibana
904
+ tech:knex-js
905
+ tech:knockout
906
+ tech:kotlin
907
+ tech:krakenjs
908
+ tech:ktor
909
+ tech:kubernetes
910
+ tech:labview
911
+ tech:laravel
912
+ tech:latex
913
+ tech:less-js
914
+ tech:linkedin
915
+ tech:linux
916
+ tech:liquibase
917
+ tech:livewire
918
+ tech:llvm
919
+ tech:logstash
920
+ tech:lua
921
+ tech:lumen
922
+ tech:magento
923
+ tech:markdown
924
+ tech:material-ui
925
+ tech:materialize
926
+ tech:matlab
927
+ tech:matplotlib
928
+ tech:maven
929
+ tech:meteor-js
930
+ tech:microsoft-sql-server
931
+ tech:minitab
932
+ tech:mob-x
933
+ tech:mocha
934
+ tech:modx
935
+ tech:moleculer
936
+ tech:mongodb
937
+ tech:mongoose-js
938
+ tech:moodle
939
+ tech:ms-dos
940
+ tech:mysql
941
+ tech:nano
942
+ tech:nerog
943
+ tech:nestjs
944
+ tech:net
945
+ tech:net-core
946
+ tech:network-x
947
+ tech:new4j
948
+ tech:nextjs
949
+ tech:nginx
950
+ tech:nhibernate
951
+ tech:nim
952
+ tech:nimble
953
+ tech:nix
954
+ tech:nodejs
955
+ tech:nodemon
956
+ tech:nodewebkit
957
+ tech:npm
958
+ tech:nuget
959
+ tech:num-py
960
+ tech:nuxt-js
961
+ tech:objective-c
962
+ tech:ocaml
963
+ tech:oh-my-zsh
964
+ tech:okta
965
+ tech:open-al
966
+ tech:open-api
967
+ tech:open-cl
968
+ tech:open-cv
969
+ tech:open-gl
970
+ tech:open-stack
971
+ tech:open-suse
972
+ tech:open-telemetry
973
+ tech:opera
974
+ tech:oracle
975
+ tech:p5js
976
+ tech:packer
977
+ tech:pandas
978
+ tech:perl
979
+ tech:pf-sense
980
+ tech:phalcon
981
+ tech:phoenix-framework
982
+ tech:photon-engine
983
+ tech:php
984
+ tech:php-storm
985
+ tech:playwrite
986
+ tech:ploty
987
+ tech:podman
988
+ tech:polygon
989
+ tech:portainer
990
+ tech:postcss
991
+ tech:postgresql
992
+ tech:postman
993
+ tech:powershell
994
+ tech:processing
995
+ tech:prometheus
996
+ tech:protractor
997
+ tech:purescript
998
+ tech:putty
999
+ tech:pycharm
1000
+ tech:pyscript
1001
+ tech:pytest
1002
+ tech:python
1003
+ tech:python-poetry
1004
+ tech:pytorch
1005
+ tech:qodana
1006
+ tech:qt
1007
+ tech:quarkus
1008
+ tech:quasar
1009
+ tech:qwik
1010
+ tech:r
1011
+ tech:rabbitmq
1012
+ tech:rancher
1013
+ tech:raspberrypi
1014
+ tech:reach
1015
+ tech:react
1016
+ tech:react-bootstrap
1017
+ tech:realm
1018
+ tech:red-cube-s-epic-compiler-thingy-programming-re-ct
1019
+ tech:redhat
1020
+ tech:redis
1021
+ tech:redux
1022
+ tech:ren-py
1023
+ tech:rider
1024
+ tech:robot-operating-system-ros
1025
+ tech:rocksdb
1026
+ tech:rollup-js
1027
+ tech:rspec
1028
+ tech:rstudio
1029
+ tech:ruby
1030
+ tech:ruby-mine
1031
+ tech:ruby-on-rails
1032
+ tech:rust
1033
+ tech:salesforce
1034
+ tech:sanity
1035
+ tech:sass
1036
+ tech:scala
1037
+ tech:scalingo
1038
+ tech:sdl
1039
+ tech:selenium
1040
+ tech:sema-software
1041
+ tech:sequelize
1042
+ tech:shopware
1043
+ tech:sketch
1044
+ tech:slack
1045
+ tech:socket-io
1046
+ tech:solid-js
1047
+ tech:solidity
1048
+ tech:sonarqube
1049
+ tech:sourcetree
1050
+ tech:spark
1051
+ tech:splunk
1052
+ tech:spring
1053
+ tech:sql-developer
1054
+ tech:sqlalchemy
1055
+ tech:sqlite
1056
+ tech:ssh
1057
+ tech:stackoverflow
1058
+ tech:stata
1059
+ tech:storybook
1060
+ tech:streamlit
1061
+ tech:stylus
1062
+ tech:subversion
1063
+ tech:svelte
1064
+ tech:swagger
1065
+ tech:swift
1066
+ tech:symfony
1067
+ tech:tailwind-css
1068
+ tech:tauri
1069
+ tech:tensorflow
1070
+ tech:terraform
1071
+ tech:tex
1072
+ tech:the-algorithms
1073
+ tech:three-js
1074
+ tech:titanium-sdk
1075
+ tech:tomcat
1076
+ tech:tortoise-git
1077
+ tech:tower
1078
+ tech:traefik-mesh
1079
+ tech:traefik-proxy
1080
+ tech:travis-ci
1081
+ tech:trello
1082
+ tech:twitter
1083
+ tech:typescript
1084
+ tech:typo3
1085
+ tech:ubuntu
1086
+ tech:uml
1087
+ tech:unity
1088
+ tech:unix
1089
+ tech:unreal-engine
1090
+ tech:uwsgi
1091
+ tech:v8
1092
+ tech:vagrant
1093
+ tech:vala
1094
+ tech:vercel
1095
+ tech:veutify
1096
+ tech:vim
1097
+ tech:visualstudio
1098
+ tech:vite
1099
+ tech:vitejs
1100
+ tech:vscode
1101
+ tech:vsphere
1102
+ tech:vue
1103
+ tech:vue-storefront
1104
+ tech:vyper
1105
+ tech:webassembly
1106
+ tech:webflow
1107
+ tech:weblate
1108
+ tech:webpack
1109
+ tech:webstorm
1110
+ tech:windows11
1111
+ tech:windows8
1112
+ tech:woo-commerce
1113
+ tech:wordpress
1114
+ tech:xamarin
1115
+ tech:xcode
1116
+ tech:xml
1117
+ tech:yaml
1118
+ tech:yarn
1119
+ tech:yii-framework
1120
+ tech:yuno-host
1121
+ tech:zend-framework
1122
+ tech:zig
1123
+ }
1124
+ }
1125
+ `,nC="likec4builtin",vz=`${nC}:///likec4/lib/icons.c4`,wz=new un.NotificationType("likec4/onDidChangeModel"),bz=new un.RequestType0("likec4/fetchModel"),Tz=new un.RequestType0("likec4/fetchComputedModel"),Ez=new un.RequestType("likec4/computeView"),Rz=new un.RequestType("likec4/build"),Sz=new un.RequestType("likec4/locate"),$z=new un.RequestType("likec4/change-view");var kz=t=>{const e=t.match(/^[ \t]*(?=\S)/gm);return e?e.reduce((n,r)=>Math.min(n,r.length),1/0):0};const _z=Ro(kz);function lv(t){const e=_z(t);if(e===0)return t;const n=new RegExp(`^[ \\t]{${e}}`,"gm");return t.replace(n,"")}function Cz(t){for(var e=5381,n=t.length;n;)e=e*33^t.charCodeAt(--n);return e>>>0}var Az=Cz;const Iz=Ro(Az);var Pz=Object.getOwnPropertyNames,xz=Object.getOwnPropertySymbols,Nz=Object.prototype.hasOwnProperty;function rC(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Xf(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 c=t(n,r,i);return s.delete(n),s.delete(r),c}}function iC(t){return Pz(t).concat(xz(t))}var sC=Object.hasOwn||function(t,e){return Nz.call(t,e)};function Jo(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var oC="_owner",aC=Object.getOwnPropertyDescriptor,cC=Object.keys;function Oz(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 Dz(t,e){return Jo(t.getTime(),e.getTime())}function lC(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),s=0,o,a;(o=i.next())&&!o.done;){for(var c=e.entries(),l=!1,u=0;(a=c.next())&&!a.done;){var d=o.value,f=d[0],h=d[1],p=a.value,y=p[0],R=p[1];!l&&!r[u]&&(l=n.equals(f,y,s,u,t,e,n)&&n.equals(h,R,f,y,t,e,n))&&(r[u]=!0),u++}if(!l)return!1;s++}return!0}function Lz(t,e,n){var r=cC(t),i=r.length;if(cC(e).length!==i)return!1;for(var s;i-- >0;)if(s=r[i],s===oC&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!sC(e,s)||!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function Jc(t,e,n){var r=iC(t),i=r.length;if(iC(e).length!==i)return!1;for(var s,o,a;i-- >0;)if(s=r[i],s===oC&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!sC(e,s)||!n.equals(t[s],e[s],s,s,t,e,n)||(o=aC(t,s),a=aC(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Mz(t,e){return Jo(t.valueOf(),e.valueOf())}function Fz(t,e){return t.source===e.source&&t.flags===e.flags}function uC(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),s,o;(s=i.next())&&!s.done;){for(var a=e.values(),c=!1,l=0;(o=a.next())&&!o.done;)!c&&!r[l]&&(c=n.equals(s.value,o.value,s.value,o.value,t,e,n))&&(r[l]=!0),l++;if(!c)return!1}return!0}function jz(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var Uz="[object Arguments]",Bz="[object Boolean]",qz="[object Date]",Wz="[object Map]",Gz="[object Number]",zz="[object Object]",Hz="[object RegExp]",Vz="[object Set]",Kz="[object String]",Yz=Array.isArray,dC=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,fC=Object.assign,Xz=Object.prototype.toString.call.bind(Object.prototype.toString);function Jz(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,s=t.arePrimitiveWrappersEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,c=t.areTypedArraysEqual;return function(u,d,f){if(u===d)return!0;if(u==null||d==null||typeof u!="object"||typeof d!="object")return u!==u&&d!==d;var h=u.constructor;if(h!==d.constructor)return!1;if(h===Object)return i(u,d,f);if(Yz(u))return e(u,d,f);if(dC!=null&&dC(u))return c(u,d,f);if(h===Date)return n(u,d,f);if(h===RegExp)return o(u,d,f);if(h===Map)return r(u,d,f);if(h===Set)return a(u,d,f);var p=Xz(u);return p===qz?n(u,d,f):p===Hz?o(u,d,f):p===Wz?r(u,d,f):p===Vz?a(u,d,f):p===zz?typeof u.then!="function"&&typeof d.then!="function"&&i(u,d,f):p===Uz?i(u,d,f):p===Bz||p===Gz||p===Kz?s(u,d,f):!1}}function Qz(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Jc:Oz,areDatesEqual:Dz,areMapsEqual:r?rC(lC,Jc):lC,areObjectsEqual:r?Jc:Lz,arePrimitiveWrappersEqual:Mz,areRegExpsEqual:Fz,areSetsEqual:r?rC(uC,Jc):uC,areTypedArraysEqual:r?Jc:jz};if(n&&(i=fC({},i,n(i))),e){var s=Xf(i.areArraysEqual),o=Xf(i.areMapsEqual),a=Xf(i.areObjectsEqual),c=Xf(i.areSetsEqual);i=fC({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:c})}return i}function Zz(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function e9(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,s=t.strict;if(r)return function(c,l){var u=r(),d=u.cache,f=d===void 0?e?new WeakMap:void 0:d,h=u.meta;return n(c,l,{cache:f,equals:i,meta:h,strict:s})};if(e)return function(c,l){return n(c,l,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var o={cache:void 0,equals:i,meta:void 0,strict:s};return function(c,l){return n(c,l,o)}}var hC=Vi();Vi({strict:!0}),Vi({circular:!0}),Vi({circular:!0,strict:!0}),Vi({createInternalComparator:function(){return Jo}}),Vi({strict:!0,createInternalComparator:function(){return Jo}}),Vi({circular:!0,createInternalComparator:function(){return Jo}}),Vi({circular:!0,createInternalComparator:function(){return Jo},strict:!0});function Vi(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=Qz(t),c=Jz(a),l=r?r(c):Zz(c);return e9({circular:n,comparator:c,createState:i,equals:l,strict:o})}var t9="\0",Us="\0",pC="";let n9=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=Object.hasOwn(e,"directed")?e.directed:!0,this._isMultigraph=Object.hasOwn(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.hasOwn(e,"compound")?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Us]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!="function"&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(n=>Object.keys(e._in[n]).length===0)}sinks(){var e=this;return this.nodes().filter(n=>Object.keys(e._out[n]).length===0)}setNodes(e,n){var r=arguments,i=this;return e.forEach(function(s){r.length>1?i.setNode(s,n):i.setNode(s)}),this}setNode(e,n){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=n),this):(this._nodes[e]=arguments.length>1?n:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=Us,this._children[e]={},this._children[Us][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var n=this;if(Object.hasOwn(this._nodes,e)){var r=i=>n.removeEdge(n._edgeObjs[i]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(i){n.setParent(i)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Us;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===e)throw new Error("Setting "+n+" as parent of "+e+" would create a cycle");this.setNode(n)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=n,this._children[n][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var n=this._parent[e];if(n!==Us)return n}}children(e=Us){if(this._isCompound){var n=this._children[e];if(n)return Object.keys(n)}else{if(e===Us)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var n=this._preds[e];if(n)return Object.keys(n)}successors(e){var n=this._sucs[e];if(n)return Object.keys(n)}neighbors(e){var n=this.predecessors(e);if(n){const i=new Set(n);for(var r of this.successors(e))i.add(r);return Array.from(i.values())}}isLeaf(e){var n;return this.isDirected()?n=this.successors(e):n=this.neighbors(e),n.length===0}filterNodes(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([o,a]){e(o)&&n.setNode(o,a)}),Object.values(this._edgeObjs).forEach(function(o){n.hasNode(o.v)&&n.hasNode(o.w)&&n.setEdge(o,r.edge(o))});var i={};function s(o){var a=r.parent(o);return a===void 0||n.hasNode(a)?(i[o]=a,a):a in i?i[a]:s(a)}return this._isCompound&&n.nodes().forEach(o=>n.setParent(o,s(o))),n}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!="function"&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,n){var r=this,i=arguments;return e.reduce(function(s,o){return i.length>1?r.setEdge(s,o,n):r.setEdge(s,o),o}),this}setEdge(){var e,n,r,i,s=!1,o=arguments[0];typeof o=="object"&&o!==null&&"v"in o?(e=o.v,n=o.w,r=o.name,arguments.length===2&&(i=arguments[1],s=!0)):(e=o,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),e=""+e,n=""+n,r!==void 0&&(r=""+r);var a=Qc(this._isDirected,e,n,r);if(Object.hasOwn(this._edgeLabels,a))return s&&(this._edgeLabels[a]=i),this;if(r!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[a]=s?i:this._defaultEdgeLabelFn(e,n,r);var c=r9(this._isDirected,e,n,r);return e=c.v,n=c.w,Object.freeze(c),this._edgeObjs[a]=c,gC(this._preds[n],e),gC(this._sucs[e],n),this._in[n][a]=c,this._out[e][a]=c,this._edgeCount++,this}edge(e,n,r){var i=arguments.length===1?uv(this._isDirected,arguments[0]):Qc(this._isDirected,e,n,r);return this._edgeLabels[i]}edgeAsObj(){const e=this.edge(...arguments);return typeof e!="object"?{label:e}:e}hasEdge(e,n,r){var i=arguments.length===1?uv(this._isDirected,arguments[0]):Qc(this._isDirected,e,n,r);return Object.hasOwn(this._edgeLabels,i)}removeEdge(e,n,r){var i=arguments.length===1?uv(this._isDirected,arguments[0]):Qc(this._isDirected,e,n,r),s=this._edgeObjs[i];return s&&(e=s.v,n=s.w,delete this._edgeLabels[i],delete this._edgeObjs[i],mC(this._preds[n],e),mC(this._sucs[e],n),delete this._in[n][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,n){var r=this._in[e];if(r){var i=Object.values(r);return n?i.filter(s=>s.v===n):i}}outEdges(e,n){var r=this._out[e];if(r){var i=Object.values(r);return n?i.filter(s=>s.w===n):i}}nodeEdges(e,n){var r=this.inEdges(e,n);if(r)return r.concat(this.outEdges(e,n))}};function gC(t,e){t[e]?t[e]++:t[e]=1}function mC(t,e){--t[e]||delete t[e]}function Qc(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}return i+pC+s+pC+(r===void 0?t9:r)}function r9(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}var a={v:i,w:s};return r&&(a.name=r),a}function uv(t,e){return Qc(t,e.v,e.w,e.name)}var dv=n9,i9="2.2.4",s9={Graph:dv,version:i9},o9=dv,a9={write:c9,read:d9};function c9(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:l9(t),edges:u9(t)};return t.graph()!==void 0&&(e.value=structuredClone(t.graph())),e}function l9(t){return t.nodes().map(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function u9(t){return t.edges().map(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return e.name!==void 0&&(r.name=e.name),n!==void 0&&(r.value=n),r})}function d9(t){var e=new o9(t.options).setGraph(t.value);return t.nodes.forEach(function(n){e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(function(n){e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}var f9=h9;function h9(t){var e={},n=[],r;function i(s){Object.hasOwn(e,s)||(e[s]=!0,r.push(s),t.successors(s).forEach(i),t.predecessors(s).forEach(i))}return t.nodes().forEach(function(s){r=[],i(s),r.length&&n.push(r)}),n}let p9=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var n=this._keyIndices[e];if(n!==void 0)return this._arr[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,n){var r=this._keyIndices;if(e=String(e),!Object.hasOwn(r,e)){var i=this._arr,s=i.length;return r[e]=s,i.push({key:e,priority:n}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,n){var r=this._keyIndices[e];if(n>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+n);this._arr[r].priority=n,this._decrease(r)}_heapify(e){var n=this._arr,r=2*e,i=r+1,s=e;r<n.length&&(s=n[r].priority<n[s].priority?r:s,i<n.length&&(s=n[i].priority<n[s].priority?i:s),s!==e&&(this._swap(e,s),this._heapify(s)))}_decrease(e){for(var n=this._arr,r=n[e].priority,i;e!==0&&(i=e>>1,!(n[i].priority<r));)this._swap(e,i),e=i}_swap(e,n){var r=this._arr,i=this._keyIndices,s=r[e],o=r[n];r[e]=o,r[n]=s,i[o.key]=e,i[s.key]=n}};var yC=p9,g9=yC,vC=y9,m9=()=>1;function y9(t,e,n,r){return v9(t,String(e),n||m9,r||function(i){return t.outEdges(i)})}function v9(t,e,n,r){var i={},s=new g9,o,a,c=function(l){var u=l.v!==o?l.v:l.w,d=i[u],f=n(l),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+l+" Weight: "+f);h<d.distance&&(d.distance=h,d.predecessor=o,s.decrease(u,h))};for(t.nodes().forEach(function(l){var u=l===e?0:Number.POSITIVE_INFINITY;i[l]={distance:u},s.add(l,u)});s.size()>0&&(o=s.removeMin(),a=i[o],a.distance!==Number.POSITIVE_INFINITY);)r(o).forEach(c);return i}var w9=vC,b9=T9;function T9(t,e,n){return t.nodes().reduce(function(r,i){return r[i]=w9(t,i,e,n),r},{})}var wC=E9;function E9(t){var e=0,n=[],r={},i=[];function s(o){var a=r[o]={onStack:!0,lowlink:e,index:e++};if(n.push(o),t.successors(o).forEach(function(u){Object.hasOwn(r,u)?r[u].onStack&&(a.lowlink=Math.min(a.lowlink,r[u].index)):(s(u),a.lowlink=Math.min(a.lowlink,r[u].lowlink))}),a.lowlink===a.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return t.nodes().forEach(function(o){Object.hasOwn(r,o)||s(o)}),i}var R9=wC,S9=$9;function $9(t){return R9(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}var k9=C9,_9=()=>1;function C9(t,e,n){return A9(t,e||_9,n||function(r){return t.outEdges(r)})}function A9(t,e,n){var r={},i=t.nodes();return i.forEach(function(s){r[s]={},r[s][s]={distance:0},i.forEach(function(o){s!==o&&(r[s][o]={distance:Number.POSITIVE_INFINITY})}),n(s).forEach(function(o){var a=o.v===s?o.w:o.v,c=e(o);r[s][a]={distance:c,predecessor:s}})}),i.forEach(function(s){var o=r[s];i.forEach(function(a){var c=r[a];i.forEach(function(l){var u=c[s],d=o[l],f=c[l],h=u.distance+d.distance;h<f.distance&&(f.distance=h,f.predecessor=d.predecessor)})})}),r}function bC(t){var e={},n={},r=[];function i(s){if(Object.hasOwn(n,s))throw new fv;Object.hasOwn(e,s)||(n[s]=!0,e[s]=!0,t.predecessors(s).forEach(i),delete n[s],r.push(s))}if(t.sinks().forEach(i),Object.keys(e).length!==t.nodeCount())throw new fv;return r}class fv extends Error{constructor(){super(...arguments)}}var TC=bC;bC.CycleException=fv;var EC=TC,I9=P9;function P9(t){try{EC(t)}catch(e){if(e instanceof EC.CycleException)return!1;throw e}return!0}var RC=x9;function x9(t,e,n){Array.isArray(e)||(e=[e]);var r=t.isDirected()?a=>t.successors(a):a=>t.neighbors(a),i=n==="post"?N9:O9,s=[],o={};return e.forEach(a=>{if(!t.hasNode(a))throw new Error("Graph does not have node: "+a);i(a,r,o,s)}),s}function N9(t,e,n,r){for(var i=[[t,!1]];i.length>0;){var s=i.pop();s[1]?r.push(s[0]):Object.hasOwn(n,s[0])||(n[s[0]]=!0,i.push([s[0],!0]),SC(e(s[0]),o=>i.push([o,!1])))}}function O9(t,e,n,r){for(var i=[t];i.length>0;){var s=i.pop();Object.hasOwn(n,s)||(n[s]=!0,r.push(s),SC(e(s),o=>i.push(o)))}}function SC(t,e){for(var n=t.length;n--;)e(t[n],n,t);return t}var D9=RC,L9=M9;function M9(t,e){return D9(t,e,"post")}var F9=RC,j9=U9;function U9(t,e){return F9(t,e,"pre")}var B9=dv,q9=yC,W9=G9;function G9(t,e){var n=new B9,r={},i=new q9,s;function o(c){var l=c.v===s?c.w:c.v,u=i.priority(l);if(u!==void 0){var d=e(c);d<u&&(r[l]=s,i.decrease(l,d))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(c){i.add(c,Number.POSITIVE_INFINITY),n.setNode(c)}),i.decrease(t.nodes()[0],0);for(var a=!1;i.size()>0;){if(s=i.removeMin(),Object.hasOwn(r,s))n.setEdge(s,r[s]);else{if(a)throw new Error("Input graph is not connected: "+t);a=!0}t.nodeEdges(s).forEach(o)}return n}var z9={components:f9,dijkstra:vC,dijkstraAll:b9,findCycles:S9,floydWarshall:k9,isAcyclic:I9,postorder:L9,preorder:j9,prim:W9,tarjan:wC,topsort:TC},$C=s9,hv={Graph:$C.Graph,json:a9,alg:z9,version:$C.version};const pv=Ro(hv);var gv={exports:{}};(function(t,e){var n=Bb;e=t.exports=r;function r(d,f){return f=o(d,f),c(d,f)}e.sha1=function(d){return r(d)},e.keys=function(d){return r(d,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},e.MD5=function(d){return r(d,{algorithm:"md5",encoding:"hex"})},e.keysMD5=function(d){return r(d,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var i=n.getHashes?n.getHashes().slice():["sha1","md5"];i.push("passthrough");var s=["buffer","hex","binary","base64"];function o(d,f){f=f||{};var h={};if(h.algorithm=f.algorithm||"sha1",h.encoding=f.encoding||"hex",h.excludeValues=!!f.excludeValues,h.algorithm=h.algorithm.toLowerCase(),h.encoding=h.encoding.toLowerCase(),h.ignoreUnknown=f.ignoreUnknown===!0,h.respectType=f.respectType!==!1,h.respectFunctionNames=f.respectFunctionNames!==!1,h.respectFunctionProperties=f.respectFunctionProperties!==!1,h.unorderedArrays=f.unorderedArrays===!0,h.unorderedSets=f.unorderedSets!==!1,h.unorderedObjects=f.unorderedObjects!==!1,h.replacer=f.replacer||void 0,h.excludeKeys=f.excludeKeys||void 0,typeof d>"u")throw new Error("Object argument required.");for(var p=0;p<i.length;++p)i[p].toLowerCase()===h.algorithm.toLowerCase()&&(h.algorithm=i[p]);if(i.indexOf(h.algorithm)===-1)throw new Error('Algorithm "'+h.algorithm+'" not supported. supported values: '+i.join(", "));if(s.indexOf(h.encoding)===-1&&h.algorithm!=="passthrough")throw new Error('Encoding "'+h.encoding+'" not supported. supported values: '+s.join(", "));return h}function a(d){if(typeof d!="function")return!1;var f=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return f.exec(Function.prototype.toString.call(d))!=null}function c(d,f){var h;f.algorithm!=="passthrough"?h=n.createHash(f.algorithm):h=new u,typeof h.write>"u"&&(h.write=h.update,h.end=h.update);var p=l(f,h);if(p.dispatch(d),h.update||h.end(""),h.digest)return h.digest(f.encoding==="buffer"?void 0:f.encoding);var y=h.read();return f.encoding==="buffer"?y:y.toString(f.encoding)}e.writeToStream=function(d,f,h){return typeof h>"u"&&(h=f,f={}),f=o(d,f),l(f,h).dispatch(d)};function l(d,f,h){h=h||[];var p=function(y){return f.update?f.update(y,"utf8"):f.write(y,"utf8")};return{dispatch:function(y){d.replacer&&(y=d.replacer(y));var R=typeof y;return y===null&&(R="null"),this["_"+R](y)},_object:function(y){var R=/\[object (.*)\]/i,b=Object.prototype.toString.call(y),v=R.exec(b);v?v=v[1]:v="unknown:["+b+"]",v=v.toLowerCase();var T=null;if((T=h.indexOf(y))>=0)return this.dispatch("[CIRCULAR:"+T+"]");if(h.push(y),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(y))return p("buffer:"),p(y);if(v!=="object"&&v!=="function"&&v!=="asyncfunction")if(this["_"+v])this["_"+v](y);else{if(d.ignoreUnknown)return p("["+v+"]");throw new Error('Unknown object type "'+v+'"')}else{var _=Object.keys(y);d.unorderedObjects&&(_=_.sort()),d.respectType!==!1&&!a(y)&&_.splice(0,0,"prototype","__proto__","constructor"),d.excludeKeys&&(_=_.filter(function(F){return!d.excludeKeys(F)})),p("object:"+_.length+":");var N=this;return _.forEach(function(F){N.dispatch(F),p(":"),d.excludeValues||N.dispatch(y[F]),p(",")})}},_array:function(y,R){R=typeof R<"u"?R:d.unorderedArrays!==!1;var b=this;if(p("array:"+y.length+":"),!R||y.length<=1)return y.forEach(function(_){return b.dispatch(_)});var v=[],T=y.map(function(_){var N=new u,F=h.slice(),P=l(d,N,F);return P.dispatch(_),v=v.concat(F.slice(h.length)),N.read().toString()});return h=h.concat(v),T.sort(),this._array(T,!1)},_date:function(y){return p("date:"+y.toJSON())},_symbol:function(y){return p("symbol:"+y.toString())},_error:function(y){return p("error:"+y.toString())},_boolean:function(y){return p("bool:"+y.toString())},_string:function(y){p("string:"+y.length+":"),p(y.toString())},_function:function(y){p("fn:"),a(y)?this.dispatch("[native]"):this.dispatch(y.toString()),d.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(y.name)),d.respectFunctionProperties&&this._object(y)},_number:function(y){return p("number:"+y.toString())},_xml:function(y){return p("xml:"+y.toString())},_null:function(){return p("Null")},_undefined:function(){return p("Undefined")},_regexp:function(y){return p("regex:"+y.toString())},_uint8array:function(y){return p("uint8array:"),this.dispatch(Array.prototype.slice.call(y))},_uint8clampedarray:function(y){return p("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(y))},_int8array:function(y){return p("int8array:"),this.dispatch(Array.prototype.slice.call(y))},_uint16array:function(y){return p("uint16array:"),this.dispatch(Array.prototype.slice.call(y))},_int16array:function(y){return p("int16array:"),this.dispatch(Array.prototype.slice.call(y))},_uint32array:function(y){return p("uint32array:"),this.dispatch(Array.prototype.slice.call(y))},_int32array:function(y){return p("int32array:"),this.dispatch(Array.prototype.slice.call(y))},_float32array:function(y){return p("float32array:"),this.dispatch(Array.prototype.slice.call(y))},_float64array:function(y){return p("float64array:"),this.dispatch(Array.prototype.slice.call(y))},_arraybuffer:function(y){return p("arraybuffer:"),this.dispatch(new Uint8Array(y))},_url:function(y){return p("url:"+y.toString())},_map:function(y){p("map:");var R=Array.from(y);return this._array(R,d.unorderedSets!==!1)},_set:function(y){p("set:");var R=Array.from(y);return this._array(R,d.unorderedSets!==!1)},_file:function(y){return p("file:"),this.dispatch([y.name,y.size,y.type,y.lastModfied])},_blob:function(){if(d.ignoreUnknown)return p("[blob]");throw Error(`Hashing Blob objects is currently not supported
1126
+ (see https://github.com/puleos/object-hash/issues/26)
1127
+ Use "options.replacer" or "options.ignoreUnknown"
1128
+ `)},_domwindow:function(){return p("domwindow")},_bigint:function(y){return p("bigint:"+y.toString())},_process:function(){return p("process")},_timer:function(){return p("timer")},_pipe:function(){return p("pipe")},_tcp:function(){return p("tcp")},_udp:function(){return p("udp")},_tty:function(){return p("tty")},_statwatcher:function(){return p("statwatcher")},_securecontext:function(){return p("securecontext")},_connection:function(){return p("connection")},_zlib:function(){return p("zlib")},_context:function(){return p("context")},_nodescript:function(){return p("nodescript")},_httpparser:function(){return p("httpparser")},_dataview:function(){return p("dataview")},_signal:function(){return p("signal")},_fsevent:function(){return p("fsevent")},_tlswrap:function(){return p("tlswrap")}}}function u(){return{buf:"",write:function(d){this.buf+=d},end:function(d){this.buf+=d},read:function(){return this.buf}}}})(gv,gv.exports);var H9=gv.exports;const V9=Ro(H9);function kC(t){const e={id:t.id,__:t.__??"element",autoLayout:t.autoLayout,nodes:Ye(t.nodes,st(j_(["id","title","description","technology","shape","icon","children"])),ci(({id:n,icon:r,...i})=>[n,{...i,icon:Q(r)?"Y":"N"}])),edges:Ye(t.edges,st(j_(["source","target","label","description","technology","dir","head","tail","line"])),ci(({source:n,target:r,...i})=>[`${n}:${r}`,i]))};return t.hash=V9(e,{ignoreUnknown:!0,respectType:!1}),t}function hn(t){if(re.isElementWhere(t)){const e=hn(t.where.expr),n=oo(t.where.condition);return r=>e(r)&&n(r)}if(re.isWildcard(t))return()=>!0;if(re.isElementKindExpr(t))return t.isEqual?e=>e.kind===t.elementKind:e=>e.kind!==t.elementKind;if(re.isElementTagExpr(t))return t.isEqual?({tags:e})=>!!e&&e.includes(t.elementTag):({tags:e})=>Rt(e)||!e.includes(t.elementTag);if(re.isExpandedElementExpr(t))return e=>e.id===t.expanded||bt(e.id)===t.expanded;if(re.isElementRef(t)){const{element:e,isDescedants:n}=t;return n?r=>r.id.startsWith(e+"."):r=>r.id===e}if(re.isCustomElement(t))return hn(t.custom.expr);Se(t)}function _C(t,e){const n=t.flatMap(i=>"include"in i?i.include.filter(re.isCustomElement):[]);if(n.length===0)return e;const r=[...e];for(const{custom:{expr:i,...s}}of n){const{border:o,opacity:a,...c}=F_(s,Rt),l=!zi(c),u=hn(i);r.forEach((d,f)=>{if(!u(d))return;l&&(d={...d,isCustomized:!0,...c});let h;o!==void 0&&(h={border:o}),a!==void 0&&(h={...h,opacity:a}),h&&(d={...d,isCustomized:!0,style:{...d.style,...h}}),r[f]=d})}return r}function CC(t){switch(!0){case re.isRelationWhere(t):return CC(t.where.expr);case re.isRelation(t):{const e=hn(t.source),n=hn(t.target);return r=>e(r.source)&&n(r.target)||!!t.isBidirectional&&e(r.target)&&n(r.source)}case re.isInOut(t):{const e=hn(t.inout);return n=>e(n.source)||e(n.target)}case re.isIncoming(t):{const e=hn(t.incoming);return n=>e(n.target)}case re.isOutgoing(t):{const e=hn(t.outgoing);return n=>e(n.source)}default:Se(t)}}function K9(t,e,n){const r=t.flatMap(s=>"include"in s?s.include.filter(re.isCustomRelationExpr):[]),i=Array.from(n);if(r.length===0||i.length===0)return i;for(const{customRelation:{relation:s,title:o,...a}}of r){const c=F_(a,Rt),l=CC(s);i.forEach((u,d)=>{const f=e.find(p=>p.id===u.source),h=e.find(p=>p.id===u.target);!f||!h||l({source:f,target:h})&&(i[d]={...u,label:o??u.label,isCustomized:!0,...c})})}return i}function AC(t,e){const n=t.filter(uO);if(n.length===0)return e;for(const r of n){const i=[];for(const s of r.targets){if(re.isWildcard(s)){i.push(()=>!0);break}i.push(hn(s))}Xe(e,bG(i)).forEach(s=>{s.shape=r.style.shape??s.shape,s.color=r.style.color??s.color,Ct(r.style.icon)&&(s.icon=r.style.icon),Ct(r.notation)&&(s.notation=r.notation);let o;Ct(r.style.border)&&(o={border:r.style.border}),Ct(r.style.opacity)&&(o={...o,opacity:r.style.opacity}),o&&(s.style={...s.style,...o})})}return e}function Y9(t,e){let n;for(;t.parent&&(n=e.get(t.parent));){const r=n.depth??1;if(n.depth=Math.max(r,(t.depth??0)+1),n.depth===r)break;t=n}}function IC(t){return Array.from(t).sort(gg).reduce((e,{id:n,color:r,shape:i,style:s,...o})=>{let a=bt(n),c=0;for(;a;){const u=e.get(a);if(u){u.children.length==0&&(u.depth=1,Y9(u,e)),u.children.push(n),c=u.level+1;break}a=bt(a)}const l={...o,id:n,parent:a,level:c,color:r??_u,shape:i??qb,children:[],inEdges:[],outEdges:[],style:{...s}};return e.set(n,l),e},new Map)}function PC(t){return Ye(t,Hf(ai("notation")),Wi(iv(Hf(ai("shape")),Wi(iv(Hf(ai("color")),Wi(iv(st(ai("kind")),kr())),Yo(),st(([e,n])=>({kinds:n,color:e})))),Yo(),Hi(([e,n])=>n.map(({color:r,kinds:i})=>({shape:e,color:r,kinds:i}))))),Yo(),Hi(([e,n])=>n.map(({shape:r,color:i,kinds:s})=>({title:e,shape:r,color:i,kinds:s}))),MW(ai("shape"),ai("title"),[e=>e.kinds.length,"desc"]))}const xC=pv.alg.postorder,X9=pv.alg.findCycles,J9=pv.alg.isAcyclic;function Q9(t){t.forEach(e=>{e.children.length>0&&(e.children=t.flatMap(n=>n.parent===e.id?n.id:[]))})}function Z9({nodes:t,edges:e}){if(e.length===0)return t;const n=new hv.Graph({compound:!1,directed:!0,multigraph:!1}),r=a=>at(t.find(c=>c.id===a),"Edge not found"),i=a=>at(e.find(c=>c.id===a),"Edge not found");for(const a of[...e].sort(Pa))n.setEdge(a.source,a.target);for(const a of t)n.setNode(a.id),a.children.length>0&&a.inEdges.forEach(c=>{const l=i(c);l.target!==a.id&&r(l.source).children.length===0&&n.setEdge(l.source,a.id)}),a.parent&&n.setEdge(a.parent,a.id);let s=n.sources();s.length===0&&(s=Ye(t,zf(gg),Xe(a=>a.inEdges.length===0||a.parent===null),st(a=>a.id)));const o=xC(n,s).reverse().map(r);if(o.length<t.length){const a=yG(t,o);o.push(...a)}return ce(o.length===t.length,"Not all nodes were processed by graphlib"),Q9(o),o}const nr=()=>!0,mv=t=>t,yv=t=>t===nr?mv:Xe(t),eH=t=>t===nr?mv:e=>t(e)?e:null;function tH(t,e=nr){const n=[...this.resolvedElements],r=yv(e)(t.isDescedants===!0?this.graph.childrenOrElement(t.element):[this.graph.element(t.element)]);if(r.length!==0&&(this.addElement(...r),r.length>1&&this.addEdges(this.graph.edgesWithin(r)),n.length>0&&r.length>0))for(const i of r)this.addEdges(this.graph.anyEdgesBetween(i,n))}function nH(t,e=nr){const n=[...this.resolvedElements].filter(H_([hn(t),e]));this.excludeElement(...n)}function rH(t,e=nr){const n=this.root;if(!n){const l=this.graph.rootElements.filter(e);if(l.length<=0)return;const u=[...this.resolvedElements];if(this.addElement(...l),this.addEdges(this.graph.edgesWithin(l)),u.length>0)for(const d of l)this.addEdges(this.graph.anyEdgesBetween(d,u));return}const r=[...this.resolvedElements],i=eH(e)(this.graph.element(n));i&&this.addElement(i);const s=yv(e),o=s(this.graph.children(n)),a=o.length>0;a?(this.addElement(...o),this.addEdges(this.graph.edgesWithin(o))):i&&o.push(i);const c=[...r,...s([...this.graph.siblings(n),...this.graph.ancestors(n).flatMap(l=>this.graph.siblings(l.id))])];for(const l of o)this.addEdges(this.graph.anyEdgesBetween(l,c));if(!a&&i&&this.graph.anyEdgesBetween(i,this.graph.siblings(n)).length===0){const l=bt(n),u=l&&this.graph.element(l);u&&e(u)&&this.addElement(u)}}function iH(t,e=nr){if(e!==nr){const r=[...this.resolvedElements].filter(e);this.excludeElement(...r);return}const n=this.root;n?(this.excludeElement(this.graph.element(n),...this.graph.children(n)),this.excludeRelation(...this.graph.connectedRelations(n))):this.reset()}function sH(t,e=nr){const n=yv(e),r=[...this.resolvedElements],i=this.graph.element(t.expanded);if(e(i)){this.addElement(i);const o=this.graph.anyEdgesBetween(i,r);this.addEdges(o)}const s=[];for(const o of n(this.graph.children(t.expanded))){this.addImplicit(o);const a=this.graph.anyEdgesBetween(o,r);a.length>0&&(this.addEdges(a),s.push(o))}s.length>1&&this.addEdges(this.graph.edgesWithin(s))}function oH(t,e=nr){const n=[...this.resolvedElements].filter(H_([hn(t),e]));this.excludeElement(...n)}const NC=t=>t.isEqual?re.isElementKindExpr(t)?e=>e.kind===t.elementKind:({tags:e})=>!!e&&e.includes(t.elementTag):re.isElementKindExpr(t)?e=>e.kind!==t.elementKind:({tags:e})=>Rt(e)||e.length===0||!e.includes(t.elementTag);function aH(t,e=nr){const n=this.graph.elements.filter(NC(t)).filter(e);if(n.length>0){const r=[...this.resolvedElements];this.addElement(...n),this.addEdges(this.graph.edgesWithin(n));for(const i of n)this.addEdges(this.graph.anyEdgesBetween(i,r))}}function cH(t,e=nr){const n=[...this.resolvedElements].filter(NC(t)).filter(e);n.length>0&&this.excludeElement(...n)}function Zc(t){return re.isElementRef(t)?this.graph.ascendingSiblings(t.element):this.root?this.graph.ascendingSiblings(this.root):this.graph.rootElements}function Jf(t){return re.isWildcard(t)?this.root?[...this.graph.children(this.root),this.graph.element(this.root)]:this.graph.rootElements:re.isElementKindExpr(t)?this.graph.elements.filter(e=>t.isEqual?e.kind===t.elementKind:e.kind!==t.elementKind):re.isElementTagExpr(t)?this.graph.elements.filter(e=>{const n=e.tags;return t.isEqual?!!n&&n.includes(t.elementTag):Rt(n)||n.length===0||!n.includes(t.elementTag)}):re.isExpandedElementExpr(t)?[this.graph.element(t.expanded)]:re.isElementRef(t)?this.root===t.element&&t.isDescedants!==!0?[...this.graph.children(this.root),this.graph.element(this.root)]:t.isDescedants?this.graph.childrenOrElement(t.element):[this.graph.element(t.element)]:Se(t)}function OC(t){if(re.isWildcard(t)){if(!this.root)return[];const r=this.graph.ascendingSiblings(this.root),i=[...this.graph.children(this.root),this.graph.element(this.root)];return this.graph.edgesBetween(r,i)}const e=Jf.call(this,t);if(e.length===0)return[];let n=[...this.resolvedElements];if(re.isElementRef(t)||re.isExpandedElementExpr(t)){const r=t.element??t.expanded,i=t.isDescedants??!1;n=n.filter(s=>!fr(r,s.id)||i&&bt(s.id)===r)}return n.length===0&&(n=Zc.call(this,t)),this.graph.edgesBetween(n,e)}const el=(t,e)=>e?Ye(t,st(n=>({...n,relations:n.relations.filter(e)})),Xe(n=>n.relations.length>0)):t,vv=(t,e)=>Ye(t,Hi(n=>n.relations),e?Xe(e):mv,kr());function lH(t,e){const n=el(OC.call(this,t.incoming),e);n.length!==0&&(this.addEdges(n),this.addImplicit(...n.map(r=>r.target)))}function uH(t,e){let n=vv(OC.call(this,t.incoming),e);this.excludeRelation(...n)}function DC(t){if(re.isWildcard(t)){if(!this.root)return[];const r=this.graph.ascendingSiblings(this.root),i=[...this.graph.children(this.root),this.graph.element(this.root)];return this.graph.edgesBetween(i,r)}const e=Jf.call(this,t);if(e.length===0)return[];let n=[...this.resolvedElements];if(re.isElementRef(t)||re.isExpandedElementExpr(t)){const r=t.element??t.expanded,i=t.isDescedants??!1;n=n.filter(s=>!fr(r,s.id)||i&&bt(s.id)===r)}return n.length===0&&(n=Zc.call(this,t)),this.graph.edgesBetween(e,n)}function dH(t,e){const n=el(DC.call(this,t.outgoing),e);n.length!==0&&(this.addEdges(n),this.addImplicit(...n.map(r=>r.source)))}function fH(t,e){const n=vv(DC.call(this,t.outgoing),e);this.excludeRelation(...n)}var Qf;(t=>{t.Empty={implicits:[],edges:[]}})(Qf||(Qf={}));function LC({inout:t},e){if(re.isWildcard(t)){if(!this.root)return Qf.Empty;const i=this.graph.ascendingSiblings(this.root);return{edges:el(this.graph.anyEdgesBetween(this.graph.element(this.root),i),e),implicits:[]}}const n=Jf.call(this,t);if(n.length===0)return Qf.Empty;let r=[...this.resolvedElements];if(re.isElementRef(t)||re.isExpandedElementExpr(t)){const i=t.element??t.expanded,s=t.isDescedants??!1;r=r.filter(o=>!fr(i,o.id)||s&&bt(o.id)===i)}return r.length===0&&(r=Zc.call(this,t)),n.reduce((i,s)=>{const o=el(this.graph.anyEdgesBetween(s,r),e);return o.length>0&&(i.implicits.push(s),i.edges.push(...o)),i},{implicits:[],edges:[]})}function hH(t,e){const{implicits:n,edges:r}=LC.call(this,t,e);this.addEdges(r),this.addImplicit(...n)}function pH(t,e){const{edges:n}=LC.call(this,t,e);this.excludeRelation(...n.flatMap(r=>r.relations))}function Zf(t){return re.isElementRef(t)&&this.root===t.element&&t.isDescedants!==!0?[...this.graph.children(t.element),this.graph.element(t.element)]:re.isExpandedElementExpr(t)&&this.root===t.expanded?[...this.graph.children(t.expanded),this.graph.element(t.expanded)]:Jf.call(this,t)}function gH(t,e){let n,r;re.isWildcard(t.source)&&!re.isWildcard(t.target)?(n=Zc.call(this,t.target),r=Zf.call(this,t.target)):!re.isWildcard(t.source)&&re.isWildcard(t.target)?(n=Zf.call(this,t.source),r=Zc.call(this,t.source)):(n=Zf.call(this,t.source),r=Zf.call(this,t.target));const i=this.graph.edgesBetween(n,r);t.isBidirectional===!0&&i.push(...this.graph.edgesBetween(r,n)),this.addEdges(el(i,e))}function mH(t,e){const n=hn(t.source),r=hn(t.target),i=a=>{let c=n(a.source)&&r(a.target);return!c&&t.isBidirectional&&(c=n(a.target)&&r(a.source)),c},s=this.edges.filter(i),o=vv(s,e);this.excludeRelation(...o)}function yH(t,e){return Pa({source:t.source.id,target:t.target.id},{source:e.source.id,target:e.target.id})}let vH=class gN{constructor(e,n){this.view=e,this.graph=n}explicits=new Set;implicits=new Set;ctxEdges=[];static elementView(e,n){return new gN(e,n).compute()}compute(){this.reset();const{docUri:e,rules:n,...r}=this.view,i=n.filter(lO);this.root&&i.length==0&&this.addElement(this.graph.element(this.root)),this.processPredicates(i),this.removeRedundantImplicitEdges();const s=[...this.includedElements],o=IC(s),a=new Map,c=this.computeEdges();for(const p of c){a.set(p.id,p);const y=o.get(p.source),R=o.get(p.target);for(ce(y,`Source node ${p.source} not found`),ce(R,`Target node ${p.target} not found`);p.parent&&!o.has(p.parent);)p.parent=bt(p.parent);y.outEdges.push(p.id),R.inEdges.push(p.id);for(const b of Hn(p.source)){if(b===p.parent)break;o.get(b)?.outEdges.push(p.id)}for(const b of Hn(p.target)){if(b===p.parent)break;o.get(b)?.inEdges.push(p.id)}}const l=s.flatMap(p=>o.get(p.id)??[]),u=_C(n,AC(n,Z9({nodes:l,edges:c}))),d=new Set([...u.flatMap(p=>p.children.length===0?p.outEdges.flatMap(y=>a.get(y)??[]):[]),...c]),f=this.view.rules.findLast(r0),h=PC(u);return kC({...r,autoLayout:f?.autoLayout??"TB",nodes:st(u,U_(["notation"])),edges:K9(n,u,d),...h.length>0&&{notation:{elements:h}}})}get root(){return s0(this.view)?this.view.viewOf:null}computeEdges(){return this.ctxEdges.map(e=>{ce(tr(e.relations,1),"Edge must have at least one relation");const n=zf(e.relations,Pa),r=e.source.id,i=e.target.id,s={id:`${r}:${i}`,parent:Rs(r,i),source:r,target:i,label:null,relations:n.map(c=>c.id)};let o;if(o=n.length===1?n[0]:n.find(c=>c.source===r&&c.target===i),!o){const c=Ye(n,L_((l,u)=>(Q(u.title)&&!l.title.includes(u.title)&&l.title.push(u.title),Q(u.description)&&!l.description.includes(u.description)&&l.description.push(u.description),Q(u.technology)&&!l.technology.includes(u.technology)&&l.technology.push(u.technology),Q(u.kind)&&!l.kind.includes(u.kind)&&l.kind.push(u.kind),Q(u.color)&&!l.color.includes(u.color)&&l.color.push(u.color),Q(u.line)&&!l.line.includes(u.line)&&l.line.push(u.line),Q(u.head)&&!l.head.includes(u.head)&&l.head.push(u.head),Q(u.tail)&&!l.tail.includes(u.tail)&&l.tail.push(u.tail),Q(u.navigateTo)&&!l.navigateTo.includes(u.navigateTo)&&l.navigateTo.push(u.navigateTo),l),{title:[],description:[],technology:[],kind:[],head:[],tail:[],color:[],line:[],navigateTo:[]}));o={title:jn(c.title)??"[...]",description:jn(c.description),technology:jn(c.technology),kind:jn(c.kind),head:jn(c.head),tail:jn(c.tail),color:jn(c.color),line:jn(c.line),navigateTo:jn(c.navigateTo)}}const a=kr(Hi(n,c=>c.tags??[]));return Object.assign(s,this.getEdgeLabel(o),Q(o.description)&&{description:o.description},Q(o.technology)&&{technology:o.technology},Q(o.kind)&&{kind:o.kind},o.color&&{color:o.color},o.line&&{line:o.line},o.head&&{head:o.head},o.tail&&{tail:o.tail},o.navigateTo&&{navigateTo:o.navigateTo},tr(a,1)&&{tags:a})})}get includedElements(){return new Set([...this.explicits,...this.ctxEdges.flatMap(e=>[e.source,e.target])])}get resolvedElements(){return new Set([...this.explicits,...this.implicits,...this.ctxEdges.flatMap(e=>[e.source,e.target])])}get edges(){return this.ctxEdges}addEdges(e){for(const n of e){if(!tr(n.relations,1))continue;const r=this.ctxEdges.find(i=>i.source.id===n.source.id&&i.target.id===n.target.id);if(r){r.relations=kr([...r.relations,...n.relations]);continue}this.ctxEdges.push(n)}}addElement(...e){for(const n of e)this.explicits.add(n),this.implicits.add(n)}addImplicit(...e){for(const n of e)this.implicits.add(n)}excludeElement(...e){for(const n of e)this.ctxEdges=this.ctxEdges.filter(r=>r.source.id!==n.id&&r.target.id!==n.id),this.explicits.delete(n),this.implicits.delete(n)}excludeRelation(...e){if(e.length===0)return;const n=new Set,r=Ye(this.ctxEdges,st(s=>{const o=s.relations.filter(a=>!e.includes(a));return o.length===0?(n.add(s.source),n.add(s.target),null):o.length!==s.relations.length?{...s,relations:o}:s}),Xe(JW));if(n.size===0)return;this.ctxEdges=r;const i=this.includedElements;if(i.size===0){this.implicits.clear();return}for(const s of n)i.has(s)||this.implicits.delete(s)}reset(){this.explicits.clear(),this.implicits.clear(),this.ctxEdges=[]}removeRedundantImplicitEdges(){const e=new Set,n=s=>s.reduce((o,a)=>(e.has(a)||(o.push(a),e.add(a)),o),[]),r=s=>{const{source:o,target:a}=s;return c=>{const l=o.id===c.source.id,u=a.id===c.target.id;if(l&&u)return!0;const d=fr(o.id,c.source.id),f=fr(a.id,c.target.id);return d&&f||l&&f||u&&d}},i=[...this.ctxEdges].sort(yH).reverse();this.ctxEdges=i.reduce((s,o)=>{const a=n(o.relations);return a.length===0||s.length>0&&s.some(r(o))||s.push({source:o.source,target:o.target,relations:a}),s},[])}processPredicates(e){for(const n of e){const r="include"in n,i=n.include??n.exclude;for(const s of i){if(re.isElementPredicateExpr(s)){this.processElementPredicate(s,r);continue}if(re.isRelationPredicateExpr(s)){this.processRelationPredicate(s,r);continue}Se(s)}}return this}processElementPredicate(e,n,r){if(re.isCustomElement(e))return n&&this.processElementPredicate(e.custom.expr,n),this;if(re.isElementWhere(e)){const i=oo(e.where.condition);return this.processElementPredicate(e.where.expr,n,i),this}if(re.isExpandedElementExpr(e))return n?sH.call(this,e,r):oH.call(this,e,r),this;if(re.isElementKindExpr(e)||re.isElementTagExpr(e))return n?aH.call(this,e,r):cH.call(this,e,r),this;if(re.isElementRef(e))return n?tH.call(this,e,r):nH.call(this,e,r),this;if(re.isWildcard(e))return n?rH.call(this,e,r):iH.call(this,e,r),this;Se(e)}processRelationPredicate(e,n,r){if(re.isCustomRelationExpr(e))return n&&this.processRelationPredicate(e.customRelation.relation,n),this;if(re.isRelationWhere(e)){const i=oo(e.where.condition);return this.processRelationPredicate(e.where.expr,n,i),this}if(re.isIncoming(e))return n?lH.call(this,e,r):uH.call(this,e,r),this;if(re.isOutgoing(e))return n?dH.call(this,e,r):fH.call(this,e,r),this;if(re.isInOut(e))return n?hH.call(this,e,r):pH.call(this,e,r),this;if(re.isRelation(e))return n?gH.call(this,e,r):mH.call(this,e,r),this;Se(e)}getEdgeLabel(e){const n=[];return Q(e.title)&&n.push(e.title),Q(e.technology)&&n.push(`[${e.technology}]`),n.length>0?{label:n.join(`
1129
+ `)}:{}}};function wH(t,e){return vH.elementView(t,e)}function MC(t,e){try{return{isSuccess:!0,view:wH(t,e)}}catch(n){return{isSuccess:!1,error:n instanceof Error?n:new Error(`Unknown error: ${n}`),view:void 0}}}let bH=class mN{constructor(e,n){this.view=e,this.graph=n}explicits=new Set;steps=[];static compute(e,n){return new mN(e,n).compute()}addStep({source:e,target:n,title:r,isBackward:i,navigateTo:s,...o},a,c){const l=c?o0(c,a):o0(a),u=this.graph.element(e),d=this.graph.element(n);this.explicits.add(u),this.explicits.add(d);const{title:f,relations:h,tags:p,navigateTo:y}=this.findRelations(u,d),R=Q(s)&&s!==this.view.id?s:y;this.steps.push({id:l,...o,source:u,target:d,title:r??f,relations:h??[],isBackward:i??!1,...R?{navigateTo:R}:{},...p?{tags:p}:{}})}compute(){const{docUri:e,rules:n,steps:r,...i}=this.view;let s=1;for(const f of r){if(fO(f)){if(f.__parallel.length===0)continue;f.__parallel.length===1?this.addStep(f.__parallel[0],s):f.__parallel.forEach((h,p)=>this.addStep(h,p+1,s))}else this.addStep(f,s);s++}for(const f of n)if(dO(f))for(const h of f.include){const p=hn(h);this.graph.elements.filter(p).forEach(y=>this.explicits.add(y))}const o=[...this.explicits],a=IC(o),c=this.steps.map(({source:f,target:h,relations:p,title:y,isBackward:R,...b})=>{const v=at(a.get(f.id),`Source node ${f.id} not found`),T=at(a.get(h.id),`Target node ${h.id} not found`),_={parent:Rs(f.id,h.id),source:f.id,target:h.id,label:y,relations:p,color:co,line:t0,head:ao,...b};for(R&&(_.dir="back");_.parent&&!a.has(_.parent);)_.parent=bt(_.parent);v.outEdges.push(_.id),T.inEdges.push(_.id);for(const N of Hn(_.source)){if(N===_.parent)break;a.get(N)?.outEdges.push(_.id)}for(const N of Hn(_.target)){if(N===_.parent)break;a.get(N)?.inEdges.push(_.id)}return _}),l=_C(n,AC(n,o.map(f=>at(a.get(f.id))))),u=n.findLast(r0),d=PC(l);return kC({...i,autoLayout:u?.autoLayout??"LR",nodes:st(l,U_(["notation"])),edges:c,...d.length>0&&{notation:{elements:d}}})}findRelations(e,n){const r=kr(this.graph.edgesBetween(e,n).flatMap(u=>u.relations));if(r.length===0)return{title:null,tags:null,relations:null,navigateTo:null};const i=Ye(r,Hi(u=>u.tags),Xe(Q),kr()),s=tr(i,1)?i:null,o=tr(r,1)?st(r,u=>u.id):null,a=jn(r)||r.find(u=>u.source===e.id&&u.target===n.id),c=Q(a?.title)?a.title:Ye(r,st(u=>u.title),Xe(Q),kr(),jn()),l=a?.navigateTo&&a.navigateTo!==this.view.id?a.navigateTo:Ye(r,st(u=>u.navigateTo),Xe(Q),Xe(u=>u!==this.view.id),kr(),jn());return{title:c??null,tags:s,relations:o,navigateTo:l??null}}};function FC(t,e){try{return{isSuccess:!0,view:bH.compute(t,e)}}catch(n){return{isSuccess:!1,error:n instanceof Error?n:new Error(`Unknown error: ${n}`),view:void 0}}}const wv=Set,bv=Map;function Tv(t,e){return t.size===0||e.size===0?new Set:new Set([...t].filter(n=>e.has(n)))}let jC=class{#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=new Map;#s=new bv;#o=new bv;#a=new bv;#c=new Map;constructor({elements:e,relations:n}){for(const r of Object.values(e))this.addElement(r);for(const r of Object.values(n))this.addRelation(r)}get rootElements(){return[...this.#r]}get elements(){return[...this.#e.values()]}element(e){const n=this.#e.get(e);return ce(n,`Element ${e} not found`),n}connectedRelations(e){return[...this._incomingTo(e),...this._outgoingFrom(e),...this._internalOf(e)]}children(e){return this._childrenOf(e).slice()}childrenOrElement(e){const n=this.children(e);return n.length>0?n:[this.element(e)]}siblings(e){const n=Gi(e)?e:e.id,r=bt(n);return(r?this._childrenOf(r):this.rootElements).filter(i=>i.id!==n)}ancestors(e){let n=Gi(e)?e:e.id;const r=[];let i;for(;i=this.#t.get(n);)r.push(i),n=i.id;return r}ascendingSiblings(e){const n=Gi(e)?e:e.id;let r=this.#c.get(n);return r||(r=[...this.siblings(n),...this.ancestors(n).flatMap(i=>this.siblings(i.id))],this.#c.set(n,r)),r.slice()}anyEdgesBetween(e,n){if(n.length===0)return[];const r=Gi(e)?this.element(e):e,i=this._incomingTo(r.id),s=this._outgoingFrom(r.id);if(i.size===0&&s.size===0)return[];const o=[];for(const a of n){const c=Gi(a)?this.element(a):a;if(!Uu(r,c)){if(s.size>0){const l=Tv(this._incomingTo(c.id),s);l.size>0&&o.push({source:r,target:c,relations:[...l]})}if(i.size>0){const l=Tv(this._outgoingFrom(c.id),i);l.size>0&&o.push({source:c,target:r,relations:[...l]})}}}return o}edgesWithin(e){return e.length<2?[]:e.reduce((n,r,i,s)=>(i===s.length-1||n.push(...this.anyEdgesBetween(r,s.slice(i+1))),n),[])}edgesBetween(e,n){const r=q_(e)?e:[e],i=q_(n)?n:[n];if(r.length===0||i.length===0)return[];const s=[];for(const o of r){const a=Gi(o)?this.element(o):o,c=this._outgoingFrom(a.id);if(c.size!==0)for(const l of i){const u=Gi(l)?this.element(l):l;if(Uu(a,u))continue;const d=this._incomingTo(u.id),f=Tv(c,d);f.size>0&&s.push({source:a,target:u,relations:[...f]})}}return s}addElement(e){if(this.#e.has(e.id))throw new Error(`Element ${e.id} already exists`);this.#e.set(e.id,e);const n=bt(e.id);n?(this.#t.set(e.id,this.element(n)),this._childrenOf(n).push(e)):this.#r.add(e)}addRelation(e){if(this.#i.has(e.id))throw new Error(`Relation ${e.id} already exists`);this.#i.set(e.id,e),this._incomingTo(e.target).add(e),this._outgoingFrom(e.source).add(e);const n=Rs(e.source,e.target);if(n)for(const r of[n,...Hn(n)])this._internalOf(r).add(e);for(const r of Hn(e.source)){if(r===n)break;this._outgoingFrom(r).add(e)}for(const r of Hn(e.target)){if(r===n)break;this._incomingTo(r).add(e)}}_childrenOf(e){let n=this.#n.get(e);return n||(n=[],this.#n.set(e,n)),n}_incomingTo(e){let n=this.#s.get(e);return n||(n=new wv,this.#s.set(e,n)),n}_outgoingFrom(e){let n=this.#o.get(e);return n||(n=new wv,this.#o.set(e,n)),n}_internalOf(e){let n=this.#a.get(e);return n||(n=new wv,this.#a.set(e,n)),n}};const TH=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,EH=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,RH=/^([/\\]\s*){2,}[^/\\]/;function UC(t){return["./","../"].some(e=>t.startsWith(e))}function Ev(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?TH.test(t):EH.test(t)||(e.acceptRelative?RH.test(t):!1)}function SH(t="",e){return t.endsWith("/")}function $H(t="",e){return(SH(t)?t.slice(0,-1):t)||"/"}function kH(t="",e){return t.endsWith("/")?t:t+"/"}function eh(t=""){return t.startsWith("/")}function BC(t=""){return(eh(t)?t.slice(1):t)||"/"}function _H(t=""){return eh(t)?t:"/"+t}function CH(t,e){if(AH(e))return t;const n=$H(e);if(!t.startsWith(n))return t;const r=t.slice(n.length);return r[0]==="/"?r:"/"+r}function AH(t){return!t||t==="/"}function th(t=""){const[e="",n="",r=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:n,hash:r}}const Re=Me.withTag("lsp");function qt(t){Re.error(t)}function mt(t){if(t instanceof Error){Re.warn(t.stack??t.message);return}Re.warn(t)}function IH(t){Re.level=Ke[t]}function PH(t){const e={log:({level:n,...r},i)=>{if(n!==Ke.error&&n!==Ke.fatal)return;const s=r.tag||"",o=r.args.map(c=>c&&typeof c.stack=="string"?c.message+`
1130
+ `+c.stack:typeof c=="string"?c:String(c));s&&o.unshift(`[${s}]`);const a=o.join(" ");t.telemetry.logEvent({eventName:"error",error:a})}};Me.addReporter(e),Re.setReporters(Me.options.reporters)}function xH(t){const e={log:({level:n,...r},i)=>{const s=r.tag||"",o=r.args.map(c=>c&&typeof c.stack=="string"?c.message+`
1131
+ `+c.stack:typeof c=="string"?c:String(c));s&&o.unshift(`[${s}]`);const a=o.join(" ");switch(!0){case n>=Ke.trace:{t.tracer.log(a);break}case n>=Ke.debug:{t.console.debug(a);break}case n>=Ke.info:{t.console.info(a);break}case n>=Ke.log:{t.console.log(a);break}case n>=Ke.warn:{t.console.warn(a);break}case n>=Ke.fatal:{t.console.error(a);break}}}};Me.addReporter(e),Re.setReporters(Me.options.reporters)}const nh="DynamicViewRule";function Rv(t){return V.isInstance(t,nh)}const rh="ElementExpression";function Sv(t){return V.isInstance(t,rh)}const ih="ElementPredicate";function NH(t){return V.isInstance(t,ih)}const sh="ElementPredicateOrWhere";function OH(t){return V.isInstance(t,sh)}const Bs="ElementProperty";function DH(t){return V.isInstance(t,Bs)}const qs="LikeC4View";function $v(t){return V.isInstance(t,qs)}const oh="MetadataProperty";function qC(t){return V.isInstance(t,oh)}const WC="Predicate",ah="RelationExpression";function kv(t){return V.isInstance(t,ah)}const ch="RelationPredicate";function LH(t){return V.isInstance(t,ch)}const lh="RelationPredicateOrWhere";function MH(t){return V.isInstance(t,lh)}const Qo="RelationProperty";function FH(t){return V.isInstance(t,Qo)}const uh="RelationshipStyleProperty";function jH(t){return V.isInstance(t,uh)}const Zo="StringProperty";function UH(t){return V.isInstance(t,Zo)}const tl="StyleProperty";function _v(t){return V.isInstance(t,tl)}const dh="ViewProperty";function BH(t){return V.isInstance(t,dh)}const fh="ViewRule";function qH(t){return V.isInstance(t,fh)}const hh="ViewRulePredicate";function Cv(t){return V.isInstance(t,hh)}const nl="WhereElement";function GC(t){return V.isInstance(t,nl)}const rl="WhereElementExpression";function WH(t){return V.isInstance(t,rl)}const zC="WhereExpression",ph="WhereKindEqual";function GH(t){return V.isInstance(t,ph)}const il="WhereRelation";function HC(t){return V.isInstance(t,il)}const sl="WhereRelationExpression";function zH(t){return V.isInstance(t,sl)}const gh="WhereTagEqual";function HH(t){return V.isInstance(t,gh)}const ol="ArrowProperty";function al(t){return V.isInstance(t,ol)}const cl="BorderProperty";function mh(t){return V.isInstance(t,cl)}const ll="ColorProperty";function Ws(t){return V.isInstance(t,ll)}const Gs="CustomColor",yh="CustomElementProperties";function VH(t){return V.isInstance(t,yh)}const vh="CustomRelationProperties";function KH(t){return V.isInstance(t,vh)}const ul="DirectedRelationExpression";function Av(t){return V.isInstance(t,ul)}const ea="DynamicView";function YH(t){return V.isInstance(t,ea)}const wh="DynamicViewBody";function VC(t){return V.isInstance(t,wh)}const dl="DynamicViewIncludePredicate";function XH(t){return V.isInstance(t,dl)}const bh="DynamicViewParallelSteps";function KC(t){return V.isInstance(t,bh)}const Th="DynamicViewPredicateIterator";function YC(t){return V.isInstance(t,Th)}const Iv="DynamicViewRef",Eh="DynamicViewStep";function Pv(t){return V.isInstance(t,Eh)}const Ar="Element";function Ir(t){return V.isInstance(t,Ar)}const Rh="ElementBody";function ta(t){return V.isInstance(t,Rh)}const fl="ElementDescedantsExpression";function xv(t){return V.isInstance(t,fl)}const Sh="ElementExpressionsIterator";function JH(t){return V.isInstance(t,Sh)}const Ki="ElementKind";function QH(t){return V.isInstance(t,Ki)}const hl="ElementKindExpression";function $h(t){return V.isInstance(t,hl)}const pl="ElementPredicateWhere";function Nv(t){return V.isInstance(t,pl)}const gl="ElementPredicateWith";function kh(t){return V.isInstance(t,gl)}const ml="ElementRef";function yl(t){return V.isInstance(t,ml)}const vl="ElementStringProperty";function Ov(t){return V.isInstance(t,vl)}const wl="ElementStyleProperty";function bl(t){return V.isInstance(t,wl)}const Tl="ElementTagExpression";function _h(t){return V.isInstance(t,Tl)}const na="ElementView";function Ch(t){return V.isInstance(t,na)}const Ah="ElementViewBody";function Dv(t){return V.isInstance(t,Ah)}const Lv="ElementViewRef",El="ExcludePredicate";function Ih(t){return V.isInstance(t,El)}const Rl="ExpandElementExpression";function XC(t){return V.isInstance(t,Rl)}const ra="ExtendElement";function ia(t){return V.isInstance(t,ra)}const Ph="ExtendElementBody";function Mv(t){return V.isInstance(t,Ph)}const xh="FqnElementRef";function JC(t){return V.isInstance(t,xh)}const Sl="IconProperty";function Yi(t){return V.isInstance(t,Sl)}const $l="IncludePredicate";function Fv(t){return V.isInstance(t,$l)}const kl="IncomingRelationExpression";function QC(t){return V.isInstance(t,kl)}const _l="InOutRelationExpression";function jv(t){return V.isInstance(t,_l)}const zs="LibIcon";function ZH(t){return V.isInstance(t,zs)}const Uv="LikeC4Grammar",Nh="LikeC4Lib";function ZC(t){return V.isInstance(t,Nh)}const Cl="LineProperty";function Al(t){return V.isInstance(t,Cl)}const Il="LinkProperty";function Oh(t){return V.isInstance(t,Il)}const Pl="MetadataAttribute";function e7(t){return V.isInstance(t,Pl)}const xl="MetadataBody";function t7(t){return V.isInstance(t,xl)}const sa="Model";function Bv(t){return V.isInstance(t,sa)}const oa="ModelViews";function qv(t){return V.isInstance(t,oa)}const Dh="NavigateToProperty";function Wv(t){return V.isInstance(t,Dh)}const Nl="NotationProperty";function aa(t){return V.isInstance(t,Nl)}const Ol="NotesProperty";function eA(t){return V.isInstance(t,Ol)}const Dl="OpacityProperty";function Lh(t){return V.isInstance(t,Dl)}const Ll="OutgoingRelationExpression";function Gv(t){return V.isInstance(t,Ll)}const Mh="Predicates";function tA(t){return V.isInstance(t,Mh)}const Fh="Relation";function Xi(t){return V.isInstance(t,Fh)}const jh="RelationBody";function nA(t){return V.isInstance(t,jh)}const Ml="RelationNavigateToProperty";function Uh(t){return V.isInstance(t,Ml)}const Fl="RelationPredicateWhere";function rA(t){return V.isInstance(t,Fl)}const jl="RelationPredicateWith";function zv(t){return V.isInstance(t,jl)}const Ji="RelationshipKind";function n7(t){return V.isInstance(t,Ji)}const Ul="RelationStringProperty";function Bh(t){return V.isInstance(t,Ul)}const Bl="RelationStyleProperty";function Hv(t){return V.isInstance(t,Bl)}const ql="ShapeProperty";function qh(t){return V.isInstance(t,ql)}const Wh="SpecificationColor";function Gh(t){return V.isInstance(t,Wh)}const ca="SpecificationElementKind";function la(t){return V.isInstance(t,ca)}const Wl="SpecificationElementStringProperty";function iA(t){return V.isInstance(t,Wl)}const ua="SpecificationRelationshipKind";function da(t){return V.isInstance(t,ua)}const Gl="SpecificationRelationshipStringProperty";function sA(t){return V.isInstance(t,Gl)}const fa="SpecificationRule";function Vv(t){return V.isInstance(t,fa)}const ha="SpecificationTag";function zh(t){return V.isInstance(t,ha)}const Qi="Tag";function oA(t){return V.isInstance(t,Qi)}const Hh="Tags";function Kv(t){return V.isInstance(t,Hh)}const Yv="ViewRef",zl="ViewRuleAutoLayout";function Vh(t){return V.isInstance(t,zl)}const Hl="ViewRuleStyle";function pa(t){return V.isInstance(t,Hl)}const Vl="ViewStringProperty";function r7(t){return V.isInstance(t,Vl)}const Kl="WhereBinaryExpression";function i7(t){return V.isInstance(t,Kl)}const Yl="WhereElementKind";function s7(t){return V.isInstance(t,Yl)}const Xl="WhereElementNegation";function aA(t){return V.isInstance(t,Xl)}const Jl="WhereElementTag";function o7(t){return V.isInstance(t,Jl)}const Ql="WhereRelationKind";function cA(t){return V.isInstance(t,Ql)}const Zl="WhereRelationNegation";function lA(t){return V.isInstance(t,Zl)}const eu="WhereRelationTag";function a7(t){return V.isInstance(t,eu)}const tu="WildcardExpression";function ga(t){return V.isInstance(t,tu)}class uA extends uT{getAllTypes(){return[ol,cl,ll,Gs,yh,vh,ul,ea,wh,dl,bh,Th,Iv,nh,Eh,Ar,Rh,fl,rh,Sh,Ki,hl,ih,sh,pl,gl,Bs,ml,vl,wl,Tl,na,Ah,Lv,El,Rl,ra,Ph,xh,Sl,_l,$l,kl,zs,Uv,Nh,qs,Cl,Il,Pl,xl,oh,sa,oa,Dh,Nl,Ol,Dl,Ll,WC,Mh,Fh,jh,ah,Ml,ch,lh,Fl,jl,Qo,Ul,Bl,Ji,uh,ql,Wh,ca,Wl,ua,Gl,fa,ha,Zo,tl,Qi,Hh,dh,Yv,fh,zl,hh,Hl,Vl,Kl,nl,rl,Yl,Xl,Jl,zC,ph,il,sl,Ql,Zl,eu,gh,tu]}computeIsSubtype(e,n){switch(e){case ol:case Cl:return this.isSubtype(uh,n);case cl:case Dl:case ql:return this.isSubtype(tl,n);case ll:return this.isSubtype(uh,n)||this.isSubtype(tl,n);case ul:case kl:case _l:case Ll:return this.isSubtype(ah,n);case ea:case na:return this.isSubtype(qs,n);case dl:return this.isSubtype(nh,n);case fl:case hl:case ml:case Tl:case Rl:case tu:return this.isSubtype(rh,n);case rh:case pl:return this.isSubtype(sh,n);case ih:case ch:return this.isSubtype(WC,n);case sh:case gl:return this.isSubtype(ih,n);case vl:return this.isSubtype(Bs,n)||this.isSubtype(Zo,n);case wl:return this.isSubtype(Bs,n);case El:case $l:return this.isSubtype(hh,n);case Sl:return this.isSubtype(Bs,n)||this.isSubtype(tl,n);case Il:return this.isSubtype(Bs,n)||this.isSubtype(Qo,n)||this.isSubtype(dh,n);case Pl:case Nl:case Ol:case Wl:case Gl:return this.isSubtype(Zo,n);case xl:return this.isSubtype(oh,n);case oh:return this.isSubtype(Bs,n)||this.isSubtype(Qo,n);case ah:case Fl:return this.isSubtype(lh,n);case Ml:case Bl:return this.isSubtype(Qo,n);case lh:case jl:return this.isSubtype(ch,n);case Ul:return this.isSubtype(Qo,n)||this.isSubtype(Zo,n);case zl:case Hl:return this.isSubtype(nh,n)||this.isSubtype(fh,n);case hh:return this.isSubtype(fh,n);case Vl:return this.isSubtype(Zo,n)||this.isSubtype(dh,n);case Kl:return this.isSubtype(rl,n)||this.isSubtype(sl,n);case nl:case Xl:return this.isSubtype(rl,n);case rl:case sl:return this.isSubtype(zC,n);case Yl:return this.isSubtype(nl,n)||this.isSubtype(ph,n);case Jl:return this.isSubtype(nl,n)||this.isSubtype(gh,n);case il:case Zl:return this.isSubtype(sl,n);case Ql:return this.isSubtype(ph,n)||this.isSubtype(il,n);case eu:return this.isSubtype(il,n)||this.isSubtype(gh,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"ColorProperty:customColor":return Gs;case"DynamicViewRef:view":return ea;case"DynamicViewStep:kind":case"OutgoingRelationExpression:kind":case"Relation:kind":case"WhereRelationKind:value":return Ji;case"Element:kind":case"ElementKindExpression:kind":case"WhereElementKind:value":return Ki;case"ElementRef:el":case"FqnElementRef:el":return Ar;case"ElementTagExpression:tag":case"Tags:values":case"WhereElementTag:value":case"WhereRelationTag:value":return Qi;case"ElementViewRef:view":return na;case"IconProperty:libicon":return zs;case"ViewRef:view":return qs;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case ol:return{name:ol,properties:[{name:"key"},{name:"value"}]};case cl:return{name:cl,properties:[{name:"key"},{name:"value"}]};case ll:return{name:ll,properties:[{name:"customColor"},{name:"key"},{name:"themeColor"}]};case Gs:return{name:Gs,properties:[{name:"name"}]};case yh:return{name:yh,properties:[{name:"props",defaultValue:[]}]};case vh:return{name:vh,properties:[{name:"props",defaultValue:[]}]};case ul:return{name:ul,properties:[{name:"source"},{name:"target"}]};case ea:return{name:ea,properties:[{name:"body"},{name:"name"}]};case wh:return{name:wh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"steps",defaultValue:[]},{name:"tags"}]};case dl:return{name:dl,properties:[{name:"predicates"}]};case bh:return{name:bh,properties:[{name:"steps",defaultValue:[]}]};case Th:return{name:Th,properties:[{name:"prev"},{name:"value"}]};case Iv:return{name:Iv,properties:[{name:"view"}]};case Eh:return{name:Eh,properties:[{name:"custom"},{name:"isBackward",defaultValue:!1},{name:"kind"},{name:"source"},{name:"target"},{name:"title"}]};case Ar:return{name:Ar,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"props",defaultValue:[]}]};case Rh:return{name:Rh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case fl:return{name:fl,properties:[{name:"parent"}]};case Sh:return{name:Sh,properties:[{name:"prev"},{name:"value"}]};case Ki:return{name:Ki,properties:[{name:"name"}]};case hl:return{name:hl,properties:[{name:"isEqual",defaultValue:!1},{name:"kind"}]};case pl:return{name:pl,properties:[{name:"subject"},{name:"where"}]};case gl:return{name:gl,properties:[{name:"custom"},{name:"subject"}]};case ml:return{name:ml,properties:[{name:"el"},{name:"parent"}]};case vl:return{name:vl,properties:[{name:"key"},{name:"value"}]};case wl:return{name:wl,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case Tl:return{name:Tl,properties:[{name:"isEqual",defaultValue:!1},{name:"tag"}]};case na:return{name:na,properties:[{name:"body"},{name:"extends"},{name:"name"},{name:"viewOf"}]};case Ah:return{name:Ah,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case Lv:return{name:Lv,properties:[{name:"view"}]};case El:return{name:El,properties:[{name:"predicates"}]};case Rl:return{name:Rl,properties:[{name:"expand"}]};case ra:return{name:ra,properties:[{name:"body"},{name:"element"}]};case Ph:return{name:Ph,properties:[{name:"elements",defaultValue:[]}]};case xh:return{name:xh,properties:[{name:"el"},{name:"parent"}]};case Sl:return{name:Sl,properties:[{name:"key"},{name:"libicon"},{name:"value"}]};case $l:return{name:$l,properties:[{name:"predicates"}]};case kl:return{name:kl,properties:[{name:"to"}]};case _l:return{name:_l,properties:[{name:"inout"}]};case zs:return{name:zs,properties:[{name:"name"}]};case Uv:return{name:Uv,properties:[{name:"likec4lib",defaultValue:[]},{name:"models",defaultValue:[]},{name:"specifications",defaultValue:[]},{name:"views",defaultValue:[]}]};case Nh:return{name:Nh,properties:[{name:"icons",defaultValue:[]}]};case Cl:return{name:Cl,properties:[{name:"key"},{name:"value"}]};case Il:return{name:Il,properties:[{name:"key"},{name:"title"},{name:"value"}]};case Pl:return{name:Pl,properties:[{name:"key"},{name:"value"}]};case xl:return{name:xl,properties:[{name:"props",defaultValue:[]}]};case sa:return{name:sa,properties:[{name:"elements",defaultValue:[]},{name:"name"}]};case oa:return{name:oa,properties:[{name:"name"},{name:"views",defaultValue:[]}]};case Dh:return{name:Dh,properties:[{name:"key"},{name:"value"}]};case Nl:return{name:Nl,properties:[{name:"key"},{name:"value"}]};case Ol:return{name:Ol,properties:[{name:"key"},{name:"value"}]};case Dl:return{name:Dl,properties:[{name:"key"},{name:"value"}]};case Ll:return{name:Ll,properties:[{name:"from"},{name:"isBidirectional",defaultValue:!1},{name:"kind"}]};case Mh:return{name:Mh,properties:[{name:"prev"},{name:"value"}]};case Fh:return{name:Fh,properties:[{name:"body"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case jh:return{name:jh,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case Ml:return{name:Ml,properties:[{name:"key"},{name:"value"}]};case Fl:return{name:Fl,properties:[{name:"subject"},{name:"where"}]};case jl:return{name:jl,properties:[{name:"custom"},{name:"subject"}]};case Ji:return{name:Ji,properties:[{name:"name"}]};case Ul:return{name:Ul,properties:[{name:"key"},{name:"value"}]};case Bl:return{name:Bl,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case ql:return{name:ql,properties:[{name:"key"},{name:"value"}]};case Wh:return{name:Wh,properties:[{name:"color"},{name:"name"}]};case ca:return{name:ca,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Wl:return{name:Wl,properties:[{name:"key"},{name:"value"}]};case ua:return{name:ua,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case Gl:return{name:Gl,properties:[{name:"key"},{name:"value"}]};case fa:return{name:fa,properties:[{name:"colors",defaultValue:[]},{name:"elements",defaultValue:[]},{name:"name"},{name:"relationships",defaultValue:[]},{name:"tags",defaultValue:[]}]};case ha:return{name:ha,properties:[{name:"tag"}]};case Qi:return{name:Qi,properties:[{name:"name"}]};case Hh:return{name:Hh,properties:[{name:"prev"},{name:"values",defaultValue:[]}]};case Yv:return{name:Yv,properties:[{name:"view"}]};case zl:return{name:zl,properties:[{name:"direction"}]};case Hl:return{name:Hl,properties:[{name:"props",defaultValue:[]},{name:"target"}]};case Vl:return{name:Vl,properties:[{name:"key"},{name:"value"}]};case Kl:return{name:Kl,properties:[{name:"left"},{name:"operator"},{name:"right"}]};case Yl:return{name:Yl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Xl:return{name:Xl,properties:[{name:"value"}]};case Jl:return{name:Jl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Ql:return{name:Ql,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Zl:return{name:Zl,properties:[{name:"value"}]};case eu:return{name:eu,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case tu:return{name:tu,properties:[{name:"isWildcard",defaultValue:!1}]};default:return{name:e,properties:[]}}}}const V=new uA;let dA;const c7=()=>dA??(dA=a8(`{"$type":"Grammar","isDeclared":true,"name":"LikeC4","rules":[{"$type":"ParserRule","name":"LikeC4Grammar","entry":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"specifications","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"models","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"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@105"},"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@110"},"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@110"},"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@110"},"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@109"},"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@8"},"arguments":[]}},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"relationships","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"colors","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@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"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@128"},"arguments":[]}},{"$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@104"},"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@99"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"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@128"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"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@110"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"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@128"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":false},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"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@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"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@128"},"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@21"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"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@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"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@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@107"},"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@107"},"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@24/parameters@0"}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]},{"$type":"Group","guardCondition":{"$type":"Negation","value":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@24/parameters@0"}}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},"cardinality":"?"}]}]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"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@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Assignment","feature":"technology","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"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@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"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@128"},"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@99"},"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@30"},"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@31"},"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@129"},"arguments":[]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"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":"Assignment","feature":"views","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":"LikeC4ViewRule","returnType":{"$ref":"#/types@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"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@110"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"extends"},{"$type":"Assignment","feature":"extends","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"of"},{"$type":"Assignment","feature":"viewOf","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"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@110"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@40"},"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@34"},"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@35"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"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@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]}]}},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"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@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"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@128"},"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@48"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@78"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"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@47"},"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@22"},"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@108"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@85"},"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@49"},"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@49"},"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@50"},"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@50"},"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@63"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"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@53"},"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@84"},"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@60"},"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@54"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"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@56"},"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@56"},"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@57"},"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@57"},"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@54"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"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@54"},"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@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"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@61"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"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@112"},"arguments":[]},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementKindExpression"}},{"$type":"Keyword","value":"element.kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@112"},"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@22"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExpandElementExpression"},"feature":"expand","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@120"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementDescedantsExpression"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@121"},"arguments":[]}]}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"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@65"},"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@85"},"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@72"},"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@66"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@67"},"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@68"},"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@68"},"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@69"},"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@69"},"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@66"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"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@66"},"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@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"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@73"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@75"},"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@74"},"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@60"},"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@76"},"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@60"},"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@60"},"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"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"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@60"},"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@60"},"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@79"},"arguments":[]}}]},"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@51"},"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@51"},"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@77"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"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@43"},"arguments":[]}}]},"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@128"},"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@128"},"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@86"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"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@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@83"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@99"},"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@36"},"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@38"},"arguments":[]}}]},"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@106"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"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@102"},"arguments":[]}},{"$type":"Assignment","feature":"customColor","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@6"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@109"},"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@127"},"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@105"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@106"},"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@103"},"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@100"},"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@93"},"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@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@92"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@94"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"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@95"},"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@100"},"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@101"},"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@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@97"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@98"},"arguments":[]}]},"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":"CustomColorValue","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@122"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@130"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconId","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@117"},"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@118"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@119"},"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@122"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@124"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"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@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"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@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@102"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EqOperator","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"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","name":"IsEqual","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isEqual","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"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|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\\\\._/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotWildcard","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\.\\\\*/"},"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":"Hex","definition":{"$type":"RegexToken","regex":"/[a-zA-Z0-9]+/"},"fragment":false,"hidden":false}],"types":[{"$type":"Type","name":"LikeC4View","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@34"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@35"}}]}},{"$type":"Type","name":"StringProperty","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@18"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@42"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@27"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@31"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@13"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@82"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@83"}}]}},{"$type":"Type","name":"WhereTagEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@59/definition/elements@0/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@71/definition/elements@0/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereKindEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@59/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@71/definition/elements@1/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereExpression","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@54"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@66"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"usedGrammars":[]}`)),fA={languageId:"likec4",fileExtensions:[".c4",".likec4",".like-c4"],caseInsensitive:!1},l7={skipValidations:!0,recoveryEnabled:!0,nodeLocationTracking:"full"},u7={AstReflection:()=>new uA},d7={Grammar:()=>c7(),LanguageMetaData:()=>fA,parser:{ParserConfig:()=>l7}};function pn(t){return t.el.ref}function Kh(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 nu=Symbol.for("idattr"),Xv={writeId(t,e){return t[nu]=e,t},readId(t){return t[nu]}},hA={writeId(t,e){return Rt(e)?t[nu]=void 0:t[nu]=e,t},readId(t){return t[nu]}};function f7(t){return Object.assign(t,{c4Specification:{tags:new Set,elements:{},relationships:{},colors:{}},c4Elements:[],c4Relations:[],c4Views:[]})}function Yh(t){return t.textDocument.languageId===fA.languageId}function pA(t){return Yh(t)&&t.state>=Ne.IndexedContent&&!!t.c4fqnIndex}function ru(t){return Yh(t)&&t.state==Ne.Validated&&!!t.c4Specification&&!!t.c4Elements&&!!t.c4Relations&&!!t.c4Views&&!!t.c4fqnIndex}function h7(t){return e=>t.some(n=>n(e))}const p7=h7([YC,kh,zv,Sv,kv,KC,Pv,BH,_v,Kv,qH,Rv,Dv,VC,$v,FH,nA,Xi,DH,ta,Ir,Mv,ia,la,da,zh,Gh,Vv,qv,Bv]),g7=t=>{let e=t;for(;e;){if(p7(e))return e;e=e.$container}};function m7(t){const e=t.diagnostics?.filter(r=>r.severity===Lc.Error)??[],n=new WeakSet(e.flatMap(r=>g7(r.node)??[]));return{isValid:r=>!n.has(r),invalidNodes:n}}function*y7(t,e){const n=t.parseResult.value.models.flatMap(s=>e(s)?s.elements:[]),r=[];let i;for(;i=n.shift();)if(e(i)){if(Xi(i)){r.push(i);continue}if(ia(i)){i.body&&i.body.elements.length>0&&n.push(...i.body.elements);continue}i.body&&i.body.elements.length>0&&n.push(...i.body.elements),yield i}for(const s of r)yield s}function v7(t){const e=pn(t.target);if(!e)throw new Error("RelationRefError: Invalid reference to target");if(Ct(t.source)){const n=pn(t.source);if(!n)throw new Error("RelationRefError: Invalid reference to source");return{source:n,target:e}}if(!ta(t.$container))throw new Error("RelationRefError: Invalid container for sourceless relation");return{source:t.$container.$container,target:e}}function gA({value:t}){const e=parseFloat(t);return isNaN(e)?100:V_(e,{min:0,max:100})}function Xh(t,e){const n={};if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case mh(r):{Q(r.value)&&(n.border=r.value);break}case Ws(r):{const i=iu(r);Q(i)&&(n.color=i);break}case qh(r):{Q(r.value)&&(n.shape=r.value);break}case Yi(r):{const i=r.libicon?.ref?.name??r.value;Q(i)&&(n.icon=i);break}case Lh(r):{n.opacity=gA(r);break}default:Se(r.$type)}return n}function w7(t){const e={};if(!t||t.length===0)return e;for(const n of t){if(Ws(n)){const r=iu(n);Q(r)&&(e.color=r);continue}if(Al(n)){e.line=n.value;continue}if(al(n)){switch(n.key){case"head":{e.head=n.value;break}case"tail":{e.tail=n.value;break}default:Se(n)}continue}Se(n)}return e}function mA(t){const{color:e,line:n,head:r,tail:i}=w7(t?.filter(jH));return{...e&&e!==co?{color:e}:{},...n&&n!==t0?{line:n}:{},...r&&r!==ao?{head:r}:{},...i?{tail:i}:{}}}function iu(t){return t?.themeColor??t?.customColor?.$refText}function yA(t){switch(t){case"TopBottom":return"TB";case"BottomTop":return"BT";case"LeftRight":return"LR";case"RightLeft":return"RL";default:Se(t)}}function b7(t){switch(t){case"TB":return"TopBottom";case"BT":return"BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:Se(t)}}function vA(t){if(Sv(t))return t;if(Nv(t))return t.subject;if(kh(t))return vA(t.subject);Se(t)}class T7{constructor(e){this.services=e}async provideCodeLens(e,n,r){return e.state!==Ne.Validated&&(Re.debug(`Waiting for document ${e.uri.path} to be validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(Ne.Validated,e.uri,r),Re.debug(`Document ${e.uri.path} is validated`)),ru(e)?e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=Xv.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}}class E7 extends b_{completionOptions={triggerCharacters:["."]}}class R7 extends T_{createDocumentHighlight(e){return se.DocumentHighlight.create(e.segment.range,se.DocumentHighlightKind.Read)}}class S7{constructor(e){this.services=e}getDocumentLinks(e,n){return ru(e)?mr(e.parseResult.value).filter(Oh).map(r=>{try{const i=mn(r.$cstNode,"value")?.range,s=this.resolveLink(e,r.value);if(i&&Ev(s))return{range:i,target:s}}catch(i){mt(i)}return null}).nonNullable().toArray():[]}resolveLink(e,n){if(Ev(n)||eh(n))return n;const r=UC(n)?new URL(e.uri.toString(!0)):this.services.shared.workspace.WorkspaceManager.workspaceURL;return new URL(n,r).toString()}relativeLink(e,n){if(eh(n))return BC(n);if(UC(n)){const r=new URL(e.uri.toString(!0)),i=new URL(n,r).toString();return BC(CH(i,this.services.shared.workspace.WorkspaceManager.workspaceURL.toString()))}return null}}class $7{constructor(e){this.services=e,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}nodeKindProvider;getSymbols({parseResult:{value:{specifications:e,models:n,views:r,likec4lib:i}}}){return[...i.map(s=>()=>this.getLikec4LibSymbol(s)),...e.map(s=>()=>this.getSpecSymbol(s)),...n.map(s=>()=>this.getModelSymbol(s)),...r.map(s=>()=>this.getModelViewsSymbol(s))].flatMap(s=>{try{return s()??[]}catch(o){return qt(o),[]}})}getLikec4LibSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.icons.map(i=>this.getLibIconSymbol(i)).filter(Q);return r.length===0?[]:[{kind:Qn.Namespace,name:"icons",range:n.range,selectionRange:pc(n,"icons")?.range??n.range,children:r}]}getSpecSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=mn(n,"name");if(!r)return[];const i=Ye([...e.elements,...e.tags,...e.relationships],st(s=>{try{if(la(s)||da(s))return this.getKindSymbol(s);if(zh(s))return this.getTagSymbol(s)}catch(o){return qt(o),null}Se(s)}),Xe(Q));return i.length===0?[]:[{kind:Qn.Namespace,name:e.name,range:n.range,selectionRange:r.range,children:i}]}getModelSymbol(e){const n=e.$cstNode;if(!n)return[];const r=mn(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))}]:[]}getElementsSymbol(e){try{if(ia(e))return this.getExtendElementSymbol(e);if(Ir(e))return this.getElementSymbol(e)}catch(n){qt(n)}return[]}getExtendElementSymbol(e){const n=e.$cstNode,r=e.element.$cstNode,i=e.body;return!n||!r?[]:[{kind:this.symbolKind(e),name:Kh(e.element),range:n.range,selectionRange:r.range,children:i.elements.flatMap(s=>this.getElementsSymbol(s))}]}getElementSymbol(e){const n=e.$cstNode,r=mn(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=mn(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||zi(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||zi(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||zi(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?mn(n,"name"):null;return r?[{kind:this.symbolKind(e),name:r.text,range:n.range,selectionRange:r.range,children:[]}]:[]}symbolKind(e){return this.nodeKindProvider.getSymbolKind(e)}}class k7 extends $_{locator;constructor(e){super(e),this.locator=e.likec4.ModelLocator}getAstNodeHoverContent(e){if(oA(e))return{contents:{kind:"markdown",value:lv(`
1132
+ tag: \`${e.name}\`
1133
+ `)}};if(Ir(e)){const n=this.locator.getParsedElement(e);return n?{contents:{kind:"markdown",value:[n.id,`### ${n.title}`,"`"+n.kind+"` "].join(`
1134
+ `)}}:void 0}}}class _7 extends iW{highlightElement(e,n){if(n7(e))return n({node:e,property:"name",type:Pe.function});if(ZH(e))return n({node:e,property:"name",type:Pe.type,modifier:[it.definition]}),"prune";if(Gv(e)&&"kind"in e){n({node:e,property:"kind",type:Pe.function});return}if(Xi(e)&&"kind"in e&&n({node:e,property:"kind",type:Pe.function}),Wv(e)||Uh(e))return n({node:e,property:"key",type:Pe.property}),n({node:e,property:"value",type:Pe.variable,modifier:[it.definition,it.readonly]}),"prune";if((xv(e)||ga(e))&&e.$cstNode){n({cst:e.$cstNode,type:Pe.variable,modifier:[it.definition,it.readonly]});return}if(cA(e)&&Q(e.value)){n({node:e,property:"value",type:Pe.function});return}if((GC(e)||HC(e))&&Q(e.value)){n({node:e,property:"value",type:Pe.type,modifier:[it.definition,it.readonly]});return}if($h(e)&&Q(e.kind)&&n({node:e,property:"kind",type:Pe.type,modifier:[it.definition]}),_h(e)&&Q(e.tag)&&n({node:e,property:"tag",type:Pe.type,modifier:[it.definition]}),yl(e)||JC(e))return n({node:e,property:"el",type:e.parent?Pe.property:Pe.variable,modifier:[it.definition,it.readonly]}),e.parent?void 0:"prune";if(Gh(e)){n({node:e,keyword:"color",type:Pe.keyword}),n({node:e,property:"name",type:Pe.type,modifier:[it.declaration,it.readonly]});return}if((la(e)||da(e))&&n({node:e,property:"kind",type:Pe.type,modifier:[it.declaration,it.readonly]}),Kv(e))return n({node:e,property:"values",type:Pe.interface});if(oA(e))return n({node:e,property:"name",type:Pe.type,modifier:[it.definition]});if((Hv(e)||bl(e)&&ta(e.$container))&&n({node:e,property:"key",type:Pe.property}),Lh(e))return n({node:e,property:"key",type:Pe.property}),n({node:e,property:"value",type:Pe.number}),"prune";if(Oh(e)||Yi(e)||UH(e))return n({node:e,property:"key",type:Pe.property}),"value"in e&&e.value&&n({node:e,property:"value",type:Pe.string}),Yi(e)&&e.libicon&&n({node:e,property:"libicon",type:Pe.enum,modifier:[it.defaultLibrary]}),"prune";if(Ws(e)||qh(e)||al(e)||Al(e)||mh(e))return n({node:e,property:"key",type:Pe.property}),"value"in e&&n({node:e,property:"value",type:Pe.enum}),"prune";if(Ir(e))return this.highlightAstElement(e,n);if($v(e))return this.highlightView(e,n)}highlightAstElement(e,n){n({node:e,property:"name",type:Pe.variable,modifier:[it.declaration,it.readonly]}),n({node:e,property:"kind",type:Pe.keyword,modifier:[]})}highlightView(e,n){e.name&&n({node:e,property:"name",type:Pe.variable,modifier:[it.declaration,it.readonly,"local"]})}}const{findNodeForProperty:C7}=dd,{toDocumentSegment:wA}=_L;function A7(t,e,n){const r=C7(e.$cstNode,"name");return{documentUri:n.uri,name:e.name,...e.$cstNode&&{selectionSegment:wA(e.$cstNode)},...r&&{nameSegment:wA(r)},path:t.getAstNodePath(e),type:Ar}}function I7(t,e){const n=t.c4fqnIndex=new Sr,r=t.parseResult.value.models.flatMap(a=>a.elements);if(r.length===0)return;const i=e.workspace.AstNodeLocator,s=r.map(a=>[a,null]);let o;for(;o=s.shift();)try{const[a,c]=o;if(Xi(a))continue;if(ia(a)){if(Ct(a.body)&&!zi(a.body.elements)){const l=Kh(a.element);for(const u of a.body.elements)s.push([u,l])}continue}if(Ir(a)){const l=eO(a.name,c);if(n.add(l,{...A7(i,a,t),fqn:l}),hA.writeId(a,l),Ct(a.body)&&!zi(a.body.elements))for(const u of a.body.elements)s.push([u,l]);continue}Se(a)}catch(a){qt(a)}}class P7{constructor(e){this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments,e.shared.workspace.DocumentBuilder.onBuildPhase(Ne.IndexedContent,async(n,r)=>{for(const i of n)if(Yh(i)){delete i.c4fqnIndex,delete i.c4Elements,delete i.c4Specification,delete i.c4Relations,delete i.c4Views;try{I7(i,e)}catch(s){mt(s)}}return await Promise.resolve()}),Re.debug("[FqnIndex] Created")}langiumDocuments;get documents(){return this.langiumDocuments.all.filter(pA)}entries(e){return this.documents.flatMap(n=>n.c4fqnIndex.keys().filter(e).flatMap(r=>n.c4fqnIndex.get(r)))}getFqn(e){return hA.readId(e)??null}byFqn(e){return this.documents.flatMap(n=>n.c4fqnIndex.get(e))}directChildrenOf(e){return Le([e]).flatMap(n=>{const r=this.entries(i=>bt(i)===n).map(i=>[i.name,i]).toArray();return r.length===0?[]:new Sr(r).entriesGroupedByKey().flatMap(([i,s])=>s.length===1?s:[]).iterator()})}uniqueDescedants(e){return new St(()=>{const n=`${e}.`,r=new Set,i=[],s=new Sr;if(this.entries(o=>o.startsWith(n)).forEach(o=>{const a=Ia(o.fqn),c={...o,name:a};bt(o.fqn)===e?(r.add(a),s.add(a,c)):i.push(c)}),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():jt)}}const bA=t=>t.map(e=>" - "+e.uri.toString(!0)).join(`
1135
+ `);function x7(t){const e=new Map;for(const n of t)if(hO(n)&&n.viewOf&&Rt(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){if(i.navigateTo)continue;const s=z_(e.get(i.id)??[],o=>o!==n);s&&(i.navigateTo=s)}return t}function N7(t){const e=new hv.Graph({directed:!0,multigraph:!1,compound:!1});for(const n of Gf(t))e.setNode(n.id),i0(n)&&e.setEdge(n.id,n.extends);if(e.edgeCount()===0)return t;for(;!J9(e);){const n=Kc(X9(e));if(!n)break;const r=Vc(n);if(!r)break;e.removeNode(r)}return xC(e,e.sources()).reduce((n,r)=>{const i=t[r];if(!i)return n;if(i0(i)){const s=n[i.extends];return s?Object.assign(n,{[i.id]:{...s,...i,rules:[...s.rules,...i.rules]}}):(Me.debug(`View "${i.id}" extends from "${i.extends}" which does not exist`),n)}return Object.assign(n,{[i.id]:i})},{})}function O7(t,e="/"){const n=Ye(t,st(c=>c.docUri),Xe(Q),kr());if(n.length===0)return"";if(n.length===1){const c=th(n[0]).pathname.split(e);return c.length<=1?e:(c.pop(),c.join(e)+e)}ce(tr(n,2),"Expected at least 2 unique URIs");const[r,...i]=n,s=th(r).pathname.split(e);let o=s.length;for(const c of i){if(c===r)continue;const l=th(c).pathname.split(e);for(let u=0;u<o;u++)l[u]!==s[u]&&(o=u);if(o===0)return""}const a=s.slice(0,o).join(e);return a.endsWith(e)?a:a+e}function D7(t){const e="/",n=O7(t,e);return t.map(r=>{if(!r.docUri)return{view:r,parts:[]};let i=th(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=pg(r.parts[s],i.parts[s]);if(o!==0)return o}return pg(r.view.title??r.view.id,i.view.title??i.view.id)}).map(({parts:r,view:i})=>({...i,relativePath:r.join(e)}))}function L7(t,e){const n={tags:new Set,elements:{},relationships:{},colors:{}};rG(st(e,ai("c4Specification")),f=>{f.tags.forEach(h=>n.tags.add(h)),Object.assign(n.elements,f.elements),Object.assign(n.relationships,f.relationships),Object.assign(n.colors,f.colors)});function r(f,h){return st(h,p=>{try{const y=t.lsp.DocumentLinkProvider.relativeLink(f,p.url);if(y&&y!==p.url)return{...p,relative:y}}catch(y){mt(y)}return p})}const i=Wi(n.colors,f=>gL(f.color));function s(f){return({tags:h,links:p,style:{color:y,shape:R,icon:b,opacity:v,border:T},id:_,kind:N,title:F,description:P,technology:G,metadata:B})=>{try{const W=n.elements[N];if(!W)return Re.warn(`No kind '${N}' found for ${_}`),null;const I=p?r(f,p):null;return y??=W.style.color,R??=W.style.shape,b??=W.style.icon,v??=W.style.opacity,T??=W.style.border,G??=W.technology,{...y&&{color:y},...R&&{shape:R},...b&&{icon:b},...B&&!zi(B)&&{metadata:B},...W.notation&&{notation:W.notation},style:{...T&&{border:T},...B_(v)&&{opacity:v}},links:I,tags:h??null,technology:G??null,description:P??null,title:F,kind:N,id:_}}catch(W){mt(W)}return null}}const o=Ye(e,Hi(f=>st(f.c4Elements,s(f))),Xe(Q),TL,L_((f,h)=>{const p=bt(h.id);return p&&Rt(f[p])?(mt(`No parent found for ${h.id}`),f):(f[h.id]=h,f)},{}));function a(f){return({astPath:h,source:p,target:y,kind:R,links:b,id:v,...T})=>{if(Rt(o[p])||Rt(o[y]))return Re.warn(`Invalid relation ${v}, source: ${p}(${!!o[p]}), target: ${y}(${!!o[y]})`),null;const _=b?r(f,b):null;return _r(R)&&R in n.relationships?{...n.relationships[R],...T,..._&&{links:_},source:p,target:y,kind:R,id:v}:{..._&&{links:_},...T,source:p,target:y,id:v}}}const c=Ye(e,Hi(f=>st(f.c4Relations,a(f))),Xe(Q),zf(Pa),M_(),W_(ai("id")));function l(f){const h=f.uri.toString();return p=>{let{id:y,title:R,description:b,tags:v,links:T,astPath:_,...N}=p;p.__==="element"&&Rt(R)&&"viewOf"in p&&(R=o[p.viewOf]?.title??null),Rt(R)&&y==="index"&&(R="Landscape view");const F=T?r(f,T):null;return{...N,tags:v,links:F,docUri:h,description:b,title:R,id:y,customColorDefinitions:i}}}const u=e.flatMap(f=>st(f.c4Views,l(f)));u.some(f=>f.id==="index")||u.unshift({__:"element",id:"index",title:"Landscape view",description:null,tags:null,links:null,customColorDefinitions:i,rules:[{include:[{wildcard:!0}]}]});const d=Ye(u,D7,W_(ai("id")),N7);return{specification:{tags:Array.from(n.tags),elements:n.elements,relationships:n.relationships},elements:o,relations:c,views:d}}const Jv="ParsedLikeC4Model",Qv="ComputedLikeC4Model";class M7{constructor(e){this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments;const n=e.likec4.ModelParser;e.shared.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.notifyListeners(i)}),e.shared.workspace.DocumentBuilder.onBuildPhase(Ne.Validated,async(r,i)=>{let s=[];try{Re.debug(`[ModelBuilder] onValidated (${r.length} docs)
1136
+ ${bA(r)}`);for(const o of n.parse(r))s.push(o.uri)}catch(o){mt(o)}return s.length>0&&this.notifyListeners(s),await Promise.resolve()}),Re.debug("[ModelBuilder] Created")}langiumDocuments;listeners=[];unsafeSyncBuildModel(){return this.services.WorkspaceCache.get(Jv,()=>{const e=this.documents();return e.length===0?(Re.debug("[ModelBuilder] No documents to build model from"),null):(Re.debug(`[ModelBuilder] buildModel from ${e.length} docs:
1137
+ ${bA(e)}`),L7(this.services,e))})}async buildModel(e){const n=this.services.WorkspaceCache;return n.has(Jv)?n.get(Jv):await this.services.shared.workspace.WorkspaceLock.read(async()=>(e&&await Pt(e),this.unsafeSyncBuildModel()))}previousViews={};unsafeSyncBuildComputedModel(e){const n=this.services.WorkspaceCache,r=this.services.WorkspaceCache;return n.get(Qv,()=>{const i=new jC(e),s=[];for(const a of Gf(e.views)){const c=Au(a)?MC(a,i):FC(a,i);if(!c.isSuccess){mt(c.error);continue}s.push(c.view)}x7(s);const o=ci(s,a=>{const c=this.previousViews[a.id],l=c&&hC(a,c)?c:a;return r.set(TA(a.id),l),[a.id,l]});return this.previousViews={...o},{specification:e.specification,elements:e.elements,relations:e.relations,views:o}})}async buildComputedModel(e){const n=this.services.WorkspaceCache;if(n.has(Qv))return n.get(Qv);const r=await this.buildModel(e);return r?await this.services.shared.workspace.WorkspaceLock.read(async()=>(e&&await Pt(e),this.unsafeSyncBuildComputedModel(r))):null}async computeView(e,n){const r=this.services.WorkspaceCache,i=TA(e);if(r.has(i))return r.get(i);const s=await this.buildModel(n),o=s?.views[e];return o?await this.services.shared.workspace.WorkspaceLock.read(async()=>(n&&await Pt(n),r.get(i,()=>{const a=new jC(s),c=Au(o)?MC(o,a):FC(o,a);if(!c.isSuccess)return qt(c.error),null;let l=c.view;const u=Ye(s.views,Gf(),Xe(s0),Xe(f=>f.id!==e),Hf(f=>f.viewOf));for(const f of l.nodes)if(!f.navigateTo){const h=u[f.id];h&&(f.navigateTo=h[0].id)}const d=this.previousViews[e];return l=d&&hC(l,d)?d:l,this.previousViews[e]=l,l}))):(Re.warn(`[ModelBuilder] Cannot find view ${e}`),null)}onModelParsed(e){return this.listeners.push(e),Ls.create(()=>{const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)})}documents(){return this.langiumDocuments.all.filter(ru).toArray()}notifyListeners(e){for(const n of this.listeners)try{n(e)}catch(r){qt(r)}}}function TA(t){return`computed-view-${t}`}const{findNodeForKeyword:F7,findNodeForProperty:Jh}=dd,{getDocument:j7}=rd;class U7{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,this.langiumDocuments=e.shared.workspace.LangiumDocuments}fqnIndex;langiumDocuments;documents(){return this.langiumDocuments.all.filter(ru)}getParsedElement(e){const n=this.fqnIndex.getFqn(e);if(!n)return null;const r=j7(e);return ru(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}}locateRelation(e){for(const n of this.documents()){const r=n.c4Relations.find(o=>o.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(!Xi(i))continue;let s=i.title?Jh(i.$cstNode,"title"):void 0;if(s??=i.kind?Jh(i.$cstNode,"kind"):void 0,s??=Jh(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($v(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?Jh(r.$cstNode,"name"):void 0;return i??=F7(r.$cstNode,"view"),i??=r.$cstNode,i?{uri:n.doc.uri.toString(),range:i.range}:null}}function Zv(...t){var e=t.length>1?t.join(":::"):t[0];return Iz(e).toString(36)}function B7({nodes:t,edges:e,...n}){return{...n,nodes:Wi(t,({x:r,y:i,width:s,height:o,isCompound:a,...c})=>({...c,b:[r,i,s,o],c:a})),edges:Wi(e,({points:r,controlPoints:i,labelBBox:s,dotpos:o,...a})=>({...!!i&&{cp:i},...!!s&&{l:s},...!!o&&{dp:o},...a,p:r}))}}function q7({nodes:t,edges:e,...n}){return{...n,nodes:Wi(t,({b:r,c:i,...s})=>({x:r[0],y:r[1],width:r[2],height:r[3],isCompound:i,...s})),edges:Wi(e,({p:r,cp:i,l:s,dp:o,...a})=>({...!!i&&{controlPoints:i},...!!s&&{labelBBox:s},...!!o&&{dotpos:o},...a,points:r}))}}function W7(t){const e=ZG(B7(t)),n=mz(e),r=[];let i=0;const s=200;for(;i<n.length;)r.push(" * "+n.slice(i,Math.min(i+s,n.length))),i+=s;return r.unshift("/**"," * @likec4-generated(v1)"),r.push(" */"),r.join(`
1138
+ `)}function EA(t){return t.includes("@likec4-generated")}function G7(t){if(!EA(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
1139
+ `).filter(r=>!r.includes("**")&&!r.includes("@likec4-")&&!r.includes("*/")).map(r=>r.replaceAll("*","").trim()).join(""),n=pz(e);return q7(uz(n))}const RA=({operator:t,not:e},n)=>t.startsWith("!=")?{neq:n}:t.startsWith("=")?{eq:n}:e?{neq:n}:{eq:n};function su(t){switch(!0){case HH(t):{const e=t.value?.ref?.name;return ce(e,"Expected tag name"),{tag:RA(t,e)}}case GH(t):{const e=t.value?.ref?.name;return ce(e,"Expected kind name"),{kind:RA(t,e)}}case(aA(t)||lA(t)):return{not:su(t.value)};case i7(t):{const e=su(t.left),n=su(t.right),r=t.operator.toLowerCase();switch(r){case"and":{const i=[Bp(e)?e.and:e,Bp(n)?n.and:n].flat();return ce(Es(i),"Expected non-empty array"),{and:i}}case"or":{const i=[qp(e)?e.or:e,qp(n)?n.or:n].flat();return ce(Es(i),"Expected non-empty array"),{or:i}}default:Se(r)}}default:Se(t)}}const{getDocument:ew}=rd;function Hs(t){return _r(t)?Mt(t).split(`
1140
+ `).join(" "):void 0}function Mt(t){return _r(t)?lv(t).trim():void 0}class z7{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,Re.debug("[ModelParser] Created")}fqnIndex;parse(e){const n=Array.isArray(e)?e:[e],r=[];for(const i of n){if(!pA(i)){Re.warn(`Not a FqnIndexedDocument: ${i.uri.toString(!0)}`);continue}try{r.push(this.parseLikeC4Document(i))}catch(s){qt(new Error(`Error parsing document ${i.uri.toString()}`,{cause:s}))}}return r}parseLikeC4Document(e){const n=f7(e),{isValid:r}=m7(n);return this.parseSpecification(n,r),this.parseModel(n,r),this.parseViews(n,r),n}parseSpecification(e,n){const{parseResult:r,c4Specification:i}=e,s=r.value.specifications.filter(n),o=s.flatMap(u=>u.elements.filter(n));for(const{kind:u,props:d}of o)try{const f=u.name;if(!Q(f))continue;if(f in i.elements){Re.warn(`Element kind "${f}" is already defined`);continue}const h=d.find(bl),p=ci(d.filter(iA).filter(y=>_r(y.value))??[],y=>[y.key,Mt(y.value)]);i.elements[f]={...p,style:{...Xh(h?.props,n)}}}catch(f){mt(f)}const a=s.flatMap(u=>u.relationships.filter(n));for(const{kind:u,props:d}of a)try{const f=u.name;if(!Q(f))continue;if(f in i.relationships){Re.warn(`Relationship kind "${f}" is already defined`);continue}const h=ci(d.filter(sA).filter(p=>_r(p.value))??[],p=>[p.key,Mt(p.value)]);i.relationships[f]={...h,...mA(d)}}catch(f){mt(f)}const c=s.flatMap(u=>u.tags.filter(n));for(const u of c){const d=u.tag.name;Q(d)&&i.tags.add(d)}const l=s.flatMap(u=>u.colors.filter(n));for(const{name:u,color:d}of l)try{const f=u.name;if(f in i.colors){Re.warn(`Custom color "${f}" is already defined`);continue}i.colors[f]={color:d}}catch(f){mt(f)}}parseModel(e,n){for(const r of y7(e,n)){if(Ir(r)){try{e.c4Elements.push(this.parseElement(r,n))}catch(i){mt(i)}continue}if(Xi(r)){try{e.c4Relations.push(this.parseRelation(r))}catch(i){mt(i)}continue}Se(r)}}parseElement(e,n){const r=this.resolveFqn(e),i=e.kind.$refText,s=this.convertTags(e.body),o=e.body?.props.find(bl)?.props,a=Xh(o,n),c=this.getMetadata(e.body?.props.find(qC)),l=this.getAstNodePath(e);let[u,d,f]=e.props??[];const h=ci(e.body?.props.filter(Ov)??[],R=>[R.key,R.value||void 0]);u=Hs(u??h.title),d=Mt(h.description??d),f=Hs(h.technology??f);const p=this.convertLinks(e.body),y=e.body?.props.find(Yi);if(y){const R=y.libicon?.ref?.name??y.value;Q(R)&&(a.icon=R)}return{id:r,kind:i,astPath:l,title:u??e.name,...c&&{metadata:c},...s&&{tags:s},...p&&Es(p)&&{links:p},...Q(f)&&{technology:f},...Q(d)&&{description:d},style:a}}parseRelation(e){const n=v7(e),r=this.resolveFqn(n.target),i=this.resolveFqn(n.source),s=this.convertTags(e)??this.convertTags(e.body),o=this.convertLinks(e.body),a=e.kind?.ref?.name,c=this.getMetadata(e.body?.props.find(qC)),l=this.getAstNodePath(e),u=ci(e.body?.props.filter(Bh).filter(R=>_r(R.value))??[],R=>[R.key,R.value]),d=Ye(e.body?.props??[],Xe(Uh),st(R=>R.value.view.ref?.name),Xe(Q),Kc()),f=Mt(e.title??u.title)??"",h=Mt(u.description),p=Mt(e.technology)??Hs(u.technology),y=e.body?.props.find(Hv);return{id:Zv(l,i,r),astPath:l,source:i,target:r,title:f,...c&&{metadata:c},...Q(p)&&{technology:p},...Q(h)&&{description:h},...a&&{kind:a},...s&&{tags:s},...Es(o)&&{links:o},...mA(y?.props),...d&&{navigateTo:d}}}parseViews(e,n){const r=e.parseResult.value.views.flatMap(i=>n(i)?i.views:[]);for(const i of r)try{if(!n(i))continue;e.c4Views.push(Ch(i)?this.parseElementView(i,n):this.parseDynamicElementView(i,n))}catch(s){mt(s)}}parseViewRulePredicate(e,n){const r=[];let i=e.predicates;for(;i;){try{Q(i.value)&&n(i.value)&&r.unshift(this.parsePredicate(i.value,n))}catch(s){mt(s)}i=i.prev}return Fv(e)?{include:r}:{exclude:r}}parsePredicate(e,n){if(NH(e))return this.parseElementPredicate(e,n);if(LH(e))return this.parseRelationPredicate(e,n);Se(e)}parseElementExpressionsIterator(e){const n=[];let r=e;for(;r;){try{n.unshift(this.parseElementExpr(r.value))}catch(i){mt(i)}r=r.prev}return n}parseElementPredicate(e,n){if(kh(e))return this.parseElementPredicateWith(e,n);if(Nv(e))return this.parseElementPredicateWhere(e);if(Sv(e))return this.parseElementExpr(e);Se(e)}parseElementExpr(e){if(ga(e))return{wildcard:!0};if($h(e))return ce(e.kind,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.$refText,isEqual:e.isEqual};if(_h(e)){ce(e.tag,"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(XC(e)){const n=pn(e.expand);return ce(n,"Element not found "+e.expand.$cstNode?.text),{expanded:this.resolveFqn(n)}}if(xv(e)){const n=pn(e.parent);return ce(n,"Element not found "+e.parent.$cstNode?.text),{element:this.resolveFqn(n),isDescedants:!0}}if(yl(e)){const n=pn(e);return ce(n,"Element not found "+e.$cstNode?.text),{element:this.resolveFqn(n)}}Se(e)}parseElementPredicateWith(e,n){const r=this.parseElementPredicate(e.subject,n);return(e.custom?.props??[]).reduce((i,s)=>{if(Wv(s)){const o=s.value.view.$refText;return Q(o)&&(i.custom.navigateTo=o),i}if(Ov(s)){if(Ct(s.value)){let o=s.key==="description"?Mt(s.value):Hs(s.value);i.custom[s.key]=o||""}return i}if(Yi(s)){const o=s.libicon?.ref?.name??s.value;return Ct(o)&&(i.custom[s.key]=o),i}if(Ws(s)){const o=iu(s);return Ct(o)&&(i.custom[s.key]=o),i}if(qh(s)||mh(s))return Ct(s.value)&&(i.custom[s.key]=s.value),i;if(Lh(s))return Ct(s.value)&&(i.custom[s.key]=gA(s)),i;if(aa(s))return Q(s.value)&&(i.custom[s.key]=Mt(s.value)),i;Se(s)},{custom:{expr:r}})}parseElementPredicateWhere(e){return{where:{expr:this.parseElementExpr(e.subject),condition:e.where?su(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicate(e,n){if(zv(e)){const r=rA(e.subject)?e.subject.subject:e.subject;return this.parseRelationPredicateWith(e,r)}if(rA(e))return this.parseRelationPredicateWhere(e);if(kv(e))return this.parseRelationExpr(e);Se(e)}parseRelationPredicateWhere(e){return{where:{expr:this.parseRelationExpr(e.subject),condition:e.where?su(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicateWith(e,n){const r=this.parseRelationExpr(n);return(e.custom?.props??[]).reduce((i,s)=>{if(Bh(s)||aa(s)||eA(s))return Ct(s.value)&&(i.customRelation[s.key]=Mt(s.value)??""),i;if(al(s))return Q(s.value)&&(i.customRelation[s.key]=s.value),i;if(Ws(s)){const o=iu(s);return Q(o)&&(i.customRelation[s.key]=o),i}if(Al(s))return Q(s.value)&&(i.customRelation[s.key]=s.value),i;if(Uh(s)){const o=s.value.view.ref?.name;return Q(o)&&(i.customRelation.navigateTo=o),i}Se(s)},{customRelation:{relation:r}})}parseRelationExpr(e){if(Av(e))return{source:this.parseElementExpr(e.source.from),target:this.parseElementExpr(e.target),isBidirectional:e.source.isBidirectional};if(jv(e))return{inout:this.parseElementExpr(e.inout.to)};if(Gv(e))return{outgoing:this.parseElementExpr(e.from)};if(QC(e))return{incoming:this.parseElementExpr(e.to)};Se(e)}parseViewRule(e,n){if(Cv(e))return this.parseViewRulePredicate(e,n);if(pa(e)){const r=Xh(e.props.filter(_v),n),i=Mt(e.props.find(aa)?.value);return{targets:this.parseElementExpressionsIterator(e.target),...i&&{notation:i},style:{...r}}}if(Vh(e))return{autoLayout:yA(e.direction)};Se(e)}parseViewManualLaout(e){const n=zu(e.$cstNode,["BLOCK_COMMENT"]);if(!(!n||!EA(n.text)))try{return G7(n.text)}catch(r){const i=ew(e);Re.warn(r),Re.warn(`Ignoring manual layout of "${e.name??"unnamed"}" at ${i.uri.fsPath}:${1+(n.range.start.line||0)}`);return}}parseDynamicParallelSteps(e){return{__parallel:e.steps.map(n=>this.parseDynamicStep(n))}}parseDynamicStep(e){const n=pn(e.source);if(!n)throw new Error("Invalid reference to source");const r=pn(e.target);if(!r)throw new Error("Invalid reference to target");let i=this.resolveFqn(n),s=this.resolveFqn(r);const o=Mt(e.title)??null;let a={source:i,target:s,title:o};if(e.isBackward&&(a={source:s,target:i,title:o,isBackward:!0}),Array.isArray(e.custom?.props))for(const c of e.custom.props)try{if(Bh(c)||aa(c)||eA(c)){Ct(c.value)&&(a[c.key]=Mt(c.value)??"");continue}if(al(c)){Ct(c.value)&&(a[c.key]=c.value);continue}if(Ws(c)){const l=iu(c);Ct(l)&&(a[c.key]=l);continue}if(Al(c)){Ct(c.value)&&(a[c.key]=c.value);continue}if(Uh(c)){const l=c.value.view.ref?.name;Q(l)&&(a.navigateTo=l);continue}Se(c)}catch(l){mt(l)}return a}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 h=pn(e.viewOf),p=h&&this.resolveFqn(h);p?s=p:Re.warn("viewOf is not resolved: "+e.$cstNode?.text)}let o=e.name;o||(o="view_"+Zv(ew(e).uri.toString(),i,s??""));const a=Hs(r.props.find(h=>h.key==="title")?.value)??null,c=Mt(r.props.find(h=>h.key==="description")?.value)??null,l=this.convertTags(r),u=this.convertLinks(r),d=this.parseViewManualLaout(e),f={__:"element",id:o,astPath:i,title:a,description:c,tags:l,links:Es(u)?u:null,rules:r.rules.flatMap(h=>{try{return n(h)?this.parseViewRule(h,n):[]}catch(p){return mt(p),[]}}),...s&&{viewOf:s},...d&&{manualLayout:d}};if(Xv.writeId(e,f.id),"extends"in e){const h=e.extends.view.ref;return ce(h?.name,"view extends is not resolved: "+e.$cstNode?.text),Object.assign(f,{extends:h.name})}return f}parseDynamicElementView(e,n){const r=e.body;ce(r,"DynamicElementView body is not defined");const i=r.props.filter(n),s=this.getAstNodePath(e);let o=e.name;o||(o="dynamic_"+Zv(ew(e).uri.toString(),s));const a=Hs(i.find(f=>f.key==="title")?.value)??null,c=Mt(i.find(f=>f.key==="description")?.value)??null,l=this.convertTags(r),u=this.convertLinks(r);Xv.writeId(e,o);const d=this.parseViewManualLaout(e);return{__:"dynamic",id:o,astPath:s,title:a,description:c,tags:l,links:Es(u)?u:null,rules:r.rules.reduce((f,h)=>{if(!n(h))return f;try{if(XH(h)){const p=[];let y=h.predicates;for(;y;){try{if(n(y.value)){const R=this.parseElementPredicate(y.value,n);p.unshift(R)}}catch(R){mt(R)}y=y.prev}return p.length>0&&f.push({include:p}),f}if(pa(h)){const p=Xh(h.props.filter(_v),n),y=Mt(h.props.find(aa)?.value),R=this.parseElementExpressionsIterator(h.target);return R.length>0&&f.push({targets:R,...y&&{notation:y},style:{...p}}),f}if(Vh(h))return f.push({autoLayout:yA(h.direction)}),f;Se(h)}catch(p){return mt(p),f}},[]),steps:r.steps.reduce((f,h)=>{try{n(h)&&(KC(h)?f.push(this.parseDynamicParallelSteps(h)):f.push(this.parseDynamicStep(h)))}catch(p){mt(p)}return f},[]),...d&&{manualLayout:d}}}resolveFqn(e){if(ia(e))return Kh(e.element);const n=this.fqnIndex.getFqn(e);return ce(n,`Not indexed element: ${this.getAstNodePath(e)}`),n}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){return e?.props!=null?ci(e.props,n=>[n.key,Mt(n.value)]):void 0}convertTags(e){let n=e?.tags;if(!n)return null;const r=[];for(;n;){try{const i=n.values.map(s=>s.ref?.name).filter(Q);i.length>0&&r.unshift(...i)}catch{}n=n.prev}return Es(r)?r:null}convertLinks(e){if(!(!e?.props||e.props.length===0))return Ye(e.props,Xe(Oh),Hi(n=>{const r=n.value;if(Q(r)){const i=Q(n.title)?Hs(n.title):void 0;return i?{url:r,title:i}:{url:r}}return[]}))}}const{findNodeForKeyword:H7,findNodeForProperty:use}=dd,V7=(t,e,n=0)=>{const r=n>0?" ".repeat(n):"";return[r+`style ${t} {`,...Yo(e).map(([i,s])=>r+` ${i} ${i==="opacity"?s.toString()+"%":s}`),r+"}"]},K7=(t,e)=>n=>{if(!pa(n))return!1;const r=n.target.value;if(!r||Q(n.target.prev)||!yl(r))return!1;const i=r.el.ref;return(i?e.getFqn(i):null)===t};function Y7(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=Vc(n.body.rules)?.$cstNode?.range.end??n.body.$cstNode?.range.end;ce(o,"insertPos is not defined");const a=s.range.start.character+2,c=t.likec4.FqnIndex,l=Xe(n.body.rules,pa),u=e.__==="element"?e.viewOf:null,d=[],f=[];r.forEach(R=>{const b=dG(l,K7(R,c)),v=u&&fr(u,R)?R.substring(u.length+1):R;b?d.push({fqn:v,rule:b}):f.push({fqn:v})});const h={start:o,end:o},p=R=>{R.start.line<=h.start.line&&(R.start.line==h.start.line?h.start.character=Math.min(R.start.character,h.start.character):h.start=R.start),R.end.line>=h.end.line&&(R.end.line==h.end.line?h.end.character=Math.max(R.end.character,h.end.character):h.end=R.end)},y=[];if(f.length>0){const R=f.flatMap(({fqn:b})=>V7(b,i,a));y.push(Xt.insert(o,`
1141
+ `+R.join(`
1142
+ `))),h.start={line:o.line+1,character:a},h.end={line:o.line+R.length,character:Vc(R)?.length??0}}if(d.length>0)for(const{rule:R}of d){const b=R.$cstNode;ce(b,"RuleCstNode not found");for(const[v,T]of Yo(i)){const _=v==="opacity"?T.toString()+"%":T,N=R.props.find(B=>B.key===v);if(N&&N.$cstNode){const{range:{start:B,end:W}}=N.$cstNode;p({start:B,end:W}),y.push(Xt.replace({start:B,end:W},v+" "+_));continue}const F=H7(b,"{")?.range.end;ce(F,"Opening brace not found");const P=" ".repeat(2+b.range.start.character),G=P+v+" "+_;y.push(Xt.insert(F,`
1143
+ `+G)),p({start:{line:F.line+1,character:P.length},end:{line:F.line+1,character:G.length}})}}return{modifiedRange:h,edits:y}}const{findNodeForProperty:X7,findNodeForKeyword:J7}=dd;function Q7(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=b7(r),o=n.body.rules.findLast(Vh);if(o&&o.$cstNode){const l=X7(o.$cstNode,"direction");return l?Xt.replace(l.range,s):Xt.replace(o.$cstNode.range,`autoLayout ${s}`)}const a=J7(n.body.$cstNode,"}")?.range.start;ce(a,"Closing brace not found");const c=` autoLayout ${s}
1144
+ `+" ".repeat(a.character);return Xt.insert(a,c)}function Z7(t,{viewAst:e,layout:n}){ce(e.$cstNode,"invalid view.$cstNode");const r=zu(e.$cstNode,["BLOCK_COMMENT"]);let i=W7(n);return e.$cstNode.range.start.character>0&&(i=$G(i,e.$cstNode.range.start.character)),r?Xt.replace(r.range,i.trimStart()):Xt.insert({line:e.$cstNode.range.start.line,character:0},i+`
1145
+ `)}class eV{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 c=await n.workspace.applyEdit({label:`LikeC4 - change view ${e.viewId}`,edit:{changes:{[a.uri]:s}}});if(!c.applied){n.window.showErrorMessage(`Failed to apply changes ${c.failureReason}`);return}r={uri:a.uri,range:o}})}catch(i){Me.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,...Y7(this.services,{...r,targets:n.targets,style:n.style})};case"change-autolayout":{const s=Q7(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:s.range,edits:[s]}}case"save-manual-layout":const i=Z7(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:i.range,edits:[i]};default:Se(n)}}}class tV extends O${async computeExports(e,n){const r=[];try{const{specifications:i,models:s,views:o,likec4lib:a}=e.parseResult.value;this.exportLibrary(a,r,e),this.exportSpecification(i,r,e),this.exportModel(s,r,e),this.exportViews(o,r,e)}catch(i){qt(i)}return r}exportViews(e,n,r){if(!(Rt(e)||e.length===0))for(const i of e.flatMap(s=>s.views))try{Q(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){qt(s)}}exportModel(e,n,r){if(!(Rt(e)||e.length===0))for(const i of e.flatMap(s=>s.elements))try{Ir(i)&&Q(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){qt(s)}}exportLibrary(e,n,r){if(!Rt(e))try{for(const i of e.flatMap(s=>s.icons))n.push(this.descriptions.createDescription(i,i.name,r))}catch(i){qt(i)}}exportSpecification(e,n,r){if(!(Rt(e)||e.length===0))for(const i of e.flatMap(s=>[...s.elements,...s.relationships,...s.tags,...s.colors]))try{switch(!0){case la(i):{Q(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r));continue}case zh(i):{Q(i.tag.name)&&n.push(this.descriptions.createDescription(i.tag,"#"+i.tag.name,r));continue}case da(i):{Q(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 Gh(i):{Q(i.name.name)&&n.push(this.descriptions.createDescription(i.name,i.name.name,r));continue}default:Se(i)}}catch(s){qt(s)}}computeLocalScopes(e,n){return new Promise(r=>{const i=e.parseResult.value,s=new Sr;for(const o of i.models)try{const a=this.processContainer(o,s,e);s.addAll(i,a.values())}catch(a){qt(a)}r(s)})}processContainer(e,n,r){const i=new Sr,s=new Sr;for(const o of e.elements){if(Xi(o))continue;let a;if(Ir(o)?(Q(o.name)&&i.add(o.name,this.descriptions.createDescription(o,o.name,r)),a=o.body):ia(o)&&(a=o.body),a&&a.elements.length>0)try{const c=this.processContainer(a,n,r);for(const[l,u]of c)s.add(l,u)}catch(c){qt(c)}}if(s.size>0)for(const[o,a]of s.entriesGroupedByKey())!i.has(o)&&a.length===1&&i.add(o,a[0]);return n.addAll(e,i.values()),i}}const{getDocument:nV}=rd;class rV extends j${fqnIndex;constructor(e){super(e),this.fqnIndex=e.likec4.FqnIndex}directChildrenOf(e){return this.fqnIndex.directChildrenOf(e)}uniqueDescedants(e){return new St(()=>{const n=e(),r=n&&this.fqnIndex.getFqn(n);return r?this.fqnIndex.uniqueDescedants(r).iterator():null},n=>n?n.next():jt)}scopeElementRef(e){return this.uniqueDescedants(()=>e.el.ref)}scopeExtendElement({element:e}){return Le([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>pn(e)))}scopeElementView({viewOf:e,extends:n}){return e?Le([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>pn(e))):n?Le([n]).flatMap(r=>{const i=r.view.ref;return i?this.scopeElementView(i):mo}):mo}getScope(e){try{const n=this.reflection.getReferenceType(e);if(n!==Ar)return this.getGlobalScope(n);try{const r=e.container;if(JC(r)&&e.property==="el"){const i=r.parent;return i?new jc(this.directChildrenOf(Kh(i))):this.getGlobalScope(n)}if(yl(r)&&e.property==="el"){const i=r.parent;if(i)return new jc(this.scopeElementRef(i));if(e.reference.$refText==="this"||e.reference.$refText==="it"){const s=rn(r,Ir);return s?new D$([this.descriptions.createDescription(s,e.reference.$refText)]):L$}}return this.computeScope(e)}catch(r){return Re.warn(r),this.getGlobalScope(n)}}catch(n){return Re.warn(n),L$}}computeScope(e){const n=this.reflection.getReferenceType(e);ce(n===Ar,"Invalid reference type");const r=[],i=nV(e.container).precomputedScopes;if(i){const s=a=>this.reflection.isSubtype(a.type,n);let o=e.container;for(;o;){const a=i.get(o).filter(s);a.length>0&&r.push(Le(a)),Mv(o)&&r.push(this.scopeExtendElement(o.$container)),Dv(o)&&r.push(this.scopeElementView(o.$container)),o=o.$container}}return r.reduceRight((s,o)=>this.createScope(o,s),this.getGlobalScope(n))}getGlobalScope(e){return new jc(this.indexManager.allElements(e))}}class iV{constructor(e){this.services=e}disposables=[];init(){const e=this.services.likec4.ModelBuilder,n=this.services.likec4.ModelLocator,r=this.services.likec4.ModelChanges,i=this.services.shared.lsp.Connection;if(!i){Re.info("[ServerRpc] no connection, not initializing");return}Re.info("[ServerRpc] init");const s=this.services.shared.workspace.LangiumDocuments,o=this.services.shared.workspace.DocumentBuilder,a=mG(()=>void i.sendNotification(wz,"").catch(l=>(Re.error(`[ServerRpc] error sending onDidChangeModel: ${l}`),Promise.resolve())),{timing:"both",waitMs:350,maxWaitMs:1e3});let c=!0;this.disposables.push(Ls.create(()=>{a.cancel()}),e.onModelParsed(()=>a.call()),i.onRequest(Tz,async l=>({model:await e.buildComputedModel(l)})),i.onRequest(bz,async l=>({model:await e.buildModel(l)})),i.onRequest(Ez,async({viewId:l},u)=>({view:await e.computeView(l,u)})),i.onRequest(Rz,async({docs:l},u)=>{const d=l.map(p=>Jt.parse(p)),f=p=>d.every(y=>!On.equals(y,p)),h=s.all.filter(p=>Yh(p)&&f(p.uri)&&p.uri.scheme!==nC).map(p=>p.uri).toArray();Re.debug(`[ServerRpc] received request to build:
1146
+ changed (total ${d.length}):${l.map(p=>`
1147
+ - `+p).join("")}
1148
+ deleted (total ${h.length}):${h.map(p=>`
1149
+ - `+p.toString()).join(`
1150
+ `)}`),!c&&d.length+h.length>0&&(await Promise.allSettled([...d,...h].map(async p=>{const y=p.toString();Re.debug(`clear diagnostics for ${y}`);try{await i.sendDiagnostics({uri:y,diagnostics:[]})}catch(R){Re.warn(`error clearing diagnostics for ${y}: ${R}`)}})),await Pt(u)),c=!1,await o.update(d,h,u)}),i.onRequest(Sz,l=>{if("element"in l)return n.locateElement(l.element,l.property??"name");if("relation"in l)return n.locateRelation(l.relation);if("view"in l)return n.locateView(l.view);Se(l)}),i.onRequest($z,async(l,u)=>await r.applyChange(l)))}dispose(){let e;for(;e=this.disposables.pop();)try{e.dispose()}catch(n){qt(n)}}}class sV{constructor(e){this.services=e}getSymbolKind(e){const n=ct(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Ar,ra):return Qn.Constructor;case r(sa,oa,fa):return Qn.Namespace;case r(qs):return Qn.Class;case r(Qi,zs,Gs,ha):return Qn.EnumMember;case r(Ji,ua):return Qn.Event;case r(Ki,ca):return Qn.TypeParameter}return Qn.Field}getCompletionItemKind(e){const n=ct(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Gs):return Er.Color;case r(Ar,ra):return Er.Constructor;case r(sa,oa,fa):return Er.Module;case r(qs):return Er.Class;case r(Qi,zs,Gs,ha):return Er.EnumMember;case r(Ji,ua):return Er.Event;case r(Ki,ca):return Er.TypeParameter;default:return Er.Reference}}}class oV extends q${documentFactory;constructor(e){super(e),this.documentFactory=e.workspace.LangiumDocumentFactory}async loadAdditionalDocuments(e,n){await super.loadAdditionalDocuments(e,n),n(this.documentFactory.fromString(yz,Jt.parse(vz)))}workspace(){return this.folders&&rT(this.folders,1)?this.folders[0]:null}get workspaceUri(){const e=this.workspace();return ce(e,"Workspace not initialized"),Jt.parse(e.uri)}get workspaceURL(){const e=this.workspace();return ce(e,"Workspace not initialized"),new URL(e.uri)}}class aV extends C_{}const cV=t=>(e,n)=>{const r=vA(e.value);switch(!0){case $h(r):case _h(r):case ga(r):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:e});return}}},lV=t=>{const e=t.likec4.FqnIndex;return(n,r)=>{try{const i=pn(n.source),s=i&&e.getFqn(i);s||r("error","Source not found (not parsed/indexed yet)",{node:n,property:"source"});const o=pn(n.target),a=o&&e.getFqn(o);a||r("error","Target not found (not parsed/indexed yet)",{node:n,property:"target"}),s&&a&&(fr(s,a)||fr(a,s))&&r("error","Invalid parent-child relationship",{node:n})}catch(i){qt(i)}}},Qh=["this","it","self","super","likec4lib"];function Zh(t){return async(e,n,r)=>{r&&await Pt(r);try{await t(e,n,r)}catch(i){mt(i)}}}const{getDocument:uV}=rd,dV=t=>{const e=t.likec4.FqnIndex,n=t.workspace.AstNodeLocator;return Zh((r,i)=>{const s=e.getFqn(r);if(!s){i("error","Not indexed element",{node:r,property:"name"});return}Qh.includes(r.name)&&i("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const o=uV(r).uri,a=n.getAstNodePath(r),c=e.byFqn(s).filter(l=>l.documentUri!==o||l.path!==a).head();if(c){const l=c.documentUri!==o;i("error",`Duplicate element name ${r.name!==s?r.name+" ("+s+")":r.name}`,{node:r,property:"name",...l&&{relatedInformation:[{location:{range:c.nameSegment?.range??c.selectionSegment?.range,uri:c.documentUri.toString()},message:"conflicting element"}]}})}})},fV=t=>(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"})},hV=t=>(e,n)=>{const r=e.$container;r.props.some(i=>Yi(i)&&i!==e)&&n("error","Icon must be defined once",{node:e}),bl(r)&&ta(r.$container)&&r.$container.props.some(i=>Yi(i))&&n("warning","Redundant as icon defined on element",{node:e})},pV=t=>(e,n)=>{Ng(e,Pv)||n("error","Notes can be defined only inside dynamic view",{node:e})},gV=t=>{const e=t.likec4.FqnIndex;return Zh((n,r)=>{const i=pn(n.target),s=i&&e.getFqn(i);s||r("error","Target not resolved",{node:n,property:"target"});let o;if(Ct(n.source)){if(o=pn(n.source),!o)return r("error","Source not resolved",{node:n,property:"source"})}else{if(!ta(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&&Uu(a,s)&&r("error","Invalid parent-child relationship",{node:n})})},mV=t=>Zh((e,n)=>{e.$container.tags?.values&&e.tags?.values&&n("error","Relation cannot have tags in both header and body",{node:e.tags})}),yV=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one specification per document",{node:e,property:"name"})},vV=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one model per document",{node:e,property:"name"})},wV=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one views block per document",{node:e,property:"name"})},bV=t=>{const e=t.shared.workspace.IndexManager;return Zh((n,r)=>{Qh.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=e.allElements(Ki).filter(s=>s.name===n.name&&s.node!==n).head();if(i){const s=i.documentUri!==At(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"}]}})}})},TV=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{const i="#"+n.name,s=e.allElements(Qi).filter(o=>o.name===i&&o.node!==n).head();if(s){const o=s.documentUri!==At(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"}]}})}}},EV=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{Qh.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(Ji).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate RelationshipKind '${n.name}'`,{node:n,property:"name"})}},RV=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{n.name&&(Qh.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"}))}},SV=t=>(e,n)=>{const r=rn(e,Cv);Ih(r)&&n("error",'Invalid usage inside "exclude"',{node:e});const i=Nv(e.subject)?e.subject.subject:e.subject;switch(!0){case yl(i):case xv(i):case XC(i):case ga(i):return;case $h(i):case _h(i):n("error","Invalid target (expect reference to specific element)",{node:e,property:"subject"});return;default:Se(i)}},$V=t=>(e,n)=>{Ng(e,kv)&&n("warning","Redundant usage, expand predicate resolves parent element only when used in relations",{node:e})},kV=t=>(e,n)=>{if(ga(e.to)&&!jv(e.$container)){const r=rn(e,Ch);Rt(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}},_V=t=>(e,n)=>{if(ga(e.from)&&!Av(e.$container)){const r=rn(e,Ch);Rt(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}},CV=t=>(e,n)=>{const r=rn(e,Cv);Ih(r)&&n("error",'Invalid usage inside "exclude"',{node:e})};function AV(t){Re.info("registerValidationChecks"),t.validation.ValidationRegistry.register({NotesProperty:pV(),OpacityProperty:fV(),IconProperty:hV(),SpecificationRule:yV(),Model:vV(),ModelViews:wV(),DynamicViewStep:lV(t),LikeC4View:RV(t),Element:dV(t),ElementKind:bV(t),Relation:gV(t),RelationBody:mV(),Tag:TV(t),DynamicViewPredicateIterator:cV(),ElementPredicateWith:SV(),RelationPredicateWith:CV(),ExpandElementExpression:$V(),RelationshipKind:EV(t),IncomingRelationExpression:kV(),OutgoingRelationExpression:_V()});const e=t.shared.lsp.Connection;e&&t.shared.workspace.DocumentBuilder.onUpdate((n,r)=>{for(const i of r)Re.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]})})}function IV(t,e){return[t,e]=SA(t,e)>0?[e,t]:[t,e],PV(t.range,e.range.start)}function SA(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 PV(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 $A(t){return t.range.start.line!=t.range.end.line}const ee={newLine:qi.newLine({allowMore:!0}),oneSpace:qi.oneSpace(),noSpace:qi.noSpace(),indent:qi.indent({allowMore:!0}),noIndent:qi.noIndent()};class xV extends pW{format(e){this.removeIndentFromTopLevelStatements(e),this.indentContentInBraces(e),this.formatSpecificationRule(e),this.formatElementDeclaration(e),this.formatRelation(e),this.formatView(e),this.formatViewRuleStyle(e),this.formatIncludeExcludeExpressions(e),this.formatWhereExpression(e),this.formatWithPredicate(e),this.formatLeafProperty(e),this.formatMetadataProperty(e),this.formatAutolayoutProperty(e),this.formatLinkProperty(e),this.formatNavigateToProperty(e),this.formatTags(e)}formatTags(e){this.on(e,Kv,(n,r)=>{r.cst(bo(n.$cstNode,"values").slice(1)).prepend(ee.oneSpace),r.keywords(",").prepend(ee.noSpace).append(ee.oneSpace)})}formatRelation(e){this.on(e,Xi,(n,r)=>{r.property("source").append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace),r.properties("target","title","technology","tags").prepend(ee.oneSpace)}),this.on(e,Pv,(n,r)=>{r.properties("source").append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace),r.properties("target","title").prepend(ee.oneSpace)}),this.on(e,Av)?.property("target").prepend(ee.oneSpace),this.on(e,Gv,(n,r)=>{r.property("from").append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace)}),this.on(e,QC)?.keywords("->").append(ee.oneSpace),this.on(e,jv)?.property("inout").append(ee.oneSpace)}removeIndentFromTopLevelStatements(e){(Bv(e)||Vv(e)||qv(e)||ZC(e))&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib").prepend(ee.noIndent)}indentContentInBraces(e){if(ZC(e)||Vv(e)||la(e)||da(e)||Bv(e)||ta(e)||Mv(e)||nA(e)||Hv(e)||t7(e)||qv(e)||Dv(e)||VC(e)||pa(e)||VH(e)||KH(e)||bl(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||!IV(o,a))&&n.cst([a]).prepend(ee.indent),o=a;r.prepend(ee.noIndent).prepend(ee.oneSpace),i.prepend(ee.noIndent).prepend(qi.newLine({allowMore:!0}))}}appendKeywordsWithSpace(e){this.on(e,QH)?.keywords("element").append(ee.oneSpace)}formatView(e){this.on(e,Ch,(n,r)=>{(n.extends||n.viewOf||n.name)&&r.keywords("view").append(ee.oneSpace),r.keywords("of","extends").surround(ee.oneSpace)}),this.on(e,YH)?.keywords("dynamic","view").append(ee.oneSpace)}formatLeafProperty(e){if(Ov(e)||Bh(e)||r7(e)||aa(e)||iA(e)||sA(e)||Ws(e)||Al(e)||al(e)||Yi(e)||qh(e)||mh(e)||Lh(e)){const n=this.getNodeFormatter(e);n.keywords("title","description","technology","notation","color","line","head","tail","icon","shape","border","opacity").append(ee.oneSpace),n.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),n.keyword(";").prepend(ee.noSpace).append(ee.newLine)}}formatLinkProperty(e){this.on(e,Oh,(n,r)=>{r.keyword("link").append(ee.oneSpace),r.property("value").append(ee.oneSpace),r.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),r.keyword(";").prepend(ee.noSpace).append(ee.newLine)})}formatNavigateToProperty(e){this.on(e,Wv)?.property("key").append(ee.oneSpace)}formatAutolayoutProperty(e){this.on(e,Vh)?.keyword("autoLayout").append(ee.oneSpace)}formatMetadataProperty(e){this.on(e,e7,(n,r)=>{r.property("key").append(ee.oneSpace),r.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),r.keyword(";").prepend(ee.noSpace).append(ee.newLine)})}formatElementDeclaration(e){this.on(e,Ir,(n,r)=>{const i=mn(n.$cstNode,"kind"),s=mn(n.$cstNode,"name");s&&i&&(SA(s,i)>0?r.cst([i]).append(ee.oneSpace):(r.cst([s]).append(ee.oneSpace),r.cst([i]).prepend(ee.oneSpace))),r.properties("props").prepend(ee.oneSpace)})}formatSpecificationRule(e){if((la(e)||da(e)||zh(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag").append(ee.oneSpace),Gh(e)){const n=this.getNodeFormatter(e);n.keyword("color").append(ee.oneSpace),n.property("name").append(ee.oneSpace)}}formatWithPredicate(e){const n=this.getNodeFormatter(e);(kh(e)||zv(e))&&n.keyword("with").prepend(ee.oneSpace)}formatViewRuleStyle(e){this.on(e,pa)?.keyword("style").append(ee.oneSpace),this.on(e,JH)?.keyword(",").prepend(ee.noSpace).append(ee.oneSpace)}formatWhereExpression(e){if((MH(e)||OH(e))&&this.getNodeFormatter(e).keyword("where").append(ee.oneSpace),(zH(e)||WH(e))&&this.getNodeFormatter(e).property("operator").surround(ee.oneSpace),(aA(e)||lA(e))&&this.getNodeFormatter(e).keyword("not").append(ee.oneSpace),GC(e)||o7(e)||s7(e)||HC(e)||a7(e)||cA(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(ee.oneSpace),n.property("not").surround(ee.oneSpace)}}formatIncludeExcludeExpressions(e){if(Rv(e)||Fv(e)||Ih(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!$A(e.$cstNode))&&n.keywords("include","exclude").append(ee.oneSpace)}if(YC(e)||tA(e)||tA(e)){const n=this.getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&$A(r?.$cstNode);i&&n.property("value").prepend(ee.indent),n.keyword(",").prepend(ee.noSpace).append(i?ee.newLine:ee.oneSpace)}}findPredicateExpressionRoot(e){let n=e.$container;for(;;){if(!n||Rv(n)||Fv(n)||Ih(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}}const NV={lsp:{NodeKindProvider:t=>new sV(t),WorkspaceSymbolProvider:t=>new aV(t)},workspace:{WorkspaceManager:t=>new oV(t)}};function Wt(t){return e=>new t(e)}const OV={WorkspaceCache:t=>new F$(t.shared),Rpc:Wt(iV),likec4:{ModelChanges:Wt(eV),FqnIndex:Wt(P7),ModelParser:Wt(z7),ModelBuilder:Wt(M7),ModelLocator:Wt(U7)},lsp:{CompletionProvider:Wt(E7),DocumentHighlightProvider:Wt(R7),DocumentSymbolProvider:Wt($7),SemanticTokenProvider:Wt(_7),HoverProvider:Wt(k7),CodeLensProvider:Wt(T7),DocumentLinkProvider:Wt(S7),Formatter:Wt(xV)},references:{ScopeComputation:Wt(tV),ScopeProvider:Wt(rV)}};function DV(t,e,n,r){const i=LV(t),s=[uW({shared:i}),d7,OV,e,n,r].reduce(kA,{}),o=uf(s);return i.ServiceRegistry.register(o),AV(o),t.connection?o.Rpc.init():i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:o}}function LV(t={}){const e={...ik,...t};return t.connection&&(xH(t.connection),PH(t.connection)),uf(fW(e),u7,NV)}function kA(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]=kA(i,r):t[n]=r}}return t}function _A(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function tw(t){return typeof t=="object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function CA(t){return tw(t)||_A(t)}function ou(t){return typeof t=="string"||CA(t)}function MV(t){return Array.isArray(t)&&t.every(ou)}function FV(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function AA(t){if(CA(t))return t;const[e,n,r]=t.split(":");return FV(r)?{id:e,port:n,compass:r}:{id:e,port:n}}function jV(t){if(t.length<2&&(ou(t[0])&&ou(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.map(e=>AA(e))}const ep=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function UV(t){return Object.assign(Object.seal(Object.assign({},ep)),t)}function BV(...t){const[e,...n]=t;return(...r)=>n.reduce((i,s)=>s(i),e(...r))}function Un(t,...e){return BV(t,...e)}const qV=t=>(...e)=>n=>t(n,...e),WV=t=>({[Symbol.iterator]:t}),rr=qV((t,e)=>Array.from(WV(function*(){for(const n of t)yield e(n)})));class IA{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 Ie=IA.prototype.createElement.bind(new IA),GV=/\r?\n/;function ir(t){return e=>e.join(t)}function zV(t){return e=>t+e+t}function Zi(t,e){return n=>t+n+e}function tp(t){return e=>t+e}const PA=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),np=t=>t.split(GV),au=(t,e,n)=>Un(np,rr(tp(t==="space"?" ".repeat(e):`
1151
+ `)),ir(n)),Vs=t=>{switch(t){case"crlf":return`\r
1152
+ `;case"lf":return`
1153
+ `}},HV={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const n=Vs(t.endOfLine);return Un(rr(t.print),ir(n),au(t.indentStyle,t.indentSize,n),Zi(`${e.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(e.children)}},VV={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},KV={match(t){return t.type==="Comment"},print(t,e){const n=Vs(t.endOfLine);switch(e.kind){case"Block":return Un(np,rr(tp(" * ")),ir(n),Zi(`/**${n}`,`${n} */`))(e.value);case"Macro":return Un(np,rr(tp("# ")),ir(n))(e.value);case"Slash":default:return Un(np,rr(tp("// ")),ir(n))(e.value)}}},YV={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join(Vs(t.endOfLine))}},XV={match(t){return t.type==="Edge"},print(t,e){const n=Un(rr(t.print),ir(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${n};`;const r=Vs(t.endOfLine),i=Un(rr(t.print),ir(r),au(t.indentStyle,t.indentSize,r),Zi(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},JV={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=Vs(t.endOfLine),i=Un(rr(t.print),ir(r),au(t.indentStyle,t.indentSize,r),Zi(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},QV=Un(PA,zV('"')),ZV=Zi("<",">"),eK={match(t){return t.type==="Literal"},print(t,e){switch(e.quoted){case"html":return ZV(e.value);case!0:return QV(e.value);case!1:default:return PA(e.value)}}},tK={match(t){return t.type==="Node"},print(t,e){const n=t.print(e.id);if(e.children.length===0)return`${n};`;const r=Vs(t.endOfLine),i=Un(rr(t.print),ir(r),au(t.indentStyle,t.indentSize,r),Zi(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},nK={match(t){return t.type==="NodeRefGroup"},print(t,e){return Un(rr(t.print),ir(" "),Zi("{","}"))(e.children)}},rK={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(":")}},iK={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=Vs(t.endOfLine),i=Un(rr(t.print),ir(r),au(t.indentStyle,t.indentSize,r),Zi(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},sK=[HV,VV,KV,YV,XV,JV,eK,tK,nK,rK,iK];class oK{options;#e=[...sK];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 c of n)if(c.match(a))return c.print(o,a);throw Error()}};return o.print(e)}}function aK(t,e){const n=new oK(e).print(t);if(!n)throw new Error;return n}function rp(t,e){if(typeof e=="string"){const n=e.trim();return/^<.+>$/ms.test(n)?Ie("Attribute",{key:Ie("Literal",{value:t,quoted:!1},[]),value:Ie("Literal",{value:n.slice(1,n.length-1),quoted:"html"},[])},[]):Ie("Attribute",{key:Ie("Literal",{value:t,quoted:!1},[]),value:Ie("Literal",{value:e,quoted:!0},[])},[])}return Ie("Attribute",{key:Ie("Literal",{value:t,quoted:!1},[]),value:Ie("Literal",{value:String(e),quoted:!1},[])},[])}function Ks(t,e){return Ie("Comment",{kind:e,value:t},[])}function xA(t,e){return Array.from(function*(){for(const[n,r]of e.values)yield rp(n,r);for(const n of Object.values(e.attributes))n.size>0&&(n.comment&&(yield Ks(n.comment,t.commentKind)),yield t.convert(n));for(const n of e.nodes)n.comment&&(yield Ks(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.subgraphs)n.comment&&(yield Ks(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.edges)n.comment&&(yield Ks(n.comment,t.commentKind)),yield t.convert(n)}())}const cK={match(t){return t.$$type==="AttributeList"},convert(t,e){return Ie("AttributeList",{kind:e.$$kind},e.values.map(([n,r])=>rp(n,r)))}},lK={match(t){return t.$$type==="Edge"},convert(t,e){return Ie("Edge",{targets:e.targets.map(n=>tw(n)?Ie("NodeRef",{id:Ie("Literal",{value:n.id,quoted:!0},[])},[]):_A(n)?Ie("NodeRef",{id:Ie("Literal",{value:n.id,quoted:!0},[]),port:n.port?Ie("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?Ie("Literal",{value:n.compass,quoted:!0},[]):void 0},[]):Ie("NodeRefGroup",{},n.map(r=>tw(r)?Ie("NodeRef",{id:Ie("Literal",{value:r.id,quoted:!0},[])},[]):Ie("NodeRef",{id:Ie("Literal",{value:r.id,quoted:!0},[]),port:r.port?Ie("Literal",{value:r.port,quoted:!0},[]):void 0,compass:r.compass?Ie("Literal",{value:r.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[Ks(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>rp(n,r))])}},uK={match(t){return t.$$type==="Graph"},convert(t,e){return Ie("Dot",{},[...e.comment?[Ks(e.comment,t.commentKind)]:[],Ie("Graph",{directed:e.directed,strict:e.strict,id:e.id?Ie("Literal",{value:e.id,quoted:!0},[]):void 0},xA(t,e))])}},dK={match(t){return t.$$type==="Node"},convert(t,e){return Ie("Node",{id:Ie("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[Ks(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>rp(n,r))])}},fK={match(t){return t.$$type==="Subgraph"},convert(t,e){return Ie("Subgraph",{id:e.id?Ie("Literal",{value:e.id,quoted:!0},[]):void 0},xA(t,e))}},hK=[cK,lK,dK,uK,fK];class pK{options;#e=[...hK];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 gK(t,e){return new pK(e).convert(t)}const D=new Proxy(Object.freeze({}),{get:(t,e)=>e});class nw{}class rw extends nw{#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 iw extends rw{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,n){super(n),this.$$kind=e}}class NA extends rw{#e=ep;id;comment;attributes=Object.freeze({graph:new iw("Graph"),edge:new iw("Edge"),node:new iw("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=UV(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=>MV(s)?jV(s):AA(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 OA extends NA{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 mK extends OA{get directed(){return!0}}class yK extends OA{get directed(){return!1}}class vK extends NA{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 DA extends rw{comment}let wK=class extends nw{id;get $$type(){return"Node"}comment;attributes;constructor(e,n){super(),this.id=e,this.attributes=new DA(n)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class bK extends nw{targets;get $$type(){return"Edge"}comment;attributes;constructor(e,n){if(super(),this.targets=e,e.length<2&&(ou(e[0])&&ou(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new DA(n)}}Object.assign(ep,{Graph:yK,Digraph:mK,Subgraph:vK,Node:wK,Edge:bK});function LA(t,e){return(...n)=>{const r=t?this.Digraph:this.Graph,i=n.find(c=>typeof c=="string"),s=n.find(c=>typeof c=="object"),o=n.find(c=>typeof c=="function"),a=new r(i,e,s);return a.with(this),typeof o=="function"&&o(a),a}}function MA(t,e=ep){return Object.freeze({digraph:LA.call(e,!0,t),graph:LA.call(e,!1,t)})}const FA=MA(!1),TK=FA.digraph;FA.graph;const EK=MA(!0);function jA(t,e){const n=gK(t,e?.convert);return aK(n,e?.print)}function RK(t){let e=t.length-1,n=t[e];for(;n===" "||n===" ";)n=t[--e];return t.substring(0,e+1)}function SK(t){return t.split(`
1154
+ `).map(r=>RK(r)).join(`
1155
+ `)}var $K=function(t,e){if(e=e||{},t==null)return t;var n=e.width||50,r=typeof e.indent=="string"?e.indent:" ",i=e.newline||`
1156
+ `+r,s=typeof e.escape=="function"?e.escape:kK,o=".{1,"+n+"}";e.cut!==!0&&(o+="([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)");var a=new RegExp(o,"g"),c=t.match(a)||[],l=r+c.map(function(u){return u.slice(-1)===`
1157
+ `&&(u=u.slice(0,u.length-1)),s(u)}).join(i);return e.trim===!0&&(l=SK(l)),l};function kK(t){return t}const _K=Ro($K),ip={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 ip.hue2rgb(s,i,t+1/3)*255;case"g":return ip.hue2rgb(s,i,t)*255;case"b":return ip.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,c=o>.5?a/(2-i-s):a/(i+s);if(r==="s")return c*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}}},CK={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},AK={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},ge={channel:ip,lang:CK,unit:AK},es={};for(let t=0;t<=255;t++)es[t]=ge.unit.dec2hex(t);const Gt={ALL:0,RGB:1,HSL:2};class IK{constructor(){this.type=Gt.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=Gt.ALL}is(e){return this.type===e}}class PK{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new IK}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=Gt.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=ge.channel.rgb2hsl(e,"h")),r===void 0&&(e.s=ge.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=ge.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=ge.channel.hsl2rgb(e,"r")),r===void 0&&(e.g=ge.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=ge.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(Gt.HSL)&&n!==void 0?n:(this._ensureHSL(),ge.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(Gt.HSL)&&n!==void 0?n:(this._ensureHSL(),ge.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(Gt.HSL)&&n!==void 0?n:(this._ensureHSL(),ge.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(Gt.RGB)&&n!==void 0?n:(this._ensureRGB(),ge.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(Gt.RGB)&&n!==void 0?n:(this._ensureRGB(),ge.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(Gt.RGB)&&n!==void 0?n:(this._ensureRGB(),ge.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Gt.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Gt.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(Gt.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Gt.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Gt.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Gt.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const sw=new PK({r:0,g:0,b:0,a:0},"transparent"),ma={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(ma.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,c=o?8:4,l=s?0:-1,u=o?255:15;return sw.set({r:(r>>c*(l+3)&u)*a,g:(r>>c*(l+2)&u)*a,b:(r>>c*(l+1)&u)*a,a:s?(r&u)*a/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${es[Math.round(e)]}${es[Math.round(n)]}${es[Math.round(r)]}${es[Math.round(i*255)]}`:`#${es[Math.round(e)]}${es[Math.round(n)]}${es[Math.round(r)]}`}},Ys={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(Ys.hueRe);if(e){const[,n,r]=e;switch(r){case"grad":return ge.channel.clamp.h(parseFloat(n)*.9);case"rad":return ge.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return ge.channel.clamp.h(parseFloat(n)*360)}}return ge.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(Ys.re);if(!n)return;const[,r,i,s,o,a]=n;return sw.set({h:Ys._hue2deg(r),s:ge.channel.clamp.s(parseFloat(i)),l:ge.channel.clamp.l(parseFloat(s)),a:o?ge.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(${ge.lang.round(e)}, ${ge.lang.round(n)}%, ${ge.lang.round(r)}%, ${i})`:`hsl(${ge.lang.round(e)}, ${ge.lang.round(n)}%, ${ge.lang.round(r)}%)`}},cu={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=cu.colors[t];if(e)return ma.parse(e)},stringify:t=>{const e=ma.stringify(t);for(const n in cu.colors)if(cu.colors[n]===e)return n}},lu={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(lu.re);if(!n)return;const[,r,i,s,o,a,c,l,u]=n;return sw.set({r:ge.channel.clamp.r(i?parseFloat(r)*2.55:parseFloat(r)),g:ge.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:ge.channel.clamp.b(c?parseFloat(a)*2.55:parseFloat(a)),a:l?ge.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${ge.lang.round(e)}, ${ge.lang.round(n)}, ${ge.lang.round(r)}, ${ge.lang.round(i)})`:`rgb(${ge.lang.round(e)}, ${ge.lang.round(n)}, ${ge.lang.round(r)})`}},ts={format:{keyword:cu,hex:ma,rgb:lu,rgba:lu,hsl:Ys,hsla:Ys},parse:t=>{if(typeof t!="string")return t;const e=ma.parse(t)||lu.parse(t)||Ys.parse(t)||cu.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Gt.HSL)||t.data.r===void 0?Ys.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?lu.stringify(t):ma.stringify(t)},xK=(t,e)=>{const n=ts.parse(t);for(const r in e)n[r]=ge.channel.clamp[r](e[r]);return ts.stringify(n)},UA=t=>ts.format.hex.stringify(ts.parse(t)),NK=(t,e,n)=>{const r=ts.parse(t),i=r[e],s=ge.channel.clamp[e](i+n);return i!==s&&(r[e]=s),ts.stringify(r)},OK=(t,e)=>NK(t,"a",-e),DK=(t,e)=>{const n=ts.parse(t),r={};for(const i in e)e[i]&&(r[i]=n[i]+e[i]);return xK(t,r)},LK=(t,e)=>{const n=ts.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],ge.channel.max[s]);return DK(t,r)};class MK{value;next;constructor(e){this.value=e}}class FK{#e;#t;#n;constructor(){this.clear()}enqueue(e){const n=new MK(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 sp(t){BA(t);const e=new FK;let n=0;const r=()=>{n<t&&e.size>0&&(e.dequeue()(),n++)},i=()=>{n--,r()},s=async(c,l,u)=>{const d=(async()=>c(...u))();l(d);try{await d}catch{}i()},o=(c,l,u)=>{new Promise(d=>{e.enqueue(d)}).then(s.bind(void 0,c,l,u)),(async()=>(await Promise.resolve(),n<t&&r()))()},a=(c,...l)=>new Promise(u=>{o(c,u,l)});return Object.defineProperties(a,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(c){BA(c),t=c,queueMicrotask(()=>{for(;n<t&&e.size>0;)r()})}}}),a}function BA(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 jK=sp(1);let UK=class Ip{static _graphviz=null;graphviz(){return Promise.resolve().then(()=>Ip._graphviz??=Fp.load())}async attempt(e,n){return await jK(async()=>{try{return await n()}catch(r){Me.error(r),Me.error(`FAILED GraphvizWasmAdapter: ${e}`),Fp.unload(),Ip._graphviz=null}Me.warn("Retrying..."),await lT(50);try{return await n()}finally{Fp.unload(),Ip._graphviz=null}})}async unflatten(e){return await this.attempt(`unflatten
1158
+ ${e}`,async()=>(await this.graphviz()).unflatten(e,1,!1,3).replaceAll(/\t\[/g," [").replaceAll(/\t/g," "))}async acyclic(e){return await this.attempt(`acyclic
1159
+ ${e}`,async()=>{const n=(await this.graphviz()).acyclic(e,!0);return n.acyclic&&n.outFile||e})}async layoutJson(e){return await this.attempt(`dot
1160
+ ${e}`,async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt(`svg
1161
+ ${e}`,async()=>(await this.graphviz()).layout(e,"svg"))}};function qA(t,e){const n=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:o,y:a,width:c,height:l}=s;return{...i,width:c,height:l,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 WA=(t,e)=>t.width>e.width+10||t.height>e.height+10;function BK(t,e){if(t.hash===e.hash)return{diagram:qA(t,e)};if(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||WA(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:qA(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||WA(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:Yo(e.edges).flatMap(([r,i])=>i.dotpos?{id:r,dotpos:i.dotpos}:[])}}}function Rn(t){return t.children.length>0}function Bn(t){switch(t){case"open":return"vee";default:return t}}function Pr(t){return Array.isArray(t)?[Pr(t[0]),Pr(t[1])]:(ce(isFinite(t),`Invalid not finite point value ${t}`),Math.round(t))}const GA=t=>(ce(isFinite(t),`Invalid not finite inch value ${t}`),Math.floor(t*72)),et=t=>Math.ceil(t/72*1e3)/1e3,qn=t=>Math.ceil(t);qn(40).toString();function zA(t,e){return UA(LK(t,{l:-35-5*e,s:-15-5*e}))}function qK(t){return UA(OK(t,.3))}function WK(t){return t.trim().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function ow(t,e){return _K(t,{width:e,indent:"",escape:WK}).split(`
1162
+ `)}function ns({text:t,maxchars:e,fontsize:n,bold:r,color:i}){let s=ow(t,e).map(a=>zi(a)?" ":a).join("<BR/>");r&&(s=`<B>${s}</B>`);const o=i?` COLOR="${i}"`:"";return`<FONT POINT-SIZE="${qn(n)}"${o}>${s}</FONT>`}function GK(t,e){const n=Q(t.icon),r=[ns({text:t.title,fontsize:19,maxchars:35})];if(Q(t.technology)&&r.push(ns({text:t.technology,fontsize:12,maxchars:n?35:45,color:e.loContrast})),Q(t.description)&&r.push(ns({text:t.description,fontsize:14,maxchars:n?35:45,color:e.loContrast})),r.length===1&&!n)return`<${r[0]}>`;const i=n?(s,o,a)=>{let c=`<TD ALIGN="TEXT" BALIGN="LEFT">${s}</TD>`;if(o===0){const l=a.length>1?` ROWSPAN="${a.length}"`:"";let u=76;(t.shape==="queue"||t.shape==="mobile")&&(u+=20),c=`<TD${l} WIDTH="${u}" FIXEDSIZE="TRUE"> </TD>${c}`,c=`${c}<TD${l} WIDTH="16" FIXEDSIZE="TRUE"> </TD>`}return`<TR>${c}</TR>`}:s=>`<TR><TD>${s}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="6">${r.map(i).join("")}</TABLE>>`}function zK(t,e){const n=ns({text:t.title.toUpperCase(),maxchars:50,fontsize:11,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 ya=35;function HK({label:t,description:e,technology:n}){const r=[];if(Q(t)&&r.push(ns({text:t,maxchars:ya,fontsize:14,bold:t==="[...]"})),Q(e)&&r.push(ns({text:e,maxchars:ya,fontsize:14})),Q(n)&&r.push(ns({text:n,fontsize:12,maxchars:ya})),r.length===0)return null;const i=r.map(s=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT">${s}</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${aw}>${i}</TABLE>>`}const aw=`BGCOLOR="${_n.relationships[co].labelBgColor}A0"`;function VK(t,e){const n=`<TABLE FIXEDSIZE="TRUE" BORDER="0" CELLPADDING="6" ${aw}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${qn(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return Q(e)?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${n}</TD>`,`<TD ${aw} CELLPADDING="2">`,ns({text:e,maxchars:ya,fontsize:14}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${n}>`}const HA="dashed",cw=_n.font;class VA{constructor(e){this.view=e,this.compoundIds=new Set(e.nodes.filter(Rn).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):[]);const n=this.graphvizModel=this.createGraph();this.applyNodeAttributes(n.attributes.node),this.applyEdgeAttributes(n.attributes.edge),this.buildGraphvizModel(n)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphvizModel;get hasEdgesWithCompounds(){return this.edgesWithCompounds.size>0}buildGraphvizModel(e){const n=(i,s)=>{const o=this.nodeId(i),a=this.elementToSubgraph(i,s.subgraph(o));this.subgraphs.set(i.id,a);for(const c of this.view.nodes.filter(l=>Rn(l)&&l.parent===i.id))n(c,a)},r=[];for(const i of this.view.nodes)Rn(i)?Rt(i.parent)&&n(i,e):r.push(i);for(const i of r){const s=i.parent?this.getSubgraph(i.parent):e;ce(s,"parent graph should be defined");const o=this.nodeId(i),a=this.elementToNode(i,s.node(o));this.nodes.set(i.id,a)}for(const i of this.view.edges){const s=this.addEdge(i,e);s&&this.edges.set(i.id,s)}}print(){return jA(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){this.view.autoLayout==="TB"||this.view.autoLayout;const e=TK({[D.bgcolor]:"transparent",[D.layout]:"dot",[D.compound]:!0,[D.rankdir]:this.view.autoLayout,[D.TBbalance]:"min",[D.splines]:"spline",[D.outputorder]:"nodesfirst",[D.nodesep]:et(110),[D.ranksep]:et(120),[D.pack]:qn(120),[D.packmode]:"array_3",[D.pad]:et(15),[D.forcelabels]:!0,[D.fontname]:cw});return e.attributes.graph.apply({[D.fontsize]:qn(15),[D.labeljust]:this.view.autoLayout==="RL"?"r":"l",[D.labelloc]:this.view.autoLayout==="BT"?"b":"t",[D.margin]:50.1}),e}applyNodeAttributes(e){e.apply({[D.fontname]:cw,[D.nojustify]:!0,[D.shape]:"rect",[D.width]:et(320),[D.height]:et(180),[D.style]:"filled",[D.penwidth]:0})}applyEdgeAttributes(e){e.apply({[D.nojustify]:!0,[D.arrowsize]:.75,[D.fontname]:cw,[D.fontsize]:qn(14),[D.penwidth]:qn(2),[D.color]:_n.relationships[co].lineColor,[D.fontcolor]:_n.relationships[co].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)}nodeId(e){const n=Rn(e);let r=Ia(e.id).toLowerCase(),i=this.checkNodeId(r,n);if(i!==null)return i;let s=e.id,o;for(;o=bt(s);){if(r=Ia(o).toLowerCase()+"_"+r,i=this.checkNodeId(r,n),i!==null)return i;s=o}r=Ia(e.id).toLowerCase();let a=1;do i=this.checkNodeId(r+"_"+a++,n);while(i===null);return i}elementToSubgraph(e,n){ce(Rn(e),"node should be compound"),ce(B_(e.depth),"node.depth should be defined");const r=this.getElementColorValues(e.color),i=qK(r.loContrast);return n.apply({[D.likec4_id]:e.id,[D.likec4_level]:e.level,[D.likec4_depth]:e.depth,[D.fillcolor]:zA(r.fill,e.depth),[D.color]:zA(r.stroke,e.depth),[D.style]:"filled",[D.margin]:qn(e.children.length>1?40:32),[D.label]:zK(e,i)}),n}elementToNode(e,n){ce(!Rn(e),"node should not be compound");const r=Q(e.icon),i=this.getElementColorValues(e.color);switch(n.attributes.apply({[D.likec4_id]:e.id,[D.likec4_level]:e.level,[D.fillcolor]:i.fill,[D.fontcolor]:i.hiContrast,[D.color]:i.stroke,[D.margin]:`${et(r?10:26)},${et(26)}`}),e.shape){case"cylinder":case"storage":{n.attributes.apply({[D.margin]:`${et(r?10:26)},${et(0)}`,[D.penwidth]:qn(2),[D.shape]:"cylinder"});break}case"browser":{n.attributes.apply({[D.margin]:`${et(r?10:30)},${et(32)}`});break}case"mobile":{n.attributes.apply({[D.margin]:`${et(r?10:30)},${et(26)}`});break}case"queue":{n.attributes.apply({[D.width]:et(320),[D.height]:et(165),[D.margin]:`${et(r?10:30)},${et(26)}`});break}}return n.attributes.set(D.label,GK(e,i)),n}leafElements(e){if(e===null)return this.view.nodes.filter(r=>!Rn(r));const n=e+".";return this.view.nodes.filter(r=>!Rn(r)&&r.id.startsWith(n))}viewElement(e){return at(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.viewElement(e),i=this.getGraphNode(e),s;return i||(ce(Rn(r),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,ce(s,`subgraph ${e} not found`),r=at(n(this.leafElements(e)),`leaf element in ${e} not found`),i=at(this.getGraphNode(r.id),`source graphviz node ${r.id} not found`)),[r,i,s]}hasInternalEdges(e){return e===null?this.view.edges.length>0:this.view.edges.some(cT(e))}findInternalEdges(e){return e===null?this.view.edges.slice():this.view.edges.filter(cT(e))}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=Ye(this.view.nodes,Xe(Rn),st(r=>r.id),zf(go),M_(),st(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}}),Xe(({edges:r})=>r.length>1&&r.length<8),IW(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=at(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),a=at(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);n.add(s.source),n.add(s.target),o.attributes.set(D.group,r.id),a.attributes.set(D.group,r.id)}catch(o){Me.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 c=this.getGraphNode(o);if(!c)continue;const l=et(a.center.x)+r,u=et(e-a.center.y);a.fixedsize?c.attributes.apply({[D.pos]:`${l},${u}!`,[D.pin]:!0,[D.width]:et(a.fixedsize.width),[D.height]:et(a.fixedsize.height),[D.fixedsize]:!0}):c.attributes.set(D.pos,`${l},${u}`)}for(const[o,a]of this.edges.entries()){a.attributes.delete(D.weight),a.attributes.delete(D.minlen),a.attributes.delete(D.constraint);const c=n.edges.find(l=>l.id===o)?.dotpos;c&&!s&&a.attributes.set(D.pos,c)}return this.graphvizModel.apply({[D.layout]:"fdp",[D.overlap]:"vpsc",[D.sep]:"+50,50",[D.esep]:"+10,10",[D.start]:"random2",[D.splines]:"compound"}),this.graphvizModel.delete(D.compound),this.graphvizModel.delete(D.rankdir),this.graphvizModel.delete(D.nodesep),this.graphvizModel.delete(D.ranksep),this.graphvizModel.delete(D.pack),this.graphvizModel.delete(D.pad),this.graphvizModel.delete(D.packmode),this.graphvizModel.attributes.graph.delete(D.margin),this}getRelationshipColorValues(e){return n0(e)?_n.relationships[e]:this.view.customColorDefinitions[e]?.relationships??_n.relationships[_u]}getElementColorValues(e){return n0(e)?_n.elements[e]:this.view.customColorDefinitions[e]?.elements??_n.elements[_u]}}class $b extends VA{static toDot(e){return new $b(e).print()}createGraph(){const e=super.createGraph();return e.set(D.TBbalance,"max"),e}addEdge(e,n){const{nodes:r}=this.view,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[o,a,c]=this.edgeEndpoint(i,T=>Vc(T)),[l,u,d]=this.edgeEndpoint(s,Kc),f=n.edge([a,u],{[D.likec4_id]:e.id,[D.style]:e.line??HA});if(d&&f.attributes.set(D.lhead,d),c&&f.attributes.set(D.ltail,c),e.color&&e.color!==co){const T=this.getRelationshipColorValues(e.color);f.attributes.apply({[D.color]:T.lineColor,[D.fontcolor]:T.labelColor})}const h=_r(d)||_r(c),p=c0(e.id),y=VK(p,e.label?.trim());if(f.attributes.set(D.label,y),!h){const T=new Set([...o.outEdges,...l.inEdges,...ZW(l.outEdges,o.inEdges)].filter(_=>!this.edgesWithCompounds.has(_)));f.attributes.set(D.weight,T.size)}const R=r.findIndex(T=>T.id===i);r.findIndex(T=>T.id===s)<R&&e.dir!=="back"&&f.attributes.apply({[D.constraint]:!1});let[b,v]=[e.head??ao,e.tail??"none"];return e.dir==="back"?(f.attributes.apply({[D.arrowtail]:Bn(b),[D.minlen]:0,[D.dir]:"back"}),v!=="none"&&f.attributes.apply({[D.arrowhead]:Bn(v),[D.dir]:"both"}),f):b==="none"&&v==="none"||b!=="none"&&v!=="none"?(f.attributes.apply({[D.arrowhead]:Bn(b),[D.arrowtail]:Bn(v),[D.dir]:"both"}),f):b==="none"?(f.attributes.delete(D.arrowhead),f.attributes.apply({[D.arrowtail]:Bn(v),[D.minlen]:0,[D.dir]:"back"}),f):(b!==ao&&f.attributes.set(D.arrowhead,Bn(b)),f)}}class kb extends VA{static toDot(e){return new kb(e).print()}buildGraphvizModel(e){super.buildGraphvizModel(e),this.assignGroups();const n=new Set,r=this.view.nodes.reduce((i,s)=>(Rn(s)&&(n.add(s.id),i.push(s)),i),[]);for(const i of r){const s=Ye(i.children,Xe(l=>!this.compoundIds.has(l)),st(l=>this.viewElement(l)),Xe(l=>l.inEdges.length===0&&l.outEdges.length===0));if(s.length<=2)continue;let o=2;switch(!0){case s.length>11:o=4;break;case s.length>4:o=3;break}const a=at(this.getSubgraph(i.id),`Subgraph not found for ${i.id}`);let c=null;EG(s,o).forEach(l=>{const u=l.length>1?a.createSubgraph({[D.rank]:"same"}):null;l.forEach((d,f)=>{const h=this.getGraphNode(d.id);h&&(u?.node(h.id),f===0&&(c&&a.edge([c,h],{[D.style]:"invis"}),c=h))})})}}addEdge(e,n){const r=this.view.edges,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[o,a,c]=this.edgeEndpoint(i,T=>Vc(T)),[l,u,d]=this.edgeEndpoint(s,Kc),f=e.parent,h=(f===null?n:at(this.getSubgraph(f),`Parent not found for edge ${e.id}`)).edge([a,u],{[D.likec4_id]:e.id,[D.style]:e.line??HA});d&&h.attributes.set(D.lhead,d),c&&h.attributes.set(D.ltail,c);const p=_r(d)||_r(c);if(!p){const T=new Set([...o.inEdges,...o.outEdges,...l.inEdges,...l.outEdges].filter(_=>!this.edgesWithCompounds.has(_)));h.attributes.set(D.weight,T.size)}const y=HK(e);if(y&&(p?h.attributes.set(D.xlabel,y):h.attributes.set(D.label,y)),e.color){const T=this.getRelationshipColorValues(e.color);h.attributes.apply({[D.color]:T.lineColor,[D.fontcolor]:T.labelColor})}let[R,b]=[e.head??ao,e.tail??"none"];if(e.dir==="back")return h.attributes.apply({[D.arrowtail]:Bn(R),[D.dir]:"back"}),b!=="none"&&h.attributes.apply({[D.arrowhead]:Bn(b),[D.dir]:"both",[D.minlen]:0}),h;if(R==="none"&&b==="none")return h.attributes.apply({[D.arrowtail]:"none",[D.arrowhead]:"none",[D.dir]:"none",[D.minlen]:0,[D.constraint]:!1}),h;if(R!=="none"&&b!=="none")return h.attributes.apply({[D.arrowhead]:Bn(R),[D.arrowtail]:Bn(b),[D.dir]:"both",[D.minlen]:0}),h;if(R!==ao&&h.attributes.set(D.arrowhead,Bn(R)),b!=="none"&&h.attributes.set(D.arrowtail,Bn(b)),r.length===1)return h;let v;return f===null&&o.parent==null&&l.parent==null?v=r.filter(T=>{if(T.id===e.id||T.parent!==null||T.source===e.source&&T.target===e.target||T.source===e.target&&T.target===e.source)return!1;const _=this.viewElement(T.source),N=this.viewElement(T.target);return Rn(_)||Rn(N)?!1:_.parent==null&&N.parent==null}):v=this.findInternalEdges(f).filter(T=>!(T.id===e.id||T.source===e.source&&T.target===e.target||T.source===e.target&&T.target===e.source)),v.length===0&&(f===null||this.leafElements(f).length<=3)&&h.attributes.set(D.minlen,0),h}}function op(t){const[e,n,r,i]=t?t.split(",").map(a=>Pr(+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 KK(t){try{const[e,n]=t.split(",");return{x:Pr(parseFloat(e)),y:Pr(parseFloat(n))}}catch(e){throw Me.error(`failed on parsing pos: ${t}`,e),e}}function KA({pos:t,width:e,height:n}){const{x:r,y:i}=KK(t),s=GA(+e),o=GA(+n);return{x:r-Math.round(s/2),y:i-Math.round(o/2),width:s,height:o}}function YA(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 l of t){if(l.op==="F"){a=Pr(l.size);continue}if(l.op==="T"){let u=Pr(l.pt[0])-e,d=Pr(l.width);switch(l.align){case"r":u-=d;break;case"c":u-=Math.round(d/2);break}r=Math.min(r,u),s=Math.max(s,u+d);let f=Pr(l.pt[1])-n;i=Math.min(i,Math.round(f-a)),o=Math.max(o,f)}}}catch(l){return Me.error(`Failed on parsing label draw ops: ${l}
1163
+ ${JSON.stringify(t,null,2)}`),null}if(r===1/0)return null;const c=2;return{x:r-c,y:i-c,width:s-r+2*c,height:o-i+2*c}}function XA({_draw_:t,likec4_id:e="???"},n="<unknown view>"){try{const r=t.filter(s=>s.op.toLowerCase()==="b");ce(tr(r,1),`view ${n} edge ${e} should have at least one bezier draw op`),r.length>1&&Me.warn(`view ${n} edge ${e} has more than one bezier draw op, using the first one only`);const i=r[0].points.map(s=>Pr(s));return ce(tr(i,2),`view ${n} edge ${e} should have at least two points`),i}catch(r){throw Me.error(`failed on parsing view ${n} edge ${e} _draw_:
1164
+ ${JSON.stringify(t,null,2)}`),r}}function YK(t,{id:e,source:n,target:r,dir:i,label:s,description:o,...a},c){const l=YA(t._ldraw_??t._tldraw_??t._hldraw_),u=t.dir==="back"||i==="back";return s=s?ow(s,ya).join(`
1165
+ `):null,o=o?ow(o,ya).join(`
1166
+ `):void 0,{id:e,source:n,target:r,label:s,...Q(o)&&{description:o},...Q(t.pos)&&{dotpos:t.pos},points:XA(t,c),labelBBox:l,...u?{dir:"back"}:{},...a}}function JA(t,e){const n=JSON.parse(t),r=op(n.bb),{nodes:i,edges:s,manualLayout:o,...a}=e,c={...a,bounds:r,nodes:[],edges:[]},l=n.objects??[];for(const d of i){const f=l.find(v=>v.likec4_id===d.id);ce(f,`View ${a.id} element ${d.id} not found in graphviz output`);const{x:h,y:p,width:y,height:R}="bb"in f?op(f.bb):KA(f),b=[h,p];c.nodes.push({...d,position:b,width:y,height:R,labelBBox:at(YA(f._ldraw_,b),`View ${a.id} Node ${d.id} label bbox not found`)})}const u=n.edges??[];for(const d of s){const f=u.find(h=>h.likec4_id===d.id);if(!f){Me.warn(`View ${a.id} edge ${d.id} not found in graphviz output, skipping`);continue}c.edges.push(YK(f,d,a.id))}return c}const ap=t=>String(t+1).padStart(2,"0");function XK(t){const e=JSON.parse(t),n=op(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=ap(o._gvid),c=o.likec4_path??"",l=i.get(o._gvid),{x:u,y:d,width:f,height:h}="bb"in o?op(o.bb):KA(o),p={x:u,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:l?.id??null,height:h,width:f,position:p,label:o.label??"",viewId:o.likec4_id});else{const y={id:a,type:o.likec4_type,parentId:l?.id??null,height:h,width:f,position:p,path:c,label:o.label??""},R=[..."subgraphs"in o?o.subgraphs:[],..."nodes"in o?o.nodes:[]];for(const b of R)i.set(b,y);r.nodes.push(y)}}for(const o of e.edges??[])try{const a=ap(o.tail),c=ap(o.head);r.edges.push({id:`link${ap(o._gvid)}`,source:a,target:c,points:XA(o)})}catch(a){Me.warn(a)}return r}const QA=_n.font,cp="/";class _b{static toDot(e){return new _b(e).print()}subgraphs=new Map;graphvizModel;constructor(e){const n=this.graphvizModel=EK.graph({[D.layout]:"osage",[D.pack]:qn(100),[D.packmode]:"array_ltc",[D.pad]:et(15),[D.fontname]:QA,[D.splines]:"polyline",[D.esep]:"+20"});n.attributes.graph.apply({[D.fontsize]:qn(20),[D.labeljust]:"l",[D.labelloc]:"t"}),n.attributes.node.apply({[D.fontname]:QA,[D.shape]:"rect",[D.width]:et(400),[D.height]:et(300),[D.fixedsize]:!0,[D.fontsize]:10}),n.attributes.edge.apply({[D.penwidth]:qn(2)});const r=new Set(e.map(c=>c.relativePath??""));let i=0,s=[...e];const o=r.size>1;o&&s.sort((c,l)=>{const u=c.relativePath?.split(cp)??[""],d=l.relativePath?.split(cp)??[""];u.push(c.title??"Untitled"),d.push(l.title??"Untitled");const f=u.length,h=d.length;switch(i=Math.max(i,f,h),!0){case f>h:return-1;case f<h:return 1;default:{for(let p=0;p<f;p++){const y=u[p].localeCompare(d[p]);if(y!==0)return y}return 0}}});const a=new Map;s.forEach((c,l)=>{this.addView(o?c:{...c,relativePath:""},l+i);const u=c.nodes.reduce((d,f)=>(f.navigateTo&&d.add(f.navigateTo),d),new Set);u.size>0&&a.set(c.id,u)});for(const[c,l]of a)for(const u of l)n.edge([c,u])}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(cp)?e.slice(0,e.lastIndexOf(cp)):"";r=this.getParentForPath(s).subgraph("cluster"+String(this.subgraphs.size+1),{[D.likec4_type]:i?"file":"folder",[D.likec4_path]:e,[D.sortv]:this.subgraphs.size,[D.label]:Q(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,{[D.likec4_type]:"view",[D.likec4_id]:e.id,[D.sortv]:n,[D.label]:e.title||"Untitled"})}print(){return jA(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}}const ZA=t=>Wp(t)?new $b(t):new kb(t);class JK{constructor(e){this.graphviz=e}get port(){return this.graphviz}changePort(e){this.graphviz=e}async layout(e){let n=await this.dot(e);const r=await this.graphviz.layoutJson(n);let i=JA(r,e);if(e.manualLayout){const s=BK(i,e.manualLayout);if(s.diagram)i=s.diagram;else{if(s.relayout.nodes.length>0){const o=ZA(e);if(o.hasEdgesWithCompounds)Me.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=JA(a,e)}}i.hasLayoutDrift=!0}}return n=n.split(`
1167
+ `).filter(s=>!(s.includes("margin")&&s.includes("50.1"))).join(`
1168
+ `),{dot:n,diagram:i}}async svg(e){let n=await this.dot(e);return n=n.split(`
1169
+ `).filter(r=>!(r.includes("margin")&&r.includes("50.1"))).join(`
1170
+ `),{svg:await this.graphviz.svg(n),dot:n}}async dot(e){let n=ZA(e).print();if(Wp(e))return n;try{return await this.graphviz.unflatten(n)}catch(r){return Me.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=_b.toDot(e),r=await this.graphviz.layoutJson(n);return XK(r)}}function Wn(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 lw=(t,e)=>{const n=eI(t);if(typeof n!="string")throw new TypeError(`${e} must be a string or a file URL: ${n}.`);return n},eI=t=>t instanceof URL?Np(t):t,tI=(t,e=[],n={})=>{const r=lw(t,"First argument"),[i,s]=Wn(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(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);const o=i.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Wn(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[r,o,s]},{toString:nI}=Object.prototype,QK=t=>nI.call(t)==="[object ArrayBuffer]",sr=t=>nI.call(t)==="[object Uint8Array]",uu=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ZK=new TextEncoder,rI=t=>ZK.encode(t),eY=new TextDecoder,iI=t=>eY.decode(t),tY=(t,e)=>nY(t,e).join(""),nY=(t,e)=>{if(e==="utf8"&&t.every(s=>typeof s=="string"))return t;const n=new Ob(e),r=t.map(s=>typeof s=="string"?rI(s):s).map(s=>n.write(s)),i=n.end();return i===""?r:[...r,i]},uw=t=>t.length===1&&sr(t[0])?t[0]:sI(rY(t)),rY=t=>t.map(e=>typeof e=="string"?rI(e):e),sI=t=>{const e=new Uint8Array(iY(t));let n=0;for(const r of t)e.set(r,n),n+=r.length;return e},iY=t=>{let e=0;for(const n of t)e+=n.length;return e},sY=t=>Array.isArray(t)&&Array.isArray(t.raw),oY=(t,e)=>{let n=[];for(const[s,o]of t.entries())n=aY({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,{}]},aY=({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}=cY(i,t.raw[r]),c=aI(n,s,o);if(r===e.length)return c;const l=e[r],u=Array.isArray(l)?l.map(d=>cI(d)):[cI(l)];return aI(c,u,a)},cY=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};const n=[];let r=0;const i=oI.has(e[0]);for(let o=0,a=0;o<t.length;o+=1,a+=1){const c=e[a];if(oI.has(c))r!==o&&n.push(t.slice(r,o)),r=o+1;else if(c==="\\"){const l=e[a+1];l==="u"&&e[a+2]==="{"?a=e.indexOf("}",a+3):a+=lY[l]??1}}const s=r===t.length;return s||n.push(t.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:s}},oI=new Set([" "," ","\r",`
1171
+ `]),lY={x:3,u:5},aI=(t,e,n)=>n||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],cI=t=>{const e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Wn(t)&&("stdout"in t||"isMaxBuffer"in t))return uY(t);throw t instanceof Nb||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`)},uY=({stdout:t})=>{if(typeof t=="string")return t;if(sr(t))return iI(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`)},Xs=t=>dw.includes(t),dw=[Ge.stdin,Ge.stdout,Ge.stderr],xr=["stdin","stdout","stderr"],lI=t=>xr[t]??`stdio[${t}]`,dY=t=>{const e={...t};for(const n of hI)e[n]=uI(t,n);return e},uI=(t,e)=>{const n=Array.from({length:fY(t)+1}),r=hY(t[e],n,e);return vY(r,e)},fY=({stdio:t})=>Array.isArray(t)?Math.max(t.length,xr.length):xr.length,hY=(t,e,n)=>Wn(t)?pY(t,e,n):e.fill(t),pY=(t,e,n)=>{for(const r of Object.keys(t).sort(gY))for(const i of mY(r,n,e))e[i]=t[r];return e},gY=(t,e)=>dI(t)<dI(e)?1:-1,dI=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,mY=(t,e,n)=>{if(t==="ipc")return[n.length-1];const r=fI(t);if(r===void 0||r===0)throw new TypeError(`"${e}.${t}" is invalid.
1172
+ 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.
1173
+ Please set the "stdio" option to ensure that file descriptor exists.`);return r==="all"?[1,2]:[r]},fI=t=>{if(t==="all")return t;if(xr.includes(t))return xr.indexOf(t);const e=yY.exec(t);if(e!==null)return Number(e[1])},yY=/^fd(\d+)$/,vY=(t,e)=>t.map(n=>n===void 0?bY[e]:n),wY=CN("execa").enabled?"full":"none",bY={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:wY,stripFinalNewline:!0},hI=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],du=(t,e)=>e==="ipc"?t.at(-1):t[e],fw=({verbose:t},e)=>pw(t,e)!=="none",hw=({verbose:t},e)=>!["none","short"].includes(pw(t,e)),TY=({verbose:t},e)=>{const n=pw(t,e);return gw(n)?n:void 0},pw=(t,e)=>e===void 0?EY(t):du(t,e),EY=t=>t.find(e=>gw(e))??mw.findLast(e=>t.includes(e)),gw=t=>typeof t=="function",mw=["none","short","full"],RY=(t,e)=>{const n=[t,...e],r=n.join(" "),i=n.map(s=>AY(pI(s))).join(" ");return{command:r,escapedCommand:i}},yw=t=>AN(t).split(`
1174
+ `).map(e=>pI(e)).join(`
1175
+ `),pI=t=>t.replaceAll(kY,e=>SY(e)),SY=t=>{const e=_Y[t];if(e!==void 0)return e;const n=t.codePointAt(0),r=n.toString(16);return n<=CY?`\\u${r.padStart(4,"0")}`:`\\U${r}`},$Y=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},kY=$Y(),_Y={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},CY=65535,AY=t=>IY.test(t)?t:ON==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,IY=/^[\w./-]+$/;function PY(){return Ge.platform!=="win32"?Ge.env.TERM!=="linux":!!Ge.env.WT_SESSION||!!Ge.env.TERMINUS_SUBLIME||Ge.env.ConEmuTask==="{cmd::Cmder}"||Ge.env.TERM_PROGRAM==="Terminus-Sublime"||Ge.env.TERM_PROGRAM==="vscode"||Ge.env.TERM==="xterm-256color"||Ge.env.TERM==="alacritty"||Ge.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const gI={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"},xY={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"},NY={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"},OY={...gI,...xY},DY={...gI,...NY},LY=PY(),vw=LY?OY:DY,MY=Db.WriteStream.prototype.hasColors(),lp=(t,e)=>{if(!MY)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,c=0;for(;o!==-1;)a+=s.slice(c,o)+n,c=o+r.length,o=s.indexOf(r,c);return a+=s.slice(c)+r,a}},FY=lp(1,22),ww=lp(90,39),jY=lp(91,39),UY=lp(93,39),BY=({type:t,message:e,timestamp:n,piped:r,commandId:i,result:{failed:s=!1}={},options:{reject:o=!0}})=>{const a=qY(n),c=WY[t]({failed:s,reject:o,piped:r}),l=GY[t]({reject:o});return`${ww(`[${a}]`)} ${ww(`[${i}]`)} ${l(c)} ${l(e)}`},qY=t=>`${up(t.getHours(),2)}:${up(t.getMinutes(),2)}:${up(t.getSeconds(),2)}.${up(t.getMilliseconds(),3)}`,up=(t,e)=>String(t).padStart(e,"0"),mI=({failed:t,reject:e})=>t?e?vw.cross:vw.warning:vw.tick,WY={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:mI,duration:mI},yI=t=>t,GY={command:()=>FY,output:()=>yI,ipc:()=>yI,error:({reject:t})=>t?jY:UY,duration:()=>ww},zY=(t,e,n)=>{const r=TY(e,n);return t.map(({verboseLine:i,verboseObject:s})=>HY(i,s,r)).filter(i=>i!==void 0).map(i=>VY(i)).join("")},HY=(t,e,n)=>{if(n===void 0)return t;const r=n(t,e);if(typeof r=="string")return r},VY=t=>t.endsWith(`
1176
+ `)?t:`${t}
1177
+ `,fu=({type:t,verboseMessage:e,fdNumber:n,verboseInfo:r,result:i})=>{const s=KY({type:t,result:i,verboseInfo:r}),o=YY(e,s),a=zY(o,r,n);Ab(JY,a)},KY=({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}),YY=(t,e)=>t.split(`
1178
+ `).map(n=>XY({...e,message:n})),XY=t=>({verboseLine:BY(t),verboseObject:t}),JY=2,vI=t=>{const e=typeof t=="string"?t:xb(t);return yw(e).replaceAll(" "," ".repeat(QY))},QY=2,ZY=(t,e)=>{fw(e)&&fu({type:"command",verboseMessage:t,verboseInfo:e})},eX=(t,e,n)=>{rX(t);const r=tX(t);return{verbose:t,escapedCommand:e,commandId:r,rawOptions:n}},tX=t=>fw({verbose:t})?nX++:void 0;let nX=0n;const rX=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(!mw.includes(e)&&!gw(e)){const n=mw.map(r=>`'${r}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${n} or a function.`)}}},wI=()=>Eu.bigint(),bI=t=>Number(Eu.bigint()-t)/1e6,TI=(t,e,n)=>{const r=wI(),{command:i,escapedCommand:s}=RY(t,e),o=uI(n,"verbose"),a=eX(o,s,{...n});return ZY(s,a),{command:i,escapedCommand:s,startTime:r,verboseInfo:a}};var va={exports:{}},bw,EI;function iX(){if(EI)return bw;EI=1,bw=r,r.sync=i;var t=Ru;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 c=0;c<a.length;c++){var l=a[c].toLowerCase();if(l&&s.substr(-l.length).toLowerCase()===l)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(c,l){a(c,c?!1:n(l,s,o))})}function i(s,o){return n(t.statSync(s),s,o)}return bw}var Tw,RI;function sX(){if(RI)return Tw;RI=1,Tw=e,e.sync=n;var t=Ru;function e(s,o,a){t.stat(s,function(c,l){a(c,c?!1:r(l,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,c=s.uid,l=s.gid,u=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),h=parseInt("010",8),p=parseInt("001",8),y=f|h,R=a&p||a&h&&l===d||a&f&&c===u||a&y&&u===0;return R}return Tw}var dp;process.platform==="win32"||gt.TESTING_WINDOWS?dp=iX():dp=sX();var oX=Ew;Ew.sync=aX;function Ew(t,e,n){if(typeof e=="function"&&(n=e,e={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,i){Ew(t,e||{},function(s,o){s?i(s):r(o)})})}dp(t,e||{},function(r,i){r&&(r.code==="EACCES"||e&&e.ignoreErrors)&&(r=null,i=!1),n(r,i)})}function aX(t,e){try{return dp.sync(t,e||{})}catch(n){if(e&&e.ignoreErrors||n.code==="EACCES")return!1;throw n}}const wa=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",SI=$a,cX=wa?";":":",$I=oX,kI=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),_I=(t,e)=>{const n=e.colon||cX,r=t.match(/\//)||wa&&t.match(/\\/)?[""]:[...wa?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(n)],i=wa?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=wa?i.split(n):[""];return wa&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:i}},CI=(t,e,n)=>{typeof e=="function"&&(n=e,e={}),e||(e={});const{pathEnv:r,pathExt:i,pathExtExe:s}=_I(t,e),o=[],a=l=>new Promise((u,d)=>{if(l===r.length)return e.all&&o.length?u(o):d(kI(t));const f=r[l],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=SI.join(h,t),y=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;u(c(y,l,0))}),c=(l,u,d)=>new Promise((f,h)=>{if(d===i.length)return f(a(u+1));const p=i[d];$I(l+p,{pathExt:s},(y,R)=>{if(!y&&R)if(e.all)o.push(l+p);else return f(l+p);return f(c(l,u,d+1))})});return n?a(0).then(l=>n(null,l),n):a(0)},lX=(t,e)=>{e=e||{};const{pathEnv:n,pathExt:r,pathExtExe:i}=_I(t,e),s=[];for(let o=0;o<n.length;o++){const a=n[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=SI.join(c,t),u=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+l:l;for(let d=0;d<r.length;d++){const f=u+r[d];try{if($I.sync(f,{pathExt:i}))if(e.all)s.push(f);else return f}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw kI(t)};var uX=CI;CI.sync=lX;var Rw={exports:{}};const AI=(t={})=>{const e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Rw.exports=AI,Rw.exports.default=AI;var dX=Rw.exports;const II=$a,fX=uX,hX=dX;function PI(t,e){const n=t.options.env||process.env,r=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=fX.sync(t.command,{path:n[hX({env:n})],pathExt:e?II.delimiter:void 0})}catch{}finally{s&&process.chdir(r)}return o&&(o=II.resolve(i?t.options.cwd:"",o)),o}function pX(t){return PI(t)||PI(t,!0)}var gX=pX,Sw={};const $w=/([()\][%!^"`<>&|;, *?])/g;function mX(t){return t=t.replace($w,"^$1"),t}function yX(t,e){return t=`${t}`,t=t.replace(/(\\*)"/g,'$1$1\\"'),t=t.replace(/(\\*)$/,"$1$1"),t=`"${t}"`,t=t.replace($w,"^$1"),e&&(t=t.replace($w,"^$1")),t}Sw.command=mX,Sw.argument=yX;var vX=/^#!(.*)/;const wX=vX;var bX=(t="")=>{const e=t.match(wX);if(!e)return null;const[n,r]=e[0].replace(/#! ?/,"").split(" "),i=n.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i};const kw=Ru,TX=bX;function EX(t){const n=Buffer.alloc(150);let r;try{r=kw.openSync(t,"r"),kw.readSync(r,n,0,150,0),kw.closeSync(r)}catch{}return TX(n.toString())}var RX=EX;const SX=$a,xI=gX,NI=Sw,$X=RX,kX=process.platform==="win32",_X=/\.(?:com|exe)$/i,CX=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function AX(t){t.file=xI(t);const e=t.file&&$X(t.file);return e?(t.args.unshift(t.file),t.command=e,xI(t)):t.file}function IX(t){if(!kX)return t;const e=AX(t),n=!_X.test(e);if(t.options.forceShell||n){const r=CX.test(e);t.command=SX.normalize(t.command),t.command=NI.command(t.command),t.args=t.args.map(s=>NI.argument(s,r));const i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function PX(t,e,n){e&&!Array.isArray(e)&&(n=e,e=null),e=e?e.slice(0):[],n=Object.assign({},n);const r={command:t,args:e,options:n,file:void 0,original:{command:t,args:e}};return n.shell?r:IX(r)}var xX=PX;const _w=process.platform==="win32";function Cw(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function NX(t,e){if(!_w)return;const n=t.emit;t.emit=function(r,i){if(r==="exit"){const s=OI(i,e);if(s)return n.call(t,"error",s)}return n.apply(t,arguments)}}function OI(t,e){return _w&&t===1&&!e.file?Cw(e.original,"spawn"):null}function OX(t,e){return _w&&t===1&&!e.file?Cw(e.original,"spawnSync"):null}var DX={hookChildProcess:NX,verifyENOENT:OI,verifyENOENTSync:OX,notFoundError:Cw};const DI=Lb,Aw=xX,Iw=DX;function LI(t,e,n){const r=Aw(t,e,n),i=DI.spawn(r.command,r.args,r.options);return Iw.hookChildProcess(i,r),i}function LX(t,e,n){const r=Aw(t,e,n),i=DI.spawnSync(r.command,r.args,r.options);return i.error=i.error||Iw.verifyENOENTSync(i.status,r),i}va.exports=LI,va.exports.spawn=LI,va.exports.sync=LX,va.exports._parse=Aw,va.exports._enoent=Iw;var MX=va.exports;const FX=Ro(MX);function MI(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 jX=({cwd:t=Ge.cwd(),path:e=Ge.env[MI()],preferLocal:n=!0,execPath:r=Ge.execPath,addExecPath:i=!0}={})=>{const s=t instanceof URL?Np(t):t,o=Mr.resolve(s),a=[];return n&&UX(a,o),i&&BX(a,r,o),[...a,e].join(Mr.delimiter)},UX=(t,e)=>{let n;for(;n!==e;)t.push(Mr.join(e,"node_modules/.bin")),n=e,e=Mr.resolve(e,"..")},BX=(t,e,n)=>{const r=e instanceof URL?Np(e):e;t.push(Mr.resolve(n,r,".."))},qX=({env:t=Ge.env,...e}={})=>{t={...t};const n=MI({env:t});return e.path=t[n],t[n]=jX(e),t},WX=(t,e,n)=>{const r=n?Nw:xw,i=t instanceof hu?{}:{cause:t};return new r(e,i)};class hu extends Error{}const FI=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,jI,{value:!0,writable:!1,enumerable:!1,configurable:!1})},GX=t=>Pw(t)&&jI in t,jI=Symbol("isExecaError"),Pw=t=>Object.prototype.toString.call(t)==="[object Error]";class xw extends Error{}FI(xw,xw.name);class Nw extends Error{}FI(Nw,Nw.name);const zX=()=>{const t=BI-UI+1;return Array.from({length:t},HX)},HX=(t,e)=>({name:`SIGRT${e+1}`,number:UI+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),UI=34,BI=64,VX=[{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"}],qI=()=>{const t=zX();return[...VX,...t].map(KX)},KX=({name:t,number:e,description:n,action:r,forced:i=!1,standard:s})=>{const{signals:{[t]:o}}=ws,a=o!==void 0;return{name:t,number:a?o:e,description:n,supported:a,action:r,forced:i,standard:s}},YX=()=>{const t=qI();return Object.fromEntries(t.map(XX))},XX=({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}],JX=YX(),QX=()=>{const t=qI(),e=BI+1,n=Array.from({length:e},(r,i)=>ZX(i,t));return Object.assign({},...n)},ZX=(t,e)=>{const n=eJ(t,e);if(n===void 0)return{};const{name:r,description:i,supported:s,action:o,forced:a,standard:c}=n;return{[t]:{name:r,number:t,description:i,supported:s,action:o,forced:a,standard:c}}},eJ=(t,e)=>{const n=e.find(({name:r})=>ws.signals[r]===t);return n!==void 0?n:e.find(r=>r.number===t)};QX();const tJ=t=>{const e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return WI(t,e)},nJ=t=>t===0?t:WI(t,"`subprocess.kill()`'s argument"),WI=(t,e)=>{if(Number.isInteger(t))return rJ(t,e);if(typeof t=="string")return sJ(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer.
1179
+ ${Ow()}`)},rJ=(t,e)=>{if(GI.has(t))return GI.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist.
1180
+ ${Ow()}`)},iJ=()=>new Map(Object.entries(ws.signals).reverse().map(([t,e])=>[e,t])),GI=iJ(),sJ=(t,e)=>{if(t in ws.signals)return t;throw t.toUpperCase()in ws.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist.
1181
+ ${Ow()}`)},Ow=()=>`Available signal names: ${oJ()}.
1182
+ Available signal numbers: ${aJ()}.`,oJ=()=>Object.keys(ws.signals).sort().map(t=>`'${t}'`).join(", "),aJ=()=>[...new Set(Object.values(ws.signals).sort((t,e)=>t-e))].join(", "),zI=t=>JX[t].description,cJ=t=>{if(t===!1)return t;if(t===!0)return lJ;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},lJ=1e3*5,uJ=({kill:t,options:{forceKillAfterDelay:e,killSignal:n},onInternalError:r,context:i,controller:s},o,a)=>{const{signal:c,error:l}=dJ(o,a,n);fJ(l,r);const u=t(c);return hJ({kill:t,signal:c,forceKillAfterDelay:e,killSignal:n,killResult:u,context:i,controller:s}),u},dJ=(t,e,n)=>{const[r=n,i]=Pw(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&&!Pw(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:nJ(r),error:i}},fJ=(t,e)=>{t!==void 0&&e.reject(t)},hJ=async({kill:t,signal:e,forceKillAfterDelay:n,killSignal:r,killResult:i,context:s,controller:o})=>{e===r&&i&&HI({kill:t,forceKillAfterDelay:n,context:s,controllerSignal:o.signal})},HI=async({kill:t,forceKillAfterDelay:e,context:n,controllerSignal:r})=>{if(e!==!1)try{await Mb(e,void 0,{signal:r}),t("SIGKILL")&&(n.isForcefullyTerminated??=!0)}catch{}},VI=async(t,e)=>{t.aborted||await nn(t,"abort",{signal:e})},pJ=({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)}`)},gJ=({subprocess:t,cancelSignal:e,gracefulCancel:n,context:r,controller:i})=>e===void 0||n?[]:[mJ(t,e,r,i)],mJ=async(t,e,n,{signal:r})=>{throw await VI(e,r),n.terminationReason??="cancel",t.kill(),e.reason},Dw=({methodName:t,isSubprocess:e,ipc:n,isConnected:r})=>{yJ(t,e,n),KI(t,e,r)},yJ=(t,e,n)=>{if(!n)throw new Error(`${or(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},KI=(t,e,n)=>{if(!n)throw new Error(`${or(t,e)} cannot be used: the ${rs(e)} has already exited or disconnected.`)},vJ=t=>{throw new Error(`${or("getOneMessage",t)} could not complete: the ${rs(t)} exited or disconnected.`)},wJ=t=>{throw new Error(`${or("sendMessage",t)} failed: the ${rs(t)} is sending a message too, instead of listening to incoming messages.
1183
+ This can be fixed by both sending a message and listening to incoming messages at the same time:
1184
+
1185
+ const [receivedMessage] = await Promise.all([
1186
+ ${or("getOneMessage",t)},
1187
+ ${or("sendMessage",t,"message, {strict: true}")},
1188
+ ]);`)},YI=(t,e)=>new Error(`${or("sendMessage",e)} failed when sending an acknowledgment response to the ${rs(e)}.`,{cause:t}),bJ=t=>{throw new Error(`${or("sendMessage",t)} failed: the ${rs(t)} is not listening to incoming messages.`)},TJ=t=>{throw new Error(`${or("sendMessage",t)} failed: the ${rs(t)} exited without listening to incoming messages.`)},EJ=()=>new Error(`\`cancelSignal\` aborted: the ${rs(!0)} disconnected.`),RJ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},SJ=({error:t,methodName:e,isSubprocess:n})=>{if(t.code==="EPIPE")throw new Error(`${or(e,n)} cannot be used: the ${rs(n)} is disconnecting.`,{cause:t})},$J=({error:t,methodName:e,isSubprocess:n,message:r})=>{if(kJ(t))throw new Error(`${or(e,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:t})},kJ=({code:t,message:e})=>_J.has(t)||CJ.some(n=>e.includes(n)),_J=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),CJ=["could not be cloned","circular structure","call stack size exceeded"],or=(t,e,n="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${AJ(e)}${t}(${n})`,AJ=t=>t?"":"subprocess.",rs=t=>t?"parent process":"subprocess",Lw=t=>{t.connected&&t.disconnect()},pu=()=>{const t={},e=new Promise((n,r)=>{Object.assign(t,{resolve:n,reject:r})});return Object.assign(e,t)},XI=(t,e="stdin")=>{const{options:r,fileDescriptors:i}=Js.get(t),s=JI(i,e,!0),o=t.stdio[s];if(o===null)throw new TypeError(QI(s,e,r,!0));return o},Mw=(t,e="stdout")=>{const{options:r,fileDescriptors:i}=Js.get(t),s=JI(i,e,!1),o=s==="all"?t.all:t.stdio[s];if(o==null)throw new TypeError(QI(s,e,r,!1));return o},Js=new WeakMap,JI=(t,e,n)=>{const r=IJ(e,n);return PJ(r,e,n,t),r},IJ=(t,e)=>{const n=fI(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(`"${gu(e)}" must not be "${t}".
1189
+ It must be ${r} or "fd3", "fd4" (and so on).
1190
+ It is optional and defaults to "${i}".`)},PJ=(t,e,n,r)=>{const i=r[ZI(t)];if(i===void 0)throw new TypeError(`"${gu(n)}" must not be ${e}. That file descriptor does not exist.
1191
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!n)throw new TypeError(`"${gu(n)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&n)throw new TypeError(`"${gu(n)}" must not be ${e}. It must be a writable stream, not readable.`)},QI=(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}=xJ(t,n);return`The "${i}: ${Fw(s)}" option is incompatible with using "${gu(r)}: ${Fw(e)}".
1192
+ Please set this option with "pipe" instead.`},xJ=(t,{stdin:e,stdout:n,stderr:r,stdio:i})=>{const s=ZI(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]}},ZI=t=>t==="all"?1:t,gu=t=>t?"to":"from",Fw=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream",fp=(t,e,n)=>{const r=t.getMaxListeners();r===0||r===Number.POSITIVE_INFINITY||(t.setMaxListeners(r+e),jb(n,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))},eP=(t,e)=>{e&&jw(t)},jw=t=>{t.refCounted()},tP=(t,e)=>{e&&Uw(t)},Uw=t=>{t.unrefCounted()},NJ=(t,e)=>{e&&(Uw(t),Uw(t))},OJ=(t,e)=>{e&&(jw(t),jw(t))},DJ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r},i)=>{if(qJ(i)||eQ(i))return;hp.has(t)||hp.set(t,[]);const s=hp.get(t);if(s.push(i),!(s.length>1))for(;s.length>0;){await VJ(t,r,i),await Fb.yield();const o=await BJ({wrappedMessage:s[0],anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r});s.shift(),r.emit("message",o),r.emit("message:done")}},LJ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{cP();const s=hp.get(t);for(;s?.length>0;)await nn(r,"message:done");t.removeListener("message",i),OJ(e,n),r.connected=!1,r.emit("disconnect")},hp=new WeakMap,pp=(t,e,n)=>{if(gp.has(t))return gp.get(t);const r=new FN;return r.connected=!0,gp.set(t,r),MJ({ipcEmitter:r,anyProcess:t,channel:e,isSubprocess:n}),r},gp=new WeakMap,MJ=({ipcEmitter:t,anyProcess:e,channel:n,isSubprocess:r})=>{const i=DJ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t});e.on("message",i),e.once("disconnect",LJ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t,boundOnMessage:i})),NJ(n,r)},nP=t=>{const e=gp.get(t);return e===void 0?t.channel!==null:e.connected},FJ=({anyProcess:t,channel:e,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;const s=pp(t,e,n),o=Bw(t,s);return{id:jJ++,type:yp,message:r,hasListeners:o}};let jJ=0n;const UJ=(t,e)=>{if(!(e?.type!==yp||e.hasListeners))for(const{id:n}of t)n!==void 0&&mp[n].resolve({isDeadlock:!0,hasListeners:!1})},BJ=async({wrappedMessage:t,anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(t?.type!==yp||!e.connected)return t;const{id:s,message:o}=t,a={id:s,type:rP,message:Bw(e,i)};try{await iP({anyProcess:e,channel:n,isSubprocess:r,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return o},qJ=t=>{if(t?.type!==rP)return!1;const{id:e,message:n}=t;return mp[e]?.resolve({isDeadlock:!1,hasListeners:n}),!0},WJ=async(t,e,n)=>{if(t?.type!==yp)return;const r=pu();mp[t.id]=r;const i=new AbortController;try{const{isDeadlock:s,hasListeners:o}=await Promise.race([r,GJ(e,n,i)]);s&&wJ(n),o||bJ(n)}finally{i.abort(),delete mp[t.id]}},mp={},GJ=async(t,e,{signal:n})=>{fp(t,1,n),await nn(t,"disconnect",{signal:n}),TJ(e)},yp="execa:ipc:request",rP="execa:ipc:response",zJ=(t,e,n)=>{mu.has(t)||mu.set(t,new Set);const r=mu.get(t),i=pu(),s=n?e.id:void 0,o={onMessageSent:i,id:s};return r.add(o),{outgoingMessages:r,outgoingMessage:o}},HJ=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},VJ=async(t,e,n)=>{for(;!Bw(t,e)&&mu.get(t)?.size>0;){const r=[...mu.get(t)];UJ(r,n),await Promise.all(r.map(({onMessageSent:i})=>i))}},mu=new WeakMap,Bw=(t,e)=>e.listenerCount("message")>KJ(t),KJ=t=>Js.has(t)&&!du(Js.get(t).options.buffer,"ipc")?1:0,iP=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},i,{strict:s=!1}={})=>{const o="sendMessage";return Dw({methodName:o,isSubprocess:n,ipc:r,isConnected:t.connected}),YJ({anyProcess:t,channel:e,methodName:o,isSubprocess:n,message:i,strict:s})},YJ=async({anyProcess:t,channel:e,methodName:n,isSubprocess:r,message:i,strict:s})=>{const o=FJ({anyProcess:t,channel:e,isSubprocess:r,message:i,strict:s}),a=zJ(t,o,s);try{await sP({anyProcess:t,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(c){throw Lw(t),c}finally{HJ(a)}},sP=async({anyProcess:t,methodName:e,isSubprocess:n,wrappedMessage:r,message:i})=>{const s=XJ(t);try{await Promise.all([WJ(r,t,n),s(r)])}catch(o){throw SJ({error:o,methodName:e,isSubprocess:n}),$J({error:o,methodName:e,isSubprocess:n,message:i}),o}},XJ=t=>{if(qw.has(t))return qw.get(t);const e=IN(t.send.bind(t));return qw.set(t,e),e},qw=new WeakMap,JJ=(t,e)=>{const n="cancelSignal";return KI(n,!1,t.connected),sP({anyProcess:t,methodName:n,isSubprocess:!1,wrappedMessage:{type:aP,message:e},message:e})},QJ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>(await ZJ({anyProcess:t,channel:e,isSubprocess:n,ipc:r}),Ww.signal),ZJ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>{if(!oP){if(oP=!0,!r){RJ();return}if(e===null){cP();return}pp(t,e,n),await Fb.yield()}};let oP=!1;const eQ=t=>t?.type!==aP?!1:(Ww.abort(t.message),!0),aP="execa:ipc:cancel",cP=()=>{Ww.abort(EJ())},Ww=new AbortController,tQ=({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.")}},nQ=({subprocess:t,cancelSignal:e,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:s})=>n?[rQ({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:i,controller:s})]:[],rQ=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{await VI(e,i);const s=iQ(e);throw await JJ(t,s),HI({kill:t.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??="gracefulCancel",e.reason},iQ=({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},sQ=({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})`)},oQ=(t,e,n,r)=>e===0||e===void 0?[]:[aQ(t,e,n,r)],aQ=async(t,e,n,{signal:r})=>{throw await Mb(e,void 0,{signal:r}),n.terminationReason??="timeout",t.kill(),new hu},cQ=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},lQ=(t,e,{node:n=!1,nodePath:r=DN,nodeOptions:i=LN.filter(c=>!c.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 c=lw(r,'The "nodePath" option'),l=Mr.resolve(s,c),u={...a,nodePath:l,node:n,cwd:s};if(!n)return[t,e,u];if(Mr.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]},uQ=({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`.");hQ[n](t)}},dQ=t=>{try{UN(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},fQ=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},hQ={advanced:dQ,json:fQ},pQ=async(t,e)=>{e!==void 0&&await t.sendMessage(e)},gQ=({encoding:t})=>{if(Gw.has(t))return;const e=yQ(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${vp(t)}\`.
1193
+ Please rename it to ${vp(e)}.`);const n=[...Gw].map(r=>vp(r)).join(", ");throw new TypeError(`Invalid option \`encoding: ${vp(t)}\`.
1194
+ Please rename it to one of: ${n}.`)},mQ=new Set(["utf8","utf16le"]),Qs=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),Gw=new Set([...mQ,...Qs]),yQ=t=>{if(t===null)return"buffer";if(typeof t!="string")return;const e=t.toLowerCase();if(e in lP)return lP[e];if(Gw.has(e))return e},lP={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},vp=t=>typeof t=="string"?`"${t}"`:String(t),vQ=(t=uP())=>{const e=lw(t,'The "cwd" option');return Mr.resolve(e)},uP=()=>{try{return Ge.cwd()}catch(t){throw t.message=`The current directory does not exist.
1195
+ ${t.message}`,t}},wQ=(t,e)=>{if(e===uP())return t;let n;try{n=vN(e)}catch(r){return`The "cwd" option is invalid: ${e}.
1196
+ ${r.message}
1197
+ ${t}`}return n.isDirectory()?t:`The "cwd" option is not a directory: ${e}.
1198
+ ${t}`},dP=(t,e,n)=>{n.cwd=vQ(n.cwd);const[r,i,s]=lQ(t,e,n),{command:o,args:a,options:c}=FX._parse(r,i,s),l=dY(c),u=bQ(l);return sQ(u),gQ(u),uQ(u),pJ(u),tQ(u),u.shell=eI(u.shell),u.env=TQ(u),u.killSignal=tJ(u.killSignal),u.forceKillAfterDelay=cJ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!Qs.has(u.encoding)&&u.buffer[f]),Ge.platform==="win32"&&Mr.basename(o,".exe")==="cmd"&&a.unshift("/q"),{file:o,commandArguments:a,options:u}},bQ=({extendEnv:t=!0,preferLocal:e=!1,cwd:n,localDir:r=n,encoding:i="utf8",reject:s=!0,cleanup:o=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:h=f!==void 0||d,serialization:p="advanced",...y})=>({...y,extendEnv:t,preferLocal:e,cwd:n,localDirectory:r,encoding:i,reject:s,cleanup:o,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:h,serialization:p}),TQ=({env:t,extendEnv:e,preferLocal:n,node:r,localDirectory:i,nodePath:s})=>{const o=e?{...Ge.env,...t}:t;return n||r?qX({env:o,cwd:i,execPath:s,preferLocal:n,addExecPath:r}):o};function zw(t){if(typeof t=="string")return EQ(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return RQ(t)}const EQ=t=>t.at(-1)===fP?t.slice(0,t.at(-2)===hP?-2:-1):t,RQ=t=>t.at(-1)===SQ?t.subarray(0,t.at(-2)===$Q?-2:-1):t,fP=`
1199
+ `,SQ=fP.codePointAt(0),hP="\r",$Q=hP.codePointAt(0);function Zs(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 pP(t,{checkOpen:e=!0}={}){return Zs(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 wp(t,{checkOpen:e=!0}={}){return Zs(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 gP(t,e){return pP(t,e)&&wp(t,e)}const kQ=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class _Q{#e;#t;#n=!1;#r=void 0;constructor(e,n){this.#e=e,this.#t=n}next(){const e=()=>this.#i();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){const n=()=>this.#s(e);return this.#r?this.#r.then(n,n):n()}async#i(){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#s(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 Hw=Symbol();function mP(){return this[Hw].next()}Object.defineProperty(mP,"name",{value:"next"});function yP(t){return this[Hw].return(t)}Object.defineProperty(yP,"name",{value:"return"});const CQ=Object.create(kQ,{next:{enumerable:!0,configurable:!0,writable:!0,value:mP},return:{enumerable:!0,configurable:!0,writable:!0,value:yP}});function AQ({preventCancel:t=!1}={}){const e=this.getReader(),n=new _Q(e,t),r=Object.create(CQ);return r[Hw]=n,r}const IQ=t=>{if(wp(t,{checkOpen:!1})&&Vw.on!==void 0)return xQ(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(PQ.call(t)==="[object ReadableStream]")return AQ.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:PQ}=Object.prototype,xQ=async function*(t){const e=new AbortController,n={};NQ(t,e,n);try{for await(const[r]of Vw.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()}},NQ=async(t,e,n)=>{try{await Vw.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(r){n.error=r}finally{e.abort()}},Vw={},Kw=async(t,{init:e,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{const l=IQ(t),u=e();u.length=0;try{for await(const d of l){const f=DQ(d),h=n[f](d,u);vP({convertedChunk:h,state:u,getSize:r,truncateChunk:i,addChunk:s,maxBuffer:c})}return OQ({state:u,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,maxBuffer:c}),a(u)}catch(d){const f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},OQ=({state:t,getSize:e,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:s})=>{const o=i(t);o!==void 0&&vP({convertedChunk:o,state:t,getSize:e,truncateChunk:n,addChunk:r,maxBuffer:s})},vP=({convertedChunk:t,state:e,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:s})=>{const o=n(t),a=e.length+o;if(a<=s){wP(t,e,i,a);return}const c=r(t,s-e.length);throw c!==void 0&&wP(c,e,i,s),new bp},wP=(t,e,n,r)=>{e.contents=n(t,e,r),e.length=r},DQ=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=bP.call(t);return n==="[object ArrayBuffer]"?"arrayBuffer":n==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&bP.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:bP}=Object.prototype;class bp extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}const eo=t=>t,Yw=()=>{},TP=({contents:t})=>t,EP=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},RP=t=>t.length;async function LQ(t,e){return Kw(t,UQ,e)}const MQ=()=>({contents:[]}),FQ=()=>1,jQ=(t,{contents:e})=>(e.push(t),e),UQ={init:MQ,convertChunk:{string:eo,buffer:eo,arrayBuffer:eo,dataView:eo,typedArray:eo,others:eo},getSize:FQ,truncateChunk:Yw,addChunk:jQ,getFinalChunk:Yw,finalize:TP};async function BQ(t,e){return Kw(t,XQ,e)}const qQ=()=>({contents:new ArrayBuffer(0)}),WQ=t=>GQ.encode(t),GQ=new TextEncoder,SP=t=>new Uint8Array(t),$P=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),zQ=(t,e)=>t.slice(0,e),HQ=(t,{contents:e,length:n},r)=>{const i=CP()?KQ(e,r):VQ(e,r);return new Uint8Array(i).set(t,n),i},VQ=(t,e)=>{if(e<=t.byteLength)return t;const n=new ArrayBuffer(kP(e));return new Uint8Array(n).set(new Uint8Array(t),0),n},KQ=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;const n=new ArrayBuffer(e,{maxByteLength:kP(e)});return new Uint8Array(n).set(new Uint8Array(t),0),n},kP=t=>_P**Math.ceil(Math.log(t)/Math.log(_P)),_P=2,YQ=({contents:t,length:e})=>CP()?t:t.slice(0,e),CP=()=>"resize"in ArrayBuffer.prototype,XQ={init:qQ,convertChunk:{string:WQ,buffer:SP,arrayBuffer:SP,dataView:$P,typedArray:$P,others:EP},getSize:RP,truncateChunk:zQ,addChunk:HQ,getFinalChunk:Yw,finalize:YQ};async function JQ(t,e){return Kw(t,nZ,e)}const QQ=()=>({contents:"",textDecoder:new TextDecoder}),Tp=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),ZQ=(t,{contents:e})=>e+t,eZ=(t,e)=>t.slice(0,e),tZ=({textDecoder:t})=>{const e=t.decode();return e===""?void 0:e},nZ={init:QQ,convertChunk:{string:eo,buffer:Tp,arrayBuffer:Tp,dataView:Tp,typedArray:Tp,others:EP},getSize:RP,truncateChunk:eZ,addChunk:ZQ,getFinalChunk:tZ,finalize:TP},rZ=({error:t,stream:e,readableObjectMode:n,lines:r,encoding:i,fdNumber:s})=>{if(!(t instanceof bp))throw t;if(s==="all")return t;const o=iZ(n,r,i);throw t.maxBufferInfo={fdNumber:s,unit:o},e.destroy(),t},iZ=(t,e,n)=>t?"objects":e?"lines":n==="buffer"?"bytes":"characters",sZ=(t,e,n)=>{if(e.length!==n)return;const r=new bp;throw r.maxBufferInfo={fdNumber:"ipc"},r},oZ=(t,e)=>{const{streamName:n,threshold:r,unit:i}=aZ(t,e);return`Command's ${n} was larger than ${r} ${i}`},aZ=(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=du(e,n);return n==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:lI(n),threshold:i,unit:r}},cZ=(t,e,n)=>t?.code==="ENOBUFS"&&e!==null&&e.some(r=>r!==null&&r.length>Xw(n)),lZ=(t,e,n)=>{if(!e)return t;const r=Xw(n);return t.length>r?t.slice(0,r):t},Xw=([,t])=>t,uZ=({stdio:t,all:e,ipcOutput:n,originalError:r,signal:i,signalDescription:s,exitCode:o,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:p,maxBuffer:y,timeout:R,cwd:b})=>{const v=r?.code,T=dZ({originalError:r,timedOut:c,timeout:R,isMaxBuffer:d,maxBuffer:y,errorCode:v,signal:i,signalDescription:s,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:p}),_=hZ(r,b),N=_===void 0?"":`
1200
+ ${_}`,F=`${T}: ${a}${N}`,P=e===void 0?[t[2],t[1]]:[e],G=[F,...P,...t.slice(3),n.map(B=>pZ(B)).join(`
1201
+ `)].map(B=>yw(zw(gZ(B)))).filter(Boolean).join(`
1202
+
1203
+ `);return{originalMessage:_,shortMessage:F,message:G}},dZ=({originalError:t,timedOut:e,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:s,signal:o,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:h})=>{const p=fZ(d,f);return e?`Command timed out after ${n} milliseconds${p}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${p}`:`Command was gracefully canceled with ${o} (${a})`:l?`Command was canceled${p}`:r?`${oZ(t,i)}${p}`:s!==void 0?`Command failed with ${s}${p}`:d?`Command was killed with ${h} (${zI(h)})${p}`:o!==void 0?`Command was killed with ${o} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},fZ=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",hZ=(t,e)=>{if(t instanceof hu)return;const n=GX(t)?t.originalMessage:String(t?.message??t),r=yw(wQ(n,e));return r===""?void 0:r},pZ=t=>typeof t=="string"?t:xb(t),gZ=t=>Array.isArray(t)?t.map(e=>zw(AP(e))).filter(Boolean).join(`
1204
+ `):AP(t),AP=t=>typeof t=="string"?t:sr(t)?iI(t):"",IP=({command:t,escapedCommand:e,stdio:n,all:r,ipcOutput:i,options:{cwd:s},startTime:o})=>PP({command:t,escapedCommand:e,cwd:s,durationMs:bI(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:[]}),Jw=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:o})=>Qw({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}),Qw=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:h,options:{timeoutDuration:p,timeout:y=p,forceKillAfterDelay:R,killSignal:b,cwd:v,maxBuffer:T},isSync:_})=>{const{exitCode:N,signal:F,signalDescription:P}=yZ(l,u),{originalMessage:G,shortMessage:B,message:W}=uZ({stdio:d,all:f,ipcOutput:h,originalError:t,signal:F,signalDescription:P,exitCode:N,escapedCommand:n,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:R,killSignal:b,maxBuffer:T,timeout:y,cwd:v}),I=WX(t,W,_);return Object.assign(I,mZ({error:I,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:N,signal:F,signalDescription:P,stdio:d,all:f,ipcOutput:h,cwd:v,originalMessage:G,shortMessage:B})),I},mZ=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:h,ipcOutput:p,cwd:y,originalMessage:R,shortMessage:b})=>PP({shortMessage:b,originalMessage:R,command:e,escapedCommand:n,cwd:y,durationMs:bI(r),failed:!0,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:h,stdio:f,ipcOutput:p,pipedFrom:[]}),PP=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),yZ=(t,e)=>{const n=t===null?void 0:t,r=e===null?void 0:e,i=r===void 0?void 0:zI(e);return{exitCode:n,signal:r,signalDescription:i}},xP=t=>Number.isFinite(t)?t:0;function vZ(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(xP(t*1e3)%1e3),nanoseconds:Math.trunc(xP(t*1e6)%1e3)}}function wZ(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 bZ(t){switch(typeof t){case"number":{if(Number.isFinite(t))return vZ(t);break}case"bigint":return wZ(t)}throw new TypeError("Expected a finite number or bigint")}const TZ=t=>t===0||t===0n,EZ=(t,e)=>e===1||e===1n?t:`${t}s`,RZ=1e-7,SZ=24n*60n*60n*1000n;function NP(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=(u,d)=>{const f=Math.floor(u*10**d+RZ);return(Math.round(f)/10**d).toFixed(d)},o=(u,d,f,h)=>{if(!((i.length===0||!e.colonNotation)&&TZ(u)&&!(e.colonNotation&&f==="m"))){if(h??=String(u),e.colonNotation){const p=h.includes(".")?h.split(".")[0].length:h.length,y=i.length>0?2:1;h="0".repeat(Math.max(0,y-p))+h}else h+=e.verbose?" "+EZ(d,u):f;i.push(h)}},a=bZ(t),c=BigInt(a.days);if(o(c/365n,"year","y"),o(c%365n,"day","d"),o(Number(a.hours),"hour","h"),o(Number(a.minutes),"minute","m"),e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3){const u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),h=Number(a.nanoseconds);if(o(u,"second","s"),e.formatSubMilliseconds)o(d,"millisecond","ms"),o(f,"microsecond","\xB5s"),o(h,"nanosecond","ns");else{const p=d+f/1e3+h/1e6,y=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,R=p>=1?Math.round(p):Math.ceil(p),b=y?p.toFixed(y):R;o(Number.parseFloat(b),"millisecond","ms",b)}}else{const u=(n?Number(t%SZ):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=s(u,d),h=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");o(Number.parseFloat(h),"second","s",h)}if(i.length===0)return r+"0"+(e.verbose?" milliseconds":"ms");const l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),r+i.join(l)}const $Z=(t,e)=>{t.failed&&fu({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})},kZ=(t,e)=>{fw(e)&&($Z(t,e),_Z(t,e))},_Z=(t,e)=>{const n=`(done in ${NP(t.durationMs)})`;fu({type:"duration",verboseMessage:n,verboseInfo:e,result:t})},Zw=(t,e,{reject:n})=>{if(kZ(t,e),t.failed&&n)throw t;return t},CZ=(t,e)=>ba(t)?"asyncGenerator":FP(t)?"generator":tb(t)?"fileUrl":OZ(t)?"filePath":MZ(t)?"webStream":Zs(t,{checkOpen:!1})?"native":sr(t)?"uint8Array":FZ(t)?"asyncIterable":jZ(t)?"iterable":rb(t)?OP({transform:t},e):xZ(t)?AZ(t,e):"native",AZ=(t,e)=>gP(t.transform,{checkOpen:!1})?IZ(t,e):rb(t.transform)?OP(t,e):PZ(t,e),IZ=(t,e)=>(DP(t,e,"Duplex stream"),"duplex"),OP=(t,e)=>(DP(t,e,"web TransformStream"),"webTransform"),DP=({final:t,binary:e,objectMode:n},r,i)=>{LP(t,`${r}.final`,i),LP(e,`${r}.binary`,i),eb(n,`${r}.objectMode`)},LP=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${n}.`)},PZ=({transform:t,final:e,binary:n,objectMode:r},i)=>{if(t!==void 0&&!MP(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(gP(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(rb(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!MP(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return eb(n,`${i}.binary`),eb(r,`${i}.objectMode`),ba(t)||ba(e)?"asyncGenerator":"generator"},eb=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},MP=t=>ba(t)||FP(t),ba=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FP=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",xZ=t=>Wn(t)&&(t.transform!==void 0||t.final!==void 0),tb=t=>Object.prototype.toString.call(t)==="[object URL]",NZ=t=>tb(t)&&t.protocol!=="file:",OZ=t=>Wn(t)&&Object.keys(t).length===1&&jP(t.file),jP=t=>typeof t=="string",DZ=(t,e)=>t==="native"&&typeof e=="string"&&!LZ.has(e),LZ=new Set(["ipc","ignore","inherit","overlapped","pipe"]),UP=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",nb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",MZ=t=>UP(t)||nb(t),rb=t=>UP(t?.readable)&&nb(t?.writable),FZ=t=>BP(t)&&typeof t[Symbol.asyncIterator]=="function",jZ=t=>BP(t)&&typeof t[Symbol.iterator]=="function",BP=t=>typeof t=="object"&&t!==null,to=new Set(["generator","asyncGenerator","duplex","webTransform"]),qP=new Set(["fileUrl","filePath","fileNumber"]),WP=new Set(["fileUrl","filePath"]),UZ=new Set([...WP,"webStream","nodeStream"]),BZ=new Set(["webTransform","duplex"]),Ep={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"},GP=(t,e,n,r)=>r==="output"?qZ(t,e,n):WZ(t,e,n),qZ=(t,e,n)=>{const r=e!==0&&n[e-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t??r}},WZ=(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}},GZ=(t,e)=>{const n=t.findLast(({type:r})=>to.has(r));return n===void 0?!1:e==="input"?n.value.writableObjectMode:n.value.readableObjectMode},zZ=(t,e,n,r)=>[...t.filter(({type:i})=>!to.has(i)),...HZ(t,e,n,r)],HZ=(t,e,n,{encoding:r})=>{const i=t.filter(({type:o})=>to.has(o)),s=Array.from({length:i.length});for(const[o,a]of Object.entries(i))s[o]=VZ({stdioItem:a,index:Number(o),newTransforms:s,optionName:e,direction:n,encoding:r});return JZ(s,n)},VZ=({stdioItem:t,stdioItem:{type:e},index:n,newTransforms:r,optionName:i,direction:s,encoding:o})=>e==="duplex"?KZ({stdioItem:t,optionName:i}):e==="webTransform"?YZ({stdioItem:t,index:n,newTransforms:r,direction:s}):XZ({stdioItem:t,index:n,newTransforms:r,direction:s,encoding:o}),KZ=({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}}},YZ=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i})=>{const{transform:s,objectMode:o}=Wn(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=GP(o,n,r,i);return{...t,value:{transform:s,writableObjectMode:a,readableObjectMode:c}}},XZ=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i,encoding:s})=>{const{transform:o,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Wn(e)?e:{transform:e},d=c||Qs.has(s),{writableObjectMode:f,readableObjectMode:h}=GP(u,n,r,i);return{...t,value:{transform:o,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:h}}},JZ=(t,e)=>e==="input"?t.reverse():t,QZ=(t,e,n)=>{const r=t.map(i=>ZZ(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)??nee},ZZ=({type:t,value:e},n)=>eee[n]??zP[t](e),eee=["input","output","output"],Ta=()=>{},ib=()=>"input",zP={generator:Ta,asyncGenerator:Ta,fileUrl:Ta,filePath:Ta,iterable:ib,asyncIterable:ib,uint8Array:ib,webStream:t=>nb(t)?"output":"input",nodeStream(t){return wp(t,{checkOpen:!1})?pP(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ta,duplex:Ta,native(t){const e=tee(t);if(e!==void 0)return e;if(Zs(t,{checkOpen:!1}))return zP.nodeStream(t)}},tee=t=>{if([0,Ge.stdin].includes(t))return"input";if([1,2,Ge.stdout,Ge.stderr].includes(t))return"output"},nee="output",ree=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t,iee=({stdio:t,ipc:e,buffer:n,...r},i,s)=>{const o=see(t,r).map((a,c)=>HP(a,c));return s?aee(o,n,i):ree(o,e)},see=(t,e)=>{if(t===void 0)return xr.map(r=>e[r]);if(oee(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${xr.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,xr.length);return Array.from({length:n},(r,i)=>t[i])},oee=t=>xr.some(e=>t[e]!==void 0),HP=(t,e)=>Array.isArray(t)?t.map(n=>HP(n,e)):t??(e>=xr.length?"ignore":"pipe"),aee=(t,e,n)=>t.map((r,i)=>!e[i]&&i!==0&&!hw(n,i)&&cee(r)?"ignore":r),cee=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe"),lee=({stdioItem:t,stdioItem:{type:e},isStdioArray:n,fdNumber:r,direction:i,isSync:s})=>!n||e!=="native"?t:s?uee({stdioItem:t,fdNumber:r,direction:i}):hee({stdioItem:t,fdNumber:r}),uee=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r,direction:i})=>{const s=dee({value:e,optionName:n,fdNumber:r,direction:i});if(s!==void 0)return s;if(Zs(e,{checkOpen:!1}))throw new TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},dee=({value:t,optionName:e,fdNumber:n,direction:r})=>{const i=fee(t,n);if(i!==void 0){if(r==="output")return{type:"fileNumber",value:i,optionName:e};if(Db.isatty(i))throw new TypeError(`The \`${e}: ${Fw(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:uu(xp(i)),optionName:e}}},fee=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;const n=dw.indexOf(t);if(n!==-1)return n},hee=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r})=>e==="inherit"?{type:"nodeStream",value:VP(r,e,n),optionName:n}:typeof e=="number"?{type:"nodeStream",value:VP(e,e,n),optionName:n}:Zs(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:n}:t,VP=(t,e,n)=>{const r=dw[t];if(r===void 0)throw new TypeError(`The \`${n}: ${e}\` option is invalid: no such standard stream.`);return r},pee=({input:t,inputFile:e},n)=>n===0?[...gee(t),...yee(e)]:[],gee=t=>t===void 0?[]:[{type:mee(t),value:t,optionName:"input"}],mee=t=>{if(wp(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(sr(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},yee=t=>t===void 0?[]:[{...vee(t),optionName:"inputFile"}],vee=t=>{if(tb(t))return{type:"fileUrl",value:t};if(jP(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")},wee=t=>t.filter((e,n)=>t.every((r,i)=>e.value!==r.value||n>=i||e.type==="generator"||e.type==="asyncGenerator")),bee=({stdioItem:{type:t,value:e,optionName:n},direction:r,fileDescriptors:i,isSync:s})=>{const o=Tee(i,t);if(o.length!==0){if(s){Eee({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});return}if(UZ.has(t))return KP({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});BZ.has(t)&&See({otherStdioItems:o,type:t,value:e,optionName:n})}},Tee=(t,e)=>t.flatMap(({direction:n,stdioItems:r})=>r.filter(i=>i.type===e).map(i=>({...i,direction:n}))),Eee=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{WP.has(e)&&KP({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})},KP=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{const s=t.filter(a=>Ree(a,n));if(s.length===0)return;const o=s.find(a=>a.direction!==i);return YP(o,r,e),i==="output"?s[0].stream:void 0},Ree=({type:t,value:e},n)=>t==="filePath"?e.file===n.file:t==="fileUrl"?e.href===n.href:e===n,See=({otherStdioItems:t,type:e,value:n,optionName:r})=>{const i=t.find(({value:{transform:s}})=>s===n.transform);YP(i,r,e)},YP=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${Ep[n]} that is the same.`)},XP=(t,e,n,r)=>{const s=iee(e,n,r).map((a,c)=>$ee({stdioOption:a,fdNumber:c,options:e,isSync:r})),o=Nee({initialFileDescriptors:s,addProperties:t,options:e,isSync:r});return e.stdio=o.map(({stdioItems:a})=>Lee(a)),o},$ee=({stdioOption:t,fdNumber:e,options:n,isSync:r})=>{const i=lI(e),{stdioItems:s,isStdioArray:o}=kee({stdioOption:t,fdNumber:e,options:n,optionName:i}),a=QZ(s,e,i),c=s.map(d=>lee({stdioItem:d,isStdioArray:o,fdNumber:e,direction:a,isSync:r})),l=zZ(c,i,a,n),u=GZ(l,a);return xee(l,u),{direction:a,objectMode:u,stdioItems:l}},kee=({stdioOption:t,fdNumber:e,options:n,optionName:r})=>{const s=[...(Array.isArray(t)?t:[t]).map(c=>_ee(c,r)),...pee(n,e)],o=wee(s),a=o.length>1;return Cee(o,a,r),Iee(o),{stdioItems:o,isStdioArray:a}},_ee=(t,e)=>({type:CZ(t,e),value:t,optionName:e}),Cee=(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(Aee.has(r))throw new Error(`The \`${i}\` option must not include \`${r}\`.`)}},Aee=new Set(["ignore","ipc"]),Iee=t=>{for(const e of t)Pee(e)},Pee=({type:t,value:e,optionName:n})=>{if(NZ(e))throw new TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
1205
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(DZ(t,e))throw new TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},xee=(t,e)=>{if(!e)return;const n=t.find(({type:r})=>qP.has(r));if(n!==void 0)throw new TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},Nee=({initialFileDescriptors:t,addProperties:e,options:n,isSync:r})=>{const i=[];try{for(const s of t)i.push(Oee({fileDescriptor:s,fileDescriptors:i,addProperties:e,options:n,isSync:r}));return i}catch(s){throw JP(i),s}},Oee=({fileDescriptor:{direction:t,objectMode:e,stdioItems:n},fileDescriptors:r,addProperties:i,options:s,isSync:o})=>{const a=n.map(c=>Dee({stdioItem:c,addProperties:i,direction:t,options:s,fileDescriptors:r,isSync:o}));return{direction:t,objectMode:e,stdioItems:a}},Dee=({stdioItem:t,addProperties:e,direction:n,options:r,fileDescriptors:i,isSync:s})=>{const o=bee({stdioItem:t,direction:n,fileDescriptors:i,isSync:s});return o!==void 0?{...t,stream:o}:{...t,...e[n][t.type](t,r)}},JP=t=>{for(const{stdioItems:e}of t)for(const{stream:n}of e)n!==void 0&&!Xs(n)&&n.destroy()},Lee=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"},Mee=(t,e)=>XP(jee,t,e,!0),Nr=({type:t,optionName:e})=>{QP(e,Ep[t])},Fee=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&QP(t,`"${e}"`),{}),QP=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},ZP={generator(){},asyncGenerator:Nr,webStream:Nr,nodeStream:Nr,webTransform:Nr,duplex:Nr,asyncIterable:Nr,native:Fee},jee={input:{...ZP,fileUrl:({value:t})=>({contents:[uu(xp(t))]}),filePath:({value:{file:t}})=>({contents:[uu(xp(t))]}),fileNumber:Nr,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...ZP,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t}})=>({path:t}),fileNumber:({value:t})=>({path:t}),iterable:Nr,string:Nr,uint8Array:Nr}},Ea=(t,{stripFinalNewline:e},n)=>ex(e,n)&&t!==void 0&&!Array.isArray(t)?zw(t):t,ex=(t,e)=>e==="all"?t[1]||t[2]:t[e],tx=(t,e,n,r)=>t||n?void 0:ix(e,r),nx=(t,e,n)=>n?t.flatMap(r=>rx(r,e)):rx(t,e),rx=(t,e)=>{const{transform:n,final:r}=ix(e,{});return[...n(t),...r()]},ix=(t,e)=>(e.previousChunks="",{transform:Uee.bind(void 0,e,t),final:qee.bind(void 0,e)}),Uee=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]===`
1206
+ `){const o=Bee(n,s,e,t);let a=n.slice(i+1,s+1-o);r.length>0&&(a=sb(r,a),r=""),yield a,i=s}i!==n.length-1&&(r=sb(r,n.slice(i+1))),t.previousChunks=r},Bee=(t,e,n,r)=>n?0:(r.isWindowsNewline=e!==0&&t[e-1]==="\r",r.isWindowsNewline?2:1),qee=function*({previousChunks:t}){t.length>0&&(yield t)},Wee=({binary:t,preserveNewlines:e,readableObjectMode:n,state:r})=>t||e||n?void 0:{transform:Gee.bind(void 0,r)},Gee=function*({isWindowsNewline:t=!1},e){const{unixNewline:n,windowsNewline:r,LF:i,concatBytes:s}=typeof e=="string"?zee:Vee;if(e.at(-1)===i){yield e;return}yield s(e,t?r:n)},sb=(t,e)=>`${t}${e}`,zee={windowsNewline:`\r
1207
+ `,unixNewline:`
1208
+ `,LF:`
1209
+ `,concatBytes:sb},Hee=(t,e)=>{const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n},Vee={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Hee},Kee=(t,e)=>t?void 0:Yee.bind(void 0,e),Yee=function*(t,e){if(typeof e!="string"&&!sr(e)&&!Lp.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Xee=(t,e)=>t?Jee.bind(void 0,e):Qee.bind(void 0,e),Jee=function*(t,e){sx(t,e),yield e},Qee=function*(t,e){if(sx(t,e),typeof e!="string"&&!sr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},sx=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
1210
+ Instead, \`yield\` should either be called with a value, or not be called at all. For example:
1211
+ if (condition) { yield value; }`)},ox=(t,e,n)=>{if(n)return;if(t)return{transform:Zee.bind(void 0,new TextEncoder)};const r=new Ob(e);return{transform:ete.bind(void 0,r),final:tte.bind(void 0,r)}},Zee=function*(t,e){Lp.isBuffer(e)?yield uu(e):typeof e=="string"?yield t.encode(e):yield e},ete=function*(t,e){yield sr(e)?t.write(e):e},tte=function*(t){const e=t.end();e!==""&&(yield e)},ax=so(async(t,e,n,r)=>{e.currentIterable=t(...n);try{for await(const i of e.currentIterable)r.push(i)}finally{delete e.currentIterable}}),ob=async function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=ste}=e[n];for await(const i of r(t))yield*ob(i,e,n+1)},nte=async function*(t){for(const[e,{final:n}]of Object.entries(t))yield*rte(n,Number(e),t)},rte=async function*(t,e,n){if(t!==void 0)for await(const r of t())yield*ob(r,n,e+1)},ite=so(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),ste=function*(t){yield t},cx=(t,e,n,r)=>{try{for(const i of t(...e))n.push(i);r()}catch(i){r(i)}},ote=(t,e)=>[...e.flatMap(n=>[...yu(n,t,0)]),...ab(t)],yu=function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=cte}=e[n];for(const i of r(t))yield*yu(i,e,n+1)},ab=function*(t){for(const[e,{final:n}]of Object.entries(t))yield*ate(n,Number(e),t)},ate=function*(t,e,n){if(t!==void 0)for(const r of t())yield*yu(r,n,e+1)},cte=function*(t){yield t},lx=({value:t,value:{transform:e,final:n,writableObjectMode:r,readableObjectMode:i},optionName:s},{encoding:o})=>{const a={},c=dx(t,o,s),l=ba(e),u=ba(n),d=l?ax.bind(void 0,ob,a):cx.bind(void 0,yu),f=l||u?ax.bind(void 0,nte,a):cx.bind(void 0,ab),h=l||u?ite.bind(void 0,a):void 0;return{stream:new BN({writableObjectMode:r,writableHighWaterMark:$u(r),readableObjectMode:i,readableHighWaterMark:$u(i),transform(y,R,b){d([y,c,0],this,b)},flush(y){f([c],this,y)},destroy:h})}},ux=(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 c=dx(o,n,a);t=ote(c,t)}return t},dx=({transform:t,final:e,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:s},o,a)=>{const c={};return[{transform:Kee(r,a)},ox(n,o,r),tx(n,s,r,c),{transform:t,final:e},{transform:Xee(i,a)},Wee({binary:n,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)},lte=(t,e)=>{for(const n of ute(t))dte(t,n,e)},ute=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),dte=(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:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ep[a]} with synchronous methods.`)}const o=i.map(({contents:a})=>a).map(a=>fte(a,r));n.input=uw(o)},fte=(t,e)=>{const n=ux(t,e,"utf8",!0);return hte(n),uw(n)},hte=t=>{const e=t.find(n=>typeof n!="string"&&!sr(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}.`)},fx=({stdioItems:t,encoding:e,verboseInfo:n,fdNumber:r})=>r!=="all"&&hw(n,r)&&!Qs.has(e)&&pte(r)&&(t.some(({type:i,value:s})=>i==="native"&&gte.has(s))||t.every(({type:i})=>to.has(i))),pte=t=>t===1||t===2,gte=new Set(["pipe","overlapped"]),mte=async(t,e,n,r)=>{for await(const i of t)vte(e)||hx(i,n,r)},yte=(t,e,n)=>{for(const r of t)hx(r,e,n)},vte=t=>t._readableState.pipes.length>0,hx=(t,e,n)=>{const r=vI(t);fu({type:"output",verboseMessage:r,fdNumber:e,verboseInfo:n})},wte=({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((c,l)=>bte({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...s}},bte=({result:t,fileDescriptors:e,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;const f=lZ(t,s,d),h=uu(f),{stdioItems:p,objectMode:y}=e[n],R=Tte([h],p,c,r),{serializedResult:b,finalResult:v=b}=Ete({chunks:R,objectMode:y,encoding:c,lines:l,stripFinalNewline:u,fdNumber:n});Rte({serializedResult:b,fdNumber:n,state:r,verboseInfo:o,encoding:c,stdioItems:p,objectMode:y});const T=a[n]?v:void 0;try{return r.error===void 0&&Ste(b,p,i),T}catch(_){return r.error=_,T}},Tte=(t,e,n,r)=>{try{return ux(t,e,n,!1)}catch(i){return r.error=i,t}},Ete=({chunks:t,objectMode:e,encoding:n,lines:r,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(n==="buffer")return{serializedResult:uw(t)};const o=tY(t,n);return r[s]?{serializedResult:o,finalResult:nx(o,!i[s],e)}:{serializedResult:o}},Rte=({serializedResult:t,fdNumber:e,state:n,verboseInfo:r,encoding:i,stdioItems:s,objectMode:o})=>{if(!fx({stdioItems:s,encoding:i,verboseInfo:r,fdNumber:e}))return;const a=nx(t,!1,o);try{yte(a,e,r)}catch(c){n.error??=c}},Ste=(t,e,n)=>{for(const{path:r}of e.filter(({type:i})=>qP.has(i))){const i=typeof r=="string"?r:r.toString();n.has(i)?wN(r,t):(n.add(i),Ab(r,t))}},$te=([,t,e],n)=>{if(n.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ea(e,n,"all")]:Array.isArray(e)?[Ea(t,n,"all"),...e]:sr(t)&&sr(e)?sI([t,e]):`${t}${e}`},kte=async(t,e)=>{const[n,r]=await _te(t);return e.isForcefullyTerminated??=!1,[n,r]},_te=async t=>{const[e,n]=await Promise.allSettled([nn(t,"spawn"),nn(t,"exit")]);return e.status==="rejected"?[]:n.status==="rejected"?px(t):n.value},px=async t=>{try{return await nn(t,"exit")}catch{return px(t)}},Cte=async t=>{const[e,n]=await t;if(!Ate(e,n)&&gx(e,n))throw new hu;return[e,n]},Ate=(t,e)=>t===void 0&&e===void 0,gx=(t,e)=>t!==0||e!==null,Ite=({error:t,status:e,signal:n,output:r},{maxBuffer:i})=>{const s=Pte(t,e,n),o=s?.code==="ETIMEDOUT",a=cZ(s,r,i);return{resultError:s,exitCode:e,signal:n,timedOut:o,isMaxBuffer:a}},Pte=(t,e,n)=>t!==void 0?t:gx(e,n)?new hu:void 0,xte=(t,e,n)=>{const{file:r,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Nte(t,e,n),d=Lte({file:r,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return Zw(d,c,l)},Nte=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=TI(t,e,n),a=Ote(n),{file:c,commandArguments:l,options:u}=dP(t,e,a);Dte(u);const d=Mee(u,o);return{file:c,commandArguments:l,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},Ote=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Dte=({ipc:t,ipcInput:e,detached:n,cancelSignal:r})=>{e&&Rp("ipcInput"),t&&Rp("ipc: true"),n&&Rp("detached: true"),r&&Rp("cancelSignal")},Rp=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Lte=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{const c=Mte({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;const{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:h}=Ite(c,n),{output:p,error:y=l}=wte({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:h,verboseInfo:s}),R=p.map((v,T)=>Ea(v,n,T)),b=Ea($te(p,n),n,"all");return jte({error:y,exitCode:u,signal:d,timedOut:f,isMaxBuffer:h,stdio:R,all:b,options:n,command:r,escapedCommand:i,startTime:a})},Mte=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{lte(s,n);const a=Fte(n);return xN(t,e,a)}catch(a){return Jw({error:a,command:r,escapedCommand:i,fileDescriptors:s,options:n,startTime:o,isSync:!0})}},Fte=({encoding:t,maxBuffer:e,...n})=>({...n,encoding:"buffer",maxBuffer:Xw(e)}),jte=({error:t,exitCode:e,signal:n,timedOut:r,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?IP({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):Qw({error:t,command:c,escapedCommand:l,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:n,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0}),Ute=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0,filter:s}={})=>(Dw({methodName:"getOneMessage",isSubprocess:n,ipc:r,isConnected:nP(t)}),Bte({anyProcess:t,channel:e,isSubprocess:n,filter:s,reference:i})),Bte=async({anyProcess:t,channel:e,isSubprocess:n,filter:r,reference:i})=>{eP(e,i);const s=pp(t,e,n),o=new AbortController;try{return await Promise.race([qte(s,r,o),Wte(s,n,o),Gte(s,n,o)])}catch(a){throw Lw(t),a}finally{o.abort(),tP(e,i)}},qte=async(t,e,{signal:n})=>{if(e===void 0){const[r]=await nn(t,"message",{signal:n});return r}for await(const[r]of Su(t,"message",{signal:n}))if(e(r))return r},Wte=async(t,e,{signal:n})=>{await nn(t,"disconnect",{signal:n}),vJ(e)},Gte=async(t,e,{signal:n})=>{const[r]=await nn(t,"strict:error",{signal:n});throw YI(r,e)},zte=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0}={})=>mx({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),mx=({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:i,reference:s})=>{Dw({methodName:"getEachMessage",isSubprocess:n,ipc:r,isConnected:nP(t)}),eP(e,s);const o=pp(t,e,n),a=new AbortController,c={};return Hte(t,o,a),Vte({ipcEmitter:o,isSubprocess:n,controller:a,state:c}),Kte({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:a,state:c,reference:s})},Hte=async(t,e,n)=>{try{await nn(e,"disconnect",{signal:n.signal}),n.abort()}catch{}},Vte=async({ipcEmitter:t,isSubprocess:e,controller:n,state:r})=>{try{const[i]=await nn(t,"strict:error",{signal:n.signal});r.error=YI(i,e),n.abort()}catch{}},Kte=async function*({anyProcess:t,channel:e,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(const[c]of Su(n,"message",{signal:s.signal}))yx(o),yield c}catch{yx(o)}finally{s.abort(),tP(e,a),r||Lw(t),i&&await t}},yx=({error:t})=>{if(t)throw t},Yte=(t,{ipc:e})=>{Object.assign(t,vx(t,!1,e))},Xte=()=>{const t=Ge,e=!0,n=Ge.channel!==void 0;return{...vx(t,e,n),getCancelSignal:QJ.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}},vx=(t,e,n)=>({sendMessage:iP.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getOneMessage:Ute.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getEachMessage:zte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}),Jte=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,verboseInfo:o})=>{JP(r);const a=new Nb;Qte(a,r),Object.assign(a,{readable:Zte,writable:ene,duplex:tne});const c=Jw({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:!1}),l=nne(c,o,i);return{subprocess:a,promise:l}},Qte=(t,e)=>{const n=vu(),r=vu(),i=vu(),s=Array.from({length:e.length-3},vu),o=vu(),a=[n,r,i,...s];Object.assign(t,{stdin:n,stdout:r,stderr:i,all:o,stdio:a})},vu=()=>{const t=new Ub;return t.end(),t},Zte=()=>new bs({read(){}}),ene=()=>new Op({write(){}}),tne=()=>new Dp({read(){},write(){}}),nne=async(t,e,n)=>Zw(t,e,n),rne=(t,e)=>XP(ine,t,e,!1),wu=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ep[t]}.`)},wx={fileNumber:wu,generator:lx,asyncGenerator:lx,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:n}}){const r=e||n;return{stream:Dp.fromWeb(t,{objectMode:r})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},ine={input:{...wx,fileUrl:({value:t})=>({stream:Ib(t)}),filePath:({value:{file:t}})=>({stream:Ib(t)}),webStream:({value:t})=>({stream:bs.fromWeb(t)}),iterable:({value:t})=>({stream:bs.from(t)}),asyncIterable:({value:t})=>({stream:bs.from(t)}),string:({value:t})=>({stream:bs.from(t)}),uint8Array:({value:t})=>({stream:bs.from(Lp.from(t))})},output:{...wx,fileUrl:({value:t})=>({stream:Pb(t)}),filePath:({value:{file:t}})=>({stream:Pb(t)}),webStream:({value:t})=>({stream:Op.fromWeb(t)}),iterable:wu,asyncIterable:wu,string:wu,uint8Array:wu}};function cb(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(const i of t)lb(i);const e=t.some(({readableObjectMode:i})=>i),n=sne(t,e),r=new one({objectMode:e,writableHighWaterMark:n,readableHighWaterMark:n});for(const i of t)r.add(i);return r}const sne=(t,e)=>{if(t.length===0)return $u(e);const n=t.filter(({readableObjectMode:r})=>r===e).map(({readableHighWaterMark:r})=>r);return Math.max(...n)};class one extends Ub{#e=new Set([]);#t=new Set([]);#n=new Set([]);#r;#i=Symbol("unpipe");#s=new WeakMap;add(e){if(lb(e),this.#e.has(e))return;this.#e.add(e),this.#r??=ane(this,this.#e,this.#i);const n=une({passThroughStream:this,stream:e,streams:this.#e,ended:this.#t,aborted:this.#n,onFinished:this.#r,unpipeEvent:this.#i});this.#s.set(e,n),e.pipe(this,{end:!1})}async remove(e){if(lb(e),!this.#e.has(e))return!1;const n=this.#s.get(e);return n===void 0?!1:(this.#s.delete(e),e.unpipe(this),await n,!0)}}const ane=async(t,e,n)=>{Sp(t,Rx);const r=new AbortController;try{await Promise.race([cne(t,r),lne(t,e,n,r)])}finally{r.abort(),Sp(t,-Rx)}},cne=async(t,{signal:e})=>{try{await Ti(t,{signal:e,cleanup:!0})}catch(n){throw bx(t,n),n}},lne=async(t,e,n,{signal:r})=>{for await(const[i]of Su(t,"unpipe",{signal:r}))e.has(i)&&i.emit(n)},lb=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},une=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,onFinished:s,unpipeEvent:o})=>{Sp(t,Sx);const a=new AbortController;try{await Promise.race([dne(s,e,a),fne({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:a}),hne({stream:e,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),Sp(t,-Sx)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?ub(t):pne(t))},dne=async(t,e,{signal:n})=>{try{await t,n.aborted||ub(e)}catch(r){n.aborted||bx(e,r)}},fne=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:{signal:s}})=>{try{await Ti(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),n.has(e)&&r.add(e)}catch(o){if(s.aborted||!n.has(e))return;Tx(o)?i.add(e):Ex(t,o)}},hne=async({stream:t,streams:e,ended:n,aborted:r,unpipeEvent:i,controller:{signal:s}})=>{if(await nn(t,i,{signal:s}),!t.readable)return nn(s,"abort",{signal:s});e.delete(t),n.delete(t),r.delete(t)},pne=t=>{t.writable&&t.end()},bx=(t,e)=>{Tx(e)?ub(t):Ex(t,e)},Tx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ub=t=>{(t.readable||t.writable)&&t.destroy()},Ex=(t,e)=>{t.destroyed||(t.once("error",gne),t.destroy(e))},gne=()=>{},Sp=(t,e)=>{const n=t.getMaxListeners();n!==0&&n!==Number.POSITIVE_INFINITY&&t.setMaxListeners(n+e)},Rx=2,Sx=1,$p=(t,e)=>{t.pipe(e),mne(t,e),yne(t,e)},mne=async(t,e)=>{if(!(Xs(t)||Xs(e))){try{await Ti(t,{cleanup:!0,readable:!0,writable:!1})}catch{}$x(e)}},$x=t=>{t.writable&&t.end()},yne=async(t,e)=>{if(!(Xs(t)||Xs(e))){try{await Ti(e,{cleanup:!0,readable:!1,writable:!0})}catch{}kx(t)}},kx=t=>{t.readable&&t.destroy()},vne=(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:c})=>to.has(c)))wne(t,a,o,i);for(const{stream:a}of s.filter(({type:c})=>!to.has(c)))Tne({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]:cb(s);$p(o,i)}},wne=(t,e,n,r)=>{n==="output"?$p(t.stdio[r],e):$p(e,t.stdio[r]);const i=bne[r];i!==void 0&&(t[i]=e),t.stdio[r]=e},bne=["stdin","stdout","stderr"],Tne=({subprocess:t,stream:e,direction:n,fdNumber:r,pipeGroups:i,controller:s})=>{if(e===void 0)return;Ene(e,s);const[o,a]=n==="output"?[e,t.stdio[r]]:[t.stdio[r],e],c=i.get(o)??[];i.set(o,[...c,a])},Ene=(t,{signal:e})=>{Xs(t)&&fp(t,Rne,e)},Rne=2,Ra=[];Ra.push("SIGHUP","SIGINT","SIGTERM"),process.platform!=="win32"&&Ra.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&Ra.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const kp=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",db=Symbol.for("signal-exit emitter"),fb=globalThis,Sne=Object.defineProperty.bind(Object);class $ne{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(fb[db])return fb[db];Sne(fb,db,{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 _x{}const kne=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}});class _ne extends _x{onExit(){return()=>{}}load(){}unload(){}}class Cne extends _x{#e=hb.platform==="win32"?"SIGINT":"SIGHUP";#t=new $ne;#n;#r;#i;#s={};#o=!1;constructor(e){super(),this.#n=e,this.#s={};for(const n of Ra)this.#s[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.#i=e.reallyExit,this.#r=e.emit}onExit(e,n){if(!kp(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 Ra)try{const n=this.#s[e];n&&this.#n.on(e,n)}catch{}this.#n.emit=(e,...n)=>this.#c(e,...n),this.#n.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Ra.forEach(e=>{const n=this.#s[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.#i,this.#t.count-=1)}#a(e){return kp(this.#n)?(this.#n.exitCode=e||0,this.#t.emit("exit",this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...n){const r=this.#r;if(e==="exit"&&kp(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 hb=globalThis.process,{onExit:Ane,load:fse,unload:hse}=kne(kp(hb)?new Cne(hb):new _ne),Ine=(t,{cleanup:e,detached:n},{signal:r})=>{if(!e||n)return;const i=Ane(()=>{t.kill()});jb(r,()=>{i()})},Pne=({source:t,sourcePromise:e,boundOptions:n,createNested:r},...i)=>{const s=wI(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=xne(n,r,i),{sourceStream:d,sourceError:f}=One(t,l),{options:h,fileDescriptors:p}=Js.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:h,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:p,startTime:s}},xne=(t,e,n)=>{try{const{destination:r,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=Nne(t,e,...n),a=XI(r,s);return{destination:r,destinationStream:a,from:i,unpipeSignal:o}}catch(r){return{destinationError:r}}},Nne=(t,e,n,...r)=>{if(Array.isArray(n))return{destination:e(Cx,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]=tI(n,...r);return{destination:e(Cx)(i,s,o),pipeOptions:o}}if(Js.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}`)},Cx=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),One=(t,e)=>{try{return{sourceStream:Mw(t,e)}}catch(n){return{sourceError:n}}},Dne=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:s,startTime:o})=>{const a=Lne({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r});if(a!==void 0)throw Ax({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},Lne=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r})=>{if(e!==void 0&&r!==void 0)return r;if(r!==void 0)return kx(t),r;if(e!==void 0)return $x(n),e},Ax=({error:t,fileDescriptors:e,sourceOptions:n,startTime:r})=>Jw({error:t,command:Ix,escapedCommand:Ix,fileDescriptors:e,options:n,startTime:r,isSync:!1}),Ix="source.pipe(destination)",Mne=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},Fne=(t,e,n)=>{const r=_p.has(e)?Une(t,e):jne(t,e);return fp(t,qne,n.signal),fp(e,Wne,n.signal),Bne(e),r},jne=(t,e)=>{const n=cb([t]);return $p(n,e),_p.set(e,n),n},Une=(t,e)=>{const n=_p.get(e);return n.add(t),n},Bne=async t=>{try{await Ti(t,{cleanup:!0,readable:!1,writable:!0})}catch{}_p.delete(t)},_p=new WeakMap,qne=2,Wne=1,Gne=(t,e)=>t===void 0?[]:[zne(t,e)],zne=async(t,{sourceStream:e,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:s})=>{await PN(t,e),await n.remove(e);const o=new Error("Pipe canceled by `unpipeSignal` option.");throw Ax({error:o,fileDescriptors:r,sourceOptions:i,startTime:s})},pb=(t,...e)=>{if(Wn(e[0]))return pb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});const{destination:n,...r}=Pne(t,...e),i=Hne({...r,destination:n});return i.pipe=pb.bind(void 0,{...t,source:n,sourcePromise:i,boundOptions:{}}),i},Hne=async({sourcePromise:t,sourceStream:e,sourceOptions:n,sourceError:r,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{const u=Vne(t,i);Dne({sourceStream:e,sourceError:r,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:n,startTime:l});const d=new AbortController;try{const f=Fne(e,s,d);return await Promise.race([Mne(u),...Gne(a,{sourceStream:e,mergedStream:f,sourceOptions:n,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Vne=(t,e)=>Promise.allSettled([t,e]),Px=({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:r,encoding:i,preserveNewlines:s})=>{const o=new AbortController;return Kne(e,o),Nx({stream:t,controller:o,binary:n,shouldEncode:!t.readableObjectMode&&r,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},Kne=async(t,e)=>{try{await t}catch{}finally{e.abort()}},xx=({stream:t,onStreamEnd:e,lines:n,encoding:r,stripFinalNewline:i,allMixed:s})=>{const o=new AbortController;Yne(e,o,t);const a=t.readableObjectMode&&!s;return Nx({stream:t,controller:o,binary:r==="buffer",shouldEncode:!a,encoding:r,shouldSplit:!a&&n,preserveNewlines:!i})},Yne=async(t,e,n)=>{try{await t}catch{n.destroy()}finally{e.abort()}},Nx=({stream:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})=>{const a=Su(t,"data",{signal:e.signal,highWaterMark:Dx,highWatermark:Dx});return Xne({onStdoutChunk:a,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})},Ox=$u(!0),Dx=Ox,Xne=async function*({onStdoutChunk:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o}){const a=Jne({binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(const[c]of t)yield*yu(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*ab(a)}},Jne=({binary:t,shouldEncode:e,encoding:n,shouldSplit:r,preserveNewlines:i})=>[ox(t,n,!e),tx(t,i,!r,{})].filter(Boolean),Qne=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{const d=Zne({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([ere(t),d]);return}const f=ex(c,n),h=xx({stream:t,onStreamEnd:e,lines:o,encoding:r,stripFinalNewline:f,allMixed:a}),[p]=await Promise.all([tre({stream:t,iterable:h,fdNumber:n,encoding:r,maxBuffer:s,lines:o}),d]);return p},Zne=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!fx({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:s,fdNumber:n}))return;const a=xx({stream:t,onStreamEnd:e,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i});await mte(a,t,n,s)},ere=async t=>{await MN(),t.readableFlowing===null&&t.resume()},tre=async({stream:t,stream:{readableObjectMode:e},iterable:n,fdNumber:r,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await LQ(n,{maxBuffer:s}):i==="buffer"?new Uint8Array(await BQ(n,{maxBuffer:s})):await JQ(n,{maxBuffer:s})}catch(a){return Mx(rZ({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:r}))}},Lx=async t=>{try{return await t}catch(e){return Mx(e)}},Mx=({bufferedData:t})=>QK(t)?new Uint8Array(t):t,gb=async(t,e,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{const s=nre(t,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],Ti(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||sre(a,e,n,r)}finally{o.abort()}},nre=(t,{originalStreams:[e],subprocess:n})=>{const r={stdinCleanedUp:!1};return t===e&&rre(t,n,r),r},rre=(t,e,n)=>{const{_destroy:r}=t;t._destroy=(...i)=>{ire(e,n),r.call(t,...i)}},ire=({exitCode:t,signalCode:e},n)=>{(t!==null||e!==null)&&(n.stdinCleanedUp=!0)},sre=(t,e,n,r)=>{if(!ore(t,e,n,r))throw t},ore=(t,e,n,r=!0)=>n.propagating?jx(t)||mb(t):(n.propagating=!0,Fx(n,e)===r?jx(t):mb(t)),Fx=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",mb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",jx=t=>t?.code==="EPIPE",are=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>Ux({stream:c,fdNumber:l,encoding:e,buffer:n[l],maxBuffer:r[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),Ux=async({stream:t,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;const u=gb(t,e,l);if(Fx(l,e)){await u;return}const[d]=await Promise.all([Qne({stream:t,onStreamEnd:u,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d},cre=({stdout:t,stderr:e},{all:n})=>n&&(t||e)?cb([t,e].filter(Boolean)):void 0,lre=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>Ux({...ure(t,n),fdNumber:"all",encoding:e,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:dre(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),ure=({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}},dre=({all:t,stdout:e,stderr:n})=>t&&e&&n&&e.readableObjectMode!==n.readableObjectMode,fre=t=>hw(t,"ipc"),hre=(t,e)=>{const n=vI(t);fu({type:"ipc",verboseMessage:n,fdNumber:"ipc",verboseInfo:e})},pre=async({subprocess:t,buffer:e,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:s})=>{if(!r)return i;const o=fre(s),a=du(e,"ipc"),c=du(n,"ipc");for await(const l of mx({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))a&&(sZ(t,i,c),i.push(l)),o&&hre(l,s);return i},gre=async(t,e)=>(await Promise.allSettled([t]),e),mre=async({subprocess:t,options:{encoding:e,buffer:n,maxBuffer:r,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:h,fileDescriptors:p,originalStreams:y,onInternalError:R,controller:b})=>{const v=kte(t,f),T={originalStreams:y,fileDescriptors:p,subprocess:t,exitPromise:v,propagating:!1},_=are({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:h,streamInfo:T}),N=lre({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:h,streamInfo:T}),F=[],P=pre({subprocess:t,buffer:n,maxBuffer:r,ipc:u,ipcOutput:F,verboseInfo:h}),G=yre(y,t,T),B=vre(p,T);try{return await Promise.race([Promise.all([{},Cte(v),Promise.all(_),N,P,pQ(t,d),...G,...B]),R,wre(t,b),...oQ(t,s,f,b),...gJ({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:b}),...nQ({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(W){return f.terminationReason??="other",Promise.all([{error:W},v,Promise.all(_.map(I=>Lx(I))),Lx(N),gre(P,F),Promise.allSettled(G),Promise.allSettled(B)])}},yre=(t,e,n)=>t.map((r,i)=>r===e.stdio[i]?void 0:gb(r,i,n)),vre=(t,e)=>t.flatMap(({stdioItems:n},r)=>n.filter(({value:i,stream:s=i})=>Zs(s,{checkOpen:!1})&&!Xs(s)).map(({type:i,value:s,stream:o=s})=>gb(o,r,e,{isSameDirection:to.has(i),stopOnExit:i==="native"}))),wre=async(t,{signal:e})=>{const[n]=await nn(t,"error",{signal:e});throw n},bre=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),yb=(t,e,n)=>{const r=t[n];r.has(e)||r.set(e,[]);const i=r.get(e),s=pu();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Cp=async({resolve:t,promises:e},n)=>{t();const[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...e])]);return!r},Bx=async t=>{if(t!==void 0)try{await qx(t)}catch{}},Tre=async t=>{if(t!==void 0)try{await Wx(t)}catch{}},qx=async t=>{await Ti(t,{cleanup:!0,readable:!1,writable:!0})},Wx=async t=>{await Ti(t,{cleanup:!0,readable:!0,writable:!1})},Gx=async(t,e)=>{if(await t,e)throw e},zx=(t,e,n)=>{n&&!mb(n)?t.destroy(n):e&&t.destroy()},Ere=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,binary:i=!0,preserveNewlines:s=!0}={})=>{const o=i||Qs.has(n),{subprocessStdout:a,waitReadableDestroy:c}=Hx(t,r,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=Vx(a,o),{read:f,onStdoutDataDone:h}=Kx({subprocessStdout:a,subprocess:t,binary:o,encoding:n,preserveNewlines:s}),p=new bs({read:f,destroy:so(Xx.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return Yx({subprocessStdout:a,onStdoutDataDone:h,readable:p,subprocess:t}),p},Hx=(t,e,n)=>{const r=Mw(t,e),i=yb(n,r,"readableDestroy");return{subprocessStdout:r,waitReadableDestroy:i}},Vx=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n},r)=>r?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:Ox},Kx=({subprocessStdout:t,subprocess:e,binary:n,encoding:r,preserveNewlines:i})=>{const s=pu(),o=Px({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){Rre(this,o,s)},onStdoutDataDone:s}},Rre=async(t,e,n)=>{try{const{value:r,done:i}=await e.next();i?n.resolve():t.push(r)}catch{}},Yx=async({subprocessStdout:t,onStdoutDataDone:e,readable:n,subprocess:r,subprocessStdin:i})=>{try{await Wx(t),await r,await Bx(i),await e,n.readable&&n.push(null)}catch(s){await Bx(i),Jx(n,s)}},Xx=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:n},r)=>{await Cp(n,e)&&(Jx(t,r),await Gx(e,r))},Jx=(t,e)=>{zx(t,t.readable,e)},Sre=({subprocess:t,concurrentStreams:e},{to:n}={})=>{const{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}=Qx(t,n,e),o=new Op({...Zx(r,t,i),destroy:so(tN.bind(void 0,{subprocessStdin:r,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return eN(r,o),o},Qx=(t,e,n)=>{const r=XI(t,e),i=yb(n,r,"writableFinal"),s=yb(n,r,"writableDestroy");return{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}},Zx=(t,e,n)=>({write:$re.bind(void 0,t),final:so(kre.bind(void 0,t,e,n))}),$re=(t,e,n,r)=>{t.write(e,n)?r():t.once("drain",r)},kre=async(t,e,n)=>{await Cp(n,e)&&(t.writable&&t.end(),await e)},eN=async(t,e,n)=>{try{await qx(t),e.writable&&e.end()}catch(r){await Tre(n),nN(e,r)}},tN=async({subprocessStdin:t,subprocess:e,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await Cp(n,e),await Cp(r,e)&&(nN(t,i),await Gx(e,i))},nN=(t,e)=>{zx(t,t.writable,e)},_re=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{const a=s||Qs.has(n),{subprocessStdout:c,waitReadableDestroy:l}=Hx(t,r,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=Qx(t,i,e),{readableEncoding:h,readableObjectMode:p,readableHighWaterMark:y}=Vx(c,a),{read:R,onStdoutDataDone:b}=Kx({subprocessStdout:c,subprocess:t,binary:a,encoding:n,preserveNewlines:o}),v=new Dp({read:R,...Zx(u,t,d),destroy:so(Cre.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:y,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:p,writableObjectMode:u.writableObjectMode,encoding:h});return Yx({subprocessStdout:c,onStdoutDataDone:b,readable:v,subprocess:t,subprocessStdin:u}),eN(u,v,c),v},Cre=async({subprocessStdout:t,subprocessStdin:e,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([Xx({subprocessStdout:t,subprocess:n,waitReadableDestroy:r},o),tN({subprocessStdin:e,subprocess:n,waitWritableFinal:i,waitWritableDestroy:s},o)])},rN=(t,e,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{const s=r||Qs.has(e),o=Mw(t,n),a=Px({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return Are(a,o,t)},Are=async function*(t,e,n){try{yield*t}finally{e.readable&&e.destroy(),await n}},Ire=(t,{encoding:e})=>{const n=bre();t.readable=Ere.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.writable=Sre.bind(void 0,{subprocess:t,concurrentStreams:n}),t.duplex=_re.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.iterable=rN.bind(void 0,t,e),t[Symbol.asyncIterator]=rN.bind(void 0,t,e,{})},Pre=(t,e)=>{for(const[n,r]of Nre){const i=r.value.bind(e);Reflect.defineProperty(t,n,{...r,value:i})}},xre=(async()=>{})().constructor.prototype,Nre=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(xre,t)]),Ore=(t,e,n,r)=>{const{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Dre(t,e,n),{subprocess:f,promise:h}=Mre({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=pb.bind(void 0,{source:f,sourcePromise:h,boundOptions:{},createNested:r}),Pre(f,h),Js.set(f,{options:u,fileDescriptors:d}),f},Dre=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=TI(t,e,n),{file:a,commandArguments:c,options:l}=dP(t,e,n),u=Lre(l),d=rne(u,o);return{file:a,commandArguments:c,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},Lre=({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}},Mre=({file:t,commandArguments:e,options:n,startTime:r,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=NN(t,e,n)}catch(p){return Jte({error:p,command:s,escapedCommand:o,fileDescriptors:a,options:n,startTime:r,verboseInfo:i})}const l=new AbortController;jN(Number.POSITIVE_INFINITY,l.signal);const u=[...c.stdio];vne(c,a,l),Ine(c,n,l);const d={},f=pu();c.kill=uJ.bind(void 0,{kill:c.kill.bind(c),options:n,onInternalError:f,context:d,controller:l}),c.all=cre(c,n),Ire(c,n),Yte(c,n);const h=Fre({subprocess:c,options:n,startTime:r,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:h}},Fre=async({subprocess:t,options:e,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{const[d,[f,h],p,y,R]=await mre({subprocess:t,options:e,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();const b=p.map((_,N)=>Ea(_,e,N)),v=Ea(y,e,"all"),T=jre({errorInfo:d,exitCode:f,signal:h,stdio:b,all:v,ipcOutput:R,context:c,options:e,command:o,escapedCommand:a,startTime:n});return Zw(T,r,e)},jre=({errorInfo:t,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Qw({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof bp,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):IP({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:s,options:a,startTime:u}),vb=(t,e)=>{const n=Object.fromEntries(Object.entries(e).map(([r,i])=>[r,Ure(r,t[r],i)]));return{...t,...n}},Ure=(t,e,n)=>Bre.has(t)&&Wn(e)&&Wn(n)?{...e,...n}:n,Bre=new Set(["env",...hI]),no=(t,e,n,r)=>{const i=(o,a,c)=>no(o,a,n,c),s=(...o)=>qre({mapArguments:t,deepOptions:n,boundOptions:e,setBoundExeca:r,createNested:i},...o);return r!==void 0&&r(s,i,e),s},qre=({mapArguments:t,deepOptions:e={},boundOptions:n={},setBoundExeca:r,createNested:i},s,...o)=>{if(Wn(s))return i(t,vb(n,s),r);const{file:a,commandArguments:c,options:l,isSync:u}=Wre({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:n});return u?xte(a,c,l):Ore(a,c,l,i)},Wre=({mapArguments:t,firstArgument:e,nextArguments:n,deepOptions:r,boundOptions:i})=>{const s=sY(e)?oY(e,n):[e,...n],[o,a,c]=tI(...s),l=vb(vb(r,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:h=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:h}},Gre=({file:t,commandArguments:e})=>iN(t,e),zre=({file:t,commandArguments:e})=>({...iN(t,e),isSync:!0}),iN=(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]=Hre(t);return{file:n,commandArguments:r}},Hre=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(Vre)){const i=n.at(-1);i&&i.endsWith("\\")?n[n.length-1]=`${i.slice(0,-1)} ${r}`:n.push(r)}return n},Vre=/ +/g,Kre=(t,e,n)=>{t.sync=e(Xre,n),t.s=t.sync},Yre=({options:t})=>sN(t),Xre=({options:t})=>({...sN(t),isSync:!0}),sN=t=>({options:{...Jre(t),...t}}),Jre=({input:t,inputFile:e,stdio:n})=>t===void 0&&e===void 0&&n===void 0?{stdin:"inherit"}:{},Qre={preferLocal:!0},wb=no(()=>({}));no(()=>({isSync:!0})),no(Gre),no(zre),no(cQ),no(Yre,{},Qre,Kre),Xte();const bb=sp(2);class Zre{constructor(e="dot"){this.path=e}async unflatten(e){return await bb(async()=>{const n=await wb("unflatten",["-l 1","-c 3"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});return n instanceof Error&&(n.stdout?Me.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' failed: ${n.stderr}
1212
+
1213
+ but returned
1214
+ ${n.stdout}`):Me.error(`[BinaryGraphvizLayouter.layout] '${n.command}' failed: ${n.stderr}
1215
+
1216
+ nothing returned, ignoring...`)),n.stdout&&(e=n.stdout.replaceAll(/\t\[/g," [").replaceAll(/\t/g," ")),e})}async layoutJson(e){return await bb(async()=>{const n=await wb(this.path,["-Tjson","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(n instanceof Error){if(!n.stdout)throw Me.error(`[BinaryGraphvizLayouter.layout] '${n.command}' nothing returned and failed: "${n.stderr}"`),n;Me.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' returned result but also failed "${n.stderr}"`)}return n.stdout})}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){return await bb(async()=>{const n=await wb(this.path,["-Tsvg","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(n instanceof Error){if(!n.stdout)throw Me.error(`[BinaryGraphvizLayouter.layout] '${n.command}' nothing returned and failed: ${n.stderr}`),n;Me.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' returned result but also failed ${n.stderr}`)}return n.stdout})}}function Tb(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 Eb(t,e,n=".",r){if(!Tb(e))return Eb(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]]:Tb(o)&&Tb(i[s])?i[s]=Eb(o,i[s],(n?`${n}.`:"")+s.toString(),r):i[s]=o))}return i}function eie(t){return(...e)=>e.reduce((n,r)=>Eb(n,r,"",t),{})}const tie=eie();class nie{constructor(){this.encoding="utf-8"}readFile(e){return Cb.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await Cb.promises.readdir(e.fsPath,{withFileTypes:!0})).map(r=>({dirent:r,isFile:r.isFile(),isDirectory:r.isDirectory(),uri:On.joinPath(e,r.name)}))}}const rie={fileSystemProvider:()=>new nie},iie="likec4",sie="1.10.0",oie="MIT",aie="https://likec4.dev",cie="Denis Davydkov <denis@davydkov.com>",lie={url:"https://github.com/sponsors/davydkov"},uie={type:"git",url:"https://github.com/likec4/likec4.git",directory:"packages/likec4"},die={node:">=20.0.0"},fie="https://github.com/likec4/likec4/issues",hie="module",pie="./bin/likec4.mjs",gie={".":"./src/index.ts","./react":{types:"./app/react/components/index.ts",default:"./react/index.mjs"},"./react/style.css":"./react/style.css","./icons/all":{types:"./icons/all.d.ts",default:"./icons/all.js"},"./icons/*":{types:"./icons/icon.d.ts",default:"./icons/*"}},mie={registry:"https://registry.npmjs.org",access:"public",exports:{".":{types:"./dist/index.d.mts",default:"./dist/index.mjs"},"./react":{types:"./react/index.d.ts",default:"./react/index.mjs"},"./react/style.css":"./react/style.css","./icons/all":{types:"./icons/all.d.ts",default:"./icons/all.js"},"./icons/*":{types:"./icons/icon.d.ts",default:"./icons/*"}}},yie={"turbo-build":"turbo run build --log-prefix=none --log-order=grouped","typecheck:app":"tsc --noEmit -p ./app/tsconfig.json","typecheck:cli":"tsc --noEmit -p ./tsconfig.cli.json",typecheck:"run-p --print-label 'typecheck:*'",prebuild:"tsx scripts/prebuild.ts","build:cli":"unbuild","build:app":"tsx scripts/bundle-app.ts","build:react":"tsx scripts/bundle-react.ts","build:react-dts":"tsx scripts/dts-react.ts","build:webcomponent":"tsx scripts/bundle-webcomponent.ts",build:"run prebuild && run-p --print-label 'build:*'",generate:"tsx scripts/generate.ts",prepack:"tsx scripts/prepack.ts",lint:"run -T eslint src/ --fix",clean:"run -T rimraf dist app/dist dev/.export dev/dist node_modules/.vite",dev:"tsx watch src/cli/index.ts serve dev","dev:docs:bigbank":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/bigbank","dev:docs:dynamic-view":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/dynamic-view","dev:docs:index-page":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/index-page","dev:docs:theme":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/likec4-theme","dev:template":"tsx watch src/cli/index.ts serve ../create-likec4/template","dev:example-cloud":"tsx watch src/cli/index.ts serve ../../examples/cloud-system","dev:failed":"tsx watch src/cli/index.ts serve ../../examples/failed","dev:example-dev":"tsx watch src/cli/index.ts serve ../../examples/diagrams-dev/likec4",cli:"tsx src/cli/index.ts","cli:serve":"tsx watch src/cli/index.ts serve dev","cli:build":"tsx src/cli/index.ts build -o dev/dist dev","cli:preview":"tsx src/cli/index.ts preview -o dev/dist dev","cli:export":"tsx src/cli/index.ts export png -o dev/export dev","cli:export:json":"tsx src/cli/index.ts export json -o dev/export/likec4.json dev",test:"vitest run --no-isolate","vitest:ui":"vitest --no-isolate --ui","test:watch":"vitest"},vie={"@hpcc-js/wasm-graphviz":"1.3.0","@nanostores/react":"0.7.3","@vitejs/plugin-react":"4.3.1","esm-env":"^1.0.0",nanostores:"0.11.3",playwright:"1.46.1",react:"^18.3.1","react-dom":"^18.3.1",vite:"5.3.4",yargs:"17.7.2"},wie={"@fontsource/ibm-plex-sans":"^5.0.21","@likec4/core":"workspace:*","@likec4/diagram":"workspace:*","@likec4/generators":"workspace:*","@likec4/icons":"workspace:*","@likec4/language-server":"workspace:*","@likec4/layouts":"workspace:*","@likec4/log":"workspace:*","@likec4/tsconfig":"workspace:*","@mantine/core":"7.12.2","@mantine/hooks":"7.12.2","@mantine/vanilla-extract":"7.12.2","@react-hookz/web":"^24.0.4","@tabler/icons-react":"^3.14.0","@tanstack/react-router":"1.45.13","@tanstack/router-cli":"1.45.13","@tanstack/router-vite-plugin":"1.45.13","@types/node":"^20.16.1","@types/prop-types":"^15.7.11","@types/react":"18.3.4","@types/react-dom":"18.3.0","@types/string-hash":"^1.1.3","@types/yargs":"^17.0.33","@vanilla-extract/css":"^1.15.5","@vanilla-extract/dynamic":"^2.1.2","@vanilla-extract/vite-plugin":"^4.0.15","@xyflow/react":"12.1.1","@xyflow/system":"0.0.39",autoprefixer:"^10.4.20","ci-info":"^3.9.0",classnames:"^2.5.1",clsx:"^2.1.1",defu:"^6.1.4","dts-bundle-generator":"^9.5.1",esbuild:"^0.23.1","esbuild-node-externals":"^1.14.0",execa:"^9.3.1","fast-equals":"^5.0.1","framer-motion":"^11.3.30","get-port":"^7.1.0",glob:"^11.0.0","html-to-image":"^1.11.11",json5:"^2.2.3",langium:"3.1.3",mkdirp:"^3.0.1","npm-run-all2":"^6.2.2","p-limit":"^6.1.0","package-up":"^5.0.0",postcss:"^8.4.41","postcss-preset-mantine":"^1.17.0","pretty-ms":"^9.1.0","react-error-boundary":"^4.0.13","react-resizable-panels":"^2.1.2","react-shadow":"^20.5.0",remeda:"^2.11.0","string-hash":"^1.1.3","strip-indent":"^4.0.0",terser:"^5.31.6",tinyrainbow:"^1.2.0",tsx:"~4.9.3",turbo:"^2.1.1","type-fest":"^4.26.0",typescript:"^5.5.4",ufo:"^1.5.4",unbuild:"^3.0.0-rc.7","vite-plugin-css-injected-by-js":"^3.5.1","vite-plugin-shadow-style":"^1.1.1",vitest:"~2.0.5"},bie="yarn@4.3.1",oN={name:iie,version:sie,license:oie,homepage:aie,author:cie,sponsor:lie,repository:uie,engines:die,bugs:fie,type:hie,bin:pie,exports:gie,publishConfig:mie,scripts:yie,dependencies:vie,devDependencies:wie,packageManager:bie};var Rb={},Tie=[{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}];(function(t){const e=Tie,n=process.env;Object.defineProperty(t,"_vendors",{value:e.map(function(i){return i.constant})}),t.name=null,t.isPR=null,e.forEach(function(i){const o=(Array.isArray(i.env)?i.env:[i.env]).every(function(a){return r(a)});if(t[i.constant]=o,!!o)switch(t.name=i.name,typeof i.pr){case"string":t.isPR=!!n[i.pr];break;case"object":"env"in i.pr?t.isPR=i.pr.env in n&&n[i.pr.env]!==i.pr.ne:"any"in i.pr?t.isPR=i.pr.any.some(function(a){return!!n[a]}):t.isPR=r(i.pr);break;default:t.isPR=null}}),t.isCI=!!(n.CI!=="false"&&(n.BUILD_ID||n.BUILD_NUMBER||n.CI||n.CI_APP_ID||n.CI_BUILD_ID||n.CI_BUILD_NUMBER||n.CI_NAME||n.CONTINUOUS_INTEGRATION||n.RUN_ID||t.name));function r(i){return typeof i=="string"?!!n[i]:"env"in i?n[i.env]&&n[i.env].includes(i.includes):"any"in i?i.any.some(function(s){return!!n[s]}):Object.keys(i).every(function(s){return n[s]===i[s]})}})(Rb);const aN=Ze.bold(Ze.bgRed(Ze.white("ERROR"))),Eie=Ze.bold(Ze.yellow("WARN")),Rie=Ze.bold(Ze.green("INFO"));function cN(t){const e=qN("info",{prefix:t,allowClearScreen:!Rb.isCI}),n=!Rb.isCI;return{...e,info(r,i){e.info(`${Rie} ${r}`,{timestamp:n,...i})},warn(r,i){e.warn(`${Eie} ${r}`,{timestamp:n,...i})},error(r,i){if(r instanceof Error){e.error(`${aN} ${Ze.red(r.stack??r.name+" "+r.message)}`,{timestamp:n,error:r,...i});return}e.error(`${aN} ${r}`,{timestamp:n,...i})}}}const Sie=1e6;function lN(t){const[e,n]=Eu(t),r=e*1e3+n/Sie;return{ms:r,pretty:NP(r)}}function $ie(t){const e=Eu();return{stopAndLog(n="done in "){n=Ze.green(`${n}${lN(e).pretty}`),t?t.info(n):Me.success(n)}}}class kie{constructor(e){this.services=e,this.layouter=e.likec4.Layouter}cache=new WeakMap;layouter;previousAction=Promise.resolve();limit=sp(2);inflightRequest;async computedViews(){try{this.inflightRequest??=Promise.resolve().then(async()=>await this.services.likec4.ModelBuilder.buildComputedModel());const e=await Promise.resolve(this.inflightRequest);return Object.values(e?.views??{})}finally{this.inflightRequest=void 0}}async layoutViews(){const e=this.services.logger,n=this.previousAction.then(async()=>{const r=(await this.computedViews()).map(i=>this.limit(async()=>{try{let s=this.cache.get(i);return s||(s=await this.layouter.layout(i),this.cache.set(i,s)),s}catch(s){return e.error(s),null}}));return(await Promise.all(r)).filter(Q)});return this.previousAction=n.catch(r=>(e.error(r),Promise.resolve([]))),await n}async diagrams(){return(await this.layoutViews()).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(s=>this.limit(async()=>{const{dot:o,svg:a}=await this.layouter.svg(s);return{id:s.id,dot:o,svg:a}})),i=await Promise.all(r);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}}class _ie{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(`${Ze.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(`${Ze.dim("workspace:")} found ${s.length} source files`),await i.build(s,{validation:!0});const o=await n.buildComputedModel(),a=Gf(o?.views??{}).length;if(a===0){e.warn(`${Ze.dim("workspace:")} no views found`);return}e.info(`${Ze.dim("workspace:")} ${Ze.green(`\u2713 computed ${a} views`)}`);const c=await this.services.likec4.Views.diagrams();c.length===a?e.info(`${Ze.dim("workspace:")} ${Ze.green("\u2713 all views layouted")}`):e.warn(`${Ze.dim("workspace:")} ${Ze.yellow(`\u2717 layouted ${c.length} views`)}`)}}function uN(t){return e=>new t(e)}const Cie={logger:()=>{throw new Error("Logger must be provided")},likec4:{Layouter:()=>{throw new Error("Layouter must be provided")},Views:uN(kie)},cli:{Workspace:uN(_ie)}};function dN(t){const e=tie(t,{useFileSystem:!0,logger:"default",graphviz:"wasm"});let n;switch(e.logger){case"vite":n=cN("c4:lsp ");break;case"default":n=Me;break;default:n=e.logger}const r=e.graphviz==="binary";n.info(`${Ze.dim("version")} ${oN.version}`),n.info(`${Ze.dim("layout")} ${r?"binary":"wasm"}`);const i={logger:()=>n,likec4:{Layouter:()=>new JK(r===!0?new Zre:new UK)}};return IH("warn"),DV(e.useFileSystem?rie:{},Cie,i).likec4}const fN=t=>new Error(`Invalid model:
1217
+ ${t.getErrors().map(e=>` ${e.sourceFsPath}:${e.line} ${e.message.slice(0,200)}`).join(`
1218
+ `)}`);class is{constructor(e,n,r){this.workspace=e,this.langium=n,this.isPrintErrorEnabled=r,this.logger=n.logger,this.langiumDocuments=n.shared.workspace.LangiumDocuments,this.views=n.likec4.Views,this.isPrintErrorEnabled&&this.printErrors()}static async fromSource(e,n){const r=dN({useFileSystem:!1,...n}),i=Jt.from({scheme:"virtual",path:"/workspace"});await r.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"});const s=On.joinPath(i,"source.likec4");r.shared.workspace.LangiumDocuments.createDocument(s,e),await r.cli.Workspace.init();const o=new is(i.path,r,n?.printErrors??!0);return n?.throwIfInvalid===!0&&o.hasErrors()?Promise.reject(fN(o)):o}static likec4Instances=new Map;static async fromWorkspace(e,n){const r=EN(e);if(!bN(r))throw new Error(`Workspace not found: ${r}`);let i=is.likec4Instances.get(r);if(!i){const s=dN({useFileSystem:!0,...n});await s.cli.Workspace.initWorkspace({uri:SN(r).toString(),name:RN(r)}),await s.cli.Workspace.init(),i=new is(r,s,n?.printErrors??!0),is.likec4Instances.set(r,i)}return n?.throwIfInvalid===!0&&i.hasErrors()?Promise.reject(fN(i)):i}cachedModel;logger;langiumDocuments;views;async computed(){return await this.langium.likec4.ModelBuilder.buildComputedModel()}model(){if(!this.cachedModel){const e=this.langium.likec4.ModelBuilder.unsafeSyncBuildModel();if(!e)throw new Error("Failed to build model");const n=this.langium.likec4.ModelBuilder.unsafeSyncBuildComputedModel(e);this.cachedModel=Bu.from(n)}return this.cachedModel}async diagrams(){return await this.views.diagrams()}getErrors(){return this.langiumDocuments.all.toArray().flatMap(e=>(e.diagnostics??[]).filter(n=>n.severity===Lc.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===Lc.Error))}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(`
1219
+ `);return a.length>10&&(a.length=10,a.push("...")),a.map((c,l)=>l===0?" "+Ze.dim(`Line ${o}: `)+Ze.red(c):" ".repeat(10)+Ze.red(c))}).join(`
1220
+ `);this.logger.error(`Invalid ${n.uri.fsPath}
1221
+ ${i}`)}}return e}async notifyUpdate({changed:e,removed:n}){const r=this.langium.shared.workspace.WorkspaceLock;try{let i=!1;return await r.write(async s=>{await this.langium.shared.workspace.DocumentBuilder.update(e?[Jt.file(e)]:[],n?[Jt.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 is.likec4Instances)n===this&&is.likec4Instances.delete(e)}}export{lT as $,Ze as A,sp as B,Hn as C,Me as D,Pa as E,tO as F,ci as G,nT as H,z_ as I,cN as J,ro as K,is as L,kH as M,xT as N,Ev as O,_H as P,Kc as Q,V_ as R,lN as S,ce as T,Bu as U,$ie as V,_n as W,lv as X,pg as Y,tr as Z,Rs as _,go as a,Ke as a0,oN as a1,Q0 as b,c0 as c,rT as d,Wp as e,aT as f,Uu as g,Ia as h,at as i,nO as j,bt as k,At as l,bL as m,bo as n,yo as o,ct as p,Se as q,Rt as r,Ye as s,fr as t,kr as u,Xe as v,gg as w,a0 as x,Q as y,Gi as z};