likec4 1.46.0 → 1.46.2

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.
@@ -1,7 +1,7 @@
1
1
  import*as bS from"node:fs";import{mkdirSync as D4,existsSync as O4}from"node:fs";import Ms,{dirname as _S,resolve as jv,join as L4,relative as M4,sep as j4,basename as q4}from"node:path";import{fileURLToPath as F4,pathToFileURL as H4}from"node:url";import{t as Ye,r as B4,e as Op,n as z4,a as qt,b as wl,f as Vo,g as Wo,d as Ir,c as U4}from"./likec4.CB2-Uaub.mjs";import{isatty as V4}from"tty";import bl,{stripVTControlCharacters as W4}from"node:util";import G4 from"util";import*as je from"path";import Lp from"path";
2
2
  import K4,{type as Z4}from"os";import RS from"crypto";import J4 from"net";import Y4 from"url";import qv,{unwatchFile as kS,watchFile as X4,watch as Q4,stat as e2}from"fs";import t2 from"child_process";import*as Go from"@likec4/core";import{invariant as ze,BBox as _l,LikeC4Styles as r2,RichText as n2,extractStep as i2,_stage as Fv,_layout as SS,isDynamicView as ES,isElementView as Hv,isDeploymentView as s2,FqnRef as Dt,nonexhaustive as lt,nonNullable as Dn,preferSummary as TS,Fqn as a2,ancestorsFqn as o2,
3
3
  isAutoLayoutDirection as c2,isGlobalFqn as $S,isDeploymentNode as l2,splitGlobalFqn as u2,isSameHierarchy as PS,isAncestor as Bv,RelationExpr as Mp,FqnExpr as zv,memoizeProp as d2,GlobalFqn as f2,isNonEmptyArray as kr,exact as Ko,nameFromFqn as p2,LinkedList as CS,isOrOperator as AS,isAndOperator as xS,_type as h2,applyManualLayout as m2,calcDriftsFromSnapshot as g2}from"@likec4/core";import{bundleRequire as y2}from"bundle-require";import*as v2 from"node:fs/promises";import w2,{lstat as IS,stat as Uv,
4
- readdir as b2,realpath as _2,writeFile as R2,unlink as k2}from"node:fs/promises";import{L as S2,b as NS,x as E2,c as T2,a as DS,l as Rl,R as OS}from"./likec4.DASl7M77.mjs";import{fdir as LS}from"fdir";import{invariant as fr,nonexhaustive as js,hierarchyDistance as $2,nameFromFqn as jp,nonNullable as On,compareFqnHierarchically as P2,delay as MS,promiseNextTick as Vv,compareNaturalHierarchically as jS,BiMap as C2,memoizeProp as qp,stringHash as A2,isAnyOf as Ln,isSameHierarchy as x2,ifilter as Wv,
4
+ readdir as b2,realpath as _2,writeFile as R2,unlink as k2}from"node:fs/promises";import{L as S2,b as NS,x as E2,c as T2,a as DS,l as Rl,R as OS}from"./likec4.DASl7M77.mjs";import{fdir as LS}from"fdir";import{invariant as yr,nonexhaustive as js,hierarchyDistance as $2,nameFromFqn as jp,nonNullable as On,compareFqnHierarchically as P2,delay as MS,promiseNextTick as Vv,compareNaturalHierarchically as jS,BiMap as C2,memoizeProp as qp,stringHash as A2,isAnyOf as Ln,isSameHierarchy as x2,ifilter as Wv,
5
5
  MultiMap as Fr,DefaultWeakMap as qS,sortNaturalByFqn as I2,ancestorsFqn as N2,compareNatural as FS,isNonEmptyArray as D2,sortByFqnHierarchically as HS,parentFqn as BS,toArray as O2,onNextTick as zS}from"@likec4/core/utils";import US,{realpath as Gv,stat as Kv,lstat as L2,open as M2,readdir as j2}from"fs/promises";import{EventEmitter as q2}from"events";import{Readable as VS,Writable as F2}from"node:stream";import{t as tr,a as Zo}from"./likec4.DOUP9ptn.mjs";import Ei,{hrtime as WS}from"node:process";
6
6
  import{createServer as H2}from"http";import{Http2ServerRequest as Fp}from"http2";import{Readable as GS}from"stream";import B2,{Buffer as z2}from"buffer";import U2 from"string_decoder";import{randomUUID as V2}from"node:crypto";import{Buffer as Pa}from"node:buffer";import{Vector as W2}from"@likec4/core/geometry";import{Graph as G2}from"@likec4/core/utils/graphology";import{Graphviz as kl}from"@hpcc-js/wasm-graphviz";import{LikeC4Model as Jo,modelConnection as K2}from"@likec4/core/model";import{Fqn as Z2,
7
7
  exact as Gi,FqnRef as Nr,_type as KS,_stage as Zv,isExtendsElementView as J2,FqnExpr as tn}from"@likec4/core/types";import{ThemeColors as Y2,assignTagColors as X2,computeColorValues as Q2}from"@likec4/core/styles";import{resolveRulesExtendedViews as ej,computeView as tj}from"@likec4/core/compute-view";import rj from"boxen";import{spawn as nj}from"node:child_process";import{once as ZS,on as ij}from"node:events";import{pipeline as sj}from"node:stream/promises";import*as aj from"node:readline/promises";
@@ -95,7 +95,7 @@ t"}var u8="[object Symbol]";function uu(t){return typeof t=="symbol"||ei(t)&&Hs(
95
95
  function h8(t){return t&&t.slice(0,f8(t)+1).replace(p8,"")}function qn(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var IE=NaN,m8=/^[-+]0x[0-9a-f]+$/i,g8=/^0b[01]+$/i,y8=/^0o[0-7]+$/i,v8=parseInt;function w8(t){if(typeof t=="number")return t;if(uu(t))return IE;if(qn(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=qn(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=h8(t);var r=g8.test(t);return r||y8.test(t)?v8(t.slice(2),r?2:8):m8.test(t)?IE:+t}var NE=1/0,b8=17976931348623157e292;
96
96
  function _8(t){if(!t)return t===0?t:0;if(t=w8(t),t===NE||t===-NE){var e=t<0?-1:1;return e*b8}return t===t?t:0}function lh(t){var e=_8(t),r=e%1;return e===e?r?e-r:e:0}function Na(t){return t}var R8="[object AsyncFunction]",k8="[object Function]",S8="[object GeneratorFunction]",E8="[object Proxy]";function Qi(t){if(!qn(t))return!1;var e=Hs(t);return e==k8||e==S8||e==R8||e==E8}var Pw=$i["__core-js_shared__"],DE=(function(){var t=/[^.]+$/.exec(Pw&&Pw.keys&&Pw.keys.IE_PROTO||"");return t?"Symbol(src)\
97
97
  _1."+t:""})();function T8(t){return!!DE&&DE in t}var $8=Function.prototype,P8=$8.toString;function Da(t){if(t!=null){try{return P8.call(t)}catch{}try{return t+""}catch{}}return""}var C8=/[\\^$.*+?()[\]{}|]/g,A8=/^\[object .+?Constructor\]$/,x8=Function.prototype,I8=Object.prototype,N8=x8.toString,D8=I8.hasOwnProperty,O8=RegExp("^"+N8.call(D8).replace(C8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function L8(t){if(!qn(t)||T8(t))return!1;var e=Qi(t)?O8:A8;
98
- return e.test(Da(t))}function M8(t,e){return t?.[e]}function Oa(t,e){var r=M8(t,e);return L8(r)?r:void 0}var Cw=Oa($i,"WeakMap"),OE=Object.create,j8=(function(){function t(){}return function(e){if(!qn(e))return{};if(OE)return OE(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})();function q8(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function pr(){}function F8(t,e){
98
+ return e.test(Da(t))}function M8(t,e){return t?.[e]}function Oa(t,e){var r=M8(t,e);return L8(r)?r:void 0}var Cw=Oa($i,"WeakMap"),OE=Object.create,j8=(function(){function t(){}return function(e){if(!qn(e))return{};if(OE)return OE(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})();function q8(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function fr(){}function F8(t,e){
99
99
  var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var H8=800,B8=16,z8=Date.now;function U8(t){var e=0,r=0;return function(){var n=z8(),i=B8-(n-r);if(r=n,i>0){if(++e>=H8)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function V8(t){return function(){return t}}var uh=(function(){try{var t=Oa(Object,"defineProperty");return t({},"",{}),t}catch{}})(),W8=uh?function(t,e){return uh(t,"toString",{configurable:!0,enumerable:!1,value:V8(e),writable:!0})}:Na,G8=U8(W8);function LE(t,e){
100
100
  for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}function ME(t,e,r,n){for(var i=t.length,s=r+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function K8(t){return t!==t}function Z8(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function Aw(t,e,r){return e===e?Z8(t,e,r):ME(t,K8,r)}function jE(t,e){var r=t==null?0:t.length;return!!r&&Aw(t,e,0)>-1}var J8=9007199254740991,Y8=/^(?:0|[1-9]\d*)$/;function dh(t,e){var r=typeof t;return e=e??J8,!!e&&(r=="number"||r!="\
101
101
  symbol"&&Y8.test(t))&&t>-1&&t%1==0&&t<e}function xw(t,e,r){e=="__proto__"&&uh?uh(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function du(t,e){return t===e||t!==t&&e!==e}var X8=Object.prototype,Q8=X8.hasOwnProperty;function fh(t,e,r){var n=t[e];(!(Q8.call(t,e)&&du(n,r))||r===void 0&&!(e in t))&&xw(t,e,r)}function fu(t,e,r,n){var i=!r;r||(r={});for(var s=-1,a=e.length;++s<a;){var o=e[s],c=void 0;c===void 0&&(c=t[o]),i?xw(r,o,c):fh(r,o,c)}return r}var qE=Math.max;function eq(t,e,r){
@@ -140,11 +140,11 @@ for(var i=r.length,s=-1,a=Object(r);++s<i&&n(a[s],s,a)!==!1;);return r}}var Ma=Z
140
140
  (e=e===void 0?1:lh(e),QE(t,e<0?0:e,n)):[]}function bu(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:lh(e),e=n-e,QE(t,0,e<0?0:e)):[]}function t5(t){return typeof t=="function"?t:Na}function Oe(t,e){var r=dt(t)?LE:Ma;return r(t,t5(e))}function r5(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function n5(t,e){var r=!0;return Ma(t,function(n,i,s){return r=!!e(n,i,s),r}),r}function ri(t,e,r){var n=dt(t)?r5:n5;return n(t,ti(e))}function xT(t,e){var r=[];return Ma(
141
141
  t,function(n,i,s){e(n,i,s)&&r.push(n)}),r}function gn(t,e){var r=dt(t)?Bw:xT;return r(t,ti(e))}function i5(t){return function(e,r,n){var i=Object(e);if(!Pi(e)){var s=ti(r);e=Fn(e),r=function(o){return s(i[o],o,i)}}var a=t(e,r,n);return a>-1?i[s?e[a]:a]:void 0}}var s5=Math.max;function a5(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:lh(r);return i<0&&(i=s5(n+i,0)),ME(t,ti(e),i)}var cc=i5(a5);function ni(t){return t&&t.length?t[0]:void 0}function o5(t,e){var r=-1,n=Pi(t)?Array(t.
142
142
  length):[];return Ma(t,function(i,s,a){n[++r]=e(i,s,a)}),n}function Pe(t,e){var r=dt(t)?ch:o5;return r(t,ti(e))}function yn(t,e){return Hw(Pe(t,e))}var c5=Object.prototype,l5=c5.hasOwnProperty,u5=Y6(function(t,e,r){l5.call(t,r)?t[r].push(e):xw(t,r,[e])}),d5=Object.prototype,f5=d5.hasOwnProperty;function p5(t,e){return t!=null&&f5.call(t,e)}function Le(t,e){return t!=null&&PT(t,e,p5)}var h5="[object String]";function nn(t){return typeof t=="string"||!dt(t)&&ei(t)&&Hs(t)==h5}function m5(t,e){return ch(
143
- e,function(r){return t[r]})}function hr(t){return t==null?[]:m5(t,Fn(t))}var g5=Math.max;function Hr(t,e,r,n){t=Pi(t)?t:hr(t),r=r?lh(r):0;var i=t.length;return r<0&&(r=g5(i+r,0)),nn(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Aw(t,e,r)>-1}function IT(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=0;return Aw(t,e,i)}var y5="[object Map]",v5="[object Set]",w5=Object.prototype,b5=w5.hasOwnProperty;function Tt(t){if(t==null)return!0;if(Pi(t)&&(dt(t)||typeof t=="string"||typeof t.splice=="function"||hu(t)||
143
+ e,function(r){return t[r]})}function pr(t){return t==null?[]:m5(t,Fn(t))}var g5=Math.max;function Hr(t,e,r,n){t=Pi(t)?t:pr(t),r=r?lh(r):0;var i=t.length;return r<0&&(r=g5(i+r,0)),nn(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Aw(t,e,r)>-1}function IT(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=0;return Aw(t,e,i)}var y5="[object Map]",v5="[object Set]",w5=Object.prototype,b5=w5.hasOwnProperty;function Tt(t){if(t==null)return!0;if(Pi(t)&&(dt(t)||typeof t=="string"||typeof t.splice=="function"||hu(t)||
144
144
  Ow(t)||ph(t)))return!t.length;var e=Bn(t);if(e==y5||e==v5)return!t.size;if(pu(t))return!JE(t).length;for(var r in t)if(b5.call(t,r))return!1;return!0}var _5="[object RegExp]";function R5(t){return ei(t)&&Hs(t)==_5}var NT=Bs&&Bs.isRegExp,rs=NT?hh(NT):R5;function ns(t){return t===void 0}function k5(t,e){return t<e}function S5(t,e,r){for(var n=-1,i=t.length;++n<i;){var s=t[n],a=e(s);if(a!=null&&(o===void 0?a===a&&!uu(a):r(a,o)))var o=a,c=s}return c}function E5(t){return t&&t.length?S5(t,Na,k5):void 0}
145
145
  var T5="Expected a function";function $5(t){if(typeof t!="function")throw new TypeError(T5);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 P5(t,e,r,n){if(!qn(t))return t;e=yh(e,t);for(var i=-1,s=e.length,a=s-1,o=t;o!=null&&++i<s;){var c=vu(e[i]),l=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=a){var u=o[c];
146
146
  l=void 0,l===void 0&&(l=qn(u)?u:dh(e[i+1])?[]:{})}fh(o,c,l),o=o[c]}return t}function C5(t,e,r){for(var n=-1,i=e.length,s={};++n<i;){var a=e[n],o=qw(t,a);r(o,a)&&P5(s,yh(a,t),o)}return s}function ii(t,e){if(t==null)return{};var r=ch(VF(t),function(n){return[n]});return e=ti(e),C5(t,r,function(n,i){return e(n,i[0])})}function A5(t,e,r,n,i){return i(t,function(s,a,o){r=n?(n=!1,s):e(r,s,a,o)}),r}function Br(t,e,r){var n=dt(t)?CF:A5,i=arguments.length<3;return n(t,ti(e),r,i,Ma)}function Rh(t,e){var r=dt(
147
- t)?Bw:xT;return r(t,$5(ti(e)))}function x5(t,e){var r;return Ma(t,function(n,i,s){return r=e(n,i,s),!r}),!!r}function DT(t,e,r){var n=dt(t)?bT:x5;return n(t,ti(e))}var I5=1/0,N5=sc&&1/Kw(new sc([,-0]))[1]==I5?function(t){return new sc(t)}:pr,D5=200;function OT(t,e,r){var n=-1,i=jE,s=t.length,a=!0,o=[],c=o;if(s>=D5){var l=e?null:N5(t);if(l)return Kw(l);a=!1,i=Gw,c=new ac}else c=e?[]:o;e:for(;++n<s;){var u=t[n],d=e?e(u):u;if(u=u!==0?u:0,a&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.
147
+ t)?Bw:xT;return r(t,$5(ti(e)))}function x5(t,e){var r;return Ma(t,function(n,i,s){return r=e(n,i,s),!r}),!!r}function DT(t,e,r){var n=dt(t)?bT:x5;return n(t,ti(e))}var I5=1/0,N5=sc&&1/Kw(new sc([,-0]))[1]==I5?function(t){return new sc(t)}:fr,D5=200;function OT(t,e,r){var n=-1,i=jE,s=t.length,a=!0,o=[],c=o;if(s>=D5){var l=e?null:N5(t);if(l)return Kw(l);a=!1,i=Gw,c=new ac}else c=e?[]:o;e:for(;++n<s;){var u=t[n],d=e?e(u):u;if(u=u!==0?u:0,a&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.
148
148
  push(d),o.push(u)}else i(c,d,r)||(c!==o&&c.push(d),o.push(u))}return o}function Xw(t){return t&&t.length?OT(t):[]}function O5(t,e){return t&&t.length?OT(t,ti(e)):[]}function Qw(t){console&&console.error&&console.error(`Error: ${t}`)}function LT(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function MT(t){const e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function jT(t){function e(){}e.prototype=t;const r=new e;function n(){return typeof r.bar}return n(),n(),
149
149
  t}function L5(t){return M5(t)?t.LABEL:t.name}function M5(t){return nn(t.LABEL)&&t.LABEL!==""}class Ai{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),Oe(this.definition,r=>{r.accept(e)})}}class zr extends Ai{constructor(e){super([]),this.idx=1,mn(this,ii(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class lc extends Ai{constructor(e){
150
150
  super(e.definition),this.orgText="",mn(this,ii(e,r=>r!==void 0))}}class sn extends Ai{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,mn(this,ii(e,r=>r!==void 0))}}class Tr extends Ai{constructor(e){super(e.definition),this.idx=1,mn(this,ii(e,r=>r!==void 0))}}class vn extends Ai{constructor(e){super(e.definition),this.idx=1,mn(this,ii(e,r=>r!==void 0))}}class wn extends Ai{constructor(e){super(e.definition),this.idx=1,mn(this,ii(e,r=>r!==void 0))}}class Yt extends Ai{constructor(e){
@@ -170,7 +170,7 @@ char" lexer optimizations:
170
170
  Using the @chevrotain/regexp-to-ast library
171
171
  Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function eb(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)eb(t.value[i],e,r);break;case"Alternative":const n=t.value;for(let i=0;i<n.length;i++){const s=n[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":Ch(a.value,e,r);break;case"\
172
172
  Set":if(a.complement===!0)throw Error(HT);Oe(a.value,c=>{if(typeof c=="number")Ch(c,e,r);else{const l=c;if(r===!0)for(let u=l.from;u<=l.to;u++)Ch(u,e,r);else{for(let u=l.from;u<=l.to&&u<ku;u++)Ch(u,e,r);if(l.to>=ku){const u=l.from>=ku?l.from:ku,d=l.to,f=zs(u),p=zs(d);for(let w=f;w<=p;w++)e[w]=w}}}});break;case"Group":eb(a.value,e,r);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&tb(a)===!1||a.type!=="Group"&&o===!1)break}
173
- break;default:throw Error("non exhaustive match!")}return hr(e)}function Ch(t,e,r){const n=zs(t);e[n]=n,r===!0&&J5(t,e)}function J5(t,e){const r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){const i=zs(n.charCodeAt(0));e[i]=i}else{const i=r.toLowerCase();if(i!==r){const s=zs(i.charCodeAt(0));e[s]=s}}}function BT(t,e){return cc(t.value,r=>{if(typeof r=="number")return Hr(e,r);{const n=r;return cc(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function tb(t){const e=t.quantifier;return e&&e.atLeast===0?
173
+ break;default:throw Error("non exhaustive match!")}return pr(e)}function Ch(t,e,r){const n=zs(t);e[n]=n,r===!0&&J5(t,e)}function J5(t,e){const r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){const i=zs(n.charCodeAt(0));e[i]=i}else{const i=r.toLowerCase();if(i!==r){const s=zs(i.charCodeAt(0));e[s]=s}}}function BT(t,e){return cc(t.value,r=>{if(typeof r=="number")return Hr(e,r);{const n=r;return cc(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function tb(t){const e=t.quantifier;return e&&e.atLeast===0?
174
174
  !0:t.value?dt(t.value)?ri(t.value,tb):tb(t.value):!1}class Y5 extends ih{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){Hr(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?BT(e,this.targetCharCodes)===void 0&&(this.found=!0):BT(e,this.targetCharCodes)!==void 0&&
175
175
  (this.found=!0)}}function rb(t,e){if(e instanceof RegExp){const r=$h(e),n=new Y5(t);return n.visit(r),n.found}else return cc(e,r=>Hr(t,r.charCodeAt(0)))!==void 0}const ja="PATTERN",Ru="defaultMode",Ah="modes";let zT=typeof new RegExp("(?:)").sticky=="boolean";function X5(t,e){e=Yw(e,{useSticky:zT,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
176
176
  `],tracer:(h,v)=>v()});const r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{_3()});let n;r("Reject Lexer.NA",()=>{n=Rh(t,h=>h[ja]===cn.NA)});let i=!1,s;r("Transform Patterns",()=>{i=!1,s=Pe(n,h=>{const v=h[ja];if(rs(v)){const b=v.source;return b.length===1&&b!=="^"&&b!=="$"&&b!=="."&&!v.ignoreCase?b:b.length===2&&b[0]==="\\"&&!Hr(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],b[1])?b[1]:e.useSticky?VT(v):UT(v)}else{if(Qi(v))return i=!0,{exec:v};if(typeof v=="object")return i=
@@ -199,7 +199,7 @@ const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function VT(
199
199
  `,type:Xt.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Le(t,Ah)&&Le(t,Ru)&&!Le(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Ru}: <${t.defaultMode}>which does not exist
200
200
  `,type:Xt.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Le(t,Ah)&&Oe(t.modes,(i,s)=>{Oe(i,(a,o)=>{if(ns(a))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
201
201
  `,type:Xt.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(Le(a,"LONGER_ALT")){const c=dt(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];Oe(c,l=>{!ns(l)&&!Hr(i,l)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${a.name}> outside of mode <${s}>
202
- `,type:Xt.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function g3(t,e,r){const n=[];let i=!1;const s=wu(Hn(hr(t.modes))),a=Rh(s,c=>c[ja]===cn.NA),o=KT(r);return e&&Oe(a,c=>{const l=GT(c,o);if(l!==!1){const d={message:b3(c,l),type:l.issue,tokenType:c};n.push(d)}else Le(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):rb(o,c.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
202
+ `,type:Xt.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function g3(t,e,r){const n=[];let i=!1;const s=wu(Hn(pr(t.modes))),a=Rh(s,c=>c[ja]===cn.NA),o=KT(r);return e&&Oe(a,c=>{const l=GT(c,o);if(l!==!1){const d={message:b3(c,l),type:l.issue,tokenType:c};n.push(d)}else Le(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):rb(o,c.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
203
203
  This Lexer has been defined to track line and column information,
204
204
  But none of the Token Types can be identified as matching a line terminator.
205
205
  See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
@@ -226,7 +226,7 @@ Tu.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacter
226
226
  this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Q5(o,a))}),Tt(this.lexerDefinitionErrors)){Eu(o);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=X5(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=
227
227
  l.charCodeToPatternIdxToConfig,this.emptyGroups=mn({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Tt(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=Pe(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
228
228
  `);throw new Error(`Errors detected in definition of Lexer:
229
- `+c)}Oe(this.lexerDefinitionWarning,o=>{LT(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(zT?(this.chopInput=Na,this.match=this.matchWithTest):(this.updateLastIndex=pr,this.match=this.matchWithExec),s&&(this.handleModes=pr),this.trackStartLines===!1&&(this.computeNewColumn=Na),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=pr),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.
229
+ `+c)}Oe(this.lexerDefinitionWarning,o=>{LT(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(zT?(this.chopInput=Na,this.match=this.matchWithTest):(this.updateLastIndex=fr,this.match=this.matchWithExec),s&&(this.handleModes=fr),this.trackStartLines===!1&&(this.computeNewColumn=Na),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=fr),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.
230
230
  positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optim\
231
231
  ization Warnings",()=>{const o=Br(this.canModeBeOptimized,(c,l,u)=>(l===!1&&c.push(u),c),[]);if(r.ensureOptimizations&&!Tt(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
232
232
  Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
@@ -274,7 +274,7 @@ without consuming any Tokens. The grammar path that causes this is:
274
274
  ${n}
275
275
  To fix this refactor your grammar to remove the left recursion.
276
276
  see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof lc?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function I3(t,e){const r=new N3(t,e);return r.resolveRefs(),r.errors}class N3 extends uc{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){
277
- Oe(hr(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{const n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:Ur.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class D3 extends Eh{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=
277
+ Oe(pr(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{const n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:Ur.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class D3 extends Eh{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=
278
278
  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=Sr(this.path.ruleStack).reverse(),this.occurrenceStack=Sr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===
279
279
  this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){Tt(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class O3 extends D3{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=
280
280
  this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=r.concat(n),s=new sn({definition:i});this.possibleTokTypes=_u(s),this.found=!0}}}class Nh extends Eh{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}
@@ -298,7 +298,7 @@ this.checkIsTarget(e,zt.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWith
298
298
  a+c)}}e=i}return e}function U3(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;const i=t[n];for(let s=0;s<e.length;s++){const a=e[s];if(i[a]===!0)return!1}}return!0}function y$(t,e){const r=Pe(t,a=>ab([a],1)),n=g$(r.length),i=Pe(r,a=>{const o={};return Oe(a,c=>{const l=cb(c.partialPath);Oe(l,u=>{o[u]=!0})}),o});let s=r;for(let a=1;a<=e;a++){const o=s;s=g$(o.length);for(let c=0;c<o.length;c++){const l=o[c];for(let u=0;u<l.length;u++){const d=l[u].partialPath,f=l[u].suffixDef,p=cb(d);if(U3(i,
299
299
  p,c)||Tt(f)||d.length===e){const g=n[c];if(lb(g,d)===!1){g.push(d);for(let y=0;y<p.length;y++){const m=p[y];i[c][m]=!0}}}else{const g=ab(f,a+1,d);s[c]=s[c].concat(g),Oe(g,y=>{const m=cb(y.partialPath);Oe(m,h=>{i[c][h]=!0})})}}}}return n}function Dh(t,e,r,n){const i=new m$(t,zt.ALTERNATION,n);return e.accept(i),y$(i.result,r)}function Oh(t,e,r,n){const i=new m$(t,r);e.accept(i);const s=i.result,o=new z3(e,t,r).startWalking(),c=new sn({definition:s}),l=new sn({definition:o});return y$([c,l],n)}function lb(t,e){
300
300
  e:for(let r=0;r<t.length;r++){const n=t[r];if(n.length===e.length){for(let i=0;i<n.length;i++){const s=e[i],a=n[i];if((s===a||a.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function V3(t,e){return t.length<e.length&&ri(t,(r,n)=>{const i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function v$(t){return ri(t,e=>ri(e,r=>ri(r,n=>Tt(n.categoryMatches))))}function W3(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.
301
- grammarName});return Pe(e,r=>Object.assign({type:Ur.CUSTOM_LOOKAHEAD_VALIDATION},r))}function G3(t,e,r,n){const i=yn(t,c=>K3(c,r)),s=aH(t,e,r),a=yn(t,c=>rH(c,r)),o=yn(t,c=>Y3(c,t,n,r));return i.concat(s,a,o)}function K3(t,e){const r=new J3;t.accept(r);const n=r.allProductions,i=u5(n,Z3),s=ii(i,o=>o.length>1);return Pe(hr(s),o=>{const c=ni(o),l=e.buildDuplicateFoundError(t,o),u=xi(c),d={message:l,type:Ur.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:u,occurrence:c.idx},f=w$(c);return f&&(d.parameter=
301
+ grammarName});return Pe(e,r=>Object.assign({type:Ur.CUSTOM_LOOKAHEAD_VALIDATION},r))}function G3(t,e,r,n){const i=yn(t,c=>K3(c,r)),s=aH(t,e,r),a=yn(t,c=>rH(c,r)),o=yn(t,c=>Y3(c,t,n,r));return i.concat(s,a,o)}function K3(t,e){const r=new J3;t.accept(r);const n=r.allProductions,i=u5(n,Z3),s=ii(i,o=>o.length>1);return Pe(pr(s),o=>{const c=ni(o),l=e.buildDuplicateFoundError(t,o),u=xi(c),d={message:l,type:Ur.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:u,occurrence:c.idx},f=w$(c);return f&&(d.parameter=
302
302
  f),d})}function Z3(t){return`${xi(t)}_#_${t.idx}_#_${w$(t)}`}function w$(t){return t instanceof Lt?t.terminalType.name:t instanceof zr?t.nonTerminalName:""}class J3 extends uc{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.
303
303
  push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function Y3(t,e,r,n){const i=[];if(Br(e,(a,o)=>o.name===t.name?a+1:a,0)>1){const a=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:a,type:Ur.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function X3(t,e,r){const n=[];let i;return Hr(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}\
304
304
  <-as it is not defined in any of the super grammars `,n.push({message:i,type:Ur.INVALID_RULE_OVERRIDE,ruleName:t})),n}function b$(t,e,r,n=[]){const i=[],s=Lh(e.definition);if(Tt(s))return[];{const a=t.name;Hr(s,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:Ur.LEFT_RECURSION,ruleName:a});const c=_h(s,n.concat([t])),l=yn(c,u=>{const d=Sr(n);return d.push(u),b$(t,u,r,d)});return i.concat(l)}}function Lh(t){let e=[];if(Tt(t))return e;const r=ni(t);if(r instanceof
@@ -332,9 +332,9 @@ this[l.name](l.children,e)}}}function kH(t,e){const r=function(){};I$(r,t+"BaseS
332
332
 
333
333
  `).replace(/\n/g,`
334
334
  `)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function SH(t,e,r){const n=function(){};I$(n,t+"BaseSemanticsWithDefaults");const i=Object.create(r.prototype);return Oe(e,s=>{i[s]=RH}),n.prototype=i,n.prototype.constructor=n,n}var yb;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(yb||(yb={}));function EH(t,e){return TH(t,e)}function TH(t,e){const r=gn(e,i=>Qi(t[i])===!1),n=Pe(r,i=>({msg:`Missing visitor method: <${i}> o\
335
- n ${t.constructor.name} CST Visitor.`,type:yb.MISSING_METHOD,methodName:i}));return wu(n)}class $H{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Le(e,"nodeLocationTracking")?e.nodeLocationTracking:is.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=pr,this.cstFinallyStateUpdate=pr,this.cstPostTerminal=pr,this.cstPostNonTerminal=pr,this.cstPostRule=pr;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=
336
- x$,this.setNodeLocationFromNode=x$,this.cstPostRule=pr,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=pr,this.setNodeLocationFromNode=pr,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=A$,this.setNodeLocationFromNode=A$,this.cstPostRule=pr,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):
337
- (this.setNodeLocationFromToken=pr,this.setNodeLocationFromNode=pr,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=pr,this.setNodeLocationFromNode=pr,this.cstPostRule=pr,this.setInitialNodeLocation=pr;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,
335
+ n ${t.constructor.name} CST Visitor.`,type:yb.MISSING_METHOD,methodName:i}));return wu(n)}class $H{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Le(e,"nodeLocationTracking")?e.nodeLocationTracking:is.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=fr,this.cstFinallyStateUpdate=fr,this.cstPostTerminal=fr,this.cstPostNonTerminal=fr,this.cstPostRule=fr;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=
336
+ x$,this.setNodeLocationFromNode=x$,this.cstPostRule=fr,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=fr,this.setNodeLocationFromNode=fr,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=A$,this.setNodeLocationFromNode=A$,this.cstPostRule=fr,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):
337
+ (this.setNodeLocationFromToken=fr,this.setNodeLocationFromNode=fr,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=fr,this.setNodeLocationFromNode=fr,this.cstPostRule=fr,this.setInitialNodeLocation=fr;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,
338
338
  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 r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const r={name:e,children:Object.
339
339
  create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.
340
340
  length-1];wH(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.length-1];bH(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(ns(this.baseCstVisitorConstructor)){const e=kH(this.className,Fn(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ns(this.baseCstVisitorWithDefaultsConstructor)){const e=SH(
@@ -349,15 +349,15 @@ orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal
349
349
  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(
350
350
  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,r,n=Uh){if(Hr(this.definedRulesNames,
351
351
  e)){const a={message:qa.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Ur.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=Uh){const i=X3(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,r,n);return this[e]=s,s}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);const n=this.
352
- saveRecogState();try{return e.apply(this,r),!0}catch(i){if(Mh(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return j5(hr(this.gastProductionsCache))}}class AH{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ih,this.subruleIdx=0,this.definedRulesNames=[],this.
352
+ saveRecogState();try{return e.apply(this,r),!0}catch(i){if(Mh(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return j5(pr(this.gastProductionsCache))}}class AH{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ih,this.subruleIdx=0,this.definedRulesNames=[],this.
353
353
  tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},Le(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
354
354
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
355
355
  For Further details.`);if(dt(e)){if(Tt(e))throw Error(`A Token Vocabulary cannot be empty.
356
356
  Note that the first argument for the parser constructor
357
357
  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.
358
358
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
359
- For Further details.`)}if(dt(e))this.tokensMap=Br(e,(s,a)=>(s[a.name]=a,s),{});else if(Le(e,"modes")&&ri(Hn(hr(e.modes)),P3)){const s=Hn(hr(e.modes)),a=Xw(s);this.tokensMap=Br(a,(o,c)=>(o[c.name]=c,o),{})}else if(qn(e))this.tokensMap=Sr(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=Us;const n=Le(e,"modes")?Hn(hr(e.modes)):hr(e),i=ri(n,s=>Tt(s.categoryMatches));this.
360
- tokenMatcher=i?Ih:Su,Eu(hr(this.tokensMap))}defineRule(e,r,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
359
+ For Further details.`)}if(dt(e))this.tokensMap=Br(e,(s,a)=>(s[a.name]=a,s),{});else if(Le(e,"modes")&&ri(Hn(pr(e.modes)),P3)){const s=Hn(pr(e.modes)),a=Xw(s);this.tokensMap=Br(a,(o,c)=>(o[c.name]=c,o),{})}else if(qn(e))this.tokensMap=Sr(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=Us;const n=Le(e,"modes")?Hn(pr(e.modes)):pr(e),i=ri(n,s=>Tt(s.categoryMatches));this.
360
+ tokenMatcher=i?Ih:Su,Eu(pr(this.tokensMap))}defineRule(e,r,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
361
361
  Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=Le(n,"resyncEnabled")?n.resyncEnabled:Uh.resyncEnabled,s=Le(n,"recoveryValueFunc")?n.recoveryValueFunc:Uh.recoveryValueFunc,a=this.ruleShortNameIdx<<mH+Vs;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),r.apply(this,u);const d=this.CST_STACK[this.CST_STACK.
362
362
  length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),r.apply(this,u)}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,n){const i=this.RULE_STACK.length===1,s=r&&!this.isBackTracking()&&this.recoveryEnabled;if(Mh(e)){const a=e;if(s){const o=this.
363
363
  findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return n(e);else{if(this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,a.partialCstResult=c}throw a}}else{if(i)return this.moveToTerminatedState(),n(e);throw a}}else throw e}optionInternal(e,r){const n=this.getKeyForAutomaticLookahead(C$,r);return this.optionInternalLogic(e,r,
@@ -393,9 +393,9 @@ console.log(`${n}--> <${e}>`);const{time:i,value:s}=MT(r),a=i>10?console.warn:co
393
393
  NaN,NaN,NaN,NaN);Object.freeze(zh);const is=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:fc,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Uh=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Ur;(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",
394
394
  t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAH\
395
395
  EAD_VALIDATION"})(Ur||(Ur={}));function j$(t=void 0){return function(){return t}}class xp{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 r=this.className;this.TRACE_INIT("toFastProps",()=>{jT(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),Oe(this.definedRulesNames,
396
- i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=oH({rules:hr(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(Tt(n)&&this.skipValidations===!1){const i=cH({rules:hr(this.gastProductionsCache),tokenTypes:hr(this.tokensMap),errMsgProvider:qa,
397
- grammarName:r}),s=W3({lookaheadStrategy:this.lookaheadStrategy,rules:hr(this.gastProductionsCache),tokenTypes:hr(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,s)}}),Tt(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=V5(hr(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:hr(
398
- this.gastProductionsCache)}),this.preComputeLookaheadFunctions(hr(this.gastProductionsCache))})),!xp.DEFER_DEFINITION_ERRORS_HANDLING&&!Tt(this.definitionErrors))throw e=Pe(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
396
+ i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=oH({rules:pr(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(Tt(n)&&this.skipValidations===!1){const i=cH({rules:pr(this.gastProductionsCache),tokenTypes:pr(this.tokensMap),errMsgProvider:qa,
397
+ grammarName:r}),s=W3({lookaheadStrategy:this.lookaheadStrategy,rules:pr(this.gastProductionsCache),tokenTypes:pr(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,s)}}),Tt(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=V5(pr(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:pr(
398
+ this.gastProductionsCache)}),this.preComputeLookaheadFunctions(pr(this.gastProductionsCache))})),!xp.DEFER_DEFINITION_ERRORS_HANDLING&&!Tt(this.definitionErrors))throw e=Pe(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
399
399
  ${e.join(`
400
400
  -------------------------------
401
401
  `)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;const n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(e,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),Le(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
@@ -680,7 +680,7 @@ const s=va.getLogger().contextLocalStorage?.getStore()??{};let a;const o=typeof
680
680
  s==null)&&(a=r((c,...l)=>(s=c,oC(c,l))),s==null))throw new TypeError("No log record was made.");return[a,s]}this.emit({category:this.category,level:e,get message(){return o()[0]},get rawMessage(){return o()[1]},timestamp:Date.now(),properties:{...i,...n}})}logTemplate(e,r,n,i={}){const s=va.getLogger().contextLocalStorage?.getStore()??{};this.emit({category:this.category,level:e,message:oC(r,n),rawMessage:r,timestamp:Date.now(),properties:{...s,...i}})}trace(e,...r){typeof e=="string"?this.log("\
681
681
  trace",e,r[0]??{}):typeof e=="function"?this.logLazily("trace",e):Array.isArray(e)?this.logTemplate("trace",e,r):this.log("trace","{*}",e)}debug(e,...r){typeof e=="string"?this.log("debug",e,r[0]??{}):typeof e=="function"?this.logLazily("debug",e):Array.isArray(e)?this.logTemplate("debug",e,r):this.log("debug","{*}",e)}info(e,...r){typeof e=="string"?this.log("info",e,r[0]??{}):typeof e=="function"?this.logLazily("info",e):Array.isArray(e)?this.logTemplate("info",e,r):this.log("info","{*}",e)}warn(e,...r){
682
682
  typeof e=="string"?this.log("warning",e,r[0]??{}):typeof e=="function"?this.logLazily("warning",e):Array.isArray(e)?this.logTemplate("warning",e,r):this.log("warning","{*}",e)}warning(e,...r){this.warn(e,...r)}error(e,...r){typeof e=="string"?this.log("error",e,r[0]??{}):typeof e=="function"?this.logLazily("error",e):Array.isArray(e)?this.logTemplate("error",e,r):this.log("error","{*}",e)}fatal(e,...r){typeof e=="string"?this.log("fatal",e,r[0]??{}):typeof e=="function"?this.logLazily("fatal",e):
683
- Array.isArray(e)?this.logTemplate("fatal",e,r):this.log("fatal","{*}",e)}},LU=class x4{logger;properties;constructor(e,r){this.logger=e,this.properties=r}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(e){return this.logger.getChild(e).with(this.properties)}with(e){return new x4(this.logger,{...this.properties,...e})}log(e,r,n,i){this.logger.log(e,r,typeof n=="function"?()=>({...this.properties,...n()}):{...this.properties,...n},i)}logLazily(e,r){this.logger.
683
+ Array.isArray(e)?this.logTemplate("fatal",e,r):this.log("fatal","{*}",e)}},LU=class C4{logger;properties;constructor(e,r){this.logger=e,this.properties=r}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(e){return this.logger.getChild(e).with(this.properties)}with(e){return new C4(this.logger,{...this.properties,...e})}log(e,r,n,i){this.logger.log(e,r,typeof n=="function"?()=>({...this.properties,...n()}):{...this.properties,...n},i)}logLazily(e,r){this.logger.
684
684
  logLazily(e,r,this.properties)}logTemplate(e,r,n){this.logger.logTemplate(e,r,n,this.properties)}trace(e,...r){typeof e=="string"?this.log("trace",e,r[0]??{}):typeof e=="function"?this.logLazily("trace",e):Array.isArray(e)?this.logTemplate("trace",e,r):this.log("trace","{*}",e)}debug(e,...r){typeof e=="string"?this.log("debug",e,r[0]??{}):typeof e=="function"?this.logLazily("debug",e):Array.isArray(e)?this.logTemplate("debug",e,r):this.log("debug","{*}",e)}info(e,...r){typeof e=="string"?this.log(
685
685
  "info",e,r[0]??{}):typeof e=="function"?this.logLazily("info",e):Array.isArray(e)?this.logTemplate("info",e,r):this.log("info","{*}",e)}warn(e,...r){typeof e=="string"?this.log("warning",e,r[0]??{}):typeof e=="function"?this.logLazily("warning",e):Array.isArray(e)?this.logTemplate("warning",e,r):this.log("warning","{*}",e)}warning(e,...r){this.warn(e,...r)}error(e,...r){typeof e=="string"?this.log("error",e,r[0]??{}):typeof e=="function"?this.logLazily("error",e):Array.isArray(e)?this.logTemplate(
686
686
  "error",e,r):this.log("error","{*}",e)}fatal(e,...r){typeof e=="string"?this.log("fatal",e,r[0]??{}):typeof e=="function"?this.logLazily("fatal",e):Array.isArray(e)?this.logTemplate("fatal",e,r):this.log("fatal","{*}",e)}};const MU=bc.getLogger(["logtape","meta"]);function aC(t,e){const r=[];let n="";for(let i=0;i<t.length;i++){const s=t.charAt(i),a=t.charAt(i+1);if(s==="{"&&a==="{")n=n+s,i++;else if(s==="}"&&a==="}")n=n+s,i++;else if(s==="{")r.push(n),n="";else if(s==="}"){let o;n.match(/^\s*\*\s*$/)?
@@ -793,7 +793,7 @@ y={}));var m;(function(T){T[T.Closed=1]="Closed",T[T.Disposed=2]="Disposed",T[T.
793
793
  R={}));var $;(function(T){T.Message=Object.freeze({sendCancellation(H,U){return H.sendNotification(o.type,{id:U})},cleanup(H){}});function B(H){const U=H;return U&&r.func(U.sendCancellation)&&r.func(U.cleanup)}T.is=B})($||(t.CancellationSenderStrategy=$={}));var M;(function(T){T.Message=Object.freeze({receiver:R.Message,sender:$.Message});function B(H){const U=H;return U&&R.is(U.receiver)&&$.is(U.sender)}T.is=B})(M||(t.CancellationStrategy=M={}));var q;(function(T){function B(H){const U=H;return U&&
794
794
  r.func(U.handleMessage)}T.is=B})(q||(t.MessageStrategy=q={}));var Z;(function(T){function B(H){const U=H;return U&&(M.is(U.cancellationStrategy)||v.is(U.connectionStrategy)||q.is(U.messageStrategy))}T.is=B})(Z||(t.ConnectionOptions=Z={}));var L;(function(T){T[T.New=1]="New",T[T.Listening=2]="Listening",T[T.Closed=3]="Closed",T[T.Disposed=4]="Disposed"})(L||(L={}));function P(T,B,H,U){const G=H!==void 0?H:t.NullLogger;let oe=0,ne=0,C=0;const F="2.0";let Y;const K=new Map;let S;const N=new Map,X=new Map;
795
795
  let se,ue=new i.LinkedMap,_e=new Map,de=new Set,x=new Map,O=f.Off,J=w.Text,z,ae=L.New;const Re=new s.Emitter,Me=new s.Emitter,me=new s.Emitter,Ne=new s.Emitter,pe=new s.Emitter,Se=U&&U.cancellationStrategy?U.cancellationStrategy:M.Message;function Be(I){if(I===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+I.toString()}function tt(I){return I===null?"res-unknown-"+(++C).toString():"res-"+I.toString()}function st(){return"not-"+(++ne).
796
- toString()}function Jt(I,re){n.Message.isRequest(re)?I.set(Be(re.id),re):n.Message.isResponse(re)?I.set(tt(re.id),re):I.set(st(),re)}function Ht(I){}function ur(){return ae===L.Listening}function ce(){return ae===L.Closed}function le(){return ae===L.Disposed}function ke(){(ae===L.New||ae===L.Listening)&&(ae=L.Closed,Me.fire(void 0))}function Rr(I){Re.fire([I,void 0,void 0])}function yr(I){Re.fire(I)}T.onClose(ke),T.onError(Rr),B.onClose(ke),B.onError(yr);function Ri(){se||ue.size===0||(se=(0,e.default)().
796
+ toString()}function Jt(I,re){n.Message.isRequest(re)?I.set(Be(re.id),re):n.Message.isResponse(re)?I.set(tt(re.id),re):I.set(st(),re)}function Ht(I){}function ur(){return ae===L.Listening}function ce(){return ae===L.Closed}function le(){return ae===L.Disposed}function ke(){(ae===L.New||ae===L.Listening)&&(ae=L.Closed,Me.fire(void 0))}function Rr(I){Re.fire([I,void 0,void 0])}function gr(I){Re.fire(I)}T.onClose(ke),T.onError(Rr),B.onClose(ke),B.onError(gr);function Ri(){se||ue.size===0||(se=(0,e.default)().
797
797
  timer.setImmediate(()=>{se=void 0,ba()}))}function Ds(I){n.Message.isRequest(I)?Ra(I):n.Message.isNotification(I)?Os(I):n.Message.isResponse(I)?ka(I):Ls(I)}function ba(){if(ue.size===0)return;const I=ue.shift();try{const re=U?.messageStrategy;q.is(re)?re.handleMessage(I,Ds):Ds(I)}finally{Ri()}}const _a=I=>{try{if(n.Message.isNotification(I)&&I.method===o.type.method){const re=I.params.id,he=Be(re),we=ue.get(he);if(n.Message.isRequest(we)){const Ge=U?.connectionStrategy,mt=Ge&&Ge.cancelUndispatched?
798
798
  Ge.cancelUndispatched(we,Ht):void 0;if(mt&&(mt.error!==void 0||mt.result!==void 0)){ue.delete(he),x.delete(re),mt.id=we.id,ki(mt,I.method,Date.now()),B.write(mt).catch(()=>G.error("Sending response for canceled message failed."));return}}const rt=x.get(re);if(rt!==void 0){rt.cancel(),Wi(I);return}else de.add(re)}Jt(ue,I)}finally{Ri()}};function Ra(I){if(le())return;function re(Ke,Et,gt){const dr={jsonrpc:F,id:I.id};Ke instanceof n.ResponseError?dr.error=Ke.toJson():dr.result=Ke===void 0?null:Ke,
799
799
  ki(dr,Et,gt),B.write(dr).catch(()=>G.error("Sending response failed."))}function he(Ke,Et,gt){const dr={jsonrpc:F,id:I.id,error:Ke.toJson()};ki(dr,Et,gt),B.write(dr).catch(()=>G.error("Sending response failed."))}function we(Ke,Et,gt){Ke===void 0&&(Ke=null);const dr={jsonrpc:F,id:I.id,result:Ke};ki(dr,Et,gt),B.write(dr).catch(()=>G.error("Sending response failed."))}Ta(I);const rt=K.get(I.method);let Ge,mt;rt&&(Ge=rt.type,mt=rt.handler);const xe=Date.now();if(mt||Y){const Ke=I.id??String(Date.now()),
@@ -912,8 +912,8 @@ var Me;(function(A){A.Text=1,A.Read=2,A.Write=3})(Me||(n.DocumentHighlightKind=M
912
912
  var E=D;return Q.defined(E)&&Q.typedArray(E.diagnostics,_.is)&&(E.only===void 0||Q.typedArray(E.only,Q.string))&&(E.triggerKind===void 0||E.triggerKind===Jt.Invoked||E.triggerKind===Jt.Automatic)}A.is=k})(Ht||(n.CodeActionContext=Ht={}));var ur;(function(A){function V(D,E,W){var I={title:D},re=!0;return typeof E=="string"?(re=!1,I.kind=E):R.is(E)?I.command=E:I.edit=E,re&&W!==void 0&&(I.kind=W),I}A.create=V;function k(D){var E=D;return E&&Q.string(E.title)&&(E.diagnostics===void 0||Q.typedArray(E.
913
913
  diagnostics,_.is))&&(E.kind===void 0||Q.string(E.kind))&&(E.edit!==void 0||E.command!==void 0)&&(E.command===void 0||R.is(E.command))&&(E.isPreferred===void 0||Q.boolean(E.isPreferred))&&(E.edit===void 0||H.is(E.edit))}A.is=k})(ur||(n.CodeAction=ur={}));var ce;(function(A){function V(D,E){var W={range:D};return Q.defined(E)&&(W.data=E),W}A.create=V;function k(D){var E=D;return Q.defined(E)&&l.is(E.range)&&(Q.undefined(E.command)||R.is(E.command))}A.is=k})(ce||(n.CodeLens=ce={}));var le;(function(A){
914
914
  function V(D,E){return{tabSize:D,insertSpaces:E}}A.create=V;function k(D){var E=D;return Q.defined(E)&&Q.uinteger(E.tabSize)&&Q.boolean(E.insertSpaces)}A.is=k})(le||(n.FormattingOptions=le={}));var ke;(function(A){function V(D,E,W){return{range:D,target:E,data:W}}A.create=V;function k(D){var E=D;return Q.defined(E)&&l.is(E.range)&&(Q.undefined(E.target)||Q.string(E.target))}A.is=k})(ke||(n.DocumentLink=ke={}));var Rr;(function(A){function V(D,E){return{range:D,parent:E}}A.create=V;function k(D){
915
- var E=D;return Q.objectLiteral(E)&&l.is(E.range)&&(E.parent===void 0||A.is(E.parent))}A.is=k})(Rr||(n.SelectionRange=Rr={}));var yr;(function(A){A.namespace="namespace",A.type="type",A.class="class",A.enum="enum",A.interface="interface",A.struct="struct",A.typeParameter="typeParameter",A.parameter="parameter",A.variable="variable",A.property="property",A.enumMember="enumMember",A.event="event",A.function="function",A.method="method",A.macro="macro",A.keyword="keyword",A.modifier="modifier",A.comment=
916
- "comment",A.string="string",A.number="number",A.regexp="regexp",A.operator="operator",A.decorator="decorator"})(yr||(n.SemanticTokenTypes=yr={}));var Ri;(function(A){A.declaration="declaration",A.definition="definition",A.readonly="readonly",A.static="static",A.deprecated="deprecated",A.abstract="abstract",A.async="async",A.modification="modification",A.documentation="documentation",A.defaultLibrary="defaultLibrary"})(Ri||(n.SemanticTokenModifiers=Ri={}));var Ds;(function(A){function V(k){var D=k;
915
+ var E=D;return Q.objectLiteral(E)&&l.is(E.range)&&(E.parent===void 0||A.is(E.parent))}A.is=k})(Rr||(n.SelectionRange=Rr={}));var gr;(function(A){A.namespace="namespace",A.type="type",A.class="class",A.enum="enum",A.interface="interface",A.struct="struct",A.typeParameter="typeParameter",A.parameter="parameter",A.variable="variable",A.property="property",A.enumMember="enumMember",A.event="event",A.function="function",A.method="method",A.macro="macro",A.keyword="keyword",A.modifier="modifier",A.comment=
916
+ "comment",A.string="string",A.number="number",A.regexp="regexp",A.operator="operator",A.decorator="decorator"})(gr||(n.SemanticTokenTypes=gr={}));var Ri;(function(A){A.declaration="declaration",A.definition="definition",A.readonly="readonly",A.static="static",A.deprecated="deprecated",A.abstract="abstract",A.async="async",A.modification="modification",A.documentation="documentation",A.defaultLibrary="defaultLibrary"})(Ri||(n.SemanticTokenModifiers=Ri={}));var Ds;(function(A){function V(k){var D=k;
917
917
  return Q.objectLiteral(D)&&(D.resultId===void 0||typeof D.resultId=="string")&&Array.isArray(D.data)&&(D.data.length===0||typeof D.data[0]=="number")}A.is=V})(Ds||(n.SemanticTokens=Ds={}));var ba;(function(A){function V(D,E){return{range:D,text:E}}A.create=V;function k(D){var E=D;return E!=null&&l.is(E.range)&&Q.string(E.text)}A.is=k})(ba||(n.InlineValueText=ba={}));var _a;(function(A){function V(D,E,W){return{range:D,variableName:E,caseSensitiveLookup:W}}A.create=V;function k(D){var E=D;return E!=
918
918
  null&&l.is(E.range)&&Q.boolean(E.caseSensitiveLookup)&&(Q.string(E.variableName)||E.variableName===void 0)}A.is=k})(_a||(n.InlineValueVariableLookup=_a={}));var Ra;(function(A){function V(D,E){return{range:D,expression:E}}A.create=V;function k(D){var E=D;return E!=null&&l.is(E.range)&&(Q.string(E.expression)||E.expression===void 0)}A.is=k})(Ra||(n.InlineValueEvaluatableExpression=Ra={}));var ka;(function(A){function V(D,E){return{frameId:D,stoppedLocation:E}}A.create=V;function k(D){var E=D;return Q.
919
919
  defined(E)&&l.is(D.stoppedLocation)}A.is=k})(ka||(n.InlineValueContext=ka={}));var Os;(function(A){A.Type=1,A.Parameter=2;function V(k){return k===1||k===2}A.is=V})(Os||(n.InlayHintKind=Os={}));var Ls;(function(A){function V(D){return{value:D}}A.create=V;function k(D){var E=D;return Q.objectLiteral(E)&&(E.tooltip===void 0||Q.string(E.tooltip)||S.is(E.tooltip))&&(E.location===void 0||u.is(E.location))&&(E.command===void 0||R.is(E.command))}A.is=k})(Ls||(n.InlayHintLabelPart=Ls={}));var en;(function(A){
@@ -1001,7 +1001,7 @@ text=="string"&&I.range!==void 0&&(I.rangeLength===void 0||typeof I.rangeLength=
1001
1001
  k.type=new e.ProtocolNotificationType(k.method)})(Se||(t.DidChangeWatchedFilesNotification=Se={}));var Be;(function(k){k.Created=1,k.Changed=2,k.Deleted=3})(Be||(t.FileChangeType=Be={}));var tt;(function(k){function D(E){const W=E;return n.objectLiteral(W)&&(r.URI.is(W.baseUri)||r.WorkspaceFolder.is(W.baseUri))&&n.string(W.pattern)}k.is=D})(tt||(t.RelativePattern=tt={}));var st;(function(k){k.Create=1,k.Change=2,k.Delete=4})(st||(t.WatchKind=st={}));var Jt;(function(k){k.method="textDocument/pub\
1002
1002
  lishDiagnostics",k.messageDirection=e.MessageDirection.serverToClient,k.type=new e.ProtocolNotificationType(k.method)})(Jt||(t.PublishDiagnosticsNotification=Jt={}));var Ht;(function(k){k.Invoked=1,k.TriggerCharacter=2,k.TriggerForIncompleteCompletions=3})(Ht||(t.CompletionTriggerKind=Ht={}));var ur;(function(k){k.method="textDocument/completion",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(ur||(t.CompletionRequest=ur={}));var ce;(function(k){
1003
1003
  k.method="completionItem/resolve",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(ce||(t.CompletionResolveRequest=ce={}));var le;(function(k){k.method="textDocument/hover",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(le||(t.HoverRequest=le={}));var ke;(function(k){k.Invoked=1,k.TriggerCharacter=2,k.ContentChange=3})(ke||(t.SignatureHelpTriggerKind=ke={}));var Rr;(function(k){k.method="textDocum\
1004
- ent/signatureHelp",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Rr||(t.SignatureHelpRequest=Rr={}));var yr;(function(k){k.method="textDocument/definition",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(yr||(t.DefinitionRequest=yr={}));var Ri;(function(k){k.method="textDocument/references",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Ri||(t.ReferencesRequest=
1004
+ ent/signatureHelp",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Rr||(t.SignatureHelpRequest=Rr={}));var gr;(function(k){k.method="textDocument/definition",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(gr||(t.DefinitionRequest=gr={}));var Ri;(function(k){k.method="textDocument/references",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Ri||(t.ReferencesRequest=
1005
1005
  Ri={}));var Ds;(function(k){k.method="textDocument/documentHighlight",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Ds||(t.DocumentHighlightRequest=Ds={}));var ba;(function(k){k.method="textDocument/documentSymbol",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(ba||(t.DocumentSymbolRequest=ba={}));var _a;(function(k){k.method="textDocument/codeAction",k.messageDirection=e.MessageDirection.clientToServer,
1006
1006
  k.type=new e.ProtocolRequestType(k.method)})(_a||(t.CodeActionRequest=_a={}));var Ra;(function(k){k.method="codeAction/resolve",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Ra||(t.CodeActionResolveRequest=Ra={}));var ka;(function(k){k.method="workspace/symbol",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(ka||(t.WorkspaceSymbolRequest=ka={}));var Os;(function(k){k.method="workspaceSymbol/reso\
1007
1007
  lve",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Os||(t.WorkspaceSymbolResolveRequest=Os={}));var Ls;(function(k){k.method="textDocument/codeLens",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(Ls||(t.CodeLensRequest=Ls={}));var en;(function(k){k.method="codeLens/resolve",k.messageDirection=e.MessageDirection.clientToServer,k.type=new e.ProtocolRequestType(k.method)})(en||(t.CodeLensResolveRequest=
@@ -1082,8 +1082,8 @@ type,(le,ke)=>ce(le,ke,(0,n.attachWorkDone)(z,le),(0,n.attachPartialResult)(z,le
1082
1082
  onDocumentRangeFormatting:ce=>z.onRequest(t.DocumentRangeFormattingRequest.type,(le,ke)=>ce(le,ke,(0,n.attachWorkDone)(z,le),void 0)),onDocumentOnTypeFormatting:ce=>z.onRequest(t.DocumentOnTypeFormattingRequest.type,(le,ke)=>ce(le,ke)),onRenameRequest:ce=>z.onRequest(t.RenameRequest.type,(le,ke)=>ce(le,ke,(0,n.attachWorkDone)(z,le),void 0)),onPrepareRename:ce=>z.onRequest(t.PrepareRenameRequest.type,(le,ke)=>ce(le,ke)),onDocumentLinks:ce=>z.onRequest(t.DocumentLinkRequest.type,(le,ke)=>ce(le,ke,
1083
1083
  (0,n.attachWorkDone)(z,le),(0,n.attachPartialResult)(z,le))),onDocumentLinkResolve:ce=>z.onRequest(t.DocumentLinkResolveRequest.type,(le,ke)=>ce(le,ke)),onDocumentColor:ce=>z.onRequest(t.DocumentColorRequest.type,(le,ke)=>ce(le,ke,(0,n.attachWorkDone)(z,le),(0,n.attachPartialResult)(z,le))),onColorPresentation:ce=>z.onRequest(t.ColorPresentationRequest.type,(le,ke)=>ce(le,ke,(0,n.attachWorkDone)(z,le),(0,n.attachPartialResult)(z,le))),onFoldingRanges:ce=>z.onRequest(t.FoldingRangeRequest.type,(le,ke)=>ce(
1084
1084
  le,ke,(0,n.attachWorkDone)(z,le),(0,n.attachPartialResult)(z,le))),onSelectionRanges:ce=>z.onRequest(t.SelectionRangeRequest.type,(le,ke)=>ce(le,ke,(0,n.attachWorkDone)(z,le),(0,n.attachPartialResult)(z,le))),onExecuteCommand:ce=>z.onRequest(t.ExecuteCommandRequest.type,(le,ke)=>ce(le,ke,(0,n.attachWorkDone)(z,le),void 0)),dispose:()=>z.dispose()};for(let ce of Be)ce.attach(ur);return z.onRequest(t.InitializeRequest.type,ce=>{x.initialize(ce),e.string(ce.trace)&&(ae.trace=t.Trace.fromString(ce.trace));
1085
- for(let le of Be)le.initialize(ce.capabilities);if(Jt){let le=Jt(ce,new t.CancellationTokenSource().token,(0,n.attachWorkDone)(z,ce),void 0);return tt(le).then(ke=>{if(ke instanceof t.ResponseError)return ke;let Rr=ke;Rr||(Rr={capabilities:{}});let yr=Rr.capabilities;yr||(yr={},Rr.capabilities=yr),yr.textDocumentSync===void 0||yr.textDocumentSync===null?yr.textDocumentSync=e.number(ur.__textDocumentSync)?ur.__textDocumentSync:t.TextDocumentSyncKind.None:!e.number(yr.textDocumentSync)&&!e.number(
1086
- yr.textDocumentSync.change)&&(yr.textDocumentSync.change=e.number(ur.__textDocumentSync)?ur.__textDocumentSync:t.TextDocumentSyncKind.None);for(let Ri of Be)Ri.fillServerCapabilities(yr);return Rr})}else{let le={capabilities:{textDocumentSync:t.TextDocumentSyncKind.None}};for(let ke of Be)ke.fillServerCapabilities(le.capabilities);return le}}),z.onRequest(t.ShutdownRequest.type,()=>{if(x.shutdownReceived=!0,st)return st(new t.CancellationTokenSource().token)}),z.onNotification(t.ExitNotification.
1085
+ for(let le of Be)le.initialize(ce.capabilities);if(Jt){let le=Jt(ce,new t.CancellationTokenSource().token,(0,n.attachWorkDone)(z,ce),void 0);return tt(le).then(ke=>{if(ke instanceof t.ResponseError)return ke;let Rr=ke;Rr||(Rr={capabilities:{}});let gr=Rr.capabilities;gr||(gr={},Rr.capabilities=gr),gr.textDocumentSync===void 0||gr.textDocumentSync===null?gr.textDocumentSync=e.number(ur.__textDocumentSync)?ur.__textDocumentSync:t.TextDocumentSyncKind.None:!e.number(gr.textDocumentSync)&&!e.number(
1086
+ gr.textDocumentSync.change)&&(gr.textDocumentSync.change=e.number(ur.__textDocumentSync)?ur.__textDocumentSync:t.TextDocumentSyncKind.None);for(let Ri of Be)Ri.fillServerCapabilities(gr);return Rr})}else{let le={capabilities:{textDocumentSync:t.TextDocumentSyncKind.None}};for(let ke of Be)ke.fillServerCapabilities(le.capabilities);return le}}),z.onRequest(t.ShutdownRequest.type,()=>{if(x.shutdownReceived=!0,st)return st(new t.CancellationTokenSource().token)}),z.onNotification(t.ExitNotification.
1087
1087
  type,()=>{try{Ht&&Ht()}finally{x.shutdownReceived?x.exit(0):x.exit(1)}}),z.onNotification(t.SetTraceNotification.type,ce=>{ae.trace=t.Trace.fromString(ce.value)}),ur}return ft.createConnection=_e,ft}var Gr={},sx;function BG(){if(sx)return Gr;sx=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.resolveModulePath=Gr.FileSystem=Gr.resolveGlobalYarnPath=Gr.resolveGlobalNodePath=Gr.resolve=Gr.uriToFilePath=void 0;const t=Y4,e=Lp,r=qv,n=t2;function i(d){let f=t.parse(d);if(f.protocol!=="file:"||!f.
1088
1088
  path)return;let p=f.path.split("/");for(var w=0,g=p.length;w<g;w++)p[w]=decodeURIComponent(p[w]);if(process.platform==="win32"&&p.length>1){let y=p[0],m=p[1];y.length===0&&m.length>1&&m[1]===":"&&p.shift()}return e.normalize(p.join("/"))}Gr.uriToFilePath=i;function s(){return process.platform==="win32"}function a(d,f,p,w){const g="NODE_PATH",y=["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\
1089
1089
  :'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((m,h)=>{let v=process.env,b=Object.create(null);Object.keys(v).forEach(_=>b[_]=v[_]),f&&r.existsSync(f)&&(b[g]?b[g]=f+e.delimiter+b[g]:b[g]=f,w&&w(`NODE_PATH value is: ${b[g]}`)),b.ELECTRON_RUN_AS_NODE="1";try{let _=(0,n.fork)("",[],{cwd:p,env:b,execArgv:["-e",y]});if(_.pid===void 0){h(new Error(`Starting process to resolve node module ${d} failed`));return}_.on("error",$=>{h($)}),_.on("m\
@@ -1789,8 +1789,8 @@ jt.info("LikeC4 MCP Server running on stdio"))}async stop(){if(this.transport)tr
1789
1789
  a.close()}});else if(n[pN]){let a;s.body=new ReadableStream({async pull(o){try{a||=GS.toWeb(n).getReader();const{done:c,value:l}=await a.read();c?o.close():o.enqueue(l)}catch(c){o.error(c)}}})}else s.body=GS.toWeb(n);return new ep(e,s)},Zc=Symbol("getRequestCache"),fY=Symbol("requestCache"),ey=Symbol("incomingKey"),ty=Symbol("urlKey"),pY=Symbol("headersKey"),Jc=Symbol("abortControllerKey"),hY=Symbol("getAbortController"),ry={get method(){return this[ey].method||"GET"},get url(){return this[ty]},
1790
1790
  get headers(){return this[pY]||=uY(this[ey])},[hY](){return this[Zc](),this[Jc]},[Zc](){return this[Jc]||=new AbortController,this[fY]||=dY(this.method,this[ty],this.headers,this[ey],this[Jc])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(t=>{Object.defineProperty(ry,t,{get(){return this[Zc]()[t]}})}),["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(ry,t,{value:function(){
1791
1791
  return this[Zc]()[t]()}})}),Object.setPrototypeOf(ry,ep.prototype);var mY=(t,e)=>{const r=Object.create(ry);r[ey]=t;const n=t.url||"";if(n[0]!=="/"&&(n.startsWith("http://")||n.startsWith("https://"))){if(t instanceof Fp)throw new _o("Absolute URL for :path is not allowed in HTTP/2");try{const o=new URL(n);r[ty]=o.href}catch(o){throw new _o("Invalid absolute URL",{cause:o})}return r}const i=(t instanceof Fp?t.authority:t.headers.host)||e;if(!i)throw new _o("Missing host header");let s;if(t instanceof
1792
- Fp){if(s=t.scheme,!(s==="http"||s==="https"))throw new _o("Unsupported scheme")}else s=t.socket&&t.socket.encrypted?"https":"http";const a=new URL(`${s}://${i}${n}`);if(a.hostname.length!==i.length&&a.hostname!==i.replace(/:\d+$/,""))throw new _o("Invalid host header");return r[ty]=a.href,r},hN=Symbol("responseCache"),Yc=Symbol("getResponseCache"),Ro=Symbol("cache"),rR=global.Response,tp=class I4{#e;#t;[Yc](){return delete this[Ro],this[hN]||=new rR(this.#e,this.#t)}constructor(e,r){let n;if(this.#e=
1793
- e,r instanceof I4){const i=r[hN];if(i){this.#t=i,this[Yc]();return}else this.#t=r.#t,n=new Headers(r.#t.headers)}else this.#t=r;(typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(n||=r?.headers||{"content-type":"text/plain; charset=UTF-8"},this[Ro]=[r?.status||200,e,n])}get headers(){const e=this[Ro];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2])),e[2]):this[Yc]().headers}get status(){return this[Ro]?.[0]??this[Yc]().status}get ok(){const e=this.
1792
+ Fp){if(s=t.scheme,!(s==="http"||s==="https"))throw new _o("Unsupported scheme")}else s=t.socket&&t.socket.encrypted?"https":"http";const a=new URL(`${s}://${i}${n}`);if(a.hostname.length!==i.length&&a.hostname!==i.replace(/:\d+$/,""))throw new _o("Invalid host header");return r[ty]=a.href,r},hN=Symbol("responseCache"),Yc=Symbol("getResponseCache"),Ro=Symbol("cache"),rR=global.Response,tp=class A4{#e;#t;[Yc](){return delete this[Ro],this[hN]||=new rR(this.#e,this.#t)}constructor(e,r){let n;if(this.#e=
1793
+ e,r instanceof A4){const i=r[hN];if(i){this.#t=i,this[Yc]();return}else this.#t=r.#t,n=new Headers(r.#t.headers)}else this.#t=r;(typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(n||=r?.headers||{"content-type":"text/plain; charset=UTF-8"},this[Ro]=[r?.status||200,e,n])}get headers(){const e=this[Ro];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2])),e[2]):this[Yc]().headers}get status(){return this[Ro]?.[0]??this[Yc]().status}get ok(){const e=this.
1794
1794
  status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(tp.prototype,t,{get(){return this[Yc]()[t]}})}),["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(tp.prototype,t,{value:function(){return this[Yc]()[t]()}})}),Object.setPrototypeOf(tp,rR),Object.setPrototypeOf(tp.prototype,rR.prototype);async function gY(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}
1795
1795
  function mN(t,e,r){const n=o=>{t.cancel(o).catch(()=>{})};return e.on("close",n),e.on("error",n),(r??t.read()).then(a,i),t.closed.finally(()=>{e.off("close",n),e.off("error",n)});function i(o){o&&e.destroy(o)}function s(){t.read().then(a,i)}function a({done:o,value:c}){try{if(o)e.end();else if(!e.write(c))e.once("drain",s);else return t.read().then(a,i)}catch(l){i(l)}}}function yY(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:mN(t.getReader(),e)}var gN=t=>{
1796
1796
  const e={};t instanceof Headers||(t=new Headers(t??void 0));const r=[];for(const[n,i]of t)n==="set-cookie"?r.push(i):e[n]=i;return r.length>0&&(e["set-cookie"]=r),e["content-type"]??="text/plain; charset=UTF-8",e},vY="x-hono-already-sent",wY=global.fetch;typeof global.crypto>"u"&&(global.crypto=RS),global.fetch=(t,e)=>(e={compress:!1,...e},wY(t,e));var nR=Symbol("outgoingEnded"),bY=()=>new Response(null,{status:400}),yN=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.
@@ -2615,7 +2615,7 @@ nnection";break;case 11:if(t==="Retry-After"||t==="retry-after")return"retry-aft
2615
2615
  tch";break;case 14:if(t==="Content-Length"||t==="content-length")return"content-length";break;case 15:if(t==="Accept-Encoding"||t==="accept-encoding")return"\0accept-encoding";if(t==="Accept-Language"||t==="accept-language")return"\0accept-language";if(t==="X-Forwarded-For"||t==="x-forwarded-for")return"\0x-forwarded-for";break;case 16:if(t==="Content-Encoding"||t==="content-encoding")return"\0content-encoding";if(t==="X-Forwarded-Host"||t==="x-forwarded-host")return"\0x-forwarded-host";break;case 17:
2616
2616
  if(t==="If-Modified-Since"||t==="if-modified-since")return"if-modified-since";if(t==="Transfer-Encoding"||t==="transfer-encoding")return"\0transfer-encoding";if(t==="X-Forwarded-Proto"||t==="x-forwarded-proto")return"\0x-forwarded-proto";break;case 19:if(t==="Proxy-Authorization"||t==="proxy-authorization")return"proxy-authorization";if(t==="If-Unmodified-Since"||t==="if-unmodified-since")return"if-unmodified-since";break}return e?"\0"+t:sD(t.toLowerCase(),!0)}function kX(t,e,r){t.listenerCount(
2617
2617
  "error")===0?r():r(e)}function xR(t,e){if(typeof t!="string")throw new uy(e,"string",t)}const SX=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function aD(t,e){if(typeof t>"u"||!SX.exec(t))throw new cy(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function EX(t){if(typeof t=="string")return aD(t,"hints"),t;if(Array.isArray(t)){const e=t.length;let r="";if(e===0)return r;for(let n=0;n<e;n++){const i=t[n];aD(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}
2618
- throw new cy("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function TX(t){return t!=null&&t[Symbol.toStringTag]==="Uint8Array"}const tl=Symbol("kNeedDrain"),Kt=Symbol("kOutHeaders");function $X(){return new Date().toUTCString()}function oD(t){return t?16:64*1024}const PX=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;function CX(t){return PX.test(t)}const AX=/[^\t\x20-\x7e\x80-\xff]/;function IR(t){return AX.test(t)}const cD=/(?:^|\W)chunked(?:$|\W)/i;function Zce(t){}
2618
+ throw new cy("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function TX(t){return t!=null&&t[Symbol.toStringTag]==="Uint8Array"}const tl=Symbol("kNeedDrain"),Kt=Symbol("kOutHeaders");function $X(){return new Date().toUTCString()}function oD(t){return t?16:64*1024}const PX=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;function CX(t){return PX.test(t)}const AX=/[^\t\x20-\x7e\x80-\xff]/;function IR(t){return AX.test(t)}const cD=/(?:^|\W)chunked(?:$|\W)/i;function Xce(t){}
2619
2619
  const Jr=Symbol("corked"),rl=Symbol("kChunkedBuffer"),nl=Symbol("kChunkedLength"),il=Symbol("kUniqueHeaders"),ca=Symbol("kBytesWritten"),hy=Symbol("errored"),Eo=Symbol("kHighWaterMark"),NR=Symbol("kRejectNonStandardBodyWrites"),DR=()=>{},xX=/(?:^|\W)close(?:$|\W)/i;function IX(t){return t.length===6&&t.toLowerCase()==="cookie"}function NX(t){return t.length===19&&t.toLowerCase()==="content-disposition"}class DX{[Jr]=0;[Eo]=oD();entries=[];onWrite;constructor(e={}){this.onWrite=e.onWrite}write(e,r,n){
2620
2620
  return this.entries.push({data:e,length:e.length,encoding:r,callback:n,written:!1}),this._flush(),!0}cork(){this[Jr]++}uncork(){this[Jr]--,this._flush()}_flush(){if(this[Jr]<=0)for(const[e,r]of this.entries.entries())r.written||(r.written=!0,this.onWrite!=null&&this.onWrite(e,r),r.callback!=null&&r.callback.call(void 0))}get writableLength(){return this.entries.reduce((e,r)=>e+(r.written&&r.length?r.length:0),0)}get writableHighWaterMark(){return this[Eo]}get writableCorked(){return this[Jr]}}class lD extends F2{req;outputData;outputSize;writtenHeaderBytes=0;_last;chunkedEncoding;shouldKeepAlive;maxRequestsOnConnectionReached;_defaultKeepAlive;useChunkedEncodingByDefault;sendDate;_removedConnection;_removedContLen;_removedTE;strictContentLength;[ca];_contentLength;_hasBody;_trailer;[tl];finished;_headerSent;[Jr];[rl];[nl];_closed;_header;[Kt];_keepAliveTimeout;_maxRequestsPerSocket;_onPendingData;[il];[hy];[Eo];[NR];_writtenDataBuffer=new DX(
2621
2621
  {onWrite:this._onDataWritten.bind(this)});constructor(e,r){super(),this.req=e,this.outputData=[],this.outputSize=0,this.destroyed=!1,this._last=!1,this.chunkedEncoding=!1,this.shouldKeepAlive=!0,this.maxRequestsOnConnectionReached=!1,this._defaultKeepAlive=!0,this.useChunkedEncodingByDefault=!0,this.sendDate=!1,this._removedConnection=!1,this._removedContLen=!1,this._removedTE=!1,this.strictContentLength=!1,this[ca]=0,this._contentLength=null,this._hasBody=!0,this._trailer="",this[tl]=!1,this.finished=
@@ -2683,88 +2683,88 @@ matchResult)}get req(){return this.#t??=new _D(this.#e,this.#f,this.#c),this.#t}
2683
2683
  const n=this.#i.headers.getSetCookie();t.headers.delete("set-cookie");for(const i of n)t.headers.append("set-cookie",i)}else t.headers.set(e,r)}this.#i=t,this.finalized=!0}render=(...t)=>(this.#u??=e=>this.html(e),this.#u(...t));setLayout=t=>this.#o=t;getLayout=()=>this.#o;setRenderer=t=>{this.#u=t};header=(t,e,r)=>{this.finalized&&(this.#i=new Response(this.#i.body,this.#i));const n=this.#i?this.#i.headers:this.#d??=new Headers;e===void 0?n.delete(t):r?.append?n.append(t,e):n.set(t,e)};status=t=>{
2684
2684
  this.#n=t};set=(t,e)=>{this.#r??=new Map,this.#r.set(t,e)};get=t=>this.#r?this.#r.get(t):void 0;get var(){return this.#r?Object.fromEntries(this.#r):{}}#l(t,e,r){const n=this.#i?new Headers(this.#i.headers):this.#d??new Headers;if(typeof e=="object"&&"headers"in e){const s=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(const[a,o]of s)a.toLowerCase()==="set-cookie"?n.append(a,o):n.set(a,o)}if(r)for(const[s,a]of Object.entries(r))if(typeof a=="string")n.set(s,a);else{n.delete(s);
2685
2685
  for(const o of a)n.append(s,o)}const i=typeof e=="number"?e:e?.status??this.#n;return new Response(t,{status:i,headers:n})}newResponse=(...t)=>this.#l(...t);body=(t,e,r)=>this.#l(t,e,r);text=(t,e,r)=>!this.#d&&!this.#n&&!e&&!r&&!this.finalized?new Response(t):this.#l(t,e,jR(sQ,r));json=(t,e,r)=>this.#l(JSON.stringify(t),e,jR("application/json",r));html=(t,e,r)=>{const n=i=>this.#l(i,e,jR("text/html; charset=UTF-8",r));return typeof t=="object"?RD(t,iQ.Stringify,!1,{}).then(n):n(t)};redirect=(t,e)=>{
2686
- const r=String(t);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,e??302)};notFound=()=>(this.#a??=()=>new Response,this.#a(this))},mr="ALL",oQ="all",cQ=["get","post","put","delete","options","patch"],kD="Can not add a route since the matcher is already built.",SD=class extends Error{},lQ="__COMPOSED_HANDLER",uQ=t=>t.text("404 Not Found",404),ED=(t,e)=>{if("getResponse"in t){const r=t.getResponse();return e.newResponse(r.body,r)}return console.error(t),
2687
- e.text("Internal Server Error",500)},TD=class{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(e={}){[...cQ,oQ].forEach(s=>{this[s]=(a,...o)=>(typeof a=="string"?this.#e=a:this.#n(s,this.#e,a),o.forEach(c=>{this.#n(s,this.#e,c)}),this)}),this.on=(s,a,...o)=>{for(const c of[a].flat()){this.#e=c;for(const l of[s].flat())o.map(u=>{this.#n(l.toUpperCase(),this.#e,u)})}return this},this.use=(s,...a)=>(typeof s=="string"?this.#e=s:(this.#e="*",a.unshift(
2688
- s)),a.forEach(o=>{this.#n(mr,this.#e,o)}),this);const{strict:n,...i}=e;Object.assign(this,i),this.getPath=n??!0?e.getPath??gD:tQ}#t(){const e=new TD({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#r=this.#r,e.routes=this.routes,e}#r=uQ;errorHandler=ED;route(e,r){const n=this.basePath(e);return r.routes.map(i=>{let s;r.errorHandler===ED?s=i.handler:(s=async(a,o)=>(await hD([],r.errorHandler)(a,()=>i.handler(a,o))).res,s[lQ]=i.handler),n.#n(i.method,i.path,s)}),
2689
- this}basePath(e){const r=this.#t();return r._basePath=sl(this._basePath,e),r}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#r=e,this);mount(e,r,n){let i,s;n&&(typeof n=="function"?s=n:(s=n.optionHandler,n.replaceRequest===!1?i=c=>c:i=n.replaceRequest));const a=s?c=>{const l=s(c);return Array.isArray(l)?l:[l]}:c=>{let l;try{l=c.executionCtx}catch{}return[c.env,l]};i||=(()=>{const c=sl(this._basePath,e),l=c==="/"?0:c.length;return u=>{const d=new URL(u.url);return d.pathname=d.pathname.slice(
2690
- l)||"/",new Request(d,u)}})();const o=async(c,l)=>{const u=await r(i(c.req.raw),...a(c));if(u)return u;await l()};return this.#n(mr,sl(e,"*"),o),this}#n(e,r,n){e=e.toUpperCase(),r=sl(this._basePath,r);const i={basePath:this._basePath,path:r,method:e,handler:n};this.router.add(e,r,[n,i]),this.routes.push(i)}#s(e,r){if(e instanceof Error)return this.errorHandler(e,r);throw e}#i(e,r,n,i){if(i==="HEAD")return(async()=>new Response(null,await this.#i(e,r,n,"GET")))();const s=this.getPath(e,{env:n}),a=this.
2691
- router.match(i,s),o=new aQ(e,{path:s,matchResult:a,env:n,executionCtx:r,notFoundHandler:this.#r});if(a[0].length===1){let l;try{l=a[0][0][0][0](o,async()=>{o.res=await this.#r(o)})}catch(u){return this.#s(u,o)}return l instanceof Promise?l.then(u=>u||(o.finalized?o.res:this.#r(o))).catch(u=>this.#s(u,o)):l??this.#r(o)}const c=hD(a[0],this.errorHandler,this.#r);return(async()=>{try{const l=await c(o);if(!l.finalized)throw new Error("Context is not finalized. Did you forget to return a Response ob\
2692
- ject or `await next()`?");return l.res}catch(l){return this.#s(l,o)}})()}fetch=(e,...r)=>this.#i(e,r[1],r[0],e.method);request=(e,r,n,i)=>e instanceof Request?this.fetch(r?new Request(e,r):e,n,i):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${sl("/",e)}`,r),n,i));fire=()=>{addEventListener("fetch",e=>{e.respondWith(this.#i(e.request,e,void 0,e.request.method))})}},$D=[];function dQ(t,e){const r=this.buildAllMatchers(),n=(i,s)=>{const a=r[i]||r[mr],o=a[2][s];if(o)
2693
- return o;const c=s.match(a[0]);if(!c)return[[],$D];const l=c.indexOf("",1);return[a[1][l],c]};return this.match=n,n(t,e)}var vy="[^/]+",ip=".*",sp="(?:|/.*)",al=Symbol(),fQ=new Set(".\\+*[^]$()");function pQ(t,e){return t.length===1?e.length===1?t<e?-1:1:-1:e.length===1||t===ip||t===sp?1:e===ip||e===sp?-1:t===vy?1:e===vy?-1:t.length===e.length?t<e?-1:1:e.length-t.length}var qR=class{#e;#t;#r=Object.create(null);insert(e,r,n,i,s){if(e.length===0){if(this.#e!==void 0)throw al;if(s)return;this.#e=r;
2694
- return}const[a,...o]=e,c=a==="*"?o.length===0?["","",ip]:["","",vy]:a==="/*"?["","",sp]:a.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let l;if(c){const u=c[1];let d=c[2]||vy;if(u&&c[2]&&(d===".*"||(d=d.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(d))))throw al;if(l=this.#r[d],!l){if(Object.keys(this.#r).some(f=>f!==ip&&f!==sp))throw al;if(s)return;l=this.#r[d]=new qR,u!==""&&(l.#t=i.varIndex++)}!s&&u!==""&&n.push([u,l.#t])}else if(l=this.#r[a],!l){if(Object.keys(this.#r).some(u=>u.length>1&&
2695
- u!==ip&&u!==sp))throw al;if(s)return;l=this.#r[a]=new qR}l.insert(o,r,n,i,s)}buildRegExpStr(){const r=Object.keys(this.#r).sort(pQ).map(n=>{const i=this.#r[n];return(typeof i.#t=="number"?`(${n})@${i.#t}`:fQ.has(n)?`\\${n}`:n)+i.buildRegExpStr()});return typeof this.#e=="number"&&r.unshift(`#${this.#e}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}},hQ=class{#e={varIndex:0};#t=new qR;insert(t,e,r){const n=[],i=[];for(let a=0;;){let o=!1;if(t=t.replace(/\{[^}]+\}/g,c=>{const l=`@\\${a}`;
2696
- return i[a]=[l,c],a++,o=!0,l}),!o)break}const s=t.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=i.length-1;a>=0;a--){const[o]=i[a];for(let c=s.length-1;c>=0;c--)if(s[c].indexOf(o)!==-1){s[c]=s[c].replace(o,i[a][1]);break}}return this.#t.insert(s,e,n,this.#e,r),n}buildRegExp(){let t=this.#t.buildRegExpStr();if(t==="")return[/^$/,[],[]];let e=0;const r=[],n=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,s,a)=>s!==void 0?(r[++e]=Number(s),"$()"):(a!==void 0&&(n[Number(a)]=++e),"")),[new RegExp(
2697
- `^${t}`),r,n]}},mQ=[/^$/,[],Object.create(null)],PD=Object.create(null);function CD(t){return PD[t]??=new RegExp(t==="*"?"":`^${t.replace(/\/\*$|([.\\+*[^\]$()])/g,(e,r)=>r?`\\${r}`:"(?:|/.*)")}$`)}function gQ(){PD=Object.create(null)}function yQ(t){const e=new hQ,r=[];if(t.length===0)return mQ;const n=t.map(l=>[!/\*|\/:/.test(l[0]),...l]).sort(([l,u],[d,f])=>l?1:d?-1:u.length-f.length),i=Object.create(null);for(let l=0,u=-1,d=n.length;l<d;l++){const[f,p,w]=n[l];f?i[p]=[w.map(([y])=>[y,Object.create(
2698
- null)]),$D]:u++;let g;try{g=e.insert(p,u,f)}catch(y){throw y===al?new SD(p):y}f||(r[u]=w.map(([y,m])=>{const h=Object.create(null);for(m-=1;m>=0;m--){const[v,b]=g[m];h[v]=b}return[y,h]}))}const[s,a,o]=e.buildRegExp();for(let l=0,u=r.length;l<u;l++)for(let d=0,f=r[l].length;d<f;d++){const p=r[l][d]?.[1];if(!p)continue;const w=Object.keys(p);for(let g=0,y=w.length;g<y;g++)p[w[g]]=o[p[w[g]]]}const c=[];for(const l in a)c[l]=r[a[l]];return[s,c,i]}function ol(t,e){if(t){for(const r of Object.keys(t).
2699
- sort((n,i)=>i.length-n.length))if(CD(r).test(e))return[...t[r]]}}var vQ=class{name="RegExpRouter";#e;#t;constructor(){this.#e={[mr]:Object.create(null)},this.#t={[mr]:Object.create(null)}}add(t,e,r){const n=this.#e,i=this.#t;if(!n||!i)throw new Error(kD);n[t]||[n,i].forEach(o=>{o[t]=Object.create(null),Object.keys(o[mr]).forEach(c=>{o[t][c]=[...o[mr][c]]})}),e==="/*"&&(e="*");const s=(e.match(/\/:/g)||[]).length;if(/\*$/.test(e)){const o=CD(e);t===mr?Object.keys(n).forEach(c=>{n[c][e]||=ol(n[c],
2700
- e)||ol(n[mr],e)||[]}):n[t][e]||=ol(n[t],e)||ol(n[mr],e)||[],Object.keys(n).forEach(c=>{(t===mr||t===c)&&Object.keys(n[c]).forEach(l=>{o.test(l)&&n[c][l].push([r,s])})}),Object.keys(i).forEach(c=>{(t===mr||t===c)&&Object.keys(i[c]).forEach(l=>o.test(l)&&i[c][l].push([r,s]))});return}const a=yD(e)||[e];for(let o=0,c=a.length;o<c;o++){const l=a[o];Object.keys(i).forEach(u=>{(t===mr||t===u)&&(i[u][l]||=[...ol(n[u],l)||ol(n[mr],l)||[]],i[u][l].push([r,s-c+o+1]))})}}match=dQ;buildAllMatchers(){const t=Object.
2701
- create(null);return Object.keys(this.#t).concat(Object.keys(this.#e)).forEach(e=>{t[e]||=this.#r(e)}),this.#e=this.#t=void 0,gQ(),t}#r(t){const e=[];let r=t===mr;return[this.#e,this.#t].forEach(n=>{const i=n[t]?Object.keys(n[t]).map(s=>[s,n[t][s]]):[];i.length!==0?(r||=!0,e.push(...i)):t!==mr&&e.push(...Object.keys(n[mr]).map(s=>[s,n[mr][s]]))}),r?yQ(e):null}},wQ=class{name="SmartRouter";#e=[];#t=[];constructor(t){this.#e=t.routers}add(t,e,r){if(!this.#t)throw new Error(kD);this.#t.push([t,e,r])}match(t,e){
2702
- if(!this.#t)throw new Error("Fatal error");const r=this.#e,n=this.#t,i=r.length;let s=0,a;for(;s<i;s++){const o=r[s];try{for(let c=0,l=n.length;c<l;c++)o.add(...n[c]);a=o.match(t,e)}catch(c){if(c instanceof SD)continue;throw c}this.match=o.match.bind(o),this.#e=[o],this.#t=void 0;break}if(s===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#t||this.#e.length!==1)throw new Error("No active router has been determined yet.");return this.#e[0]}},
2703
- ap=Object.create(null),AD=class{#e;#t;#r;#n=0;#s=ap;constructor(e,r,n){if(this.#t=n||Object.create(null),this.#e=[],e&&r){const i=Object.create(null);i[e]={handler:r,possibleKeys:[],score:0},this.#e=[i]}this.#r=[]}insert(e,r,n){this.#n=++this.#n;let i=this;const s=JX(r),a=[];for(let o=0,c=s.length;o<c;o++){const l=s[o],u=s[o+1],d=QX(l,u),f=Array.isArray(d)?d[0]:l;if(f in i.#t){i=i.#t[f],d&&a.push(d[1]);continue}i.#t[f]=new AD,d&&(i.#r.push(d),a.push(d[1])),i=i.#t[f]}return i.#e.push({[e]:{handler:n,
2704
- possibleKeys:a.filter((o,c,l)=>l.indexOf(o)===c),score:this.#n}}),i}#i(e,r,n,i){const s=[];for(let a=0,o=e.#e.length;a<o;a++){const c=e.#e[a],l=c[r]||c[mr],u={};if(l!==void 0&&(l.params=Object.create(null),s.push(l),n!==ap||i&&i!==ap))for(let d=0,f=l.possibleKeys.length;d<f;d++){const p=l.possibleKeys[d],w=u[l.score];l.params[p]=i?.[p]&&!w?i[p]:n[p]??i?.[p],u[l.score]=!0}}return s}search(e,r){const n=[];this.#s=ap;let s=[this];const a=mD(r),o=[];for(let c=0,l=a.length;c<l;c++){const u=a[c],d=c===
2705
- l-1,f=[];for(let p=0,w=s.length;p<w;p++){const g=s[p],y=g.#t[u];y&&(y.#s=g.#s,d?(y.#t["*"]&&n.push(...this.#i(y.#t["*"],e,g.#s)),n.push(...this.#i(y,e,g.#s))):f.push(y));for(let m=0,h=g.#r.length;m<h;m++){const v=g.#r[m],b=g.#s===ap?{}:{...g.#s};if(v==="*"){const Z=g.#t["*"];Z&&(n.push(...this.#i(Z,e,g.#s)),Z.#s=b,f.push(Z));continue}const[_,R,$]=v;if(!u&&!($ instanceof RegExp))continue;const M=g.#t[_],q=a.slice(c).join("/");if($ instanceof RegExp){const Z=$.exec(q);if(Z){if(b[R]=Z[0],n.push(...this.#i(
2706
- M,e,g.#s,b)),Object.keys(M.#t).length){M.#s=b;const L=Z[0].match(/\//)?.length??0;(o[L]||=[]).push(M)}continue}}($===!0||$.test(u))&&(b[R]=u,d?(n.push(...this.#i(M,e,b,g.#s)),M.#t["*"]&&n.push(...this.#i(M.#t["*"],e,b,g.#s))):(M.#s=b,f.push(M)))}}s=f.concat(o.shift()??[])}return n.length>1&&n.sort((c,l)=>c.score-l.score),[n.map(({handler:c,params:l})=>[c,l])]}},bQ=class{name="TrieRouter";#e;constructor(){this.#e=new AD}add(t,e,r){const n=yD(e);if(n){for(let i=0,s=n.length;i<s;i++)this.#e.insert(
2707
- t,n[i],r);return}this.#e.insert(t,e,r)}match(t,e){return this.#e.search(t,e)}},_Q=class extends TD{constructor(t={}){super(t),this.router=t.router??new wQ({routers:[new vQ,new bQ]})}};function RQ(t){return new _Q().post("/mcp",async e=>{const{req:r,res:n}=BX(e.req.raw),i=t.create();try{const s=new lX({sessionIdGenerator:void 0});return s.onerror=a=>{jt.error(Ve(a))},await i.connect(s),await s.handleRequest(r,n,await e.req.json()),n.on("close",async()=>{await s.close(),await i.close()}),zX(n)}catch(s){
2708
- return jt.error(Ve(s)),e.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null},{status:500})}}).all("/mcp",async e=>e.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null},{status:405})).notFound(e=>(jt.debug(`${e.req.method} ${e.req.url} not found`),e.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not found."},id:null},{status:404}))).onError((e,r)=>(jt.error(Ve(e)),r.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},
2709
- id:null},{status:500})))}function kQ(t){return new Promise((e,r)=>{const{factory:n,port:i}=t,s=RQ(n),a=EY({fetch:s.fetch,hostname:"0.0.0.0",port:i}).prependOnceListener("error",r).prependOnceListener("listening",()=>{a.removeListener("error",r),e(a.unref())})})}class SQ{services;_port;server=void 0;constructor(e,r=33335){this.services=e,this._port=r}get mcp(){throw new Error("StreamableLikeC4MCPServer has access to McpServer only during the request")}get isStarted(){return this.server?.listening===
2710
- !0}get port(){return this._port}async dispose(){await this.stop()}async start(e=this._port){if(this.server){if(this.port===e)return;await this.stop()}jt.info("Starting MCP server on port {port}",{port:e}),this._port=e,this.server=await kQ({factory:this.services.mcp.ServerFactory,port:e}),jt.info("MCP server ready at http://0.0.0.0:{port}/mcp",{port:e})}stop(){const e=this.server;return e?(jt.info("Stopping MCP server"),this.server=void 0,new Promise(r=>{e.close(n=>{n?jt.error("Failed to stop MCP\
2711
- server",{err:n}):jt.info("MCP server stopped"),r()})})):(jt.info("MCP server is not running, nothing to stop"),Promise.resolve())}}const EQ=(t,e=33335)=>{jt.debug("Creating StreamableLikeC4MCPServer");const r=new SQ(t,e),n=t.LanguageMetaData.languageId,i=t.shared.lsp.Connection;return t.shared.workspace.ConfigurationProvider.onConfigurationSectionUpdate(s=>{if(s.section!==n){jt.warn("Unexpected configuration update: {update}",{update:s});return}const{enabled:a=!1,port:o=e}=s.configuration.mcp;if(!a){
2712
- r.stop();return}Promise.resolve().then(()=>r.start(o)).then(()=>{i?.telemetry?.logEvent({eventName:"mcp-server-started",mcpPort:o})}).catch(c=>{const l=Ve(c);i?.telemetry?.logEvent({eventName:"mcp-server-start-failed",mcpPort:o,message:l}),jt.warn(`Failed to start LikeC4 MCP Server:
2686
+ const r=String(t);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,e??302)};notFound=()=>(this.#a??=()=>new Response,this.#a(this))},hr="ALL",oQ="all",cQ=["get","post","put","delete","options","patch"],kD="Can not add a route since the matcher is already built.",SD=class extends Error{},lQ="__COMPOSED_HANDLER",uQ=t=>t.text("404 Not Found",404),ED=(t,e)=>{if("getResponse"in t){const r=t.getResponse();return e.newResponse(r.body,r)}return console.error(t),
2687
+ e.text("Internal Server Error",500)},dQ=class x4{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(e={}){[...cQ,oQ].forEach(s=>{this[s]=(a,...o)=>(typeof a=="string"?this.#e=a:this.#n(s,this.#e,a),o.forEach(c=>{this.#n(s,this.#e,c)}),this)}),this.on=(s,a,...o)=>{for(const c of[a].flat()){this.#e=c;for(const l of[s].flat())o.map(u=>{this.#n(l.toUpperCase(),this.#e,u)})}return this},this.use=(s,...a)=>(typeof s=="string"?this.#e=s:(this.#e="*",a.
2688
+ unshift(s)),a.forEach(o=>{this.#n(hr,this.#e,o)}),this);const{strict:n,...i}=e;Object.assign(this,i),this.getPath=n??!0?e.getPath??gD:tQ}#t(){const e=new x4({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#r=this.#r,e.routes=this.routes,e}#r=uQ;errorHandler=ED;route(e,r){const n=this.basePath(e);return r.routes.map(i=>{let s;r.errorHandler===ED?s=i.handler:(s=async(a,o)=>(await hD([],r.errorHandler)(a,()=>i.handler(a,o))).res,s[lQ]=i.handler),n.#n(i.method,i.
2689
+ path,s)}),this}basePath(e){const r=this.#t();return r._basePath=sl(this._basePath,e),r}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#r=e,this);mount(e,r,n){let i,s;n&&(typeof n=="function"?s=n:(s=n.optionHandler,n.replaceRequest===!1?i=c=>c:i=n.replaceRequest));const a=s?c=>{const l=s(c);return Array.isArray(l)?l:[l]}:c=>{let l;try{l=c.executionCtx}catch{}return[c.env,l]};i||=(()=>{const c=sl(this._basePath,e),l=c==="/"?0:c.length;return u=>{const d=new URL(u.url);return d.pathname=d.
2690
+ pathname.slice(l)||"/",new Request(d,u)}})();const o=async(c,l)=>{const u=await r(i(c.req.raw),...a(c));if(u)return u;await l()};return this.#n(hr,sl(e,"*"),o),this}#n(e,r,n){e=e.toUpperCase(),r=sl(this._basePath,r);const i={basePath:this._basePath,path:r,method:e,handler:n};this.router.add(e,r,[n,i]),this.routes.push(i)}#s(e,r){if(e instanceof Error)return this.errorHandler(e,r);throw e}#i(e,r,n,i){if(i==="HEAD")return(async()=>new Response(null,await this.#i(e,r,n,"GET")))();const s=this.getPath(
2691
+ e,{env:n}),a=this.router.match(i,s),o=new aQ(e,{path:s,matchResult:a,env:n,executionCtx:r,notFoundHandler:this.#r});if(a[0].length===1){let l;try{l=a[0][0][0][0](o,async()=>{o.res=await this.#r(o)})}catch(u){return this.#s(u,o)}return l instanceof Promise?l.then(u=>u||(o.finalized?o.res:this.#r(o))).catch(u=>this.#s(u,o)):l??this.#r(o)}const c=hD(a[0],this.errorHandler,this.#r);return(async()=>{try{const l=await c(o);if(!l.finalized)throw new Error("Context is not finalized. Did you forget to re\
2692
+ turn a Response object or `await next()`?");return l.res}catch(l){return this.#s(l,o)}})()}fetch=(e,...r)=>this.#i(e,r[1],r[0],e.method);request=(e,r,n,i)=>e instanceof Request?this.fetch(r?new Request(e,r):e,n,i):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${sl("/",e)}`,r),n,i));fire=()=>{addEventListener("fetch",e=>{e.respondWith(this.#i(e.request,e,void 0,e.request.method))})}},TD=[];function fQ(t,e){const r=this.buildAllMatchers(),n=((i,s)=>{const a=r[i]||
2693
+ r[hr],o=a[2][s];if(o)return o;const c=s.match(a[0]);if(!c)return[[],TD];const l=c.indexOf("",1);return[a[1][l],c]});return this.match=n,n(t,e)}var vy="[^/]+",ip=".*",sp="(?:|/.*)",al=Symbol(),pQ=new Set(".\\+*[^]$()");function hQ(t,e){return t.length===1?e.length===1?t<e?-1:1:-1:e.length===1||t===ip||t===sp?1:e===ip||e===sp?-1:t===vy?1:e===vy?-1:t.length===e.length?t<e?-1:1:e.length-t.length}var mQ=class mS{#e;#t;#r=Object.create(null);insert(e,r,n,i,s){if(e.length===0){if(this.#e!==void 0)throw al;
2694
+ if(s)return;this.#e=r;return}const[a,...o]=e,c=a==="*"?o.length===0?["","",ip]:["","",vy]:a==="/*"?["","",sp]:a.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let l;if(c){const u=c[1];let d=c[2]||vy;if(u&&c[2]&&(d===".*"||(d=d.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(d))))throw al;if(l=this.#r[d],!l){if(Object.keys(this.#r).some(f=>f!==ip&&f!==sp))throw al;if(s)return;l=this.#r[d]=new mS,u!==""&&(l.#t=i.varIndex++)}!s&&u!==""&&n.push([u,l.#t])}else if(l=this.#r[a],!l){if(Object.keys(this.#r).
2695
+ some(u=>u.length>1&&u!==ip&&u!==sp))throw al;if(s)return;l=this.#r[a]=new mS}l.insert(o,r,n,i,s)}buildRegExpStr(){const r=Object.keys(this.#r).sort(hQ).map(n=>{const i=this.#r[n];return(typeof i.#t=="number"?`(${n})@${i.#t}`:pQ.has(n)?`\\${n}`:n)+i.buildRegExpStr()});return typeof this.#e=="number"&&r.unshift(`#${this.#e}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}},gQ=class{#e={varIndex:0};#t=new mQ;insert(t,e,r){const n=[],i=[];for(let a=0;;){let o=!1;if(t=t.replace(/\{[^}]+\}/g,
2696
+ c=>{const l=`@\\${a}`;return i[a]=[l,c],a++,o=!0,l}),!o)break}const s=t.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=i.length-1;a>=0;a--){const[o]=i[a];for(let c=s.length-1;c>=0;c--)if(s[c].indexOf(o)!==-1){s[c]=s[c].replace(o,i[a][1]);break}}return this.#t.insert(s,e,n,this.#e,r),n}buildRegExp(){let t=this.#t.buildRegExpStr();if(t==="")return[/^$/,[],[]];let e=0;const r=[],n=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,s,a)=>s!==void 0?(r[++e]=Number(s),"$()"):(a!==void 0&&(n[Number(a)]=
2697
+ ++e),"")),[new RegExp(`^${t}`),r,n]}},yQ=[/^$/,[],Object.create(null)],$D=Object.create(null);function PD(t){return $D[t]??=new RegExp(t==="*"?"":`^${t.replace(/\/\*$|([.\\+*[^\]$()])/g,(e,r)=>r?`\\${r}`:"(?:|/.*)")}$`)}function vQ(){$D=Object.create(null)}function wQ(t){const e=new gQ,r=[];if(t.length===0)return yQ;const n=t.map(l=>[!/\*|\/:/.test(l[0]),...l]).sort(([l,u],[d,f])=>l?1:d?-1:u.length-f.length),i=Object.create(null);for(let l=0,u=-1,d=n.length;l<d;l++){const[f,p,w]=n[l];f?i[p]=[w.map(
2698
+ ([y])=>[y,Object.create(null)]),TD]:u++;let g;try{g=e.insert(p,u,f)}catch(y){throw y===al?new SD(p):y}f||(r[u]=w.map(([y,m])=>{const h=Object.create(null);for(m-=1;m>=0;m--){const[v,b]=g[m];h[v]=b}return[y,h]}))}const[s,a,o]=e.buildRegExp();for(let l=0,u=r.length;l<u;l++)for(let d=0,f=r[l].length;d<f;d++){const p=r[l][d]?.[1];if(!p)continue;const w=Object.keys(p);for(let g=0,y=w.length;g<y;g++)p[w[g]]=o[p[w[g]]]}const c=[];for(const l in a)c[l]=r[a[l]];return[s,c,i]}function ol(t,e){if(t){for(const r of Object.
2699
+ keys(t).sort((n,i)=>i.length-n.length))if(PD(r).test(e))return[...t[r]]}}var bQ=class{name="RegExpRouter";#e;#t;constructor(){this.#e={[hr]:Object.create(null)},this.#t={[hr]:Object.create(null)}}add(t,e,r){const n=this.#e,i=this.#t;if(!n||!i)throw new Error(kD);n[t]||[n,i].forEach(o=>{o[t]=Object.create(null),Object.keys(o[hr]).forEach(c=>{o[t][c]=[...o[hr][c]]})}),e==="/*"&&(e="*");const s=(e.match(/\/:/g)||[]).length;if(/\*$/.test(e)){const o=PD(e);t===hr?Object.keys(n).forEach(c=>{n[c][e]||=
2700
+ ol(n[c],e)||ol(n[hr],e)||[]}):n[t][e]||=ol(n[t],e)||ol(n[hr],e)||[],Object.keys(n).forEach(c=>{(t===hr||t===c)&&Object.keys(n[c]).forEach(l=>{o.test(l)&&n[c][l].push([r,s])})}),Object.keys(i).forEach(c=>{(t===hr||t===c)&&Object.keys(i[c]).forEach(l=>o.test(l)&&i[c][l].push([r,s]))});return}const a=yD(e)||[e];for(let o=0,c=a.length;o<c;o++){const l=a[o];Object.keys(i).forEach(u=>{(t===hr||t===u)&&(i[u][l]||=[...ol(n[u],l)||ol(n[hr],l)||[]],i[u][l].push([r,s-c+o+1]))})}}match=fQ;buildAllMatchers(){
2701
+ const t=Object.create(null);return Object.keys(this.#t).concat(Object.keys(this.#e)).forEach(e=>{t[e]||=this.#r(e)}),this.#e=this.#t=void 0,vQ(),t}#r(t){const e=[];let r=t===hr;return[this.#e,this.#t].forEach(n=>{const i=n[t]?Object.keys(n[t]).map(s=>[s,n[t][s]]):[];i.length!==0?(r||=!0,e.push(...i)):t!==hr&&e.push(...Object.keys(n[hr]).map(s=>[s,n[hr][s]]))}),r?wQ(e):null}},_Q=class{name="SmartRouter";#e=[];#t=[];constructor(t){this.#e=t.routers}add(t,e,r){if(!this.#t)throw new Error(kD);this.#t.
2702
+ push([t,e,r])}match(t,e){if(!this.#t)throw new Error("Fatal error");const r=this.#e,n=this.#t,i=r.length;let s=0,a;for(;s<i;s++){const o=r[s];try{for(let c=0,l=n.length;c<l;c++)o.add(...n[c]);a=o.match(t,e)}catch(c){if(c instanceof SD)continue;throw c}this.match=o.match.bind(o),this.#e=[o],this.#t=void 0;break}if(s===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#t||this.#e.length!==1)throw new Error("No active router has\
2703
+ been determined yet.");return this.#e[0]}},ap=Object.create(null),RQ=class I4{#e;#t;#r;#n=0;#s=ap;constructor(e,r,n){if(this.#t=n||Object.create(null),this.#e=[],e&&r){const i=Object.create(null);i[e]={handler:r,possibleKeys:[],score:0},this.#e=[i]}this.#r=[]}insert(e,r,n){this.#n=++this.#n;let i=this;const s=JX(r),a=[];for(let o=0,c=s.length;o<c;o++){const l=s[o],u=s[o+1],d=QX(l,u),f=Array.isArray(d)?d[0]:l;if(f in i.#t){i=i.#t[f],d&&a.push(d[1]);continue}i.#t[f]=new I4,d&&(i.#r.push(d),a.push(
2704
+ d[1])),i=i.#t[f]}return i.#e.push({[e]:{handler:n,possibleKeys:a.filter((o,c,l)=>l.indexOf(o)===c),score:this.#n}}),i}#i(e,r,n,i){const s=[];for(let a=0,o=e.#e.length;a<o;a++){const c=e.#e[a],l=c[r]||c[hr],u={};if(l!==void 0&&(l.params=Object.create(null),s.push(l),n!==ap||i&&i!==ap))for(let d=0,f=l.possibleKeys.length;d<f;d++){const p=l.possibleKeys[d],w=u[l.score];l.params[p]=i?.[p]&&!w?i[p]:n[p]??i?.[p],u[l.score]=!0}}return s}search(e,r){const n=[];this.#s=ap;let s=[this];const a=mD(r),o=[];
2705
+ for(let c=0,l=a.length;c<l;c++){const u=a[c],d=c===l-1,f=[];for(let p=0,w=s.length;p<w;p++){const g=s[p],y=g.#t[u];y&&(y.#s=g.#s,d?(y.#t["*"]&&n.push(...this.#i(y.#t["*"],e,g.#s)),n.push(...this.#i(y,e,g.#s))):f.push(y));for(let m=0,h=g.#r.length;m<h;m++){const v=g.#r[m],b=g.#s===ap?{}:{...g.#s};if(v==="*"){const Z=g.#t["*"];Z&&(n.push(...this.#i(Z,e,g.#s)),Z.#s=b,f.push(Z));continue}const[_,R,$]=v;if(!u&&!($ instanceof RegExp))continue;const M=g.#t[_],q=a.slice(c).join("/");if($ instanceof RegExp){
2706
+ const Z=$.exec(q);if(Z){if(b[R]=Z[0],n.push(...this.#i(M,e,g.#s,b)),Object.keys(M.#t).length){M.#s=b;const L=Z[0].match(/\//)?.length??0;(o[L]||=[]).push(M)}continue}}($===!0||$.test(u))&&(b[R]=u,d?(n.push(...this.#i(M,e,b,g.#s)),M.#t["*"]&&n.push(...this.#i(M.#t["*"],e,b,g.#s))):(M.#s=b,f.push(M)))}}s=f.concat(o.shift()??[])}return n.length>1&&n.sort((c,l)=>c.score-l.score),[n.map(({handler:c,params:l})=>[c,l])]}},kQ=class{name="TrieRouter";#e;constructor(){this.#e=new RQ}add(t,e,r){const n=yD(
2707
+ e);if(n){for(let i=0,s=n.length;i<s;i++)this.#e.insert(t,n[i],r);return}this.#e.insert(t,e,r)}match(t,e){return this.#e.search(t,e)}},SQ=class extends dQ{constructor(t={}){super(t),this.router=t.router??new _Q({routers:[new bQ,new kQ]})}};function EQ(t){return new SQ().post("/mcp",async e=>{const{req:r,res:n}=BX(e.req.raw),i=t.create();try{const s=new lX({sessionIdGenerator:void 0});return s.onerror=a=>{jt.error(Ve(a))},await i.connect(s),await s.handleRequest(r,n,await e.req.json()),n.on("close",
2708
+ async()=>{await s.close(),await i.close()}),zX(n)}catch(s){return jt.error(Ve(s)),e.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null},{status:500})}}).all("/mcp",async e=>e.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null},{status:405})).notFound(e=>(jt.debug(`${e.req.method} ${e.req.url} not found`),e.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not found."},id:null},{status:404}))).onError((e,r)=>(jt.error(Ve(e)),r.json({jsonrpc:"\
2709
+ 2.0",error:{code:-32603,message:"Internal server error"},id:null},{status:500})))}function TQ(t){return new Promise((e,r)=>{const{factory:n,port:i}=t,s=EQ(n),a=EY({fetch:s.fetch,hostname:"0.0.0.0",port:i}).prependOnceListener("error",r).prependOnceListener("listening",()=>{a.removeListener("error",r),e(a.unref())})})}class $Q{services;_port;server=void 0;constructor(e,r=33335){this.services=e,this._port=r}get mcp(){throw new Error("StreamableLikeC4MCPServer has access to McpServer only during th\
2710
+ e request")}get isStarted(){return this.server?.listening===!0}get port(){return this._port}async dispose(){await this.stop()}async start(e=this._port){if(this.server){if(this.port===e)return;await this.stop()}jt.info("Starting MCP server on port {port}",{port:e}),this._port=e,this.server=await TQ({factory:this.services.mcp.ServerFactory,port:e}),jt.info("MCP server ready at http://0.0.0.0:{port}/mcp",{port:e})}stop(){const e=this.server;return e?(jt.info("Stopping MCP server"),this.server=void 0,
2711
+ new Promise(r=>{e.close(n=>{n?jt.error("Failed to stop MCP server",{err:n}):jt.info("MCP server stopped"),r()})})):(jt.info("MCP server is not running, nothing to stop"),Promise.resolve())}}const PQ=(t,e=33335)=>{jt.debug("Creating StreamableLikeC4MCPServer");const r=new $Q(t,e),n=t.LanguageMetaData.languageId,i=t.shared.lsp.Connection;return t.shared.workspace.ConfigurationProvider.onConfigurationSectionUpdate(s=>{if(s.section!==n){jt.warn("Unexpected configuration update: {update}",{update:s});
2712
+ return}const{enabled:a=!1,port:o=e}=s.configuration.mcp;if(!a){r.stop();return}Promise.resolve().then(()=>r.start(o)).then(()=>{i?.telemetry?.logEvent({eventName:"mcp-server-started",mcpPort:o})}).catch(c=>{const l=Ve(c);i?.telemetry?.logEvent({eventName:"mcp-server-start-failed",mcpPort:o,message:l}),jt.warn(`Failed to start LikeC4 MCP Server:
2713
2713
  ${l}`),i&&i.window.showErrorMessage(`LikeC4: Failed to start MCP Server
2714
2714
 
2715
- ${l}`)})}),r},TQ=t=>new oY(t),$Q=(t="sse")=>({mcpServer:e=>{if(t==="stdio")return TQ(e);const r=typeof t=="object"?t.port:33335;return EQ(e,r)}});var PQ=Object.getOwnPropertyNames,CQ=Object.getOwnPropertySymbols,AQ=Object.prototype.hasOwnProperty;function xD(t,e){return function(n,i,s){return t(n,i,s)&&e(n,i,s)}}function wy(t){return function(r,n,i){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,i);var s=i.cache,a=s.get(r),o=s.get(n);if(a&&o)return a===n&&o===r;s.set(r,n),s.set(n,
2716
- r);var c=t(r,n,i);return s.delete(r),s.delete(n),c}}function xQ(t){return t?.[Symbol.toStringTag]}function ID(t){return PQ(t).concat(CQ(t))}var IQ=Object.hasOwn||(function(t,e){return AQ.call(t,e)});function To(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var NQ="__v",DQ="__o",OQ="_owner",ND=Object.getOwnPropertyDescriptor,DD=Object.keys;function LQ(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function MQ(t,e){return To(t.getTime(),e.
2717
- getTime())}function jQ(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function qQ(t,e){return t===e}function OD(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),s=t.entries(),a,o,c=0;(a=s.next())&&!a.done;){for(var l=e.entries(),u=!1,d=0;(o=l.next())&&!o.done;){if(i[d]){d++;continue}var f=a.value,p=o.value;if(r.equals(f[0],p[0],c,d,t,e,r)&&r.equals(f[1],p[1],f[0],p[0],t,e,r)){u=i[d]=!0;break}d++}if(!u)return!1;c++}return!0}
2718
- var FQ=To;function HQ(t,e,r){var n=DD(t),i=n.length;if(DD(e).length!==i)return!1;for(;i-- >0;)if(!MD(t,e,r,n[i]))return!1;return!0}function op(t,e,r){var n=ID(t),i=n.length;if(ID(e).length!==i)return!1;for(var s,a,o;i-- >0;)if(s=n[i],!MD(t,e,r,s)||(a=ND(t,s),o=ND(e,s),(a||o)&&(!a||!o||a.configurable!==o.configurable||a.enumerable!==o.enumerable||a.writable!==o.writable)))return!1;return!0}function BQ(t,e){return To(t.valueOf(),e.valueOf())}function zQ(t,e){return t.source===e.source&&t.flags===e.
2719
- flags}function LD(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),s=t.values(),a,o;(a=s.next())&&!a.done;){for(var c=e.values(),l=!1,u=0;(o=c.next())&&!o.done;){if(!i[u]&&r.equals(a.value,o.value,a.value,o.value,t,e,r)){l=i[u]=!0;break}u++}if(!l)return!1}return!0}function UQ(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function VQ(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.
2720
- port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function MD(t,e,r,n){return(n===OQ||n===DQ||n===NQ)&&(t.$$typeof||e.$$typeof)?!0:IQ(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var WQ="[object Arguments]",GQ="[object Boolean]",KQ="[object Date]",ZQ="[object Error]",JQ="[object Map]",YQ="[object Number]",XQ="[object Object]",QQ="[object RegExp]",eee="[object Set]",tee="[object String]",ree="[object URL]",nee=Array.isArray,jD=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView==
2721
- "function"?ArrayBuffer.isView:null,qD=Object.assign,iee=Object.prototype.toString.call.bind(Object.prototype.toString);function see(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,i=t.areFunctionsEqual,s=t.areMapsEqual,a=t.areNumbersEqual,o=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,l=t.areRegExpsEqual,u=t.areSetsEqual,d=t.areTypedArraysEqual,f=t.areUrlsEqual,p=t.unknownTagComparators;return function(g,y,m){if(g===y)return!0;if(g==null||y==null)return!1;var h=typeof g;if(h!==
2722
- typeof y)return!1;if(h!=="object")return h==="number"?a(g,y,m):h==="function"?i(g,y,m):!1;var v=g.constructor;if(v!==y.constructor)return!1;if(v===Object)return o(g,y,m);if(nee(g))return e(g,y,m);if(jD!=null&&jD(g))return d(g,y,m);if(v===Date)return r(g,y,m);if(v===RegExp)return l(g,y,m);if(v===Map)return s(g,y,m);if(v===Set)return u(g,y,m);var b=iee(g);if(b===KQ)return r(g,y,m);if(b===QQ)return l(g,y,m);if(b===JQ)return s(g,y,m);if(b===eee)return u(g,y,m);if(b===XQ)return typeof g.then!="functi\
2723
- on"&&typeof y.then!="function"&&o(g,y,m);if(b===ree)return f(g,y,m);if(b===ZQ)return n(g,y,m);if(b===WQ)return o(g,y,m);if(b===GQ||b===YQ||b===tee)return c(g,y,m);if(p){var _=p[b];if(!_){var R=xQ(g);R&&(_=p[R])}if(_)return _(g,y,m)}return!1}}function aee(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,i={areArraysEqual:n?op:LQ,areDatesEqual:MQ,areErrorsEqual:jQ,areFunctionsEqual:qQ,areMapsEqual:n?xD(OD,op):OD,areNumbersEqual:FQ,areObjectsEqual:n?op:HQ,arePrimitiveWrappersEqual:BQ,areRegExpsEqual:zQ,
2724
- areSetsEqual:n?xD(LD,op):LD,areTypedArraysEqual:n?op:UQ,areUrlsEqual:VQ,unknownTagComparators:void 0};if(r&&(i=qD({},i,r(i))),e){var s=wy(i.areArraysEqual),a=wy(i.areMapsEqual),o=wy(i.areObjectsEqual),c=wy(i.areSetsEqual);i=qD({},i,{areArraysEqual:s,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return i}function oee(t){return function(e,r,n,i,s,a,o){return t(e,r,o)}}function cee(t){var e=t.circular,r=t.comparator,n=t.createState,i=t.equals,s=t.strict;if(n)return function(c,l){var u=n(),d=u.cache,
2725
- f=d===void 0?e?new WeakMap:void 0:d,p=u.meta;return r(c,l,{cache:f,equals:i,meta:p,strict:s})};if(e)return function(c,l){return r(c,l,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var a={cache:void 0,equals:i,meta:void 0,strict:s};return function(c,l){return r(c,l,a)}}var FR=la();la({strict:!0}),la({circular:!0}),la({circular:!0,strict:!0}),la({createInternalComparator:function(){return To}}),la({strict:!0,createInternalComparator:function(){return To}}),la({circular:!0,createInternalComparator:function(){
2726
- return To}}),la({circular:!0,createInternalComparator:function(){return To},strict:!0});function la(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,n=t.createInternalComparator,i=t.createState,s=t.strict,a=s===void 0?!1:s,o=aee(t),c=see(o),l=n?n(c):oee(c);return cee({circular:r,comparator:c,createState:i,equals:l,strict:a})}const lee=100,FD=100,ua={top:50,right:40,bottom:40,left:40};function HD(t,e){const r=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:a,y:o,width:c,height:l}=s;
2727
- return{...i,width:c,height:l,x:a,y:o}}),n=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:r,edges:n}}function uee(t,e){const r=new Map(t.nodes.map(i=>[i.id,i]));if(t.hash===e.hash||fee(t,e))return zD(t.nodes.filter(i=>!i.parent),r,e),HD(t,e);t.hasLayoutDrift=!0;const n=_l.merge(...t.nodes.map(i=>e.nodes[i.id]).filter(i=>!!i));return t.nodes.filter(i=>i.parent==null).reduce((i,s)=>BD(s,i,r,e),{x:n.x,y:n.y+n.height+
2728
- FD}),t.edges.filter(i=>!e.edges[i.id]).forEach(i=>dee(i,e)),HD(t,e)}function BD(t,e,r,n){let i=n.nodes[t.id];const s=i?.isCompound??!1,a=!i,o=a?e:{x:i.x,y:i.y},c=t.children.map(d=>n.nodes[d]).filter(d=>!!d),l=c.length>0&&_l.merge(...c),u=s&&l?{x:l.x,y:l.y+l.height+FD}:{x:o.x+ua.left,y:o.y+ua.top};return t.children.map(d=>r.get(d)).reduce((d,f)=>BD(f,d,r,n),u),i=t.children.length>0?UD(t,n):n.nodes[t.id]??{isCompound:!1,width:t.width,height:t.height,x:o.x,y:o.y},n.nodes[t.id]=i,a?{x:i.x+i.width+lee,
2729
- y:i.y}:e}function dee(t,e){const r=e.nodes[t.source],n=e.nodes[t.target],i=VD(_l.center(r)),s=VD(_l.center(n)),a=s.subtract(i),{x:o,y:c}=a.divide(2).add(i),l={...t?.labelBBox??{width:0,height:0},x:o,y:c},u=a.multiply(.7).add(i),d=a.multiply(.3).add(i);e.edges[t.id]={points:[[i.x,i.y],[d.x,d.y],[u.x,u.y],[s.x,s.y]],labelBBox:l,controlPoints:[u]}}function zD(t,e,r){t.filter(n=>n.children.length>0).forEach(n=>{zD(n.children.map(i=>e.get(i)).filter(i=>!!i),e,r),r.nodes[n.id]=UD(n,r)})}function UD(t,e){
2730
- const r=_l.merge(...t.children.map(n=>e.nodes[n]));return{isCompound:!0,x:r.x-ua.left,y:r.y-ua.top,width:r.width+ua.left+ua.right,height:r.height+ua.top+ua.bottom}}function fee(t,e){const r=n=>n.children.length>0;return FR(t.autoLayout,e.autoLayout)&&t.nodes.every(n=>{const i=e.nodes[n.id];return!!i&&r(n)===i.isCompound})&&t.edges.every(n=>!!e.edges[n.id])}function VD({x:t,y:e}){return new W2(t,e)}function WD(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function HR(t){return typeof t==
2731
- "object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function GD(t){return HR(t)||WD(t)}function cp(t){return typeof t=="string"||GD(t)}function pee(t){return Array.isArray(t)&&t.every(cp)}function hee(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function KD(t){if(GD(t))return t;const[e,r,n]=t.split(":");return hee(n)?{id:e,port:r,compass:n}:{id:e,port:r}}function mee(t){if(t.length<2&&(cp(t[0])&&cp(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.
2732
- map(e=>KD(e))}const by=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function gee(t){return Object.assign(Object.seal(Object.assign({},by)),t)}function yee(...t){const[e,...r]=t;return(...n)=>r.reduce((i,s)=>s(i),e(...n))}function Gn(t,...e){return yee(t,...e)}const vee=t=>(...e)=>r=>t(r,...e),wee=t=>({[Symbol.iterator]:t}),pi=vee((t,e)=>Array.from(wee(function*(){for(const r of t)yield e(r)})));class ZD{options;getLocation(){return this.options?.locationFunction?.()??
2733
- null}constructor(e){this.options=e}createElement(e,r,n=[]){return{location:this.getLocation(),...r,type:e,children:n}}}const wt=ZD.prototype.createElement.bind(new ZD),bee=/\r?\n/;function hi(t){return e=>e.join(t)}function _ee(t){return e=>t+e+t}function da(t,e){return r=>t+r+e}function _y(t){return e=>t+e}const JD=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),Ry=t=>t.split(bee),lp=(t,e,r)=>Gn(Ry,pi(_y(t==="space"?" ".repeat(e):`
2715
+ ${l}`)})}),r},CQ=t=>new oY(t),AQ=(t="sse")=>({mcpServer:e=>{if(t==="stdio")return CQ(e);const r=typeof t=="object"?t.port:33335;return PQ(e,r)}});var xQ=Object.getOwnPropertyNames,IQ=Object.getOwnPropertySymbols,NQ=Object.prototype.hasOwnProperty;function CD(t,e){return function(n,i,s){return t(n,i,s)&&e(n,i,s)}}function wy(t){return function(r,n,i){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,i);var s=i.cache,a=s.get(r),o=s.get(n);if(a&&o)return a===n&&o===r;s.set(r,n),s.set(n,
2716
+ r);var c=t(r,n,i);return s.delete(r),s.delete(n),c}}function DQ(t){return t?.[Symbol.toStringTag]}function AD(t){return xQ(t).concat(IQ(t))}var OQ=Object.hasOwn||(function(t,e){return NQ.call(t,e)});function To(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var LQ="__v",MQ="__o",jQ="_owner",xD=Object.getOwnPropertyDescriptor,ID=Object.keys;function qQ(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function FQ(t,e){return To(t.getTime(),e.
2717
+ getTime())}function HQ(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function BQ(t,e){return t===e}function ND(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),s=t.entries(),a,o,c=0;(a=s.next())&&!a.done;){for(var l=e.entries(),u=!1,d=0;(o=l.next())&&!o.done;){if(i[d]){d++;continue}var f=a.value,p=o.value;if(r.equals(f[0],p[0],c,d,t,e,r)&&r.equals(f[1],p[1],f[0],p[0],t,e,r)){u=i[d]=!0;break}d++}if(!u)return!1;c++}return!0}
2718
+ var zQ=To;function UQ(t,e,r){var n=ID(t),i=n.length;if(ID(e).length!==i)return!1;for(;i-- >0;)if(!OD(t,e,r,n[i]))return!1;return!0}function op(t,e,r){var n=AD(t),i=n.length;if(AD(e).length!==i)return!1;for(var s,a,o;i-- >0;)if(s=n[i],!OD(t,e,r,s)||(a=xD(t,s),o=xD(e,s),(a||o)&&(!a||!o||a.configurable!==o.configurable||a.enumerable!==o.enumerable||a.writable!==o.writable)))return!1;return!0}function VQ(t,e){return To(t.valueOf(),e.valueOf())}function WQ(t,e){return t.source===e.source&&t.flags===e.
2719
+ flags}function DD(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var i=new Array(n),s=t.values(),a,o;(a=s.next())&&!a.done;){for(var c=e.values(),l=!1,u=0;(o=c.next())&&!o.done;){if(!i[u]&&r.equals(a.value,o.value,a.value,o.value,t,e,r)){l=i[u]=!0;break}u++}if(!l)return!1}return!0}function GQ(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function KQ(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.
2720
+ port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function OD(t,e,r,n){return(n===jQ||n===MQ||n===LQ)&&(t.$$typeof||e.$$typeof)?!0:OQ(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var ZQ="[object Arguments]",JQ="[object Boolean]",YQ="[object Date]",XQ="[object Error]",QQ="[object Map]",eee="[object Number]",tee="[object Object]",ree="[object RegExp]",nee="[object Set]",iee="[object String]",see="[object URL]",aee=Array.isArray,LD=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView==
2721
+ "function"?ArrayBuffer.isView:null,MD=Object.assign,oee=Object.prototype.toString.call.bind(Object.prototype.toString);function cee(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,i=t.areFunctionsEqual,s=t.areMapsEqual,a=t.areNumbersEqual,o=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,l=t.areRegExpsEqual,u=t.areSetsEqual,d=t.areTypedArraysEqual,f=t.areUrlsEqual,p=t.unknownTagComparators;return function(g,y,m){if(g===y)return!0;if(g==null||y==null)return!1;var h=typeof g;if(h!==
2722
+ typeof y)return!1;if(h!=="object")return h==="number"?a(g,y,m):h==="function"?i(g,y,m):!1;var v=g.constructor;if(v!==y.constructor)return!1;if(v===Object)return o(g,y,m);if(aee(g))return e(g,y,m);if(LD!=null&&LD(g))return d(g,y,m);if(v===Date)return r(g,y,m);if(v===RegExp)return l(g,y,m);if(v===Map)return s(g,y,m);if(v===Set)return u(g,y,m);var b=oee(g);if(b===YQ)return r(g,y,m);if(b===ree)return l(g,y,m);if(b===QQ)return s(g,y,m);if(b===nee)return u(g,y,m);if(b===tee)return typeof g.then!="func\
2723
+ tion"&&typeof y.then!="function"&&o(g,y,m);if(b===see)return f(g,y,m);if(b===XQ)return n(g,y,m);if(b===ZQ)return o(g,y,m);if(b===JQ||b===eee||b===iee)return c(g,y,m);if(p){var _=p[b];if(!_){var R=DQ(g);R&&(_=p[R])}if(_)return _(g,y,m)}return!1}}function lee(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,i={areArraysEqual:n?op:qQ,areDatesEqual:FQ,areErrorsEqual:HQ,areFunctionsEqual:BQ,areMapsEqual:n?CD(ND,op):ND,areNumbersEqual:zQ,areObjectsEqual:n?op:UQ,arePrimitiveWrappersEqual:VQ,areRegExpsEqual:WQ,
2724
+ areSetsEqual:n?CD(DD,op):DD,areTypedArraysEqual:n?op:GQ,areUrlsEqual:KQ,unknownTagComparators:void 0};if(r&&(i=MD({},i,r(i))),e){var s=wy(i.areArraysEqual),a=wy(i.areMapsEqual),o=wy(i.areObjectsEqual),c=wy(i.areSetsEqual);i=MD({},i,{areArraysEqual:s,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return i}function uee(t){return function(e,r,n,i,s,a,o){return t(e,r,o)}}function dee(t){var e=t.circular,r=t.comparator,n=t.createState,i=t.equals,s=t.strict;if(n)return function(c,l){var u=n(),d=u.cache,
2725
+ f=d===void 0?e?new WeakMap:void 0:d,p=u.meta;return r(c,l,{cache:f,equals:i,meta:p,strict:s})};if(e)return function(c,l){return r(c,l,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var a={cache:void 0,equals:i,meta:void 0,strict:s};return function(c,l){return r(c,l,a)}}var qR=la();la({strict:!0}),la({circular:!0}),la({circular:!0,strict:!0}),la({createInternalComparator:function(){return To}}),la({strict:!0,createInternalComparator:function(){return To}}),la({circular:!0,createInternalComparator:function(){
2726
+ return To}}),la({circular:!0,createInternalComparator:function(){return To},strict:!0});function la(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,n=t.createInternalComparator,i=t.createState,s=t.strict,a=s===void 0?!1:s,o=lee(t),c=cee(o),l=n?n(c):uee(c);return dee({circular:r,comparator:c,createState:i,equals:l,strict:a})}const fee=100,jD=100,ua={top:50,right:40,bottom:40,left:40};function qD(t,e){const r=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:a,y:o,width:c,height:l}=s;
2727
+ return{...i,width:c,height:l,x:a,y:o}}),n=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:r,edges:n}}function pee(t,e){const r=new Map(t.nodes.map(i=>[i.id,i]));if(t.hash===e.hash||mee(t,e))return HD(t.nodes.filter(i=>!i.parent),r,e),qD(t,e);t.hasLayoutDrift=!0;const n=_l.merge(...t.nodes.map(i=>e.nodes[i.id]).filter(i=>!!i));return t.nodes.filter(i=>i.parent==null).reduce((i,s)=>FD(s,i,r,e),{x:n.x,y:n.y+n.height+
2728
+ jD}),t.edges.filter(i=>!e.edges[i.id]).forEach(i=>hee(i,e)),qD(t,e)}function FD(t,e,r,n){let i=n.nodes[t.id];const s=i?.isCompound??!1,a=!i,o=a?e:{x:i.x,y:i.y},c=t.children.map(d=>n.nodes[d]).filter(d=>!!d),l=c.length>0&&_l.merge(...c),u=s&&l?{x:l.x,y:l.y+l.height+jD}:{x:o.x+ua.left,y:o.y+ua.top};return t.children.map(d=>r.get(d)).reduce((d,f)=>FD(f,d,r,n),u),i=t.children.length>0?BD(t,n):n.nodes[t.id]??{isCompound:!1,width:t.width,height:t.height,x:o.x,y:o.y},n.nodes[t.id]=i,a?{x:i.x+i.width+fee,
2729
+ y:i.y}:e}function hee(t,e){const r=e.nodes[t.source],n=e.nodes[t.target],i=zD(_l.center(r)),s=zD(_l.center(n)),a=s.subtract(i),{x:o,y:c}=a.divide(2).add(i),l={...t?.labelBBox??{width:0,height:0},x:o,y:c},u=a.multiply(.7).add(i),d=a.multiply(.3).add(i);e.edges[t.id]={points:[[i.x,i.y],[d.x,d.y],[u.x,u.y],[s.x,s.y]],labelBBox:l,controlPoints:[u]}}function HD(t,e,r){t.filter(n=>n.children.length>0).forEach(n=>{HD(n.children.map(i=>e.get(i)).filter(i=>!!i),e,r),r.nodes[n.id]=BD(n,r)})}function BD(t,e){
2730
+ const r=_l.merge(...t.children.map(n=>e.nodes[n]));return{isCompound:!0,x:r.x-ua.left,y:r.y-ua.top,width:r.width+ua.left+ua.right,height:r.height+ua.top+ua.bottom}}function mee(t,e){const r=n=>n.children.length>0;return qR(t.autoLayout,e.autoLayout)&&t.nodes.every(n=>{const i=e.nodes[n.id];return!!i&&r(n)===i.isCompound})&&t.edges.every(n=>!!e.edges[n.id])}function zD({x:t,y:e}){return new W2(t,e)}function UD(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function FR(t){return typeof t==
2731
+ "object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function VD(t){return FR(t)||UD(t)}function cp(t){return typeof t=="string"||VD(t)}function gee(t){return Array.isArray(t)&&t.every(cp)}function yee(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function WD(t){if(VD(t))return t;const[e,r,n]=t.split(":");return yee(n)?{id:e,port:r,compass:n}:{id:e,port:r}}function vee(t){if(t.length<2&&(cp(t[0])&&cp(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.
2732
+ map(e=>WD(e))}const by=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function wee(t){return Object.assign(Object.seal(Object.assign({},by)),t)}function bee(...t){const[e,...r]=t;return(...n)=>r.reduce((i,s)=>s(i),e(...n))}function Gn(t,...e){return bee(t,...e)}const _ee=t=>(...e)=>r=>t(r,...e),Ree=t=>({[Symbol.iterator]:t}),pi=_ee((t,e)=>Array.from(Ree(function*(){for(const r of t)yield e(r)})));class GD{options;getLocation(){return this.options?.locationFunction?.()??
2733
+ null}constructor(e){this.options=e}createElement(e,r,n=[]){return{location:this.getLocation(),...r,type:e,children:n}}}const wt=GD.prototype.createElement.bind(new GD),kee=/\r?\n/;function hi(t){return e=>e.join(t)}function See(t){return e=>t+e+t}function da(t,e){return r=>t+r+e}function _y(t){return e=>t+e}const KD=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),Ry=t=>t.split(kee),lp=(t,e,r)=>Gn(Ry,pi(_y(t==="space"?" ".repeat(e):`
2734
2734
  `)),hi(r)),$o=t=>{switch(t){case"crlf":return`\r
2735
2735
  `;case"lf":return`
2736
- `}},Ree={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const r=$o(t.endOfLine);return Gn(pi(t.print),hi(r),lp(t.indentStyle,t.indentSize,r),da(`${e.kind.toLocaleLowerCase()} [${r}`,`${r}];`))(e.children)}},kee={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},See={match(t){return t.type==="Comment"},print(t,e){const r=$o(t.endOfLine);switch(e.kind){case"Block":return Gn(Ry,
2737
- pi(_y(" * ")),hi(r),da(`/**${r}`,`${r} */`))(e.value);case"Macro":return Gn(Ry,pi(_y("# ")),hi(r))(e.value);case"Slash":default:return Gn(Ry,pi(_y("// ")),hi(r))(e.value)}}},Eee={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join($o(t.endOfLine))}},Tee={match(t){return t.type==="Edge"},print(t,e){const r=Gn(pi(t.print),hi(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${r};`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,
2738
- n),da(`[${n}`,`${n}];`))(e.children);return`${r} ${i}`}},$ee={match(t){return t.type==="Graph"},print(t,e){t.directed=e.directed;const r=[];if(e.strict&&r.push("strict"),r.push(e.directed?"digraph":"graph"),e.id&&r.push(t.print(e.id)),e.children.length===0)return`${r.join(" ")} {}`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,n),da(`{${n}`,`${n}}`))(e.children);return`${r.join(" ")} ${i}`}},Pee=Gn(JD,_ee('"')),Cee=da("<",">"),Aee={match(t){return t.type==="Literal"},
2739
- print(t,e){switch(e.quoted){case"html":return Cee(e.value);case!0:return Pee(e.value);case!1:default:return JD(e.value)}}},xee={match(t){return t.type==="Node"},print(t,e){const r=t.print(e.id);if(e.children.length===0)return`${r};`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,n),da(`[${n}`,`${n}];`))(e.children);return`${r} ${i}`}},Iee={match(t){return t.type==="NodeRefGroup"},print(t,e){return Gn(pi(t.print),hi(" "),da("{","}"))(e.children)}},Nee={match(t){return t.
2740
- type==="NodeRef"},print(t,e){const r=[t.print(e.id)];return e.port&&r.push(t.print(e.port)),e.compass&&r.push(t.print(e.compass)),r.join(":")}},Dee={match(t){return t.type==="Subgraph"},print(t,e){const r=["subgraph"];if(e.id&&r.push(t.print(e.id)),e.children.length===0)return`${r.join(" ")} {}`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,n),da(`{${n}`,`${n}}`))(e.children);return`${r.join(" ")} ${i}`}},Oee=[Ree,kee,See,Eee,Tee,$ee,Aee,xee,Iee,Nee,Dee];class Lee{options;#e=[
2741
- ...Oee];constructor(e={}){this.options=e}print(e){const r=[...this.#e],{indentSize:n=2,indentStyle:i="space",endOfLine:s="lf"}=this.options,a={directed:!0,indentSize:n,indentStyle:i,endOfLine:s,print(o){for(const c of r)if(c.match(o))return c.print(a,o);throw Error()}};return a.print(e)}}function Mee(t,e){const r=new Lee(e).print(t);if(!r)throw new Error;return r}function ky(t,e){if(typeof e=="string"){const r=e.trim();return/^<.+>$/ms.test(r)?wt("Attribute",{key:wt("Literal",{value:t,quoted:!1},
2742
- []),value:wt("Literal",{value:r.slice(1,r.length-1),quoted:"html"},[])},[]):wt("Attribute",{key:wt("Literal",{value:t,quoted:!1},[]),value:wt("Literal",{value:e,quoted:!0},[])},[])}return wt("Attribute",{key:wt("Literal",{value:t,quoted:!1},[]),value:wt("Literal",{value:String(e),quoted:!1},[])},[])}function Po(t,e){return wt("Comment",{kind:e,value:t},[])}function YD(t,e){return Array.from((function*(){for(const[r,n]of e.values)yield ky(r,n);for(const r of Object.values(e.attributes))r.size>0&&
2743
- (r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r));for(const r of e.nodes)r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r);for(const r of e.subgraphs)r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r);for(const r of e.edges)r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r)})())}const jee={match(t){return t.$$type==="AttributeList"},convert(t,e){return wt("AttributeList",{kind:e.$$kind},e.values.map(([r,n])=>ky(r,n)))}},qee={match(t){
2744
- return t.$$type==="Edge"},convert(t,e){return wt("Edge",{targets:e.targets.map(r=>HR(r)?wt("NodeRef",{id:wt("Literal",{value:r.id,quoted:!0},[])},[]):WD(r)?wt("NodeRef",{id:wt("Literal",{value:r.id,quoted:!0},[]),port:r.port?wt("Literal",{value:r.port,quoted:!0},[]):void 0,compass:r.compass?wt("Literal",{value:r.compass,quoted:!0},[]):void 0},[]):wt("NodeRefGroup",{},r.map(n=>HR(n)?wt("NodeRef",{id:wt("Literal",{value:n.id,quoted:!0},[])},[]):wt("NodeRef",{id:wt("Literal",{value:n.id,quoted:!0},
2745
- []),port:n.port?wt("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?wt("Literal",{value:n.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[Po(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([r,n])=>ky(r,n))])}},Fee={match(t){return t.$$type==="Graph"},convert(t,e){return wt("Dot",{},[...e.comment?[Po(e.comment,t.commentKind)]:[],wt("Graph",{directed:e.directed,strict:e.strict,id:e.id?wt("Literal",{value:e.id,quoted:!0},[]):void 0},YD(t,e))])}},Hee={
2746
- match(t){return t.$$type==="Node"},convert(t,e){return wt("Node",{id:wt("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[Po(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([r,n])=>ky(r,n))])}},Bee={match(t){return t.$$type==="Subgraph"},convert(t,e){return wt("Subgraph",{id:e.id?wt("Literal",{value:e.id,quoted:!0},[]):void 0},YD(t,e))}},zee=[jee,qee,Hee,Fee,Bee];class Uee{options;#e=[...zee];constructor(e={}){this.options=e}convert(e){const r=[...this.#e],{commentKind:n="\
2747
- Slash"}=this.options,i={commentKind:n,convert(s){for(const a of r)if(a.match(s))return a.convert(i,s);throw Error()}};return i.convert(e)}}function Vee(t,e){return new Uee(e).convert(t)}const ee=new Proxy(Object.freeze({}),{get:(t,e)=>e});class BR{}class zR extends BR{#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,r){r!=null&&this.#e.set(e,r)}delete(e){this.#e.delete(e)}apply(e){
2748
- const r=Array.isArray(e)?e:Object.entries(e);for(const[n,i]of r)this.set(n,i)}clear(){this.#e.clear()}}class UR extends zR{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,r){super(r),this.$$kind=e}}class XD extends zR{#e=by;id;comment;attributes=Object.freeze({graph:new UR("Graph"),edge:new UR("Edge"),node:new UR("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.
2749
- values())}#t={nodes:new Map,edges:new Set,subgraphs:new Set};with(e){this.#e=gee(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 r=new this.#e.Subgraph(...e);return r.with(this.#e),this.addSubgraph(r),r}removeNode(e){this.#t.nodes.delete(typeof e=="string"?e:e.id)}removeEdge(e){
2750
- this.#t.edges.delete(e)}removeSubgraph(e){this.#t.subgraphs.delete(e)}createNode(e,r){const n=new this.#e.Node(e,r);return this.addNode(n),n}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(r=>r.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,r){const n=e.map(s=>pee(s)?mee(s):KD(s)),i=new this.#e.Edge(n,r);return this.addEdge(i),i}subgraph(...e){const r=e.find(a=>typeof a=="string"),n=e.find(a=>typeof a=="object"&&a!==null),i=e.find(a=>typeof a=="function"),s=r?this.
2736
+ `}},Eee={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const r=$o(t.endOfLine);return Gn(pi(t.print),hi(r),lp(t.indentStyle,t.indentSize,r),da(`${e.kind.toLocaleLowerCase()} [${r}`,`${r}];`))(e.children)}},Tee={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},$ee={match(t){return t.type==="Comment"},print(t,e){const r=$o(t.endOfLine);switch(e.kind){case"Block":return Gn(Ry,
2737
+ pi(_y(" * ")),hi(r),da(`/**${r}`,`${r} */`))(e.value);case"Macro":return Gn(Ry,pi(_y("# ")),hi(r))(e.value);case"Slash":default:return Gn(Ry,pi(_y("// ")),hi(r))(e.value)}}},Pee={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join($o(t.endOfLine))}},Cee={match(t){return t.type==="Edge"},print(t,e){const r=Gn(pi(t.print),hi(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${r};`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,
2738
+ n),da(`[${n}`,`${n}];`))(e.children);return`${r} ${i}`}},Aee={match(t){return t.type==="Graph"},print(t,e){t.directed=e.directed;const r=[];if(e.strict&&r.push("strict"),r.push(e.directed?"digraph":"graph"),e.id&&r.push(t.print(e.id)),e.children.length===0)return`${r.join(" ")} {}`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,n),da(`{${n}`,`${n}}`))(e.children);return`${r.join(" ")} ${i}`}},xee=Gn(KD,See('"')),Iee=da("<",">"),Nee={match(t){return t.type==="Literal"},
2739
+ print(t,e){switch(e.quoted){case"html":return Iee(e.value);case!0:return xee(e.value);case!1:default:return KD(e.value)}}},Dee={match(t){return t.type==="Node"},print(t,e){const r=t.print(e.id);if(e.children.length===0)return`${r};`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,n),da(`[${n}`,`${n}];`))(e.children);return`${r} ${i}`}},Oee={match(t){return t.type==="NodeRefGroup"},print(t,e){return Gn(pi(t.print),hi(" "),da("{","}"))(e.children)}},Lee={match(t){return t.
2740
+ type==="NodeRef"},print(t,e){const r=[t.print(e.id)];return e.port&&r.push(t.print(e.port)),e.compass&&r.push(t.print(e.compass)),r.join(":")}},Mee={match(t){return t.type==="Subgraph"},print(t,e){const r=["subgraph"];if(e.id&&r.push(t.print(e.id)),e.children.length===0)return`${r.join(" ")} {}`;const n=$o(t.endOfLine),i=Gn(pi(t.print),hi(n),lp(t.indentStyle,t.indentSize,n),da(`{${n}`,`${n}}`))(e.children);return`${r.join(" ")} ${i}`}},jee=[Eee,Tee,$ee,Pee,Cee,Aee,Nee,Dee,Oee,Lee,Mee];class qee{options;#e=[
2741
+ ...jee];constructor(e={}){this.options=e}print(e){const r=[...this.#e],{indentSize:n=2,indentStyle:i="space",endOfLine:s="lf"}=this.options,a={directed:!0,indentSize:n,indentStyle:i,endOfLine:s,print(o){for(const c of r)if(c.match(o))return c.print(a,o);throw Error()}};return a.print(e)}}function Fee(t,e){const r=new qee(e).print(t);if(!r)throw new Error;return r}function ky(t,e){if(typeof e=="string"){const r=e.trim();return/^<.+>$/ms.test(r)?wt("Attribute",{key:wt("Literal",{value:t,quoted:!1},
2742
+ []),value:wt("Literal",{value:r.slice(1,r.length-1),quoted:"html"},[])},[]):wt("Attribute",{key:wt("Literal",{value:t,quoted:!1},[]),value:wt("Literal",{value:e,quoted:!0},[])},[])}return wt("Attribute",{key:wt("Literal",{value:t,quoted:!1},[]),value:wt("Literal",{value:String(e),quoted:!1},[])},[])}function Po(t,e){return wt("Comment",{kind:e,value:t},[])}function ZD(t,e){return Array.from((function*(){for(const[r,n]of e.values)yield ky(r,n);for(const r of Object.values(e.attributes))r.size>0&&
2743
+ (r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r));for(const r of e.nodes)r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r);for(const r of e.subgraphs)r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r);for(const r of e.edges)r.comment&&(yield Po(r.comment,t.commentKind)),yield t.convert(r)})())}const Hee={match(t){return t.$$type==="AttributeList"},convert(t,e){return wt("AttributeList",{kind:e.$$kind},e.values.map(([r,n])=>ky(r,n)))}},Bee={match(t){
2744
+ return t.$$type==="Edge"},convert(t,e){return wt("Edge",{targets:e.targets.map(r=>FR(r)?wt("NodeRef",{id:wt("Literal",{value:r.id,quoted:!0},[])},[]):UD(r)?wt("NodeRef",{id:wt("Literal",{value:r.id,quoted:!0},[]),port:r.port?wt("Literal",{value:r.port,quoted:!0},[]):void 0,compass:r.compass?wt("Literal",{value:r.compass,quoted:!0},[]):void 0},[]):wt("NodeRefGroup",{},r.map(n=>FR(n)?wt("NodeRef",{id:wt("Literal",{value:n.id,quoted:!0},[])},[]):wt("NodeRef",{id:wt("Literal",{value:n.id,quoted:!0},
2745
+ []),port:n.port?wt("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?wt("Literal",{value:n.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[Po(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([r,n])=>ky(r,n))])}},zee={match(t){return t.$$type==="Graph"},convert(t,e){return wt("Dot",{},[...e.comment?[Po(e.comment,t.commentKind)]:[],wt("Graph",{directed:e.directed,strict:e.strict,id:e.id?wt("Literal",{value:e.id,quoted:!0},[]):void 0},ZD(t,e))])}},Uee={
2746
+ match(t){return t.$$type==="Node"},convert(t,e){return wt("Node",{id:wt("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[Po(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([r,n])=>ky(r,n))])}},Vee={match(t){return t.$$type==="Subgraph"},convert(t,e){return wt("Subgraph",{id:e.id?wt("Literal",{value:e.id,quoted:!0},[]):void 0},ZD(t,e))}},Wee=[Hee,Bee,Uee,zee,Vee];class Gee{options;#e=[...Wee];constructor(e={}){this.options=e}convert(e){const r=[...this.#e],{commentKind:n="\
2747
+ Slash"}=this.options,i={commentKind:n,convert(s){for(const a of r)if(a.match(s))return a.convert(i,s);throw Error()}};return i.convert(e)}}function Kee(t,e){return new Gee(e).convert(t)}const ee=new Proxy(Object.freeze({}),{get:(t,e)=>e});class HR{}class BR extends HR{#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,r){r!=null&&this.#e.set(e,r)}delete(e){this.#e.delete(e)}apply(e){
2748
+ const r=Array.isArray(e)?e:Object.entries(e);for(const[n,i]of r)this.set(n,i)}clear(){this.#e.clear()}}class zR extends BR{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,r){super(r),this.$$kind=e}}class JD extends BR{#e=by;id;comment;attributes=Object.freeze({graph:new zR("Graph"),edge:new zR("Edge"),node:new zR("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.
2749
+ values())}#t={nodes:new Map,edges:new Set,subgraphs:new Set};with(e){this.#e=wee(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 r=new this.#e.Subgraph(...e);return r.with(this.#e),this.addSubgraph(r),r}removeNode(e){this.#t.nodes.delete(typeof e=="string"?e:e.id)}removeEdge(e){
2750
+ this.#t.edges.delete(e)}removeSubgraph(e){this.#t.subgraphs.delete(e)}createNode(e,r){const n=new this.#e.Node(e,r);return this.addNode(n),n}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(r=>r.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,r){const n=e.map(s=>gee(s)?vee(s):WD(s)),i=new this.#e.Edge(n,r);return this.addEdge(i),i}subgraph(...e){const r=e.find(a=>typeof a=="string"),n=e.find(a=>typeof a=="object"&&a!==null),i=e.find(a=>typeof a=="function"),s=r?this.
2751
2751
  getSubgraph(r)??this.createSubgraph(r):this.createSubgraph();return n!==void 0&&s.apply(n),i!==void 0&&i(s),s}node(e,...r){if(typeof e=="string"){const n=e,i=r.find(o=>typeof o=="object"&&o!==null),s=r.find(o=>typeof o=="function"),a=this.getNode(n)??this.createNode(n);return i!==void 0&&a.attributes.apply(i),s!==void 0&&s(a),a}typeof e=="object"&&e!==null&&this.attributes.node.apply(e)}edge(e,...r){if(Array.isArray(e)){const n=e,i=r.find(o=>typeof o=="object"),s=r.find(o=>typeof o=="function"),
2752
- a=this.createEdge(n,i);return s!==void 0&&s(a),a}typeof e=="object"&&e!==null&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}}class QD extends XD{get $$type(){return"Graph"}id;strict;constructor(...e){super(),this.id=e.find(n=>typeof n=="string"),this.strict=e.find(n=>typeof n=="boolean")??!1;const r=e.find(n=>typeof n=="object"&&n!==null);r!==void 0&&this.apply(r)}}class Wee extends QD{get directed(){return!0}}class Gee extends QD{get directed(){return!1}}class Kee extends XD{get $$type(){
2753
- return"Subgraph"}id;constructor(...e){super(),this.id=e.find(n=>typeof n=="string");const r=e.find(n=>typeof n=="object"&&n!==null);r!==void 0&&this.apply(r)}isSubgraphCluster(){return typeof this.id=="string"?this.id.startsWith("cluster"):!1}}class eO extends zR{comment}let Zee=class extends BR{id;get $$type(){return"Node"}comment;attributes;constructor(e,r){super(),this.id=e,this.attributes=new eO(r)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class Jee extends BR{targets;get $$type(){
2754
- return"Edge"}comment;attributes;constructor(e,r){if(super(),this.targets=e,e.length<2&&(cp(e[0])&&cp(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new eO(r)}}Object.assign(by,{Graph:Gee,Digraph:Wee,Subgraph:Kee,Node:Zee,Edge:Jee});function tO(t,e){return(...r)=>{const n=t?this.Digraph:this.Graph,i=r.find(c=>typeof c=="string"),s=r.find(c=>typeof c=="object"),a=r.find(c=>typeof c=="function"),o=new n(i,e,s);return o.with(this),typeof a==
2755
- "function"&&a(o),o}}function rO(t,e=by){return Object.freeze({digraph:tO.call(e,!0,t),graph:tO.call(e,!1,t)})}const nO=rO(!1),Yee=nO.digraph;nO.graph,rO(!0);function Xee(t,e){const r=Vee(t,e?.convert);return Mee(r,e?.print)}var VR,iO;function Qee(){if(iO)return VR;iO=1;function t(n){let i=n.length-1,s=n[i];for(;s===" "||s===" ";)s=n[--i];return n.substring(0,i+1)}function e(n){return n.split(`
2752
+ a=this.createEdge(n,i);return s!==void 0&&s(a),a}typeof e=="object"&&e!==null&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}}class YD extends JD{get $$type(){return"Graph"}id;strict;constructor(...e){super(),this.id=e.find(n=>typeof n=="string"),this.strict=e.find(n=>typeof n=="boolean")??!1;const r=e.find(n=>typeof n=="object"&&n!==null);r!==void 0&&this.apply(r)}}class Zee extends YD{get directed(){return!0}}class Jee extends YD{get directed(){return!1}}class Yee extends JD{get $$type(){
2753
+ return"Subgraph"}id;constructor(...e){super(),this.id=e.find(n=>typeof n=="string");const r=e.find(n=>typeof n=="object"&&n!==null);r!==void 0&&this.apply(r)}isSubgraphCluster(){return typeof this.id=="string"?this.id.startsWith("cluster"):!1}}class XD extends BR{comment}let Xee=class extends HR{id;get $$type(){return"Node"}comment;attributes;constructor(e,r){super(),this.id=e,this.attributes=new XD(r)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class Qee extends HR{targets;get $$type(){
2754
+ return"Edge"}comment;attributes;constructor(e,r){if(super(),this.targets=e,e.length<2&&(cp(e[0])&&cp(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new XD(r)}}Object.assign(by,{Graph:Jee,Digraph:Zee,Subgraph:Yee,Node:Xee,Edge:Qee});function QD(t,e){return(...r)=>{const n=t?this.Digraph:this.Graph,i=r.find(c=>typeof c=="string"),s=r.find(c=>typeof c=="object"),a=r.find(c=>typeof c=="function"),o=new n(i,e,s);return o.with(this),typeof a==
2755
+ "function"&&a(o),o}}function eO(t,e=by){return Object.freeze({digraph:QD.call(e,!0,t),graph:QD.call(e,!1,t)})}const tO=eO(!1),ete=tO.digraph;tO.graph,eO(!0);function tte(t,e){const r=Kee(t,e?.convert);return Fee(r,e?.print)}var UR,rO;function rte(){if(rO)return UR;rO=1;function t(n){let i=n.length-1,s=n[i];for(;s===" "||s===" ";)s=n[--i];return n.substring(0,i+1)}function e(n){return n.split(`
2756
2756
  `).map(a=>t(a)).join(`
2757
- `)}VR=function(n,i){if(i=i||{},n==null)return n;var s=i.width||50,a=typeof i.indent=="string"?i.indent:" ",o=i.newline||`
2757
+ `)}UR=function(n,i){if(i=i||{},n==null)return n;var s=i.width||50,a=typeof i.indent=="string"?i.indent:" ",o=i.newline||`
2758
2758
  `+a,c=typeof i.escape=="function"?i.escape:r,l=".{1,"+s+"}";i.cut!==!0&&(l+="([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)");var u=new RegExp(l,"g"),d=n.match(u)||[],f=a+d.map(function(p){return p.slice(-1)===`
2759
- `&&(p=p.slice(0,p.length-1)),c(p)}).join(o);return i.trim===!0&&(f=e(f)),f};function r(n){return n}return VR}var ete=Qee();const tte=Ks(ete),Sy={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,r)=>(r<0&&(r+=1),r>1&&(r-=
2759
+ `&&(p=p.slice(0,p.length-1)),c(p)}).join(o);return i.trim===!0&&(f=e(f)),f};function r(n){return n}return UR}var nte=rte();const ite=Ks(nte),Sy={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,r)=>(r<0&&(r+=1),r>1&&(r-=
2760
2760
  1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t),hsl2rgb:({h:t,s:e,l:r},n)=>{if(!e)return r*2.55;t/=360,e/=100,r/=100;const i=r<.5?r*(1+e):r+e-r*e,s=2*r-i;switch(n){case"r":return Sy.hue2rgb(s,i,t+1/3)*255;case"g":return Sy.hue2rgb(s,i,t)*255;case"b":return Sy.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:r},n)=>{t/=255,e/=255,r/=255;const i=Math.max(t,e,r),s=Math.min(t,e,r),a=(i+s)/2;if(n==="l")return a*100;if(i===s)return 0;const o=i-s,c=a>.5?o/(2-i-s):o/(i+s);if(n==="s")return c*100;switch(i){case t:
2761
- return((e-r)/o+(e<r?6:0))*60;case e:return((r-t)/o+2)*60;case r:return((t-e)/o+4)*60;default:return-1}}},rte={clamp:(t,e,r)=>e>r?Math.min(e,Math.max(r,t)):Math.min(r,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},nte={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Ze={channel:Sy,lang:rte,unit:nte},fa={};for(let t=0;t<=255;t++)fa[t]=Ze.unit.dec2hex(t);const Lr={ALL:0,RGB:1,HSL:2};class ite{constructor(){this.type=Lr.ALL}get(){return this.type}set(e){if(this.type&&this.
2762
- type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=Lr.ALL}is(e){return this.type===e}}class ste{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new ite}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=Lr.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Ze.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Ze.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Ze.channel.rgb2hsl(e,"l"))}_ensureRGB(){
2761
+ return((e-r)/o+(e<r?6:0))*60;case e:return((r-t)/o+2)*60;case r:return((t-e)/o+4)*60;default:return-1}}},ste={clamp:(t,e,r)=>e>r?Math.min(e,Math.max(r,t)):Math.min(r,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},ate={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Ze={channel:Sy,lang:ste,unit:ate},fa={};for(let t=0;t<=255;t++)fa[t]=Ze.unit.dec2hex(t);const Lr={ALL:0,RGB:1,HSL:2};class ote{constructor(){this.type=Lr.ALL}get(){return this.type}set(e){if(this.type&&this.
2762
+ type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=Lr.ALL}is(e){return this.type===e}}class cte{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new ote}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=Lr.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Ze.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Ze.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Ze.channel.rgb2hsl(e,"l"))}_ensureRGB(){
2763
2763
  const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Ze.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Ze.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Ze.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(Lr.HSL)&&r!==void 0?r:(this._ensureHSL(),Ze.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(Lr.HSL)&&r!==void 0?r:(this._ensureHSL(),Ze.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(Lr.HSL)&&r!==void 0?r:(this._ensureHSL(),Ze.
2764
2764
  channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(Lr.RGB)&&r!==void 0?r:(this._ensureRGB(),Ze.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(Lr.RGB)&&r!==void 0?r:(this._ensureRGB(),Ze.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(Lr.RGB)&&r!==void 0?r:(this._ensureRGB(),Ze.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Lr.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Lr.RGB),
2765
- this.changed=!0,this.data.g=e}set b(e){this.type.set(Lr.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Lr.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Lr.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Lr.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const WR=new ste({r:0,g:0,b:0,a:0},"transparent"),cl={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(cl.re);if(!e)return;const r=e[1],
2766
- n=parseInt(r,16),i=r.length,s=i%4===0,a=i>4,o=a?1:17,c=a?8:4,l=s?0:-1,u=a?255:15;return WR.set({r:(n>>c*(l+3)&u)*o,g:(n>>c*(l+2)&u)*o,b:(n>>c*(l+1)&u)*o,a:s?(n&u)*o/255:1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`#${fa[Math.round(e)]}${fa[Math.round(r)]}${fa[Math.round(n)]}${fa[Math.round(i*255)]}`:`#${fa[Math.round(e)]}${fa[Math.round(r)]}${fa[Math.round(n)]}`}},Co={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,
2767
- hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(Co.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Ze.channel.clamp.h(parseFloat(r)*.9);case"rad":return Ze.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Ze.channel.clamp.h(parseFloat(r)*360)}}return Ze.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(Co.re);if(!r)return;const[,n,i,s,a,o]=r;return WR.set({h:Co._hue2deg(n),s:Ze.channel.clamp.s(parseFloat(
2765
+ this.changed=!0,this.data.g=e}set b(e){this.type.set(Lr.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Lr.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Lr.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Lr.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const VR=new cte({r:0,g:0,b:0,a:0},"transparent"),cl={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(cl.re);if(!e)return;const r=e[1],
2766
+ n=parseInt(r,16),i=r.length,s=i%4===0,a=i>4,o=a?1:17,c=a?8:4,l=s?0:-1,u=a?255:15;return VR.set({r:(n>>c*(l+3)&u)*o,g:(n>>c*(l+2)&u)*o,b:(n>>c*(l+1)&u)*o,a:s?(n&u)*o/255:1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`#${fa[Math.round(e)]}${fa[Math.round(r)]}${fa[Math.round(n)]}${fa[Math.round(i*255)]}`:`#${fa[Math.round(e)]}${fa[Math.round(r)]}${fa[Math.round(n)]}`}},Co={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,
2767
+ hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(Co.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Ze.channel.clamp.h(parseFloat(r)*.9);case"rad":return Ze.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Ze.channel.clamp.h(parseFloat(r)*360)}}return Ze.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(Co.re);if(!r)return;const[,n,i,s,a,o]=r;return VR.set({h:Co._hue2deg(n),s:Ze.channel.clamp.s(parseFloat(
2768
2768
  i)),l:Ze.channel.clamp.l(parseFloat(s)),a:a?Ze.channel.clamp.a(o?parseFloat(a)/100:parseFloat(a)):1},t)},stringify:t=>{const{h:e,s:r,l:n,a:i}=t;return i<1?`hsla(${Ze.lang.round(e)}, ${Ze.lang.round(r)}%, ${Ze.lang.round(n)}%, ${i})`:`hsl(${Ze.lang.round(e)}, ${Ze.lang.round(r)}%, ${Ze.lang.round(n)}%)`}},up={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",
2769
2769
  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:"#8f\
2770
2770
  bc8f",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:"#cd5c\
@@ -2772,91 +2772,91 @@ bc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",da
2772
2772
  #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:"\
2773
2773
  #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:"\
2774
2774
  #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=up.colors[t];if(e)return cl.parse(e)},stringify:t=>{const e=cl.stringify(t);for(const r in up.colors)if(up.colors[r]===e)return r}},dp={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,
2775
- parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const r=t.match(dp.re);if(!r)return;const[,n,i,s,a,o,c,l,u]=r;return WR.set({r:Ze.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Ze.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:Ze.channel.clamp.b(c?parseFloat(o)*2.55:parseFloat(o)),a:l?Ze.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${Ze.lang.round(e)}, ${Ze.lang.round(r)}, ${Ze.lang.round(n)}, ${Ze.lang.
2775
+ parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const r=t.match(dp.re);if(!r)return;const[,n,i,s,a,o,c,l,u]=r;return VR.set({r:Ze.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Ze.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:Ze.channel.clamp.b(c?parseFloat(o)*2.55:parseFloat(o)),a:l?Ze.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${Ze.lang.round(e)}, ${Ze.lang.round(r)}, ${Ze.lang.round(n)}, ${Ze.lang.
2776
2776
  round(i)})`:`rgb(${Ze.lang.round(e)}, ${Ze.lang.round(r)}, ${Ze.lang.round(n)})`}},pa={format:{keyword:up,hex:cl,rgb:dp,rgba:dp,hsl:Co,hsla:Co},parse:t=>{if(typeof t!="string")return t;const e=cl.parse(t)||dp.parse(t)||Co.parse(t)||up.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Lr.HSL)||t.data.r===void 0?Co.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?dp.stringify(t):cl.
2777
- stringify(t)},ate=(t,e)=>{const r=pa.parse(t);for(const n in e)r[n]=Ze.channel.clamp[n](e[n]);return pa.stringify(r)},sO=t=>pa.format.hex.stringify(pa.parse(t)),ote=(t,e,r)=>{const n=pa.parse(t),i=n[e],s=Ze.channel.clamp[e](i+r);return i!==s&&(n[e]=s),pa.stringify(n)},cte=(t,e)=>ote(t,"a",-.3),lte=(t,e)=>{const r=pa.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return ate(t,n)},ute=(t,e)=>{const r=pa.parse(t),n={},i=(s,a,o)=>a>0?(o-s)*a/100:s*a/100;for(const s in e)n[s]=i(r[s],e[s],Ze.channel.
2778
- max[s]);return lte(t,n)};function $n(t){return t.children.length>0}function Mr(t){switch(t){case"open":return"vee";default:return t}}function Hi(t){return Array.isArray(t)?[Hi(t[0]),Hi(t[1])]:(fr(isFinite(t),`Invalid not finite point value ${t}`),Math.round(t))}const aO=t=>(fr(isFinite(t),`Invalid not finite inch value ${t}`),Math.floor(t*72)),Zt=t=>Math.ceil(t/72*1e3)/1e3,Es=t=>Math.ceil(t);Es(40).toString();function oO(t,e){return sO(ute(t,{l:-35-5*e,s:-15-5*e}))}function dte(t){return sO(cte(
2779
- t))}function fte(t){return t.trim().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function cO(t,{maxchars:e,maxLines:r,sanitize:n=uU()}){let i=tte(t,{width:e,indent:"",escape:n}).split(`
2780
- `);return Pr(r)&&r>0&&i.length>r&&(i=i.slice(0,r)),i}function Ao({text:t,maxchars:e,fontsize:r,maxLines:n,bold:i,color:s}){let a=cO(t,{maxchars:e,maxLines:n,sanitize:fte}).join("<BR/>");i&&(a=`<B>${a}</B>`);const o=s?` COLOR="${s}"`:"";return`<FONT POINT-SIZE="${Es(r)}"${o}>${a}</FONT>`}function pte(t){switch(t){case"xs":case"sm":return 30;case"md":return 40;case"lg":case"xl":return 55;default:js(t)}}function hte(t,e){const{sizes:{size:r},values:n}=e.nodeSizes(t.style),i=e.colors(t.color).elements,
2781
- s=["sm","xs"].includes(r),a=be(t.icon),o=[Ao({text:t.title,fontsize:n.textSize,maxchars:pte(r),maxLines:s?1:3})];if(r!=="xs"){be(t.technology?.trim())&&o.push(Ao({text:t.technology,fontsize:Math.ceil(n.textSize*.65),maxchars:a?35:45,maxLines:1,color:i.loContrast}));const l=n2.from(t.description).text;l&&o.push(Ao({text:l,fontsize:Math.ceil(n.textSize*.75),maxchars:a?35:45,maxLines:s?3:5,color:i.loContrast}))}if(o.length===1&&a===!1)return`<${o[0]}>`;const c=a?(l,u,d)=>{let f=`<TD ALIGN="TEXT" BA\
2782
- LIGN="LEFT">${l}</TD>`;if(u===0){const p=d.length>1?` ROWSPAN="${d.length}"`:"";let w=76;["xs","sm"].includes(r)&&(w=16),(t.shape==="queue"||t.shape==="mobile")&&(w+=20),f=`<TD${p} WIDTH="${w}"> </TD>${f}`,f=`${f}<TD${p} WIDTH="16"> </TD>`}return`<TR>${f}</TR>`}:l=>`<TR><TD>${l}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4">${o.map(c).join("")}</TABLE>>`}function mte(t,e){const r=Ao({text:t.title.toUpperCase(),maxchars:50,fontsize:11,maxLines:1,bold:!0,color:e});return r.includes(
2783
- "<BR/>")?`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="TEXT" BALIGN="LEFT">${r}</TD></TR></TABLE>>`:`<${r}>`}const Ey=40,lO=5,GR=`BGCOLOR="${r2.DEFAULT.relationshipColors.labelBg}A0"`;function uO({label:t,technology:e}){const r=[];if(be(t?.trim())&&r.push(Ao({text:t,maxchars:Ey,fontsize:14,maxLines:lO,bold:t==="[...]"})),be(e?.trim())&&r.push(Ao({text:`[ ${e} ]`,fontsize:12,maxLines:1,maxchars:Ey})),r.length===0)return null;const n=r.map(i=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT\
2784
- ">${i}</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${GR}>${n}</TABLE>>`}function gte(t,e){const r=`<TABLE BORDER="0" CELLPADDING="6" ${GR}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${Es(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return be(e?.trim())?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${r}</TD>`,`<TD ${GR} CELLPADDING="3">`,Ao({text:e,maxchars:Ey,fontsize:14,maxLines:5}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${r}>`}
2785
- const KR="dashed",ZR="Arial",dO=BC("dot"),JR=50.1;class YR{constructor(e,r){this.view=e,this.styles=r,this.compoundIds=new Set(e.nodes.filter($n).map(i=>i.id)),this.edgesWithCompounds=new Set(this.compoundIds.size>0?e.edges.filter(i=>this.compoundIds.has(i.source)||this.compoundIds.has(i.target)).map(i=>i.id):[]);for(const i of e.nodes)this.graphology.addNode(i.id,{origin:i,level:i.level,depth:i.depth??0,modelRef:i.modelRef??null,deploymentRef:i.deploymentRef??null,maxConnectedHierarchyDistance:0});
2786
- for(const i of e.edges){let s=this.graphology.getNodeAttribute(i.source,"deploymentRef"),a=this.graphology.getNodeAttribute(i.target,"deploymentRef");(s===null||a===null)&&(s=this.graphology.getNodeAttribute(i.source,"modelRef"),a=this.graphology.getNodeAttribute(i.target,"modelRef"));let o=-1;s!==null&&a!==null?o=$2(s,a):dO.warn(`Edge ${i.id} of view ${e.id} is invalid, sourceFqn: ${s}, targetFqn: ${a}`),this.graphology.addEdgeWithKey(i.id,i.source,i.target,{origin:i,hierarchyDistance:o,weight:1}),
2777
+ stringify(t)},lte=(t,e)=>{const r=pa.parse(t);for(const n in e)r[n]=Ze.channel.clamp[n](e[n]);return pa.stringify(r)},nO=t=>pa.format.hex.stringify(pa.parse(t)),ute=(t,e,r)=>{const n=pa.parse(t),i=n[e],s=Ze.channel.clamp[e](i+r);return i!==s&&(n[e]=s),pa.stringify(n)},dte=(t,e)=>ute(t,"a",-.3),fte=(t,e)=>{const r=pa.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return lte(t,n)},pte=(t,e)=>{const r=pa.parse(t),n={},i=(s,a,o)=>a>0?(o-s)*a/100:s*a/100;for(const s in e)n[s]=i(r[s],e[s],Ze.channel.
2778
+ max[s]);return fte(t,n)};function $n(t){return t.children.length>0}function Mr(t){switch(t){case"open":return"vee";default:return t}}function Hi(t){return Array.isArray(t)?[Hi(t[0]),Hi(t[1])]:(yr(isFinite(t),`Invalid not finite point value ${t}`),Math.round(t))}const iO=t=>(yr(isFinite(t),`Invalid not finite inch value ${t}`),Math.floor(t*72)),Zt=t=>Math.ceil(t/72*1e3)/1e3,Es=t=>Math.ceil(t);Es(40).toString();function sO(t,e){return nO(pte(t,{l:-35-5*e,s:-15-5*e}))}function hte(t){return nO(dte(
2779
+ t))}function mte(t){return t.trim().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function aO(t,{maxchars:e,maxLines:r,sanitize:n=uU()}){let i=ite(t,{width:e,indent:"",escape:n}).split(`
2780
+ `);return Pr(r)&&r>0&&i.length>r&&(i=i.slice(0,r)),i}function Ao({text:t,maxchars:e,fontsize:r,maxLines:n,bold:i,color:s}){let a=aO(t,{maxchars:e,maxLines:n,sanitize:mte}).join("<BR/>");i&&(a=`<B>${a}</B>`);const o=s?` COLOR="${s}"`:"";return`<FONT POINT-SIZE="${Es(r)}"${o}>${a}</FONT>`}function gte(t){switch(t){case"xs":case"sm":return 30;case"md":return 40;case"lg":case"xl":return 55;default:js(t)}}function yte(t,e){const{sizes:{size:r},values:n}=e.nodeSizes(t.style),i=e.colors(t.color).elements,
2781
+ s=["sm","xs"].includes(r),a=be(t.icon),o=[Ao({text:t.title,fontsize:n.textSize,maxchars:gte(r),maxLines:s?1:3})];if(r!=="xs"){be(t.technology?.trim())&&o.push(Ao({text:t.technology,fontsize:Math.ceil(n.textSize*.65),maxchars:a?35:45,maxLines:1,color:i.loContrast}));const l=n2.from(t.description).text;l&&o.push(Ao({text:l,fontsize:Math.ceil(n.textSize*.75),maxchars:a?35:45,maxLines:s?3:5,color:i.loContrast}))}if(o.length===1&&a===!1)return`<${o[0]}>`;const c=a?(l,u,d)=>{let f=`<TD ALIGN="TEXT" BA\
2782
+ LIGN="LEFT">${l}</TD>`;if(u===0){const p=d.length>1?` ROWSPAN="${d.length}"`:"";let w=76;["xs","sm"].includes(r)&&(w=16),(t.shape==="queue"||t.shape==="mobile")&&(w+=20),f=`<TD${p} WIDTH="${w}"> </TD>${f}`,f=`${f}<TD${p} WIDTH="16"> </TD>`}return`<TR>${f}</TR>`}:l=>`<TR><TD>${l}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4">${o.map(c).join("")}</TABLE>>`}function vte(t,e){const r=Ao({text:t.title.toUpperCase(),maxchars:50,fontsize:11,maxLines:1,bold:!0,color:e});return r.includes(
2783
+ "<BR/>")?`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="TEXT" BALIGN="LEFT">${r}</TD></TR></TABLE>>`:`<${r}>`}const Ey=40,oO=5,WR=`BGCOLOR="${r2.DEFAULT.relationshipColors.labelBg}A0"`;function cO({label:t,technology:e}){const r=[];if(be(t?.trim())&&r.push(Ao({text:t,maxchars:Ey,fontsize:14,maxLines:oO,bold:t==="[...]"})),be(e?.trim())&&r.push(Ao({text:`[ ${e} ]`,fontsize:12,maxLines:1,maxchars:Ey})),r.length===0)return null;const n=r.map(i=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT\
2784
+ ">${i}</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${WR}>${n}</TABLE>>`}function wte(t,e){const r=`<TABLE BORDER="0" CELLPADDING="6" ${WR}><TR><TD WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${Es(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return be(e?.trim())?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${r}</TD>`,`<TD ${WR} CELLPADDING="3">`,Ao({text:e,maxchars:Ey,fontsize:14,maxLines:5}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${r}>`}
2785
+ const GR="dashed",KR="Arial",lO=BC("dot"),ZR=50.1;class JR{constructor(e,r){this.view=e,this.styles=r,this.compoundIds=new Set(e.nodes.filter($n).map(i=>i.id)),this.edgesWithCompounds=new Set(this.compoundIds.size>0?e.edges.filter(i=>this.compoundIds.has(i.source)||this.compoundIds.has(i.target)).map(i=>i.id):[]);for(const i of e.nodes)this.graphology.addNode(i.id,{origin:i,level:i.level,depth:i.depth??0,modelRef:i.modelRef??null,deploymentRef:i.deploymentRef??null,maxConnectedHierarchyDistance:0});
2786
+ for(const i of e.edges){let s=this.graphology.getNodeAttribute(i.source,"deploymentRef"),a=this.graphology.getNodeAttribute(i.target,"deploymentRef");(s===null||a===null)&&(s=this.graphology.getNodeAttribute(i.source,"modelRef"),a=this.graphology.getNodeAttribute(i.target,"modelRef"));let o=-1;s!==null&&a!==null?o=$2(s,a):lO.warn(`Edge ${i.id} of view ${e.id} is invalid, sourceFqn: ${s}, targetFqn: ${a}`),this.graphology.addEdgeWithKey(i.id,i.source,i.target,{origin:i,hierarchyDistance:o,weight:1}),
2787
2787
  o>this.graphology.getNodeAttribute(i.source,"maxConnectedHierarchyDistance")&&this.graphology.mergeNodeAttributes(i.source,{maxConnectedHierarchyDistance:o}),o>this.graphology.getNodeAttribute(i.target,"maxConnectedHierarchyDistance")&&this.graphology.mergeNodeAttributes(i.target,{maxConnectedHierarchyDistance:o})}this.graphology.forEachEdge((i,{hierarchyDistance:s},a,o,c,l)=>{const u=Math.max(c.maxConnectedHierarchyDistance,l.maxConnectedHierarchyDistance);if(u>s)this.graphology.mergeEdgeAttributes(
2788
2788
  i,{weight:u-s+1});else{const d=this.graphology.directedDegree(a),f=this.graphology.directedDegree(o);d===1&&f===1&&s>1&&this.graphology.mergeEdgeAttributes(i,{weight:s})}});const n=this.graphvizModel=this.createGraph();this.applyNodeAttributes(n.attributes.node),this.applyEdgeAttributes(n.attributes.edge),this.build(n),this.postBuild(n)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphology=new G2({allowSelfLoops:!0,multi:!0,type:"directed"});graphvizModel;get $defaults(){
2789
2789
  return this.styles.defaults}get hasEdgesWithCompounds(){return this.edgesWithCompounds.size>0}get defaultRelationshipColors(){const e=this.styles.relationshipColors;return{line:e.line,label:e.label,labelBg:e.labelBg}}postBuild(e){}build(e){const r=(i,s)=>{const a=this.generateGraphvizId(i),o=this.elementToSubgraph(i,s.subgraph(a));this.subgraphs.set(i.id,o);for(const c of i.children){const l=this.computedNode(c);if($n(l))r(l,o);else{const u=On(this.getGraphNode(l.id),`Graphviz Node not found for\
2790
- ${l.id}`);o.node(u.id)}}},n=[];for(const i of this.view.nodes)if($n(i))Mt(i.parent)&&n.push(i);else{const s=this.generateGraphvizId(i),a=this.elementToNode(i,e.node(s));this.nodes.set(i.id,a)}for(const i of n)r(i,e);for(const i of this.view.edges){const s=this.addEdge(i,e);s&&this.edges.set(i.id,s)}}print(){return Xee(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){const e=this.view.autoLayout,r=Yee({[ee.likec4_viewId]:this.view.id,[ee.bgcolor]:"transparent",[ee.layout]:"\
2791
- dot",[ee.compound]:!0,[ee.rankdir]:e.direction,[ee.TBbalance]:"min",[ee.splines]:"spline",[ee.outputorder]:"nodesfirst",[ee.nodesep]:Zt(e.nodeSep??110),[ee.ranksep]:Zt(e.rankSep??120),[ee.pad]:Zt(15),[ee.fontname]:ZR});return r.attributes.graph.apply({[ee.fontsize]:Es(this.styles.fontSize()),[ee.labeljust]:e.direction==="RL"?"r":"l",[ee.labelloc]:e.direction==="BT"?"b":"t",[ee.margin]:JR}),r}applyNodeAttributes(e){const r=this.styles.elementColors;e.apply({[ee.fontname]:ZR,[ee.shape]:"rect",[ee.
2792
- fillcolor]:r.fill,[ee.fontcolor]:r.hiContrast,[ee.color]:r.stroke,[ee.style]:"filled",[ee.penwidth]:0})}applyEdgeAttributes(e){const r=this.defaultRelationshipColors;e.apply({[ee.arrowsize]:.75,[ee.fontname]:ZR,[ee.fontsize]:Es(14),[ee.penwidth]:Es(2),[ee.color]:r.line,[ee.fontcolor]:r.label})}checkNodeId(e,r=!1){return r?e="cluster_"+e:e.toLowerCase().startsWith("cluster")&&(e="nd_"+e),this.ids.has(e)?null:(this.ids.add(e),e)}generateGraphvizId(e){const r=$n(e);let n=jp(e.id).toLowerCase(),i=this.
2793
- checkNodeId(n,r);if(i!==null)return i;n=jp(e.id).toLowerCase();let s=1;do i=this.checkNodeId(n+"_"+s++,r);while(i===null);return i}elementToSubgraph(e,r){fr($n(e),"node should be compound"),fr(Di(e.depth),"node.depth should be defined");const n=this.styles.colors(e.color).elements,i=dte(n.loContrast);return r.apply({[ee.likec4_id]:e.id,[ee.likec4_level]:e.level,[ee.likec4_depth]:e.depth,[ee.fillcolor]:oO(n.fill,e.depth),[ee.color]:oO(n.stroke,e.depth),[ee.style]:"filled",[ee.margin]:Es(e.children.
2794
- length>1?40:32)}),Pt(e.title.trim())||r.set(ee.label,mte(e,i)),r}elementToNode(e,r){fr(!$n(e),"node should not be compound");const n=be(e.icon),i=this.styles.colors(e.color).elements,{values:{padding:s,sizes:{width:a,height:o}}}=this.styles.nodeSizes(e.style);switch(r.attributes.apply({[ee.likec4_id]:e.id,[ee.likec4_level]:e.level,[ee.label]:hte(e,this.styles),[ee.margin]:`${Zt(n?8:s)},${Zt(s)}`}),r.attributes.set(ee.width,Zt(a)),r.attributes.set(ee.height,Zt(o)),this.styles.isDefaultColor(e.color)||
2790
+ ${l.id}`);o.node(u.id)}}},n=[];for(const i of this.view.nodes)if($n(i))Mt(i.parent)&&n.push(i);else{const s=this.generateGraphvizId(i),a=this.elementToNode(i,e.node(s));this.nodes.set(i.id,a)}for(const i of n)r(i,e);for(const i of this.view.edges){const s=this.addEdge(i,e);s&&this.edges.set(i.id,s)}}print(){return tte(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){const e=this.view.autoLayout,r=ete({[ee.likec4_viewId]:this.view.id,[ee.bgcolor]:"transparent",[ee.layout]:"\
2791
+ dot",[ee.compound]:!0,[ee.rankdir]:e.direction,[ee.TBbalance]:"min",[ee.splines]:"spline",[ee.outputorder]:"nodesfirst",[ee.nodesep]:Zt(e.nodeSep??110),[ee.ranksep]:Zt(e.rankSep??120),[ee.pad]:Zt(15),[ee.fontname]:KR});return r.attributes.graph.apply({[ee.fontsize]:Es(this.styles.fontSize()),[ee.labeljust]:e.direction==="RL"?"r":"l",[ee.labelloc]:e.direction==="BT"?"b":"t",[ee.margin]:ZR}),r}applyNodeAttributes(e){const r=this.styles.elementColors;e.apply({[ee.fontname]:KR,[ee.shape]:"rect",[ee.
2792
+ fillcolor]:r.fill,[ee.fontcolor]:r.hiContrast,[ee.color]:r.stroke,[ee.style]:"filled",[ee.penwidth]:0})}applyEdgeAttributes(e){const r=this.defaultRelationshipColors;e.apply({[ee.arrowsize]:.75,[ee.fontname]:KR,[ee.fontsize]:Es(14),[ee.penwidth]:Es(2),[ee.color]:r.line,[ee.fontcolor]:r.label})}checkNodeId(e,r=!1){return r?e="cluster_"+e:e.toLowerCase().startsWith("cluster")&&(e="nd_"+e),this.ids.has(e)?null:(this.ids.add(e),e)}generateGraphvizId(e){const r=$n(e);let n=jp(e.id).toLowerCase(),i=this.
2793
+ checkNodeId(n,r);if(i!==null)return i;n=jp(e.id).toLowerCase();let s=1;do i=this.checkNodeId(n+"_"+s++,r);while(i===null);return i}elementToSubgraph(e,r){yr($n(e),"node should be compound"),yr(Di(e.depth),"node.depth should be defined");const n=this.styles.colors(e.color).elements,i=hte(n.loContrast);return r.apply({[ee.likec4_id]:e.id,[ee.likec4_level]:e.level,[ee.likec4_depth]:e.depth,[ee.fillcolor]:sO(n.fill,e.depth),[ee.color]:sO(n.stroke,e.depth),[ee.style]:"filled",[ee.margin]:Es(e.children.
2794
+ length>1?40:32)}),Pt(e.title.trim())||r.set(ee.label,vte(e,i)),r}elementToNode(e,r){yr(!$n(e),"node should not be compound");const n=be(e.icon),i=this.styles.colors(e.color).elements,{values:{padding:s,sizes:{width:a,height:o}}}=this.styles.nodeSizes(e.style);switch(r.attributes.apply({[ee.likec4_id]:e.id,[ee.likec4_level]:e.level,[ee.label]:yte(e,this.styles),[ee.margin]:`${Zt(n?8:s)},${Zt(s)}`}),r.attributes.set(ee.width,Zt(a)),r.attributes.set(ee.height,Zt(o)),this.styles.isDefaultColor(e.color)||
2795
2795
  r.attributes.apply({[ee.fillcolor]:i.fill,[ee.fontcolor]:i.hiContrast,[ee.color]:i.stroke}),e.shape){case"cylinder":case"storage":{r.attributes.apply({[ee.margin]:`${Zt(n?8:s)},${Zt(0)}`,[ee.penwidth]:Es(2),[ee.shape]:"cylinder"});break}case"browser":{r.attributes.apply({[ee.margin]:`${Zt(n?8:s+4)},${Zt(s+6)}`});break}case"mobile":{r.attributes.apply({[ee.margin]:`${Zt(n?8:s+4)},${Zt(s)}`});break}case"queue":{r.attributes.apply({[ee.width]:Zt(a),[ee.height]:Zt(o-8),[ee.margin]:`${Zt(n?8:s+4)},${Zt(
2796
2796
  s)}`});break}}return r}leafElements(e){return e===null?this.view.nodes.filter(r=>!$n(r)):this.computedNode(e).children.flatMap(r=>{const n=this.computedNode(r);return $n(n)?this.leafElements(n.id):n})}descendants(e){return e===null?this.view.nodes.slice():this.computedNode(e).children.flatMap(r=>{const n=this.computedNode(r);return[n,...this.descendants(n.id)]})}computedNode(e){return On(this.view.nodes.find(r=>r.id===e),`Node ${e} not found`)}getGraphNode(e){return this.nodes.get(e)??null}getSubgraph(e){
2797
- return this.subgraphs.get(e)??null}edgeEndpoint(e,r){let n=this.computedNode(e),i=this.getGraphNode(e),s;return i||(fr($n(n),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,fr(s,`subgraph ${e} not found`),n=On(r(this.leafElements(e)),`leaf element in ${e} not found`),i=On(this.getGraphNode(n.id),`source graphviz node ${n.id} not found`)),[n,i,s]}findInternalEdges(e){if(e===null)return this.view.edges.slice();const r=this.computedNode(e);return Ye(this.descendants(e),oi(n=>VP(n.inEdges,
2797
+ return this.subgraphs.get(e)??null}edgeEndpoint(e,r){let n=this.computedNode(e),i=this.getGraphNode(e),s;return i||(yr($n(n),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,yr(s,`subgraph ${e} not found`),n=On(r(this.leafElements(e)),`leaf element in ${e} not found`),i=On(this.getGraphNode(n.id),`source graphviz node ${n.id} not found`)),[n,i,s]}findInternalEdges(e){if(e===null)return this.view.edges.slice();const r=this.computedNode(e);return Ye(this.descendants(e),oi(n=>VP(n.inEdges,
2798
2798
  n.outEdges)),as(),Vz(VP(r.inEdges,r.outEdges)),qt(n=>this.view.edges.find(i=>i.id===n)),Qe(be))}withoutCompoundEdges(e){return this.edgesWithCompounds.size===0?e:{...e,inEdges:e.inEdges.filter(r=>!this.edgesWithCompounds.has(r)),outEdges:e.outEdges.filter(r=>!this.edgesWithCompounds.has(r))}}assignGroups(){const e=Ye(this.view.nodes,Qe($n),qt(n=>n.id),n0(P2),vU(),qt(n=>{const i=this.findInternalEdges(n).filter(s=>s.source!==s.target&&!this.compoundIds.has(s.source)&&!this.compoundIds.has(s.target));
2799
- return{id:n,edges:i}}),Qe(({edges:n})=>n.length>1&&n.length<8),kU(4)),r=new Set;for(const n of e){const i=n.edges.filter(s=>!r.has(s.source)&&!r.has(s.target));for(const s of i)try{const a=On(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),o=On(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);r.add(s.source),r.add(s.target),a.attributes.set(ee.group,n.id),o.attributes.set(ee.group,n.id)}catch(a){dO.error(`Failed to assign group to edge ${s.id}`,{error:a})}}}applyManualLayout({
2799
+ return{id:n,edges:i}}),Qe(({edges:n})=>n.length>1&&n.length<8),kU(4)),r=new Set;for(const n of e){const i=n.edges.filter(s=>!r.has(s.source)&&!r.has(s.target));for(const s of i)try{const a=On(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),o=On(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);r.add(s.source),r.add(s.target),a.attributes.set(ee.group,n.id),o.attributes.set(ee.group,n.id)}catch(a){lO.error(`Failed to assign group to edge ${s.id}`,{error:a})}}}applyManualLayout({
2800
2800
  height:e,...r}){const n=r.x<0?-r.x:0;r.y<0&&-r.y;for(const{id:i,...s}of r.nodes){const a=this.getGraphNode(i);if(!a)continue;const o=Zt(s.center.x)+n,c=Zt(e-s.center.y);s.fixedsize?a.attributes.apply({[ee.pos]:`${o},${c}!`,[ee.pin]:!0,[ee.width]:Zt(s.fixedsize.width),[ee.height]:Zt(s.fixedsize.height),[ee.fixedsize]:!0}):a.attributes.set(ee.pos,`${o},${c}`)}for(const[,i]of this.edges.entries())i.attributes.delete(ee.weight),i.attributes.delete(ee.minlen),i.attributes.delete(ee.constraint);return this.
2801
- graphvizModel.apply({[ee.layout]:"fdp",[ee.overlap]:"vpsc",[ee.sep]:"+50,50",[ee.esep]:"+10,10",[ee.start]:"random2",[ee.splines]:"compound",[ee.K]:10}),this.graphvizModel.delete(ee.compound),this.graphvizModel.delete(ee.rankdir),this.graphvizModel.delete(ee.nodesep),this.graphvizModel.delete(ee.ranksep),this.graphvizModel.delete(ee.pack),this.graphvizModel.delete(ee.pad),this.graphvizModel.delete(ee.packmode),this.graphvizModel.attributes.graph.delete(ee.margin),this}}class yte extends YR{createGraph(){
2801
+ graphvizModel.apply({[ee.layout]:"fdp",[ee.overlap]:"vpsc",[ee.sep]:"+50,50",[ee.esep]:"+10,10",[ee.start]:"random2",[ee.splines]:"compound",[ee.K]:10}),this.graphvizModel.delete(ee.compound),this.graphvizModel.delete(ee.rankdir),this.graphvizModel.delete(ee.nodesep),this.graphvizModel.delete(ee.ranksep),this.graphvizModel.delete(ee.pack),this.graphvizModel.delete(ee.pad),this.graphvizModel.delete(ee.packmode),this.graphvizModel.attributes.graph.delete(ee.margin),this}}class bte extends JR{createGraph(){
2802
2802
  const e=super.createGraph(),r=this.view.autoLayout;return e.delete(ee.TBbalance),e.apply({[ee.nodesep]:Zt(r.nodeSep??130),[ee.ranksep]:Zt(r.rankSep??130)}),e}postBuild(e){Ye(this.view.nodes,qt(r=>({node:r,graphvizNode:this.getGraphNode(r.id)})),Vo(({node:r,graphvizNode:n})=>{if(n!=null)return r.modelRef}),wl(),qt(r=>r),YP(r=>{r.length<2||e.subgraph({[ee.rank]:"same"},n=>{for(const{graphvizNode:i}of r)n.node(On(i).id)})}),TU(()=>{e.set(ee.newrank,!0),e.set(ee.clusterrank,"global"),e.delete(ee.pack),
2803
- e.delete(ee.packmode)}))}elementToSubgraph(e,r){const n=super.elementToSubgraph(e,r);return e.children.length>1&&n.set(ee.margin,Es(50)),n}addEdge(e,r){const[n,i]=[e.source,e.target],[s,a,o]=this.edgeEndpoint(n,m=>Wo(m)),[c,l,u]=this.edgeEndpoint(i,wc),d=Ni(u)||Ni(o),f=r.edge([a,l],{[ee.likec4_id]:e.id,[ee.style]:e.line??KR});u&&f.attributes.set(ee.lhead,u),o&&f.attributes.set(ee.ltail,o);const p=this.graphology.getEdgeAttribute(e.id,"weight");p>1&&!this.graphology.hasDirectedEdge(e.target,e.source)&&
2804
- f.attributes.set(ee.weight,p);const w=uO(e);if(w&&f.attributes.set(d?ee.xlabel:ee.label,w),e.color&&e.color!==this.$defaults.relationship.color){const m=this.styles.colors(e.color).relationships;f.attributes.apply({[ee.color]:m.line,[ee.fontcolor]:m.label})}let[g,y]=[e.head??this.$defaults.relationship.arrow,e.tail??"none"];return g==="none"&&y==="none"?(f.attributes.apply({[ee.arrowtail]:"none",[ee.arrowhead]:"none",[ee.dir]:"none"}),f):e.dir==="both"?(f.attributes.apply({[ee.arrowhead]:Mr(g),[ee.
2805
- arrowtail]:Mr(e.tail??g),[ee.dir]:"both"}),!d&&s.modelRef!==c.modelRef&&f.attributes.set(ee.constraint,!1),f):(g&&f.attributes.set(ee.arrowhead,Mr(g)),y!=="none"&&f.attributes.set(ee.arrowtail,Mr(y)),f)}}class vte extends YR{postBuild(e){e.delete(ee.TBbalance),e.set(ee.ordering,"in")}addEdge(e,r){const{nodes:n}=this.view,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[a,o,c]=this.edgeEndpoint(i,v=>Wo(v)),[l,u,d]=this.edgeEndpoint(s,wc),f=r.edge([o,u],{[ee.likec4_id]:e.id,[ee.style]:e.
2806
- line??KR});if(d&&f.attributes.set(ee.lhead,d),c&&f.attributes.set(ee.ltail,c),e.color&&e.color!==this.$defaults.relationship.color){const v=this.styles.colors(e.color).relationships;f.attributes.apply({[ee.color]:v.line,[ee.fontcolor]:v.label})}const p=[e.label?.trim(),e.technology?.trim()].filter(be).join(`
2807
- `),w=i2(e.id),g=gte(w,p);f.attributes.set(ee.label,g);const y=n.findIndex(v=>v.id===i);n.findIndex(v=>v.id===s)<y&&e.dir!=="back"&&f.attributes.apply({[ee.minlen]:0});let[m,h]=[e.head??this.$defaults.relationship.arrow,e.tail??"none"];return e.dir==="back"?(f.attributes.apply({[ee.arrowtail]:Mr(m),[ee.dir]:"back"}),h!=="none"&&f.attributes.apply({[ee.arrowhead]:Mr(h),[ee.minlen]:0}),f):m==="none"&&h==="none"||m!=="none"&&h!=="none"?(f.attributes.apply({[ee.arrowhead]:Mr(m),[ee.arrowtail]:Mr(h),[ee.
2808
- dir]:"both"}),f):m==="none"?(f.attributes.delete(ee.arrowhead),f.attributes.apply({[ee.arrowtail]:Mr(h),[ee.minlen]:0,[ee.dir]:"back"}),f):(f.attributes.set(ee.arrowhead,Mr(m)),f)}}const wte=BC("dot.rank");class bte extends YR{postBuild(e){this.assignGroups();const r=new Set,n=this.view.nodes.reduce((a,o)=>($n(o)&&(r.add(o.id),a.push(o)),a),[]);let i=!1;for(const a of n){const o=Ye(a.children,Qe(d=>!this.compoundIds.has(d)),qt(d=>this.computedNode(d)),Qe(d=>d.inEdges.length===0&&d.outEdges.length===
2803
+ e.delete(ee.packmode)}))}elementToSubgraph(e,r){const n=super.elementToSubgraph(e,r);return e.children.length>1&&n.set(ee.margin,Es(50)),n}addEdge(e,r){const[n,i]=[e.source,e.target],[s,a,o]=this.edgeEndpoint(n,m=>Wo(m)),[c,l,u]=this.edgeEndpoint(i,wc),d=Ni(u)||Ni(o),f=r.edge([a,l],{[ee.likec4_id]:e.id,[ee.style]:e.line??GR});u&&f.attributes.set(ee.lhead,u),o&&f.attributes.set(ee.ltail,o);const p=this.graphology.getEdgeAttribute(e.id,"weight");p>1&&!this.graphology.hasDirectedEdge(e.target,e.source)&&
2804
+ f.attributes.set(ee.weight,p);const w=cO(e);if(w&&f.attributes.set(d?ee.xlabel:ee.label,w),e.color&&e.color!==this.$defaults.relationship.color){const m=this.styles.colors(e.color).relationships;f.attributes.apply({[ee.color]:m.line,[ee.fontcolor]:m.label})}let[g,y]=[e.head??this.$defaults.relationship.arrow,e.tail??"none"];return g==="none"&&y==="none"?(f.attributes.apply({[ee.arrowtail]:"none",[ee.arrowhead]:"none",[ee.dir]:"none"}),f):e.dir==="both"?(f.attributes.apply({[ee.arrowhead]:Mr(g),[ee.
2805
+ arrowtail]:Mr(e.tail??g),[ee.dir]:"both"}),!d&&s.modelRef!==c.modelRef&&f.attributes.set(ee.constraint,!1),f):(g&&f.attributes.set(ee.arrowhead,Mr(g)),y!=="none"&&f.attributes.set(ee.arrowtail,Mr(y)),f)}}class _te extends JR{postBuild(e){e.delete(ee.TBbalance),e.set(ee.ordering,"in")}addEdge(e,r){const{nodes:n}=this.view,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[a,o,c]=this.edgeEndpoint(i,v=>Wo(v)),[l,u,d]=this.edgeEndpoint(s,wc),f=r.edge([o,u],{[ee.likec4_id]:e.id,[ee.style]:e.
2806
+ line??GR});if(d&&f.attributes.set(ee.lhead,d),c&&f.attributes.set(ee.ltail,c),e.color&&e.color!==this.$defaults.relationship.color){const v=this.styles.colors(e.color).relationships;f.attributes.apply({[ee.color]:v.line,[ee.fontcolor]:v.label})}const p=[e.label?.trim(),e.technology?.trim()].filter(be).join(`
2807
+ `),w=i2(e.id),g=wte(w,p);f.attributes.set(ee.label,g);const y=n.findIndex(v=>v.id===i);n.findIndex(v=>v.id===s)<y&&e.dir!=="back"&&f.attributes.apply({[ee.minlen]:0});let[m,h]=[e.head??this.$defaults.relationship.arrow,e.tail??"none"];return e.dir==="back"?(f.attributes.apply({[ee.arrowtail]:Mr(m),[ee.dir]:"back"}),h!=="none"&&f.attributes.apply({[ee.arrowhead]:Mr(h),[ee.minlen]:0}),f):m==="none"&&h==="none"||m!=="none"&&h!=="none"?(f.attributes.apply({[ee.arrowhead]:Mr(m),[ee.arrowtail]:Mr(h),[ee.
2808
+ dir]:"both"}),f):m==="none"?(f.attributes.delete(ee.arrowhead),f.attributes.apply({[ee.arrowtail]:Mr(h),[ee.minlen]:0,[ee.dir]:"back"}),f):(f.attributes.set(ee.arrowhead,Mr(m)),f)}}const Rte=BC("dot.rank");class kte extends JR{postBuild(e){this.assignGroups();const r=new Set,n=this.view.nodes.reduce((a,o)=>($n(o)&&(r.add(o.id),a.push(o)),a),[]);let i=!1;for(const a of n){const o=Ye(a.children,Qe(d=>!this.compoundIds.has(d)),qt(d=>this.computedNode(d)),Qe(d=>d.inEdges.length===0&&d.outEdges.length===
2809
2809
  0));if(o.length<=2)continue;let c=2;switch(!0){case o.length>11:c=4;break;case o.length>4:c=3;break}const l=On(this.getSubgraph(a.id),`Subgraph not found for ${a.id}`);let u=null;Hz(o,c).forEach(d=>{const f=d.length>1?l.createSubgraph({[ee.rank]:"same"}):null;d.forEach((p,w)=>{const g=this.getGraphNode(p.id);g&&(f?.node(g.id),w===0&&(u&&l.edge([u,g],{[ee.style]:"invis"}),u=g))}),i=i||!!f})}const s=this.applyExplicitRankBlocks(e);i&&(e.set(ee.newrank,!0),e.set(ee.clusterrank,"global")),s>0&&e.set(
2810
- "likec4_rankBlocks",s)}applyExplicitRankBlocks(e){const r=this.view.ranks??[];if(r.length===0)return 0;let n=0;for(const i of r){const s=[...new Set(i.nodes)].map(o=>this.getGraphNode(o)).filter(o=>!!o);if(s.length===0)continue;const a=e.createSubgraph({[ee.rank]:i.type});s.forEach(o=>a.node(o.id)),n+=1,wte.debug`rank ${i.type} => ${s.map(o=>o.id).join(", ")}`}return n}addEdge(e,r){const[n,i]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[s,a,o]=this.edgeEndpoint(n,v=>Wo(v)),[c,l,u]=this.
2811
- edgeEndpoint(i,wc),d=e.parent,f=this.graphology.getEdgeAttributes(e.id),p=r.edge([a,l],{[ee.likec4_id]:e.id,[ee.style]:e.line??KR});u&&p.attributes.set(ee.lhead,u),o&&p.attributes.set(ee.ltail,o);const w=Ni(u)||Ni(o);!this.graphology.hasDirectedEdge(e.target,e.source)&&f.weight>1&&p.attributes.set(ee.weight,f.weight);const g=uO(e);if(g&&p.attributes.set(w?ee.xlabel:ee.label,g),e.color&&e.color!==this.$defaults.relationship.color){const v=this.styles.colors(e.color).relationships;p.attributes.apply(
2810
+ "likec4_rankBlocks",s)}applyExplicitRankBlocks(e){const r=this.view.ranks??[];if(r.length===0)return 0;let n=0;for(const i of r){const s=[...new Set(i.nodes)].map(o=>this.getGraphNode(o)).filter(o=>!!o);if(s.length===0)continue;const a=e.createSubgraph({[ee.rank]:i.type});s.forEach(o=>a.node(o.id)),n+=1,Rte.debug`rank ${i.type} => ${s.map(o=>o.id).join(", ")}`}return n}addEdge(e,r){const[n,i]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[s,a,o]=this.edgeEndpoint(n,v=>Wo(v)),[c,l,u]=this.
2811
+ edgeEndpoint(i,wc),d=e.parent,f=this.graphology.getEdgeAttributes(e.id),p=r.edge([a,l],{[ee.likec4_id]:e.id,[ee.style]:e.line??GR});u&&p.attributes.set(ee.lhead,u),o&&p.attributes.set(ee.ltail,o);const w=Ni(u)||Ni(o);!this.graphology.hasDirectedEdge(e.target,e.source)&&f.weight>1&&p.attributes.set(ee.weight,f.weight);const g=cO(e);if(g&&p.attributes.set(w?ee.xlabel:ee.label,g),e.color&&e.color!==this.$defaults.relationship.color){const v=this.styles.colors(e.color).relationships;p.attributes.apply(
2812
2812
  {[ee.color]:v.line,[ee.fontcolor]:v.label})}let[y,m]=[e.head??this.$defaults.relationship.arrow,e.tail??"none"];if(e.dir==="back")return p.attributes.apply({[ee.arrowtail]:Mr(y),[ee.dir]:"back"}),m!=="none"&&p.attributes.apply({[ee.arrowhead]:Mr(m),[ee.dir]:"both",[ee.minlen]:0}),p;if(y==="none"&&m==="none")return p.attributes.apply({[ee.arrowtail]:"none",[ee.arrowhead]:"none",[ee.dir]:"none",[ee.minlen]:0,[ee.constraint]:!1}),p;if(y!=="none"&&m!=="none")return p.attributes.apply({[ee.arrowhead]:Mr(
2813
2813
  y),[ee.arrowtail]:Mr(m),[ee.dir]:"both"}),p;if(p.attributes.set(ee.arrowhead,Mr(y)),m!=="none"&&p.attributes.set(ee.arrowtail,Mr(m)),this.view.edges.length===1)return p;let h;return d===null&&s.parent==null&&c.parent==null?h=this.view.edges.filter(v=>{if(v.id===e.id||v.parent!==null||v.source===e.source&&v.target===e.target||v.source===e.target&&v.target===e.source)return!1;const b=this.computedNode(v.source),_=this.computedNode(v.target);return $n(b)||$n(_)?!1:b.parent==null&&_.parent==null}):h=
2814
- this.findInternalEdges(d).filter(v=>!(v.id===e.id||v.source===e.source&&v.target===e.target||v.source===e.target&&v.target===e.source)),h.length===0&&(d===null||this.leafElements(d).length<=3)&&p.attributes.set(ee.minlen,0),p}}function fO(t){const[e,r,n,i]=t?t.split(",").map(o=>Hi(+o)):[0,0,0,0],s=Math.round(n-e),a=Math.round(r-i);return{x:Math.round(e),y:Math.round(i),width:s,height:a}}function _te(t){try{const[e,r]=t.split(",");return{x:Hi(parseFloat(e)),y:Hi(parseFloat(r))}}catch(e){throw new Error(
2815
- `Failed on parsing pos: ${t}`,{cause:e})}}function Rte(t){const{x:e,y:r}=_te(t.pos),n=aO(parseFloat(t.width)),i=aO(parseFloat(t.height));return{x:e-Math.round(n/2),y:r-Math.round(i/2),width:n,height:i}}function pO(t,[e,r]=[0,0]){if(!t||t.length===0)return null;let n=1/0,i=1/0,s=-1/0,a=-1/0,o=13;try{for(const l of t){if(l.op==="F"){o=Hi(l.size);continue}if(l.op==="T"){let u=Hi(l.pt[0])-e,d=Hi(l.width);switch(l.align){case"r":u-=d;break;case"c":u-=Math.round(d/2);break}n=Math.min(n,u),s=Math.max(s,
2814
+ this.findInternalEdges(d).filter(v=>!(v.id===e.id||v.source===e.source&&v.target===e.target||v.source===e.target&&v.target===e.source)),h.length===0&&(d===null||this.leafElements(d).length<=3)&&p.attributes.set(ee.minlen,0),p}}function uO(t){const[e,r,n,i]=t?t.split(",").map(o=>Hi(+o)):[0,0,0,0],s=Math.round(n-e),a=Math.round(r-i);return{x:Math.round(e),y:Math.round(i),width:s,height:a}}function Ste(t){try{const[e,r]=t.split(",");return{x:Hi(parseFloat(e)),y:Hi(parseFloat(r))}}catch(e){throw new Error(
2815
+ `Failed on parsing pos: ${t}`,{cause:e})}}function Ete(t){const{x:e,y:r}=Ste(t.pos),n=iO(parseFloat(t.width)),i=iO(parseFloat(t.height));return{x:e-Math.round(n/2),y:r-Math.round(i/2),width:n,height:i}}function dO(t,[e,r]=[0,0]){if(!t||t.length===0)return null;let n=1/0,i=1/0,s=-1/0,a=-1/0,o=13;try{for(const l of t){if(l.op==="F"){o=Hi(l.size);continue}if(l.op==="T"){let u=Hi(l.pt[0])-e,d=Hi(l.width);switch(l.align){case"r":u-=d;break;case"c":u-=Math.round(d/2);break}n=Math.min(n,u),s=Math.max(s,
2816
2816
  u+d);let f=Hi(l.pt[1])-r;i=Math.min(i,Math.round(f-o)),a=Math.max(a,f)}}}catch(l){return Rn.warn(`Failed on parsing label draw ops:
2817
- {labelDrawOps}`,{e:l,labelDrawOps:t}),null}if(n===1/0)return null;const c=2;return{x:n-c,y:i-c,width:s-n+2*c,height:a-i+2*c}}function kte({_draw_:t,likec4_id:e="???"},r="<unknown view>"){try{const n=t.filter(s=>s.op.toLowerCase()==="b");fr(Ir(n,1),`view ${r} edge ${e} should have at least one bezier draw op`),n.length>1&&Rn.warn(`view ${r} edge ${e} has more than one bezier draw op, using the first one only`);const i=n[0].points.map(s=>Hi(s));return fr(Ir(i,2),`view ${r} edge ${e} should have at\
2817
+ {labelDrawOps}`,{e:l,labelDrawOps:t}),null}if(n===1/0)return null;const c=2;return{x:n-c,y:i-c,width:s-n+2*c,height:a-i+2*c}}function Tte({_draw_:t,likec4_id:e="???"},r="<unknown view>"){try{const n=t.filter(s=>s.op.toLowerCase()==="b");yr(Ir(n,1),`view ${r} edge ${e} should have at least one bezier draw op`),n.length>1&&Rn.warn(`view ${r} edge ${e} has more than one bezier draw op, using the first one only`);const i=n[0].points.map(s=>Hi(s));return yr(Ir(i,2),`view ${r} edge ${e} should have at\
2818
2818
  least two points`),i}catch(n){throw new Error(`failed on parsing view ${r} edge ${e} _draw_:
2819
- ${JSON.stringify(t,null,2)}`,{cause:n})}}function Ste(t,{id:e,source:r,target:n,dir:i,label:s,description:a,...o},c){const l=pO(t._ldraw_??t._tldraw_??t._hldraw_),u=t.dir==="back"||i==="back";return s=s&&l?cO(s,{maxchars:Ey,maxLines:lO}).join(`
2820
- `):null,{id:e,source:r,target:n,label:s,...be(a)&&{description:a},points:kte(t,c),labelBBox:l,...u?{dir:"back"}:{},...o}}function Ete(t,e){const r=fO(t.bb),{nodes:n,edges:i,hasManualLayout:s,manualLayout:a,...o}=e;let c;o._type==="dynamic"?c={...o,sequenceLayout:{actors:[],compounds:[],parallelAreas:[],steps:[],bounds:r},[Fv]:"layouted",bounds:r,nodes:[],edges:[]}:c={...o,[Fv]:"layouted",bounds:r,nodes:[],edges:[]},s&&(c[SS]="auto");const l=t.objects??[];for(const d of n){const f=l.find(p=>p.likec4_id===
2821
- d.id);fr(f,`View ${o.id} node ${d.id} not found in graphviz output`);try{const{x:p,y:w,width:g,height:y}="bb"in f?fO(f.bb):Rte(f),m=[p,w];c.nodes.push({...d,x:p,y:w,width:g,height:y,labelBBox:pO(f._ldraw_,m)??{x:p,y:w,width:g,height:y}})}catch(p){throw new Error(`Failed on parsing node ${d.id}:
2822
- ${JSON.stringify(f,null,2)}`,{cause:p})}}const u=t.edges??[];for(const d of i){const f=u.find(p=>p.likec4_id===d.id);if(!f){Rn.warn`View ${o.id} edge ${d.id} not found in graphviz output, skipping`;continue}c.edges.push(Ste(f,d,o.id))}return c}class Tte{value;next;constructor(e){this.value=e}}class $te{#e;#t;#r;constructor(){this.clear()}enqueue(e){const r=new Tte(e);this.#e?(this.#t.next=r,this.#t=r):(this.#e=r,this.#t=r),this.#r++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#r--,
2823
- e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#r=0}get size(){return this.#r}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}}function Pte(t){hO(t);const e=new $te;let r=0;const n=()=>{r<t&&e.size>0&&(e.dequeue()(),r++)},i=()=>{r--,n()},s=async(c,l,u)=>{const d=(async()=>c(...u))();l(d);try{await d}catch{}i()},a=(c,l,u)=>{new Promise(d=>{e.enqueue(d)}).then(s.bind(void 0,c,l,u)),(async()=>(await Promise.resolve(),r<t&&n()))()},o=(c,...l)=>new Promise(
2824
- u=>{a(c,u,l)});return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(c){hO(c),t=c,queueMicrotask(()=>{for(;r<t&&e.size>0;)n()})}}}),o}function hO(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 Cte=Pte(1),fp=Rn.getChild("graphviz-wasm");class xn{static _graphviz=null;static opsCount=0;get concurrency(){return 1}dispose(){
2825
- kl.unload(),xn._graphviz=null}[Symbol.dispose](){this.dispose()}graphviz(){return Promise.resolve().then(async()=>(xn._graphviz||(fp.debug`loading wasm`,xn.opsCount=0,xn._graphviz=kl.load()),await xn._graphviz))}async attempt(e,r,n){return await Cte(async()=>{try{const i=await n();return++xn.opsCount>=10&&(fp.debug`unloading wasm`,kl.unload(),xn._graphviz=null),i}catch(i){fp.error(`FAILED GraphvizWasm. ${e}`,{error:i}),fp.error(`FAILED DOT:
2819
+ ${JSON.stringify(t,null,2)}`,{cause:n})}}function $te(t,{id:e,source:r,target:n,dir:i,label:s,description:a,...o},c){const l=dO(t._ldraw_??t._tldraw_??t._hldraw_),u=t.dir==="back"||i==="back";return s=s&&l?aO(s,{maxchars:Ey,maxLines:oO}).join(`
2820
+ `):null,{id:e,source:r,target:n,label:s,...be(a)&&{description:a},points:Tte(t,c),labelBBox:l,...u?{dir:"back"}:{},...o}}function Pte(t,e){const r=uO(t.bb),{nodes:n,edges:i,hasManualLayout:s,manualLayout:a,...o}=e;let c;o._type==="dynamic"?c={...o,sequenceLayout:{actors:[],compounds:[],parallelAreas:[],steps:[],bounds:r},[Fv]:"layouted",bounds:r,nodes:[],edges:[]}:c={...o,[Fv]:"layouted",bounds:r,nodes:[],edges:[]},s&&(c[SS]="auto");const l=t.objects??[];for(const d of n){const f=l.find(p=>p.likec4_id===
2821
+ d.id);yr(f,`View ${o.id} node ${d.id} not found in graphviz output`);try{const{x:p,y:w,width:g,height:y}="bb"in f?uO(f.bb):Ete(f),m=[p,w];c.nodes.push({...d,x:p,y:w,width:g,height:y,labelBBox:dO(f._ldraw_,m)??{x:p,y:w,width:g,height:y}})}catch(p){throw new Error(`Failed on parsing node ${d.id}:
2822
+ ${JSON.stringify(f,null,2)}`,{cause:p})}}const u=t.edges??[];for(const d of i){const f=u.find(p=>p.likec4_id===d.id);if(!f){Rn.warn`View ${o.id} edge ${d.id} not found in graphviz output, skipping`;continue}c.edges.push($te(f,d,o.id))}return c}class Cte{value;next;constructor(e){this.value=e}}class Ate{#e;#t;#r;constructor(){this.clear()}enqueue(e){const r=new Cte(e);this.#e?(this.#t.next=r,this.#t=r):(this.#e=r,this.#t=r),this.#r++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#r--,
2823
+ e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#r=0}get size(){return this.#r}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}}function xte(t){fO(t);const e=new Ate;let r=0;const n=()=>{r<t&&e.size>0&&(e.dequeue()(),r++)},i=()=>{r--,n()},s=async(c,l,u)=>{const d=(async()=>c(...u))();l(d);try{await d}catch{}i()},a=(c,l,u)=>{new Promise(d=>{e.enqueue(d)}).then(s.bind(void 0,c,l,u)),(async()=>(await Promise.resolve(),r<t&&n()))()},o=(c,...l)=>new Promise(
2824
+ u=>{a(c,u,l)});return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(c){fO(c),t=c,queueMicrotask(()=>{for(;r<t&&e.size>0;)n()})}}}),o}function fO(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 Ite=xte(1),fp=Rn.getChild("graphviz-wasm");class xn{static _graphviz=null;static opsCount=0;get concurrency(){return 1}dispose(){
2825
+ kl.unload(),xn._graphviz=null}[Symbol.dispose](){this.dispose()}graphviz(){return Promise.resolve().then(async()=>(xn._graphviz||(fp.debug`loading wasm`,xn.opsCount=0,xn._graphviz=kl.load()),await xn._graphviz))}async attempt(e,r,n){return await Ite(async()=>{try{const i=await n();return++xn.opsCount>=10&&(fp.debug`unloading wasm`,kl.unload(),xn._graphviz=null),i}catch(i){fp.error(`FAILED GraphvizWasm. ${e}`,{error:i}),fp.error(`FAILED DOT:
2826
2826
  `+r),kl.unload(),xn._graphviz=null}fp.warn("Retrying..."),await MS(10,500);try{return await n()}finally{kl.unload(),xn._graphviz=null}})}async unflatten(e){return await this.attempt("unflatten",e,async()=>(await this.graphviz()).unflatten(e,1,!1,3).replaceAll(/\t\[/g," [").replaceAll(/\t/g," "))}async acyclic(e){return await this.attempt("acyclic",e,async()=>{const r=(await this.graphviz()).acyclic(e,!0);return r.acyclic&&r.outFile||e})}async layoutJson(e){return await this.attempt("layout",e,
2827
- async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt("svg",e,async()=>(await this.graphviz()).layout(e,"svg"))}}const Ate=({view:t,styles:e})=>{switch(!0){case ES(t):return new vte(t,e);case s2(t):return new yte(t,e);case Hv(t):return new bte(t,e);default:js(t)}},xo=Rn.getChild(["layouter"]);class xte{graphviz;constructor(e){this.graphviz=e??new xn}dispose(){this.graphviz.dispose()}[Symbol.dispose](){this.dispose()}get graphvizPort(){return this.
2828
- graphviz}changePort(e){this.graphviz.dispose(),this.graphviz=e}async dotToJson(e){let r;try{r=await this.graphviz.layoutJson(e)}catch(n){throw xo.error(Ve(n)),xo.error`Failed to convert DOT to JSON:\n${e}`,n}try{return JSON.parse(r)}catch(n){throw xo.error(Ve(n)),xo.error`Failed to parse JSON:\n${r}\n. Generated from DOT:\n${e}`,n}}async layout(e){try{xo.debug`layouting view ${e.view.id}...`;let r=await this.dot(e);const{view:n}=e,i=await this.dotToJson(r);let s=Ete(i,n);return n.manualLayout&&(s=
2829
- uee(s,n.manualLayout)),ES(s)&&Object.assign(s,{sequenceLayout:U4(s)}),r=r.split(`
2830
- `).filter(a=>!(a.includes("margin")&&a.includes(`${JR}`))).join(`
2827
+ async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt("svg",e,async()=>(await this.graphviz()).layout(e,"svg"))}}const Nte=({view:t,styles:e})=>{switch(!0){case ES(t):return new _te(t,e);case s2(t):return new bte(t,e);case Hv(t):return new kte(t,e);default:js(t)}},xo=Rn.getChild(["layouter"]);class Dte{graphviz;constructor(e){this.graphviz=e??new xn}dispose(){this.graphviz.dispose()}[Symbol.dispose](){this.dispose()}get graphvizPort(){return this.
2828
+ graphviz}changePort(e){this.graphviz.dispose(),this.graphviz=e}async dotToJson(e){let r;try{r=await this.graphviz.layoutJson(e)}catch(n){throw xo.error(Ve(n)),xo.error`Failed to convert DOT to JSON:\n${e}`,n}try{return JSON.parse(r)}catch(n){throw xo.error(Ve(n)),xo.error`Failed to parse JSON:\n${r}\n. Generated from DOT:\n${e}`,n}}async layout(e){try{xo.debug`layouting view ${e.view.id}...`;let r=await this.dot(e);const{view:n}=e,i=await this.dotToJson(r);let s=Pte(i,n);return n.manualLayout&&(s=
2829
+ pee(s,n.manualLayout)),ES(s)&&Object.assign(s,{sequenceLayout:U4(s)}),r=r.split(`
2830
+ `).filter(a=>!(a.includes("margin")&&a.includes(`${ZR}`))).join(`
2831
2831
  `),xo.debug`layouting view ${e.view.id} done`,{dot:r,diagram:s}}catch(r){throw new Error(`Error during layout: ${e.view.id}`,{cause:r})}}async svg(e){let r=await this.dot(e);return r=r.split(`
2832
- `).filter(n=>!(n.includes("margin")&&n.includes(`${JR}`))).join(`
2833
- `),{svg:await this.graphviz.svg(r),dot:r}}async dot(e){let r=Ate(e).print();if(!Hv(e.view))return r;try{return await this.graphviz.unflatten(r)}catch(n){return xo.warn(`Error during unflatten: ${e.view.id}`,{error:n}),r}}}const Kn=Rn.getChild(["layouter","queue"]);class mO extends xte{queue;isProcessingBatch=!1;constructor(e){super(e?.graphviz),this.queue=new NI({concurrency:e?.concurrency??this.graphvizPort.concurrency,timeout:e?.timeout??2e4,throwOnTimeout:e?.throwOnTimeout??!0})}async runInQueue(e){
2832
+ `).filter(n=>!(n.includes("margin")&&n.includes(`${ZR}`))).join(`
2833
+ `),{svg:await this.graphviz.svg(r),dot:r}}async dot(e){let r=Nte(e).print();if(!Hv(e.view))return r;try{return await this.graphviz.unflatten(r)}catch(n){return xo.warn(`Error during unflatten: ${e.view.id}`,{error:n}),r}}}const Kn=Rn.getChild(["layouter","queue"]);class pO extends Dte{queue;isProcessingBatch=!1;constructor(e){super(e?.graphviz),this.queue=new NI({concurrency:e?.concurrency??this.graphvizPort.concurrency,timeout:e?.timeout??2e4,throwOnTimeout:e?.throwOnTimeout??!0})}async runInQueue(e){
2834
2834
  return this.isProcessingBatch?(Kn.debug`waiting for batch to finish`,await this.queue.onIdle(),await Vv(),await this.runInQueue(e)):(this.queue.size>this.queue.concurrency*2+1&&(Kn.debug`task limit reached: ${this.queue.size} (pending: ${this.queue.pending}), waiting queue to shrink to ${this.queue.concurrency}`,await this.queue.onSizeLessThan(this.queue.concurrency+1)),Kn.debug`add task to queue`,await this.queue.add(e))}changePort(e){super.changePort(e),this.queue.concurrency!==e.concurrency&&
2835
2835
  (this.queue.concurrency=this.graphvizPort.concurrency,Kn.debug`set queue concurrency to ${this.graphvizPort.concurrency}`)}async layout(e){const r=await this.runInQueue(async()=>await super.layout(e));if(!r)throw new Error("QueueGraphvizLayoter: layout failed");return r}async batchLayout(e){if(this.isProcessingBatch)return Kn.debug`wait for previous layouts to finish`,await this.queue.onIdle(),await Vv(),await this.batchLayout(e);if(e.cancelToken?.isCancellationRequested)return Kn.debug`cancellation requested`,
2836
2836
  [];const r=this.queue.concurrency;Kn.debug`starting batch layout, size: ${e.batch.length}, concurrency: ${r}`,this.isProcessingBatch=!0;const n=[];try{for(const i of e.batch)if(Kn.debug`add task for view ${i.view.id}`,this.queue.add(async()=>(r<=2&&await Vv(),await super.layout(i))).then(s=>{if(!s){e.onError?.(i,new Error(`Layout queue returned null for view ${i.view.id}`));return}n.push(s),e.onSuccess?.(i,s)}).catch(s=>{Kn.error(`Fail layout view ${i.view.id}`,{err:s}),e.onError?.(i,s)}),this.queue.
2837
2837
  size>r+2&&(Kn.debug`task limit reached: ${this.queue.size}, waiting queue to shrink to ${r}`,await this.queue.onSizeLessThan(r+1)),e.cancelToken?.isCancellationRequested){Kn.debug`cancellation requested`;break}}finally{await this.queue.onIdle(),Kn.debug`batch layout done`,this.isProcessingBatch=!1}return n}dispose(){this.queue.clear(),super.dispose()}}const pp=Symbol.for("idattr"),Ty={writeId(t,e){return t[pp]=e,t},readId(t){return t[pp]}},$y={writeId(t,e){return Mt(e)?t[pp]=void 0:t[pp]=e,t},readId(t){
2838
- return t[pp]}};function Bi(t){return t.textDocument.languageId===Vf.languageId?(fr(be(t.likec4ProjectId),`LikeC4Document must have projectId defined: ${t.uri.fsPath}`),!0):!1}function Ite(t){return Bi(t)&&t.state==Ue.Validated&&!!t.c4Specification&&!!t.c4Elements&&!!t.c4ExtendElements&&!!t.c4ExtendDeployments&&!!t.c4ExtendRelations&&!!t.c4Relations&&!!t.c4Views&&!!t.c4Deployments&&!!t.c4DeploymentRelations&&!!t.c4Imports}function zi(t){return t?.markdown||t?.text}function gO(t){const e=parseFloat(
2839
- t);return isNaN(e)?100:UP(e,{min:0,max:100})}function yO({value:t}){return gO(t)}function ll({value:t}){switch(t){case"xs":case"sm":case"md":case"lg":case"xl":return t;case"xsmall":return"xs";case"small":return"sm";case"medium":return"md";case"large":return"lg";case"xlarge":return"xl";default:js(t)}}function XR(t,e){const r={};if(!t||t.length===0)return r;for(const n of t)if(e(n))switch(!0){case uo(n):{const i=hp(n);be(i)&&(r.color=i);break}case Vd(n):{r.line=n.value;break}case md(n):{switch(n.key){case"\
2840
- head":{r.head=n.value;break}case"tail":{r.tail=n.value;break}default:js(n)}break}default:js(n)}return r}function hp(t){return t?.themeColor??t?.customColor?.$refText}function QR(t){const e=t.rankSep,r=t.nodeSep;let n;switch(t.direction){case"TopBottom":{n="TB";break}case"BottomTop":{n="BT";break}case"LeftRight":{n="LR";break}case"RightLeft":{n="RL";break}default:js(t.direction)}return{direction:n,...r&&{nodeSep:r},...e&&{rankSep:e}}}function Nte(t){switch(t){case"TB":return"TopBottom";case"BT":return"\
2841
- BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:js(t)}}function Py(t){return hn(t,e=>Pf(e)||Ec(e)||Fx(e))}const ek=t=>Kx(t)||Xm(t)||sg(t)||X0(t)||Zm(t)||Y0(t),tk=t=>Zx(t)||W0(t)||Mx(t)||e_(t)||Lx(t);function Dte(t){for(;;){if(tk(t)||ek(t))return!1;if(n_(t)||Xd(t))return!0;if(t.$container)t=t.$container;else return!1}}function Ote(t){for(;;){if(tk(t))return!1;if(ek(t))return!0;if(t.$container)t=t.$container;else return!1}}function Lte(t){for(;;){if(ek(t))return!1;if(tk(t))
2842
- return!0;if(t.$container)t=t.$container;else return!1}}class Mte{parser;locator;constructor(e){this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getDocumentation(e){try{if(Kr(e)){const r=bt(e),n=this.parser.forDocument(r).parseDeploymentNode(e),i=[n.id];return n.title!==e.name&&i.push(" ",`**${n.title}**`),i.join(`
2838
+ return t[pp]}};function Bi(t){return t.textDocument.languageId===Vf.languageId?(yr(be(t.likec4ProjectId),`LikeC4Document must have projectId defined: ${t.uri.fsPath}`),!0):!1}function Ote(t){return Bi(t)&&t.state==Ue.Validated&&!!t.c4Specification&&!!t.c4Elements&&!!t.c4ExtendElements&&!!t.c4ExtendDeployments&&!!t.c4ExtendRelations&&!!t.c4Relations&&!!t.c4Views&&!!t.c4Deployments&&!!t.c4DeploymentRelations&&!!t.c4Imports}function zi(t){return t?.markdown||t?.text}function hO(t){const e=parseFloat(
2839
+ t);return isNaN(e)?100:UP(e,{min:0,max:100})}function mO({value:t}){return hO(t)}function ll({value:t}){switch(t){case"xs":case"sm":case"md":case"lg":case"xl":return t;case"xsmall":return"xs";case"small":return"sm";case"medium":return"md";case"large":return"lg";case"xlarge":return"xl";default:js(t)}}function YR(t,e){const r={};if(!t||t.length===0)return r;for(const n of t)if(e(n))switch(!0){case uo(n):{const i=hp(n);be(i)&&(r.color=i);break}case Vd(n):{r.line=n.value;break}case md(n):{switch(n.key){case"\
2840
+ head":{r.head=n.value;break}case"tail":{r.tail=n.value;break}default:js(n)}break}default:js(n)}return r}function hp(t){return t?.themeColor??t?.customColor?.$refText}function XR(t){const e=t.rankSep,r=t.nodeSep;let n;switch(t.direction){case"TopBottom":{n="TB";break}case"BottomTop":{n="BT";break}case"LeftRight":{n="LR";break}case"RightLeft":{n="RL";break}default:js(t.direction)}return{direction:n,...r&&{nodeSep:r},...e&&{rankSep:e}}}function Lte(t){switch(t){case"TB":return"TopBottom";case"BT":return"\
2841
+ BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:js(t)}}function Py(t){return hn(t,e=>Pf(e)||Ec(e)||Fx(e))}const QR=t=>Kx(t)||Xm(t)||sg(t)||X0(t)||Zm(t)||Y0(t),ek=t=>Zx(t)||W0(t)||Mx(t)||e_(t)||Lx(t);function Mte(t){for(;;){if(ek(t)||QR(t))return!1;if(n_(t)||Xd(t))return!0;if(t.$container)t=t.$container;else return!1}}function jte(t){for(;;){if(ek(t))return!1;if(QR(t))return!0;if(t.$container)t=t.$container;else return!1}}function qte(t){for(;;){if(QR(t))return!1;if(ek(t))
2842
+ return!0;if(t.$container)t=t.$container;else return!1}}class Fte{parser;locator;constructor(e){this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getDocumentation(e){try{if(Kr(e)){const r=bt(e),n=this.parser.forDocument(r).parseDeploymentNode(e),i=[n.id];return n.title!==e.name&&i.push(" ",`**${n.title}**`),i.join(`
2843
2843
  `)}if(un(e)){const r=bt(e),n=this.parser.forDocument(r).parseDeployedInstance(e),[i,s]=Dt.isImportRef(n.element)?[n.element.project,n.element.model]:[r.likec4ProjectId,n.element.model],a=i?this.locator.getParsedElement(s,i):this.locator.getParsedElement(s),o=[n.id,`_instance of_ ${s}`];return a&&o.push(" ",`**${a.title}**`),o.join(`
2844
2844
  `)}if(Ar(e)){const r=bt(e),n=this.parser.forDocument(r).parseElement(e);return n?[n.id," ",`**${n.title}**`].join(`
2845
- `):void 0}}catch(r){nt(r)}}}function jte(t,e){return[t,e]=rk(t,e)>0?[e,t]:[t,e],qte(t.range,e.range.start)}function rk(t,e){const r=t.range.start.line-e.range.start.line;return r!==0?r:t.range.start.character-e.range.start.character}function qte(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 ul(t){return!!t&&t.range.start.line!=t.range.end.line}const fe={newLine:Un.newLine({allowMore:!0}),
2846
- oneSpace:Un.oneSpace(),noSpace:Un.noSpace(),indent:Un.indent({allowMore:!0}),noIndent:Un.noIndent()};class Fte extends wK{options={quoteStyle:"auto"};extendedFormattingCommands=[];constructor(e){super(),e.shared.workspace.ConfigurationProvider.onConfigurationSectionUpdate(r=>this.onConfigurationUpdate(r.configuration.formatting))}doDocumentFormat(e,r,n){this.extendedFormattingCommands=[];const i=super.doDocumentFormat(e,r,n);return this.doExtendedFormatting(i),i}format(e){this.removeIndentFromTopLevelStatements(
2845
+ `):void 0}}catch(r){nt(r)}}}function Hte(t,e){return[t,e]=tk(t,e)>0?[e,t]:[t,e],Bte(t.range,e.range.start)}function tk(t,e){const r=t.range.start.line-e.range.start.line;return r!==0?r:t.range.start.character-e.range.start.character}function Bte(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 ul(t){return!!t&&t.range.start.line!=t.range.end.line}const fe={newLine:Un.newLine({allowMore:!0}),
2846
+ oneSpace:Un.oneSpace(),noSpace:Un.noSpace(),indent:Un.indent({allowMore:!0}),noIndent:Un.noIndent()};class zte extends wK{options={quoteStyle:"auto"};extendedFormattingCommands=[];constructor(e){super(),e.shared.workspace.ConfigurationProvider.onConfigurationSectionUpdate(r=>this.onConfigurationUpdate(r.configuration.formatting))}doDocumentFormat(e,r,n){this.extendedFormattingCommands=[];const i=super.doDocumentFormat(e,r,n);return this.doExtendedFormatting(i),i}format(e){this.removeIndentFromTopLevelStatements(
2847
2847
  e),this.indentContentInBraces(e),this.normalizeQuotes(e),this.formatImports(e),this.formatSpecificationRule(e),this.formatGlobals(e),this.formatElementDeclaration(e),this.formatExtendElement(e),this.formatRelation(e),this.formatMetadataProperty(e),this.formatDeploymentNodeDeclaration(e),this.formatDeployedInstance(e),this.formatDeploymentRelation(e),this.formatExtendDeployment(e),this.formatView(e),this.formatViewRuleGroup(e),this.formatViewRuleGlobalStyle(e),this.formatViewRuleGlobalPredicate(e),
2848
2848
  this.formatIncludeExcludeExpressions(e),this.formatWhereExpression(e),this.formatWhereRelationExpression(e),this.formatWhereElementExpression(e),this.formatRelationExpression(e),this.formatAutolayoutProperty(e),this.formatWithPredicate(e),this.formatViewRuleStyle(e),this.formatLeafProperty(e),this.formatLinkProperty(e),this.formatNavigateToProperty(e),this.formatTags(e)}formatTags(e){this.on(e,nI,(r,n)=>{const i=rc(r.$cstNode,"values").filter(be).slice(1);n.cst(i).prepend(fe.oneSpace),n.keywords(
2849
2849
  ",").prepend(fe.noSpace).append(fe.oneSpace)})}formatDeploymentRelation(e){this.on(e,ui,(r,n)=>{const i=r?.source?.$cstNode?[r?.source?.$cstNode]:[];n.cst(i).append(fe.oneSpace),n.keywords("]->").prepend(fe.noSpace),n.keywords("-[").append(fe.noSpace),n.nodes(...Qe([r.target,r.tags],be)).prepend(fe.oneSpace),n.properties("title","description","technology").prepend(fe.oneSpace)})}formatExtendDeployment(e){this.on(e,Xs,(r,n)=>{n.keywords("extend").append(fe.oneSpace)})}formatRelation(e){this.on(e,
2850
2850
  r=>Mi(r)||ui(r),(r,n)=>{const i=r?.source?.$cstNode?[r?.source?.$cstNode]:[];n.cst(i).append(fe.oneSpace),n.keywords("]->").prepend(fe.noSpace),n.keywords("-[").append(fe.noSpace),n.nodes(...Qe([r.target,r.tags],be)).prepend(fe.oneSpace),n.properties("title","description","technology").prepend(fe.oneSpace)}),this.on(e,Tm,(r,n)=>{n.keywords("->","<-").surround(fe.oneSpace),n.property("dotKind").prepend(fe.oneSpace).append(fe.oneSpace),n.keywords("]->").prepend(fe.noSpace).append(fe.oneSpace),n.keywords(
2851
2851
  "-[").prepend(fe.oneSpace).append(fe.noSpace),n.properties("title").prepend(fe.oneSpace),(m_(r)&&ul(r.$cstNode)||Uf(r)&&m_(r.$container)&&ul(r.$container.$cstNode))&&(n.property("dotKind").prepend(Un.indent({allowLess:!1,allowMore:!0,priority:2})),n.keywords("->","-[").prepend(Un.indent({allowLess:!1,allowMore:!0,priority:2})),r.custom?.$cstNode&&ul(r.custom.$cstNode)&&n.property("custom").prepend({options:{allowLess:!1,allowMore:!0,priority:2},moves:[{tabs:1}]}))})}removeIndentFromTopLevelStatements(e){
2852
2852
  Gx(e.$container)&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib","global","deployments","import").prepend(fe.noIndent)}indentContentInBraces(e){if(ZK(e)||eI(e)||Fc(e)||Bc(e)||jc(e)||n_(e)||Ic(e)||mo(e)||Md(e)||Ld(e)||mo(e)||Kx(e)||Xm(e)||sg(e)||QK(e)||kg(e)||XK(e)||Xd(e)||X0(e)||Zm(e)||W0(e)||Vc(e)||Tf(e)||FK(e)||HK(e)||Ad(e)||Z0(e)||Zx(e)||Mx(e)||zK(e)||Lx(e)||e_(e)){const r=this.getNodeFormatter(e),n=r.keywords("{");n.prepend(fe.noIndent).prepend(fe.oneSpace);const i=ul(
2853
- e.$cstNode),s=r.keywords("}"),a=r.interior(n,s);let o=null;for(const c of a.nodes){if(!i){r.cst([c]).surround(fe.oneSpace);continue}(!o||!jte(o,c))&&r.cst([c]).prepend(Un.newLine({allowMore:!0})).prepend(fe.indent),o=c}i?s.prepend(fe.noIndent).prepend(Un.newLine({allowMore:!0})):s.prepend(Un.oneSpace({allowLess:!0}))}}appendKeywordsWithSpace(e){this.on(e,Hx)?.keywords("element").append(fe.oneSpace)}formatView(e){this.on(e,eg,(r,n)=>{(r.extends||r.viewOf||r.name)&&n.keywords("view").append(fe.oneSpace),
2853
+ e.$cstNode),s=r.keywords("}"),a=r.interior(n,s);let o=null;for(const c of a.nodes){if(!i){r.cst([c]).surround(fe.oneSpace);continue}(!o||!Hte(o,c))&&r.cst([c]).prepend(Un.newLine({allowMore:!0})).prepend(fe.indent),o=c}i?s.prepend(fe.noIndent).prepend(Un.newLine({allowMore:!0})):s.prepend(Un.oneSpace({allowLess:!0}))}}appendKeywordsWithSpace(e){this.on(e,Hx)?.keywords("element").append(fe.oneSpace)}formatView(e){this.on(e,eg,(r,n)=>{(r.extends||r.viewOf||r.name)&&n.keywords("view").append(fe.oneSpace),
2854
2854
  n.keywords("of","extends").surround(fe.oneSpace)}),this.on(e,G0)?.keywords("dynamic","view").append(fe.oneSpace),this.on(e,jx)?.keywords("deployment","view").append(fe.oneSpace)}formatLeafProperty(e){if(Pd(e)||df(e)||xg(e)||Lc(e)||s_(e)||Xx(e)||Qx(e)||uo(e)||Vd(e)||md(e)||go(e)||Sg(e)||Fm(e)||wg(e)||i_(e)||l_(e)||a_(e)||d_(e)){const r=this.getNodeFormatter(e),n=r.keyword(":"),i=r.keywords("title","description","technology","summary","notation","notes","color","line","head","tail","icon","shape",
2855
2855
  "border","opacity","multiple","size","padding","textSize");n.nodes.length===0?i.append(fe.oneSpace):n.prepend(fe.noSpace).append(fe.oneSpace),r.keyword(";").prepend(fe.noSpace).append(fe.newLine)}}formatLinkProperty(e){this.on(e,Gd,(r,n)=>{n.keyword("link").append(fe.oneSpace),n.property("value").append(fe.oneSpace),n.keyword(":").prepend(fe.noSpace).append(fe.oneSpace),n.keyword(";").prepend(fe.noSpace).append(fe.newLine)})}formatNavigateToProperty(e){this.on(e,vg)?.property("key").append(fe.oneSpace)}formatAutolayoutProperty(e){
2856
- this.on(e,Rf,(r,n)=>{n.keyword("autoLayout").append(fe.oneSpace),n.property("rankSep").prepend(fe.oneSpace),n.property("nodeSep").prepend(fe.oneSpace)})}formatMetadataProperty(e){this.on(e,YK,(r,n)=>{n.property("key").append(fe.oneSpace),n.keyword(":").prepend(fe.noSpace).append(fe.oneSpace),n.keyword(";").prepend(fe.noSpace).append(fe.newLine)})}formatElementDeclaration(e){this.on(e,Ar,(r,n)=>{const i=Dr(r.$cstNode,"kind"),s=Dr(r.$cstNode,"name");s&&i&&(rk(s,i)>0?n.cst([i]).append(fe.oneSpace):
2856
+ this.on(e,Rf,(r,n)=>{n.keyword("autoLayout").append(fe.oneSpace),n.property("rankSep").prepend(fe.oneSpace),n.property("nodeSep").prepend(fe.oneSpace)})}formatMetadataProperty(e){this.on(e,YK,(r,n)=>{n.property("key").append(fe.oneSpace),n.keyword(":").prepend(fe.noSpace).append(fe.oneSpace),n.keyword(";").prepend(fe.noSpace).append(fe.newLine)})}formatElementDeclaration(e){this.on(e,Ar,(r,n)=>{const i=Dr(r.$cstNode,"kind"),s=Dr(r.$cstNode,"name");s&&i&&(tk(s,i)>0?n.cst([i]).append(fe.oneSpace):
2857
2857
  (n.cst([s]).append(fe.oneSpace),n.cst([i]).prepend(fe.oneSpace))),n.properties("props").prepend(fe.oneSpace)})}formatExtendElement(e){this.on(e,ho,(r,n)=>{n.keywords("extend").append(fe.oneSpace)})}formatGlobals(e){this.on(e,Ic,(r,n)=>{n.keyword("style").append(fe.oneSpace),n.property("id").append(fe.oneSpace)}),this.on(e,mo,(r,n)=>{n.keyword("styleGroup").append(fe.oneSpace)}),this.on(e,Md,(r,n)=>{n.keyword("predicateGroup").append(fe.oneSpace)}),this.on(e,Ld,(r,n)=>{n.keyword("dynamicPredicate\
2858
2858
  Group").append(fe.oneSpace)})}formatImports(e){this.on(e,Hd,(r,n)=>{n.keyword("import").append(fe.oneSpace),n.keywords("{","}","from").surround(fe.oneSpace)}),this.on(e,Li,(r,n)=>{n.keywords(",").prepend(fe.noSpace).append(fe.oneSpace)})}formatSpecificationRule(e){if((Fc(e)||Bc(e)||vf(e)||jc(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag","deploymentNode").append(fe.oneSpace),Tg(e)){const r=this.getNodeFormatter(e);r.keyword("color").append(fe.oneSpace),r.property("name").append(
2859
- fe.oneSpace)}}formatWithPredicate(e){(cg(e)||c_(e))&&this.getNodeFormatter(e).keyword("with").prepend(fe.oneSpace)}formatDeploymentNodeDeclaration(e){this.on(e,Kr,(r,n)=>{const i=Dr(r.$cstNode,"kind"),s=Dr(r.$cstNode,"name");s&&i&&(rk(s,i)>0?n.cst([i]).append(fe.oneSpace):(n.cst([s]).append(fe.oneSpace),n.cst([i]).prepend(fe.oneSpace))),n.properties("title").prepend(fe.oneSpace)})}formatDeployedInstance(e){this.on(e,un,(r,n)=>{const i=r.$cstNode?.content.find(s=>s.text==="=");i&&n.cst([i]).surround(
2859
+ fe.oneSpace)}}formatWithPredicate(e){(cg(e)||c_(e))&&this.getNodeFormatter(e).keyword("with").prepend(fe.oneSpace)}formatDeploymentNodeDeclaration(e){this.on(e,Kr,(r,n)=>{const i=Dr(r.$cstNode,"kind"),s=Dr(r.$cstNode,"name");s&&i&&(tk(s,i)>0?n.cst([i]).append(fe.oneSpace):(n.cst([s]).append(fe.oneSpace),n.cst([i]).prepend(fe.oneSpace))),n.properties("title").prepend(fe.oneSpace)})}formatDeployedInstance(e){this.on(e,un,(r,n)=>{const i=r.$cstNode?.content.find(s=>s.text==="=");i&&n.cst([i]).surround(
2860
2860
  fe.oneSpace),n.keyword("instanceOf").append(fe.oneSpace),n.property("title").prepend(fe.oneSpace)})}formatViewRuleGlobalStyle(e){this.on(e,h_,(r,n)=>{n.keywords("global","style").append(fe.oneSpace)})}formatViewRuleGlobalPredicate(e){const r=this.getNodeFormatter(e);(p_(e)||qx(e))&&r.keywords("global","predicate").append(fe.oneSpace)}formatViewRuleGroup(e){this.on(e,Tf,(r,n)=>{n.keyword("group").append(fe.oneSpace)})}formatViewRuleStyle(e){this.on(e,Vc)?.keyword("style").append(fe.oneSpace),this.
2861
2861
  on(e,_d)?.keyword("style").append(fe.oneSpace),this.on(e,Ux)?.keyword(",").prepend(fe.noSpace).append(fe.oneSpace),this.on(e,VK)?.keyword(",").prepend(fe.noSpace).append(fe.oneSpace)}formatWhereExpression(e){(o_(e)||r_(e))&&this.getNodeFormatter(e).keyword("where").append(fe.oneSpace)}formatWhereRelationExpression(e){if(this.on(e,jK,(r,n)=>{n.property("operator").surround(fe.oneSpace)}),this.on(e,aI,(r,n)=>{n.keyword("not").append(fe.oneSpace)}),Ox(e)||a7(e)||sI(e)){const r=this.getNodeFormatter(
2862
2862
  e);r.property("operator").surround(fe.oneSpace),r.property("not").surround(fe.oneSpace)}}formatWhereElementExpression(e){if(this.on(e,LK,(r,n)=>{n.property("operator").surround(fe.oneSpace)}),this.on(e,iI,(r,n)=>{n.keyword("not").append(fe.oneSpace)}),Nx(e)||s7(e)||i7(e)){const r=this.getNodeFormatter(e);r.property("operator").surround(fe.oneSpace),r.property("not").surround(fe.oneSpace)}}formatIncludeExcludeExpressions(e){if(O0(e)||Pf(e)||Ec(e)){const r=this.getNodeFormatter(e);(!e.$cstNode||!ul(
@@ -2864,71 +2864,72 @@ e.$cstNode))&&r.keywords("include","exclude").append(fe.oneSpace)}if(Ux(e)){cons
2864
2864
  n.keywords("-[").prepend(fe.oneSpace).append(fe.noSpace),n.keywords("]->").prepend(fe.noSpace).append(fe.oneSpace),n.property("dotKind").prepend(fe.oneSpace).append(fe.oneSpace)}),this.on(e,UK,(r,n)=>{n.property("target").prepend(fe.oneSpace)})}findPredicateExpressionRoot(e){let r=e.$container;for(;;){if(!r||O0(r)||Pf(r)||Ec(r))return r;r=r.$container}}on(e,r,n){const i=r(e)?this.getNodeFormatter(e):void 0;return n&&i&&n(e,i),i}doExtendedFormatting(e){const r=this.quotesNormalizerFactory(this.extendedFormattingCommands);
2865
2865
  for(let n of this.extendedFormattingCommands)switch(n.type){case"normalizeQuotes":r(n,e);break;default:lt(n.type)}}normalizeQuotes(e){if(this.options.quoteStyle==="ignore")return;let r=null;r=r??this.on(e,Ix)?.property("value"),r=r??this.on(e,Ar)?.properties("props"),r=r??this.on(e,Hd)?.properties("project"),r=r??this.on(e,Mi)?.properties("title","technology"),r=r??this.on(e,Tf)?.properties("title"),r=r??this.on(e,Tm)?.properties("title"),r=r??this.on(e,Kr)?.properties("title"),r=r??this.on(e,un)?.
2866
2866
  properties("title"),r=r??this.on(e,ui)?.properties("title","technology"),r=r??this.on(e,Gd)?.properties("title"),r&&this.extendedFormattingCommands.push({type:"normalizeQuotes",region:r})}quotesNormalizerFactory(e){const r=this.options.quoteStyle!="auto"?this.options.quoteStyle:this.getAutoQuoteStyle(e);return(n,i)=>{const s=r==="single"?'"':"'",a=r==="single"?"'":'"',o=a.repeat(3),c=a,l=n.region.nodes.map(u=>{const d=u.text.startsWith('"""')||u.text.startsWith("'''")?o:c;return{range:u.range,newText:d+
2867
- this.escapeQuotesInternalQuotes(u.text.slice(d.length,-d.length),s,a)+d}});i.push(...l)}}escapeQuotesInternalQuotes(e,r,n){let i="",s=0;for(;s>=0;){let a=e.indexOf(n,s);if(a<0){i+=e.slice(s);break}i+=e.slice(s,a),s=a+1;let o=!1;for(;a>0&&e[a-1]=="\\";)o=!o,a--;i+=o?n:`\\${n}`}return i}getAutoQuoteStyle(e){const r=e.flatMap(n=>n.region.nodes);return r.filter(n=>n.text[0]=='"').length*2>=r.length?"double":"single"}onConfigurationUpdate(e){this.options={...this.options,...e??{quoteStyle:"auto"}}}}class Hte extends kP{services;constructor(e){
2868
- super(e),this.services=e}createDescription(e,r,n){n??=bt(e);const i=super.createDescription(e,r,n);return yo(n.uri)||(n.likec4ProjectId??=this.services.shared.workspace.ProjectsManager.belongsTo(n),i.likec4ProjectId=n.likec4ProjectId),i}}class Bte extends SP{services;constructor(e){super(e),this.services=e}async updateContent(e,r){const n=this.services.workspace.ProjectsManager;e.likec4ProjectId=n.belongsTo(e),await super.updateContent(e,r)}projectElements(e,r,n){const i=this.services.workspace.
2869
- ProjectsManager;return at(this.symbolIndex.keys()).filter(s=>i.belongsTo(s)===e&&(!n||n.has(s))).flatMap(s=>this.getFileDescriptions(s,r))}}const zte=jS("/",!0),Ute=(t,e)=>zte(t.uri.path,e.uri.path),vO=t=>t.textDocument.languageId!==Vf.languageId||yo(t.uri);class Vte extends pP{services;compare=jS("/",!0);constructor(e){super(e),this.services=e}addDocument(e){const r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);const n=[...this.
2870
- documentMap.values(),e].sort(Ute);this.documentMap.clear();for(const i of n)this.documentMap.set(i.uri.toString(),i)}getDocument(e){const r=super.getDocument(e);if(r&&!vO(r)&&(r.likec4ProjectId??=this.services.workspace.ProjectsManager.belongsTo(r)),r&&!Bi(r))throw new Error(`Document ${r.uri.path} is not a LikeC4 document`);return r}get all(){return at(this.documentMap.values()).filter(e=>e.textDocument.languageId===Vf.languageId?(yo(e.uri)||(e.likec4ProjectId??=this.services.workspace.ProjectsManager.
2871
- belongsTo(e)),!0):!1)}get allExcludingBuiltin(){const e=this.services.workspace.ProjectsManager;return super.all.filter(r=>!vO(r)&&!e.isExcluded(r))}projectDocuments(e){return this.allExcludingBuiltin.filter(r=>r.likec4ProjectId===e)}groupedByProject(){return Vo(this.allExcludingBuiltin.toArray(),ci("likec4ProjectId"))}}var nk={},ik,wO;function Cy(){if(wO)return ik;wO=1;const t="\\\\/",e=`[^${t}]`,r="\\.",n="\\+",i="\\?",s="\\/",a="(?=.)",o="[^/]",c=`(?:${s}|$)`,l=`(?:^|${s})`,u=`${r}{1,2}${c}`,
2872
- d=`(?!${r})`,f=`(?!${l}${u})`,p=`(?!${r}{0,1}${c})`,w=`(?!${u})`,g=`[^.${s}]`,y=`${o}*?`,h={DOT_LITERAL:r,PLUS_LITERAL:n,QMARK_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:a,QMARK:o,END_ANCHOR:c,DOTS_SLASH:u,NO_DOT:d,NO_DOTS:f,NO_DOT_SLASH:p,NO_DOTS_SLASH:w,QMARK_NO_DOT:g,STAR:y,START_ANCHOR:l,SEP:"/"},v={...h,SLASH_LITERAL:`[${t}]`,QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`\
2873
- (?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},b={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return ik={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:b,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,
2874
- REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,
2875
- CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,
2876
- CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(_){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${_.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(_){return _===!0?v:h}},ik}var bO;function Ay(){return bO||(bO=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:n,
2877
- REGEX_SPECIAL_CHARS_GLOBAL:i}=Cy();t.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t.hasRegexChars=s=>n.test(s),t.isRegexChar=s=>s.length===1&&t.hasRegexChars(s),t.escapeRegex=s=>s.replace(i,"\\$1"),t.toPosixSlashes=s=>s.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},t.removeBackslashes=s=>s.replace(r,a=>a===
2878
- "\\"?"":a),t.escapeLast=(s,a,o)=>{const c=s.lastIndexOf(a,o);return c===-1?s:s[c-1]==="\\"?t.escapeLast(s,a,c-1):`${s.slice(0,c)}\\${s.slice(c)}`},t.removePrefix=(s,a={})=>{let o=s;return o.startsWith("./")&&(o=o.slice(2),a.prefix="./"),o},t.wrapOutput=(s,a={},o={})=>{const c=o.contains?"":"^",l=o.contains?"":"$";let u=`${c}(?:${s})${l}`;return a.negated===!0&&(u=`(?:^(?!${u}).*$)`),u},t.basename=(s,{windows:a}={})=>{const o=s.split(a?/[\\/]/:"/"),c=o[o.length-1];return c===""?o[o.length-2]:c}})(
2879
- nk)),nk}var sk,_O;function Wte(){if(_O)return sk;_O=1;const t=Ay(),{CHAR_ASTERISK:e,CHAR_AT:r,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:i,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:u,CHAR_PLUS:d,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:p,CHAR_RIGHT_PARENTHESES:w,CHAR_RIGHT_SQUARE_BRACKET:g}=Cy(),y=v=>v===o||v===n,m=v=>{v.isPrefix!==!0&&(v.depth=v.isGlobstar?1/0:1)};return sk=(v,b)=>{const _=b||{},R=v.length-1,$=_.parts===
2880
- !0||_.scanToEnd===!0,M=[],q=[],Z=[];let L=v,P=-1,T=0,B=0,H=!1,U=!1,G=!1,oe=!1,ne=!1,C=!1,F=!1,Y=!1,K=!1,S=!1,N=0,X,se,ue={value:"",depth:0,isGlob:!1};const _e=()=>P>=R,de=()=>L.charCodeAt(P+1),x=()=>(X=se,L.charCodeAt(++P));for(;P<R;){se=x();let Re;if(se===n){F=ue.backslashes=!0,se=x(),se===c&&(C=!0);continue}if(C===!0||se===c){for(N++;_e()!==!0&&(se=x());){if(se===n){F=ue.backslashes=!0,x();continue}if(se===c){N++;continue}if(C!==!0&&se===s&&(se=x())===s){if(H=ue.isBrace=!0,G=ue.isGlob=!0,S=!0,
2881
- $===!0)continue;break}if(C!==!0&&se===i){if(H=ue.isBrace=!0,G=ue.isGlob=!0,S=!0,$===!0)continue;break}if(se===p&&(N--,N===0)){C=!1,H=ue.isBrace=!0,S=!0;break}}if($===!0)continue;break}if(se===o){if(M.push(P),q.push(ue),ue={value:"",depth:0,isGlob:!1},S===!0)continue;if(X===s&&P===T+1){T+=2;continue}B=P+1;continue}if(_.noext!==!0&&(se===d||se===r||se===e||se===f||se===a)===!0&&de()===l){if(G=ue.isGlob=!0,oe=ue.isExtglob=!0,S=!0,se===a&&P===T&&(K=!0),$===!0){for(;_e()!==!0&&(se=x());){if(se===n){F=
2882
- ue.backslashes=!0,se=x();continue}if(se===w){G=ue.isGlob=!0,S=!0;break}}continue}break}if(se===e){if(X===e&&(ne=ue.isGlobstar=!0),G=ue.isGlob=!0,S=!0,$===!0)continue;break}if(se===f){if(G=ue.isGlob=!0,S=!0,$===!0)continue;break}if(se===u){for(;_e()!==!0&&(Re=x());){if(Re===n){F=ue.backslashes=!0,x();continue}if(Re===g){U=ue.isBracket=!0,G=ue.isGlob=!0,S=!0;break}}if($===!0)continue;break}if(_.nonegate!==!0&&se===a&&P===T){Y=ue.negated=!0,T++;continue}if(_.noparen!==!0&&se===l){if(G=ue.isGlob=!0,
2883
- $===!0){for(;_e()!==!0&&(se=x());){if(se===l){F=ue.backslashes=!0,se=x();continue}if(se===w){S=!0;break}}continue}break}if(G===!0){if(S=!0,$===!0)continue;break}}_.noext===!0&&(oe=!1,G=!1);let O=L,J="",z="";T>0&&(J=L.slice(0,T),L=L.slice(T),B-=T),O&&G===!0&&B>0?(O=L.slice(0,B),z=L.slice(B)):G===!0?(O="",z=L):O=L,O&&O!==""&&O!=="/"&&O!==L&&y(O.charCodeAt(O.length-1))&&(O=O.slice(0,-1)),_.unescape===!0&&(z&&(z=t.removeBackslashes(z)),O&&F===!0&&(O=t.removeBackslashes(O)));const ae={prefix:J,input:v,
2884
- start:T,base:O,glob:z,isBrace:H,isBracket:U,isGlob:G,isExtglob:oe,isGlobstar:ne,negated:Y,negatedExtglob:K};if(_.tokens===!0&&(ae.maxDepth=0,y(se)||q.push(ue),ae.tokens=q),_.parts===!0||_.tokens===!0){let Re;for(let Me=0;Me<M.length;Me++){const me=Re?Re+1:T,Ne=M[Me],pe=v.slice(me,Ne);_.tokens&&(Me===0&&T!==0?(q[Me].isPrefix=!0,q[Me].value=J):q[Me].value=pe,m(q[Me]),ae.maxDepth+=q[Me].depth),(Me!==0||pe!=="")&&Z.push(pe),Re=Ne}if(Re&&Re+1<v.length){const Me=v.slice(Re+1);Z.push(Me),_.tokens&&(q[q.
2885
- length-1].value=Me,m(q[q.length-1]),ae.maxDepth+=q[q.length-1].depth)}ae.slashes=M,ae.parts=Z}return ae},sk}var ak,RO;function Gte(){if(RO)return ak;RO=1;const t=Cy(),e=Ay(),{MAX_LENGTH:r,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=t,o=(u,d)=>{if(typeof d.expandRange=="function")return d.expandRange(...u,d);u.sort();const f=`[${u.join("-")}]`;try{new RegExp(f)}catch{return u.map(w=>e.escapeRegex(w)).join("..")}return f},c=(u,d)=>`Missing ${u}: "${d}\
2886
- " - use "\\\\${d}" to match literal characters`,l=(u,d)=>{if(typeof u!="string")throw new TypeError("Expected a string");u=a[u]||u;const f={...d},p=typeof f.maxLength=="number"?Math.min(r,f.maxLength):r;let w=u.length;if(w>p)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${p}`);const g={type:"bos",value:"",output:f.prepend||""},y=[g],m=f.capture?"":"?:",h=t.globChars(f.windows),v=t.extglobChars(h),{DOT_LITERAL:b,PLUS_LITERAL:_,SLASH_LITERAL:R,ONE_CHAR:$,DOTS_SLASH:M,NO_DOT:q,
2887
- NO_DOT_SLASH:Z,NO_DOTS_SLASH:L,QMARK:P,QMARK_NO_DOT:T,STAR:B,START_ANCHOR:H}=h,U=me=>`(${m}(?:(?!${H}${me.dot?M:b}).)*?)`,G=f.dot?"":q,oe=f.dot?P:T;let ne=f.bash===!0?U(f):B;f.capture&&(ne=`(${ne})`),typeof f.noext=="boolean"&&(f.noextglob=f.noext);const C={input:u,index:-1,start:0,dot:f.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};u=e.removePrefix(u,C),w=u.length;const F=[],Y=[],K=[];let S=g,N;const X=()=>C.index===
2888
- w-1,se=C.peek=(me=1)=>u[C.index+me],ue=C.advance=()=>u[++C.index]||"",_e=()=>u.slice(C.index+1),de=(me="",Ne=0)=>{C.consumed+=me,C.index+=Ne},x=me=>{C.output+=me.output!=null?me.output:me.value,de(me.value)},O=()=>{let me=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)ue(),C.start++,me++;return me%2===0?!1:(C.negated=!0,C.start++,!0)},J=me=>{C[me]++,K.push(me)},z=me=>{C[me]--,K.pop()},ae=me=>{if(S.type==="globstar"){const Ne=C.braces>0&&(me.type==="comma"||me.type==="brace"),pe=me.extglob===!0||
2889
- F.length&&(me.type==="pipe"||me.type==="paren");me.type!=="slash"&&me.type!=="paren"&&!Ne&&!pe&&(C.output=C.output.slice(0,-S.output.length),S.type="star",S.value="*",S.output=ne,C.output+=S.output)}if(F.length&&me.type!=="paren"&&(F[F.length-1].inner+=me.value),(me.value||me.output)&&x(me),S&&S.type==="text"&&me.type==="text"){S.output=(S.output||S.value)+me.value,S.value+=me.value;return}me.prev=S,y.push(me),S=me},Re=(me,Ne)=>{const pe={...v[Ne],conditions:1,inner:""};pe.prev=S,pe.parens=C.parens,
2890
- pe.output=C.output;const Se=(f.capture?"(":"")+pe.open;J("parens"),ae({type:me,value:Ne,output:C.output?"":$}),ae({type:"paren",extglob:!0,value:ue(),output:Se}),F.push(pe)},Me=me=>{let Ne=me.close+(f.capture?")":""),pe;if(me.type==="negate"){let Se=ne;if(me.inner&&me.inner.length>1&&me.inner.includes("/")&&(Se=U(f)),(Se!==ne||X()||/^\)+$/.test(_e()))&&(Ne=me.close=`)$))${Se}`),me.inner.includes("*")&&(pe=_e())&&/^\.[^\\/.]+$/.test(pe)){const Be=l(pe,{...d,fastpaths:!1}).output;Ne=me.close=`)${Be}\
2891
- )${Se})`}me.prev.type==="bos"&&(C.negatedExtglob=!0)}ae({type:"paren",extglob:!0,value:N,output:Ne}),z("parens")};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(u)){let me=!1,Ne=u.replace(s,(pe,Se,Be,tt,st,Jt)=>tt==="\\"?(me=!0,pe):tt==="?"?Se?Se+tt+(st?P.repeat(st.length):""):Jt===0?oe+(st?P.repeat(st.length):""):P.repeat(Be.length):tt==="."?b.repeat(Be.length):tt==="*"?Se?Se+tt+(st?ne:""):ne:Se?pe:`\\${pe}`);return me===!0&&(f.unescape===!0?Ne=Ne.replace(/\\/g,""):Ne=Ne.replace(/\\+/g,pe=>pe.
2892
- length%2===0?"\\\\":pe?"\\":"")),Ne===u&&f.contains===!0?(C.output=u,C):(C.output=e.wrapOutput(Ne,C,d),C)}for(;!X();){if(N=ue(),N==="\0")continue;if(N==="\\"){const pe=se();if(pe==="/"&&f.bash!==!0||pe==="."||pe===";")continue;if(!pe){N+="\\",ae({type:"text",value:N});continue}const Se=/^\\+/.exec(_e());let Be=0;if(Se&&Se[0].length>2&&(Be=Se[0].length,C.index+=Be,Be%2!==0&&(N+="\\")),f.unescape===!0?N=ue():N+=ue(),C.brackets===0){ae({type:"text",value:N});continue}}if(C.brackets>0&&(N!=="]"||S.value===
2893
- "["||S.value==="[^")){if(f.posix!==!1&&N===":"){const pe=S.value.slice(1);if(pe.includes("[")&&(S.posix=!0,pe.includes(":"))){const Se=S.value.lastIndexOf("["),Be=S.value.slice(0,Se),tt=S.value.slice(Se+2),st=n[tt];if(st){S.value=Be+st,C.backtrack=!0,ue(),!g.output&&y.indexOf(S)===1&&(g.output=$);continue}}}(N==="["&&se()!==":"||N==="-"&&se()==="]")&&(N=`\\${N}`),N==="]"&&(S.value==="["||S.value==="[^")&&(N=`\\${N}`),f.posix===!0&&N==="!"&&S.value==="["&&(N="^"),S.value+=N,x({value:N});continue}
2894
- if(C.quotes===1&&N!=='"'){N=e.escapeRegex(N),S.value+=N,x({value:N});continue}if(N==='"'){C.quotes=C.quotes===1?0:1,f.keepQuotes===!0&&ae({type:"text",value:N});continue}if(N==="("){J("parens"),ae({type:"paren",value:N});continue}if(N===")"){if(C.parens===0&&f.strictBrackets===!0)throw new SyntaxError(c("opening","("));const pe=F[F.length-1];if(pe&&C.parens===pe.parens+1){Me(F.pop());continue}ae({type:"paren",value:N,output:C.parens?")":"\\)"}),z("parens");continue}if(N==="["){if(f.nobracket===!0||
2895
- !_e().includes("]")){if(f.nobracket!==!0&&f.strictBrackets===!0)throw new SyntaxError(c("closing","]"));N=`\\${N}`}else J("brackets");ae({type:"bracket",value:N});continue}if(N==="]"){if(f.nobracket===!0||S&&S.type==="bracket"&&S.value.length===1){ae({type:"text",value:N,output:`\\${N}`});continue}if(C.brackets===0){if(f.strictBrackets===!0)throw new SyntaxError(c("opening","["));ae({type:"text",value:N,output:`\\${N}`});continue}z("brackets");const pe=S.value.slice(1);if(S.posix!==!0&&pe[0]==="\
2896
- ^"&&!pe.includes("/")&&(N=`/${N}`),S.value+=N,x({value:N}),f.literalBrackets===!1||e.hasRegexChars(pe))continue;const Se=e.escapeRegex(S.value);if(C.output=C.output.slice(0,-S.value.length),f.literalBrackets===!0){C.output+=Se,S.value=Se;continue}S.value=`(${m}${Se}|${S.value})`,C.output+=S.value;continue}if(N==="{"&&f.nobrace!==!0){J("braces");const pe={type:"brace",value:N,output:"(",outputIndex:C.output.length,tokensIndex:C.tokens.length};Y.push(pe),ae(pe);continue}if(N==="}"){const pe=Y[Y.length-
2897
- 1];if(f.nobrace===!0||!pe){ae({type:"text",value:N,output:N});continue}let Se=")";if(pe.dots===!0){const Be=y.slice(),tt=[];for(let st=Be.length-1;st>=0&&(y.pop(),Be[st].type!=="brace");st--)Be[st].type!=="dots"&&tt.unshift(Be[st].value);Se=o(tt,f),C.backtrack=!0}if(pe.comma!==!0&&pe.dots!==!0){const Be=C.output.slice(0,pe.outputIndex),tt=C.tokens.slice(pe.tokensIndex);pe.value=pe.output="\\{",N=Se="\\}",C.output=Be;for(const st of tt)C.output+=st.output||st.value}ae({type:"brace",value:N,output:Se}),
2898
- z("braces"),Y.pop();continue}if(N==="|"){F.length>0&&F[F.length-1].conditions++,ae({type:"text",value:N});continue}if(N===","){let pe=N;const Se=Y[Y.length-1];Se&&K[K.length-1]==="braces"&&(Se.comma=!0,pe="|"),ae({type:"comma",value:N,output:pe});continue}if(N==="/"){if(S.type==="dot"&&C.index===C.start+1){C.start=C.index+1,C.consumed="",C.output="",y.pop(),S=g;continue}ae({type:"slash",value:N,output:R});continue}if(N==="."){if(C.braces>0&&S.type==="dot"){S.value==="."&&(S.output=b);const pe=Y[Y.
2899
- length-1];S.type="dots",S.output+=N,S.value+=N,pe.dots=!0;continue}if(C.braces+C.parens===0&&S.type!=="bos"&&S.type!=="slash"){ae({type:"text",value:N,output:b});continue}ae({type:"dot",value:N,output:b});continue}if(N==="?"){if(!(S&&S.value==="(")&&f.noextglob!==!0&&se()==="("&&se(2)!=="?"){Re("qmark",N);continue}if(S&&S.type==="paren"){const Se=se();let Be=N;(S.value==="("&&!/[!=<:]/.test(Se)||Se==="<"&&!/<([!=]|\w+>)/.test(_e()))&&(Be=`\\${N}`),ae({type:"text",value:N,output:Be});continue}if(f.
2900
- dot!==!0&&(S.type==="slash"||S.type==="bos")){ae({type:"qmark",value:N,output:T});continue}ae({type:"qmark",value:N,output:P});continue}if(N==="!"){if(f.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){Re("negate",N);continue}if(f.nonegate!==!0&&C.index===0){O();continue}}if(N==="+"){if(f.noextglob!==!0&&se()==="("&&se(2)!=="?"){Re("plus",N);continue}if(S&&S.value==="("||f.regex===!1){ae({type:"plus",value:N,output:_});continue}if(S&&(S.type==="bracket"||S.type==="paren"||S.type===
2901
- "brace")||C.parens>0){ae({type:"plus",value:N});continue}ae({type:"plus",value:_});continue}if(N==="@"){if(f.noextglob!==!0&&se()==="("&&se(2)!=="?"){ae({type:"at",extglob:!0,value:N,output:""});continue}ae({type:"text",value:N});continue}if(N!=="*"){(N==="$"||N==="^")&&(N=`\\${N}`);const pe=i.exec(_e());pe&&(N+=pe[0],C.index+=pe[0].length),ae({type:"text",value:N});continue}if(S&&(S.type==="globstar"||S.star===!0)){S.type="star",S.star=!0,S.value+=N,S.output=ne,C.backtrack=!0,C.globstar=!0,de(N);
2902
- continue}let me=_e();if(f.noextglob!==!0&&/^\([^?]/.test(me)){Re("star",N);continue}if(S.type==="star"){if(f.noglobstar===!0){de(N);continue}const pe=S.prev,Se=pe.prev,Be=pe.type==="slash"||pe.type==="bos",tt=Se&&(Se.type==="star"||Se.type==="globstar");if(f.bash===!0&&(!Be||me[0]&&me[0]!=="/")){ae({type:"star",value:N,output:""});continue}const st=C.braces>0&&(pe.type==="comma"||pe.type==="brace"),Jt=F.length&&(pe.type==="pipe"||pe.type==="paren");if(!Be&&pe.type!=="paren"&&!st&&!Jt){ae({type:"\
2903
- star",value:N,output:""});continue}for(;me.slice(0,3)==="/**";){const Ht=u[C.index+4];if(Ht&&Ht!=="/")break;me=me.slice(3),de("/**",3)}if(pe.type==="bos"&&X()){S.type="globstar",S.value+=N,S.output=U(f),C.output=S.output,C.globstar=!0,de(N);continue}if(pe.type==="slash"&&pe.prev.type!=="bos"&&!tt&&X()){C.output=C.output.slice(0,-(pe.output+S.output).length),pe.output=`(?:${pe.output}`,S.type="globstar",S.output=U(f)+(f.strictSlashes?")":"|$)"),S.value+=N,C.globstar=!0,C.output+=pe.output+S.output,
2904
- de(N);continue}if(pe.type==="slash"&&pe.prev.type!=="bos"&&me[0]==="/"){const Ht=me[1]!==void 0?"|$":"";C.output=C.output.slice(0,-(pe.output+S.output).length),pe.output=`(?:${pe.output}`,S.type="globstar",S.output=`${U(f)}${R}|${R}${Ht})`,S.value+=N,C.output+=pe.output+S.output,C.globstar=!0,de(N+ue()),ae({type:"slash",value:"/",output:""});continue}if(pe.type==="bos"&&me[0]==="/"){S.type="globstar",S.value+=N,S.output=`(?:^|${R}|${U(f)}${R})`,C.output=S.output,C.globstar=!0,de(N+ue()),ae({type:"\
2905
- slash",value:"/",output:""});continue}C.output=C.output.slice(0,-S.output.length),S.type="globstar",S.output=U(f),S.value+=N,C.output+=S.output,C.globstar=!0,de(N);continue}const Ne={type:"star",value:N,output:ne};if(f.bash===!0){Ne.output=".*?",(S.type==="bos"||S.type==="slash")&&(Ne.output=G+Ne.output),ae(Ne);continue}if(S&&(S.type==="bracket"||S.type==="paren")&&f.regex===!0){Ne.output=N,ae(Ne);continue}(C.index===C.start||S.type==="slash"||S.type==="dot")&&(S.type==="dot"?(C.output+=Z,S.output+=
2906
- Z):f.dot===!0?(C.output+=L,S.output+=L):(C.output+=G,S.output+=G),se()!=="*"&&(C.output+=$,S.output+=$)),ae(Ne)}for(;C.brackets>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing","]"));C.output=e.escapeLast(C.output,"["),z("brackets")}for(;C.parens>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing",")"));C.output=e.escapeLast(C.output,"("),z("parens")}for(;C.braces>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing","}"));C.output=e.escapeLast(C.output,"{"),z("\
2907
- braces")}if(f.strictSlashes!==!0&&(S.type==="star"||S.type==="bracket")&&ae({type:"maybe_slash",value:"",output:`${R}?`}),C.backtrack===!0){C.output="";for(const me of C.tokens)C.output+=me.output!=null?me.output:me.value,me.suffix&&(C.output+=me.suffix)}return C};return l.fastpaths=(u,d)=>{const f={...d},p=typeof f.maxLength=="number"?Math.min(r,f.maxLength):r,w=u.length;if(w>p)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${p}`);u=a[u]||u;const{DOT_LITERAL:g,SLASH_LITERAL:y,
2908
- ONE_CHAR:m,DOTS_SLASH:h,NO_DOT:v,NO_DOTS:b,NO_DOTS_SLASH:_,STAR:R,START_ANCHOR:$}=t.globChars(f.windows),M=f.dot?b:v,q=f.dot?_:v,Z=f.capture?"":"?:",L={negated:!1,prefix:""};let P=f.bash===!0?".*?":R;f.capture&&(P=`(${P})`);const T=G=>G.noglobstar===!0?P:`(${Z}(?:(?!${$}${G.dot?h:g}).)*?)`,B=G=>{switch(G){case"*":return`${M}${m}${P}`;case".*":return`${g}${m}${P}`;case"*.*":return`${M}${P}${g}${m}${P}`;case"*/*":return`${M}${P}${y}${m}${q}${P}`;case"**":return M+T(f);case"**/*":return`(?:${M}${T(
2909
- f)}${y})?${q}${m}${P}`;case"**/*.*":return`(?:${M}${T(f)}${y})?${q}${P}${g}${m}${P}`;case"**/.*":return`(?:${M}${T(f)}${y})?${g}${m}${P}`;default:{const oe=/^(.*?)\.(\w+)$/.exec(G);if(!oe)return;const ne=B(oe[1]);return ne?ne+g+oe[2]:void 0}}},H=e.removePrefix(u,L);let U=B(H);return U&&f.strictSlashes!==!0&&(U+=`${y}?`),U},ak=l,ak}var ok,kO;function Kte(){if(kO)return ok;kO=1;const t=Wte(),e=Gte(),r=Ay(),n=Cy(),i=a=>a&&typeof a=="object"&&!Array.isArray(a),s=(a,o,c=!1)=>{if(Array.isArray(a)){const y=a.
2910
- map(h=>s(h,o,c));return h=>{for(const v of y){const b=v(h);if(b)return b}return!1}}const l=i(a)&&a.tokens&&a.input;if(a===""||typeof a!="string"&&!l)throw new TypeError("Expected pattern to be a non-empty string");const u=o||{},d=u.windows,f=l?s.compileRe(a,o):s.makeRe(a,o,!1,!0),p=f.state;delete f.state;let w=()=>!1;if(u.ignore){const y={...o,ignore:null,onMatch:null,onResult:null};w=s(u.ignore,y,c)}const g=(y,m=!1)=>{const{isMatch:h,match:v,output:b}=s.test(y,f,o,{glob:a,posix:d}),_={glob:a,state:p,
2911
- regex:f,posix:d,input:y,output:b,match:v,isMatch:h};return typeof u.onResult=="function"&&u.onResult(_),h===!1?(_.isMatch=!1,m?_:!1):w(y)?(typeof u.onIgnore=="function"&&u.onIgnore(_),_.isMatch=!1,m?_:!1):(typeof u.onMatch=="function"&&u.onMatch(_),m?_:!0)};return c&&(g.state=p),g};return s.test=(a,o,c,{glob:l,posix:u}={})=>{if(typeof a!="string")throw new TypeError("Expected input to be a string");if(a==="")return{isMatch:!1,output:""};const d=c||{},f=d.format||(u?r.toPosixSlashes:null);let p=a===
2912
- l,w=p&&f?f(a):a;return p===!1&&(w=f?f(a):a,p=w===l),(p===!1||d.capture===!0)&&(d.matchBase===!0||d.basename===!0?p=s.matchBase(a,o,c,u):p=o.exec(w)),{isMatch:!!p,match:p,output:w}},s.matchBase=(a,o,c)=>(o instanceof RegExp?o:s.makeRe(o,c)).test(r.basename(a)),s.isMatch=(a,o,c)=>s(o,c)(a),s.parse=(a,o)=>Array.isArray(a)?a.map(c=>s.parse(c,o)):e(a,{...o,fastpaths:!1}),s.scan=(a,o)=>t(a,o),s.compileRe=(a,o,c=!1,l=!1)=>{if(c===!0)return a.output;const u=o||{},d=u.contains?"":"^",f=u.contains?"":"$";
2913
- let p=`${d}(?:${a.output})${f}`;a&&a.negated===!0&&(p=`^(?!${p}).*$`);const w=s.toRegex(p,o);return l===!0&&(w.state=a),w},s.makeRe=(a,o={},c=!1,l=!1)=>{if(!a||typeof a!="string")throw new TypeError("Expected a non-empty string");let u={negated:!1,fastpaths:!0};return o.fastpaths!==!1&&(a[0]==="."||a[0]==="*")&&(u.output=e.fastpaths(a,o)),u.output||(u=e(a,o)),s.compileRe(u,o,c,l)},s.toRegex=(a,o)=>{try{const c=o||{};return new RegExp(a,c.flags||(c.nocase?"i":""))}catch(c){if(o&&o.debug===!0)throw c;
2914
- return/$^/}},s.constants=n,ok=s,ok}var ck,SO;function Zte(){if(SO)return ck;SO=1;const t=Kte(),e=Ay();function r(n,i,s=!1){return i&&(i.windows===null||i.windows===void 0)&&(i={...i,windows:e.isWindows()}),t(n,i,s)}return Object.assign(r,t),ck=r,ck}var Jte=Zte();const lk=Ks(Jte),Yte=/#/g,Xte=/&/g,Qte=/\//g,ere=/=/g,uk=/\+/g,tre=/%5e/gi,rre=/%60/gi,nre=/%7c/gi,ire=/%20/gi;function sre(t){return encodeURI(""+t).replace(nre,"|")}function dk(t){return sre(typeof t=="string"?t:JSON.stringify(t)).replace(
2915
- uk,"%2B").replace(ire,"+").replace(Yte,"%23").replace(Xte,"%26").replace(rre,"`").replace(tre,"^").replace(Qte,"%2F")}function fk(t){return dk(t).replace(ere,"%3D")}function EO(t=""){try{return decodeURIComponent(""+t)}catch{return""+t}}function are(t){return EO(t.replace(uk," "))}function ore(t){return EO(t.replace(uk," "))}function cre(t=""){const e=Object.create(null);t[0]==="?"&&(t=t.slice(1));for(const r of t.split("&")){const n=r.match(/([^=]+)=?(.*)/)||[];if(n.length<2)continue;const i=are(
2916
- n[1]);if(i==="__proto__"||i==="constructor")continue;const s=ore(n[2]||"");e[i]===void 0?e[i]=s:Array.isArray(e[i])?e[i].push(s):e[i]=[e[i],s]}return e}function lre(t,e){return(typeof e=="number"||typeof e=="boolean")&&(e=String(e)),e?Array.isArray(e)?e.map(r=>`${fk(t)}=${dk(r)}`).join("&"):`${fk(t)}=${dk(e)}`:fk(t)}function ure(t){return Object.keys(t).filter(e=>t[e]!==void 0).map(e=>lre(e,t[e])).filter(Boolean).join("&")}const dre=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,TO=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,
2917
- fre=/^([/\\]\s*){2,}[^/\\]/,pre=/^\.?\//;function pk(t){return["./","../"].some(e=>t.startsWith(e))}function dl(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?dre.test(t):TO.test(t)||(e.acceptRelative?fre.test(t):!1)}function hre(t="",e){return t.endsWith("/")}function mre(t="",e){return(hre(t)?t.slice(0,-1):t)||"/"}function xy(t="",e){return t.endsWith("/")?t:t+"/"}function mp(t=""){return t.startsWith("/")}function $O(t=""){return(mp(t)?t.slice(1):t)||"/"}function gre(t=""){
2918
- return mp(t)?t:"/"+t}function yre(t,e){if(wre(e))return t;const r=mre(e);if(!t.startsWith(r))return t;const n=t.slice(r.length);return n[0]==="/"?n:"/"+n}function vre(t,e){const r=AO(t),n={...cre(r.search),...e};return r.search=ure(n),Rre(r)}function wre(t){return!t||t==="/"}function bre(t){return t&&t!=="/"}function Iy(t,...e){let r=t||"";for(const n of e.filter(i=>bre(i)))if(r){const i=n.replace(pre,"");r=xy(r)+i}else r=n;return r}function fl(...t){const e=/\/(?!\/)/,r=t.filter(Boolean),n=[];let i=0;
2919
- for(const a of r)if(!(!a||a==="/")){for(const[o,c]of a.split(e).entries())if(!(!c||c===".")){if(c===".."){if(n.length===1&&dl(n[0]))continue;n.pop(),i--;continue}if(o===1&&n[n.length-1]?.endsWith(":/")){n[n.length-1]+="/"+c;continue}n.push(c),i++}}let s=n.join("/");return i>=0?r[0]?.startsWith("/")&&!s.startsWith("/")?s="/"+s:r[0]?.startsWith("./")&&!s.startsWith("./")&&(s="./"+s):s="../".repeat(-1*i)+s,r[r.length-1]?.endsWith("/")&&!s.endsWith("/")&&(s+="/"),s}function PO(t){return _re(t,"")}function _re(t,e){
2920
- let r=t.match(TO);return r||(r=t.match(/^\/{2,}/)),r?e+t.slice(r[0].length):e+t}const CO=Symbol.for("ufo:protocolRelative");function AO(t="",e){const r=t.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(r){const[,d,f=""]=r;return{protocol:d.toLowerCase(),pathname:f,href:d+f,auth:"",host:"",search:"",hash:""}}if(!dl(t,{acceptRelative:!0}))return xO(t);const[,n="",i,s=""]=t.replace(/\\/g,"/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[];let[,a="",o=""]=s.match(/([^#/?]*)(.*)?/)||
2921
- [];n==="file:"&&(o=o.replace(/\/(?=[A-Za-z]:)/,""));const{pathname:c,search:l,hash:u}=xO(o);return{protocol:n.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):"",host:a,pathname:c,search:l,hash:u,[CO]:!n}}function xO(t=""){const[e="",r="",n=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:r,hash:n}}function Rre(t){const e=t.pathname||"",r=t.search?(t.search.startsWith("?")?"":"?")+t.search:"",n=t.hash||"",i=t.auth?t.auth+"@":"",s=t.host||"";return(t.protocol||
2922
- t[CO]?(t.protocol||"")+"//":"")+i+s+e+r+n}const kre=/\/([^/]+)$/;function Sre(t="",e){const{pathname:r}=AO(t),n=r.match(kre);return n?n[1]:void 0}const Ct=Fe.getChild("ProjectsManager");function Ny(t){return ct.isUri(t)?t.toString():typeof t=="string"?t.startsWith("file://")?t:ct.file(t).toString():t.uri.toString()}function hk(t){return t=Ny(t),xy(t)}const Zn={id:"default",config:{name:"default",exclude:["**/node_modules/**"]},exclude:lk("**/node_modules/**",{dot:!0}),includeConfig:{paths:[],maxDepth:3,
2923
- fileThreshold:30}};class In{services;static DefaultProjectId=Zn.id;#e=void 0;#t=void 0;#r=new C2;#n=[];#s=new WeakMap;constructor(e){this.services=e,Ct.debug`created`}get defaultProjectId(){if(this.#e)return this.#e;if(!(this.#n.length>1))return this.#n[0]?.id??In.DefaultProjectId}set defaultProjectId(e){if(e!==this.#e){if(this.#t=void 0,!e||e===In.DefaultProjectId){Ct.debug`reset default project ID`,this.#e=void 0;return}fr(this.#n.find(r=>r.id===e),`Project "${e}" not found`),Ct.debug`set default project ID to ${e}`,
2924
- this.#e=e}}get default(){if(!this.#t){const e=this.defaultProjectId??In.DefaultProjectId;let r=this.#n.find(n=>n.id===e);if(!r){const n=this.getWorkspaceFolder();r={id:e,config:Zn.config,folder:hk(n),folderUri:n,exclude:Zn.exclude,includeConfig:Zn.includeConfig}}this.#t=r}return this.#t}get all(){if(Ir(this.#n,1)){const e=[...qt(this.#n,ci("id")),Zn.id];if(this.#e){const r=e.findIndex(n=>n===this.#e);if(r>0){const[n]=e.splice(r,1);return[n,...e]}}return e}return[Zn.id]}getProject(e){const r=typeof e==
2925
- "string"?e:e.likec4ProjectId||this.belongsTo(e);if(r===Zn.id){let i;try{i=this.services.workspace.WorkspaceManager.workspaceUri}catch(s){Ct.warn("Failed to get workspace URI, using default folder",{error:s}),i=ct.file("/")}return{id:In.DefaultProjectId,config:Zn.config,folderUri:i}}const n=On(this.#n.find(i=>i.id===r),`Project "${r}" not found`);return{id:r,folderUri:n.folderUri,config:n.config,...n.includePaths&&{includePaths:n.includePaths.map(i=>i.uri)}}}ensureProjectId(e){return e===In.DefaultProjectId?
2926
- this.defaultProjectId??In.DefaultProjectId:e?(fr(this.#r.has(e),`Project ID ${e} is not registered`),e):On(this.defaultProjectId,()=>`Specify exact project, known: [${[...this.#r.keys()].join(", ")}]`)}ensureProject(e){return e=this.ensureProjectId(e),this.getProject(e)}hasMultipleProjects(){return this.#n.length>1}isExcluded(e){if(typeof e=="string"||ct.isUri(e)){let n=Ny(e);const i=this.findProjectForDocument(n);return i.exclude?i.exclude(PO(n)):!1}let r=this.#s.get(e);return r===void 0&&(r=this.
2927
- isExcluded(e.uri),this.#s.set(e,r)),r}isConfigFile(e){const r=Sre(e.toString())?.toLowerCase(),n=!!r&&Rl(r);return n&&Zn.exclude(e.path)?(Ct.debug`exclude config file ${e.path}`,!1):n}async registerConfigFile(e){if(Zn.exclude(e.path))throw new Error(`Path to ${e.fsPath} is excluded by: ${Zn.config.exclude.join(", ")}`);if(!this.isConfigFile(e))throw new Error(`${e.fsPath} is not a valid LikeC4 config filename.`);try{const r=await this.services.workspace.FileSystemProvider.loadProjectConfig(e),n=fl(
2928
- e.path,".."),i=e.with({path:n});return await this.registerProject({config:r,folderUri:i})}catch(r){throw this.services.lsp.Connection?.window.showErrorMessage(`LikeC4: Failed to register project at ${e.fsPath}`),jC(r,`Failed to register project config ${e.fsPath}:
2929
- `)}}async registerProject(e){const r=NS(e.config),n=hk(e.folderUri);let i=this.#n.find(o=>o.folder===n);if(i&&FR(i.config,r))return i;let s=!1,a;if(i){s=!0,i.config.name!==r.name?(this.#r.delete(i.id),Ct.info`unregister project ${i.id} folder: ${n}`,a=this.uniqueProjectId(r.name),i.id=a,Ct.info`re-register project ${i.id} folder: ${n}`):(a=i.id,Ct.info`update project ${i.id} on config change`),i.config=r;const o=OS(r.include);i.includeConfig=o}else{this.#r.has(r.name)&&Ct.warn`Project "${r.name}" already exists, generating unique ID`,
2930
- a=this.uniqueProjectId(r.name);const o=OS(r.include);i={id:a,config:r,folder:n,folderUri:ct.parse(n),includeConfig:o},s=this.#n.some(c=>c.folder.startsWith(n)||n.startsWith(c.folder)),this.#n=Ye([...this.#n,i],_U([({folder:c})=>PO(c).split("/").length,"desc"])),Ct.info`register project ${i.id} folder: ${n}`}if(this.#t=void 0,Mt(r.exclude)?i.exclude=Zn.exclude:Ir(r.exclude,1)&&(i.exclude=lk(r.exclude,{dot:!0})),i.includeConfig.paths&&Ir(i.includeConfig.paths,1)){i.includePaths=i.includeConfig.paths.
2931
- map(o=>{const c=fl(i.folderUri.path,o),l=i.folderUri.with({path:c});return{uri:l,folder:hk(l)}}),Ct.debug`project ${i.id} include paths: ${i.includePaths.map(o=>o.uri.fsPath).join(", ")}`;for(const o of i.includePaths)for(const c of this.#n)if(c.id!==i.id&&((o.folder.startsWith(c.folder)||c.folder.startsWith(o.folder))&&Ct.warn('Project "{projectId}" include path "{includePath}" overlaps with project "{otherProjectId}" folder. Files in overlapping areas will only belong to one project.',{projectId:i.
2867
+ this.escapeQuotesInternalQuotes(u.text.slice(d.length,-d.length),s,a)+d}});i.push(...l)}}escapeQuotesInternalQuotes(e,r,n){let i="",s=0;for(;s>=0;){let a=e.indexOf(n,s);if(a<0){i+=e.slice(s);break}i+=e.slice(s,a),s=a+1;let o=!1;for(;a>0&&e[a-1]=="\\";)o=!o,a--;i+=o?n:`\\${n}`}return i}getAutoQuoteStyle(e){const r=e.flatMap(n=>n.region.nodes);return r.filter(n=>n.text[0]=='"').length*2>=r.length?"double":"single"}onConfigurationUpdate(e){this.options={...this.options,...e??{quoteStyle:"auto"}}}}class Ute extends kP{services;constructor(e){
2868
+ super(e),this.services=e}createDescription(e,r,n){n??=bt(e);const i=super.createDescription(e,r,n);return yo(n.uri)||(n.likec4ProjectId??=this.services.shared.workspace.ProjectsManager.belongsTo(n),i.likec4ProjectId=n.likec4ProjectId),i}}class Vte extends SP{services;constructor(e){super(e),this.services=e}async updateContent(e,r){const n=this.services.workspace.ProjectsManager;e.likec4ProjectId=n.belongsTo(e),await super.updateContent(e,r)}projectElements(e,r,n){const i=this.services.workspace.
2869
+ ProjectsManager,s=i.getProject(e).includePaths?.map(a=>{const o=a.toString();return o.endsWith("/")?o:o+"/"})??[];return at(this.symbolIndex.keys()).filter(a=>{const o=i.belongsTo(a)===e,c=s.some(l=>a.startsWith(l));return(o||c)&&(!n||n.has(a))}).flatMap(a=>this.getFileDescriptions(a,r))}}const Wte=jS("/",!0),Gte=(t,e)=>Wte(t.uri.path,e.uri.path),gO=t=>t.textDocument.languageId!==Vf.languageId||yo(t.uri);class Kte extends pP{services;compare=jS("/",!0);constructor(e){super(e),this.services=e}addDocument(e){
2870
+ const r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);const n=[...this.documentMap.values(),e].sort(Gte);this.documentMap.clear();for(const i of n)this.documentMap.set(i.uri.toString(),i)}getDocument(e){const r=super.getDocument(e);if(r&&!gO(r)&&(r.likec4ProjectId??=this.services.workspace.ProjectsManager.belongsTo(r)),r&&!Bi(r))throw new Error(`Document ${r.uri.path} is not a LikeC4 document`);return r}get all(){return at(this.
2871
+ documentMap.values()).filter(e=>e.textDocument.languageId===Vf.languageId?(yo(e.uri)||(e.likec4ProjectId??=this.services.workspace.ProjectsManager.belongsTo(e)),!0):!1)}get allExcludingBuiltin(){const e=this.services.workspace.ProjectsManager;return super.all.filter(r=>!gO(r)&&!e.isExcluded(r))}projectDocuments(e){const r=this.services.workspace.ProjectsManager.getProject(e),n=r.folderUri.toString()+(r.folderUri.path.endsWith("/")?"":"/"),i=r.includePaths?.map(s=>{const a=s.toString();return a.endsWith(
2872
+ "/")?a:a+"/"})??[];return this.allExcludingBuiltin.filter(s=>{const a=s.uri.toString();return a.startsWith(n)?!0:i.length>0?i.some(o=>a.startsWith(o)):!1})}groupedByProject(){return Vo(this.allExcludingBuiltin.toArray(),ci("likec4ProjectId"))}}var rk={},nk,yO;function Cy(){if(yO)return nk;yO=1;const t="\\\\/",e=`[^${t}]`,r="\\.",n="\\+",i="\\?",s="\\/",a="(?=.)",o="[^/]",c=`(?:${s}|$)`,l=`(?:^|${s})`,u=`${r}{1,2}${c}`,d=`(?!${r})`,f=`(?!${l}${u})`,p=`(?!${r}{0,1}${c})`,w=`(?!${u})`,g=`[^.${s}]`,
2873
+ y=`${o}*?`,h={DOT_LITERAL:r,PLUS_LITERAL:n,QMARK_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:a,QMARK:o,END_ANCHOR:c,DOTS_SLASH:u,NO_DOT:d,NO_DOTS:f,NO_DOT_SLASH:p,NO_DOTS_SLASH:w,QMARK_NO_DOT:g,STAR:y,START_ANCHOR:l,SEP:"/"},v={...h,SLASH_LITERAL:`[${t}]`,QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}\
2874
+ ])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},b={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return nk={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:b,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,
2875
+ REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,
2876
+ CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,
2877
+ CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(_){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${_.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(_){return _===!0?v:h}},nk}var vO;function Ay(){return vO||(vO=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:n,REGEX_SPECIAL_CHARS_GLOBAL:i}=Cy();
2878
+ t.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t.hasRegexChars=s=>n.test(s),t.isRegexChar=s=>s.length===1&&t.hasRegexChars(s),t.escapeRegex=s=>s.replace(i,"\\$1"),t.toPosixSlashes=s=>s.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},t.removeBackslashes=s=>s.replace(r,a=>a==="\\"?"":a),t.escapeLast=(s,a,o)=>{
2879
+ const c=s.lastIndexOf(a,o);return c===-1?s:s[c-1]==="\\"?t.escapeLast(s,a,c-1):`${s.slice(0,c)}\\${s.slice(c)}`},t.removePrefix=(s,a={})=>{let o=s;return o.startsWith("./")&&(o=o.slice(2),a.prefix="./"),o},t.wrapOutput=(s,a={},o={})=>{const c=o.contains?"":"^",l=o.contains?"":"$";let u=`${c}(?:${s})${l}`;return a.negated===!0&&(u=`(?:^(?!${u}).*$)`),u},t.basename=(s,{windows:a}={})=>{const o=s.split(a?/[\\/]/:"/"),c=o[o.length-1];return c===""?o[o.length-2]:c}})(rk)),rk}var ik,wO;function Zte(){
2880
+ if(wO)return ik;wO=1;const t=Ay(),{CHAR_ASTERISK:e,CHAR_AT:r,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:i,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:u,CHAR_PLUS:d,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:p,CHAR_RIGHT_PARENTHESES:w,CHAR_RIGHT_SQUARE_BRACKET:g}=Cy(),y=v=>v===o||v===n,m=v=>{v.isPrefix!==!0&&(v.depth=v.isGlobstar?1/0:1)};return ik=(v,b)=>{const _=b||{},R=v.length-1,$=_.parts===!0||_.scanToEnd===!0,M=[],q=[],
2881
+ Z=[];let L=v,P=-1,T=0,B=0,H=!1,U=!1,G=!1,oe=!1,ne=!1,C=!1,F=!1,Y=!1,K=!1,S=!1,N=0,X,se,ue={value:"",depth:0,isGlob:!1};const _e=()=>P>=R,de=()=>L.charCodeAt(P+1),x=()=>(X=se,L.charCodeAt(++P));for(;P<R;){se=x();let Re;if(se===n){F=ue.backslashes=!0,se=x(),se===c&&(C=!0);continue}if(C===!0||se===c){for(N++;_e()!==!0&&(se=x());){if(se===n){F=ue.backslashes=!0,x();continue}if(se===c){N++;continue}if(C!==!0&&se===s&&(se=x())===s){if(H=ue.isBrace=!0,G=ue.isGlob=!0,S=!0,$===!0)continue;break}if(C!==!0&&
2882
+ se===i){if(H=ue.isBrace=!0,G=ue.isGlob=!0,S=!0,$===!0)continue;break}if(se===p&&(N--,N===0)){C=!1,H=ue.isBrace=!0,S=!0;break}}if($===!0)continue;break}if(se===o){if(M.push(P),q.push(ue),ue={value:"",depth:0,isGlob:!1},S===!0)continue;if(X===s&&P===T+1){T+=2;continue}B=P+1;continue}if(_.noext!==!0&&(se===d||se===r||se===e||se===f||se===a)===!0&&de()===l){if(G=ue.isGlob=!0,oe=ue.isExtglob=!0,S=!0,se===a&&P===T&&(K=!0),$===!0){for(;_e()!==!0&&(se=x());){if(se===n){F=ue.backslashes=!0,se=x();continue}
2883
+ if(se===w){G=ue.isGlob=!0,S=!0;break}}continue}break}if(se===e){if(X===e&&(ne=ue.isGlobstar=!0),G=ue.isGlob=!0,S=!0,$===!0)continue;break}if(se===f){if(G=ue.isGlob=!0,S=!0,$===!0)continue;break}if(se===u){for(;_e()!==!0&&(Re=x());){if(Re===n){F=ue.backslashes=!0,x();continue}if(Re===g){U=ue.isBracket=!0,G=ue.isGlob=!0,S=!0;break}}if($===!0)continue;break}if(_.nonegate!==!0&&se===a&&P===T){Y=ue.negated=!0,T++;continue}if(_.noparen!==!0&&se===l){if(G=ue.isGlob=!0,$===!0){for(;_e()!==!0&&(se=x());){
2884
+ if(se===l){F=ue.backslashes=!0,se=x();continue}if(se===w){S=!0;break}}continue}break}if(G===!0){if(S=!0,$===!0)continue;break}}_.noext===!0&&(oe=!1,G=!1);let O=L,J="",z="";T>0&&(J=L.slice(0,T),L=L.slice(T),B-=T),O&&G===!0&&B>0?(O=L.slice(0,B),z=L.slice(B)):G===!0?(O="",z=L):O=L,O&&O!==""&&O!=="/"&&O!==L&&y(O.charCodeAt(O.length-1))&&(O=O.slice(0,-1)),_.unescape===!0&&(z&&(z=t.removeBackslashes(z)),O&&F===!0&&(O=t.removeBackslashes(O)));const ae={prefix:J,input:v,start:T,base:O,glob:z,isBrace:H,isBracket:U,
2885
+ isGlob:G,isExtglob:oe,isGlobstar:ne,negated:Y,negatedExtglob:K};if(_.tokens===!0&&(ae.maxDepth=0,y(se)||q.push(ue),ae.tokens=q),_.parts===!0||_.tokens===!0){let Re;for(let Me=0;Me<M.length;Me++){const me=Re?Re+1:T,Ne=M[Me],pe=v.slice(me,Ne);_.tokens&&(Me===0&&T!==0?(q[Me].isPrefix=!0,q[Me].value=J):q[Me].value=pe,m(q[Me]),ae.maxDepth+=q[Me].depth),(Me!==0||pe!=="")&&Z.push(pe),Re=Ne}if(Re&&Re+1<v.length){const Me=v.slice(Re+1);Z.push(Me),_.tokens&&(q[q.length-1].value=Me,m(q[q.length-1]),ae.maxDepth+=
2886
+ q[q.length-1].depth)}ae.slashes=M,ae.parts=Z}return ae},ik}var sk,bO;function Jte(){if(bO)return sk;bO=1;const t=Cy(),e=Ay(),{MAX_LENGTH:r,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=t,o=(u,d)=>{if(typeof d.expandRange=="function")return d.expandRange(...u,d);u.sort();const f=`[${u.join("-")}]`;try{new RegExp(f)}catch{return u.map(w=>e.escapeRegex(w)).join("..")}return f},c=(u,d)=>`Missing ${u}: "${d}" - use "\\\\${d}" to match literal characters`,
2887
+ l=(u,d)=>{if(typeof u!="string")throw new TypeError("Expected a string");u=a[u]||u;const f={...d},p=typeof f.maxLength=="number"?Math.min(r,f.maxLength):r;let w=u.length;if(w>p)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${p}`);const g={type:"bos",value:"",output:f.prepend||""},y=[g],m=f.capture?"":"?:",h=t.globChars(f.windows),v=t.extglobChars(h),{DOT_LITERAL:b,PLUS_LITERAL:_,SLASH_LITERAL:R,ONE_CHAR:$,DOTS_SLASH:M,NO_DOT:q,NO_DOT_SLASH:Z,NO_DOTS_SLASH:L,QMARK:P,QMARK_NO_DOT:T,
2888
+ STAR:B,START_ANCHOR:H}=h,U=me=>`(${m}(?:(?!${H}${me.dot?M:b}).)*?)`,G=f.dot?"":q,oe=f.dot?P:T;let ne=f.bash===!0?U(f):B;f.capture&&(ne=`(${ne})`),typeof f.noext=="boolean"&&(f.noextglob=f.noext);const C={input:u,index:-1,start:0,dot:f.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};u=e.removePrefix(u,C),w=u.length;const F=[],Y=[],K=[];let S=g,N;const X=()=>C.index===w-1,se=C.peek=(me=1)=>u[C.index+me],ue=C.advance=()=>u[++C.
2889
+ index]||"",_e=()=>u.slice(C.index+1),de=(me="",Ne=0)=>{C.consumed+=me,C.index+=Ne},x=me=>{C.output+=me.output!=null?me.output:me.value,de(me.value)},O=()=>{let me=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)ue(),C.start++,me++;return me%2===0?!1:(C.negated=!0,C.start++,!0)},J=me=>{C[me]++,K.push(me)},z=me=>{C[me]--,K.pop()},ae=me=>{if(S.type==="globstar"){const Ne=C.braces>0&&(me.type==="comma"||me.type==="brace"),pe=me.extglob===!0||F.length&&(me.type==="pipe"||me.type==="paren");me.type!=="\
2890
+ slash"&&me.type!=="paren"&&!Ne&&!pe&&(C.output=C.output.slice(0,-S.output.length),S.type="star",S.value="*",S.output=ne,C.output+=S.output)}if(F.length&&me.type!=="paren"&&(F[F.length-1].inner+=me.value),(me.value||me.output)&&x(me),S&&S.type==="text"&&me.type==="text"){S.output=(S.output||S.value)+me.value,S.value+=me.value;return}me.prev=S,y.push(me),S=me},Re=(me,Ne)=>{const pe={...v[Ne],conditions:1,inner:""};pe.prev=S,pe.parens=C.parens,pe.output=C.output;const Se=(f.capture?"(":"")+pe.open;
2891
+ J("parens"),ae({type:me,value:Ne,output:C.output?"":$}),ae({type:"paren",extglob:!0,value:ue(),output:Se}),F.push(pe)},Me=me=>{let Ne=me.close+(f.capture?")":""),pe;if(me.type==="negate"){let Se=ne;if(me.inner&&me.inner.length>1&&me.inner.includes("/")&&(Se=U(f)),(Se!==ne||X()||/^\)+$/.test(_e()))&&(Ne=me.close=`)$))${Se}`),me.inner.includes("*")&&(pe=_e())&&/^\.[^\\/.]+$/.test(pe)){const Be=l(pe,{...d,fastpaths:!1}).output;Ne=me.close=`)${Be})${Se})`}me.prev.type==="bos"&&(C.negatedExtglob=!0)}
2892
+ ae({type:"paren",extglob:!0,value:N,output:Ne}),z("parens")};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(u)){let me=!1,Ne=u.replace(s,(pe,Se,Be,tt,st,Jt)=>tt==="\\"?(me=!0,pe):tt==="?"?Se?Se+tt+(st?P.repeat(st.length):""):Jt===0?oe+(st?P.repeat(st.length):""):P.repeat(Be.length):tt==="."?b.repeat(Be.length):tt==="*"?Se?Se+tt+(st?ne:""):ne:Se?pe:`\\${pe}`);return me===!0&&(f.unescape===!0?Ne=Ne.replace(/\\/g,""):Ne=Ne.replace(/\\+/g,pe=>pe.length%2===0?"\\\\":pe?"\\":"")),Ne===u&&f.contains===
2893
+ !0?(C.output=u,C):(C.output=e.wrapOutput(Ne,C,d),C)}for(;!X();){if(N=ue(),N==="\0")continue;if(N==="\\"){const pe=se();if(pe==="/"&&f.bash!==!0||pe==="."||pe===";")continue;if(!pe){N+="\\",ae({type:"text",value:N});continue}const Se=/^\\+/.exec(_e());let Be=0;if(Se&&Se[0].length>2&&(Be=Se[0].length,C.index+=Be,Be%2!==0&&(N+="\\")),f.unescape===!0?N=ue():N+=ue(),C.brackets===0){ae({type:"text",value:N});continue}}if(C.brackets>0&&(N!=="]"||S.value==="["||S.value==="[^")){if(f.posix!==!1&&N===":"){
2894
+ const pe=S.value.slice(1);if(pe.includes("[")&&(S.posix=!0,pe.includes(":"))){const Se=S.value.lastIndexOf("["),Be=S.value.slice(0,Se),tt=S.value.slice(Se+2),st=n[tt];if(st){S.value=Be+st,C.backtrack=!0,ue(),!g.output&&y.indexOf(S)===1&&(g.output=$);continue}}}(N==="["&&se()!==":"||N==="-"&&se()==="]")&&(N=`\\${N}`),N==="]"&&(S.value==="["||S.value==="[^")&&(N=`\\${N}`),f.posix===!0&&N==="!"&&S.value==="["&&(N="^"),S.value+=N,x({value:N});continue}if(C.quotes===1&&N!=='"'){N=e.escapeRegex(N),S.value+=
2895
+ N,x({value:N});continue}if(N==='"'){C.quotes=C.quotes===1?0:1,f.keepQuotes===!0&&ae({type:"text",value:N});continue}if(N==="("){J("parens"),ae({type:"paren",value:N});continue}if(N===")"){if(C.parens===0&&f.strictBrackets===!0)throw new SyntaxError(c("opening","("));const pe=F[F.length-1];if(pe&&C.parens===pe.parens+1){Me(F.pop());continue}ae({type:"paren",value:N,output:C.parens?")":"\\)"}),z("parens");continue}if(N==="["){if(f.nobracket===!0||!_e().includes("]")){if(f.nobracket!==!0&&f.strictBrackets===
2896
+ !0)throw new SyntaxError(c("closing","]"));N=`\\${N}`}else J("brackets");ae({type:"bracket",value:N});continue}if(N==="]"){if(f.nobracket===!0||S&&S.type==="bracket"&&S.value.length===1){ae({type:"text",value:N,output:`\\${N}`});continue}if(C.brackets===0){if(f.strictBrackets===!0)throw new SyntaxError(c("opening","["));ae({type:"text",value:N,output:`\\${N}`});continue}z("brackets");const pe=S.value.slice(1);if(S.posix!==!0&&pe[0]==="^"&&!pe.includes("/")&&(N=`/${N}`),S.value+=N,x({value:N}),f.
2897
+ literalBrackets===!1||e.hasRegexChars(pe))continue;const Se=e.escapeRegex(S.value);if(C.output=C.output.slice(0,-S.value.length),f.literalBrackets===!0){C.output+=Se,S.value=Se;continue}S.value=`(${m}${Se}|${S.value})`,C.output+=S.value;continue}if(N==="{"&&f.nobrace!==!0){J("braces");const pe={type:"brace",value:N,output:"(",outputIndex:C.output.length,tokensIndex:C.tokens.length};Y.push(pe),ae(pe);continue}if(N==="}"){const pe=Y[Y.length-1];if(f.nobrace===!0||!pe){ae({type:"text",value:N,output:N});
2898
+ continue}let Se=")";if(pe.dots===!0){const Be=y.slice(),tt=[];for(let st=Be.length-1;st>=0&&(y.pop(),Be[st].type!=="brace");st--)Be[st].type!=="dots"&&tt.unshift(Be[st].value);Se=o(tt,f),C.backtrack=!0}if(pe.comma!==!0&&pe.dots!==!0){const Be=C.output.slice(0,pe.outputIndex),tt=C.tokens.slice(pe.tokensIndex);pe.value=pe.output="\\{",N=Se="\\}",C.output=Be;for(const st of tt)C.output+=st.output||st.value}ae({type:"brace",value:N,output:Se}),z("braces"),Y.pop();continue}if(N==="|"){F.length>0&&F[F.
2899
+ length-1].conditions++,ae({type:"text",value:N});continue}if(N===","){let pe=N;const Se=Y[Y.length-1];Se&&K[K.length-1]==="braces"&&(Se.comma=!0,pe="|"),ae({type:"comma",value:N,output:pe});continue}if(N==="/"){if(S.type==="dot"&&C.index===C.start+1){C.start=C.index+1,C.consumed="",C.output="",y.pop(),S=g;continue}ae({type:"slash",value:N,output:R});continue}if(N==="."){if(C.braces>0&&S.type==="dot"){S.value==="."&&(S.output=b);const pe=Y[Y.length-1];S.type="dots",S.output+=N,S.value+=N,pe.dots=
2900
+ !0;continue}if(C.braces+C.parens===0&&S.type!=="bos"&&S.type!=="slash"){ae({type:"text",value:N,output:b});continue}ae({type:"dot",value:N,output:b});continue}if(N==="?"){if(!(S&&S.value==="(")&&f.noextglob!==!0&&se()==="("&&se(2)!=="?"){Re("qmark",N);continue}if(S&&S.type==="paren"){const Se=se();let Be=N;(S.value==="("&&!/[!=<:]/.test(Se)||Se==="<"&&!/<([!=]|\w+>)/.test(_e()))&&(Be=`\\${N}`),ae({type:"text",value:N,output:Be});continue}if(f.dot!==!0&&(S.type==="slash"||S.type==="bos")){ae({type:"\
2901
+ qmark",value:N,output:T});continue}ae({type:"qmark",value:N,output:P});continue}if(N==="!"){if(f.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){Re("negate",N);continue}if(f.nonegate!==!0&&C.index===0){O();continue}}if(N==="+"){if(f.noextglob!==!0&&se()==="("&&se(2)!=="?"){Re("plus",N);continue}if(S&&S.value==="("||f.regex===!1){ae({type:"plus",value:N,output:_});continue}if(S&&(S.type==="bracket"||S.type==="paren"||S.type==="brace")||C.parens>0){ae({type:"plus",value:N});continue}
2902
+ ae({type:"plus",value:_});continue}if(N==="@"){if(f.noextglob!==!0&&se()==="("&&se(2)!=="?"){ae({type:"at",extglob:!0,value:N,output:""});continue}ae({type:"text",value:N});continue}if(N!=="*"){(N==="$"||N==="^")&&(N=`\\${N}`);const pe=i.exec(_e());pe&&(N+=pe[0],C.index+=pe[0].length),ae({type:"text",value:N});continue}if(S&&(S.type==="globstar"||S.star===!0)){S.type="star",S.star=!0,S.value+=N,S.output=ne,C.backtrack=!0,C.globstar=!0,de(N);continue}let me=_e();if(f.noextglob!==!0&&/^\([^?]/.test(
2903
+ me)){Re("star",N);continue}if(S.type==="star"){if(f.noglobstar===!0){de(N);continue}const pe=S.prev,Se=pe.prev,Be=pe.type==="slash"||pe.type==="bos",tt=Se&&(Se.type==="star"||Se.type==="globstar");if(f.bash===!0&&(!Be||me[0]&&me[0]!=="/")){ae({type:"star",value:N,output:""});continue}const st=C.braces>0&&(pe.type==="comma"||pe.type==="brace"),Jt=F.length&&(pe.type==="pipe"||pe.type==="paren");if(!Be&&pe.type!=="paren"&&!st&&!Jt){ae({type:"star",value:N,output:""});continue}for(;me.slice(0,3)==="\
2904
+ /**";){const Ht=u[C.index+4];if(Ht&&Ht!=="/")break;me=me.slice(3),de("/**",3)}if(pe.type==="bos"&&X()){S.type="globstar",S.value+=N,S.output=U(f),C.output=S.output,C.globstar=!0,de(N);continue}if(pe.type==="slash"&&pe.prev.type!=="bos"&&!tt&&X()){C.output=C.output.slice(0,-(pe.output+S.output).length),pe.output=`(?:${pe.output}`,S.type="globstar",S.output=U(f)+(f.strictSlashes?")":"|$)"),S.value+=N,C.globstar=!0,C.output+=pe.output+S.output,de(N);continue}if(pe.type==="slash"&&pe.prev.type!=="bo\
2905
+ s"&&me[0]==="/"){const Ht=me[1]!==void 0?"|$":"";C.output=C.output.slice(0,-(pe.output+S.output).length),pe.output=`(?:${pe.output}`,S.type="globstar",S.output=`${U(f)}${R}|${R}${Ht})`,S.value+=N,C.output+=pe.output+S.output,C.globstar=!0,de(N+ue()),ae({type:"slash",value:"/",output:""});continue}if(pe.type==="bos"&&me[0]==="/"){S.type="globstar",S.value+=N,S.output=`(?:^|${R}|${U(f)}${R})`,C.output=S.output,C.globstar=!0,de(N+ue()),ae({type:"slash",value:"/",output:""});continue}C.output=C.output.
2906
+ slice(0,-S.output.length),S.type="globstar",S.output=U(f),S.value+=N,C.output+=S.output,C.globstar=!0,de(N);continue}const Ne={type:"star",value:N,output:ne};if(f.bash===!0){Ne.output=".*?",(S.type==="bos"||S.type==="slash")&&(Ne.output=G+Ne.output),ae(Ne);continue}if(S&&(S.type==="bracket"||S.type==="paren")&&f.regex===!0){Ne.output=N,ae(Ne);continue}(C.index===C.start||S.type==="slash"||S.type==="dot")&&(S.type==="dot"?(C.output+=Z,S.output+=Z):f.dot===!0?(C.output+=L,S.output+=L):(C.output+=G,
2907
+ S.output+=G),se()!=="*"&&(C.output+=$,S.output+=$)),ae(Ne)}for(;C.brackets>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing","]"));C.output=e.escapeLast(C.output,"["),z("brackets")}for(;C.parens>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing",")"));C.output=e.escapeLast(C.output,"("),z("parens")}for(;C.braces>0;){if(f.strictBrackets===!0)throw new SyntaxError(c("closing","}"));C.output=e.escapeLast(C.output,"{"),z("braces")}if(f.strictSlashes!==!0&&(S.type==="star"||S.
2908
+ type==="bracket")&&ae({type:"maybe_slash",value:"",output:`${R}?`}),C.backtrack===!0){C.output="";for(const me of C.tokens)C.output+=me.output!=null?me.output:me.value,me.suffix&&(C.output+=me.suffix)}return C};return l.fastpaths=(u,d)=>{const f={...d},p=typeof f.maxLength=="number"?Math.min(r,f.maxLength):r,w=u.length;if(w>p)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${p}`);u=a[u]||u;const{DOT_LITERAL:g,SLASH_LITERAL:y,ONE_CHAR:m,DOTS_SLASH:h,NO_DOT:v,NO_DOTS:b,NO_DOTS_SLASH:_,
2909
+ STAR:R,START_ANCHOR:$}=t.globChars(f.windows),M=f.dot?b:v,q=f.dot?_:v,Z=f.capture?"":"?:",L={negated:!1,prefix:""};let P=f.bash===!0?".*?":R;f.capture&&(P=`(${P})`);const T=G=>G.noglobstar===!0?P:`(${Z}(?:(?!${$}${G.dot?h:g}).)*?)`,B=G=>{switch(G){case"*":return`${M}${m}${P}`;case".*":return`${g}${m}${P}`;case"*.*":return`${M}${P}${g}${m}${P}`;case"*/*":return`${M}${P}${y}${m}${q}${P}`;case"**":return M+T(f);case"**/*":return`(?:${M}${T(f)}${y})?${q}${m}${P}`;case"**/*.*":return`(?:${M}${T(f)}${y}\
2910
+ )?${q}${P}${g}${m}${P}`;case"**/.*":return`(?:${M}${T(f)}${y})?${g}${m}${P}`;default:{const oe=/^(.*?)\.(\w+)$/.exec(G);if(!oe)return;const ne=B(oe[1]);return ne?ne+g+oe[2]:void 0}}},H=e.removePrefix(u,L);let U=B(H);return U&&f.strictSlashes!==!0&&(U+=`${y}?`),U},sk=l,sk}var ak,_O;function Yte(){if(_O)return ak;_O=1;const t=Zte(),e=Jte(),r=Ay(),n=Cy(),i=a=>a&&typeof a=="object"&&!Array.isArray(a),s=(a,o,c=!1)=>{if(Array.isArray(a)){const y=a.map(h=>s(h,o,c));return h=>{for(const v of y){const b=v(
2911
+ h);if(b)return b}return!1}}const l=i(a)&&a.tokens&&a.input;if(a===""||typeof a!="string"&&!l)throw new TypeError("Expected pattern to be a non-empty string");const u=o||{},d=u.windows,f=l?s.compileRe(a,o):s.makeRe(a,o,!1,!0),p=f.state;delete f.state;let w=()=>!1;if(u.ignore){const y={...o,ignore:null,onMatch:null,onResult:null};w=s(u.ignore,y,c)}const g=(y,m=!1)=>{const{isMatch:h,match:v,output:b}=s.test(y,f,o,{glob:a,posix:d}),_={glob:a,state:p,regex:f,posix:d,input:y,output:b,match:v,isMatch:h};
2912
+ return typeof u.onResult=="function"&&u.onResult(_),h===!1?(_.isMatch=!1,m?_:!1):w(y)?(typeof u.onIgnore=="function"&&u.onIgnore(_),_.isMatch=!1,m?_:!1):(typeof u.onMatch=="function"&&u.onMatch(_),m?_:!0)};return c&&(g.state=p),g};return s.test=(a,o,c,{glob:l,posix:u}={})=>{if(typeof a!="string")throw new TypeError("Expected input to be a string");if(a==="")return{isMatch:!1,output:""};const d=c||{},f=d.format||(u?r.toPosixSlashes:null);let p=a===l,w=p&&f?f(a):a;return p===!1&&(w=f?f(a):a,p=w===
2913
+ l),(p===!1||d.capture===!0)&&(d.matchBase===!0||d.basename===!0?p=s.matchBase(a,o,c,u):p=o.exec(w)),{isMatch:!!p,match:p,output:w}},s.matchBase=(a,o,c)=>(o instanceof RegExp?o:s.makeRe(o,c)).test(r.basename(a)),s.isMatch=(a,o,c)=>s(o,c)(a),s.parse=(a,o)=>Array.isArray(a)?a.map(c=>s.parse(c,o)):e(a,{...o,fastpaths:!1}),s.scan=(a,o)=>t(a,o),s.compileRe=(a,o,c=!1,l=!1)=>{if(c===!0)return a.output;const u=o||{},d=u.contains?"":"^",f=u.contains?"":"$";let p=`${d}(?:${a.output})${f}`;a&&a.negated===!0&&
2914
+ (p=`^(?!${p}).*$`);const w=s.toRegex(p,o);return l===!0&&(w.state=a),w},s.makeRe=(a,o={},c=!1,l=!1)=>{if(!a||typeof a!="string")throw new TypeError("Expected a non-empty string");let u={negated:!1,fastpaths:!0};return o.fastpaths!==!1&&(a[0]==="."||a[0]==="*")&&(u.output=e.fastpaths(a,o)),u.output||(u=e(a,o)),s.compileRe(u,o,c,l)},s.toRegex=(a,o)=>{try{const c=o||{};return new RegExp(a,c.flags||(c.nocase?"i":""))}catch(c){if(o&&o.debug===!0)throw c;return/$^/}},s.constants=n,ak=s,ak}var ok,RO;function Xte(){
2915
+ if(RO)return ok;RO=1;const t=Yte(),e=Ay();function r(n,i,s=!1){return i&&(i.windows===null||i.windows===void 0)&&(i={...i,windows:e.isWindows()}),t(n,i,s)}return Object.assign(r,t),ok=r,ok}var Qte=Xte();const ck=Ks(Qte),ere=/#/g,tre=/&/g,rre=/\//g,nre=/=/g,lk=/\+/g,ire=/%5e/gi,sre=/%60/gi,are=/%7c/gi,ore=/%20/gi;function cre(t){return encodeURI(""+t).replace(are,"|")}function uk(t){return cre(typeof t=="string"?t:JSON.stringify(t)).replace(lk,"%2B").replace(ore,"+").replace(ere,"%23").replace(tre,
2916
+ "%26").replace(sre,"`").replace(ire,"^").replace(rre,"%2F")}function dk(t){return uk(t).replace(nre,"%3D")}function kO(t=""){try{return decodeURIComponent(""+t)}catch{return""+t}}function lre(t){return kO(t.replace(lk," "))}function ure(t){return kO(t.replace(lk," "))}function dre(t=""){const e=Object.create(null);t[0]==="?"&&(t=t.slice(1));for(const r of t.split("&")){const n=r.match(/([^=]+)=?(.*)/)||[];if(n.length<2)continue;const i=lre(n[1]);if(i==="__proto__"||i==="constructor")continue;const s=ure(
2917
+ n[2]||"");e[i]===void 0?e[i]=s:Array.isArray(e[i])?e[i].push(s):e[i]=[e[i],s]}return e}function fre(t,e){return(typeof e=="number"||typeof e=="boolean")&&(e=String(e)),e?Array.isArray(e)?e.map(r=>`${dk(t)}=${uk(r)}`).join("&"):`${dk(t)}=${uk(e)}`:dk(t)}function pre(t){return Object.keys(t).filter(e=>t[e]!==void 0).map(e=>fre(e,t[e])).filter(Boolean).join("&")}const hre=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,SO=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,mre=/^([/\\]\s*){2,}[^/\\]/,gre=/^\.?\//;function fk(t){return[
2918
+ "./","../"].some(e=>t.startsWith(e))}function dl(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?hre.test(t):SO.test(t)||(e.acceptRelative?mre.test(t):!1)}function yre(t="",e){return t.endsWith("/")}function vre(t="",e){return(yre(t)?t.slice(0,-1):t)||"/"}function xy(t="",e){return t.endsWith("/")?t:t+"/"}function mp(t=""){return t.startsWith("/")}function EO(t=""){return(mp(t)?t.slice(1):t)||"/"}function wre(t=""){return mp(t)?t:"/"+t}function bre(t,e){if(Rre(e))return t;const r=vre(
2919
+ e);if(!t.startsWith(r))return t;const n=t.slice(r.length);return n[0]==="/"?n:"/"+n}function _re(t,e){const r=PO(t),n={...dre(r.search),...e};return r.search=pre(n),Ere(r)}function Rre(t){return!t||t==="/"}function kre(t){return t&&t!=="/"}function Iy(t,...e){let r=t||"";for(const n of e.filter(i=>kre(i)))if(r){const i=n.replace(gre,"");r=xy(r)+i}else r=n;return r}function fl(...t){const e=/\/(?!\/)/,r=t.filter(Boolean),n=[];let i=0;for(const a of r)if(!(!a||a==="/")){for(const[o,c]of a.split(e).
2920
+ entries())if(!(!c||c===".")){if(c===".."){if(n.length===1&&dl(n[0]))continue;n.pop(),i--;continue}if(o===1&&n[n.length-1]?.endsWith(":/")){n[n.length-1]+="/"+c;continue}n.push(c),i++}}let s=n.join("/");return i>=0?r[0]?.startsWith("/")&&!s.startsWith("/")?s="/"+s:r[0]?.startsWith("./")&&!s.startsWith("./")&&(s="./"+s):s="../".repeat(-1*i)+s,r[r.length-1]?.endsWith("/")&&!s.endsWith("/")&&(s+="/"),s}function TO(t){return Sre(t,"")}function Sre(t,e){let r=t.match(SO);return r||(r=t.match(/^\/{2,}/)),
2921
+ r?e+t.slice(r[0].length):e+t}const $O=Symbol.for("ufo:protocolRelative");function PO(t="",e){const r=t.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(r){const[,d,f=""]=r;return{protocol:d.toLowerCase(),pathname:f,href:d+f,auth:"",host:"",search:"",hash:""}}if(!dl(t,{acceptRelative:!0}))return CO(t);const[,n="",i,s=""]=t.replace(/\\/g,"/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[];let[,a="",o=""]=s.match(/([^#/?]*)(.*)?/)||[];n==="file:"&&(o=o.replace(/\/(?=[A-Za-z]:)/,
2922
+ ""));const{pathname:c,search:l,hash:u}=CO(o);return{protocol:n.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):"",host:a,pathname:c,search:l,hash:u,[$O]:!n}}function CO(t=""){const[e="",r="",n=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:r,hash:n}}function Ere(t){const e=t.pathname||"",r=t.search?(t.search.startsWith("?")?"":"?")+t.search:"",n=t.hash||"",i=t.auth?t.auth+"@":"",s=t.host||"";return(t.protocol||t[$O]?(t.protocol||"")+"//":"")+i+s+e+r+n}const Tre=/\/([^/]+)$/;
2923
+ function $re(t="",e){const{pathname:r}=PO(t),n=r.match(Tre);return n?n[1]:void 0}const Ct=Fe.getChild("ProjectsManager");function Ny(t){return ct.isUri(t)?t.toString():typeof t=="string"?t.startsWith("file://")?t:ct.file(t).toString():t.uri.toString()}function pk(t){return t=Ny(t),xy(t)}const Zn={id:"default",config:{name:"default",exclude:["**/node_modules/**"]},exclude:ck("**/node_modules/**",{dot:!0}),includeConfig:{paths:[],maxDepth:3,fileThreshold:30}};class In{services;static DefaultProjectId=Zn.
2924
+ id;#e=void 0;#t=void 0;#r=new C2;#n=[];#s=new WeakMap;constructor(e){this.services=e,Ct.debug`created`}get defaultProjectId(){if(this.#e)return this.#e;if(!(this.#n.length>1))return this.#n[0]?.id??In.DefaultProjectId}set defaultProjectId(e){if(e!==this.#e){if(this.#t=void 0,!e||e===In.DefaultProjectId){Ct.debug`reset default project ID`,this.#e=void 0;return}yr(this.#n.find(r=>r.id===e),`Project "${e}" not found`),Ct.debug`set default project ID to ${e}`,this.#e=e}}get default(){if(!this.#t){const e=this.
2925
+ defaultProjectId??In.DefaultProjectId;let r=this.#n.find(n=>n.id===e);if(!r){const n=this.getWorkspaceFolder();r={id:e,config:Zn.config,folder:pk(n),folderUri:n,exclude:Zn.exclude,includeConfig:Zn.includeConfig}}this.#t=r}return this.#t}get all(){if(Ir(this.#n,1)){const e=[...qt(this.#n,ci("id")),Zn.id];if(this.#e){const r=e.findIndex(n=>n===this.#e);if(r>0){const[n]=e.splice(r,1);return[n,...e]}}return e}return[Zn.id]}getProject(e){const r=typeof e=="string"?e:e.likec4ProjectId||this.belongsTo(
2926
+ e);if(r===Zn.id){let i;try{i=this.services.workspace.WorkspaceManager.workspaceUri}catch(s){Ct.warn("Failed to get workspace URI, using default folder",{error:s}),i=ct.file("/")}return{id:In.DefaultProjectId,config:Zn.config,folderUri:i}}const n=On(this.#n.find(i=>i.id===r),`Project "${r}" not found`);return{id:r,folderUri:n.folderUri,config:n.config,...n.includePaths&&{includePaths:n.includePaths.map(i=>i.uri)}}}ensureProjectId(e){return e===In.DefaultProjectId?this.defaultProjectId??In.DefaultProjectId:
2927
+ e?(yr(this.#r.has(e),`Project ID ${e} is not registered`),e):On(this.defaultProjectId,()=>`Specify exact project, known: [${[...this.#r.keys()].join(", ")}]`)}ensureProject(e){return e=this.ensureProjectId(e),this.getProject(e)}hasMultipleProjects(){return this.#n.length>1}isExcluded(e){if(typeof e=="string"||ct.isUri(e)){let n=Ny(e);const i=this.findProjectForDocument(n);return i.exclude?i.exclude(TO(n)):!1}let r=this.#s.get(e);return r===void 0&&(r=this.isExcluded(e.uri),this.#s.set(e,r)),r}isConfigFile(e){
2928
+ const r=$re(e.toString())?.toLowerCase(),n=!!r&&Rl(r);return n&&Zn.exclude(e.path)?(Ct.debug`exclude config file ${e.path}`,!1):n}async registerConfigFile(e){if(Zn.exclude(e.path))throw new Error(`Path to ${e.fsPath} is excluded by: ${Zn.config.exclude.join(", ")}`);if(!this.isConfigFile(e))throw new Error(`${e.fsPath} is not a valid LikeC4 config filename.`);try{const r=await this.services.workspace.FileSystemProvider.loadProjectConfig(e),n=fl(e.path,".."),i=e.with({path:n});return await this.registerProject(
2929
+ {config:r,folderUri:i})}catch(r){throw this.services.lsp.Connection?.window.showErrorMessage(`LikeC4: Failed to register project at ${e.fsPath}`),jC(r,`Failed to register project config ${e.fsPath}:
2930
+ `)}}async registerProject(e){const r=NS(e.config),n=pk(e.folderUri);let i=this.#n.find(o=>o.folder===n);if(i&&qR(i.config,r))return i;let s=!1,a;if(i){s=!0,i.config.name!==r.name?(this.#r.delete(i.id),Ct.info`unregister project ${i.id} folder: ${n}`,a=this.uniqueProjectId(r.name),i.id=a,Ct.info`re-register project ${i.id} folder: ${n}`):(a=i.id,Ct.info`update project ${i.id} on config change`),i.config=r;const o=OS(r.include);i.includeConfig=o}else{this.#r.has(r.name)&&Ct.warn`Project "${r.name}" already exists, generating unique ID`,
2931
+ a=this.uniqueProjectId(r.name);const o=OS(r.include);i={id:a,config:r,folder:n,folderUri:ct.parse(n),includeConfig:o},s=this.#n.some(c=>c.folder.startsWith(n)||n.startsWith(c.folder)),this.#n=Ye([...this.#n,i],_U([({folder:c})=>TO(c).split("/").length,"desc"])),Ct.info`register project ${i.id} folder: ${n}`}if(this.#t=void 0,Mt(r.exclude)?i.exclude=Zn.exclude:Ir(r.exclude,1)&&(i.exclude=ck(r.exclude,{dot:!0})),i.includeConfig.paths&&Ir(i.includeConfig.paths,1)){i.includePaths=i.includeConfig.paths.
2932
+ map(o=>{const c=fl(i.folderUri.path,o),l=i.folderUri.with({path:c});return{uri:l,folder:pk(l)}}),Ct.debug`project ${i.id} include paths: ${i.includePaths.map(o=>o.uri.fsPath).join(", ")}`;for(const o of i.includePaths)for(const c of this.#n)if(c.id!==i.id&&((o.folder.startsWith(c.folder)||c.folder.startsWith(o.folder))&&Ct.warn('Project "{projectId}" include path "{includePath}" overlaps with project "{otherProjectId}" folder. Files in overlapping areas will only belong to one project.',{projectId:i.
2932
2933
  id,includePath:o.folder,otherProjectId:c.id}),c.includePaths))for(const l of c.includePaths)(o.folder.startsWith(l.folder)||l.folder.startsWith(o.folder))&&Ct.warn('Project "{projectId}" include path "{includePath}" overlaps with project "{otherProjectId}" include path "{otherIncludePath}". Files in overlapping areas will only belong to one project.',{projectId:i.id,includePath:o.folder,otherProjectId:c.id,otherIncludePath:l.folder})}else delete i.includePaths;return this.#r.set(i.id,n),s&&!this.#i&&
2933
2934
  await this.rebuidProject(i.id).catch(o=>{Ct.warn("Failed to rebuild project {projectId} after config change",{projectId:i.id,error:o})}),i}belongsTo(e){if(ct.isUri(e)||typeof e=="string"){const r=Ny(e);return this.findProjectForDocument(r).id}return this.documentBelongsTo.get(e,()=>this.findProjectForDocument(Ny(e.uri))).id}#i=null;async reloadProjects(){try{this.#i?Ct.debug`reload projects is already in progress, waiting`:(Ct.debug`schedule reload projects`,this.#i=this._reloadProjects()),await this.#i}finally{
2934
2935
  this.#i=null}}async _reloadProjects(){await MS(200);const e=this.services.workspace.WorkspaceManager.workspaceFolders;if(!e){Ct.warn("No workspace folders found");return}await this.services.workspace.WorkspaceLock.write(async r=>{Ct.debug`start reload projects`;const n=[];for(const i of e)try{Ct.debug`scan projects in folder ${i.uri}`;const s=await this.services.workspace.FileSystemProvider.scanProjectFiles(ct.parse(i.uri));for(const a of s)a.isFile&&this.isConfigFile(a.uri)&&(Ct.debug`found config ${a.
@@ -2936,28 +2937,28 @@ uri.fsPath}`,n.push(a.uri))}catch(s){Ct.error("Failed to scanProjectFiles, {fold
2936
2937
  has(r);)r=`${e}-${n++}`;return r}reset(){this.#t=void 0,this.#e&&!this.#r.has(this.#e)&&(this.#e=void 0),this.services.workspace.LangiumDocuments.all.forEach(e=>{yo(e.uri)||delete e.likec4ProjectId}),this.documentBelongsTo.clear(),this.mappingsToProject.clear(),this.#s=new WeakMap}async rebuidProject(e,r){if(!r)return await this.services.workspace.WorkspaceLock.write(async c=>{await this.rebuidProject(e,c)});Ct.info`rebuild project ${e}`,this.#t=void 0;const n=this.#n.find(c=>c.id===e)??this.default;
2937
2938
  n.id!==e&&Ct.warn`Project ${e} not found, rebuilding default project ${n.id}`;const i=Ct.getChild(n.id),s=n.folder,a=n.includePaths?.map(c=>c.folder)??[],o=this.services.workspace.LangiumDocuments.all.filter(c=>{if(n.exclude?.(c.uri.path))return!1;const l=c.uri.toString();if(l.startsWith(s)||a.some(d=>l.startsWith(d)))return!0;const u=xy(fl(l,".."));return u.startsWith(s)||s.startsWith(u)}).map(c=>c.uri).toArray();o.length>0&&(this.reset(),i.info("rebuild documents: {docs}",{docs:o.length}),await this.
2938
2939
  services.workspace.DocumentBuilder.update(o,[],r).catch(c=>{i.warn("Failed to rebuild project",{error:c})}))}findProjectForDocument(e){return this.mappingsToProject.get(e,()=>{const r=this.#n.find(({folder:i})=>e.startsWith(i));return r||this.#n.find(({includePaths:i})=>i?i.some(s=>e.startsWith(s.folder)):!1)||this.default})}get mappingsToProject(){return qp(this,"_mappingsToProject",()=>new vc(this.services))}get documentBelongsTo(){return qp(this,"_documentBelongsTo",()=>new vc(this.services))}getAllIncludePaths(){
2939
- const e=[];for(const r of this.#n)if(r.includePaths)for(const n of r.includePaths)e.push({projectId:r.id,includePath:n.uri,includeConfig:r.includeConfig});return e}getWorkspaceFolder(){try{return this.services.workspace.WorkspaceManager.workspaceUri}catch(e){return Ct.warn("Failed to get workspace URI, using default folder",{error:e}),ct.file("/")}}}class Ere extends EP{services;documentFactory;fileSystemProvider;initialBuildOptions={eagerLinking:!0,validation:!0};constructor(e){super(e),this.services=
2940
+ const e=[];for(const r of this.#n)if(r.includePaths)for(const n of r.includePaths)e.push({projectId:r.id,includePath:n.uri,includeConfig:r.includeConfig});return e}getWorkspaceFolder(){try{return this.services.workspace.WorkspaceManager.workspaceUri}catch(e){return Ct.warn("Failed to get workspace URI, using default folder",{error:e}),ct.file("/")}}}class Pre extends EP{services;documentFactory;fileSystemProvider;initialBuildOptions={eagerLinking:!0,validation:!0};constructor(e){super(e),this.services=
2940
2941
  e,this.documentFactory=e.workspace.LangiumDocumentFactory,this.fileSystemProvider=e.workspace.FileSystemProvider}async performStartup(e){this.folders??=e;const r=[];for(const i of e)try{const s=ct.parse(i.uri),a=await this.fileSystemProvider.scanProjectFiles(s);r.push(...a),this.services.workspace.FileSystemWatcher.watch(s.fsPath)}catch(s){nt(s)}const n=this.services.workspace.ProjectsManager;for(const i of r)try{await n.registerConfigFile(i.uri)}catch(s){nt(s)}return await super.performStartup(
2941
2942
  e)}async loadAdditionalDocuments(e,r){r(this.documentFactory.fromString(fI,ct.parse(f7)));const n=this.services.workspace.ProjectsManager.getAllIncludePaths();let i=0;for(const{projectId:s,includePath:a,includeConfig:o}of n)try{Fe.debug`scanning include path ${a.fsPath} for project ${s}`;const c=await this.fileSystemProvider.readDirectory(a,{recursive:!0,maxDepth:o.maxDepth});let l=0;for(const u of c)if(u.isFile&&!this.services.workspace.ProjectsManager.isExcluded(u.uri)){const d=await this.documentFactory.
2942
2943
  fromUri(u.uri);r(d),l++,i++}Fe.debug`loaded ${l} files from include path ${a.fsPath}`}catch(c){nt(c)}if(n.length>0&&i>0){const s=Math.min(...n.map(a=>a.includeConfig.fileThreshold));i>s?Fe.warn(`Loaded ${i} files from include paths (threshold: ${s}). Large include directories may slow workspace initialization. Consider adjusting "include.fileThreshold" or "include.maxDepth" in your project configuration.`):Fe.info`loaded ${i} total files from ${n.length} include paths`}await super.loadAdditionalDocuments(
2943
2944
  e,r)}includeEntry(e,r,n){return this.services.workspace.ProjectsManager.isConfigFile(r.uri)?!1:r.isFile?!this.services.workspace.ProjectsManager.isExcluded(r.uri):super.includeEntry(e,r,n)}workspace(){return this.folders&&Ir(this.folders,1)?this.folders[0]:null}async rebuildAll(e){if(!e)return await this.services.workspace.WorkspaceLock.write(async n=>{await this.rebuildAll(n)});const r=this.services.workspace.LangiumDocuments.all.map(n=>n.uri).toArray();Fe.info("invalidate and rebuild all {docs\
2944
- } documents",{docs:r.length}),this.services.workspace.Cache.clear(),await this.documentBuilder.update(r,[],e)}get workspaceUri(){const e=this.workspace();return ze(e,"Workspace not initialized"),ct.parse(e.uri)}get workspaceURL(){const e=this.workspace();return ze(e,"Workspace not initialized"),new URL(e.uri)}}const mk=Fe.getChild("LanguageServices");class Tre{services;builder;editor;projectsManager;constructor(e){this.services=e,this.builder=e.likec4.ModelBuilder,this.projectsManager=e.shared.workspace.
2945
+ } documents",{docs:r.length}),this.services.workspace.Cache.clear(),await this.documentBuilder.update(r,[],e)}get workspaceUri(){const e=this.workspace();return ze(e,"Workspace not initialized"),ct.parse(e.uri)}get workspaceURL(){const e=this.workspace();return ze(e,"Workspace not initialized"),new URL(e.uri)}}const hk=Fe.getChild("LanguageServices");class Cre{services;builder;editor;projectsManager;constructor(e){this.services=e,this.builder=e.likec4.ModelBuilder,this.projectsManager=e.shared.workspace.
2945
2946
  ProjectsManager,this.editor=e.likec4.ModelChanges}get views(){return this.services.likec4.Views}get workspaceUri(){return this.services.shared.workspace.WorkspaceManager.workspaceUri}projects(){const e=this.services.shared.workspace.ProjectsManager,r=Ye(this.services.shared.workspace.LangiumDocuments.groupedByProject(),fm(),qt(([a,o])=>{const c=a,{folderUri:l,config:u}=e.getProject(c);return{id:c,folder:l,title:u.title??u.name,documents:qt(o,ci("uri")),config:u}}));if(Ir(r,2)&&e.defaultProjectId){
2946
2947
  const a=r.findIndex(o=>o.id===e.defaultProjectId);if(a>0){const[o]=r.splice(a,1);return[o,...r]}return r}if(Ir(r,1))return r;const{folderUri:n,config:i}=e.getProject(In.DefaultProjectId),s=qt(this.services.shared.workspace.LangiumDocuments.projectDocuments(In.DefaultProjectId).toArray(),ci("uri"));return[{id:In.DefaultProjectId,folder:n,title:i.title??i.name,documents:s,config:i}]}project(e){e=this.projectsManager.ensureProjectId(e);const r=this.services.shared.workspace.ProjectsManager,{folderUri:n,
2947
2948
  config:i}=r.getProject(e),s=qt(this.services.shared.workspace.LangiumDocuments.projectDocuments(e).toArray(),ci("uri"));return{id:e,folder:n,title:i.title??i.name,documents:s,config:i}}async diagrams(e,r){const n=this.projectsManager.ensureProjectId(e);return await this.views.diagrams(n,r)}async computedModel(e,r){const n=this.projectsManager.ensureProjectId(e);return await this.builder.computeModel(n,r)}async layoutedModel(e,r){const n=this.projectsManager.ensureProjectId(e),i=await this.builder.
2948
2949
  computeModel(n,r);if(!i)throw new Error("Failed to compute model, empty project?");const s=await this.views.layoutAllViews(n,r);return Jo.create({...i.$data,_stage:"layouted",views:Ye(s,qt(ci("diagram")),Nu(ci("id")))})}getErrors(){return this.services.shared.workspace.LangiumDocuments.allExcludingBuiltin.toArray().flatMap(e=>(e.diagnostics??[]).filter(r=>r.severity===Ha.Error).map(({message:r,range:n})=>({message:r,line:n.start.line,range:n,sourceFsPath:e.uri.fsPath})))}locate(e){switch(!0){case"\
2949
- element"in e:return this.services.likec4.ModelLocator.locateElement(e.element,e.projectId);case"relation"in e:return this.services.likec4.ModelLocator.locateRelation(e.relation,e.projectId);case"view"in e:return this.services.likec4.ModelLocator.locateView(e.view,e.projectId);case"deployment"in e:return this.services.likec4.ModelLocator.locateDeploymentElement(e.deployment,e.projectId);default:lt(e)}}async dispose(){try{mk.debug("disposing LikeC4LanguageServices"),await this.services.shared.workspace.
2950
- FileSystemWatcher.dispose(),this.services.mcp.Server.isStarted&&await this.services.mcp.Server.stop(),this.services.Rpc.dispose(),this.services.likec4.ModelBuilder.dispose(),mk.debug("LikeC4LanguageServices disposed")}catch(e){mk.error(Ve(e))}}}const IO=t=>Number.isFinite(t)?t:0;function $re(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(IO(t*1e3)%1e3),nanoseconds:Math.
2951
- trunc(IO(t*1e6)%1e3)}}function Pre(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 Cre(t){switch(typeof t){case"number":{if(Number.isFinite(t))return $re(t);break}case"bigint":return Pre(t)}throw new TypeError("Expected a finite number or bigint")}const Are=t=>t===0||t===0n,xre=(t,e)=>e===1||e===1n?t:`${t}s`,Ire=1e-7,Nre=24n*60n*60n*1000n;function NO(t,e){const r=typeof t=="bigint";if(!r&&!Number.
2952
- isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};const n=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+Ire);return(Math.round(f)/10**d).toFixed(d)},a=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Are(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){
2953
- const w=p.includes(".")?p.split(".")[0].length:p.length,g=i.length>0?2:1;p="0".repeat(Math.max(0,g-w))+p}else p+=e.verbose?" "+xre(d,u):f;i.push(p)}},o=Cre(t),c=BigInt(o.days);if(e.hideYearAndDays?a(BigInt(c)*24n+BigInt(o.hours),"hour","h"):(e.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(o.hours),"hour","h")),a(Number(o.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){const u=Number(
2954
- o.seconds),d=Number(o.milliseconds),f=Number(o.microseconds),p=Number(o.nanoseconds);if(a(u,"second","s"),e.formatSubMilliseconds)a(d,"millisecond","ms"),a(f,"microsecond","\xB5s"),a(p,"nanosecond","ns");else{const w=d+f/1e3+p/1e6,g=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,y=w>=1?Math.round(w):Math.ceil(w),m=g?w.toFixed(g):y;a(Number.parseFloat(m),"millisecond","ms",m)}}else{const u=(r?Number(t%Nre):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:
2955
- 1,f=s(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");a(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");const l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}class gk{toDispose=[];isDisposed=!1;onDispose(...e){this.toDispose.push(...e)}dispose(){this.throwIfDisposed(),this.isDisposed=!0;let e;for(;e=this.toDispose.pop();)try{e.dispose()}catch(r){nt(r)}}throwIfDisposed(){
2956
- if(this.isDisposed)throw new Error("This has already been disposed")}}function ha(t){let e=u_(t)?t.el.ref:t.modelElement.value.ref;return e?.$type==="Imported"&&(e=e.imported.ref),e?.$type==="Element"?e:void 0}function Io(t){const e=[t.$type==="StrictFqnRef"?t.value.$refText:t.el.$refText];let r=t.parent;for(;r;)e.push(r.$type==="StrictFqnRef"?r.value.$refText:r.el.$refText),r=r.parent;return e.length===1?e[0]:e.reverse().join(".")}function Dre(t){for(;t.parent;)t=t.parent;return t.value.ref??null}
2957
- function Ore(t){let e;for(;e=t.value?.ref;){if(Kr(e))return null;if(un(e))return e;if(Mt(t.parent))return null;t=t.parent}return null}function Lre(t){const e=Dre(t);return e?.$type==="Imported"?e:null}function Mre(t){let e;for(;e=t.value?.ref;){if(km(e))return!0;if(Mt(t.parent))return!1;t=t.parent}return!1}function ar(t){if(Li(t)){for(;t.$type==="Imported"&&t.$container;)t=t.$container;ze(Hd(t))}if(Hd(t))return t.project;const e=Bt(t)?bt(t):t;return Dn(e.likec4ProjectId,()=>`Invalid state, docum\
2958
- ent ${e.uri} has no project ID assigned`)}function Ui(...t){var e=t.length>1?t.join(":::"):t[0];return A2(e)}function Dy(t){try{return t()}catch(e){Fe.debug("Safe call failed",{error:e});return}}function yk(){try{return performance.now()}catch{return Date.now()}}function Oy(){const t=yk();return{get ms(){return yk()-t},get pretty(){return NO(yk()-t)}}}class jre{services;constructor(e){this.services=e}async provideCodeLens(e,r,n){return Bi(e)?(e.state<=Ue.Linked&&(Fe.debug(`Waiting for document ${e.
2959
- uri.path} to be Linked`),await this.services.shared.workspace.DocumentBuilder.waitUntil(Ue.Linked,e.uri,n),Fe.debug("Document is linked")),e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=Ty.readId(i),a=i.$cstNode?.range;if(!a||!s)return[];const o=ar(i);return{range:{start:a.start,end:{line:a.start.line,character:a.start.character+4}},command:{command:"likec4.open-preview",arguments:[s,o],title:"open preview"}}})):void 0}}const vk=["color","shape","icon","border","opacity","mult\
2960
- iple","size","textSize"].join(",");class qre extends mx{services;constructor(e){super(e),this.services=e}completionOptions={triggerCharacters:[".","#"]};completionForKeyword(e,r,n){if(this.filterKeyword(e,r))switch(!0){case r.value==="import":n(e,{label:r.value,kind:xt.Snippet,insertTextFormat:br.Snippet,insertText:`${r.value} { $0 } from '\${1|${this.services.shared.workspace.ProjectsManager.all.join(",")}|}'`});break;case(r.value==="deployment"&&Xn(e.node,Xd)):n(e,{label:r.value,detail:"Insert\
2950
+ element"in e:return this.services.likec4.ModelLocator.locateElement(e.element,e.projectId);case"relation"in e:return this.services.likec4.ModelLocator.locateRelation(e.relation,e.projectId);case"view"in e:return this.services.likec4.ModelLocator.locateView(e.view,e.projectId);case"deployment"in e:return this.services.likec4.ModelLocator.locateDeploymentElement(e.deployment,e.projectId);default:lt(e)}}async dispose(){try{hk.debug("disposing LikeC4LanguageServices"),await this.services.shared.workspace.
2951
+ FileSystemWatcher.dispose(),this.services.mcp.Server.isStarted&&await this.services.mcp.Server.stop(),this.services.Rpc.dispose(),this.services.likec4.ModelBuilder.dispose(),hk.debug("LikeC4LanguageServices disposed")}catch(e){hk.error(Ve(e))}}}const AO=t=>Number.isFinite(t)?t:0;function Are(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(AO(t*1e3)%1e3),nanoseconds:Math.
2952
+ trunc(AO(t*1e6)%1e3)}}function xre(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 Ire(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Are(t);break}case"bigint":return xre(t)}throw new TypeError("Expected a finite number or bigint")}const Nre=t=>t===0||t===0n,Dre=(t,e)=>e===1||e===1n?t:`${t}s`,Ore=1e-7,Lre=24n*60n*60n*1000n;function xO(t,e){const r=typeof t=="bigint";if(!r&&!Number.
2953
+ isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};const n=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+Ore);return(Math.round(f)/10**d).toFixed(d)},a=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Nre(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){
2954
+ const w=p.includes(".")?p.split(".")[0].length:p.length,g=i.length>0?2:1;p="0".repeat(Math.max(0,g-w))+p}else p+=e.verbose?" "+Dre(d,u):f;i.push(p)}},o=Ire(t),c=BigInt(o.days);if(e.hideYearAndDays?a(BigInt(c)*24n+BigInt(o.hours),"hour","h"):(e.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(o.hours),"hour","h")),a(Number(o.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){const u=Number(
2955
+ o.seconds),d=Number(o.milliseconds),f=Number(o.microseconds),p=Number(o.nanoseconds);if(a(u,"second","s"),e.formatSubMilliseconds)a(d,"millisecond","ms"),a(f,"microsecond","\xB5s"),a(p,"nanosecond","ns");else{const w=d+f/1e3+p/1e6,g=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,y=w>=1?Math.round(w):Math.ceil(w),m=g?w.toFixed(g):y;a(Number.parseFloat(m),"millisecond","ms",m)}}else{const u=(r?Number(t%Lre):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:
2956
+ 1,f=s(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");a(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");const l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}class mk{toDispose=[];isDisposed=!1;onDispose(...e){this.toDispose.push(...e)}dispose(){this.throwIfDisposed(),this.isDisposed=!0;let e;for(;e=this.toDispose.pop();)try{e.dispose()}catch(r){nt(r)}}throwIfDisposed(){
2957
+ if(this.isDisposed)throw new Error("This has already been disposed")}}function ha(t){let e=u_(t)?t.el.ref:t.modelElement.value.ref;return e?.$type==="Imported"&&(e=e.imported.ref),e?.$type==="Element"?e:void 0}function Io(t){const e=[t.$type==="StrictFqnRef"?t.value.$refText:t.el.$refText];let r=t.parent;for(;r;)e.push(r.$type==="StrictFqnRef"?r.value.$refText:r.el.$refText),r=r.parent;return e.length===1?e[0]:e.reverse().join(".")}function Mre(t){for(;t.parent;)t=t.parent;return t.value.ref??null}
2958
+ function jre(t){let e;for(;e=t.value?.ref;){if(Kr(e))return null;if(un(e))return e;if(Mt(t.parent))return null;t=t.parent}return null}function qre(t){const e=Mre(t);return e?.$type==="Imported"?e:null}function Fre(t){let e;for(;e=t.value?.ref;){if(km(e))return!0;if(Mt(t.parent))return!1;t=t.parent}return!1}function ar(t){if(Li(t)){for(;t.$type==="Imported"&&t.$container;)t=t.$container;ze(Hd(t))}if(Hd(t))return t.project;const e=Bt(t)?bt(t):t;return Dn(e.likec4ProjectId,()=>`Invalid state, docum\
2959
+ ent ${e.uri} has no project ID assigned`)}function Ui(...t){var e=t.length>1?t.join(":::"):t[0];return A2(e)}function Dy(t){try{return t()}catch(e){Fe.debug("Safe call failed",{error:e});return}}function gk(){try{return performance.now()}catch{return Date.now()}}function Oy(){const t=gk();return{get ms(){return gk()-t},get pretty(){return xO(gk()-t)}}}class Hre{services;constructor(e){this.services=e}async provideCodeLens(e,r,n){return Bi(e)?(e.state<=Ue.Linked&&(Fe.debug(`Waiting for document ${e.
2960
+ uri.path} to be Linked`),await this.services.shared.workspace.DocumentBuilder.waitUntil(Ue.Linked,e.uri,n),Fe.debug("Document is linked")),e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=Ty.readId(i),a=i.$cstNode?.range;if(!a||!s)return[];const o=ar(i);return{range:{start:a.start,end:{line:a.start.line,character:a.start.character+4}},command:{command:"likec4.open-preview",arguments:[s,o],title:"open preview"}}})):void 0}}const yk=["color","shape","icon","border","opacity","mult\
2961
+ iple","size","textSize"].join(",");class Bre extends mx{services;constructor(e){super(e),this.services=e}completionOptions={triggerCharacters:[".","#"]};completionForKeyword(e,r,n){if(this.filterKeyword(e,r))switch(!0){case r.value==="import":n(e,{label:r.value,kind:xt.Snippet,insertTextFormat:br.Snippet,insertText:`${r.value} { $0 } from '\${1|${this.services.shared.workspace.ProjectsManager.all.join(",")}|}'`});break;case(r.value==="deployment"&&Xn(e.node,Xd)):n(e,{label:r.value,detail:"Insert\
2961
2962
  deployment view",kind:xt.Class,insertTextFormat:br.Snippet,insertText:["deployment view ${1:view_${TM_FILENAME_BASE}_${CURRENT_SECOND}} {"," title '${2:Untitled}'"," "," include $0","}"].join(`
2962
2963
  `)});break;case["title","description","technology","link"].includes(r.value):n(e,{label:r.value,detail:`Insert ${r.value} property`,kind:xt.Property,insertTextFormat:br.Snippet,insertText:`${r.value} '\${0}'`});break;case r.value==="color":n(e,{label:r.value,kind:xt.Property,insertTextFormat:br.Snippet,insertText:`${r.value} \${1|${Y2.join(",")}|}$0`});break;case r.value==="opacity":n(e,{label:r.value,kind:xt.Property,insertTextFormat:br.Snippet,insertText:`${r.value} \${0:100}%`});break;case["v\
2963
2964
  iews","specification","model","deployment","with"].includes(r.value):n(e,{label:r.value,detail:`Insert ${r.value} block`,kind:xt.Module,insertTextFormat:br.Snippet,insertText:`${r.value} {
@@ -2966,74 +2967,75 @@ iews","specification","model","deployment","with"].includes(r.value):n(e,{label:
2966
2967
  `)});break;case["par","parallel"].includes(r.value):n(e,{label:r.value,detail:"Insert block of parallel steps",kind:xt.Module,insertTextFormat:br.Snippet,insertText:[`${r.value} {`," $0","}"].join(`
2967
2968
  `)});break;case(r.value==="dynamic"&&Xn(e.node,Xd)):n(e,{label:r.value,detail:"Insert dynamic view",kind:xt.Class,insertTextFormat:br.Snippet,insertText:["dynamic view ${1:view_${TM_FILENAME_BASE}_${CURRENT_SECOND}} {"," title '${2:Untitled}'"," "," $0","}"].join(`
2968
2969
  `)});break;case(r.value==="style"&&e.node&&Xn(e.node,Ic)):n(e,{label:r.value,detail:`Insert ${r.value} block`,kind:xt.Module,insertTextFormat:br.Snippet,insertText:`${r.value} \${1:name} \${2:*} {
2969
- \${3|${vk}|} $0
2970
+ \${3|${yk}|} $0
2970
2971
  }`});break;case(r.value==="style"&&e.node&&Xn(e.node,qz([Xd,mo]))):n(e,{label:r.value,detail:`Insert ${r.value} block`,kind:xt.Module,insertTextFormat:br.Snippet,insertText:`${r.value} \${1:*} {
2971
- \${2|${vk}|} $0
2972
+ \${2|${yk}|} $0
2972
2973
  }`});break;case r.value==="style":n(e,{label:r.value,detail:`Insert ${r.value} block`,kind:xt.Module,insertTextFormat:br.Snippet,insertText:`${r.value} {
2973
- \${1|${vk}|} $0
2974
+ \${1|${yk}|} $0
2974
2975
  }`});break;case r.value==="extend":n(e,{label:r.value,detail:"Extend another view",kind:xt.Class,insertTextFormat:br.Snippet,insertText:`extend $1 {
2975
2976
  $0
2976
2977
  }`});break;case r.value==="autoLayout":n(e,{label:r.value,kind:xt.Property,insertTextFormat:br.Snippet,insertText:"autoLayout ${1|TopBottom,BottomTop,LeftRight,RightLeft|}$0"});break;case r.value==="mode":n(e,{label:r.value,kind:xt.Property,insertTextFormat:br.Snippet,insertText:"mode ${1|sequence,diagram|}$0"});break;case["include","exclude"].includes(r.value):n(e,{label:r.value,kind:xt.Operator,detail:`Insert ${r.value} predicate`,insertTextFormat:br.PlainText,insertText:`${r.value} `});break;default:
2977
- n(e,{label:r.value,kind:this.getKeywordCompletionItemKind(r),detail:"Keyword",sortText:"1"})}}}class Fre extends gx{createDocumentHighlight(e){return Ce.DocumentHighlight.create(e.segment.range,Ce.DocumentHighlightKind.Read)}}class Hre{services;constructor(e){this.services=e}async getDocumentLinks(e,r,n){return!Bi(e)||this.services.shared.workspace.ProjectsManager.isExcluded(e)?[]:Qn(e.parseResult.value).filter(Gd).map(i=>{try{const s=Dr(i.$cstNode,"value")?.range,a=s&&this.resolveLink(e,i.value);
2978
- if(a&&dl(a))return{range:s,target:a}}catch(s){nt(s)}return null}).nonNullable().toArray()}resolveLink(e,r){if(dl(r)||mp(r))return r;if(pk(r))return fl(e.uri.toString(),"../",r);const n=this.services.shared.workspace.ProjectsManager.getProject(e).folderUri;return fl(n.toString(),r)}relativeLink(e,r){if(mp(r))return $O(r);if(pk(r)){const n=this.services.shared.workspace.ProjectsManager.getProject(e).folderUri.toString(),i=new URL(e.uri.toString()),s=new URL(r,i).toString();return $O(yre(s,n))}return null}}
2979
- const DO=Fe.getChild("DocumentSymbolProvider");class Bre{services;nodeKindProvider;nameProvider;parser;locator;constructor(e){this.services=e,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator,this.nameProvider=e.references.NameProvider}async getSymbols(e,r,n){if(!Bi(e)||this.services.shared.workspace.ProjectsManager.isExcluded(e))return[];e.state<=Ue.Linked&&(DO.debug(`Waiting for document ${e.uri.path} to be Linked`),await this.
2980
- services.shared.workspace.DocumentBuilder.waitUntil(Ue.Linked,e.uri,n),DO.debug("document is Linked"));const{parseResult:{value:{specifications:i,models:s,deployments:a,views:o,likec4lib:c}}}=e;return[...c.map(l=>()=>this.getLikec4LibSymbol(l)),...i.map(l=>()=>this.getSpecSymbol(l)),...s.map(l=>()=>this.getModelSymbol(l)),...a.map(l=>()=>this.getDeploymentModelSymbol(l)),...o.map(l=>()=>this.getModelViewsSymbol(l))].flatMap(l=>{try{return l()??[]}catch(u){return nt(u),[]}})}getLikec4LibSymbol(e){
2978
+ n(e,{label:r.value,kind:this.getKeywordCompletionItemKind(r),detail:"Keyword",sortText:"1"})}}}class zre extends gx{createDocumentHighlight(e){return Ce.DocumentHighlight.create(e.segment.range,Ce.DocumentHighlightKind.Read)}}class Ure{services;constructor(e){this.services=e}async getDocumentLinks(e,r,n){return!Bi(e)||this.services.shared.workspace.ProjectsManager.isExcluded(e)?[]:Qn(e.parseResult.value).filter(Gd).map(i=>{try{const s=Dr(i.$cstNode,"value")?.range,a=s&&this.resolveLink(e,i.value);
2979
+ if(a&&dl(a))return{range:s,target:a}}catch(s){nt(s)}return null}).nonNullable().toArray()}resolveLink(e,r){if(dl(r)||mp(r))return r;if(fk(r))return fl(e.uri.toString(),"../",r);const n=this.services.shared.workspace.ProjectsManager.getProject(e).folderUri;return fl(n.toString(),r)}relativeLink(e,r){if(mp(r))return EO(r);if(fk(r)){const n=this.services.shared.workspace.ProjectsManager.getProject(e).folderUri.toString(),i=new URL(e.uri.toString()),s=new URL(r,i).toString();return EO(bre(s,n))}return null}}
2980
+ const IO=Fe.getChild("DocumentSymbolProvider");class Vre{services;nodeKindProvider;nameProvider;parser;locator;constructor(e){this.services=e,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator,this.nameProvider=e.references.NameProvider}async getSymbols(e,r,n){if(!Bi(e)||this.services.shared.workspace.ProjectsManager.isExcluded(e))return[];e.state<=Ue.Linked&&(IO.debug(`Waiting for document ${e.uri.path} to be Linked`),await this.
2981
+ services.shared.workspace.DocumentBuilder.waitUntil(Ue.Linked,e.uri,n),IO.debug("document is Linked"));const{parseResult:{value:{specifications:i,models:s,deployments:a,views:o,likec4lib:c}}}=e;return[...c.map(l=>()=>this.getLikec4LibSymbol(l)),...i.map(l=>()=>this.getSpecSymbol(l)),...s.map(l=>()=>this.getModelSymbol(l)),...a.map(l=>()=>this.getDeploymentModelSymbol(l)),...o.map(l=>()=>this.getModelViewsSymbol(l))].flatMap(l=>{try{return l()??[]}catch(u){return nt(u),[]}})}getLikec4LibSymbol(e){
2981
2982
  const r=e?.$cstNode;if(!r)return[];const n=e.icons.map(i=>this.getLibIconSymbol(i)).filter(be);return n.length===0?[]:[{kind:si.Namespace,name:"icons",range:r.range,selectionRange:au(r,"icons")?.range??r.range,children:n}]}getSpecSymbol(e){const r=e?.$cstNode;if(!r)return[];const n=Dr(r,"name");if(!n)return[];const i=Ye([...e.elements,...e.tags,...e.relationships],qt(s=>{try{if(Fc(s)||Bc(s)||jc(s))return this.getKindSymbol(s);if(vf(s))return this.getTagSymbol(s)}catch(a){return nt(a),null}lt(s)}),
2982
2983
  Qe(be));return i.length===0?[]:[{kind:si.Namespace,name:e.name,range:r.range,selectionRange:n.range,children:i}]}getModelSymbol(e){const r=e.$cstNode;if(!r)return[];const n=Dr(r,"name");return n?[{kind:this.symbolKind(e),name:e.name,range:r.range,selectionRange:n.range,children:e.elements.flatMap(i=>Pc(i)?[]:this.getElementsSymbol(i))}]:[]}getDeploymentModelSymbol(e){const r=e.$cstNode;if(!r)return[];const n=Dr(r,"name");return n?[{kind:this.symbolKind(e),name:e.name,range:r.range,selectionRange:n.
2983
2984
  range,children:e.elements.flatMap(i=>this.getDeploymentElementSymbol(i))}]:[]}getElementsSymbol(e){try{if(ho(e))return this.getExtendElementSymbol(e);if(Ar(e))return this.getElementSymbol(e)}catch(r){nt(r)}return[]}getExtendElementSymbol(e){const r=e.$cstNode,n=e.element.$cstNode,i=e.body;return!r||!n?[]:[{kind:this.symbolKind(e),name:Io(e.element),range:r.range,selectionRange:n.range,children:i.elements.flatMap(s=>this.getElementsSymbol(s))}]}getElementSymbol(e){const r=e.$cstNode,n=Dr(r,"name");
2984
2985
  if(!n||!r)return[];const i=e.name,s=e.kind.$refText;return[{kind:this.symbolKind(e),name:i,range:r.range,selectionRange:n.range,detail:s,children:e.body?.elements.flatMap(a=>this.getElementsSymbol(a))??[]}]}getModelViewsSymbol(e){const r=e.$cstNode,n=Dr(r,"name");return!n||!r?[]:[{kind:this.symbolKind(e),name:e.name,range:r.range,selectionRange:n.range,children:e.views.flatMap(i=>this.getViewSymbol(i))}]}getKindSymbol(e){return!e.$cstNode||!e.kind.$cstNode||Pt(e.kind.name)?null:{kind:this.symbolKind(
2985
2986
  e),name:e.kind.name,range:e.$cstNode.range,selectionRange:e.kind.$cstNode.range}}getTagSymbol(e){return!e.$cstNode||!e.tag.$cstNode||Pt(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||Pt(e.name)?null:{kind:this.symbolKind(e),name:e.name,range:e.$cstNode.range,selectionRange:e.$cstNode.range}}getViewSymbol(e){const r=e?.$cstNode;if(!r)return[];const n=e.name?Dr(r,"name"):null;return n?
2986
2987
  [{kind:this.symbolKind(e),name:n.text,range:r.range,selectionRange:n.range,children:[]}]:[]}getDeploymentElementSymbol(e){try{if(Kr(e))return this.getDeploymentNodeSymbol(e);if(un(e))return this.getDeployedInstanceSymbol(e);if(Xs(e))return[]}catch(r){nt(r)}return[]}getDeploymentNodeSymbol(e){const r=e.$cstNode,n=this.nameProvider.getNameNode(e);if(!n||!r)return[];const i=this.nameProvider.getNameStrict(e),s=e.kind.$refText;return[{kind:this.symbolKind(e),name:i,range:r.range,selectionRange:n.range,
2987
- detail:s,children:e.body?.elements.flatMap(a=>this.getDeploymentElementSymbol(a))??[]}]}getDeployedInstanceSymbol(e){const r=e.$cstNode,n=this.nameProvider.getNameNode(e);if(!n||!r)return[];const i=bt(e),s=this.parser.forDocument(i).parseDeployedInstance(e),a=this.nameProvider.getNameStrict(e),o="instance of "+s.element.model;return[{kind:this.symbolKind(e),name:a,range:r.range,selectionRange:n.range,detail:o,children:[]}]}symbolKind(e){return this.nodeKindProvider.getSymbolKind(e)}}class zre extends bx{parser;locator;constructor(e){
2988
+ detail:s,children:e.body?.elements.flatMap(a=>this.getDeploymentElementSymbol(a))??[]}]}getDeployedInstanceSymbol(e){const r=e.$cstNode,n=this.nameProvider.getNameNode(e);if(!n||!r)return[];const i=bt(e),s=this.parser.forDocument(i).parseDeployedInstance(e),a=this.nameProvider.getNameStrict(e),o="instance of "+s.element.model;return[{kind:this.symbolKind(e),name:a,range:r.range,selectionRange:n.range,detail:o,children:[]}]}symbolKind(e){return this.nodeKindProvider.getSymbolKind(e)}}class Wre extends bx{parser;locator;constructor(e){
2988
2989
  super(e),this.parser=e.likec4.ModelParser,this.locator=e.likec4.ModelLocator}getAstNodeHoverContent(e){if(wf(e))return{contents:{kind:"markdown",value:"tag `"+e.name+"`"}};if(Kr(e)){const r=bt(e),n=this.parser.forDocument(r).parseDeploymentNode(e),i=[n.id+" "];n.title!==e.name&&i.push(`### ${n.title}`),i.push("deployment node `"+n.kind+"` ");const s=TS(n);return s&&i.push("",s.md??s.txt),{contents:{kind:"markdown",value:i.join(`
2989
2990
  `)}}}if(un(e)){const r=bt(e),n=this.parser.forDocument(r).parseDeployedInstance(e),[i,s]=Dt.isImportRef(n.element)?[n.element.project,n.element.model]:[r.likec4ProjectId,n.element.model],a=i?this.locator.getParsedElement(s,i):this.locator.getParsedElement(s),o=[n.id+" ",`instance of \`${Dt.flatten(n.element)}\``];return a&&o.push(`### ${a.title}`,"element kind `"+a.kind+"` "),{contents:{kind:"markdown",value:o.join(`
2990
2991
  `)}}}if(Hx(e))return{contents:{kind:"markdown",value:"element kind `"+e.name+"`"}};if(BK(e))return{contents:{kind:"markdown",value:"deployment node `"+e.name+"`"}};if(Yx(e))return{contents:{kind:"markdown",value:"relationship kind `"+e.name+"`"}};if(Ar(e)){const r=this.locator.getParsedElement(e);if(!r)return;const n=[r.id,`### ${r.title}`,"element kind `"+r.kind+"` "],i=TS(r);return i&&n.push("",i.md??i.txt),{contents:{kind:"markdown",value:n.join(`
2991
- `)}}}}}class Ure{getCodeActions(e,r){const n=r.context.diagnostics,i=[];for(const s of n)s.code==="manual-layout-v1"&&i.push({title:"Migrate Manual Layouts",command:oo.Command.create("Migrate Manual Layouts","likec4.migrate-manual-layouts"),edit:{changes:{[e.textDocument.uri]:[oo.TextEdit.insert(r.range.start,"")]}},kind:"quickfix",isPreferred:!0,diagnostics:[s]});return i.length>0?i:void 0}}const OO={...Xh},LO={...Lb};function wk(t){const e=[],r=new Proxy({},{get(n,i){if(i==="modifier")return s=>(e.
2992
- push(s),r);if(i in LO)return e.push(LO[i]),r;if(i in OO)return()=>t(OO[i],e);throw new Error(`Unknown semantic token type or modifier: ${i}`)}});return r}const MO="Stop Highlighting",No=()=>{throw MO};class Vre extends cK{rules=[];constructor(e){super(e),this.initRules()}initRules(){this.rules=[];const e=(r,n)=>{const i={predicate:r,highlightFn:n};this.rules.push(i)};e(Yx,r=>{r.property("name").function()}),e(Ln(Mi,Jx,ui),r=>{r.property("kind").function()}),e(KK,r=>{r.property("name").definition.
2992
+ `)}}}}}class Gre{getCodeActions(e,r){const n=r.context.diagnostics,i=[];for(const s of n)s.code==="manual-layout-v1"&&i.push({title:"Migrate Manual Layouts",command:oo.Command.create("Migrate Manual Layouts","likec4.migrate-manual-layouts"),edit:{changes:{[e.textDocument.uri]:[oo.TextEdit.insert(r.range.start,"")]}},kind:"quickfix",isPreferred:!0,diagnostics:[s]});return i.length>0?i:void 0}}const NO={...Xh},DO={...Lb};function vk(t){const e=[],r=new Proxy({},{get(n,i){if(i==="modifier")return s=>(e.
2993
+ push(s),r);if(i in DO)return e.push(DO[i]),r;if(i in NO)return()=>t(NO[i],e);throw new Error(`Unknown semantic token type or modifier: ${i}`)}});return r}const OO="Stop Highlighting",No=()=>{throw OO};class Kre extends cK{rules=[];constructor(e){super(e),this.initRules()}initRules(){this.rules=[];const e=(r,n)=>{const i={predicate:r,highlightFn:n};this.rules.push(i)};e(Yx,r=>{r.property("name").function()}),e(Ln(Mi,Jx,ui),r=>{r.property("kind").function()}),e(KK,r=>{r.property("name").definition.
2993
2994
  function(),No()}),e(Ln(vg,lf),r=>{r.property("value").readonly.definition.interface(),No()}),e(Ln(ug,lI),r=>{r.cst().readonly.definition.variable(),No()}),e(rI,r=>{r.cst().type(),No()}),e(e7,r=>{r.cst().function(),No()}),e(sI,r=>{be(r.node.value)&&r.property("value").function()}),e(Ln(Nx,Ox),r=>{be(r.node.value)&&r.property("value").readonly.definition.type()}),e(Ln(oI,cI),r=>{r.property("participant").keyword()}),e(Bx,r=>{be(r.node.kind)&&r.property("kind").definition.type()}),e(Ln(mo,Ic),r=>{r.
2994
- property("id").readonly.definition.variable()}),e(h_,r=>{r.property("style").readonly.definition.variable()}),e(Ln(Md,Ld),r=>{r.property("name").readonly.definition.variable()}),e(p_,r=>{r.property("predicate").readonly.definition.variable()}),e(zx,r=>{be(r.node.tag)&&r.property("tag").definition.type()}),e(Ln(Vx,tI),r=>{r.property("value").readonly.definition.variable(),r.node.parent||No()}),e(u_,r=>{r.property("el").readonly.definition.variable(),r.node.parent||No()}),e(Tg,r=>{r.keyword("color").
2995
- keyword(),r.property("name").readonly.declaration.type()}),e(vf,r=>{be(r.node.color)&&r.keyword("color").property()}),e(Ln(Fc,Bc,jc),r=>{r.property("kind").readonly.declaration.type()}),e(wf,r=>{r.property("name").definition.type()}),e(wg,r=>{r.property("value").number()}),e(go,r=>{if(r.node.libicon||r.node.value==="none"){r.property(r.node.libicon?"libicon":"value").defaultLibrary.enum();return}r.property("value").string()}),e(Gd,r=>{be(r.node.value)&&r.property("value").string()}),e(uo,r=>{be(
2996
- r.node.customColor)&&r.property("customColor").enum(),be(r.node.themeColor)&&r.property("themeColor").enum()}),e(Ln(Sg,md,Vd,Fm,NK,K0),r=>{be(r.node.value)&&r.property("value").enum()})}highlightElement(e,r){try{if(Ln(Ar,Kr,un)(e))return this.highlightNameAndKind(e);if(H0(e))return this.highlightView(e);TK(e)&&!Ln(Oi,Ad,kg)(e)&&(fr(e.key),r({node:e,property:"key",type:Xh.property}));for(const{predicate:n,highlightFn:i}of this.rules)if(n(e)){i(this.mark(e));break}}catch(n){if(n===MO)return"prune";
2997
- Fe.warn(`Error highlighting node of type ${e._type}`,{error:n})}}highlightNameAndKind(e){if(this.mark(e).property("name").declaration.readonly.variable(),un(e)||this.mark(e).property("kind").keyword(),Ar(e)){e.props.length>0&&this.mark(e).property("props").string();return}e.title&&this.mark(e).property("title").string()}highlightView(e){e.name&&this.mark(e).property("name").modifier("local").declaration.readonly.interface()}mark(e){return{node:e,cst:r=>wk((n,i)=>this.highlightToken({range:On(r??
2998
- e.$cstNode,"AST node has no CST node").range,type:n,modifier:i})),keyword:r=>wk((n,i)=>this.highlightKeyword({node:e,keyword:r,type:n,modifier:i})),property:(r,n)=>wk((i,s)=>this.highlightProperty({node:e,property:r,type:i,modifier:s,...n!==void 0?{index:n}:{}}))}}}const Wre=6e4;class Gre{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=
2999
- new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(q_,r=>{const n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(B_,r=>{this._onprogress(r)}),this.setRequestHandler(H_,r=>({}))}_setupTimeout(e,r,n,i,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(e){const r=this._timeoutInfo.
3000
- get(e);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new sr(Gt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;const s=(r=this.transport)===
3001
- null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};const a=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{a?.(c),this._onerror(c)};const o=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,l)=>{o?.(c,l),Yf(c)||Jg(c)?this._onresponse(c):L_(c)?this._onrequest(c,l):zZ(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){
3002
- var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const n=new sr(Gt.ConnectionClosed,"Connection closed");for(const i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;
3003
- n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;const s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,a=this._transport;if(s===void 0){a?.send({jsonrpc:"2.0",id:e.id,error:{code:Gt.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}const o=new AbortController;this._requestHandlerAbortControllers.
3004
- set(e.id,o);const c={signal:o.signal,sessionId:a?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:l=>this.notification(l,{relatedRequestId:e.id}),sendRequest:(l,u,d)=>this.request(l,u,{...d,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,c)).then(l=>{if(!o.signal.aborted)return a?.send({result:l,jsonrpc:"2.0",id:e.id})},l=>{var u;if(!o.signal.aborted)return a?.send({jsonrpc:"2.0",id:e.id,error:{
3005
- code:Number.isSafeInteger(l.code)?l.code:Gt.InternalError,message:(u=l.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...n}=e.params,i=Number(r),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const a=this._responseHandlers.
3006
- get(i),o=this._timeoutInfo.get(i);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){a(c);return}s(n)}_onresponse(e){const r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Yf(e))n(e);else{const i=new sr(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this.
3007
- _transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){const{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}=n??{};return new Promise((o,c)=>{var l,u,d,f,p,w;if(!this._transport){c(new Error("Not connected"));return}((l=this._options)===null||l===void 0?void 0:l.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=n?.signal)===null||u===void 0||u.throwIfAborted();const g=this._requestMessageId++,y={...e,jsonrpc:"\
3008
- 2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),y.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:g}});const m=b=>{var _;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(_=this._transport)===null||_===void 0||_.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(b)}},{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(R=>this._onerror(new Error(
3009
- `Failed to send cancellation: ${R}`))),c(b)};this._responseHandlers.set(g,b=>{var _;if(!(!((_=n?.signal)===null||_===void 0)&&_.aborted)){if(b instanceof Error)return c(b);try{const R=r.parse(b.result);o(R)}catch(R){c(R)}}}),(f=n?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var b;m((b=n?.signal)===null||b===void 0?void 0:b.reason)});const h=(p=n?.timeout)!==null&&p!==void 0?p:Wre,v=()=>m(new sr(Gt.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(g,h,n?.maxTotalTimeout,
3010
- v,(w=n?.resetTimeoutOnProgress)!==null&&w!==void 0?w:!1),this._transport.send(y,{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(b=>{this._cleanupTimeout(g),c(b)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.
3011
- has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const l={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(l,r).catch(u=>this._onerror(u))});return}const o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){const n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,s)=>Promise.resolve(
3012
- r(e.parse(i),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function jO(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Kre(t,e){const r={
3013
- ...t};for(const n in e){const i=n,s=e[i];if(s===void 0)continue;const a=r[i];jO(a)&&jO(s)?r[i]={...a,...s}:r[i]=s}return r}var Ly={exports:{}},bk={},Ts={},Do={},_k={},Rk={},kk={},qO;function My(){return qO||(qO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;
3014
- class r extends e{constructor(h){if(super(),!t.IDENTIFIER.test(h))throw new Error("CodeGen: name must be a valid identifier");this.str=h}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class n extends e{constructor(h){super(),this._items=typeof h=="string"?[h]:h}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const h=this._items[0];return h===""||h==='""'}get str(){var h;return(h=this._str)!==null&&h!==void 0?h:this._str=this._items.
3015
- reduce((v,b)=>`${v}${b}`,"")}get names(){var h;return(h=this._names)!==null&&h!==void 0?h:this._names=this._items.reduce((v,b)=>(b instanceof r&&(v[b.str]=(v[b.str]||0)+1),v),{})}}t._Code=n,t.nil=new n("");function i(m,...h){const v=[m[0]];let b=0;for(;b<h.length;)o(v,h[b]),v.push(m[++b]);return new n(v)}t._=i;const s=new n("+");function a(m,...h){const v=[p(m[0])];let b=0;for(;b<h.length;)v.push(s),o(v,h[b]),v.push(s,p(m[++b]));return c(v),new n(v)}t.str=a;function o(m,h){h instanceof n?m.push(
3016
- ...h._items):h instanceof r?m.push(h):m.push(d(h))}t.addCodeArg=o;function c(m){let h=1;for(;h<m.length-1;){if(m[h]===s){const v=l(m[h-1],m[h+1]);if(v!==void 0){m.splice(h-1,3,v);continue}m[h++]="+"}h++}}function l(m,h){if(h==='""')return m;if(m==='""')return h;if(typeof m=="string")return h instanceof r||m[m.length-1]!=='"'?void 0:typeof h!="string"?`${m.slice(0,-1)}${h}"`:h[0]==='"'?m.slice(0,-1)+h.slice(1):void 0;if(typeof h=="string"&&h[0]==='"'&&!(m instanceof r))return`"${m}${h.slice(1)}`}
3017
- function u(m,h){return h.emptyStr()?m:m.emptyStr()?h:a`${m}${h}`}t.strConcat=u;function d(m){return typeof m=="number"||typeof m=="boolean"||m===null?m:p(Array.isArray(m)?m.join(","):m)}function f(m){return new n(p(m))}t.stringify=f;function p(m){return JSON.stringify(m).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=p;function w(m){return typeof m=="string"&&t.IDENTIFIER.test(m)?new n(`.${m}`):i`[${m}]`}t.getProperty=w;function g(m){if(typeof m=="string"&&t.IDENTIFIER.
3018
- test(m))return new n(`${m}`);throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`)}t.getEsmExportName=g;function y(m){return new n(m.toString())}t.regexpCode=y})(kk)),kk}var Sk={},FO;function HO(){return FO||(FO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=My();class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;
3019
- (function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(t.UsedValueState=n={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class i{constructor({prefixes:l,parent:u}={}){this._names={},this._prefixes=l,this._parent=u}toName(l){return l instanceof e.Name?l:this.name(l)}name(l){return new e.Name(this._newName(l))}_newName(l){const u=this._names[l]||this._nameGroup(l);return`${l}${u.index++}`}_nameGroup(l){var u,d;if(!((d=(u=this._parent)===null||
3020
- u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}t.Scope=i;class s extends e.Name{constructor(l,u){super(u),this.prefix=l}setValue(l,{property:u,itemIndex:d}){this.value=l,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=s;const a=(0,e._)`\n`;class o extends i{constructor(l){super(l),this._values={},this._scope=l.scope,
3021
- this.opts={...l,_n:l.lines?a:e.nil}}get(){return this._scope}name(l){return new s(l,this._newName(l))}value(l,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const f=this.toName(l),{prefix:p}=f,w=(d=u.key)!==null&&d!==void 0?d:u.ref;let g=this._values[p];if(g){const h=g.get(w);if(h)return h}else g=this._values[p]=new Map;g.set(w,f);const y=this._scope[p]||(this._scope[p]=[]),m=y.length;return y[m]=u.ref,f.setValue(u,{property:p,itemIndex:m}),f}getValue(l,u){const d=this.
3022
- _values[l];if(d)return d.get(u)}scopeRefs(l,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,e._)`${l}${d.scopePath}`})}scopeCode(l=this._values,u,d){return this._reduceValues(l,f=>{if(f.value===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return f.value.code},u,d)}_reduceValues(l,u,d={},f){let p=e.nil;for(const w in l){const g=l[w];if(!g)continue;const y=d[w]=d[w]||new Map;g.forEach(m=>{if(y.has(
3023
- m))return;y.set(m,n.Started);let h=u(m);if(h){const v=this.opts.es5?t.varKinds.var:t.varKinds.const;p=(0,e._)`${p}${v} ${m} = ${h};${this.opts._n}`}else if(h=f?.(m))p=(0,e._)`${p}${h}${this.opts._n}`;else throw new r(m);y.set(m,n.Completed)})}return p}}t.ValueScope=o})(Sk)),Sk}var BO;function Je(){return BO||(BO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.
3024
- getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=My(),r=HO();var n=My();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(
3025
- t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}});var i=HO();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),
3026
- Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class s{optimizeNodes(){return this}optimizeNames(S,N){return this}}class a extends s{constructor(S,N,X){super(),this.varKind=S,this.name=N,this.rhs=X}render({es5:S,_n:N}){const X=S?r.varKinds.
3027
- var:this.varKind,se=this.rhs===void 0?"":` = ${this.rhs}`;return`${X} ${this.name}${se};`+N}optimizeNames(S,N){if(S[this.name.str])return this.rhs&&(this.rhs=B(this.rhs,S,N)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends s{constructor(S,N,X){super(),this.lhs=S,this.rhs=N,this.sideEffects=X}render({_n:S}){return`${this.lhs} = ${this.rhs};`+S}optimizeNames(S,N){if(!(this.lhs instanceof e.Name&&!S[this.lhs.str]&&!this.sideEffects))return this.rhs=B(this.
3028
- rhs,S,N),this}get names(){const S=this.lhs instanceof e.Name?{}:{...this.lhs.names};return T(S,this.rhs)}}class c extends o{constructor(S,N,X,se){super(S,X,se),this.op=N}render({_n:S}){return`${this.lhs} ${this.op}= ${this.rhs};`+S}}class l extends s{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`${this.label}:`+S}}class u extends s{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`break${this.label?` ${this.label}`:""};`+S}}class d extends s{constructor(S){
3029
- super(),this.error=S}render({_n:S}){return`throw ${this.error};`+S}get names(){return this.error.names}}class f extends s{constructor(S){super(),this.code=S}render({_n:S}){return`${this.code};`+S}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(S,N){return this.code=B(this.code,S,N),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class p extends s{constructor(S=[]){super(),this.nodes=S}render(S){return this.nodes.reduce((N,X)=>N+X.render(S),"")}optimizeNodes(){
3030
- const{nodes:S}=this;let N=S.length;for(;N--;){const X=S[N].optimizeNodes();Array.isArray(X)?S.splice(N,1,...X):X?S[N]=X:S.splice(N,1)}return S.length>0?this:void 0}optimizeNames(S,N){const{nodes:X}=this;let se=X.length;for(;se--;){const ue=X[se];ue.optimizeNames(S,N)||(H(S,ue.names),X.splice(se,1))}return X.length>0?this:void 0}get names(){return this.nodes.reduce((S,N)=>P(S,N.names),{})}}class w extends p{render(S){return"{"+S._n+super.render(S)+"}"+S._n}}class g extends p{}class y extends w{}y.
3031
- kind="else";class m extends w{constructor(S,N){super(N),this.condition=S}render(S){let N=`if(${this.condition})`+super.render(S);return this.else&&(N+="else "+this.else.render(S)),N}optimizeNodes(){super.optimizeNodes();const S=this.condition;if(S===!0)return this.nodes;let N=this.else;if(N){const X=N.optimizeNodes();N=this.else=Array.isArray(X)?new y(X):X}if(N)return S===!1?N instanceof m?N:N.nodes:this.nodes.length?this:new m(U(S),N instanceof m?[N]:N.nodes);if(!(S===!1||!this.nodes.length))return this}optimizeNames(S,N){
3032
- var X;if(this.else=(X=this.else)===null||X===void 0?void 0:X.optimizeNames(S,N),!!(super.optimizeNames(S,N)||this.else))return this.condition=B(this.condition,S,N),this}get names(){const S=super.names;return T(S,this.condition),this.else&&P(S,this.else.names),S}}m.kind="if";class h extends w{}h.kind="for";class v extends h{constructor(S){super(),this.iteration=S}render(S){return`for(${this.iteration})`+super.render(S)}optimizeNames(S,N){if(super.optimizeNames(S,N))return this.iteration=B(this.iteration,
3033
- S,N),this}get names(){return P(super.names,this.iteration.names)}}class b extends h{constructor(S,N,X,se){super(),this.varKind=S,this.name=N,this.from=X,this.to=se}render(S){const N=S.es5?r.varKinds.var:this.varKind,{name:X,from:se,to:ue}=this;return`for(${N} ${X}=${se}; ${X}<${ue}; ${X}++)`+super.render(S)}get names(){const S=T(super.names,this.from);return T(S,this.to)}}class _ extends h{constructor(S,N,X,se){super(),this.loop=S,this.varKind=N,this.name=X,this.iterable=se}render(S){return`for(${this.
3034
- varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(S)}optimizeNames(S,N){if(super.optimizeNames(S,N))return this.iterable=B(this.iterable,S,N),this}get names(){return P(super.names,this.iterable.names)}}class R extends w{constructor(S,N,X){super(),this.name=S,this.args=N,this.async=X}render(S){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(S)}}R.kind="func";class $ extends p{render(S){return"return "+super.render(S)}}$.kind="return";class M extends w{render(S){
3035
- let N="try"+super.render(S);return this.catch&&(N+=this.catch.render(S)),this.finally&&(N+=this.finally.render(S)),N}optimizeNodes(){var S,N;return super.optimizeNodes(),(S=this.catch)===null||S===void 0||S.optimizeNodes(),(N=this.finally)===null||N===void 0||N.optimizeNodes(),this}optimizeNames(S,N){var X,se;return super.optimizeNames(S,N),(X=this.catch)===null||X===void 0||X.optimizeNames(S,N),(se=this.finally)===null||se===void 0||se.optimizeNames(S,N),this}get names(){const S=super.names;return this.
3036
- catch&&P(S,this.catch.names),this.finally&&P(S,this.finally.names),S}}class q extends w{constructor(S){super(),this.error=S}render(S){return`catch(${this.error})`+super.render(S)}}q.kind="catch";class Z extends w{render(S){return"finally"+super.render(S)}}Z.kind="finally";class L{constructor(S,N={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...N,_n:N.lines?`
2995
+ property("id").readonly.definition.variable()}),e(h_,r=>{r.property("style").readonly.definition.variable()}),e(Ln(Md,Ld),r=>{r.property("name").readonly.definition.variable()}),e(p_,r=>{r.property("predicate").readonly.definition.variable()}),e(zx,r=>{be(r.node.tag)&&r.property("tag").definition.type()}),e(Ln(Vx,tI),r=>{const n=r.node.$cstNode?.text??"";n!==""&&n!=="this"&&n!=="it"&&r.property("value").readonly.definition.variable(),r.node.parent||No()}),e(u_,r=>{(r.node.el.$refText??"")!==""&&
2996
+ r.property("el").readonly.definition.variable(),r.node.parent||No()}),e(Tg,r=>{r.keyword("color").keyword(),r.property("name").readonly.declaration.type()}),e(vf,r=>{be(r.node.color)&&r.keyword("color").property()}),e(Ln(Fc,Bc,jc),r=>{r.property("kind").readonly.declaration.type()}),e(wf,r=>{r.property("name").definition.type()}),e(wg,r=>{r.property("value").number()}),e(go,r=>{if(r.node.libicon||r.node.value==="none"){r.property(r.node.libicon?"libicon":"value").defaultLibrary.enum();return}r.property(
2997
+ "value").string()}),e(Gd,r=>{be(r.node.value)&&r.property("value").string()}),e(uo,r=>{be(r.node.customColor)&&r.property("customColor").enum(),be(r.node.themeColor)&&r.property("themeColor").enum()}),e(Ln(Sg,md,Vd,Fm,NK,K0),r=>{be(r.node.value)&&r.property("value").enum()})}highlightElement(e,r){if(Ln(Ar,Kr,un)(e))return this.highlightNameAndKind(e);if(H0(e))return this.highlightView(e);TK(e)&&!Ln(Oi,Ad,kg)(e)&&be(e.key)&&r({node:e,property:"key",type:Xh.property});let n;for(const{predicate:i,highlightFn:s}of this.
2998
+ rules)if(i(e))try{n??=this.mark(e),s(n)}catch(a){if(a===OO)return"prune";Fe.warn(`Error highlighting node of type ${e._type}`,{error:a})}}highlightNameAndKind(e){if(this.mark(e).property("name").declaration.readonly.variable(),un(e)||this.mark(e).property("kind").keyword(),Ar(e)){e.props.length>0&&this.mark(e).property("props").string();return}e.title&&this.mark(e).property("title").string()}highlightView(e){e.name&&this.mark(e).property("name").modifier("local").declaration.readonly.interface()}mark(e){
2999
+ return{node:e,cst:r=>vk((n,i)=>this.highlightToken({range:On(r??e.$cstNode,"AST node has no CST node").range,type:n,modifier:i})),keyword:r=>vk((n,i)=>this.highlightKeyword({node:e,keyword:r,type:n,modifier:i})),property:(r,n)=>vk((i,s)=>this.highlightProperty({node:e,property:r,type:i,modifier:s,...n!==void 0?{index:n}:{}}))}}}const Zre=6e4;class Jre{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=
3000
+ new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(q_,r=>{const n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(B_,r=>{this._onprogress(r)}),this.setRequestHandler(H_,r=>({}))}_setupTimeout(e,r,n,i,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,
3001
+ onTimeout:i})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new sr(Gt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){
3002
+ var r,n,i;this._transport=e;const s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};const a=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{a?.(c),this._onerror(c)};const o=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,l)=>{o?.(c,l),Yf(c)||Jg(c)?this._onresponse(c):L_(c)?this._onrequest(c,l):zZ(c)?this._onnotification(c):this._onerror(new Error(`Unknown message t\
3003
+ ype: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const n=new sr(Gt.ConnectionClosed,"Connection closed");for(const i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const n=(r=this._notificationHandlers.
3004
+ get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;const s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,a=this._transport;if(s===void 0){a?.send({jsonrpc:"2.0",id:e.id,error:{code:Gt.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error \
3005
+ response: ${l}`)));return}const o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);const c={signal:o.signal,sessionId:a?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:l=>this.notification(l,{relatedRequestId:e.id}),sendRequest:(l,u,d)=>this.request(l,u,{...d,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,c)).then(l=>{if(!o.signal.aborted)return a?.send({result:l,jsonrpc:"\
3006
+ 2.0",id:e.id})},l=>{var u;if(!o.signal.aborted)return a?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Gt.InternalError,message:(u=l.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...n}=e.params,i=Number(r),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress noti\
3007
+ fication for an unknown token: ${JSON.stringify(e)}`));return}const a=this._responseHandlers.get(i),o=this._timeoutInfo.get(i);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){a(c);return}s(n)}_onresponse(e){const r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Yf(e))n(
3008
+ e);else{const i=new sr(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){const{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}=n??{};return new Promise((o,c)=>{var l,u,d,f,p,w;if(!this._transport){c(new Error("Not connected"));return}((l=this._options)===null||l===void 0?void 0:l.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),
3009
+ (u=n?.signal)===null||u===void 0||u.throwIfAborted();const g=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),y.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:g}});const m=b=>{var _;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(_=this._transport)===null||_===void 0||_.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,
3010
+ reason:String(b)}},{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(R=>this._onerror(new Error(`Failed to send cancellation: ${R}`))),c(b)};this._responseHandlers.set(g,b=>{var _;if(!(!((_=n?.signal)===null||_===void 0)&&_.aborted)){if(b instanceof Error)return c(b);try{const R=r.parse(b.result);o(R)}catch(R){c(R)}}}),(f=n?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var b;m((b=n?.signal)===null||b===void 0?void 0:b.reason)});const h=(p=n?.timeout)!==null&&p!==void 0?
3011
+ p:Zre,v=()=>m(new sr(Gt.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(g,h,n?.maxTotalTimeout,v,(w=n?.resetTimeoutOnProgress)!==null&&w!==void 0?w:!1),this._transport.send(y,{relatedRequestId:i,resumptionToken:s,onresumptiontoken:a}).catch(b=>{this._cleanupTimeout(g),c(b)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==
3012
+ null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const l={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(l,r).catch(u=>this._onerror(u))});return}const o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){
3013
+ const n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,s)=>Promise.resolve(r(e.parse(i),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.
3014
+ delete(e)}}function LO(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Yre(t,e){const r={...t};for(const n in e){const i=n,s=e[i];if(s===void 0)continue;const a=r[i];LO(a)&&LO(s)?r[i]={...a,...s}:r[i]=s}return r}var Ly={exports:{}},wk={},Ts={},Do={},bk={},_k={},Rk={},MO;function My(){return MO||(MO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t.
3015
+ _Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends e{constructor(h){if(super(),!t.IDENTIFIER.test(h))throw new Error("CodeGen: name must be a valid identifier");this.str=h}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class n extends e{constructor(h){super(),this._items=typeof h=="string"?[h]:h}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const h=this._items[0];
3016
+ return h===""||h==='""'}get str(){var h;return(h=this._str)!==null&&h!==void 0?h:this._str=this._items.reduce((v,b)=>`${v}${b}`,"")}get names(){var h;return(h=this._names)!==null&&h!==void 0?h:this._names=this._items.reduce((v,b)=>(b instanceof r&&(v[b.str]=(v[b.str]||0)+1),v),{})}}t._Code=n,t.nil=new n("");function i(m,...h){const v=[m[0]];let b=0;for(;b<h.length;)o(v,h[b]),v.push(m[++b]);return new n(v)}t._=i;const s=new n("+");function a(m,...h){const v=[p(m[0])];let b=0;for(;b<h.length;)v.push(
3017
+ s),o(v,h[b]),v.push(s,p(m[++b]));return c(v),new n(v)}t.str=a;function o(m,h){h instanceof n?m.push(...h._items):h instanceof r?m.push(h):m.push(d(h))}t.addCodeArg=o;function c(m){let h=1;for(;h<m.length-1;){if(m[h]===s){const v=l(m[h-1],m[h+1]);if(v!==void 0){m.splice(h-1,3,v);continue}m[h++]="+"}h++}}function l(m,h){if(h==='""')return m;if(m==='""')return h;if(typeof m=="string")return h instanceof r||m[m.length-1]!=='"'?void 0:typeof h!="string"?`${m.slice(0,-1)}${h}"`:h[0]==='"'?m.slice(0,-1)+
3018
+ h.slice(1):void 0;if(typeof h=="string"&&h[0]==='"'&&!(m instanceof r))return`"${m}${h.slice(1)}`}function u(m,h){return h.emptyStr()?m:m.emptyStr()?h:a`${m}${h}`}t.strConcat=u;function d(m){return typeof m=="number"||typeof m=="boolean"||m===null?m:p(Array.isArray(m)?m.join(","):m)}function f(m){return new n(p(m))}t.stringify=f;function p(m){return JSON.stringify(m).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=p;function w(m){return typeof m=="string"&&t.IDENTIFIER.
3019
+ test(m)?new n(`.${m}`):i`[${m}]`}t.getProperty=w;function g(m){if(typeof m=="string"&&t.IDENTIFIER.test(m))return new n(`${m}`);throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`)}t.getEsmExportName=g;function y(m){return new n(m.toString())}t.regexpCode=y})(Rk)),Rk}var kk={},jO;function qO(){return jO||(jO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=My();class r extends Error{constructor(l){
3020
+ super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(t.UsedValueState=n={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class i{constructor({prefixes:l,parent:u}={}){this._names={},this._prefixes=l,this._parent=u}toName(l){return l instanceof e.Name?l:this.name(l)}name(l){return new e.Name(this._newName(l))}_newName(l){const u=this._names[l]||this._nameGroup(l);return`${l}${u.
3021
+ index++}`}_nameGroup(l){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}t.Scope=i;class s extends e.Name{constructor(l,u){super(u),this.prefix=l}setValue(l,{property:u,itemIndex:d}){this.value=l,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=s;const a=(0,e._)`\n`;class o extends i{constructor(l){
3022
+ super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?a:e.nil}}get(){return this._scope}name(l){return new s(l,this._newName(l))}value(l,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const f=this.toName(l),{prefix:p}=f,w=(d=u.key)!==null&&d!==void 0?d:u.ref;let g=this._values[p];if(g){const h=g.get(w);if(h)return h}else g=this._values[p]=new Map;g.set(w,f);const y=this._scope[p]||(this._scope[p]=[]),m=y.length;return y[m]=u.ref,f.setValue(u,
3023
+ {property:p,itemIndex:m}),f}getValue(l,u){const d=this._values[l];if(d)return d.get(u)}scopeRefs(l,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,e._)`${l}${d.scopePath}`})}scopeCode(l=this._values,u,d){return this._reduceValues(l,f=>{if(f.value===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return f.value.code},u,d)}_reduceValues(l,u,d={},f){let p=e.nil;for(const w in l){const g=l[w];if(!g)continue;
3024
+ const y=d[w]=d[w]||new Map;g.forEach(m=>{if(y.has(m))return;y.set(m,n.Started);let h=u(m);if(h){const v=this.opts.es5?t.varKinds.var:t.varKinds.const;p=(0,e._)`${p}${v} ${m} = ${h};${this.opts._n}`}else if(h=f?.(m))p=(0,e._)`${p}${h}${this.opts._n}`;else throw new r(m);y.set(m,n.Completed)})}return p}}t.ValueScope=o})(kk)),kk}var FO;function Je(){return FO||(FO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=
3025
+ t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=My(),r=qO();var n=My();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){
3026
+ return n.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}});var i=qO();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",
3027
+ {enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class s{optimizeNodes(){return this}optimizeNames(S,N){return this}}class a extends s{constructor(S,N,X){super(),this.varKind=S,this.
3028
+ name=N,this.rhs=X}render({es5:S,_n:N}){const X=S?r.varKinds.var:this.varKind,se=this.rhs===void 0?"":` = ${this.rhs}`;return`${X} ${this.name}${se};`+N}optimizeNames(S,N){if(S[this.name.str])return this.rhs&&(this.rhs=B(this.rhs,S,N)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends s{constructor(S,N,X){super(),this.lhs=S,this.rhs=N,this.sideEffects=X}render({_n:S}){return`${this.lhs} = ${this.rhs};`+S}optimizeNames(S,N){if(!(this.lhs instanceof e.Name&&
3029
+ !S[this.lhs.str]&&!this.sideEffects))return this.rhs=B(this.rhs,S,N),this}get names(){const S=this.lhs instanceof e.Name?{}:{...this.lhs.names};return T(S,this.rhs)}}class c extends o{constructor(S,N,X,se){super(S,X,se),this.op=N}render({_n:S}){return`${this.lhs} ${this.op}= ${this.rhs};`+S}}class l extends s{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`${this.label}:`+S}}class u extends s{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`break${this.
3030
+ label?` ${this.label}`:""};`+S}}class d extends s{constructor(S){super(),this.error=S}render({_n:S}){return`throw ${this.error};`+S}get names(){return this.error.names}}class f extends s{constructor(S){super(),this.code=S}render({_n:S}){return`${this.code};`+S}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(S,N){return this.code=B(this.code,S,N),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class p extends s{constructor(S=[]){super(),this.nodes=S}render(S){
3031
+ return this.nodes.reduce((N,X)=>N+X.render(S),"")}optimizeNodes(){const{nodes:S}=this;let N=S.length;for(;N--;){const X=S[N].optimizeNodes();Array.isArray(X)?S.splice(N,1,...X):X?S[N]=X:S.splice(N,1)}return S.length>0?this:void 0}optimizeNames(S,N){const{nodes:X}=this;let se=X.length;for(;se--;){const ue=X[se];ue.optimizeNames(S,N)||(H(S,ue.names),X.splice(se,1))}return X.length>0?this:void 0}get names(){return this.nodes.reduce((S,N)=>P(S,N.names),{})}}class w extends p{render(S){return"{"+S._n+
3032
+ super.render(S)+"}"+S._n}}class g extends p{}class y extends w{}y.kind="else";class m extends w{constructor(S,N){super(N),this.condition=S}render(S){let N=`if(${this.condition})`+super.render(S);return this.else&&(N+="else "+this.else.render(S)),N}optimizeNodes(){super.optimizeNodes();const S=this.condition;if(S===!0)return this.nodes;let N=this.else;if(N){const X=N.optimizeNodes();N=this.else=Array.isArray(X)?new y(X):X}if(N)return S===!1?N instanceof m?N:N.nodes:this.nodes.length?this:new m(U(
3033
+ S),N instanceof m?[N]:N.nodes);if(!(S===!1||!this.nodes.length))return this}optimizeNames(S,N){var X;if(this.else=(X=this.else)===null||X===void 0?void 0:X.optimizeNames(S,N),!!(super.optimizeNames(S,N)||this.else))return this.condition=B(this.condition,S,N),this}get names(){const S=super.names;return T(S,this.condition),this.else&&P(S,this.else.names),S}}m.kind="if";class h extends w{}h.kind="for";class v extends h{constructor(S){super(),this.iteration=S}render(S){return`for(${this.iteration})`+
3034
+ super.render(S)}optimizeNames(S,N){if(super.optimizeNames(S,N))return this.iteration=B(this.iteration,S,N),this}get names(){return P(super.names,this.iteration.names)}}class b extends h{constructor(S,N,X,se){super(),this.varKind=S,this.name=N,this.from=X,this.to=se}render(S){const N=S.es5?r.varKinds.var:this.varKind,{name:X,from:se,to:ue}=this;return`for(${N} ${X}=${se}; ${X}<${ue}; ${X}++)`+super.render(S)}get names(){const S=T(super.names,this.from);return T(S,this.to)}}class _ extends h{constructor(S,N,X,se){
3035
+ super(),this.loop=S,this.varKind=N,this.name=X,this.iterable=se}render(S){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(S)}optimizeNames(S,N){if(super.optimizeNames(S,N))return this.iterable=B(this.iterable,S,N),this}get names(){return P(super.names,this.iterable.names)}}class R extends w{constructor(S,N,X){super(),this.name=S,this.args=N,this.async=X}render(S){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(S)}}R.kind="fun\
3036
+ c";class $ extends p{render(S){return"return "+super.render(S)}}$.kind="return";class M extends w{render(S){let N="try"+super.render(S);return this.catch&&(N+=this.catch.render(S)),this.finally&&(N+=this.finally.render(S)),N}optimizeNodes(){var S,N;return super.optimizeNodes(),(S=this.catch)===null||S===void 0||S.optimizeNodes(),(N=this.finally)===null||N===void 0||N.optimizeNodes(),this}optimizeNames(S,N){var X,se;return super.optimizeNames(S,N),(X=this.catch)===null||X===void 0||X.optimizeNames(
3037
+ S,N),(se=this.finally)===null||se===void 0||se.optimizeNames(S,N),this}get names(){const S=super.names;return this.catch&&P(S,this.catch.names),this.finally&&P(S,this.finally.names),S}}class q extends w{constructor(S){super(),this.error=S}render(S){return`catch(${this.error})`+super.render(S)}}q.kind="catch";class Z extends w{render(S){return"finally"+super.render(S)}}Z.kind="finally";class L{constructor(S,N={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...N,_n:N.lines?`\
3038
+
3037
3039
  `:""},this._extScope=S,this._scope=new r.Scope({parent:S}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(S){return this._scope.name(S)}scopeName(S){return this._extScope.name(S)}scopeValue(S,N){const X=this._extScope.value(S,N);return(this._values[X.prefix]||(this._values[X.prefix]=new Set)).add(X),X}getScopeValue(S,N){return this._extScope.getValue(S,N)}scopeRefs(S){return this._extScope.scopeRefs(S,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(S,N,X,se){
3038
3040
  const ue=this._scope.toName(N);return X!==void 0&&se&&(this._constants[ue.str]=X),this._leafNode(new a(S,ue,X)),ue}const(S,N,X){return this._def(r.varKinds.const,S,N,X)}let(S,N,X){return this._def(r.varKinds.let,S,N,X)}var(S,N,X){return this._def(r.varKinds.var,S,N,X)}assign(S,N,X){return this._leafNode(new o(S,N,X))}add(S,N){return this._leafNode(new c(S,t.operators.ADD,N))}code(S){return typeof S=="function"?S():S!==e.nil&&this._leafNode(new f(S)),this}object(...S){const N=["{"];for(const[X,se]of S)
3039
3041
  N.length>1&&N.push(","),N.push(X),(X!==se||this.opts.es5)&&(N.push(":"),(0,e.addCodeArg)(N,se));return N.push("}"),new e._Code(N)}if(S,N,X){if(this._blockNode(new m(S)),N&&X)this.code(N).else().code(X).endIf();else if(N)this.code(N).endIf();else if(X)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(S){return this._elseNode(new m(S))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(m,y)}_for(S,N){return this._blockNode(S),N&&this.code(N).endFor(),
@@ -3043,26 +3045,26 @@ var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(S,(0,e._)`Obj
3043
3045
  _nodes.length-N;if(X<0||S!==void 0&&X!==S)throw new Error(`CodeGen: wrong number of nodes: ${X} vs ${S} expected`);return this._nodes.length=N,this}func(S,N=e.nil,X,se){return this._blockNode(new R(S,N,X)),se&&this.code(se).endFunc(),this}endFunc(){return this._endBlockNode(R)}optimize(S=1){for(;S-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(S){return this._currNode.nodes.push(S),this}_blockNode(S){this._currNode.nodes.push(S),this._nodes.
3044
3046
  push(S)}_endBlockNode(S,N){const X=this._currNode;if(X instanceof S||N&&X instanceof N)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${N?`${S.kind}/${N.kind}`:S.kind}"`)}_elseNode(S){const N=this._currNode;if(!(N instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=N.else=S,this}get _root(){return this._nodes[0]}get _currNode(){const S=this._nodes;return S[S.length-1]}set _currNode(S){const N=this._nodes;N[N.length-1]=S}}t.CodeGen=L;function P(K,S){
3045
3047
  for(const N in S)K[N]=(K[N]||0)+(S[N]||0);return K}function T(K,S){return S instanceof e._CodeOrName?P(K,S.names):K}function B(K,S,N){if(K instanceof e.Name)return X(K);if(!se(K))return K;return new e._Code(K._items.reduce((ue,_e)=>(_e instanceof e.Name&&(_e=X(_e)),_e instanceof e._Code?ue.push(..._e._items):ue.push(_e),ue),[]));function X(ue){const _e=N[ue.str];return _e===void 0||S[ue.str]!==1?ue:(delete S[ue.str],_e)}function se(ue){return ue instanceof e._Code&&ue._items.some(_e=>_e instanceof
3046
- e.Name&&S[_e.str]===1&&N[_e.str]!==void 0)}}function H(K,S){for(const N in S)K[N]=(K[N]||0)-(S[N]||0)}function U(K){return typeof K=="boolean"||typeof K=="number"||K===null?!K:(0,e._)`!${Y(K)}`}t.not=U;const G=F(t.operators.AND);function oe(...K){return K.reduce(G)}t.and=oe;const ne=F(t.operators.OR);function C(...K){return K.reduce(ne)}t.or=C;function F(K){return(S,N)=>S===e.nil?N:N===e.nil?S:(0,e._)`${Y(S)} ${K} ${Y(N)}`}function Y(K){return K instanceof e.Name?K:(0,e._)`(${K})`}})(Rk)),Rk}var et={},
3047
- zO;function ht(){if(zO)return et;zO=1,Object.defineProperty(et,"__esModule",{value:!0}),et.checkStrictMode=et.getErrorPath=et.Type=et.useFunc=et.setEvaluated=et.evaluatedPropsToName=et.mergeEvaluated=et.eachItem=et.unescapeJsonPointer=et.escapeJsonPointer=et.escapeFragment=et.unescapeFragment=et.schemaRefOrVal=et.schemaHasRulesButRef=et.schemaHasRules=et.checkUnknownRules=et.alwaysValidSchema=et.toHash=void 0;const t=Je(),e=My();function r(_){const R={};for(const $ of _)R[$]=!0;return R}et.toHash=
3048
+ e.Name&&S[_e.str]===1&&N[_e.str]!==void 0)}}function H(K,S){for(const N in S)K[N]=(K[N]||0)-(S[N]||0)}function U(K){return typeof K=="boolean"||typeof K=="number"||K===null?!K:(0,e._)`!${Y(K)}`}t.not=U;const G=F(t.operators.AND);function oe(...K){return K.reduce(G)}t.and=oe;const ne=F(t.operators.OR);function C(...K){return K.reduce(ne)}t.or=C;function F(K){return(S,N)=>S===e.nil?N:N===e.nil?S:(0,e._)`${Y(S)} ${K} ${Y(N)}`}function Y(K){return K instanceof e.Name?K:(0,e._)`(${K})`}})(_k)),_k}var et={},
3049
+ HO;function ht(){if(HO)return et;HO=1,Object.defineProperty(et,"__esModule",{value:!0}),et.checkStrictMode=et.getErrorPath=et.Type=et.useFunc=et.setEvaluated=et.evaluatedPropsToName=et.mergeEvaluated=et.eachItem=et.unescapeJsonPointer=et.escapeJsonPointer=et.escapeFragment=et.unescapeFragment=et.schemaRefOrVal=et.schemaHasRulesButRef=et.schemaHasRules=et.checkUnknownRules=et.alwaysValidSchema=et.toHash=void 0;const t=Je(),e=My();function r(_){const R={};for(const $ of _)R[$]=!0;return R}et.toHash=
3048
3050
  r;function n(_,R){return typeof R=="boolean"?R:Object.keys(R).length===0?!0:(i(_,R),!s(R,_.self.RULES.all))}et.alwaysValidSchema=n;function i(_,R=_.schema){const{opts:$,self:M}=_;if(!$.strictSchema||typeof R=="boolean")return;const q=M.RULES.keywords;for(const Z in R)q[Z]||b(_,`unknown keyword: "${Z}"`)}et.checkUnknownRules=i;function s(_,R){if(typeof _=="boolean")return!_;for(const $ in _)if(R[$])return!0;return!1}et.schemaHasRules=s;function a(_,R){if(typeof _=="boolean")return!_;for(const $ in _)
3049
3051
  if($!=="$ref"&&R.all[$])return!0;return!1}et.schemaHasRulesButRef=a;function o({topSchemaRef:_,schemaPath:R},$,M,q){if(!q){if(typeof $=="number"||typeof $=="boolean")return $;if(typeof $=="string")return(0,t._)`${$}`}return(0,t._)`${_}${R}${(0,t.getProperty)(M)}`}et.schemaRefOrVal=o;function c(_){return d(decodeURIComponent(_))}et.unescapeFragment=c;function l(_){return encodeURIComponent(u(_))}et.escapeFragment=l;function u(_){return typeof _=="number"?`${_}`:_.replace(/~/g,"~0").replace(/\//g,
3050
3052
  "~1")}et.escapeJsonPointer=u;function d(_){return _.replace(/~1/g,"/").replace(/~0/g,"~")}et.unescapeJsonPointer=d;function f(_,R){if(Array.isArray(_))for(const $ of _)R($);else R(_)}et.eachItem=f;function p({mergeNames:_,mergeToName:R,mergeValues:$,resultToName:M}){return(q,Z,L,P)=>{const T=L===void 0?Z:L instanceof t.Name?(Z instanceof t.Name?_(q,Z,L):R(q,Z,L),L):Z instanceof t.Name?(R(q,L,Z),Z):$(Z,L);return P===t.Name&&!(T instanceof t.Name)?M(q,T):T}}et.mergeEvaluated={props:p({mergeNames:(_,R,$)=>_.
3051
3053
  if((0,t._)`${$} !== true && ${R} !== undefined`,()=>{_.if((0,t._)`${R} === true`,()=>_.assign($,!0),()=>_.assign($,(0,t._)`${$} || {}`).code((0,t._)`Object.assign(${$}, ${R})`))}),mergeToName:(_,R,$)=>_.if((0,t._)`${$} !== true`,()=>{R===!0?_.assign($,!0):(_.assign($,(0,t._)`${$} || {}`),g(_,$,R))}),mergeValues:(_,R)=>_===!0?!0:{..._,...R},resultToName:w}),items:p({mergeNames:(_,R,$)=>_.if((0,t._)`${$} !== true && ${R} !== undefined`,()=>_.assign($,(0,t._)`${R} === true ? true : ${$} > ${R} ? ${$} : ${R}`)),
3052
3054
  mergeToName:(_,R,$)=>_.if((0,t._)`${$} !== true`,()=>_.assign($,R===!0?!0:(0,t._)`${$} > ${R} ? ${$} : ${R}`)),mergeValues:(_,R)=>_===!0?!0:Math.max(_,R),resultToName:(_,R)=>_.var("items",R)})};function w(_,R){if(R===!0)return _.var("props",!0);const $=_.var("props",(0,t._)`{}`);return R!==void 0&&g(_,$,R),$}et.evaluatedPropsToName=w;function g(_,R,$){Object.keys($).forEach(M=>_.assign((0,t._)`${R}${(0,t.getProperty)(M)}`,!0))}et.setEvaluated=g;const y={};function m(_,R){return _.scopeValue("fun\
3053
3055
  c",{ref:R,code:y[R.code]||(y[R.code]=new e._Code(R.code))})}et.useFunc=m;var h;(function(_){_[_.Num=0]="Num",_[_.Str=1]="Str"})(h||(et.Type=h={}));function v(_,R,$){if(_ instanceof t.Name){const M=R===h.Num;return $?M?(0,t._)`"[" + ${_} + "]"`:(0,t._)`"['" + ${_} + "']"`:M?(0,t._)`"/" + ${_}`:(0,t._)`"/" + ${_}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return $?(0,t.getProperty)(_).toString():"/"+u(_)}et.getErrorPath=v;function b(_,R,$=_.opts.strictSchema){if($){if(R=`strict mode: ${R}`,$===!0)
3054
- throw new Error(R);_.self.logger.warn(R)}}return et.checkStrictMode=b,et}var jy={},UO;function $s(){if(UO)return jy;UO=1,Object.defineProperty(jy,"__esModule",{value:!0});const t=Je(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),
3055
- this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return jy.default=e,jy}var VO;function qy(){return VO||(VO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=Je(),r=ht(),n=$s();t.keywordError={message:({keyword:y})=>(0,e.str)`must pass "${y}" keyword validation`},
3056
+ throw new Error(R);_.self.logger.warn(R)}}return et.checkStrictMode=b,et}var jy={},BO;function $s(){if(BO)return jy;BO=1,Object.defineProperty(jy,"__esModule",{value:!0});const t=Je(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),
3057
+ this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return jy.default=e,jy}var zO;function qy(){return zO||(zO=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=Je(),r=ht(),n=$s();t.keywordError={message:({keyword:y})=>(0,e.str)`must pass "${y}" keyword validation`},
3056
3058
  t.keyword$DataError={message:({keyword:y,schemaType:m})=>m?(0,e.str)`"${y}" keyword must be ${m} ($data)`:(0,e.str)`"${y}" keyword is invalid ($data)`};function i(y,m=t.keywordError,h,v){const{it:b}=y,{gen:_,compositeRule:R,allErrors:$}=b,M=d(y,m,h);v??(R||$)?c(_,M):l(b,(0,e._)`[${M}]`)}t.reportError=i;function s(y,m=t.keywordError,h){const{it:v}=y,{gen:b,compositeRule:_,allErrors:R}=v,$=d(y,m,h);c(b,$),_||R||l(v,n.default.vErrors)}t.reportExtraError=s;function a(y,m){y.assign(n.default.errors,m),
3057
3059
  y.if((0,e._)`${n.default.vErrors} !== null`,()=>y.if(m,()=>y.assign((0,e._)`${n.default.vErrors}.length`,m),()=>y.assign(n.default.vErrors,null)))}t.resetErrorsCount=a;function o({gen:y,keyword:m,schemaValue:h,data:v,errsCount:b,it:_}){if(b===void 0)throw new Error("ajv implementation error");const R=y.name("err");y.forRange("i",b,n.default.errors,$=>{y.const(R,(0,e._)`${n.default.vErrors}[${$}]`),y.if((0,e._)`${R}.instancePath === undefined`,()=>y.assign((0,e._)`${R}.instancePath`,(0,e.strConcat)(
3058
3060
  n.default.instancePath,_.errorPath))),y.assign((0,e._)`${R}.schemaPath`,(0,e.str)`${_.errSchemaPath}/${m}`),_.opts.verbose&&(y.assign((0,e._)`${R}.schema`,h),y.assign((0,e._)`${R}.data`,v))})}t.extendErrors=o;function c(y,m){const h=y.const("err",m);y.if((0,e._)`${n.default.vErrors} === null`,()=>y.assign(n.default.vErrors,(0,e._)`[${h}]`),(0,e._)`${n.default.vErrors}.push(${h})`),y.code((0,e._)`${n.default.errors}++`)}function l(y,m){const{gen:h,validateName:v,schemaEnv:b}=y;b.$async?h.throw((0,e.
3059
3061
  _)`new ${y.ValidationError}(${m})`):(h.assign((0,e._)`${v}.errors`,m),h.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function d(y,m,h){const{createErrors:v}=y.it;return v===!1?(0,e._)`{}`:f(y,m,h)}function f(y,m,h={}){const{gen:v,it:b}=y,_=[p(b,h),w(y,h)];return g(y,m,_),v.object(..._)}function p({
3060
3062
  errorPath:y},{instancePath:m}){const h=m?(0,e.str)`${y}${(0,r.getErrorPath)(m,r.Type.Str)}`:y;return[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,h)]}function w({keyword:y,it:{errSchemaPath:m}},{schemaPath:h,parentSchema:v}){let b=v?m:(0,e.str)`${m}/${y}`;return h&&(b=(0,e.str)`${b}${(0,r.getErrorPath)(h,r.Type.Str)}`),[u.schemaPath,b]}function g(y,{params:m,message:h},v){const{keyword:b,data:_,schemaValue:R,it:$}=y,{opts:M,propertyName:q,topSchemaRef:Z,schemaPath:L}=$;v.push([u.
3061
- keyword,b],[u.params,typeof m=="function"?m(y):m||(0,e._)`{}`]),M.messages&&v.push([u.message,typeof h=="function"?h(y):h]),M.verbose&&v.push([u.schema,R],[u.parentSchema,(0,e._)`${Z}${L}`],[n.default.data,_]),q&&v.push([u.propertyName,q])}})(_k)),_k}var WO;function Zre(){if(WO)return Do;WO=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.boolOrEmptySchema=Do.topBoolOrEmptySchema=void 0;const t=qy(),e=Je(),r=$s(),n={message:"boolean schema is false"};function i(o){const{gen:c,schema:l,validateName:u}=o;
3062
- l===!1?a(o,!1):typeof l=="object"&&l.$async===!0?c.return(r.default.data):(c.assign((0,e._)`${u}.errors`,null),c.return(!0))}Do.topBoolOrEmptySchema=i;function s(o,c){const{gen:l,schema:u}=o;u===!1?(l.var(c,!1),a(o)):l.var(c,!0)}Do.boolOrEmptySchema=s;function a(o,c){const{gen:l,data:u}=o,d={gen:l,keyword:"false schema",data:u,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)(d,n,void 0,c)}return Do}var xr={},Oo={},GO;function KO(){if(GO)return Oo;GO=1,Object.defineProperty(
3063
+ keyword,b],[u.params,typeof m=="function"?m(y):m||(0,e._)`{}`]),M.messages&&v.push([u.message,typeof h=="function"?h(y):h]),M.verbose&&v.push([u.schema,R],[u.parentSchema,(0,e._)`${Z}${L}`],[n.default.data,_]),q&&v.push([u.propertyName,q])}})(bk)),bk}var UO;function Xre(){if(UO)return Do;UO=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.boolOrEmptySchema=Do.topBoolOrEmptySchema=void 0;const t=qy(),e=Je(),r=$s(),n={message:"boolean schema is false"};function i(o){const{gen:c,schema:l,validateName:u}=o;
3064
+ l===!1?a(o,!1):typeof l=="object"&&l.$async===!0?c.return(r.default.data):(c.assign((0,e._)`${u}.errors`,null),c.return(!0))}Do.topBoolOrEmptySchema=i;function s(o,c){const{gen:l,schema:u}=o;u===!1?(l.var(c,!1),a(o)):l.var(c,!0)}Do.boolOrEmptySchema=s;function a(o,c){const{gen:l,data:u}=o,d={gen:l,keyword:"false schema",data:u,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)(d,n,void 0,c)}return Do}var xr={},Oo={},VO;function WO(){if(VO)return Oo;VO=1,Object.defineProperty(
3063
3065
  Oo,"__esModule",{value:!0}),Oo.getRules=Oo.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function r(i){return typeof i=="string"&&e.has(i)}Oo.isJSONType=r;function n(){const i={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...i,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},i.number,i.string,i.array,i.object],post:{rules:[]},all:{},keywords:{}}}
3064
- return Oo.getRules=n,Oo}var Ps={},ZO;function JO(){if(ZO)return Ps;ZO=1,Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.shouldUseRule=Ps.shouldUseGroup=Ps.schemaHasRulesForType=void 0;function t({schema:n,self:i},s){const a=i.RULES.types[s];return a&&a!==!0&&e(n,a)}Ps.schemaHasRulesForType=t;function e(n,i){return i.rules.some(s=>r(n,s))}Ps.shouldUseGroup=e;function r(n,i){var s;return n[i.keyword]!==void 0||((s=i.definition.implements)===null||s===void 0?void 0:s.some(a=>n[a]!==void 0))}return Ps.
3065
- shouldUseRule=r,Ps}var YO;function Fy(){if(YO)return xr;YO=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.reportTypeError=xr.checkDataTypes=xr.checkDataType=xr.coerceAndCheckDataType=xr.getJSONTypes=xr.getSchemaTypes=xr.DataType=void 0;const t=KO(),e=JO(),r=qy(),n=Je(),i=ht();var s;(function(h){h[h.Correct=0]="Correct",h[h.Wrong=1]="Wrong"})(s||(xr.DataType=s={}));function a(h){const v=o(h.type);if(v.includes("null")){if(h.nullable===!1)throw new Error("type: null contradicts nullable: f\
3066
+ return Oo.getRules=n,Oo}var Ps={},GO;function KO(){if(GO)return Ps;GO=1,Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.shouldUseRule=Ps.shouldUseGroup=Ps.schemaHasRulesForType=void 0;function t({schema:n,self:i},s){const a=i.RULES.types[s];return a&&a!==!0&&e(n,a)}Ps.schemaHasRulesForType=t;function e(n,i){return i.rules.some(s=>r(n,s))}Ps.shouldUseGroup=e;function r(n,i){var s;return n[i.keyword]!==void 0||((s=i.definition.implements)===null||s===void 0?void 0:s.some(a=>n[a]!==void 0))}return Ps.
3067
+ shouldUseRule=r,Ps}var ZO;function Fy(){if(ZO)return xr;ZO=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.reportTypeError=xr.checkDataTypes=xr.checkDataType=xr.coerceAndCheckDataType=xr.getJSONTypes=xr.getSchemaTypes=xr.DataType=void 0;const t=WO(),e=KO(),r=qy(),n=Je(),i=ht();var s;(function(h){h[h.Correct=0]="Correct",h[h.Wrong=1]="Wrong"})(s||(xr.DataType=s={}));function a(h){const v=o(h.type);if(v.includes("null")){if(h.nullable===!1)throw new Error("type: null contradicts nullable: f\
3066
3068
  alse")}else{if(!v.length&&h.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');h.nullable===!0&&v.push("null")}return v}xr.getSchemaTypes=a;function o(h){const v=Array.isArray(h)?h:h?[h]:[];if(v.every(t.isJSONType))return v;throw new Error("type must be JSONType or JSONType[]: "+v.join(","))}xr.getJSONTypes=o;function c(h,v){const{gen:b,data:_,opts:R}=h,$=u(v,R.coerceTypes),M=v.length>0&&!($.length===0&&v.length===1&&(0,e.schemaHasRulesForType)(h,v[0]));if(M){const q=w(
3067
3069
  v,_,R.strictNumbers,s.Wrong);b.if(q,()=>{$.length?d(h,v,$):y(h)})}return M}xr.coerceAndCheckDataType=c;const l=new Set(["string","number","integer","boolean","null"]);function u(h,v){return v?h.filter(b=>l.has(b)||v==="array"&&b==="array"):[]}function d(h,v,b){const{gen:_,data:R,opts:$}=h,M=_.let("dataType",(0,n._)`typeof ${R}`),q=_.let("coerced",(0,n._)`undefined`);$.coerceTypes==="array"&&_.if((0,n._)`${M} == 'object' && Array.isArray(${R}) && ${R}.length == 1`,()=>_.assign(R,(0,n._)`${R}[0]`).
3068
3070
  assign(M,(0,n._)`typeof ${R}`).if(w(v,R,$.strictNumbers),()=>_.assign(q,R))),_.if((0,n._)`${q} !== undefined`);for(const L of b)(l.has(L)||L==="array"&&$.coerceTypes==="array")&&Z(L);_.else(),y(h),_.endIf(),_.if((0,n._)`${q} !== undefined`,()=>{_.assign(R,q),f(h,q)});function Z(L){switch(L){case"string":_.elseIf((0,n._)`${M} == "number" || ${M} == "boolean"`).assign(q,(0,n._)`"" + ${R}`).elseIf((0,n._)`${R} === null`).assign(q,(0,n._)`""`);return;case"number":_.elseIf((0,n._)`${M} == "boolean" || ${R} === null
@@ -3071,33 +3073,33 @@ assign(M,(0,n._)`typeof ${R}`).if(w(v,R,$.strictNumbers),()=>_.assign(q,R))),_.i
3071
3073
  || ${M} === "boolean" || ${R} === null`).assign(q,(0,n._)`[${R}]`)}}}function f({gen:h,parentData:v,parentDataProperty:b},_){h.if((0,n._)`${v} !== undefined`,()=>h.assign((0,n._)`${v}[${b}]`,_))}function p(h,v,b,_=s.Correct){const R=_===s.Correct?n.operators.EQ:n.operators.NEQ;let $;switch(h){case"null":return(0,n._)`${v} ${R} null`;case"array":$=(0,n._)`Array.isArray(${v})`;break;case"object":$=(0,n._)`${v} && typeof ${v} == "object" && !Array.isArray(${v})`;break;case"integer":$=
3072
3074
  M((0,n._)`!(${v} % 1) && !isNaN(${v})`);break;case"number":$=M();break;default:return(0,n._)`typeof ${v} ${R} ${h}`}return _===s.Correct?$:(0,n.not)($);function M(q=n.nil){return(0,n.and)((0,n._)`typeof ${v} == "number"`,q,b?(0,n._)`isFinite(${v})`:n.nil)}}xr.checkDataType=p;function w(h,v,b,_){if(h.length===1)return p(h[0],v,b,_);let R;const $=(0,i.toHash)(h);if($.array&&$.object){const M=(0,n._)`typeof ${v} != "object"`;R=$.null?M:(0,n._)`!${v} || ${M}`,delete $.null,delete $.array,delete $.object}else
3073
3075
  R=n.nil;$.number&&delete $.integer;for(const M in $)R=(0,n.and)(R,p(M,v,b,_));return R}xr.checkDataTypes=w;const g={message:({schema:h})=>`must be ${h}`,params:({schema:h,schemaValue:v})=>typeof h=="string"?(0,n._)`{type: ${h}}`:(0,n._)`{type: ${v}}`};function y(h){const v=m(h);(0,r.reportError)(v,g)}xr.reportTypeError=y;function m(h){const{gen:v,data:b,schema:_}=h,R=(0,i.schemaRefOrVal)(h,_,"type");return{gen:v,keyword:"type",data:b,schema:_.type,schemaCode:R,schemaValue:R,parentSchema:_,params:{},
3074
- it:h}}return xr}var gp={},XO;function Jre(){if(XO)return gp;XO=1,Object.defineProperty(gp,"__esModule",{value:!0}),gp.assignDefaults=void 0;const t=Je(),e=ht();function r(i,s){const{properties:a,items:o}=i.schema;if(s==="object"&&a)for(const c in a)n(i,c,a[c].default);else s==="array"&&Array.isArray(o)&&o.forEach((c,l)=>n(i,l,c.default))}gp.assignDefaults=r;function n(i,s,a){const{gen:o,compositeRule:c,data:l,opts:u}=i;if(a===void 0)return;const d=(0,t._)`${l}${(0,t.getProperty)(s)}`;if(c){(0,e.
3075
- checkStrictMode)(i,`default is ignored for: ${d}`);return}let f=(0,t._)`${d} === undefined`;u.useDefaults==="empty"&&(f=(0,t._)`${f} || ${d} === null || ${d} === ""`),o.if(f,(0,t._)`${d} = ${(0,t.stringify)(a)}`)}return gp}var mi={},kt={},QO;function gi(){if(QO)return kt;QO=1,Object.defineProperty(kt,"__esModule",{value:!0}),kt.validateUnion=kt.validateArray=kt.usePattern=kt.callValidateCode=kt.schemaProperties=kt.allSchemaProperties=kt.noPropertyInData=kt.propertyInData=kt.isOwnProperty=kt.hasPropFunc=
3076
+ it:h}}return xr}var gp={},JO;function Qre(){if(JO)return gp;JO=1,Object.defineProperty(gp,"__esModule",{value:!0}),gp.assignDefaults=void 0;const t=Je(),e=ht();function r(i,s){const{properties:a,items:o}=i.schema;if(s==="object"&&a)for(const c in a)n(i,c,a[c].default);else s==="array"&&Array.isArray(o)&&o.forEach((c,l)=>n(i,l,c.default))}gp.assignDefaults=r;function n(i,s,a){const{gen:o,compositeRule:c,data:l,opts:u}=i;if(a===void 0)return;const d=(0,t._)`${l}${(0,t.getProperty)(s)}`;if(c){(0,e.
3077
+ checkStrictMode)(i,`default is ignored for: ${d}`);return}let f=(0,t._)`${d} === undefined`;u.useDefaults==="empty"&&(f=(0,t._)`${f} || ${d} === null || ${d} === ""`),o.if(f,(0,t._)`${d} = ${(0,t.stringify)(a)}`)}return gp}var mi={},kt={},YO;function gi(){if(YO)return kt;YO=1,Object.defineProperty(kt,"__esModule",{value:!0}),kt.validateUnion=kt.validateArray=kt.usePattern=kt.callValidateCode=kt.schemaProperties=kt.allSchemaProperties=kt.noPropertyInData=kt.propertyInData=kt.isOwnProperty=kt.hasPropFunc=
3076
3078
  kt.reportMissingProp=kt.checkMissingProp=kt.checkReportMissingProp=void 0;const t=Je(),e=ht(),r=$s(),n=ht();function i(h,v){const{gen:b,data:_,it:R}=h;b.if(u(b,_,v,R.opts.ownProperties),()=>{h.setParams({missingProperty:(0,t._)`${v}`},!0),h.error()})}kt.checkReportMissingProp=i;function s({gen:h,data:v,it:{opts:b}},_,R){return(0,t.or)(..._.map($=>(0,t.and)(u(h,v,$,b.ownProperties),(0,t._)`${R} = ${$}`)))}kt.checkMissingProp=s;function a(h,v){h.setParams({missingProperty:v},!0),h.error()}kt.reportMissingProp=
3077
3079
  a;function o(h){return h.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}kt.hasPropFunc=o;function c(h,v,b){return(0,t._)`${o(h)}.call(${v}, ${b})`}kt.isOwnProperty=c;function l(h,v,b,_){const R=(0,t._)`${v}${(0,t.getProperty)(b)} !== undefined`;return _?(0,t._)`${R} && ${c(h,v,b)}`:R}kt.propertyInData=l;function u(h,v,b,_){const R=(0,t._)`${v}${(0,t.getProperty)(b)} === undefined`;return _?(0,t.or)(R,(0,t.not)(c(h,v,b))):R}kt.noPropertyInData=
3078
3080
  u;function d(h){return h?Object.keys(h).filter(v=>v!=="__proto__"):[]}kt.allSchemaProperties=d;function f(h,v){return d(v).filter(b=>!(0,e.alwaysValidSchema)(h,v[b]))}kt.schemaProperties=f;function p({schemaCode:h,data:v,it:{gen:b,topSchemaRef:_,schemaPath:R,errorPath:$},it:M},q,Z,L){const P=L?(0,t._)`${h}, ${v}, ${_}${R}`:v,T=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,$)],[r.default.parentData,M.parentData],[r.default.parentDataProperty,M.parentDataProperty],[r.default.rootData,
3079
3081
  r.default.rootData]];M.opts.dynamicRef&&T.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const B=(0,t._)`${P}, ${b.object(...T)}`;return Z!==t.nil?(0,t._)`${q}.call(${Z}, ${B})`:(0,t._)`${q}(${B})`}kt.callValidateCode=p;const w=(0,t._)`new RegExp`;function g({gen:h,it:{opts:v}},b){const _=v.unicodeRegExp?"u":"",{regExp:R}=v.code,$=R(b,_);return h.scopeValue("pattern",{key:$.toString(),ref:$,code:(0,t._)`${R.code==="new RegExp"?w:(0,n.useFunc)(h,R)}(${b}, ${_})`})}kt.usePattern=g;function y(h){
3080
3082
  const{gen:v,data:b,keyword:_,it:R}=h,$=v.name("valid");if(R.allErrors){const q=v.let("valid",!0);return M(()=>v.assign(q,!1)),q}return v.var($,!0),M(()=>v.break()),$;function M(q){const Z=v.const("len",(0,t._)`${b}.length`);v.forRange("i",0,Z,L=>{h.subschema({keyword:_,dataProp:L,dataPropType:e.Type.Num},$),v.if((0,t.not)($),q)})}}kt.validateArray=y;function m(h){const{gen:v,schema:b,keyword:_,it:R}=h;if(!Array.isArray(b))throw new Error("ajv implementation error");if(b.some(Z=>(0,e.alwaysValidSchema)(
3081
- R,Z))&&!R.opts.unevaluated)return;const M=v.let("valid",!1),q=v.name("_valid");v.block(()=>b.forEach((Z,L)=>{const P=h.subschema({keyword:_,schemaProp:L,compositeRule:!0},q);v.assign(M,(0,t._)`${M} || ${q}`),h.mergeValidEvaluated(P,q)||v.if((0,t.not)(M))})),h.result(M,()=>h.reset(),()=>h.error(!0))}return kt.validateUnion=m,kt}var eL;function Yre(){if(eL)return mi;eL=1,Object.defineProperty(mi,"__esModule",{value:!0}),mi.validateKeywordUsage=mi.validSchemaType=mi.funcKeywordCode=mi.macroKeywordCode=
3083
+ R,Z))&&!R.opts.unevaluated)return;const M=v.let("valid",!1),q=v.name("_valid");v.block(()=>b.forEach((Z,L)=>{const P=h.subschema({keyword:_,schemaProp:L,compositeRule:!0},q);v.assign(M,(0,t._)`${M} || ${q}`),h.mergeValidEvaluated(P,q)||v.if((0,t.not)(M))})),h.result(M,()=>h.reset(),()=>h.error(!0))}return kt.validateUnion=m,kt}var XO;function ene(){if(XO)return mi;XO=1,Object.defineProperty(mi,"__esModule",{value:!0}),mi.validateKeywordUsage=mi.validSchemaType=mi.funcKeywordCode=mi.macroKeywordCode=
3082
3084
  void 0;const t=Je(),e=$s(),r=gi(),n=qy();function i(f,p){const{gen:w,keyword:g,schema:y,parentSchema:m,it:h}=f,v=p.macro.call(h.self,y,m,h),b=l(w,g,v);h.opts.validateSchema!==!1&&h.self.validateSchema(v,!0);const _=w.name("valid");f.subschema({schema:v,schemaPath:t.nil,errSchemaPath:`${h.errSchemaPath}/${g}`,topSchemaRef:b,compositeRule:!0},_),f.pass(_,()=>f.error(!0))}mi.macroKeywordCode=i;function s(f,p){var w;const{gen:g,keyword:y,schema:m,parentSchema:h,$data:v,it:b}=f;c(b,p);const _=!v&&p.compile?
3083
3085
  p.compile.call(b.self,m,h,b):p.validate,R=l(g,y,_),$=g.let("valid");f.block$data($,M),f.ok((w=p.valid)!==null&&w!==void 0?w:$);function M(){if(p.errors===!1)L(),p.modifying&&a(f),P(()=>f.error());else{const T=p.async?q():Z();p.modifying&&a(f),P(()=>o(f,T))}}function q(){const T=g.let("ruleErrs",null);return g.try(()=>L((0,t._)`await `),B=>g.assign($,!1).if((0,t._)`${B} instanceof ${b.ValidationError}`,()=>g.assign(T,(0,t._)`${B}.errors`),()=>g.throw(B))),T}function Z(){const T=(0,t._)`${R}.errors`;
3084
3086
  return g.assign(T,null),L(t.nil),T}function L(T=p.async?(0,t._)`await `:t.nil){const B=b.opts.passContext?e.default.this:e.default.self,H=!("compile"in p&&!v||p.schema===!1);g.assign($,(0,t._)`${T}${(0,r.callValidateCode)(f,R,B,H)}`,p.modifying)}function P(T){var B;g.if((0,t.not)((B=p.valid)!==null&&B!==void 0?B:$),T)}}mi.funcKeywordCode=s;function a(f){const{gen:p,data:w,it:g}=f;p.if(g.parentData,()=>p.assign(w,(0,t._)`${g.parentData}[${g.parentDataProperty}]`))}function o(f,p){const{gen:w}=f;w.
3085
3087
  if((0,t._)`Array.isArray(${p})`,()=>{w.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${p} : ${e.default.vErrors}.concat(${p})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,n.extendErrors)(f)},()=>f.error())}function c({schemaEnv:f},p){if(p.async&&!f.$async)throw new Error("async keyword in sync schema")}function l(f,p,w){if(w===void 0)throw new Error(`keyword "${p}" failed to compile`);return f.scopeValue("keyword",typeof w=="function"?{ref:w}:{ref:w,code:(0,t.
3086
3088
  stringify)(w)})}function u(f,p,w=!1){return!p.length||p.some(g=>g==="array"?Array.isArray(f):g==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==g||w&&typeof f>"u")}mi.validSchemaType=u;function d({schema:f,opts:p,self:w,errSchemaPath:g},y,m){if(Array.isArray(y.keyword)?!y.keyword.includes(m):y.keyword!==m)throw new Error("ajv implementation error");const h=y.dependencies;if(h?.some(v=>!Object.prototype.hasOwnProperty.call(f,v)))throw new Error(`parent schema must have dependencies o\
3087
- f ${m}: ${h.join(",")}`);if(y.validateSchema&&!y.validateSchema(f[m])){const b=`keyword "${m}" value is invalid at path "${g}": `+w.errorsText(y.validateSchema.errors);if(p.validateSchema==="log")w.logger.error(b);else throw new Error(b)}}return mi.validateKeywordUsage=d,mi}var Cs={},tL;function Xre(){if(tL)return Cs;tL=1,Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.extendSubschemaMode=Cs.extendSubschemaData=Cs.getSubschema=void 0;const t=Je(),e=ht();function r(s,{keyword:a,schemaProp:o,
3089
+ f ${m}: ${h.join(",")}`);if(y.validateSchema&&!y.validateSchema(f[m])){const b=`keyword "${m}" value is invalid at path "${g}": `+w.errorsText(y.validateSchema.errors);if(p.validateSchema==="log")w.logger.error(b);else throw new Error(b)}}return mi.validateKeywordUsage=d,mi}var Cs={},QO;function tne(){if(QO)return Cs;QO=1,Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.extendSubschemaMode=Cs.extendSubschemaData=Cs.getSubschema=void 0;const t=Je(),e=ht();function r(s,{keyword:a,schemaProp:o,
3088
3090
  schema:c,schemaPath:l,errSchemaPath:u,topSchemaRef:d}){if(a!==void 0&&c!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){const f=s.schema[a];return o===void 0?{schema:f,schemaPath:(0,t._)`${s.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${s.errSchemaPath}/${a}`}:{schema:f[o],schemaPath:(0,t._)`${s.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(o)}`,errSchemaPath:`${s.errSchemaPath}/${a}/${(0,e.escapeFragment)(o)}`}}if(c!==void 0){if(l===
3089
3091
  void 0||u===void 0||d===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:c,schemaPath:l,topSchemaRef:d,errSchemaPath:u}}throw new Error('either "keyword" or "schema" must be passed')}Cs.getSubschema=r;function n(s,a,{dataProp:o,dataPropType:c,data:l,dataTypes:u,propertyName:d}){if(l!==void 0&&o!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:f}=a;if(o!==void 0){const{errorPath:w,dataPathArr:g,
3090
3092
  opts:y}=a,m=f.let("data",(0,t._)`${a.data}${(0,t.getProperty)(o)}`,!0);p(m),s.errorPath=(0,t.str)`${w}${(0,e.getErrorPath)(o,c,y.jsPropertySyntax)}`,s.parentDataProperty=(0,t._)`${o}`,s.dataPathArr=[...g,s.parentDataProperty]}if(l!==void 0){const w=l instanceof t.Name?l:f.let("data",l,!0);p(w),d!==void 0&&(s.propertyName=d)}u&&(s.dataTypes=u);function p(w){s.data=w,s.dataLevel=a.dataLevel+1,s.dataTypes=[],a.definedProperties=new Set,s.parentData=a.data,s.dataNames=[...a.dataNames,w]}}Cs.extendSubschemaData=
3091
- n;function i(s,{jtdDiscriminator:a,jtdMetadata:o,compositeRule:c,createErrors:l,allErrors:u}){c!==void 0&&(s.compositeRule=c),l!==void 0&&(s.createErrors=l),u!==void 0&&(s.allErrors=u),s.jtdDiscriminator=a,s.jtdMetadata=o}return Cs.extendSubschemaMode=i,Cs}var Yr={},Ek,rL;function nL(){return rL||(rL=1,Ek=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=
3092
- n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var a=s[i];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}),Ek}var Tk={
3093
- exports:{}},iL;function Qre(){if(iL)return Tk.exports;iL=1;var t=Tk.exports=function(n,i,s){typeof i=="function"&&(s=i,i={}),s=i.cb||s;var a=typeof s=="function"?s:s.pre||function(){},o=s.post||function(){};e(i,a,o,n,"",n)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords=
3093
+ n;function i(s,{jtdDiscriminator:a,jtdMetadata:o,compositeRule:c,createErrors:l,allErrors:u}){c!==void 0&&(s.compositeRule=c),l!==void 0&&(s.createErrors=l),u!==void 0&&(s.allErrors=u),s.jtdDiscriminator=a,s.jtdMetadata=o}return Cs.extendSubschemaMode=i,Cs}var Yr={},Sk,eL;function tL(){return eL||(eL=1,Sk=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=
3094
+ n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var a=s[i];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}),Sk}var Ek={
3095
+ exports:{}},rL;function rne(){if(rL)return Ek.exports;rL=1;var t=Ek.exports=function(n,i,s){typeof i=="function"&&(s=i,i={}),s=i.cb||s;var a=typeof s=="function"?s:s.pre||function(){},o=s.post||function(){};e(i,a,o,n,"",n)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords=
3094
3096
  {default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function e(n,i,s,a,o,c,l,u,d,f){if(a&&typeof a=="object"&&!Array.isArray(a)){i(a,o,c,l,u,d,f);for(var p in a){var w=a[p];if(Array.isArray(w)){if(p in t.arrayKeywords)for(var g=0;g<w.length;g++)e(n,i,s,w[g],o+"/"+p+"/"+g,c,o,p,a,g)}else if(p in t.propsKeywords){if(w&&
3095
- typeof w=="object")for(var y in w)e(n,i,s,w[y],o+"/"+p+"/"+r(y),c,o,p,a,y)}else(p in t.keywords||n.allKeys&&!(p in t.skipKeywords))&&e(n,i,s,w,o+"/"+p,c,o,p,a)}s(a,o,c,l,u,d,f)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return Tk.exports}var sL;function Hy(){if(sL)return Yr;sL=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.getSchemaRefs=Yr.resolveUrl=Yr.normalizeId=Yr._getFullPath=Yr.getFullPath=Yr.inlineRef=void 0;const t=ht(),e=nL(),r=Qre(),n=new Set(["type","format",
3097
+ typeof w=="object")for(var y in w)e(n,i,s,w[y],o+"/"+p+"/"+r(y),c,o,p,a,y)}else(p in t.keywords||n.allKeys&&!(p in t.skipKeywords))&&e(n,i,s,w,o+"/"+p,c,o,p,a)}s(a,o,c,l,u,d,f)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return Ek.exports}var nL;function Hy(){if(nL)return Yr;nL=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.getSchemaRefs=Yr.resolveUrl=Yr.normalizeId=Yr._getFullPath=Yr.getFullPath=Yr.inlineRef=void 0;const t=ht(),e=tL(),r=rne(),n=new Set(["type","format",
3096
3098
  "pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function i(g,y=!0){return typeof g=="boolean"?!0:y===!0?!a(g):y?o(g)<=y:!1}Yr.inlineRef=i;const s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(g){for(const y in g){if(s.has(y))return!0;const m=g[y];if(Array.isArray(m)&&m.some(a)||typeof m=="object"&&a(m))return!0}return!1}function o(g){
3097
3099
  let y=0;for(const m in g){if(m==="$ref")return 1/0;if(y++,!n.has(m)&&(typeof g[m]=="object"&&(0,t.eachItem)(g[m],h=>y+=o(h)),y===1/0))return 1/0}return y}function c(g,y="",m){m!==!1&&(y=d(y));const h=g.parse(y);return l(g,h)}Yr.getFullPath=c;function l(g,y){return g.serialize(y).split("#")[0]+"#"}Yr._getFullPath=l;const u=/#\/?$/;function d(g){return g?g.replace(u,""):""}Yr.normalizeId=d;function f(g,y,m){return m=d(m),g.resolve(y,m)}Yr.resolveUrl=f;const p=/^[a-z_][-a-z0-9._]*$/i;function w(g,y){
3098
3100
  if(typeof g=="boolean")return{};const{schemaId:m,uriResolver:h}=this.opts,v=d(g[m]||y),b={"":v},_=c(h,v,!1),R={},$=new Set;return r(g,{allKeys:!0},(Z,L,P,T)=>{if(T===void 0)return;const B=_+L;let H=b[T];typeof Z[m]=="string"&&(H=U.call(this,Z[m])),G.call(this,Z.$anchor),G.call(this,Z.$dynamicAnchor),b[L]=H;function U(oe){const ne=this.opts.uriResolver.resolve;if(oe=d(H?ne(H,oe):oe),$.has(oe))throw q(oe);$.add(oe);let C=this.refs[oe];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?
3099
- M(Z,C.schema,oe):oe!==d(B)&&(oe[0]==="#"?(M(Z,R[oe],oe),R[oe]=Z):this.refs[oe]=B),oe}function G(oe){if(typeof oe=="string"){if(!p.test(oe))throw new Error(`invalid anchor "${oe}"`);U.call(this,`#${oe}`)}}}),R;function M(Z,L,P){if(L!==void 0&&!e(Z,L))throw q(P)}function q(Z){return new Error(`reference "${Z}" resolves to more than one schema`)}}return Yr.getSchemaRefs=w,Yr}var aL;function yp(){if(aL)return Ts;aL=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.getData=Ts.KeywordCxt=Ts.validateFunctionCode=
3100
- void 0;const t=Zre(),e=Fy(),r=JO(),n=Fy(),i=Jre(),s=Yre(),a=Xre(),o=Je(),c=$s(),l=Hy(),u=ht(),d=qy();function f(x){if(_(x)&&($(x),b(x))){y(x);return}p(x,()=>(0,t.topBoolOrEmptySchema)(x))}Ts.validateFunctionCode=f;function p({gen:x,validateName:O,schema:J,schemaEnv:z,opts:ae},Re){ae.code.es5?x.func(O,(0,o._)`${c.default.data}, ${c.default.valCxt}`,z.$async,()=>{x.code((0,o._)`"use strict"; ${h(J,ae)}`),g(x,ae),x.code(Re)}):x.func(O,(0,o._)`${c.default.data}, ${w(ae)}`,z.$async,()=>x.code(h(J,ae)).
3101
+ M(Z,C.schema,oe):oe!==d(B)&&(oe[0]==="#"?(M(Z,R[oe],oe),R[oe]=Z):this.refs[oe]=B),oe}function G(oe){if(typeof oe=="string"){if(!p.test(oe))throw new Error(`invalid anchor "${oe}"`);U.call(this,`#${oe}`)}}}),R;function M(Z,L,P){if(L!==void 0&&!e(Z,L))throw q(P)}function q(Z){return new Error(`reference "${Z}" resolves to more than one schema`)}}return Yr.getSchemaRefs=w,Yr}var iL;function yp(){if(iL)return Ts;iL=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.getData=Ts.KeywordCxt=Ts.validateFunctionCode=
3102
+ void 0;const t=Xre(),e=Fy(),r=KO(),n=Fy(),i=Qre(),s=ene(),a=tne(),o=Je(),c=$s(),l=Hy(),u=ht(),d=qy();function f(x){if(_(x)&&($(x),b(x))){y(x);return}p(x,()=>(0,t.topBoolOrEmptySchema)(x))}Ts.validateFunctionCode=f;function p({gen:x,validateName:O,schema:J,schemaEnv:z,opts:ae},Re){ae.code.es5?x.func(O,(0,o._)`${c.default.data}, ${c.default.valCxt}`,z.$async,()=>{x.code((0,o._)`"use strict"; ${h(J,ae)}`),g(x,ae),x.code(Re)}):x.func(O,(0,o._)`${c.default.data}, ${w(ae)}`,z.$async,()=>x.code(h(J,ae)).
3101
3103
  code(Re))}function w(x){return(0,o._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${x.dynamicRef?(0,o._)`, ${c.default.dynamicAnchors}={}`:o.nil}}={}`}function g(x,O){x.if(c.default.valCxt,()=>{x.var(c.default.instancePath,(0,o._)`${c.default.valCxt}.${c.default.instancePath}`),x.var(c.default.parentData,(0,o._)`${c.default.valCxt}.${c.default.parentData}`),x.var(c.default.parentDataProperty,(0,o._)`${c.default.valCxt}.${c.
3102
3104
  default.parentDataProperty}`),x.var(c.default.rootData,(0,o._)`${c.default.valCxt}.${c.default.rootData}`),O.dynamicRef&&x.var(c.default.dynamicAnchors,(0,o._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{x.var(c.default.instancePath,(0,o._)`""`),x.var(c.default.parentData,(0,o._)`undefined`),x.var(c.default.parentDataProperty,(0,o._)`undefined`),x.var(c.default.rootData,c.default.data),O.dynamicRef&&x.var(c.default.dynamicAnchors,(0,o._)`{}`)})}function y(x){const{schema:O,opts:J,gen:z}=x;
3103
3105
  p(x,()=>{J.$comment&&O.$comment&&T(x),Z(x),z.let(c.default.vErrors,null),z.let(c.default.errors,0),J.unevaluated&&m(x),M(x),B(x)})}function m(x){const{gen:O,validateName:J}=x;x.evaluated=O.const("evaluated",(0,o._)`${J}.evaluated`),O.if((0,o._)`${x.evaluated}.dynamicProps`,()=>O.assign((0,o._)`${x.evaluated}.props`,(0,o._)`undefined`)),O.if((0,o._)`${x.evaluated}.dynamicItems`,()=>O.assign((0,o._)`${x.evaluated}.items`,(0,o._)`undefined`))}function h(x,O){const J=typeof x=="object"&&x[O.schemaId];
@@ -3117,8 +3119,8 @@ this.$dataError(),O!==o.nil&&z.assign(O,!1)),z.else()}invalid$data(){const{gen:O
3117
3119
  return o.nil}}subschema(O,J){const z=(0,a.getSubschema)(this.it,O);(0,a.extendSubschemaData)(z,this.it,O),(0,a.extendSubschemaMode)(z,O);const ae={...this.it,...z,items:void 0,props:void 0};return v(ae,J),ae}mergeEvaluated(O,J){const{it:z,gen:ae}=this;z.opts.unevaluated&&(z.props!==!0&&O.props!==void 0&&(z.props=u.mergeEvaluated.props(ae,O.props,z.props,J)),z.items!==!0&&O.items!==void 0&&(z.items=u.mergeEvaluated.items(ae,O.items,z.items,J)))}mergeValidEvaluated(O,J){const{it:z,gen:ae}=this;if(z.
3118
3120
  opts.unevaluated&&(z.props!==!0||z.items!==!0))return ae.if(J,()=>this.mergeEvaluated(O,o.Name)),!0}}Ts.KeywordCxt=X;function se(x,O,J,z){const ae=new X(x,J,O);"code"in J?J.code(ae,z):ae.$data&&J.validate?(0,s.funcKeywordCode)(ae,J):"macro"in J?(0,s.macroKeywordCode)(ae,J):(J.compile||J.validate)&&(0,s.funcKeywordCode)(ae,J)}const ue=/^\/(?:[^~]|~0|~1)*$/,_e=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function de(x,{dataLevel:O,dataNames:J,dataPathArr:z}){let ae,Re;if(x==="")return c.default.rootData;if(x[0]===
3119
3121
  "/"){if(!ue.test(x))throw new Error(`Invalid JSON-pointer: ${x}`);ae=x,Re=c.default.rootData}else{const pe=_e.exec(x);if(!pe)throw new Error(`Invalid JSON-pointer: ${x}`);const Se=+pe[1];if(ae=pe[2],ae==="#"){if(Se>=O)throw new Error(Ne("property/index",Se));return z[O-Se]}if(Se>O)throw new Error(Ne("data",Se));if(Re=J[O-Se],!ae)return Re}let Me=Re;const me=ae.split("/");for(const pe of me)pe&&(Re=(0,o._)`${Re}${(0,o.getProperty)((0,u.unescapeJsonPointer)(pe))}`,Me=(0,o._)`${Me} && ${Re}`);return Me;
3120
- function Ne(pe,Se){return`Cannot access ${pe} ${Se} levels up, current level is ${O}`}}return Ts.getData=de,Ts}var By={},oL;function zy(){if(oL)return By;oL=1,Object.defineProperty(By,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return By.default=t,By}var Uy={},cL;function vp(){if(cL)return Uy;cL=1,Object.defineProperty(Uy,"__esModule",{value:!0});const t=Hy();class e extends Error{constructor(n,i,s,a){super(a||
3121
- `can't resolve reference ${s} from id ${i}`),this.missingRef=(0,t.resolveUrl)(n,i,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}}return Uy.default=e,Uy}var Pn={},lL;function Vy(){if(lL)return Pn;lL=1,Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.resolveSchema=Pn.getCompilingSchema=Pn.resolveRef=Pn.compileSchema=Pn.SchemaEnv=void 0;const t=Je(),e=zy(),r=$s(),n=Hy(),i=ht(),s=yp();class a{constructor(m){var h;this.refs={},this.dynamicAnchors={};let v;typeof m.
3122
+ function Ne(pe,Se){return`Cannot access ${pe} ${Se} levels up, current level is ${O}`}}return Ts.getData=de,Ts}var By={},sL;function zy(){if(sL)return By;sL=1,Object.defineProperty(By,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return By.default=t,By}var Uy={},aL;function vp(){if(aL)return Uy;aL=1,Object.defineProperty(Uy,"__esModule",{value:!0});const t=Hy();class e extends Error{constructor(n,i,s,a){super(a||
3123
+ `can't resolve reference ${s} from id ${i}`),this.missingRef=(0,t.resolveUrl)(n,i,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}}return Uy.default=e,Uy}var Pn={},oL;function Vy(){if(oL)return Pn;oL=1,Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.resolveSchema=Pn.getCompilingSchema=Pn.resolveRef=Pn.compileSchema=Pn.SchemaEnv=void 0;const t=Je(),e=zy(),r=$s(),n=Hy(),i=ht(),s=yp();class a{constructor(m){var h;this.refs={},this.dynamicAnchors={};let v;typeof m.
3122
3124
  schema=="object"&&(v=m.schema),this.schema=m.schema,this.schemaId=m.schemaId,this.root=m.root||this,this.baseId=(h=m.baseId)!==null&&h!==void 0?h:(0,n.normalizeId)(v?.[m.schemaId||"$id"]),this.schemaPath=m.schemaPath,this.localRefs=m.localRefs,this.meta=m.meta,this.$async=v?.$async,this.refs={}}}Pn.SchemaEnv=a;function o(y){const m=u.call(this,y);if(m)return m;const h=(0,n.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:v,lines:b}=this.opts.code,{ownProperties:_}=this.opts,R=new t.CodeGen(
3123
3125
  this.scope,{es5:v,lines:b,ownProperties:_});let $;y.$async&&($=R.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const M=R.scopeName("validate");y.validateName=M;const q={gen:R,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:R.scopeValue("schema",this.
3124
3126
  opts.code.source===!0?{ref:y.schema,code:(0,t.stringify)(y.schema)}:{ref:y.schema}),validateName:M,ValidationError:$,schema:y.schema,schemaEnv:y,rootId:h,baseId:y.baseId||h,schemaPath:t.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let Z;try{this._compilations.add(y),(0,s.validateFunctionCode)(q),R.optimize(this.opts.code.optimize);const L=R.toString();Z=`${R.scopeRefs(r.default.scope)}return ${L}`,this.opts.code.process&&(Z=this.opts.code.
@@ -3127,18 +3129,18 @@ process(Z,y));const T=new Function(`${r.default.self}`,`${r.default.scope}`,Z)(t
3127
3129
  root:y,baseId:m}))}if(_!==void 0)return y.refs[h]=l.call(this,_)}Pn.resolveRef=c;function l(y){return(0,n.inlineRef)(y.schema,this.opts.inlineRefs)?y.schema:y.validate?y:o.call(this,y)}function u(y){for(const m of this._compilations)if(d(m,y))return m}Pn.getCompilingSchema=u;function d(y,m){return y.schema===m.schema&&y.root===m.root&&y.baseId===m.baseId}function f(y,m){let h;for(;typeof(h=this.refs[m])=="string";)m=h;return h||this.schemas[m]||p.call(this,y,m)}function p(y,m){const h=this.opts.
3128
3130
  uriResolver.parse(m),v=(0,n._getFullPath)(this.opts.uriResolver,h);let b=(0,n.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&v===b)return g.call(this,h,y);const _=(0,n.normalizeId)(v),R=this.refs[_]||this.schemas[_];if(typeof R=="string"){const $=p.call(this,y,R);return typeof $?.schema!="object"?void 0:g.call(this,h,$)}if(typeof R?.schema=="object"){if(R.validate||o.call(this,R),_===(0,n.normalizeId)(m)){const{schema:$}=R,{schemaId:M}=this.opts,q=$[M];return q&&
3129
3131
  (b=(0,n.resolveUrl)(this.opts.uriResolver,b,q)),new a({schema:$,schemaId:M,root:y,baseId:b})}return g.call(this,h,R)}}Pn.resolveSchema=p;const w=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(y,{baseId:m,schema:h,root:v}){var b;if(((b=y.fragment)===null||b===void 0?void 0:b[0])!=="/")return;for(const $ of y.fragment.slice(1).split("/")){if(typeof h=="boolean")return;const M=h[(0,i.unescapeFragment)($)];if(M===void 0)return;h=M;const q=typeof h=="object"&&
3130
- h[this.opts.schemaId];!w.has($)&&q&&(m=(0,n.resolveUrl)(this.opts.uriResolver,m,q))}let _;if(typeof h!="boolean"&&h.$ref&&!(0,i.schemaHasRulesButRef)(h,this.RULES)){const $=(0,n.resolveUrl)(this.opts.uriResolver,m,h.$ref);_=p.call(this,v,$)}const{schemaId:R}=this.opts;if(_=_||new a({schema:h,schemaId:R,root:v,baseId:m}),_.schema!==_.root.schema)return _}return Pn}const uL="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",dL="Meta-schema for $data reference (JSON An\
3131
- ySchema extension proposal)",fL="object",pL=["$data"],hL={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},mL=!1,ene={$id:uL,description:dL,type:fL,required:pL,properties:hL,additionalProperties:mL},tne={__proto__:null,$id:uL,additionalProperties:mL,default:ene,description:dL,properties:hL,required:pL,type:fL},rne=em(tne);var Wy={},wp={exports:{}},$k,gL;function nne(){return gL||(gL=1,$k={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,
3132
- C:12,d:13,D:13,e:14,E:14,f:15,F:15}}),$k}var Pk,yL;function ine(){if(yL)return Pk;yL=1;const{HEX:t}=nne(),e=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function r(g){if(o(g,".")<3)return{host:g,isIPV4:!1};const y=g.match(e)||[],[m]=y;return m?{host:a(m,"."),isIPV4:!0}:{host:g,isIPV4:!1}}function n(g,y=!1){let m="",h=!0;for(const v of g){if(t[v]===void 0)return;v!=="0"&&h===!0&&(h=!1),h||(m+=v)}return y&&m.length===0&&(m="0"),m}function i(g){let y=0;
3132
+ h[this.opts.schemaId];!w.has($)&&q&&(m=(0,n.resolveUrl)(this.opts.uriResolver,m,q))}let _;if(typeof h!="boolean"&&h.$ref&&!(0,i.schemaHasRulesButRef)(h,this.RULES)){const $=(0,n.resolveUrl)(this.opts.uriResolver,m,h.$ref);_=p.call(this,v,$)}const{schemaId:R}=this.opts;if(_=_||new a({schema:h,schemaId:R,root:v,baseId:m}),_.schema!==_.root.schema)return _}return Pn}const cL="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",lL="Meta-schema for $data reference (JSON An\
3133
+ ySchema extension proposal)",uL="object",dL=["$data"],fL={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},pL=!1,nne={$id:cL,description:lL,type:uL,required:dL,properties:fL,additionalProperties:pL},ine={__proto__:null,$id:cL,additionalProperties:pL,default:nne,description:lL,properties:fL,required:dL,type:uL},sne=em(ine);var Wy={},wp={exports:{}},Tk,hL;function ane(){return hL||(hL=1,Tk={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,
3134
+ C:12,d:13,D:13,e:14,E:14,f:15,F:15}}),Tk}var $k,mL;function one(){if(mL)return $k;mL=1;const{HEX:t}=ane(),e=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function r(g){if(o(g,".")<3)return{host:g,isIPV4:!1};const y=g.match(e)||[],[m]=y;return m?{host:a(m,"."),isIPV4:!0}:{host:g,isIPV4:!1}}function n(g,y=!1){let m="",h=!0;for(const v of g){if(t[v]===void 0)return;v!=="0"&&h===!0&&(h=!1),h||(m+=v)}return y&&m.length===0&&(m="0"),m}function i(g){let y=0;
3133
3135
  const m={error:!1,address:"",zone:""},h=[],v=[];let b=!1,_=!1,R=!1;function $(){if(v.length){if(b===!1){const M=n(v);if(M!==void 0)h.push(M);else return m.error=!0,!1}v.length=0}return!0}for(let M=0;M<g.length;M++){const q=g[M];if(!(q==="["||q==="]"))if(q===":"){if(_===!0&&(R=!0),!$())break;if(y++,h.push(":"),y>7){m.error=!0;break}M-1>=0&&g[M-1]===":"&&(_=!0);continue}else if(q==="%"){if(!$())break;b=!0}else{v.push(q);continue}}return v.length&&(b?m.zone=v.join(""):R?h.push(v.join("")):h.push(n(
3134
3136
  v))),m.address=h.join(""),m}function s(g){if(o(g,":")<2)return{host:g,isIPV6:!1};const y=i(g);if(y.error)return{host:g,isIPV6:!1};{let m=y.address,h=y.address;return y.zone&&(m+="%"+y.zone,h+="%25"+y.zone),{host:m,escapedHost:h,isIPV6:!0}}}function a(g,y){let m="",h=!0;const v=g.length;for(let b=0;b<v;b++){const _=g[b];_==="0"&&h?(b+1<=v&&g[b+1]===y||b+1===v)&&(m+=_,h=!1):(_===y?h=!0:h=!1,m+=_)}return m}function o(g,y){let m=0;for(let h=0;h<g.length;h++)g[h]===y&&m++;return m}const c=/^\.\.?\//u,
3135
3137
  l=/^\/\.(?:\/|$)/u,u=/^\/\.\.(?:\/|$)/u,d=/^\/?(?:.|\n)*?(?=\/|$)/u;function f(g){const y=[];for(;g.length;)if(g.match(c))g=g.replace(c,"");else if(g.match(l))g=g.replace(l,"/");else if(g.match(u))g=g.replace(u,"/"),y.pop();else if(g==="."||g==="..")g="";else{const m=g.match(d);if(m){const h=m[0];g=g.slice(h.length),y.push(h)}else throw new Error("Unexpected dot segment condition")}return y.join("")}function p(g,y){const m=y!==!0?escape:unescape;return g.scheme!==void 0&&(g.scheme=m(g.scheme)),g.
3136
3138
  userinfo!==void 0&&(g.userinfo=m(g.userinfo)),g.host!==void 0&&(g.host=m(g.host)),g.path!==void 0&&(g.path=m(g.path)),g.query!==void 0&&(g.query=m(g.query)),g.fragment!==void 0&&(g.fragment=m(g.fragment)),g}function w(g){const y=[];if(g.userinfo!==void 0&&(y.push(g.userinfo),y.push("@")),g.host!==void 0){let m=unescape(g.host);const h=r(m);if(h.isIPV4)m=h.host;else{const v=s(h.host);v.isIPV6===!0?m=`[${v.escapedHost}]`:m=g.host}y.push(m)}return(typeof g.port=="number"||typeof g.port=="string")&&
3137
- (y.push(":"),y.push(String(g.port))),y.length?y.join(""):void 0}return Pk={recomposeAuthority:w,normalizeComponentEncoding:p,removeDotSegments:f,normalizeIPv4:r,normalizeIPv6:s,stringArrayToHexStripped:n},Pk}var Ck,vL;function sne(){if(vL)return Ck;vL=1;const t=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}function n(h){
3139
+ (y.push(":"),y.push(String(g.port))),y.length?y.join(""):void 0}return $k={recomposeAuthority:w,normalizeComponentEncoding:p,removeDotSegments:f,normalizeIPv4:r,normalizeIPv6:s,stringArrayToHexStripped:n},$k}var Pk,gL;function cne(){if(gL)return Pk;gL=1;const t=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}function n(h){
3138
3140
  return h.host||(h.error=h.error||"HTTP URIs must have a host."),h}function i(h){const v=String(h.scheme).toLowerCase()==="https";return(h.port===(v?443:80)||h.port==="")&&(h.port=void 0),h.path||(h.path="/"),h}function s(h){return h.secure=r(h),h.resourceName=(h.path||"/")+(h.query?"?"+h.query:""),h.path=void 0,h.query=void 0,h}function a(h){if((h.port===(r(h)?443:80)||h.port==="")&&(h.port=void 0),typeof h.secure=="boolean"&&(h.scheme=h.secure?"wss":"ws",h.secure=void 0),h.resourceName){const[v,
3139
3141
  b]=h.resourceName.split("?");h.path=v&&v!=="/"?v:void 0,h.query=b,h.resourceName=void 0}return h.fragment=void 0,h}function o(h,v){if(!h.path)return h.error="URN can not be parsed",h;const b=h.path.match(e);if(b){const _=v.scheme||h.scheme||"urn";h.nid=b[1].toLowerCase(),h.nss=b[2];const R=`${_}:${v.nid||h.nid}`,$=m[R];h.path=void 0,$&&(h=$.parse(h,v))}else h.error=h.error||"URN can not be parsed.";return h}function c(h,v){const b=v.scheme||h.scheme||"urn",_=h.nid.toLowerCase(),R=`${b}:${v.nid||
3140
3142
  _}`,$=m[R];$&&(h=$.serialize(h,v));const M=h,q=h.nss;return M.path=`${_||v.nid}:${q}`,v.skipEscape=!0,M}function l(h,v){const b=h;return b.uuid=b.nss,b.nss=void 0,!v.tolerant&&(!b.uuid||!t.test(b.uuid))&&(b.error=b.error||"UUID is not valid."),b}function u(h){const v=h;return v.nss=(h.uuid||"").toLowerCase(),v}const d={scheme:"http",domainHost:!0,parse:n,serialize:i},f={scheme:"https",domainHost:d.domainHost,parse:n,serialize:i},p={scheme:"ws",domainHost:!0,parse:s,serialize:a},w={scheme:"wss",domainHost:p.
3141
- domainHost,parse:p.parse,serialize:p.serialize},m={http:d,https:f,ws:p,wss:w,urn:{scheme:"urn",parse:o,serialize:c,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:l,serialize:u,skipNormalize:!0}};return Ck=m,Ck}var wL;function ane(){if(wL)return wp.exports;wL=1;const{normalizeIPv6:t,normalizeIPv4:e,removeDotSegments:r,recomposeAuthority:n,normalizeComponentEncoding:i}=ine(),s=sne();function a(y,m){return typeof y=="string"?y=u(w(y,m),m):typeof y=="object"&&(y=w(u(y,m),m)),y}function o(y,m,h){
3143
+ domainHost,parse:p.parse,serialize:p.serialize},m={http:d,https:f,ws:p,wss:w,urn:{scheme:"urn",parse:o,serialize:c,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:l,serialize:u,skipNormalize:!0}};return Pk=m,Pk}var yL;function lne(){if(yL)return wp.exports;yL=1;const{normalizeIPv6:t,normalizeIPv4:e,removeDotSegments:r,recomposeAuthority:n,normalizeComponentEncoding:i}=one(),s=cne();function a(y,m){return typeof y=="string"?y=u(w(y,m),m):typeof y=="object"&&(y=w(u(y,m),m)),y}function o(y,m,h){
3142
3144
  const v=Object.assign({scheme:"null"},h),b=c(w(y,v),w(m,v),v,!0);return u(b,{...v,skipEscape:!0})}function c(y,m,h,v){const b={};return v||(y=w(u(y,h),h),m=w(u(m,h),h)),h=h||{},!h.tolerant&&m.scheme?(b.scheme=m.scheme,b.userinfo=m.userinfo,b.host=m.host,b.port=m.port,b.path=r(m.path||""),b.query=m.query):(m.userinfo!==void 0||m.host!==void 0||m.port!==void 0?(b.userinfo=m.userinfo,b.host=m.host,b.port=m.port,b.path=r(m.path||""),b.query=m.query):(m.path?(m.path.charAt(0)==="/"?b.path=r(m.path):((y.
3143
3145
  userinfo!==void 0||y.host!==void 0||y.port!==void 0)&&!y.path?b.path="/"+m.path:y.path?b.path=y.path.slice(0,y.path.lastIndexOf("/")+1)+m.path:b.path=m.path,b.path=r(b.path)),b.query=m.query):(b.path=y.path,m.query!==void 0?b.query=m.query:b.query=y.query),b.userinfo=y.userinfo,b.host=y.host,b.port=y.port),b.scheme=y.scheme),b.fragment=m.fragment,b}function l(y,m,h){return typeof y=="string"?(y=unescape(y),y=u(i(w(y,h),!0),{...h,skipEscape:!0})):typeof y=="object"&&(y=u(i(y,!0),{...h,skipEscape:!0})),
3144
3146
  typeof m=="string"?(m=unescape(m),m=u(i(w(m,h),!0),{...h,skipEscape:!0})):typeof m=="object"&&(m=u(i(m,!0),{...h,skipEscape:!0})),y.toLowerCase()===m.toLowerCase()}function u(y,m){const h={host:y.host,scheme:y.scheme,userinfo:y.userinfo,port:y.port,path:y.path,query:y.query,nid:y.nid,nss:y.nss,uuid:y.uuid,fragment:y.fragment,reference:y.reference,resourceName:y.resourceName,secure:y.secure,error:""},v=Object.assign({},m),b=[],_=s[(v.scheme||h.scheme||"").toLowerCase()];_&&_.serialize&&_.serialize(
@@ -3147,8 +3149,8 @@ void 0&&b.push("#",h.fragment),b.join("")}const d=Array.from({length:127},(y,m)=
3147
3149
  b=y.indexOf("%")!==-1;let _=!1;h.reference==="suffix"&&(y=(h.scheme?h.scheme+":":"")+"//"+y);const R=y.match(p);if(R){if(v.scheme=R[1],v.userinfo=R[3],v.host=R[4],v.port=parseInt(R[5],10),v.path=R[6]||"",v.query=R[7],v.fragment=R[8],isNaN(v.port)&&(v.port=R[5]),v.host){const M=e(v.host);if(M.isIPV4===!1){const q=t(M.host);v.host=q.host.toLowerCase(),_=q.isIPV6}else v.host=M.host,_=!0}v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&v.query===void 0&&!v.path?v.reference="\
3148
3150
  same-document":v.scheme===void 0?v.reference="relative":v.fragment===void 0?v.reference="absolute":v.reference="uri",h.reference&&h.reference!=="suffix"&&h.reference!==v.reference&&(v.error=v.error||"URI is not a "+h.reference+" reference.");const $=s[(h.scheme||v.scheme||"").toLowerCase()];if(!h.unicodeSupport&&(!$||!$.unicodeSupport)&&v.host&&(h.domainHost||$&&$.domainHost)&&_===!1&&f(v.host))try{v.host=URL.domainToASCII(v.host.toLowerCase())}catch(M){v.error=v.error||"Host's domain name can n\
3149
3151
  ot be converted to ASCII: "+M}(!$||$&&!$.skipNormalize)&&(b&&v.scheme!==void 0&&(v.scheme=unescape(v.scheme)),b&&v.host!==void 0&&(v.host=unescape(v.host)),v.path&&(v.path=escape(unescape(v.path))),v.fragment&&(v.fragment=encodeURI(decodeURIComponent(v.fragment)))),$&&$.parse&&$.parse(v,h)}else v.error=v.error||"URI can not be parsed.";return v}const g={SCHEMES:s,normalize:a,resolve:o,resolveComponents:c,equal:l,serialize:u,parse:w};return wp.exports=g,wp.exports.default=g,wp.exports.fastUri=g,wp.
3150
- exports}var bL;function one(){if(bL)return Wy;bL=1,Object.defineProperty(Wy,"__esModule",{value:!0});const t=ane();return t.code='require("ajv/dist/runtime/uri").default',Wy.default=t,Wy}var _L;function RL(){return _L||(_L=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=yp();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Je();Object.defineProperty(t,"_",{enumerable:!0,
3151
- get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=zy(),i=vp(),s=KO(),a=Vy(),o=Je(),c=Hy(),l=Fy(),u=ht(),d=rne,f=one(),
3152
+ exports}var vL;function une(){if(vL)return Wy;vL=1,Object.defineProperty(Wy,"__esModule",{value:!0});const t=lne();return t.code='require("ajv/dist/runtime/uri").default',Wy.default=t,Wy}var wL;function bL(){return wL||(wL=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=yp();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Je();Object.defineProperty(t,"_",{enumerable:!0,
3153
+ get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=zy(),i=vp(),s=WO(),a=Vy(),o=Je(),c=Hy(),l=Fy(),u=ht(),d=sne,f=une(),
3152
3154
  p=(C,F)=>new RegExp(C,F);p.code="new RegExp";const w=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",
3153
3155
  missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cach\
3154
3156
  e, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},m={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},h=200;function v(C){var F,Y,K,S,N,X,se,ue,_e,de,x,O,J,z,ae,Re,Me,me,Ne,pe,Se,Be,tt,st,Jt;const Ht=C.strict,ur=(F=C.code)===null||F===void 0?void 0:F.optimize,ce=ur===!0||ur===void 0?1:ur||0,le=(K=(Y=C.code)===null||Y===void 0?void 0:Y.regExp)!==null&&K!==void 0?
@@ -3172,81 +3174,81 @@ tion ${S}. ${C[N]}`)}}function R(C){return C=(0,c.normalizeId)(C),this.schemas[C
3172
3174
  keyword=F),this.addKeyword(Y)}}function Z(){const C={...this.opts};for(const F of w)delete C[F];return C}const L={log(){},warn(){},error(){}};function P(C){if(C===!1)return L;if(C===void 0)return console;if(C.log&&C.warn&&C.error)return C;throw new Error("logger must implement log, warn and error methods")}const T=/^[a-z_$][a-z0-9_$:-]*$/i;function B(C,F){const{RULES:Y}=this;if((0,u.eachItem)(C,K=>{if(Y.keywords[K])throw new Error(`Keyword ${K} is already defined`);if(!T.test(K))throw new Error(
3173
3175
  `Keyword ${K} has invalid name`)}),!!F&&F.$data&&!("code"in F||"validate"in F))throw new Error('$data keyword must have "code" or "validate" function')}function H(C,F,Y){var K;const S=F?.post;if(Y&&S)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:N}=this;let X=S?N.post:N.rules.find(({type:ue})=>ue===Y);if(X||(X={type:Y,rules:[]},N.rules.push(X)),N.keywords[C]=!0,!F)return;const se={keyword:C,definition:{...F,type:(0,l.getJSONTypes)(F.type),schemaType:(0,l.getJSONTypes)(
3174
3176
  F.schemaType)}};F.before?U.call(this,X,se,F.before):X.rules.push(se),N.all[C]=se,(K=F.implements)===null||K===void 0||K.forEach(ue=>this.addKeyword(ue))}function U(C,F,Y){const K=C.rules.findIndex(S=>S.keyword===Y);K>=0?C.rules.splice(K,0,F):(C.rules.push(F),this.logger.warn(`rule ${Y} is not defined`))}function G(C){let{metaSchema:F}=C;F!==void 0&&(C.$data&&this.opts.$data&&(F=ne(F)),C.validateSchema=this.compile(F,!0))}const oe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/\
3175
- lib/refs/data.json#"};function ne(C){return{anyOf:[C,oe]}}})(bk)),bk}var Gy={},Ky={},Zy={},kL;function cne(){if(kL)return Zy;kL=1,Object.defineProperty(Zy,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Zy.default=t,Zy}var ma={},SL;function EL(){if(SL)return ma;SL=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.callRef=ma.getValidate=void 0;const t=vp(),e=gi(),r=Je(),n=$s(),i=Vy(),s=ht(),a={keyword:"$re\
3177
+ lib/refs/data.json#"};function ne(C){return{anyOf:[C,oe]}}})(wk)),wk}var Gy={},Ky={},Zy={},_L;function dne(){if(_L)return Zy;_L=1,Object.defineProperty(Zy,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Zy.default=t,Zy}var ma={},RL;function kL(){if(RL)return ma;RL=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.callRef=ma.getValidate=void 0;const t=vp(),e=gi(),r=Je(),n=$s(),i=Vy(),s=ht(),a={keyword:"$re\
3176
3178
  f",schemaType:"string",code(l){const{gen:u,schema:d,it:f}=l,{baseId:p,schemaEnv:w,validateName:g,opts:y,self:m}=f,{root:h}=w;if((d==="#"||d==="#/")&&p===h.baseId)return b();const v=i.resolveRef.call(m,h,p,d);if(v===void 0)throw new t.default(f.opts.uriResolver,p,d);if(v instanceof i.SchemaEnv)return _(v);return R(v);function b(){if(w===h)return c(l,g,w,w.$async);const $=u.scopeValue("root",{ref:h});return c(l,(0,r._)`${$}.validate`,h,h.$async)}function _($){const M=o(l,$);c(l,M,$,$.$async)}function R($){
3177
3179
  const M=u.scopeValue("schema",y.code.source===!0?{ref:$,code:(0,r.stringify)($)}:{ref:$}),q=u.name("valid"),Z=l.subschema({schema:$,dataTypes:[],schemaPath:r.nil,topSchemaRef:M,errSchemaPath:d},q);l.mergeEvaluated(Z),l.ok(q)}}};function o(l,u){const{gen:d}=l;return u.validate?d.scopeValue("validate",{ref:u.validate}):(0,r._)`${d.scopeValue("wrapper",{ref:u})}.validate`}ma.getValidate=o;function c(l,u,d,f){const{gen:p,it:w}=l,{allErrors:g,schemaEnv:y,opts:m}=w,h=m.passContext?n.default.this:r.nil;
3178
3180
  f?v():b();function v(){if(!y.$async)throw new Error("async schema referenced by sync schema");const $=p.let("valid");p.try(()=>{p.code((0,r._)`await ${(0,e.callValidateCode)(l,u,h)}`),R(u),g||p.assign($,!0)},M=>{p.if((0,r._)`!(${M} instanceof ${w.ValidationError})`,()=>p.throw(M)),_(M),g||p.assign($,!1)}),l.ok($)}function b(){l.result((0,e.callValidateCode)(l,u,h),()=>R(u),()=>_(u))}function _($){const M=(0,r._)`${$}.errors`;p.assign(n.default.vErrors,(0,r._)`${n.default.vErrors} === null ? ${M} : ${n.
3179
3181
  default.vErrors}.concat(${M})`),p.assign(n.default.errors,(0,r._)`${n.default.vErrors}.length`)}function R($){var M;if(!w.opts.unevaluated)return;const q=(M=d?.validate)===null||M===void 0?void 0:M.evaluated;if(w.props!==!0)if(q&&!q.dynamicProps)q.props!==void 0&&(w.props=s.mergeEvaluated.props(p,q.props,w.props));else{const Z=p.var("props",(0,r._)`${$}.evaluated.props`);w.props=s.mergeEvaluated.props(p,Z,w.props,r.Name)}if(w.items!==!0)if(q&&!q.dynamicItems)q.items!==void 0&&(w.items=s.mergeEvaluated.
3180
- items(p,q.items,w.items));else{const Z=p.var("items",(0,r._)`${$}.evaluated.items`);w.items=s.mergeEvaluated.items(p,Z,w.items,r.Name)}}}return ma.callRef=c,ma.default=a,ma}var TL;function $L(){if(TL)return Ky;TL=1,Object.defineProperty(Ky,"__esModule",{value:!0});const t=cne(),e=EL(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Ky.default=r,Ky}var Jy={},Yy={},PL;function lne(){if(PL)return Yy;PL=1,Object.defineProperty(Yy,"__esModule",{
3182
+ items(p,q.items,w.items));else{const Z=p.var("items",(0,r._)`${$}.evaluated.items`);w.items=s.mergeEvaluated.items(p,Z,w.items,r.Name)}}}return ma.callRef=c,ma.default=a,ma}var SL;function EL(){if(SL)return Ky;SL=1,Object.defineProperty(Ky,"__esModule",{value:!0});const t=dne(),e=kL(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Ky.default=r,Ky}var Jy={},Yy={},TL;function fne(){if(TL)return Yy;TL=1,Object.defineProperty(Yy,"__esModule",{
3181
3183
  value:!0});const t=Je(),e=t.operators,r={maximum:{okStr:"<=",ok:e.LTE,fail:e.GT},minimum:{okStr:">=",ok:e.GTE,fail:e.LT},exclusiveMaximum:{okStr:"<",ok:e.LT,fail:e.GTE},exclusiveMinimum:{okStr:">",ok:e.GT,fail:e.LTE}},n={message:({keyword:s,schemaCode:a})=>(0,t.str)`must be ${r[s].okStr} ${a}`,params:({keyword:s,schemaCode:a})=>(0,t._)`{comparison: ${r[s].okStr}, limit: ${a}}`},i={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(s){const{keyword:a,data:o,schemaCode:c}=s;
3182
- s.fail$data((0,t._)`${o} ${r[a].fail} ${c} || isNaN(${o})`)}};return Yy.default=i,Yy}var Xy={},CL;function une(){if(CL)return Xy;CL=1,Object.defineProperty(Xy,"__esModule",{value:!0});const t=Je(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must be multiple of ${n}`,params:({schemaCode:n})=>(0,t._)`{multipleOf: ${n}}`},code(n){const{gen:i,data:s,schemaCode:a,it:o}=n,c=o.opts.multipleOfPrecision,l=i.let("res"),u=c?(0,t._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${c}`:
3183
- (0,t._)`${l} !== parseInt(${l})`;n.fail$data((0,t._)`(${a} === 0 || (${l} = ${s}/${a}, ${u}))`)}};return Xy.default=r,Xy}var Qy={},ev={},AL;function dne(){if(AL)return ev;AL=1,Object.defineProperty(ev,"__esModule",{value:!0});function t(e){const r=e.length;let n=0,i=0,s;for(;i<r;)n++,s=e.charCodeAt(i++),s>=55296&&s<=56319&&i<r&&(s=e.charCodeAt(i),(s&64512)===56320&&i++);return n}return ev.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',ev}var xL;function fne(){if(xL)return Qy;xL=
3184
- 1,Object.defineProperty(Qy,"__esModule",{value:!0});const t=Je(),e=ht(),r=dne(),i={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:a}){const o=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${o} than ${a} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){const{keyword:a,data:o,schemaCode:c,it:l}=s,u=a==="maxLength"?t.operators.GT:t.operators.LT,d=l.opts.unicode===!1?(0,t._)`${o}.length`:(0,t._)`${(0,e.
3185
- useFunc)(s.gen,r.default)}(${o})`;s.fail$data((0,t._)`${d} ${u} ${c}`)}};return Qy.default=i,Qy}var tv={},IL;function pne(){if(IL)return tv;IL=1,Object.defineProperty(tv,"__esModule",{value:!0});const t=gi(),e=Je(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>(0,e.str)`must match pattern "${i}"`,params:({schemaCode:i})=>(0,e._)`{pattern: ${i}}`},code(i){const{data:s,$data:a,schema:o,schemaCode:c,it:l}=i,u=l.opts.unicodeRegExp?"u":"",d=a?(0,e._)`(new RegExp(${c}, ${u}))`:
3186
- (0,t.usePattern)(i,o);i.fail$data((0,e._)`!${d}.test(${s})`)}};return tv.default=n,tv}var rv={},NL;function hne(){if(NL)return rv;NL=1,Object.defineProperty(rv,"__esModule",{value:!0});const t=Je(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:i}){const s=n==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${i} properties`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:i,
3187
- data:s,schemaCode:a}=n,o=i==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`Object.keys(${s}).length ${o} ${a}`)}};return rv.default=r,rv}var nv={},DL;function mne(){if(DL)return nv;DL=1,Object.defineProperty(nv,"__esModule",{value:!0});const t=gi(),e=Je(),r=ht(),i={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,e.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,e._)`{missingProperty: ${s}}`},
3184
+ s.fail$data((0,t._)`${o} ${r[a].fail} ${c} || isNaN(${o})`)}};return Yy.default=i,Yy}var Xy={},$L;function pne(){if($L)return Xy;$L=1,Object.defineProperty(Xy,"__esModule",{value:!0});const t=Je(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must be multiple of ${n}`,params:({schemaCode:n})=>(0,t._)`{multipleOf: ${n}}`},code(n){const{gen:i,data:s,schemaCode:a,it:o}=n,c=o.opts.multipleOfPrecision,l=i.let("res"),u=c?(0,t._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${c}`:
3185
+ (0,t._)`${l} !== parseInt(${l})`;n.fail$data((0,t._)`(${a} === 0 || (${l} = ${s}/${a}, ${u}))`)}};return Xy.default=r,Xy}var Qy={},ev={},PL;function hne(){if(PL)return ev;PL=1,Object.defineProperty(ev,"__esModule",{value:!0});function t(e){const r=e.length;let n=0,i=0,s;for(;i<r;)n++,s=e.charCodeAt(i++),s>=55296&&s<=56319&&i<r&&(s=e.charCodeAt(i),(s&64512)===56320&&i++);return n}return ev.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',ev}var CL;function mne(){if(CL)return Qy;CL=
3186
+ 1,Object.defineProperty(Qy,"__esModule",{value:!0});const t=Je(),e=ht(),r=hne(),i={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:a}){const o=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${o} than ${a} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){const{keyword:a,data:o,schemaCode:c,it:l}=s,u=a==="maxLength"?t.operators.GT:t.operators.LT,d=l.opts.unicode===!1?(0,t._)`${o}.length`:(0,t._)`${(0,e.
3187
+ useFunc)(s.gen,r.default)}(${o})`;s.fail$data((0,t._)`${d} ${u} ${c}`)}};return Qy.default=i,Qy}var tv={},AL;function gne(){if(AL)return tv;AL=1,Object.defineProperty(tv,"__esModule",{value:!0});const t=gi(),e=Je(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>(0,e.str)`must match pattern "${i}"`,params:({schemaCode:i})=>(0,e._)`{pattern: ${i}}`},code(i){const{data:s,$data:a,schema:o,schemaCode:c,it:l}=i,u=l.opts.unicodeRegExp?"u":"",d=a?(0,e._)`(new RegExp(${c}, ${u}))`:
3188
+ (0,t.usePattern)(i,o);i.fail$data((0,e._)`!${d}.test(${s})`)}};return tv.default=n,tv}var rv={},xL;function yne(){if(xL)return rv;xL=1,Object.defineProperty(rv,"__esModule",{value:!0});const t=Je(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:i}){const s=n==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${i} properties`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:i,
3189
+ data:s,schemaCode:a}=n,o=i==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`Object.keys(${s}).length ${o} ${a}`)}};return rv.default=r,rv}var nv={},IL;function vne(){if(IL)return nv;IL=1,Object.defineProperty(nv,"__esModule",{value:!0});const t=gi(),e=Je(),r=ht(),i={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,e.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,e._)`{missingProperty: ${s}}`},
3188
3190
  code(s){const{gen:a,schema:o,schemaCode:c,data:l,$data:u,it:d}=s,{opts:f}=d;if(!u&&o.length===0)return;const p=o.length>=f.loopRequired;if(d.allErrors?w():g(),f.strictRequired){const h=s.parentSchema.properties,{definedProperties:v}=s.it;for(const b of o)if(h?.[b]===void 0&&!v.has(b)){const _=d.schemaEnv.baseId+d.errSchemaPath,R=`required property "${b}" is not defined at "${_}" (strictRequired)`;(0,r.checkStrictMode)(d,R,d.opts.strictRequired)}}function w(){if(p||u)s.block$data(e.nil,y);else for(const h of o)
3189
3191
  (0,t.checkReportMissingProp)(s,h)}function g(){const h=a.let("missing");if(p||u){const v=a.let("valid",!0);s.block$data(v,()=>m(h,v)),s.ok(v)}else a.if((0,t.checkMissingProp)(s,o,h)),(0,t.reportMissingProp)(s,h),a.else()}function y(){a.forOf("prop",c,h=>{s.setParams({missingProperty:h}),a.if((0,t.noPropertyInData)(a,l,h,f.ownProperties),()=>s.error())})}function m(h,v){s.setParams({missingProperty:h}),a.forOf(h,c,()=>{a.assign(v,(0,t.propertyInData)(a,l,h,f.ownProperties)),a.if((0,e.not)(v),()=>{
3190
- s.error(),a.break()})},e.nil)}}};return nv.default=i,nv}var iv={},OL;function gne(){if(OL)return iv;OL=1,Object.defineProperty(iv,"__esModule",{value:!0});const t=Je(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:i}){const s=n==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${i} items`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:i,data:s,schemaCode:a}=n,o=i==="maxItems"?t.operators.
3191
- GT:t.operators.LT;n.fail$data((0,t._)`${s}.length ${o} ${a}`)}};return iv.default=r,iv}var sv={},av={},LL;function Ak(){if(LL)return av;LL=1,Object.defineProperty(av,"__esModule",{value:!0});const t=nL();return t.code='require("ajv/dist/runtime/equal").default',av.default=t,av}var ML;function yne(){if(ML)return sv;ML=1,Object.defineProperty(sv,"__esModule",{value:!0});const t=Fy(),e=Je(),r=ht(),n=Ak(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:a,
3192
+ s.error(),a.break()})},e.nil)}}};return nv.default=i,nv}var iv={},NL;function wne(){if(NL)return iv;NL=1,Object.defineProperty(iv,"__esModule",{value:!0});const t=Je(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:i}){const s=n==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${i} items`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:i,data:s,schemaCode:a}=n,o=i==="maxItems"?t.operators.
3193
+ GT:t.operators.LT;n.fail$data((0,t._)`${s}.length ${o} ${a}`)}};return iv.default=r,iv}var sv={},av={},DL;function Ck(){if(DL)return av;DL=1,Object.defineProperty(av,"__esModule",{value:!0});const t=tL();return t.code='require("ajv/dist/runtime/equal").default',av.default=t,av}var OL;function bne(){if(OL)return sv;OL=1,Object.defineProperty(sv,"__esModule",{value:!0});const t=Fy(),e=Je(),r=ht(),n=Ck(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:a,
3192
3194
  j:o}})=>(0,e.str)`must NOT have duplicate items (items ## ${o} and ${a} are identical)`,params:({params:{i:a,j:o}})=>(0,e._)`{i: ${a}, j: ${o}}`},code(a){const{gen:o,data:c,$data:l,schema:u,parentSchema:d,schemaCode:f,it:p}=a;if(!l&&!u)return;const w=o.let("valid"),g=d.items?(0,t.getSchemaTypes)(d.items):[];a.block$data(w,y,(0,e._)`${f} === false`),a.ok(w);function y(){const b=o.let("i",(0,e._)`${c}.length`),_=o.let("j");a.setParams({i:b,j:_}),o.assign(w,!0),o.if((0,e._)`${b} > 1`,()=>(m()?h:v)(
3193
3195
  b,_))}function m(){return g.length>0&&!g.some(b=>b==="object"||b==="array")}function h(b,_){const R=o.name("item"),$=(0,t.checkDataTypes)(g,R,p.opts.strictNumbers,t.DataType.Wrong),M=o.const("indices",(0,e._)`{}`);o.for((0,e._)`;${b}--;`,()=>{o.let(R,(0,e._)`${c}[${b}]`),o.if($,(0,e._)`continue`),g.length>1&&o.if((0,e._)`typeof ${R} == "string"`,(0,e._)`${R} += "_"`),o.if((0,e._)`typeof ${M}[${R}] == "number"`,()=>{o.assign(_,(0,e._)`${M}[${R}]`),a.error(),o.assign(w,!1).break()}).code((0,e._)`${M}[${R}] = ${b}`)})}
3194
- function v(b,_){const R=(0,r.useFunc)(o,n.default),$=o.name("outer");o.label($).for((0,e._)`;${b}--;`,()=>o.for((0,e._)`${_} = ${b}; ${_}--;`,()=>o.if((0,e._)`${R}(${c}[${b}], ${c}[${_}])`,()=>{a.error(),o.assign(w,!1).break($)})))}}};return sv.default=s,sv}var ov={},jL;function vne(){if(jL)return ov;jL=1,Object.defineProperty(ov,"__esModule",{value:!0});const t=Je(),e=ht(),r=Ak(),i={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},
3195
- code(s){const{gen:a,data:o,$data:c,schemaCode:l,schema:u}=s;c||u&&typeof u=="object"?s.fail$data((0,t._)`!${(0,e.useFunc)(a,r.default)}(${o}, ${l})`):s.fail((0,t._)`${u} !== ${o}`)}};return ov.default=i,ov}var cv={},qL;function wne(){if(qL)return cv;qL=1,Object.defineProperty(cv,"__esModule",{value:!0});const t=Je(),e=ht(),r=Ak(),i={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){
3196
+ function v(b,_){const R=(0,r.useFunc)(o,n.default),$=o.name("outer");o.label($).for((0,e._)`;${b}--;`,()=>o.for((0,e._)`${_} = ${b}; ${_}--;`,()=>o.if((0,e._)`${R}(${c}[${b}], ${c}[${_}])`,()=>{a.error(),o.assign(w,!1).break($)})))}}};return sv.default=s,sv}var ov={},LL;function _ne(){if(LL)return ov;LL=1,Object.defineProperty(ov,"__esModule",{value:!0});const t=Je(),e=ht(),r=Ck(),i={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},
3197
+ code(s){const{gen:a,data:o,$data:c,schemaCode:l,schema:u}=s;c||u&&typeof u=="object"?s.fail$data((0,t._)`!${(0,e.useFunc)(a,r.default)}(${o}, ${l})`):s.fail((0,t._)`${u} !== ${o}`)}};return ov.default=i,ov}var cv={},ML;function Rne(){if(ML)return cv;ML=1,Object.defineProperty(cv,"__esModule",{value:!0});const t=Je(),e=ht(),r=Ck(),i={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){
3196
3198
  const{gen:a,data:o,$data:c,schema:l,schemaCode:u,it:d}=s;if(!c&&l.length===0)throw new Error("enum must have non-empty array");const f=l.length>=d.opts.loopEnum;let p;const w=()=>p??(p=(0,e.useFunc)(a,r.default));let g;if(f||c)g=a.let("valid"),s.block$data(g,y);else{if(!Array.isArray(l))throw new Error("ajv implementation error");const h=a.const("vSchema",u);g=(0,t.or)(...l.map((v,b)=>m(h,b)))}s.pass(g);function y(){a.assign(g,!1),a.forOf("v",u,h=>a.if((0,t._)`${w()}(${o}, ${h})`,()=>a.assign(g,
3197
- !0).break()))}function m(h,v){const b=l[v];return typeof b=="object"&&b!==null?(0,t._)`${w()}(${o}, ${h}[${v}])`:(0,t._)`${o} === ${b}`}}};return cv.default=i,cv}var FL;function HL(){if(FL)return Jy;FL=1,Object.defineProperty(Jy,"__esModule",{value:!0});const t=lne(),e=une(),r=fne(),n=pne(),i=hne(),s=mne(),a=gne(),o=yne(),c=vne(),l=wne(),u=[t.default,e.default,r.default,n.default,i.default,s.default,a.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"\
3198
- boolean"},c.default,l.default];return Jy.default=u,Jy}var lv={},pl={},BL;function zL(){if(BL)return pl;BL=1,Object.defineProperty(pl,"__esModule",{value:!0}),pl.validateAdditionalItems=void 0;const t=Je(),e=ht(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){const{parentSchema:a,it:o}=s,{items:c}=a;if(!Array.isArray(
3199
+ !0).break()))}function m(h,v){const b=l[v];return typeof b=="object"&&b!==null?(0,t._)`${w()}(${o}, ${h}[${v}])`:(0,t._)`${o} === ${b}`}}};return cv.default=i,cv}var jL;function qL(){if(jL)return Jy;jL=1,Object.defineProperty(Jy,"__esModule",{value:!0});const t=fne(),e=pne(),r=mne(),n=gne(),i=yne(),s=vne(),a=wne(),o=bne(),c=_ne(),l=Rne(),u=[t.default,e.default,r.default,n.default,i.default,s.default,a.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"\
3200
+ boolean"},c.default,l.default];return Jy.default=u,Jy}var lv={},pl={},FL;function HL(){if(FL)return pl;FL=1,Object.defineProperty(pl,"__esModule",{value:!0}),pl.validateAdditionalItems=void 0;const t=Je(),e=ht(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){const{parentSchema:a,it:o}=s,{items:c}=a;if(!Array.isArray(
3199
3201
  c)){(0,e.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas');return}i(s,c)}};function i(s,a){const{gen:o,schema:c,data:l,keyword:u,it:d}=s;d.items=!0;const f=o.const("len",(0,t._)`${l}.length`);if(c===!1)s.setParams({len:a.length}),s.pass((0,t._)`${f} <= ${a.length}`);else if(typeof c=="object"&&!(0,e.alwaysValidSchema)(d,c)){const w=o.var("valid",(0,t._)`${f} <= ${a.length}`);o.if((0,t.not)(w),()=>p(w)),s.ok(w)}function p(w){o.forRange("i",a.length,f,g=>{s.
3200
- subschema({keyword:u,dataProp:g,dataPropType:e.Type.Num},w),d.allErrors||o.if((0,t.not)(w),()=>o.break())})}}return pl.validateAdditionalItems=i,pl.default=n,pl}var uv={},hl={},UL;function VL(){if(UL)return hl;UL=1,Object.defineProperty(hl,"__esModule",{value:!0}),hl.validateTuple=void 0;const t=Je(),e=ht(),r=gi(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(s){const{schema:a,it:o}=s;if(Array.isArray(a))return i(s,"additionalItems",a);o.items=
3202
+ subschema({keyword:u,dataProp:g,dataPropType:e.Type.Num},w),d.allErrors||o.if((0,t.not)(w),()=>o.break())})}}return pl.validateAdditionalItems=i,pl.default=n,pl}var uv={},hl={},BL;function zL(){if(BL)return hl;BL=1,Object.defineProperty(hl,"__esModule",{value:!0}),hl.validateTuple=void 0;const t=Je(),e=ht(),r=gi(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(s){const{schema:a,it:o}=s;if(Array.isArray(a))return i(s,"additionalItems",a);o.items=
3201
3203
  !0,!(0,e.alwaysValidSchema)(o,a)&&s.ok((0,r.validateArray)(s))}};function i(s,a,o=s.schema){const{gen:c,parentSchema:l,data:u,keyword:d,it:f}=s;g(l),f.opts.unevaluated&&o.length&&f.items!==!0&&(f.items=e.mergeEvaluated.items(c,o.length,f.items));const p=c.name("valid"),w=c.const("len",(0,t._)`${u}.length`);o.forEach((y,m)=>{(0,e.alwaysValidSchema)(f,y)||(c.if((0,t._)`${w} > ${m}`,()=>s.subschema({keyword:d,schemaProp:m,dataProp:m},p)),s.ok(p))});function g(y){const{opts:m,errSchemaPath:h}=f,v=o.
3202
- length,b=v===y.minItems&&(v===y.maxItems||y[a]===!1);if(m.strictTuples&&!b){const _=`"${d}" is ${v}-tuple, but minItems or maxItems/${a} are not specified or different at path "${h}"`;(0,e.checkStrictMode)(f,_,m.strictTuples)}}}return hl.validateTuple=i,hl.default=n,hl}var WL;function bne(){if(WL)return uv;WL=1,Object.defineProperty(uv,"__esModule",{value:!0});const t=VL(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return uv.
3203
- default=e,uv}var dv={},GL;function _ne(){if(GL)return dv;GL=1,Object.defineProperty(dv,"__esModule",{value:!0});const t=Je(),e=ht(),r=gi(),n=zL(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:a}})=>(0,t.str)`must NOT have more than ${a} items`,params:({params:{len:a}})=>(0,t._)`{limit: ${a}}`},code(a){const{schema:o,parentSchema:c,it:l}=a,{prefixItems:u}=c;l.items=!0,!(0,e.alwaysValidSchema)(l,o)&&(u?(0,n.validateAdditionalItems)(
3204
- a,u):a.ok((0,r.validateArray)(a)))}};return dv.default=s,dv}var fv={},KL;function Rne(){if(KL)return fv;KL=1,Object.defineProperty(fv,"__esModule",{value:!0});const t=Je(),e=ht(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:i,max:s}})=>s===void 0?(0,t.str)`must contain at least ${i} valid item(s)`:(0,t.str)`must contain at least ${i} and no more than ${s} valid item(s)`,params:({params:{min:i,max:s}})=>s===void 0?
3204
+ length,b=v===y.minItems&&(v===y.maxItems||y[a]===!1);if(m.strictTuples&&!b){const _=`"${d}" is ${v}-tuple, but minItems or maxItems/${a} are not specified or different at path "${h}"`;(0,e.checkStrictMode)(f,_,m.strictTuples)}}}return hl.validateTuple=i,hl.default=n,hl}var UL;function kne(){if(UL)return uv;UL=1,Object.defineProperty(uv,"__esModule",{value:!0});const t=zL(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return uv.
3205
+ default=e,uv}var dv={},VL;function Sne(){if(VL)return dv;VL=1,Object.defineProperty(dv,"__esModule",{value:!0});const t=Je(),e=ht(),r=gi(),n=HL(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:a}})=>(0,t.str)`must NOT have more than ${a} items`,params:({params:{len:a}})=>(0,t._)`{limit: ${a}}`},code(a){const{schema:o,parentSchema:c,it:l}=a,{prefixItems:u}=c;l.items=!0,!(0,e.alwaysValidSchema)(l,o)&&(u?(0,n.validateAdditionalItems)(
3206
+ a,u):a.ok((0,r.validateArray)(a)))}};return dv.default=s,dv}var fv={},WL;function Ene(){if(WL)return fv;WL=1,Object.defineProperty(fv,"__esModule",{value:!0});const t=Je(),e=ht(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:i,max:s}})=>s===void 0?(0,t.str)`must contain at least ${i} valid item(s)`:(0,t.str)`must contain at least ${i} and no more than ${s} valid item(s)`,params:({params:{min:i,max:s}})=>s===void 0?
3205
3207
  (0,t._)`{minContains: ${i}}`:(0,t._)`{minContains: ${i}, maxContains: ${s}}`},code(i){const{gen:s,schema:a,parentSchema:o,data:c,it:l}=i;let u,d;const{minContains:f,maxContains:p}=o;l.opts.next?(u=f===void 0?1:f,d=p):u=1;const w=s.const("len",(0,t._)`${c}.length`);if(i.setParams({min:u,max:d}),d===void 0&&u===0){(0,e.checkStrictMode)(l,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&u>d){(0,e.checkStrictMode)(l,'"minContains" > "maxContains" is alway\
3206
3208
  s invalid'),i.fail();return}if((0,e.alwaysValidSchema)(l,a)){let v=(0,t._)`${w} >= ${u}`;d!==void 0&&(v=(0,t._)`${v} && ${w} <= ${d}`),i.pass(v);return}l.items=!0;const g=s.name("valid");d===void 0&&u===1?m(g,()=>s.if(g,()=>s.break())):u===0?(s.let(g,!0),d!==void 0&&s.if((0,t._)`${c}.length > 0`,y)):(s.let(g,!1),y()),i.result(g,()=>i.reset());function y(){const v=s.name("_valid"),b=s.let("count",0);m(v,()=>s.if(v,()=>h(b)))}function m(v,b){s.forRange("i",0,w,_=>{i.subschema({keyword:"contains",dataProp:_,
3207
- dataPropType:e.Type.Num,compositeRule:!0},v),b()})}function h(v){s.code((0,t._)`${v}++`),d===void 0?s.if((0,t._)`${v} >= ${u}`,()=>s.assign(g,!0).break()):(s.if((0,t._)`${v} > ${d}`,()=>s.assign(g,!1).break()),u===1?s.assign(g,!0):s.if((0,t._)`${v} >= ${u}`,()=>s.assign(g,!0)))}}};return fv.default=n,fv}var xk={},ZL;function JL(){return ZL||(ZL=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Je(),r=ht(),n=gi();t.error=
3209
+ dataPropType:e.Type.Num,compositeRule:!0},v),b()})}function h(v){s.code((0,t._)`${v}++`),d===void 0?s.if((0,t._)`${v} >= ${u}`,()=>s.assign(g,!0).break()):(s.if((0,t._)`${v} > ${d}`,()=>s.assign(g,!1).break()),u===1?s.assign(g,!0):s.if((0,t._)`${v} >= ${u}`,()=>s.assign(g,!0)))}}};return fv.default=n,fv}var Ak={},GL;function KL(){return GL||(GL=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Je(),r=ht(),n=gi();t.error=
3208
3210
  {message:({params:{property:c,depsCount:l,deps:u}})=>{const d=l===1?"property":"properties";return(0,e.str)`must have ${d} ${u} when property ${c} is present`},params:({params:{property:c,depsCount:l,deps:u,missingProperty:d}})=>(0,e._)`{property: ${c},
3209
3211
  missingProperty: ${d},
3210
3212
  depsCount: ${l},
3211
3213
  deps: ${u}}`};const i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){const[l,u]=s(c);a(c,l),o(c,u)}};function s({schema:c}){const l={},u={};for(const d in c){if(d==="__proto__")continue;const f=Array.isArray(c[d])?l:u;f[d]=c[d]}return[l,u]}function a(c,l=c.schema){const{gen:u,data:d,it:f}=c;if(Object.keys(l).length===0)return;const p=u.let("missing");for(const w in l){const g=l[w];if(g.length===0)continue;const y=(0,n.propertyInData)(u,d,w,f.opts.ownProperties);
3212
3214
  c.setParams({property:w,depsCount:g.length,deps:g.join(", ")}),f.allErrors?u.if(y,()=>{for(const m of g)(0,n.checkReportMissingProp)(c,m)}):(u.if((0,e._)`${y} && (${(0,n.checkMissingProp)(c,g,p)})`),(0,n.reportMissingProp)(c,p),u.else())}}t.validatePropertyDeps=a;function o(c,l=c.schema){const{gen:u,data:d,keyword:f,it:p}=c,w=u.name("valid");for(const g in l)(0,r.alwaysValidSchema)(p,l[g])||(u.if((0,n.propertyInData)(u,d,g,p.opts.ownProperties),()=>{const y=c.subschema({keyword:f,schemaProp:g},w);
3213
- c.mergeValidEvaluated(y,w)},()=>u.var(w,!0)),c.ok(w))}t.validateSchemaDeps=o,t.default=i})(xk)),xk}var pv={},YL;function kne(){if(YL)return pv;YL=1,Object.defineProperty(pv,"__esModule",{value:!0});const t=Je(),e=ht(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:i})=>(0,t._)`{propertyName: ${i.propertyName}}`},code(i){const{gen:s,schema:a,data:o,it:c}=i;if((0,e.alwaysValidSchema)(c,a))return;const l=s.name("\
3214
- valid");s.forIn("key",o,u=>{i.setParams({propertyName:u}),i.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},l),s.if((0,t.not)(l),()=>{i.error(!0),c.allErrors||s.break()})}),i.ok(l)}};return pv.default=n,pv}var hv={},XL;function QL(){if(XL)return hv;XL=1,Object.defineProperty(hv,"__esModule",{value:!0});const t=gi(),e=Je(),r=$s(),n=ht(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,
3215
+ c.mergeValidEvaluated(y,w)},()=>u.var(w,!0)),c.ok(w))}t.validateSchemaDeps=o,t.default=i})(Ak)),Ak}var pv={},ZL;function Tne(){if(ZL)return pv;ZL=1,Object.defineProperty(pv,"__esModule",{value:!0});const t=Je(),e=ht(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:i})=>(0,t._)`{propertyName: ${i.propertyName}}`},code(i){const{gen:s,schema:a,data:o,it:c}=i;if((0,e.alwaysValidSchema)(c,a))return;const l=s.name("\
3216
+ valid");s.forIn("key",o,u=>{i.setParams({propertyName:u}),i.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},l),s.if((0,t.not)(l),()=>{i.error(!0),c.allErrors||s.break()})}),i.ok(l)}};return pv.default=n,pv}var hv={},JL;function YL(){if(JL)return hv;JL=1,Object.defineProperty(hv,"__esModule",{value:!0});const t=gi(),e=Je(),r=$s(),n=ht(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,
3215
3217
  error:{message:"must NOT have additional properties",params:({params:a})=>(0,e._)`{additionalProperty: ${a.additionalProperty}}`},code(a){const{gen:o,schema:c,parentSchema:l,data:u,errsCount:d,it:f}=a;if(!d)throw new Error("ajv implementation error");const{allErrors:p,opts:w}=f;if(f.props=!0,w.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(f,c))return;const g=(0,t.allSchemaProperties)(l.properties),y=(0,t.allSchemaProperties)(l.patternProperties);m(),a.ok((0,e._)`${d} === ${r.default.errors}`);
3216
3218
  function m(){o.forIn("key",u,R=>{!g.length&&!y.length?b(R):o.if(h(R),()=>b(R))})}function h(R){let $;if(g.length>8){const M=(0,n.schemaRefOrVal)(f,l.properties,"properties");$=(0,t.isOwnProperty)(o,M,R)}else g.length?$=(0,e.or)(...g.map(M=>(0,e._)`${R} === ${M}`)):$=e.nil;return y.length&&($=(0,e.or)($,...y.map(M=>(0,e._)`${(0,t.usePattern)(a,M)}.test(${R})`))),(0,e.not)($)}function v(R){o.code((0,e._)`delete ${u}[${R}]`)}function b(R){if(w.removeAdditional==="all"||w.removeAdditional&&c===!1){v(
3217
3219
  R);return}if(c===!1){a.setParams({additionalProperty:R}),a.error(),p||o.break();return}if(typeof c=="object"&&!(0,n.alwaysValidSchema)(f,c)){const $=o.name("valid");w.removeAdditional==="failing"?(_(R,$,!1),o.if((0,e.not)($),()=>{a.reset(),v(R)})):(_(R,$),p||o.if((0,e.not)($),()=>o.break()))}}function _(R,$,M){const q={keyword:"additionalProperties",dataProp:R,dataPropType:n.Type.Str};M===!1&&Object.assign(q,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(q,$)}}};return hv.default=s,
3218
- hv}var mv={},eM;function Sne(){if(eM)return mv;eM=1,Object.defineProperty(mv,"__esModule",{value:!0});const t=yp(),e=gi(),r=ht(),n=QL(),i={keyword:"properties",type:"object",schemaType:"object",code(s){const{gen:a,schema:o,parentSchema:c,data:l,it:u}=s;u.opts.removeAdditional==="all"&&c.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(u,n.default,"additionalProperties"));const d=(0,e.allSchemaProperties)(o);for(const y of d)u.definedProperties.add(y);u.opts.unevaluated&&d.length&&u.
3220
+ hv}var mv={},XL;function $ne(){if(XL)return mv;XL=1,Object.defineProperty(mv,"__esModule",{value:!0});const t=yp(),e=gi(),r=ht(),n=YL(),i={keyword:"properties",type:"object",schemaType:"object",code(s){const{gen:a,schema:o,parentSchema:c,data:l,it:u}=s;u.opts.removeAdditional==="all"&&c.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(u,n.default,"additionalProperties"));const d=(0,e.allSchemaProperties)(o);for(const y of d)u.definedProperties.add(y);u.opts.unevaluated&&d.length&&u.
3219
3221
  props!==!0&&(u.props=r.mergeEvaluated.props(a,(0,r.toHash)(d),u.props));const f=d.filter(y=>!(0,r.alwaysValidSchema)(u,o[y]));if(f.length===0)return;const p=a.name("valid");for(const y of f)w(y)?g(y):(a.if((0,e.propertyInData)(a,l,y,u.opts.ownProperties)),g(y),u.allErrors||a.else().var(p,!0),a.endIf()),s.it.definedProperties.add(y),s.ok(p);function w(y){return u.opts.useDefaults&&!u.compositeRule&&o[y].default!==void 0}function g(y){s.subschema({keyword:"properties",schemaProp:y,dataProp:y},p)}}};
3220
- return mv.default=i,mv}var gv={},tM;function Ene(){if(tM)return gv;tM=1,Object.defineProperty(gv,"__esModule",{value:!0});const t=gi(),e=Je(),r=ht(),n=ht(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(s){const{gen:a,schema:o,data:c,parentSchema:l,it:u}=s,{opts:d}=u,f=(0,t.allSchemaProperties)(o),p=f.filter(b=>(0,r.alwaysValidSchema)(u,o[b]));if(f.length===0||p.length===f.length&&(!u.opts.unevaluated||u.props===!0))return;const w=d.strictSchema&&!d.allowMatchingProperties&&
3222
+ return mv.default=i,mv}var gv={},QL;function Pne(){if(QL)return gv;QL=1,Object.defineProperty(gv,"__esModule",{value:!0});const t=gi(),e=Je(),r=ht(),n=ht(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(s){const{gen:a,schema:o,data:c,parentSchema:l,it:u}=s,{opts:d}=u,f=(0,t.allSchemaProperties)(o),p=f.filter(b=>(0,r.alwaysValidSchema)(u,o[b]));if(f.length===0||p.length===f.length&&(!u.opts.unevaluated||u.props===!0))return;const w=d.strictSchema&&!d.allowMatchingProperties&&
3221
3223
  l.properties,g=a.name("valid");u.props!==!0&&!(u.props instanceof e.Name)&&(u.props=(0,n.evaluatedPropsToName)(a,u.props));const{props:y}=u;m();function m(){for(const b of f)w&&h(b),u.allErrors?v(b):(a.var(g,!0),v(b),a.if(g))}function h(b){for(const _ in w)new RegExp(b).test(_)&&(0,r.checkStrictMode)(u,`property ${_} matches pattern ${b} (use allowMatchingProperties)`)}function v(b){a.forIn("key",c,_=>{a.if((0,e._)`${(0,t.usePattern)(s,b)}.test(${_})`,()=>{const R=p.includes(b);R||s.subschema({keyword:"\
3222
- patternProperties",schemaProp:b,dataProp:_,dataPropType:n.Type.Str},g),u.opts.unevaluated&&y!==!0?a.assign((0,e._)`${y}[${_}]`,!0):!R&&!u.allErrors&&a.if((0,e.not)(g),()=>a.break())})})}}};return gv.default=i,gv}var yv={},rM;function Tne(){if(rM)return yv;rM=1,Object.defineProperty(yv,"__esModule",{value:!0});const t=ht(),e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:n,schema:i,it:s}=r;if((0,t.alwaysValidSchema)(s,i)){r.fail();return}const a=n.name("valid");r.
3223
- subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),r.failResult(a,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return yv.default=e,yv}var vv={},nM;function $ne(){if(nM)return vv;nM=1,Object.defineProperty(vv,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:gi().validateUnion,error:{message:"must match a schema in anyOf"}};return vv.default=e,vv}var wv={},iM;function Pne(){if(iM)return wv;iM=1,Object.defineProperty(
3224
+ patternProperties",schemaProp:b,dataProp:_,dataPropType:n.Type.Str},g),u.opts.unevaluated&&y!==!0?a.assign((0,e._)`${y}[${_}]`,!0):!R&&!u.allErrors&&a.if((0,e.not)(g),()=>a.break())})})}}};return gv.default=i,gv}var yv={},eM;function Cne(){if(eM)return yv;eM=1,Object.defineProperty(yv,"__esModule",{value:!0});const t=ht(),e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:n,schema:i,it:s}=r;if((0,t.alwaysValidSchema)(s,i)){r.fail();return}const a=n.name("valid");r.
3225
+ subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),r.failResult(a,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return yv.default=e,yv}var vv={},tM;function Ane(){if(tM)return vv;tM=1,Object.defineProperty(vv,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:gi().validateUnion,error:{message:"must match a schema in anyOf"}};return vv.default=e,vv}var wv={},rM;function xne(){if(rM)return wv;rM=1,Object.defineProperty(
3224
3226
  wv,"__esModule",{value:!0});const t=Je(),e=ht(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:i})=>(0,t._)`{passingSchemas: ${i.passing}}`},code(i){const{gen:s,schema:a,parentSchema:o,it:c}=i;if(!Array.isArray(a))throw new Error("ajv implementation error");if(c.opts.discriminator&&o.discriminator)return;const l=a,u=s.let("valid",!1),d=s.let("passing",null),f=s.name("_valid");i.setParams({passing:d}),s.block(p),i.result(
3225
- u,()=>i.reset(),()=>i.error(!0));function p(){l.forEach((w,g)=>{let y;(0,e.alwaysValidSchema)(c,w)?s.var(f,!0):y=i.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},f),g>0&&s.if((0,t._)`${f} && ${u}`).assign(u,!1).assign(d,(0,t._)`[${d}, ${g}]`).else(),s.if(f,()=>{s.assign(u,!0),s.assign(d,g),y&&i.mergeEvaluated(y,t.Name)})})}}};return wv.default=n,wv}var bv={},sM;function Cne(){if(sM)return bv;sM=1,Object.defineProperty(bv,"__esModule",{value:!0});const t=ht(),e={keyword:"allOf",schemaType:"\
3226
- array",code(r){const{gen:n,schema:i,it:s}=r;if(!Array.isArray(i))throw new Error("ajv implementation error");const a=n.name("valid");i.forEach((o,c)=>{if((0,t.alwaysValidSchema)(s,o))return;const l=r.subschema({keyword:"allOf",schemaProp:c},a);r.ok(a),r.mergeEvaluated(l)})}};return bv.default=e,bv}var _v={},aM;function Ane(){if(aM)return _v;aM=1,Object.defineProperty(_v,"__esModule",{value:!0});const t=Je(),e=ht(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.
3227
+ u,()=>i.reset(),()=>i.error(!0));function p(){l.forEach((w,g)=>{let y;(0,e.alwaysValidSchema)(c,w)?s.var(f,!0):y=i.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},f),g>0&&s.if((0,t._)`${f} && ${u}`).assign(u,!1).assign(d,(0,t._)`[${d}, ${g}]`).else(),s.if(f,()=>{s.assign(u,!0),s.assign(d,g),y&&i.mergeEvaluated(y,t.Name)})})}}};return wv.default=n,wv}var bv={},nM;function Ine(){if(nM)return bv;nM=1,Object.defineProperty(bv,"__esModule",{value:!0});const t=ht(),e={keyword:"allOf",schemaType:"\
3228
+ array",code(r){const{gen:n,schema:i,it:s}=r;if(!Array.isArray(i))throw new Error("ajv implementation error");const a=n.name("valid");i.forEach((o,c)=>{if((0,t.alwaysValidSchema)(s,o))return;const l=r.subschema({keyword:"allOf",schemaProp:c},a);r.ok(a),r.mergeEvaluated(l)})}};return bv.default=e,bv}var _v={},iM;function Nne(){if(iM)return _v;iM=1,Object.defineProperty(_v,"__esModule",{value:!0});const t=Je(),e=ht(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.
3227
3229
  str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){const{gen:a,parentSchema:o,it:c}=s;o.then===void 0&&o.else===void 0&&(0,e.checkStrictMode)(c,'"if" without "then" and "else" is ignored');const l=i(c,"then"),u=i(c,"else");if(!l&&!u)return;const d=a.let("valid",!0),f=a.name("_valid");if(p(),s.reset(),l&&u){const g=a.let("ifClause");s.setParams({ifClause:g}),a.if(f,w("then",g),w("else",g))}else l?a.if(f,w("then")):a.if((0,t.not)(f),w("el\
3228
- se"));s.pass(d,()=>s.error(!0));function p(){const g=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);s.mergeEvaluated(g)}function w(g,y){return()=>{const m=s.subschema({keyword:g},f);a.assign(d,f),s.mergeValidEvaluated(m,d),y?a.assign(y,(0,t._)`${g}`):s.setParams({ifClause:g})}}}};function i(s,a){const o=s.schema[a];return o!==void 0&&!(0,e.alwaysValidSchema)(s,o)}return _v.default=n,_v}var Rv={},oM;function xne(){if(oM)return Rv;oM=1,Object.defineProperty(Rv,"__esMod\
3229
- ule",{value:!0});const t=ht(),e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:n,it:i}){n.if===void 0&&(0,t.checkStrictMode)(i,`"${r}" without "if" is ignored`)}};return Rv.default=e,Rv}var cM;function lM(){if(cM)return lv;cM=1,Object.defineProperty(lv,"__esModule",{value:!0});const t=zL(),e=bne(),r=VL(),n=_ne(),i=Rne(),s=JL(),a=kne(),o=QL(),c=Sne(),l=Ene(),u=Tne(),d=$ne(),f=Pne(),p=Cne(),w=Ane(),g=xne();function y(m=!1){const h=[u.default,d.default,f.default,
3230
- p.default,w.default,g.default,a.default,o.default,s.default,c.default,l.default];return m?h.push(e.default,n.default):h.push(t.default,r.default),h.push(i.default),h}return lv.default=y,lv}var kv={},Sv={},uM;function Ine(){if(uM)return Sv;uM=1,Object.defineProperty(Sv,"__esModule",{value:!0});const t=Je(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,t._)`{format: ${n}}`},
3230
+ se"));s.pass(d,()=>s.error(!0));function p(){const g=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);s.mergeEvaluated(g)}function w(g,y){return()=>{const m=s.subschema({keyword:g},f);a.assign(d,f),s.mergeValidEvaluated(m,d),y?a.assign(y,(0,t._)`${g}`):s.setParams({ifClause:g})}}}};function i(s,a){const o=s.schema[a];return o!==void 0&&!(0,e.alwaysValidSchema)(s,o)}return _v.default=n,_v}var Rv={},sM;function Dne(){if(sM)return Rv;sM=1,Object.defineProperty(Rv,"__esMod\
3231
+ ule",{value:!0});const t=ht(),e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:n,it:i}){n.if===void 0&&(0,t.checkStrictMode)(i,`"${r}" without "if" is ignored`)}};return Rv.default=e,Rv}var aM;function oM(){if(aM)return lv;aM=1,Object.defineProperty(lv,"__esModule",{value:!0});const t=HL(),e=kne(),r=zL(),n=Sne(),i=Ene(),s=KL(),a=Tne(),o=YL(),c=$ne(),l=Pne(),u=Cne(),d=Ane(),f=xne(),p=Ine(),w=Nne(),g=Dne();function y(m=!1){const h=[u.default,d.default,f.default,
3232
+ p.default,w.default,g.default,a.default,o.default,s.default,c.default,l.default];return m?h.push(e.default,n.default):h.push(t.default,r.default),h.push(i.default),h}return lv.default=y,lv}var kv={},Sv={},cM;function One(){if(cM)return Sv;cM=1,Object.defineProperty(Sv,"__esModule",{value:!0});const t=Je(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,t._)`{format: ${n}}`},
3231
3233
  code(n,i){const{gen:s,data:a,$data:o,schema:c,schemaCode:l,it:u}=n,{opts:d,errSchemaPath:f,schemaEnv:p,self:w}=u;if(!d.validateFormats)return;o?g():y();function g(){const m=s.scopeValue("formats",{ref:w.formats,code:d.code.formats}),h=s.const("fDef",(0,t._)`${m}[${l}]`),v=s.let("fType"),b=s.let("format");s.if((0,t._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>s.assign(v,(0,t._)`${h}.type || "string"`).assign(b,(0,t._)`${h}.validate`),()=>s.assign(v,(0,t._)`"string"`).assign(b,h)),
3232
3234
  n.fail$data((0,t.or)(_(),R()));function _(){return d.strictSchema===!1?t.nil:(0,t._)`${l} && !${b}`}function R(){const $=p.$async?(0,t._)`(${h}.async ? await ${b}(${a}) : ${b}(${a}))`:(0,t._)`${b}(${a})`,M=(0,t._)`(typeof ${b} == "function" ? ${$} : ${b}.test(${a}))`;return(0,t._)`${b} && ${b} !== true && ${v} === ${i} && !${M}`}}function y(){const m=w.formats[c];if(!m){_();return}if(m===!0)return;const[h,v,b]=R(m);h===i&&n.pass($());function _(){if(d.strictSchema===!1){w.logger.warn(M());return}
3233
3235
  throw new Error(M());function M(){return`unknown format "${c}" ignored in schema at path "${f}"`}}function R(M){const q=M instanceof RegExp?(0,t.regexpCode)(M):d.code.formats?(0,t._)`${d.code.formats}${(0,t.getProperty)(c)}`:void 0,Z=s.scopeValue("formats",{key:c,ref:M,code:q});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,t._)`${Z}.validate`]:["string",M,Z]}function $(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!p.$async)throw new Error("asyn\
3234
- c format in sync schema");return(0,t._)`await ${b}(${a})`}return typeof v=="function"?(0,t._)`${b}(${a})`:(0,t._)`${b}.test(${a})`}}}};return Sv.default=r,Sv}var dM;function fM(){if(dM)return kv;dM=1,Object.defineProperty(kv,"__esModule",{value:!0});const e=[Ine().default];return kv.default=e,kv}var Lo={},pM;function hM(){return pM||(pM=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.contentVocabulary=Lo.metadataVocabulary=void 0,Lo.metadataVocabulary=["title","description","default","dep\
3235
- recated","readOnly","writeOnly","examples"],Lo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Lo}var mM;function Nne(){if(mM)return Gy;mM=1,Object.defineProperty(Gy,"__esModule",{value:!0});const t=$L(),e=HL(),r=lM(),n=fM(),i=hM(),s=[t.default,e.default,(0,r.default)(),n.default,i.metadataVocabulary,i.contentVocabulary];return Gy.default=s,Gy}var Ev={},bp={},gM;function Dne(){if(gM)return bp;gM=1,Object.defineProperty(bp,"__esModule",{value:!0}),bp.DiscrError=void 0;var t;
3236
- return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(bp.DiscrError=t={})),bp}var yM;function vM(){if(yM)return Ev;yM=1,Object.defineProperty(Ev,"__esModule",{value:!0});const t=Je(),e=Dne(),r=Vy(),n=vp(),i=ht(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:o,tagName:c}})=>o===e.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:o,tag:c,tagName:l}})=>(0,t._)`{error: ${o}, tag: ${l}, tagValue: ${c}}`},
3236
+ c format in sync schema");return(0,t._)`await ${b}(${a})`}return typeof v=="function"?(0,t._)`${b}(${a})`:(0,t._)`${b}.test(${a})`}}}};return Sv.default=r,Sv}var lM;function uM(){if(lM)return kv;lM=1,Object.defineProperty(kv,"__esModule",{value:!0});const e=[One().default];return kv.default=e,kv}var Lo={},dM;function fM(){return dM||(dM=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.contentVocabulary=Lo.metadataVocabulary=void 0,Lo.metadataVocabulary=["title","description","default","dep\
3237
+ recated","readOnly","writeOnly","examples"],Lo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Lo}var pM;function Lne(){if(pM)return Gy;pM=1,Object.defineProperty(Gy,"__esModule",{value:!0});const t=EL(),e=qL(),r=oM(),n=uM(),i=fM(),s=[t.default,e.default,(0,r.default)(),n.default,i.metadataVocabulary,i.contentVocabulary];return Gy.default=s,Gy}var Ev={},bp={},hM;function Mne(){if(hM)return bp;hM=1,Object.defineProperty(bp,"__esModule",{value:!0}),bp.DiscrError=void 0;var t;
3238
+ return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(bp.DiscrError=t={})),bp}var mM;function gM(){if(mM)return Ev;mM=1,Object.defineProperty(Ev,"__esModule",{value:!0});const t=Je(),e=Mne(),r=Vy(),n=vp(),i=ht(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:o,tagName:c}})=>o===e.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:o,tag:c,tagName:l}})=>(0,t._)`{error: ${o}, tag: ${l}, tagValue: ${c}}`},
3237
3239
  code(o){const{gen:c,data:l,schema:u,parentSchema:d,it:f}=o,{oneOf:p}=d;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");const w=u.propertyName;if(typeof w!="string")throw new Error("discriminator: requires propertyName");if(u.mapping)throw new Error("discriminator: mapping is not supported");if(!p)throw new Error("discriminator: requires oneOf keyword");const g=c.let("valid",!1),y=c.const("tag",(0,t._)`${l}${(0,t.getProperty)(w)}`);c.if((0,t._)`typeof ${y} == "string"`,
3238
3240
  ()=>m(),()=>o.error(!1,{discrError:e.DiscrError.Tag,tag:y,tagName:w})),o.ok(g);function m(){const b=v();c.if(!1);for(const _ in b)c.elseIf((0,t._)`${y} === ${_}`),c.assign(g,h(b[_]));c.else(),o.error(!1,{discrError:e.DiscrError.Mapping,tag:y,tagName:w}),c.endIf()}function h(b){const _=c.name("valid"),R=o.subschema({keyword:"oneOf",schemaProp:b},_);return o.mergeEvaluated(R,t.Name),_}function v(){var b;const _={},R=M(d);let $=!0;for(let L=0;L<p.length;L++){let P=p[L];if(P?.$ref&&!(0,i.schemaHasRulesButRef)(
3239
3241
  P,f.self.RULES)){const B=P.$ref;if(P=r.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,B),P instanceof r.SchemaEnv&&(P=P.schema),P===void 0)throw new n.default(f.opts.uriResolver,f.baseId,B)}const T=(b=P?.properties)===null||b===void 0?void 0:b[w];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${w}"`);$=$&&(R||M(P)),q(T,L)}if(!$)throw new Error(`discriminator: "${w}" must be required`);return _;function M({required:L}){return Array.
3240
- isArray(L)&&L.includes(w)}function q(L,P){if(L.const)Z(L.const,P);else if(L.enum)for(const T of L.enum)Z(T,P);else throw new Error(`discriminator: "properties/${w}" must have "const" or "enum"`)}function Z(L,P){if(typeof L!="string"||L in _)throw new Error(`discriminator: "${w}" values must be unique strings`);_[L]=P}}}};return Ev.default=a,Ev}const wM="http://json-schema.org/draft-07/schema#",bM="http://json-schema.org/draft-07/schema#",_M="Core schema meta-schema",RM={schemaArray:{type:"array",
3241
- minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},kM=["object","boolean"],SM={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},
3242
+ isArray(L)&&L.includes(w)}function q(L,P){if(L.const)Z(L.const,P);else if(L.enum)for(const T of L.enum)Z(T,P);else throw new Error(`discriminator: "properties/${w}" must have "const" or "enum"`)}function Z(L,P){if(typeof L!="string"||L in _)throw new Error(`discriminator: "${w}" values must be unique strings`);_[L]=P}}}};return Ev.default=a,Ev}const yM="http://json-schema.org/draft-07/schema#",vM="http://json-schema.org/draft-07/schema#",wM="Core schema meta-schema",bM={schemaArray:{type:"array",
3243
+ minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},_M=["object","boolean"],RM={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},
3242
3244
  title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"\
3243
3245
  #/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"obje\
3244
3246
  ct",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"str\
3245
- ing"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},One={$schema:wM,$id:bM,title:_M,definitions:RM,type:kM,properties:SM,default:!0},Lne={__proto__:null,$id:bM,$schema:wM,default:One,definitions:RM,properties:SM,title:_M,type:kM},Mne=em(Lne);var EM;function TM(){return EM||(EM=1,(function(t,e){Object.
3246
- defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const r=RL(),n=Nne(),i=vM(),s=Mne,a=["/properties"],o="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(w=>this.addVocabulary(w)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const w=this.
3247
+ ing"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},jne={$schema:yM,$id:vM,title:wM,definitions:bM,type:_M,properties:RM,default:!0},qne={__proto__:null,$id:vM,$schema:yM,default:jne,definitions:bM,properties:RM,title:wM,type:_M},Fne=em(qne);var kM;function SM(){return kM||(kM=1,(function(t,e){Object.
3248
+ defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const r=bL(),n=Lne(),i=gM(),s=Fne,a=["/properties"],o="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(w=>this.addVocabulary(w)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const w=this.
3247
3249
  opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(w,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=yp();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Je();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(
3248
3250
  e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=zy();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var f=vp();Object.
3249
- defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(Ly,Ly.exports)),Ly.exports}var jne=TM(),Tv={exports:{}},Ik={},$M;function qne(){return $M||($M=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(L,P){return{validate:L,compare:P}}t.fullFormats={date:e(s,a),time:e(c(!0),l),"date-time":e(f(!0),p),"iso-time":e(c(),u),"iso-date-time":e(f(),w),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
3251
+ defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(Ly,Ly.exports)),Ly.exports}var Hne=SM(),Tv={exports:{}},xk={},EM;function Bne(){return EM||(EM=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(L,P){return{validate:L,compare:P}}t.fullFormats={date:e(s,a),time:e(c(!0),l),"date-time":e(f(!0),p),"iso-time":e(c(),u),"iso-date-time":e(f(),w),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
3250
3252
  uri:m,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
3251
3253
  "uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
3252
3254
  email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
@@ -3255,15 +3257,15 @@ a),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d
3255
3257
  email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function r(L){return L%4===0&&(L%100!==0||L%400===0)}const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(L){const P=n.exec(L);if(!P)return!1;const T=+P[1],B=+P[2],H=+P[3];return B>=1&&B<=12&&H>=1&&H<=(B===2&&r(T)?29:i[B])}function a(L,P){if(L&&P)return L>P?1:L<P?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
3256
3258
  function c(L){return function(T){const B=o.exec(T);if(!B)return!1;const H=+B[1],U=+B[2],G=+B[3],oe=B[4],ne=B[5]==="-"?-1:1,C=+(B[6]||0),F=+(B[7]||0);if(C>23||F>59||L&&!oe)return!1;if(H<=23&&U<=59&&G<60)return!0;const Y=U-F*ne,K=H-C*ne-(Y<0?1:0);return(K===23||K===-1)&&(Y===59||Y===-1)&&G<61}}function l(L,P){if(!(L&&P))return;const T=new Date("2020-01-01T"+L).valueOf(),B=new Date("2020-01-01T"+P).valueOf();if(T&&B)return T-B}function u(L,P){if(!(L&&P))return;const T=o.exec(L),B=o.exec(P);if(T&&B)
3257
3259
  return L=T[1]+T[2]+T[3],P=B[1]+B[2]+B[3],L>P?1:L<P?-1:0}const d=/t|\s/i;function f(L){const P=c(L);return function(B){const H=B.split(d);return H.length===2&&s(H[0])&&P(H[1])}}function p(L,P){if(!(L&&P))return;const T=new Date(L).valueOf(),B=new Date(P).valueOf();if(T&&B)return T-B}function w(L,P){if(!(L&&P))return;const[T,B]=L.split(d),[H,U]=P.split(d),G=a(T,H);if(G!==void 0)return G||l(B,U)}const g=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
3258
- function m(L){return g.test(L)&&y.test(L)}const h=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(L){return h.lastIndex=0,h.test(L)}const b=-2147483648,_=2**31-1;function R(L){return Number.isInteger(L)&&L<=_&&L>=b}function $(L){return Number.isInteger(L)}function M(){return!0}const q=/[^\\]\\Z/;function Z(L){if(q.test(L))return!1;try{return new RegExp(L),!0}catch{return!1}}})(Ik)),Ik}var Nk={},PM;function Fne(){return PM||(PM=1,(function(t){Object.defineProperty(
3259
- t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=TM(),r=Je(),n=r.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:o,schemaCode:c})=>(0,r.str)`should be ${i[o].okStr} ${c}`,params:({keyword:o,schemaCode:c})=>(0,r._)`{comparison: ${i[o].okStr}, limit: ${c}}`};t.formatLimitDefinition={keyword:Object.
3260
+ function m(L){return g.test(L)&&y.test(L)}const h=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(L){return h.lastIndex=0,h.test(L)}const b=-2147483648,_=2**31-1;function R(L){return Number.isInteger(L)&&L<=_&&L>=b}function $(L){return Number.isInteger(L)}function M(){return!0}const q=/[^\\]\\Z/;function Z(L){if(q.test(L))return!1;try{return new RegExp(L),!0}catch{return!1}}})(xk)),xk}var Ik={},TM;function zne(){return TM||(TM=1,(function(t){Object.defineProperty(
3261
+ t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=SM(),r=Je(),n=r.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:o,schemaCode:c})=>(0,r.str)`should be ${i[o].okStr} ${c}`,params:({keyword:o,schemaCode:c})=>(0,r._)`{comparison: ${i[o].okStr}, limit: ${c}}`};t.formatLimitDefinition={keyword:Object.
3260
3262
  keys(i),type:"string",schemaType:"string",$data:!0,error:s,code(o){const{gen:c,data:l,schemaCode:u,keyword:d,it:f}=o,{opts:p,self:w}=f;if(!p.validateFormats)return;const g=new e.KeywordCxt(f,w.RULES.all.format.definition,"format");g.$data?y():m();function y(){const v=c.scopeValue("formats",{ref:w.formats,code:p.code.formats}),b=c.const("fmt",(0,r._)`${v}[${g.schemaCode}]`);o.fail$data((0,r.or)((0,r._)`typeof ${b} != "object"`,(0,r._)`${b} instanceof RegExp`,(0,r._)`typeof ${b}.compare != "function"`,
3261
3263
  h(b)))}function m(){const v=g.schema,b=w.formats[v];if(!b||b===!0)return;if(typeof b!="object"||b instanceof RegExp||typeof b.compare!="function")throw new Error(`"${d}": format "${v}" does not define "compare" function`);const _=c.scopeValue("formats",{key:v,ref:b,code:p.code.formats?(0,r._)`${p.code.formats}${(0,r.getProperty)(v)}`:void 0});o.fail$data(h(_))}function h(v){return(0,r._)`${v}.compare(${l}, ${u}) ${i[d].fail} 0`}},dependencies:["format"]};const a=o=>(o.addKeyword(t.formatLimitDefinition),
3262
- o);t.default=a})(Nk)),Nk}var CM;function Hne(){return CM||(CM=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=qne(),n=Fne(),i=Je(),s=new i.Name("fullFormats"),a=new i.Name("fastFormats"),o=(l,u={keywords:!0})=>{if(Array.isArray(u))return c(l,u,r.fullFormats,s),l;const[d,f]=u.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,s],p=u.formats||r.formatNames;return c(l,p,d,f),u.keywords&&(0,n.default)(l),l};o.get=(l,u="full")=>{const f=(u==="fast"?r.fastFormats:r.fullFormats)[l];
3263
- if(!f)throw new Error(`Unknown format "${l}"`);return f};function c(l,u,d,f){var p,w;(p=(w=l.opts.code).formats)!==null&&p!==void 0||(w.formats=(0,i._)`require("ajv-formats/dist/formats").${f}`);for(const g of u)l.addFormat(g,d[g])}t.exports=e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o})(Tv,Tv.exports)),Tv.exports}var Bne=Hne();const AM=Ks(Bne);function zne(){const t=new jne.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return AM(t),t}class Une{constructor(e){
3264
- this._ajv=e??zne()}getValidator(e){var r;const n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}}class Vne extends Gre{constructor(e,r){var n,i;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Qg.options.map((s,a)=>[s,a])),this.isMessageIgnored=(s,a)=>{const o=this.
3265
- _loggingLevels.get(a);return o?this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this._jsonSchemaValidator=(i=r?.jsonSchemaValidator)!==null&&i!==void 0?i:new Une,this.setRequestHandler(F_,s=>this._oninitialize(s)),this.setNotificationHandler(rN,()=>{var s;return(s=this.oninitialized)===null||s===void 0?void 0:s.call(this)}),this._capabilities.logging&&this.setRequestHandler(lN,async(s,a)=>{
3266
- var o;const c=a.sessionId||((o=a.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:l}=s.params,u=Qg.safeParse(l);return u.success&&this._loggingLevels.set(c,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Kre(this._capabilities,e)}assertCapabilityForMethod(e){var r,n,i;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&
3264
+ o);t.default=a})(Ik)),Ik}var $M;function Une(){return $M||($M=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=Bne(),n=zne(),i=Je(),s=new i.Name("fullFormats"),a=new i.Name("fastFormats"),o=(l,u={keywords:!0})=>{if(Array.isArray(u))return c(l,u,r.fullFormats,s),l;const[d,f]=u.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,s],p=u.formats||r.formatNames;return c(l,p,d,f),u.keywords&&(0,n.default)(l),l};o.get=(l,u="full")=>{const f=(u==="fast"?r.fastFormats:r.fullFormats)[l];
3265
+ if(!f)throw new Error(`Unknown format "${l}"`);return f};function c(l,u,d,f){var p,w;(p=(w=l.opts.code).formats)!==null&&p!==void 0||(w.formats=(0,i._)`require("ajv-formats/dist/formats").${f}`);for(const g of u)l.addFormat(g,d[g])}t.exports=e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o})(Tv,Tv.exports)),Tv.exports}var Vne=Une();const PM=Ks(Vne);function Wne(){const t=new Hne.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return PM(t),t}class Gne{constructor(e){
3266
+ this._ajv=e??Wne()}getValidator(e){var r;const n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}}class Kne extends Jre{constructor(e,r){var n,i;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Qg.options.map((s,a)=>[s,a])),this.isMessageIgnored=(s,a)=>{const o=this.
3267
+ _loggingLevels.get(a);return o?this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this._jsonSchemaValidator=(i=r?.jsonSchemaValidator)!==null&&i!==void 0?i:new Gne,this.setRequestHandler(F_,s=>this._oninitialize(s)),this.setNotificationHandler(rN,()=>{var s;return(s=this.oninitialized)===null||s===void 0?void 0:s.call(this)}),this._capabilities.logging&&this.setRequestHandler(lN,async(s,a)=>{
3268
+ var o;const c=a.sessionId||((o=a.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:l}=s.params,u=Qg.safeParse(l);return u.success&&this._loggingLevels.set(c,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Yre(this._capabilities,e)}assertCapabilityForMethod(e){var r,n,i;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&
3267
3269
  r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((i=this._clientCapabilities)===null||i===void 0)&&i.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/mess\
3268
3270
  age":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notif\
3269
3271
  ications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"\
@@ -3271,65 +3273,65 @@ prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not su
3271
3273
  return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:O_.includes(r)?r:KI,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},j_)}async createMessage(e,r){return this.request({method:"\
3272
3274
  sampling/createMessage",params:e},uN,r)}async elicitInput(e,r){const n=await this.request({method:"elicitation/create",params:e},dN,r);if(n.action==="accept"&&n.content&&e.requestedSchema)try{const s=this._jsonSchemaValidator.getValidator(e.requestedSchema)(n.content);if(!s.valid)throw new sr(Gt.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(i){throw i instanceof sr?i:new sr(Gt.InternalError,`Error validating elicitation response: ${i instanceof
3273
3275
  Error?i.message:String(i)}`)}return n}async listRoots(e,r){return this.request({method:"roots/list",params:e},fN,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){
3274
- return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const Wne=Symbol("Let zodToJsonSchema decide on which parser to use"),xM={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"\
3275
- definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Gne=t=>typeof t=="string"?{...xM,name:t}:{...xM,...t},Kne=t=>{const e=Gne(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,
3276
- seen:new Map(Object.entries(e.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function IM(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function St(t,e,r,n,i){t[e]=r,IM(t,e,n,i)}const NM=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function pn(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];
3277
- return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?NM(e,t.currentPath):e.join("/")}}function Zne(t,e){const r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==ye.ZodAny&&(r.items=_t(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&St(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&St(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(St(r,"minItems",t.exactLength.value,t.exactLength.message,e),St(
3278
- r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Jne(t,e){const r={type:"integer",format:"int64"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?St(r,"minimum",n.value,n.message,e):St(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),St(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?St(r,"maximum",n.value,n.message,e):St(r,"exclusiveMaximum",n.value,
3279
- n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),St(r,"maximum",n.value,n.message,e));break;case"multipleOf":St(r,"multipleOf",n.value,n.message,e);break}return r}function Yne(){return{type:"boolean"}}function DM(t,e){return _t(t.type._def,e)}const Xne=(t,e)=>_t(t.innerType._def,e);function OM(t,e,r){const n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,s)=>OM(t,e,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{
3280
- type:"string",format:"date"};case"integer":return Qne(t,e)}}const Qne=(t,e)=>{const r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(const n of t.checks)switch(n.kind){case"min":St(r,"minimum",n.value,n.message,e);break;case"max":St(r,"maximum",n.value,n.message,e);break}return r};function eie(t,e){return{..._t(t.innerType._def,e),default:t.defaultValue()}}function tie(t,e){return e.effectStrategy==="input"?_t(t.schema._def,e):pn(e)}function rie(t){return{type:"string",
3281
- enum:Array.from(t.values)}}const nie=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function iie(t,e){const r=[_t(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),_t(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s);let n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const i=[];return r.forEach(s=>{if(nie(s))i.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let a=s;if("additionalProperties"in s&&s.additionalProperties===
3282
- !1){const{additionalProperties:o,...c}=s;a=c}else n=void 0;i.push(a)}}),i.length?{allOf:i,...n}:void 0}function sie(t,e){const r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}let Dk;const yi={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
3283
- emoji:()=>(Dk===void 0&&(Dk=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Dk),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
3276
+ return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const Zne=Symbol("Let zodToJsonSchema decide on which parser to use"),CM={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"\
3277
+ definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Jne=t=>typeof t=="string"?{...CM,name:t}:{...CM,...t},Yne=t=>{const e=Jne(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,
3278
+ seen:new Map(Object.entries(e.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function AM(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function St(t,e,r,n,i){t[e]=r,AM(t,e,n,i)}const xM=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function pn(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];
3279
+ return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?xM(e,t.currentPath):e.join("/")}}function Xne(t,e){const r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==ye.ZodAny&&(r.items=_t(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&St(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&St(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(St(r,"minItems",t.exactLength.value,t.exactLength.message,e),St(
3280
+ r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Qne(t,e){const r={type:"integer",format:"int64"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?St(r,"minimum",n.value,n.message,e):St(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),St(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?St(r,"maximum",n.value,n.message,e):St(r,"exclusiveMaximum",n.value,
3281
+ n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),St(r,"maximum",n.value,n.message,e));break;case"multipleOf":St(r,"multipleOf",n.value,n.message,e);break}return r}function eie(){return{type:"boolean"}}function IM(t,e){return _t(t.type._def,e)}const tie=(t,e)=>_t(t.innerType._def,e);function NM(t,e,r){const n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,s)=>NM(t,e,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{
3282
+ type:"string",format:"date"};case"integer":return rie(t,e)}}const rie=(t,e)=>{const r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(const n of t.checks)switch(n.kind){case"min":St(r,"minimum",n.value,n.message,e);break;case"max":St(r,"maximum",n.value,n.message,e);break}return r};function nie(t,e){return{..._t(t.innerType._def,e),default:t.defaultValue()}}function iie(t,e){return e.effectStrategy==="input"?_t(t.schema._def,e):pn(e)}function sie(t){return{type:"string",
3283
+ enum:Array.from(t.values)}}const aie=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function oie(t,e){const r=[_t(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),_t(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s);let n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const i=[];return r.forEach(s=>{if(aie(s))i.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let a=s;if("additionalProperties"in s&&s.additionalProperties===
3284
+ !1){const{additionalProperties:o,...c}=s;a=c}else n=void 0;i.push(a)}}),i.length?{allOf:i,...n}:void 0}function cie(t,e){const r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}let Nk;const yi={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
3285
+ emoji:()=>(Nk===void 0&&(Nk=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Nk),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
3284
3286
  ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
3285
- base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function LM(t,e){const r={type:"string"};if(t.checks)for(const n of t.checks)switch(n.kind){case"min":St(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":St(r,"maxLength",typeof r.maxLength=="numbe\
3287
+ base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function DM(t,e){const r={type:"string"};if(t.checks)for(const n of t.checks)switch(n.kind){case"min":St(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":St(r,"maxLength",typeof r.maxLength=="numbe\
3286
3288
  r"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":vi(r,"email",n.message,e);break;case"format:idn-email":vi(r,"idn-email",n.message,e);break;case"pattern:zod":Xr(r,yi.email,n.message,e);break}break;case"url":vi(r,"uri",n.message,e);break;case"uuid":vi(r,"uuid",n.message,e);break;case"regex":Xr(r,n.regex,n.message,e);break;case"cuid":Xr(r,yi.cuid,n.message,e);break;case"cuid2":Xr(r,yi.cuid2,n.message,e);break;case"startsWith":Xr(r,RegExp(
3287
- `^${Ok(n.value,e)}`),n.message,e);break;case"endsWith":Xr(r,RegExp(`${Ok(n.value,e)}$`),n.message,e);break;case"datetime":vi(r,"date-time",n.message,e);break;case"date":vi(r,"date",n.message,e);break;case"time":vi(r,"time",n.message,e);break;case"duration":vi(r,"duration",n.message,e);break;case"length":St(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),St(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"\
3288
- includes":{Xr(r,RegExp(Ok(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&vi(r,"ipv4",n.message,e),n.version!=="v4"&&vi(r,"ipv6",n.message,e);break}case"base64url":Xr(r,yi.base64url,n.message,e);break;case"jwt":Xr(r,yi.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Xr(r,yi.ipv4Cidr,n.message,e),n.version!=="v4"&&Xr(r,yi.ipv6Cidr,n.message,e);break}case"emoji":Xr(r,yi.emoji(),n.message,e);break;case"ulid":{Xr(r,yi.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"\
3289
- format:binary":{vi(r,"binary",n.message,e);break}case"contentEncoding:base64":{St(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Xr(r,yi.base64,n.message,e);break}}break}case"nanoid":Xr(r,yi.nanoid,n.message,e)}return r}function Ok(t,e){return e.patternStrategy==="escape"?oie(t):t}const aie=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function oie(t){let e="";for(let r=0;r<t.length;r++)aie.has(t[r])||(e+="\\"),e+=t[r];return e}function vi(t,e,r,n){t.
3289
+ `^${Dk(n.value,e)}`),n.message,e);break;case"endsWith":Xr(r,RegExp(`${Dk(n.value,e)}$`),n.message,e);break;case"datetime":vi(r,"date-time",n.message,e);break;case"date":vi(r,"date",n.message,e);break;case"time":vi(r,"time",n.message,e);break;case"duration":vi(r,"duration",n.message,e);break;case"length":St(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),St(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"\
3290
+ includes":{Xr(r,RegExp(Dk(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&vi(r,"ipv4",n.message,e),n.version!=="v4"&&vi(r,"ipv6",n.message,e);break}case"base64url":Xr(r,yi.base64url,n.message,e);break;case"jwt":Xr(r,yi.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Xr(r,yi.ipv4Cidr,n.message,e),n.version!=="v4"&&Xr(r,yi.ipv6Cidr,n.message,e);break}case"emoji":Xr(r,yi.emoji(),n.message,e);break;case"ulid":{Xr(r,yi.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"\
3291
+ format:binary":{vi(r,"binary",n.message,e);break}case"contentEncoding:base64":{St(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Xr(r,yi.base64,n.message,e);break}}break}case"nanoid":Xr(r,yi.nanoid,n.message,e)}return r}function Dk(t,e){return e.patternStrategy==="escape"?uie(t):t}const lie=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function uie(t){let e="";for(let r=0;r<t.length;r++)lie.has(t[r])||(e+="\\"),e+=t[r];return e}function vi(t,e,r,n){t.
3290
3292
  format||t.anyOf?.some(i=>i.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):St(t,"format",e,r,n)}function Xr(t,e,r,n){t.pattern||t.allOf?.some(i=>i.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.
3291
- allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:MM(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):St(t,"pattern",MM(e,n),r,n)}function MM(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},
3293
+ allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:OM(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):St(t,"pattern",OM(e,n),r,n)}function OM(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},
3292
3294
  n=r.i?t.source.toLowerCase():t.source;let i="",s=!1,a=!1,o=!1;for(let c=0;c<n.length;c++){if(s){i+=n[c],s=!1;continue}if(r.i){if(a){if(n[c].match(/[a-z]/)){o?(i+=n[c],i+=`${n[c-2]}-${n[c]}`.toUpperCase(),o=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(i+=n[c],o=!0):i+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){i+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){i+=`(^|(?<=[\r
3293
3295
  ]))`;continue}else if(n[c]==="$"){i+=`($|(?=[\r
3294
3296
  ]))`;continue}}if(r.s&&n[c]==="."){i+=a?`${n[c]}\r
3295
3297
  `:`[${n[c]}\r
3296
- ]`;continue}i+=n[c],n[c]==="\\"?s=!0:a&&n[c]==="]"?a=!1:!a&&n[c]==="["&&(a=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return i}function jM(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===ye.ZodEnum)return{type:"o\
3298
+ ]`;continue}i+=n[c],n[c]==="\\"?s=!0:a&&n[c]==="]"?a=!1:!a&&n[c]==="["&&(a=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return i}function LM(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===ye.ZodEnum)return{type:"o\
3297
3299
  bject",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,i)=>({...n,[i]:_t(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",i]})??pn(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const r={type:"object",additionalProperties:_t(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===ye.ZodString&&t.keyType._def.checks?.length){
3298
- const{type:n,...i}=LM(t.keyType._def,e);return{...r,propertyNames:i}}else{if(t.keyType?._def.typeName===ye.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===ye.ZodBranded&&t.keyType._def.type._def.typeName===ye.ZodString&&t.keyType._def.type._def.checks?.length){const{type:n,...i}=DM(t.keyType._def,e);return{...r,propertyNames:i}}}return r}function cie(t,e){if(e.mapStrategy==="record")return jM(t,e);const r=_t(t.keyType._def,{...e,currentPath:[...e.currentPath,
3299
- "items","items","0"]})||pn(e),n=_t(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pn(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function lie(t){const e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),i=Array.from(new Set(n.map(s=>typeof s)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:n}}function uie(t){return t.target==="openAi"?void 0:{not:pn(
3300
- {...t,currentPath:[...t.currentPath,"not"]})}}function die(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const $v={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fie(t,e){if(e.target==="openApi3")return qM(t,e);const r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in $v&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((i,s)=>{const a=$v[s._def.typeName];
3300
+ const{type:n,...i}=DM(t.keyType._def,e);return{...r,propertyNames:i}}else{if(t.keyType?._def.typeName===ye.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===ye.ZodBranded&&t.keyType._def.type._def.typeName===ye.ZodString&&t.keyType._def.type._def.checks?.length){const{type:n,...i}=IM(t.keyType._def,e);return{...r,propertyNames:i}}}return r}function die(t,e){if(e.mapStrategy==="record")return LM(t,e);const r=_t(t.keyType._def,{...e,currentPath:[...e.currentPath,
3301
+ "items","items","0"]})||pn(e),n=_t(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pn(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function fie(t){const e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),i=Array.from(new Set(n.map(s=>typeof s)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:n}}function pie(t){return t.target==="openAi"?void 0:{not:pn(
3302
+ {...t,currentPath:[...t.currentPath,"not"]})}}function hie(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const $v={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function mie(t,e){if(e.target==="openApi3")return MM(t,e);const r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in $v&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((i,s)=>{const a=$v[s._def.typeName];
3301
3303
  return a&&!i.includes(a)?[...i,a]:i},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((i,s)=>{const a=typeof s._def.value;switch(a){case"string":case"number":case"boolean":return[...i,a];case"bigint":return[...i,"integer"];case"object":if(s._def.value===null)return[...i,"null"];case"symbol":case"undefined":case"function":default:return i}},[]);if(n.length===r.length){const i=n.filter((s,a,o)=>o.indexOf(s)===a);return{type:i.length>
3302
- 1?i:i[0],enum:r.reduce((s,a)=>s.includes(a._def.value)?s:[...s,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,i)=>[...n,...i._def.values.filter(s=>!n.includes(s))],[])};return qM(t,e)}const qM=(t,e)=>{const r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,i)=>_t(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.
3303
- length?{anyOf:r}:void 0};function pie(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:$v[t.innerType._def.typeName],nullable:!0}:{type:[$v[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const n=_t(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const r=_t(t.
3304
- innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function hie(t,e){const r={type:"number"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"int":r.type="integer",IM(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?St(r,"minimum",n.value,n.message,e):St(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),St(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSc\
3305
- hema7"?n.inclusive?St(r,"maximum",n.value,n.message,e):St(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),St(r,"maximum",n.value,n.message,e));break;case"multipleOf":St(r,"multipleOf",n.value,n.message,e);break}return r}function mie(t,e){const r=e.target==="openAi",n={type:"object",properties:{}},i=[],s=t.shape();for(const o in s){let c=s[o];if(c===void 0||c._def===void 0)continue;let l=yie(c);l&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||
3306
- (c=c.nullable()),l=!1);const u=_t(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(n.properties[o]=u,l||i.push(o))}i.length&&(n.required=i);const a=gie(t,e);return a!==void 0&&(n.additionalProperties=a),n}function gie(t,e){if(t.catchall._def.typeName!=="ZodNever")return _t(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"\
3307
- strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function yie(t){try{return t.isOptional()}catch{return!0}}const vie=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return _t(t.innerType._def,e);const r=_t(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pn(e)},r]}:pn(e)},wie=(t,e)=>{if(e.pipeStrategy==="input")return _t(t.in.
3308
- _def,e);if(e.pipeStrategy==="output")return _t(t.out._def,e);const r=_t(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=_t(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(i=>i!==void 0)}};function bie(t,e){return _t(t.type._def,e)}function _ie(t,e){const n={type:"array",uniqueItems:!0,items:_t(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&St(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&
3309
- St(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Rie(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>_t(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:_t(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>_t(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce(
3310
- (r,n)=>n===void 0?r:[...r,n],[])}}function kie(t){return{not:pn(t)}}function Sie(t){return pn(t)}const Eie=(t,e)=>_t(t.innerType._def,e),Tie=(t,e,r)=>{switch(e){case ye.ZodString:return LM(t,r);case ye.ZodNumber:return hie(t,r);case ye.ZodObject:return mie(t,r);case ye.ZodBigInt:return Jne(t,r);case ye.ZodBoolean:return Yne();case ye.ZodDate:return OM(t,r);case ye.ZodUndefined:return kie(r);case ye.ZodNull:return die(r);case ye.ZodArray:return Zne(t,r);case ye.ZodUnion:case ye.ZodDiscriminatedUnion:
3311
- return fie(t,r);case ye.ZodIntersection:return iie(t,r);case ye.ZodTuple:return Rie(t,r);case ye.ZodRecord:return jM(t,r);case ye.ZodLiteral:return sie(t,r);case ye.ZodEnum:return rie(t);case ye.ZodNativeEnum:return lie(t);case ye.ZodNullable:return pie(t,r);case ye.ZodOptional:return vie(t,r);case ye.ZodMap:return cie(t,r);case ye.ZodSet:return _ie(t,r);case ye.ZodLazy:return()=>t.getter()._def;case ye.ZodPromise:return bie(t,r);case ye.ZodNaN:case ye.ZodNever:return uie(r);case ye.ZodEffects:return tie(
3312
- t,r);case ye.ZodAny:return pn(r);case ye.ZodUnknown:return Sie(r);case ye.ZodDefault:return eie(t,r);case ye.ZodBranded:return DM(t,r);case ye.ZodReadonly:return Eie(t,r);case ye.ZodCatch:return Xne(t,r);case ye.ZodPipeline:return wie(t,r);case ye.ZodFunction:case ye.ZodVoid:case ye.ZodSymbol:return;default:return(n=>{})()}};function _t(t,e,r=!1){const n=e.seen.get(t);if(e.override){const o=e.override?.(t,e,n,r);if(o!==Wne)return o}if(n&&!r){const o=$ie(n,e);if(o!==void 0)return o}const i={def:t,
3313
- path:e.currentPath,jsonSchema:void 0};e.seen.set(t,i);const s=Tie(t,t.typeName,e),a=typeof s=="function"?_t(s(),e):s;if(a&&Pie(t,e,a),e.postProcess){const o=e.postProcess(a,t,e);return i.jsonSchema=a,o}return i.jsonSchema=a,a}const $ie=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:NM(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive referen\
3314
- ce detected at ${e.currentPath.join("/")}! Defaulting to any`),pn(e)):e.$refStrategy==="seen"?pn(e):void 0}},Pie=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r),FM=(t,e)=>{const r=Kne(e);let n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[l,u])=>({...c,[l]:_t(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??pn(r)}),{}):void 0;const i=typeof e=="string"?e:e?.nameStrategy==="title"?
3304
+ 1?i:i[0],enum:r.reduce((s,a)=>s.includes(a._def.value)?s:[...s,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,i)=>[...n,...i._def.values.filter(s=>!n.includes(s))],[])};return MM(t,e)}const MM=(t,e)=>{const r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,i)=>_t(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.
3305
+ length?{anyOf:r}:void 0};function gie(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:$v[t.innerType._def.typeName],nullable:!0}:{type:[$v[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const n=_t(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const r=_t(t.
3306
+ innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function yie(t,e){const r={type:"number"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"int":r.type="integer",AM(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?St(r,"minimum",n.value,n.message,e):St(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),St(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSc\
3307
+ hema7"?n.inclusive?St(r,"maximum",n.value,n.message,e):St(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),St(r,"maximum",n.value,n.message,e));break;case"multipleOf":St(r,"multipleOf",n.value,n.message,e);break}return r}function vie(t,e){const r=e.target==="openAi",n={type:"object",properties:{}},i=[],s=t.shape();for(const o in s){let c=s[o];if(c===void 0||c._def===void 0)continue;let l=bie(c);l&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||
3308
+ (c=c.nullable()),l=!1);const u=_t(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(n.properties[o]=u,l||i.push(o))}i.length&&(n.required=i);const a=wie(t,e);return a!==void 0&&(n.additionalProperties=a),n}function wie(t,e){if(t.catchall._def.typeName!=="ZodNever")return _t(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"\
3309
+ strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function bie(t){try{return t.isOptional()}catch{return!0}}const _ie=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return _t(t.innerType._def,e);const r=_t(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:pn(e)},r]}:pn(e)},Rie=(t,e)=>{if(e.pipeStrategy==="input")return _t(t.in.
3310
+ _def,e);if(e.pipeStrategy==="output")return _t(t.out._def,e);const r=_t(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=_t(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(i=>i!==void 0)}};function kie(t,e){return _t(t.type._def,e)}function Sie(t,e){const n={type:"array",uniqueItems:!0,items:_t(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&St(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&
3311
+ St(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Eie(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>_t(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:_t(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>_t(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce(
3312
+ (r,n)=>n===void 0?r:[...r,n],[])}}function Tie(t){return{not:pn(t)}}function $ie(t){return pn(t)}const Pie=(t,e)=>_t(t.innerType._def,e),Cie=(t,e,r)=>{switch(e){case ye.ZodString:return DM(t,r);case ye.ZodNumber:return yie(t,r);case ye.ZodObject:return vie(t,r);case ye.ZodBigInt:return Qne(t,r);case ye.ZodBoolean:return eie();case ye.ZodDate:return NM(t,r);case ye.ZodUndefined:return Tie(r);case ye.ZodNull:return hie(r);case ye.ZodArray:return Xne(t,r);case ye.ZodUnion:case ye.ZodDiscriminatedUnion:
3313
+ return mie(t,r);case ye.ZodIntersection:return oie(t,r);case ye.ZodTuple:return Eie(t,r);case ye.ZodRecord:return LM(t,r);case ye.ZodLiteral:return cie(t,r);case ye.ZodEnum:return sie(t);case ye.ZodNativeEnum:return fie(t);case ye.ZodNullable:return gie(t,r);case ye.ZodOptional:return _ie(t,r);case ye.ZodMap:return die(t,r);case ye.ZodSet:return Sie(t,r);case ye.ZodLazy:return()=>t.getter()._def;case ye.ZodPromise:return kie(t,r);case ye.ZodNaN:case ye.ZodNever:return pie(r);case ye.ZodEffects:return iie(
3314
+ t,r);case ye.ZodAny:return pn(r);case ye.ZodUnknown:return $ie(r);case ye.ZodDefault:return nie(t,r);case ye.ZodBranded:return IM(t,r);case ye.ZodReadonly:return Pie(t,r);case ye.ZodCatch:return tie(t,r);case ye.ZodPipeline:return Rie(t,r);case ye.ZodFunction:case ye.ZodVoid:case ye.ZodSymbol:return;default:return(n=>{})()}};function _t(t,e,r=!1){const n=e.seen.get(t);if(e.override){const o=e.override?.(t,e,n,r);if(o!==Zne)return o}if(n&&!r){const o=Aie(n,e);if(o!==void 0)return o}const i={def:t,
3315
+ path:e.currentPath,jsonSchema:void 0};e.seen.set(t,i);const s=Cie(t,t.typeName,e),a=typeof s=="function"?_t(s(),e):s;if(a&&xie(t,e,a),e.postProcess){const o=e.postProcess(a,t,e);return i.jsonSchema=a,o}return i.jsonSchema=a,a}const Aie=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:xM(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive referen\
3316
+ ce detected at ${e.currentPath.join("/")}! Defaulting to any`),pn(e)):e.$refStrategy==="seen"?pn(e):void 0}},xie=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r),jM=(t,e)=>{const r=Yne(e);let n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[l,u])=>({...c,[l]:_t(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??pn(r)}),{}):void 0;const i=typeof e=="string"?e:e?.nameStrategy==="title"?
3315
3317
  void 0:e?.name,s=_t(t._def,i===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1)??pn(r),a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(s.title=a),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const o=i===void 0?n?{...s,
3316
3318
  [r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...n,[i]:s}};return r.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions\
3317
- as roots! Try wrapping it in an object property."),o};var Lk;(function(t){t.Completable="McpCompletable"})(Lk||(Lk={}));class Mk extends it{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}Mk.create=(t,e)=>new Mk({type:t,typeName:Lk.Completable,complete:e.complete,...Cie(e)});function Cie(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(
3318
- `Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{var c,l;const{message:u}=t;return a.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(c=u??n)!==null&&c!==void 0?c:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(l=u??r)!==null&&l!==void 0?l:o.defaultError}},description:i}}const Aie=/^[A-Za-z0-9._-]{1,128}$/;function xie(t){const e=[];if(t.length===
3319
+ as roots! Try wrapping it in an object property."),o};var Ok;(function(t){t.Completable="McpCompletable"})(Ok||(Ok={}));class Lk extends it{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}Lk.create=(t,e)=>new Lk({type:t,typeName:Ok.Completable,complete:e.complete,...Iie(e)});function Iie(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(
3320
+ `Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{var c,l;const{message:u}=t;return a.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(c=u??n)!==null&&c!==void 0?c:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(l=u??r)!==null&&l!==void 0?l:o.defaultError}},description:i}}const Nie=/^[A-Za-z0-9._-]{1,128}$/;function Die(t){const e=[];if(t.length===
3319
3321
  0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(
3320
- ".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Aie.test(t)){const r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,i,s)=>s.indexOf(n)===i);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function Iie(t,e){if(e.length>0){console.warn(`Tool na\
3321
- me validation warning for "${t}":`);for(const r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function HM(t){const e=xie(t);return Iie(t,e.warnings),e.isValid}class Nie{constructor(e,r){this.
3322
- _registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Vne(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Q_.shape.method.value),this.server.
3323
- assertCanSetRequestHandler(eR.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Q_,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{const n={name:e,title:r.title,description:r.description,inputSchema:r.inputSchema?FM(r.inputSchema,{strictUnions:!0,pipeStrategy:"input"}):Die,annotations:r.annotations,_meta:r._meta};return r.outputSchema&&(n.outputSchema=FM(r.outputSchema,{strictUnions:!0,pipeStrategy:"\
3322
+ ".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Nie.test(t)){const r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,i,s)=>s.indexOf(n)===i);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function Oie(t,e){if(e.length>0){console.warn(`Tool na\
3323
+ me validation warning for "${t}":`);for(const r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function qM(t){const e=Die(t);return Oie(t,e.warnings),e.isValid}class Lie{constructor(e,r){this.
3324
+ _registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Kne(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Q_.shape.method.value),this.server.
3325
+ assertCanSetRequestHandler(eR.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Q_,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{const n={name:e,title:r.title,description:r.description,inputSchema:r.inputSchema?jM(r.inputSchema,{strictUnions:!0,pipeStrategy:"input"}):Mie,annotations:r.annotations,_meta:r._meta};return r.outputSchema&&(n.outputSchema=jM(r.outputSchema,{strictUnions:!0,pipeStrategy:"\
3324
3326
  output"})),n})})),this.server.setRequestHandler(eR,async(e,r)=>{const n=this._registeredTools[e.params.name];let i;try{if(!n)throw new sr(Gt.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new sr(Gt.InvalidParams,`Tool ${e.params.name} disabled`);if(n.inputSchema){const s=n.callback,a=await n.inputSchema.safeParseAsync(e.params.arguments);if(!a.success)throw new sr(Gt.InvalidParams,`Input validation error: Invalid arguments for tool ${e.params.name}: ${a.error.message}`);const o=a.
3325
3327
  data;i=await Promise.resolve(s(o,r))}else{const s=n.callback;i=await Promise.resolve(s(r))}if(n.outputSchema&&!i.isError){if(!i.structuredContent)throw new sr(Gt.InvalidParams,`Output validation error: Tool ${e.params.name} has an output schema but no structured content was provided`);const s=await n.outputSchema.safeParseAsync(i.structuredContent);if(!s.success)throw new sr(Gt.InvalidParams,`Output validation error: Invalid structured content for tool ${e.params.name}: ${s.error.message}`)}}catch(s){
3326
3328
  return this.createToolError(s instanceof Error?s.message:String(s))}return i}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(tR.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(tR,async e=>{switch(e.params.ref.type){case"ref/prompt":return YJ(e),this.handlePromptCompletion(e,e.params.
3327
3329
  ref);case"ref/resource":return XJ(e),this.handleResourceCompletion(e,e.params.ref);default:throw new sr(Gt.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){const n=this._registeredPrompts[r.name];if(!n)throw new sr(Gt.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new sr(Gt.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Pv;const i=n.argsSchema.shape[e.params.argument.name];
3328
- if(!(i instanceof Mk))return Pv;const a=await i._def.complete(e.params.argument.value,e.params.context);return zM(a)}async handleResourceCompletion(e,r){const n=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Pv;throw new sr(Gt.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const i=n.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return Pv;const s=await i(
3329
- e.params.argument.value,e.params.context);return zM(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(U_.shape.method.value),this.server.assertCanSetRequestHandler(V_.shape.method.value),this.server.assertCanSetRequestHandler(G_.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(U_,async(e,r)=>{const n=Object.entries(this._registeredResources).filter(([s,a])=>a.enabled).map(([s,
3330
+ if(!(i instanceof Lk))return Pv;const a=await i._def.complete(e.params.argument.value,e.params.context);return HM(a)}async handleResourceCompletion(e,r){const n=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Pv;throw new sr(Gt.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const i=n.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return Pv;const s=await i(
3331
+ e.params.argument.value,e.params.context);return HM(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(U_.shape.method.value),this.server.assertCanSetRequestHandler(V_.shape.method.value),this.server.assertCanSetRequestHandler(G_.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(U_,async(e,r)=>{const n=Object.entries(this._registeredResources).filter(([s,a])=>a.enabled).map(([s,
3330
3332
  a])=>({uri:s,name:a.name,...a.metadata})),i=[];for(const s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;const a=await s.resourceTemplate.listCallback(r);for(const o of a.resources)i.push({...s.metadata,...o})}return{resources:[...n,...i]}}),this.server.setRequestHandler(V_,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),
3331
3333
  this.server.setRequestHandler(G_,async(e,r)=>{const n=new URL(e.params.uri),i=this._registeredResources[n.toString()];if(i){if(!i.enabled)throw new sr(Gt.InvalidParams,`Resource ${n} disabled`);return i.readCallback(n,r)}for(const s of Object.values(this._registeredResourceTemplates)){const a=s.resourceTemplate.uriTemplate.match(n.toString());if(a)return s.readCallback(n,a,r)}throw new sr(Gt.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=
3332
- !0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(K_.shape.method.value),this.server.assertCanSetRequestHandler(Z_.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(K_,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?Lie(r.argsSchema):void 0}))})),this.server.setRequestHandler(
3334
+ !0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(K_.shape.method.value),this.server.assertCanSetRequestHandler(Z_.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(K_,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?qie(r.argsSchema):void 0}))})),this.server.setRequestHandler(
3333
3335
  Z_,async(e,r)=>{const n=this._registeredPrompts[e.params.name];if(!n)throw new sr(Gt.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new sr(Gt.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){const i=await n.argsSchema.safeParseAsync(e.params.arguments);if(!i.success)throw new sr(Gt.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${i.error.message}`);const s=i.data,a=n.callback;return await Promise.resolve(a(s,r))}else{const i=n.callback;return await Promise.
3334
3336
  resolve(i(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...n){let i;typeof n[0]=="object"&&(i=n.shift());const s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const a=this._createRegisteredResource(e,void 0,r,i,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already re\
3335
3337
  gistered`);const a=this._createRegisteredResourceTemplate(e,void 0,r,i,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(e,r,n,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const s=this._createRegisteredResource(e,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} \
@@ -3337,16 +3339,16 @@ is already registered`);const s=this._createRegisteredResourceTemplate(e,n.title
3337
3339
  (a.name=o.name),typeof o.title<"u"&&(a.title=o.title),typeof o.metadata<"u"&&(a.metadata=o.metadata),typeof o.callback<"u"&&(a.readCallback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=a,a}_createRegisteredResourceTemplate(e,r,n,i,s){const a={resourceTemplate:n,title:r,metadata:i,readCallback:s,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:o=>{
3338
3340
  typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=a)),typeof o.title<"u"&&(a.title=o.title),typeof o.template<"u"&&(a.resourceTemplate=o.template),typeof o.metadata<"u"&&(a.metadata=o.metadata),typeof o.callback<"u"&&(a.readCallback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=a,a}_createRegisteredPrompt(e,r,n,i,s){const a={title:r,description:n,
3339
3341
  argsSchema:i===void 0?void 0:ve(i),callback:s,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=a)),typeof o.title<"u"&&(a.title=o.title),typeof o.description<"u"&&(a.description=o.description),typeof o.argsSchema<"u"&&(a.argsSchema=ve(o.argsSchema)),typeof o.callback<"u"&&(a.callback=o.callback),typeof o.enabled<"u"&&
3340
- (a.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=a,a}_createRegisteredTool(e,r,n,i,s,a,o,c){HM(e);const l={title:r,description:n,inputSchema:BM(i),outputSchema:BM(s),annotations:a,_meta:o,callback:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(typeof u.name=="string"&&HM(u.name),delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=
3342
+ (a.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=a,a}_createRegisteredTool(e,r,n,i,s,a,o,c){qM(e);const l={title:r,description:n,inputSchema:FM(i),outputSchema:FM(s),annotations:a,_meta:o,callback:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(typeof u.name=="string"&&qM(u.name),delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=
3341
3343
  l)),typeof u.title<"u"&&(l.title=u.title),typeof u.description<"u"&&(l.description=u.description),typeof u.paramsSchema<"u"&&(l.inputSchema=ve(u.paramsSchema)),typeof u.callback<"u"&&(l.callback=u.callback),typeof u.annotations<"u"&&(l.annotations=u.annotations),typeof u._meta<"u"&&(l._meta=u._meta),typeof u.enabled<"u"&&(l.enabled=u.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])
3342
- throw new Error(`Tool ${e} is already registered`);let n,i,s,a;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){const c=r[0];jk(c)?(i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!jk(r[0])&&(a=r.shift())):typeof c=="object"&&c!==null&&(a=r.shift())}const o=r[0];return this._createRegisteredTool(e,void 0,n,i,s,a,void 0,o)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:i,description:s,inputSchema:a,outputSchema:o,annotations:c,
3344
+ throw new Error(`Tool ${e} is already registered`);let n,i,s,a;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){const c=r[0];Mk(c)?(i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Mk(r[0])&&(a=r.shift())):typeof c=="object"&&c!==null&&(a=r.shift())}const o=r[0];return this._createRegisteredTool(e,void 0,n,i,s,a,void 0,o)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:i,description:s,inputSchema:a,outputSchema:o,annotations:c,
3343
3345
  _meta:l}=r;return this._createRegisteredTool(e,i,s,a,o,c,l,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let i;r.length>1&&(i=r.shift());const s=r[0],a=this._createRegisteredPrompt(e,void 0,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:i,description:s,argsSchema:a}=r,
3344
- o=this._createRegisteredPrompt(e,i,s,a,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}const Die={type:"objec\
3345
- t",properties:{}};function jk(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(Oie)}function Oie(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function BM(t){if(t)return jk(t)?ve(t):t}function Lie(t){return Object.entries(t.shape).map(([e,r])=>({name:e,description:r.description,required:!r.isOptional()}))}function zM(t){return{completion:{values:t.slice(0,100),total:t.length,
3346
- hasMore:t.length>100}}}const Pv={completion:{values:[],hasMore:!1}};class Mie{get mcp(){throw new Error("NoopLikeC4MCPServer does not have a McpServer")}get isStarted(){return!1}get port(){return NaN}start(){return Promise.resolve()}stop(){return Promise.resolve()}}const UM={mcpServer:()=>new Mie},jie="1.46.0",qie={version:jie},_p=ve({path:j().describe("Path to the file"),range:ve({start:ve({line:It(),character:It()}),end:ve({line:It(),character:It()})}).describe("Range in the file")}).nullable(),
3346
+ o=this._createRegisteredPrompt(e,i,s,a,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}const Mie={type:"objec\
3347
+ t",properties:{}};function Mk(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(jie)}function jie(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function FM(t){if(t)return Mk(t)?ve(t):t}function qie(t){return Object.entries(t.shape).map(([e,r])=>({name:e,description:r.description,required:!r.isOptional()}))}function HM(t){return{completion:{values:t.slice(0,100),total:t.length,
3348
+ hasMore:t.length>100}}}const Pv={completion:{values:[],hasMore:!1}};class Fie{get mcp(){throw new Error("NoopLikeC4MCPServer does not have a McpServer")}get isStarted(){return!1}get port(){return NaN}start(){return Promise.resolve()}stop(){return Promise.resolve()}}const BM={mcpServer:()=>new Fie},Hie="1.46.2",Bie={version:Hie},_p=ve({path:j().describe("Path to the file"),range:ve({start:ve({line:It(),character:It()}),end:ve({line:It(),character:It()})}).describe("Range in the file")}).nullable(),
3347
3349
  ml=j().refine(t=>!0).optional().default(In.DefaultProjectId).describe('Project id (optional, will use "default" if not specified)'),Rp=Te(ve({id:j().describe("View id"),title:j().describe("View title"),type:dn(["element","deployment","dynamic"]).describe("View type")})),kp=t=>[...t].map(e=>({id:e.id,title:e.titleOrId,type:e.$view._type})),Sp=(t,e)=>r=>{try{const n=t.locate({projectId:e,...r});return n?{path:ct.parse(n.uri).fsPath,range:n.range}:null}catch(n){return jt.debug("Failed to locate {pa\
3348
- rams}",{error:n,params:r}),null}},VM=ve({id:j(),title:j(),kind:j()}),Fie=ve({type:dn(["direct","indirect"]).describe('Type of relationship, "direct" for direct relationships, "indirect" for relationships through nested elements'),source:VM,target:VM,kind:j().nullable().describe("Relationship kind"),title:j().nullable().describe("Relationship title"),description:j().nullable().describe("Relationship description"),technology:j().nullable().describe("Relationship technology"),tags:Te(j()).describe(
3349
- "Relationship tags"),includedInViews:Rp.describe("Views that include this relationship"),sourceLocation:_p}),Hie=na({name:"find-relationships",annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Find relationships between two elements"},description:`
3350
+ rams}",{error:n,params:r}),null}},zM=ve({id:j(),title:j(),kind:j()}),zie=ve({type:dn(["direct","indirect"]).describe('Type of relationship, "direct" for direct relationships, "indirect" for relationships through nested elements'),source:zM,target:zM,kind:j().nullable().describe("Relationship kind"),title:j().nullable().describe("Relationship title"),description:j().nullable().describe("Relationship description"),technology:j().nullable().describe("Relationship technology"),tags:Te(j()).describe(
3351
+ "Relationship tags"),includedInViews:Rp.describe("Views that include this relationship"),sourceLocation:_p}),Uie=na({name:"find-relationships",annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Find relationships between two elements"},description:`
3350
3352
  Find relationships between two LikeC4 elements within a project.
3351
3353
 
3352
3354
  What it does:
@@ -3417,9 +3419,9 @@ Response:
3417
3419
  }
3418
3420
  ]
3419
3421
  }
3420
- `,inputSchema:{element1:j().describe("Element ID (FQN)"),element2:j().describe("Element ID (FQN)"),project:ml},outputSchema:{found:Te(Fie)}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project);if(x2(e.element1,e.element2))throw new Error("No relationships possible between parent-child");const n=[],i=await t.computedModel(r),s=i.findElement(e.element1);fr(s,`Element "${e.element1}" not found in project "${r}"`);const a=i.findElement(e.element2);fr(a,`Element "${e.element2}" not foun\
3422
+ `,inputSchema:{element1:j().describe("Element ID (FQN)"),element2:j().describe("Element ID (FQN)"),project:ml},outputSchema:{found:Te(zie)}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project);if(x2(e.element1,e.element2))throw new Error("No relationships possible between parent-child");const n=[],i=await t.computedModel(r),s=i.findElement(e.element1);yr(s,`Element "${e.element1}" not found in project "${r}"`);const a=i.findElement(e.element2);yr(a,`Element "${e.element2}" not foun\
3421
3423
  d in project "${r}"`);const o=Sp(t,r),c=K2.findConnection(s,a,"both").flatMap(l=>[...l.relations]);for(const l of c){const u=l.source===s&&l.target===a||l.source===a&&l.target===s;n.push({type:u?"direct":"indirect",source:{id:l.source.id,title:l.source.title,kind:l.source.kind},target:{id:l.target.id,title:l.target.title,kind:l.target.kind},kind:l.kind,title:l.title,description:l.description.text,technology:l.technology,tags:[...l.tags],includedInViews:kp(l.views()),sourceLocation:o({relation:l.
3422
- id})})}return{found:n}}),Bie=na({name:"list-projects",description:`
3424
+ id})})}return{found:n}}),Vie=na({name:"list-projects",description:`
3423
3425
  List LikeC4 projects discoverable in the current workspace.
3424
3426
 
3425
3427
  Request:
@@ -3452,7 +3454,7 @@ Example response:
3452
3454
  }
3453
3455
  ]
3454
3456
  }
3455
- `,annotations:{readOnlyHint:!0,idempotentHint:!0,title:"List projects"},outputSchema:{projects:Te(ve({id:j(),title:j(),folder:j(),sources:Te(j())}))}},async t=>({projects:t.projects().map(e=>({id:e.id,title:e.title,folder:e.folder.fsPath,sources:e.documents.map(r=>r.fsPath)}))})),zie=na({name:"open-view",description:`
3457
+ `,annotations:{readOnlyHint:!0,idempotentHint:!0,title:"List projects"},outputSchema:{projects:Te(ve({id:j(),title:j(),folder:j(),sources:Te(j())}))}},async t=>({projects:t.projects().map(e=>({id:e.id,title:e.title,folder:e.folder.fsPath,sources:e.documents.map(r=>r.fsPath)}))})),Wie=na({name:"open-view",description:`
3456
3458
  Open a LikeC4 view in the editor's preview panel.
3457
3459
 
3458
3460
  Request:
@@ -3473,7 +3475,7 @@ Example response:
3473
3475
  "range": { "start": { "line": 10, "character": 0 }, "end": { "line": 30, "character": 0 } }
3474
3476
  }
3475
3477
  }
3476
- `,annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Open view in preview panel"},inputSchema:{viewId:j().describe("View id (name)"),project:ml},outputSchema:{location:_p}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project),n=(await t.computedModel(r)).findView(e.viewId);if(!n)throw new Error(`View with ID '${e.viewId}' not found in project ${r}`);return await t.views.openView(n.id,r),{location:Sp(t,r)({view:n.id})}}),Uie=na({name:"read-deployment",description:`
3478
+ `,annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Open view in preview panel"},inputSchema:{viewId:j().describe("View id (name)"),project:ml},outputSchema:{location:_p}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project),n=(await t.computedModel(r)).findView(e.viewId);if(!n)throw new Error(`View with ID '${e.viewId}' not found in project ${r}`);return await t.views.openView(n.id,r),{location:Sp(t,r)({view:n.id})}}),Gie=na({name:"read-deployment",description:`
3477
3479
  Read details about a deployment node or a deployed instance in a LikeC4 project.
3478
3480
 
3479
3481
  What it does:
@@ -3541,7 +3543,7 @@ Example response (deployed instance):
3541
3543
  `,annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Read deployment entity"},inputSchema:{id:j().describe("Deployment id (FQN)"),project:ml},outputSchema:{type:dn(["deployment-node","deployed-instance"]),id:j().describe("Deployment id (FQN)"),kind:j().describe("Deployment node kind, or element kind for deployed instances"),name:j(),title:j(),description:j().nullable(),technology:j().nullable(),tags:Te(j()),project:j(),metadata:Ft(Wt([j(),Te(j())])),links:Te(ve({title:j().nullable().describe(
3542
3544
  "Optional link title"),url:j().describe("Link URL"),relative:j().nullable().describe("Relative path (if URL is relative to workspace root)")})).describe("External links associated with this deployment entity"),shape:j(),color:j(),children:Te(j()).describe("Children of this deployment node (Array of Deployment ids)"),includedInViews:Rp.describe("Views that include this deployment node"),instanceof:ve({id:j().describe("Element ID (FQN)"),title:j(),kind:j()}).nullable().describe('If type is "deploy\
3543
3545
  ed-instance", the referenced element'),sourceLocation:_p}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project),n=(await t.computedModel(r)).deployment.findElement(e.id);ze(n,`Deployment entity "${e.id}" not found in project "${r}"`);const i=Sp(t,r);return{type:n.isInstance()?"deployed-instance":"deployment-node",id:n.id,name:n.name,kind:n.kind,title:n.title,description:n.description.text,technology:n.technology,tags:[...n.tags],project:r,metadata:n.getMetadata(),links:(n.links??[]).
3544
- map(s=>({title:s.title??null,url:s.url,relative:s.relative??null})),shape:n.shape,color:n.color,children:n.isInstance()?[]:[...n.children()].map(s=>s.id),includedInViews:kp(n.views()),instanceof:n.isInstance()?{id:n.element.id,title:n.element.title,kind:n.element.kind}:null,sourceLocation:i({deployment:n.id})}}),Vie=na({name:"read-element",description:`
3546
+ map(s=>({title:s.title??null,url:s.url,relative:s.relative??null})),shape:n.shape,color:n.color,children:n.isInstance()?[]:[...n.children()].map(s=>s.id),includedInViews:kp(n.views()),instanceof:n.isInstance()?{id:n.element.id,title:n.element.title,kind:n.element.kind}:null,sourceLocation:i({deployment:n.id})}}),Kie=na({name:"read-element",description:`
3545
3547
  Read detailed information about a LikeC4 element.
3546
3548
 
3547
3549
  Request:
@@ -3634,7 +3636,7 @@ tionship kind"),target:j().describe("Target element id (FQN), either this elemen
3634
3636
  element id (FQN), either this element or nested element, if relationship is indirect"),target:ve({id:j(),title:j(),kind:j()}).describe("Target element of this relationship"),kind:j().nullable().describe("Relationship kind"),title:j().nullable().describe("Relationship title"),description:j().nullable().describe("Relationship description"),technology:j().nullable().describe("Relationship technology"),tags:Te(j()).describe("Relationship tags")})).describe("Outgoing relationships of this element (d\
3635
3637
  irect and indirect, outgoing from nested elements)")}).describe("Relationships of this element"),deployedInstances:Te(j()).describe("Deployed instances of this element (Array of Deployment FQNs)"),sourceLocation:_p}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project),n=(await t.computedModel(r)).findElement(e.id);ze(n,`Element "${e.id}" not found in project "${r}"`);const i=Sp(t,r);return{id:n.id,name:n.name,kind:n.kind,title:n.title,description:n.description.text,technology:n.technology,
3636
3638
  tags:[...n.tags],project:r,metadata:n.getMetadata(),links:(n.links??[]).map(s=>({title:s.title??null,url:s.url,relative:s.relative??null})),shape:n.shape,color:n.color,children:[...n.children()].map(s=>s.id),defaultView:n.defaultView?.id||null,includedInViews:kp(n.views()),relationships:{incoming:[...n.incoming()].map(s=>({source:{id:s.source.id,title:s.source.title,kind:s.source.kind},kind:s.kind,target:s.target.id,title:s.title,description:s.description.text,technology:s.technology,tags:[...s.
3637
- tags]})),outgoing:[...n.outgoing()].map(s=>({source:s.source.id,target:{id:s.target.id,title:s.target.title,kind:s.target.kind},kind:s.kind,title:s.title,description:s.description.text,technology:s.technology,tags:[...s.tags]}))},deployedInstances:[...n.deployments()].map(s=>s.id),sourceLocation:i({element:n.id})}}),Wie=na({name:"read-project-summary",annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Read project summary"},description:`
3639
+ tags]})),outgoing:[...n.outgoing()].map(s=>({source:s.source.id,target:{id:s.target.id,title:s.target.title,kind:s.target.kind},kind:s.kind,title:s.title,description:s.description.text,technology:s.technology,tags:[...s.tags]}))},deployedInstances:[...n.deployments()].map(s=>s.id),sourceLocation:i({element:n.id})}}),Zie=na({name:"read-project-summary",annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Read project summary"},description:`
3638
3640
  Request:
3639
3641
  - project: string (optional) \u2014 project id. Defaults to "default" if omitted.
3640
3642
 
@@ -3713,9 +3715,9 @@ Example response:
3713
3715
  `,inputSchema:{project:ml},outputSchema:{title:j(),folder:j(),sources:Te(j()),specification:ve({elementKinds:Te(j()),relationshipKinds:Te(j()),deploymentKinds:Te(j()),tags:Te(j()),metadataKeys:Te(j())}),elements:Te(ve({id:j(),kind:j(),title:j(),tags:Te(j())})).describe("List of elements in the project"),deployments:Te(Gg("type",[ve({type:De("deployment-node"),id:j().describe("Node ID"),kind:j().describe("Deployment node kind"),title:j().describe("Node title"),tags:Te(j())}),ve({type:De("deploy\
3714
3716
  ed-instance"),id:j().describe("Node ID"),title:j().describe("Node title"),tags:Te(j()),referencedElementId:j().describe("Element ID (FQN)")})])).describe("List of deployment nodes and deployed instances in the project"),views:Te(ve({id:j(),title:j(),type:dn(["element","deployment","dynamic"])}))}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project),n=t.project(r),i=await t.computedModel(r);return{title:n.title,folder:n.folder.fsPath,specification:{elementKinds:_n(i.specification.elements),
3715
3717
  relationshipKinds:_n(i.specification.relationships),deploymentKinds:_n(i.specification.deployments),tags:[...i.tags],metadataKeys:i.specification.metadataKeys??[]},elements:[...i.elements()].filter(s=>!s.imported).map(s=>({id:s.id,kind:s.kind,title:s.title,tags:[...s.tags]})),deployments:[...i.deployment.elements()].map(s=>s.isInstance()?{type:"deployed-instance",id:s.id,title:s.title,tags:[...s.tags],referencedElementId:s.element.id}:{type:"deployment-node",id:s.id,kind:s.kind,title:s.title,tags:[
3716
- ...s.tags]}),views:[...i.views()].map(s=>({id:s.id,title:s.titleOrId,type:s.$view._type})),sources:n.documents?.map(s=>s.fsPath)??[]}}),Gie=t=>t.hasElement()?t.element.id:t.hasDeployment()?t.deployment.id:null,Kie=Gg("type",[ve({type:De("element"),id:j().describe("Node ID"),elementId:j().describe("Element ID (FQN)"),kind:j().describe("Element kind"),title:j().describe("Node title"),description:j().nullable(),technology:j().nullable(),children:Te(j()).describe("Children nodes, array of node IDs"),
3718
+ ...s.tags]}),views:[...i.views()].map(s=>({id:s.id,title:s.titleOrId,type:s.$view._type})),sources:n.documents?.map(s=>s.fsPath)??[]}}),Jie=t=>t.hasElement()?t.element.id:t.hasDeployment()?t.deployment.id:null,Yie=Gg("type",[ve({type:De("element"),id:j().describe("Node ID"),elementId:j().describe("Element ID (FQN)"),kind:j().describe("Element kind"),title:j().describe("Node title"),description:j().nullable(),technology:j().nullable(),children:Te(j()).describe("Children nodes, array of node IDs"),
3717
3719
  shape:j().describe("Rendered shape"),color:j().describe("Rendered color"),tags:Te(j())}),ve({type:De("deployment-node"),id:j().describe("Node ID"),deploymentId:j().describe("Deployment entity ID (FQN)"),kind:j().describe("Deployment kind"),title:j().describe("Node title"),description:j().nullable(),technology:j().nullable(),children:Te(j()).describe("Children nodes, array of node IDs"),shape:j().describe("Rendered shape"),color:j().describe("Rendered color"),tags:Te(j())}),ve({type:De("deployed-\
3718
- instance"),id:j().describe("Node ID"),deploymentId:j().describe("Deployment entity ID (FQN)"),title:j().describe("Node title"),description:j().nullable(),technology:j().nullable(),referencedElement:ve({id:j().describe("Element ID (FQN)"),kind:j().describe("Element kind"),title:j().describe("Element title")}),shape:j().describe("Rendered shape"),color:j().describe("Rendered color"),tags:Te(j())})]),Zie=na({name:"read-view",description:`
3720
+ instance"),id:j().describe("Node ID"),deploymentId:j().describe("Deployment entity ID (FQN)"),title:j().describe("Node title"),description:j().nullable(),technology:j().nullable(),referencedElement:ve({id:j().describe("Element ID (FQN)"),kind:j().describe("Element kind"),title:j().describe("Element title")}),shape:j().describe("Rendered shape"),color:j().describe("Rendered color"),tags:Te(j())})]),Xie=na({name:"read-view",description:`
3719
3721
  Read detailed information about a LikeC4 view.
3720
3722
 
3721
3723
  Request:
@@ -3763,11 +3765,11 @@ Example response:
3763
3765
  "range": { "start": { "line": 10, "character": 0 }, "end": { "line": 30, "character": 0 } }
3764
3766
  }
3765
3767
  }
3766
- `,annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Read view"},inputSchema:{viewId:j().describe("View id (name)"),project:ml},outputSchema:{id:j(),type:dn(["element","deployment","dynamic"]).describe("View type"),title:j(),description:j().nullable(),tags:Te(j()),project:j(),nodes:Te(Kie),edges:Te(ve({source:j().describe("Source node"),target:j().describe("Target node"),label:j().nullable(),description:j().nullable(),technology:j().nullable(),tags:Te(j())})).describe("Edge represents relatio\
3768
+ `,annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Read view"},inputSchema:{viewId:j().describe("View id (name)"),project:ml},outputSchema:{id:j(),type:dn(["element","deployment","dynamic"]).describe("View type"),title:j(),description:j().nullable(),tags:Te(j()),project:j(),nodes:Te(Yie),edges:Te(ve({source:j().describe("Source node"),target:j().describe("Target node"),label:j().nullable(),description:j().nullable(),technology:j().nullable(),tags:Te(j())})).describe("Edge represents relatio\
3767
3769
  nship between nodes"),sourceLocation:_p}},async(t,e)=>{const r=t.projectsManager.ensureProjectId(e.project),n=t.project(r),i=(await t.computedModel(r)).findView(e.viewId);if(!i)throw new Error(`View with ID '${e.viewId}' not found in project ${n.id}`);const s=Sp(t,n.id);return{id:i.id,type:i.$view._type,title:i.title??i.id,description:i.description.text,tags:[...i.tags],project:n.id,nodes:[...i.nodes()].flatMap(a=>{const o={id:a.id,title:a.title,description:a.description.text,technology:a.technology,
3768
3770
  shape:a.shape,color:a.color,tags:[...a.tags]};return a.hasDeployedInstance()?{...o,type:"deployed-instance",deploymentId:a.deployment.id,referencedElement:{id:a.deployment.element.id,kind:a.deployment.element.kind,title:a.deployment.element.title}}:a.hasDeployment()?{...o,type:"deployment-node",kind:a.deployment.kind,deploymentId:a.deployment.id,children:[...a.children()].map(c=>c.id)}:a.hasElement()?{...o,type:"element",elementId:a.element.id,kind:a.element.kind,children:[...a.children()].flatMap(
3769
- c=>Gie(c)??[])}:[]}),edges:[...i.edges()].map(a=>({source:a.source.id,target:a.target.id,label:a.label,description:a.description.text,technology:a.technology,tags:[...a.tags]})),sourceLocation:s({view:i.id})}}),Jie=Te(Gg("type",[ve({type:De("element"),project:j().describe("Project ID"),id:j().describe("Element ID (FQN)"),name:j().describe("Element name"),kind:j(),title:j(),technology:j().nullable(),shape:j(),includedInViews:Rp,metadata:Ft(Wt([j(),Te(j())])),tags:Te(j())}),ve({type:De("deployment\
3770
- -node"),project:j().describe("Project ID"),id:j().describe("Deployment ID (FQN)"),name:j().describe("Deployment name"),kind:j(),title:j(),technology:j().nullable(),shape:j(),includedInViews:Rp,metadata:Ft(Wt([j(),Te(j())])),tags:Te(j())})])),Yie=na({name:"search-element",annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Search elements"},description:`
3771
+ c=>Jie(c)??[])}:[]}),edges:[...i.edges()].map(a=>({source:a.source.id,target:a.target.id,label:a.label,description:a.description.text,technology:a.technology,tags:[...a.tags]})),sourceLocation:s({view:i.id})}}),Qie=Te(Gg("type",[ve({type:De("element"),project:j().describe("Project ID"),id:j().describe("Element ID (FQN)"),name:j().describe("Element name"),kind:j(),title:j(),technology:j().nullable(),shape:j(),includedInViews:Rp,metadata:Ft(Wt([j(),Te(j())])),tags:Te(j())}),ve({type:De("deployment\
3772
+ -node"),project:j().describe("Project ID"),id:j().describe("Deployment ID (FQN)"),name:j().describe("Deployment name"),kind:j(),title:j(),technology:j().nullable(),shape:j(),includedInViews:Rp,metadata:Ft(Wt([j(),Te(j())])),tags:Te(j())})])),ese=na({name:"search-element",annotations:{readOnlyHint:!0,idempotentHint:!0,title:"Search elements"},description:`
3771
3773
  Search LikeC4 elements and deployment nodes across all projects.
3772
3774
 
3773
3775
  Query syntax (case-insensitive):
@@ -3822,10 +3824,10 @@ Example response:
3822
3824
  }
3823
3825
  ]
3824
3826
  }
3825
- `,inputSchema:{search:j().min(2,"Search must be at least 2 characters long")},outputSchema:{total:It(),found:Jie}},async(t,e)=>{const r=t.projects(),n=[];let i=e.search.toLowerCase(),s;i.startsWith("kind:")?(i=i.slice(5),jt.debug("search by kind: {search}",{search:i}),s=a=>a.kind.toLowerCase()===i):i.startsWith("shape:")?(i=i.slice(6),jt.debug("search by shape: {search}",{search:i}),s=a=>a.shape.toLowerCase()===i):i.startsWith("meta:")?(i=i.slice(5),jt.debug("search by metadata: {search}",{search:i}),
3827
+ `,inputSchema:{search:j().min(2,"Search must be at least 2 characters long")},outputSchema:{total:It(),found:Qie}},async(t,e)=>{const r=t.projects(),n=[];let i=e.search.toLowerCase(),s;i.startsWith("kind:")?(i=i.slice(5),jt.debug("search by kind: {search}",{search:i}),s=a=>a.kind.toLowerCase()===i):i.startsWith("shape:")?(i=i.slice(6),jt.debug("search by shape: {search}",{search:i}),s=a=>a.shape.toLowerCase()===i):i.startsWith("meta:")?(i=i.slice(5),jt.debug("search by metadata: {search}",{search:i}),
3826
3828
  s=a=>!!a.getMetadata(i)):i.startsWith("#")?(i=i.slice(1),jt.debug("search by tag: {search}",{search:i}),s=a=>a.tags.some(o=>o.toLowerCase().includes(i))):(jt.debug("search by id/title: {search}",{search:i}),s=a=>a.id.toLowerCase().includes(i)||a.title.toLowerCase().includes(i));for(const a of r)try{const o=await t.computedModel(a.id);for(const c of Wv(o.elements(),l=>!l.imported&&s(l)))n.push({type:"element",project:a.id,id:c.id,name:c.name,kind:c.kind,title:c.title,technology:c.technology,shape:c.
3827
- shape,tags:[...c.tags],metadata:c.getMetadata(),includedInViews:kp(c.views())});for(const c of Wv(o.deployment.nodes(),s))n.push({type:"deployment-node",project:a.id,id:c.id,name:c.name,kind:c.kind,title:c.title,technology:c.technology,shape:c.shape,tags:[...c.tags],metadata:c.getMetadata(),includedInViews:kp(c.views())})}catch(o){jt.error(`Error searching in project ${a.id}:`,{error:o})}return{total:n.length,found:n.slice(0,20)}});class Xie{services;constructor(e){this.services=e}create(e){const r=this.
3828
- services.shared.lsp.Connection!==void 0,n=new Nie({name:"LikeC4",version:qie.version},{instructions:`LikeC4 MCP \u2013 query and navigate LikeC4 models.
3829
+ shape,tags:[...c.tags],metadata:c.getMetadata(),includedInViews:kp(c.views())});for(const c of Wv(o.deployment.nodes(),s))n.push({type:"deployment-node",project:a.id,id:c.id,name:c.name,kind:c.kind,title:c.title,technology:c.technology,shape:c.shape,tags:[...c.tags],metadata:c.getMetadata(),includedInViews:kp(c.views())})}catch(o){jt.error(`Error searching in project ${a.id}:`,{error:o})}return{total:n.length,found:n.slice(0,20)}});class tse{services;constructor(e){this.services=e}create(e){const r=this.
3830
+ services.shared.lsp.Connection!==void 0,n=new Lie({name:"LikeC4",version:Bie.version},{instructions:`LikeC4 MCP \u2013 query and navigate LikeC4 models.
3829
3831
 
3830
3832
  Conventions:
3831
3833
  - All tools are read-only and idempotent.
@@ -3849,53 +3851,53 @@ Instructions:
3849
3851
  - If response returns "sourceLocation", provide link to this location in the editor
3850
3852
 
3851
3853
  Full documentation: https://likec4.dev/llms-full.txt
3852
- `,enforceStrictCapabilities:!0,...e,capabilities:{tools:{},...e?.capabilities}});return n.registerTool(...Bie(this.services.likec4.LanguageServices)),n.registerTool(...Wie(this.services.likec4.LanguageServices)),n.registerTool(...Vie(this.services.likec4.LanguageServices)),n.registerTool(...Uie(this.services.likec4.LanguageServices)),n.registerTool(...Zie(this.services.likec4.LanguageServices)),n.registerTool(...Yie(this.services.likec4.LanguageServices)),n.registerTool(...Hie(this.services.likec4.
3853
- LanguageServices)),r&&n.registerTool(...zie(this.services.likec4.LanguageServices)),n.server.onerror=i=>{Fe.error(Ve(i))},n}}class WM extends gk{services;projects;langiumDocuments;documentCache;workspaceCache;constructor(e){super(),this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.projects=e.shared.workspace.ProjectsManager,this.documentCache=new qS(r=>this.createDocumentIndex(r)),this.workspaceCache=new vc(e.shared,Ue.IndexedContent),this.onDispose(e.shared.workspace.
3854
+ `,enforceStrictCapabilities:!0,...e,capabilities:{tools:{},...e?.capabilities}});return n.registerTool(...Vie(this.services.likec4.LanguageServices)),n.registerTool(...Zie(this.services.likec4.LanguageServices)),n.registerTool(...Kie(this.services.likec4.LanguageServices)),n.registerTool(...Gie(this.services.likec4.LanguageServices)),n.registerTool(...Xie(this.services.likec4.LanguageServices)),n.registerTool(...ese(this.services.likec4.LanguageServices)),n.registerTool(...Uie(this.services.likec4.
3855
+ LanguageServices)),r&&n.registerTool(...Wie(this.services.likec4.LanguageServices)),n.server.onerror=i=>{Fe.error(Ve(i))},n}}class UM extends mk{services;projects;langiumDocuments;documentCache;workspaceCache;constructor(e){super(),this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.projects=e.shared.workspace.ProjectsManager,this.documentCache=new qS(r=>this.createDocumentIndex(r)),this.workspaceCache=new vc(e.shared,Ue.IndexedContent),this.onDispose(e.shared.workspace.
3854
3856
  DocumentBuilder.onDocumentPhase(Ue.IndexedContent,r=>{Bi(r)&&this.documentCache.delete(r)}))}documents(e){return this.langiumDocuments.projectDocuments(e).filter(r=>Bi(r)&&r.state>=Ue.IndexedContent)}get(e){return e.state<Ue.IndexedContent&&nt(`Document ${e.uri.path} is not indexed`),this.documentCache.get(e)}resolve(e){return e.$type==="Imported"?this.getFqn(e.imported.ref):e.$type==="Element"?this.getFqn(e):this.services.likec4.DeploymentsIndex.getFqn(e)}getFqn(e){ze(Ar(e)||km(e));let r=$y.readId(
3855
- e);if(be(r))return r;const n=bt(e);return ze(Bi(n)),this.get(n),Dn($y.readId(e),"Element fqn must be set, invalid state")}byFqn(e,r){return at(this.workspaceCache.get(`${e}:fqn:${r}`,()=>this.documents(e).flatMap(n=>this.get(n).byFqn(r)).toArray()))}rootElements(e){return at(this.workspaceCache.get(`${e}:rootElements`,()=>{const r=this.documents(e).reduce((n,i)=>(this.get(i).rootElements().forEach(s=>{n.set(s.name,s)}),n),new Fr);return qk(r)}))}directChildrenOf(e,r){return at(this.workspaceCache.
3856
- get(`${e}:directChildrenOf:${r}`,()=>{const n=this.documents(e).reduce((i,s)=>(this.get(s).children(r).forEach(a=>{i.set(a.name,a)}),i),new Fr);return qk(n)}))}uniqueDescedants(e,r){return at(this.workspaceCache.get(`${e}:uniqueDescedants:${r}`,()=>{const{children:n,descendants:i}=this.documents(e).reduce((o,c)=>{const l=this.get(c);return l.children(r).forEach(u=>{o.children.set(u.name,u)}),l.descendants(r).forEach(u=>{o.descendants.set(u.name,u)}),o},{children:new Fr,descendants:new Fr}),s=qk(
3857
+ e);if(be(r))return r;const n=bt(e);return ze(Bi(n)),this.get(n),Dn($y.readId(e),"Element fqn must be set, invalid state")}byFqn(e,r){return at(this.workspaceCache.get(`${e}:fqn:${r}`,()=>this.documents(e).flatMap(n=>this.get(n).byFqn(r)).toArray()))}rootElements(e){return at(this.workspaceCache.get(`${e}:rootElements`,()=>{const r=this.documents(e).reduce((n,i)=>(this.get(i).rootElements().forEach(s=>{n.set(s.name,s)}),n),new Fr);return jk(r)}))}directChildrenOf(e,r){return at(this.workspaceCache.
3858
+ get(`${e}:directChildrenOf:${r}`,()=>{const n=this.documents(e).reduce((i,s)=>(this.get(s).children(r).forEach(a=>{i.set(a.name,a)}),i),new Fr);return jk(n)}))}uniqueDescedants(e,r){return at(this.workspaceCache.get(`${e}:uniqueDescedants:${r}`,()=>{const{children:n,descendants:i}=this.documents(e).reduce((o,c)=>{const l=this.get(c);return l.children(r).forEach(u=>{o.children.set(u.name,u)}),l.descendants(r).forEach(u=>{o.descendants.set(u.name,u)}),o},{children:new Fr,descendants:new Fr}),s=jk(
3857
3859
  n),a=[...i.associations()].flatMap(([o,c])=>c.length===1&&!n.has(o)?c:[]);return[...s,...I2(a)]}))}createDocumentIndex(e){const r=e.parseResult.value.models.flatMap(d=>d.elements);if(r.length===0)return gl.EMPTY;const n=e.likec4ProjectId??this.projects.belongsTo(e),i=new Array,s=new Fr,a=new Fr,o=new Fr,c=this.services.workspace.AstNodeDescriptionProvider,l=(d,f,p)=>{const w=Object.assign(c.createDescription(d,f,e),{id:p,likec4ProjectId:n});return $y.writeId(d,p),o.set(p,w),w},u=(d,f)=>{let p;if(Ar(
3858
- d)){p=Z2(d.name,f);const g=l(d,d.name,p);f?s.set(f,g):i.push(g)}else p=Io(d.element);let w=[];if(Pr(d.body)&&!Pt(d.body.elements)){for(const g of d.body.elements)if(!Mi(g)&&!Pc(g))try{w.push(...u(g,p))}catch(y){nt(y)}}w=[...s.get(p)??[],...w];for(const g of w)a.set(p,g);if(ho(d))for(const g of N2(p))for(const y of w)a.set(g,y);return a.get(p)??[]};for(const d of r)try{if(Mi(d)||Pc(d))continue;u(d,null)}catch(f){nt(f)}return new gl(i,s,a,o,n)}}function qk(t){return[...t.associations()].flatMap(([
3859
- e,r])=>r.length===1?r:[]).sort((e,r)=>FS(e.name,r.name))}class gl{_rootElements;_children;_descendants;_byfqn;projectId;static EMPTY=new gl([],new Fr,new Fr,new Fr,In.DefaultProjectId);constructor(e,r,n,i,s){this._rootElements=e,this._children=r,this._descendants=n,this._byfqn=i,this.projectId=s}rootElements(){return this._rootElements}byFqn(e){return this._byfqn.get(e)??[]}children(e){return this._children.get(e)??[]}descendants(e){return this._descendants.get(e)??[]}}class Qie extends WM{services;Names;constructor(e){
3860
+ d)){p=Z2(d.name,f);const g=l(d,d.name,p);f?s.set(f,g):i.push(g)}else p=Io(d.element);let w=[];if(Pr(d.body)&&!Pt(d.body.elements)){for(const g of d.body.elements)if(!Mi(g)&&!Pc(g))try{w.push(...u(g,p))}catch(y){nt(y)}}w=[...s.get(p)??[],...w];for(const g of w)a.set(p,g);if(ho(d))for(const g of N2(p))for(const y of w)a.set(g,y);return a.get(p)??[]};for(const d of r)try{if(Mi(d)||Pc(d))continue;u(d,null)}catch(f){nt(f)}return new gl(i,s,a,o,n)}}function jk(t){return[...t.associations()].flatMap(([
3861
+ e,r])=>r.length===1?r:[]).sort((e,r)=>FS(e.name,r.name))}class gl{_rootElements;_children;_descendants;_byfqn;projectId;static EMPTY=new gl([],new Fr,new Fr,new Fr,In.DefaultProjectId);constructor(e,r,n,i,s){this._rootElements=e,this._children=r,this._descendants=n,this._byfqn=i,this.projectId=s}rootElements(){return this._rootElements}byFqn(e){return this._byfqn.get(e)??[]}children(e){return this._children.get(e)??[]}descendants(e){return this._descendants.get(e)??[]}}class rse extends UM{services;Names;constructor(e){
3860
3862
  super(e),this.services=e,this.Names=e.references.NameProvider}createDocumentIndex(e){const r=e.parseResult.value.deployments.flatMap(f=>f.elements);if(r.length===0)return gl.EMPTY;const n=this.projects.belongsTo(e),i=new Array,s=new Fr,a=new Fr,o=new Fr,c=this.Names,l=this.services.workspace.AstNodeDescriptionProvider,u=(f,p,w)=>{const g={...l.createDescription(f,p,e),id:w,likec4ProjectId:n};return $y.writeId(f,w),o.set(w,g),g},d=(f,p)=>{let w;if(Xs(f))w=Io(f.deploymentNode);else{const y=c.getName(
3861
- f);if(!be(y))return[];w=a2(y,p);const m=u(f,y,w);if(p?s.set(p,m):i.push(m),un(f))return[]}let g=[];if(Pr(f.body)){for(const y of f.body.elements)if(!ui(y))try{g.push(...d(y,w))}catch(m){nt(m)}}g=[...s.get(w)??[],...g];for(const y of g)a.set(w,y);if(Xs(f))for(const y of o2(w))for(const m of g)a.set(y,m);return a.get(w)??[]};for(const f of r)try{if(ui(f))continue;d(f,null)}catch(p){nt(p)}return new gl(i,s,a,o,n)}}function ese(t){const e=new Map;for(const r of t)if(Hv(r)&&r.viewOf&&Mt(r.extends)){const n=e.
3862
- get(r.viewOf)??[];n.push(r.id),e.set(r.viewOf,n)}for(const{id:r,nodes:n}of t)for(const i of n){const s=i.modelRef;if(i.navigateTo||!s)continue;const a=t0(e.get(s)??[],o=>o!==r);a&&(i.navigateTo=a)}return t}new TextEncoder;const tse=4096;function GM(t,e,r){let n=e;const i=n+r,s=[];let a="";for(;n<i;){const o=t[n++];if((o&128)===0)s.push(o);else if((o&224)===192){const c=t[n++]&63;s.push((o&31)<<6|c)}else if((o&240)===224){const c=t[n++]&63,l=t[n++]&63;s.push((o&31)<<12|c<<6|l)}else if((o&248)===240){
3863
- const c=t[n++]&63,l=t[n++]&63,u=t[n++]&63;let d=(o&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(o);s.length>=tse&&(a+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(a+=String.fromCharCode(...s)),a}const rse=new TextDecoder,nse=200;function ise(t,e,r){const n=t.subarray(e,e+r);return rse.decode(n)}function sse(t,e,r){return r>nse?ise(t,e,r):GM(t,e,r)}class Cv{constructor(e,r){this.type=e,this.data=r}}class An extends Error{constructor(e){
3864
- super(e);const r=Object.create(An.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:An.name})}}const Ep=4294967295;function ase(t,e,r){const n=Math.floor(r/4294967296),i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function KM(t,e){const r=t.getInt32(e),n=t.getUint32(e+4);return r*4294967296+n}function ose(t,e){const r=t.getUint32(e),n=t.getUint32(e+4);return r*4294967296+n}const cse=-1,lse=4294967296-1,use=17179869184-1;function dse({sec:t,
3865
- nsec:e}){if(t>=0&&e>=0&&t<=use)if(e===0&&t<=lse){const r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{const r=t/4294967296,n=t&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|r&3),s.setUint32(4,n),i}else{const r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,e),ase(n,4,t),r}}function fse(t){const e=t.getTime(),r=Math.floor(e/1e3),n=(e-r*1e3)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-i*1e9}}function pse(t){if(t instanceof
3866
- Date){const e=fse(t);return dse(e)}else return null}function hse(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const r=e.getUint32(0),n=e.getUint32(4),i=(r&3)*4294967296+n,s=r>>>2;return{sec:i,nsec:s}}case 12:{const r=KM(e,4),n=e.getUint32(0);return{sec:r,nsec:n}}default:throw new An(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function mse(t){const e=hse(t);return new Date(e.sec*1e3+
3867
- e.nsec/1e6)}const gse={type:cse,encode:pse,decode:mse};class Fk{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(gse)}register({type:e,encode:r,decode:n}){if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{const i=-1-e;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}}tryToEncode(e,r){for(let n=0;n<this.builtInEncoders.length;n++){const i=this.builtInEncoders[n];if(i!=null){const s=i(e,r);if(s!=null){const a=-1-n;return new Cv(a,s)}}}
3868
- for(let n=0;n<this.encoders.length;n++){const i=this.encoders[n];if(i!=null){const s=i(e,r);if(s!=null){const a=n;return new Cv(a,s)}}}return e instanceof Cv?e:null}decode(e,r,n){const i=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return i?i(e,r,n):new Cv(r,e)}}Fk.defaultCodec=new Fk;function yse(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function ZM(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,
3869
- t.byteLength):yse(t)?new Uint8Array(t):Uint8Array.from(t)}function Hk(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const vse=16,wse=16;class bse{constructor(e=vse,r=wse){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,n){const i=this.caches[n-1];e:for(const s of i){const a=s.bytes;for(let o=0;o<n;o++)if(a[o]!==e[r+o])continue e;
3870
- return s.str}return null}store(e,r){const n=this.caches[e.length-1],i={bytes:e,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,r,n){const i=this.find(e,r,n);if(i!=null)return this.hit++,i;this.miss++;const s=GM(e,r,n),a=Uint8Array.prototype.slice.call(e,r,r+n);return this.store(a,s),s}}const Bk="array",Tp="map_key",JM="map_value",_se=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new An("The type of key must be string or number but "+typeof t)};
3871
- class Rse{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const r=this.getUninitializedStateFromPool();r.type=Bk,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){const r=this.getUninitializedStateFromPool();r.type=Tp,r.readCount=0,r.size=e,r.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,
3872
- size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Bk){const n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===Tp||e.type===JM){const n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=
3873
- -1}}const $p=-1,zk=new DataView(new ArrayBuffer(0)),kse=new Uint8Array(zk.buffer);try{zk.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const YM=new RangeError("Insufficient data"),Sse=new bse;class wS{constructor(e){this.totalPos=0,this.pos=0,this.view=zk,this.bytes=kse,this.headByte=$p,this.stack=new Rse,this.entered=!1,this.extensionCodec=e?.extensionCodec??
3874
- Fk.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??Ep,this.maxBinLength=e?.maxBinLength??Ep,this.maxArrayLength=e?.maxArrayLength??Ep,this.maxMapLength=e?.maxMapLength??Ep,this.maxExtLength=e?.maxExtLength??Ep,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:Sse,this.mapKeyConverter=e?.mapKeyConverter??_se}clone(){return new wS({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.
3875
- useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=$p,this.stack.reset()}setBuffer(e){const r=ZM(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===$p&&!this.hasRemaining(1))this.setBuffer(e);else{const r=this.
3876
- bytes.subarray(this.pos),n=ZM(e),i=new Uint8Array(r.length+n.length);i.set(r),i.set(n,r.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:r,pos:n}=this;return new RangeError(`Extra ${r.byteLength-n} of ${r.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const r=this.doDecodeSync();if(this.hasRemaining(1))throw this.
3863
+ f);if(!be(y))return[];w=a2(y,p);const m=u(f,y,w);if(p?s.set(p,m):i.push(m),un(f))return[]}let g=[];if(Pr(f.body)){for(const y of f.body.elements)if(!ui(y))try{g.push(...d(y,w))}catch(m){nt(m)}}g=[...s.get(w)??[],...g];for(const y of g)a.set(w,y);if(Xs(f))for(const y of o2(w))for(const m of g)a.set(y,m);return a.get(w)??[]};for(const f of r)try{if(ui(f))continue;d(f,null)}catch(p){nt(p)}return new gl(i,s,a,o,n)}}function nse(t){const e=new Map;for(const r of t)if(Hv(r)&&r.viewOf&&Mt(r.extends)){const n=e.
3864
+ get(r.viewOf)??[];n.push(r.id),e.set(r.viewOf,n)}for(const{id:r,nodes:n}of t)for(const i of n){const s=i.modelRef;if(i.navigateTo||!s)continue;const a=t0(e.get(s)??[],o=>o!==r);a&&(i.navigateTo=a)}return t}new TextEncoder;const ise=4096;function VM(t,e,r){let n=e;const i=n+r,s=[];let a="";for(;n<i;){const o=t[n++];if((o&128)===0)s.push(o);else if((o&224)===192){const c=t[n++]&63;s.push((o&31)<<6|c)}else if((o&240)===224){const c=t[n++]&63,l=t[n++]&63;s.push((o&31)<<12|c<<6|l)}else if((o&248)===240){
3865
+ const c=t[n++]&63,l=t[n++]&63,u=t[n++]&63;let d=(o&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(o);s.length>=ise&&(a+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(a+=String.fromCharCode(...s)),a}const sse=new TextDecoder,ase=200;function ose(t,e,r){const n=t.subarray(e,e+r);return sse.decode(n)}function cse(t,e,r){return r>ase?ose(t,e,r):VM(t,e,r)}class Cv{constructor(e,r){this.type=e,this.data=r}}class An extends Error{constructor(e){
3866
+ super(e);const r=Object.create(An.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:An.name})}}const Ep=4294967295;function lse(t,e,r){const n=Math.floor(r/4294967296),i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function WM(t,e){const r=t.getInt32(e),n=t.getUint32(e+4);return r*4294967296+n}function use(t,e){const r=t.getUint32(e),n=t.getUint32(e+4);return r*4294967296+n}const dse=-1,fse=4294967296-1,pse=17179869184-1;function hse({sec:t,
3867
+ nsec:e}){if(t>=0&&e>=0&&t<=pse)if(e===0&&t<=fse){const r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{const r=t/4294967296,n=t&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|r&3),s.setUint32(4,n),i}else{const r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,e),lse(n,4,t),r}}function mse(t){const e=t.getTime(),r=Math.floor(e/1e3),n=(e-r*1e3)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-i*1e9}}function gse(t){if(t instanceof
3868
+ Date){const e=mse(t);return hse(e)}else return null}function yse(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const r=e.getUint32(0),n=e.getUint32(4),i=(r&3)*4294967296+n,s=r>>>2;return{sec:i,nsec:s}}case 12:{const r=WM(e,4),n=e.getUint32(0);return{sec:r,nsec:n}}default:throw new An(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function vse(t){const e=yse(t);return new Date(e.sec*1e3+
3869
+ e.nsec/1e6)}const wse={type:dse,encode:gse,decode:vse};class qk{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(wse)}register({type:e,encode:r,decode:n}){if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{const i=-1-e;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}}tryToEncode(e,r){for(let n=0;n<this.builtInEncoders.length;n++){const i=this.builtInEncoders[n];if(i!=null){const s=i(e,r);if(s!=null){const a=-1-n;return new Cv(a,s)}}}
3870
+ for(let n=0;n<this.encoders.length;n++){const i=this.encoders[n];if(i!=null){const s=i(e,r);if(s!=null){const a=n;return new Cv(a,s)}}}return e instanceof Cv?e:null}decode(e,r,n){const i=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return i?i(e,r,n):new Cv(r,e)}}qk.defaultCodec=new qk;function bse(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function GM(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,
3871
+ t.byteLength):bse(t)?new Uint8Array(t):Uint8Array.from(t)}function Fk(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const _se=16,Rse=16;class kse{constructor(e=_se,r=Rse){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,n){const i=this.caches[n-1];e:for(const s of i){const a=s.bytes;for(let o=0;o<n;o++)if(a[o]!==e[r+o])continue e;
3872
+ return s.str}return null}store(e,r){const n=this.caches[e.length-1],i={bytes:e,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,r,n){const i=this.find(e,r,n);if(i!=null)return this.hit++,i;this.miss++;const s=VM(e,r,n),a=Uint8Array.prototype.slice.call(e,r,r+n);return this.store(a,s),s}}const Hk="array",Tp="map_key",KM="map_value",Sse=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new An("The type of key must be string or number but "+typeof t)};
3873
+ class Ese{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const r=this.getUninitializedStateFromPool();r.type=Hk,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){const r=this.getUninitializedStateFromPool();r.type=Tp,r.readCount=0,r.size=e,r.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,
3874
+ size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Hk){const n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===Tp||e.type===KM){const n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=
3875
+ -1}}const $p=-1,Bk=new DataView(new ArrayBuffer(0)),Tse=new Uint8Array(Bk.buffer);try{Bk.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ZM=new RangeError("Insufficient data"),$se=new kse;class wS{constructor(e){this.totalPos=0,this.pos=0,this.view=Bk,this.bytes=Tse,this.headByte=$p,this.stack=new Ese,this.entered=!1,this.extensionCodec=e?.extensionCodec??
3876
+ qk.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??Ep,this.maxBinLength=e?.maxBinLength??Ep,this.maxArrayLength=e?.maxArrayLength??Ep,this.maxMapLength=e?.maxMapLength??Ep,this.maxExtLength=e?.maxExtLength??Ep,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:$se,this.mapKeyConverter=e?.mapKeyConverter??Sse}clone(){return new wS({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.
3877
+ useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=$p,this.stack.reset()}setBuffer(e){const r=GM(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===$p&&!this.hasRemaining(1))this.setBuffer(e);else{const r=this.
3878
+ bytes.subarray(this.pos),n=GM(e),i=new Uint8Array(r.length+n.length);i.set(r),i.set(n,r.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:r,pos:n}=this;return new RangeError(`Extra ${r.byteLength-n} of ${r.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const r=this.doDecodeSync();if(this.hasRemaining(1))throw this.
3877
3879
  createExtraByteError(this.pos);return r}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let r=!1,n;for await(const o of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(o);try{n=
3878
- this.doDecodeSync(),r=!0}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:i,pos:s,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${Hk(i)} at ${a} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,r){if(this.entered){yield*this.
3880
+ this.doDecodeSync(),r=!0}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:i,pos:s,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${Fk(i)} at ${a} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,r){if(this.entered){yield*this.
3879
3881
  clone().decodeMultiAsync(e,r);return}try{this.entered=!0;let n=r,i=-1;for await(const s of e){if(r&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(i=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(a){if(!(a instanceof RangeError))throw a}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let r;if(e>=224)r=e-256;else if(e<192)if(e<128)r=e;else if(e<144){const i=e-128;if(i!==
3880
3882
  0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e<160){const i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else{const i=e-160;r=this.decodeString(i,0)}else if(e===192)r=null;else if(e===194)r=!1;else if(e===195)r=!0;else if(e===202)r=this.readF32();else if(e===203)r=this.readF64();else if(e===204)r=this.readU8();else if(e===205)r=this.readU16();else if(e===206)r=this.readU32();else if(e===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(e===
3881
3883
  208)r=this.readI8();else if(e===209)r=this.readI16();else if(e===210)r=this.readI32();else if(e===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(e===217){const i=this.lookU8();r=this.decodeString(i,1)}else if(e===218){const i=this.lookU16();r=this.decodeString(i,2)}else if(e===219){const i=this.lookU32();r=this.decodeString(i,4)}else if(e===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===221){const i=this.readU32();
3882
3884
  if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===196){const i=this.lookU8();r=this.decodeBinary(i,1)}else if(e===197){const i=this.lookU16();r=this.decodeBinary(i,2)}else if(e===198){const i=this.lookU32();r=this.decodeBinary(i,4)}else if(e===212)r=this.
3883
- decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){const i=this.lookU8();r=this.decodeExtension(i,1)}else if(e===200){const i=this.lookU16();r=this.decodeExtension(i,2)}else if(e===201){const i=this.lookU32();r=this.decodeExtension(i,4)}else throw new An(`Unrecognized type byte: ${Hk(e)}`);this.complete();const n=this.stack;for(;n.length>
3884
- 0;){const i=n.top();if(i.type===Bk)if(i.array[i.position]=r,i.position++,i.position===i.size)r=i.array,n.release(i);else continue e;else if(i.type===Tp){if(r==="__proto__")throw new An("The key __proto__ is not allowed");i.key=this.mapKeyConverter(r),i.type=JM;continue e}else if(i.map[i.key]=r,i.readCount++,i.readCount===i.size)r=i.map,n.release(i);else{i.key=null,i.type=Tp;continue e}}return r}}readHeadByte(){return this.headByte===$p&&(this.headByte=this.readU8()),this.headByte}complete(){this.
3885
- headByte=$p}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new An(`Unrecognized array type byte: ${Hk(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new An(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new An(`Max length exceeded: array length (${e}) > maxArrayLength (${this.
3886
- maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){if(e>this.maxStrLength)throw new An(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw YM;const n=this.pos+r;let i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=sse(this.bytes,n,e),
3887
- this.pos+=r+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Tp:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new An(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw YM;const n=this.pos+r,i=this.bytes.subarray(n,n+e);return this.pos+=r+e,i}decodeExtension(e,r){if(e>this.maxExtLength)throw new An(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+
3885
+ decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){const i=this.lookU8();r=this.decodeExtension(i,1)}else if(e===200){const i=this.lookU16();r=this.decodeExtension(i,2)}else if(e===201){const i=this.lookU32();r=this.decodeExtension(i,4)}else throw new An(`Unrecognized type byte: ${Fk(e)}`);this.complete();const n=this.stack;for(;n.length>
3886
+ 0;){const i=n.top();if(i.type===Hk)if(i.array[i.position]=r,i.position++,i.position===i.size)r=i.array,n.release(i);else continue e;else if(i.type===Tp){if(r==="__proto__")throw new An("The key __proto__ is not allowed");i.key=this.mapKeyConverter(r),i.type=KM;continue e}else if(i.map[i.key]=r,i.readCount++,i.readCount===i.size)r=i.map,n.release(i);else{i.key=null,i.type=Tp;continue e}}return r}}readHeadByte(){return this.headByte===$p&&(this.headByte=this.readU8()),this.headByte}complete(){this.
3887
+ headByte=$p}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new An(`Unrecognized array type byte: ${Fk(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new An(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new An(`Max length exceeded: array length (${e}) > maxArrayLength (${this.
3888
+ maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){if(e>this.maxStrLength)throw new An(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw ZM;const n=this.pos+r;let i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=cse(this.bytes,n,e),
3889
+ this.pos+=r+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Tp:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new An(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw ZM;const n=this.pos+r,i=this.bytes.subarray(n,n+e);return this.pos+=r+e,i}decodeExtension(e,r){if(e>this.maxExtLength)throw new An(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+
3888
3890
  r),i=this.decodeBinary(e,r+1);return this.extensionCodec.decode(i,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.
3889
- view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=ose(this.view,this.pos);return this.pos+=8,e}readI64(){const e=KM(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(
3890
- this.pos);return this.pos+=8,e}}function Ese(t,e){return new wS(e).decode(t)}const Tse=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return z2.from(t,e)},$se=/^[A-Za-z0-9+/]*={0,2}$/,Pse=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!$se.exec(t))throw new TypeError("Invalid base64 string.");const e=Tse(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},
3891
- {getDocument:Cse}=ec;function Ase({nodes:t,edges:e,autoLayout:r,...n}){return{...n,autoLayout:c2(r)?{direction:r}:r,nodes:Zo(t,({b:i,c:s,...a})=>({x:i[0],y:i[1],width:i[2],height:i[3],isCompound:s,...a})),edges:Zo(e,({p:i,cp:s,l:a,...o})=>({...!!s&&{controlPoints:s},...!!a&&{labelBBox:a},...o,points:i}))}}function Av(t){return t.includes("@likec4-generated")}function xse(t){if(!Av(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
3892
- `).filter(n=>!n.includes("**")&&!n.includes("@likec4-")&&!n.includes("*/")).map(n=>n.replaceAll("*","").trim()).join(""),r=Pse(e);return Ase(Ese(r))}function Uk(t){const e=El(t.$cstNode,["BLOCK_COMMENT"]);if(!(!e||!Av(e.text)))try{return xse(e.text)}catch(r){const n=Cse(t);nt(r),Fe.warn(`Ignoring manual layout of "${t.name??"unnamed"}" at ${n.uri.fsPath}:${1+(e.range.start.line||0)}`);return}}class XM{mergedData=new Map;mergeMetadata(e,r){const n={...e};for(const[i,s]of Object.entries(r)){const a=n[i];
3891
+ view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=use(this.view,this.pos);return this.pos+=8,e}readI64(){const e=WM(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(
3892
+ this.pos);return this.pos+=8,e}}function Pse(t,e){return new wS(e).decode(t)}const Cse=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return z2.from(t,e)},Ase=/^[A-Za-z0-9+/]*={0,2}$/,xse=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Ase.exec(t))throw new TypeError("Invalid base64 string.");const e=Cse(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},
3893
+ {getDocument:Ise}=ec;function Nse({nodes:t,edges:e,autoLayout:r,...n}){return{...n,autoLayout:c2(r)?{direction:r}:r,nodes:Zo(t,({b:i,c:s,...a})=>({x:i[0],y:i[1],width:i[2],height:i[3],isCompound:s,...a})),edges:Zo(e,({p:i,cp:s,l:a,...o})=>({...!!s&&{controlPoints:s},...!!a&&{labelBBox:a},...o,points:i}))}}function Av(t){return t.includes("@likec4-generated")}function Dse(t){if(!Av(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
3894
+ `).filter(n=>!n.includes("**")&&!n.includes("@likec4-")&&!n.includes("*/")).map(n=>n.replaceAll("*","").trim()).join(""),r=xse(e);return Nse(Pse(r))}function zk(t){const e=El(t.$cstNode,["BLOCK_COMMENT"]);if(!(!e||!Av(e.text)))try{return Dse(e.text)}catch(r){const n=Ise(t);nt(r),Fe.warn(`Ignoring manual layout of "${t.name??"unnamed"}" at ${n.uri.fsPath}:${1+(e.range.start.line||0)}`);return}}class JM{mergedData=new Map;mergeMetadata(e,r){const n={...e};for(const[i,s]of Object.entries(r)){const a=n[i];
3893
3895
  if(a===void 0){n[i]=s;continue}const o=Array.isArray(a)?a:[a],c=Array.isArray(s)?s:[s],l=as([...o,...c]);n[i]=l.length===1?l[0]:l}return n}merge(e){for(const r of e){const{id:n,links:i,tags:s,metadata:a}=r,o=this.mergedData.get(n)??{links:[],tags:[],metadata:{}};i&&o.links.push(...i),s&&(o.tags=as([...o.tags,...s])),a&&(o.metadata=this.mergeMetadata(o.metadata,a)),this.mergedData.set(n,o)}}applyExtended(e){const r=this.mergedData.get(e.id);if(!r)return e;let n=r.links;e.links&&e.links.length>0&&
3894
- (n=[...e.links,...n]);let i=r.tags;e.tags&&e.tags.length>0&&(i=as([...e.tags,...i]));let s=r.metadata;return e.metadata&&(s=this.mergeMetadata(e.metadata,r.metadata)),{...e,tags:Ir(i,1)?i:null,links:Ir(n,1)?n:null,...!Pt(s)&&{metadata:s}}}}class QM{specs={elements:{},deployments:{},relationships:{},colors:{}};tags;globals={predicates:{},dynamicPredicates:{},styles:{}};imports=new Fr(Set);constructor(e){const r={};for(const n of e){const{c4Specification:i,c4Globals:s,c4Imports:a}=n;Object.assign(
3896
+ (n=[...e.links,...n]);let i=r.tags;e.tags&&e.tags.length>0&&(i=as([...e.tags,...i]));let s=r.metadata;return e.metadata&&(s=this.mergeMetadata(e.metadata,r.metadata)),{...e,tags:Ir(i,1)?i:null,links:Ir(n,1)?n:null,...!Pt(s)&&{metadata:s}}}}class YM{specs={elements:{},deployments:{},relationships:{},colors:{}};tags;globals={predicates:{},dynamicPredicates:{},styles:{}};imports=new Fr(Set);constructor(e){const r={};for(const n of e){const{c4Specification:i,c4Globals:s,c4Imports:a}=n;Object.assign(
3895
3897
  r,i.tags),Object.assign(this.specs.elements,i.elements),Object.assign(this.specs.relationships,i.relationships),Object.assign(this.specs.colors,i.colors),Object.assign(this.specs.deployments,i.deployments),Object.assign(this.globals.predicates,s.predicates),Object.assign(this.globals.dynamicPredicates,s.dynamicPredicates),Object.assign(this.globals.styles,s.styles);for(const[o,c]of a)this.imports.set(o,c)}this.tags=X2(r)}toModelElement=({tags:e,links:r,style:n,id:i,kind:s,title:a,description:o,technology:c,
3896
3898
  summary:l,metadata:u})=>{try{const d=this.specs.elements[s];return d?(c??=d.technology,o??=d.description,l??=d.summary,r??=d.links,a=a===jp(i)&&d.title?d.title:a,d.tags&&D2(d.tags)&&(e=e?as([...d.tags,...e]):d.tags),Gi({metadata:u&&!Pt(u)?u:void 0,notation:d.notation,style:Gi({...d.style,...n}),links:r,tags:e,summary:l,technology:c,description:o,title:a,kind:s,id:i})):(Fe.warn`No kind '${s}' found for ${i}`,null)}catch(d){nt(d)}return null};toModelRelation=({astPath:e,source:r,target:n,kind:i,links:s,
3897
3899
  id:a,...o})=>Ni(i)&&this.specs.relationships[i]?{...this.specs.relationships[i],...o,...s&&{links:s},source:r,target:n,kind:i,id:a}:{...s&&{links:s},...o,source:r,target:n,id:a};toDeploymentElement=e=>{if("element"in e&&!("kind"in e))return{...e,element:Nr.flatten(e.element)};if("element"in e)return Fe.warn`Invalid ParsedAstDeployment ${e.id}, has both element and kind properties`,null;try{const r=this.specs.deployments[e.kind];if(!r)return Fe.warn`No kind ${e.kind} found for ${e.id}`,null;let{id:n,
3898
- style:i,title:s,...a}=e;return s=s===jp(e.id)&&r.title?r.title:s,Gi({...r,...a,title:s,style:Gi({...r.style,...i}),id:n})}catch(r){nt(r)}return null};toDeploymentRelation=({astPath:e,source:r,target:n,kind:i,links:s,id:a,...o})=>Ni(i)&&this.specs.relationships[i]?{...this.specs.relationships[i],...o,...s&&{links:s},source:r,target:n,kind:i,id:a}:{...s&&{links:s},...o,source:r,target:n,id:a}}function Ise(t,e){const r=new QM(e),n=Zo(r.specs.colors,m=>Q2(m.color)),i=new Set,s=new XM,a=new XM,o=e.flatMap(
3900
+ style:i,title:s,...a}=e;return s=s===jp(e.id)&&r.title?r.title:s,Gi({...r,...a,title:s,style:Gi({...r.style,...i}),id:n})}catch(r){nt(r)}return null};toDeploymentRelation=({astPath:e,source:r,target:n,kind:i,links:s,id:a,...o})=>Ni(i)&&this.specs.relationships[i]?{...this.specs.relationships[i],...o,...s&&{links:s},source:r,target:n,kind:i,id:a}:{...s&&{links:s},...o,source:r,target:n,id:a}}function Ose(t,e){const r=new YM(e),n=Zo(r.specs.colors,m=>Q2(m.color)),i=new Set,s=new JM,a=new JM,o=e.flatMap(
3899
3901
  m=>m.c4ExtendRelations),c=new Set,l=m=>{m?.metadata&&_n(m.metadata).forEach(h=>i.add(h))},u=Ye(e,oi(m=>(s.merge(m.c4ExtendElements),qt(m.c4Elements,r.toModelElement))),Qe(be),HS,r0((m,h)=>{const v=BS(h.id);return v&&Mt(m[v])?(Fe.debug`No parent found for ${h.id}`,m):(m[h.id]=s.applyExtended(h),l(m[h.id]),m)},{})),d=Ye(e,oi(m=>qt(m.c4Relations,r.toModelRelation)),Qe(m=>{if(!m)return!1;const h=Nr.flatten(m.source),v=Nr.flatten(m.target);return Mt(u[h])&&!$S(h)||Mt(u[v])&&!$S(v)?(Fe.debug`Invalid relation ${m.
3900
3902
  id}
3901
3903
  source: ${h} resolved: ${!!u[h]}
@@ -3905,92 +3907,92 @@ h)?a.applyExtended(h):h,l(m[h.id]),m)},{})),p=Ye(e,oi(m=>qt(m.c4DeploymentRelati
3905
3907
  source: ${m.source.deployment} resolved: ${!!f[m.source.deployment]}
3906
3908
  target: ${m.target.deployment} resolved: ${!!f[m.target.deployment]}\n`,!1):!0:!1),r0((m,h)=>Pr(m[h.id])?(Fe.debug`Duplicate deployment relation ${h.id}`,m):(l(h),m[h.id]=h,m),{}));function w(m){const h=m.uri.toString();return v=>{let{id:b,title:_,description:R,astPath:$,...M}=v;return v[KS]==="element"&&Mt(_)&&"viewOf"in v&&(_=u[v.viewOf]?.title??null),Mt(_)&&b==="index"&&(_="Landscape view"),{...tC(M,q=>q===void 0),[Zv]:"parsed",sourcePath:Xe.relative(t.folderUri,h),docUri:h,description:R,title:_,
3907
3909
  id:b}}}const g=e.flatMap(m=>qt(m.c4Views,w(m)));g.some(m=>m.id==="index")||g.unshift({[Zv]:"parsed",[KS]:"element",id:"index",title:"Landscape view",description:null,rules:[{include:[{wildcard:!0}]}]});let y=Ye(g,Nu(ci("id")));g.some(J2)&&(y=ej(y));for(const m of o)c.has(m.astPath)||Fe.warn(`Relation extend at ${m.astPath} does not match any relation in the model`);return{data:{[Zv]:"parsed",projectId:t.id,project:Gi({id:t.id,title:t.config.title??t.config.name,styles:t.config.styles,manualLayouts:t.
3908
- config.manualLayouts}),specification:{tags:r.tags,elements:r.specs.elements,relationships:Zo(r.specs.relationships,({notation:m,technology:h,...v})=>({...m&&{notation:m},...h&&{technology:h},style:v})),deployments:r.specs.deployments,...i.size>0&&{metadataKeys:[...i].sort(FS)},customColors:n},elements:u,relations:d,globals:r.globals,views:y,deployments:{elements:f,relations:p},imports:{}},imports:r.imports}}const Nse=t=>`parsed-without-imports-${t}`,Dse=t=>`parsed-model-${t}`,Ose=t=>`computed-mo\
3909
- del-${t}`,As=Fe.getChild("model-builder");class Lse extends gk{projects;parser;listeners=[];cache;DocumentBuilder;manualLayouts;mutex;constructor(e){super(),this.projects=e.shared.workspace.ProjectsManager,this.parser=e.likec4.ModelParser,this.cache=e.shared.workspace.Cache,this.DocumentBuilder=e.shared.workspace.DocumentBuilder,this.mutex=e.shared.workspace.WorkspaceLock,this.manualLayouts=e.likec4.ManualLayouts,this.onDispose(this.DocumentBuilder.onUpdate((r,n)=>{n.length>0&&this.notifyListeners(
3910
- n)})),this.onDispose(this.DocumentBuilder.onBuildPhase(Ue.Validated,(r,n)=>{const i=r.flatMap(s=>yo(s.uri)||this.projects.isExcluded(s)?[]:s.uri);i.length>0&&this.notifyListeners(i)})),As.debug`created`}unsafeSyncParseModelData(e){const r=this.cache,n=As.getChild(e),i=Nse(e);return r.has(i)&&n.debug`unsafeSyncParseModelData from cache`,r.get(i,()=>{try{const s=this.projects.getProject(e),a=this.documents(e);return a.length===0?(n.debug`no documents to build model`,null):(n.debug`unsafeSyncParseModelData`,
3911
- Ise(s,a))}catch(s){return As.warn(`unsafeSyncParseModelData failed for project ${e}`,{err:s}),null}})}unsafeSyncJoinedModel(e){const r=As.getChild(e),n=this.cache,i=Dse(e);return n.has(i)&&r.debug`unsafeSyncJoinedModel from cache`,n.get(i,()=>{const s=this.unsafeSyncParseModelData(e);if(!s)return null;let a=s.data;if(s.imports.size>0){r.debug`processing imports of ${e}`;const o=[...s.imports.associations()].reduce((c,[l,u])=>{const d=this.unsafeSyncParseModelData(l);if(d){const f=Ye([...u],oi(p=>d.
3912
- data.elements[p]??[]));Ir(f,1)&&(c[l]=f)}return c},{});a={...s.data,imports:o}}return Jo.create(a)})}async parseModel(e,r){e=this.projects.ensureProjectId(e);const n=As.getChild(e),i=Oy();return await this.mutex.read(async()=>{r?.isCancellationRequested&&await Qt(r);const s=this.unsafeSyncJoinedModel(e);return n.debug`parseModel in ${i.pretty}`,s})}previousViews={};unsafeSyncComputeModel(e,r){const n=As.getChild(e),i=this.cache,s=!!r&&!Pt(r),a=Ose(e)+(s?"+manualLayouts":"");return i.has(a)&&n.debug`unsafeSyncBuildModel from cache`,
3913
- i.get(a,()=>{const o=this.unsafeSyncJoinedModel(e);if(!o)return Jo.EMPTY.asComputed;const c=[];for(const d of wl(o.$data.views)){const f=tj(d,o);if(!f.isSuccess){n.warn(Ve(f.error));continue}r?.[d.id]&&Object.assign(f.view,{hasManualLayout:!0}),c.push(f.view)}ese(c);const l=zn(c,d=>{const f=Mse(e,d.id),p=this.previousViews[f],w=p&&FR(d,p)?p:d;return this.previousViews[f]=w,[d.id,w]}),u={...o.$data,[Fv]:"computed",views:l};return s&&(u.manualLayouts=r),Jo.create(u)})}async computeModel(e,r){e=this.
3910
+ config.manualLayouts}),specification:{tags:r.tags,elements:r.specs.elements,relationships:Zo(r.specs.relationships,({notation:m,technology:h,...v})=>({...m&&{notation:m},...h&&{technology:h},style:v})),deployments:r.specs.deployments,...i.size>0&&{metadataKeys:[...i].sort(FS)},customColors:n},elements:u,relations:d,globals:r.globals,views:y,deployments:{elements:f,relations:p},imports:{}},imports:r.imports}}const Lse=t=>`parsed-without-imports-${t}`,Mse=t=>`parsed-model-${t}`,jse=t=>`computed-mo\
3911
+ del-${t}`,As=Fe.getChild("model-builder");class qse extends mk{projects;parser;listeners=[];cache;DocumentBuilder;manualLayouts;mutex;constructor(e){super(),this.projects=e.shared.workspace.ProjectsManager,this.parser=e.likec4.ModelParser,this.cache=e.shared.workspace.Cache,this.DocumentBuilder=e.shared.workspace.DocumentBuilder,this.mutex=e.shared.workspace.WorkspaceLock,this.manualLayouts=e.likec4.ManualLayouts,this.onDispose(this.DocumentBuilder.onUpdate((r,n)=>{n.length>0&&this.notifyListeners(
3912
+ n)})),this.onDispose(this.DocumentBuilder.onBuildPhase(Ue.Validated,(r,n)=>{const i=r.flatMap(s=>yo(s.uri)||this.projects.isExcluded(s)?[]:s.uri);i.length>0&&this.notifyListeners(i)})),As.debug`created`}unsafeSyncParseModelData(e){const r=this.cache,n=As.getChild(e),i=Lse(e);return r.has(i)&&n.debug`unsafeSyncParseModelData from cache`,r.get(i,()=>{try{const s=this.projects.getProject(e),a=this.documents(e);return a.length===0?(n.debug`no documents to build model`,null):(n.debug`unsafeSyncParseModelData`,
3913
+ Ose(s,a))}catch(s){return As.warn(`unsafeSyncParseModelData failed for project ${e}`,{err:s}),null}})}unsafeSyncJoinedModel(e){const r=As.getChild(e),n=this.cache,i=Mse(e);return n.has(i)&&r.debug`unsafeSyncJoinedModel from cache`,n.get(i,()=>{const s=this.unsafeSyncParseModelData(e);if(!s)return null;let a=s.data;if(s.imports.size>0){r.debug`processing imports of ${e}`;const o=[...s.imports.associations()].reduce((c,[l,u])=>{const d=this.unsafeSyncParseModelData(l);if(d){const f=Ye([...u],oi(p=>d.
3914
+ data.elements[p]??[]));Ir(f,1)&&(c[l]=f)}return c},{});a={...s.data,imports:o}}return Jo.create(a)})}async parseModel(e,r){e=this.projects.ensureProjectId(e);const n=As.getChild(e),i=Oy();return await this.mutex.read(async()=>{r?.isCancellationRequested&&await Qt(r);const s=this.unsafeSyncJoinedModel(e);return n.debug`parseModel in ${i.pretty}`,s})}previousViews={};unsafeSyncComputeModel(e,r){const n=As.getChild(e),i=this.cache,s=!!r&&!Pt(r),a=jse(e)+(s?"+manualLayouts":"");return i.has(a)&&n.debug`unsafeSyncBuildModel from cache`,
3915
+ i.get(a,()=>{const o=this.unsafeSyncJoinedModel(e);if(!o)return Jo.EMPTY.asComputed;const c=[];for(const d of wl(o.$data.views)){const f=tj(d,o);if(!f.isSuccess){n.warn(Ve(f.error));continue}r?.[d.id]&&Object.assign(f.view,{hasManualLayout:!0}),c.push(f.view)}nse(c);const l=zn(c,d=>{const f=Fse(e,d.id),p=this.previousViews[f],w=p&&qR(d,p)?p:d;return this.previousViews[f]=w,[d.id,w]}),u={...o.$data,[Fv]:"computed",views:l};return s&&(u.manualLayouts=r),Jo.create(u)})}async computeModel(e,r){e=this.
3914
3916
  projects.ensureProjectId(e);const n=As.getChild(e),i=Oy();return await this.mutex.read(async()=>{r?.isCancellationRequested&&await Qt(r);const s=this.projects.getProject(e),a=await this.manualLayouts.read(s),o=this.unsafeSyncComputeModel(e,a);return n.debug(`buildLikeC4Model in ${i.pretty}`),o})}onModelParsed(e){return this.listeners.push(e),Ka.create(()=>{const r=this.listeners.indexOf(e);r>=0&&this.listeners.splice(r,1)})}clearCache(){As.debug("clearCache"),this.cache.clear(),this.previousViews=
3915
- {}}documents(e){return this.parser.documents(e).toArray()}notifyListeners(e){for(const r of this.listeners)try{r(e)}catch(n){As.warn(Ve(n))}}}function Mse(t,e){return`computed-view-${t}-${e}`}const{findNodeForKeyword:xv,findNodeForProperty:xs}=$w,{getDocument:jse,streamAllContents:qse}=ec,ga=Fe.getChild("ModelLocator");class Fse{services;fqnIndex;deploymentsIndex;langiumDocuments;parser;projects;constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex,
3917
+ {}}documents(e){return this.parser.documents(e).toArray()}notifyListeners(e){for(const r of this.listeners)try{r(e)}catch(n){As.warn(Ve(n))}}}function Fse(t,e){return`computed-view-${t}-${e}`}const{findNodeForKeyword:xv,findNodeForProperty:xs}=$w,{getDocument:Hse,streamAllContents:Bse}=ec,ga=Fe.getChild("ModelLocator");class zse{services;fqnIndex;deploymentsIndex;langiumDocuments;parser;projects;constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex,
3916
3918
  this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.parser=e.likec4.ModelParser,this.projects=e.shared.workspace.ProjectsManager}documents(e){return this.parser.documents(e)}getParsedElement(...e){let r,n;if(e.length===2?(r=e[0],n=e[1]):(r=e[0],n=Zs(r)?this.projects.ensureProjectId():ar(r)),Zs(r)){const s=r,a=this.fqnIndex.byFqn(n,s).head();if(!a)return null;const o=this.langiumDocuments.getDocument(a.documentUri);return o?this.parser.parse(o).c4Elements.find(c=>c.id===s)??null:null}const i=this.
3917
- fqnIndex.getFqn(r);return this.parser.parse(jse(r)).c4Elements.find(s=>s.id===i)??null}locateElement(e,r){let[n,i]=u2(e);n??=this.projects.ensureProjectId(r);const s=this.fqnIndex.byFqn(n,i).head(),a=s?.nameSegment??s?.selectionSegment;return!s||!a?null:{uri:s.documentUri.toString(),range:a.range}}locateDeploymentElement(e,r){const n=this.projects.ensureProjectId(r),i=e,s=this.deploymentsIndex.byFqn(n,i).head(),a=s?.nameSegment??s?.selectionSegment;return!s||!a?null:{uri:s.documentUri.toString(),
3919
+ fqnIndex.getFqn(r);return this.parser.parse(Hse(r)).c4Elements.find(s=>s.id===i)??null}locateElement(e,r){let[n,i]=u2(e);n??=this.projects.ensureProjectId(r);const s=this.fqnIndex.byFqn(n,i).head(),a=s?.nameSegment??s?.selectionSegment;return!s||!a?null:{uri:s.documentUri.toString(),range:a.range}}locateDeploymentElement(e,r){const n=this.projects.ensureProjectId(r),i=e,s=this.deploymentsIndex.byFqn(n,i).head(),a=s?.nameSegment??s?.selectionSegment;return!s||!a?null:{uri:s.documentUri.toString(),
3918
3920
  range:a.range}}locateRelation(e,r){const n=this.projects.ensureProjectId(r);for(const i of this.documents(n)){const s=i.c4Relations.find(c=>c.id===e)??i.c4DeploymentRelations.find(c=>c.id===e);if(!s)continue;const a=this.services.workspace.AstNodeLocator.getAstNode(i.parseResult.value,s.astPath);if(!Mi(a)&&!ui(a))continue;let o=a.kind?xs(a.$cstNode,"kind"):void 0;if(o??=a.dotKind?xs(a.$cstNode,"dotKind"):void 0,o??=xv(a.$cstNode,"->"),o??=xs(a.$cstNode,"title"),o??=xs(a.$cstNode,"target"),o??=a.
3919
3921
  $cstNode,!!o)return{uri:i.uri.toString(),range:{start:o.range.start,end:o.range.start}}}return null}locateViewAst(e,r){const n=this.projects.ensureProjectId(r);for(const i of this.documents(n)){const s=i.c4Views.find(o=>o.id===e);if(!s)continue;const a=this.services.workspace.AstNodeLocator.getAstNode(i.parseResult.value,s.astPath);if(H0(a))return{doc:i,view:s,viewAst:a}}return null}locateView(e,r){const n=this.locateViewAst(e,r);if(!n)return null;const i=n.viewAst;let s=i.name?xs(i.$cstNode,"na\
3920
- me"):void 0;return s??=xv(i.$cstNode,"view"),s??=i.$cstNode,s?{uri:n.doc.uri.toString(),range:{start:s.range.start,end:s.range.start}}:null}async locateDocumentTags(e,r){const n=this.langiumDocuments.getDocument(e);if(!n||!Bi(n))return[];n.state<Ue.Validated&&(ga.debug(`Waiting for document ${n.uri.path} to be Validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(Ue.Validated,n.uri,r));const i=ar(n);ga.debug(`locate document tags for ${n.uri.path} in project ${i}`);try{const s=new QM(
3921
- this.documents(i).toArray()).tags;ga.debug("Assigned colors to tags",{tagSpecs:s});const a=Ye(qse(n.parseResult.value),Wv(o=>wf(o)||rI(o)),O2(),oi(o=>{let c,l;try{wf(o)?(c=o.name,l=o.$cstNode):(c=o.tag.$refText,l=o.tag.$refNode);const u=s[c];return fr(u,`Tag ${c} not found in merged specification`),fr(l,`Tag ${c} does not have a $cstNode`),{name:c,color:u.color,range:l.range,isSpecification:wf(o)}}catch(u){return ga.warn(`Fail on tag ${c}`,{err:u}),[]}}));return ga.debug(`Found ${a.length} tags \
3922
+ me"):void 0;return s??=xv(i.$cstNode,"view"),s??=i.$cstNode,s?{uri:n.doc.uri.toString(),range:{start:s.range.start,end:s.range.start}}:null}async locateDocumentTags(e,r){const n=this.langiumDocuments.getDocument(e);if(!n||!Bi(n))return[];n.state<Ue.Validated&&(ga.debug(`Waiting for document ${n.uri.path} to be Validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(Ue.Validated,n.uri,r));const i=ar(n);ga.debug(`locate document tags for ${n.uri.path} in project ${i}`);try{const s=new YM(
3923
+ this.documents(i).toArray()).tags;ga.debug("Assigned colors to tags",{tagSpecs:s});const a=Ye(Bse(n.parseResult.value),Wv(o=>wf(o)||rI(o)),O2(),oi(o=>{let c,l;try{wf(o)?(c=o.name,l=o.$cstNode):(c=o.tag.$refText,l=o.tag.$refNode);const u=s[c];return yr(u,`Tag ${c} not found in merged specification`),yr(l,`Tag ${c} does not have a $cstNode`),{name:c,color:u.color,range:l.range,isSpecification:wf(o)}}catch(u){return ga.warn(`Fail on tag ${c}`,{err:u}),[]}}));return ga.debug(`Found ${a.length} tags \
3922
3924
  in document ${n.uri.path}`),a}catch(s){return ga.warn(Ve(s)),[]}}locateDynamicViewStep(e){const{doc:r,viewAst:n}=this.locateViewAst(e.view,e.projectId)??{};if(!r||!n)return null;if(!G0(n)||!n.body)return ga.warn(`View ${e.view} is not a dynamic view`),null;const i=this.services.workspace.AstNodeLocator.getAstNodePath(n.body)+e.astPath,s=this.services.workspace.AstNodeLocator.getAstNode(r.parseResult.value,i);if(!s||!Tm(s))return ga.warn(`Failed to locate dynamic view step ${i} in view ${e.view}`),
3923
- null;let a=s.kind?xs(s.$cstNode,"kind"):void 0;return a??=s.dotKind?xs(s.$cstNode,"dotKind"):void 0,a??=xv(s.$cstNode,"->"),a??=xv(s.$cstNode,"<-"),a??=xs(s.$cstNode,"title"),a??=xs(s.$cstNode,"target"),a??=s.$cstNode,a?{uri:r.uri.toString(),range:{start:a.range.start,end:a.range.start}}:null}}function e4(t){const e=t.match(/^[ \t]*(?=\S)/gm);if(!e)return t;let r=Number.POSITIVE_INFINITY;for(const n of e)r=Math.min(r,n.length);return r===0||r===Number.POSITIVE_INFINITY?t:t.replace(new RegExp(`^[\
3924
- \\t]{${r}}`,"gm"),"")}function Vk(t){const e=t.replace(/^(?:[ \t]*\r?\n)+|(?:\r?\n[ \t]*)+$/g,"");return e4(e)}const Mo=["this","it","self","super","likec4lib","global"];function Rt(t){return async function(e,r,n){try{const i=t(e,r,n);hU(i)&&await i;return}catch(i){const s=i instanceof Error?i.message:String(i);r("error",`Validation failed: ${s}`,{node:e}),Fe.debug(`Validation failed: ${s}`,{error:i})}}}const{getDocument:Hse}=ec,Bse=t=>{const e=t.likec4.DeploymentsIndex,r=t.references.NameProvider;
3925
- return Rt((n,i)=>{const s=r.getName(n);if(!s){i("error","DeploymentNode must be named",{node:n});return}const a=Dn(r.getNameNode(n),"name CstNode not found").range;Mo.includes(s)&&i("error",`Reserved word: ${s}`,{node:n,range:a});const o=ar(n),c=e.getFqn(n);e.byFqn(o,c).limit(2).toArray().length>1&&i("error",`Duplicate node name "${c}"`,{node:n,range:a})})},zse=t=>{const e=t.likec4.DeploymentsIndex,r=t.references.NameProvider;return Rt((n,i)=>{const s=r.getName(n);if(!s){i("error","Deployed inst\
3926
- ance must be named, unique inside node",{node:n});return}const a=Dn(r.getNameNode(n),"name CstNode not found").range;Mo.includes(s)&&i("error",`Reserved word: ${s}`,{node:n,range:a});const o=ar(n),c=e.getFqn(n);e.byFqn(o,c).limit(2).toArray().length>1&&i("error",`Duplicate instance name "${c}"`,{node:n,range:a})})},Use=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{if(!r.target?.value?.ref){let c=r.target?.$cstNode?.text??"";n("error",`DeploymentRelation target '${c}' not resolved`,{node:r,property:"\
3927
- target"});return}const i=Hse(r),s=e.forDocument(i);let a;try{a=s._resolveDeploymentRelationSource(r)}catch(c){Fe.warn(Ve(c)),n("error","DeploymentRelation source not resolved",{node:r,property:"source"});return}if(Dt.isImportRef(a)){n("error","DeploymentRelation cannot refer imported model (not implemented yet)",{node:r,property:"source"});return}if(Dt.isModelRef(a)){n("error","DeploymentRelation must refer deployment element",{node:r,property:"source"});return}const o=s.parseFqnRef(r.target);if(Dt.
3928
- isImportRef(o)){n("error","DeploymentRelation cannot refer imported model (not implemented yet)",{node:r,property:"target"});return}if(Dt.isModelRef(o)){n("error","DeploymentRelation must refer deployment element",{node:r,property:"target"});return}PS(a.deployment,o.deployment)&&n("error","Invalid parent-child relationship",{node:r})})},Vse=t=>Rt((e,r)=>{const n=e.deploymentNode.value.ref;(!n||!Kr(n))&&r("error","ExtendDeployment allows only DeploymentNode",{node:e,property:"deploymentNode"})}),
3929
- Wse=t=>{const e=t.likec4.FqnIndex;return Rt((r,n)=>{const i=ha(r.source),s=i&&e.getFqn(i);s||n("error","Source not found (not parsed/indexed yet)",{node:r,property:"source"});const a=ha(r.target),o=a&&e.getFqn(a);o||n("error","Target not found (not parsed/indexed yet)",{node:r,property:"target"}),s&&o&&(Bv(s,o)||Bv(o,s))&&n("error","Invalid parent-child relationship",{node:r})})},Gse=t=>{const e=t.likec4.FqnIndex;return Rt((r,n)=>{const i=r.source;Uf(i)&&i.isBackward&&n("error","Invalid chain af\
3930
- ter backward step",{node:r});const s=ha(r.target);s&&e.getFqn(s)||n("error","Target not found (not parsed/indexed yet)",{node:r,property:"target"})})},Kse=t=>Rt((e,r)=>{if(Pt(e.value)||e.value!=="diagram"&&e.value!=="sequence"){r("error",'Invalid display variant: "diagram" or "sequence" are allowed',{node:e,property:"value"});return}Xn(e,Zm)||r("error","Display mode can be defined only inside dynamic view",{node:e})}),{getDocument:Zse}=ec,Jse=t=>{const e=t.likec4.FqnIndex,r=t.workspace.AstNodeLocator;
3931
- return Rt((n,i)=>{const s=e.getFqn(n);if(!s){i("error","Not indexed element",{node:n,property:"name"});return}Mo.includes(n.name)&&i("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const a=Zse(n),o=a.uri,c=r.getAstNodePath(n),l=e.byFqn(ar(a),s).filter(u=>u.documentUri!==o||u.path!==c).head();if(l){const u=l.documentUri!==o;i("error",`Duplicate element name ${n.name!==s?n.name+" ("+s+")":n.name}`,{node:n,property:"name",...u&&{relatedInformation:[{location:{range:l.nameSegment?.range??
3932
- l.selectionSegment?.range,uri:l.documentUri.toString()},message:"conflicting element"}]}})}})},Yse=t=>Rt((e,r)=>{Mre(e.modelElement)&&r("error","Only model elements allowed here",{node:e,property:"modelElement"})}),{getDocument:Xse}=ec,Qse=t=>{const e=t.shared.workspace.ProjectsManager;return Rt((r,n)=>{const i=Xse(r),s=ar(i);if(r.project===s){n("error","Imported project cannot be the same as the current project",{node:r,property:"project"});return}if(!e.all.includes(r.project)){n("error","Impor\
3933
- ted project not found",{node:r,property:"project"});return}})},eae=t=>Rt((e,r)=>{const n=parseFloat(e.value);(isNaN(n)||n<0||n>100)&&r("warning","Value ignored, must be between 0% and 100%",{node:e,property:"value"})}),tae=t=>(e,r)=>{const n=e.$container;n.props.some(i=>go(i)&&i!==e)&&r("error","Icon must be defined once",{node:e}),Ad(n)&&Xm(n.$container)&&n.$container.props.some(i=>go(i))&&r("warning","Redundant as icon defined on element",{node:e}),e.value?.startsWith("file://")&&r("error","Ic\
3934
- on URI must not start with file://",{node:e,property:"value"})},rae=t=>(e,r)=>{Xn(e,Tm)||r("error","Notes can be defined only inside dynamic view",{node:e})},nae=t=>(e,r)=>{if(e.$type==="HexColor"){if(e.hex===void 0||Zs(e.hex)&&!e.hex.match(/^[a-fA-F0-9]+$/)){r("error","Invalid HEX",{node:e,property:"hex"});return}const n=Di(e.hex)?e.hex.toString().length:e.hex.length;n!==6&&n!==3&&n!==8&&r("error",`Invalid value "${e.$cstNode?.text}", must be 3, 6 or 8 characters long`,{node:e,property:"hex"});
3925
+ null;let a=s.kind?xs(s.$cstNode,"kind"):void 0;return a??=s.dotKind?xs(s.$cstNode,"dotKind"):void 0,a??=xv(s.$cstNode,"->"),a??=xv(s.$cstNode,"<-"),a??=xs(s.$cstNode,"title"),a??=xs(s.$cstNode,"target"),a??=s.$cstNode,a?{uri:r.uri.toString(),range:{start:a.range.start,end:a.range.start}}:null}}function XM(t){const e=t.match(/^[ \t]*(?=\S)/gm);if(!e)return t;let r=Number.POSITIVE_INFINITY;for(const n of e)r=Math.min(r,n.length);return r===0||r===Number.POSITIVE_INFINITY?t:t.replace(new RegExp(`^[\
3926
+ \\t]{${r}}`,"gm"),"")}function Uk(t){const e=t.replace(/^(?:[ \t]*\r?\n)+|(?:\r?\n[ \t]*)+$/g,"");return XM(e)}const Mo=["this","it","self","super","likec4lib","global"];function Rt(t){return async function(e,r,n){try{const i=t(e,r,n);hU(i)&&await i;return}catch(i){const s=i instanceof Error?i.message:String(i);r("error",`Validation failed: ${s}`,{node:e}),Fe.debug(`Validation failed: ${s}`,{error:i})}}}const{getDocument:Use}=ec,Vse=t=>{const e=t.likec4.DeploymentsIndex,r=t.references.NameProvider;
3927
+ return Rt((n,i)=>{const s=r.getName(n);if(!s){i("error","DeploymentNode must be named",{node:n});return}const a=Dn(r.getNameNode(n),"name CstNode not found").range;Mo.includes(s)&&i("error",`Reserved word: ${s}`,{node:n,range:a});const o=ar(n),c=e.getFqn(n);e.byFqn(o,c).limit(2).toArray().length>1&&i("error",`Duplicate node name "${c}"`,{node:n,range:a})})},Wse=t=>{const e=t.likec4.DeploymentsIndex,r=t.references.NameProvider;return Rt((n,i)=>{const s=r.getName(n);if(!s){i("error","Deployed inst\
3928
+ ance must be named, unique inside node",{node:n});return}const a=Dn(r.getNameNode(n),"name CstNode not found").range;Mo.includes(s)&&i("error",`Reserved word: ${s}`,{node:n,range:a});const o=ar(n),c=e.getFqn(n);e.byFqn(o,c).limit(2).toArray().length>1&&i("error",`Duplicate instance name "${c}"`,{node:n,range:a})})},Gse=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{if(!r.target?.value?.ref){let c=r.target?.$cstNode?.text??"";n("error",`DeploymentRelation target '${c}' not resolved`,{node:r,property:"\
3929
+ target"});return}const i=Use(r),s=e.forDocument(i);let a;try{a=s._resolveDeploymentRelationSource(r)}catch(c){Fe.warn(Ve(c)),n("error","DeploymentRelation source not resolved",{node:r,property:"source"});return}if(Dt.isImportRef(a)){n("error","DeploymentRelation cannot refer imported model (not implemented yet)",{node:r,property:"source"});return}if(Dt.isModelRef(a)){n("error","DeploymentRelation must refer deployment element",{node:r,property:"source"});return}const o=s.parseFqnRef(r.target);if(Dt.
3930
+ isImportRef(o)){n("error","DeploymentRelation cannot refer imported model (not implemented yet)",{node:r,property:"target"});return}if(Dt.isModelRef(o)){n("error","DeploymentRelation must refer deployment element",{node:r,property:"target"});return}PS(a.deployment,o.deployment)&&n("error","Invalid parent-child relationship",{node:r})})},Kse=t=>Rt((e,r)=>{const n=e.deploymentNode.value.ref;(!n||!Kr(n))&&r("error","ExtendDeployment allows only DeploymentNode",{node:e,property:"deploymentNode"})}),
3931
+ Zse=t=>{const e=t.likec4.FqnIndex;return Rt((r,n)=>{const i=ha(r.source),s=i&&e.getFqn(i);s||n("error","Source not found (not parsed/indexed yet)",{node:r,property:"source"});const a=ha(r.target),o=a&&e.getFqn(a);o||n("error","Target not found (not parsed/indexed yet)",{node:r,property:"target"}),s&&o&&(Bv(s,o)||Bv(o,s))&&n("error","Invalid parent-child relationship",{node:r})})},Jse=t=>{const e=t.likec4.FqnIndex;return Rt((r,n)=>{const i=r.source;Uf(i)&&i.isBackward&&n("error","Invalid chain af\
3932
+ ter backward step",{node:r});const s=ha(r.target);s&&e.getFqn(s)||n("error","Target not found (not parsed/indexed yet)",{node:r,property:"target"})})},Yse=t=>Rt((e,r)=>{if(Pt(e.value)||e.value!=="diagram"&&e.value!=="sequence"){r("error",'Invalid display variant: "diagram" or "sequence" are allowed',{node:e,property:"value"});return}Xn(e,Zm)||r("error","Display mode can be defined only inside dynamic view",{node:e})}),{getDocument:Xse}=ec,Qse=t=>{const e=t.likec4.FqnIndex,r=t.workspace.AstNodeLocator;
3933
+ return Rt((n,i)=>{const s=e.getFqn(n);if(!s){i("error","Not indexed element",{node:n,property:"name"});return}Mo.includes(n.name)&&i("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const a=Xse(n),o=a.uri,c=r.getAstNodePath(n),l=e.byFqn(ar(a),s).filter(u=>u.documentUri!==o||u.path!==c).head();if(l){const u=l.documentUri!==o;i("error",`Duplicate element name ${n.name!==s?n.name+" ("+s+")":n.name}`,{node:n,property:"name",...u&&{relatedInformation:[{location:{range:l.nameSegment?.range??
3934
+ l.selectionSegment?.range,uri:l.documentUri.toString()},message:"conflicting element"}]}})}})},eae=t=>Rt((e,r)=>{Fre(e.modelElement)&&r("error","Only model elements allowed here",{node:e,property:"modelElement"})}),{getDocument:tae}=ec,rae=t=>{const e=t.shared.workspace.ProjectsManager;return Rt((r,n)=>{const i=tae(r),s=ar(i);if(r.project===s){n("error","Imported project cannot be the same as the current project",{node:r,property:"project"});return}if(!e.all.includes(r.project)){n("error","Impor\
3935
+ ted project not found",{node:r,property:"project"});return}})},nae=t=>Rt((e,r)=>{const n=parseFloat(e.value);(isNaN(n)||n<0||n>100)&&r("warning","Value ignored, must be between 0% and 100%",{node:e,property:"value"})}),iae=t=>(e,r)=>{const n=e.$container;n.props.some(i=>go(i)&&i!==e)&&r("error","Icon must be defined once",{node:e}),Ad(n)&&Xm(n.$container)&&n.$container.props.some(i=>go(i))&&r("warning","Redundant as icon defined on element",{node:e}),e.value?.startsWith("file://")&&r("error","Ic\
3936
+ on URI must not start with file://",{node:e,property:"value"})},sae=t=>(e,r)=>{Xn(e,Tm)||r("error","Notes can be defined only inside dynamic view",{node:e})},aae=t=>(e,r)=>{if(e.$type==="HexColor"){if(e.hex===void 0||Zs(e.hex)&&!e.hex.match(/^[a-fA-F0-9]+$/)){r("error","Invalid HEX",{node:e,property:"hex"});return}const n=Di(e.hex)?e.hex.toString().length:e.hex.length;n!==6&&n!==3&&n!==8&&r("error",`Invalid value "${e.$cstNode?.text}", must be 3, 6 or 8 characters long`,{node:e,property:"hex"});
3935
3937
  return}if(e.$type==="RGBAColor"){if((!Di(e.red)||e.red<0||e.red>255)&&r("error","Invalid value, must be between 0 and 255",{node:e,property:"red"}),(!Di(e.green)||e.green<0||e.green>255)&&r("error","Invalid value, must be between 0 and 255",{node:e,property:"green"}),(!Di(e.blue)||e.blue<0||e.blue>255)&&r("error","Invalid value, must be between 0 and 255",{node:e,property:"blue"}),Di(e.alpha)&&(e.alpha<0||e.alpha>1)&&r("error","Invalid value, must be between 0 and 1",{node:e,property:"alpha"}),Zs(
3936
- e.alpha)){const n=parseFloat(e.alpha);(n<0||n>100)&&r("error","Invalid value, must be between 0% and 100%",{node:e,property:"alpha"})}return}lt(e)};let t4=null,r4=null;const iae=t=>t.map(e=>{const r=(e.c4Relations??[]).map(n=>Ui("extend-relation",Dt.flatten(n.source),Dt.flatten(n.target),n.kind??"default",n.title??"")).sort().join(",");return`${e.uri.toString()}:${r}`}).join("|"),sae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=e.forDocument(bt(r)),s=Dy(()=>i._resolveRelationSource(
3938
+ e.alpha)){const n=parseFloat(e.alpha);(n<0||n>100)&&r("error","Invalid value, must be between 0% and 100%",{node:e,property:"alpha"})}return}lt(e)};let QM=null,e4=null;const oae=t=>t.map(e=>{const r=(e.c4Relations??[]).map(n=>Ui("extend-relation",Dt.flatten(n.source),Dt.flatten(n.target),n.kind??"default",n.title??"")).sort().join(",");return`${e.uri.toString()}:${r}`}).join("|"),cae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=e.forDocument(bt(r)),s=Dy(()=>i._resolveRelationSource(
3937
3939
  r));if(!s){n("error","Source not resolved",{node:r,property:"source"});return}const a=Dy(()=>i.parseFqnRef(r.target));if(!a){n("error","Target not resolved",{node:r,property:"target"});return}Dt.isImportRef(s)&&(Dt.isImportRef(a)?n("warning","Relationship between imported elements may not be visible in origin projects",{node:r}):n("warning","Relationship from imported element to local element may not be visible in origin project",{node:r,property:"source"})),PS(Dt.flatten(s),Dt.flatten(a))&&n("e\
3938
- rror","Invalid parent-child relationship",{node:r})})},aae=t=>Rt((e,r)=>{e.$container.tags?.values&&e.tags?.values&&r("error","Relation cannot have tags in both header and body",{node:e.tags})}),oae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=e.forDocument(bt(r)),s=Dy(()=>i.parseFqnRef(r.source));if(!s){n("error","Source not resolved",{node:r,property:"source"});return}const a=Dy(()=>i.parseFqnRef(r.target));if(!a){n("error","Target not resolved",{node:r,property:"target"});return}
3939
- if(!Dt.isModelRef(s)&&!Dt.isImportRef(s)){n("error","Source must reference a model element",{node:r,property:"source"});return}if(!Dt.isModelRef(a)&&!Dt.isImportRef(a)){n("error","Target must reference a model element",{node:r,property:"target"});return}const o=(r.kind??r.dotKind?.kind)?.ref?.name??"default",{title:c=""}=i.parseBaseProps({},{title:r.title}),l=Ui("extend-relation",Dt.flatten(s),Dt.flatten(a),o,c),u=t.shared.workspace.LangiumDocuments.all.toArray().filter(Ite),d=iae(u);if(d!==r4){
3940
- const f=new Set;for(const p of u)for(const w of p.c4Relations??[]){const g=Ui("extend-relation",Dt.flatten(w.source),Dt.flatten(w.target),w.kind??"default",w.title??"");f.add(g)}t4=f,r4=d}(t4?.has(l)??!1)||n("warning","This extend does not match any relation (by source, kind, target, title)",{node:r})})},cae=t=>Rt((e,r)=>{e.$containerIndex&&e.$containerIndex>0&&r("warning","Prefer one specification per document",{node:e,property:"name"})}),lae=t=>Rt((e,r)=>{e.$containerIndex&&e.$containerIndex>0&&
3941
- r("warning","Prefer one model per document",{node:e,property:"name"})}),uae=t=>Rt((e,r)=>{e.$containerIndex&&e.$containerIndex>0&&r("warning","Prefer one global block per document",{node:e,property:"name"})}),dae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const i=ar(r),s=e.projectElements(i,bs).filter(a=>a.name===r.name&&a.node!==r).head();if(s){const a=s.documentUri!==bt(r).uri;n("error",`Dupl\
3942
- icate element kind '${r.name}'`,{node:r,property:"name",...a&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}})},fae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const i=ar(r),s=e.projectElements(i,ws).filter(a=>a.name===r.name&&a.node!==r).head();if(s){const a=s.documentUri!==bt(r).uri;n("error",`Duplicate deploymentN\
3943
- ode kind '${r.name}'`,{node:r,property:"name",...a&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}})},pae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=r.name,s=ar(r),a=e.projectElements(s,ta).filter(o=>o.name===i&&o.node!==r).head();if(a){const o=a.documentUri!==bt(r).uri;n("error",`Duplicate tag '${r.name}'`,{node:r,property:"name",...o&&{relatedInformation:[{location:{range:a.nameSegment.range,
3944
- uri:a.documentUri.toString()},message:"conflicting definition"}]}})}})},hae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const i=ar(r);e.projectElements(i,ea).filter(s=>s.name===r.name).limit(2).count()>1&&n("error",`Duplicate RelationshipKind '${r.name}'`,{node:r,property:"name"})})},n4=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=ar(r),s=e.projectElements(i,Ac),a=e.projectElements(
3945
- i,Cc);s.concat(a).filter(o=>o.name===r.name).limit(2).count()>1&&n("error",`Duplicate GlobalPredicateGroup or GlobalDynamicPredicateGroup name '${r.name}'`,{node:r,property:"name"})})},mae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=ar(r);e.projectElements(i,jd).filter(s=>s.name===r.name).limit(2).count()>1&&n("error",`Duplicate GlobalStyleId name '${r.name}'`,{node:r,property:"name"})})},gae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=El(r.$cstNode,
3946
- ["BLOCK_COMMENT"]);if(i&&Av(i.text)&&n("warning","Migrate to the new manual layout snapshots (run LikeC4: Migrate manual layouts)",{node:r,range:i.range,code:"manual-layout-v1"}),!r.name)return;Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const s=ar(r);e.projectElements(s,co).filter(a=>a.name===r.name).limit(2).count()>1&&n("error",`Duplicate view '${r.name}'`,{node:r,property:"name"})})};function yae(t){const e=[];let r=t;for(;r;)r.value&&e.push(r.value),r=
3947
- r.prev;return e.reverse()}const vae=t=>Rt((e,r)=>{const n=yae(e.targets);n.length<2&&e.value==="same"&&r("warning","Rank rule should have at least 2 targets",{node:e,property:"targets"});const i=n.filter(ug),s=i[0]?.ref?.parent;for(let a=1;a<i.length;a++){const o=i[a];e.value==="same"&&!i4(s,o?.ref?.parent)&&r("error","All targets must have the same parent rank same",{node:e,property:"targets"})}});function i4(t,e){return!t&&!e?!0:!t||!e||t.value.ref!==e.value.ref?!1:i4(t.parent,e.parent)}const wae=t=>{
3940
+ rror","Invalid parent-child relationship",{node:r})})},lae=t=>Rt((e,r)=>{e.$container.tags?.values&&e.tags?.values&&r("error","Relation cannot have tags in both header and body",{node:e.tags})}),uae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=e.forDocument(bt(r)),s=Dy(()=>i.parseFqnRef(r.source));if(!s){n("error","Source not resolved",{node:r,property:"source"});return}const a=Dy(()=>i.parseFqnRef(r.target));if(!a){n("error","Target not resolved",{node:r,property:"target"});return}
3941
+ if(!Dt.isModelRef(s)&&!Dt.isImportRef(s)){n("error","Source must reference a model element",{node:r,property:"source"});return}if(!Dt.isModelRef(a)&&!Dt.isImportRef(a)){n("error","Target must reference a model element",{node:r,property:"target"});return}const o=(r.kind??r.dotKind?.kind)?.ref?.name??"default",{title:c=""}=i.parseBaseProps({},{title:r.title}),l=Ui("extend-relation",Dt.flatten(s),Dt.flatten(a),o,c),u=t.shared.workspace.LangiumDocuments.all.toArray().filter(Ote),d=oae(u);if(d!==e4){
3942
+ const f=new Set;for(const p of u)for(const w of p.c4Relations??[]){const g=Ui("extend-relation",Dt.flatten(w.source),Dt.flatten(w.target),w.kind??"default",w.title??"");f.add(g)}QM=f,e4=d}(QM?.has(l)??!1)||n("warning","This extend does not match any relation (by source, kind, target, title)",{node:r})})},dae=t=>Rt((e,r)=>{e.$containerIndex&&e.$containerIndex>0&&r("warning","Prefer one specification per document",{node:e,property:"name"})}),fae=t=>Rt((e,r)=>{e.$containerIndex&&e.$containerIndex>0&&
3943
+ r("warning","Prefer one model per document",{node:e,property:"name"})}),pae=t=>Rt((e,r)=>{e.$containerIndex&&e.$containerIndex>0&&r("warning","Prefer one global block per document",{node:e,property:"name"})}),hae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const i=ar(r),s=e.projectElements(i,bs).filter(a=>a.name===r.name&&a.node!==r).head();if(s){const a=s.documentUri!==bt(r).uri;n("error",`Dupl\
3944
+ icate element kind '${r.name}'`,{node:r,property:"name",...a&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}})},mae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const i=ar(r),s=e.projectElements(i,ws).filter(a=>a.name===r.name&&a.node!==r).head();if(s){const a=s.documentUri!==bt(r).uri;n("error",`Duplicate deploymentN\
3945
+ ode kind '${r.name}'`,{node:r,property:"name",...a&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}})},gae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=r.name,s=ar(r),a=e.projectElements(s,ta).filter(o=>o.name===i&&o.node!==r).head();if(a){const o=a.documentUri!==bt(r).uri;n("error",`Duplicate tag '${r.name}'`,{node:r,property:"name",...o&&{relatedInformation:[{location:{range:a.nameSegment.range,
3946
+ uri:a.documentUri.toString()},message:"conflicting definition"}]}})}})},yae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const i=ar(r);e.projectElements(i,ea).filter(s=>s.name===r.name).limit(2).count()>1&&n("error",`Duplicate RelationshipKind '${r.name}'`,{node:r,property:"name"})})},t4=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=ar(r),s=e.projectElements(i,Ac),a=e.projectElements(
3947
+ i,Cc);s.concat(a).filter(o=>o.name===r.name).limit(2).count()>1&&n("error",`Duplicate GlobalPredicateGroup or GlobalDynamicPredicateGroup name '${r.name}'`,{node:r,property:"name"})})},vae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=ar(r);e.projectElements(i,jd).filter(s=>s.name===r.name).limit(2).count()>1&&n("error",`Duplicate GlobalStyleId name '${r.name}'`,{node:r,property:"name"})})},wae=t=>{const e=t.shared.workspace.IndexManager;return Rt((r,n)=>{const i=El(r.$cstNode,
3948
+ ["BLOCK_COMMENT"]);if(i&&Av(i.text)&&n("warning","Migrate to the new manual layout snapshots (run LikeC4: Migrate manual layouts)",{node:r,range:i.range,code:"manual-layout-v1"}),!r.name)return;Mo.includes(r.name)&&n("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const s=ar(r);e.projectElements(s,co).filter(a=>a.name===r.name).limit(2).count()>1&&n("error",`Duplicate view '${r.name}'`,{node:r,property:"name"})})};function bae(t){const e=[];let r=t;for(;r;)r.value&&e.push(r.value),r=
3949
+ r.prev;return e.reverse()}const _ae=t=>Rt((e,r)=>{const n=bae(e.targets);n.length<2&&e.value==="same"&&r("warning","Rank rule should have at least 2 targets",{node:e,property:"targets"});const i=n.filter(ug),s=i[0]?.ref?.parent;for(let a=1;a<i.length;a++){const o=i[a];e.value==="same"&&!r4(s,o?.ref?.parent)&&r("error","All targets must have the same parent rank same",{node:e,property:"targets"})}});function r4(t,e){return!t&&!e?!0:!t||!e||t.value.ref!==e.value.ref?!1:r4(t.parent,e.parent)}const Rae=t=>{
3948
3950
  const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=Py(r);if(i?.$type!=="DynamicViewIncludePredicate"&&i?.isInclude!==!0){n("error",'Invalid usage inside "exclude"',{node:r});return}const s=i.$type==="DynamicViewIncludePredicate",a=e.forDocument(bt(i));let o=tn.unwrap(a.parseFqnExprWith(r).custom.expr);switch(!0){case(tn.isWildcard(o)&&s):case(tn.isElementKindExpr(o)&&s):case(tn.isElementTagExpr(o)&&s):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:r});return}case tn.
3949
- isWildcard(o):case tn.isModelRef(o):case tn.isDeploymentRef(o):return;case tn.isElementKindExpr(o):case tn.isElementTagExpr(o):n("error","Invalid target (expect reference to specific element)",{node:r,property:"subject"});return;default:js(o)}})},bae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=e.forDocument(bt(r)).parseFqnRefExpr(r),s=Py(r),a=Lte(r)&&!Xn(r,o=>_d(o)||Vc(o));if(s?.$type==="DeploymentViewRulePredicate"||a){if(!Xn(r,Im)){if(tn.isModelRef(i)){n("error","Deployment view\
3951
+ isWildcard(o):case tn.isModelRef(o):case tn.isDeploymentRef(o):return;case tn.isElementKindExpr(o):case tn.isElementTagExpr(o):n("error","Invalid target (expect reference to specific element)",{node:r,property:"subject"});return;default:js(o)}})},kae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=e.forDocument(bt(r)).parseFqnRefExpr(r),s=Py(r),a=qte(r)&&!Xn(r,o=>_d(o)||Vc(o));if(s?.$type==="DeploymentViewRulePredicate"||a){if(!Xn(r,Im)){if(tn.isModelRef(i)){n("error","Deployment view\
3950
3952
  predicate must reference deployment model",{node:r});return}if(tn.isDeploymentRef(i)&&Nr.isInsideInstanceRef(i.ref)){n("error","Must reference deployment nodes or instances, but not internals",{node:r});return}}be(r.selector)&&!Kr(r.ref.value?.ref)&&n("warning",`Selector '${r.selector}' applies to deployment nodes only, ignored here`,{node:r,property:"selector"});return}if(s?.$type==="DynamicViewIncludePredicate")switch(!0){case tn.isElementKindExpr(i):case tn.isElementTagExpr(i):case tn.isWildcard(
3951
- i):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:r});return}}})},_ae=t=>Rt((e,r)=>{if(e.to.$type==="WildcardExpression"&&!Wx(e.$container)){const n=hn(e,eg);Mt(n?.viewOf)&&r("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),Rae=t=>Rt((e,r)=>{if(Py(e)?.$type==="ViewRulePredicate"&&e.$container.$type!=="DirectedRelationExpr"&&e.from.$type==="WildcardExpression"){const n=hn(e,eg);n&&Mt(n.viewOf)&&r("warning","Predicate is ignored as it con\
3952
- cerns all relationships",{node:e})}}),kae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=hn(r,Ec);if(!i||i.isInclude!==!0)return;const s=bt(r),a=e.forDocument(s);let o=Mp.unwrap(a.parseRelationExpr(r));const c="Model reference is allowed in exclude predicate only";if(Mp.isDirect(o)){(zv.isModelRef(o.source)||zv.isModelRef(o.target))&&n("error",c,{node:r});return}let l;if(Mp.isIncoming(o)?l=o.incoming:Mp.isOutgoing(o)?l=o.outgoing:l=o.inout,zv.isModelRef(l)){n("error",c,{node:r});return}})},
3953
- Sae=t=>Rt((e,r)=>{const n=Py(e);if(!(!n||n.$type=="DynamicViewIncludePredicate")&&!n.isInclude){r("error",'Invalid usage inside "exclude"',{node:e});return}});class Eae extends RP{services;constructor(e){super(e),this.services=e}async validateDocument(e,r,n){return this.services.shared.workspace.ProjectsManager.isExcluded(e)?[]:await super.validateDocument(e,r,n)}}function Tae(t){return e=>t.some(r=>r(e))}const $ae=Tae([Hd,Li,n_,Md,Ld,Ic,mo,cg,c_,$x,Im,Z0,m_,Uf,PK,Ec,AK,Im,ug,DK,U0,nI,OK,O0,H0,V0,
3954
- un,Kr,ui,xx,K0,Oi,Mi,CK,Ix,vg,Ar,Y0,ho,Xs,Pc,Fc,Bc,jc,vf,Tg,eI,$K]),Pae=t=>{let e=t;for(;e&&!Gx(e);){if($ae(e))return e;e=e.$container}};function Cae(t){const e=t.state>=Ue.Validated?t.diagnostics?.filter(n=>n.severity===Ha.Error)??[]:[],r=new WeakSet;for(const{node:n}of e){if(Mt(n)||r.has(n))continue;r.add(n);const i=Pae(n);i&&r.add(i)}return{isValid:n=>!r.has(n),invalidNodes:r}}function Aae(t){Fe.debug("registerValidationChecks"),t.validation.ValidationRegistry.register({DeployedInstance:zse(t),
3955
- DeploymentNodeKind:fae(t),DeploymentNode:Bse(t),DeploymentRelation:Use(t),ExtendDeployment:Vse(),ExtendRelation:oae(t),FqnRefExpr:bae(t),RelationExpr:kae(t),NotesProperty:rae(),OpacityProperty:eae(),IconProperty:tae(),SpecificationRule:cae(),Model:lae(),Globals:uae(),GlobalPredicateGroup:n4(t),GlobalDynamicPredicateGroup:n4(t),GlobalStyleId:mae(t),DynamicStepSingle:Wse(t),DynamicStepChain:Gse(t),LikeC4View:gae(t),Element:Jse(t),ElementRef:Yse(),ElementKind:dae(t),Relation:sae(t),RelationBody:aae(),
3956
- Tag:pae(t),FqnExprWith:wae(t),RelationExprWith:Sae(),RelationshipKind:hae(t),IncomingRelationExpr:_ae(),OutgoingRelationExpr:Rae(),ImportsFromPoject:Qse(t),ColorLiteral:nae(),DynamicViewDisplayVariantProperty:Kse(),ViewRuleRank:vae()});const e=t.shared.lsp.Connection;e&&zS(()=>{t.shared.workspace.DocumentBuilder.onUpdate((r,n)=>{for(const i of n)Fe.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]}).catch(s=>Fe.error(Ve(s)))})})}const Iv=Fe.getChild(
3957
- "BaseParser");function jo(t){if(t==null)return;const e=gr(t);return Zs(e)?e.split(`
3953
+ i):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:r});return}}})},Sae=t=>Rt((e,r)=>{if(e.to.$type==="WildcardExpression"&&!Wx(e.$container)){const n=hn(e,eg);Mt(n?.viewOf)&&r("warning","Predicate is ignored as it concerns all relationships",{node:e})}}),Eae=t=>Rt((e,r)=>{if(Py(e)?.$type==="ViewRulePredicate"&&e.$container.$type!=="DirectedRelationExpr"&&e.from.$type==="WildcardExpression"){const n=hn(e,eg);n&&Mt(n.viewOf)&&r("warning","Predicate is ignored as it con\
3954
+ cerns all relationships",{node:e})}}),Tae=t=>{const e=t.likec4.ModelParser;return Rt((r,n)=>{const i=hn(r,Ec);if(!i||i.isInclude!==!0)return;const s=bt(r),a=e.forDocument(s);let o=Mp.unwrap(a.parseRelationExpr(r));const c="Model reference is allowed in exclude predicate only";if(Mp.isDirect(o)){(zv.isModelRef(o.source)||zv.isModelRef(o.target))&&n("error",c,{node:r});return}let l;if(Mp.isIncoming(o)?l=o.incoming:Mp.isOutgoing(o)?l=o.outgoing:l=o.inout,zv.isModelRef(l)){n("error",c,{node:r});return}})},
3955
+ $ae=t=>Rt((e,r)=>{const n=Py(e);if(!(!n||n.$type=="DynamicViewIncludePredicate")&&!n.isInclude){r("error",'Invalid usage inside "exclude"',{node:e});return}});class Pae extends RP{services;constructor(e){super(e),this.services=e}async validateDocument(e,r,n){return this.services.shared.workspace.ProjectsManager.isExcluded(e)?[]:await super.validateDocument(e,r,n)}}function Cae(t){return e=>t.some(r=>r(e))}const Aae=Cae([Hd,Li,n_,Md,Ld,Ic,mo,cg,c_,$x,Im,Z0,m_,Uf,PK,Ec,AK,Im,ug,DK,U0,nI,OK,O0,H0,V0,
3956
+ un,Kr,ui,xx,K0,Oi,Mi,CK,Ix,vg,Ar,Y0,ho,Xs,Pc,Fc,Bc,jc,vf,Tg,eI,$K]),xae=t=>{let e=t;for(;e&&!Gx(e);){if(Aae(e))return e;e=e.$container}};function Iae(t){const e=t.state>=Ue.Validated?t.diagnostics?.filter(n=>n.severity===Ha.Error)??[]:[],r=new WeakSet;for(const{node:n}of e){if(Mt(n)||r.has(n))continue;r.add(n);const i=xae(n);i&&r.add(i)}return{isValid:n=>!r.has(n),invalidNodes:r}}function Nae(t){Fe.debug("registerValidationChecks"),t.validation.ValidationRegistry.register({DeployedInstance:Wse(t),
3957
+ DeploymentNodeKind:mae(t),DeploymentNode:Vse(t),DeploymentRelation:Gse(t),ExtendDeployment:Kse(),ExtendRelation:uae(t),FqnRefExpr:kae(t),RelationExpr:Tae(t),NotesProperty:sae(),OpacityProperty:nae(),IconProperty:iae(),SpecificationRule:dae(),Model:fae(),Globals:pae(),GlobalPredicateGroup:t4(t),GlobalDynamicPredicateGroup:t4(t),GlobalStyleId:vae(t),DynamicStepSingle:Zse(t),DynamicStepChain:Jse(t),LikeC4View:wae(t),Element:Qse(t),ElementRef:eae(),ElementKind:hae(t),Relation:cae(t),RelationBody:lae(),
3958
+ Tag:gae(t),FqnExprWith:Rae(t),RelationExprWith:$ae(),RelationshipKind:yae(t),IncomingRelationExpr:Sae(),OutgoingRelationExpr:Eae(),ImportsFromPoject:rae(t),ColorLiteral:aae(),DynamicViewDisplayVariantProperty:Yse(),ViewRuleRank:_ae()});const e=t.shared.lsp.Connection;e&&zS(()=>{t.shared.workspace.DocumentBuilder.onUpdate((r,n)=>{for(const i of n)Fe.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]}).catch(s=>Fe.error(Ve(s)))})})}const Iv=Fe.getChild(
3959
+ "BaseParser");function jo(t){if(t==null)return;const e=mr(t);return Zs(e)?e.split(`
3958
3960
  `).join(" "):"md"in e?{md:e.md.split(`
3959
3961
  `).join(" ")}:{txt:e.txt.split(`
3960
- `).join(" ")}}function gr(t){if(t!=null)switch(!0){case Zs(t):return Vk(t).trim();case(gg(t)&&be(t.markdown)):return{md:Vk(t.markdown).trim()};case(gg(t)&&be(t.text)):return{txt:Vk(t.text).trim()};default:return}}class xae{services;doc;isValid;constructor(e,r){this.services=e,this.doc=r,this.isValid=Cae(r).isValid}get project(){return d2(this,"project",()=>this.services.shared.workspace.ProjectsManager.getProject(this.doc))}resolveFqn(e){if(Li(e)){const r=ar(e),n=this.resolveFqn(Dn(e.imported.ref,
3961
- `FqnRef is empty of imported: ${e.$cstNode?.text}`));return this.doc.c4Imports.set(r,n),f2(r,n)}return ho(e)?Io(e.element):Xs(e)?Io(e.deploymentNode):km(e)?this.services.likec4.DeploymentsIndex.getFqn(e):this.services.likec4.FqnIndex.getFqn(e)}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){if(!e||!this.isValid(e)||Pt(e.props))return;const r=a=>{if(gg(a)){const o=gr(a);if(!o)return[];if(typeof o=="string")return be(o)?[o]:[];{const c=o.md||o.txt;return be(
3962
- c)?[c]:[]}}else if(JK(a))return a.values.map(o=>gr(o)).map(o=>typeof o=="string"?o:o.md||o.txt).filter(be);return[]},n=Ye(e.props,oi(a=>r(a.value).map(o=>[a.key,o])),Qe(([a,o])=>be(o)));if(Pt(n))return;const i=Ye(n,Vo(([a])=>a),Zo(a=>a.map(([o,c])=>c))),s={};for(const[a,o]of Object.entries(i))o&&o.length>0&&(s[a]=o.length===1?o[0]:o);return Pt(s)?void 0:s}parseMarkdownOrString(e){if(gg(e))return gr(e)}convertTags(e){return this.parseTags(e)}parseTags(e){let r=e?.tags;if(!r)return null;let n=[];for(;r;){
3962
+ `).join(" ")}}function mr(t){if(t!=null)switch(!0){case Zs(t):return Uk(t).trim();case(gg(t)&&be(t.markdown)):return{md:Uk(t.markdown).trim()};case(gg(t)&&be(t.text)):return{txt:Uk(t.text).trim()};default:return}}class Dae{services;doc;isValid;constructor(e,r){this.services=e,this.doc=r,this.isValid=Iae(r).isValid}get project(){return d2(this,"project",()=>this.services.shared.workspace.ProjectsManager.getProject(this.doc))}resolveFqn(e){if(Li(e)){const r=ar(e),n=this.resolveFqn(Dn(e.imported.ref,
3963
+ `FqnRef is empty of imported: ${e.$cstNode?.text}`));return this.doc.c4Imports.set(r,n),f2(r,n)}return ho(e)?Io(e.element):Xs(e)?Io(e.deploymentNode):km(e)?this.services.likec4.DeploymentsIndex.getFqn(e):this.services.likec4.FqnIndex.getFqn(e)}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){if(!e||!this.isValid(e)||Pt(e.props))return;const r=a=>{if(gg(a)){const o=mr(a);if(!o)return[];if(typeof o=="string")return be(o)?[o]:[];{const c=o.md||o.txt;return be(
3964
+ c)?[c]:[]}}else if(JK(a))return a.values.map(o=>mr(o)).map(o=>typeof o=="string"?o:o.md||o.txt).filter(be);return[]},n=Ye(e.props,oi(a=>r(a.value).map(o=>[a.key,o])),Qe(([a,o])=>be(o)));if(Pt(n))return;const i=Ye(n,Vo(([a])=>a),Zo(a=>a.map(([o,c])=>c))),s={};for(const[a,o]of Object.entries(i))o&&o.length>0&&(s[a]=o.length===1?o[0]:o);return Pt(s)?void 0:s}parseMarkdownOrString(e){if(gg(e))return mr(e)}convertTags(e){return this.parseTags(e)}parseTags(e){let r=e?.tags;if(!r)return null;let n=[];for(;r;){
3963
3965
  try{if(this.isValid(r)){const i=r.values.map(s=>s.tag.ref?.name).filter(be);i.length>0&&n.push(...i)}}catch{}r=r.prev}return kr(n)?as(n):null}convertLinks(e){return this.parseLinks(e)}parseLinks(e){if(!(!e?.props||e.props.length===0))return Ye(e.props,Qe(Gd),oi(r=>{if(!this.isValid(r))return[];const n=r.value;if(be(n)){const i=be(r.title)?jo(r.title):void 0,s=this.services.lsp.DocumentLinkProvider.relativeLink(this.doc,n);return{url:n,...i&&{title:i},...s&&s!==n&&{relative:s}}}return[]}))}parseIconProperty(e){
3964
- if(!e||!this.isValid(e))return;const{libicon:r,value:n}=e;switch(!0){case!!r:return Dn(r.ref,`Library icon ${r.$refText} has empty ref`).name;case(n&&n==="none"):return n;case(n&&dl(n)):{if(n.startsWith("file:")){Iv.warn(`Icon property '${n}' used the 'file' protocol which is not supported`);return}return n}case(n&&n.startsWith("@")):return this.parseImageAlias(n);case(n&&pk(n)):return fl(this.doc.uri.toString(),"../",n);case(n&&mp(n)):return Iy(this.project.folderUri.toString(),n);default:{Iv.warn(
3966
+ if(!e||!this.isValid(e))return;const{libicon:r,value:n}=e;switch(!0){case!!r:return Dn(r.ref,`Library icon ${r.$refText} has empty ref`).name;case(n&&n==="none"):return n;case(n&&dl(n)):{if(n.startsWith("file:")){Iv.warn(`Icon property '${n}' used the 'file' protocol which is not supported`);return}return n}case(n&&n.startsWith("@")):return this.parseImageAlias(n);case(n&&fk(n)):return fl(this.doc.uri.toString(),"../",n);case(n&&mp(n)):return Iy(this.project.folderUri.toString(),n);default:{Iv.warn(
3965
3967
  `Icon property '${n}' is not a valid URL, library icon, image alias or 'none'`);return}}}parseImageAlias(e){const r=e.indexOf("/"),n=r>0?e.substring(0,r):e,i=r>0?e.substring(r+1):"",s={"@":"./images",...this.project.config.imageAliases}[n];if(!s){Iv.warn(`Image alias "${n}" not found in project configuration`);return}const a=i?Iy(s,i):s;return Iy(this.project.folderUri.toString(),a)}parseColorLiteral(e){if(this.isValid(e)){if(WK(e))return`#${e.hex}`;if(t7(e)){let r=Di(e.alpha)?e.alpha:void 0;return Zs(
3966
- e.alpha)&&(r=gO(e.alpha)/100),r!==void 0?`rgba(${e.red},${e.green},${e.blue},${r})`:`rgb(${e.red},${e.green},${e.blue})`}lt(e)}}parseElementStyle(e){if(!e)return{};if(pU(e)){const r=this.parseStyleProps(e.find(Ad)?.props);try{const n=this.parseIconProperty(e.find(go));n&&(r.icon=n)}catch(n){Iv.warn("Failed to parse icon property on element",{err:n})}return r}return this.parseStyleProps(e.props)}parseStyleProps(e){const r={};if(!e||e.length===0)return r;for(const n of e)if(this.isValid(n))switch(!0){case Fm(
3967
- n):{be(n.value)&&(r.border=n.value);break}case uo(n):{const i=hp(n);be(i)&&(r.color=i);break}case Sg(n):{be(n.value)&&(r.shape=n.value);break}case go(n):{const i=this.parseIconProperty(n);be(i)&&(r.icon=i);break}case wg(n):{r.opacity=yO(n);break}case i_(n):{r.multiple=eC(n.value)?n.value:!1;break}case l_(n):{be(n.value)&&(r.size=ll(n));break}case a_(n):{be(n.value)&&(r.padding=ll(n));break}case d_(n):{be(n.value)&&(r.textSize=ll(n));break}default:lt(n)}return Ko(r)}parseBaseProps(e,r){const n=gr(
3968
- r?.title??zi(e.title)),i=r?.description?{txt:gr(r.description)}:this.parseMarkdownOrString(e.description),s=r?.summary?{txt:gr(r.summary)}:this.parseMarkdownOrString(e.summary),a=jo(r?.technology)??gr(zi(e.technology));return Ko({title:n,summary:s,description:i,technology:a})}}const Iae=Fe.getChild("DeploymentModelParser");function*Nae(t){const e=CS.from(t.parseResult.value.deployments.flatMap(i=>i.elements)),r=[];let n;for(;n=e.shift();){if(ui(n)){r.push(n);continue}if(n.body&&n.body.elements.length>
3969
- 0)for(const i of n.body.elements)e.push(i);yield n}yield*r}function Dae(t){return class extends t{parseDeployment(){const e=this.doc;for(const r of Nae(e))try{switch(!0){case ui(r):{this.isValid(r)&&e.c4DeploymentRelations.push(this.parseDeploymentRelation(r));break}case un(r):e.c4Deployments.push(this.parseDeployedInstance(r));break;case Kr(r):{e.c4Deployments.push(this.parseDeploymentNode(r));break}case Xs(r):{const n=this.parseExtendDeployment(r);n&&e.c4ExtendDeployments.push(n);break}default:
3970
- lt(r)}}catch(n){Iae.warn(Ve(n))}}parseDeploymentNode(e){const r=this.isValid,n=this.resolveFqn(e),i=Dn(e.kind.ref,"DeploymentKind not resolved").name,s=this.convertTags(e.body),a=this.parseElementStyle(e.body?.props),o=this.getMetadata(e.body?.props.find(Oi)),c=Ye(e.body?.props??[],Qe(r),Qe(Pd),zn(f=>[f.key,f.value])),{title:l,...u}=this.parseBaseProps(c,{title:e.title,summary:e.summary}),d=this.convertLinks(e.body);return Ko({id:n,kind:i,title:l??p2(n),...u,tags:s??void 0,...d&&kr(d)&&{links:d},
3968
+ e.alpha)&&(r=hO(e.alpha)/100),r!==void 0?`rgba(${e.red},${e.green},${e.blue},${r})`:`rgb(${e.red},${e.green},${e.blue})`}lt(e)}}parseElementStyle(e){if(!e)return{};if(pU(e)){const r=this.parseStyleProps(e.find(Ad)?.props);try{const n=this.parseIconProperty(e.find(go));n&&(r.icon=n)}catch(n){Iv.warn("Failed to parse icon property on element",{err:n})}return r}return this.parseStyleProps(e.props)}parseStyleProps(e){const r={};if(!e||e.length===0)return r;for(const n of e)if(this.isValid(n))switch(!0){case Fm(
3969
+ n):{be(n.value)&&(r.border=n.value);break}case uo(n):{const i=hp(n);be(i)&&(r.color=i);break}case Sg(n):{be(n.value)&&(r.shape=n.value);break}case go(n):{const i=this.parseIconProperty(n);be(i)&&(r.icon=i);break}case wg(n):{r.opacity=mO(n);break}case i_(n):{r.multiple=eC(n.value)?n.value:!1;break}case l_(n):{be(n.value)&&(r.size=ll(n));break}case a_(n):{be(n.value)&&(r.padding=ll(n));break}case d_(n):{be(n.value)&&(r.textSize=ll(n));break}default:lt(n)}return Ko(r)}parseBaseProps(e,r){const n=mr(
3970
+ r?.title??zi(e.title)),i=r?.description?{txt:mr(r.description)}:this.parseMarkdownOrString(e.description),s=r?.summary?{txt:mr(r.summary)}:this.parseMarkdownOrString(e.summary),a=jo(r?.technology)??mr(zi(e.technology));return Ko({title:n,summary:s,description:i,technology:a})}}const Oae=Fe.getChild("DeploymentModelParser");function*Lae(t){const e=CS.from(t.parseResult.value.deployments.flatMap(i=>i.elements)),r=[];let n;for(;n=e.shift();){if(ui(n)){r.push(n);continue}if(n.body&&n.body.elements.length>
3971
+ 0)for(const i of n.body.elements)e.push(i);yield n}yield*r}function Mae(t){return class extends t{parseDeployment(){const e=this.doc;for(const r of Lae(e))try{switch(!0){case ui(r):{this.isValid(r)&&e.c4DeploymentRelations.push(this.parseDeploymentRelation(r));break}case un(r):e.c4Deployments.push(this.parseDeployedInstance(r));break;case Kr(r):{e.c4Deployments.push(this.parseDeploymentNode(r));break}case Xs(r):{const n=this.parseExtendDeployment(r);n&&e.c4ExtendDeployments.push(n);break}default:
3972
+ lt(r)}}catch(n){Oae.warn(Ve(n))}}parseDeploymentNode(e){const r=this.isValid,n=this.resolveFqn(e),i=Dn(e.kind.ref,"DeploymentKind not resolved").name,s=this.convertTags(e.body),a=this.parseElementStyle(e.body?.props),o=this.getMetadata(e.body?.props.find(Oi)),c=Ye(e.body?.props??[],Qe(r),Qe(Pd),zn(f=>[f.key,f.value])),{title:l,...u}=this.parseBaseProps(c,{title:e.title,summary:e.summary}),d=this.convertLinks(e.body);return Ko({id:n,kind:i,title:l??p2(n),...u,tags:s??void 0,...d&&kr(d)&&{links:d},
3971
3973
  style:a,metadata:o})}parseDeployedInstance(e){const r=this.isValid,n=this.resolveFqn(e),i=this.parseFqnRef(e.target.modelElement);ze(Dt.isModelRef(i)||Dt.isImportRef(i),"Target must be a model reference");const s=this.convertTags(e.body),a=this.parseElementStyle(e.body?.props),o=this.getMetadata(e.body?.props.find(Oi)),c=Ye(e.body?.props??[],Qe(r),Qe(Pd),zn(d=>[d.key,d.value])),l=this.parseBaseProps(c,{title:e.title,summary:e.summary}),u=this.convertLinks(e.body);return Ko({id:n,element:i,tags:s??
3972
3974
  void 0,...u&&kr(u)&&{links:u},...l,style:a,metadata:o})}parseExtendDeployment(e){if(!this.isValid(e))return null;const r=this.resolveFqn(e),n=this.parseTags(e.body),i=this.getMetadata(e.body?.props.find(Oi)),s=this.getAstNodePath(e),a=this.parseLinks(e.body)??[];return!n&&Pt(i??{})&&Pt(a)?null:{id:r,astPath:s,...i&&{metadata:i},tags:n,links:kr(a)?a:null}}_resolveDeploymentRelationSource(e){if(Pr(e.source))return this.parseFqnRef(e.source);if(e.$container.$type==="DeploymentNodeBody"||e.$container.
3973
3975
  $type==="DeployedInstanceBody")return{deployment:this.resolveFqn(e.$container.$container)};throw new Error("RelationRefError: Invalid container for sourceless relation")}parseDeploymentRelation(e){const r=this.isValid,n=this.getAstNodePath(e),i=this._resolveDeploymentRelationSource(e);ze(Dt.isDeploymentRef(i),"Invalid source for deployment relation");const s=this.parseFqnRef(e.target);ze(Dt.isDeploymentRef(s),"Invalid target for deployment relation");const a=this.convertTags(e)??this.convertTags(
3974
- e.body),o=this.convertLinks(e.body),c=(e.kind??e.dotKind?.kind)?.ref?.name,l=this.getMetadata(e.body?.props.find(Oi)),u=Ye(e.body?.props??[],Qe(df),Qe(g=>be(g.value)),zn(g=>[g.key,g.value])),d=Ye(e.body?.props??[],Qe(lf),wc())?.value.view.ref?.name,f=this.parseBaseProps(u,{title:e.title}),p=e.body?.props.find(kg),w=Ui("deployment",n,i.deployment,s.deployment);return Ko({id:w,source:i,target:s,...f,metadata:l,kind:c,tags:a??void 0,...kr(o)&&{links:o},...XR(p?.props,r),navigateTo:d,astPath:n})}}}function Oae(t){
3975
- return class extends t{parseDeploymentView(e){const r=e.body;ze(r,"DynamicElementView body is not defined");const n=r.props.filter(this.isValid),i=this.getAstNodePath(e);let s=e.name;s||(s="deployment_"+Ui(this.doc.uri.toString(),i));const{title:a=null,description:o=null}=this.parseBaseProps(Ye(n,Qe(xg),zn(d=>[d.key,d.value]))),c=this.convertTags(r),l=this.convertLinks(r);Ty.writeId(e,s);const u=Uk(e);return{[Go._type]:"deployment",id:s,astPath:i,title:jo(a)??null,description:o,tags:c,links:kr(l)?
3976
- l:null,rules:r.rules.flatMap(d=>{try{return this.isValid(d)?this.parseDeploymentViewRule(d):[]}catch(f){return nt(f),[]}}),...u&&{manualLayout:u}}}parseDeploymentViewRule(e){if(Ec(e))return this.parseDeploymentViewRulePredicate(e);if(Rf(e))return QR(e);if(_d(e))return this.parseDeploymentViewRuleStyle(e);lt(e)}parseDeploymentViewRulePredicate(e){const r=[];let n=e.expr;for(;n;){try{const i=n.value;Ni(i)&&this.isValid(i)&&r.unshift(this.parseExpressionV2(i))}catch(i){nt(i)}n=n.prev}return e.isInclude?
3977
- {include:r}:{exclude:r}}parseDeploymentViewRuleStyle(e){const r=this.parseStyleProps(e.props.filter(U0)),n=gr(zi(e.props.find(Lc)?.value));return{targets:this.parseFqnExpressions(e.targets),style:r,...n&&{notation:n}}}}}const s4=({operator:t,not:e},r)=>t.startsWith("!=")?{neq:r}:t.startsWith("=")?{eq:r}:e?{neq:r}:{eq:r};function a4(t){return!oI(t)&&!cI(t)?null:t.participant}function Pp(t){switch(!0){case qK(t):{const e=t.value.tag.ref?.name,r=a4(t);ze(e,"Expected tag name");const n={tag:s4(t,e)};
3978
- return r?{participant:r,operator:n}:n}case MK(t):{const e=t.value?.ref?.name,r=a4(t);ze(e,"Expected kind name");const n={kind:s4(t,e)};return r?{participant:r,operator:n}:n}case(iI(t)||aI(t)):return{not:Pp(t.value)};case n7(t):{const e=Pp(t.left),r=Pp(t.right),n=t.operator.toLowerCase();return o4(n,e,r)}default:lt(t)}}function o4(t,e,r){if(r===null)return e;switch(t){case"and":{const n=[xS(e)?e.and:e,xS(r)?r.and:r].flat();return ze(kr(n),"Expected non-empty array"),{and:n}}case"or":{const n=[AS(
3979
- e)?e.or:e,AS(r)?r.or:r].flat();return ze(kr(n),"Expected non-empty array"),{or:n}}default:lt(t)}}const Lae=Fe.getChild("ExpressionV2Parser"),Mae=t=>{const e=t.$cstNode,r=e?`:${e.range.start.line+1}:${e.range.start.character+1}`:"";return`${bt(t).uri.fsPath}${r}`};function jae(t){return class extends t{parseFqnRef(e){const r=Dn(e.value?.ref,()=>`FqnRef "${e.$cstNode?.text}" is empty at ${Mae(e)}`);if(Li(r)){const n={project:ar(r),model:this.resolveFqn(Dn(r.imported.ref,`FqnRef is empty of importe\
3980
- d: ${r.$cstNode?.text}`))};return this.doc.c4Imports.set(n.project,n.model),n}if(Ar(r)){const n=Lre(e);if(n){const o={project:ar(n),model:this.resolveFqn(r)};return this.doc.c4Imports.set(o.project,o.model),o}const i=Ore(e);if(!i)return{model:this.resolveFqn(r)};const s=this.resolveFqn(i),a=this.resolveFqn(r);return{deployment:s,element:a}}if(km(r))return{deployment:this.resolveFqn(r)};lt(r)}parseExpressionV2(e){if(Cx(e))return this.parseFqnExprOrWith(e);if(IK(e))return this.parseRelationExprOrWith(
3976
+ e.body),o=this.convertLinks(e.body),c=(e.kind??e.dotKind?.kind)?.ref?.name,l=this.getMetadata(e.body?.props.find(Oi)),u=Ye(e.body?.props??[],Qe(df),Qe(g=>be(g.value)),zn(g=>[g.key,g.value])),d=Ye(e.body?.props??[],Qe(lf),wc())?.value.view.ref?.name,f=this.parseBaseProps(u,{title:e.title}),p=e.body?.props.find(kg),w=Ui("deployment",n,i.deployment,s.deployment);return Ko({id:w,source:i,target:s,...f,metadata:l,kind:c,tags:a??void 0,...kr(o)&&{links:o},...YR(p?.props,r),navigateTo:d,astPath:n})}}}function jae(t){
3977
+ return class extends t{parseDeploymentView(e){const r=e.body;ze(r,"DynamicElementView body is not defined");const n=r.props.filter(this.isValid),i=this.getAstNodePath(e);let s=e.name;s||(s="deployment_"+Ui(this.doc.uri.toString(),i));const{title:a=null,description:o=null}=this.parseBaseProps(Ye(n,Qe(xg),zn(d=>[d.key,d.value]))),c=this.convertTags(r),l=this.convertLinks(r);Ty.writeId(e,s);const u=zk(e);return{[Go._type]:"deployment",id:s,astPath:i,title:jo(a)??null,description:o,tags:c,links:kr(l)?
3978
+ l:null,rules:r.rules.flatMap(d=>{try{return this.isValid(d)?this.parseDeploymentViewRule(d):[]}catch(f){return nt(f),[]}}),...u&&{manualLayout:u}}}parseDeploymentViewRule(e){if(Ec(e))return this.parseDeploymentViewRulePredicate(e);if(Rf(e))return XR(e);if(_d(e))return this.parseDeploymentViewRuleStyle(e);lt(e)}parseDeploymentViewRulePredicate(e){const r=[];let n=e.expr;for(;n;){try{const i=n.value;Ni(i)&&this.isValid(i)&&r.unshift(this.parseExpressionV2(i))}catch(i){nt(i)}n=n.prev}return e.isInclude?
3979
+ {include:r}:{exclude:r}}parseDeploymentViewRuleStyle(e){const r=this.parseStyleProps(e.props.filter(U0)),n=mr(zi(e.props.find(Lc)?.value));return{targets:this.parseFqnExpressions(e.targets),style:r,...n&&{notation:n}}}}}const n4=({operator:t,not:e},r)=>t.startsWith("!=")?{neq:r}:t.startsWith("=")?{eq:r}:e?{neq:r}:{eq:r};function i4(t){return!oI(t)&&!cI(t)?null:t.participant}function Pp(t){switch(!0){case qK(t):{const e=t.value.tag.ref?.name,r=i4(t);ze(e,"Expected tag name");const n={tag:n4(t,e)};
3980
+ return r?{participant:r,operator:n}:n}case MK(t):{const e=t.value?.ref?.name,r=i4(t);ze(e,"Expected kind name");const n={kind:n4(t,e)};return r?{participant:r,operator:n}:n}case(iI(t)||aI(t)):return{not:Pp(t.value)};case n7(t):{const e=Pp(t.left),r=Pp(t.right),n=t.operator.toLowerCase();return s4(n,e,r)}default:lt(t)}}function s4(t,e,r){if(r===null)return e;switch(t){case"and":{const n=[xS(e)?e.and:e,xS(r)?r.and:r].flat();return ze(kr(n),"Expected non-empty array"),{and:n}}case"or":{const n=[AS(
3981
+ e)?e.or:e,AS(r)?r.or:r].flat();return ze(kr(n),"Expected non-empty array"),{or:n}}default:lt(t)}}const qae=Fe.getChild("ExpressionV2Parser"),Fae=t=>{const e=t.$cstNode,r=e?`:${e.range.start.line+1}:${e.range.start.character+1}`:"";return`${bt(t).uri.fsPath}${r}`};function Hae(t){return class extends t{parseFqnRef(e){const r=Dn(e.value?.ref,()=>`FqnRef "${e.$cstNode?.text}" is empty at ${Fae(e)}`);if(Li(r)){const n={project:ar(r),model:this.resolveFqn(Dn(r.imported.ref,`FqnRef is empty of importe\
3982
+ d: ${r.$cstNode?.text}`))};return this.doc.c4Imports.set(n.project,n.model),n}if(Ar(r)){const n=qre(e);if(n){const o={project:ar(n),model:this.resolveFqn(r)};return this.doc.c4Imports.set(o.project,o.model),o}const i=jre(e);if(!i)return{model:this.resolveFqn(r)};const s=this.resolveFqn(i),a=this.resolveFqn(r);return{deployment:s,element:a}}if(km(r))return{deployment:this.resolveFqn(r)};lt(r)}parseExpressionV2(e){if(Cx(e))return this.parseFqnExprOrWith(e);if(IK(e))return this.parseRelationExprOrWith(
3981
3983
  e);lt(e)}parseFqnExprOrWith(e){if(cg(e))return this.parseFqnExprWith(e);if(Px(e))return this.parseFqnExprOrWhere(e);lt(e)}parseFqnExprWith(e){const r=this.parseFqnExprOrWhere(e.subject);return(e.custom?.props??[]).reduce((n,i)=>{if(!this.isValid(i))return n;if(vg(i)){const s=i.value.view.$refText;return be(s)&&(n.custom.navigateTo=s),n}if(Pd(i)){if(Pr(i.value)&&i.key!=="summary")if(i.key==="description"){const s=this.parseMarkdownOrString(i.value);s&&(n.custom.description=s)}else n.custom[i.key]=
3982
- gr(zi(i.value))||"";return n}if(go(i)){const s=this.parseIconProperty(i);return Pr(s)&&(n.custom[i.key]=s),n}if(uo(i)){const s=hp(i);return Pr(s)&&(n.custom[i.key]=s),n}if(Sg(i)||Fm(i))return Pr(i.value)&&(n.custom[i.key]=i.value),n;if(wg(i))return Pr(i.value)&&(n.custom[i.key]=yO(i)),n;if(Lc(i)){const s=be(i.value)?gr(zi(i.value)):void 0;return s&&(n.custom[i.key]=s),n}if(i_(i))return eC(i.value)&&(n.custom[i.key]=i.value),n;if(l_(i)||d_(i)||a_(i))return be(i.value)&&(n.custom[i.key]=ll(i)),n;lt(
3984
+ mr(zi(i.value))||"";return n}if(go(i)){const s=this.parseIconProperty(i);return Pr(s)&&(n.custom[i.key]=s),n}if(uo(i)){const s=hp(i);return Pr(s)&&(n.custom[i.key]=s),n}if(Sg(i)||Fm(i))return Pr(i.value)&&(n.custom[i.key]=i.value),n;if(wg(i))return Pr(i.value)&&(n.custom[i.key]=mO(i)),n;if(Lc(i)){const s=be(i.value)?mr(zi(i.value)):void 0;return s&&(n.custom[i.key]=s),n}if(i_(i))return eC(i.value)&&(n.custom[i.key]=i.value),n;if(l_(i)||d_(i)||a_(i))return be(i.value)&&(n.custom[i.key]=ll(i)),n;lt(
3983
3985
  i)},{custom:{expr:r}})}parseFqnExprOrWhere(e){if(r_(e))return this.parseFqnExprWhere(e);if($x(e))return this.parseFqnExpr(e);lt(e)}parseFqnExprWhere(e){return ze(!r_(e.subject),"FqnExprWhere is not allowed as subject of FqnExprWhere"),{where:{expr:this.parseFqnExpr(e.subject),condition:e.where?Pp(e.where):{kind:{neq:"--always-true--"}}}}}parseFqnExpr(e){if(lI(e))return{wildcard:!0};if(Bx(e))return ze(e.kind?.ref,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.ref.name,
3984
3986
  isEqual:e.isEqual};if(zx(e))return ze(e.tag.tag.ref,"ElementTagExpr tag is not resolved: "+e.$cstNode?.text),{elementTag:e.tag.tag.$refText,isEqual:e.isEqual};if(ug(e))return this.parseFqnRefExpr(e);lt(e)}parseFqnRefExpr(e){const r=this.parseFqnRef(e.ref);switch(!0){case e.selector==="._":return{ref:r,selector:"expanded"};case e.selector===".**":return{ref:r,selector:"descendants"};case e.selector===".*":return{ref:r,selector:"children"};default:return{ref:r}}}parseFqnExpressions(e){const r=[];let n=e;
3985
- for(;n;){try{Ni(n.value)&&this.isValid(n.value)&&r.push(this.parseFqnExpr(n.value))}catch(i){Lae.warn(Ve(i))}n=n.prev}return r.reverse()}parseRelationExprOrWith(e){if(c_(e))return this.parseRelationExprWith(e);if(xK(e))return this.parseRelationExprOrWhere(e);lt(e)}parseRelationExprWith(e){const r=this.parseRelationExprOrWhere(e.subject);return{customRelation:{...this.parseCustomRelationProperties(e.custom),expr:r}}}parseCustomRelationProperties(e){return(e?.props??[]).reduce((r,n)=>{if(df(n)||Lc(
3986
- n)||s_(n)){const i=be(n.value)?gr(zi(n.value)):void 0;return i&&(r[n.key]=i),r}if(md(n))return be(n.value)&&(r[n.key]=n.value),r;if(uo(n)){const i=hp(n);return be(i)&&(r[n.key]=i),r}if(Vd(n))return be(n.value)&&(r[n.key]=n.value),r;if(lf(n)){const i=n.value.view.ref?.name;return be(i)&&(r[n.key]=i),r}lt(n)},{})}parseRelationExprOrWhere(e){if(o_(e))return this.parseRelationExprWhere(e);if(Im(e))return this.parseRelationExpr(e);lt(e)}parseRelationExprWhere(e){ze(!o_(e.subject),"RelationExprWhere i\
3987
- s not allowed as subject of RelationExprWhere");const r=this.parseRelationExpr(e.subject),n=r.where?.expr??r,i=r.where?.condition,s=e.where?Pp(e.where):null;let a;return s&&i?a=o4("and",i,s):a=s??i??{kind:{neq:"--always-true--"}},{where:{expr:n,condition:a}}}parseRelationExpr(e){switch(e.$type){case"DirectedRelationExpr":return this.wrapInWhere({source:this.parseFqnExpr(e.source.from),target:this.parseFqnExpr(e.target),isBidirectional:e.source.isBidirectional},this.parseInlineKindCondition(e.source));case"\
3987
+ for(;n;){try{Ni(n.value)&&this.isValid(n.value)&&r.push(this.parseFqnExpr(n.value))}catch(i){qae.warn(Ve(i))}n=n.prev}return r.reverse()}parseRelationExprOrWith(e){if(c_(e))return this.parseRelationExprWith(e);if(xK(e))return this.parseRelationExprOrWhere(e);lt(e)}parseRelationExprWith(e){const r=this.parseRelationExprOrWhere(e.subject);return{customRelation:{...this.parseCustomRelationProperties(e.custom),expr:r}}}parseCustomRelationProperties(e){return(e?.props??[]).reduce((r,n)=>{if(df(n)||Lc(
3988
+ n)||s_(n)){const i=be(n.value)?mr(zi(n.value)):void 0;return i&&(r[n.key]=i),r}if(md(n))return be(n.value)&&(r[n.key]=n.value),r;if(uo(n)){const i=hp(n);return be(i)&&(r[n.key]=i),r}if(Vd(n))return be(n.value)&&(r[n.key]=n.value),r;if(lf(n)){const i=n.value.view.ref?.name;return be(i)&&(r[n.key]=i),r}lt(n)},{})}parseRelationExprOrWhere(e){if(o_(e))return this.parseRelationExprWhere(e);if(Im(e))return this.parseRelationExpr(e);lt(e)}parseRelationExprWhere(e){ze(!o_(e.subject),"RelationExprWhere i\
3989
+ s not allowed as subject of RelationExprWhere");const r=this.parseRelationExpr(e.subject),n=r.where?.expr??r,i=r.where?.condition,s=e.where?Pp(e.where):null;let a;return s&&i?a=s4("and",i,s):a=s??i??{kind:{neq:"--always-true--"}},{where:{expr:n,condition:a}}}parseRelationExpr(e){switch(e.$type){case"DirectedRelationExpr":return this.wrapInWhere({source:this.parseFqnExpr(e.source.from),target:this.parseFqnExpr(e.target),isBidirectional:e.source.isBidirectional},this.parseInlineKindCondition(e.source));case"\
3988
3990
  InOutRelationExpr":return{inout:this.parseFqnExpr(e.inout.to)};case"OutgoingRelationExpr":return this.wrapInWhere({outgoing:this.parseFqnExpr(e.from)},this.parseInlineKindCondition(e));case"IncomingRelationExpr":return{incoming:this.parseFqnExpr(e.to)};default:lt(e)}}parseInlineKindCondition(e){const r=e.kind??e.dotKind?.kind;return r?(ze(r.ref,"Kind is not resolved: "+e.$cstNode?.text),{kind:{eq:r.ref?.name}}):null}wrapInWhere(e,r){return r?{where:{expr:e,condition:r}}:e}}}const Nv=Fe.getChild(
3989
- "GlobalsParser");function qae(t){return class extends t{parseGlobals(){const{parseResult:e,c4Globals:r}=this.doc,n=this.isValid,i=e.value.globals.filter(n),s=i.flatMap(o=>o.predicates.filter(n));for(const o of s)try{const c=o.name;if(!be(c))continue;if(c in r.predicates){Nv.warn(`Global predicate named "${c}" is already defined`);continue}this.parseAndStoreGlobalPredicateGroupOrDynamic(o,c,r)}catch(c){Nv.warn(Ve(c))}const a=i.flatMap(o=>o.styles.filter(n));for(const o of a)try{const c=o.id.name;
3991
+ "GlobalsParser");function Bae(t){return class extends t{parseGlobals(){const{parseResult:e,c4Globals:r}=this.doc,n=this.isValid,i=e.value.globals.filter(n),s=i.flatMap(o=>o.predicates.filter(n));for(const o of s)try{const c=o.name;if(!be(c))continue;if(c in r.predicates){Nv.warn(`Global predicate named "${c}" is already defined`);continue}this.parseAndStoreGlobalPredicateGroupOrDynamic(o,c,r)}catch(c){Nv.warn(Ve(c))}const a=i.flatMap(o=>o.styles.filter(n));for(const o of a)try{const c=o.id.name;
3990
3992
  if(!be(c))continue;if(c in r.styles){Nv.warn(`Global style named "${c}" is already defined`);continue}const l=this.parseGlobalStyleOrGroup(o);Ir(l,1)&&(r.styles[c]=l)}catch(c){Nv.warn(Ve(c))}}parseAndStoreGlobalPredicateGroupOrDynamic(e,r,n){if(Md(e)){const i=this.parseGlobalPredicateGroup(e);Ir(i,1)&&(n.predicates[r]=i);return}if(Ld(e)){const i=this.parseGlobalDynamicPredicateGroup(e);Ir(i,1)&&(n.dynamicPredicates[r]=i);return}lt(e)}parseGlobalPredicateGroup(e){return e.predicates.map(r=>this.parseViewRulePredicate(
3991
- r))}parseGlobalDynamicPredicateGroup(e){return e.predicates.map(r=>this.parseDynamicViewIncludePredicate(r))}parseGlobalStyleOrGroup(e){if(Ic(e))return[this.parseViewRuleStyle(e)];if(mo(e))return e.styles.map(r=>this.parseViewRuleStyle(r));lt(e)}}}const Fae=Fe.getChild("ImportsParser");function Hae(t){return class extends t{parseImports(){const e=this.doc.parseResult.value.imports??[];for(const r of e){const n=r.project;let i=r.imports;for(;i;){try{this.doc.c4Imports.set(n,this.resolveFqn(Dn(i.imported.
3992
- ref,`ElementRef is empty of imported: ${i.imported.$refText}`)))}catch(s){Fae.warn(Ve(s))}i=i.prev}}}}}const Bae=Fe.getChild("ModelParser");function*zae(t){const e=CS.from(t.parseResult.value.models.flatMap(i=>i.elements)),r=[];let n;for(;n=e.shift();){if(Mi(n)){r.push(n);continue}if(Pc(n)){yield n;continue}if(n.body&&"elements"in n.body&&n.body.elements&&n.body.elements.length>0)for(const i of n.body.elements)e.push(i);yield n}yield*r}function Uae(t){return class extends t{parseModel(){const e=this.
3993
- doc;for(const r of zae(e))try{if(Ar(r)){e.c4Elements.push(this.parseElement(r));continue}if(Mi(r)){this.isValid(r)&&e.c4Relations.push(this.parseRelation(r));continue}if(ho(r)){const n=this.parseExtendElement(r);n&&e.c4ExtendElements.push(n);continue}if(Pc(r)){const n=this.parseExtendRelation(r);n&&e.c4ExtendRelations.push(n);continue}lt(r)}catch(n){const i=this.getAstNodePath(r),s=Ve(n),a=n instanceof Error?n.message:String(s);Bae.warn(`Error on {eltype}: ${a}
3993
+ r))}parseGlobalDynamicPredicateGroup(e){return e.predicates.map(r=>this.parseDynamicViewIncludePredicate(r))}parseGlobalStyleOrGroup(e){if(Ic(e))return[this.parseViewRuleStyle(e)];if(mo(e))return e.styles.map(r=>this.parseViewRuleStyle(r));lt(e)}}}const zae=Fe.getChild("ImportsParser");function Uae(t){return class extends t{parseImports(){const e=this.doc.parseResult.value.imports??[];for(const r of e){const n=r.project;let i=r.imports;for(;i;){try{this.doc.c4Imports.set(n,this.resolveFqn(Dn(i.imported.
3994
+ ref,`ElementRef is empty of imported: ${i.imported.$refText}`)))}catch(s){zae.warn(Ve(s))}i=i.prev}}}}}const Vae=Fe.getChild("ModelParser");function*Wae(t){const e=CS.from(t.parseResult.value.models.flatMap(i=>i.elements)),r=[];let n;for(;n=e.shift();){if(Mi(n)){r.push(n);continue}if(Pc(n)){yield n;continue}if(n.body&&"elements"in n.body&&n.body.elements&&n.body.elements.length>0)for(const i of n.body.elements)e.push(i);yield n}yield*r}function Gae(t){return class extends t{parseModel(){const e=this.
3995
+ doc;for(const r of Wae(e))try{if(Ar(r)){e.c4Elements.push(this.parseElement(r));continue}if(Mi(r)){this.isValid(r)&&e.c4Relations.push(this.parseRelation(r));continue}if(ho(r)){const n=this.parseExtendElement(r);n&&e.c4ExtendElements.push(n);continue}if(Pc(r)){const n=this.parseExtendRelation(r);n&&e.c4ExtendRelations.push(n);continue}lt(r)}catch(n){const i=this.getAstNodePath(r),s=Ve(n),a=n instanceof Error?n.message:String(s);Vae.warn(`Error on {eltype}: ${a}
3994
3996
  document: {path}
3995
3997
  astpath: {astPath}
3996
3998
  ${s}`,{path:e.uri.path,eltype:r.$type,astPath:i})}}parseElement(e){const r=this.isValid,n=this.resolveFqn(e),i=Dn(e.kind.ref,"Element kind is not resolved").name,s=this.parseTags(e.body),a=this.parseElementStyle(e.body?.props),o=this.getMetadata(e.body?.props.find(Oi)),c=this.getAstNodePath(e);let[l,u,d]=e.props??[];const f=Ye(e.body?.props??[],Qe(r),Qe(Pd),zn(y=>[y.key,y.value])),{title:p,...w}=this.parseBaseProps(f,{title:l,summary:u,technology:d}),g=this.parseLinks(e.body);return Gi({id:n,kind:i,
@@ -3998,109 +4000,109 @@ astPath:c,title:p??e.name,metadata:o,tags:s??void 0,...g&&kr(g)&&{links:g},...w,
3998
4000
  l reference"),ze(Nr.isModelRef(n)||Nr.isImportRef(n),"Target must be a model reference");const i=this.parseTags(e.body),s=this.getMetadata(e.body?.props.find(Oi)),a=this.getAstNodePath(e),o=this.parseLinks(e.body)??[];if(!i&&Pt(s??{})&&Pt(o))return null;const c=(e.kind??e.dotKind?.kind)?.ref?.name,{title:l=""}=this.parseBaseProps({},{title:e.title}),u=Ui("extend-relation",Nr.flatten(r),Nr.flatten(n),c??"default",l);return Gi({id:u,astPath:a,metadata:s,tags:i,links:kr(o)?o:null})}_resolveRelationSource(e){
3999
4001
  if(Pr(e.source)){const r=this.parseFqnRef(e.source);return ze(Nr.isModelRef(r)||Nr.isImportRef(r),"Relation source must be a model reference"),r}if(Xm(e.$container))return{model:this.resolveFqn(e.$container.$container)};if(sg(e.$container))return{model:this.resolveFqn(e.$container.$container)};throw new Error("RelationRefError: Invalid container for sourceless relation")}parseRelation(e){const r=this.isValid,n=this._resolveRelationSource(e),i=this.parseFqnRef(e.target);ze(Nr.isModelRef(i)||Nr.isImportRef(
4000
4002
  i),"Target must be a model reference");const s=this.parseTags(e)??this.parseTags(e.body),a=this.parseLinks(e.body),o=(e.kind??e.dotKind?.kind)?.ref?.name,c=this.getMetadata(e.body?.props.find(Oi)),l=this.getAstNodePath(e),u=Ye(e.body?.props??[],Qe(df),Qe(m=>be(m.value)),zn(m=>[m.key,m.value])),d=Ye(e.body?.props??[],Qe(lf),qt(m=>m.value.view.ref?.name),Qe(be),wc()),{title:f="",description:p,technology:w}=this.parseBaseProps(u,{title:e.title,description:e.description,technology:e.technology}),g=e.
4001
- body?.props.find(kg),y=Ui(l,n.model,i.model);return Gi({id:y,astPath:l,source:n,target:i,title:f,metadata:c,kind:o,tags:s??void 0,links:kr(a)?a:void 0,navigateTo:d||void 0,description:p,technology:w,...XR(g?.props,r)})}}}function Vae(t){return class extends t{parsePredicate(e){return this.parseExpressionV2(e)}parseElementPredicate(e){if(cg(e))return this.parseFqnExprWith(e);if(Px(e))return this.parseFqnExprOrWhere(e);lt(e)}parseElementPredicateOrWhere(e){return this.parseFqnExprOrWhere(e)}parseElementExpression(e){
4003
+ body?.props.find(kg),y=Ui(l,n.model,i.model);return Gi({id:y,astPath:l,source:n,target:i,title:f,metadata:c,kind:o,tags:s??void 0,links:kr(a)?a:void 0,navigateTo:d||void 0,description:p,technology:w,...YR(g?.props,r)})}}}function Kae(t){return class extends t{parsePredicate(e){return this.parseExpressionV2(e)}parseElementPredicate(e){if(cg(e))return this.parseFqnExprWith(e);if(Px(e))return this.parseFqnExprOrWhere(e);lt(e)}parseElementPredicateOrWhere(e){return this.parseFqnExprOrWhere(e)}parseElementExpression(e){
4002
4004
  return this.parseFqnExpr(e)}parseElementPredicateWhere(e){return this.parseFqnExprWhere(e)}parseElementPredicateWith(e){return this.parseFqnExprWith(e)}parseRelationPredicate(e){return this.parseRelationExprOrWith(e)}parseRelationPredicateOrWhere(e){return this.parseRelationExprOrWhere(e)}parseRelationPredicateWhere(e){return this.parseRelationExprWhere(e)}parseRelationPredicateWith(e){return this.parseRelationExprWith(e)}parseRelationExpression(e){return this.parseRelationExpr(e)}}}const ya=Fe.
4003
- getChild("SpecificationParser");function Wae(t){return class extends t{parseSpecification(){const{parseResult:{value:{specifications:e}},c4Specification:r}=this.doc,n=this.isValid;for(const o of e.flatMap(c=>c.elements.filter(n)))try{Object.assign(r.elements,this.parseElementSpecificationNode(o))}catch(c){ya.warn(Ve(c))}for(const o of e.flatMap(c=>c.deploymentNodes.filter(n)))try{Object.assign(r.deployments,this.parseElementSpecificationNode(o))}catch(c){ya.warn(Ve(c))}const i=e.flatMap(o=>o.relationships.
4004
- filter(this.isValid));for(const{kind:o,props:c}of i)try{const l=o.name;if(!be(l))continue;if(l in r.relationships){ya.warn(`Relationship kind "${l}" is already defined`);continue}const u=Ye(c.filter(Qx)??[],Qe(d=>this.isValid(d)&&Ni(d.value)),zn(d=>[d.key,gr(zi(d.value))]),tC(Mt));r.relationships[l]={...u,...XR(c.filter(xx),this.isValid)}}catch(l){ya.warn(Ve(l))}const s=e.flatMap(o=>o.tags.filter(this.isValid));for(const o of s)try{const c=o.tag.name,l=this.getAstNodePath(o.tag),u=o.color&&this.
4005
- parseColorLiteral(o.color);if(c in r.tags){ya.warn("Tag {tag} is already defined, skipping duplicate",{tag:c});continue}be(c)&&(r.tags[c]={astPath:l,...u?{color:u}:{}})}catch(c){ya.warn(Ve(c))}const a=e.flatMap(o=>o.colors.filter(n));for(const{name:o,color:c}of a)try{const l=o.name;if(l in r.colors){ya.warn(`Custom color "${l}" is already defined`);continue}r.colors[l]={color:On(this.parseColorLiteral(c),`Color "${l}" is not valid: ${c}`)}}catch(l){ya.warn(Ve(l))}}parseElementSpecificationNode(e){
4006
- const{kind:r,props:n}=e,i=r.name;if(!be(i))throw new Error("DeploymentNodeKind name is not resolved");const s=this.parseTags(e),a=this.parseElementStyle(n.find(Ad)),o=this.parseLinks(e),c=Ye(n.filter(Xx)??[],Qe(d=>this.isValid(d)),zn(d=>[d.key,d.value])),l=this.parseBaseProps(c),u=gr(zi(c.notation));return{[i]:Ko({...l,notation:u,tags:s??void 0,...o&&Go.isNonEmptyArray(o)&&{links:o},style:a})}}}}const wi=Fe.getChild("ViewsParser"),Gae=wi.getChild("rank");function Kae(t){return class extends t{parseViews(){
4005
+ getChild("SpecificationParser");function Zae(t){return class extends t{parseSpecification(){const{parseResult:{value:{specifications:e}},c4Specification:r}=this.doc,n=this.isValid;for(const o of e.flatMap(c=>c.elements.filter(n)))try{Object.assign(r.elements,this.parseElementSpecificationNode(o))}catch(c){ya.warn(Ve(c))}for(const o of e.flatMap(c=>c.deploymentNodes.filter(n)))try{Object.assign(r.deployments,this.parseElementSpecificationNode(o))}catch(c){ya.warn(Ve(c))}const i=e.flatMap(o=>o.relationships.
4006
+ filter(this.isValid));for(const{kind:o,props:c}of i)try{const l=o.name;if(!be(l))continue;if(l in r.relationships){ya.warn(`Relationship kind "${l}" is already defined`);continue}const u=Ye(c.filter(Qx)??[],Qe(d=>this.isValid(d)&&Ni(d.value)),zn(d=>[d.key,mr(zi(d.value))]),tC(Mt));r.relationships[l]={...u,...YR(c.filter(xx),this.isValid)}}catch(l){ya.warn(Ve(l))}const s=e.flatMap(o=>o.tags.filter(this.isValid));for(const o of s)try{const c=o.tag.name,l=this.getAstNodePath(o.tag),u=o.color&&this.
4007
+ parseColorLiteral(o.color);if(c in r.tags){ya.warn("Tag {tag} is already defined, skipping duplicate",{tag:c});continue}be(c)&&(r.tags[c]={astPath:l,...u?{color:u}:{}})}catch(c){ya.warn(Ve(c))}const a=e.flatMap(o=>o.colors.filter(n));for(const{name:o,color:c}of a)try{const l=o.name;if(l in r.colors){ya.warn(`Custom color "${l}" is already defined`);continue}r.colors[l]={color:On(this.parseColorLiteral(c),`Color "${l}" is not valid`)}}catch(l){ya.warn(Ve(l))}}parseElementSpecificationNode(e){const{
4008
+ kind:r,props:n}=e,i=r.name;if(!be(i))throw new Error("DeploymentNodeKind name is not resolved");const s=this.parseTags(e),a=this.parseElementStyle(n.find(Ad)),o=this.parseLinks(e),c=Ye(n.filter(Xx)??[],Qe(d=>this.isValid(d)),zn(d=>[d.key,d.value])),l=this.parseBaseProps(c),u=mr(zi(c.notation));return{[i]:Ko({...l,notation:u,tags:s??void 0,...o&&Go.isNonEmptyArray(o)&&{links:o},style:a})}}}}const wi=Fe.getChild("ViewsParser"),Jae=wi.getChild("rank");function Yae(t){return class extends t{parseViews(){
4007
4009
  const e=this.isValid;for(const r of this.doc.parseResult.value.views){const n=r.styles.flatMap(s=>{try{return e(s)?this.parseViewRuleStyleOrGlobalRef(s):[]}catch(a){return wi.warn(Ve(a)),[]}}),i=r.folder&&!Pt(r.folder.trim())?jo(r.folder):null;for(const s of r.views)try{if(!e(s))continue;switch(!0){case eg(s):this.doc.c4Views.push(this.parseElementView(s,n));break;case G0(s):this.doc.c4Views.push(this.parseDynamicElementView(s,n));break;case jx(s):this.doc.c4Views.push(this.parseDeploymentView(s));
4008
4010
  break;default:lt(s)}if(i){const a=this.doc.c4Views.at(-1);a.title=i+" / "+(a.title||a.id)}}catch(a){wi.warn(Ve(a))}}}parseElementView(e,r){const n=e.body;ze(n,"ElementView body is not defined");const i=this.getAstNodePath(e);let s=null;if("viewOf"in e){const p=ha(e.viewOf),w=p&&this.resolveFqn(p);if(w)s=w;else{const g=e.name??"unnamed",y=e.viewOf.$cstNode?.text??"<unknown>";wi.warn("viewOf {viewId} not resolved {msg}",{msg:y,viewId:g})}}let a=e.name;a||(a="view_"+Ui(this.doc.uri.toString(),i,s??
4009
- ""));const{title:o=null,description:c=null}=this.parseBaseProps(Ye(n.props,Qe(p=>this.isValid(p)),Qe(xg),zn(p=>[p.key,p.value]))),l=this.convertTags(n),u=this.convertLinks(n),d=Uk(e),f={[Go._type]:"element",id:a,astPath:i,title:jo(o)??null,description:c,tags:l,links:kr(u)?u:null,rules:[...r,...n.rules.flatMap(p=>{try{return this.isValid(p)?this.parseElementViewRule(p):[]}catch(w){return wi.warn(Ve(w)),[]}})],...s&&{viewOf:s},...d&&{manualLayout:d}};if(Ty.writeId(e,f.id),"extends"in e){const p=e.
4010
- extends.view.ref;return ze(p?.name,"view extends is not resolved: "+e.$cstNode?.text),Object.assign(f,{extends:p.name})}return f}parseElementViewRule(e){if(Pf(e))return this.parseViewRulePredicate(e);if(p_(e))return this.parseViewRuleGlobalPredicateRef(e);if(V0(e))return this.parseViewRuleStyleOrGlobalRef(e);if(Rf(e))return QR(e);if(Tf(e))return this.parseViewRuleGroup(e);if(r7(e))return this.parseViewRuleRank(e);lt(e)}parseViewRulePredicate(e){const r=[];let n=e.exprs;for(;n;){const{value:i,prev:s}=n;
4011
+ ""));const{title:o=null,description:c=null}=this.parseBaseProps(Ye(n.props,Qe(p=>this.isValid(p)),Qe(xg),zn(p=>[p.key,p.value]))),l=this.convertTags(n),u=this.convertLinks(n),d=zk(e),f={[Go._type]:"element",id:a,astPath:i,title:jo(o)??null,description:c,tags:l,links:kr(u)?u:null,rules:[...r,...n.rules.flatMap(p=>{try{return this.isValid(p)?this.parseElementViewRule(p):[]}catch(w){return wi.warn(Ve(w)),[]}})],...s&&{viewOf:s},...d&&{manualLayout:d}};if(Ty.writeId(e,f.id),"extends"in e){const p=e.
4012
+ extends.view.ref;return ze(p?.name,"view extends is not resolved: "+e.$cstNode?.text),Object.assign(f,{extends:p.name})}return f}parseElementViewRule(e){if(Pf(e))return this.parseViewRulePredicate(e);if(p_(e))return this.parseViewRuleGlobalPredicateRef(e);if(V0(e))return this.parseViewRuleStyleOrGlobalRef(e);if(Rf(e))return XR(e);if(Tf(e))return this.parseViewRuleGroup(e);if(r7(e))return this.parseViewRuleRank(e);lt(e)}parseViewRulePredicate(e){const r=[];let n=e.exprs;for(;n;){const{value:i,prev:s}=n;
4011
4013
  try{if(be(i)&&this.isValid(i)){const a=this.parsePredicate(i);r.unshift(a)}}catch(a){wi.warn(Ve(a))}if(!s)break;n=s}return e.isInclude?{include:r}:{exclude:r}}parseViewRuleGlobalPredicateRef(e){return{predicateId:e.predicate.$refText}}parseViewRuleStyleOrGlobalRef(e){if(Vc(e))return this.parseViewRuleStyle(e);if(h_(e))return this.parseViewRuleGlobalStyle(e);lt(e)}parseViewRuleGroup(e){const r=[];for(const n of e.groupRules)try{if(!this.isValid(n))continue;if(Pf(n)){r.push(this.parseViewRulePredicate(
4012
- n));continue}if(Tf(n)){r.push(this.parseViewRuleGroup(n));continue}lt(n)}catch(i){wi.warn(Ve(i))}return{title:jo(e.title)??null,groupRules:r,...this.parseStyleProps(e.props)}}parseViewRuleRank(e){const r=this.parseFqnExpressions(e.targets).filter(i=>Go.ModelExpression.isFqnExpr(i)),n=e.value??"same";return Gae.debug`Parsed rank constraint ${n} with ${r.length} target(s)`,{rank:n,targets:r}}parseViewRuleStyle(e){const r=this.parseFqnExpressions(e.targets).filter(s=>Go.ModelExpression.isFqnExpr(s)),
4013
- n=this.parseStyleProps(e.props.filter(U0)),i=gr(zi(e.props.find(Lc)?.value));return{targets:r,style:n,...i&&{notation:i}}}parseViewRuleGlobalStyle(e){return{styleId:e.style.$refText}}parseDynamicElementView(e,r){const n=e.body;ze(n,"DynamicElementView body is not defined");const i=this.isValid,s=n.props.filter(i),a=this.getAstNodePath(e);let o=e.name;o||(o="dynamic_"+Ui(this.doc.uri.toString(),a));const{title:c=null,description:l=null}=this.parseBaseProps(Ye(s,Qe(xg),zn(w=>[w.key,w.value]))),u=this.
4014
- convertTags(n),d=this.convertLinks(n);Ty.writeId(e,o);const f=Uk(e),p=t0(s,K0)?.value;return{[Go._type]:"dynamic",id:o,astPath:a,title:jo(c)??null,description:l,tags:u,links:kr(d)?d:null,variant:p,rules:[...r,...n.rules.flatMap(w=>{try{return i(w)?this.parseDynamicViewRule(w):[]}catch(g){return wi.warn(Ve(g)),[]}},[])],steps:n.steps.reduce((w,g)=>{try{i(g)&&(Z0(g)?w.push(this.parseDynamicParallelSteps(g)):w.push(this.parseDynamicStep(g)))}catch(y){wi.warn(Ve(y))}return w},[]),...f&&{manualLayout:f}}}parseDynamicViewRule(e){
4015
- if(Fx(e))return this.parseDynamicViewIncludePredicate(e);if(qx(e))return this.parseViewRuleGlobalPredicateRef(e);if(V0(e))return this.parseViewRuleStyleOrGlobalRef(e);if(Rf(e))return QR(e);lt(e)}parseDynamicViewIncludePredicate(e){const r=[];let n=e.exprs;for(;n;){try{if(Ni(n.value)&&this.isValid(n.value)&&Cx(n.value)){const i=this.parseElementPredicate(n.value);r.unshift(i)}}catch(i){wi.warn(Ve(i))}n=n.prev}return{include:r}}parseDynamicParallelSteps(e){const r=Wk(e),n=e.steps.map(i=>this.parseDynamicStep(
4016
- i));return ze(kr(n),"Dynamic parallel steps must have at least one step"),{parallelId:r,__parallel:n}}parseDynamicStep(e){if(Uf(e))return ze(this.isValid(e)),this.parseDynamicStepSingle(e);const r=this.recursiveParseDynamicStepChain(e);return ze(kr(r),"Dynamic step chain must have at least one step"),{seriesId:Wk(e),__series:r}}recursiveParseDynamicStepChain(e,r){if(Uf(e.source)){if(!this.isValid(e.source))return[];const o=this.parseDynamicStepSingle(e.source);if(o.isBackward)return[];const c={...this.
4014
+ n));continue}if(Tf(n)){r.push(this.parseViewRuleGroup(n));continue}lt(n)}catch(i){wi.warn(Ve(i))}return{title:jo(e.title)??null,groupRules:r,...this.parseStyleProps(e.props)}}parseViewRuleRank(e){const r=this.parseFqnExpressions(e.targets).filter(i=>Go.ModelExpression.isFqnExpr(i)),n=e.value??"same";return Jae.debug`Parsed rank constraint ${n} with ${r.length} target(s)`,{rank:n,targets:r}}parseViewRuleStyle(e){const r=this.parseFqnExpressions(e.targets).filter(s=>Go.ModelExpression.isFqnExpr(s)),
4015
+ n=this.parseStyleProps(e.props.filter(U0)),i=mr(zi(e.props.find(Lc)?.value));return{targets:r,style:n,...i&&{notation:i}}}parseViewRuleGlobalStyle(e){return{styleId:e.style.$refText}}parseDynamicElementView(e,r){const n=e.body;ze(n,"DynamicElementView body is not defined");const i=this.isValid,s=n.props.filter(i),a=this.getAstNodePath(e);let o=e.name;o||(o="dynamic_"+Ui(this.doc.uri.toString(),a));const{title:c=null,description:l=null}=this.parseBaseProps(Ye(s,Qe(xg),zn(w=>[w.key,w.value]))),u=this.
4016
+ convertTags(n),d=this.convertLinks(n);Ty.writeId(e,o);const f=zk(e),p=t0(s,K0)?.value;return{[Go._type]:"dynamic",id:o,astPath:a,title:jo(c)??null,description:l,tags:u,links:kr(d)?d:null,variant:p,rules:[...r,...n.rules.flatMap(w=>{try{return i(w)?this.parseDynamicViewRule(w):[]}catch(g){return wi.warn(Ve(g)),[]}},[])],steps:n.steps.reduce((w,g)=>{try{i(g)&&(Z0(g)?w.push(this.parseDynamicParallelSteps(g)):w.push(this.parseDynamicStep(g)))}catch(y){wi.warn(Ve(y))}return w},[]),...f&&{manualLayout:f}}}parseDynamicViewRule(e){
4017
+ if(Fx(e))return this.parseDynamicViewIncludePredicate(e);if(qx(e))return this.parseViewRuleGlobalPredicateRef(e);if(V0(e))return this.parseViewRuleStyleOrGlobalRef(e);if(Rf(e))return XR(e);lt(e)}parseDynamicViewIncludePredicate(e){const r=[];let n=e.exprs;for(;n;){try{if(Ni(n.value)&&this.isValid(n.value)&&Cx(n.value)){const i=this.parseElementPredicate(n.value);r.unshift(i)}}catch(i){wi.warn(Ve(i))}n=n.prev}return{include:r}}parseDynamicParallelSteps(e){const r=Vk(e),n=e.steps.map(i=>this.parseDynamicStep(
4018
+ i));return ze(kr(n),"Dynamic parallel steps must have at least one step"),{parallelId:r,__parallel:n}}parseDynamicStep(e){if(Uf(e))return ze(this.isValid(e)),this.parseDynamicStepSingle(e);const r=this.recursiveParseDynamicStepChain(e);return ze(kr(r),"Dynamic step chain must have at least one step"),{seriesId:Vk(e),__series:r}}recursiveParseDynamicStepChain(e,r){if(Uf(e.source)){if(!this.isValid(e.source))return[];const o=this.parseDynamicStepSingle(e.source);if(o.isBackward)return[];const c={...this.
4017
4019
  parseAbstractDynamicStep(e),source:o.target};return c.target===o.source?c.isBackward=!0:r&&(r.push([o.source,o.target]),r.push([c.source,c.target])),[o,c]}r??=[];const n=this.recursiveParseDynamicStepChain(e.source,r);if(!kr(n)||!this.isValid(e))return[];const i=Wo(n),s={...this.parseAbstractDynamicStep(e),source:i.target},a=r.findIndex(([o,c])=>o===s.target&&c===s.source);return a!==-1?(s.isBackward=!0,r.splice(a,r.length-a)):r.push([s.source,s.target]),[...n,s]}parseDynamicStepSingle(e){const r=ha(
4018
- e.source);if(!r)throw new Error("Invalid reference to source");let n={...this.parseAbstractDynamicStep(e),source:this.resolveFqn(r)};return e.isBackward&&(n={...n,source:n.target,target:n.source,isBackward:!0}),n}parseAbstractDynamicStep(e){const r=ha(e.target);if(!r)throw new Error("Invalid reference to target");const n={target:this.resolveFqn(r),astPath:Wk(e)},i=gr(e.title);i&&(n.title=i);const s=e.kind?.ref?.name??e.dotKind?.kind.ref?.name;s&&(n.kind=s);for(const a of e.custom?.props??[])try{
4019
- switch(!0){case lf(a):{const o=a.value.view.ref?.name;be(o)&&(n.navigateTo=o);break}case df(a):case Lc(a):{if(Pr(a.value))if(a.key==="description"){const o=gr(a.value);o&&(n.description=o)}else n[a.key]=gr(zi(a.value))??"";break}case s_(a):{Pr(a.value)&&(n[a.key]=gr(a.value));break}case md(a):{Pr(a.value)&&(n[a.key]=a.value);break}case uo(a):{const o=hp(a);Pr(o)&&(n[a.key]=o);break}case Vd(a):{Pr(a.value)&&(n[a.key]=a.value);break}default:lt(a)}}catch(o){wi.warn(Ve(o))}return n}}}function Wk(t){
4020
- let e=t,r=[];for(;!Zm(e);)Di(e.$containerIndex)&&r.unshift(`@${e.$containerIndex}`),r.unshift(`/${e.$containerProperty??"__invalid__"}`),e=e.$container;return r.join("")}const Zae=Ye(xae,jae,Hae,Uae,Dae,Oae,Vae,Wae,Kae,qae);class Jae extends Zae{}const Cp=Fe.getChild("ModelParser");class Yae{services;cachedParsers=new qS(e=>this.createParser(e));constructor(e){this.services=e,e.shared.workspace.DocumentBuilder.onDocumentPhase(Ue.Linked,async r=>{this.cachedParsers.has(r)&&(Cp.trace("Linked: clea\
4020
+ e.source);if(!r)throw new Error("Invalid reference to source");let n={...this.parseAbstractDynamicStep(e),source:this.resolveFqn(r)};return e.isBackward&&(n={...n,source:n.target,target:n.source,isBackward:!0}),n}parseAbstractDynamicStep(e){const r=ha(e.target);if(!r)throw new Error("Invalid reference to target");const n={target:this.resolveFqn(r),astPath:Vk(e)},i=mr(e.title);i&&(n.title=i);const s=e.kind?.ref?.name??e.dotKind?.kind.ref?.name;s&&(n.kind=s);for(const a of e.custom?.props??[])try{
4021
+ switch(!0){case lf(a):{const o=a.value.view.ref?.name;be(o)&&(n.navigateTo=o);break}case df(a):case Lc(a):{if(Pr(a.value))if(a.key==="description"){const o=mr(a.value);o&&(n.description=o)}else n[a.key]=mr(zi(a.value))??"";break}case s_(a):{Pr(a.value)&&(n[a.key]=mr(a.value));break}case md(a):{Pr(a.value)&&(n[a.key]=a.value);break}case uo(a):{const o=hp(a);Pr(o)&&(n[a.key]=o);break}case Vd(a):{Pr(a.value)&&(n[a.key]=a.value);break}default:lt(a)}}catch(o){wi.warn(Ve(o))}return n}}}function Vk(t){
4022
+ let e=t,r=[];for(;!Zm(e);)Di(e.$containerIndex)&&r.unshift(`@${e.$containerIndex}`),r.unshift(`/${e.$containerProperty??"__invalid__"}`),e=e.$container;return r.join("")}const Xae=Ye(Dae,Hae,Uae,Gae,Mae,jae,Kae,Zae,Yae,Bae);class Qae extends Xae{}const Cp=Fe.getChild("ModelParser");class eoe{services;cachedParsers=new qS(e=>this.createParser(e));constructor(e){this.services=e,e.shared.workspace.DocumentBuilder.onDocumentPhase(Ue.Linked,async r=>{this.cachedParsers.has(r)&&(Cp.trace("Linked: clea\
4021
4023
  r cached parser {projectId} document {doc}",{projectId:r.likec4ProjectId,doc:Xe.basename(r.uri)}),this.cachedParsers.delete(r))}),e.shared.workspace.DocumentBuilder.onBuildPhase(Ue.Linked,async r=>{for(const n of r)if(!e.shared.workspace.ProjectsManager.isExcluded(n))try{this.parse(n)}catch(i){nt(i)}}),e.shared.workspace.DocumentBuilder.onDocumentPhase(Ue.Validated,async r=>{r.diagnostics?.some(n=>n.severity===Ha.Error)&&this.cachedParsers.has(r)&&(Cp.trace("Validated: clear cached parser {proje\
4022
- ctId} document {doc} because of errors",{projectId:r.likec4ProjectId,doc:Xe.basename(r.uri)}),this.cachedParsers.delete(r))})}documents(e){return this.services.shared.workspace.LangiumDocuments.projectDocuments(e).map(r=>this.parse(r))}parse(e){return this.forDocument(e).doc}forDocument(e){return this.cachedParsers.get(e)}createParser(e){fr(Bi(e),`Document ${e.uri.toString()} is not a LikeC4 document`);const r=Xe.basename(e.uri);e.likec4ProjectId?Cp.trace("create parser {projectId} document {doc\
4024
+ ctId} document {doc} because of errors",{projectId:r.likec4ProjectId,doc:Xe.basename(r.uri)}),this.cachedParsers.delete(r))})}documents(e){return this.services.shared.workspace.LangiumDocuments.projectDocuments(e).map(r=>this.parse(r))}parse(e){return this.forDocument(e).doc}forDocument(e){return this.cachedParsers.get(e)}createParser(e){yr(Bi(e),`Document ${e.uri.toString()} is not a LikeC4 document`);const r=Xe.basename(e.uri);e.likec4ProjectId?Cp.trace("create parser {projectId} document {doc\
4023
4025
  }",{projectId:e.likec4ProjectId,doc:r}):Cp.warn("create parser for document without project {doc}",{doc:e.uri.fsPath}),e.state<Ue.Linked&&Cp.warn("Document {doc} is not linked, state is {state}",{doc:r,state:e.state});const n={c4Specification:{tags:{},elements:{},relationships:{},colors:{},deployments:{}},c4Elements:[],c4ExtendElements:[],c4ExtendDeployments:[],c4ExtendRelations:[],c4Relations:[],c4Deployments:[],c4DeploymentRelations:[],c4Globals:{predicates:{},dynamicPredicates:{},styles:{}},c4Views:[],
4024
- c4Imports:new Fr(Set)};e=Object.assign(e,n);const i=new Jae(this.services,e);try{i.parseSpecification(),i.parseImports(),i.parseModel(),i.parseGlobals(),i.parseDeployment(),i.parseViews()}catch(s){throw new Error(`Error parsing document ${e.uri.fsPath}`,{cause:s})}return i}}class Xae extends iP{runConverter(e,r,n){return e.name==="MarkdownString"?((r.startsWith('"""')&&r.endsWith('"""')||r.startsWith("'''")&&r.endsWith("'''"))&&(r=r.slice(2,-2)),Ii.convertString(r)):super.runConverter(e,r,n)}}const{
4025
- findNodeForKeyword:Qae}=$w,eoe=(t,e,r=0)=>{const n=r>0?" ".repeat(r):"";return[n+`style ${t} {`,...fm(e).map(([i,s])=>n+` ${i} ${i==="opacity"?s.toString()+"%":s}`),n+"}"]},toe=(t,e)=>r=>{if(!Vc(r)&&!_d(r))return!1;const n=r.targets.value;if(!n||be(r.targets.prev)||n.$type!=="FqnRefExpr"||be(n.selector))return!1;const i=n.ref?.value?.ref;return(i?e.resolve(i):null)===t};function roe(t,{view:e,viewAst:r,targets:n,style:i}){ze(r.body,`View ${e.id} has no body`);const s=r.$cstNode;ze(s,"viewCstNod\
4026
- e");const a=Wo(r.body.rules)?.$cstNode?.range.end??r.body.$cstNode?.range.end;ze(a,"insertPos is not defined");const o=s.range.start.character+2,c=t.likec4.FqnIndex,l=Qe(r.body.rules,y=>Vc(y)||_d(y)),u=e[h2]==="element"?e.viewOf??null:null,d=[],f=[];n.forEach(y=>{const m=JP(l,toe(y,c)),h=u&&Bv(u,y)?y.substring(u.length+1):y;m?d.push({fqn:h,rule:m}):f.push({fqn:h})});const p={start:a,end:a},w=y=>{y.start.line<=p.start.line&&(y.start.line==p.start.line?p.start.character=Math.min(y.start.character,
4027
- p.start.character):p.start=y.start),y.end.line>=p.end.line&&(y.end.line==p.end.line?p.end.character=Math.max(y.end.character,p.end.character):p.end=y.end)},g=[];if(f.length>0){const y=f.flatMap(({fqn:m})=>eoe(m,i,o));g.push(bn.insert(a,`
4026
+ c4Imports:new Fr(Set)};e=Object.assign(e,n);const i=new Qae(this.services,e);try{i.parseSpecification(),i.parseImports(),i.parseModel(),i.parseGlobals(),i.parseDeployment(),i.parseViews()}catch(s){throw new Error(`Error parsing document ${e.uri.fsPath}`,{cause:s})}return i}}class toe extends iP{runConverter(e,r,n){return e.name==="MarkdownString"?((r.startsWith('"""')&&r.endsWith('"""')||r.startsWith("'''")&&r.endsWith("'''"))&&(r=r.slice(2,-2)),Ii.convertString(r)):super.runConverter(e,r,n)}}const{
4027
+ findNodeForKeyword:roe}=$w,noe=(t,e,r=0)=>{const n=r>0?" ".repeat(r):"";return[n+`style ${t} {`,...fm(e).map(([i,s])=>n+` ${i} ${i==="opacity"?s.toString()+"%":s}`),n+"}"]},ioe=(t,e)=>r=>{if(!Vc(r)&&!_d(r))return!1;const n=r.targets.value;if(!n||be(r.targets.prev)||n.$type!=="FqnRefExpr"||be(n.selector))return!1;const i=n.ref?.value?.ref;return(i?e.resolve(i):null)===t};function soe(t,{view:e,viewAst:r,targets:n,style:i}){ze(r.body,`View ${e.id} has no body`);const s=r.$cstNode;ze(s,"viewCstNod\
4028
+ e");const a=Wo(r.body.rules)?.$cstNode?.range.end??r.body.$cstNode?.range.end;ze(a,"insertPos is not defined");const o=s.range.start.character+2,c=t.likec4.FqnIndex,l=Qe(r.body.rules,y=>Vc(y)||_d(y)),u=e[h2]==="element"?e.viewOf??null:null,d=[],f=[];n.forEach(y=>{const m=JP(l,ioe(y,c)),h=u&&Bv(u,y)?y.substring(u.length+1):y;m?d.push({fqn:h,rule:m}):f.push({fqn:h})});const p={start:a,end:a},w=y=>{y.start.line<=p.start.line&&(y.start.line==p.start.line?p.start.character=Math.min(y.start.character,
4029
+ p.start.character):p.start=y.start),y.end.line>=p.end.line&&(y.end.line==p.end.line?p.end.character=Math.max(y.end.character,p.end.character):p.end=y.end)},g=[];if(f.length>0){const y=f.flatMap(({fqn:m})=>noe(m,i,o));g.push(bn.insert(a,`
4028
4030
  `+y.join(`
4029
- `))),p.start={line:a.line+1,character:o},p.end={line:a.line+y.length,character:Wo(y)?.length??0}}if(d.length>0)for(const{rule:y}of d){const m=y.$cstNode;ze(m,"RuleCstNode not found");for(const[h,v]of fm(i)){const b=h==="opacity"?v.toString()+"%":v,_=y.props.find(q=>q.key===h);if(_&&_.$cstNode){const{range:{start:q,end:Z}}=_.$cstNode;w({start:q,end:Z}),g.push(bn.replace({start:q,end:Z},h+" "+b));continue}const R=Qae(m,"{")?.range.end;ze(R,"Opening brace not found");const $=" ".repeat(m.range.start.
4031
+ `))),p.start={line:a.line+1,character:o},p.end={line:a.line+y.length,character:Wo(y)?.length??0}}if(d.length>0)for(const{rule:y}of d){const m=y.$cstNode;ze(m,"RuleCstNode not found");for(const[h,v]of fm(i)){const b=h==="opacity"?v.toString()+"%":v,_=y.props.find(q=>q.key===h);if(_&&_.$cstNode){const{range:{start:q,end:Z}}=_.$cstNode;w({start:q,end:Z}),g.push(bn.replace({start:q,end:Z},h+" "+b));continue}const R=roe(m,"{")?.range.end;ze(R,"Opening brace not found");const $=" ".repeat(m.range.start.
4030
4032
  character)+" ",M=$+h+" "+b;g.push(bn.insert(R,`
4031
- `+M)),w({start:{line:R.line+1,character:$.length},end:{line:R.line+1,character:M.length}})}}return{modifiedRange:p,edits:g}}const{findNodeForKeyword:noe}=$w;function ioe(t,{view:e,viewAst:r,layout:n}){ze(r.body,`View ${e.id} has no body`);const i=r.$cstNode;ze(i,"viewCstNode");const s=Nte(n.direction),a=JP(r.body.rules,Rf);let o=`autoLayout ${s}`;if(Di(n.rankSep)&&(o+=` ${n.rankSep}`,Di(n.nodeSep)&&(o+=` ${n.nodeSep}`)),a&&a.$cstNode)return bn.replace(a.$cstNode.range,o);const c=noe(r.body.$cstNode,
4033
+ `+M)),w({start:{line:R.line+1,character:$.length},end:{line:R.line+1,character:M.length}})}}return{modifiedRange:p,edits:g}}const{findNodeForKeyword:aoe}=$w;function ooe(t,{view:e,viewAst:r,layout:n}){ze(r.body,`View ${e.id} has no body`);const i=r.$cstNode;ze(i,"viewCstNode");const s=Lte(n.direction),a=JP(r.body.rules,Rf);let o=`autoLayout ${s}`;if(Di(n.rankSep)&&(o+=` ${n.rankSep}`,Di(n.nodeSep)&&(o+=` ${n.nodeSep}`)),a&&a.$cstNode)return bn.replace(a.$cstNode.range,o);const c=aoe(r.body.$cstNode,
4032
4034
  "}")?.range.start;ze(c,"Closing brace not found");const l=` ${o}
4033
- `;return bn.insert(c,l)}async function c4(t,{lookup:e}){if(!e.view.manualLayout)return!1;const r=e.viewAst.$cstNode;ze(r,"invalid view.$cstNode");const n=t.shared.lsp.Connection;ze(n,"LSP Connection not available");const i=El(r,["BLOCK_COMMENT"]);return i&&Av(i.text)?(await n.workspace.applyEdit({label:`LikeC4 - remove manual layout v1 for ${e.view.id}`,edit:{changes:{[e.doc.textDocument.uri]:[bn.del(i.range)]}}})).applied:!1}const Dv=Fe.getChild("model-changes");class soe{services;locator;constructor(e){
4035
+ `;return bn.insert(c,l)}async function a4(t,{lookup:e}){if(!e.view.manualLayout)return!1;const r=e.viewAst.$cstNode;ze(r,"invalid view.$cstNode");const n=t.shared.lsp.Connection;ze(n,"LSP Connection not available");const i=El(r,["BLOCK_COMMENT"]);return i&&Av(i.text)?(await n.workspace.applyEdit({label:`LikeC4 - remove manual layout v1 for ${e.view.id}`,edit:{changes:{[e.doc.textDocument.uri]:[bn.del(i.range)]}}})).applied:!1}const Dv=Fe.getChild("model-changes");class coe{services;locator;constructor(e){
4034
4036
  this.services=e,this.locator=e.likec4.ModelLocator}async applyChange(e){const r=this.services.shared.lsp.Connection;let n=null;try{await this.services.shared.workspace.WorkspaceLock.write(async()=>{let{viewId:i,projectId:s,change:a}=e;const o=this.services.shared.workspace.ProjectsManager.ensureProject(s);Dv.debug`Applying model change ${a.op} to view ${i} in project ${o.id}`;const c=this.locator.locateViewAst(i,o.id);if(!c)throw new Error(`View ${i} not found in project ${o.id}`);const l={uri:c.
4035
- doc.textDocument.uri,version:c.doc.textDocument.version};if(a.op==="save-view-snapshot"){ze(i===a.layout.id,"View ID does not match, expected "+i+", got "+a.layout.id),c.view.manualLayout&&await c4(this.services,{lookup:c}).catch(p=>{Dv.warn(`Failed to remove manual layout v1 for view ${i} in project ${o.id}`,{err:p})}),n={success:!0,location:await this.services.likec4.ManualLayouts.write(o,a.layout)};return}if(a.op==="reset-manual-layout"){c.view.manualLayout&&await c4(this.services,{lookup:c}).
4037
+ doc.textDocument.uri,version:c.doc.textDocument.version};if(a.op==="save-view-snapshot"){ze(i===a.layout.id,"View ID does not match, expected "+i+", got "+a.layout.id),c.view.manualLayout&&await a4(this.services,{lookup:c}).catch(p=>{Dv.warn(`Failed to remove manual layout v1 for view ${i} in project ${o.id}`,{err:p})}),n={success:!0,location:await this.services.likec4.ManualLayouts.write(o,a.layout)};return}if(a.op==="reset-manual-layout"){c.view.manualLayout&&await a4(this.services,{lookup:c}).
4036
4038
  catch(p=>{Dv.warn(`Failed to remove manual layout v1 for view ${i} in project ${o.id}`,{err:p})}),n={success:!0,location:await this.services.likec4.ManualLayouts.remove(o,i)};return}ze(r,"This change only supported in IDE (running as Extension)");const{edits:u,modifiedRange:d}=this.convertToTextEdit({lookup:c,change:a});if(!u.length)return;const f=await r.workspace.applyEdit({label:`LikeC4 - change view ${e.viewId}`,edit:{changes:{[l.uri]:u}}});if(!f.applied){r.window.showErrorMessage(`Failed to\
4037
- apply changes ${f.failureReason}`);return}n={success:!0,location:{uri:l.uri,range:d}}})}catch(i){const s=Ve(jC(i,`Failed to apply change ${e.change.op} ${e.viewId}`));Dv.error(s),n={success:!1,error:s}}finally{this.services.likec4.ModelBuilder.clearCache()}return n??{success:!1,error:"Unknown error applying model change"}}convertToTextEdit({lookup:e,change:r}){switch(r.op){case"change-element-style":return roe(this.services,{...e,targets:r.targets,style:r.style});case"change-autolayout":{const n=ioe(
4038
- this.services,{...e,layout:r.layout});return{modifiedRange:n.range,edits:[n]}}default:lt(r)}}}class aoe extends hP{services;constructor(e){super(),this.services=e}getNameStrict(e){return Dn(this.getName(e),`Failed getName for ${this.services.workspace.AstNodeLocator.getAstNodePath(e)}`)}getName(e){if(om(e))return e.name;if(Li(e))return e.imported.$refText;if(un(e))return e.target.modelElement.value.$refText}getNameNode(e){if(om(e))return super.getNameNode(e);if(Li(e))return e.imported.$refNode;if(un(
4039
- e))return e.target.modelElement.value.$refNode}}function ooe(t){return Ye(t,Vo(e=>`${e.type}.${e.name}`),fm(),oi(([e,r])=>r.length===1?r:[]))}class coe extends gP{constructor(e){super(e)}async computeExports(e,r){const n=[];try{const{specifications:i,models:s,views:a,globals:o,likec4lib:c,deployments:l}=e.parseResult.value;this.exportLibrary(c,n,e),this.exportSpecification(i,n,e),this.exportModel(s,n,e),this.exportViews(a,n,e),this.exportGlobals(o,n,e),this.exportDeployments(l,n,e)}catch(i){nt(i)}
4039
+ apply changes ${f.failureReason}`);return}n={success:!0,location:{uri:l.uri,range:d}}})}catch(i){const s=Ve(jC(i,`Failed to apply change ${e.change.op} ${e.viewId}`));Dv.error(s),n={success:!1,error:s}}finally{this.services.likec4.ModelBuilder.clearCache()}return n??{success:!1,error:"Unknown error applying model change"}}convertToTextEdit({lookup:e,change:r}){switch(r.op){case"change-element-style":return soe(this.services,{...e,targets:r.targets,style:r.style});case"change-autolayout":{const n=ooe(
4040
+ this.services,{...e,layout:r.layout});return{modifiedRange:n.range,edits:[n]}}default:lt(r)}}}class loe extends hP{services;constructor(e){super(),this.services=e}getNameStrict(e){return Dn(this.getName(e),`Failed getName for ${this.services.workspace.AstNodeLocator.getAstNodePath(e)}`)}getName(e){if(om(e))return e.name;if(Li(e))return e.imported.$refText;if(un(e))return e.target.modelElement.value.$refText}getNameNode(e){if(om(e))return super.getNameNode(e);if(Li(e))return e.imported.$refNode;if(un(
4041
+ e))return e.target.modelElement.value.$refNode}}function uoe(t){return Ye(t,Vo(e=>`${e.type}.${e.name}`),fm(),oi(([e,r])=>r.length===1?r:[]))}class doe extends gP{constructor(e){super(e)}async computeExports(e,r){const n=[];try{const{specifications:i,models:s,views:a,globals:o,likec4lib:c,deployments:l}=e.parseResult.value;this.exportLibrary(c,n,e),this.exportSpecification(i,n,e),this.exportModel(s,n,e),this.exportViews(a,n,e),this.exportGlobals(o,n,e),this.exportDeployments(l,n,e)}catch(i){nt(i)}
4040
4042
  return n}exportViews(e,r,n){const i=e?.flatMap(s=>s.views);if(!(Mt(i)||i.length===0))for(const s of i)try{be(s.name)&&r.push(this.descriptions.createDescription(s,s.name,n))}catch(a){nt(a)}}exportGlobals(e,r,n){if(!(Mt(e)||e.length===0)){for(const i of e.flatMap(s=>s.predicates))try{const s=i;be(s.name)&&r.push(this.descriptions.createDescription(s,s.name,n))}catch(s){nt(s)}for(const i of e.flatMap(s=>s.styles))try{const s=i.id;be(s.name)&&r.push(this.descriptions.createDescription(s,s.name,n))}catch(s){
4041
4043
  nt(s)}}}exportModel(e,r,n){if(!(Mt(e)||e.length===0))for(const i of e.flatMap(s=>s.elements))try{Ar(i)&&be(i.name)&&r.push(this.descriptions.createDescription(i,i.name,n))}catch(s){nt(s)}}exportLibrary(e,r,n){if(!Mt(e))try{for(const i of e.flatMap(s=>s.icons))r.push(this.descriptions.createDescription(i,i.name,n))}catch(i){nt(i)}}exportSpecification(e,r,n){if(!(Mt(e)||e.length===0))for(const i of e.flatMap(s=>[...s.elements,...s.relationships,...s.deploymentNodes,...s.tags,...s.colors]))try{switch(!0){case jc(
4042
4044
  i):case Fc(i):{be(i.kind.name)&&r.push(this.descriptions.createDescription(i.kind,i.kind.name,n));continue}case vf(i):{be(i.tag.name)&&r.push(this.descriptions.createDescription(i.tag,i.tag.name,n));continue}case Bc(i):{be(i.kind.name)&&r.push(this.descriptions.createDescription(i.kind,i.kind.name,n));continue}case Tg(i):{be(i.name.name)&&r.push(this.descriptions.createDescription(i.name,i.name.name,n));continue}default:lt(i)}}catch(s){nt(s)}}exportDeployments(e,r,n){const i=e?.flatMap(s=>s.elements);
4043
4045
  if(!(Mt(i)||i.length===0))for(const s of i)try{Kr(s)&&be(s.name)&&r.push(this.descriptions.createDescription(s,s.name,n))}catch(a){nt(a)}}computeLocalScopes(e,r){return new Promise(n=>{const i=e.parseResult.value,s=[],a=new Wa;for(const o of i.models)try{s.push(...this.processContainer(o,a,e))}catch(c){nt(c)}for(const o of i.deployments)try{s.push(...this.processDeployments(o,a,e))}catch(c){nt(c)}for(const o of i.imports.flatMap(c=>c.imports))try{let c=o;for(;c;)s.push(this.descriptions.createDescription(
4044
- c,c.imported.$refText)),c=c.prev}catch(c){nt(c)}ooe(s).forEach(o=>{a.add(i,o)}),n(a)})}processContainer(e,r,n){const i=new Wa,s=[];for(const o of e.elements){if(Mi(o))continue;let c;if(Ar(o)?(be(o.name)&&i.add(o.name,this.descriptions.createDescription(o,o.name,n)),c=o.body,c&&(r.add(c,this.descriptions.createDescription(o,"this",n)),r.add(c,this.descriptions.createDescription(o,"it",n)))):ho(o)&&(c=o.body),c&&c.elements.length>0)try{s.push(...this.processContainer(c,r,n))}catch(l){nt(l)}}s.length&&
4046
+ c,c.imported.$refText)),c=c.prev}catch(c){nt(c)}uoe(s).forEach(o=>{a.add(i,o)}),n(a)})}processContainer(e,r,n){const i=new Wa,s=[];for(const o of e.elements){if(Mi(o))continue;let c;if(Ar(o)?(be(o.name)&&i.add(o.name,this.descriptions.createDescription(o,o.name,n)),c=o.body,c&&(r.add(c,this.descriptions.createDescription(o,"this",n)),r.add(c,this.descriptions.createDescription(o,"it",n)))):ho(o)&&(c=o.body),c&&c.elements.length>0)try{s.push(...this.processContainer(c,r,n))}catch(l){nt(l)}}s.length&&
4045
4047
  Ye(s,Qe(o=>!i.has(o.name)),Vo(o=>o.name),XP((o,c)=>{o.length===1&&i.add(c,o[0])}));const a=[...i.values()];return r.addAll(e,a),a}processDeployments(e,r,n){const i=new Wa,s=[];for(const o of e.elements){if(ui(o))continue;let c=o.body;if(!Xs(o)){let l=this.nameProvider.getName(o);if(be(l)){const u=this.descriptions.createDescription(o,l,n);i.add(l,u)}c&&(r.add(c,this.descriptions.createDescription(o,"this",n)),r.add(c,this.descriptions.createDescription(o,"it",n)))}if(c)try{s.push(...this.processDeployments(
4046
- c,r,n))}catch(l){nt(l)}}s.length&&Ye(s,Qe(o=>!i.has(o.name)),Vo(o=>o.name),XP((o,c)=>{o.length===1&&i.add(c,o[0])}));const a=[...i.values()];return r.addAll(e,a),a}}const{getDocument:l4}=ec;class loe extends wP{deploymentsIndex;fqnIndex;indexManager;constructor(e){super(e),this.indexManager=e.shared.workspace.IndexManager,this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex}getScope(e){try{const r=ar(e.container),n=this.reflection.getReferenceType(e);try{const i=e.container;
4048
+ c,r,n))}catch(l){nt(l)}}s.length&&Ye(s,Qe(o=>!i.has(o.name)),Vo(o=>o.name),XP((o,c)=>{o.length===1&&i.add(c,o[0])}));const a=[...i.values()];return r.addAll(e,a),a}}const{getDocument:o4}=ec;class foe extends wP{deploymentsIndex;fqnIndex;indexManager;constructor(e){super(e),this.indexManager=e.shared.workspace.IndexManager,this.fqnIndex=e.likec4.FqnIndex,this.deploymentsIndex=e.likec4.DeploymentsIndex}getScope(e){try{const r=ar(e.container),n=this.reflection.getReferenceType(e);try{const i=e.container;
4047
4049
  if(Vx(i))return new Ga(this.streamForFqnRef(r,i,e));if(tI(i))return this.getScopeForStrictFqnRef(r,i,e);if(n!==En)return this.getProjectScope(r,n,e);if(Li(i)){const s=ar(i);return new Ga(this.fqnIndex.rootElements(s))}if(u_(i)&&e.property==="el"){const s=i.parent;return s?new Ga(this.fqnIndex.directChildrenOf(r,Io(s))):this.getProjectScope(r,n,e)}return new Ga(at(this.computeScope(r,e)))}catch(i){return nt(i),this.getProjectScope(r,n,e)}}catch(r){return nt(r),QB}}*genUniqueDescedants(e){const r=e();
4048
4050
  if(!r)return;const n=ar(r);if(Ar(r)){const i=this.fqnIndex.getFqn(r);yield*this.fqnIndex.uniqueDescedants(n,i);return}if(Kr(r)){const i=this.deploymentsIndex.getFqn(r);yield*this.deploymentsIndex.uniqueDescedants(n,i)}}*genScopeExtendElement({element:e}){e.el.$nodeDescription&&(yield e.el.$nodeDescription,yield{...e.el.$nodeDescription,name:"this"},yield{...e.el.$nodeDescription,name:"it"}),yield*this.genUniqueDescedants(()=>ha(e))}*genScopeElementView({viewOf:e,extends:r}){if(e){e.modelElement.
4049
4051
  value.$nodeDescription&&(yield e.modelElement.value.$nodeDescription),yield*this.genUniqueDescedants(()=>ha(e));return}if(r){const n=r.view.ref;n&&(yield*this.genScopeElementView(n))}}getScopeForStrictFqnRef(e,r,n){const i=r.parent;return i?new Ga(this.deploymentsIndex.directChildrenOf(e,Io(i)).filter(s=>this.reflection.isSubtype(s.type,li))):this.getProjectScope(e,li,n)}*genScopeExtendDeployment({deploymentNode:e}){e.value.$nodeDescription&&(yield e.value.$nodeDescription),yield*this.genUniqueDescedants(
4050
- ()=>{const r=e.value.ref;return r&&Kr(r)?r:void 0})}streamForFqnRef(e,r,n){const i=r.parent;if(!i)return at(this.genScopeForParentlessFqnRef(e,r,n));const s=i.value.ref;return s?Li(s)?at(this.genUniqueDescedants(()=>s.imported.ref)):Kr(s)?at(this.genUniqueDescedants(()=>s)):un(s)?at(this.genUniqueDescedants(()=>{const a=s.target.modelElement.value.ref;return Li(a)?a.imported.ref:Ar(a)?a:void 0})):Ar(s)?at(this.genUniqueDescedants(()=>s)):lt(s):Sl}*genScopeForParentlessFqnRef(e,r,n){Xn(r,Y0)||Ote(
4051
- r)?yield*this.computeScope(e,n,En):Dte(r)?(yield*this.computeScope(e,n,En),yield*this.computeScope(e,n,li),yield*this.computeScope(e,n,vs)):(yield*this.computeScope(e,n,li),yield*this.computeScope(e,n,vs),Xn(r,W0)&&(yield*this.computeScope(e,n,En)));const i=l4(r).precomputedScopes;i&&(yield*i.values().filter(s=>this.reflection.isSubtype(s.type,Qs)))}*computeScope(e,r,n=this.reflection.getReferenceType(r)){const i=this.reflection.isSubtype(n,En),s=this.reflection.isSubtype(n,Rm),a=l4(r.container).
4052
+ ()=>{const r=e.value.ref;return r&&Kr(r)?r:void 0})}streamForFqnRef(e,r,n){const i=r.parent;if(!i)return at(this.genScopeForParentlessFqnRef(e,r,n));const s=i.value.ref;return s?Li(s)?at(this.genUniqueDescedants(()=>s.imported.ref)):Kr(s)?at(this.genUniqueDescedants(()=>s)):un(s)?at(this.genUniqueDescedants(()=>{const a=s.target.modelElement.value.ref;return Li(a)?a.imported.ref:Ar(a)?a:void 0})):Ar(s)?at(this.genUniqueDescedants(()=>s)):lt(s):Sl}*genScopeForParentlessFqnRef(e,r,n){Xn(r,Y0)||jte(
4053
+ r)?yield*this.computeScope(e,n,En):Mte(r)?(yield*this.computeScope(e,n,En),yield*this.computeScope(e,n,li),yield*this.computeScope(e,n,vs)):(yield*this.computeScope(e,n,li),yield*this.computeScope(e,n,vs),Xn(r,W0)&&(yield*this.computeScope(e,n,En)));const i=o4(r).precomputedScopes;i&&(yield*i.values().filter(s=>this.reflection.isSubtype(s.type,Qs)))}*computeScope(e,r,n=this.reflection.getReferenceType(r)){const i=this.reflection.isSubtype(n,En),s=this.reflection.isSubtype(n,Rm),a=o4(r.container).
4052
4054
  precomputedScopes;if(!a){yield*this.getProjectScope(e,n,r).getAllElements();return}const o=l=>this.reflection.isSubtype(l.type,n);let c=r.container;for(;c;){const l=a.get(c).filter(o);l.length>0&&(yield*l),s&&e_(c)&&(yield*this.genScopeExtendDeployment(c.$container)),i&&sg(c)&&(yield*this.genScopeExtendElement(c.$container)),i&&X0(c)&&(yield*this.genScopeElementView(c.$container)),c=c.$container}yield*this.getProjectScope(e,n,r).getAllElements()}getProjectScope(e,r,n){return r===_s?super.getGlobalScope(
4053
- r,n):this.globalScopeCache.get(`${e}::${r}`,()=>new yP(this.indexManager.projectElements(e,r)))}getGlobalScope(e,r){if(e===_s)return super.getGlobalScope(e,r);const n=ar(r.container);return this.getProjectScope(n,e,r)}}var jr=Qa(),Gk;(function(t){t.type=new jr.NotificationType("likec4/onDidChangeModel")})(Gk||(Gk={}));var Kk;(function(t){t.Method="likec4/onDidChangeSnapshot",t.type=new jr.NotificationType(t.Method)})(Kk||(Kk={}));var Zk;(function(t){t.type=new jr.NotificationType("likec4/onReque\
4054
- stOpenView")})(Zk||(Zk={}));var Jk;(function(t){t.req=new jr.RequestType("likec4/fetchComputedModel")})(Jk||(Jk={}));var Yk;(function(t){t.req=new jr.RequestType0("likec4/fetchViewsFromAllProjects")})(Yk||(Yk={}));var Xk;(function(t){t.req=new jr.RequestType("likec4/fetchLayoutedModel")})(Xk||(Xk={}));var Qk;(function(t){t.req=new jr.RequestType("likec4/layout-view")})(Qk||(Qk={}));var eS;(function(t){t.req=new jr.RequestType("likec4/validate-layout")})(eS||(eS={}));var tS;(function(t){t.req=new jr.
4055
- RequestType0("likec4/reload-projects")})(tS||(tS={}));var rS;(function(t){t.req=new jr.RequestType0("likec4/fetch-projects")})(rS||(rS={}));var nS;(function(t){t.req=new jr.RequestType("likec4/register-project")})(nS||(nS={}));var iS;(function(t){t.req=new jr.RequestType("likec4/build")})(iS||(iS={}));var sS;(function(t){t.req=new jr.RequestType("likec4/locate")})(sS||(sS={}));var aS;(function(t){t.req=new jr.RequestType("likec4/change-view")})(aS||(aS={}));var oS;(function(t){t.req=new jr.RequestType0(
4056
- "likec4/metrics")})(oS||(oS={}));var cS;(function(t){t.req=new jr.RequestType("likec4/document-tags")})(cS||(cS={}));const cr=Fe.getChild("rpc");class uoe extends gk{services;constructor(e){super(),this.services=e}init(){const e=this.services.shared.lsp.Connection;if(!e){cr.info("no connection, skip init ServerRpc");return}cr.info("init ServerRpc");const r=this.services.likec4,n=this.services.shared.workspace.ProjectsManager,i=this.services.shared.workspace.LangiumDocuments,s=this.services.shared.
4057
- workspace.DocumentBuilder,a=lU(l=>{l>1?cr.debug`send ${"onDidChangeModel"} (${l} batched)`:cr.debug`send ${"onDidChangeModel"}`,e.sendNotification(Gk.type,"").catch(u=>{cr.warn("[ServerRpc] error sending onDidChangeModel:",{error:u})})},{reducer:(l,u)=>(l??0)+u,triggerAt:"end",minQuietPeriodMs:200,maxBurstDurationMs:400});let o=!0;this.onDispose(r.ModelBuilder.onModelParsed(()=>a.call(1)),e.onRequest(Jk.req,async({projectId:l,cleanCaches:u},d)=>{if(cr.debug`received request ${"fetchComputedModel"} for project ${l}`,
4058
- u){const p=(l?i.projectDocuments(l):i.allExcludingBuiltin).toArray().map(w=>w.uri);await s.update(p,[],d)}const f=await r.ModelBuilder.computeModel(l,d);return f!==Jo.EMPTY?{model:f.$model}:{model:null}}),e.onNotification(Kk.type,async({snapshotUri:l})=>{cr.debug`received notification ${"onDidChangeSnapshot"} for snapshot ${l}`;const u=ct.parse(l);await n.rebuidProject(n.belongsTo(u.path))}),e.onRequest(Xk.req,async({projectId:l},u)=>{cr.debug`received request ${"fetchLayoutedModel"} for project ${l}`;
4059
- const d=await r.LanguageServices.layoutedModel(l);if(d===null)return{model:null};const f=await r.Views.diagrams(l,u);return{model:{...d.$data,_stage:"layouted",views:Nu(f,p=>p.id)}}}),e.onRequest(Qk.req,async({viewId:l,projectId:u,layoutType:d},f)=>(cr.debug`received request ${"layoutView"} for ${l} from project ${u} (layout type: ${d??"not set"})`,{result:await r.Views.layoutView({viewId:l,projectId:u,layoutType:d,cancelToken:f})})),e.onRequest(eS.req,async({projectId:l},u)=>{cr.debug`received request ${"\
4060
- validateLayout"} for project ${l}`;const d=await r.Views.layoutAllViews(l,u);return{result:c(d.map(f=>f.diagram))}}),e.onRequest(rS.req,async()=>{cr.debug`received request ${"FetchProjects"}`;const l=i.groupedByProject();return{projects:Zo(l,(u,d)=>{const{folderUri:f,config:{name:p,title:w}}=n.getProject(d);return{folder:f.toString(),config:{name:p,title:w},docs:qt(u,g=>g.uri.toString())}})}}),e.onRequest(tS.req,async()=>{cr.debug`received request ${"ReloadProjects"}`,r.ManualLayouts.clearCaches(),
4061
- await n.reloadProjects()}),e.onRequest(nS.req,async l=>(cr.debug`received request ${"RegisterProject"}`,{id:(await n.registerProject(l)).id})),e.onRequest(Yk.req,async l=>{cr.debug`received request ${"FetchViewsFromAllProjects"}`;const u=n.all.map(async f=>{const p=await r.Views.computedViews(f,l);return Ye(p,qt(w=>({id:w.id,title:w.title??w.id,projectId:f})),n0((w,g)=>w.id==="index"?-1:g.id==="index"?1:w.title.localeCompare(g.title)))}),d=await Promise.allSettled(u);return await Qt(l),{views:Ye(
4062
- d,Qe(f=>f.status==="fulfilled"),oi(f=>f.value))}}),e.onRequest(iS.req,async({docs:l},u)=>{const d=l.map(w=>ct.parse(w)),f=w=>d.every(g=>!Xe.equals(g,w)),p=i.allExcludingBuiltin.toArray().filter(w=>f(w.uri)).map(w=>w.uri);cr.debug(`[ServerRpc] received request to build:
4055
+ r,n):this.globalScopeCache.get(`${e}::${r}`,()=>new yP(this.indexManager.projectElements(e,r)))}getGlobalScope(e,r){if(e===_s)return super.getGlobalScope(e,r);const n=ar(r.container);return this.getProjectScope(n,e,r)}}var jr=Qa(),Wk;(function(t){t.type=new jr.NotificationType("likec4/onDidChangeModel")})(Wk||(Wk={}));var Gk;(function(t){t.Method="likec4/onDidChangeSnapshot",t.type=new jr.NotificationType(t.Method)})(Gk||(Gk={}));var Kk;(function(t){t.type=new jr.NotificationType("likec4/onReque\
4056
+ stOpenView")})(Kk||(Kk={}));var Zk;(function(t){t.req=new jr.RequestType("likec4/fetchComputedModel")})(Zk||(Zk={}));var Jk;(function(t){t.req=new jr.RequestType0("likec4/fetchViewsFromAllProjects")})(Jk||(Jk={}));var Yk;(function(t){t.req=new jr.RequestType("likec4/fetchLayoutedModel")})(Yk||(Yk={}));var Xk;(function(t){t.req=new jr.RequestType("likec4/layout-view")})(Xk||(Xk={}));var Qk;(function(t){t.req=new jr.RequestType("likec4/validate-layout")})(Qk||(Qk={}));var eS;(function(t){t.req=new jr.
4057
+ RequestType0("likec4/reload-projects")})(eS||(eS={}));var tS;(function(t){t.req=new jr.RequestType0("likec4/fetch-projects")})(tS||(tS={}));var rS;(function(t){t.req=new jr.RequestType("likec4/register-project")})(rS||(rS={}));var nS;(function(t){t.req=new jr.RequestType("likec4/build")})(nS||(nS={}));var iS;(function(t){t.req=new jr.RequestType("likec4/locate")})(iS||(iS={}));var sS;(function(t){t.req=new jr.RequestType("likec4/change-view")})(sS||(sS={}));var aS;(function(t){t.req=new jr.RequestType0(
4058
+ "likec4/metrics")})(aS||(aS={}));var oS;(function(t){t.req=new jr.RequestType("likec4/document-tags")})(oS||(oS={}));const cr=Fe.getChild("rpc");class poe extends mk{services;constructor(e){super(),this.services=e}init(){const e=this.services.shared.lsp.Connection;if(!e){cr.info("no connection, skip init ServerRpc");return}cr.info("init ServerRpc");const r=this.services.likec4,n=this.services.shared.workspace.ProjectsManager,i=this.services.shared.workspace.LangiumDocuments,s=this.services.shared.
4059
+ workspace.DocumentBuilder,a=lU(l=>{l>1?cr.debug`send ${"onDidChangeModel"} (${l} batched)`:cr.debug`send ${"onDidChangeModel"}`,e.sendNotification(Wk.type,"").catch(u=>{cr.warn("[ServerRpc] error sending onDidChangeModel:",{error:u})})},{reducer:(l,u)=>(l??0)+u,triggerAt:"end",minQuietPeriodMs:200,maxBurstDurationMs:400});let o=!0;this.onDispose(r.ModelBuilder.onModelParsed(()=>a.call(1)),e.onRequest(Zk.req,async({projectId:l,cleanCaches:u},d)=>{if(cr.debug`received request ${"fetchComputedModel"} for project ${l}`,
4060
+ u){const p=(l?i.projectDocuments(l):i.allExcludingBuiltin).toArray().map(w=>w.uri);await s.update(p,[],d)}const f=await r.ModelBuilder.computeModel(l,d);return f!==Jo.EMPTY?{model:f.$model}:{model:null}}),e.onNotification(Gk.type,async({snapshotUri:l})=>{cr.debug`received notification ${"onDidChangeSnapshot"} for snapshot ${l}`;const u=ct.parse(l);await n.rebuidProject(n.belongsTo(u.path))}),e.onRequest(Yk.req,async({projectId:l},u)=>{cr.debug`received request ${"fetchLayoutedModel"} for project ${l}`;
4061
+ const d=await r.LanguageServices.layoutedModel(l);if(d===null)return{model:null};const f=await r.Views.diagrams(l,u);return{model:{...d.$data,_stage:"layouted",views:Nu(f,p=>p.id)}}}),e.onRequest(Xk.req,async({viewId:l,projectId:u,layoutType:d},f)=>(cr.debug`received request ${"layoutView"} for ${l} from project ${u} (layout type: ${d??"not set"})`,{result:await r.Views.layoutView({viewId:l,projectId:u,layoutType:d,cancelToken:f})})),e.onRequest(Qk.req,async({projectId:l},u)=>{cr.debug`received request ${"\
4062
+ validateLayout"} for project ${l}`;const d=await r.Views.layoutAllViews(l,u);return{result:c(d.map(f=>f.diagram))}}),e.onRequest(tS.req,async()=>{cr.debug`received request ${"FetchProjects"}`;const l=i.groupedByProject();return{projects:Zo(l,(u,d)=>{const{folderUri:f,config:{name:p,title:w}}=n.getProject(d);return{folder:f.toString(),config:{name:p,title:w},docs:qt(u,g=>g.uri.toString())}})}}),e.onRequest(eS.req,async()=>{cr.debug`received request ${"ReloadProjects"}`,r.ManualLayouts.clearCaches(),
4063
+ await n.reloadProjects()}),e.onRequest(rS.req,async l=>(cr.debug`received request ${"RegisterProject"}`,{id:(await n.registerProject(l)).id})),e.onRequest(Jk.req,async l=>{cr.debug`received request ${"FetchViewsFromAllProjects"}`;const u=n.all.map(async f=>{const p=await r.Views.computedViews(f,l);return Ye(p,qt(w=>({id:w.id,title:w.title??w.id,projectId:f})),n0((w,g)=>w.id==="index"?-1:g.id==="index"?1:w.title.localeCompare(g.title)))}),d=await Promise.allSettled(u);return await Qt(l),{views:Ye(
4064
+ d,Qe(f=>f.status==="fulfilled"),oi(f=>f.value))}}),e.onRequest(nS.req,async({docs:l},u)=>{const d=l.map(w=>ct.parse(w)),f=w=>d.every(g=>!Xe.equals(g,w)),p=i.allExcludingBuiltin.toArray().filter(w=>f(w.uri)).map(w=>w.uri);cr.debug(`[ServerRpc] received request to build:
4063
4065
  changed (total ${d.length}):${l.map(w=>`
4064
4066
  - `+w).join("")}
4065
4067
  deleted (total ${p.length}):${p.map(w=>`
4066
4068
  - `+w.toString()).join(`
4067
- `)}`),!o&&d.length+p.length>0&&await Promise.allSettled([...d,...p].map(async w=>{const g=w.toString();cr.debug(`clear diagnostics for ${g}`);try{await e.sendDiagnostics({uri:g,diagnostics:[]})}catch(y){cr.warn(`error clearing diagnostics for ${g}: ${y}`)}})),o=!1,await Qt(u),await s.update(d,p,u)}),e.onRequest(sS.req,l=>{switch(cr.debug`received request ${"locate"}, ${l}`,!0){case"element"in l:return r.ModelLocator.locateElement(l.element,l.projectId);case"relation"in l:return r.ModelLocator.locateRelation(
4068
- l.relation,l.projectId);case"astPath"in l:return r.ModelLocator.locateDynamicViewStep({view:l.view,astPath:l.astPath,projectId:l.projectId});case"view"in l:return r.ModelLocator.locateView(l.view,l.projectId);case"deployment"in l:return r.ModelLocator.locateDeploymentElement(l.deployment,l.projectId);default:lt(l)}}),e.onRequest(aS.req,async(l,u)=>{cr.debug`received request ${"changeView"} of ${l.viewId} from project ${l.projectId}`;const d=await r.ModelChanges.applyChange(l),f=l.change.op;return l.
4069
- projectId&&(f==="save-view-snapshot"||f==="reset-manual-layout")&&await n.rebuidProject(l.projectId),d}),e.onRequest(oS.req,async l=>{const u=[...n.all].map(async p=>{const w=await r.ModelBuilder.computeModel(p,l);return w===Jo.EMPTY?Promise.reject(new Error("Model is empty")):{elementKinds:_n(w.specification.elements).length,deploymentKinds:_n(w.specification.deployments).length,relationshipKinds:_n(w.specification.relationships).length,tags:_n(w.specification.tags).length,customColors:_n(w.specification.
4069
+ `)}`),!o&&d.length+p.length>0&&await Promise.allSettled([...d,...p].map(async w=>{const g=w.toString();cr.debug(`clear diagnostics for ${g}`);try{await e.sendDiagnostics({uri:g,diagnostics:[]})}catch(y){cr.warn(`error clearing diagnostics for ${g}: ${y}`)}})),o=!1,await Qt(u),await s.update(d,p,u)}),e.onRequest(iS.req,l=>{switch(cr.debug`received request ${"locate"}, ${l}`,!0){case"element"in l:return r.ModelLocator.locateElement(l.element,l.projectId);case"relation"in l:return r.ModelLocator.locateRelation(
4070
+ l.relation,l.projectId);case"astPath"in l:return r.ModelLocator.locateDynamicViewStep({view:l.view,astPath:l.astPath,projectId:l.projectId});case"view"in l:return r.ModelLocator.locateView(l.view,l.projectId);case"deployment"in l:return r.ModelLocator.locateDeploymentElement(l.deployment,l.projectId);default:lt(l)}}),e.onRequest(sS.req,async(l,u)=>{cr.debug`received request ${"changeView"} of ${l.viewId} from project ${l.projectId}`;const d=await r.ModelChanges.applyChange(l),f=l.change.op;return l.
4071
+ projectId&&(f==="save-view-snapshot"||f==="reset-manual-layout")&&await n.rebuidProject(l.projectId),d}),e.onRequest(aS.req,async l=>{const u=[...n.all].map(async p=>{const w=await r.ModelBuilder.computeModel(p,l);return w===Jo.EMPTY?Promise.reject(new Error("Model is empty")):{elementKinds:_n(w.specification.elements).length,deploymentKinds:_n(w.specification.deployments).length,relationshipKinds:_n(w.specification.relationships).length,tags:_n(w.specification.tags).length,customColors:_n(w.specification.
4070
4072
  customColors??{}).length,elements:_n(w.$data.elements).length,deploymentNodes:[...w.deployment.nodes()].length,relationships:_n(w.$data.relations).length,views:_n(w.$data.views).length,projects:1}}),d=await Promise.allSettled(u);await Qt(l);const f=d.filter(p=>p.status==="fulfilled").map(p=>p.value);return{metrics:f.length>0?f.reduce((p,w)=>({elementKinds:p.elementKinds+w.elementKinds,deploymentKinds:p.deploymentKinds+w.deploymentKinds,relationshipKinds:p.relationshipKinds+w.relationshipKinds,tags:p.
4071
- tags+w.tags,customColors:p.customColors+w.customColors,elements:p.elements+w.elements,deploymentNodes:p.deploymentNodes+w.deploymentNodes,relationships:p.relationships+w.relationships,views:p.views+w.views,projects:p.projects+1})):null}}),e.onRequest(cS.req,async({documentUri:l},u)=>({tags:await r.ModelLocator.locateDocumentTags(ct.parse(l),u)})),Ka.create(()=>{a.cancel()}));function c(l){return Ye(l,Qe(u=>!!u.hasLayoutDrift),qt(u=>{const d=r.ModelLocator.locateView(u.id);return ze(d,`View ${u.id}\
4072
- not found`),{uri:d.uri,viewId:u.id,severity:oo.DiagnosticSeverity.Warning,message:`Layout drift detected for view '${u.id}'`,range:d.range}}))}}async openView(e){const r=this.services.shared.lsp.Connection;if(!r){cr.warn("No LSP connection");return}await r.sendNotification(Zk.type,e)}}class doe{services;constructor(e){this.services=e}getSymbolKind(e){const r=Bt(e)?e.$type:e.type,n=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(r,s));switch(!0){case n(En,po,li,vs,Qs):return si.Constructor;case n(
4073
+ tags+w.tags,customColors:p.customColors+w.customColors,elements:p.elements+w.elements,deploymentNodes:p.deploymentNodes+w.deploymentNodes,relationships:p.relationships+w.relationships,views:p.views+w.views,projects:p.projects+1})):null}}),e.onRequest(oS.req,async({documentUri:l},u)=>({tags:await r.ModelLocator.locateDocumentTags(ct.parse(l),u)})),Ka.create(()=>{a.cancel()}));function c(l){return Ye(l,Qe(u=>!!u.hasLayoutDrift),qt(u=>{const d=r.ModelLocator.locateView(u.id);return ze(d,`View ${u.id}\
4074
+ not found`),{uri:d.uri,viewId:u.id,severity:oo.DiagnosticSeverity.Warning,message:`Layout drift detected for view '${u.id}'`,range:d.range}}))}}async openView(e){const r=this.services.shared.lsp.Connection;if(!r){cr.warn("No LSP connection");return}await r.sendNotification(Kk.type,e)}}class hoe{services;constructor(e){this.services=e}getSymbolKind(e){const r=Bt(e)?e.$type:e.type,n=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(r,s));switch(!0){case n(En,po,li,vs,Qs):return si.Constructor;case n(
4073
4075
  Nc,Oc,Dc,xc,zc):return si.Namespace;case n(co):return si.Class;case n(ta,_s,fo,Uc):return si.EnumMember;case n(ea,Hc):return si.Event;case n(bs,ws,qc,Mc):return si.TypeParameter}return si.Field}getCompletionItemKind(e){const r=Bt(e)?e.$type:e.type,n=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(r,s));switch(!0){case n(fo):return xt.Color;case n(En,li,vs,po,Qs):return xt.Constructor;case n(Nc,Oc,Dc,xc,zc):return xt.Module;case n(co):return xt.Class;case n(ta,_s,fo,Uc):return xt.EnumMember;case n(
4074
- ea,Hc):return xt.Event;case n(bs,qc,ws,Mc):return xt.TypeParameter;default:return xt.Reference}}}class foe extends Rx{}const lS=Fe.getChild("views");class poe{services;cache=new WeakMap;viewsWithReportedErrors=new Set;ModelBuilder;constructor(e){this.services=e,this.ModelBuilder=e.likec4.ModelBuilder}get layouter(){return this.services.likec4.Layouter}async computedViews(e,r){const n=await this.ModelBuilder.computeModel(e,r);return wl(n.$data.views)}async _layoutAllViews(e,r){const n=wl(e.$data.
4075
- views);if(n.length===0)return[];const i=Oy(),s=e.project.id,a=lS.getChild(s);a.debug`layoutAll: ${n.length} views`;const o=[],c=e.$styles,l=[];for(const u of n){let d=this.cache.get(u);if(d){a.debug`layout ${u.id} from cache`,l.push(d);continue}o.push({view:u,styles:c})}return o.length>0&&await this.layouter.batchLayout({batch:o,cancelToken:r,onSuccess:(u,d)=>{l.push(this.viewSucceed(u.view,e,d))},onError:(u,d)=>{a.warn(`Fail layout view ${u.view.id}`,{error:d})}}),r&&r.isCancellationRequested&&
4076
- await Qt(r),l.length!==n.length?a.warn`layouted ${l.length} of ${n.length} views in ${i.pretty}`:l.length>0&&a.debug`layouted all ${l.length} views in ${i.pretty}`,l}async layoutAllViews(e,r){const n=await this.ModelBuilder.computeModel(e,r);return await this._layoutAllViews(n,r)}async layoutView({viewId:e,layoutType:r,projectId:n,cancelToken:i}){const s=await this.ModelBuilder.computeModel(n,i),a=s.findView(e)?.$view;n=s.project.id;const o=lS.getChild(n);if(!a){o.warn`layoutView ${e} not found`;
4076
+ ea,Hc):return xt.Event;case n(bs,qc,ws,Mc):return xt.TypeParameter;default:return xt.Reference}}}class moe extends Rx{}const cS=Fe.getChild("views");class goe{services;cache=new WeakMap;viewsWithReportedErrors=new Set;ModelBuilder;constructor(e){this.services=e,this.ModelBuilder=e.likec4.ModelBuilder}get layouter(){return this.services.likec4.Layouter}async computedViews(e,r){const n=await this.ModelBuilder.computeModel(e,r);return wl(n.$data.views)}async _layoutAllViews(e,r){const n=wl(e.$data.
4077
+ views);if(n.length===0)return[];const i=Oy(),s=e.project.id,a=cS.getChild(s);a.debug`layoutAll: ${n.length} views`;const o=[],c=e.$styles,l=[];for(const u of n){let d=this.cache.get(u);if(d){a.debug`layout ${u.id} from cache`,l.push(d);continue}o.push({view:u,styles:c})}return o.length>0&&await this.layouter.batchLayout({batch:o,cancelToken:r,onSuccess:(u,d)=>{l.push(this.viewSucceed(u.view,e,d))},onError:(u,d)=>{a.warn(`Fail layout view ${u.view.id}`,{error:d})}}),r&&r.isCancellationRequested&&
4078
+ await Qt(r),l.length!==n.length?a.warn`layouted ${l.length} of ${n.length} views in ${i.pretty}`:l.length>0&&a.debug`layouted all ${l.length} views in ${i.pretty}`,l}async layoutAllViews(e,r){const n=await this.ModelBuilder.computeModel(e,r);return await this._layoutAllViews(n,r)}async layoutView({viewId:e,layoutType:r,projectId:n,cancelToken:i}){const s=await this.ModelBuilder.computeModel(n,i),a=s.findView(e)?.$view;n=s.project.id;const o=cS.getChild(n);if(!a){o.warn`layoutView ${e} not found`;
4077
4079
  const c=s.findManualLayout(e);if(c){o.debug`found manual layout for ${e}`;let l={...c};return l.drifts=["not-exists"],l._layout="manual",{diagram:l,dot:"# manual layout"}}return null}try{const c=Oy(),l=this.cache.get(a)??await this.layouter.layout({view:a,styles:s.$styles});return this.cache.has(a)?o.debug`layout ${e} from cache`:(this.viewSucceed(a,s,l),o.debug(`layout {viewId} in ${c.pretty}`,{viewId:e})),be(r)?{dot:l.dot,diagram:this.withLayoutType(l.diagram,s,r)}:l}catch(c){const l=Ve(c);return o.
4078
4080
  warn(l),this.reportViewError(a,n,l),Promise.reject(c)}}async diagrams(e,r){const n=await this.ModelBuilder.computeModel(e,r);return(await this._layoutAllViews(n,r)).map(({diagram:i})=>this.withLayoutType(i,n,"manual"))}async viewsAsGraphvizOut(e,r){const n="All-LayoutedViews-DotWithSvg",i=this.services.shared.workspace.Cache;if(i.has(n))return await Promise.resolve(i.get(n));const s=await this.ModelBuilder.computeModel(e,r),a=wl(s.$data.views);if(a.length===0)return[];const o=a.map(async u=>{const{
4079
4081
  dot:d,svg:f}=await this.layouter.svg({view:u,styles:s.$styles});return{id:u.id,dot:d,svg:f}}),c=[],l=await Promise.allSettled(o);for(const u of l)u.status==="fulfilled"?c.push(u.value):nt(u.reason);return i.set(n,c),c}async openView(e,r){await this.services.Rpc.openView({viewId:e,projectId:r})}reportViewError(e,r,n){const i=`${r}-${e.id}`;this.cache.delete(e),this.viewsWithReportedErrors.has(i)||(this.services.shared.lsp.Connection?.window.showErrorMessage(`LikeC4: ${n}`),this.viewsWithReportedErrors.
4080
- add(i))}withLayoutType(e,r,n){if(!n)return e;const i=r.findManualLayout(e.id);return i?n==="manual"?e[SS]==="manual"?(lS.error(`View ${e.id} already has manual layout, this should not happen`),e):m2(e,i):g2(e,i):e}viewSucceed(e,r,n){const i=`${r.project.id}-${e.id}`;return this.viewsWithReportedErrors.delete(i),this.cache.set(e,n),n}}const u4={manualLayouts:()=>({read:()=>Promise.resolve(null),write:()=>Promise.reject(new Error("NoopLikeC4ManualLayouts: write operation is not supported")),remove:()=>Promise.
4081
- resolve(null),clearCaches:()=>{}})},hoe=t=>({lsp:{NodeKindProvider:e=>new doe(e),WorkspaceSymbolProvider:e=>new foe(e)},workspace:{Cache:e=>new vc(e,Ue.Validated),IndexManager:e=>new Bte(e),LangiumDocuments:e=>new Vte(e),ProjectsManager:e=>new In(e),WorkspaceManager:e=>new Ere(e),FileSystemProvider:e=>t.fileSystemProvider(e),FileSystemWatcher:e=>t.fileSystemWatcher(e)}});function Nt(t){return e=>new t(e)}const moe=t=>({documentation:{DocumentationProvider:Nt(Mte)},validation:{DocumentValidator:Nt(
4082
- Eae)},Rpc:Nt(uoe),mcp:{Server:e=>t.mcpServer(e),ServerFactory:Nt(Xie)},likec4:{LanguageServices:Nt(Tre),Layouter:e=>new mO({graphviz:new xn}),Views:Nt(poe),ManualLayouts:e=>t.manualLayouts(e),DeploymentsIndex:Nt(Qie),ModelChanges:Nt(soe),FqnIndex:Nt(WM),ModelParser:Nt(Yae),ModelBuilder:Nt(Lse),ModelLocator:Nt(Fse)},lsp:{CompletionProvider:Nt(qre),DocumentHighlightProvider:Nt(Fre),DocumentSymbolProvider:Nt(Bre),SemanticTokenProvider:Nt(Vre),HoverProvider:Nt(zre),CodeLensProvider:Nt(jre),DocumentLinkProvider:Nt(
4083
- Hre),Formatter:Nt(Fte),CodeActionProvider:Nt(Ure)},workspace:{AstNodeDescriptionProvider:Nt(Hte)},references:{NameProvider:Nt(aoe),ScopeComputation:Nt(coe),ScopeProvider:Nt(loe)},parser:{ValueConverter:Nt(Xae)}});function goe(t,e,r,n){const i=yoe(t),s=[mK({shared:i}),u7,moe({...UM,...u4,...t}),e,r,n].reduce(d4,{}),a=um(s);return i.ServiceRegistry.register(a),Aae(a),t.connection?zS(()=>a.Rpc.init()):i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:a}}function yoe(t={}){const e={
4084
- ...UM,...Tx,...u4,...t};return um(yK(e),l7,hoe(e))}function d4(t,e){if(e){for(const[r,n]of Object.entries(e))if(n!==void 0){const i=t[r];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?t[r]=d4(i,n):t[r]=n}}return t}const voe=t=>({start:Ei.hrtime.bigint(),command:t.map(e=>woe(W4(e))).join(" "),state:{stdout:"",stderr:"",output:""}}),woe=t=>/[^\w./-]/.test(t)?`'${t.replaceAll("'","'\\''")}'`:t,boe=({stdin:t,stdout:e,stderr:r,stdio:n=[t,e,r],env:i,preferLocal:s,cwd:a=".",...o})=>{const c=a instanceof
4085
- URL?F4(a):Ms.resolve(a),l=i?{...Ei.env,...i}:void 0,u=n[0]?.string;return{...o,input:u,stdio:u===void 0?n:["pipe",...n.slice(1)],env:s?_oe(l??Ei.env,c):l,cwd:c}},_oe=({Path:t="",PATH:e=t,...r},n)=>{const i=e.split(Ms.delimiter),s=f4([],Ms.resolve(n)).map(a=>Ms.join(a,"node_modules/.bin")).filter(a=>!i.includes(a));return{...r,PATH:[...s,e].filter(Boolean).join(Ms.delimiter)}},f4=(t,e)=>t.at(-1)===e?t:f4([...t,e],Ms.resolve(e,"..")),Roe=async(t,e,r)=>await koe(t,r)?[uS(t),e.map(n=>Poe(n)),{...r,shell:!0}]:
4086
- [t,e,r],koe=async(t,{shell:e,cwd:r,env:n=Ei.env})=>Ei.platform==="win32"&&!e&&!await Soe(t,r,n),Soe=(t,e,{Path:r="",PATH:n=r})=>h4.some(i=>t.toLowerCase().endsWith(i))||$oe(t,e,n),Eoe={},p4=t=>(...e)=>Eoe[e.join("\0")]??=t(...e),Toe=p4(w2.access),$oe=p4(async(t,e,r)=>{const n=r.split(Ms.delimiter).filter(Boolean).map(i=>i.replace(/^"(.*)"$/,"$1"));try{await Promise.any([e,...n].flatMap(i=>h4.map(s=>Toe(`${Ms.resolve(i,t)}${s}`))))}catch{return!1}return!0}),h4=[".exe",".com"],Poe=t=>uS(uS(`"${t.replaceAll(
4087
- /(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),uS=t=>t.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1"),Coe=async(t,{input:e},r)=>{const n=await t;e!==void 0&&n.stdin.end(e);const i=ZS(n,"close");try{return await Promise.race([i,...n.stdio.filter(Boolean).map(s=>Aoe(s))]),xoe(r,g4(n)),y4(r)}catch(s){throw await Promise.allSettled([i]),m4(s,n,r)}},Aoe=async t=>{for await(const[e]of ij(t,"error"))if(!["ERR_STREAM_PREMATURE_CLOSE","EPIPE"].includes(e?.code))throw e},xoe=({command:t},{exitCode:e,signalName:r})=>{
4088
- if(r!==void 0)throw new qo(`Command was terminated with ${r}: ${t}`);if(e!==void 0)throw new qo(`Command failed with exit code ${e}: ${t}`)},m4=(t,e,r)=>Object.assign(Ioe(t,r),g4(e),y4(r)),Ioe=(t,{command:e})=>t instanceof qo?t:new qo(`Command failed: ${e}`,{cause:t});class qo extends Error{name="SubprocessError"}const g4=({exitCode:t,signalCode:e})=>({...t<1?{}:{exitCode:t},...e===null?{}:{signalName:e}}),y4=({state:{stdout:t,stderr:e,output:r},command:n,start:i})=>({stdout:dS(t),stderr:dS(e),output:dS(
4089
- r),command:n,durationMs:Number(Ei.hrtime.bigint()-i)/1e6}),dS=t=>t.at(-1)===`
4090
- `?t.slice(0,t.at(-2)==="\r"?-2:-1):t,Noe=async(t,e,r,n)=>{try{["node","node.exe"].includes(t.toLowerCase())&&(t=Ei.execPath,e=[...Ei.execArgv.filter(s=>!s.startsWith("--inspect")),...e]),[t,e,r]=await Roe(t,e,r),[t,e,r]=Doe(t,e,r);const i=nj(t,e,r);return v4(i.stdout,n,"stdout"),v4(i.stderr,n,"stderr"),i.once("error",()=>{}),await ZS(i,"spawn"),i}catch(i){throw m4(i,{},n)}},Doe=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r],v4=(t,{state:e},r)=>{t&&(t.setEncoding("utf8"),e.isIterating||
4091
- (e.isIterating=!1,t.on("data",n=>{e[r]+=n,e.output+=n})))},Ooe=async t=>{const[[e,r]]=await Promise.all([Promise.allSettled(t),Loe(t)]);if(r.reason)throw r.reason.pipedFrom=e.reason??e.value,r.reason;if(e.reason)throw e.reason;return{...r.value,pipedFrom:e.value}},Loe=async t=>{try{const[{stdout:e},{stdin:r}]=await Promise.all(t.map(({nodeChildProcess:n})=>n));if(r===null)throw new Error('The "stdin" option must be set on the first "spawn()" call in the pipeline.');if(e===null)throw new Error('T\
4092
- he "stdout" option must be set on the last "spawn()" call in the pipeline.');sj(e,r).catch(()=>{})}catch(e){throw await Promise.allSettled(t.map(({nodeChildProcess:r})=>Moe(r))),e}},Moe=async t=>{const{stdin:e}=await t;e.end()},w4=async function*(t,{state:e},r){if(e.isIterating===!1)throw new Error(`The subprocess must be iterated right away, for example:
4093
- for await (const line of spawn(...)) { ... }`);e.isIterating=!0;try{const{[r]:n}=await t.nodeChildProcess;if(!n)return;joe(t),yield*aj.createInterface({input:n})}finally{await t}},joe=async t=>{try{await t}catch{}},qoe=async function*(...t){try{let e=[];for(;t.length>0;){e=t.map((a,o)=>e[o]??Foe(a));const[{value:r,done:n},i]=await Promise.race(e.map((a,o)=>Promise.all([a,o]))),[s]=t.splice(i,1);e.splice(i,1),n||(t.push(s),yield r)}}finally{await Promise.all(t.map(e=>e.return()))}},Foe=async t=>{
4094
- try{return await t.next()}catch(e){await t.throw(e)}};function Ap(t,e,r,n){const[i=[],s={}]=Array.isArray(e)?[e,r]:[[],e],a=voe([t,...i]),o=boe(s),c=Noe(t,i,o,a);let l=Coe(c,o,a);Object.assign(l,{nodeChildProcess:c}),l=n?Ooe([n,l]):l;const u=w4(l,a,"stdout"),d=w4(l,a,"stderr");return Object.assign(l,{nodeChildProcess:c,stdout:u,stderr:d,[Symbol.asyncIterator]:()=>qoe(u,d),pipe:(f,p,w)=>Ap(f,p,w,l)})}var bi={},Fo={},b4;function Hoe(){if(b4)return Fo;b4=1,Object.defineProperty(Fo,"__esModule",{value:!0}),
4082
+ add(i))}withLayoutType(e,r,n){if(!n)return e;const i=r.findManualLayout(e.id);return i?n==="manual"?e[SS]==="manual"?(cS.error(`View ${e.id} already has manual layout, this should not happen`),e):m2(e,i):g2(e,i):e}viewSucceed(e,r,n){const i=`${r.project.id}-${e.id}`;return this.viewsWithReportedErrors.delete(i),this.cache.set(e,n),n}}const c4={manualLayouts:()=>({read:()=>Promise.resolve(null),write:()=>Promise.reject(new Error("NoopLikeC4ManualLayouts: write operation is not supported")),remove:()=>Promise.
4083
+ resolve(null),clearCaches:()=>{}})},yoe=t=>({lsp:{NodeKindProvider:e=>new hoe(e),WorkspaceSymbolProvider:e=>new moe(e)},workspace:{Cache:e=>new vc(e,Ue.Validated),IndexManager:e=>new Vte(e),LangiumDocuments:e=>new Kte(e),ProjectsManager:e=>new In(e),WorkspaceManager:e=>new Pre(e),FileSystemProvider:e=>t.fileSystemProvider(e),FileSystemWatcher:e=>t.fileSystemWatcher(e)}});function Nt(t){return e=>new t(e)}const voe=t=>({documentation:{DocumentationProvider:Nt(Fte)},validation:{DocumentValidator:Nt(
4084
+ Pae)},Rpc:Nt(poe),mcp:{Server:e=>t.mcpServer(e),ServerFactory:Nt(tse)},likec4:{LanguageServices:Nt(Cre),Layouter:e=>new pO({graphviz:new xn}),Views:Nt(goe),ManualLayouts:e=>t.manualLayouts(e),DeploymentsIndex:Nt(rse),ModelChanges:Nt(coe),FqnIndex:Nt(UM),ModelParser:Nt(eoe),ModelBuilder:Nt(qse),ModelLocator:Nt(zse)},lsp:{CompletionProvider:Nt(Bre),DocumentHighlightProvider:Nt(zre),DocumentSymbolProvider:Nt(Vre),SemanticTokenProvider:Nt(Kre),HoverProvider:Nt(Wre),CodeLensProvider:Nt(Hre),DocumentLinkProvider:Nt(
4085
+ Ure),Formatter:Nt(zte),CodeActionProvider:Nt(Gre)},workspace:{AstNodeDescriptionProvider:Nt(Ute)},references:{NameProvider:Nt(loe),ScopeComputation:Nt(doe),ScopeProvider:Nt(foe)},parser:{ValueConverter:Nt(toe)}});function woe(t,e,r,n){const i=boe(t),s=[mK({shared:i}),u7,voe({...BM,...c4,...t}),e,r,n].reduce(l4,{}),a=um(s);return i.ServiceRegistry.register(a),Nae(a),t.connection?zS(()=>a.Rpc.init()):i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:a}}function boe(t={}){const e={
4086
+ ...BM,...Tx,...c4,...t};return um(yK(e),l7,yoe(e))}function l4(t,e){if(e){for(const[r,n]of Object.entries(e))if(n!==void 0){const i=t[r];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?t[r]=l4(i,n):t[r]=n}}return t}const _oe=t=>({start:Ei.hrtime.bigint(),command:t.map(e=>Roe(W4(e))).join(" "),state:{stdout:"",stderr:"",output:""}}),Roe=t=>/[^\w./-]/.test(t)?`'${t.replaceAll("'","'\\''")}'`:t,koe=({stdin:t,stdout:e,stderr:r,stdio:n=[t,e,r],env:i,preferLocal:s,cwd:a=".",...o})=>{const c=a instanceof
4087
+ URL?F4(a):Ms.resolve(a),l=i?{...Ei.env,...i}:void 0,u=n[0]?.string;return{...o,input:u,stdio:u===void 0?n:["pipe",...n.slice(1)],env:s?Soe(l??Ei.env,c):l,cwd:c}},Soe=({Path:t="",PATH:e=t,...r},n)=>{const i=e.split(Ms.delimiter),s=u4([],Ms.resolve(n)).map(a=>Ms.join(a,"node_modules/.bin")).filter(a=>!i.includes(a));return{...r,PATH:[...s,e].filter(Boolean).join(Ms.delimiter)}},u4=(t,e)=>t.at(-1)===e?t:u4([...t,e],Ms.resolve(e,"..")),Eoe=async(t,e,r)=>await Toe(t,r)?[lS(t),e.map(n=>xoe(n)),{...r,shell:!0}]:
4088
+ [t,e,r],Toe=async(t,{shell:e,cwd:r,env:n=Ei.env})=>Ei.platform==="win32"&&!e&&!await $oe(t,r,n),$oe=(t,e,{Path:r="",PATH:n=r})=>f4.some(i=>t.toLowerCase().endsWith(i))||Aoe(t,e,n),Poe={},d4=t=>(...e)=>Poe[e.join("\0")]??=t(...e),Coe=d4(w2.access),Aoe=d4(async(t,e,r)=>{const n=r.split(Ms.delimiter).filter(Boolean).map(i=>i.replace(/^"(.*)"$/,"$1"));try{await Promise.any([e,...n].flatMap(i=>f4.map(s=>Coe(`${Ms.resolve(i,t)}${s}`))))}catch{return!1}return!0}),f4=[".exe",".com"],xoe=t=>lS(lS(`"${t.replaceAll(
4089
+ /(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),lS=t=>t.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1"),Ioe=async(t,{input:e},r)=>{const n=await t;e!==void 0&&n.stdin.end(e);const i=ZS(n,"close");try{return await Promise.race([i,...n.stdio.filter(Boolean).map(s=>Noe(s))]),Doe(r,h4(n)),m4(r)}catch(s){throw await Promise.allSettled([i]),p4(s,n,r)}},Noe=async t=>{for await(const[e]of ij(t,"error"))if(!["ERR_STREAM_PREMATURE_CLOSE","EPIPE"].includes(e?.code))throw e},Doe=({command:t},{exitCode:e,signalName:r})=>{
4090
+ if(r!==void 0)throw new qo(`Command was terminated with ${r}: ${t}`);if(e!==void 0)throw new qo(`Command failed with exit code ${e}: ${t}`)},p4=(t,e,r)=>Object.assign(Ooe(t,r),h4(e),m4(r)),Ooe=(t,{command:e})=>t instanceof qo?t:new qo(`Command failed: ${e}`,{cause:t});class qo extends Error{name="SubprocessError"}const h4=({exitCode:t,signalCode:e})=>({...t<1?{}:{exitCode:t},...e===null?{}:{signalName:e}}),m4=({state:{stdout:t,stderr:e,output:r},command:n,start:i})=>({stdout:uS(t),stderr:uS(e),output:uS(
4091
+ r),command:n,durationMs:Number(Ei.hrtime.bigint()-i)/1e6}),uS=t=>t.at(-1)===`
4092
+ `?t.slice(0,t.at(-2)==="\r"?-2:-1):t,Loe=async(t,e,r,n)=>{try{["node","node.exe"].includes(t.toLowerCase())&&(t=Ei.execPath,e=[...Ei.execArgv.filter(s=>!s.startsWith("--inspect")),...e]),[t,e,r]=await Eoe(t,e,r),[t,e,r]=Moe(t,e,r);const i=nj(t,e,r);return g4(i.stdout,n,"stdout"),g4(i.stderr,n,"stderr"),i.once("error",()=>{}),await ZS(i,"spawn"),i}catch(i){throw p4(i,{},n)}},Moe=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r],g4=(t,{state:e},r)=>{t&&(t.setEncoding("utf8"),e.isIterating||
4093
+ (e.isIterating=!1,t.on("data",n=>{e[r]+=n,e.output+=n})))},joe=async t=>{const[[e,r]]=await Promise.all([Promise.allSettled(t),qoe(t)]);if(r.reason)throw r.reason.pipedFrom=e.reason??e.value,r.reason;if(e.reason)throw e.reason;return{...r.value,pipedFrom:e.value}},qoe=async t=>{try{const[{stdout:e},{stdin:r}]=await Promise.all(t.map(({nodeChildProcess:n})=>n));if(r===null)throw new Error('The "stdin" option must be set on the first "spawn()" call in the pipeline.');if(e===null)throw new Error('T\
4094
+ he "stdout" option must be set on the last "spawn()" call in the pipeline.');sj(e,r).catch(()=>{})}catch(e){throw await Promise.allSettled(t.map(({nodeChildProcess:r})=>Foe(r))),e}},Foe=async t=>{const{stdin:e}=await t;e.end()},y4=async function*(t,{state:e},r){if(e.isIterating===!1)throw new Error(`The subprocess must be iterated right away, for example:
4095
+ for await (const line of spawn(...)) { ... }`);e.isIterating=!0;try{const{[r]:n}=await t.nodeChildProcess;if(!n)return;Hoe(t),yield*aj.createInterface({input:n})}finally{await t}},Hoe=async t=>{try{await t}catch{}},Boe=async function*(...t){try{let e=[];for(;t.length>0;){e=t.map((a,o)=>e[o]??zoe(a));const[{value:r,done:n},i]=await Promise.race(e.map((a,o)=>Promise.all([a,o]))),[s]=t.splice(i,1);e.splice(i,1),n||(t.push(s),yield r)}}finally{await Promise.all(t.map(e=>e.return()))}},zoe=async t=>{
4096
+ try{return await t.next()}catch(e){await t.throw(e)}};function Ap(t,e,r,n){const[i=[],s={}]=Array.isArray(e)?[e,r]:[[],e],a=_oe([t,...i]),o=koe(s),c=Loe(t,i,o,a);let l=Ioe(c,o,a);Object.assign(l,{nodeChildProcess:c}),l=n?joe([n,l]):l;const u=y4(l,a,"stdout"),d=y4(l,a,"stderr");return Object.assign(l,{nodeChildProcess:c,stdout:u,stderr:d,[Symbol.asyncIterator]:()=>Boe(u,d),pipe:(f,p,w)=>Ap(f,p,w,l)})}var bi={},Fo={},v4;function Uoe(){if(v4)return Fo;v4=1,Object.defineProperty(Fo,"__esModule",{value:!0}),
4095
4097
  Fo.sync=Fo.isexe=void 0;const t=qv,e=US,r=async(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return i(await(0,e.stat)(a),o)}catch(l){const u=l;if(c||u.code==="EACCES")return!1;throw u}};Fo.isexe=r;const n=(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return i((0,t.statSync)(a),o)}catch(l){const u=l;if(c||u.code==="EACCES")return!1;throw u}};Fo.sync=n;const i=(a,o)=>a.isFile()&&s(a,o),s=(a,o)=>{const c=o.uid??process.getuid?.(),l=o.groups??process.getgroups?.()??[],u=o.gid??process.getgid?.()??l[0];if(c===
4096
- void 0||u===void 0)throw new Error("cannot get uid or gid");const d=new Set([u,...l]),f=a.mode,p=a.uid,w=a.gid,g=parseInt("100",8),y=parseInt("010",8),m=parseInt("001",8),h=g|y;return!!(f&m||f&y&&d.has(w)||f&g&&p===c||f&h&&c===0)};return Fo}var Ho={},_4;function Boe(){if(_4)return Ho;_4=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.sync=Ho.isexe=void 0;const t=qv,e=US,r=async(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return s(await(0,e.stat)(a),a,o)}catch(l){const u=l;if(c||u.code==="EAC\
4097
- CES")return!1;throw u}};Ho.isexe=r;const n=(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return s((0,t.statSync)(a),a,o)}catch(l){const u=l;if(c||u.code==="EACCES")return!1;throw u}};Ho.sync=n;const i=(a,o)=>{const{pathExt:c=process.env.PATHEXT||""}=o,l=c.split(";");if(l.indexOf("")!==-1)return!0;for(let u=0;u<l.length;u++){const d=l[u].toLowerCase(),f=a.substring(a.length-d.length).toLowerCase();if(d&&f===d)return!0}return!1},s=(a,o,c)=>a.isFile()&&i(o,c);return Ho}var fS={},R4;function zoe(){return R4||
4098
- (R4=1,Object.defineProperty(fS,"__esModule",{value:!0})),fS}var k4;function Uoe(){return k4||(k4=1,(function(t){var e=bi&&bi.__createBinding||(Object.create?(function(l,u,d,f){f===void 0&&(f=d);var p=Object.getOwnPropertyDescriptor(u,d);(!p||("get"in p?!u.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return u[d]}}),Object.defineProperty(l,f,p)}):(function(l,u,d,f){f===void 0&&(f=d),l[f]=u[d]})),r=bi&&bi.__setModuleDefault||(Object.create?(function(l,u){Object.defineProperty(
4099
- l,"default",{enumerable:!0,value:u})}):function(l,u){l.default=u}),n=bi&&bi.__importStar||function(l){if(l&&l.__esModule)return l;var u={};if(l!=null)for(var d in l)d!=="default"&&Object.prototype.hasOwnProperty.call(l,d)&&e(u,l,d);return r(u,l),u},i=bi&&bi.__exportStar||function(l,u){for(var d in l)d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&e(u,l,d)};Object.defineProperty(t,"__esModule",{value:!0}),t.sync=t.isexe=t.posix=t.win32=void 0;const s=n(Hoe());t.posix=s;const a=n(Boe());
4100
- t.win32=a,i(zoe(),t);const c=(process.env._ISEXE_TEST_PLATFORM_||process.platform)==="win32"?a:s;t.isexe=c.isexe,t.sync=c.sync})(bi)),bi}var pS,S4;function Voe(){if(S4)return pS;S4=1;const{isexe:t,sync:e}=Uoe(),{join:r,delimiter:n,sep:i,posix:s}=Lp,a=process.platform==="win32",o=new RegExp(`[${s.sep}${i===s.sep?"":i}]`.replace(/(\\)/g,"\\$1")),c=new RegExp(`^\\.${o.source}`),l=w=>Object.assign(new Error(`not found: ${w}`),{code:"ENOENT"}),u=(w,{path:g=process.env.PATH,pathExt:y=process.env.PATHEXT,
4098
+ void 0||u===void 0)throw new Error("cannot get uid or gid");const d=new Set([u,...l]),f=a.mode,p=a.uid,w=a.gid,g=parseInt("100",8),y=parseInt("010",8),m=parseInt("001",8),h=g|y;return!!(f&m||f&y&&d.has(w)||f&g&&p===c||f&h&&c===0)};return Fo}var Ho={},w4;function Voe(){if(w4)return Ho;w4=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.sync=Ho.isexe=void 0;const t=qv,e=US,r=async(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return s(await(0,e.stat)(a),a,o)}catch(l){const u=l;if(c||u.code==="EAC\
4099
+ CES")return!1;throw u}};Ho.isexe=r;const n=(a,o={})=>{const{ignoreErrors:c=!1}=o;try{return s((0,t.statSync)(a),a,o)}catch(l){const u=l;if(c||u.code==="EACCES")return!1;throw u}};Ho.sync=n;const i=(a,o)=>{const{pathExt:c=process.env.PATHEXT||""}=o,l=c.split(";");if(l.indexOf("")!==-1)return!0;for(let u=0;u<l.length;u++){const d=l[u].toLowerCase(),f=a.substring(a.length-d.length).toLowerCase();if(d&&f===d)return!0}return!1},s=(a,o,c)=>a.isFile()&&i(o,c);return Ho}var dS={},b4;function Woe(){return b4||
4100
+ (b4=1,Object.defineProperty(dS,"__esModule",{value:!0})),dS}var _4;function Goe(){return _4||(_4=1,(function(t){var e=bi&&bi.__createBinding||(Object.create?(function(l,u,d,f){f===void 0&&(f=d);var p=Object.getOwnPropertyDescriptor(u,d);(!p||("get"in p?!u.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return u[d]}}),Object.defineProperty(l,f,p)}):(function(l,u,d,f){f===void 0&&(f=d),l[f]=u[d]})),r=bi&&bi.__setModuleDefault||(Object.create?(function(l,u){Object.defineProperty(
4101
+ l,"default",{enumerable:!0,value:u})}):function(l,u){l.default=u}),n=bi&&bi.__importStar||function(l){if(l&&l.__esModule)return l;var u={};if(l!=null)for(var d in l)d!=="default"&&Object.prototype.hasOwnProperty.call(l,d)&&e(u,l,d);return r(u,l),u},i=bi&&bi.__exportStar||function(l,u){for(var d in l)d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&e(u,l,d)};Object.defineProperty(t,"__esModule",{value:!0}),t.sync=t.isexe=t.posix=t.win32=void 0;const s=n(Uoe());t.posix=s;const a=n(Voe());
4102
+ t.win32=a,i(Woe(),t);const c=(process.env._ISEXE_TEST_PLATFORM_||process.platform)==="win32"?a:s;t.isexe=c.isexe,t.sync=c.sync})(bi)),bi}var fS,R4;function Koe(){if(R4)return fS;R4=1;const{isexe:t,sync:e}=Goe(),{join:r,delimiter:n,sep:i,posix:s}=Lp,a=process.platform==="win32",o=new RegExp(`[${s.sep}${i===s.sep?"":i}]`.replace(/(\\)/g,"\\$1")),c=new RegExp(`^\\.${o.source}`),l=w=>Object.assign(new Error(`not found: ${w}`),{code:"ENOENT"}),u=(w,{path:g=process.env.PATH,pathExt:y=process.env.PATHEXT,
4101
4103
  delimiter:m=n})=>{const h=w.match(o)?[""]:[...a?[process.cwd()]:[],...(g||"").split(m)];if(a){const v=y||[".EXE",".CMD",".BAT",".COM"].join(m),b=v.split(m).flatMap(_=>[_,_.toLowerCase()]);return w.includes(".")&&b[0]!==""&&b.unshift(""),{pathEnv:h,pathExt:b,pathExtExe:v}}return{pathEnv:h,pathExt:[""]}},d=(w,g)=>{const y=/^".*"$/.test(w)?w.slice(1,-1):w;return(!y&&c.test(g)?g.slice(0,2):"")+r(y,g)},f=async(w,g={})=>{const{pathEnv:y,pathExt:m,pathExtExe:h}=u(w,g),v=[];for(const b of y){const _=d(b,
4102
- w);for(const R of m){const $=_+R;if(await t($,{pathExt:h,ignoreErrors:!0})){if(!g.all)return $;v.push($)}}}if(g.all&&v.length)return v;if(g.nothrow)return null;throw l(w)},p=(w,g={})=>{const{pathEnv:y,pathExt:m,pathExtExe:h}=u(w,g),v=[];for(const b of y){const _=d(b,w);for(const R of m){const $=_+R;if(e($,{pathExt:h,ignoreErrors:!0})){if(!g.all)return $;v.push($)}}}if(g.all&&v.length)return v;if(g.nothrow)return null;throw l(w)};return pS=f,f.sync=p,pS}var Woe=Voe();const E4=Ks(Woe),Cn=Rn.getChild(
4103
- "graphviz-binary");class Goe{_dotpath;_unflattenpath;constructor(e,r){this._dotpath=e,this._unflattenpath=r}dispose(){}[Symbol.dispose](){}get concurrency(){return Math.max(1,oj.cpus().length-2)}get dotpath(){return this._dotpath??qp(this,"_dotpath",()=>{const e=E4.sync("dot");return Cn.debug`Found ${e}`,e})}get unflattenpath(){return this._unflattenpath??qp(this,"_unflattenpath",()=>{const e=E4.sync("unflatten");return Cn.debug`Found ${e}`,e})}async unflatten(e){let r;try{const n=await Ap(this.
4104
+ w);for(const R of m){const $=_+R;if(await t($,{pathExt:h,ignoreErrors:!0})){if(!g.all)return $;v.push($)}}}if(g.all&&v.length)return v;if(g.nothrow)return null;throw l(w)},p=(w,g={})=>{const{pathEnv:y,pathExt:m,pathExtExe:h}=u(w,g),v=[];for(const b of y){const _=d(b,w);for(const R of m){const $=_+R;if(e($,{pathExt:h,ignoreErrors:!0})){if(!g.all)return $;v.push($)}}}if(g.all&&v.length)return v;if(g.nothrow)return null;throw l(w)};return fS=f,f.sync=p,fS}var Zoe=Koe();const k4=Ks(Zoe),Cn=Rn.getChild(
4105
+ "graphviz-binary");class Joe{_dotpath;_unflattenpath;constructor(e,r){this._dotpath=e,this._unflattenpath=r}dispose(){}[Symbol.dispose](){}get concurrency(){return Math.max(1,oj.cpus().length-2)}get dotpath(){return this._dotpath??qp(this,"_dotpath",()=>{const e=k4.sync("dot");return Cn.debug`Found ${e}`,e})}get unflattenpath(){return this._unflattenpath??qp(this,"_unflattenpath",()=>{const e=k4.sync("unflatten");return Cn.debug`Found ${e}`,e})}async unflatten(e){let r;try{const n=await Ap(this.
4104
4106
  unflattenpath,["-l 1","-c 3"],{timeout:1e4,stdin:{string:e}});r=n.stdout,Pt(n.stderr)||Cn.warn(`Command ${n.command} has stderr:
4105
4107
  `+n.stderr)}catch(n){Cn.error("FAILED GraphvizBinaryAdapter.unflatten",{error:n}),n instanceof qo&&!Pt(n.stdout)&&(Cn.warn(`Command: '${n.command}' returned result but also failed (exitcode ${n.exitCode}):
4106
4108
  `+n.stderr),r=n.stdout)}return r&&(e=r.replaceAll(/\t\[/g," [").replaceAll(/\t/g," ")),e}async layoutJson(e){let r;try{const n=await Ap(this.dotpath,["-Tjson","-y"],{timeout:1e4,stdin:{string:e}});r=n.stdout,Pt(n.stderr)||Cn.warn(`Command ${n.command} has stderr:
@@ -4108,16 +4110,16 @@ unflattenpath,["-l 1","-c 3"],{timeout:1e4,stdin:{string:e}});r=n.stdout,Pt(n.st
4108
4110
  `+e),n instanceof qo&&!Pt(n.stdout))Cn.warn(`Command: '${n.command}' returned result but also failed (exitcode ${n.exitCode}): "${n.stderr}"`),r=n.stdout;else throw n}return r}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){let r;try{const n=await Ap(this.dotpath,["-Tsvg","-y"],{timeout:1e4,stdin:{string:e}});r=n.stdout,Pt(n.stderr)||Cn.warn(`Command ${n.command} has stderr:
4109
4111
  `+n.stderr)}catch(n){if(Cn.error("FAILED GraphvizBinaryAdapter.svg",{error:n}),Cn.warn(`FAILED DOT:
4110
4112
  `+e),n instanceof qo&&!Pt(n.stdout))Cn.warn(`Command: '${n.command}' returned result but also failed (exitcode ${n.exitCode}):
4111
- `+n.stderr),r=n.stdout;else throw n}return r}}const Koe="likec4",T4="1.46.0",hS=Rn.getChild("cli");function $4(t){const e=Rn.getChild(t);return{info(r){e.info(r)},warn(r){if(r instanceof Error){e.warn(`${ln.red(r.name+" "+r.message)}`,{msg:r});return}if(typeof r=="string"){e.warn(r);return}e.warn`${r}`},warnOnce(r){e.warn(r)},error(r,n){let i=n?.error??r;if(i instanceof Error){if(r===i){e.error(`${ln.red(i.name+" "+i.message)}`,{error:i});return}e.error(ln.red(r),{error:i});return}if(typeof r=="\
4112
- string"){e.error(ln.red(r));return}e.error`${r}`},clearScreen:function(r){},hasErrorLogged:function(r){throw new Error("Function not implemented.")},hasWarned:!1}}const mS=()=>{},Zoe={info:mS,warn:mS,error:mS},Joe=1e6;function P4(t){const[e,r]=WS(t),n=e*1e3+r/Joe;return{ms:n,pretty:NO(n)}}function Yoe(t){const e=WS();return{stopAndLog(r="done in "){r=ln.green(`${r}${P4(e).pretty}`),(t||hS).info(r)}}}function Xoe(t,e){console.log(rj(t,{padding:1,margin:1,dimBorder:!0,...e}))}class Qoe{constructor(e){
4113
+ `+n.stderr),r=n.stdout;else throw n}return r}}const Yoe="likec4",S4="1.46.2",pS=Rn.getChild("cli");function E4(t){const e=Rn.getChild(t);return{info(r){e.info(r)},warn(r){if(r instanceof Error){e.warn(`${ln.red(r.name+" "+r.message)}`,{msg:r});return}if(typeof r=="string"){e.warn(r);return}e.warn`${r}`},warnOnce(r){e.warn(r)},error(r,n){let i=n?.error??r;if(i instanceof Error){if(r===i){e.error(`${ln.red(i.name+" "+i.message)}`,{error:i});return}e.error(ln.red(r),{error:i});return}if(typeof r=="\
4114
+ string"){e.error(ln.red(r));return}e.error`${r}`},clearScreen:function(r){},hasErrorLogged:function(r){throw new Error("Function not implemented.")},hasWarned:!1}}const hS=()=>{},Xoe={info:hS,warn:hS,error:hS},Qoe=1e6;function T4(t){const[e,r]=WS(t),n=e*1e3+r/Qoe;return{ms:n,pretty:xO(n)}}function ece(t){const e=WS();return{stopAndLog(r="done in "){r=ln.green(`${r}${T4(e).pretty}`),(t||pS).info(r)}}}function tce(t,e){console.log(rj(t,{padding:1,margin:1,dimBorder:!0,...e}))}class rce{constructor(e){
4113
4115
  this.services=e}isInitialized=!1;async initWorkspace(e){if(this.isInitialized)throw new Error("Workspace already initialized");this.isInitialized=!0;const r=this.services.logger,n=this.services.shared.workspace.WorkspaceManager;r.info(`${ln.dim("workspace:")} ${e.uri}`),n.initialize({capabilities:{},processId:null,rootUri:null,workspaceFolders:[e]}),await n.initializeWorkspace([e]);const i=this.services.shared.workspace.LangiumDocuments.all.toArray().filter(s=>!yo(s.uri));if(i.length===0)throw r.
4114
- error("no LikeC4 sources found"),new Error("no LikeC4 sources found");r.info(`${ln.dim("workspace:")} found ${i.length} source files`)}}function ece(t){return e=>new t(e)}const tce={logger:()=>{throw new Error("Logger must be provided")},cli:{Workspace:ece(Qoe)}};function C4(t){const e=Xv(t,{useFileSystem:!0,watch:!1,logger:"default",graphviz:"wasm",mcp:!1});let r;switch(e.mcp==="stdio"&&(zC({reset:!0,sinks:{console:JW()}}),e.logger="default"),e.logger){case!1:r=Zoe;break;case"vite":r=$4("lang");
4115
- break;case"default":r=hS.getChild("lang");break;default:r=e.logger;break}const n=e.graphviz==="binary";r.info(`${ln.dim("version")} ${T4}`),r.info(`${ln.dim("layout")} ${n?"binary":"wasm"}`);const i={logger:()=>r,likec4:{Layouter:()=>new mO({graphviz:n?new Goe:new xn})}},{likec4:s}=goe({...e.useFileSystem?dZ(e.watch):Tx,...e.mcp?$Q(e.mcp==="stdio"?"stdio":"sse"):{},...aZ},tce,i);return typeof e.mcp=="object"&&e.mcp.port&&s.mcp.Server.start(e.mcp.port).catch(a=>{r.error(Ve(a))}),e.mcp==="stdio"&&
4116
- s.mcp.Server.start().catch(a=>{r.error(Ve(a))}),s}const A4=t=>new Error(`Invalid model:
4116
+ error("no LikeC4 sources found"),new Error("no LikeC4 sources found");r.info(`${ln.dim("workspace:")} found ${i.length} source files`)}}function nce(t){return e=>new t(e)}const ice={logger:()=>{throw new Error("Logger must be provided")},cli:{Workspace:nce(rce)}};function $4(t){const e=Xv(t,{useFileSystem:!0,watch:!1,logger:"default",graphviz:"wasm",mcp:!1});let r;switch(e.mcp==="stdio"&&(zC({reset:!0,sinks:{console:JW()}}),e.logger="default"),e.logger){case!1:r=Xoe;break;case"vite":r=E4("lang");
4117
+ break;case"default":r=pS.getChild("lang");break;default:r=e.logger;break}const n=e.graphviz==="binary";r.info(`${ln.dim("version")} ${S4}`),r.info(`${ln.dim("layout")} ${n?"binary":"wasm"}`);const i={logger:()=>r,likec4:{Layouter:()=>new pO({graphviz:n?new Joe:new xn})}},{likec4:s}=woe({...e.useFileSystem?dZ(e.watch):Tx,...e.mcp?AQ(e.mcp==="stdio"?"stdio":"sse"):{},...aZ},ice,i);return typeof e.mcp=="object"&&e.mcp.port&&s.mcp.Server.start(e.mcp.port).catch(a=>{r.error(Ve(a))}),e.mcp==="stdio"&&
4118
+ s.mcp.Server.start().catch(a=>{r.error(Ve(a))}),s}const P4=t=>new Error(`Invalid model:
4117
4119
  ${t.getErrors().map(e=>` ${e.sourceFsPath}:${e.line} ${e.message.slice(0,200)}`).join(`
4118
- `)}`);class wa{constructor(e,r){this.workspace=e,this.langium=r,this.logger=r.logger}static async fromSource(e,r){const n=C4(Xv(r,{useFileSystem:!1,watch:!1,logger:!1,graphviz:"wasm",mcp:!1})),i=ct.from({scheme:"virtual",path:"/workspace"}),s=Xe.joinPath(i,"source.likec4"),a=n.shared.workspace.LangiumDocuments.createDocument(s,e);await n.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"}),await n.shared.workspace.DocumentBuilder.build([a],{validation:!0});const o=new wa(i.path,n);return r?.
4119
- throwIfInvalid===!0&&o.hasErrors()?(await o.dispose(),Promise.reject(A4(o))):(r?.printErrors!==!1&&o.hasErrors()&&o.printErrors(),o)}static likec4Instances=new Map;static async fromWorkspace(e=".",r){const n=jv(e);if(!O4(n))throw new Error(`Workspace not found: ${n}`);let i=wa.likec4Instances.get(n);if(!i){const s=C4(Xv(r,{useFileSystem:!0,watch:!1,logger:"default",graphviz:"wasm",mcp:!1}));i=new wa(n,s),wa.likec4Instances.set(n,i),await s.cli.Workspace.initWorkspace({uri:H4(n).toString(),name:q4(
4120
- n)}),r?.printErrors!==!1&&i.hasErrors()&&i.printErrors()}return r?.throwIfInvalid===!0&&i.hasErrors()?(await i.dispose(),Promise.reject(A4(i))):i}logger;get languageServices(){return this.langium.likec4.LanguageServices}get projectsManager(){return this.langium.shared.workspace.ProjectsManager}get viewsService(){return this.langium.likec4.Views}get LangiumDocuments(){return this.langium.shared.workspace.LangiumDocuments}ensureSingleProject(){const e=this.langium.likec4.LanguageServices.projects();
4120
+ `)}`);class wa{constructor(e,r){this.workspace=e,this.langium=r,this.logger=r.logger}static async fromSource(e,r){const n=$4(Xv(r,{useFileSystem:!1,watch:!1,logger:!1,graphviz:"wasm",mcp:!1})),i=ct.from({scheme:"virtual",path:"/workspace"}),s=Xe.joinPath(i,"source.likec4"),a=n.shared.workspace.LangiumDocuments.createDocument(s,e);await n.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"}),await n.shared.workspace.DocumentBuilder.build([a],{validation:!0});const o=new wa(i.path,n);return r?.
4121
+ throwIfInvalid===!0&&o.hasErrors()?(await o.dispose(),Promise.reject(P4(o))):(r?.printErrors!==!1&&o.hasErrors()&&o.printErrors(),o)}static likec4Instances=new Map;static async fromWorkspace(e=".",r){const n=jv(e);if(!O4(n))throw new Error(`Workspace not found: ${n}`);let i=wa.likec4Instances.get(n);if(!i){const s=$4(Xv(r,{useFileSystem:!0,watch:!1,logger:"default",graphviz:"wasm",mcp:!1}));i=new wa(n,s),wa.likec4Instances.set(n,i),await s.cli.Workspace.initWorkspace({uri:H4(n).toString(),name:q4(
4122
+ n)}),r?.printErrors!==!1&&i.hasErrors()&&i.printErrors()}return r?.throwIfInvalid===!0&&i.hasErrors()?(await i.dispose(),Promise.reject(P4(i))):i}logger;get languageServices(){return this.langium.likec4.LanguageServices}get projectsManager(){return this.langium.shared.workspace.ProjectsManager}get viewsService(){return this.langium.likec4.Views}get LangiumDocuments(){return this.langium.shared.workspace.LangiumDocuments}ensureSingleProject(){const e=this.langium.likec4.LanguageServices.projects();
4121
4123
  if(e.length>1)throw this.logger.error(`Multiple projects found:
4122
4124
  ${e.map(r=>` - ${r.folder.fsPath}`).join(`
4123
4125
  `)}
@@ -4128,5 +4130,5 @@ r)}getErrors(){return this.LangiumDocuments.all.toArray().flatMap(e=>(e.diagnost
4128
4130
  line,o=s.message.split(`
4129
4131
  `);return o.length>10&&(o.length=10,o.push("...")),o.map((c,l)=>l===0?" "+ln.dim(`Line ${a}: `)+ln.red(c):" ".repeat(10)+ln.red(c))}).join(`
4130
4132
  `);this.logger.error(`Invalid ${r.uri.fsPath}
4131
- ${i}`)}}return e}onModelUpdate(e){const r=this.langium.likec4.ModelBuilder.onModelParsed(()=>e());return()=>{r.dispose()}}async dispose(){await this.langium.likec4.LanguageServices.dispose();for(const[e,r]of wa.likec4Instances)r===this&&wa.likec4Instances.delete(e)}async[Symbol.asyncDispose](){await this.dispose()}}export{ct as $,vre as A,lk as B,P4 as C,Je as D,$s as E,Vy as F,EL as G,ht as H,JL as I,$L as J,HL as K,wa as L,lM as M,hE as N,fM as O,hM as P,em as Q,RL as R,vM as S,Yo as T,yp as U,
4132
- zy as V,vp as W,AM as X,Koe as Y,Pt as Z,T4 as _,n0 as a,Yoe as a0,Xe as a1,e4 as a2,zC as a3,HC as a4,Qe as b,be as c,wc as d,Mt as e,rc as f,bt as g,$4 as h,Bt as i,Iy as j,Rn as k,Ks as l,_n as m,as as n,dl as o,gre as p,hS as q,t0 as r,Ap as s,zn as t,ln as u,Ve as v,xy as w,Xoe as x,Zs as y,UP as z};
4133
+ ${i}`)}}return e}onModelUpdate(e){const r=this.langium.likec4.ModelBuilder.onModelParsed(()=>e());return()=>{r.dispose()}}async dispose(){await this.langium.likec4.LanguageServices.dispose();for(const[e,r]of wa.likec4Instances)r===this&&wa.likec4Instances.delete(e)}async[Symbol.asyncDispose](){await this.dispose()}}export{ct as $,_re as A,ck as B,T4 as C,Je as D,$s as E,Vy as F,kL as G,ht as H,KL as I,EL as J,qL as K,wa as L,oM as M,hE as N,uM as O,fM as P,em as Q,bL as R,gM as S,Yo as T,yp as U,
4134
+ zy as V,vp as W,PM as X,Yoe as Y,Pt as Z,S4 as _,n0 as a,ece as a0,Xe as a1,XM as a2,zC as a3,HC as a4,Qe as b,be as c,wc as d,Mt as e,rc as f,bt as g,E4 as h,Bt as i,Iy as j,Rn as k,Ks as l,_n as m,as as n,dl as o,wre as p,pS as q,t0 as r,Ap as s,zn as t,ln as u,Ve as v,xy as w,tce as x,Zs as y,UP as z};