@nowline/embed 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,66 +1,66 @@
1
- /*! @nowline/embed 0.12.1 sha=fd731a2 built=2026-11-04T04:03:36Z */
2
- "use strict";var nowline=(()=>{var sL=Object.create;var Bs=Object.defineProperty;var aL=Object.getOwnPropertyDescriptor;var lL=Object.getOwnPropertyNames;var cL=Object.getPrototypeOf,uL=Object.prototype.hasOwnProperty;var fL=(e,t,n)=>t in e?Bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var dL=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Ws=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Gp=(e,t)=>{for(var n in t)Bs(e,n,{get:t[n],enumerable:!0})},TE=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lL(t))!uL.call(e,i)&&i!==n&&Bs(e,i,{get:()=>t[i],enumerable:!(r=aL(t,i))||r.enumerable});return e};var Hp=(e,t,n)=>(n=e!=null?sL(cL(e)):{},TE(t||!e||!e.__esModule?Bs(n,"default",{value:e,enumerable:!0}):n,e)),pL=e=>TE(Bs({},"__esModule",{value:!0}),e);var M=(e,t,n)=>fL(e,typeof t!="symbol"?t+"":t,n);var gm=Ws(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});var pm;function hm(){if(pm===void 0)throw new Error("No runtime abstraction layer installed");return pm}(function(e){function t(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");pm=n}e.install=t})(hm||(hm={}));mm.default=hm});var ym=Ws($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.boolean=gM;$n.string=H_;$n.number=yM;$n.error=xM;$n.func=EM;$n.array=z_;$n.stringArray=wM;function gM(e){return e===!0||e===!1}function H_(e){return typeof e=="string"||e instanceof String}function yM(e){return typeof e=="number"||e instanceof Number}function xM(e){return e instanceof Error}function EM(e){return typeof e=="function"}function z_(e){return Array.isArray(e)}function wM(e){return z_(e)&&e.every(t=>H_(t))}});var wm=Ws(kr=>{"use strict";var TM=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kr,"__esModule",{value:!0});kr.Emitter=kr.Event=void 0;var vM=TM(gm()),j_;(function(e){let t={dispose(){}};e.None=function(){return t}})(j_||(kr.Event=j_={}));var xm=class{constructor(){M(this,"_callbacks");M(this,"_contexts")}add(t,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(t,n)})}remove(t,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===t)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,s=r.length;o<s;o++)try{n.push(r[o].apply(i[o],t))}catch(a){(0,vM.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Wu=class Wu{constructor(t){M(this,"_options");M(this,"_event");M(this,"_callbacks");this._options=t}get event(){return this._event||(this._event=(t,n,r)=>{this._callbacks||(this._callbacks=new xm),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),i.dispose=Wu._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};M(Wu,"_noop",function(){});var Em=Wu;kr.Emitter=Em});var Y_=Ws(Tt=>{"use strict";var _M=Tt&&Tt.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),AM=Tt&&Tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),kM=Tt&&Tt.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i<r.length;i++)r[i]!=="default"&&_M(n,t,r[i]);return AM(n,t),n}})(),IM=Tt&&Tt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CancellationTokenSource=Tt.CancellationToken=void 0;var RM=IM(gm()),SM=kM(ym()),Tm=wm(),Xu;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Tm.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Tm.Event.None});function t(n){let r=n;return r&&(r===e.None||r===e.Cancelled||SM.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}e.is=t})(Xu||(Tt.CancellationToken=Xu={}));var bM=Object.freeze(function(e,t){let n=(0,RM.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}),Uu=class{constructor(){M(this,"_isCancelled",!1);M(this,"_emitter")}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?bM:(this._emitter||(this._emitter=new Tm.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},vm=class{constructor(){M(this,"_token")}get token(){return this._token||(this._token=new Uu),this._token}cancel(){this._token?this._token.cancel():this._token=Xu.Cancelled}dispose(){this._token?this._token instanceof Uu&&this._token.dispose():this._token=Xu.None}};Tt.CancellationTokenSource=vm});var K_=Ws(te=>{"use strict";var NM=te&&te.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),LM=te&&te.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),PM=te&&te.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i<r.length;i++)r[i]!=="default"&&NM(n,t,r[i]);return LM(n,t),n}})();Object.defineProperty(te,"__esModule",{value:!0});te.Message=te.NotificationType9=te.NotificationType8=te.NotificationType7=te.NotificationType6=te.NotificationType5=te.NotificationType4=te.NotificationType3=te.NotificationType2=te.NotificationType1=te.NotificationType0=te.NotificationType=te.RequestType9=te.RequestType8=te.RequestType7=te.RequestType6=te.RequestType5=te.RequestType4=te.RequestType3=te.RequestType2=te.RequestType1=te.RequestType=te.RequestType0=te.AbstractMessageSignature=te.ParameterStructures=te.ResponseError=te.ErrorCodes=void 0;var hi=PM(ym()),_m;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(_m||(te.ErrorCodes=_m={}));var Am=class e extends Error{constructor(n,r,i){super(r);M(this,"code");M(this,"data");this.code=hi.number(n)?n:_m.UnknownErrorCode,this.data=i,Object.setPrototypeOf(this,e.prototype)}toJson(){let n={code:this.code,message:this.message};return this.data!==void 0&&(n.data=this.data),n}};te.ResponseError=Am;var Zt=class Zt{constructor(t){M(this,"kind");this.kind=t}static is(t){return t===Zt.auto||t===Zt.byName||t===Zt.byPosition}toString(){return this.kind}};M(Zt,"auto",new Zt("auto")),M(Zt,"byPosition",new Zt("byPosition")),M(Zt,"byName",new Zt("byName"));var Ir=Zt;te.ParameterStructures=Ir;var Oe=class{constructor(t,n){M(this,"method");M(this,"numberOfParams");this.method=t,this.numberOfParams=n}get parameterStructures(){return Ir.auto}};te.AbstractMessageSignature=Oe;var km=class extends Oe{constructor(n){super(n,0);M(this,"_")}};te.RequestType0=km;var Im=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};te.RequestType=Im;var Rm=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};te.RequestType1=Rm;var Sm=class extends Oe{constructor(n){super(n,2);M(this,"_")}};te.RequestType2=Sm;var bm=class extends Oe{constructor(n){super(n,3);M(this,"_")}};te.RequestType3=bm;var Nm=class extends Oe{constructor(n){super(n,4);M(this,"_")}};te.RequestType4=Nm;var Lm=class extends Oe{constructor(n){super(n,5);M(this,"_")}};te.RequestType5=Lm;var Pm=class extends Oe{constructor(n){super(n,6);M(this,"_")}};te.RequestType6=Pm;var Om=class extends Oe{constructor(n){super(n,7);M(this,"_")}};te.RequestType7=Om;var Cm=class extends Oe{constructor(n){super(n,8);M(this,"_")}};te.RequestType8=Cm;var $m=class extends Oe{constructor(n){super(n,9);M(this,"_")}};te.RequestType9=$m;var Dm=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};te.NotificationType=Dm;var Mm=class extends Oe{constructor(n){super(n,0);M(this,"_")}};te.NotificationType0=Mm;var Fm=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};te.NotificationType1=Fm;var Bm=class extends Oe{constructor(n){super(n,2);M(this,"_")}};te.NotificationType2=Bm;var Wm=class extends Oe{constructor(n){super(n,3);M(this,"_")}};te.NotificationType3=Wm;var Xm=class extends Oe{constructor(n){super(n,4);M(this,"_")}};te.NotificationType4=Xm;var Um=class extends Oe{constructor(n){super(n,5);M(this,"_")}};te.NotificationType5=Um;var Gm=class extends Oe{constructor(n){super(n,6);M(this,"_")}};te.NotificationType6=Gm;var Hm=class extends Oe{constructor(n){super(n,7);M(this,"_")}};te.NotificationType7=Hm;var zm=class extends Oe{constructor(n){super(n,8);M(this,"_")}};te.NotificationType8=zm;var jm=class extends Oe{constructor(n){super(n,9);M(this,"_")}};te.NotificationType9=jm;var V_;(function(e){function t(i){let o=i;return o&&hi.string(o.method)&&(hi.string(o.id)||hi.number(o.id))}e.isRequest=t;function n(i){let o=i;return o&&hi.string(o.method)&&i.id===void 0}e.isNotification=n;function r(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(hi.string(o.id)||hi.number(o.id)||o.id===null)}e.isResponse=r})(V_||(te.Message=V_={}))});var Xy={};Gp(Xy,{nodeReadFile:()=>R2});async function R2(){throw new Error("nowline: filesystem readers are unavailable in the browser embed")}var Uy=dL(()=>{});var JU={};Gp(JU,{EmbedRenderError:()=>Kl,__resetForTests:()=>ZU,init:()=>yE,initialize:()=>YU,parse:()=>KU,render:()=>VU,run:()=>qU,sha:()=>zU,version:()=>HU});function Ue(e){return typeof e=="object"&&e!==null&&typeof e.$type=="string"}function it(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"ref"in e}function Mt(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"items"in e}function vE(e){return typeof e=="object"&&e!==null&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.path=="string"}function Gi(e){return typeof e=="object"&&e!==null&&typeof e.info=="object"&&typeof e.message=="string"}var Ui=class{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(t){let n=this.types[t.container.$type];if(!n)throw new Error(`Type ${t.container.$type||"undefined"} not found.`);let r=n.properties[t.property]?.referenceType;if(!r)throw new Error(`Property ${t.property||"undefined"} of type ${t.container.$type} is not a reference.`);return r}getTypeMetaData(t){let n=this.types[t];return n||{name:t,properties:{},superTypes:[]}}isInstance(t,n){return Ue(t)&&this.isSubtype(t.$type,n)}isSubtype(t,n){if(t===n)return!0;let r=this.subtypes[t];r||(r=this.subtypes[t]={});let i=r[n];if(i!==void 0)return i;{let o=this.types[t],s=o?o.superTypes.some(a=>this.isSubtype(a,n)):!1;return r[n]=s,s}}getAllSubTypes(t){let n=this.allSubtypes[t];if(n)return n;{let r=this.getAllTypes(),i=[];for(let o of r)this.isSubtype(o,t)&&i.push(o);return this.allSubtypes[t]=i,i}}isComplete(t){let n=this.getTypeMetaData(t.$type);for(let r of Object.keys(n.properties)){let i=n.properties[r];if(i.optional)continue;let o=t[i.name];if(o==null)return!1}return!0}};function nr(e){return typeof e=="object"&&e!==null&&Array.isArray(e.content)}function tc(e){return typeof e=="object"&&e!==null&&typeof e.tokenType=="object"}function nc(e){return nr(e)&&typeof e.fullText=="string"}var zt=class e{constructor(t,n){this.startFn=t,this.nextFn=n}iterator(){let t={state:this.startFn(),next:()=>this.nextFn(t.state),[Symbol.iterator]:()=>t};return t}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let t=this.iterator(),n=0,r=t.next();for(;!r.done;)n++,r=t.next();return n}toArray(){let t=[],n=this.iterator(),r;do r=n.next(),r.value!==void 0&&t.push(r.value);while(!r.done);return t}toSet(){return new Set(this)}toMap(t,n){let r=this.map(i=>[t?t(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(t){return new e(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return yt})}join(t=","){let n=this.iterator(),r="",i,o=!1;do i=n.next(),i.done||(o&&(r+=t),r+=mL(i.value)),o=!0;while(!i.done);return r}indexOf(t,n=0){let r=this.iterator(),i=0,o=r.next();for(;!o.done;){if(i>=n&&o.value===t)return i;o=r.next(),i++}return-1}every(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(!t(r.value))return!1;r=n.next()}return!0}some(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(t(r.value))return!0;r=n.next()}return!1}forEach(t){let n=this.iterator(),r=0,i=n.next();for(;!i.done;)t(i.value,r),i=n.next(),r++}map(t){return new e(this.startFn,n=>{let{done:r,value:i}=this.nextFn(n);return r?yt:{done:!1,value:t(i)}})}filter(t){return new e(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&t(r.value))return r;while(!r.done);return yt})}nonNullable(){return this.filter(t=>t!=null)}reduce(t,n){let r=this.iterator(),i=n,o=r.next();for(;!o.done;)i===void 0?i=o.value:i=t(i,o.value),o=r.next();return i}reduceRight(t,n){return this.recursiveReduce(this.iterator(),t,n)}recursiveReduce(t,n,r){let i=t.next();if(i.done)return r;let o=this.recursiveReduce(t,n,r);return o===void 0?i.value:n(o,i.value)}find(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(t(r.value))return r.value;r=n.next()}}findIndex(t){let n=this.iterator(),r=0,i=n.next();for(;!i.done;){if(t(i.value))return r;i=n.next(),r++}return-1}includes(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(r.value===t)return!0;r=n.next()}return!1}flatMap(t){return new e(()=>({this:this.startFn()}),n=>{do{if(n.iterator){let o=n.iterator.next();if(o.done)n.iterator=void 0;else return o}let{done:r,value:i}=this.nextFn(n.this);if(!r){let o=t(i);if(rc(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(n.iterator);return yt})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let n=t>1?this.flat(t-1):this;return new e(()=>({this:n.startFn()}),r=>{do{if(r.iterator){let s=r.iterator.next();if(s.done)r.iterator=void 0;else return s}let{done:i,value:o}=n.nextFn(r.this);if(!i)if(rc(o))r.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(r.iterator);return yt})}head(){let n=this.iterator().next();if(!n.done)return n.value}tail(t=1){return new e(()=>{let n=this.startFn();for(let r=0;r<t;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(t){return new e(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>t?yt:this.nextFn(n.state)))}distinct(t){return new e(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){let i=t?t(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return yt})}exclude(t,n){let r=new Set;for(let i of t){let o=n?n(i):i;r.add(o)}return this.filter(i=>{let o=n?n(i):i;return!r.has(o)})}};function mL(e){return typeof e=="string"?e:typeof e>"u"?"undefined":typeof e.toString=="function"?e.toString():Object.prototype.toString.call(e)}function rc(e){return!!e&&typeof e[Symbol.iterator]=="function"}var oc=new zt(()=>{},()=>yt),yt=Object.freeze({done:!0,value:void 0});function ye(...e){if(e.length===1){let t=e[0];if(t instanceof zt)return t;if(rc(t))return new zt(()=>t[Symbol.iterator](),n=>n.next());if(typeof t.length=="number")return new zt(()=>({index:0}),n=>n.index<t.length?{done:!1,value:t[n.index++]}:yt)}return e.length>1?new zt(()=>({collIndex:0,arrIndex:0}),t=>{do{if(t.iterator){let n=t.iterator.next();if(!n.done)return n;t.iterator=void 0}if(t.array){if(t.arrIndex<t.array.length)return{done:!1,value:t.array[t.arrIndex++]};t.array=void 0,t.arrIndex=0}if(t.collIndex<e.length){let n=e[t.collIndex++];rc(n)?t.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return yt}):oc}var rr=class extends zt{constructor(t,n,r){super(()=>({iterators:r?.includeRoot?[[t][Symbol.iterator]()]:[n(t)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(n(s.value)[Symbol.iterator]()),s}return yt})}iterator(){let t={state:this.startFn(),next:()=>this.nextFn(t.state),prune:()=>{t.state.pruned=!0},[Symbol.iterator]:()=>t};return t}},ic;(function(e){function t(o){return o.reduce((s,a)=>s+a,0)}e.sum=t;function n(o){return o.reduce((s,a)=>s*a,0)}e.product=n;function r(o){return o.reduce((s,a)=>Math.min(s,a))}e.min=r;function i(o){return o.reduce((s,a)=>Math.max(s,a))}e.max=i})(ic||(ic={}));function sc(e,t={}){for(let[n,r]of Object.entries(e))n.startsWith("$")||(Array.isArray(r)?r.forEach((i,o)=>{Ue(i)&&(i.$container=e,i.$containerProperty=n,i.$containerIndex=o,t.deep&&sc(i,t))}):Ue(r)&&(r.$container=e,r.$containerProperty=n,t.deep&&sc(r,t)))}function Hi(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function st(e){let n=Xs(e).$document;if(!n)throw new Error("AST node has no document.");return n}function Xs(e){for(;e.$container;)e=e.$container;return e}function jp(e){return it(e)?e.ref?[e.ref]:[]:Mt(e)?e.items.map(t=>t.ref):[]}function ac(e,t){if(!e)throw new Error("Node must be an AstNode.");let n=t?.range;return new zt(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){let i=r.keys[r.keyIndex];if(!i.startsWith("$")){let o=e[i];if(Ue(o)){if(r.keyIndex++,zp(o,n))return{done:!1,value:o}}else if(Array.isArray(o)){for(;r.arrayIndex<o.length;){let s=r.arrayIndex++,a=o[s];if(Ue(a)&&zp(a,n))return{done:!1,value:a}}r.arrayIndex=0}}r.keyIndex++}return yt})}function cn(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new rr(e,n=>ac(n,t))}function xt(e,t){if(e){if(t?.range&&!zp(e,t.range))return new rr(e,()=>[])}else throw new Error("Root node must be an AstNode.");return new rr(e,n=>ac(n,t),{includeRoot:!0})}function zp(e,t){if(!t)return!0;let n=e.$cstNode?.range;return n?kE(n,t):!1}function Hr(e){return new zt(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndex<t.keys.length;){let n=t.keys[t.keyIndex];if(!n.startsWith("$")){let r=e[n];if(it(r)||Mt(r))return t.keyIndex++,{done:!1,value:{reference:r,container:e,property:n}};if(Array.isArray(r)){for(;t.arrayIndex<r.length;){let i=t.arrayIndex++,o=r[i];if(it(o)||Mt(o))return{done:!1,value:{reference:o,container:e,property:n,index:i}}}t.arrayIndex=0}}t.keyIndex++}return yt})}function _E(e,t){let n=e.getTypeMetaData(t.$type),r=t;for(let i of Object.values(n.properties))i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=AE(i.defaultValue))}function AE(e){return Array.isArray(e)?[...e.map(AE)]:e}var bt={$type:"AbstractElement",cardinality:"cardinality"};function xc(e){return me.isInstance(e,bt.$type)}var fc={$type:"AbstractParserRule"};function or(e){return me.isInstance(e,fc.$type)}var lc={$type:"AbstractRule"};var jt={$type:"AbstractType"};var jr={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};function sr(e){return me.isInstance(e,jr.$type)}var dc={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};function nh(e){return me.isInstance(e,dc.$type)}var IE={$type:"ArrayLiteral",elements:"elements"};var Vp={$type:"ArrayType",elementType:"elementType"};function LE(e){return me.isInstance(e,Vp.$type)}var Yr={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};function fn(e){return me.isInstance(e,Yr.$type)}var Kp={$type:"BooleanLiteral",true:"true"};function PE(e){return me.isInstance(e,Kp.$type)}var Vr={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};function OE(e){return me.isInstance(e,Vr.$type)}var zi={$type:"Condition"};var pc={$type:"Conjunction",left:"left",right:"right"};function CE(e){return me.isInstance(e,pc.$type)}var Kr={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};function dn(e){return me.isInstance(e,Kr.$type)}var hc={$type:"Disjunction",left:"left",right:"right"};function $E(e){return me.isInstance(e,hc.$type)}var qp={$type:"EndOfFile",cardinality:"cardinality"};function DE(e){return me.isInstance(e,qp.$type)}var zr={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"};var RE={$type:"GrammarImport",path:"path"};var ji={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};function qr(e){return me.isInstance(e,ji.$type)}var Zp={$type:"InferredType",name:"name"};function Ec(e){return me.isInstance(e,Zp.$type)}var Tn={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};function Zr(e){return me.isInstance(e,Tn.$type)}var Yp={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"};var SE={$type:"InfixRuleOperators",precedences:"precedences"};var zs={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};function ME(e){return me.isInstance(e,zs.$type)}var js={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};function Yt(e){return me.isInstance(e,js.$type)}var cc={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"};var Yi={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function FE(e){return me.isInstance(e,Yi.$type)}var Jp={$type:"Negation",value:"value"};function BE(e){return me.isInstance(e,Jp.$type)}var bE={$type:"NumberLiteral",value:"value"};var uc={$type:"Parameter",name:"name"};var Qp={$type:"ParameterReference",parameter:"parameter"};function WE(e){return me.isInstance(e,Qp.$type)}var un={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};function at(e){return me.isInstance(e,un.$type)}var mc={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"};function XE(e){return me.isInstance(e,mc.$type)}var Vi={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};function UE(e){return me.isInstance(e,Vi.$type)}var eh={$type:"ReturnType",name:"name"};function GE(e){return me.isInstance(e,eh.$type)}var Ki={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};function pn(e){return me.isInstance(e,Ki.$type)}var Ys={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};function rh(e){return me.isInstance(e,Ys.$type)}var NE={$type:"StringLiteral",value:"value"};var qi={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function HE(e){return me.isInstance(e,qi.$type)}var Ft={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};var Zi={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function zE(e){return me.isInstance(e,Zi.$type)}var ir={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};function Et(e){return me.isInstance(e,ir.$type)}var Ji={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};function ih(e){return me.isInstance(e,Ji.$type)}var gc={$type:"Type",name:"name",type:"type"};function oh(e){return me.isInstance(e,gc.$type)}var Us={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"};var Gs={$type:"TypeDefinition"};var th={$type:"UnionType",types:"types"};function jE(e){return me.isInstance(e,th.$type)}var yc={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};function sh(e){return me.isInstance(e,yc.$type)}var Qi={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function YE(e){return me.isInstance(e,Qi.$type)}var Hs={$type:"ValueLiteral"};var Vs={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};function VE(e){return me.isInstance(e,Vs.$type)}var Ks=class extends Ui{constructor(){super(...arguments),this.types={AbstractElement:{name:bt.$type,properties:{cardinality:{name:bt.cardinality,optional:!0}},superTypes:[]},AbstractParserRule:{name:fc.$type,properties:{},superTypes:[lc.$type,jt.$type]},AbstractRule:{name:lc.$type,properties:{},superTypes:[]},AbstractType:{name:jt.$type,properties:{},superTypes:[]},Action:{name:jr.$type,properties:{cardinality:{name:jr.cardinality,optional:!0},feature:{name:jr.feature,optional:!0},inferredType:{name:jr.inferredType,optional:!0},operator:{name:jr.operator,optional:!0},type:{name:jr.type,referenceType:jt.$type,optional:!0}},superTypes:[bt.$type]},Alternatives:{name:dc.$type,properties:{cardinality:{name:dc.cardinality,optional:!0},elements:{name:dc.elements,defaultValue:[]}},superTypes:[bt.$type]},ArrayLiteral:{name:IE.$type,properties:{elements:{name:IE.elements,defaultValue:[]}},superTypes:[Hs.$type]},ArrayType:{name:Vp.$type,properties:{elementType:{name:Vp.elementType}},superTypes:[Gs.$type]},Assignment:{name:Yr.$type,properties:{cardinality:{name:Yr.cardinality,optional:!0},feature:{name:Yr.feature},operator:{name:Yr.operator},predicate:{name:Yr.predicate,optional:!0},terminal:{name:Yr.terminal}},superTypes:[bt.$type]},BooleanLiteral:{name:Kp.$type,properties:{true:{name:Kp.true,defaultValue:!1}},superTypes:[zi.$type,Hs.$type]},CharacterRange:{name:Vr.$type,properties:{cardinality:{name:Vr.cardinality,optional:!0},left:{name:Vr.left},lookahead:{name:Vr.lookahead,optional:!0},parenthesized:{name:Vr.parenthesized,defaultValue:!1,optional:!0},right:{name:Vr.right,optional:!0}},superTypes:[Ft.$type]},Condition:{name:zi.$type,properties:{},superTypes:[]},Conjunction:{name:pc.$type,properties:{left:{name:pc.left},right:{name:pc.right}},superTypes:[zi.$type]},CrossReference:{name:Kr.$type,properties:{cardinality:{name:Kr.cardinality,optional:!0},deprecatedSyntax:{name:Kr.deprecatedSyntax,defaultValue:!1},isMulti:{name:Kr.isMulti,defaultValue:!1},terminal:{name:Kr.terminal,optional:!0},type:{name:Kr.type,referenceType:jt.$type}},superTypes:[bt.$type]},Disjunction:{name:hc.$type,properties:{left:{name:hc.left},right:{name:hc.right}},superTypes:[zi.$type]},EndOfFile:{name:qp.$type,properties:{cardinality:{name:qp.cardinality,optional:!0}},superTypes:[bt.$type]},Grammar:{name:zr.$type,properties:{imports:{name:zr.imports,defaultValue:[]},interfaces:{name:zr.interfaces,defaultValue:[]},isDeclared:{name:zr.isDeclared,defaultValue:!1},name:{name:zr.name,optional:!0},rules:{name:zr.rules,defaultValue:[]},types:{name:zr.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:RE.$type,properties:{path:{name:RE.path}},superTypes:[]},Group:{name:ji.$type,properties:{cardinality:{name:ji.cardinality,optional:!0},elements:{name:ji.elements,defaultValue:[]},guardCondition:{name:ji.guardCondition,optional:!0},predicate:{name:ji.predicate,optional:!0}},superTypes:[bt.$type]},InferredType:{name:Zp.$type,properties:{name:{name:Zp.name}},superTypes:[jt.$type]},InfixRule:{name:Tn.$type,properties:{call:{name:Tn.call},dataType:{name:Tn.dataType,optional:!0},inferredType:{name:Tn.inferredType,optional:!0},name:{name:Tn.name},operators:{name:Tn.operators},parameters:{name:Tn.parameters,defaultValue:[]},returnType:{name:Tn.returnType,referenceType:jt.$type,optional:!0}},superTypes:[fc.$type]},InfixRuleOperatorList:{name:Yp.$type,properties:{associativity:{name:Yp.associativity,optional:!0},operators:{name:Yp.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:SE.$type,properties:{precedences:{name:SE.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:zs.$type,properties:{attributes:{name:zs.attributes,defaultValue:[]},name:{name:zs.name},superTypes:{name:zs.superTypes,defaultValue:[],referenceType:jt.$type}},superTypes:[jt.$type]},Keyword:{name:js.$type,properties:{cardinality:{name:js.cardinality,optional:!0},predicate:{name:js.predicate,optional:!0},value:{name:js.value}},superTypes:[bt.$type]},NamedArgument:{name:cc.$type,properties:{calledByName:{name:cc.calledByName,defaultValue:!1},parameter:{name:cc.parameter,referenceType:uc.$type,optional:!0},value:{name:cc.value}},superTypes:[]},NegatedToken:{name:Yi.$type,properties:{cardinality:{name:Yi.cardinality,optional:!0},lookahead:{name:Yi.lookahead,optional:!0},parenthesized:{name:Yi.parenthesized,defaultValue:!1,optional:!0},terminal:{name:Yi.terminal}},superTypes:[Ft.$type]},Negation:{name:Jp.$type,properties:{value:{name:Jp.value}},superTypes:[zi.$type]},NumberLiteral:{name:bE.$type,properties:{value:{name:bE.value}},superTypes:[Hs.$type]},Parameter:{name:uc.$type,properties:{name:{name:uc.name}},superTypes:[]},ParameterReference:{name:Qp.$type,properties:{parameter:{name:Qp.parameter,referenceType:uc.$type}},superTypes:[zi.$type]},ParserRule:{name:un.$type,properties:{dataType:{name:un.dataType,optional:!0},definition:{name:un.definition},entry:{name:un.entry,defaultValue:!1},fragment:{name:un.fragment,defaultValue:!1},inferredType:{name:un.inferredType,optional:!0},name:{name:un.name},parameters:{name:un.parameters,defaultValue:[]},returnType:{name:un.returnType,referenceType:jt.$type,optional:!0}},superTypes:[fc.$type]},ReferenceType:{name:mc.$type,properties:{isMulti:{name:mc.isMulti,defaultValue:!1},referenceType:{name:mc.referenceType}},superTypes:[Gs.$type]},RegexToken:{name:Vi.$type,properties:{cardinality:{name:Vi.cardinality,optional:!0},lookahead:{name:Vi.lookahead,optional:!0},parenthesized:{name:Vi.parenthesized,defaultValue:!1,optional:!0},regex:{name:Vi.regex}},superTypes:[Ft.$type]},ReturnType:{name:eh.$type,properties:{name:{name:eh.name}},superTypes:[]},RuleCall:{name:Ki.$type,properties:{arguments:{name:Ki.arguments,defaultValue:[]},cardinality:{name:Ki.cardinality,optional:!0},predicate:{name:Ki.predicate,optional:!0},rule:{name:Ki.rule,referenceType:lc.$type}},superTypes:[bt.$type]},SimpleType:{name:Ys.$type,properties:{primitiveType:{name:Ys.primitiveType,optional:!0},stringType:{name:Ys.stringType,optional:!0},typeRef:{name:Ys.typeRef,referenceType:jt.$type,optional:!0}},superTypes:[Gs.$type]},StringLiteral:{name:NE.$type,properties:{value:{name:NE.value}},superTypes:[Hs.$type]},TerminalAlternatives:{name:qi.$type,properties:{cardinality:{name:qi.cardinality,optional:!0},elements:{name:qi.elements,defaultValue:[]},lookahead:{name:qi.lookahead,optional:!0},parenthesized:{name:qi.parenthesized,defaultValue:!1,optional:!0}},superTypes:[Ft.$type]},TerminalElement:{name:Ft.$type,properties:{cardinality:{name:Ft.cardinality,optional:!0},lookahead:{name:Ft.lookahead,optional:!0},parenthesized:{name:Ft.parenthesized,defaultValue:!1,optional:!0}},superTypes:[bt.$type]},TerminalGroup:{name:Zi.$type,properties:{cardinality:{name:Zi.cardinality,optional:!0},elements:{name:Zi.elements,defaultValue:[]},lookahead:{name:Zi.lookahead,optional:!0},parenthesized:{name:Zi.parenthesized,defaultValue:!1,optional:!0}},superTypes:[Ft.$type]},TerminalRule:{name:ir.$type,properties:{definition:{name:ir.definition},fragment:{name:ir.fragment,defaultValue:!1},hidden:{name:ir.hidden,defaultValue:!1},name:{name:ir.name},type:{name:ir.type,optional:!0}},superTypes:[lc.$type]},TerminalRuleCall:{name:Ji.$type,properties:{cardinality:{name:Ji.cardinality,optional:!0},lookahead:{name:Ji.lookahead,optional:!0},parenthesized:{name:Ji.parenthesized,defaultValue:!1,optional:!0},rule:{name:Ji.rule,referenceType:ir.$type}},superTypes:[Ft.$type]},Type:{name:gc.$type,properties:{name:{name:gc.name},type:{name:gc.type}},superTypes:[jt.$type]},TypeAttribute:{name:Us.$type,properties:{defaultValue:{name:Us.defaultValue,optional:!0},isOptional:{name:Us.isOptional,defaultValue:!1},name:{name:Us.name},type:{name:Us.type}},superTypes:[]},TypeDefinition:{name:Gs.$type,properties:{},superTypes:[]},UnionType:{name:th.$type,properties:{types:{name:th.types,defaultValue:[]}},superTypes:[Gs.$type]},UnorderedGroup:{name:yc.$type,properties:{cardinality:{name:yc.cardinality,optional:!0},elements:{name:yc.elements,defaultValue:[]}},superTypes:[bt.$type]},UntilToken:{name:Qi.$type,properties:{cardinality:{name:Qi.cardinality,optional:!0},lookahead:{name:Qi.lookahead,optional:!0},parenthesized:{name:Qi.parenthesized,defaultValue:!1,optional:!0},terminal:{name:Qi.terminal}},superTypes:[Ft.$type]},ValueLiteral:{name:Hs.$type,properties:{},superTypes:[]},Wildcard:{name:Vs.$type,properties:{cardinality:{name:Vs.cardinality,optional:!0},lookahead:{name:Vs.lookahead,optional:!0},parenthesized:{name:Vs.parenthesized,defaultValue:!1,optional:!0}},superTypes:[Ft.$type]}}}},me=new Ks;function qs(e){return new rr(e,t=>nr(t)?t.content:[],{includeRoot:!0})}function ZE(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function JE(e){return{start:{line:e.startLine-1,character:e.startColumn-1},end:{line:e.endLine-1,character:e.endColumn}}}function Zs(e){let{startOffset:t,endOffset:n}=e;return typeof t=="number"&&Number.isFinite(t)&&t>=0&&typeof n=="number"&&Number.isFinite(n)&&n>=t}function eo(e){if(!e)return;let{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}var vn;(function(e){e[e.Before=0]="Before",e[e.After=1]="After",e[e.OverlapFront=2]="OverlapFront",e[e.OverlapBack=3]="OverlapBack",e[e.Inside=4]="Inside",e[e.Outside=5]="Outside"})(vn||(vn={}));function gL(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return vn.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return vn.After;let n=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,r=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return n&&r?vn.Inside:n?vn.OverlapBack:r?vn.OverlapFront:vn.Outside}function kE(e,t){return gL(e,t)>vn.After}var QE=/^[\w\p{L}]$/u;function ew(e,t){if(e){let n=yL(e,!0);if(n&&qE(n,t))return n;if(nc(e)){let r=e.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){let o=e.content[i];if(qE(o,t))return o}}}}function qE(e,t){return tc(e)&&t.includes(e.tokenType.name)}function yL(e,t=!0){for(;e.container;){let n=e.container,r=n.content.indexOf(e);for(;r>0;){r--;let i=n.content[r];if(t||!i.hidden)return i}e=n}}var kc={};Gp(kc,{findAssignment:()=>Eh,findNameAssignment:()=>_c,findNodeForKeyword:()=>yh,findNodeForProperty:()=>ra,findNodesForKeyword:()=>AL,findNodesForKeywordInternal:()=>xh,findNodesForProperty:()=>mh,getActionAtElement:()=>lw,getActionType:()=>uw,getAllReachableRules:()=>na,getAllRulesUsedForCrossReferences:()=>_L,getCrossReferenceTerminal:()=>ph,getEntryRule:()=>iw,getExplicitRuleType:()=>Ac,getHiddenRules:()=>ow,getRuleType:()=>wh,getRuleTypeName:()=>bL,getTypeName:()=>lr,isArrayCardinality:()=>IL,isArrayOperator:()=>RL,isCommentTerminal:()=>hh,isDataType:()=>SL,isDataTypeRule:()=>ia,isOptionalCardinality:()=>kL,terminalRegex:()=>no});var Js=class extends Error{constructor(t,n){let r=typeof n=="string"?n:n();super(t?`${r} at ${t.range.start.line}:${t.range.start.character}`:r)}};function ar(e,t="Error: Got unexpected value."){throw new Error(typeof t=="string"?t:t())}function oe(e){return e.charCodeAt(0)}function wc(e,t){Array.isArray(e)?e.forEach(function(n){t.push(n)}):t.push(e)}function to(e,t){if(e[t]===!0)throw"duplicate flag "+t;let n=e[t];e[t]=!0}function Jr(e){if(e===void 0)throw Error("Internal Error - Should never get here!");return!0}function Qs(){throw Error("Internal Error - Should never get here!")}function ah(e){return e.type==="Character"}var ea=[];for(let e=oe("0");e<=oe("9");e++)ea.push(e);var ta=[oe("_")].concat(ea);for(let e=oe("a");e<=oe("z");e++)ta.push(e);for(let e=oe("A");e<=oe("Z");e++)ta.push(e);var lh=[oe(" "),oe("\f"),oe(`
3
- `),oe("\r"),oe(" "),oe("\v"),oe(" "),oe("\xA0"),oe("\u1680"),oe("\u2000"),oe("\u2001"),oe("\u2002"),oe("\u2003"),oe("\u2004"),oe("\u2005"),oe("\u2006"),oe("\u2007"),oe("\u2008"),oe("\u2009"),oe("\u200A"),oe("\u2028"),oe("\u2029"),oe("\u202F"),oe("\u205F"),oe("\u3000"),oe("\uFEFF")];var xL=/[0-9a-fA-F]/,Tc=/[0-9]/,EL=/[1-9]/,Qr=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(t){this.idx=t.idx,this.input=t.input,this.groupIdx=t.groupIdx}pattern(t){this.idx=0,this.input=t,this.groupIdx=0,this.consumeChar("/");let n=this.disjunction();this.consumeChar("/");let r={type:"Flags",loc:{begin:this.idx,end:t.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":to(r,"global");break;case"i":to(r,"ignoreCase");break;case"m":to(r,"multiLine");break;case"u":to(r,"unicode");break;case"y":to(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){let t=[],n=this.idx;for(t.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),t.push(this.alternative());return{type:"Disjunction",value:t,loc:this.loc(n)}}alternative(){let t=[],n=this.idx;for(;this.isTerm();)t.push(this.term());return{type:"Alternative",value:t,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let t=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(t)};case"$":return{type:"EndAnchor",loc:this.loc(t)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(t)};case"B":return{type:"NonWordBoundary",loc:this.loc(t)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":n="Lookbehind";break;case"!":n="NegativeLookbehind"}break}}Jr(n);let r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(t)}}return Qs()}quantifier(t=!1){let n,r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let o;this.isDigit()?(o=this.integerIncludingZero(),n={atLeast:i,atMost:o}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(t===!0&&n===void 0)return;Jr(n);break}if(!(t===!0&&n===void 0)&&Jr(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let t,n=this.idx;switch(this.peekChar()){case".":t=this.dotAll();break;case"\\":t=this.atomEscape();break;case"[":t=this.characterClass();break;case"(":t=this.group();break}return t===void 0&&this.isPatternCharacter()&&(t=this.patternCharacter()),Jr(t)?(t.loc=this.loc(n),this.isQuantifier()&&(t.quantifier=this.quantifier()),t):Qs()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[oe(`
4
- `),oe("\r"),oe("\u2028"),oe("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let t,n=!1;switch(this.popChar()){case"d":t=ea;break;case"D":t=ea,n=!0;break;case"s":t=lh;break;case"S":t=lh,n=!0;break;case"w":t=ta;break;case"W":t=ta,n=!0;break}return Jr(t)?{type:"Set",value:t,complement:n}:Qs()}controlEscapeAtom(){let t;switch(this.popChar()){case"f":t=oe("\f");break;case"n":t=oe(`
5
- `);break;case"r":t=oe("\r");break;case"t":t=oe(" ");break;case"v":t=oe("\v");break}return Jr(t)?{type:"Character",value:t}:Qs()}controlLetterEscapeAtom(){this.consumeChar("c");let t=this.popChar();if(/[a-zA-Z]/.test(t)===!1)throw Error("Invalid ");return{type:"Character",value:t.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:oe("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let t=this.popChar();return{type:"Character",value:oe(t)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
6
- `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let t=this.popChar();return{type:"Character",value:oe(t)}}}characterClass(){let t=[],n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){let r=this.classAtom(),i=r.type==="Character";if(ah(r)&&this.isRangeDash()){this.consumeChar("-");let o=this.classAtom(),s=o.type==="Character";if(ah(o)){if(o.value<r.value)throw Error("Range out of order in character class");t.push({from:r.value,to:o.value})}else wc(r.value,t),t.push(oe("-")),wc(o.value,t)}else wc(r.value,t)}return this.consumeChar("]"),{type:"Set",complement:n,value:t}}classAtom(){switch(this.peekChar()){case"]":case`
7
- `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:oe("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let t=!0;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),t=!1):this.groupIdx++;let n=this.disjunction();this.consumeChar(")");let r={type:"Group",capturing:t,value:n};return t&&(r.idx=this.groupIdx),r}positiveInteger(){let t=this.popChar();if(EL.test(t)===!1)throw Error("Expecting a positive integer");for(;Tc.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)}integerIncludingZero(){let t=this.popChar();if(Tc.test(t)===!1)throw Error("Expecting an integer");for(;Tc.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)}patternCharacter(){let t=this.popChar();switch(t){case`
8
- `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:oe(t)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Tc.test(this.peekChar(0))}isClassAtom(t=0){switch(this.peekChar(t)){case"]":case`
1
+ /*! @nowline/embed 0.13.0 sha=348d8c6 built=2026-11-13T08:06:49Z */
2
+ "use strict";var nowline=(()=>{var lL=Object.create;var Ws=Object.defineProperty;var cL=Object.getOwnPropertyDescriptor;var uL=Object.getOwnPropertyNames;var fL=Object.getPrototypeOf,dL=Object.prototype.hasOwnProperty;var pL=(e,t,n)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hL=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Xs=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},zp=(e,t)=>{for(var n in t)Ws(e,n,{get:t[n],enumerable:!0})},_E=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uL(t))!dL.call(e,i)&&i!==n&&Ws(e,i,{get:()=>t[i],enumerable:!(r=cL(t,i))||r.enumerable});return e};var jp=(e,t,n)=>(n=e!=null?lL(fL(e)):{},_E(t||!e||!e.__esModule?Ws(n,"default",{value:e,enumerable:!0}):n,e)),mL=e=>_E(Ws({},"__esModule",{value:!0}),e);var M=(e,t,n)=>pL(e,typeof t!="symbol"?t+"":t,n);var xm=Xs(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});var mm;function gm(){if(mm===void 0)throw new Error("No runtime abstraction layer installed");return mm}(function(e){function t(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");mm=n}e.install=t})(gm||(gm={}));ym.default=gm});var Em=Xs($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.boolean=xM;$n.string=j_;$n.number=EM;$n.error=wM;$n.func=TM;$n.array=Y_;$n.stringArray=vM;function xM(e){return e===!0||e===!1}function j_(e){return typeof e=="string"||e instanceof String}function EM(e){return typeof e=="number"||e instanceof Number}function wM(e){return e instanceof Error}function TM(e){return typeof e=="function"}function Y_(e){return Array.isArray(e)}function vM(e){return Y_(e)&&e.every(t=>j_(t))}});var vm=Xs(kr=>{"use strict";var _M=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kr,"__esModule",{value:!0});kr.Emitter=kr.Event=void 0;var AM=_M(xm()),V_;(function(e){let t={dispose(){}};e.None=function(){return t}})(V_||(kr.Event=V_={}));var wm=class{constructor(){M(this,"_callbacks");M(this,"_contexts")}add(t,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(t,n)})}remove(t,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===t)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,s=r.length;o<s;o++)try{n.push(r[o].apply(i[o],t))}catch(a){(0,AM.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Uu=class Uu{constructor(t){M(this,"_options");M(this,"_event");M(this,"_callbacks");this._options=t}get event(){return this._event||(this._event=(t,n,r)=>{this._callbacks||(this._callbacks=new wm),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),i.dispose=Uu._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};M(Uu,"_noop",function(){});var Tm=Uu;kr.Emitter=Tm});var K_=Xs(Tt=>{"use strict";var kM=Tt&&Tt.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),IM=Tt&&Tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),RM=Tt&&Tt.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i<r.length;i++)r[i]!=="default"&&kM(n,t,r[i]);return IM(n,t),n}})(),SM=Tt&&Tt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CancellationTokenSource=Tt.CancellationToken=void 0;var bM=SM(xm()),NM=RM(Em()),_m=vm(),Gu;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:_m.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_m.Event.None});function t(n){let r=n;return r&&(r===e.None||r===e.Cancelled||NM.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}e.is=t})(Gu||(Tt.CancellationToken=Gu={}));var LM=Object.freeze(function(e,t){let n=(0,bM.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}),Hu=class{constructor(){M(this,"_isCancelled",!1);M(this,"_emitter")}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?LM:(this._emitter||(this._emitter=new _m.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Am=class{constructor(){M(this,"_token")}get token(){return this._token||(this._token=new Hu),this._token}cancel(){this._token?this._token.cancel():this._token=Gu.Cancelled}dispose(){this._token?this._token instanceof Hu&&this._token.dispose():this._token=Gu.None}};Tt.CancellationTokenSource=Am});var Z_=Xs(ne=>{"use strict";var PM=ne&&ne.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),OM=ne&&ne.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),CM=ne&&ne.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i<r.length;i++)r[i]!=="default"&&PM(n,t,r[i]);return OM(n,t),n}})();Object.defineProperty(ne,"__esModule",{value:!0});ne.Message=ne.NotificationType9=ne.NotificationType8=ne.NotificationType7=ne.NotificationType6=ne.NotificationType5=ne.NotificationType4=ne.NotificationType3=ne.NotificationType2=ne.NotificationType1=ne.NotificationType0=ne.NotificationType=ne.RequestType9=ne.RequestType8=ne.RequestType7=ne.RequestType6=ne.RequestType5=ne.RequestType4=ne.RequestType3=ne.RequestType2=ne.RequestType1=ne.RequestType=ne.RequestType0=ne.AbstractMessageSignature=ne.ParameterStructures=ne.ResponseError=ne.ErrorCodes=void 0;var hi=CM(Em()),km;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(km||(ne.ErrorCodes=km={}));var Im=class e extends Error{constructor(n,r,i){super(r);M(this,"code");M(this,"data");this.code=hi.number(n)?n:km.UnknownErrorCode,this.data=i,Object.setPrototypeOf(this,e.prototype)}toJson(){let n={code:this.code,message:this.message};return this.data!==void 0&&(n.data=this.data),n}};ne.ResponseError=Im;var Zt=class Zt{constructor(t){M(this,"kind");this.kind=t}static is(t){return t===Zt.auto||t===Zt.byName||t===Zt.byPosition}toString(){return this.kind}};M(Zt,"auto",new Zt("auto")),M(Zt,"byPosition",new Zt("byPosition")),M(Zt,"byName",new Zt("byName"));var Ir=Zt;ne.ParameterStructures=Ir;var Oe=class{constructor(t,n){M(this,"method");M(this,"numberOfParams");this.method=t,this.numberOfParams=n}get parameterStructures(){return Ir.auto}};ne.AbstractMessageSignature=Oe;var Rm=class extends Oe{constructor(n){super(n,0);M(this,"_")}};ne.RequestType0=Rm;var Sm=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ne.RequestType=Sm;var bm=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ne.RequestType1=bm;var Nm=class extends Oe{constructor(n){super(n,2);M(this,"_")}};ne.RequestType2=Nm;var Lm=class extends Oe{constructor(n){super(n,3);M(this,"_")}};ne.RequestType3=Lm;var Pm=class extends Oe{constructor(n){super(n,4);M(this,"_")}};ne.RequestType4=Pm;var Om=class extends Oe{constructor(n){super(n,5);M(this,"_")}};ne.RequestType5=Om;var Cm=class extends Oe{constructor(n){super(n,6);M(this,"_")}};ne.RequestType6=Cm;var $m=class extends Oe{constructor(n){super(n,7);M(this,"_")}};ne.RequestType7=$m;var Dm=class extends Oe{constructor(n){super(n,8);M(this,"_")}};ne.RequestType8=Dm;var Mm=class extends Oe{constructor(n){super(n,9);M(this,"_")}};ne.RequestType9=Mm;var Fm=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ne.NotificationType=Fm;var Bm=class extends Oe{constructor(n){super(n,0);M(this,"_")}};ne.NotificationType0=Bm;var Wm=class extends Oe{constructor(n,r=Ir.auto){super(n,1);M(this,"_parameterStructures");M(this,"_");this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};ne.NotificationType1=Wm;var Xm=class extends Oe{constructor(n){super(n,2);M(this,"_")}};ne.NotificationType2=Xm;var Um=class extends Oe{constructor(n){super(n,3);M(this,"_")}};ne.NotificationType3=Um;var Gm=class extends Oe{constructor(n){super(n,4);M(this,"_")}};ne.NotificationType4=Gm;var Hm=class extends Oe{constructor(n){super(n,5);M(this,"_")}};ne.NotificationType5=Hm;var zm=class extends Oe{constructor(n){super(n,6);M(this,"_")}};ne.NotificationType6=zm;var jm=class extends Oe{constructor(n){super(n,7);M(this,"_")}};ne.NotificationType7=jm;var Ym=class extends Oe{constructor(n){super(n,8);M(this,"_")}};ne.NotificationType8=Ym;var Vm=class extends Oe{constructor(n){super(n,9);M(this,"_")}};ne.NotificationType9=Vm;var q_;(function(e){function t(i){let o=i;return o&&hi.string(o.method)&&(hi.string(o.id)||hi.number(o.id))}e.isRequest=t;function n(i){let o=i;return o&&hi.string(o.method)&&i.id===void 0}e.isNotification=n;function r(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(hi.string(o.id)||hi.number(o.id)||o.id===null)}e.isResponse=r})(q_||(ne.Message=q_={}))});var Gy={};zp(Gy,{nodeReadFile:()=>b2});async function b2(){throw new Error("nowline: filesystem readers are unavailable in the browser embed")}var Hy=hL(()=>{});var eG={};zp(eG,{EmbedRenderError:()=>Zl,__resetForTests:()=>QU,init:()=>EE,initialize:()=>KU,parse:()=>ZU,render:()=>qU,run:()=>JU,sha:()=>YU,version:()=>jU});function Ue(e){return typeof e=="object"&&e!==null&&typeof e.$type=="string"}function it(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"ref"in e}function Mt(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"items"in e}function AE(e){return typeof e=="object"&&e!==null&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.path=="string"}function Hi(e){return typeof e=="object"&&e!==null&&typeof e.info=="object"&&typeof e.message=="string"}var Gi=class{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(t){let n=this.types[t.container.$type];if(!n)throw new Error(`Type ${t.container.$type||"undefined"} not found.`);let r=n.properties[t.property]?.referenceType;if(!r)throw new Error(`Property ${t.property||"undefined"} of type ${t.container.$type} is not a reference.`);return r}getTypeMetaData(t){let n=this.types[t];return n||{name:t,properties:{},superTypes:[]}}isInstance(t,n){return Ue(t)&&this.isSubtype(t.$type,n)}isSubtype(t,n){if(t===n)return!0;let r=this.subtypes[t];r||(r=this.subtypes[t]={});let i=r[n];if(i!==void 0)return i;{let o=this.types[t],s=o?o.superTypes.some(a=>this.isSubtype(a,n)):!1;return r[n]=s,s}}getAllSubTypes(t){let n=this.allSubtypes[t];if(n)return n;{let r=this.getAllTypes(),i=[];for(let o of r)this.isSubtype(o,t)&&i.push(o);return this.allSubtypes[t]=i,i}}isComplete(t){let n=this.getTypeMetaData(t.$type);for(let r of Object.keys(n.properties)){let i=n.properties[r];if(i.optional)continue;let o=t[i.name];if(o==null)return!1}return!0}};function nr(e){return typeof e=="object"&&e!==null&&Array.isArray(e.content)}function rc(e){return typeof e=="object"&&e!==null&&typeof e.tokenType=="object"}function ic(e){return nr(e)&&typeof e.fullText=="string"}var zt=class e{constructor(t,n){this.startFn=t,this.nextFn=n}iterator(){let t={state:this.startFn(),next:()=>this.nextFn(t.state),[Symbol.iterator]:()=>t};return t}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let t=this.iterator(),n=0,r=t.next();for(;!r.done;)n++,r=t.next();return n}toArray(){let t=[],n=this.iterator(),r;do r=n.next(),r.value!==void 0&&t.push(r.value);while(!r.done);return t}toSet(){return new Set(this)}toMap(t,n){let r=this.map(i=>[t?t(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(t){return new e(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return yt})}join(t=","){let n=this.iterator(),r="",i,o=!1;do i=n.next(),i.done||(o&&(r+=t),r+=yL(i.value)),o=!0;while(!i.done);return r}indexOf(t,n=0){let r=this.iterator(),i=0,o=r.next();for(;!o.done;){if(i>=n&&o.value===t)return i;o=r.next(),i++}return-1}every(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(!t(r.value))return!1;r=n.next()}return!0}some(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(t(r.value))return!0;r=n.next()}return!1}forEach(t){let n=this.iterator(),r=0,i=n.next();for(;!i.done;)t(i.value,r),i=n.next(),r++}map(t){return new e(this.startFn,n=>{let{done:r,value:i}=this.nextFn(n);return r?yt:{done:!1,value:t(i)}})}filter(t){return new e(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&t(r.value))return r;while(!r.done);return yt})}nonNullable(){return this.filter(t=>t!=null)}reduce(t,n){let r=this.iterator(),i=n,o=r.next();for(;!o.done;)i===void 0?i=o.value:i=t(i,o.value),o=r.next();return i}reduceRight(t,n){return this.recursiveReduce(this.iterator(),t,n)}recursiveReduce(t,n,r){let i=t.next();if(i.done)return r;let o=this.recursiveReduce(t,n,r);return o===void 0?i.value:n(o,i.value)}find(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(t(r.value))return r.value;r=n.next()}}findIndex(t){let n=this.iterator(),r=0,i=n.next();for(;!i.done;){if(t(i.value))return r;i=n.next(),r++}return-1}includes(t){let n=this.iterator(),r=n.next();for(;!r.done;){if(r.value===t)return!0;r=n.next()}return!1}flatMap(t){return new e(()=>({this:this.startFn()}),n=>{do{if(n.iterator){let o=n.iterator.next();if(o.done)n.iterator=void 0;else return o}let{done:r,value:i}=this.nextFn(n.this);if(!r){let o=t(i);if(oc(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(n.iterator);return yt})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let n=t>1?this.flat(t-1):this;return new e(()=>({this:n.startFn()}),r=>{do{if(r.iterator){let s=r.iterator.next();if(s.done)r.iterator=void 0;else return s}let{done:i,value:o}=n.nextFn(r.this);if(!i)if(oc(o))r.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(r.iterator);return yt})}head(){let n=this.iterator().next();if(!n.done)return n.value}tail(t=1){return new e(()=>{let n=this.startFn();for(let r=0;r<t;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(t){return new e(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>t?yt:this.nextFn(n.state)))}distinct(t){return new e(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){let i=t?t(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return yt})}exclude(t,n){let r=new Set;for(let i of t){let o=n?n(i):i;r.add(o)}return this.filter(i=>{let o=n?n(i):i;return!r.has(o)})}};function yL(e){return typeof e=="string"?e:typeof e>"u"?"undefined":typeof e.toString=="function"?e.toString():Object.prototype.toString.call(e)}function oc(e){return!!e&&typeof e[Symbol.iterator]=="function"}var ac=new zt(()=>{},()=>yt),yt=Object.freeze({done:!0,value:void 0});function ye(...e){if(e.length===1){let t=e[0];if(t instanceof zt)return t;if(oc(t))return new zt(()=>t[Symbol.iterator](),n=>n.next());if(typeof t.length=="number")return new zt(()=>({index:0}),n=>n.index<t.length?{done:!1,value:t[n.index++]}:yt)}return e.length>1?new zt(()=>({collIndex:0,arrIndex:0}),t=>{do{if(t.iterator){let n=t.iterator.next();if(!n.done)return n;t.iterator=void 0}if(t.array){if(t.arrIndex<t.array.length)return{done:!1,value:t.array[t.arrIndex++]};t.array=void 0,t.arrIndex=0}if(t.collIndex<e.length){let n=e[t.collIndex++];oc(n)?t.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return yt}):ac}var rr=class extends zt{constructor(t,n,r){super(()=>({iterators:r?.includeRoot?[[t][Symbol.iterator]()]:[n(t)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(n(s.value)[Symbol.iterator]()),s}return yt})}iterator(){let t={state:this.startFn(),next:()=>this.nextFn(t.state),prune:()=>{t.state.pruned=!0},[Symbol.iterator]:()=>t};return t}},sc;(function(e){function t(o){return o.reduce((s,a)=>s+a,0)}e.sum=t;function n(o){return o.reduce((s,a)=>s*a,0)}e.product=n;function r(o){return o.reduce((s,a)=>Math.min(s,a))}e.min=r;function i(o){return o.reduce((s,a)=>Math.max(s,a))}e.max=i})(sc||(sc={}));function lc(e,t={}){for(let[n,r]of Object.entries(e))n.startsWith("$")||(Array.isArray(r)?r.forEach((i,o)=>{Ue(i)&&(i.$container=e,i.$containerProperty=n,i.$containerIndex=o,t.deep&&lc(i,t))}):Ue(r)&&(r.$container=e,r.$containerProperty=n,t.deep&&lc(r,t)))}function zi(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function st(e){let n=Us(e).$document;if(!n)throw new Error("AST node has no document.");return n}function Us(e){for(;e.$container;)e=e.$container;return e}function Vp(e){return it(e)?e.ref?[e.ref]:[]:Mt(e)?e.items.map(t=>t.ref):[]}function cc(e,t){if(!e)throw new Error("Node must be an AstNode.");let n=t?.range;return new zt(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){let i=r.keys[r.keyIndex];if(!i.startsWith("$")){let o=e[i];if(Ue(o)){if(r.keyIndex++,Yp(o,n))return{done:!1,value:o}}else if(Array.isArray(o)){for(;r.arrayIndex<o.length;){let s=r.arrayIndex++,a=o[s];if(Ue(a)&&Yp(a,n))return{done:!1,value:a}}r.arrayIndex=0}}r.keyIndex++}return yt})}function cn(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new rr(e,n=>cc(n,t))}function xt(e,t){if(e){if(t?.range&&!Yp(e,t.range))return new rr(e,()=>[])}else throw new Error("Root node must be an AstNode.");return new rr(e,n=>cc(n,t),{includeRoot:!0})}function Yp(e,t){if(!t)return!0;let n=e.$cstNode?.range;return n?RE(n,t):!1}function Hr(e){return new zt(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndex<t.keys.length;){let n=t.keys[t.keyIndex];if(!n.startsWith("$")){let r=e[n];if(it(r)||Mt(r))return t.keyIndex++,{done:!1,value:{reference:r,container:e,property:n}};if(Array.isArray(r)){for(;t.arrayIndex<r.length;){let i=t.arrayIndex++,o=r[i];if(it(o)||Mt(o))return{done:!1,value:{reference:o,container:e,property:n,index:i}}}t.arrayIndex=0}}t.keyIndex++}return yt})}function kE(e,t){let n=e.getTypeMetaData(t.$type),r=t;for(let i of Object.values(n.properties))i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=IE(i.defaultValue))}function IE(e){return Array.isArray(e)?[...e.map(IE)]:e}var bt={$type:"AbstractElement",cardinality:"cardinality"};function wc(e){return me.isInstance(e,bt.$type)}var pc={$type:"AbstractParserRule"};function or(e){return me.isInstance(e,pc.$type)}var uc={$type:"AbstractRule"};var jt={$type:"AbstractType"};var jr={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};function sr(e){return me.isInstance(e,jr.$type)}var hc={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};function ih(e){return me.isInstance(e,hc.$type)}var SE={$type:"ArrayLiteral",elements:"elements"};var qp={$type:"ArrayType",elementType:"elementType"};function OE(e){return me.isInstance(e,qp.$type)}var Yr={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};function fn(e){return me.isInstance(e,Yr.$type)}var Zp={$type:"BooleanLiteral",true:"true"};function CE(e){return me.isInstance(e,Zp.$type)}var Vr={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};function $E(e){return me.isInstance(e,Vr.$type)}var ji={$type:"Condition"};var mc={$type:"Conjunction",left:"left",right:"right"};function DE(e){return me.isInstance(e,mc.$type)}var Kr={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};function dn(e){return me.isInstance(e,Kr.$type)}var gc={$type:"Disjunction",left:"left",right:"right"};function ME(e){return me.isInstance(e,gc.$type)}var Jp={$type:"EndOfFile",cardinality:"cardinality"};function FE(e){return me.isInstance(e,Jp.$type)}var zr={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"};var bE={$type:"GrammarImport",path:"path"};var Yi={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};function qr(e){return me.isInstance(e,Yi.$type)}var Qp={$type:"InferredType",name:"name"};function Tc(e){return me.isInstance(e,Qp.$type)}var Tn={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};function Zr(e){return me.isInstance(e,Tn.$type)}var Kp={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"};var NE={$type:"InfixRuleOperators",precedences:"precedences"};var js={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};function BE(e){return me.isInstance(e,js.$type)}var Ys={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};function Yt(e){return me.isInstance(e,Ys.$type)}var fc={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"};var Vi={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function WE(e){return me.isInstance(e,Vi.$type)}var eh={$type:"Negation",value:"value"};function XE(e){return me.isInstance(e,eh.$type)}var LE={$type:"NumberLiteral",value:"value"};var dc={$type:"Parameter",name:"name"};var th={$type:"ParameterReference",parameter:"parameter"};function UE(e){return me.isInstance(e,th.$type)}var un={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};function at(e){return me.isInstance(e,un.$type)}var yc={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"};function GE(e){return me.isInstance(e,yc.$type)}var Ki={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};function HE(e){return me.isInstance(e,Ki.$type)}var nh={$type:"ReturnType",name:"name"};function zE(e){return me.isInstance(e,nh.$type)}var qi={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};function pn(e){return me.isInstance(e,qi.$type)}var Vs={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};function oh(e){return me.isInstance(e,Vs.$type)}var PE={$type:"StringLiteral",value:"value"};var Zi={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function jE(e){return me.isInstance(e,Zi.$type)}var Ft={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};var Ji={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function YE(e){return me.isInstance(e,Ji.$type)}var ir={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};function Et(e){return me.isInstance(e,ir.$type)}var Qi={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};function sh(e){return me.isInstance(e,Qi.$type)}var xc={$type:"Type",name:"name",type:"type"};function ah(e){return me.isInstance(e,xc.$type)}var Gs={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"};var Hs={$type:"TypeDefinition"};var rh={$type:"UnionType",types:"types"};function VE(e){return me.isInstance(e,rh.$type)}var Ec={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};function lh(e){return me.isInstance(e,Ec.$type)}var eo={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function KE(e){return me.isInstance(e,eo.$type)}var zs={$type:"ValueLiteral"};var Ks={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};function qE(e){return me.isInstance(e,Ks.$type)}var qs=class extends Gi{constructor(){super(...arguments),this.types={AbstractElement:{name:bt.$type,properties:{cardinality:{name:bt.cardinality,optional:!0}},superTypes:[]},AbstractParserRule:{name:pc.$type,properties:{},superTypes:[uc.$type,jt.$type]},AbstractRule:{name:uc.$type,properties:{},superTypes:[]},AbstractType:{name:jt.$type,properties:{},superTypes:[]},Action:{name:jr.$type,properties:{cardinality:{name:jr.cardinality,optional:!0},feature:{name:jr.feature,optional:!0},inferredType:{name:jr.inferredType,optional:!0},operator:{name:jr.operator,optional:!0},type:{name:jr.type,referenceType:jt.$type,optional:!0}},superTypes:[bt.$type]},Alternatives:{name:hc.$type,properties:{cardinality:{name:hc.cardinality,optional:!0},elements:{name:hc.elements,defaultValue:[]}},superTypes:[bt.$type]},ArrayLiteral:{name:SE.$type,properties:{elements:{name:SE.elements,defaultValue:[]}},superTypes:[zs.$type]},ArrayType:{name:qp.$type,properties:{elementType:{name:qp.elementType}},superTypes:[Hs.$type]},Assignment:{name:Yr.$type,properties:{cardinality:{name:Yr.cardinality,optional:!0},feature:{name:Yr.feature},operator:{name:Yr.operator},predicate:{name:Yr.predicate,optional:!0},terminal:{name:Yr.terminal}},superTypes:[bt.$type]},BooleanLiteral:{name:Zp.$type,properties:{true:{name:Zp.true,defaultValue:!1}},superTypes:[ji.$type,zs.$type]},CharacterRange:{name:Vr.$type,properties:{cardinality:{name:Vr.cardinality,optional:!0},left:{name:Vr.left},lookahead:{name:Vr.lookahead,optional:!0},parenthesized:{name:Vr.parenthesized,defaultValue:!1,optional:!0},right:{name:Vr.right,optional:!0}},superTypes:[Ft.$type]},Condition:{name:ji.$type,properties:{},superTypes:[]},Conjunction:{name:mc.$type,properties:{left:{name:mc.left},right:{name:mc.right}},superTypes:[ji.$type]},CrossReference:{name:Kr.$type,properties:{cardinality:{name:Kr.cardinality,optional:!0},deprecatedSyntax:{name:Kr.deprecatedSyntax,defaultValue:!1},isMulti:{name:Kr.isMulti,defaultValue:!1},terminal:{name:Kr.terminal,optional:!0},type:{name:Kr.type,referenceType:jt.$type}},superTypes:[bt.$type]},Disjunction:{name:gc.$type,properties:{left:{name:gc.left},right:{name:gc.right}},superTypes:[ji.$type]},EndOfFile:{name:Jp.$type,properties:{cardinality:{name:Jp.cardinality,optional:!0}},superTypes:[bt.$type]},Grammar:{name:zr.$type,properties:{imports:{name:zr.imports,defaultValue:[]},interfaces:{name:zr.interfaces,defaultValue:[]},isDeclared:{name:zr.isDeclared,defaultValue:!1},name:{name:zr.name,optional:!0},rules:{name:zr.rules,defaultValue:[]},types:{name:zr.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:bE.$type,properties:{path:{name:bE.path}},superTypes:[]},Group:{name:Yi.$type,properties:{cardinality:{name:Yi.cardinality,optional:!0},elements:{name:Yi.elements,defaultValue:[]},guardCondition:{name:Yi.guardCondition,optional:!0},predicate:{name:Yi.predicate,optional:!0}},superTypes:[bt.$type]},InferredType:{name:Qp.$type,properties:{name:{name:Qp.name}},superTypes:[jt.$type]},InfixRule:{name:Tn.$type,properties:{call:{name:Tn.call},dataType:{name:Tn.dataType,optional:!0},inferredType:{name:Tn.inferredType,optional:!0},name:{name:Tn.name},operators:{name:Tn.operators},parameters:{name:Tn.parameters,defaultValue:[]},returnType:{name:Tn.returnType,referenceType:jt.$type,optional:!0}},superTypes:[pc.$type]},InfixRuleOperatorList:{name:Kp.$type,properties:{associativity:{name:Kp.associativity,optional:!0},operators:{name:Kp.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:NE.$type,properties:{precedences:{name:NE.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:js.$type,properties:{attributes:{name:js.attributes,defaultValue:[]},name:{name:js.name},superTypes:{name:js.superTypes,defaultValue:[],referenceType:jt.$type}},superTypes:[jt.$type]},Keyword:{name:Ys.$type,properties:{cardinality:{name:Ys.cardinality,optional:!0},predicate:{name:Ys.predicate,optional:!0},value:{name:Ys.value}},superTypes:[bt.$type]},NamedArgument:{name:fc.$type,properties:{calledByName:{name:fc.calledByName,defaultValue:!1},parameter:{name:fc.parameter,referenceType:dc.$type,optional:!0},value:{name:fc.value}},superTypes:[]},NegatedToken:{name:Vi.$type,properties:{cardinality:{name:Vi.cardinality,optional:!0},lookahead:{name:Vi.lookahead,optional:!0},parenthesized:{name:Vi.parenthesized,defaultValue:!1,optional:!0},terminal:{name:Vi.terminal}},superTypes:[Ft.$type]},Negation:{name:eh.$type,properties:{value:{name:eh.value}},superTypes:[ji.$type]},NumberLiteral:{name:LE.$type,properties:{value:{name:LE.value}},superTypes:[zs.$type]},Parameter:{name:dc.$type,properties:{name:{name:dc.name}},superTypes:[]},ParameterReference:{name:th.$type,properties:{parameter:{name:th.parameter,referenceType:dc.$type}},superTypes:[ji.$type]},ParserRule:{name:un.$type,properties:{dataType:{name:un.dataType,optional:!0},definition:{name:un.definition},entry:{name:un.entry,defaultValue:!1},fragment:{name:un.fragment,defaultValue:!1},inferredType:{name:un.inferredType,optional:!0},name:{name:un.name},parameters:{name:un.parameters,defaultValue:[]},returnType:{name:un.returnType,referenceType:jt.$type,optional:!0}},superTypes:[pc.$type]},ReferenceType:{name:yc.$type,properties:{isMulti:{name:yc.isMulti,defaultValue:!1},referenceType:{name:yc.referenceType}},superTypes:[Hs.$type]},RegexToken:{name:Ki.$type,properties:{cardinality:{name:Ki.cardinality,optional:!0},lookahead:{name:Ki.lookahead,optional:!0},parenthesized:{name:Ki.parenthesized,defaultValue:!1,optional:!0},regex:{name:Ki.regex}},superTypes:[Ft.$type]},ReturnType:{name:nh.$type,properties:{name:{name:nh.name}},superTypes:[]},RuleCall:{name:qi.$type,properties:{arguments:{name:qi.arguments,defaultValue:[]},cardinality:{name:qi.cardinality,optional:!0},predicate:{name:qi.predicate,optional:!0},rule:{name:qi.rule,referenceType:uc.$type}},superTypes:[bt.$type]},SimpleType:{name:Vs.$type,properties:{primitiveType:{name:Vs.primitiveType,optional:!0},stringType:{name:Vs.stringType,optional:!0},typeRef:{name:Vs.typeRef,referenceType:jt.$type,optional:!0}},superTypes:[Hs.$type]},StringLiteral:{name:PE.$type,properties:{value:{name:PE.value}},superTypes:[zs.$type]},TerminalAlternatives:{name:Zi.$type,properties:{cardinality:{name:Zi.cardinality,optional:!0},elements:{name:Zi.elements,defaultValue:[]},lookahead:{name:Zi.lookahead,optional:!0},parenthesized:{name:Zi.parenthesized,defaultValue:!1,optional:!0}},superTypes:[Ft.$type]},TerminalElement:{name:Ft.$type,properties:{cardinality:{name:Ft.cardinality,optional:!0},lookahead:{name:Ft.lookahead,optional:!0},parenthesized:{name:Ft.parenthesized,defaultValue:!1,optional:!0}},superTypes:[bt.$type]},TerminalGroup:{name:Ji.$type,properties:{cardinality:{name:Ji.cardinality,optional:!0},elements:{name:Ji.elements,defaultValue:[]},lookahead:{name:Ji.lookahead,optional:!0},parenthesized:{name:Ji.parenthesized,defaultValue:!1,optional:!0}},superTypes:[Ft.$type]},TerminalRule:{name:ir.$type,properties:{definition:{name:ir.definition},fragment:{name:ir.fragment,defaultValue:!1},hidden:{name:ir.hidden,defaultValue:!1},name:{name:ir.name},type:{name:ir.type,optional:!0}},superTypes:[uc.$type]},TerminalRuleCall:{name:Qi.$type,properties:{cardinality:{name:Qi.cardinality,optional:!0},lookahead:{name:Qi.lookahead,optional:!0},parenthesized:{name:Qi.parenthesized,defaultValue:!1,optional:!0},rule:{name:Qi.rule,referenceType:ir.$type}},superTypes:[Ft.$type]},Type:{name:xc.$type,properties:{name:{name:xc.name},type:{name:xc.type}},superTypes:[jt.$type]},TypeAttribute:{name:Gs.$type,properties:{defaultValue:{name:Gs.defaultValue,optional:!0},isOptional:{name:Gs.isOptional,defaultValue:!1},name:{name:Gs.name},type:{name:Gs.type}},superTypes:[]},TypeDefinition:{name:Hs.$type,properties:{},superTypes:[]},UnionType:{name:rh.$type,properties:{types:{name:rh.types,defaultValue:[]}},superTypes:[Hs.$type]},UnorderedGroup:{name:Ec.$type,properties:{cardinality:{name:Ec.cardinality,optional:!0},elements:{name:Ec.elements,defaultValue:[]}},superTypes:[bt.$type]},UntilToken:{name:eo.$type,properties:{cardinality:{name:eo.cardinality,optional:!0},lookahead:{name:eo.lookahead,optional:!0},parenthesized:{name:eo.parenthesized,defaultValue:!1,optional:!0},terminal:{name:eo.terminal}},superTypes:[Ft.$type]},ValueLiteral:{name:zs.$type,properties:{},superTypes:[]},Wildcard:{name:Ks.$type,properties:{cardinality:{name:Ks.cardinality,optional:!0},lookahead:{name:Ks.lookahead,optional:!0},parenthesized:{name:Ks.parenthesized,defaultValue:!1,optional:!0}},superTypes:[Ft.$type]}}}},me=new qs;function Zs(e){return new rr(e,t=>nr(t)?t.content:[],{includeRoot:!0})}function QE(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function ew(e){return{start:{line:e.startLine-1,character:e.startColumn-1},end:{line:e.endLine-1,character:e.endColumn}}}function Js(e){let{startOffset:t,endOffset:n}=e;return typeof t=="number"&&Number.isFinite(t)&&t>=0&&typeof n=="number"&&Number.isFinite(n)&&n>=t}function to(e){if(!e)return;let{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}var vn;(function(e){e[e.Before=0]="Before",e[e.After=1]="After",e[e.OverlapFront=2]="OverlapFront",e[e.OverlapBack=3]="OverlapBack",e[e.Inside=4]="Inside",e[e.Outside=5]="Outside"})(vn||(vn={}));function xL(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return vn.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return vn.After;let n=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,r=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return n&&r?vn.Inside:n?vn.OverlapBack:r?vn.OverlapFront:vn.Outside}function RE(e,t){return xL(e,t)>vn.After}var tw=/^[\w\p{L}]$/u;function nw(e,t){if(e){let n=EL(e,!0);if(n&&JE(n,t))return n;if(ic(e)){let r=e.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){let o=e.content[i];if(JE(o,t))return o}}}}function JE(e,t){return rc(e)&&t.includes(e.tokenType.name)}function EL(e,t=!0){for(;e.container;){let n=e.container,r=n.content.indexOf(e);for(;r>0;){r--;let i=n.content[r];if(t||!i.hidden)return i}e=n}}var Rc={};zp(Rc,{findAssignment:()=>Th,findNameAssignment:()=>kc,findNodeForKeyword:()=>Eh,findNodeForProperty:()=>ia,findNodesForKeyword:()=>IL,findNodesForKeywordInternal:()=>wh,findNodesForProperty:()=>yh,getActionAtElement:()=>uw,getActionType:()=>dw,getAllReachableRules:()=>ra,getAllRulesUsedForCrossReferences:()=>kL,getCrossReferenceTerminal:()=>mh,getEntryRule:()=>sw,getExplicitRuleType:()=>Ic,getHiddenRules:()=>aw,getRuleType:()=>vh,getRuleTypeName:()=>LL,getTypeName:()=>lr,isArrayCardinality:()=>SL,isArrayOperator:()=>bL,isCommentTerminal:()=>gh,isDataType:()=>NL,isDataTypeRule:()=>oa,isOptionalCardinality:()=>RL,terminalRegex:()=>ro});var Qs=class extends Error{constructor(t,n){let r=typeof n=="string"?n:n();super(t?`${r} at ${t.range.start.line}:${t.range.start.character}`:r)}};function ar(e,t="Error: Got unexpected value."){throw new Error(typeof t=="string"?t:t())}function oe(e){return e.charCodeAt(0)}function vc(e,t){Array.isArray(e)?e.forEach(function(n){t.push(n)}):t.push(e)}function no(e,t){if(e[t]===!0)throw"duplicate flag "+t;let n=e[t];e[t]=!0}function Jr(e){if(e===void 0)throw Error("Internal Error - Should never get here!");return!0}function ea(){throw Error("Internal Error - Should never get here!")}function ch(e){return e.type==="Character"}var ta=[];for(let e=oe("0");e<=oe("9");e++)ta.push(e);var na=[oe("_")].concat(ta);for(let e=oe("a");e<=oe("z");e++)na.push(e);for(let e=oe("A");e<=oe("Z");e++)na.push(e);var uh=[oe(" "),oe("\f"),oe(`
3
+ `),oe("\r"),oe(" "),oe("\v"),oe(" "),oe("\xA0"),oe("\u1680"),oe("\u2000"),oe("\u2001"),oe("\u2002"),oe("\u2003"),oe("\u2004"),oe("\u2005"),oe("\u2006"),oe("\u2007"),oe("\u2008"),oe("\u2009"),oe("\u200A"),oe("\u2028"),oe("\u2029"),oe("\u202F"),oe("\u205F"),oe("\u3000"),oe("\uFEFF")];var wL=/[0-9a-fA-F]/,_c=/[0-9]/,TL=/[1-9]/,Qr=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(t){this.idx=t.idx,this.input=t.input,this.groupIdx=t.groupIdx}pattern(t){this.idx=0,this.input=t,this.groupIdx=0,this.consumeChar("/");let n=this.disjunction();this.consumeChar("/");let r={type:"Flags",loc:{begin:this.idx,end:t.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":no(r,"global");break;case"i":no(r,"ignoreCase");break;case"m":no(r,"multiLine");break;case"u":no(r,"unicode");break;case"y":no(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){let t=[],n=this.idx;for(t.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),t.push(this.alternative());return{type:"Disjunction",value:t,loc:this.loc(n)}}alternative(){let t=[],n=this.idx;for(;this.isTerm();)t.push(this.term());return{type:"Alternative",value:t,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let t=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(t)};case"$":return{type:"EndAnchor",loc:this.loc(t)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(t)};case"B":return{type:"NonWordBoundary",loc:this.loc(t)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":n="Lookbehind";break;case"!":n="NegativeLookbehind"}break}}Jr(n);let r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(t)}}return ea()}quantifier(t=!1){let n,r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let o;this.isDigit()?(o=this.integerIncludingZero(),n={atLeast:i,atMost:o}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(t===!0&&n===void 0)return;Jr(n);break}if(!(t===!0&&n===void 0)&&Jr(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let t,n=this.idx;switch(this.peekChar()){case".":t=this.dotAll();break;case"\\":t=this.atomEscape();break;case"[":t=this.characterClass();break;case"(":t=this.group();break}return t===void 0&&this.isPatternCharacter()&&(t=this.patternCharacter()),Jr(t)?(t.loc=this.loc(n),this.isQuantifier()&&(t.quantifier=this.quantifier()),t):ea()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[oe(`
4
+ `),oe("\r"),oe("\u2028"),oe("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let t,n=!1;switch(this.popChar()){case"d":t=ta;break;case"D":t=ta,n=!0;break;case"s":t=uh;break;case"S":t=uh,n=!0;break;case"w":t=na;break;case"W":t=na,n=!0;break}return Jr(t)?{type:"Set",value:t,complement:n}:ea()}controlEscapeAtom(){let t;switch(this.popChar()){case"f":t=oe("\f");break;case"n":t=oe(`
5
+ `);break;case"r":t=oe("\r");break;case"t":t=oe(" ");break;case"v":t=oe("\v");break}return Jr(t)?{type:"Character",value:t}:ea()}controlLetterEscapeAtom(){this.consumeChar("c");let t=this.popChar();if(/[a-zA-Z]/.test(t)===!1)throw Error("Invalid ");return{type:"Character",value:t.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:oe("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let t=this.popChar();return{type:"Character",value:oe(t)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
6
+ `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let t=this.popChar();return{type:"Character",value:oe(t)}}}characterClass(){let t=[],n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){let r=this.classAtom(),i=r.type==="Character";if(ch(r)&&this.isRangeDash()){this.consumeChar("-");let o=this.classAtom(),s=o.type==="Character";if(ch(o)){if(o.value<r.value)throw Error("Range out of order in character class");t.push({from:r.value,to:o.value})}else vc(r.value,t),t.push(oe("-")),vc(o.value,t)}else vc(r.value,t)}return this.consumeChar("]"),{type:"Set",complement:n,value:t}}classAtom(){switch(this.peekChar()){case"]":case`
7
+ `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:oe("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let t=!0;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),t=!1):this.groupIdx++;let n=this.disjunction();this.consumeChar(")");let r={type:"Group",capturing:t,value:n};return t&&(r.idx=this.groupIdx),r}positiveInteger(){let t=this.popChar();if(TL.test(t)===!1)throw Error("Expecting a positive integer");for(;_c.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)}integerIncludingZero(){let t=this.popChar();if(_c.test(t)===!1)throw Error("Expecting an integer");for(;_c.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)}patternCharacter(){let t=this.popChar();switch(t){case`
8
+ `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:oe(t)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return _c.test(this.peekChar(0))}isClassAtom(t=0){switch(this.peekChar(t)){case"]":case`
9
9
  `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){let t=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(t)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
10
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(t){let n="";for(let i=0;i<t;i++){let o=this.popChar();if(xL.test(o)===!1)throw Error("Expecting a HexDecimal digits");n+=o}return{type:"Character",value:parseInt(n,16)}}peekChar(t=0){return this.input[this.idx+t]}popChar(){let t=this.peekChar(0);return this.consumeChar(void 0),t}consumeChar(t){if(t!==void 0&&this.input[this.idx]!==t)throw Error("Expected: '"+t+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(t){return{begin:t,end:this.idx}}};var hn=class{visitChildren(t){for(let n in t){let r=t[n];t.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(t){switch(t.type){case"Pattern":this.visitPattern(t);break;case"Flags":this.visitFlags(t);break;case"Disjunction":this.visitDisjunction(t);break;case"Alternative":this.visitAlternative(t);break;case"StartAnchor":this.visitStartAnchor(t);break;case"EndAnchor":this.visitEndAnchor(t);break;case"WordBoundary":this.visitWordBoundary(t);break;case"NonWordBoundary":this.visitNonWordBoundary(t);break;case"Lookahead":this.visitLookahead(t);break;case"NegativeLookahead":this.visitNegativeLookahead(t);break;case"Lookbehind":this.visitLookbehind(t);break;case"NegativeLookbehind":this.visitNegativeLookbehind(t);break;case"Character":this.visitCharacter(t);break;case"Set":this.visitSet(t);break;case"Group":this.visitGroup(t);break;case"GroupBackReference":this.visitGroupBackReference(t);break;case"Quantifier":this.visitQuantifier(t);break}this.visitChildren(t)}visitPattern(t){}visitFlags(t){}visitDisjunction(t){}visitAlternative(t){}visitStartAnchor(t){}visitEndAnchor(t){}visitWordBoundary(t){}visitNonWordBoundary(t){}visitLookahead(t){}visitNegativeLookahead(t){}visitLookbehind(t){}visitNegativeLookbehind(t){}visitCharacter(t){}visitSet(t){}visitGroup(t){}visitGroupBackReference(t){}visitQuantifier(t){}};var tw=/\r?\n/gm,wL=new Qr,uh=class extends hn{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(t){this.multiline=!1,this.regex=t,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(t){t.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(t){let n=String.fromCharCode(t.value);if(!this.multiline&&n===`
10
+ `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(t){let n="";for(let i=0;i<t;i++){let o=this.popChar();if(wL.test(o)===!1)throw Error("Expecting a HexDecimal digits");n+=o}return{type:"Character",value:parseInt(n,16)}}peekChar(t=0){return this.input[this.idx+t]}popChar(){let t=this.peekChar(0);return this.consumeChar(void 0),t}consumeChar(t){if(t!==void 0&&this.input[this.idx]!==t)throw Error("Expected: '"+t+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(t){return{begin:t,end:this.idx}}};var hn=class{visitChildren(t){for(let n in t){let r=t[n];t.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(t){switch(t.type){case"Pattern":this.visitPattern(t);break;case"Flags":this.visitFlags(t);break;case"Disjunction":this.visitDisjunction(t);break;case"Alternative":this.visitAlternative(t);break;case"StartAnchor":this.visitStartAnchor(t);break;case"EndAnchor":this.visitEndAnchor(t);break;case"WordBoundary":this.visitWordBoundary(t);break;case"NonWordBoundary":this.visitNonWordBoundary(t);break;case"Lookahead":this.visitLookahead(t);break;case"NegativeLookahead":this.visitNegativeLookahead(t);break;case"Lookbehind":this.visitLookbehind(t);break;case"NegativeLookbehind":this.visitNegativeLookbehind(t);break;case"Character":this.visitCharacter(t);break;case"Set":this.visitSet(t);break;case"Group":this.visitGroup(t);break;case"GroupBackReference":this.visitGroupBackReference(t);break;case"Quantifier":this.visitQuantifier(t);break}this.visitChildren(t)}visitPattern(t){}visitFlags(t){}visitDisjunction(t){}visitAlternative(t){}visitStartAnchor(t){}visitEndAnchor(t){}visitWordBoundary(t){}visitNonWordBoundary(t){}visitLookahead(t){}visitNegativeLookahead(t){}visitLookbehind(t){}visitNegativeLookbehind(t){}visitCharacter(t){}visitSet(t){}visitGroup(t){}visitGroupBackReference(t){}visitQuantifier(t){}};var rw=/\r?\n/gm,vL=new Qr,dh=class extends hn{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(t){this.multiline=!1,this.regex=t,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(t){t.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(t){let n=String.fromCharCode(t.value);if(!this.multiline&&n===`
11
11
  `&&(this.multiline=!0),t.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let r=ei(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(t){if(!this.multiline){let n=this.regex.substring(t.loc.begin,t.loc.end),r=new RegExp(n);this.multiline=!!`
12
- `.match(r)}if(t.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let n=this.regex.substring(t.loc.begin,t.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(t){t.type==="Group"&&t.quantifier||super.visitChildren(t)}},ch=new uh;function nw(e){try{return typeof e=="string"&&(e=new RegExp(e)),e=e.toString(),ch.reset(e),ch.visit(wL.pattern(e)),ch.multiline}catch{return!1}}var TL=`\f
13
- \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function vc(e){let t=typeof e=="string"?new RegExp(e):e;return TL.some(n=>t.test(n))}function ei(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rw(e,t){let n=vL(e),r=t.match(n);return!!r&&r[0].length>0}function vL(e){typeof e=="string"&&(e=new RegExp(e));let t=e,n=e.source,r=0;function i(){let o="",s;function a(c){o+=n.substr(r,c),r+=c}function l(c){o+="(?:"+n.substr(r,c)+"|$)",r+=c}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":l(3);break;case"x":l(4);break;case"u":t.unicode?n[r+2]==="{"?l(n.indexOf("}",r)-r+1):l(6):l(2);break;case"p":case"P":t.unicode?l(n.indexOf("}",r)-r+1):l(2);break;case"k":l(n.indexOf(">",r)-r+1);break;default:l(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=r,s=s.exec(n)||[],l(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=r,s=s.exec(n),s?a(s[0].length):l(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":o+="(?:",r+=3,o+=i()+"|$)";break;case"=":o+="(?=",r+=3,o+=i()+")";break;case"!":s=r,r+=3,i(),o+=n.substr(s,r-s);break;case"<":switch(n[r+3]){case"=":case"!":s=r,r+=4,i(),o+=n.substr(s,r-s);break;default:a(n.indexOf(">",r)-r+1),o+=i()+"|$)";break}break}else a(1),o+=i()+"|$)";break;case")":return++r,o;default:l(1);break}return o}return new RegExp(i(),e.flags)}function iw(e){return e.rules.find(t=>at(t)&&t.entry)}function ow(e){return e.rules.filter(t=>Et(t)&&t.hidden)}function na(e,t){let n=new Set,r=iw(e);if(!r)return new Set(e.rules);let i=[r].concat(ow(e));for(let s of i)sw(s,n,t);let o=new Set;for(let s of e.rules)(n.has(s.name)||Et(s)&&s.hidden)&&o.add(s);return o}function sw(e,t,n){t.add(e.name),cn(e).forEach(r=>{if(pn(r)||n&&ih(r)){let i=r.rule.ref;i&&!t.has(i.name)&&sw(i,t,n)}})}function _L(e){let t=new Set;return cn(e).forEach(n=>{dn(n)&&(at(n.type.ref)&&t.add(n.type.ref),Ec(n.type.ref)&&at(n.type.ref.$container)&&t.add(n.type.ref.$container))}),t}function ph(e){if(e.terminal)return e.terminal;if(e.type.ref)return _c(e.type.ref)?.terminal}function hh(e){return e.hidden&&!vc(no(e))}function mh(e,t){return!e||!t?[]:gh(e,t,e.astNode,!0)}function ra(e,t,n){if(!e||!t)return;let r=gh(e,t,e.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function gh(e,t,n,r){if(!r){let i=Hi(e.grammarSource,fn);if(i&&i.feature===t)return[e]}return nr(e)&&e.astNode===n?e.content.flatMap(i=>gh(i,t,n,!1)):[]}function AL(e,t){return e?xh(e,t,e?.astNode):[]}function yh(e,t,n){if(!e)return;let r=xh(e,t,e?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function xh(e,t,n){if(e.astNode!==n)return[];if(Yt(e.grammarSource)&&e.grammarSource.value===t)return[e];let r=qs(e).iterator(),i,o=[];do if(i=r.next(),!i.done){let s=i.value;s.astNode===n?Yt(s.grammarSource)&&s.grammarSource.value===t&&o.push(s):r.prune()}while(!i.done);return o}function Eh(e){let t=e.astNode;for(;t===e.container?.astNode;){let n=Hi(e.grammarSource,fn);if(n)return n;e=e.container}}function _c(e){let t=e;return Ec(t)&&(sr(t.$container)?t=t.$container.$container:or(t.$container)?t=t.$container:ar(t.$container)),aw(e,t,new Map)}function aw(e,t,n){function r(i,o){let s;return Hi(i,fn)||(s=aw(o,o,n)),n.set(e,s),s}if(n.has(e))return n.get(e);n.set(e,void 0);for(let i of cn(t)){if(fn(i)&&i.feature.toLowerCase()==="name")return n.set(e,i),i;if(pn(i)&&at(i.rule.ref))return r(i,i.rule.ref);if(rh(i)&&i.typeRef?.ref)return r(i,i.typeRef.ref)}}function lw(e){let t=e.$container;if(qr(t)){let n=t.elements,r=n.indexOf(e);for(let i=r-1;i>=0;i--){let o=n[i];if(sr(o))return o;{let s=cn(n[i]).find(sr);if(s)return s}}}if(xc(t))return lw(t)}function kL(e,t){return e==="?"||e==="*"||qr(t)&&!!t.guardCondition}function IL(e){return e==="*"||e==="+"}function RL(e){return e==="+="}function ia(e){return cw(e,new Set)}function cw(e,t){if(t.has(e))return!0;t.add(e);for(let n of cn(e))if(pn(n)){if(!n.rule.ref||at(n.rule.ref)&&!cw(n.rule.ref,t)||Zr(n.rule.ref))return!1}else{if(fn(n))return!1;if(sr(n))return!1}return!!e.definition}function SL(e){return dh(e.type,new Set)}function dh(e,t){if(t.has(e))return!0;if(t.add(e),LE(e))return!1;if(XE(e))return!1;if(jE(e))return e.types.every(n=>dh(n,t));if(rh(e)){if(e.primitiveType!==void 0)return!0;if(e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let n=e.typeRef.ref;return oh(n)?dh(n.type,t):!1}else return!1}else return!1}function Ac(e){if(!Et(e)){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t)return t.name}}}function lr(e){if(or(e))return at(e)&&ia(e)?e.name:Ac(e)??e.name;if(ME(e)||oh(e)||GE(e))return e.name;if(sr(e)){let t=uw(e);if(t)return t}else if(Ec(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function uw(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return lr(e.type.ref)}function bL(e){return Et(e)?e.type?.name??"string":at(e)&&ia(e)?e.name:Ac(e)??e.name}function wh(e){return Et(e)?e.type?.name??"string":Ac(e)??e.name}function no(e){let t={s:!1,i:!1,u:!1},n=ro(e.definition,t),r=Object.entries(t).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}var Th=/[\s\S]/.source;function ro(e,t){if(HE(e))return NL(e);if(zE(e))return LL(e);if(OE(e))return CL(e);if(ih(e)){let n=e.rule.ref;if(!n)throw new Error("Missing rule reference.");return _n(ro(n.definition),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}else{if(FE(e))return OL(e);if(YE(e))return PL(e);if(UE(e)){let n=e.regex.lastIndexOf("/"),r=e.regex.substring(1,n),i=e.regex.substring(n+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),_n(r,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}else{if(VE(e))return _n(Th,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized});throw new Error(`Invalid terminal element: ${e?.$type}, ${e?.$cstNode?.text}`)}}}function NL(e){return _n(e.elements.map(t=>ro(t)).join("|"),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function LL(e){return _n(e.elements.map(t=>ro(t)).join(""),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function PL(e){return _n(`${Th}*?${ro(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function OL(e){return _n(`(?!${ro(e.terminal)})${Th}*?`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function CL(e){return e.right?_n(`[${fh(e.left)}-${fh(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1}):_n(fh(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function fh(e){return ei(e.value)}function _n(e,t){return(t.parenthesized||t.lookahead||t.wrap!==!1)&&(e=`(${t.lookahead??(t.parenthesized?"":"?:")}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function fw(e){let t=[],n=e.Grammar;for(let r of n.rules)Et(r)&&hh(r)&&nw(no(r))&&t.push(r.name);return{multilineCommentRules:t,nameRegexp:QE}}function io(e){console&&console.error&&console.error(`Error: ${e}`)}function oa(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function sa(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function aa(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e;(0,eval)(e)}function $L(e){return DL(e)?e.LABEL:e.name}function DL(e){return typeof e.LABEL=="string"&&e.LABEL!==""}var Nt=class{get definition(){return this._definition}set definition(t){this._definition=t}constructor(t){this._definition=t}accept(t){t.visit(this),this.definition.forEach(n=>{n.accept(t)})}},Ee=class extends Nt{constructor(t){super([]),this.idx=1,Object.assign(this,mn(t))}set definition(t){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(t){t.visit(this)}},lt=class extends Nt{constructor(t){super(t.definition),this.orgText="",Object.assign(this,mn(t))}},be=class extends Nt{constructor(t){super(t.definition),this.ignoreAmbiguities=!1,Object.assign(this,mn(t))}},we=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},Ne=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},Le=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},ge=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},ke=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},Ie=class extends Nt{get definition(){return this._definition}set definition(t){this._definition=t}constructor(t){super(t.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,mn(t))}},ue=class{constructor(t){this.idx=1,Object.assign(this,mn(t))}accept(t){t.visit(this)}};function Ic(e){return e.map(oo)}function oo(e){function t(n){return n.map(oo)}if(e instanceof Ee){let n={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return typeof e.label=="string"&&(n.label=e.label),n}else{if(e instanceof be)return{type:"Alternative",definition:t(e.definition)};if(e instanceof we)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof Ne)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof Le)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:oo(new ue({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof ke)return{type:"RepetitionWithSeparator",idx:e.idx,separator:oo(new ue({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof ge)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof Ie)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof ue){let n={type:"Terminal",name:e.terminalType.name,label:$L(e.terminalType),idx:e.idx};typeof e.label=="string"&&(n.terminalLabel=e.label);let r=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(n.pattern=r instanceof RegExp?r.source:r),n}else{if(e instanceof lt)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}}}function mn(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}var ct=class{visit(t){let n=t;switch(n.constructor){case Ee:return this.visitNonTerminal(n);case be:return this.visitAlternative(n);case we:return this.visitOption(n);case Ne:return this.visitRepetitionMandatory(n);case Le:return this.visitRepetitionMandatoryWithSeparator(n);case ke:return this.visitRepetitionWithSeparator(n);case ge:return this.visitRepetition(n);case Ie:return this.visitAlternation(n);case ue:return this.visitTerminal(n);case lt:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(t){}visitAlternative(t){}visitOption(t){}visitRepetition(t){}visitRepetitionMandatory(t){}visitRepetitionMandatoryWithSeparator(t){}visitRepetitionWithSeparator(t){}visitAlternation(t){}visitTerminal(t){}visitRule(t){}};function vh(e){return e instanceof be||e instanceof we||e instanceof ge||e instanceof Ne||e instanceof Le||e instanceof ke||e instanceof ue||e instanceof lt}function ti(e,t=[]){return e instanceof we||e instanceof ge||e instanceof ke?!0:e instanceof Ie?e.definition.some(r=>ti(r,t)):e instanceof Ee&&t.includes(e)?!1:e instanceof Nt?(e instanceof Ee&&t.push(e),e.definition.every(r=>ti(r,t))):!1}function _h(e){return e instanceof Ie}function wt(e){if(e instanceof Ee)return"SUBRULE";if(e instanceof we)return"OPTION";if(e instanceof Ie)return"OR";if(e instanceof Ne)return"AT_LEAST_ONE";if(e instanceof Le)return"AT_LEAST_ONE_SEP";if(e instanceof ke)return"MANY_SEP";if(e instanceof ge)return"MANY";if(e instanceof ue)return"CONSUME";throw Error("non exhaustive match")}var An=class{walk(t,n=[]){t.definition.forEach((r,i)=>{let o=t.definition.slice(i+1);if(r instanceof Ee)this.walkProdRef(r,o,n);else if(r instanceof ue)this.walkTerminal(r,o,n);else if(r instanceof be)this.walkFlat(r,o,n);else if(r instanceof we)this.walkOption(r,o,n);else if(r instanceof Ne)this.walkAtLeastOne(r,o,n);else if(r instanceof Le)this.walkAtLeastOneSep(r,o,n);else if(r instanceof ke)this.walkManySep(r,o,n);else if(r instanceof ge)this.walkMany(r,o,n);else if(r instanceof Ie)this.walkOr(r,o,n);else throw Error("non exhaustive match")})}walkTerminal(t,n,r){}walkProdRef(t,n,r){}walkFlat(t,n,r){let i=n.concat(r);this.walk(t,i)}walkOption(t,n,r){let i=n.concat(r);this.walk(t,i)}walkAtLeastOne(t,n,r){let i=[new we({definition:t.definition})].concat(n,r);this.walk(t,i)}walkAtLeastOneSep(t,n,r){let i=dw(t,n,r);this.walk(t,i)}walkMany(t,n,r){let i=[new we({definition:t.definition})].concat(n,r);this.walk(t,i)}walkManySep(t,n,r){let i=dw(t,n,r);this.walk(t,i)}walkOr(t,n,r){let i=n.concat(r);t.definition.forEach(o=>{let s=new be({definition:[o]});this.walk(s,i)})}};function dw(e,t,n){return[new we({definition:[new ue({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function ni(e){if(e instanceof Ee)return ni(e.referencedRule);if(e instanceof ue)return BL(e);if(vh(e))return ML(e);if(_h(e))return FL(e);throw Error("non exhaustive match")}function ML(e){let t=[],n=e.definition,r=0,i=n.length>r,o,s=!0;for(;i&&s;)o=n[r],s=ti(o),t=t.concat(ni(o)),r=r+1,i=n.length>r;return[...new Set(t)]}function FL(e){let t=e.definition.map(n=>ni(n));return[...new Set(t.flat())]}function BL(e){return[e.terminalType]}var Rc="_~IN~_";var Ah=class extends An{constructor(t){super(),this.topProd=t,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(t,n,r){}walkProdRef(t,n,r){let i=WL(t.referencedRule,t.idx)+this.topProd.name,o=n.concat(r),s=new be({definition:o}),a=ni(s);this.follows[i]=a}};function pw(e){let t={};return e.forEach(n=>{let r=new Ah(n).startWalking();Object.assign(t,r)}),t}function WL(e,t){return e.name+t+Rc}var Sc={},XL=new Qr;function ri(e){let t=e.toString();if(Sc.hasOwnProperty(t))return Sc[t];{let n=XL.pattern(t);return Sc[t]=n,n}}function hw(){Sc={}}var gw="Complement Sets are not supported for first char optimization",la=`Unable to use "first char" lexer optimizations:
14
- `;function yw(e,t=!1){try{let n=ri(e);return kh(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===gw)t&&oa(`${la} Unable to optimize: < ${e.toString()} >
12
+ `.match(r)}if(t.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let n=this.regex.substring(t.loc.begin,t.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(t){t.type==="Group"&&t.quantifier||super.visitChildren(t)}},fh=new dh;function iw(e){try{return typeof e=="string"&&(e=new RegExp(e)),e=e.toString(),fh.reset(e),fh.visit(vL.pattern(e)),fh.multiline}catch{return!1}}var _L=`\f
13
+ \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function Ac(e){let t=typeof e=="string"?new RegExp(e):e;return _L.some(n=>t.test(n))}function ei(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ow(e,t){let n=AL(e),r=t.match(n);return!!r&&r[0].length>0}function AL(e){typeof e=="string"&&(e=new RegExp(e));let t=e,n=e.source,r=0;function i(){let o="",s;function a(c){o+=n.substr(r,c),r+=c}function l(c){o+="(?:"+n.substr(r,c)+"|$)",r+=c}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":l(3);break;case"x":l(4);break;case"u":t.unicode?n[r+2]==="{"?l(n.indexOf("}",r)-r+1):l(6):l(2);break;case"p":case"P":t.unicode?l(n.indexOf("}",r)-r+1):l(2);break;case"k":l(n.indexOf(">",r)-r+1);break;default:l(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=r,s=s.exec(n)||[],l(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=r,s=s.exec(n),s?a(s[0].length):l(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":o+="(?:",r+=3,o+=i()+"|$)";break;case"=":o+="(?=",r+=3,o+=i()+")";break;case"!":s=r,r+=3,i(),o+=n.substr(s,r-s);break;case"<":switch(n[r+3]){case"=":case"!":s=r,r+=4,i(),o+=n.substr(s,r-s);break;default:a(n.indexOf(">",r)-r+1),o+=i()+"|$)";break}break}else a(1),o+=i()+"|$)";break;case")":return++r,o;default:l(1);break}return o}return new RegExp(i(),e.flags)}function sw(e){return e.rules.find(t=>at(t)&&t.entry)}function aw(e){return e.rules.filter(t=>Et(t)&&t.hidden)}function ra(e,t){let n=new Set,r=sw(e);if(!r)return new Set(e.rules);let i=[r].concat(aw(e));for(let s of i)lw(s,n,t);let o=new Set;for(let s of e.rules)(n.has(s.name)||Et(s)&&s.hidden)&&o.add(s);return o}function lw(e,t,n){t.add(e.name),cn(e).forEach(r=>{if(pn(r)||n&&sh(r)){let i=r.rule.ref;i&&!t.has(i.name)&&lw(i,t,n)}})}function kL(e){let t=new Set;return cn(e).forEach(n=>{dn(n)&&(at(n.type.ref)&&t.add(n.type.ref),Tc(n.type.ref)&&at(n.type.ref.$container)&&t.add(n.type.ref.$container))}),t}function mh(e){if(e.terminal)return e.terminal;if(e.type.ref)return kc(e.type.ref)?.terminal}function gh(e){return e.hidden&&!Ac(ro(e))}function yh(e,t){return!e||!t?[]:xh(e,t,e.astNode,!0)}function ia(e,t,n){if(!e||!t)return;let r=xh(e,t,e.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function xh(e,t,n,r){if(!r){let i=zi(e.grammarSource,fn);if(i&&i.feature===t)return[e]}return nr(e)&&e.astNode===n?e.content.flatMap(i=>xh(i,t,n,!1)):[]}function IL(e,t){return e?wh(e,t,e?.astNode):[]}function Eh(e,t,n){if(!e)return;let r=wh(e,t,e?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function wh(e,t,n){if(e.astNode!==n)return[];if(Yt(e.grammarSource)&&e.grammarSource.value===t)return[e];let r=Zs(e).iterator(),i,o=[];do if(i=r.next(),!i.done){let s=i.value;s.astNode===n?Yt(s.grammarSource)&&s.grammarSource.value===t&&o.push(s):r.prune()}while(!i.done);return o}function Th(e){let t=e.astNode;for(;t===e.container?.astNode;){let n=zi(e.grammarSource,fn);if(n)return n;e=e.container}}function kc(e){let t=e;return Tc(t)&&(sr(t.$container)?t=t.$container.$container:or(t.$container)?t=t.$container:ar(t.$container)),cw(e,t,new Map)}function cw(e,t,n){function r(i,o){let s;return zi(i,fn)||(s=cw(o,o,n)),n.set(e,s),s}if(n.has(e))return n.get(e);n.set(e,void 0);for(let i of cn(t)){if(fn(i)&&i.feature.toLowerCase()==="name")return n.set(e,i),i;if(pn(i)&&at(i.rule.ref))return r(i,i.rule.ref);if(oh(i)&&i.typeRef?.ref)return r(i,i.typeRef.ref)}}function uw(e){let t=e.$container;if(qr(t)){let n=t.elements,r=n.indexOf(e);for(let i=r-1;i>=0;i--){let o=n[i];if(sr(o))return o;{let s=cn(n[i]).find(sr);if(s)return s}}}if(wc(t))return uw(t)}function RL(e,t){return e==="?"||e==="*"||qr(t)&&!!t.guardCondition}function SL(e){return e==="*"||e==="+"}function bL(e){return e==="+="}function oa(e){return fw(e,new Set)}function fw(e,t){if(t.has(e))return!0;t.add(e);for(let n of cn(e))if(pn(n)){if(!n.rule.ref||at(n.rule.ref)&&!fw(n.rule.ref,t)||Zr(n.rule.ref))return!1}else{if(fn(n))return!1;if(sr(n))return!1}return!!e.definition}function NL(e){return hh(e.type,new Set)}function hh(e,t){if(t.has(e))return!0;if(t.add(e),OE(e))return!1;if(GE(e))return!1;if(VE(e))return e.types.every(n=>hh(n,t));if(oh(e)){if(e.primitiveType!==void 0)return!0;if(e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let n=e.typeRef.ref;return ah(n)?hh(n.type,t):!1}else return!1}else return!1}function Ic(e){if(!Et(e)){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t)return t.name}}}function lr(e){if(or(e))return at(e)&&oa(e)?e.name:Ic(e)??e.name;if(BE(e)||ah(e)||zE(e))return e.name;if(sr(e)){let t=dw(e);if(t)return t}else if(Tc(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function dw(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return lr(e.type.ref)}function LL(e){return Et(e)?e.type?.name??"string":at(e)&&oa(e)?e.name:Ic(e)??e.name}function vh(e){return Et(e)?e.type?.name??"string":Ic(e)??e.name}function ro(e){let t={s:!1,i:!1,u:!1},n=io(e.definition,t),r=Object.entries(t).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}var _h=/[\s\S]/.source;function io(e,t){if(jE(e))return PL(e);if(YE(e))return OL(e);if($E(e))return DL(e);if(sh(e)){let n=e.rule.ref;if(!n)throw new Error("Missing rule reference.");return _n(io(n.definition),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}else{if(WE(e))return $L(e);if(KE(e))return CL(e);if(HE(e)){let n=e.regex.lastIndexOf("/"),r=e.regex.substring(1,n),i=e.regex.substring(n+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),_n(r,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}else{if(qE(e))return _n(_h,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized});throw new Error(`Invalid terminal element: ${e?.$type}, ${e?.$cstNode?.text}`)}}}function PL(e){return _n(e.elements.map(t=>io(t)).join("|"),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function OL(e){return _n(e.elements.map(t=>io(t)).join(""),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function CL(e){return _n(`${_h}*?${io(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function $L(e){return _n(`(?!${io(e.terminal)})${_h}*?`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function DL(e){return e.right?_n(`[${ph(e.left)}-${ph(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1}):_n(ph(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function ph(e){return ei(e.value)}function _n(e,t){return(t.parenthesized||t.lookahead||t.wrap!==!1)&&(e=`(${t.lookahead??(t.parenthesized?"":"?:")}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function pw(e){let t=[],n=e.Grammar;for(let r of n.rules)Et(r)&&gh(r)&&iw(ro(r))&&t.push(r.name);return{multilineCommentRules:t,nameRegexp:tw}}function oo(e){console&&console.error&&console.error(`Error: ${e}`)}function sa(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function aa(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function la(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e;(0,eval)(e)}function ML(e){return FL(e)?e.LABEL:e.name}function FL(e){return typeof e.LABEL=="string"&&e.LABEL!==""}var Nt=class{get definition(){return this._definition}set definition(t){this._definition=t}constructor(t){this._definition=t}accept(t){t.visit(this),this.definition.forEach(n=>{n.accept(t)})}},Ee=class extends Nt{constructor(t){super([]),this.idx=1,Object.assign(this,mn(t))}set definition(t){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(t){t.visit(this)}},lt=class extends Nt{constructor(t){super(t.definition),this.orgText="",Object.assign(this,mn(t))}},be=class extends Nt{constructor(t){super(t.definition),this.ignoreAmbiguities=!1,Object.assign(this,mn(t))}},we=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},Ne=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},Le=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},ge=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},ke=class extends Nt{constructor(t){super(t.definition),this.idx=1,Object.assign(this,mn(t))}},Ie=class extends Nt{get definition(){return this._definition}set definition(t){this._definition=t}constructor(t){super(t.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,mn(t))}},ue=class{constructor(t){this.idx=1,Object.assign(this,mn(t))}accept(t){t.visit(this)}};function Sc(e){return e.map(so)}function so(e){function t(n){return n.map(so)}if(e instanceof Ee){let n={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return typeof e.label=="string"&&(n.label=e.label),n}else{if(e instanceof be)return{type:"Alternative",definition:t(e.definition)};if(e instanceof we)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof Ne)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof Le)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:so(new ue({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof ke)return{type:"RepetitionWithSeparator",idx:e.idx,separator:so(new ue({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof ge)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof Ie)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof ue){let n={type:"Terminal",name:e.terminalType.name,label:ML(e.terminalType),idx:e.idx};typeof e.label=="string"&&(n.terminalLabel=e.label);let r=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(n.pattern=r instanceof RegExp?r.source:r),n}else{if(e instanceof lt)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}}}function mn(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}var ct=class{visit(t){let n=t;switch(n.constructor){case Ee:return this.visitNonTerminal(n);case be:return this.visitAlternative(n);case we:return this.visitOption(n);case Ne:return this.visitRepetitionMandatory(n);case Le:return this.visitRepetitionMandatoryWithSeparator(n);case ke:return this.visitRepetitionWithSeparator(n);case ge:return this.visitRepetition(n);case Ie:return this.visitAlternation(n);case ue:return this.visitTerminal(n);case lt:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(t){}visitAlternative(t){}visitOption(t){}visitRepetition(t){}visitRepetitionMandatory(t){}visitRepetitionMandatoryWithSeparator(t){}visitRepetitionWithSeparator(t){}visitAlternation(t){}visitTerminal(t){}visitRule(t){}};function Ah(e){return e instanceof be||e instanceof we||e instanceof ge||e instanceof Ne||e instanceof Le||e instanceof ke||e instanceof ue||e instanceof lt}function ti(e,t=[]){return e instanceof we||e instanceof ge||e instanceof ke?!0:e instanceof Ie?e.definition.some(r=>ti(r,t)):e instanceof Ee&&t.includes(e)?!1:e instanceof Nt?(e instanceof Ee&&t.push(e),e.definition.every(r=>ti(r,t))):!1}function kh(e){return e instanceof Ie}function wt(e){if(e instanceof Ee)return"SUBRULE";if(e instanceof we)return"OPTION";if(e instanceof Ie)return"OR";if(e instanceof Ne)return"AT_LEAST_ONE";if(e instanceof Le)return"AT_LEAST_ONE_SEP";if(e instanceof ke)return"MANY_SEP";if(e instanceof ge)return"MANY";if(e instanceof ue)return"CONSUME";throw Error("non exhaustive match")}var An=class{walk(t,n=[]){t.definition.forEach((r,i)=>{let o=t.definition.slice(i+1);if(r instanceof Ee)this.walkProdRef(r,o,n);else if(r instanceof ue)this.walkTerminal(r,o,n);else if(r instanceof be)this.walkFlat(r,o,n);else if(r instanceof we)this.walkOption(r,o,n);else if(r instanceof Ne)this.walkAtLeastOne(r,o,n);else if(r instanceof Le)this.walkAtLeastOneSep(r,o,n);else if(r instanceof ke)this.walkManySep(r,o,n);else if(r instanceof ge)this.walkMany(r,o,n);else if(r instanceof Ie)this.walkOr(r,o,n);else throw Error("non exhaustive match")})}walkTerminal(t,n,r){}walkProdRef(t,n,r){}walkFlat(t,n,r){let i=n.concat(r);this.walk(t,i)}walkOption(t,n,r){let i=n.concat(r);this.walk(t,i)}walkAtLeastOne(t,n,r){let i=[new we({definition:t.definition})].concat(n,r);this.walk(t,i)}walkAtLeastOneSep(t,n,r){let i=hw(t,n,r);this.walk(t,i)}walkMany(t,n,r){let i=[new we({definition:t.definition})].concat(n,r);this.walk(t,i)}walkManySep(t,n,r){let i=hw(t,n,r);this.walk(t,i)}walkOr(t,n,r){let i=n.concat(r);t.definition.forEach(o=>{let s=new be({definition:[o]});this.walk(s,i)})}};function hw(e,t,n){return[new we({definition:[new ue({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function ni(e){if(e instanceof Ee)return ni(e.referencedRule);if(e instanceof ue)return XL(e);if(Ah(e))return BL(e);if(kh(e))return WL(e);throw Error("non exhaustive match")}function BL(e){let t=[],n=e.definition,r=0,i=n.length>r,o,s=!0;for(;i&&s;)o=n[r],s=ti(o),t=t.concat(ni(o)),r=r+1,i=n.length>r;return[...new Set(t)]}function WL(e){let t=e.definition.map(n=>ni(n));return[...new Set(t.flat())]}function XL(e){return[e.terminalType]}var bc="_~IN~_";var Ih=class extends An{constructor(t){super(),this.topProd=t,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(t,n,r){}walkProdRef(t,n,r){let i=UL(t.referencedRule,t.idx)+this.topProd.name,o=n.concat(r),s=new be({definition:o}),a=ni(s);this.follows[i]=a}};function mw(e){let t={};return e.forEach(n=>{let r=new Ih(n).startWalking();Object.assign(t,r)}),t}function UL(e,t){return e.name+t+bc}var Nc={},GL=new Qr;function ri(e){let t=e.toString();if(Nc.hasOwnProperty(t))return Nc[t];{let n=GL.pattern(t);return Nc[t]=n,n}}function gw(){Nc={}}var xw="Complement Sets are not supported for first char optimization",ca=`Unable to use "first char" lexer optimizations:
14
+ `;function Ew(e,t=!1){try{let n=ri(e);return Rh(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===xw)t&&sa(`${ca} Unable to optimize: < ${e.toString()} >
15
15
  Complement Sets cannot be automatically optimized.
16
16
  This will disable the lexer's first char optimizations.
17
17
  See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";t&&(r=`
18
18
  This will disable the lexer's first char optimizations.
19
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),io(`${la}
19
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),oo(`${ca}
20
20
  Failed parsing: < ${e.toString()} >
21
21
  Using the @chevrotain/regexp-to-ast library
22
- Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function kh(e,t,n){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)kh(e.value[i],t,n);break;case"Alternative":let r=e.value;for(let i=0;i<r.length;i++){let o=r[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let s=o;switch(s.type){case"Character":bc(s.value,t,n);break;case"Set":if(s.complement===!0)throw Error(gw);s.value.forEach(l=>{if(typeof l=="number")bc(l,t,n);else{let c=l;if(n===!0)for(let u=c.from;u<=c.to;u++)bc(u,t,n);else{for(let u=c.from;u<=c.to&&u<so;u++)bc(u,t,n);if(c.to>=so){let u=c.from>=so?c.from:so,f=c.to,d=gn(u),p=gn(f);for(let m=d;m<=p;m++)t[m]=m}}}});break;case"Group":kh(s.value,t,n);break;default:throw Error("Non Exhaustive Match")}let a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Ih(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Object.values(t)}function bc(e,t,n){let r=gn(e);t[r]=r,n===!0&&UL(e,t)}function UL(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let i=gn(r.charCodeAt(0));t[i]=i}else{let i=n.toLowerCase();if(i!==n){let o=gn(i.charCodeAt(0));t[o]=o}}}function mw(e,t){return e.value.find(n=>{if(typeof n=="number")return t.includes(n);{let r=n;return t.find(i=>r.from<=i&&i<=r.to)!==void 0}})}function Ih(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?Array.isArray(e.value)?e.value.every(Ih):Ih(e.value):!1}var Rh=class extends hn{constructor(t){super(),this.targetCharCodes=t,this.found=!1}visitChildren(t){if(this.found!==!0){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return;case"Lookbehind":this.visitLookbehind(t);return;case"NegativeLookbehind":this.visitNegativeLookbehind(t);return}super.visitChildren(t)}}visitCharacter(t){this.targetCharCodes.includes(t.value)&&(this.found=!0)}visitSet(t){t.complement?mw(t,this.targetCharCodes)===void 0&&(this.found=!0):mw(t,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Nc(e,t){if(t instanceof RegExp){let n=ri(t),r=new Rh(e);return r.visit(n),r.found}else{for(let n of t){let r=n.charCodeAt(0);if(e.includes(r))return!0}return!1}}var ii="PATTERN",ao="defaultMode",Lc="modes",Oc=0,ca=1,Cc=2,$c=3;function Ew(e,t){t=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
23
- `],tracer:(y,E)=>E()},t);let n=t.tracer;n("initCharCodeToOptimizedIndexMap",()=>{lP()});let r;n("Reject Lexer.NA",()=>{r=e.filter(y=>y[ii]!==Me.NA)});let i=!1,o;n("Transform Patterns",()=>{i=!1,o=r.map(y=>{let E=y[ii];if(E instanceof RegExp){let _=E.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!E.ignoreCase?_:_.length===2&&_[0]==="\\"&&!["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(_[1])?_[1]:xw(E)}else{if(typeof E=="function")return i=!0,{exec:E};if(typeof E=="object")return i=!0,E;if(typeof E=="string"){if(E.length===1)return E;{let _=E.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),T=new RegExp(_);return xw(T)}}else throw Error("non exhaustive match")}})});let s,a,l,c,u;n("misc mapping",()=>{s=r.map(y=>y.tokenTypeIdx),a=r.map(y=>{let E=y.GROUP;if(E!==Me.SKIPPED){if(typeof E=="string")return E;if(E===void 0)return!1;throw Error("non exhaustive match")}}),l=r.map(y=>{let E=y.LONGER_ALT;if(E)return Array.isArray(E)?E.map(T=>r.indexOf(T)):[r.indexOf(E)]}),c=r.map(y=>y.PUSH_MODE),u=r.map(y=>Object.hasOwn(y,"POP_MODE"))});let f;n("Line Terminator Handling",()=>{let y=Iw(t.lineTerminatorCharacters);f=r.map(E=>!1),t.positionTracking!=="onlyOffset"&&(f=r.map(E=>Object.hasOwn(E,"LINE_BREAKS")?!!E.LINE_BREAKS:kw(E,y)===!1&&Nc(y,E.PATTERN)))});let d,p,m,g;n("Misc Mapping #2",()=>{d=r.map(_w),p=o.map(sP),m=r.reduce((y,E)=>{let _=E.GROUP;return typeof _=="string"&&_!==Me.SKIPPED&&(y[_]=[]),y},{}),g=o.map((y,E)=>{let _=a[E]===void 0&&l[E]===void 0?GL(r[E].PATTERN):void 0;return{pattern:o[E],asciiClass:_,longerAlt:l[E],canLineTerminator:f[E],matchType:_!==void 0?$c:p[E]!==!1?Oc:d[E]?ca:Cc,short:p[E],group:a[E],push:c[E],pop:u[E],tokenTypeIdx:s[E],tokenType:r[E]}})});let w=!0,x=[];return t.safeMode||n("First Char Optimization",()=>{x=r.reduce((y,E,_)=>{if(typeof E.PATTERN=="string"){let T=E.PATTERN.charCodeAt(0),I=gn(T);Sh(y,I,g[_])}else if(Array.isArray(E.START_CHARS_HINT)){let T;E.START_CHARS_HINT.forEach(I=>{let B=typeof I=="string"?I.charCodeAt(0):I,$=gn(B);T!==$&&(T=$,Sh(y,$,g[_]))})}else if(E.PATTERN instanceof RegExp)if(E.PATTERN.unicode)w=!1,t.ensureOptimizations&&io(`${la} Unable to analyze < ${E.PATTERN.toString()} > pattern.
22
+ Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Rh(e,t,n){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)Rh(e.value[i],t,n);break;case"Alternative":let r=e.value;for(let i=0;i<r.length;i++){let o=r[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let s=o;switch(s.type){case"Character":Lc(s.value,t,n);break;case"Set":if(s.complement===!0)throw Error(xw);s.value.forEach(l=>{if(typeof l=="number")Lc(l,t,n);else{let c=l;if(n===!0)for(let u=c.from;u<=c.to;u++)Lc(u,t,n);else{for(let u=c.from;u<=c.to&&u<ao;u++)Lc(u,t,n);if(c.to>=ao){let u=c.from>=ao?c.from:ao,f=c.to,d=gn(u),p=gn(f);for(let m=d;m<=p;m++)t[m]=m}}}});break;case"Group":Rh(s.value,t,n);break;default:throw Error("Non Exhaustive Match")}let a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Sh(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Object.values(t)}function Lc(e,t,n){let r=gn(e);t[r]=r,n===!0&&HL(e,t)}function HL(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let i=gn(r.charCodeAt(0));t[i]=i}else{let i=n.toLowerCase();if(i!==n){let o=gn(i.charCodeAt(0));t[o]=o}}}function yw(e,t){return e.value.find(n=>{if(typeof n=="number")return t.includes(n);{let r=n;return t.find(i=>r.from<=i&&i<=r.to)!==void 0}})}function Sh(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?Array.isArray(e.value)?e.value.every(Sh):Sh(e.value):!1}var bh=class extends hn{constructor(t){super(),this.targetCharCodes=t,this.found=!1}visitChildren(t){if(this.found!==!0){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return;case"Lookbehind":this.visitLookbehind(t);return;case"NegativeLookbehind":this.visitNegativeLookbehind(t);return}super.visitChildren(t)}}visitCharacter(t){this.targetCharCodes.includes(t.value)&&(this.found=!0)}visitSet(t){t.complement?yw(t,this.targetCharCodes)===void 0&&(this.found=!0):yw(t,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Pc(e,t){if(t instanceof RegExp){let n=ri(t),r=new bh(e);return r.visit(n),r.found}else{for(let n of t){let r=n.charCodeAt(0);if(e.includes(r))return!0}return!1}}var ii="PATTERN",lo="defaultMode",Oc="modes",$c=0,ua=1,Dc=2,Mc=3;function Tw(e,t){t=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
23
+ `],tracer:(y,w)=>w()},t);let n=t.tracer;n("initCharCodeToOptimizedIndexMap",()=>{uP()});let r;n("Reject Lexer.NA",()=>{r=e.filter(y=>y[ii]!==Me.NA)});let i=!1,o;n("Transform Patterns",()=>{i=!1,o=r.map(y=>{let w=y[ii];if(w instanceof RegExp){let _=w.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!w.ignoreCase?_:_.length===2&&_[0]==="\\"&&!["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(_[1])?_[1]:ww(w)}else{if(typeof w=="function")return i=!0,{exec:w};if(typeof w=="object")return i=!0,w;if(typeof w=="string"){if(w.length===1)return w;{let _=w.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),v=new RegExp(_);return ww(v)}}else throw Error("non exhaustive match")}})});let s,a,l,c,u;n("misc mapping",()=>{s=r.map(y=>y.tokenTypeIdx),a=r.map(y=>{let w=y.GROUP;if(w!==Me.SKIPPED){if(typeof w=="string")return w;if(w===void 0)return!1;throw Error("non exhaustive match")}}),l=r.map(y=>{let w=y.LONGER_ALT;if(w)return Array.isArray(w)?w.map(v=>r.indexOf(v)):[r.indexOf(w)]}),c=r.map(y=>y.PUSH_MODE),u=r.map(y=>Object.hasOwn(y,"POP_MODE"))});let f;n("Line Terminator Handling",()=>{let y=Sw(t.lineTerminatorCharacters);f=r.map(w=>!1),t.positionTracking!=="onlyOffset"&&(f=r.map(w=>Object.hasOwn(w,"LINE_BREAKS")?!!w.LINE_BREAKS:Rw(w,y)===!1&&Pc(y,w.PATTERN)))});let d,p,m,g;n("Misc Mapping #2",()=>{d=r.map(kw),p=o.map(lP),m=r.reduce((y,w)=>{let _=w.GROUP;return typeof _=="string"&&_!==Me.SKIPPED&&(y[_]=[]),y},{}),g=o.map((y,w)=>{let _=a[w]===void 0&&l[w]===void 0?zL(r[w].PATTERN):void 0;return{pattern:o[w],asciiClass:_,longerAlt:l[w],canLineTerminator:f[w],matchType:_!==void 0?Mc:p[w]!==!1?$c:d[w]?ua:Dc,short:p[w],group:a[w],push:c[w],pop:u[w],tokenTypeIdx:s[w],tokenType:r[w]}})});let E=!0,x=[];return t.safeMode||n("First Char Optimization",()=>{x=r.reduce((y,w,_)=>{if(typeof w.PATTERN=="string"){let v=w.PATTERN.charCodeAt(0),R=gn(v);Nh(y,R,g[_])}else if(Array.isArray(w.START_CHARS_HINT)){let v;w.START_CHARS_HINT.forEach(R=>{let B=typeof R=="string"?R.charCodeAt(0):R,C=gn(B);v!==C&&(v=C,Nh(y,C,g[_]))})}else if(w.PATTERN instanceof RegExp)if(w.PATTERN.unicode)E=!1,t.ensureOptimizations&&oo(`${ca} Unable to analyze < ${w.PATTERN.toString()} > pattern.
24
24
  The regexp unicode flag is not currently supported by the regexp-to-ast library.
25
25
  This will disable the lexer's first char optimizations.
26
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let T=yw(E.PATTERN,t.ensureOptimizations);T.length===0&&(w=!1),T.forEach(I=>{Sh(y,I,g[_])})}else t.ensureOptimizations&&io(`${la} TokenType: <${E.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
26
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let v=Ew(w.PATTERN,t.ensureOptimizations);v.length===0&&(E=!1),v.forEach(R=>{Nh(y,R,g[_])})}else t.ensureOptimizations&&oo(`${ca} TokenType: <${w.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
27
27
  This will disable the lexer's first char optimizations.
28
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),w=!1;return y},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:x,hasCustom:i,canBeOptimized:w}}function GL(e){var t,n;if(!(e instanceof RegExp)||e.flags!=="")return;let r;try{r=ri(e)}catch{return}if(r.value.value.length!==1||r.value.value[0].value.length!==1)return;let i=r.value.value[0].value[0],o;for(;i.type==="Group";){if(i.capturing||i.quantifier!==void 0&&o!==void 0||i.value.value.length!==1||i.value.value[0].value.length!==1)return;o=(t=i.quantifier)!==null&&t!==void 0?t:o,i=i.value.value[0].value[0]}if(i.type!=="Set"||i.complement||i.quantifier!==void 0&&o!==void 0||(o=(n=i.quantifier)!==null&&n!==void 0?n:o,o?.atLeast!==1||o.atMost!==1/0||!o.greedy))return;let s=new Uint8Array(128);for(let a of i.value){let l=typeof a=="number"?a:a.from,c=typeof a=="number"?a:a.to;if(l<0||c>=s.length)return;s.fill(1,l,c+1)}return s}function ww(e,t){let n=[],r=zL(e);n=n.concat(r.errors);let i=jL(r.valid),o=i.valid;return n=n.concat(i.errors),n=n.concat(HL(o)),n=n.concat(eP(o)),n=n.concat(tP(o,t)),n=n.concat(nP(o)),n}function HL(e){let t=[],n=e.filter(r=>r[ii]instanceof RegExp);return t=t.concat(VL(n)),t=t.concat(ZL(n)),t=t.concat(JL(n)),t=t.concat(QL(n)),t=t.concat(KL(n)),t}function zL(e){let t=e.filter(i=>!Object.hasOwn(i,ii)),n=t.map(i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:De.MISSING_PATTERN,tokenTypes:[i]})),r=e.filter(i=>!t.includes(i));return{errors:n,valid:r}}function jL(e){let t=e.filter(i=>{let o=i[ii];return!(o instanceof RegExp)&&typeof o!="function"&&!Object.hasOwn(o,"exec")&&typeof o!="string"}),n=t.map(i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:De.INVALID_PATTERN,tokenTypes:[i]})),r=e.filter(i=>!t.includes(i));return{errors:n,valid:r}}var YL=/[^\\][$]/;function VL(e){class t extends hn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}}return e.filter(i=>{let o=i.PATTERN;try{let s=ri(o),a=new t;return a.visit(s),a.found}catch{return YL.test(o.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
28
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),E=!1;return y},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:x,hasCustom:i,canBeOptimized:E}}function zL(e){var t,n;if(!(e instanceof RegExp)||e.flags!=="")return;let r;try{r=ri(e)}catch{return}if(r.value.value.length!==1||r.value.value[0].value.length!==1)return;let i=r.value.value[0].value[0],o;for(;i.type==="Group";){if(i.capturing||i.quantifier!==void 0&&o!==void 0||i.value.value.length!==1||i.value.value[0].value.length!==1)return;o=(t=i.quantifier)!==null&&t!==void 0?t:o,i=i.value.value[0].value[0]}if(i.type!=="Set"||i.complement||i.quantifier!==void 0&&o!==void 0||(o=(n=i.quantifier)!==null&&n!==void 0?n:o,o?.atLeast!==1||o.atMost!==1/0||!o.greedy))return;let s=new Uint8Array(128);for(let a of i.value){let l=typeof a=="number"?a:a.from,c=typeof a=="number"?a:a.to;if(l<0||c>=s.length)return;s.fill(1,l,c+1)}return s}function vw(e,t){let n=[],r=YL(e);n=n.concat(r.errors);let i=VL(r.valid),o=i.valid;return n=n.concat(i.errors),n=n.concat(jL(o)),n=n.concat(nP(o)),n=n.concat(rP(o,t)),n=n.concat(iP(o)),n}function jL(e){let t=[],n=e.filter(r=>r[ii]instanceof RegExp);return t=t.concat(qL(n)),t=t.concat(QL(n)),t=t.concat(eP(n)),t=t.concat(tP(n)),t=t.concat(ZL(n)),t}function YL(e){let t=e.filter(i=>!Object.hasOwn(i,ii)),n=t.map(i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:De.MISSING_PATTERN,tokenTypes:[i]})),r=e.filter(i=>!t.includes(i));return{errors:n,valid:r}}function VL(e){let t=e.filter(i=>{let o=i[ii];return!(o instanceof RegExp)&&typeof o!="function"&&!Object.hasOwn(o,"exec")&&typeof o!="string"}),n=t.map(i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:De.INVALID_PATTERN,tokenTypes:[i]})),r=e.filter(i=>!t.includes(i));return{errors:n,valid:r}}var KL=/[^\\][$]/;function qL(e){class t extends hn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(o){this.found=!0}}return e.filter(i=>{let o=i.PATTERN;try{let s=ri(o),a=new t;return a.visit(s),a.found}catch{return KL.test(o.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
29
29
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
30
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:De.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function KL(e){return e.filter(r=>r.PATTERN.test("")).map(r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:De.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}var qL=/[^\\[][\^]|^\^/;function ZL(e){class t extends hn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}return e.filter(i=>{let o=i.PATTERN;try{let s=ri(o),a=new t;return a.visit(s),a.found}catch{return qL.test(o.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
30
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:De.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function ZL(e){return e.filter(r=>r.PATTERN.test("")).map(r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:De.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}var JL=/[^\\[][\^]|^\^/;function QL(e){class t extends hn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}return e.filter(i=>{let o=i.PATTERN;try{let s=ri(o),a=new t;return a.visit(s),a.found}catch{return JL.test(o.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
31
31
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
32
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:De.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function JL(e){return e.filter(r=>{let i=r[ii];return i instanceof RegExp&&(i.multiline||i.global)}).map(r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:De.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function QL(e){let t=[],n=e.map(o=>e.reduce((s,a)=>(o.PATTERN.source===a.PATTERN.source&&!t.includes(a)&&a.PATTERN!==Me.NA&&(t.push(a),s.push(a)),s),[]));return n=n.filter(Boolean),n.filter(o=>o.length>1).map(o=>{let s=o.map(l=>l.name);return{message:`The same RegExp pattern ->${o[0].PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:De.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function eP(e){return e.filter(r=>{if(!Object.hasOwn(r,"GROUP"))return!1;let i=r.GROUP;return i!==Me.SKIPPED&&i!==Me.NA&&typeof i!="string"}).map(r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:De.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function tP(e,t){return e.filter(i=>i.PUSH_MODE!==void 0&&!t.includes(i.PUSH_MODE)).map(i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:De.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function nP(e){let t=[],n=e.reduce((r,i,o)=>{let s=i.PATTERN;return s===Me.NA||(typeof s=="string"?r.push({str:s,idx:o,tokenType:i}):s instanceof RegExp&&iP(s)&&r.push({str:s.source,idx:o,tokenType:i})),r},[]);return e.forEach((r,i)=>{n.forEach(({str:o,idx:s,tokenType:a})=>{if(i<s&&rP(o,r.PATTERN)){let l=`Token: ->${a.name}<- can never be matched.
32
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:De.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function eP(e){return e.filter(r=>{let i=r[ii];return i instanceof RegExp&&(i.multiline||i.global)}).map(r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:De.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function tP(e){let t=[],n=e.map(o=>e.reduce((s,a)=>(o.PATTERN.source===a.PATTERN.source&&!t.includes(a)&&a.PATTERN!==Me.NA&&(t.push(a),s.push(a)),s),[]));return n=n.filter(Boolean),n.filter(o=>o.length>1).map(o=>{let s=o.map(l=>l.name);return{message:`The same RegExp pattern ->${o[0].PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:De.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function nP(e){return e.filter(r=>{if(!Object.hasOwn(r,"GROUP"))return!1;let i=r.GROUP;return i!==Me.SKIPPED&&i!==Me.NA&&typeof i!="string"}).map(r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:De.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function rP(e,t){return e.filter(i=>i.PUSH_MODE!==void 0&&!t.includes(i.PUSH_MODE)).map(i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:De.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function iP(e){let t=[],n=e.reduce((r,i,o)=>{let s=i.PATTERN;return s===Me.NA||(typeof s=="string"?r.push({str:s,idx:o,tokenType:i}):s instanceof RegExp&&sP(s)&&r.push({str:s.source,idx:o,tokenType:i})),r},[]);return e.forEach((r,i)=>{n.forEach(({str:o,idx:s,tokenType:a})=>{if(i<s&&oP(o,r.PATTERN)){let l=`Token: ->${a.name}<- can never be matched.
33
33
  Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
34
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:l,type:De.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),t}function rP(e,t){if(t instanceof RegExp){if(oP(t))return!1;let n=t.exec(e);return n!==null&&n.index===0}else{if(typeof t=="function")return t(e,0,[],{});if(Object.hasOwn(t,"exec"))return t.exec(e,0,[],{});if(typeof t=="string")return t===e;throw Error("non exhaustive match")}}function iP(e){return[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(n=>e.source.indexOf(n)!==-1)===void 0}function oP(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source)}function xw(e){let t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function Tw(e,t,n){let r=[];return Object.hasOwn(e,ao)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+ao+`> property in its definition
35
- `,type:De.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,Lc)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Lc+`> property in its definition
36
- `,type:De.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,Lc)&&Object.hasOwn(e,ao)&&!Object.hasOwn(e.modes,e.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${ao}: <${e.defaultMode}>which does not exist
37
- `,type:De.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,Lc)&&Object.keys(e.modes).forEach(i=>{let o=e.modes[i];o.forEach((s,a)=>{s===void 0?r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${a}>
34
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:l,type:De.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),t}function oP(e,t){if(t instanceof RegExp){if(aP(t))return!1;let n=t.exec(e);return n!==null&&n.index===0}else{if(typeof t=="function")return t(e,0,[],{});if(Object.hasOwn(t,"exec"))return t.exec(e,0,[],{});if(typeof t=="string")return t===e;throw Error("non exhaustive match")}}function sP(e){return[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(n=>e.source.indexOf(n)!==-1)===void 0}function aP(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source)}function ww(e){let t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function _w(e,t,n){let r=[];return Object.hasOwn(e,lo)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+lo+`> property in its definition
35
+ `,type:De.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,Oc)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Oc+`> property in its definition
36
+ `,type:De.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,Oc)&&Object.hasOwn(e,lo)&&!Object.hasOwn(e.modes,e.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${lo}: <${e.defaultMode}>which does not exist
37
+ `,type:De.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,Oc)&&Object.keys(e.modes).forEach(i=>{let o=e.modes[i];o.forEach((s,a)=>{s===void 0?r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${a}>
38
38
  `,type:De.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(s,"LONGER_ALT")&&(Array.isArray(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT]).forEach(c=>{c!==void 0&&!o.includes(c)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${s.name}> outside of mode <${i}>
39
- `,type:De.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),r}function vw(e,t,n){let r=[],i=!1,s=Object.values(e.modes||{}).flat().filter(Boolean).filter(l=>l[ii]!==Me.NA),a=Iw(n);return t&&s.forEach(l=>{let c=kw(l,a);if(c!==!1){let f={message:aP(l,c),type:c.issue,tokenType:l};r.push(f)}else Object.hasOwn(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):Nc(a,l.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
39
+ `,type:De.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),r}function Aw(e,t,n){let r=[],i=!1,s=Object.values(e.modes||{}).flat().filter(Boolean).filter(l=>l[ii]!==Me.NA),a=Sw(n);return t&&s.forEach(l=>{let c=Rw(l,a);if(c!==!1){let f={message:cP(l,c),type:c.issue,tokenType:l};r.push(f)}else Object.hasOwn(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):Pc(a,l.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
40
40
  This Lexer has been defined to track line and column information,
41
41
  But none of the Token Types can be identified as matching a line terminator.
42
42
  See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
43
- for details.`,type:De.NO_LINE_BREAKS_FLAGS}),r}function _w(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t=="function")return!0;if(Object.hasOwn(t,"exec"))return!0;if(typeof t=="string")return!1;throw Error("non exhaustive match")}function sP(e){return typeof e=="string"&&e.length===1?e.charCodeAt(0):!1}var Aw={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let r=e.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return e.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function kw(e,t){if(Object.hasOwn(e,"LINE_BREAKS"))return!1;if(e.PATTERN instanceof RegExp){try{Nc(t,e.PATTERN)}catch(n){return{issue:De.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(typeof e.PATTERN=="string")return!1;if(_w(e))return{issue:De.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function aP(e,t){if(t.issue===De.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
43
+ for details.`,type:De.NO_LINE_BREAKS_FLAGS}),r}function kw(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t=="function")return!0;if(Object.hasOwn(t,"exec"))return!0;if(typeof t=="string")return!1;throw Error("non exhaustive match")}function lP(e){return typeof e=="string"&&e.length===1?e.charCodeAt(0):!1}var Iw={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let r=e.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return e.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function Rw(e,t){if(Object.hasOwn(e,"LINE_BREAKS"))return!1;if(e.PATTERN instanceof RegExp){try{Pc(t,e.PATTERN)}catch(n){return{issue:De.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(typeof e.PATTERN=="string")return!1;if(kw(e))return{issue:De.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function cP(e,t){if(t.issue===De.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
44
44
  The problem is in the <${e.name}> Token Type
45
45
  Root cause: ${t.errMsg}.
46
46
  For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===De.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
47
47
  The problem is in the <${e.name}> Token Type
48
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Iw(e){return e.map(n=>typeof n=="string"?n.charCodeAt(0):n)}function Sh(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var so=256,Pc=[];function gn(e){return e<so?e:Pc[e]}function lP(){if(Pc.length===0){Pc=new Array(65536);for(let e=0;e<65536;e++)Pc[e]=e>255?255+~~(e/255):e}}function kn(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[n]===!0}function lo(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var Rw=1,bw={};function In(e){let t=cP(e);uP(t),dP(t),fP(t),t.forEach(n=>{n.isParent=n.categoryMatches.length>0})}function cP(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(o=>o.CATEGORIES).flat().filter(Boolean);let i=n.filter(o=>!t.includes(o));t=t.concat(i),i.length===0?r=!1:n=i}return t}function uP(e){e.forEach(t=>{bh(t)||(bw[Rw]=t,t.tokenTypeIdx=Rw++),Sw(t)&&!Array.isArray(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),Sw(t)||(t.CATEGORIES=[]),pP(t)||(t.categoryMatches=[]),hP(t)||(t.categoryMatchesMap={})})}function fP(e){e.forEach(t=>{t.categoryMatches=[],Object.keys(t.categoryMatchesMap).forEach(n=>{t.categoryMatches.push(bw[n].tokenTypeIdx)})})}function dP(e){e.forEach(t=>{Nw([],t)})}function Nw(e,t){e.forEach(n=>{t.categoryMatchesMap[n.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||Nw(r,n)})}function bh(e){return Object.hasOwn(e??{},"tokenTypeIdx")}function Sw(e){return Object.hasOwn(e??{},"CATEGORIES")}function pP(e){return Object.hasOwn(e??{},"categoryMatches")}function hP(e){return Object.hasOwn(e??{},"categoryMatchesMap")}function Lw(e){return Object.hasOwn(e??{},"tokenTypeIdx")}var co={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,n,r,i,o){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`}};var De;(function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(De||(De={}));var ua={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
49
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:co,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ua);var Me=class{constructor(t,n=ua){if(this.lexerDefinition=t,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);let{time:a,value:l}=sa(o),c=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${s}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,l}else return o()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
50
- a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ua,n);let r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===ua.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Aw;else if(this.config.lineTerminatorCharacters===ua.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
51
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(t)?i={modes:{defaultMode:[...t]},defaultMode:ao}:(o=!1,i=Object.assign({},t))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Tw(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(vw(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Object.entries(i.modes).forEach(([a,l])=>{i.modes[a]=l.filter(c=>c!==void 0)});let s=Object.keys(i.modes);if(Object.entries(i.modes).forEach(([a,l])=>{this.TRACE_INIT(`Mode: <${a}> processing`,()=>{if(this.modes.push(a),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(ww(l,s))}),this.lexerDefinitionErrors.length===0){In(l);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=Ew(l,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[a]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[a]=c.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[a]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let l=this.lexerDefinitionErrors.map(c=>c.message).join(`-----------------------
48
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Sw(e){return e.map(n=>typeof n=="string"?n.charCodeAt(0):n)}function Nh(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var ao=256,Cc=[];function gn(e){return e<ao?e:Cc[e]}function uP(){if(Cc.length===0){Cc=new Array(65536);for(let e=0;e<65536;e++)Cc[e]=e>255?255+~~(e/255):e}}function kn(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[n]===!0}function co(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var bw=1,Lw={};function In(e){let t=fP(e);dP(t),hP(t),pP(t),t.forEach(n=>{n.isParent=n.categoryMatches.length>0})}function fP(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(o=>o.CATEGORIES).flat().filter(Boolean);let i=n.filter(o=>!t.includes(o));t=t.concat(i),i.length===0?r=!1:n=i}return t}function dP(e){e.forEach(t=>{Lh(t)||(Lw[bw]=t,t.tokenTypeIdx=bw++),Nw(t)&&!Array.isArray(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),Nw(t)||(t.CATEGORIES=[]),mP(t)||(t.categoryMatches=[]),gP(t)||(t.categoryMatchesMap={})})}function pP(e){e.forEach(t=>{t.categoryMatches=[],Object.keys(t.categoryMatchesMap).forEach(n=>{t.categoryMatches.push(Lw[n].tokenTypeIdx)})})}function hP(e){e.forEach(t=>{Pw([],t)})}function Pw(e,t){e.forEach(n=>{t.categoryMatchesMap[n.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||Pw(r,n)})}function Lh(e){return Object.hasOwn(e??{},"tokenTypeIdx")}function Nw(e){return Object.hasOwn(e??{},"CATEGORIES")}function mP(e){return Object.hasOwn(e??{},"categoryMatches")}function gP(e){return Object.hasOwn(e??{},"categoryMatchesMap")}function Ow(e){return Object.hasOwn(e??{},"tokenTypeIdx")}var uo={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,n,r,i,o){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`}};var De;(function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(De||(De={}));var fa={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
49
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:uo,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(fa);var Me=class{constructor(t,n=fa){if(this.lexerDefinition=t,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);let{time:a,value:l}=aa(o),c=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${s}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,l}else return o()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
50
+ a boolean 2nd argument is no longer supported`);this.config=Object.assign({},fa,n);let r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===fa.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Iw;else if(this.config.lineTerminatorCharacters===fa.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
51
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(t)?i={modes:{defaultMode:[...t]},defaultMode:lo}:(o=!1,i=Object.assign({},t))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(_w(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Aw(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Object.entries(i.modes).forEach(([a,l])=>{i.modes[a]=l.filter(c=>c!==void 0)});let s=Object.keys(i.modes);if(Object.entries(i.modes).forEach(([a,l])=>{this.TRACE_INIT(`Mode: <${a}> processing`,()=>{if(this.modes.push(a),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(vw(l,s))}),this.lexerDefinitionErrors.length===0){In(l);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=Tw(l,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[a]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[a]=c.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[a]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let l=this.lexerDefinitionErrors.map(c=>c.message).join(`-----------------------
52
52
  `);throw new Error(`Errors detected in definition of Lexer:
53
- `+l)}this.lexerDefinitionWarning.forEach(a=>{oa(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(o&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=a=>a),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let a=Object.entries(this.canModeBeOptimized).reduce((l,[c,u])=>(u===!1&&l.push(c),l),[]);if(n.ensureOptimizations&&a.length>0)throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
53
+ `+l)}this.lexerDefinitionWarning.forEach(a=>{sa(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(o&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=a=>a),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let a=Object.entries(this.canModeBeOptimized).reduce((l,[c,u])=>(u===!1&&l.push(c),l),[]);if(n.ensureOptimizations&&a.length>0)throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
54
54
  Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
55
- Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{hw()}),this.TRACE_INIT("toFastProperties",()=>{aa(this)})})}tokenize(t,n=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let i=this.lexerDefinitionErrors.map(o=>o.message).join(`-----------------------
55
+ Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{gw()}),this.TRACE_INIT("toFastProperties",()=>{la(this)})})}tokenize(t,n=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let i=this.lexerDefinitionErrors.map(o=>o.message).join(`-----------------------
56
56
  `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
57
- `+i)}return this.tokenizeInternal(t,n)}tokenizeInternal(t,n){let r,i,o,s,a,l,c,u,f,d,p,m,g,w,x,y=t,E=y.length,_=0,T=0,I=this.hasCustom?0:Math.floor(t.length/10),B=new Array(I),$=[],X=this.trackStartLines?1:void 0,Y=this.trackStartLines?1:void 0,D={};for(let V=0;V<this.cachedGroupKeys.length;V++)D[this.cachedGroupKeys[V]]=[];let R=this.trackStartLines,S=this.config.lineTerminatorsPattern,O=0,k=[],L=[],v=[],P=[];Object.freeze(P);let b=!1,F=V=>{if(v.length===1&&V.tokenType.PUSH_MODE===void 0){let ne=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(V);$.push({offset:V.startOffset,line:V.startLine,column:V.startColumn,length:V.image.length,message:ne})}else{v.pop();let ne=v.at(-1);k=this.patternIdxToConfig[ne],L=this.charCodeToPatternIdxToConfig[ne],O=k.length;let A=this.canModeBeOptimized[ne]&&this.config.safeMode===!1;L&&A?b=!0:b=!1}};function j(V){v.push(V),L=this.charCodeToPatternIdxToConfig[V],k=this.patternIdxToConfig[V],O=k.length;let ne=this.canModeBeOptimized[V]&&this.config.safeMode===!1;L&&ne?b=!0:b=!1}j.call(this,n);let U,ee=this.config.recoveryEnabled;for(;_<E;){l=null,f=-1;let V=y.charCodeAt(_),ne;if(b){let C=gn(V),W=L[C];ne=W!==void 0?W:P}else ne=k;let A=ne.length;for(r=0;r<A;r++){U=ne[r];let C=U.pattern;switch(c=null,U.matchType){case Oc:V===U.short&&(f=1,l=C);break;case ca:x=C.exec(y,_,B,D),x!==null?(l=x[0],f=l.length,x.payload!==void 0&&(c=x.payload)):l=null;break;case $c:{let W=U.asciiClass;if(W[V]!==1){C.lastIndex=0;break}let G=_+1;for(;W[y.charCodeAt(G)]===1;)G++;f=G-_,C.lastIndex=G;break}case Cc:C.lastIndex=_,f=this.matchLength(C,t,_);break}if(f!==-1){if(a=U.longerAlt,a!==void 0){l=t.substring(_,_+f);let W=a.length;for(o=0;o<W;o++){let G=k[a[o]],K=G.pattern;if(u=null,G.matchType===ca?(x=K.exec(y,_,B,D),x!==null?(s=x[0],x.payload!==void 0&&(u=x.payload)):s=null):(K.lastIndex=_,s=this.match(K,t,_)),s&&s.length>l.length){l=s,f=s.length,c=u,U=G;break}}}break}}if(f!==-1){if(d=U.group,d!==void 0&&(l=l!==null?l:t.substring(_,_+f),p=U.tokenTypeIdx,m=this.createTokenInstance(l,_,p,U.tokenType,X,Y,f),this.handlePayload(m,c),d===!1?T=this.addToken(B,T,m):D[d].push(m)),R===!0&&U.canLineTerminator===!0){let C=0,W,G;S.lastIndex=0;do l=l!==null?l:t.substring(_,_+f),W=S.test(l),W===!0&&(G=S.lastIndex-1,C++);while(W===!0);C!==0?(X=X+C,Y=f-G,this.updateTokenEndLineColumnLocation(m,d,G,C,X,Y,f)):Y=this.computeNewColumn(Y,f)}else Y=this.computeNewColumn(Y,f);_=_+f,this.handleModes(U,F,j,m)}else{let C=_,W=X,G=Y,K=ee===!1;for(;K===!1&&_<E;)for(_++,i=0;i<O;i++){let q=k[i],J=q.pattern;switch(q.matchType){case Oc:y.charCodeAt(_)===q.short&&(K=!0);break;case ca:K=J.exec(y,_,B,D)!==null;break;case $c:case Cc:J.lastIndex=_,K=J.exec(t)!==null;break}if(K===!0)break}if(g=_-C,Y=this.computeNewColumn(Y,g),w=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,C,g,W,G,v.at(-1)),$.push({offset:C,line:W,column:G,length:g,message:w}),ee===!1)break}}return this.hasCustom||(B.length=T),{tokens:B,groups:D,errors:$}}handleModes(t,n,r,i){if(t.pop===!0){let o=t.push;n(i),o!==void 0&&r.call(this,o)}else t.push!==void 0&&r.call(this,t.push)}updateTokenEndLineColumnLocation(t,n,r,i,o,s,a){let l,c;n!==void 0&&(l=r===a-1,c=l?-1:0,i===1&&l===!0||(t.endLine=o+c,t.endColumn=s-1+-c))}computeNewColumn(t,n){return t+n}createOffsetOnlyToken(t,n,r,i){return{image:t,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(t,n,r,i,o,s){return{image:t,startOffset:n,startLine:o,startColumn:s,tokenTypeIdx:r,tokenType:i}}createFullToken(t,n,r,i,o,s,a){return{image:t,startOffset:n,endOffset:n+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(t,n,r){return t.push(r),n}addTokenUsingMemberAccess(t,n,r){return t[n]=r,n++,n}handlePayloadNoCustom(t,n){}handlePayloadWithCustom(t,n){n!==null&&(t.payload=n)}match(t,n,r){return t.test(n)===!0?n.substring(r,t.lastIndex):null}matchLength(t,n,r){return t.test(n)===!0?t.lastIndex-r:-1}};Me.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";Me.NA=/NOT_APPLICABLE/;function Rn(e){return Nh(e)?e.LABEL:e.name}function Nh(e){return typeof e.LABEL=="string"&&e.LABEL!==""}var mP="parent",Pw="categories",Ow="label",Cw="group",$w="push_mode",Dw="pop_mode",Mw="longer_alt",Fw="line_breaks",Bw="start_chars_hint";function cr(e){return gP(e)}function gP(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,mP))throw`The parent property is no longer supported.
58
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,Pw)&&(n.CATEGORIES=e[Pw]),In([n]),Object.hasOwn(e,Ow)&&(n.LABEL=e[Ow]),Object.hasOwn(e,Cw)&&(n.GROUP=e[Cw]),Object.hasOwn(e,Dw)&&(n.POP_MODE=e[Dw]),Object.hasOwn(e,$w)&&(n.PUSH_MODE=e[$w]),Object.hasOwn(e,Mw)&&(n.LONGER_ALT=e[Mw]),Object.hasOwn(e,Fw)&&(n.LINE_BREAKS=e[Fw]),Object.hasOwn(e,Bw)&&(n.START_CHARS_HINT=e[Bw]),n}var ut=cr({name:"EOF",pattern:Me.NA});In([ut]);function Sn(e,t,n,r,i,o,s,a){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function uo(e,t){return kn(e,t)}var bn={buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:r}){return`Expecting ${Nh(e)?`--> ${Rn(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let o="Expecting: ",a=`
57
+ `+i)}return this.tokenizeInternal(t,n)}tokenizeInternal(t,n){let r,i,o,s,a,l,c,u,f,d,p,m,g,E,x,y=t,w=y.length,_=0,v=0,R=this.hasCustom?0:Math.floor(t.length/10),B=new Array(R),C=[],X=this.trackStartLines?1:void 0,V=this.trackStartLines?1:void 0,$={};for(let Y=0;Y<this.cachedGroupKeys.length;Y++)$[this.cachedGroupKeys[Y]]=[];let I=this.trackStartLines,F=this.config.lineTerminatorsPattern,N=0,k=[],b=[],T=[],L=[];Object.freeze(L);let D=!1,P=Y=>{if(T.length===1&&Y.tokenType.PUSH_MODE===void 0){let te=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Y);C.push({offset:Y.startOffset,line:Y.startLine,column:Y.startColumn,length:Y.image.length,message:te})}else{T.pop();let te=T.at(-1);k=this.patternIdxToConfig[te],b=this.charCodeToPatternIdxToConfig[te],N=k.length;let A=this.canModeBeOptimized[te]&&this.config.safeMode===!1;b&&A?D=!0:D=!1}};function U(Y){T.push(Y),b=this.charCodeToPatternIdxToConfig[Y],k=this.patternIdxToConfig[Y],N=k.length;let te=this.canModeBeOptimized[Y]&&this.config.safeMode===!1;b&&te?D=!0:D=!1}U.call(this,n);let z,J=this.config.recoveryEnabled;for(;_<w;){l=null,f=-1;let Y=y.charCodeAt(_),te;if(D){let O=gn(Y),W=b[O];te=W!==void 0?W:L}else te=k;let A=te.length;for(r=0;r<A;r++){z=te[r];let O=z.pattern;switch(c=null,z.matchType){case $c:Y===z.short&&(f=1,l=O);break;case ua:x=O.exec(y,_,B,$),x!==null?(l=x[0],f=l.length,x.payload!==void 0&&(c=x.payload)):l=null;break;case Mc:{let W=z.asciiClass;if(W[Y]!==1){O.lastIndex=0;break}let G=_+1;for(;W[y.charCodeAt(G)]===1;)G++;f=G-_,O.lastIndex=G;break}case Dc:O.lastIndex=_,f=this.matchLength(O,t,_);break}if(f!==-1){if(a=z.longerAlt,a!==void 0){l=t.substring(_,_+f);let W=a.length;for(o=0;o<W;o++){let G=k[a[o]],K=G.pattern;if(u=null,G.matchType===ua?(x=K.exec(y,_,B,$),x!==null?(s=x[0],x.payload!==void 0&&(u=x.payload)):s=null):(K.lastIndex=_,s=this.match(K,t,_)),s&&s.length>l.length){l=s,f=s.length,c=u,z=G;break}}}break}}if(f!==-1){if(d=z.group,d!==void 0&&(l=l!==null?l:t.substring(_,_+f),p=z.tokenTypeIdx,m=this.createTokenInstance(l,_,p,z.tokenType,X,V,f),this.handlePayload(m,c),d===!1?v=this.addToken(B,v,m):$[d].push(m)),I===!0&&z.canLineTerminator===!0){let O=0,W,G;F.lastIndex=0;do l=l!==null?l:t.substring(_,_+f),W=F.test(l),W===!0&&(G=F.lastIndex-1,O++);while(W===!0);O!==0?(X=X+O,V=f-G,this.updateTokenEndLineColumnLocation(m,d,G,O,X,V,f)):V=this.computeNewColumn(V,f)}else V=this.computeNewColumn(V,f);_=_+f,this.handleModes(z,P,U,m)}else{let O=_,W=X,G=V,K=J===!1;for(;K===!1&&_<w;)for(_++,i=0;i<N;i++){let q=k[i],Q=q.pattern;switch(q.matchType){case $c:y.charCodeAt(_)===q.short&&(K=!0);break;case ua:K=Q.exec(y,_,B,$)!==null;break;case Mc:case Dc:Q.lastIndex=_,K=Q.exec(t)!==null;break}if(K===!0)break}if(g=_-O,V=this.computeNewColumn(V,g),E=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,O,g,W,G,T.at(-1)),C.push({offset:O,line:W,column:G,length:g,message:E}),J===!1)break}}return this.hasCustom||(B.length=v),{tokens:B,groups:$,errors:C}}handleModes(t,n,r,i){if(t.pop===!0){let o=t.push;n(i),o!==void 0&&r.call(this,o)}else t.push!==void 0&&r.call(this,t.push)}updateTokenEndLineColumnLocation(t,n,r,i,o,s,a){let l,c;n!==void 0&&(l=r===a-1,c=l?-1:0,i===1&&l===!0||(t.endLine=o+c,t.endColumn=s-1+-c))}computeNewColumn(t,n){return t+n}createOffsetOnlyToken(t,n,r,i){return{image:t,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(t,n,r,i,o,s){return{image:t,startOffset:n,startLine:o,startColumn:s,tokenTypeIdx:r,tokenType:i}}createFullToken(t,n,r,i,o,s,a){return{image:t,startOffset:n,endOffset:n+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(t,n,r){return t.push(r),n}addTokenUsingMemberAccess(t,n,r){return t[n]=r,n++,n}handlePayloadNoCustom(t,n){}handlePayloadWithCustom(t,n){n!==null&&(t.payload=n)}match(t,n,r){return t.test(n)===!0?n.substring(r,t.lastIndex):null}matchLength(t,n,r){return t.test(n)===!0?t.lastIndex-r:-1}};Me.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";Me.NA=/NOT_APPLICABLE/;function Rn(e){return Ph(e)?e.LABEL:e.name}function Ph(e){return typeof e.LABEL=="string"&&e.LABEL!==""}var yP="parent",Cw="categories",$w="label",Dw="group",Mw="push_mode",Fw="pop_mode",Bw="longer_alt",Ww="line_breaks",Xw="start_chars_hint";function cr(e){return xP(e)}function xP(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,yP))throw`The parent property is no longer supported.
58
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,Cw)&&(n.CATEGORIES=e[Cw]),In([n]),Object.hasOwn(e,$w)&&(n.LABEL=e[$w]),Object.hasOwn(e,Dw)&&(n.GROUP=e[Dw]),Object.hasOwn(e,Fw)&&(n.POP_MODE=e[Fw]),Object.hasOwn(e,Mw)&&(n.PUSH_MODE=e[Mw]),Object.hasOwn(e,Bw)&&(n.LONGER_ALT=e[Bw]),Object.hasOwn(e,Ww)&&(n.LINE_BREAKS=e[Ww]),Object.hasOwn(e,Xw)&&(n.START_CHARS_HINT=e[Xw]),n}var ut=cr({name:"EOF",pattern:Me.NA});In([ut]);function Sn(e,t,n,r,i,o,s,a){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function fo(e,t){return kn(e,t)}var bn={buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:r}){return`Expecting ${Ph(e)?`--> ${Rn(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let o="Expecting: ",a=`
59
59
  but found: '`+t[0].image+"'";if(r)return o+r+a;{let f=`one of these possible Token sequences:
60
60
  ${e.reduce((d,p)=>d.concat(p),[]).map(d=>`[${d.map(p=>Rn(p)).join(", ")}]`).map((d,p)=>` ${p+1}. ${d}`).join(`
61
61
  `)}`;return o+f+a}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i="Expecting: ",s=`
62
62
  but found: '`+t[0].image+"'";if(n)return i+n+s;{let l=`expecting at least one iteration which starts with one of these possible Token sequences::
63
- <${e.map(c=>`[${c.map(u=>Rn(u)).join(",")}]`).join(" ,")}>`;return i+l+s}}};Object.freeze(bn);var Ww={buildRuleNotFoundError(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+`<-
63
+ <${e.map(c=>`[${c.map(u=>Rn(u)).join(",")}]`).join(" ,")}>`;return i+l+s}}};Object.freeze(bn);var Uw={buildRuleNotFoundError(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+`<-
64
64
  inside top level rule: ->`+e.name+"<-"}},Vt={buildDuplicateFoundError(e,t){function n(u){return u instanceof ue?u.terminalType.name:u instanceof Ee?u.nonTerminalName:""}let r=e.name,i=t[0],o=i.idx,s=wt(i),a=n(i),l=o>0,c=`->${s}${l?o:""}<- ${a?`with argument: ->${a}<-`:""}
65
65
  appears more than once (${t.length} times) in the top level rule: ->${r}<-.
66
66
  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
@@ -87,46 +87,46 @@ rule: <${t}> can be invoked from itself (directly or indirectly)
87
87
  without consuming any Tokens. The grammar path that causes this is:
88
88
  ${r}
89
89
  To fix this refactor your grammar to remove the left recursion.
90
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let t;return e.topLevelRule instanceof lt?t=e.topLevelRule.name:t=e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Xw(e,t){let n=new Lh(e,t);return n.resolveRefs(),n.errors}var Lh=class extends ct{constructor(t,n){super(),this.nameToTopRule=t,this.errMsgProvider=n,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(t=>{this.currTopLevel=t,t.accept(this)})}visitNonTerminal(t){let n=this.nameToTopRule[t.nonTerminalName];if(n)t.referencedRule=n;else{let r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:r,type:Ye.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}}};var Ph=class extends An{constructor(t,n){super(),this.topProd=t,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(t,n=[]){this.found||super.walk(t,n)}walkProdRef(t,n,r){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){let i=n.concat(r);this.updateExpectedNext(),this.walk(t.referencedRule,i)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Dc=class extends Ph{constructor(t,n){super(t,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(t,n,r){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){let i=n.concat(r),o=new be({definition:i});this.possibleTokTypes=ni(o),this.found=!0}}},fo=class extends An{constructor(t,n){super(),this.topRule=t,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Mc=class extends fo{walkMany(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(t,n,r)}},fa=class extends fo{walkManySep(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(t,n,r)}},Fc=class extends fo{walkAtLeastOne(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(t,n,r)}},da=class extends fo{walkAtLeastOneSep(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(t,n,r)}};function Bc(e,t,n=[]){n=[...n];let r=[],i=0;function o(a){return a.concat(e.slice(i+1))}function s(a){let l=Bc(o(a),t,n);return r.concat(l)}for(;n.length<t&&i<e.length;){let a=e[i];if(a instanceof be)return s(a.definition);if(a instanceof Ee)return s(a.definition);if(a instanceof we)r=s(a.definition);else if(a instanceof Ne){let l=a.definition.concat([new ge({definition:a.definition})]);return s(l)}else if(a instanceof Le){let l=[new be({definition:a.definition}),new ge({definition:[new ue({terminalType:a.separator})].concat(a.definition)})];return s(l)}else if(a instanceof ke){let l=a.definition.concat([new ge({definition:[new ue({terminalType:a.separator})].concat(a.definition)})]);r=s(l)}else if(a instanceof ge){let l=a.definition.concat([new ge({definition:a.definition})]);r=s(l)}else{if(a instanceof Ie)return a.definition.forEach(l=>{l.definition.length!==0&&(r=s(l.definition))}),r;if(a instanceof ue)n.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:e.slice(i)}),r}function Uw(e,t,n,r){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,l=t.length,c=l-r-1,u=[],f=[];for(f.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});f.length!==0;){let d=f.pop();if(d===s){a&&f.at(-1).idx<=c&&f.pop();continue}let p=d.def,m=d.idx,g=d.ruleStack,w=d.occurrenceStack;if(p.length===0)continue;let x=p[0];if(x===i){let y={idx:m,def:p.slice(1),ruleStack:g.slice(0,-1),occurrenceStack:w.slice(0,-1)};f.push(y)}else if(x instanceof ue)if(m<l-1){let y=m+1,E=t[y];if(n(E,x.terminalType)){let _={idx:y,def:p.slice(1),ruleStack:g,occurrenceStack:w};f.push(_)}}else if(m===l-1)u.push({nextTokenType:x.terminalType,nextTokenOccurrence:x.idx,ruleStack:g,occurrenceStack:w}),a=!0;else throw Error("non exhaustive match");else if(x instanceof Ee){let y=[...g];y.push(x.nonTerminalName);let E=[...w];E.push(x.idx);let _={idx:m,def:x.definition.concat(o,p.slice(1)),ruleStack:y,occurrenceStack:E};f.push(_)}else if(x instanceof we){let y={idx:m,def:p.slice(1),ruleStack:g,occurrenceStack:w};f.push(y),f.push(s);let E={idx:m,def:x.definition.concat(p.slice(1)),ruleStack:g,occurrenceStack:w};f.push(E)}else if(x instanceof Ne){let y=new ge({definition:x.definition,idx:x.idx}),E=x.definition.concat([y],p.slice(1)),_={idx:m,def:E,ruleStack:g,occurrenceStack:w};f.push(_)}else if(x instanceof Le){let y=new ue({terminalType:x.separator}),E=new ge({definition:[y].concat(x.definition),idx:x.idx}),_=x.definition.concat([E],p.slice(1)),T={idx:m,def:_,ruleStack:g,occurrenceStack:w};f.push(T)}else if(x instanceof ke){let y={idx:m,def:p.slice(1),ruleStack:g,occurrenceStack:w};f.push(y),f.push(s);let E=new ue({terminalType:x.separator}),_=new ge({definition:[E].concat(x.definition),idx:x.idx}),T=x.definition.concat([_],p.slice(1)),I={idx:m,def:T,ruleStack:g,occurrenceStack:w};f.push(I)}else if(x instanceof ge){let y={idx:m,def:p.slice(1),ruleStack:g,occurrenceStack:w};f.push(y),f.push(s);let E=new ge({definition:x.definition,idx:x.idx}),_=x.definition.concat([E],p.slice(1)),T={idx:m,def:_,ruleStack:g,occurrenceStack:w};f.push(T)}else if(x instanceof Ie)for(let y=x.definition.length-1;y>=0;y--){let E=x.definition[y],_={idx:m,def:E.definition.concat(p.slice(1)),ruleStack:g,occurrenceStack:w};f.push(_),f.push(s)}else if(x instanceof be)f.push({idx:m,def:x.definition.concat(p.slice(1)),ruleStack:g,occurrenceStack:w});else if(x instanceof lt)f.push(yP(x,m,g,w));else throw Error("non exhaustive match")}return u}function yP(e,t,n,r){let i=[...n];i.push(e.name);let o=[...r];return o.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:o}}var Fe;(function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"})(Fe||(Fe={}));function pa(e){if(e instanceof we||e==="Option")return Fe.OPTION;if(e instanceof ge||e==="Repetition")return Fe.REPETITION;if(e instanceof Ne||e==="RepetitionMandatory")return Fe.REPETITION_MANDATORY;if(e instanceof Le||e==="RepetitionMandatoryWithSeparator")return Fe.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof ke||e==="RepetitionWithSeparator")return Fe.REPETITION_WITH_SEPARATOR;if(e instanceof Ie||e==="Alternation")return Fe.ALTERNATION;throw Error("non exhaustive match")}function Xc(e){let{occurrence:t,rule:n,prodType:r,maxLookahead:i}=e,o=pa(r);return o===Fe.ALTERNATION?po(t,n,i):ho(t,n,o,i)}function Hw(e,t,n,r,i,o){let s=po(e,t,n),a=qw(s)?lo:kn;return o(s,r,a,i)}function zw(e,t,n,r,i,o){let s=ho(e,t,i,n),a=qw(s)?lo:kn;return o(s[0],a,r)}function jw(e,t,n,r){let i=e.length,o=e.every(s=>s.every(a=>a.length===1));if(t)return function(s){let a=s.map(l=>l.GATE);for(let l=0;l<i;l++){let c=e[l],u=c.length,f=a[l];if(!(f!==void 0&&f.call(this)===!1))e:for(let d=0;d<u;d++){let p=c[d],m=p.length;for(let g=0;g<m;g++){let w=this.LA_FAST(g+1);if(n(w,p[g])===!1)continue e}return l}}};if(o&&!r){let a=e.map(l=>l.flat()).reduce((l,c,u)=>(c.forEach(f=>{f.tokenTypeIdx in l||(l[f.tokenTypeIdx]=u),f.categoryMatches.forEach(d=>{Object.hasOwn(l,d)||(l[d]=u)})}),l),{});return function(){let l=this.LA_FAST(1);return a[l.tokenTypeIdx]}}else return function(){for(let s=0;s<i;s++){let a=e[s],l=a.length;e:for(let c=0;c<l;c++){let u=a[c],f=u.length;for(let d=0;d<f;d++){let p=this.LA_FAST(d+1);if(n(p,u[d])===!1)continue e}return s}}}}function Yw(e,t,n){let r=e.every(o=>o.length===1),i=e.length;if(r&&!n){let o=e.flat();if(o.length===1&&o[0].categoryMatches.length===0){let a=o[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===a}}else{let s=o.reduce((a,l,c)=>(a[l.tokenTypeIdx]=!0,l.categoryMatches.forEach(u=>{a[u]=!0}),a),[]);return function(){let a=this.LA_FAST(1);return s[a.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let s=e[o],a=s.length;for(let l=0;l<a;l++){let c=this.LA_FAST(l+1);if(t(c,s[l])===!1)continue e}return!0}return!1}}var Ch=class extends An{constructor(t,n,r){super(),this.topProd=t,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(t,n,r,i){return t.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(t,n,r){this.checkIsTarget(t,Fe.OPTION,n,r)||super.walkOption(t,n,r)}walkAtLeastOne(t,n,r){this.checkIsTarget(t,Fe.REPETITION_MANDATORY,n,r)||super.walkOption(t,n,r)}walkAtLeastOneSep(t,n,r){this.checkIsTarget(t,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(t,n,r)}walkMany(t,n,r){this.checkIsTarget(t,Fe.REPETITION,n,r)||super.walkOption(t,n,r)}walkManySep(t,n,r){this.checkIsTarget(t,Fe.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(t,n,r)}},Wc=class extends ct{constructor(t,n,r){super(),this.targetOccurrence=t,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(t,n){t.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||t===this.targetRef)&&(this.result=t.definition)}visitOption(t){this.checkIsTarget(t,Fe.OPTION)}visitRepetition(t){this.checkIsTarget(t,Fe.REPETITION)}visitRepetitionMandatory(t){this.checkIsTarget(t,Fe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(t){this.checkIsTarget(t,Fe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(t){this.checkIsTarget(t,Fe.REPETITION_WITH_SEPARATOR)}visitAlternation(t){this.checkIsTarget(t,Fe.ALTERNATION)}};function Gw(e){let t=new Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function Oh(e){let t=[""];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let o=0;o<t.length;o++){let s=t[o];i.push(s+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){let l="_"+r.categoryMatches[a];i.push(s+l)}}t=i}return t}function xP(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let o=0;o<t.length;o++){let s=t[o];if(i[s]===!0)return!1}}return!0}function Vw(e,t){let n=e.map(s=>Bc([s],1)),r=Gw(n.length),i=n.map(s=>{let a={};return s.forEach(l=>{Oh(l.partialPath).forEach(u=>{a[u]=!0})}),a}),o=n;for(let s=1;s<=t;s++){let a=o;o=Gw(a.length);for(let l=0;l<a.length;l++){let c=a[l];for(let u=0;u<c.length;u++){let f=c[u].partialPath,d=c[u].suffixDef,p=Oh(f);if(xP(i,p,l)||d.length===0||f.length===t){let g=r[l];if(Uc(g,f)===!1){g.push(f);for(let w=0;w<p.length;w++){let x=p[w];i[l][x]=!0}}}else{let g=Bc(d,s+1,f);o[l]=o[l].concat(g),g.forEach(w=>{Oh(w.partialPath).forEach(y=>{i[l][y]=!0})})}}}}return r}function po(e,t,n,r){let i=new Wc(e,Fe.ALTERNATION,r);return t.accept(i),Vw(i.result,n)}function ho(e,t,n,r){let i=new Wc(e,n);t.accept(i);let o=i.result,a=new Ch(t,e,n).startWalking(),l=new be({definition:o}),c=new be({definition:a});return Vw([l,c],r)}function Uc(e,t){e:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let i=0;i<r.length;i++){let o=t[i],s=r[i];if((o===s||s.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function Kw(e,t){return e.length<t.length&&e.every((n,r)=>{let i=t[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function qw(e){return e.every(t=>t.every(n=>n.every(r=>r.categoryMatches.length===0)))}function Zw(e){return e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(n=>Object.assign({type:Ye.CUSTOM_LOOKAHEAD_VALIDATION},n))}function Jw(e,t,n,r){let i=e.flatMap(l=>EP(l,n)),o=kP(e,t,n),s=e.flatMap(l=>vP(l,n)),a=e.flatMap(l=>TP(l,e,r,n));return i.concat(o,s,a)}function EP(e,t){let n=new $h;e.accept(n);let r=n.allProductions,i=Object.groupBy(r,wP),o=Object.fromEntries(Object.entries(i).filter(([a,l])=>l.length>1));return Object.values(o).map(a=>{let l=a[0],c=t.buildDuplicateFoundError(e,a),u=wt(l),f={message:c,type:Ye.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:u,occurrence:l.idx},d=Qw(l);return d&&(f.parameter=d),f})}function wP(e){return`${wt(e)}_#_${e.idx}_#_${Qw(e)}`}function Qw(e){return e instanceof ue?e.terminalType.name:e instanceof Ee?e.nonTerminalName:""}var $h=class extends ct{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(t){this.allProductions.push(t)}visitOption(t){this.allProductions.push(t)}visitRepetitionWithSeparator(t){this.allProductions.push(t)}visitRepetitionMandatory(t){this.allProductions.push(t)}visitRepetitionMandatoryWithSeparator(t){this.allProductions.push(t)}visitRepetition(t){this.allProductions.push(t)}visitAlternation(t){this.allProductions.push(t)}visitTerminal(t){this.allProductions.push(t)}};function TP(e,t,n,r){let i=[];if(t.reduce((s,a)=>a.name===e.name?s+1:s,0)>1){let s=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:s,type:Ye.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function eT(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Ye.INVALID_RULE_OVERRIDE,ruleName:e})),r}function Mh(e,t,n,r=[]){let i=[],o=Gc(t.definition);if(o.length===0)return[];{let s=e.name;o.includes(e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:Ye.LEFT_RECURSION,ruleName:s});let l=r.concat([e]),u=o.filter(f=>!l.includes(f)).flatMap(f=>{let d=[...r];return d.push(f),Mh(e,f,n,d)});return i.concat(u)}}function Gc(e){let t=[];if(e.length===0)return t;let n=e[0];if(n instanceof Ee)t.push(n.referencedRule);else if(n instanceof be||n instanceof we||n instanceof Ne||n instanceof Le||n instanceof ke||n instanceof ge)t=t.concat(Gc(n.definition));else if(n instanceof Ie)t=n.definition.map(o=>Gc(o.definition)).flat();else if(!(n instanceof ue))throw Error("non exhaustive match");let r=ti(n),i=e.length>1;if(r&&i){let o=e.slice(1);return t.concat(Gc(o))}else return t}var ha=class extends ct{constructor(){super(...arguments),this.alternations=[]}visitAlternation(t){this.alternations.push(t)}};function tT(e,t){let n=new ha;return e.accept(n),n.alternations.flatMap(o=>o.definition.slice(0,-1).flatMap((a,l)=>Uw([a],[],kn,1).length===0?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:o,emptyChoiceIdx:l}),type:Ye.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:o.idx,alternative:l+1}]:[]))}function nT(e,t,n){let r=new ha;e.accept(r);let i=r.alternations;return i=i.filter(s=>s.ignoreAmbiguities!==!0),i.flatMap(s=>{let a=s.idx,l=s.maxLookahead||t,c=po(a,e,l,s),u=_P(c,s,e,n),f=AP(c,s,e,n);return u.concat(f)})}var Dh=class extends ct{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(t){this.allProductions.push(t)}visitRepetitionMandatory(t){this.allProductions.push(t)}visitRepetitionMandatoryWithSeparator(t){this.allProductions.push(t)}visitRepetition(t){this.allProductions.push(t)}};function vP(e,t){let n=new ha;return e.accept(n),n.alternations.flatMap(o=>o.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:o}),type:Ye.TOO_MANY_ALTS,ruleName:e.name,occurrence:o.idx}]:[])}function rT(e,t,n){let r=[];return e.forEach(i=>{let o=new Dh;i.accept(o),o.allProductions.forEach(a=>{let l=pa(a),c=a.maxLookahead||t,u=a.idx;if(ho(u,i,l,c)[0].flat().length===0){let p=n.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:p,type:Ye.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function _P(e,t,n,r){let i=[];return e.reduce((a,l,c)=>(t.definition[c].ignoreAmbiguities===!0||l.forEach(u=>{let f=[c];e.forEach((d,p)=>{c!==p&&Uc(d,u)&&t.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!Uc(i,u)&&(i.push(u),a.push({alts:f,path:u}))}),a),[]).map(a=>{let l=a.alts.map(u=>u+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:l,prefixPath:a.path}),type:Ye.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:a.alts}})}function AP(e,t,n,r){let i=e.reduce((s,a,l)=>{let c=a.map(u=>({idx:l,path:u}));return s.concat(c)},[]);return i.flatMap(s=>{if(t.definition[s.idx].ignoreAmbiguities===!0)return[];let l=s.idx,c=s.path;return i.filter(d=>t.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<l&&Kw(d.path,c)).map(d=>{let p=[d.idx+1,l+1],m=t.idx===0?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:p,prefixPath:d.path}),type:Ye.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:m,alternatives:p}})})}function kP(e,t,n){let r=[],i=t.map(o=>o.name);return e.forEach(o=>{let s=o.name;if(i.includes(s)){let a=n.buildNamespaceConflictError(o);r.push({message:a,type:Ye.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),r}function iT(e){let t=Object.assign({errMsgProvider:Ww},e),n={};return e.rules.forEach(r=>{n[r.name]=r}),Xw(n,t.errMsgProvider)}function oT(e){var t;let n=(t=e.errMsgProvider)!==null&&t!==void 0?t:Vt;return Jw(e.rules,e.tokenTypes,n,e.grammarName)}var sT="MismatchedTokenException",aT="NoViableAltException",lT="EarlyExitException",cT="NotAllInputParsedException",uT=[sT,aT,lT,cT];Object.freeze(uT);function ur(e){return uT.includes(e.name)}var mo=class extends Error{constructor(t,n){super(t),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},oi=class extends mo{constructor(t,n,r){super(t,n),this.previousToken=r,this.name=sT}},ma=class extends mo{constructor(t,n,r){super(t,n),this.previousToken=r,this.name=aT}},ga=class extends mo{constructor(t,n){super(t,n),this.name=cT}},ya=class extends mo{constructor(t,n,r){super(t,n),this.previousToken=r,this.name=lT}};var Fh={},Wh="InRuleRecoveryException",Bh=class extends Error{constructor(t){super(t),this.name=Wh}},Hc=class{initRecoverable(t){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(t,"recoveryEnabled")?t.recoveryEnabled:ft.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=IP)}getTokenToInsert(t){let n=Sn(t,"",-1,-1,-1,-1,-1,-1);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(t){return!0}canTokenTypeBeDeletedInRecovery(t){return!0}tryInRepetitionRecovery(t,n,r,i){let o=this.findReSyncTokenType(),s=this.exportLexerState(),a=[],l=!1,c=this.LA_FAST(1),u=this.LA_FAST(1),f=()=>{let d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:d,ruleName:this.getCurrRuleFullName()}),m=new oi(p,c,this.LA(0));m.resyncedTokens=a.slice(0,-1),this.SAVE_ERROR(m)};for(;!l;)if(this.tokenMatcher(u,i)){f();return}else if(r.call(this)){f(),t.apply(this,n);return}else this.tokenMatcher(u,o)?l=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,a));this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(t,n,r){return!(r===!1||this.tokenMatcher(this.LA_FAST(1),t)||this.isBackTracking()||this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,n)))}getNextPossibleTokenTypes(t){let n=t.ruleStack[0],i=this.getGAstProductions()[n];return new Dc(i,t).startWalking()}getFollowsForInRuleRecovery(t,n){let r=this.getCurrentGrammarPath(t,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(t,n){if(this.canRecoverWithSingleTokenInsertion(t,n))return this.getTokenToInsert(t);if(this.canRecoverWithSingleTokenDeletion(t)){let r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new Bh("sad sad panda")}canPerformInRuleRecovery(t,n){return this.canRecoverWithSingleTokenInsertion(t,n)||this.canRecoverWithSingleTokenDeletion(t)}canRecoverWithSingleTokenInsertion(t,n){if(!this.canTokenTypeBeInsertedInRecovery(t)||n.length===0)return!1;let r=this.LA_FAST(1);return n.find(o=>this.tokenMatcher(r,o))!==void 0}canRecoverWithSingleTokenDeletion(t){return this.canTokenTypeBeDeletedInRecovery(t)?this.tokenMatcher(this.LA(2),t):!1}isInCurrentRuleReSyncSet(t){let n=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(n).includes(t)}findReSyncTokenType(){let t=this.flattenFollowSet(),n=this.LA_FAST(1),r=2;for(;;){let i=t.find(o=>uo(n,o));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return Fh;let t=this.currRuleShortName,n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){let t=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK,r=this.RULE_STACK_IDX+1,i=new Array(r);for(let o=0;o<r;o++)o===0?i[o]=Fh:i[o]={ruleName:this.shortRuleNameToFullName(t[o]),idxInCallingRule:n[o],inRule:this.shortRuleNameToFullName(t[o-1])};return i}flattenFollowSet(){return this.buildFullFollowKeyStack().map(n=>this.getFollowSetFromFollowKey(n)).flat()}getFollowSetFromFollowKey(t){if(t===Fh)return[ut];let n=t.ruleName+t.idxInCallingRule+Rc+t.inRule;return this.resyncFollows[n]}addToResyncTokens(t,n){return this.tokenMatcher(t,ut)||n.push(t),n}reSyncTo(t){let n=[],r=this.LA_FAST(1);for(;this.tokenMatcher(r,t)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return n.slice(0,-1)}attemptInRepetitionRecovery(t,n,r,i,o,s,a){}getCurrentGrammarPath(t,n){let r=this.getHumanReadableRuleStack(),i=this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1);return{ruleStack:r,occurrenceStack:i,lastTok:t,lastTokOccurrence:n}}getHumanReadableRuleStack(){let t=this.RULE_STACK_IDX+1,n=new Array(t);for(let r=0;r<t;r++)n[r]=this.shortRuleNameToFullName(this.RULE_STACK[r]);return n}};function IP(e,t,n,r,i,o,s){var a,l,c;let u=r|i,f=(a=(l=this.firstAfterRepMap)[c=this.currRuleShortName])!==null&&a!==void 0?a:l[c]=[],d=f[u];if(d===void 0){let w=this.getCurrRuleFullName(),x=this.getGAstProductions()[w];d=new o(x,i).startWalking(),f[u]=d}let p=d.token,m=d.occurrence,g=d.isEndOfRule;this.RULE_STACK_IDX===0&&g&&p===void 0&&(p=ut,m=1),!(p===void 0||m===void 0)&&this.shouldInRepetitionRecoveryBeTried(p,m,s)&&this.tryInRepetitionRecovery(e,t,n,p)}var Nn=class{constructor(t){var n;this.maxLookahead=(n=t?.maxLookahead)!==null&&n!==void 0?n:ft.maxLookahead}validate(t){let n=this.validateNoLeftRecursion(t.rules);if(n.length===0){let r=this.validateEmptyOrAlternatives(t.rules),i=this.validateAmbiguousAlternationAlternatives(t.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(t.rules,this.maxLookahead);return[...n,...r,...i,...o]}return n}validateNoLeftRecursion(t){return t.flatMap(n=>Mh(n,n,Vt))}validateEmptyOrAlternatives(t){return t.flatMap(n=>tT(n,Vt))}validateAmbiguousAlternationAlternatives(t,n){return t.flatMap(r=>nT(r,n,Vt))}validateSomeNonEmptyLookaheadPath(t,n){return rT(t,n,Vt)}buildLookaheadForAlternation(t){return Hw(t.prodOccurrence,t.rule,t.maxLookahead,t.hasPredicates,t.dynamicTokensEnabled,jw)}buildLookaheadForOptional(t){return zw(t.prodOccurrence,t.rule,t.maxLookahead,t.dynamicTokensEnabled,pa(t.prodType),Yw)}};var jc=class{initLooksAhead(t){this.dynamicTokensEnabled=Object.hasOwn(t,"dynamicTokensEnabled")?t.dynamicTokensEnabled:ft.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(t,"maxLookahead")?t.maxLookahead:ft.maxLookahead,this.lookaheadStrategy=Object.hasOwn(t,"lookaheadStrategy")?t.lookaheadStrategy:new Nn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(t){t.forEach(n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{let{alternation:r,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:l}=RP(n);r.forEach(c=>{let u=c.idx===0?"":c.idx;this.TRACE_INIT(`${wt(c)}${u}`,()=>{let f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:n,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[n.name],256|c.idx,f)})}),i.forEach(c=>{this.computeLookaheadFunc(n,c.idx,768,"Repetition",c.maxLookahead,wt(c))}),o.forEach(c=>{this.computeLookaheadFunc(n,c.idx,512,"Option",c.maxLookahead,wt(c))}),s.forEach(c=>{this.computeLookaheadFunc(n,c.idx,1024,"RepetitionMandatory",c.maxLookahead,wt(c))}),a.forEach(c=>{this.computeLookaheadFunc(n,c.idx,1536,"RepetitionMandatoryWithSeparator",c.maxLookahead,wt(c))}),l.forEach(c=>{this.computeLookaheadFunc(n,c.idx,1280,"RepetitionWithSeparator",c.maxLookahead,wt(c))})})})}computeLookaheadFunc(t,n,r,i,o,s){this.TRACE_INIT(`${s}${n===0?"":n}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:t,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i});this.setLaFuncCache(this.fullRuleNameToShort[t.name],r|n,a)})}setLaFuncCache(t,n,r){let i=this.lookAheadFuncsCache[t];i===void 0&&(i=[],this.lookAheadFuncsCache[t]=i),i[n]=r}},Xh=class extends ct{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(t){this.dslMethods.option.push(t)}visitRepetitionWithSeparator(t){this.dslMethods.repetitionWithSeparator.push(t)}visitRepetitionMandatory(t){this.dslMethods.repetitionMandatory.push(t)}visitRepetitionMandatoryWithSeparator(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)}visitRepetition(t){this.dslMethods.repetition.push(t)}visitAlternation(t){this.dslMethods.alternation.push(t)}},zc=new Xh;function RP(e){zc.reset(),e.accept(zc);let t=zc.dslMethods;return zc.reset(),t}function Hh(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset)}function zh(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function fT(e,t,n){e.children[n]===void 0?e.children[n]=[t]:e.children[n].push(t)}function dT(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)}var SP="name";function jh(e,t){Object.defineProperty(e,SP,{enumerable:!1,configurable:!0,writable:!1,value:t})}function bP(e,t){let n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let o=n[i],s=e[o],a=s.length;for(let l=0;l<a;l++){let c=s[l];c.tokenTypeIdx===void 0&&this[c.name](c.children,t)}}}function pT(e,t){let n=function(){};jh(n,e+"BaseSemantics");let r={visit:function(i,o){if(Array.isArray(i)&&(i=i[0]),i!==void 0)return this[i.name](i.children,o)},validateVisitor:function(){let i=NP(this,t);if(i.length!==0){let o=i.map(s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
90
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let t;return e.topLevelRule instanceof lt?t=e.topLevelRule.name:t=e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Gw(e,t){let n=new Oh(e,t);return n.resolveRefs(),n.errors}var Oh=class extends ct{constructor(t,n){super(),this.nameToTopRule=t,this.errMsgProvider=n,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(t=>{this.currTopLevel=t,t.accept(this)})}visitNonTerminal(t){let n=this.nameToTopRule[t.nonTerminalName];if(n)t.referencedRule=n;else{let r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:r,type:Ye.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}}};var Ch=class extends An{constructor(t,n){super(),this.topProd=t,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(t,n=[]){this.found||super.walk(t,n)}walkProdRef(t,n,r){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){let i=n.concat(r);this.updateExpectedNext(),this.walk(t.referencedRule,i)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Fc=class extends Ch{constructor(t,n){super(t,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(t,n,r){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){let i=n.concat(r),o=new be({definition:i});this.possibleTokTypes=ni(o),this.found=!0}}},po=class extends An{constructor(t,n){super(),this.topRule=t,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Bc=class extends po{walkMany(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(t,n,r)}},da=class extends po{walkManySep(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(t,n,r)}},Wc=class extends po{walkAtLeastOne(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(t,n,r)}},pa=class extends po{walkAtLeastOneSep(t,n,r){if(t.idx===this.occurrence){let i=n.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(t,n,r)}};function Xc(e,t,n=[]){n=[...n];let r=[],i=0;function o(a){return a.concat(e.slice(i+1))}function s(a){let l=Xc(o(a),t,n);return r.concat(l)}for(;n.length<t&&i<e.length;){let a=e[i];if(a instanceof be)return s(a.definition);if(a instanceof Ee)return s(a.definition);if(a instanceof we)r=s(a.definition);else if(a instanceof Ne){let l=a.definition.concat([new ge({definition:a.definition})]);return s(l)}else if(a instanceof Le){let l=[new be({definition:a.definition}),new ge({definition:[new ue({terminalType:a.separator})].concat(a.definition)})];return s(l)}else if(a instanceof ke){let l=a.definition.concat([new ge({definition:[new ue({terminalType:a.separator})].concat(a.definition)})]);r=s(l)}else if(a instanceof ge){let l=a.definition.concat([new ge({definition:a.definition})]);r=s(l)}else{if(a instanceof Ie)return a.definition.forEach(l=>{l.definition.length!==0&&(r=s(l.definition))}),r;if(a instanceof ue)n.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:e.slice(i)}),r}function Hw(e,t,n,r){let i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",a=!1,l=t.length,c=l-r-1,u=[],f=[];for(f.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});f.length!==0;){let d=f.pop();if(d===s){a&&f.at(-1).idx<=c&&f.pop();continue}let p=d.def,m=d.idx,g=d.ruleStack,E=d.occurrenceStack;if(p.length===0)continue;let x=p[0];if(x===i){let y={idx:m,def:p.slice(1),ruleStack:g.slice(0,-1),occurrenceStack:E.slice(0,-1)};f.push(y)}else if(x instanceof ue)if(m<l-1){let y=m+1,w=t[y];if(n(w,x.terminalType)){let _={idx:y,def:p.slice(1),ruleStack:g,occurrenceStack:E};f.push(_)}}else if(m===l-1)u.push({nextTokenType:x.terminalType,nextTokenOccurrence:x.idx,ruleStack:g,occurrenceStack:E}),a=!0;else throw Error("non exhaustive match");else if(x instanceof Ee){let y=[...g];y.push(x.nonTerminalName);let w=[...E];w.push(x.idx);let _={idx:m,def:x.definition.concat(o,p.slice(1)),ruleStack:y,occurrenceStack:w};f.push(_)}else if(x instanceof we){let y={idx:m,def:p.slice(1),ruleStack:g,occurrenceStack:E};f.push(y),f.push(s);let w={idx:m,def:x.definition.concat(p.slice(1)),ruleStack:g,occurrenceStack:E};f.push(w)}else if(x instanceof Ne){let y=new ge({definition:x.definition,idx:x.idx}),w=x.definition.concat([y],p.slice(1)),_={idx:m,def:w,ruleStack:g,occurrenceStack:E};f.push(_)}else if(x instanceof Le){let y=new ue({terminalType:x.separator}),w=new ge({definition:[y].concat(x.definition),idx:x.idx}),_=x.definition.concat([w],p.slice(1)),v={idx:m,def:_,ruleStack:g,occurrenceStack:E};f.push(v)}else if(x instanceof ke){let y={idx:m,def:p.slice(1),ruleStack:g,occurrenceStack:E};f.push(y),f.push(s);let w=new ue({terminalType:x.separator}),_=new ge({definition:[w].concat(x.definition),idx:x.idx}),v=x.definition.concat([_],p.slice(1)),R={idx:m,def:v,ruleStack:g,occurrenceStack:E};f.push(R)}else if(x instanceof ge){let y={idx:m,def:p.slice(1),ruleStack:g,occurrenceStack:E};f.push(y),f.push(s);let w=new ge({definition:x.definition,idx:x.idx}),_=x.definition.concat([w],p.slice(1)),v={idx:m,def:_,ruleStack:g,occurrenceStack:E};f.push(v)}else if(x instanceof Ie)for(let y=x.definition.length-1;y>=0;y--){let w=x.definition[y],_={idx:m,def:w.definition.concat(p.slice(1)),ruleStack:g,occurrenceStack:E};f.push(_),f.push(s)}else if(x instanceof be)f.push({idx:m,def:x.definition.concat(p.slice(1)),ruleStack:g,occurrenceStack:E});else if(x instanceof lt)f.push(EP(x,m,g,E));else throw Error("non exhaustive match")}return u}function EP(e,t,n,r){let i=[...n];i.push(e.name);let o=[...r];return o.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:o}}var Fe;(function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"})(Fe||(Fe={}));function ha(e){if(e instanceof we||e==="Option")return Fe.OPTION;if(e instanceof ge||e==="Repetition")return Fe.REPETITION;if(e instanceof Ne||e==="RepetitionMandatory")return Fe.REPETITION_MANDATORY;if(e instanceof Le||e==="RepetitionMandatoryWithSeparator")return Fe.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof ke||e==="RepetitionWithSeparator")return Fe.REPETITION_WITH_SEPARATOR;if(e instanceof Ie||e==="Alternation")return Fe.ALTERNATION;throw Error("non exhaustive match")}function Gc(e){let{occurrence:t,rule:n,prodType:r,maxLookahead:i}=e,o=ha(r);return o===Fe.ALTERNATION?ho(t,n,i):mo(t,n,o,i)}function jw(e,t,n,r,i,o){let s=ho(e,t,n),a=Jw(s)?co:kn;return o(s,r,a,i)}function Yw(e,t,n,r,i,o){let s=mo(e,t,i,n),a=Jw(s)?co:kn;return o(s[0],a,r)}function Vw(e,t,n,r){let i=e.length,o=e.every(s=>s.every(a=>a.length===1));if(t)return function(s){let a=s.map(l=>l.GATE);for(let l=0;l<i;l++){let c=e[l],u=c.length,f=a[l];if(!(f!==void 0&&f.call(this)===!1))e:for(let d=0;d<u;d++){let p=c[d],m=p.length;for(let g=0;g<m;g++){let E=this.LA_FAST(g+1);if(n(E,p[g])===!1)continue e}return l}}};if(o&&!r){let a=e.map(l=>l.flat()).reduce((l,c,u)=>(c.forEach(f=>{f.tokenTypeIdx in l||(l[f.tokenTypeIdx]=u),f.categoryMatches.forEach(d=>{Object.hasOwn(l,d)||(l[d]=u)})}),l),{});return function(){let l=this.LA_FAST(1);return a[l.tokenTypeIdx]}}else return function(){for(let s=0;s<i;s++){let a=e[s],l=a.length;e:for(let c=0;c<l;c++){let u=a[c],f=u.length;for(let d=0;d<f;d++){let p=this.LA_FAST(d+1);if(n(p,u[d])===!1)continue e}return s}}}}function Kw(e,t,n){let r=e.every(o=>o.length===1),i=e.length;if(r&&!n){let o=e.flat();if(o.length===1&&o[0].categoryMatches.length===0){let a=o[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===a}}else{let s=o.reduce((a,l,c)=>(a[l.tokenTypeIdx]=!0,l.categoryMatches.forEach(u=>{a[u]=!0}),a),[]);return function(){let a=this.LA_FAST(1);return s[a.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let s=e[o],a=s.length;for(let l=0;l<a;l++){let c=this.LA_FAST(l+1);if(t(c,s[l])===!1)continue e}return!0}return!1}}var Dh=class extends An{constructor(t,n,r){super(),this.topProd=t,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(t,n,r,i){return t.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(t,n,r){this.checkIsTarget(t,Fe.OPTION,n,r)||super.walkOption(t,n,r)}walkAtLeastOne(t,n,r){this.checkIsTarget(t,Fe.REPETITION_MANDATORY,n,r)||super.walkOption(t,n,r)}walkAtLeastOneSep(t,n,r){this.checkIsTarget(t,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(t,n,r)}walkMany(t,n,r){this.checkIsTarget(t,Fe.REPETITION,n,r)||super.walkOption(t,n,r)}walkManySep(t,n,r){this.checkIsTarget(t,Fe.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(t,n,r)}},Uc=class extends ct{constructor(t,n,r){super(),this.targetOccurrence=t,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(t,n){t.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||t===this.targetRef)&&(this.result=t.definition)}visitOption(t){this.checkIsTarget(t,Fe.OPTION)}visitRepetition(t){this.checkIsTarget(t,Fe.REPETITION)}visitRepetitionMandatory(t){this.checkIsTarget(t,Fe.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(t){this.checkIsTarget(t,Fe.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(t){this.checkIsTarget(t,Fe.REPETITION_WITH_SEPARATOR)}visitAlternation(t){this.checkIsTarget(t,Fe.ALTERNATION)}};function zw(e){let t=new Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function $h(e){let t=[""];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let o=0;o<t.length;o++){let s=t[o];i.push(s+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){let l="_"+r.categoryMatches[a];i.push(s+l)}}t=i}return t}function wP(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let o=0;o<t.length;o++){let s=t[o];if(i[s]===!0)return!1}}return!0}function qw(e,t){let n=e.map(s=>Xc([s],1)),r=zw(n.length),i=n.map(s=>{let a={};return s.forEach(l=>{$h(l.partialPath).forEach(u=>{a[u]=!0})}),a}),o=n;for(let s=1;s<=t;s++){let a=o;o=zw(a.length);for(let l=0;l<a.length;l++){let c=a[l];for(let u=0;u<c.length;u++){let f=c[u].partialPath,d=c[u].suffixDef,p=$h(f);if(wP(i,p,l)||d.length===0||f.length===t){let g=r[l];if(Hc(g,f)===!1){g.push(f);for(let E=0;E<p.length;E++){let x=p[E];i[l][x]=!0}}}else{let g=Xc(d,s+1,f);o[l]=o[l].concat(g),g.forEach(E=>{$h(E.partialPath).forEach(y=>{i[l][y]=!0})})}}}}return r}function ho(e,t,n,r){let i=new Uc(e,Fe.ALTERNATION,r);return t.accept(i),qw(i.result,n)}function mo(e,t,n,r){let i=new Uc(e,n);t.accept(i);let o=i.result,a=new Dh(t,e,n).startWalking(),l=new be({definition:o}),c=new be({definition:a});return qw([l,c],r)}function Hc(e,t){e:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let i=0;i<r.length;i++){let o=t[i],s=r[i];if((o===s||s.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function Zw(e,t){return e.length<t.length&&e.every((n,r)=>{let i=t[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function Jw(e){return e.every(t=>t.every(n=>n.every(r=>r.categoryMatches.length===0)))}function Qw(e){return e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(n=>Object.assign({type:Ye.CUSTOM_LOOKAHEAD_VALIDATION},n))}function eT(e,t,n,r){let i=e.flatMap(l=>TP(l,n)),o=RP(e,t,n),s=e.flatMap(l=>AP(l,n)),a=e.flatMap(l=>_P(l,e,r,n));return i.concat(o,s,a)}function TP(e,t){let n=new Mh;e.accept(n);let r=n.allProductions,i=Object.groupBy(r,vP),o=Object.fromEntries(Object.entries(i).filter(([a,l])=>l.length>1));return Object.values(o).map(a=>{let l=a[0],c=t.buildDuplicateFoundError(e,a),u=wt(l),f={message:c,type:Ye.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:u,occurrence:l.idx},d=tT(l);return d&&(f.parameter=d),f})}function vP(e){return`${wt(e)}_#_${e.idx}_#_${tT(e)}`}function tT(e){return e instanceof ue?e.terminalType.name:e instanceof Ee?e.nonTerminalName:""}var Mh=class extends ct{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(t){this.allProductions.push(t)}visitOption(t){this.allProductions.push(t)}visitRepetitionWithSeparator(t){this.allProductions.push(t)}visitRepetitionMandatory(t){this.allProductions.push(t)}visitRepetitionMandatoryWithSeparator(t){this.allProductions.push(t)}visitRepetition(t){this.allProductions.push(t)}visitAlternation(t){this.allProductions.push(t)}visitTerminal(t){this.allProductions.push(t)}};function _P(e,t,n,r){let i=[];if(t.reduce((s,a)=>a.name===e.name?s+1:s,0)>1){let s=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:s,type:Ye.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function nT(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Ye.INVALID_RULE_OVERRIDE,ruleName:e})),r}function Bh(e,t,n,r=[]){let i=[],o=zc(t.definition);if(o.length===0)return[];{let s=e.name;o.includes(e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:Ye.LEFT_RECURSION,ruleName:s});let l=r.concat([e]),u=o.filter(f=>!l.includes(f)).flatMap(f=>{let d=[...r];return d.push(f),Bh(e,f,n,d)});return i.concat(u)}}function zc(e){let t=[];if(e.length===0)return t;let n=e[0];if(n instanceof Ee)t.push(n.referencedRule);else if(n instanceof be||n instanceof we||n instanceof Ne||n instanceof Le||n instanceof ke||n instanceof ge)t=t.concat(zc(n.definition));else if(n instanceof Ie)t=n.definition.map(o=>zc(o.definition)).flat();else if(!(n instanceof ue))throw Error("non exhaustive match");let r=ti(n),i=e.length>1;if(r&&i){let o=e.slice(1);return t.concat(zc(o))}else return t}var ma=class extends ct{constructor(){super(...arguments),this.alternations=[]}visitAlternation(t){this.alternations.push(t)}};function rT(e,t){let n=new ma;return e.accept(n),n.alternations.flatMap(o=>o.definition.slice(0,-1).flatMap((a,l)=>Hw([a],[],kn,1).length===0?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:o,emptyChoiceIdx:l}),type:Ye.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:o.idx,alternative:l+1}]:[]))}function iT(e,t,n){let r=new ma;e.accept(r);let i=r.alternations;return i=i.filter(s=>s.ignoreAmbiguities!==!0),i.flatMap(s=>{let a=s.idx,l=s.maxLookahead||t,c=ho(a,e,l,s),u=kP(c,s,e,n),f=IP(c,s,e,n);return u.concat(f)})}var Fh=class extends ct{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(t){this.allProductions.push(t)}visitRepetitionMandatory(t){this.allProductions.push(t)}visitRepetitionMandatoryWithSeparator(t){this.allProductions.push(t)}visitRepetition(t){this.allProductions.push(t)}};function AP(e,t){let n=new ma;return e.accept(n),n.alternations.flatMap(o=>o.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:o}),type:Ye.TOO_MANY_ALTS,ruleName:e.name,occurrence:o.idx}]:[])}function oT(e,t,n){let r=[];return e.forEach(i=>{let o=new Fh;i.accept(o),o.allProductions.forEach(a=>{let l=ha(a),c=a.maxLookahead||t,u=a.idx;if(mo(u,i,l,c)[0].flat().length===0){let p=n.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:p,type:Ye.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function kP(e,t,n,r){let i=[];return e.reduce((a,l,c)=>(t.definition[c].ignoreAmbiguities===!0||l.forEach(u=>{let f=[c];e.forEach((d,p)=>{c!==p&&Hc(d,u)&&t.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!Hc(i,u)&&(i.push(u),a.push({alts:f,path:u}))}),a),[]).map(a=>{let l=a.alts.map(u=>u+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:l,prefixPath:a.path}),type:Ye.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:a.alts}})}function IP(e,t,n,r){let i=e.reduce((s,a,l)=>{let c=a.map(u=>({idx:l,path:u}));return s.concat(c)},[]);return i.flatMap(s=>{if(t.definition[s.idx].ignoreAmbiguities===!0)return[];let l=s.idx,c=s.path;return i.filter(d=>t.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<l&&Zw(d.path,c)).map(d=>{let p=[d.idx+1,l+1],m=t.idx===0?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:p,prefixPath:d.path}),type:Ye.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:m,alternatives:p}})})}function RP(e,t,n){let r=[],i=t.map(o=>o.name);return e.forEach(o=>{let s=o.name;if(i.includes(s)){let a=n.buildNamespaceConflictError(o);r.push({message:a,type:Ye.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),r}function sT(e){let t=Object.assign({errMsgProvider:Uw},e),n={};return e.rules.forEach(r=>{n[r.name]=r}),Gw(n,t.errMsgProvider)}function aT(e){var t;let n=(t=e.errMsgProvider)!==null&&t!==void 0?t:Vt;return eT(e.rules,e.tokenTypes,n,e.grammarName)}var lT="MismatchedTokenException",cT="NoViableAltException",uT="EarlyExitException",fT="NotAllInputParsedException",dT=[lT,cT,uT,fT];Object.freeze(dT);function ur(e){return dT.includes(e.name)}var go=class extends Error{constructor(t,n){super(t),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},oi=class extends go{constructor(t,n,r){super(t,n),this.previousToken=r,this.name=lT}},ga=class extends go{constructor(t,n,r){super(t,n),this.previousToken=r,this.name=cT}},ya=class extends go{constructor(t,n){super(t,n),this.name=fT}},xa=class extends go{constructor(t,n,r){super(t,n),this.previousToken=r,this.name=uT}};var Wh={},Uh="InRuleRecoveryException",Xh=class extends Error{constructor(t){super(t),this.name=Uh}},jc=class{initRecoverable(t){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(t,"recoveryEnabled")?t.recoveryEnabled:ft.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=SP)}getTokenToInsert(t){let n=Sn(t,"",-1,-1,-1,-1,-1,-1);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(t){return!0}canTokenTypeBeDeletedInRecovery(t){return!0}tryInRepetitionRecovery(t,n,r,i){let o=this.findReSyncTokenType(),s=this.exportLexerState(),a=[],l=!1,c=this.LA_FAST(1),u=this.LA_FAST(1),f=()=>{let d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:d,ruleName:this.getCurrRuleFullName()}),m=new oi(p,c,this.LA(0));m.resyncedTokens=a.slice(0,-1),this.SAVE_ERROR(m)};for(;!l;)if(this.tokenMatcher(u,i)){f();return}else if(r.call(this)){f(),t.apply(this,n);return}else this.tokenMatcher(u,o)?l=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,a));this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(t,n,r){return!(r===!1||this.tokenMatcher(this.LA_FAST(1),t)||this.isBackTracking()||this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,n)))}getNextPossibleTokenTypes(t){let n=t.ruleStack[0],i=this.getGAstProductions()[n];return new Fc(i,t).startWalking()}getFollowsForInRuleRecovery(t,n){let r=this.getCurrentGrammarPath(t,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(t,n){if(this.canRecoverWithSingleTokenInsertion(t,n))return this.getTokenToInsert(t);if(this.canRecoverWithSingleTokenDeletion(t)){let r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new Xh("sad sad panda")}canPerformInRuleRecovery(t,n){return this.canRecoverWithSingleTokenInsertion(t,n)||this.canRecoverWithSingleTokenDeletion(t)}canRecoverWithSingleTokenInsertion(t,n){if(!this.canTokenTypeBeInsertedInRecovery(t)||n.length===0)return!1;let r=this.LA_FAST(1);return n.find(o=>this.tokenMatcher(r,o))!==void 0}canRecoverWithSingleTokenDeletion(t){return this.canTokenTypeBeDeletedInRecovery(t)?this.tokenMatcher(this.LA(2),t):!1}isInCurrentRuleReSyncSet(t){let n=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(n).includes(t)}findReSyncTokenType(){let t=this.flattenFollowSet(),n=this.LA_FAST(1),r=2;for(;;){let i=t.find(o=>fo(n,o));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return Wh;let t=this.currRuleShortName,n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){let t=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK,r=this.RULE_STACK_IDX+1,i=new Array(r);for(let o=0;o<r;o++)o===0?i[o]=Wh:i[o]={ruleName:this.shortRuleNameToFullName(t[o]),idxInCallingRule:n[o],inRule:this.shortRuleNameToFullName(t[o-1])};return i}flattenFollowSet(){return this.buildFullFollowKeyStack().map(n=>this.getFollowSetFromFollowKey(n)).flat()}getFollowSetFromFollowKey(t){if(t===Wh)return[ut];let n=t.ruleName+t.idxInCallingRule+bc+t.inRule;return this.resyncFollows[n]}addToResyncTokens(t,n){return this.tokenMatcher(t,ut)||n.push(t),n}reSyncTo(t){let n=[],r=this.LA_FAST(1);for(;this.tokenMatcher(r,t)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return n.slice(0,-1)}attemptInRepetitionRecovery(t,n,r,i,o,s,a){}getCurrentGrammarPath(t,n){let r=this.getHumanReadableRuleStack(),i=this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1);return{ruleStack:r,occurrenceStack:i,lastTok:t,lastTokOccurrence:n}}getHumanReadableRuleStack(){let t=this.RULE_STACK_IDX+1,n=new Array(t);for(let r=0;r<t;r++)n[r]=this.shortRuleNameToFullName(this.RULE_STACK[r]);return n}};function SP(e,t,n,r,i,o,s){var a,l,c;let u=r|i,f=(a=(l=this.firstAfterRepMap)[c=this.currRuleShortName])!==null&&a!==void 0?a:l[c]=[],d=f[u];if(d===void 0){let E=this.getCurrRuleFullName(),x=this.getGAstProductions()[E];d=new o(x,i).startWalking(),f[u]=d}let p=d.token,m=d.occurrence,g=d.isEndOfRule;this.RULE_STACK_IDX===0&&g&&p===void 0&&(p=ut,m=1),!(p===void 0||m===void 0)&&this.shouldInRepetitionRecoveryBeTried(p,m,s)&&this.tryInRepetitionRecovery(e,t,n,p)}var Nn=class{constructor(t){var n;this.maxLookahead=(n=t?.maxLookahead)!==null&&n!==void 0?n:ft.maxLookahead}validate(t){let n=this.validateNoLeftRecursion(t.rules);if(n.length===0){let r=this.validateEmptyOrAlternatives(t.rules),i=this.validateAmbiguousAlternationAlternatives(t.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(t.rules,this.maxLookahead);return[...n,...r,...i,...o]}return n}validateNoLeftRecursion(t){return t.flatMap(n=>Bh(n,n,Vt))}validateEmptyOrAlternatives(t){return t.flatMap(n=>rT(n,Vt))}validateAmbiguousAlternationAlternatives(t,n){return t.flatMap(r=>iT(r,n,Vt))}validateSomeNonEmptyLookaheadPath(t,n){return oT(t,n,Vt)}buildLookaheadForAlternation(t){return jw(t.prodOccurrence,t.rule,t.maxLookahead,t.hasPredicates,t.dynamicTokensEnabled,Vw)}buildLookaheadForOptional(t){return Yw(t.prodOccurrence,t.rule,t.maxLookahead,t.dynamicTokensEnabled,ha(t.prodType),Kw)}};var Vc=class{initLooksAhead(t){this.dynamicTokensEnabled=Object.hasOwn(t,"dynamicTokensEnabled")?t.dynamicTokensEnabled:ft.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(t,"maxLookahead")?t.maxLookahead:ft.maxLookahead,this.lookaheadStrategy=Object.hasOwn(t,"lookaheadStrategy")?t.lookaheadStrategy:new Nn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(t){t.forEach(n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{let{alternation:r,repetition:i,option:o,repetitionMandatory:s,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:l}=bP(n);r.forEach(c=>{let u=c.idx===0?"":c.idx;this.TRACE_INIT(`${wt(c)}${u}`,()=>{let f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:n,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[n.name],256|c.idx,f)})}),i.forEach(c=>{this.computeLookaheadFunc(n,c.idx,768,"Repetition",c.maxLookahead,wt(c))}),o.forEach(c=>{this.computeLookaheadFunc(n,c.idx,512,"Option",c.maxLookahead,wt(c))}),s.forEach(c=>{this.computeLookaheadFunc(n,c.idx,1024,"RepetitionMandatory",c.maxLookahead,wt(c))}),a.forEach(c=>{this.computeLookaheadFunc(n,c.idx,1536,"RepetitionMandatoryWithSeparator",c.maxLookahead,wt(c))}),l.forEach(c=>{this.computeLookaheadFunc(n,c.idx,1280,"RepetitionWithSeparator",c.maxLookahead,wt(c))})})})}computeLookaheadFunc(t,n,r,i,o,s){this.TRACE_INIT(`${s}${n===0?"":n}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:t,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i});this.setLaFuncCache(this.fullRuleNameToShort[t.name],r|n,a)})}setLaFuncCache(t,n,r){let i=this.lookAheadFuncsCache[t];i===void 0&&(i=[],this.lookAheadFuncsCache[t]=i),i[n]=r}},Gh=class extends ct{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(t){this.dslMethods.option.push(t)}visitRepetitionWithSeparator(t){this.dslMethods.repetitionWithSeparator.push(t)}visitRepetitionMandatory(t){this.dslMethods.repetitionMandatory.push(t)}visitRepetitionMandatoryWithSeparator(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)}visitRepetition(t){this.dslMethods.repetition.push(t)}visitAlternation(t){this.dslMethods.alternation.push(t)}},Yc=new Gh;function bP(e){Yc.reset(),e.accept(Yc);let t=Yc.dslMethods;return Yc.reset(),t}function jh(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset)}function Yh(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function pT(e,t,n){e.children[n]===void 0?e.children[n]=[t]:e.children[n].push(t)}function hT(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)}var NP="name";function Vh(e,t){Object.defineProperty(e,NP,{enumerable:!1,configurable:!0,writable:!1,value:t})}function LP(e,t){let n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let o=n[i],s=e[o],a=s.length;for(let l=0;l<a;l++){let c=s[l];c.tokenTypeIdx===void 0&&this[c.name](c.children,t)}}}function mT(e,t){let n=function(){};Vh(n,e+"BaseSemantics");let r={visit:function(i,o){if(Array.isArray(i)&&(i=i[0]),i!==void 0)return this[i.name](i.children,o)},validateVisitor:function(){let i=PP(this,t);if(i.length!==0){let o=i.map(s=>s.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
91
91
  ${o.join(`
92
92
 
93
93
  `).replace(/\n/g,`
94
- `)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=t,n}function hT(e,t,n){let r=function(){};jh(r,e+"BaseSemanticsWithDefaults");let i=Object.create(n.prototype);return t.forEach(o=>{i[o]=bP}),r.prototype=i,r.prototype.constructor=r,r}var Yh;(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(Yh||(Yh={}));function NP(e,t){return LP(e,t)}function LP(e,t){return t.filter(i=>typeof e[i]!="function").map(i=>({msg:`Missing visitor method: <${i}> on ${e.constructor.name} CST Visitor.`,type:Yh.MISSING_METHOD,methodName:i})).filter(Boolean)}var qc=class{initTreeBuilder(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=Object.hasOwn(t,"nodeLocationTracking")?t.nodeLocationTracking:ft.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zh,this.setNodeLocationFromNode=zh,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Hh,this.setNodeLocationFromNode=Hh,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${t.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(t){t.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(t){t.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(t){t.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(t){let n=this.LA_FAST(1);t.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(t){let n={name:t,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(t){let n=this.LA(0),r=t.location;r.startOffset!==-1&&r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=-1,r.startLine=-1,r.startColumn=-1)}cstPostRuleOnlyOffset(t){let n=this.LA(0),r=t.location;r.startOffset!==-1&&r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=-1}cstPostTerminal(t,n){let r=this.CST_STACK[this.CST_STACK.length-1];fT(r,n,t),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(t,n){let r=this.CST_STACK[this.CST_STACK.length-1];dT(r,n,t),this.setNodeLocationFromNode(r.location,t.location)}get currCSTNode(){let t=this;return t.CST_STACK[t.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let t=pT(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=t,t}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let t=hT(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=t,t}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}};var Zc=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(t){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=t,this.tokVectorLength=t.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):Ln}LA_FAST(t){let n=this.currIdx+t;return this.tokVector[n]}LA(t){let n=this.currIdx+t;return n<0||this.tokVectorLength<=n?Ln:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(t){this.currIdx=t}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}};var Jc=class{ACTION(t){return t.call(this)}consume(t,n,r){return this.consumeInternal(n,t,r)}subrule(t,n,r){return this.subruleInternal(n,t,r)}option(t,n){return this.optionInternal(n,t)}or(t,n){return this.orInternal(n,t)}many(t,n){return this.manyInternal(t,n)}atLeastOne(t,n){return this.atLeastOneInternal(t,n)}CONSUME(t,n){return this.consumeInternal(t,0,n)}CONSUME1(t,n){return this.consumeInternal(t,1,n)}CONSUME2(t,n){return this.consumeInternal(t,2,n)}CONSUME3(t,n){return this.consumeInternal(t,3,n)}CONSUME4(t,n){return this.consumeInternal(t,4,n)}CONSUME5(t,n){return this.consumeInternal(t,5,n)}CONSUME6(t,n){return this.consumeInternal(t,6,n)}CONSUME7(t,n){return this.consumeInternal(t,7,n)}CONSUME8(t,n){return this.consumeInternal(t,8,n)}CONSUME9(t,n){return this.consumeInternal(t,9,n)}SUBRULE(t,n){return this.subruleInternal(t,0,n)}SUBRULE1(t,n){return this.subruleInternal(t,1,n)}SUBRULE2(t,n){return this.subruleInternal(t,2,n)}SUBRULE3(t,n){return this.subruleInternal(t,3,n)}SUBRULE4(t,n){return this.subruleInternal(t,4,n)}SUBRULE5(t,n){return this.subruleInternal(t,5,n)}SUBRULE6(t,n){return this.subruleInternal(t,6,n)}SUBRULE7(t,n){return this.subruleInternal(t,7,n)}SUBRULE8(t,n){return this.subruleInternal(t,8,n)}SUBRULE9(t,n){return this.subruleInternal(t,9,n)}OPTION(t){return this.optionInternal(t,0)}OPTION1(t){return this.optionInternal(t,1)}OPTION2(t){return this.optionInternal(t,2)}OPTION3(t){return this.optionInternal(t,3)}OPTION4(t){return this.optionInternal(t,4)}OPTION5(t){return this.optionInternal(t,5)}OPTION6(t){return this.optionInternal(t,6)}OPTION7(t){return this.optionInternal(t,7)}OPTION8(t){return this.optionInternal(t,8)}OPTION9(t){return this.optionInternal(t,9)}OR(t){return this.orInternal(t,0)}OR1(t){return this.orInternal(t,1)}OR2(t){return this.orInternal(t,2)}OR3(t){return this.orInternal(t,3)}OR4(t){return this.orInternal(t,4)}OR5(t){return this.orInternal(t,5)}OR6(t){return this.orInternal(t,6)}OR7(t){return this.orInternal(t,7)}OR8(t){return this.orInternal(t,8)}OR9(t){return this.orInternal(t,9)}MANY(t){this.manyInternal(0,t)}MANY1(t){this.manyInternal(1,t)}MANY2(t){this.manyInternal(2,t)}MANY3(t){this.manyInternal(3,t)}MANY4(t){this.manyInternal(4,t)}MANY5(t){this.manyInternal(5,t)}MANY6(t){this.manyInternal(6,t)}MANY7(t){this.manyInternal(7,t)}MANY8(t){this.manyInternal(8,t)}MANY9(t){this.manyInternal(9,t)}MANY_SEP(t){this.manySepFirstInternal(0,t)}MANY_SEP1(t){this.manySepFirstInternal(1,t)}MANY_SEP2(t){this.manySepFirstInternal(2,t)}MANY_SEP3(t){this.manySepFirstInternal(3,t)}MANY_SEP4(t){this.manySepFirstInternal(4,t)}MANY_SEP5(t){this.manySepFirstInternal(5,t)}MANY_SEP6(t){this.manySepFirstInternal(6,t)}MANY_SEP7(t){this.manySepFirstInternal(7,t)}MANY_SEP8(t){this.manySepFirstInternal(8,t)}MANY_SEP9(t){this.manySepFirstInternal(9,t)}AT_LEAST_ONE(t){this.atLeastOneInternal(0,t)}AT_LEAST_ONE1(t){return this.atLeastOneInternal(1,t)}AT_LEAST_ONE2(t){this.atLeastOneInternal(2,t)}AT_LEAST_ONE3(t){this.atLeastOneInternal(3,t)}AT_LEAST_ONE4(t){this.atLeastOneInternal(4,t)}AT_LEAST_ONE5(t){this.atLeastOneInternal(5,t)}AT_LEAST_ONE6(t){this.atLeastOneInternal(6,t)}AT_LEAST_ONE7(t){this.atLeastOneInternal(7,t)}AT_LEAST_ONE8(t){this.atLeastOneInternal(8,t)}AT_LEAST_ONE9(t){this.atLeastOneInternal(9,t)}AT_LEAST_ONE_SEP(t){this.atLeastOneSepFirstInternal(0,t)}AT_LEAST_ONE_SEP1(t){this.atLeastOneSepFirstInternal(1,t)}AT_LEAST_ONE_SEP2(t){this.atLeastOneSepFirstInternal(2,t)}AT_LEAST_ONE_SEP3(t){this.atLeastOneSepFirstInternal(3,t)}AT_LEAST_ONE_SEP4(t){this.atLeastOneSepFirstInternal(4,t)}AT_LEAST_ONE_SEP5(t){this.atLeastOneSepFirstInternal(5,t)}AT_LEAST_ONE_SEP6(t){this.atLeastOneSepFirstInternal(6,t)}AT_LEAST_ONE_SEP7(t){this.atLeastOneSepFirstInternal(7,t)}AT_LEAST_ONE_SEP8(t){this.atLeastOneSepFirstInternal(8,t)}AT_LEAST_ONE_SEP9(t){this.atLeastOneSepFirstInternal(9,t)}RULE(t,n,r=go){if(this.definedRulesNames.includes(t)){let s={message:Vt.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:Ye.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(s)}this.definedRulesNames.push(t);let i=this.defineRule(t,n,r);return this[t]=i,i}OVERRIDE_RULE(t,n,r=go){let i=eT(t,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let o=this.defineRule(t,n,r);return this[t]=o,o}BACKTRACK(t,n){var r;let i=(r=t.coreRule)!==null&&r!==void 0?r:t;return function(){this.isBackTrackingStack.push(1);let o=this.saveRecogState();try{return i.apply(this,n),!0}catch(s){if(ur(s))return!1;throw s}finally{this.reloadRecogState(o),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Ic(Object.values(this.gastProductionsCache))}};var Qc=class{initRecognizerEngine(t,n){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=lo,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
94
+ `)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=t,n}function gT(e,t,n){let r=function(){};Vh(r,e+"BaseSemanticsWithDefaults");let i=Object.create(n.prototype);return t.forEach(o=>{i[o]=LP}),r.prototype=i,r.prototype.constructor=r,r}var Kh;(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(Kh||(Kh={}));function PP(e,t){return OP(e,t)}function OP(e,t){return t.filter(i=>typeof e[i]!="function").map(i=>({msg:`Missing visitor method: <${i}> on ${e.constructor.name} CST Visitor.`,type:Kh.MISSING_METHOD,methodName:i})).filter(Boolean)}var Jc=class{initTreeBuilder(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=Object.hasOwn(t,"nodeLocationTracking")?t.nodeLocationTracking:ft.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Yh,this.setNodeLocationFromNode=Yh,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=jh,this.setNodeLocationFromNode=jh,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${t.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(t){t.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(t){t.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(t){t.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(t){let n=this.LA_FAST(1);t.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(t){let n={name:t,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(t){let n=this.LA(0),r=t.location;r.startOffset!==-1&&r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=-1,r.startLine=-1,r.startColumn=-1)}cstPostRuleOnlyOffset(t){let n=this.LA(0),r=t.location;r.startOffset!==-1&&r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=-1}cstPostTerminal(t,n){let r=this.CST_STACK[this.CST_STACK.length-1];pT(r,n,t),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(t,n){let r=this.CST_STACK[this.CST_STACK.length-1];hT(r,n,t),this.setNodeLocationFromNode(r.location,t.location)}get currCSTNode(){let t=this;return t.CST_STACK[t.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let t=mT(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=t,t}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let t=gT(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=t,t}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}};var Qc=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(t){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=t,this.tokVectorLength=t.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):Ln}LA_FAST(t){let n=this.currIdx+t;return this.tokVector[n]}LA(t){let n=this.currIdx+t;return n<0||this.tokVectorLength<=n?Ln:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(t){this.currIdx=t}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}};var eu=class{ACTION(t){return t.call(this)}consume(t,n,r){return this.consumeInternal(n,t,r)}subrule(t,n,r){return this.subruleInternal(n,t,r)}option(t,n){return this.optionInternal(n,t)}or(t,n){return this.orInternal(n,t)}many(t,n){return this.manyInternal(t,n)}atLeastOne(t,n){return this.atLeastOneInternal(t,n)}CONSUME(t,n){return this.consumeInternal(t,0,n)}CONSUME1(t,n){return this.consumeInternal(t,1,n)}CONSUME2(t,n){return this.consumeInternal(t,2,n)}CONSUME3(t,n){return this.consumeInternal(t,3,n)}CONSUME4(t,n){return this.consumeInternal(t,4,n)}CONSUME5(t,n){return this.consumeInternal(t,5,n)}CONSUME6(t,n){return this.consumeInternal(t,6,n)}CONSUME7(t,n){return this.consumeInternal(t,7,n)}CONSUME8(t,n){return this.consumeInternal(t,8,n)}CONSUME9(t,n){return this.consumeInternal(t,9,n)}SUBRULE(t,n){return this.subruleInternal(t,0,n)}SUBRULE1(t,n){return this.subruleInternal(t,1,n)}SUBRULE2(t,n){return this.subruleInternal(t,2,n)}SUBRULE3(t,n){return this.subruleInternal(t,3,n)}SUBRULE4(t,n){return this.subruleInternal(t,4,n)}SUBRULE5(t,n){return this.subruleInternal(t,5,n)}SUBRULE6(t,n){return this.subruleInternal(t,6,n)}SUBRULE7(t,n){return this.subruleInternal(t,7,n)}SUBRULE8(t,n){return this.subruleInternal(t,8,n)}SUBRULE9(t,n){return this.subruleInternal(t,9,n)}OPTION(t){return this.optionInternal(t,0)}OPTION1(t){return this.optionInternal(t,1)}OPTION2(t){return this.optionInternal(t,2)}OPTION3(t){return this.optionInternal(t,3)}OPTION4(t){return this.optionInternal(t,4)}OPTION5(t){return this.optionInternal(t,5)}OPTION6(t){return this.optionInternal(t,6)}OPTION7(t){return this.optionInternal(t,7)}OPTION8(t){return this.optionInternal(t,8)}OPTION9(t){return this.optionInternal(t,9)}OR(t){return this.orInternal(t,0)}OR1(t){return this.orInternal(t,1)}OR2(t){return this.orInternal(t,2)}OR3(t){return this.orInternal(t,3)}OR4(t){return this.orInternal(t,4)}OR5(t){return this.orInternal(t,5)}OR6(t){return this.orInternal(t,6)}OR7(t){return this.orInternal(t,7)}OR8(t){return this.orInternal(t,8)}OR9(t){return this.orInternal(t,9)}MANY(t){this.manyInternal(0,t)}MANY1(t){this.manyInternal(1,t)}MANY2(t){this.manyInternal(2,t)}MANY3(t){this.manyInternal(3,t)}MANY4(t){this.manyInternal(4,t)}MANY5(t){this.manyInternal(5,t)}MANY6(t){this.manyInternal(6,t)}MANY7(t){this.manyInternal(7,t)}MANY8(t){this.manyInternal(8,t)}MANY9(t){this.manyInternal(9,t)}MANY_SEP(t){this.manySepFirstInternal(0,t)}MANY_SEP1(t){this.manySepFirstInternal(1,t)}MANY_SEP2(t){this.manySepFirstInternal(2,t)}MANY_SEP3(t){this.manySepFirstInternal(3,t)}MANY_SEP4(t){this.manySepFirstInternal(4,t)}MANY_SEP5(t){this.manySepFirstInternal(5,t)}MANY_SEP6(t){this.manySepFirstInternal(6,t)}MANY_SEP7(t){this.manySepFirstInternal(7,t)}MANY_SEP8(t){this.manySepFirstInternal(8,t)}MANY_SEP9(t){this.manySepFirstInternal(9,t)}AT_LEAST_ONE(t){this.atLeastOneInternal(0,t)}AT_LEAST_ONE1(t){return this.atLeastOneInternal(1,t)}AT_LEAST_ONE2(t){this.atLeastOneInternal(2,t)}AT_LEAST_ONE3(t){this.atLeastOneInternal(3,t)}AT_LEAST_ONE4(t){this.atLeastOneInternal(4,t)}AT_LEAST_ONE5(t){this.atLeastOneInternal(5,t)}AT_LEAST_ONE6(t){this.atLeastOneInternal(6,t)}AT_LEAST_ONE7(t){this.atLeastOneInternal(7,t)}AT_LEAST_ONE8(t){this.atLeastOneInternal(8,t)}AT_LEAST_ONE9(t){this.atLeastOneInternal(9,t)}AT_LEAST_ONE_SEP(t){this.atLeastOneSepFirstInternal(0,t)}AT_LEAST_ONE_SEP1(t){this.atLeastOneSepFirstInternal(1,t)}AT_LEAST_ONE_SEP2(t){this.atLeastOneSepFirstInternal(2,t)}AT_LEAST_ONE_SEP3(t){this.atLeastOneSepFirstInternal(3,t)}AT_LEAST_ONE_SEP4(t){this.atLeastOneSepFirstInternal(4,t)}AT_LEAST_ONE_SEP5(t){this.atLeastOneSepFirstInternal(5,t)}AT_LEAST_ONE_SEP6(t){this.atLeastOneSepFirstInternal(6,t)}AT_LEAST_ONE_SEP7(t){this.atLeastOneSepFirstInternal(7,t)}AT_LEAST_ONE_SEP8(t){this.atLeastOneSepFirstInternal(8,t)}AT_LEAST_ONE_SEP9(t){this.atLeastOneSepFirstInternal(9,t)}RULE(t,n,r=yo){if(this.definedRulesNames.includes(t)){let s={message:Vt.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:Ye.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(s)}this.definedRulesNames.push(t);let i=this.defineRule(t,n,r);return this[t]=i,i}OVERRIDE_RULE(t,n,r=yo){let i=nT(t,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let o=this.defineRule(t,n,r);return this[t]=o,o}BACKTRACK(t,n){var r;let i=(r=t.coreRule)!==null&&r!==void 0?r:t;return function(){this.isBackTrackingStack.push(1);let o=this.saveRecogState();try{return i.apply(this,n),!0}catch(s){if(ur(s))return!1;throw s}finally{this.reloadRecogState(o),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Sc(Object.values(this.gastProductionsCache))}};var tu=class{initRecognizerEngine(t,n){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=co,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
95
95
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
96
96
  For Further details.`);if(Array.isArray(t)){if(t.length===0)throw Error(`A Token Vocabulary cannot be empty.
97
97
  Note that the first argument for the parser constructor
98
98
  is no longer a Token vector (since v4.0).`);if(typeof t[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
99
99
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
100
- For Further details.`)}if(Array.isArray(t))this.tokensMap=t.reduce((o,s)=>(o[s.name]=s,o),{});else if(Object.hasOwn(t,"modes")&&Object.values(t.modes).flat().every(Lw)){let o=Object.values(t.modes).flat(),s=[...new Set(o)];this.tokensMap=s.reduce((a,l)=>(a[l.name]=l,a),{})}else if(typeof t=="object"&&t!==null)this.tokensMap=Object.assign({},t);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=ut;let i=(Object.hasOwn(t,"modes")?Object.values(t.modes).flat():Object.values(t)).every(o=>{var s;return((s=o.categoryMatches)===null||s===void 0?void 0:s.length)==0});this.tokenMatcher=i?lo:kn,In(Object.values(this.tokensMap))}defineRule(t,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${t}> may not be defined after the 'performSelfAnalysis' method has been called'
101
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=Object.hasOwn(r,"resyncEnabled")?r.resyncEnabled:go.resyncEnabled,o=Object.hasOwn(r,"recoveryValueFunc")?r.recoveryValueFunc:go.recoveryValueFunc,s=this.ruleShortNameIdx++;this.shortRuleNameToFull[s]=t,this.fullRuleNameToShort[t]=s;let a;return this.outputCst===!0?a=function(...f){try{this.ruleInvocationStateUpdate(s,t,this.subruleIdx),n.apply(this,f);let d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}}:a=function(...f){try{return this.ruleInvocationStateUpdate(s,t,this.subruleIdx),n.apply(this,f)}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...f){this.onBeforeParse(t);try{return a.apply(this,f)}finally{this.onAfterParse(t)}},{ruleName:t,originalGrammarAction:n,coreRule:a})}invokeRuleCatch(t,n,r){let i=this.RULE_STACK_IDX===0,o=n&&!this.isBackTracking()&&this.recoveryEnabled;if(ur(t)){let s=t;if(o){let a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(s.resyncedTokens=this.reSyncTo(a),this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return r(t);else{if(this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,s.partialCstResult=l}throw s}}else{if(i)return this.moveToTerminatedState(),r(t);throw s}}else throw t}optionInternal(t,n){let r=512|n;return this.optionInternalLogic(t,n,r)}optionInternalLogic(t,n,r){let i=this.currRuleLookaheadFuncs[r],o;if(typeof t!="function"){o=t.DEF;let s=t.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=t;if(i.call(this)===!0)return o.call(this)}atLeastOneInternal(t,n){let r=1024|t;return this.atLeastOneInternalLogic(t,n,r)}atLeastOneInternalLogic(t,n,r){let i=this.currRuleLookaheadFuncs[r],o;if(typeof n!="function"){o=n.DEF;let s=n.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=n;if(i.call(this)===!0){let s=this.doSingleRepetition(o);for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o)}else throw this.raiseEarlyExitException(t,Fe.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[t,n],i,1024,t,Fc)}atLeastOneSepFirstInternal(t,n){let r=1536|t;this.atLeastOneSepFirstInternalLogic(t,n,r)}atLeastOneSepFirstInternalLogic(t,n,r){let i=n.DEF,o=n.SEP;if(this.currRuleLookaheadFuncs[r].call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA_FAST(1),o);for(;this.tokenMatcher(this.LA_FAST(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,a,i,da],a,1536,t,da)}else throw this.raiseEarlyExitException(t,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(t,n){let r=768|t;return this.manyInternalLogic(t,n,r)}manyInternalLogic(t,n,r){let i=this.currRuleLookaheadFuncs[r],o;if(typeof n!="function"){o=n.DEF;let a=n.GATE;if(a!==void 0){let l=i;i=()=>a.call(this)&&l.call(this)}}else o=n;let s=!0;for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[t,n],i,768,t,Mc,s)}manySepFirstInternal(t,n){let r=1280|t;this.manySepFirstInternalLogic(t,n,r)}manySepFirstInternalLogic(t,n,r){let i=n.DEF,o=n.SEP;if(this.currRuleLookaheadFuncs[r].call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA_FAST(1),o);for(;this.tokenMatcher(this.LA_FAST(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,a,i,fa],a,1280,t,fa)}}repetitionSepSecondInternal(t,n,r,i,o){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,n,r,i,o],r,1536,t,o)}doSingleRepetition(t){let n=this.getLexerPosition();return t.call(this),this.getLexerPosition()>n}orInternal(t,n){let r=256|n,i=Array.isArray(t)?t:t.DEF,s=this.currRuleLookaheadFuncs[r].call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(n,t.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(t,n,r){let i;try{let o=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=t.coreRule.apply(this,o),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:t.ruleName),i}catch(o){throw this.subruleInternalError(o,r,t.ruleName)}}subruleInternalError(t,n,r){throw ur(t)&&t.partialCstResult!==void 0&&(this.cstPostNonTerminal(t.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete t.partialCstResult),t}consumeInternal(t,n,r){let i;try{let o=this.LA_FAST(1);this.tokenMatcher(o,t)===!0?(this.consumeToken(),i=o):this.consumeInternalError(t,o,r)}catch(o){i=this.consumeInternalRecovery(t,n,o)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:t.name,i),i}consumeInternalError(t,n,r){let i,o=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:n,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new oi(i,n,o))}consumeInternalRecovery(t,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(t,n);try{return this.tryInRuleRecovery(t,i)}catch(o){throw o.name===Wh?r:o}}else throw r}saveRecogState(){let t=this.errors,n=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(t){this.errors=t.errors,this.importLexerState(t.lexerState);let n=t.RULE_STACK;for(let r=0;r<n.length;r++)this.RULE_STACK[r]=n[r];this.RULE_STACK_IDX=n.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(t,n,r){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=r,this.RULE_STACK[++this.RULE_STACK_IDX]=t,this.currRuleShortName=t,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[t],this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let t=this.currRuleShortName;return this.shortRuleNameToFull[t]}shortRuleNameToFullName(t){return this.shortRuleNameToFull[t]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),ut)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(t){for(let n=0;n<this.maxLookahead+1;n++)this.tokVector.push(Ln)}onAfterParse(t){if(this.isAtEndOfInput()===!1){let n=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:n,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new ga(r,n))}for(;this.tokVector.at(-1)===Ln;)this.tokVector.pop()}};var eu=class{initErrorHandler(t){this._errors=[],this.errorMessageProvider=Object.hasOwn(t,"errorMessageProvider")?t.errorMessageProvider:ft.errorMessageProvider}SAVE_ERROR(t){if(ur(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(t),t;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(t){this._errors=t}raiseEarlyExitException(t,n,r){let i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=ho(t,o,n,this.maxLookahead)[0],l=[];for(let u=1;u<=this.maxLookahead;u++)l.push(this.LA(u));let c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:l,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new ya(c,this.LA(1),this.LA(0)))}raiseNoAltException(t,n){let r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],o=po(t,i,this.maxLookahead),s=[];for(let c=1;c<=this.maxLookahead;c++)s.push(this.LA(c));let a=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:s,previous:a,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ma(l,this.LA(1),a))}};var ru={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ru);var mT=!0,gT=255,xT=cr({name:"RECORDING_PHASE_TOKEN",pattern:Me.NA});In([xT]);var ET=Sn(xT,`This IToken indicates the Parser is in Recording Phase
102
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(ET);var PP={name:`This CSTNode indicates the Parser is in Recording Phase
103
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},tu=class{initGastRecorder(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let t=0;t<10;t++){let n=t>0?t:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,t,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,t,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,t)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,t)},this[`MANY${n}`]=function(r){this.manyInternalRecord(t,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(t,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(t,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(t,r)}}this.consume=function(t,n,r){return this.consumeInternalRecord(n,t,r)},this.subrule=function(t,n,r){return this.subruleInternalRecord(n,t,r)},this.option=function(t,n){return this.optionInternalRecord(n,t)},this.or=function(t,n){return this.orInternalRecord(n,t)},this.many=function(t,n){this.manyInternalRecord(t,n)},this.atLeastOne=function(t,n){this.atLeastOneInternalRecord(t,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let t=this;for(let n=0;n<10;n++){let r=n>0?n:"";delete t[`CONSUME${r}`],delete t[`SUBRULE${r}`],delete t[`OPTION${r}`],delete t[`OR${r}`],delete t[`MANY${r}`],delete t[`MANY_SEP${r}`],delete t[`AT_LEAST_ONE${r}`],delete t[`AT_LEAST_ONE_SEP${r}`]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA})}ACTION_RECORD(t){}BACKTRACK_RECORD(t,n){return()=>!0}LA_RECORD(t){return Ln}topLevelRuleRecord(t,n){try{let r=new lt({definition:[],name:t});return r.name=t,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
100
+ For Further details.`)}if(Array.isArray(t))this.tokensMap=t.reduce((o,s)=>(o[s.name]=s,o),{});else if(Object.hasOwn(t,"modes")&&Object.values(t.modes).flat().every(Ow)){let o=Object.values(t.modes).flat(),s=[...new Set(o)];this.tokensMap=s.reduce((a,l)=>(a[l.name]=l,a),{})}else if(typeof t=="object"&&t!==null)this.tokensMap=Object.assign({},t);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=ut;let i=(Object.hasOwn(t,"modes")?Object.values(t.modes).flat():Object.values(t)).every(o=>{var s;return((s=o.categoryMatches)===null||s===void 0?void 0:s.length)==0});this.tokenMatcher=i?co:kn,In(Object.values(this.tokensMap))}defineRule(t,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${t}> may not be defined after the 'performSelfAnalysis' method has been called'
101
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=Object.hasOwn(r,"resyncEnabled")?r.resyncEnabled:yo.resyncEnabled,o=Object.hasOwn(r,"recoveryValueFunc")?r.recoveryValueFunc:yo.recoveryValueFunc,s=this.ruleShortNameIdx++;this.shortRuleNameToFull[s]=t,this.fullRuleNameToShort[t]=s;let a;return this.outputCst===!0?a=function(...f){try{this.ruleInvocationStateUpdate(s,t,this.subruleIdx),n.apply(this,f);let d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}}:a=function(...f){try{return this.ruleInvocationStateUpdate(s,t,this.subruleIdx),n.apply(this,f)}catch(d){return this.invokeRuleCatch(d,i,o)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...f){this.onBeforeParse(t);try{return a.apply(this,f)}finally{this.onAfterParse(t)}},{ruleName:t,originalGrammarAction:n,coreRule:a})}invokeRuleCatch(t,n,r){let i=this.RULE_STACK_IDX===0,o=n&&!this.isBackTracking()&&this.recoveryEnabled;if(ur(t)){let s=t;if(o){let a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(s.resyncedTokens=this.reSyncTo(a),this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return r(t);else{if(this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,s.partialCstResult=l}throw s}}else{if(i)return this.moveToTerminatedState(),r(t);throw s}}else throw t}optionInternal(t,n){let r=512|n;return this.optionInternalLogic(t,n,r)}optionInternalLogic(t,n,r){let i=this.currRuleLookaheadFuncs[r],o;if(typeof t!="function"){o=t.DEF;let s=t.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=t;if(i.call(this)===!0)return o.call(this)}atLeastOneInternal(t,n){let r=1024|t;return this.atLeastOneInternalLogic(t,n,r)}atLeastOneInternalLogic(t,n,r){let i=this.currRuleLookaheadFuncs[r],o;if(typeof n!="function"){o=n.DEF;let s=n.GATE;if(s!==void 0){let a=i;i=()=>s.call(this)&&a.call(this)}}else o=n;if(i.call(this)===!0){let s=this.doSingleRepetition(o);for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o)}else throw this.raiseEarlyExitException(t,Fe.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[t,n],i,1024,t,Wc)}atLeastOneSepFirstInternal(t,n){let r=1536|t;this.atLeastOneSepFirstInternalLogic(t,n,r)}atLeastOneSepFirstInternalLogic(t,n,r){let i=n.DEF,o=n.SEP;if(this.currRuleLookaheadFuncs[r].call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA_FAST(1),o);for(;this.tokenMatcher(this.LA_FAST(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,a,i,pa],a,1536,t,pa)}else throw this.raiseEarlyExitException(t,Fe.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(t,n){let r=768|t;return this.manyInternalLogic(t,n,r)}manyInternalLogic(t,n,r){let i=this.currRuleLookaheadFuncs[r],o;if(typeof n!="function"){o=n.DEF;let a=n.GATE;if(a!==void 0){let l=i;i=()=>a.call(this)&&l.call(this)}}else o=n;let s=!0;for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[t,n],i,768,t,Bc,s)}manySepFirstInternal(t,n){let r=1280|t;this.manySepFirstInternalLogic(t,n,r)}manySepFirstInternalLogic(t,n,r){let i=n.DEF,o=n.SEP;if(this.currRuleLookaheadFuncs[r].call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA_FAST(1),o);for(;this.tokenMatcher(this.LA_FAST(1),o)===!0;)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,a,i,da],a,1280,t,da)}}repetitionSepSecondInternal(t,n,r,i,o){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,n,r,i,o],r,1536,t,o)}doSingleRepetition(t){let n=this.getLexerPosition();return t.call(this),this.getLexerPosition()>n}orInternal(t,n){let r=256|n,i=Array.isArray(t)?t:t.DEF,s=this.currRuleLookaheadFuncs[r].call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(n,t.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(t,n,r){let i;try{let o=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=t.coreRule.apply(this,o),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:t.ruleName),i}catch(o){throw this.subruleInternalError(o,r,t.ruleName)}}subruleInternalError(t,n,r){throw ur(t)&&t.partialCstResult!==void 0&&(this.cstPostNonTerminal(t.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete t.partialCstResult),t}consumeInternal(t,n,r){let i;try{let o=this.LA_FAST(1);this.tokenMatcher(o,t)===!0?(this.consumeToken(),i=o):this.consumeInternalError(t,o,r)}catch(o){i=this.consumeInternalRecovery(t,n,o)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:t.name,i),i}consumeInternalError(t,n,r){let i,o=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:n,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new oi(i,n,o))}consumeInternalRecovery(t,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(t,n);try{return this.tryInRuleRecovery(t,i)}catch(o){throw o.name===Uh?r:o}}else throw r}saveRecogState(){let t=this.errors,n=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(t){this.errors=t.errors,this.importLexerState(t.lexerState);let n=t.RULE_STACK;for(let r=0;r<n.length;r++)this.RULE_STACK[r]=n[r];this.RULE_STACK_IDX=n.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(t,n,r){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=r,this.RULE_STACK[++this.RULE_STACK_IDX]=t,this.currRuleShortName=t,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[t],this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let t=this.currRuleShortName;return this.shortRuleNameToFull[t]}shortRuleNameToFullName(t){return this.shortRuleNameToFull[t]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),ut)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(t){for(let n=0;n<this.maxLookahead+1;n++)this.tokVector.push(Ln)}onAfterParse(t){if(this.isAtEndOfInput()===!1){let n=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:n,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new ya(r,n))}for(;this.tokVector.at(-1)===Ln;)this.tokVector.pop()}};var nu=class{initErrorHandler(t){this._errors=[],this.errorMessageProvider=Object.hasOwn(t,"errorMessageProvider")?t.errorMessageProvider:ft.errorMessageProvider}SAVE_ERROR(t){if(ur(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(t),t;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(t){this._errors=t}raiseEarlyExitException(t,n,r){let i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=mo(t,o,n,this.maxLookahead)[0],l=[];for(let u=1;u<=this.maxLookahead;u++)l.push(this.LA(u));let c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:l,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new xa(c,this.LA(1),this.LA(0)))}raiseNoAltException(t,n){let r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],o=ho(t,i,this.maxLookahead),s=[];for(let c=1;c<=this.maxLookahead;c++)s.push(this.LA(c));let a=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:s,previous:a,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ga(l,this.LA(1),a))}};var ou={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ou);var yT=!0,xT=255,wT=cr({name:"RECORDING_PHASE_TOKEN",pattern:Me.NA});In([wT]);var TT=Sn(wT,`This IToken indicates the Parser is in Recording Phase
102
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(TT);var CP={name:`This CSTNode indicates the Parser is in Recording Phase
103
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},ru=class{initGastRecorder(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let t=0;t<10;t++){let n=t>0?t:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,t,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,t,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,t)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,t)},this[`MANY${n}`]=function(r){this.manyInternalRecord(t,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(t,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(t,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(t,r)}}this.consume=function(t,n,r){return this.consumeInternalRecord(n,t,r)},this.subrule=function(t,n,r){return this.subruleInternalRecord(n,t,r)},this.option=function(t,n){return this.optionInternalRecord(n,t)},this.or=function(t,n){return this.orInternalRecord(n,t)},this.many=function(t,n){this.manyInternalRecord(t,n)},this.atLeastOne=function(t,n){this.atLeastOneInternalRecord(t,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let t=this;for(let n=0;n<10;n++){let r=n>0?n:"";delete t[`CONSUME${r}`],delete t[`SUBRULE${r}`],delete t[`OPTION${r}`],delete t[`OR${r}`],delete t[`MANY${r}`],delete t[`MANY_SEP${r}`],delete t[`AT_LEAST_ONE${r}`],delete t[`AT_LEAST_ONE_SEP${r}`]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA})}ACTION_RECORD(t){}BACKTRACK_RECORD(t,n){return()=>!0}LA_RECORD(t){return Ln}topLevelRuleRecord(t,n){try{let r=new lt({definition:[],name:t});return r.name=t,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
104
104
  This error was thrown during the "grammar recording phase" For more info see:
105
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(t,n){return Ea.call(this,we,t,n)}atLeastOneInternalRecord(t,n){Ea.call(this,Ne,n,t)}atLeastOneSepFirstInternalRecord(t,n){Ea.call(this,Le,n,t,mT)}manyInternalRecord(t,n){Ea.call(this,ge,n,t)}manySepFirstInternalRecord(t,n){Ea.call(this,ke,n,t,mT)}orInternalRecord(t,n){return OP.call(this,t,n)}subruleInternalRecord(t,n,r){if(nu(n),!t||!Object.hasOwn(t,"ruleName")){let a=new Error(`<SUBRULE${yT(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(t)}>
106
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=this.recordingProdStack.at(-1),o=t.ruleName,s=new Ee({idx:n,nonTerminalName:o,label:r?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?PP:ru}consumeInternalRecord(t,n,r){if(nu(n),!bh(t)){let s=new Error(`<CONSUME${yT(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(t)}>
107
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=this.recordingProdStack.at(-1),o=new ue({idx:n,terminalType:t,label:r?.LABEL});return i.definition.push(o),ET}};function Ea(e,t,n,r=!1){nu(n);let i=this.recordingProdStack.at(-1),o=typeof t=="function"?t:t.DEF,s=new e({definition:[],idx:n});return r&&(s.separator=t.SEP),Object.hasOwn(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),ru}function OP(e,t){nu(t);let n=this.recordingProdStack.at(-1),r=Array.isArray(e)===!1,i=r===!1?e:e.DEF,o=new Ie({definition:[],idx:t,ignoreAmbiguities:r&&e.IGNORE_AMBIGUITIES===!0});Object.hasOwn(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD);let s=i.some(a=>typeof a.GATE=="function");return o.hasPredicates=s,n.definition.push(o),i.forEach(a=>{let l=new be({definition:[]});o.definition.push(l),Object.hasOwn(a,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:Object.hasOwn(a,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),a.ALT.call(this),this.recordingProdStack.pop()}),ru}function yT(e){return e===0?"":`${e}`}function nu(e){if(e<0||e>gT){let t=new Error(`Invalid DSL Method idx value: <${e}>
108
- Idx value must be a none negative value smaller than ${gT+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var iu=class{initPerformanceTracer(t){if(Object.hasOwn(t,"traceInitPerf")){let n=t.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=ft.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(t,n){if(this.traceInitPerf===!0){this.traceInitIndent++;let r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${t}>`);let{time:i,value:o}=sa(n),s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${r}<-- <${t}> time: ${i}ms`),this.traceInitIndent--,o}else return n()}};function wT(e,t){t.forEach(n=>{let r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(r,i);o&&(o.get||o.set)?Object.defineProperty(e.prototype,i,o):e.prototype[i]=n.prototype[i]})})}var Ln=Sn(ut,"",-1,-1,-1,-1,-1,-1);Object.freeze(Ln);var ft=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:bn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),go=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),Ye;(function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Ye||(Ye={}));function ou(e=void 0){return function(){return e}}var wa=class e{static performSelfAnalysis(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT("toFastProps",()=>{aa(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(i=>{let s=this[i].originalGrammarAction,a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=iT({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(r.length===0&&this.skipValidations===!1){let i=oT({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:Vt,grammarName:n}),o=Zw({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,o)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=pw(Object.values(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(i=>i.message),new Error(`Parser Definition Errors detected:
105
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(t,n){return wa.call(this,we,t,n)}atLeastOneInternalRecord(t,n){wa.call(this,Ne,n,t)}atLeastOneSepFirstInternalRecord(t,n){wa.call(this,Le,n,t,yT)}manyInternalRecord(t,n){wa.call(this,ge,n,t)}manySepFirstInternalRecord(t,n){wa.call(this,ke,n,t,yT)}orInternalRecord(t,n){return $P.call(this,t,n)}subruleInternalRecord(t,n,r){if(iu(n),!t||!Object.hasOwn(t,"ruleName")){let a=new Error(`<SUBRULE${ET(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(t)}>
106
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=this.recordingProdStack.at(-1),o=t.ruleName,s=new Ee({idx:n,nonTerminalName:o,label:r?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?CP:ou}consumeInternalRecord(t,n,r){if(iu(n),!Lh(t)){let s=new Error(`<CONSUME${ET(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(t)}>
107
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=this.recordingProdStack.at(-1),o=new ue({idx:n,terminalType:t,label:r?.LABEL});return i.definition.push(o),TT}};function wa(e,t,n,r=!1){iu(n);let i=this.recordingProdStack.at(-1),o=typeof t=="function"?t:t.DEF,s=new e({definition:[],idx:n});return r&&(s.separator=t.SEP),Object.hasOwn(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),ou}function $P(e,t){iu(t);let n=this.recordingProdStack.at(-1),r=Array.isArray(e)===!1,i=r===!1?e:e.DEF,o=new Ie({definition:[],idx:t,ignoreAmbiguities:r&&e.IGNORE_AMBIGUITIES===!0});Object.hasOwn(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD);let s=i.some(a=>typeof a.GATE=="function");return o.hasPredicates=s,n.definition.push(o),i.forEach(a=>{let l=new be({definition:[]});o.definition.push(l),Object.hasOwn(a,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:Object.hasOwn(a,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),a.ALT.call(this),this.recordingProdStack.pop()}),ou}function ET(e){return e===0?"":`${e}`}function iu(e){if(e<0||e>xT){let t=new Error(`Invalid DSL Method idx value: <${e}>
108
+ Idx value must be a none negative value smaller than ${xT+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var su=class{initPerformanceTracer(t){if(Object.hasOwn(t,"traceInitPerf")){let n=t.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=ft.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(t,n){if(this.traceInitPerf===!0){this.traceInitIndent++;let r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${t}>`);let{time:i,value:o}=aa(n),s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${r}<-- <${t}> time: ${i}ms`),this.traceInitIndent--,o}else return n()}};function vT(e,t){t.forEach(n=>{let r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(r,i);o&&(o.get||o.set)?Object.defineProperty(e.prototype,i,o):e.prototype[i]=n.prototype[i]})})}var Ln=Sn(ut,"",-1,-1,-1,-1,-1,-1);Object.freeze(Ln);var ft=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:bn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),yo=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),Ye;(function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Ye||(Ye={}));function au(e=void 0){return function(){return e}}var Ta=class e{static performSelfAnalysis(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT("toFastProps",()=>{la(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(i=>{let s=this[i].originalGrammarAction,a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=sT({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(r.length===0&&this.skipValidations===!1){let i=aT({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:Vt,grammarName:n}),o=Qw({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,o)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=mw(Object.values(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(i=>i.message),new Error(`Parser Definition Errors detected:
109
109
  ${t.join(`
110
110
  -------------------------------
111
111
  `)}`)})}constructor(t,n){this.definitionErrors=[],this.selfAnalysisDone=!1;let r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(t,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initGastRecorder(n),r.initPerformanceTracer(n),Object.hasOwn(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
112
112
  Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
113
113
  See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
114
- For further details.`);this.skipValidations=Object.hasOwn(n,"skipValidations")?n.skipValidations:ft.skipValidations}};wa.DEFER_DEFINITION_ERRORS_HANDLING=!1;wT(wa,[Hc,jc,qc,Zc,Qc,Jc,eu,tu,iu]);var Ta=class extends wa{constructor(t,n=ft){let r=Object.assign({},n);r.outputCst=!1,super(t,r)}};function $P(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var su=$P;function DP(){this.__data__=[],this.size=0}var TT=DP;function MP(e,t){return e===t||e!==e&&t!==t}var au=MP;function FP(e,t){for(var n=e.length;n--;)if(au(e[n][0],t))return n;return-1}var fr=FP;var BP=Array.prototype,WP=BP.splice;function XP(e){var t=this.__data__,n=fr(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():WP.call(t,n,1),--this.size,!0}var vT=XP;function UP(e){var t=this.__data__,n=fr(t,e);return n<0?void 0:t[n][1]}var _T=UP;function GP(e){return fr(this.__data__,e)>-1}var AT=GP;function HP(e,t){var n=this.__data__,r=fr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var kT=HP;function yo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}yo.prototype.clear=TT;yo.prototype.delete=vT;yo.prototype.get=_T;yo.prototype.has=AT;yo.prototype.set=kT;var dr=yo;function zP(){this.__data__=new dr,this.size=0}var IT=zP;function jP(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var RT=jP;function YP(e){return this.__data__.get(e)}var ST=YP;function VP(e){return this.__data__.has(e)}var bT=VP;var KP=typeof global=="object"&&global&&global.Object===Object&&global,lu=KP;var qP=typeof self=="object"&&self&&self.Object===Object&&self,ZP=lu||qP||Function("return this")(),Ze=ZP;var JP=Ze.Symbol,dt=JP;var NT=Object.prototype,QP=NT.hasOwnProperty,eO=NT.toString,va=dt?dt.toStringTag:void 0;function tO(e){var t=QP.call(e,va),n=e[va];try{e[va]=void 0;var r=!0}catch{}var i=eO.call(e);return r&&(t?e[va]=n:delete e[va]),i}var LT=tO;var nO=Object.prototype,rO=nO.toString;function iO(e){return rO.call(e)}var PT=iO;var oO="[object Null]",sO="[object Undefined]",OT=dt?dt.toStringTag:void 0;function aO(e){return e==null?e===void 0?sO:oO:OT&&OT in Object(e)?LT(e):PT(e)}var Kt=aO;function lO(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var xo=lO;var cO="[object AsyncFunction]",uO="[object Function]",fO="[object GeneratorFunction]",dO="[object Proxy]";function pO(e){if(!xo(e))return!1;var t=Kt(e);return t==uO||t==fO||t==cO||t==dO}var cu=pO;var hO=Ze["__core-js_shared__"],uu=hO;var CT=(function(){var e=/[^.]+$/.exec(uu&&uu.keys&&uu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function mO(e){return!!CT&&CT in e}var $T=mO;var gO=Function.prototype,yO=gO.toString;function xO(e){if(e!=null){try{return yO.call(e)}catch{}try{return e+""}catch{}}return""}var Pn=xO;var EO=/[\\^$.*+?()[\]{}|]/g,wO=/^\[object .+?Constructor\]$/,TO=Function.prototype,vO=Object.prototype,_O=TO.toString,AO=vO.hasOwnProperty,kO=RegExp("^"+_O.call(AO).replace(EO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function IO(e){if(!xo(e)||$T(e))return!1;var t=cu(e)?kO:wO;return t.test(Pn(e))}var DT=IO;function RO(e,t){return e?.[t]}var MT=RO;function SO(e,t){var n=MT(e,t);return DT(n)?n:void 0}var Bt=SO;var bO=Bt(Ze,"Map"),pr=bO;var NO=Bt(Object,"create"),On=NO;function LO(){this.__data__=On?On(null):{},this.size=0}var FT=LO;function PO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var BT=PO;var OO="__lodash_hash_undefined__",CO=Object.prototype,$O=CO.hasOwnProperty;function DO(e){var t=this.__data__;if(On){var n=t[e];return n===OO?void 0:n}return $O.call(t,e)?t[e]:void 0}var WT=DO;var MO=Object.prototype,FO=MO.hasOwnProperty;function BO(e){var t=this.__data__;return On?t[e]!==void 0:FO.call(t,e)}var XT=BO;var WO="__lodash_hash_undefined__";function XO(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=On&&t===void 0?WO:t,this}var UT=XO;function Eo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Eo.prototype.clear=FT;Eo.prototype.delete=BT;Eo.prototype.get=WT;Eo.prototype.has=XT;Eo.prototype.set=UT;var Vh=Eo;function UO(){this.size=0,this.__data__={hash:new Vh,map:new(pr||dr),string:new Vh}}var GT=UO;function GO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var HT=GO;function HO(e,t){var n=e.__data__;return HT(t)?n[typeof t=="string"?"string":"hash"]:n.map}var hr=HO;function zO(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t}var zT=zO;function jO(e){return hr(this,e).get(e)}var jT=jO;function YO(e){return hr(this,e).has(e)}var YT=YO;function VO(e,t){var n=hr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var VT=VO;function wo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}wo.prototype.clear=GT;wo.prototype.delete=zT;wo.prototype.get=jT;wo.prototype.has=YT;wo.prototype.set=VT;var si=wo;var KO=200;function qO(e,t){var n=this.__data__;if(n instanceof dr){var r=n.__data__;if(!pr||r.length<KO-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new si(r)}return n.set(e,t),this.size=n.size,this}var KT=qO;function To(e){var t=this.__data__=new dr(e);this.size=t.size}To.prototype.clear=IT;To.prototype.delete=RT;To.prototype.get=ST;To.prototype.has=bT;To.prototype.set=KT;var vo=To;var ZO="__lodash_hash_undefined__";function JO(e){return this.__data__.set(e,ZO),this}var qT=JO;function QO(e){return this.__data__.has(e)}var ZT=QO;function fu(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new si;++t<n;)this.add(e[t])}fu.prototype.add=fu.prototype.push=qT;fu.prototype.has=ZT;var du=fu;function eC(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var JT=eC;function tC(e,t){return e.has(t)}var pu=tC;var nC=1,rC=2;function iC(e,t,n,r,i,o){var s=n&nC,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var f=-1,d=!0,p=n&rC?new du:void 0;for(o.set(e,t),o.set(t,e);++f<a;){var m=e[f],g=t[f];if(r)var w=s?r(g,m,f,t,e,o):r(m,g,f,e,t,o);if(w!==void 0){if(w)continue;d=!1;break}if(p){if(!JT(t,function(x,y){if(!pu(p,y)&&(m===x||i(m,x,n,r,o)))return p.push(y)})){d=!1;break}}else if(!(m===g||i(m,g,n,r,o))){d=!1;break}}return o.delete(e),o.delete(t),d}var hu=iC;var oC=Ze.Uint8Array,Kh=oC;function sC(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}var QT=sC;function aC(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var _o=aC;var lC=1,cC=2,uC="[object Boolean]",fC="[object Date]",dC="[object Error]",pC="[object Map]",hC="[object Number]",mC="[object RegExp]",gC="[object Set]",yC="[object String]",xC="[object Symbol]",EC="[object ArrayBuffer]",wC="[object DataView]",ev=dt?dt.prototype:void 0,qh=ev?ev.valueOf:void 0;function TC(e,t,n,r,i,o,s){switch(n){case wC:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case EC:return!(e.byteLength!=t.byteLength||!o(new Kh(e),new Kh(t)));case uC:case fC:case hC:return au(+e,+t);case dC:return e.name==t.name&&e.message==t.message;case mC:case yC:return e==t+"";case pC:var a=QT;case gC:var l=r&lC;if(a||(a=_o),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=cC,s.set(e,t);var u=hu(a(e),a(t),r,i,o,s);return s.delete(e),u;case xC:if(qh)return qh.call(e)==qh.call(t)}return!1}var tv=TC;function vC(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var mu=vC;var _C=Array.isArray,Te=_C;function AC(e,t,n){var r=t(e);return Te(e)?r:mu(r,n(e))}var nv=AC;function kC(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}var gu=kC;function IC(){return[]}var rv=IC;var RC=Object.prototype,SC=RC.propertyIsEnumerable,iv=Object.getOwnPropertySymbols,bC=iv?function(e){return e==null?[]:(e=Object(e),gu(iv(e),function(t){return SC.call(e,t)}))}:rv,ov=bC;function NC(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var sv=NC;function LC(e){return e!=null&&typeof e=="object"}var qt=LC;var PC="[object Arguments]";function OC(e){return qt(e)&&Kt(e)==PC}var Zh=OC;var av=Object.prototype,CC=av.hasOwnProperty,$C=av.propertyIsEnumerable,DC=Zh((function(){return arguments})())?Zh:function(e){return qt(e)&&CC.call(e,"callee")&&!$C.call(e,"callee")},mr=DC;function MC(){return!1}var lv=MC;var fv=typeof exports=="object"&&exports&&!exports.nodeType&&exports,cv=fv&&typeof module=="object"&&module&&!module.nodeType&&module,FC=cv&&cv.exports===fv,uv=FC?Ze.Buffer:void 0,BC=uv?uv.isBuffer:void 0,WC=BC||lv,ai=WC;var XC=9007199254740991,UC=/^(?:0|[1-9]\d*)$/;function GC(e,t){var n=typeof e;return t=t??XC,!!t&&(n=="number"||n!="symbol"&&UC.test(e))&&e>-1&&e%1==0&&e<t}var yu=GC;var HC=9007199254740991;function zC(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=HC}var Ao=zC;var jC="[object Arguments]",YC="[object Array]",VC="[object Boolean]",KC="[object Date]",qC="[object Error]",ZC="[object Function]",JC="[object Map]",QC="[object Number]",e$="[object Object]",t$="[object RegExp]",n$="[object Set]",r$="[object String]",i$="[object WeakMap]",o$="[object ArrayBuffer]",s$="[object DataView]",a$="[object Float32Array]",l$="[object Float64Array]",c$="[object Int8Array]",u$="[object Int16Array]",f$="[object Int32Array]",d$="[object Uint8Array]",p$="[object Uint8ClampedArray]",h$="[object Uint16Array]",m$="[object Uint32Array]",Pe={};Pe[a$]=Pe[l$]=Pe[c$]=Pe[u$]=Pe[f$]=Pe[d$]=Pe[p$]=Pe[h$]=Pe[m$]=!0;Pe[jC]=Pe[YC]=Pe[o$]=Pe[VC]=Pe[s$]=Pe[KC]=Pe[qC]=Pe[ZC]=Pe[JC]=Pe[QC]=Pe[e$]=Pe[t$]=Pe[n$]=Pe[r$]=Pe[i$]=!1;function g$(e){return qt(e)&&Ao(e.length)&&!!Pe[Kt(e)]}var dv=g$;function y$(e){return function(t){return e(t)}}var pv=y$;var hv=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_a=hv&&typeof module=="object"&&module&&!module.nodeType&&module,x$=_a&&_a.exports===hv,Jh=x$&&lu.process,E$=(function(){try{var e=_a&&_a.require&&_a.require("util").types;return e||Jh&&Jh.binding&&Jh.binding("util")}catch{}})(),Qh=E$;var mv=Qh&&Qh.isTypedArray,w$=mv?pv(mv):dv,ko=w$;var T$=Object.prototype,v$=T$.hasOwnProperty;function _$(e,t){var n=Te(e),r=!n&&mr(e),i=!n&&!r&&ai(e),o=!n&&!r&&!i&&ko(e),s=n||r||i||o,a=s?sv(e.length,String):[],l=a.length;for(var c in e)(t||v$.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||yu(c,l)))&&a.push(c);return a}var gv=_$;var A$=Object.prototype;function k$(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||A$;return e===n}var xu=k$;function I$(e,t){return function(n){return e(t(n))}}var yv=I$;var R$=yv(Object.keys,Object),xv=R$;var S$=Object.prototype,b$=S$.hasOwnProperty;function N$(e){if(!xu(e))return xv(e);var t=[];for(var n in Object(e))b$.call(e,n)&&n!="constructor"&&t.push(n);return t}var Eu=N$;function L$(e){return e!=null&&Ao(e.length)&&!cu(e)}var gr=L$;function P$(e){return gr(e)?gv(e):Eu(e)}var Io=P$;function O$(e){return nv(e,Io,ov)}var em=O$;var C$=1,$$=Object.prototype,D$=$$.hasOwnProperty;function M$(e,t,n,r,i,o){var s=n&C$,a=em(e),l=a.length,c=em(t),u=c.length;if(l!=u&&!s)return!1;for(var f=l;f--;){var d=a[f];if(!(s?d in t:D$.call(t,d)))return!1}var p=o.get(e),m=o.get(t);if(p&&m)return p==t&&m==e;var g=!0;o.set(e,t),o.set(t,e);for(var w=s;++f<l;){d=a[f];var x=e[d],y=t[d];if(r)var E=s?r(y,x,d,t,e,o):r(x,y,d,e,t,o);if(!(E===void 0?x===y||i(x,y,n,r,o):E)){g=!1;break}w||(w=d=="constructor")}if(g&&!w){var _=e.constructor,T=t.constructor;_!=T&&"constructor"in e&&"constructor"in t&&!(typeof _=="function"&&_ instanceof _&&typeof T=="function"&&T instanceof T)&&(g=!1)}return o.delete(e),o.delete(t),g}var Ev=M$;var F$=Bt(Ze,"DataView"),wu=F$;var B$=Bt(Ze,"Promise"),Tu=B$;var W$=Bt(Ze,"Set"),yr=W$;var X$=Bt(Ze,"WeakMap"),vu=X$;var wv="[object Map]",U$="[object Object]",Tv="[object Promise]",vv="[object Set]",_v="[object WeakMap]",Av="[object DataView]",G$=Pn(wu),H$=Pn(pr),z$=Pn(Tu),j$=Pn(yr),Y$=Pn(vu),li=Kt;(wu&&li(new wu(new ArrayBuffer(1)))!=Av||pr&&li(new pr)!=wv||Tu&&li(Tu.resolve())!=Tv||yr&&li(new yr)!=vv||vu&&li(new vu)!=_v)&&(li=function(e){var t=Kt(e),n=t==U$?e.constructor:void 0,r=n?Pn(n):"";if(r)switch(r){case G$:return Av;case H$:return wv;case z$:return Tv;case j$:return vv;case Y$:return _v}return t});var Aa=li;var V$=1,kv="[object Arguments]",Iv="[object Array]",_u="[object Object]",K$=Object.prototype,Rv=K$.hasOwnProperty;function q$(e,t,n,r,i,o){var s=Te(e),a=Te(t),l=s?Iv:Aa(e),c=a?Iv:Aa(t);l=l==kv?_u:l,c=c==kv?_u:c;var u=l==_u,f=c==_u,d=l==c;if(d&&ai(e)){if(!ai(t))return!1;s=!0,u=!1}if(d&&!u)return o||(o=new vo),s||ko(e)?hu(e,t,n,r,i,o):tv(e,t,l,n,r,i,o);if(!(n&V$)){var p=u&&Rv.call(e,"__wrapped__"),m=f&&Rv.call(t,"__wrapped__");if(p||m){var g=p?e.value():e,w=m?t.value():t;return o||(o=new vo),i(g,w,n,r,o)}}return d?(o||(o=new vo),Ev(e,t,n,r,i,o)):!1}var Sv=q$;function bv(e,t,n,r,i){return e===t?!0:e==null||t==null||!qt(e)&&!qt(t)?e!==e&&t!==t:Sv(e,t,n,r,bv,i)}var Au=bv;var Z$=1,J$=2;function Q$(e,t,n,r){var i=n.length,o=i,s=!r;if(e==null)return!o;for(e=Object(e);i--;){var a=n[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=n[i];var l=a[0],c=e[l],u=a[1];if(s&&a[2]){if(c===void 0&&!(l in e))return!1}else{var f=new vo;if(r)var d=r(c,u,l,e,t,f);if(!(d===void 0?Au(u,c,Z$|J$,r,f):d))return!1}}return!0}var Nv=Q$;function e1(e){return e===e&&!xo(e)}var ku=e1;function t1(e){for(var t=Io(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,ku(i)]}return t}var Lv=t1;function n1(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var Iu=n1;function r1(e){var t=Lv(e);return t.length==1&&t[0][2]?Iu(t[0][0],t[0][1]):function(n){return n===e||Nv(n,e,t)}}var Pv=r1;var i1="[object Symbol]";function o1(e){return typeof e=="symbol"||qt(e)&&Kt(e)==i1}var xr=o1;var s1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a1=/^\w*$/;function l1(e,t){if(Te(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||xr(e)?!0:a1.test(e)||!s1.test(e)||t!=null&&e in Object(t)}var Ro=l1;var c1="Expected a function";function tm(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(c1);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(tm.Cache||si),n}tm.Cache=si;var Ov=tm;var u1=500;function f1(e){var t=Ov(e,function(r){return n.size===u1&&n.clear(),r}),n=t.cache;return t}var Cv=f1;var d1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p1=/\\(\\)?/g,h1=Cv(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(d1,function(n,r,i,o){t.push(i?o.replace(p1,"$1"):r||n)}),t}),$v=h1;var m1=1/0,Dv=dt?dt.prototype:void 0,Mv=Dv?Dv.toString:void 0;function Fv(e){if(typeof e=="string")return e;if(Te(e))return su(e,Fv)+"";if(xr(e))return Mv?Mv.call(e):"";var t=e+"";return t=="0"&&1/e==-m1?"-0":t}var Bv=Fv;function g1(e){return e==null?"":Bv(e)}var Wv=g1;function y1(e,t){return Te(e)?e:Ro(e,t)?[e]:$v(Wv(e))}var Ru=y1;var x1=1/0;function E1(e){if(typeof e=="string"||xr(e))return e;var t=e+"";return t=="0"&&1/e==-x1?"-0":t}var Er=E1;function w1(e,t){t=Ru(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Er(t[n++])];return n&&n==r?e:void 0}var Su=w1;function T1(e,t,n){var r=e==null?void 0:Su(e,t);return r===void 0?n:r}var Xv=T1;function v1(e,t){return e!=null&&t in Object(e)}var Uv=v1;function _1(e,t,n){t=Ru(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=Er(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&Ao(i)&&yu(s,i)&&(Te(e)||mr(e)))}var Gv=_1;function A1(e,t){return e!=null&&Gv(e,t,Uv)}var Hv=A1;var k1=1,I1=2;function R1(e,t){return Ro(e)&&ku(t)?Iu(Er(e),t):function(n){var r=Xv(n,e);return r===void 0&&r===t?Hv(n,e):Au(t,r,k1|I1)}}var zv=R1;function S1(e){return e}var So=S1;function b1(e){return function(t){return t?.[e]}}var jv=b1;function N1(e){return function(t){return Su(t,e)}}var Yv=N1;function L1(e){return Ro(e)?jv(Er(e)):Yv(e)}var Vv=L1;function P1(e){return typeof e=="function"?e:e==null?So:typeof e=="object"?Te(e)?zv(e[0],e[1]):Pv(e):Vv(e)}var wr=P1;function O1(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var l=s[e?a:++i];if(n(o[l],l,o)===!1)break}return t}}var Kv=O1;var C1=Kv(),qv=C1;function $1(e,t){return e&&qv(e,t,Io)}var Zv=$1;function D1(e,t){return function(n,r){if(n==null)return n;if(!gr(n))return e(n,r);for(var i=n.length,o=t?i:-1,s=Object(n);(t?o--:++o<i)&&r(s[o],o,s)!==!1;);return n}}var Jv=D1;var M1=Jv(Zv),Tr=M1;function F1(e,t){var n=-1,r=gr(e)?Array(e.length):[];return Tr(e,function(i,o,s){r[++n]=t(i,o,s)}),r}var Qv=F1;function B1(e,t){var n=Te(e)?su:Qv;return n(e,wr(t,3))}var Lt=B1;function W1(e,t){var n=[];return Tr(e,function(r,i,o){t(r,i,o)&&n.push(r)}),n}var e_=W1;function X1(e,t){var n=Te(e)?gu:e_;return n(e,wr(t,3))}var t_=X1;function fi(e,t,n){return`${e.name}_${t}_${n}`}var vr=1,U1=2,n_=4,r_=5;var _r=7,G1=8,H1=9,z1=10,j1=11,i_=12,ka=class{constructor(t){this.target=t}isEpsilon(){return!1}},ci=class extends ka{constructor(t,n){super(t),this.tokenType=n}},Ia=class extends ka{constructor(t){super(t)}isEpsilon(){return!0}},ui=class extends ka{constructor(t,n,r){super(t),this.rule=n,this.followState=r}isEpsilon(){return!0}};function o_(e){let t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};Y1(t,e);let n=e.length;for(let r=0;r<n;r++){let i=e[r],o=di(t,i,i);o!==void 0&&iD(t,i,o)}return t}function Y1(e,t){let n=t.length;for(let r=0;r<n;r++){let i=t[r],o=Je(e,i,void 0,{type:U1}),s=Je(e,i,void 0,{type:_r});o.stop=s,e.ruleToStartState.set(i,o),e.ruleToStopState.set(i,s)}}function s_(e,t,n){return n instanceof ue?nm(e,t,n.terminalType,n):n instanceof Ee?rD(e,t,n):n instanceof Ie?J1(e,t,n):n instanceof we?Q1(e,t,n):n instanceof ge?V1(e,t,n):n instanceof ke?K1(e,t,n):n instanceof Ne?q1(e,t,n):n instanceof Le?Z1(e,t,n):di(e,t,n)}function V1(e,t,n){let r=Je(e,t,n,{type:r_});Ar(e,r);let i=bo(e,t,r,n,di(e,t,n));return l_(e,t,n,i)}function K1(e,t,n){let r=Je(e,t,n,{type:r_});Ar(e,r);let i=bo(e,t,r,n,di(e,t,n)),o=nm(e,t,n.separator,n);return l_(e,t,n,i,o)}function q1(e,t,n){let r=Je(e,t,n,{type:n_});Ar(e,r);let i=bo(e,t,r,n,di(e,t,n));return a_(e,t,n,i)}function Z1(e,t,n){let r=Je(e,t,n,{type:n_});Ar(e,r);let i=bo(e,t,r,n,di(e,t,n)),o=nm(e,t,n.separator,n);return a_(e,t,n,i,o)}function J1(e,t,n){let r=Je(e,t,n,{type:vr});Ar(e,r);let i=Lt(n.definition,s=>s_(e,t,s));return bo(e,t,r,n,...i)}function Q1(e,t,n){let r=Je(e,t,n,{type:vr});Ar(e,r);let i=bo(e,t,r,n,di(e,t,n));return eD(e,t,n,i)}function di(e,t,n){let r=t_(Lt(n.definition,i=>s_(e,t,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:nD(e,r)}function a_(e,t,n,r,i){let o=r.left,s=r.right,a=Je(e,t,n,{type:j1});Ar(e,a);let l=Je(e,t,n,{type:i_});return o.loopback=a,l.loopback=a,e.decisionMap[fi(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=a,je(s,a),i===void 0?(je(a,o),je(a,l)):(je(a,l),je(a,i.left),je(i.right,o)),{left:o,right:l}}function l_(e,t,n,r,i){let o=r.left,s=r.right,a=Je(e,t,n,{type:z1});Ar(e,a);let l=Je(e,t,n,{type:i_}),c=Je(e,t,n,{type:H1});return a.loopback=c,l.loopback=c,je(a,o),je(a,l),je(s,c),i!==void 0?(je(c,l),je(c,i.left),je(i.right,o)):je(c,a),e.decisionMap[fi(t,i?"RepetitionWithSeparator":"Repetition",n.idx)]=a,{left:a,right:l}}function eD(e,t,n,r){let i=r.left,o=r.right;return je(i,o),e.decisionMap[fi(t,"Option",n.idx)]=i,r}function Ar(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function bo(e,t,n,r,...i){let o=Je(e,t,r,{type:G1,start:n});n.end=o;for(let a of i)a!==void 0?(je(n,a.left),je(a.right,o)):je(n,o);let s={left:n,right:o};return e.decisionMap[fi(t,tD(r),r.idx)]=n,s}function tD(e){if(e instanceof Ie)return"Alternation";if(e instanceof we)return"Option";if(e instanceof ge)return"Repetition";if(e instanceof ke)return"RepetitionWithSeparator";if(e instanceof Ne)return"RepetitionMandatory";if(e instanceof Le)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function nD(e,t){let n=t.length;for(let o=0;o<n-1;o++){let s=t[o],a;s.left.transitions.length===1&&(a=s.left.transitions[0]);let l=a instanceof ui,c=a,u=t[o+1].left;s.left.type===vr&&s.right.type===vr&&a!==void 0&&(l&&c.followState===s.right||a.target===s.right)?(l?c.followState=u:a.target=u,oD(e,s.right)):je(s.right,u)}let r=t[0],i=t[n-1];return{left:r.left,right:i.right}}function nm(e,t,n,r){let i=Je(e,t,r,{type:vr}),o=Je(e,t,r,{type:vr});return rm(i,new ci(o,n)),{left:i,right:o}}function rD(e,t,n){let r=n.referencedRule,i=e.ruleToStartState.get(r),o=Je(e,t,n,{type:vr}),s=Je(e,t,n,{type:vr}),a=new ui(i,r,s);return rm(o,a),{left:o,right:s}}function iD(e,t,n){let r=e.ruleToStartState.get(t);je(r,n.left);let i=e.ruleToStopState.get(t);return je(n.right,i),{left:r,right:i}}function je(e,t){let n=new Ia(t);rm(e,n)}function Je(e,t,n,r){let i=Object.assign({atn:e,production:n,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},r);return e.states.push(i),i}function rm(e,t){e.transitions.length===0&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function oD(e,t){e.states.splice(e.states.indexOf(t),1)}var Ra={},No=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(t){let n=im(t);n in this.map||(this.map[n]=this.configs.length,this.configs.push(t))}get elements(){return this.configs}get alts(){return Lt(this.configs,t=>t.alt)}get key(){let t="";for(let n in this.map)t+=n+":";return t}};function im(e,t=!0){return`${t?`a${e.alt}`:""}s${e.state.stateNumber}:${e.stack.map(n=>n.stateNumber.toString()).join("_")}`}function sD(e,t,n){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=t(o);if(s!=null&&(a===void 0?s===s&&!xr(s):n(s,a)))var a=s,l=o}return l}var c_=sD;function aD(e,t){return e<t}var u_=aD;function lD(e){return e&&e.length?c_(e,So,u_):void 0}var f_=lD;var d_=dt?dt.isConcatSpreadable:void 0;function cD(e){return Te(e)||mr(e)||!!(d_&&e&&e[d_])}var p_=cD;function h_(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=p_),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?h_(a,t-1,n,r,i):mu(i,a):r||(i[i.length]=a)}return i}var bu=h_;function uD(e,t){return bu(Lt(e,t),1)}var m_=uD;function fD(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var g_=fD;function dD(e){return e!==e}var y_=dD;function pD(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var x_=pD;function hD(e,t,n){return t===t?x_(e,t,n):g_(e,y_,n)}var E_=hD;function mD(e,t){var n=e==null?0:e.length;return!!n&&E_(e,t,0)>-1}var w_=mD;function gD(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var T_=gD;function yD(){}var v_=yD;var xD=1/0,ED=yr&&1/_o(new yr([,-0]))[1]==xD?function(e){return new yr(e)}:v_,__=ED;var wD=200;function TD(e,t,n){var r=-1,i=w_,o=e.length,s=!0,a=[],l=a;if(n)s=!1,i=T_;else if(o>=wD){var c=t?null:__(e);if(c)return _o(c);s=!1,i=pu,l=new du}else l=t?[]:a;e:for(;++r<o;){var u=e[r],f=t?t(u):u;if(u=n||u!==0?u:0,s&&f===f){for(var d=l.length;d--;)if(l[d]===f)continue e;t&&l.push(f),a.push(u)}else i(l,f,n)||(l!==a&&l.push(f),a.push(u))}return a}var A_=TD;function vD(e,t){return e&&e.length?A_(e,wr(t,2)):[]}var k_=vD;function _D(e){var t=e==null?0:e.length;return t?bu(e,1):[]}var I_=_D;function AD(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var R_=AD;function kD(e){return typeof e=="function"?e:So}var S_=kD;function ID(e,t){var n=Te(e)?R_:Tr;return n(e,S_(t))}var Nu=ID;var RD="[object Map]",SD="[object Set]",bD=Object.prototype,ND=bD.hasOwnProperty;function LD(e){if(e==null)return!0;if(gr(e)&&(Te(e)||typeof e=="string"||typeof e.splice=="function"||ai(e)||ko(e)||mr(e)))return!e.length;var t=Aa(e);if(t==RD||t==SD)return!e.size;if(xu(e))return!Eu(e).length;for(var n in e)if(ND.call(e,n))return!1;return!0}var b_=LD;function PD(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}var N_=PD;function OD(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}var L_=OD;function CD(e,t,n){var r=Te(e)?N_:L_,i=arguments.length<3;return r(e,wr(t,4),n,i,Tr)}var om=CD;function $D(e,t){let n={};return r=>{let i=r.toString(),o=n[i];return o!==void 0||(o={atnStartState:e,decision:t,states:{}},n[i]=o),o}}var Lu=class{constructor(){this.predicates=[]}is(t){return t>=this.predicates.length||this.predicates[t]}set(t,n){this.predicates[t]=n}toString(){let t="",n=this.predicates.length;for(let r=0;r<n;r++)t+=this.predicates[r]===!0?"1":"0";return t}},P_=new Lu,Sa=class extends Nn{constructor(t){var n,r;super(),this.logging=(n=t?.logging)!==null&&n!==void 0?n:(i=>console.log(i)),this.incomplete=(r=t?.incomplete)!==null&&r!==void 0?r:!1}initialize(t){this.atn=o_(t.rules),this.dfas=FD(this.atn),this.callers=DD(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(t){let{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:o}=t,s=this.dfas,a=this.logging,l=this.incomplete,c=fi(r,"Alternation",n),f=this.atn.decisionMap[c].decision,d=Lt(Xc({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),p=>Lt(p,m=>m[0]));if(O_(d,!1)&&!o){let p=om(d,(m,g,w)=>(Nu(g,x=>{x&&(m[x.tokenTypeIdx]=w,Nu(x.categoryMatches,y=>{m[y]=w}))}),m),{});return i?function(m){var g;let w=this.LA_FAST(1),x=p[w.tokenTypeIdx];if(m!==void 0&&x!==void 0){let y=(g=m[x])===null||g===void 0?void 0:g.GATE;if(y!==void 0&&y.call(this)===!1)return}return x}:function(){let m=this.LA_FAST(1);return p[m.tokenTypeIdx]}}else return i?function(p){let m=new Lu,g=p===void 0?0:p.length;for(let x=0;x<g;x++){let y=p?.[x].GATE;m.set(x,y===void 0||y.call(this))}let w=sm.call(this,s,f,m,a,l);return typeof w=="number"?w:void 0}:function(){let p=sm.call(this,s,f,P_,a,l);return typeof p=="number"?p:void 0}}buildLookaheadForOptional(t){let{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:o}=t,s=this.dfas,a=this.logging,l=this.incomplete,c=this.callers,u=fi(r,i,n),f=this.atn.decisionMap[u],d=f.decision,p=Lt(Xc({maxLookahead:1,occurrence:n,prodType:i,rule:r}),m=>Lt(m,g=>g[0]));if(O_(p)&&p[0][0]&&!o&&!MD(f,i,c)){let m=p[0],g=I_(m);if(g.length===1&&b_(g[0].categoryMatches)){let x=g[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===x}}else{let w=om(g,(x,y)=>(y!==void 0&&(x[y.tokenTypeIdx]=!0,Nu(y.categoryMatches,E=>{x[E]=!0})),x),{});return function(){let x=this.LA_FAST(1);return w[x.tokenTypeIdx]===!0}}}return function(){let m=sm.call(this,s,d,P_,a,l);return typeof m=="object"?!1:m===0}}};function O_(e,t=!0){let n=new Set;for(let r of e){let i=new Set;for(let o of r){if(o===void 0){if(t)break;return!1}let s=[o.tokenTypeIdx].concat(o.categoryMatches);for(let a of s)if(n.has(a)){if(!i.has(a))return!1}else n.add(a),i.add(a)}}return!0}function DD(e){let t=new Map;for(let n of e.states)for(let r of n.transitions)if(r instanceof ui){let i=t.get(r.rule);i===void 0&&(i=[],t.set(r.rule,i)),i.push(r.followState)}return t}function C_(e,t){let n=new Set,r=new Set,i=[e];for(;i.length>0;){let o=i.shift();if(!r.has(o)){if(r.add(o),o.type===_r){if(t!==void 0){let s=t.get(o.rule);s!==void 0&&i.push(...s)}continue}for(let s of o.transitions)if(s instanceof ci){n.add(s.tokenType.tokenTypeIdx);for(let a of s.tokenType.categoryMatches)n.add(a)}else i.push(s.target)}}return n}function MD(e,t,n){let r=t==="RepetitionMandatoryWithSeparator",i=e.transitions[r?1:0],o=e.transitions[r?0:1];if(i===void 0||o===void 0)return!1;let s=C_(i.target),a=C_(o.target,n);for(let l of s)if(a.has(l))return!0;return!1}function FD(e){let t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=$D(e.decisionStates[r],r);return n}function sm(e,t,n,r,i){let o=e[t](n),s=o.start;if(s===void 0){let l=KD(o.atnStartState);s=M_(o,D_(l)),o.start=s}return BD.apply(this,[o,s,n,r,i])}function BD(e,t,n,r,i){let o=t,s=1,a=[],l=this.LA_FAST(s++);for(;;){let c=zD(o,l);if(c===void 0&&(c=WD.apply(this,[e,o,l,s,n,r])),c===Ra)return HD(a,o,l);if(c.isAcceptState===!0){if(i===!0&&uo(l,ut)){let u=rM(o,n);if(u!==void 0)return u}return c.prediction}o=c,a.push(l),l=this.LA(s++)}}function WD(e,t,n,r,i,o){let s=jD(t.configs,n,i);if(s.size===0)return $_(e,t,n,Ra),Ra;let a=D_(s),l=VD(s,i);if(l!==void 0)a.isAcceptState=!0,a.prediction=l,a.configs.uniqueAlt=l;else if(QD(s)){let c=f_(s.alts);a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c,XD.apply(this,[e,r,s.alts,o])}return a=$_(e,t,n,a),a}function XD(e,t,n,r){let i=[];for(let c=1;c<=t;c++)i.push(this.LA(c).tokenType);let o=e.atnStartState,s=o.rule,a=o.production,l=UD({topLevelRule:s,ambiguityIndices:n,production:a,prefixPath:i});r(l)}function UD(e){let t=Lt(e.prefixPath,i=>Rn(i)).join(", "),n=e.production.idx===0?"":e.production.idx,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${GD(e.production)}${n}> inside <${e.topLevelRule.name}> Rule,
114
+ For further details.`);this.skipValidations=Object.hasOwn(n,"skipValidations")?n.skipValidations:ft.skipValidations}};Ta.DEFER_DEFINITION_ERRORS_HANDLING=!1;vT(Ta,[jc,Vc,Jc,Qc,tu,eu,nu,ru,su]);var va=class extends Ta{constructor(t,n=ft){let r=Object.assign({},n);r.outputCst=!1,super(t,r)}};function MP(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var lu=MP;function FP(){this.__data__=[],this.size=0}var _T=FP;function BP(e,t){return e===t||e!==e&&t!==t}var cu=BP;function WP(e,t){for(var n=e.length;n--;)if(cu(e[n][0],t))return n;return-1}var fr=WP;var XP=Array.prototype,UP=XP.splice;function GP(e){var t=this.__data__,n=fr(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():UP.call(t,n,1),--this.size,!0}var AT=GP;function HP(e){var t=this.__data__,n=fr(t,e);return n<0?void 0:t[n][1]}var kT=HP;function zP(e){return fr(this.__data__,e)>-1}var IT=zP;function jP(e,t){var n=this.__data__,r=fr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var RT=jP;function xo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}xo.prototype.clear=_T;xo.prototype.delete=AT;xo.prototype.get=kT;xo.prototype.has=IT;xo.prototype.set=RT;var dr=xo;function YP(){this.__data__=new dr,this.size=0}var ST=YP;function VP(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var bT=VP;function KP(e){return this.__data__.get(e)}var NT=KP;function qP(e){return this.__data__.has(e)}var LT=qP;var ZP=typeof global=="object"&&global&&global.Object===Object&&global,uu=ZP;var JP=typeof self=="object"&&self&&self.Object===Object&&self,QP=uu||JP||Function("return this")(),Ze=QP;var eO=Ze.Symbol,dt=eO;var PT=Object.prototype,tO=PT.hasOwnProperty,nO=PT.toString,_a=dt?dt.toStringTag:void 0;function rO(e){var t=tO.call(e,_a),n=e[_a];try{e[_a]=void 0;var r=!0}catch{}var i=nO.call(e);return r&&(t?e[_a]=n:delete e[_a]),i}var OT=rO;var iO=Object.prototype,oO=iO.toString;function sO(e){return oO.call(e)}var CT=sO;var aO="[object Null]",lO="[object Undefined]",$T=dt?dt.toStringTag:void 0;function cO(e){return e==null?e===void 0?lO:aO:$T&&$T in Object(e)?OT(e):CT(e)}var Kt=cO;function uO(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Eo=uO;var fO="[object AsyncFunction]",dO="[object Function]",pO="[object GeneratorFunction]",hO="[object Proxy]";function mO(e){if(!Eo(e))return!1;var t=Kt(e);return t==dO||t==pO||t==fO||t==hO}var fu=mO;var gO=Ze["__core-js_shared__"],du=gO;var DT=(function(){var e=/[^.]+$/.exec(du&&du.keys&&du.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function yO(e){return!!DT&&DT in e}var MT=yO;var xO=Function.prototype,EO=xO.toString;function wO(e){if(e!=null){try{return EO.call(e)}catch{}try{return e+""}catch{}}return""}var Pn=wO;var TO=/[\\^$.*+?()[\]{}|]/g,vO=/^\[object .+?Constructor\]$/,_O=Function.prototype,AO=Object.prototype,kO=_O.toString,IO=AO.hasOwnProperty,RO=RegExp("^"+kO.call(IO).replace(TO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function SO(e){if(!Eo(e)||MT(e))return!1;var t=fu(e)?RO:vO;return t.test(Pn(e))}var FT=SO;function bO(e,t){return e?.[t]}var BT=bO;function NO(e,t){var n=BT(e,t);return FT(n)?n:void 0}var Bt=NO;var LO=Bt(Ze,"Map"),pr=LO;var PO=Bt(Object,"create"),On=PO;function OO(){this.__data__=On?On(null):{},this.size=0}var WT=OO;function CO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var XT=CO;var $O="__lodash_hash_undefined__",DO=Object.prototype,MO=DO.hasOwnProperty;function FO(e){var t=this.__data__;if(On){var n=t[e];return n===$O?void 0:n}return MO.call(t,e)?t[e]:void 0}var UT=FO;var BO=Object.prototype,WO=BO.hasOwnProperty;function XO(e){var t=this.__data__;return On?t[e]!==void 0:WO.call(t,e)}var GT=XO;var UO="__lodash_hash_undefined__";function GO(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=On&&t===void 0?UO:t,this}var HT=GO;function wo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}wo.prototype.clear=WT;wo.prototype.delete=XT;wo.prototype.get=UT;wo.prototype.has=GT;wo.prototype.set=HT;var qh=wo;function HO(){this.size=0,this.__data__={hash:new qh,map:new(pr||dr),string:new qh}}var zT=HO;function zO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var jT=zO;function jO(e,t){var n=e.__data__;return jT(t)?n[typeof t=="string"?"string":"hash"]:n.map}var hr=jO;function YO(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t}var YT=YO;function VO(e){return hr(this,e).get(e)}var VT=VO;function KO(e){return hr(this,e).has(e)}var KT=KO;function qO(e,t){var n=hr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var qT=qO;function To(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}To.prototype.clear=zT;To.prototype.delete=YT;To.prototype.get=VT;To.prototype.has=KT;To.prototype.set=qT;var si=To;var ZO=200;function JO(e,t){var n=this.__data__;if(n instanceof dr){var r=n.__data__;if(!pr||r.length<ZO-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new si(r)}return n.set(e,t),this.size=n.size,this}var ZT=JO;function vo(e){var t=this.__data__=new dr(e);this.size=t.size}vo.prototype.clear=ST;vo.prototype.delete=bT;vo.prototype.get=NT;vo.prototype.has=LT;vo.prototype.set=ZT;var _o=vo;var QO="__lodash_hash_undefined__";function eC(e){return this.__data__.set(e,QO),this}var JT=eC;function tC(e){return this.__data__.has(e)}var QT=tC;function pu(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new si;++t<n;)this.add(e[t])}pu.prototype.add=pu.prototype.push=JT;pu.prototype.has=QT;var hu=pu;function nC(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var ev=nC;function rC(e,t){return e.has(t)}var mu=rC;var iC=1,oC=2;function sC(e,t,n,r,i,o){var s=n&iC,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var f=-1,d=!0,p=n&oC?new hu:void 0;for(o.set(e,t),o.set(t,e);++f<a;){var m=e[f],g=t[f];if(r)var E=s?r(g,m,f,t,e,o):r(m,g,f,e,t,o);if(E!==void 0){if(E)continue;d=!1;break}if(p){if(!ev(t,function(x,y){if(!mu(p,y)&&(m===x||i(m,x,n,r,o)))return p.push(y)})){d=!1;break}}else if(!(m===g||i(m,g,n,r,o))){d=!1;break}}return o.delete(e),o.delete(t),d}var gu=sC;var aC=Ze.Uint8Array,Zh=aC;function lC(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}var tv=lC;function cC(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Ao=cC;var uC=1,fC=2,dC="[object Boolean]",pC="[object Date]",hC="[object Error]",mC="[object Map]",gC="[object Number]",yC="[object RegExp]",xC="[object Set]",EC="[object String]",wC="[object Symbol]",TC="[object ArrayBuffer]",vC="[object DataView]",nv=dt?dt.prototype:void 0,Jh=nv?nv.valueOf:void 0;function _C(e,t,n,r,i,o,s){switch(n){case vC:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case TC:return!(e.byteLength!=t.byteLength||!o(new Zh(e),new Zh(t)));case dC:case pC:case gC:return cu(+e,+t);case hC:return e.name==t.name&&e.message==t.message;case yC:case EC:return e==t+"";case mC:var a=tv;case xC:var l=r&uC;if(a||(a=Ao),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=fC,s.set(e,t);var u=gu(a(e),a(t),r,i,o,s);return s.delete(e),u;case wC:if(Jh)return Jh.call(e)==Jh.call(t)}return!1}var rv=_C;function AC(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var yu=AC;var kC=Array.isArray,ve=kC;function IC(e,t,n){var r=t(e);return ve(e)?r:yu(r,n(e))}var iv=IC;function RC(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}var xu=RC;function SC(){return[]}var ov=SC;var bC=Object.prototype,NC=bC.propertyIsEnumerable,sv=Object.getOwnPropertySymbols,LC=sv?function(e){return e==null?[]:(e=Object(e),xu(sv(e),function(t){return NC.call(e,t)}))}:ov,av=LC;function PC(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var lv=PC;function OC(e){return e!=null&&typeof e=="object"}var qt=OC;var CC="[object Arguments]";function $C(e){return qt(e)&&Kt(e)==CC}var Qh=$C;var cv=Object.prototype,DC=cv.hasOwnProperty,MC=cv.propertyIsEnumerable,FC=Qh((function(){return arguments})())?Qh:function(e){return qt(e)&&DC.call(e,"callee")&&!MC.call(e,"callee")},mr=FC;function BC(){return!1}var uv=BC;var pv=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fv=pv&&typeof module=="object"&&module&&!module.nodeType&&module,WC=fv&&fv.exports===pv,dv=WC?Ze.Buffer:void 0,XC=dv?dv.isBuffer:void 0,UC=XC||uv,ai=UC;var GC=9007199254740991,HC=/^(?:0|[1-9]\d*)$/;function zC(e,t){var n=typeof e;return t=t??GC,!!t&&(n=="number"||n!="symbol"&&HC.test(e))&&e>-1&&e%1==0&&e<t}var Eu=zC;var jC=9007199254740991;function YC(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=jC}var ko=YC;var VC="[object Arguments]",KC="[object Array]",qC="[object Boolean]",ZC="[object Date]",JC="[object Error]",QC="[object Function]",e$="[object Map]",t$="[object Number]",n$="[object Object]",r$="[object RegExp]",i$="[object Set]",o$="[object String]",s$="[object WeakMap]",a$="[object ArrayBuffer]",l$="[object DataView]",c$="[object Float32Array]",u$="[object Float64Array]",f$="[object Int8Array]",d$="[object Int16Array]",p$="[object Int32Array]",h$="[object Uint8Array]",m$="[object Uint8ClampedArray]",g$="[object Uint16Array]",y$="[object Uint32Array]",Pe={};Pe[c$]=Pe[u$]=Pe[f$]=Pe[d$]=Pe[p$]=Pe[h$]=Pe[m$]=Pe[g$]=Pe[y$]=!0;Pe[VC]=Pe[KC]=Pe[a$]=Pe[qC]=Pe[l$]=Pe[ZC]=Pe[JC]=Pe[QC]=Pe[e$]=Pe[t$]=Pe[n$]=Pe[r$]=Pe[i$]=Pe[o$]=Pe[s$]=!1;function x$(e){return qt(e)&&ko(e.length)&&!!Pe[Kt(e)]}var hv=x$;function E$(e){return function(t){return e(t)}}var mv=E$;var gv=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Aa=gv&&typeof module=="object"&&module&&!module.nodeType&&module,w$=Aa&&Aa.exports===gv,em=w$&&uu.process,T$=(function(){try{var e=Aa&&Aa.require&&Aa.require("util").types;return e||em&&em.binding&&em.binding("util")}catch{}})(),tm=T$;var yv=tm&&tm.isTypedArray,v$=yv?mv(yv):hv,Io=v$;var _$=Object.prototype,A$=_$.hasOwnProperty;function k$(e,t){var n=ve(e),r=!n&&mr(e),i=!n&&!r&&ai(e),o=!n&&!r&&!i&&Io(e),s=n||r||i||o,a=s?lv(e.length,String):[],l=a.length;for(var c in e)(t||A$.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Eu(c,l)))&&a.push(c);return a}var xv=k$;var I$=Object.prototype;function R$(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||I$;return e===n}var wu=R$;function S$(e,t){return function(n){return e(t(n))}}var Ev=S$;var b$=Ev(Object.keys,Object),wv=b$;var N$=Object.prototype,L$=N$.hasOwnProperty;function P$(e){if(!wu(e))return wv(e);var t=[];for(var n in Object(e))L$.call(e,n)&&n!="constructor"&&t.push(n);return t}var Tu=P$;function O$(e){return e!=null&&ko(e.length)&&!fu(e)}var gr=O$;function C$(e){return gr(e)?xv(e):Tu(e)}var Ro=C$;function $$(e){return iv(e,Ro,av)}var nm=$$;var D$=1,M$=Object.prototype,F$=M$.hasOwnProperty;function B$(e,t,n,r,i,o){var s=n&D$,a=nm(e),l=a.length,c=nm(t),u=c.length;if(l!=u&&!s)return!1;for(var f=l;f--;){var d=a[f];if(!(s?d in t:F$.call(t,d)))return!1}var p=o.get(e),m=o.get(t);if(p&&m)return p==t&&m==e;var g=!0;o.set(e,t),o.set(t,e);for(var E=s;++f<l;){d=a[f];var x=e[d],y=t[d];if(r)var w=s?r(y,x,d,t,e,o):r(x,y,d,e,t,o);if(!(w===void 0?x===y||i(x,y,n,r,o):w)){g=!1;break}E||(E=d=="constructor")}if(g&&!E){var _=e.constructor,v=t.constructor;_!=v&&"constructor"in e&&"constructor"in t&&!(typeof _=="function"&&_ instanceof _&&typeof v=="function"&&v instanceof v)&&(g=!1)}return o.delete(e),o.delete(t),g}var Tv=B$;var W$=Bt(Ze,"DataView"),vu=W$;var X$=Bt(Ze,"Promise"),_u=X$;var U$=Bt(Ze,"Set"),yr=U$;var G$=Bt(Ze,"WeakMap"),Au=G$;var vv="[object Map]",H$="[object Object]",_v="[object Promise]",Av="[object Set]",kv="[object WeakMap]",Iv="[object DataView]",z$=Pn(vu),j$=Pn(pr),Y$=Pn(_u),V$=Pn(yr),K$=Pn(Au),li=Kt;(vu&&li(new vu(new ArrayBuffer(1)))!=Iv||pr&&li(new pr)!=vv||_u&&li(_u.resolve())!=_v||yr&&li(new yr)!=Av||Au&&li(new Au)!=kv)&&(li=function(e){var t=Kt(e),n=t==H$?e.constructor:void 0,r=n?Pn(n):"";if(r)switch(r){case z$:return Iv;case j$:return vv;case Y$:return _v;case V$:return Av;case K$:return kv}return t});var ka=li;var q$=1,Rv="[object Arguments]",Sv="[object Array]",ku="[object Object]",Z$=Object.prototype,bv=Z$.hasOwnProperty;function J$(e,t,n,r,i,o){var s=ve(e),a=ve(t),l=s?Sv:ka(e),c=a?Sv:ka(t);l=l==Rv?ku:l,c=c==Rv?ku:c;var u=l==ku,f=c==ku,d=l==c;if(d&&ai(e)){if(!ai(t))return!1;s=!0,u=!1}if(d&&!u)return o||(o=new _o),s||Io(e)?gu(e,t,n,r,i,o):rv(e,t,l,n,r,i,o);if(!(n&q$)){var p=u&&bv.call(e,"__wrapped__"),m=f&&bv.call(t,"__wrapped__");if(p||m){var g=p?e.value():e,E=m?t.value():t;return o||(o=new _o),i(g,E,n,r,o)}}return d?(o||(o=new _o),Tv(e,t,n,r,i,o)):!1}var Nv=J$;function Lv(e,t,n,r,i){return e===t?!0:e==null||t==null||!qt(e)&&!qt(t)?e!==e&&t!==t:Nv(e,t,n,r,Lv,i)}var Iu=Lv;var Q$=1,e1=2;function t1(e,t,n,r){var i=n.length,o=i,s=!r;if(e==null)return!o;for(e=Object(e);i--;){var a=n[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=n[i];var l=a[0],c=e[l],u=a[1];if(s&&a[2]){if(c===void 0&&!(l in e))return!1}else{var f=new _o;if(r)var d=r(c,u,l,e,t,f);if(!(d===void 0?Iu(u,c,Q$|e1,r,f):d))return!1}}return!0}var Pv=t1;function n1(e){return e===e&&!Eo(e)}var Ru=n1;function r1(e){for(var t=Ro(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Ru(i)]}return t}var Ov=r1;function i1(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var Su=i1;function o1(e){var t=Ov(e);return t.length==1&&t[0][2]?Su(t[0][0],t[0][1]):function(n){return n===e||Pv(n,e,t)}}var Cv=o1;var s1="[object Symbol]";function a1(e){return typeof e=="symbol"||qt(e)&&Kt(e)==s1}var xr=a1;var l1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c1=/^\w*$/;function u1(e,t){if(ve(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||xr(e)?!0:c1.test(e)||!l1.test(e)||t!=null&&e in Object(t)}var So=u1;var f1="Expected a function";function rm(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(f1);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(rm.Cache||si),n}rm.Cache=si;var $v=rm;var d1=500;function p1(e){var t=$v(e,function(r){return n.size===d1&&n.clear(),r}),n=t.cache;return t}var Dv=p1;var h1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,m1=/\\(\\)?/g,g1=Dv(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(h1,function(n,r,i,o){t.push(i?o.replace(m1,"$1"):r||n)}),t}),Mv=g1;var y1=1/0,Fv=dt?dt.prototype:void 0,Bv=Fv?Fv.toString:void 0;function Wv(e){if(typeof e=="string")return e;if(ve(e))return lu(e,Wv)+"";if(xr(e))return Bv?Bv.call(e):"";var t=e+"";return t=="0"&&1/e==-y1?"-0":t}var Xv=Wv;function x1(e){return e==null?"":Xv(e)}var Uv=x1;function E1(e,t){return ve(e)?e:So(e,t)?[e]:Mv(Uv(e))}var bu=E1;var w1=1/0;function T1(e){if(typeof e=="string"||xr(e))return e;var t=e+"";return t=="0"&&1/e==-w1?"-0":t}var Er=T1;function v1(e,t){t=bu(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Er(t[n++])];return n&&n==r?e:void 0}var Nu=v1;function _1(e,t,n){var r=e==null?void 0:Nu(e,t);return r===void 0?n:r}var Gv=_1;function A1(e,t){return e!=null&&t in Object(e)}var Hv=A1;function k1(e,t,n){t=bu(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=Er(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&ko(i)&&Eu(s,i)&&(ve(e)||mr(e)))}var zv=k1;function I1(e,t){return e!=null&&zv(e,t,Hv)}var jv=I1;var R1=1,S1=2;function b1(e,t){return So(e)&&Ru(t)?Su(Er(e),t):function(n){var r=Gv(n,e);return r===void 0&&r===t?jv(n,e):Iu(t,r,R1|S1)}}var Yv=b1;function N1(e){return e}var bo=N1;function L1(e){return function(t){return t?.[e]}}var Vv=L1;function P1(e){return function(t){return Nu(t,e)}}var Kv=P1;function O1(e){return So(e)?Vv(Er(e)):Kv(e)}var qv=O1;function C1(e){return typeof e=="function"?e:e==null?bo:typeof e=="object"?ve(e)?Yv(e[0],e[1]):Cv(e):qv(e)}var wr=C1;function $1(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var l=s[e?a:++i];if(n(o[l],l,o)===!1)break}return t}}var Zv=$1;var D1=Zv(),Jv=D1;function M1(e,t){return e&&Jv(e,t,Ro)}var Qv=M1;function F1(e,t){return function(n,r){if(n==null)return n;if(!gr(n))return e(n,r);for(var i=n.length,o=t?i:-1,s=Object(n);(t?o--:++o<i)&&r(s[o],o,s)!==!1;);return n}}var e_=F1;var B1=e_(Qv),Tr=B1;function W1(e,t){var n=-1,r=gr(e)?Array(e.length):[];return Tr(e,function(i,o,s){r[++n]=t(i,o,s)}),r}var t_=W1;function X1(e,t){var n=ve(e)?lu:t_;return n(e,wr(t,3))}var Lt=X1;function U1(e,t){var n=[];return Tr(e,function(r,i,o){t(r,i,o)&&n.push(r)}),n}var n_=U1;function G1(e,t){var n=ve(e)?xu:n_;return n(e,wr(t,3))}var r_=G1;function fi(e,t,n){return`${e.name}_${t}_${n}`}var vr=1,H1=2,i_=4,o_=5;var _r=7,z1=8,j1=9,Y1=10,V1=11,s_=12,Ia=class{constructor(t){this.target=t}isEpsilon(){return!1}},ci=class extends Ia{constructor(t,n){super(t),this.tokenType=n}},Ra=class extends Ia{constructor(t){super(t)}isEpsilon(){return!0}},ui=class extends Ia{constructor(t,n,r){super(t),this.rule=n,this.followState=r}isEpsilon(){return!0}};function a_(e){let t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};K1(t,e);let n=e.length;for(let r=0;r<n;r++){let i=e[r],o=di(t,i,i);o!==void 0&&sD(t,i,o)}return t}function K1(e,t){let n=t.length;for(let r=0;r<n;r++){let i=t[r],o=Je(e,i,void 0,{type:H1}),s=Je(e,i,void 0,{type:_r});o.stop=s,e.ruleToStartState.set(i,o),e.ruleToStopState.set(i,s)}}function l_(e,t,n){return n instanceof ue?im(e,t,n.terminalType,n):n instanceof Ee?oD(e,t,n):n instanceof Ie?eD(e,t,n):n instanceof we?tD(e,t,n):n instanceof ge?q1(e,t,n):n instanceof ke?Z1(e,t,n):n instanceof Ne?J1(e,t,n):n instanceof Le?Q1(e,t,n):di(e,t,n)}function q1(e,t,n){let r=Je(e,t,n,{type:o_});Ar(e,r);let i=No(e,t,r,n,di(e,t,n));return u_(e,t,n,i)}function Z1(e,t,n){let r=Je(e,t,n,{type:o_});Ar(e,r);let i=No(e,t,r,n,di(e,t,n)),o=im(e,t,n.separator,n);return u_(e,t,n,i,o)}function J1(e,t,n){let r=Je(e,t,n,{type:i_});Ar(e,r);let i=No(e,t,r,n,di(e,t,n));return c_(e,t,n,i)}function Q1(e,t,n){let r=Je(e,t,n,{type:i_});Ar(e,r);let i=No(e,t,r,n,di(e,t,n)),o=im(e,t,n.separator,n);return c_(e,t,n,i,o)}function eD(e,t,n){let r=Je(e,t,n,{type:vr});Ar(e,r);let i=Lt(n.definition,s=>l_(e,t,s));return No(e,t,r,n,...i)}function tD(e,t,n){let r=Je(e,t,n,{type:vr});Ar(e,r);let i=No(e,t,r,n,di(e,t,n));return nD(e,t,n,i)}function di(e,t,n){let r=r_(Lt(n.definition,i=>l_(e,t,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:iD(e,r)}function c_(e,t,n,r,i){let o=r.left,s=r.right,a=Je(e,t,n,{type:V1});Ar(e,a);let l=Je(e,t,n,{type:s_});return o.loopback=a,l.loopback=a,e.decisionMap[fi(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=a,je(s,a),i===void 0?(je(a,o),je(a,l)):(je(a,l),je(a,i.left),je(i.right,o)),{left:o,right:l}}function u_(e,t,n,r,i){let o=r.left,s=r.right,a=Je(e,t,n,{type:Y1});Ar(e,a);let l=Je(e,t,n,{type:s_}),c=Je(e,t,n,{type:j1});return a.loopback=c,l.loopback=c,je(a,o),je(a,l),je(s,c),i!==void 0?(je(c,l),je(c,i.left),je(i.right,o)):je(c,a),e.decisionMap[fi(t,i?"RepetitionWithSeparator":"Repetition",n.idx)]=a,{left:a,right:l}}function nD(e,t,n,r){let i=r.left,o=r.right;return je(i,o),e.decisionMap[fi(t,"Option",n.idx)]=i,r}function Ar(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function No(e,t,n,r,...i){let o=Je(e,t,r,{type:z1,start:n});n.end=o;for(let a of i)a!==void 0?(je(n,a.left),je(a.right,o)):je(n,o);let s={left:n,right:o};return e.decisionMap[fi(t,rD(r),r.idx)]=n,s}function rD(e){if(e instanceof Ie)return"Alternation";if(e instanceof we)return"Option";if(e instanceof ge)return"Repetition";if(e instanceof ke)return"RepetitionWithSeparator";if(e instanceof Ne)return"RepetitionMandatory";if(e instanceof Le)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function iD(e,t){let n=t.length;for(let o=0;o<n-1;o++){let s=t[o],a;s.left.transitions.length===1&&(a=s.left.transitions[0]);let l=a instanceof ui,c=a,u=t[o+1].left;s.left.type===vr&&s.right.type===vr&&a!==void 0&&(l&&c.followState===s.right||a.target===s.right)?(l?c.followState=u:a.target=u,aD(e,s.right)):je(s.right,u)}let r=t[0],i=t[n-1];return{left:r.left,right:i.right}}function im(e,t,n,r){let i=Je(e,t,r,{type:vr}),o=Je(e,t,r,{type:vr});return om(i,new ci(o,n)),{left:i,right:o}}function oD(e,t,n){let r=n.referencedRule,i=e.ruleToStartState.get(r),o=Je(e,t,n,{type:vr}),s=Je(e,t,n,{type:vr}),a=new ui(i,r,s);return om(o,a),{left:o,right:s}}function sD(e,t,n){let r=e.ruleToStartState.get(t);je(r,n.left);let i=e.ruleToStopState.get(t);return je(n.right,i),{left:r,right:i}}function je(e,t){let n=new Ra(t);om(e,n)}function Je(e,t,n,r){let i=Object.assign({atn:e,production:n,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},r);return e.states.push(i),i}function om(e,t){e.transitions.length===0&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function aD(e,t){e.states.splice(e.states.indexOf(t),1)}var Sa={},Lo=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(t){let n=sm(t);n in this.map||(this.map[n]=this.configs.length,this.configs.push(t))}get elements(){return this.configs}get alts(){return Lt(this.configs,t=>t.alt)}get key(){let t="";for(let n in this.map)t+=n+":";return t}};function sm(e,t=!0){return`${t?`a${e.alt}`:""}s${e.state.stateNumber}:${e.stack.map(n=>n.stateNumber.toString()).join("_")}`}function lD(e,t,n){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=t(o);if(s!=null&&(a===void 0?s===s&&!xr(s):n(s,a)))var a=s,l=o}return l}var f_=lD;function cD(e,t){return e<t}var d_=cD;function uD(e){return e&&e.length?f_(e,bo,d_):void 0}var p_=uD;var h_=dt?dt.isConcatSpreadable:void 0;function fD(e){return ve(e)||mr(e)||!!(h_&&e&&e[h_])}var m_=fD;function g_(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=m_),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?g_(a,t-1,n,r,i):yu(i,a):r||(i[i.length]=a)}return i}var Lu=g_;function dD(e,t){return Lu(Lt(e,t),1)}var y_=dD;function pD(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var x_=pD;function hD(e){return e!==e}var E_=hD;function mD(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var w_=mD;function gD(e,t,n){return t===t?w_(e,t,n):x_(e,E_,n)}var T_=gD;function yD(e,t){var n=e==null?0:e.length;return!!n&&T_(e,t,0)>-1}var v_=yD;function xD(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var __=xD;function ED(){}var A_=ED;var wD=1/0,TD=yr&&1/Ao(new yr([,-0]))[1]==wD?function(e){return new yr(e)}:A_,k_=TD;var vD=200;function _D(e,t,n){var r=-1,i=v_,o=e.length,s=!0,a=[],l=a;if(n)s=!1,i=__;else if(o>=vD){var c=t?null:k_(e);if(c)return Ao(c);s=!1,i=mu,l=new hu}else l=t?[]:a;e:for(;++r<o;){var u=e[r],f=t?t(u):u;if(u=n||u!==0?u:0,s&&f===f){for(var d=l.length;d--;)if(l[d]===f)continue e;t&&l.push(f),a.push(u)}else i(l,f,n)||(l!==a&&l.push(f),a.push(u))}return a}var I_=_D;function AD(e,t){return e&&e.length?I_(e,wr(t,2)):[]}var R_=AD;function kD(e){var t=e==null?0:e.length;return t?Lu(e,1):[]}var S_=kD;function ID(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var b_=ID;function RD(e){return typeof e=="function"?e:bo}var N_=RD;function SD(e,t){var n=ve(e)?b_:Tr;return n(e,N_(t))}var Pu=SD;var bD="[object Map]",ND="[object Set]",LD=Object.prototype,PD=LD.hasOwnProperty;function OD(e){if(e==null)return!0;if(gr(e)&&(ve(e)||typeof e=="string"||typeof e.splice=="function"||ai(e)||Io(e)||mr(e)))return!e.length;var t=ka(e);if(t==bD||t==ND)return!e.size;if(wu(e))return!Tu(e).length;for(var n in e)if(PD.call(e,n))return!1;return!0}var L_=OD;function CD(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}var P_=CD;function $D(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}var O_=$D;function DD(e,t,n){var r=ve(e)?P_:O_,i=arguments.length<3;return r(e,wr(t,4),n,i,Tr)}var am=DD;function MD(e,t){let n={};return r=>{let i=r.toString(),o=n[i];return o!==void 0||(o={atnStartState:e,decision:t,states:{}},n[i]=o),o}}var Ou=class{constructor(){this.predicates=[]}is(t){return t>=this.predicates.length||this.predicates[t]}set(t,n){this.predicates[t]=n}toString(){let t="",n=this.predicates.length;for(let r=0;r<n;r++)t+=this.predicates[r]===!0?"1":"0";return t}},C_=new Ou,ba=class extends Nn{constructor(t){var n,r;super(),this.logging=(n=t?.logging)!==null&&n!==void 0?n:(i=>console.log(i)),this.incomplete=(r=t?.incomplete)!==null&&r!==void 0?r:!1}initialize(t){this.atn=a_(t.rules),this.dfas=WD(this.atn),this.callers=FD(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(t){let{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:o}=t,s=this.dfas,a=this.logging,l=this.incomplete,c=fi(r,"Alternation",n),f=this.atn.decisionMap[c].decision,d=Lt(Gc({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),p=>Lt(p,m=>m[0]));if($_(d,!1)&&!o){let p=am(d,(m,g,E)=>(Pu(g,x=>{x&&(m[x.tokenTypeIdx]=E,Pu(x.categoryMatches,y=>{m[y]=E}))}),m),{});return i?function(m){var g;let E=this.LA_FAST(1),x=p[E.tokenTypeIdx];if(m!==void 0&&x!==void 0){let y=(g=m[x])===null||g===void 0?void 0:g.GATE;if(y!==void 0&&y.call(this)===!1)return}return x}:function(){let m=this.LA_FAST(1);return p[m.tokenTypeIdx]}}else return i?function(p){let m=new Ou,g=p===void 0?0:p.length;for(let x=0;x<g;x++){let y=p?.[x].GATE;m.set(x,y===void 0||y.call(this))}let E=lm.call(this,s,f,m,a,l);return typeof E=="number"?E:void 0}:function(){let p=lm.call(this,s,f,C_,a,l);return typeof p=="number"?p:void 0}}buildLookaheadForOptional(t){let{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:o}=t,s=this.dfas,a=this.logging,l=this.incomplete,c=this.callers,u=fi(r,i,n),f=this.atn.decisionMap[u],d=f.decision,p=Lt(Gc({maxLookahead:1,occurrence:n,prodType:i,rule:r}),m=>Lt(m,g=>g[0]));if($_(p)&&p[0][0]&&!o&&!BD(f,i,c)){let m=p[0],g=S_(m);if(g.length===1&&L_(g[0].categoryMatches)){let x=g[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===x}}else{let E=am(g,(x,y)=>(y!==void 0&&(x[y.tokenTypeIdx]=!0,Pu(y.categoryMatches,w=>{x[w]=!0})),x),{});return function(){let x=this.LA_FAST(1);return E[x.tokenTypeIdx]===!0}}}return function(){let m=lm.call(this,s,d,C_,a,l);return typeof m=="object"?!1:m===0}}};function $_(e,t=!0){let n=new Set;for(let r of e){let i=new Set;for(let o of r){if(o===void 0){if(t)break;return!1}let s=[o.tokenTypeIdx].concat(o.categoryMatches);for(let a of s)if(n.has(a)){if(!i.has(a))return!1}else n.add(a),i.add(a)}}return!0}function FD(e){let t=new Map;for(let n of e.states)for(let r of n.transitions)if(r instanceof ui){let i=t.get(r.rule);i===void 0&&(i=[],t.set(r.rule,i)),i.push(r.followState)}return t}function D_(e,t){let n=new Set,r=new Set,i=[e];for(;i.length>0;){let o=i.shift();if(!r.has(o)){if(r.add(o),o.type===_r){if(t!==void 0){let s=t.get(o.rule);s!==void 0&&i.push(...s)}continue}for(let s of o.transitions)if(s instanceof ci){n.add(s.tokenType.tokenTypeIdx);for(let a of s.tokenType.categoryMatches)n.add(a)}else i.push(s.target)}}return n}function BD(e,t,n){let r=t==="RepetitionMandatoryWithSeparator",i=e.transitions[r?1:0],o=e.transitions[r?0:1];if(i===void 0||o===void 0)return!1;let s=D_(i.target),a=D_(o.target,n);for(let l of s)if(a.has(l))return!0;return!1}function WD(e){let t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=MD(e.decisionStates[r],r);return n}function lm(e,t,n,r,i){let o=e[t](n),s=o.start;if(s===void 0){let l=ZD(o.atnStartState);s=B_(o,F_(l)),o.start=s}return XD.apply(this,[o,s,n,r,i])}function XD(e,t,n,r,i){let o=t,s=1,a=[],l=this.LA_FAST(s++);for(;;){let c=YD(o,l);if(c===void 0&&(c=UD.apply(this,[e,o,l,s,n,r])),c===Sa)return jD(a,o,l);if(c.isAcceptState===!0){if(i===!0&&fo(l,ut)){let u=oM(o,n);if(u!==void 0)return u}return c.prediction}o=c,a.push(l),l=this.LA(s++)}}function UD(e,t,n,r,i,o){let s=VD(t.configs,n,i);if(s.size===0)return M_(e,t,n,Sa),Sa;let a=F_(s),l=qD(s,i);if(l!==void 0)a.isAcceptState=!0,a.prediction=l,a.configs.uniqueAlt=l;else if(tM(s)){let c=p_(s.alts);a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c,GD.apply(this,[e,r,s.alts,o])}return a=M_(e,t,n,a),a}function GD(e,t,n,r){let i=[];for(let c=1;c<=t;c++)i.push(this.LA(c).tokenType);let o=e.atnStartState,s=o.rule,a=o.production,l=HD({topLevelRule:s,ambiguityIndices:n,production:a,prefixPath:i});r(l)}function HD(e){let t=Lt(e.prefixPath,i=>Rn(i)).join(", "),n=e.production.idx===0?"":e.production.idx,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${zD(e.production)}${n}> inside <${e.topLevelRule.name}> Rule,
115
115
  <${t}> may appears as a prefix path in all these alternatives.
116
116
  `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
117
- For Further details.`,r}function GD(e){if(e instanceof Ee)return"SUBRULE";if(e instanceof we)return"OPTION";if(e instanceof Ie)return"OR";if(e instanceof Ne)return"AT_LEAST_ONE";if(e instanceof Le)return"AT_LEAST_ONE_SEP";if(e instanceof ke)return"MANY_SEP";if(e instanceof ge)return"MANY";if(e instanceof ue)return"CONSUME";throw Error("non exhaustive match")}function HD(e,t,n){let r=m_(t.configs.elements,o=>o.state.transitions),i=k_(r.filter(o=>o instanceof ci).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:e}}function zD(e,t){return e.edges[t.tokenTypeIdx]}function jD(e,t,n){let r=new No,i=[];for(let s of e.elements){if(n.is(s.alt)===!1)continue;if(s.state.type===_r){i.push(s);continue}let a=s.state.transitions.length;for(let l=0;l<a;l++){let c=s.state.transitions[l],u=YD(c,t);u!==void 0&&r.add({state:u,alt:s.alt,stack:s.stack})}}let o;if(i.length===0&&r.size===1&&(o=r),o===void 0){o=new No;for(let s of r.elements)Pu(s,o)}if(i.length>0&&!ZD(o))for(let s of i)o.add(s);return o}function YD(e,t){if(e instanceof ci&&uo(t,e.tokenType))return e.target}function VD(e,t){let n;for(let r of e.elements)if(t.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function D_(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function $_(e,t,n,r){return r=M_(e,r),t.edges[n.tokenTypeIdx]=r,r}function M_(e,t){if(t===Ra)return t;let n=t.configs.key,r=e.states[n];return r!==void 0?r:(t.configs.finalize(),e.states[n]=t,t)}function KD(e){let t=new No,n=e.transitions.length;for(let r=0;r<n;r++){let o={state:e.transitions[r].target,alt:r,stack:[]};Pu(o,t)}return t}function Pu(e,t){let n=e.state;if(n.type===_r){if(e.stack.length>0){let i=[...e.stack],s={state:i.pop(),alt:e.alt,stack:i};Pu(s,t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);let r=n.transitions.length;for(let i=0;i<r;i++){let o=n.transitions[i],s=qD(e,o);s!==void 0&&Pu(s,t)}}function qD(e,t){if(t instanceof Ia)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof ui){let n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}function ZD(e){for(let t of e.elements)if(t.state.type===_r)return!0;return!1}function JD(e){for(let t of e.elements)if(t.state.type!==_r)return!1;return!0}function QD(e){if(JD(e))return!0;let t=eM(e.elements);return tM(t)&&!nM(t)}function eM(e){let t=new Map;for(let n of e){let r=im(n,!1),i=t.get(r);i===void 0&&(i={},t.set(r,i)),i[n.alt]=!0}return t}function tM(e){for(let t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}function nM(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}function rM(e,t){let n;for(let r of e.configs.elements)if(!(t.is(r.alt)===!1||r.state.type===_r)){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}var Po=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(t){return this.rootNode=new Na(t),this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(t){let n=new Oo;return n.grammarSource=t,this.appendChild(this.current,n),this.nodeStack.push(n),n}buildLeafNode(t,n){let r=this.createLeafNode(t,!n);return n&&(r.grammarSource=n),this.appendChild(this.current,r),r}createLeafNode(t,n){return new ba(t.startOffset,t.image.length,t.startLine-1,t.startColumn-1,t.endLine-1,t.endColumn,t.tokenType,n)}appendChild(t,n){n.container=t,t.content.push(n)}appendChildren(t,n){for(let r of n)r.container=t;t.content.length===0?t.content=n.slice():t.content.push(...n)}insertChildren(t,n,r){for(let i of r)i.container=t;t.content.splice(n,0,...r)}removeNode(t){let n=t.container;if(n){let r=n.content.indexOf(t);r>=0&&n.content.splice(r,1)}}addHiddenNodes(t){let n=[];for(let o of t)n.push(this.createLeafNode(o,!0));let r=this.current,i=!1;if(r.content.length>0){this.appendChildren(r,n);return}for(;r.container;){let o=r.container.content.indexOf(r);if(o>0){this.insertChildren(r.container,o,n),i=!0;break}r=r.container}i||this.insertChildren(this.rootNode,0,n)}construct(t){let n=this.current;t.$cstNode=n;let r=this.nodeStack.pop();r&&(r.content.length===0?this.removeNode(r):r.content=r.content.slice())}},Ou=class{constructor(){this.container=void 0,this.grammarSource=void 0}get root(){let t=this;for(;t.container;)t=t.container;return t}get text(){return this.root.fullText.substring(this.offset,this.end)}},ba=class extends Ou{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get astNode(){let t=this.container;if(!t)throw new Error("This node has no associated AST element");return t.astNode}get range(){return{start:{line:this._startLine,character:this._startColumn},end:{line:this._endLine,character:this._endColumn}}}constructor(t,n,r,i,o,s,a,l=!1){super(),this._hidden=l,this._offset=Lo(t),this._length=Lo(n),this._startLine=Lo(r),this._startColumn=Lo(i),this._endLine=Lo(o),this._endColumn=Lo(s),this._tokenType=a}};function Lo(e){return e|0}var Oo=class extends Ou{constructor(){super(...arguments),this.content=[],this._astNode=void 0,this._rangeCache=void 0}get astNode(){let t=this;for(;t;){if(t._astNode)return t._astNode;t=t.container}throw new Error("This node has no associated AST element")}set astNode(t){this._astNode=t}get hidden(){return!1}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let t=this._rangeCache;if(t===void 0){let n=this.firstNonHiddenNode,r=this.lastNonHiddenNode;if(n&&r){let{range:i}=n,{range:o}=r;this._rangeCache=t={start:i.start,end:o.end.line<i.start.line?i.start:o.end}}else return{start:{line:0,character:0},end:{line:0,character:0}}}return t}get firstNonHiddenNode(){for(let t of this.content)if(!t.hidden)return t;return this.content[0]}get lastNonHiddenNode(){for(let t=this.content.length-1;t>=0;t--){let n=this.content[t];if(!n.hidden)return n}return this.content[this.content.length-1]}},Na=class extends Oo{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(t){super(),this._text="",this._text=t??""}};var lm=Symbol("Datatype");function am(e){return e.$type===lm}var F_="\u200B",B_=e=>e.endsWith(F_)?e:e+F_,Cu=class{constructor(t,n){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=t.parser.Lexer;let r=this.lexer.definition,i=t.LanguageMetaData.mode==="production";t.shared.profilers.LangiumProfiler?.isActive("parsing")?this.wrapper=new um(r,{...t.parser.ParserConfig,skipValidations:i,errorMessageProvider:t.parser.ParserErrorMessageProvider},n,t.shared.profilers.LangiumProfiler.createTask("parsing",t.LanguageMetaData.languageId)):this.wrapper=new Mu(r,{...t.parser.ParserConfig,skipValidations:i,errorMessageProvider:t.parser.ParserErrorMessageProvider},n)}alternatives(t,n){this.wrapper.wrapOr(t,n)}optional(t,n){this.wrapper.wrapOption(t,n)}many(t,n){this.wrapper.wrapMany(t,n)}atLeastOne(t,n){this.wrapper.wrapAtLeastOne(t,n)}getRule(t){return this.allRules.get(t)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},$u=class extends Cu{get current(){return this.stack[this.stack.length-1]}constructor(t){super(t,!1),this.nodeBuilder=new Po,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=t.references.Linker,this.converter=t.parser.ValueConverter,this.astReflection=t.shared.AstReflection}rule(t,n){let r=this.computeRuleType(t),i;Zr(t)&&(i=t.name,this.registerPrecedenceMap(t));let o=this.wrapper.DEFINE_RULE(B_(t.name),this.startImplementation(r,i,n).bind(this));return this.allRules.set(t.name,o),at(t)&&t.entry&&(this.mainRule=o),o}registerPrecedenceMap(t){let n=t.name,r=new Map;for(let i=0;i<t.operators.precedences.length;i++){let o=t.operators.precedences[i];for(let s of o.operators)r.set(s.value,{precedence:i,rightAssoc:o.associativity==="right"})}this.operatorPrecedence.set(n,r)}computeRuleType(t){return Zr(t)?lr(t):t.fragment?void 0:ia(t)?lm:lr(t)}parse(t,n={}){this.nodeBuilder.buildRootNode(t);let r=this.lexerResult=this.lexer.tokenize(t);this.wrapper.input=r.tokens;let i=n.rule?this.allRules.get(n.rule):this.mainRule;if(!i)throw new Error(n.rule?`No rule found with name '${n.rule}'`:"No main rule available.");let o=this.doParse(i);return this.nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,sc(o,{deep:!0}),{value:o,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}doParse(t){let n=this.wrapper.rule(t);if(this.stack.length>0&&(n=this.construct()),n===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return this.linkCstNode(n),n}linkCstNode(t){Ue(t)&&t.$cstNode&&(t.$cstNode.astNode=t)}startImplementation(t,n,r){return i=>{let o=!this.isRecording()&&t!==void 0;if(o){let s={$type:t};this.stack.push(s),t===lm?s.value="":n!==void 0&&(s.$infixName=n)}return r(i),o?this.construct():void 0}}extractHiddenTokens(t){let n=this.lexerResult.hidden;if(!n.length)return[];let r=t.startOffset;for(let i=0;i<n.length;i++)if(n[i].startOffset>r)return n.splice(0,i);return n.splice(0,n.length)}consume(t,n,r){let i=this.wrapper.wrapConsume(t,n);if(!this.isRecording()&&this.isValidToken(i)){let o=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(o);let s=this.nodeBuilder.buildLeafNode(i,r),{assignment:a,crossRef:l}=this.getAssignment(r),c=this.current;if(a){let u=Yt(r)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,u,s,l)}else if(am(c)){let u=i.image;Yt(r)||(u=this.converter.convert(u,s).toString()),c.value+=u}}}isValidToken(t){return!t.isInsertedInRecovery&&Zs(t)}subrule(t,n,r,i,o){let s;!this.isRecording()&&!r&&(s=this.nodeBuilder.buildCompositeNode(i));let a;try{a=this.wrapper.wrapSubrule(t,n,o)}finally{this.isRecording()||(a===void 0&&!r&&(a=this.construct()),a!==void 0&&s&&s.length>0&&this.performSubruleAssignment(a,i,s))}}performSubruleAssignment(t,n,r){let{assignment:i,crossRef:o}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,t,r,o);else if(!i){let s=this.current;if(am(s))s.value+=t.toString();else if(typeof t=="object"&&t){let l=this.assignWithoutOverride(t,s);this.stack.pop(),this.stack.push(l)}}}action(t,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode);let i=this.nodeBuilder.buildCompositeNode(n);this.nodeBuilder.appendChild(i,r.$cstNode);let o={$type:t};this.stack.push(o),this.assign(n.operator,n.feature,r,r.$cstNode)}else r.$type=t}}construct(){if(this.isRecording())return;let t=this.stack.pop();return this.nodeBuilder.construct(t),"$infixName"in t?this.constructInfix(t,this.operatorPrecedence.get(t.$infixName)):am(t)?this.converter.convert(t.value,t.$cstNode):(_E(this.astReflection,t),t)}constructInfix(t,n){let r=t.parts;if(!Array.isArray(r)||r.length===0)return;let i=t.operators;if(!Array.isArray(i)||r.length<2)return r[0];let o=0,s=-1;for(let g=0;g<i.length;g++){let w=i[g],x=n.get(w)??{precedence:1/0,rightAssoc:!1};x.precedence>s?(s=x.precedence,o=g):x.precedence===s&&(x.rightAssoc||(o=g))}let a=i.slice(0,o),l=i.slice(o+1),c=r.slice(0,o+1),u=r.slice(o+1),f={$infixName:t.$infixName,$type:t.$type,$cstNode:t.$cstNode,parts:c,operators:a},d={$infixName:t.$infixName,$type:t.$type,$cstNode:t.$cstNode,parts:u,operators:l},p=this.constructInfix(f,n),m=this.constructInfix(d,n);return{$type:t.$type,$cstNode:t.$cstNode,left:p,operator:i[o],right:m}}getAssignment(t){if(!this.assignmentMap.has(t)){let n=Hi(t,fn);this.assignmentMap.set(t,{assignment:n,crossRef:n&&dn(n.terminal)?n.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(t)}assign(t,n,r,i,o){let s=this.current,a;switch(o==="single"&&typeof r=="string"?a=this.linker.buildReference(s,n,i,r):o==="multi"&&typeof r=="string"?a=this.linker.buildMultiReference(s,n,i,r):a=r,this.linkCstNode(a),t){case"=":{s[n]=a;break}case"?=":{s[n]=!0;break}case"+=":Array.isArray(s[n])||(s[n]=[]),s[n].push(a)}}assignWithoutOverride(t,n){for(let[r,i]of Object.entries(n)){let o=t[r];o===void 0?t[r]=i:Array.isArray(o)&&Array.isArray(i)&&(i.push(...o),t[r]=i)}return t.$cstNode=void 0,t}get definitionErrors(){return this.wrapper.definitionErrors}},cm=class{buildMismatchTokenMessage(t){return bn.buildMismatchTokenMessage(t)}buildNotAllInputParsedMessage(t){return bn.buildNotAllInputParsedMessage(t)}buildNoViableAltMessage(t){return bn.buildNoViableAltMessage(t)}buildEarlyExitMessage(t){return bn.buildEarlyExitMessage(t)}},La=class extends cm{buildMismatchTokenMessage({expected:t,actual:n}){return`Expecting ${t.LABEL?"`"+t.LABEL+"`":t.name.endsWith(":KW")?`keyword '${t.name.substring(0,t.name.length-3)}'`:`token of type '${t.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:t}){return`Expecting end of file but found \`${t.image}\`.`}},Du=class extends Cu{constructor(t){super(t,!0),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(t){this.resetState();let n=this.lexer.tokenize(t,{mode:"partial"});return this.tokens=n.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(t,n){let r=this.wrapper.DEFINE_RULE(B_(t.name),this.startImplementation(n).bind(this));return this.allRules.set(t.name,r),t.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(t){return n=>{let r=this.keepStackSize();try{t(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let t=this.elementStack.length;return this.stackSize=t,t}resetStackSize(t){this.removeUnexpectedElements(),this.stackSize=t}consume(t,n,r){this.wrapper.wrapConsume(t,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(t,n,r,i,o){this.before(i),this.wrapper.wrapSubrule(t,n,o),this.after(i)}before(t){this.isRecording()||this.elementStack.push(t)}after(t){if(!this.isRecording()){let n=this.elementStack.lastIndexOf(t);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}},iM={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new La},Mu=class extends Ta{constructor(t,n,r){let i=n&&"maxLookahead"in n;super(t,{...iM,lookaheadStrategy:i?new Nn({maxLookahead:n.maxLookahead}):new Sa({logging:n.skipValidations?()=>{}:void 0,incomplete:r}),...n})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(t,n,r){return this.RULE(t,n,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(t,n){return this.consume(t,n,void 0)}wrapSubrule(t,n,r){return this.subrule(t,n,{ARGS:[r]})}wrapOr(t,n){this.or(t,n)}wrapOption(t,n){this.option(t,n)}wrapMany(t,n){this.many(t,n)}wrapAtLeastOne(t,n){this.atLeastOne(t,n)}rule(t){return t.call(this,{})}},um=class extends Mu{constructor(t,n,r,i){super(t,n,r),this.task=i}rule(t){this.task.start(),this.task.startSubTask(this.ruleName(t));try{return super.rule(t)}finally{this.task.stopSubTask(this.ruleName(t)),this.task.stop()}}ruleName(t){return t.ruleName}subrule(t,n,r){this.task.startSubTask(this.ruleName(n));try{return super.subrule(t,n,r)}finally{this.task.stopSubTask(this.ruleName(n))}}};function Bu(e,t,n){return oM({parser:t,tokens:n,ruleNames:new Map},e),t}function oM(e,t){let n=na(t,!1),r=ye(t.rules).filter(at).filter(o=>n.has(o));for(let o of r){let s={...e,consume:1,optional:1,subrule:1,many:1,or:1};e.parser.rule(o,pi(s,o.definition))}let i=ye(t.rules).filter(Zr).filter(o=>n.has(o));for(let o of i)e.parser.rule(o,sM(e,o))}function sM(e,t){let n=t.call.rule.ref;if(!n)throw new Error("Could not resolve reference to infix operator rule: "+t.call.rule.$refText);if(Et(n))throw new Error("Cannot use terminal rule in infix expression");let r=t.operators.precedences.flatMap(p=>p.operators),i={$type:"Group",elements:[]},o={$container:i,$type:"Assignment",feature:"parts",operator:"+=",terminal:t.call},s={$container:i,$type:"Group",elements:[],cardinality:"*"};i.elements.push(o,s);let l={$container:s,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:r}},c={...o,$container:s};s.elements.push(l,c);let f=r.map(p=>e.tokens[p.value]).map((p,m)=>({ALT:()=>e.parser.consume(m,p,l)})),d;return p=>{d??(d=dm(e,n)),e.parser.subrule(0,d,!1,o,p),e.parser.many(0,{DEF:()=>{e.parser.alternatives(0,f),e.parser.subrule(1,d,!1,c,p)}})}}function pi(e,t,n=!1){let r;if(Yt(t))r=pM(e,t);else if(sr(t))r=aM(e,t);else if(fn(t))r=pi(e,t.terminal);else if(dn(t))r=W_(e,t);else if(pn(t))r=lM(e,t);else if(nh(t))r=uM(e,t);else if(sh(t))r=fM(e,t);else if(qr(t))r=dM(e,t);else if(DE(t)){let i=e.consume++;r=()=>e.parser.consume(i,ut,t)}else throw new Js(t.$cstNode,`Unexpected element type: ${t.$type}`);return X_(e,n?void 0:Fu(t),r,t.cardinality)}function aM(e,t){let n=lr(t);return()=>e.parser.action(n,t)}function lM(e,t){let n=t.rule.ref;if(or(n)){let r=e.subrule++,i=at(n)&&n.fragment,o=t.arguments.length>0?cM(n,t.arguments):()=>({}),s;return a=>{s??(s=dm(e,n)),e.parser.subrule(r,s,i,t,o(a))}}else if(Et(n)){let r=e.consume++,i=fm(e,n.name);return()=>e.parser.consume(r,i,t)}else if(n)ar(n);else throw new Js(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function cM(e,t){if(t.some(r=>r.calledByName)){let r=t.map(i=>({parameterName:i.parameter?.ref?.name,predicate:yn(i.value)}));return i=>{let o={};for(let{parameterName:s,predicate:a}of r)s&&(o[s]=a(i));return o}}else{let r=t.map(i=>yn(i.value));return i=>{let o={};for(let s=0;s<r.length;s++)if(s<e.parameters.length){let a=e.parameters[s].name,l=r[s];o[a]=l(i)}return o}}}function yn(e){if($E(e)){let t=yn(e.left),n=yn(e.right);return r=>t(r)||n(r)}else if(CE(e)){let t=yn(e.left),n=yn(e.right);return r=>t(r)&&n(r)}else if(BE(e)){let t=yn(e.value);return n=>!t(n)}else if(WE(e)){let t=e.parameter.ref.name;return n=>n!==void 0&&n[t]===!0}else if(PE(e)){let t=!!e.true;return()=>t}ar(e)}function uM(e,t){if(t.elements.length===1)return pi(e,t.elements[0]);{let n=[];for(let i of t.elements){let o={ALT:pi(e,i,!0)},s=Fu(i);s&&(o.GATE=yn(s)),n.push(o)}let r=e.or++;return i=>e.parser.alternatives(r,n.map(o=>{let s={ALT:()=>o.ALT(i)},a=o.GATE;return a&&(s.GATE=()=>a(i)),s}))}}function fM(e,t){if(t.elements.length===1)return pi(e,t.elements[0]);let n=[];for(let a of t.elements){let l={ALT:pi(e,a,!0)},c=Fu(a);c&&(l.GATE=yn(c)),n.push(l)}let r=e.or++,i=(a,l)=>{let c=l.getRuleStack().join("-");return`uGroup_${a}_${c}`},o=a=>e.parser.alternatives(r,n.map((l,c)=>{let u={ALT:()=>!0},f=e.parser;u.ALT=()=>{if(l.ALT(a),!f.isRecording()){let p=i(r,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);let m=f.unorderedGroups.get(p);typeof m?.[c]>"u"&&(m[c]=!0)}};let d=l.GATE;return d?u.GATE=()=>d(a):u.GATE=()=>!f.unorderedGroups.get(i(r,f))?.[c],u})),s=X_(e,Fu(t),o,"*");return a=>{s(a),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}function dM(e,t){let n=t.elements.map(r=>pi(e,r));return r=>n.forEach(i=>i(r))}function Fu(e){if(qr(e))return e.guardCondition}function W_(e,t,n=t.terminal){if(n)if(pn(n)&&at(n.rule.ref)){let r=n.rule.ref,i=e.subrule++,o;return s=>{o??(o=dm(e,r)),e.parser.subrule(i,o,!1,t,s)}}else if(pn(n)&&Et(n.rule.ref)){let r=e.consume++,i=fm(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}else if(Yt(n)){let r=e.consume++,i=fm(e,n.value);return()=>e.parser.consume(r,i,t)}else throw new Error("Could not build cross reference parser");else{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);let i=_c(t.type.ref)?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+lr(t.type.ref));return W_(e,t,i)}}function pM(e,t){let n=e.consume++,r=e.tokens[t.value];if(!r)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(n,r,t)}function X_(e,t,n,r){let i=t&&yn(t);if(!r)if(i){let o=e.or++;return s=>e.parser.alternatives(o,[{ALT:()=>n(s),GATE:()=>i(s)},{ALT:ou(),GATE:()=>!i(s)}])}else return n;if(r==="*"){let o=e.many++;return s=>e.parser.many(o,{DEF:()=>n(s),GATE:i?()=>i(s):void 0})}else if(r==="+"){let o=e.many++;if(i){let s=e.or++;return a=>e.parser.alternatives(s,[{ALT:()=>e.parser.atLeastOne(o,{DEF:()=>n(a)}),GATE:()=>i(a)},{ALT:ou(),GATE:()=>!i(a)}])}else return s=>e.parser.atLeastOne(o,{DEF:()=>n(s)})}else if(r==="?"){let o=e.optional++;return s=>e.parser.optional(o,{DEF:()=>n(s),GATE:i?()=>i(s):void 0})}else ar(r)}function dm(e,t){let n=hM(e,t),r=e.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function hM(e,t){if(or(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!at(r);)(qr(r)||nh(r)||sh(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,e.ruleNames.set(t,i),i}}function fm(e,t){let n=e.tokens[t];if(!n)throw new Error(`Token "${t}" not found."`);return n}function U_(e){let t=e.Grammar,n=e.parser.Lexer,r=new Du(e);return Bu(t,r,n.definition),r.finalize(),r}function G_(e){let t=mM(e);return t.finalize(),t}function mM(e){let t=e.Grammar,n=e.parser.Lexer,r=new $u(e);return Bu(t,r,n.definition)}var Co=class{constructor(){this.diagnostics=[]}buildTokens(t,n){let r=ye(na(t,!1)),i=this.buildTerminalTokens(r),o=this.buildKeywordTokens(r,i,n);return o.push(...i),o}flushLexingReport(t){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let t=[...this.diagnostics];return this.diagnostics=[],t}buildTerminalTokens(t){return t.filter(Et).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(t){let n=no(t),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:t.name,PATTERN:r};return typeof r=="function"&&(i.LINE_BREAKS=!0),t.hidden&&(i.GROUP=vc(n)?Me.SKIPPED:"hidden"),i}requiresCustomPattern(t){return!!(t.flags.includes("u")||t.flags.includes("s"))}regexPatternFunction(t){let n=new RegExp(t,t.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(t,n,r){return t.filter(or).flatMap(i=>cn(i).filter(Yt)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!r?.caseInsensitive))}buildKeywordToken(t,n,r){let i=this.buildKeywordPattern(t,r),o={name:t.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(t,n)};return typeof i=="function"&&(o.LINE_BREAKS=!0),o}buildKeywordPattern(t,n){return n?new RegExp(ei(t.value),"i"):t.value}findLongerAlt(t,n){return n.reduce((r,i)=>{let o=i?.PATTERN;return o?.source&&rw("^"+o.source+"$",t.value)&&r.push(i),r},[])}};var $o=class{convert(t,n){let r=n.grammarSource;if(dn(r)&&(r=ph(r)),pn(r)){let i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,t,n)}return t}runConverter(t,n,r){switch(t.name.toUpperCase()){case"INT":return Cn.convertInt(n);case"STRING":return Cn.convertString(n);case"ID":return Cn.convertID(n)}switch(wh(t)?.toLowerCase()){case"number":return Cn.convertNumber(n);case"boolean":return Cn.convertBoolean(n);case"bigint":return Cn.convertBigint(n);case"date":return Cn.convertDate(n);default:return n}}},Cn;(function(e){function t(c){let u="";for(let f=1;f<c.length-1;f++){let d=c.charAt(f);if(d==="\\"){let p=c.charAt(++f);u+=n(p)}else u+=d}return u}e.convertString=t;function n(c){switch(c){case"b":return"\b";case"f":return"\f";case"n":return`
118
- `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return c}}function r(c){return c.charAt(0)==="^"?c.substring(1):c}e.convertID=r;function i(c){return parseInt(c)}e.convertInt=i;function o(c){return BigInt(c)}e.convertBigint=o;function s(c){return new Date(c)}e.convertDate=s;function a(c){return Number(c)}e.convertNumber=a;function l(c){return c.toLowerCase()==="true"}e.convertBoolean=l})(Cn||(Cn={}));var fe=Hp(Y_()),Gu=Hp(wm()),Hu=Hp(K_()),Ym={lspReservedErrorRangeStart:-32899,RequestFailed:-32803,ServerCancelled:-32802,ContentModified:-32801,RequestCancelled:-32800,lspReservedErrorRangeEnd:-32800};function OM(){return new Promise(e=>{typeof setImmediate>"u"?setTimeout(e,0):setImmediate(e)})}var zu=0,CM=10;function q_(){return zu=performance.now(),new fe.CancellationTokenSource}var mi=Symbol("OperationCancelled");function Sr(e){return e===mi}async function Ge(e){if(e===fe.CancellationToken.None)return;let t=performance.now();if(t-zu>=CM&&(zu=t,await OM(),zu=performance.now()),e.isCancellationRequested)throw mi}var Rr=class{constructor(){this.promise=new Promise((t,n)=>{this.resolve=r=>(t(r),this),this.reject=r=>(n(r),this)})}};var ju=class e{constructor(t,n,r,i){this._uri=t,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){for(let r of t)if(e.isIncremental(r)){let i=Q_(r.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+r.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),l=Math.max(i.end.line,0),c=this._lineOffsets,u=Z_(r.text,!1,o);if(l-a===u.length)for(let d=0,p=u.length;d<p;d++)c[d+a+1]=u[d];else u.length<1e4?c.splice(a+1,l-a,...u):this._lineOffsets=c=c.slice(0,a+1).concat(u,c.slice(l+1));let f=r.text.length-(s-o);if(f!==0)for(let d=a+1+u.length,p=c.length;d<p;d++)c[d]=c[d]+f}else if(e.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Z_(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:t};for(;r<i;){let s=Math.floor((r+i)/2);n[s]>t?i=s:r=s+1}let o=r-1;return t=this.ensureBeforeEOL(t,n[o]),{line:o,character:t-n[o]}}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line];if(t.character<=0)return r;let i=t.line+1<n.length?n[t.line+1]:this._content.length,o=Math.min(r+t.character,i);return this.ensureBeforeEOL(o,r)}getLineRange(t){let n=this.getLineOffsets();if(t>=n.length){let s=n.length-1;return{start:{line:s,character:0},end:{line:s,character:this._content.length-n[s]}}}else if(t<0)return{start:{line:0,character:0},end:{line:0,character:0}};let r=n[t],i=t+1<n.length?n[t+1]:this._content.length,o=this.ensureBeforeEOL(i,r);return{start:{line:t,character:0},end:{line:t,character:o-r}}}getEOLCharacters(t){let n=this.getLineOffsets();if(t>=n.length)return"";if(t<0)return"";let r=t+1<n.length?n[t+1]:this._content.length,i=this.ensureBeforeEOL(r,n[t]);return this._content.substring(i,r)}ensureBeforeEOL(t,n){for(;t>n&&J_(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},Pa;(function(e){function t(i,o,s,a){return new ju(i,o,s,a)}e.create=t;function n(i,o,s){if(i instanceof ju)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}e.update=n;function r(i,o){let s=i.getText(),a=Vm(o.map($M),(u,f)=>{let d=u.range.start.line-f.range.start.line;return d===0?u.range.start.character-f.range.start.character:d}),l=0,c=[];for(let u of a){let f=i.offsetAt(u.range.start);if(f<l)throw new Error("Overlapping edit");f>l&&c.push(s.substring(l,f)),u.newText.length&&c.push(u.newText),l=i.offsetAt(u.range.end)}return c.push(s.substr(l)),c.join("")}e.applyEdits=r})(Pa||(Pa={}));function Vm(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);Vm(r,t),Vm(i,t);let o=0,s=0,a=0;for(;o<r.length&&s<i.length;)t(r[o],i[s])<=0?e[a++]=r[o++]:e[a++]=i[s++];for(;o<r.length;)e[a++]=r[o++];for(;s<i.length;)e[a++]=i[s++];return e}function Z_(e,t,n=0){let r=t?[n]:[];for(let i=0;i<e.length;i++){let o=e.charCodeAt(i);J_(o)&&(o===13&&i+1<e.length&&e.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function J_(e){return e===13||e===10}function Q_(e){let t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function $M(e){let t=Q_(e.range);return t!==e.range?{newText:e.newText,range:t}:e}var e0;(()=>{"use strict";var e={975:D=>{function R(k){if(typeof k!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(k))}function S(k,L){for(var v,P="",b=0,F=-1,j=0,U=0;U<=k.length;++U){if(U<k.length)v=k.charCodeAt(U);else{if(v===47)break;v=47}if(v===47){if(!(F===U-1||j===1))if(F!==U-1&&j===2){if(P.length<2||b!==2||P.charCodeAt(P.length-1)!==46||P.charCodeAt(P.length-2)!==46){if(P.length>2){var ee=P.lastIndexOf("/");if(ee!==P.length-1){ee===-1?(P="",b=0):b=(P=P.slice(0,ee)).length-1-P.lastIndexOf("/"),F=U,j=0;continue}}else if(P.length===2||P.length===1){P="",b=0,F=U,j=0;continue}}L&&(P.length>0?P+="/..":P="..",b=2)}else P.length>0?P+="/"+k.slice(F+1,U):P=k.slice(F+1,U),b=U-F-1;F=U,j=0}else v===46&&j!==-1?++j:j=-1}return P}var O={resolve:function(){for(var k,L="",v=!1,P=arguments.length-1;P>=-1&&!v;P--){var b;P>=0?b=arguments[P]:(k===void 0&&(k=process.cwd()),b=k),R(b),b.length!==0&&(L=b+"/"+L,v=b.charCodeAt(0)===47)}return L=S(L,!v),v?L.length>0?"/"+L:"/":L.length>0?L:"."},normalize:function(k){if(R(k),k.length===0)return".";var L=k.charCodeAt(0)===47,v=k.charCodeAt(k.length-1)===47;return(k=S(k,!L)).length!==0||L||(k="."),k.length>0&&v&&(k+="/"),L?"/"+k:k},isAbsolute:function(k){return R(k),k.length>0&&k.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var k,L=0;L<arguments.length;++L){var v=arguments[L];R(v),v.length>0&&(k===void 0?k=v:k+="/"+v)}return k===void 0?".":O.normalize(k)},relative:function(k,L){if(R(k),R(L),k===L||(k=O.resolve(k))===(L=O.resolve(L)))return"";for(var v=1;v<k.length&&k.charCodeAt(v)===47;++v);for(var P=k.length,b=P-v,F=1;F<L.length&&L.charCodeAt(F)===47;++F);for(var j=L.length-F,U=b<j?b:j,ee=-1,V=0;V<=U;++V){if(V===U){if(j>U){if(L.charCodeAt(F+V)===47)return L.slice(F+V+1);if(V===0)return L.slice(F+V)}else b>U&&(k.charCodeAt(v+V)===47?ee=V:V===0&&(ee=0));break}var ne=k.charCodeAt(v+V);if(ne!==L.charCodeAt(F+V))break;ne===47&&(ee=V)}var A="";for(V=v+ee+1;V<=P;++V)V!==P&&k.charCodeAt(V)!==47||(A.length===0?A+="..":A+="/..");return A.length>0?A+L.slice(F+ee):(F+=ee,L.charCodeAt(F)===47&&++F,L.slice(F))},_makeLong:function(k){return k},dirname:function(k){if(R(k),k.length===0)return".";for(var L=k.charCodeAt(0),v=L===47,P=-1,b=!0,F=k.length-1;F>=1;--F)if((L=k.charCodeAt(F))===47){if(!b){P=F;break}}else b=!1;return P===-1?v?"/":".":v&&P===1?"//":k.slice(0,P)},basename:function(k,L){if(L!==void 0&&typeof L!="string")throw new TypeError('"ext" argument must be a string');R(k);var v,P=0,b=-1,F=!0;if(L!==void 0&&L.length>0&&L.length<=k.length){if(L.length===k.length&&L===k)return"";var j=L.length-1,U=-1;for(v=k.length-1;v>=0;--v){var ee=k.charCodeAt(v);if(ee===47){if(!F){P=v+1;break}}else U===-1&&(F=!1,U=v+1),j>=0&&(ee===L.charCodeAt(j)?--j==-1&&(b=v):(j=-1,b=U))}return P===b?b=U:b===-1&&(b=k.length),k.slice(P,b)}for(v=k.length-1;v>=0;--v)if(k.charCodeAt(v)===47){if(!F){P=v+1;break}}else b===-1&&(F=!1,b=v+1);return b===-1?"":k.slice(P,b)},extname:function(k){R(k);for(var L=-1,v=0,P=-1,b=!0,F=0,j=k.length-1;j>=0;--j){var U=k.charCodeAt(j);if(U!==47)P===-1&&(b=!1,P=j+1),U===46?L===-1?L=j:F!==1&&(F=1):L!==-1&&(F=-1);else if(!b){v=j+1;break}}return L===-1||P===-1||F===0||F===1&&L===P-1&&L===v+1?"":k.slice(L,P)},format:function(k){if(k===null||typeof k!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof k);return(function(L,v){var P=v.dir||v.root,b=v.base||(v.name||"")+(v.ext||"");return P?P===v.root?P+b:P+"/"+b:b})(0,k)},parse:function(k){R(k);var L={root:"",dir:"",base:"",ext:"",name:""};if(k.length===0)return L;var v,P=k.charCodeAt(0),b=P===47;b?(L.root="/",v=1):v=0;for(var F=-1,j=0,U=-1,ee=!0,V=k.length-1,ne=0;V>=v;--V)if((P=k.charCodeAt(V))!==47)U===-1&&(ee=!1,U=V+1),P===46?F===-1?F=V:ne!==1&&(ne=1):F!==-1&&(ne=-1);else if(!ee){j=V+1;break}return F===-1||U===-1||ne===0||ne===1&&F===U-1&&F===j+1?U!==-1&&(L.base=L.name=j===0&&b?k.slice(1,U):k.slice(j,U)):(j===0&&b?(L.name=k.slice(1,F),L.base=k.slice(1,U)):(L.name=k.slice(j,F),L.base=k.slice(j,U)),L.ext=k.slice(F,U)),j>0?L.dir=k.slice(0,j-1):b&&(L.dir="/"),L},sep:"/",delimiter:":",win32:null,posix:null};O.posix=O,D.exports=O}},t={};function n(D){var R=t[D];if(R!==void 0)return R.exports;var S=t[D]={exports:{}};return e[D](S,S.exports,n),S.exports}n.d=(D,R)=>{for(var S in R)n.o(R,S)&&!n.o(D,S)&&Object.defineProperty(D,S,{enumerable:!0,get:R[S]})},n.o=(D,R)=>Object.prototype.hasOwnProperty.call(D,R),n.r=D=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(D,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(D,"__esModule",{value:!0})};var r={};let i;n.r(r),n.d(r,{URI:()=>d,Utils:()=>Y}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function l(D,R){if(!D.scheme&&R)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${D.authority}", path: "${D.path}", query: "${D.query}", fragment: "${D.fragment}"}`);if(D.scheme&&!o.test(D.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(D.path){if(D.authority){if(!s.test(D.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(D.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let c="",u="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{constructor(R,S,O,k,L,v=!1){M(this,"scheme");M(this,"authority");M(this,"path");M(this,"query");M(this,"fragment");typeof R=="object"?(this.scheme=R.scheme||c,this.authority=R.authority||c,this.path=R.path||c,this.query=R.query||c,this.fragment=R.fragment||c):(this.scheme=(function(P,b){return P||b?P:"file"})(R,v),this.authority=S||c,this.path=(function(P,b){switch(P){case"https":case"http":case"file":b?b[0]!==u&&(b=u+b):b=u}return b})(this.scheme,O||c),this.query=k||c,this.fragment=L||c,l(this,v))}static isUri(R){return R instanceof d||!!R&&typeof R.authority=="string"&&typeof R.fragment=="string"&&typeof R.path=="string"&&typeof R.query=="string"&&typeof R.scheme=="string"&&typeof R.fsPath=="string"&&typeof R.with=="function"&&typeof R.toString=="function"}get fsPath(){return y(this,!1)}with(R){if(!R)return this;let{scheme:S,authority:O,path:k,query:L,fragment:v}=R;return S===void 0?S=this.scheme:S===null&&(S=c),O===void 0?O=this.authority:O===null&&(O=c),k===void 0?k=this.path:k===null&&(k=c),L===void 0?L=this.query:L===null&&(L=c),v===void 0?v=this.fragment:v===null&&(v=c),S===this.scheme&&O===this.authority&&k===this.path&&L===this.query&&v===this.fragment?this:new m(S,O,k,L,v)}static parse(R,S=!1){let O=f.exec(R);return O?new m(O[2]||c,I(O[4]||c),I(O[5]||c),I(O[7]||c),I(O[9]||c),S):new m(c,c,c,c,c)}static file(R){let S=c;if(i&&(R=R.replace(/\\/g,u)),R[0]===u&&R[1]===u){let O=R.indexOf(u,2);O===-1?(S=R.substring(2),R=u):(S=R.substring(2,O),R=R.substring(O)||u)}return new m("file",S,R,c,c)}static from(R){let S=new m(R.scheme,R.authority,R.path,R.query,R.fragment);return l(S,!0),S}toString(R=!1){return E(this,R)}toJSON(){return this}static revive(R){if(R){if(R instanceof d)return R;{let S=new m(R);return S._formatted=R.external,S._fsPath=R._sep===p?R.fsPath:null,S}}return R}}let p=i?1:void 0;class m extends d{constructor(){super(...arguments);M(this,"_formatted",null);M(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=y(this,!1)),this._fsPath}toString(S=!1){return S?E(this,!0):(this._formatted||(this._formatted=E(this,!1)),this._formatted)}toJSON(){let S={$mid:1};return this._fsPath&&(S.fsPath=this._fsPath,S._sep=p),this._formatted&&(S.external=this._formatted),this.path&&(S.path=this.path),this.scheme&&(S.scheme=this.scheme),this.authority&&(S.authority=this.authority),this.query&&(S.query=this.query),this.fragment&&(S.fragment=this.fragment),S}}let g={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function w(D,R,S){let O,k=-1;for(let L=0;L<D.length;L++){let v=D.charCodeAt(L);if(v>=97&&v<=122||v>=65&&v<=90||v>=48&&v<=57||v===45||v===46||v===95||v===126||R&&v===47||S&&v===91||S&&v===93||S&&v===58)k!==-1&&(O+=encodeURIComponent(D.substring(k,L)),k=-1),O!==void 0&&(O+=D.charAt(L));else{O===void 0&&(O=D.substr(0,L));let P=g[v];P!==void 0?(k!==-1&&(O+=encodeURIComponent(D.substring(k,L)),k=-1),O+=P):k===-1&&(k=L)}}return k!==-1&&(O+=encodeURIComponent(D.substring(k))),O!==void 0?O:D}function x(D){let R;for(let S=0;S<D.length;S++){let O=D.charCodeAt(S);O===35||O===63?(R===void 0&&(R=D.substr(0,S)),R+=g[O]):R!==void 0&&(R+=D[S])}return R!==void 0?R:D}function y(D,R){let S;return S=D.authority&&D.path.length>1&&D.scheme==="file"?`//${D.authority}${D.path}`:D.path.charCodeAt(0)===47&&(D.path.charCodeAt(1)>=65&&D.path.charCodeAt(1)<=90||D.path.charCodeAt(1)>=97&&D.path.charCodeAt(1)<=122)&&D.path.charCodeAt(2)===58?R?D.path.substr(1):D.path[1].toLowerCase()+D.path.substr(2):D.path,i&&(S=S.replace(/\//g,"\\")),S}function E(D,R){let S=R?x:w,O="",{scheme:k,authority:L,path:v,query:P,fragment:b}=D;if(k&&(O+=k,O+=":"),(L||k==="file")&&(O+=u,O+=u),L){let F=L.indexOf("@");if(F!==-1){let j=L.substr(0,F);L=L.substr(F+1),F=j.lastIndexOf(":"),F===-1?O+=S(j,!1,!1):(O+=S(j.substr(0,F),!1,!1),O+=":",O+=S(j.substr(F+1),!1,!0)),O+="@"}L=L.toLowerCase(),F=L.lastIndexOf(":"),F===-1?O+=S(L,!1,!0):(O+=S(L.substr(0,F),!1,!0),O+=L.substr(F))}if(v){if(v.length>=3&&v.charCodeAt(0)===47&&v.charCodeAt(2)===58){let F=v.charCodeAt(1);F>=65&&F<=90&&(v=`/${String.fromCharCode(F+32)}:${v.substr(3)}`)}else if(v.length>=2&&v.charCodeAt(1)===58){let F=v.charCodeAt(0);F>=65&&F<=90&&(v=`${String.fromCharCode(F+32)}:${v.substr(2)}`)}O+=S(v,!0,!1)}return P&&(O+="?",O+=S(P,!1,!1)),b&&(O+="#",O+=R?b:w(b,!1,!1)),O}function _(D){try{return decodeURIComponent(D)}catch{return D.length>3?D.substr(0,3)+_(D.substr(3)):D}}let T=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function I(D){return D.match(T)?D.replace(T,(R=>_(R))):D}var B=n(975);let $=B.posix||B,X="/";var Y;(function(D){D.joinPath=function(R,...S){return R.with({path:$.join(R.path,...S)})},D.resolvePath=function(R,...S){let O=R.path,k=!1;O[0]!==X&&(O=X+O,k=!0);let L=$.resolve(O,...S);return k&&L[0]===X&&!R.authority&&(L=L.substring(1)),R.with({path:L})},D.dirname=function(R){if(R.path.length===0||R.path===X)return R;let S=$.dirname(R.path);return S.length===1&&S.charCodeAt(0)===46&&(S=""),R.with({path:S})},D.basename=function(R){return $.basename(R.path)},D.extname=function(R){return $.extname(R.path)}})(Y||(Y={})),e0=r})();var{URI:Ce,Utils:Do}=e0;var Qe;(function(e){e.basename=Do.basename,e.dirname=Do.dirname,e.extname=Do.extname,e.joinPath=Do.joinPath,e.resolvePath=Do.resolvePath;let t=typeof process=="object"&&process?.platform==="win32";function n(s,a){return s?.toString()===a?.toString()}e.equals=n;function r(s,a){let l=typeof s=="string"?Ce.parse(s).path:s.path,c=typeof a=="string"?Ce.parse(a).path:a.path,u=l.split("/").filter(g=>g.length>0),f=c.split("/").filter(g=>g.length>0);if(t){let g=/^[A-Z]:$/;if(u[0]&&g.test(u[0])&&(u[0]=u[0].toLowerCase()),f[0]&&g.test(f[0])&&(f[0]=f[0].toLowerCase()),u[0]!==f[0])return c.substring(1)}let d=0;for(;d<u.length&&u[d]===f[d];d++);let p="../".repeat(u.length-d),m=f.slice(d).join("/");return p+m}e.relative=r;function i(s){return Ce.parse(s.toString()).toString()}e.normalize=i;function o(s,a){let l=typeof s=="string"?Ce.parse(s):s,c=typeof a=="string"?Ce.parse(a):a;if(l.scheme!==c.scheme)return!1;let u=l.path,f=c.path;return f.charAt(f.length-1)==="/"&&(f=f.slice(0,-1)),u.charAt(u.length-1)==="/"&&(u=u.slice(0,-1)),f===u?!0:f.length<u.length||f.charAt(u.length)!=="/"?!1:f.startsWith(u)}e.contains=o})(Qe||(Qe={}));var Yu=class{constructor(){this.root={name:"",children:new Map}}normalizeUri(t){return Qe.normalize(t)}clear(){this.root.children.clear()}insert(t,n){let r=this.getNode(this.normalizeUri(t),!0);r.element=n}delete(t){let n=this.getNode(this.normalizeUri(t),!1);n?.parent&&n.parent.children.delete(n.name)}has(t){return this.getNode(this.normalizeUri(t),!1)?.element!==void 0}hasNode(t){return this.getNode(this.normalizeUri(t),!1)!==void 0}find(t){return this.getNode(this.normalizeUri(t),!1)?.element}findNode(t){let n=this.normalizeUri(t),r=this.getNode(n,!1);if(r)return{name:r.name,uri:Qe.joinPath(Ce.parse(n),r.name).toString(),element:r.element}}findChildren(t){let n=this.normalizeUri(t),r=this.getNode(n,!1);return r?Array.from(r.children.values()).map(i=>({name:i.name,uri:Qe.joinPath(Ce.parse(n),i.name).toString(),element:i.element})):[]}all(){return this.collectValues(this.root)}findAll(t){let n=this.getNode(this.normalizeUri(t),!1);return n?this.collectValues(n):[]}getNode(t,n){let r=t.split("/");t.charAt(t.length-1)==="/"&&r.pop();let i=this.root;for(let o of r){let s=i.children.get(o);if(!s)if(n)s={name:o,children:new Map,parent:i},i.children.set(o,s);else return;i=s}return i}collectValues(t){let n=[];t.element&&n.push(t.element);for(let r of t.children.values())n.push(...this.collectValues(r));return n}};var de;(function(e){e[e.Changed=0]="Changed",e[e.Parsed=1]="Parsed",e[e.IndexedContent=2]="IndexedContent",e[e.ComputedScopes=3]="ComputedScopes",e[e.Linked=4]="Linked",e[e.IndexedReferences=5]="IndexedReferences",e[e.Validated=6]="Validated"})(de||(de={}));var Vu=class{constructor(t){this.serviceRegistry=t.ServiceRegistry,this.textDocuments=t.workspace.TextDocuments,this.fileSystemProvider=t.workspace.FileSystemProvider}async fromUri(t,n=fe.CancellationToken.None){let r=await this.getInitialText(t,n);return this.createAsync(t,r,n)}async getInitialText(t,n){return this.fileSystemProvider.readFile(t)}fromTextDocument(t,n,r){return n=n??Ce.parse(t.uri),fe.CancellationToken.is(r)?this.createAsync(n,t,r):this.create(n,t,r)}fromString(t,n,r){return fe.CancellationToken.is(r)?this.createAsync(n,t,r):this.create(n,t,r)}fromModel(t,n){return this.create(n,{$model:t})}create(t,n,r){if(typeof n=="string"){let i=this.parse(t,n,r);return this.createLangiumDocument(i,t,void 0,n)}else if("$model"in n){let i={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,t)}else{let i=this.parse(t,n.getText(),r);return this.createLangiumDocument(i,t,n)}}async createAsync(t,n,r){if(typeof n=="string"){let i=await this.parseAsync(t,n,r);return this.createLangiumDocument(i,t,void 0,n)}else{let i=await this.parseAsync(t,n.getText(),r);return this.createLangiumDocument(i,t,n)}}createLangiumDocument(t,n,r,i){let o;if(r)o={parseResult:t,uri:n,state:de.Parsed,references:[],textDocument:r};else{let s=this.createTextDocumentGetter(n,i);o={parseResult:t,uri:n,state:de.Parsed,references:[],get textDocument(){return s()}}}return t.value.$document=o,o}async update(t,n){let r=t.parseResult.value.$cstNode?.root.fullText,i=this.textDocuments?.get(t.uri.toString()),o=await this.getUpdatedText(t,i,n);if(i)Object.defineProperty(t,"textDocument",{value:i});else{let s=this.createTextDocumentGetter(t.uri,o);Object.defineProperty(t,"textDocument",{get:s})}return r!==o&&(t.parseResult=await this.parseAsync(t.uri,o,n),t.parseResult.value.$document=t),t.state=de.Parsed,t}async getUpdatedText(t,n,r){return n?n.getText():await this.fileSystemProvider.readFile(t.uri)}parse(t,n,r){return this.serviceRegistry.getServices(t).parser.LangiumParser.parse(n,r)}parseAsync(t,n,r){return this.serviceRegistry.getServices(t).parser.AsyncParser.parse(n,r)}createTextDocumentGetter(t,n){let r=this.serviceRegistry,i;return()=>i??(i=Pa.create(t.toString(),r.getServices(t).LanguageMetaData.languageId,0,n??""))}},Ku=class{constructor(t){this.documentTrie=new Yu,this.services=t,this.langiumDocumentFactory=t.workspace.LangiumDocumentFactory,this.documentBuilder=()=>t.workspace.DocumentBuilder}get all(){return ye(this.documentTrie.all())}addDocument(t){let n=t.uri.toString();if(this.documentTrie.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentTrie.insert(n,t)}getDocument(t){let n=t.toString();return this.documentTrie.find(n)}getDocuments(t){let n=t.toString();return this.documentTrie.findAll(n)}async getOrCreateDocument(t,n){let r=this.getDocument(t);return r||(r=await this.langiumDocumentFactory.fromUri(t,n),this.addDocument(r),r)}createDocument(t,n,r){if(r)return this.langiumDocumentFactory.fromString(n,t,r).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(n,t);return this.addDocument(i),i}}hasDocument(t){return this.documentTrie.has(t.toString())}invalidateDocument(t){let n=t.toString(),r=this.documentTrie.find(n);return r&&this.documentBuilder().resetToState(r,de.Changed),r}deleteDocument(t){let n=t.toString(),r=this.documentTrie.find(n);return r&&(r.state=de.Changed,this.documentTrie.delete(n)),r}deleteDocuments(t){let n=t.toString(),r=this.documentTrie.findAll(n);for(let i of r)i.state=de.Changed;return this.documentTrie.delete(n),r}};var Mo=Symbol("RefResolving"),Km=class{constructor(t,n,r,i,o){this.resolver=t,this.node=n,this.property=r,this._ref=void 0,this.$refNode=i,this.$refText=o}get ref(){return this.resolver.resolveReference(this,this.node,this.property)}get $nodeDescription(){return this._nodeDescription}get error(){return Gi(this._ref)?this._ref:void 0}},qm=class{constructor(t,n,r,i,o){this.resolver=t,this.node=n,this.property=r,this._items=void 0,this.$refNode=i,this.$refText=o}get items(){return this.resolver.resolveMultiReference(this,this.node,this.property)}get error(){return this._linkingError}},qu=class{constructor(t){this.reflection=t.shared.AstReflection,this.langiumDocuments=()=>t.shared.workspace.LangiumDocuments,this.scopeProvider=t.references.ScopeProvider,this.astNodeLocator=t.workspace.AstNodeLocator,this.profiler=t.shared.profilers.LangiumProfiler,this.languageId=t.LanguageMetaData.languageId,this.referenceResolver={resolveReference:this.resolveReference.bind(this),resolveMultiReference:this.resolveMultiReference.bind(this)}}async link(t,n=fe.CancellationToken.None){if(this.profiler?.isActive("linking")){let r=this.profiler.createTask("linking",this.languageId);r.start();try{for(let i of xt(t.parseResult.value))await Ge(n),Hr(i).forEach(o=>{let s=`${i.$type}:${o.property}`;r.startSubTask(s);try{this.doLink(o,t)}finally{r.stopSubTask(s)}})}finally{r.stop()}}else for(let r of xt(t.parseResult.value))await Ge(n),Hr(r).forEach(i=>this.doLink(i,t))}doLink(t,n){let r=t.reference;if("_ref"in r&&r._ref===void 0){r._ref=Mo;try{let i=this.getCandidate(t);if(Gi(i))r._ref=i;else{r._nodeDescription=i;let o=this.loadAstNode(i);r._ref=o??this.createLinkingError(t,i)}}catch(i){console.error(`An error occurred while resolving reference to '${r.$refText}':`,i);let o=i.message??String(i);r._ref={info:t,message:`An error occurred while resolving reference to '${r.$refText}': ${o}`}}n.references.push(r)}else if("_items"in r&&r._items===void 0){r._items=Mo;try{let i=this.getCandidates(t),o=[];if(Gi(i))r._linkingError=i;else for(let s of i){let a=this.loadAstNode(s);a&&o.push({ref:a,$nodeDescription:s})}r._items=o}catch(i){r._linkingError={info:t,message:`An error occurred while resolving reference to '${r.$refText}': ${i}`},r._items=[]}n.references.push(r)}}unlink(t){for(let n of t.references)"_ref"in n?(n._ref=void 0,delete n._nodeDescription):"_items"in n&&(n._items=void 0,delete n._linkingError);t.references=[]}getCandidate(t){return this.scopeProvider.getScope(t).getElement(t.reference.$refText)??this.createLinkingError(t)}getCandidates(t){let r=this.scopeProvider.getScope(t).getElements(t.reference.$refText).distinct(i=>`${i.documentUri}#${i.path}`).toArray();return r.length>0?r:this.createLinkingError(t)}buildReference(t,n,r,i){return new Km(this.referenceResolver,t,n,r,i)}buildMultiReference(t,n,r,i){return new qm(this.referenceResolver,t,n,r,i)}resolveReference(t,n,r){if(Ue(t._ref))return t._ref;if(vE(t._nodeDescription)){let i=this.loadAstNode(t._nodeDescription);t._ref=i??this.createLinkingError({reference:t,container:n,property:r},t._nodeDescription)}else if(t._ref===void 0){t._ref=Mo;let i=Xs(n).$document,o=this.getLinkedNode({reference:t,container:n,property:r});if(o.error&&i&&i.state<de.ComputedScopes)return t._ref=void 0;t._ref=o.node??o.error,t._nodeDescription=o.descr,i?.references.push(t)}else t._ref===Mo&&this.throwCyclicReferenceError(n,r,t.$refText);return Ue(t._ref)?t._ref:void 0}resolveMultiReference(t,n,r){if(Array.isArray(t._items))return t._items;if(t._items===void 0){t._items=Mo;let i=Xs(n).$document,o=this.getCandidates({reference:t,container:n,property:r}),s=[];if(Gi(o))t._linkingError=o;else{for(let a of o){let l=this.loadAstNode(a);l&&s.push({ref:l,$nodeDescription:a})}s.length===0&&(t._linkingError=this.createLinkingError({reference:t,container:n,property:r}))}t._items=s,i?.references.push(t)}else t._items===Mo&&this.throwCyclicReferenceError(n,r,t.$refText);return Array.isArray(t._items)?t._items:[]}throwCyclicReferenceError(t,n,r){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(t)}/${n} (symbol '${r}')`)}getLinkedNode(t){try{let n=this.getCandidate(t);if(Gi(n))return{error:n};let r=this.loadAstNode(n);return r?{node:r,descr:n}:{descr:n,error:this.createLinkingError(t,n)}}catch(n){console.error(`An error occurred while resolving reference to '${t.reference.$refText}':`,n);let r=n.message??String(n);return{error:{info:t,message:`An error occurred while resolving reference to '${t.reference.$refText}': ${r}`}}}}loadAstNode(t){if(t.node)return t.node;let n=this.langiumDocuments().getDocument(t.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,t.path)}createLinkingError(t,n){let r=Xs(t.container).$document;r&&r.state<de.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);let i=this.reflection.getReferenceType(t);return{info:t,message:`Could not resolve reference to ${i} named '${t.reference.$refText}'.`,targetDescription:n}}};function DM(e){return typeof e.name=="string"}var Zu=class{getName(t){if(DM(t))return t.name}getNameNode(t){return ra(t.$cstNode,"name")}};var Ju=class{constructor(t){this.nameProvider=t.references.NameProvider,this.index=t.shared.workspace.IndexManager,this.nodeLocator=t.workspace.AstNodeLocator,this.documents=t.shared.workspace.LangiumDocuments,this.hasMultiReference=xt(t.Grammar).some(n=>dn(n)&&n.isMulti)}findDeclarations(t){if(t){let n=Eh(t),r=t.astNode;if(n&&r){let i=r[n.feature];if(it(i)||Mt(i))return jp(i);if(Array.isArray(i)){for(let o of i)if((it(o)||Mt(o))&&o.$refNode&&o.$refNode.offset<=t.offset&&o.$refNode.end>=t.end)return jp(o)}}if(r){let i=this.nameProvider.getNameNode(r);if(i&&(i===t||ZE(t,i)))return this.getSelfNodes(r)}}return[]}getSelfNodes(t){if(this.hasMultiReference){let n=this.index.findAllReferences(t,this.nodeLocator.getAstNodePath(t)),r=this.getNodeFromReferenceDescription(n.head());if(r){for(let i of Hr(r))if(Mt(i.reference)&&i.reference.items.some(o=>o.ref===t))return i.reference.items.map(o=>o.ref)}return[t]}else return[t]}getNodeFromReferenceDescription(t){if(!t)return;let n=this.documents.getDocument(t.sourceUri);if(n)return this.nodeLocator.getAstNode(n.parseResult.value,t.sourcePath)}findDeclarationNodes(t){let n=this.findDeclarations(t),r=[];for(let i of n){let o=this.nameProvider.getNameNode(i)??i.$cstNode;o&&r.push(o)}return r}findReferences(t,n){let r=[];n.includeDeclaration&&r.push(...this.getSelfReferences(t));let i=this.index.findAllReferences(t,this.nodeLocator.getAstNodePath(t));return n.documentUri&&(i=i.filter(o=>Qe.equals(o.sourceUri,n.documentUri))),r.push(...i),ye(r)}getSelfReferences(t){let n=this.getSelfNodes(t),r=[];for(let i of n){let o=this.nameProvider.getNameNode(i);if(o){let s=st(i),a=this.nodeLocator.getAstNodePath(i);r.push({sourceUri:s.uri,sourcePath:a,targetUri:s.uri,targetPath:a,segment:eo(o),local:!0})}}return r}};var Jt=class{constructor(t){if(this.map=new Map,t)for(let[n,r]of t)this.add(n,r)}get size(){return ic.sum(ye(this.map.values()).map(t=>t.length))}clear(){this.map.clear()}delete(t,n){if(n===void 0)return this.map.delete(t);{let r=this.map.get(t);if(r){let i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(t):r.splice(i,1),!0}return!1}}get(t){return this.map.get(t)??[]}getStream(t){let n=this.map.get(t);return n?ye(n):oc}has(t,n){if(n===void 0)return this.map.has(t);{let r=this.map.get(t);return r?r.indexOf(n)>=0:!1}}add(t,n){return this.map.has(t)?this.map.get(t).push(n):this.map.set(t,[n]),this}addAll(t,n){return this.map.has(t)?this.map.get(t).push(...n):this.map.set(t,Array.from(n)),this}forEach(t){this.map.forEach((n,r)=>n.forEach(i=>t(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ye(this.map.entries()).flatMap(([t,n])=>n.map(r=>[t,r]))}keys(){return ye(this.map.keys())}values(){return ye(this.map.values()).flat()}entriesGroupedByKey(){return ye(this.map.entries())}},Oa=class{get size(){return this.map.size}constructor(t){if(this.map=new Map,this.inverse=new Map,t)for(let[n,r]of t)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(t,n){return this.map.set(t,n),this.inverse.set(n,t),this}get(t){return this.map.get(t)}getKey(t){return this.inverse.get(t)}delete(t){let n=this.map.get(t);return n!==void 0?(this.map.delete(t),this.inverse.delete(n),!0):!1}};var Qu=class{constructor(t){this.nameProvider=t.references.NameProvider,this.descriptions=t.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(t,n=fe.CancellationToken.None){return this.collectExportedSymbolsForNode(t.parseResult.value,t,void 0,n)}async collectExportedSymbolsForNode(t,n,r=ac,i=fe.CancellationToken.None){let o=[];this.addExportedSymbol(t,o,n);for(let s of r(t))await Ge(i),this.addExportedSymbol(s,o,n);return o}addExportedSymbol(t,n,r){let i=this.nameProvider.getName(t);i&&n.push(this.descriptions.createDescription(t,i,r))}async collectLocalSymbols(t,n=fe.CancellationToken.None){let r=t.parseResult.value,i=new Jt;for(let o of cn(r))await Ge(n),this.addLocalSymbol(o,t,i);return i}addLocalSymbol(t,n,r){let i=t.$container;if(i){let o=this.nameProvider.getName(t);o&&r.add(i,this.descriptions.createDescription(t,o,n))}}};var Ca=class{constructor(t,n,r){this.elements=t,this.outerScope=n,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.caseInsensitive?this.elements.find(i=>i.name.toLowerCase()===n):this.elements.find(i=>i.name===t);if(r)return r;if(this.outerScope)return this.outerScope.getElement(t)}getElements(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.caseInsensitive?this.elements.filter(i=>i.name.toLowerCase()===n):this.elements.filter(i=>i.name===t);return(this.concatOuterScope||r.isEmpty())&&this.outerScope?r.concat(this.outerScope.getElements(t)):r}};var ef=class{constructor(t,n,r){this.elements=new Jt,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let i of t){let o=this.caseInsensitive?i.name.toLowerCase():i.name;this.elements.add(o,i)}this.outerScope=n}getElement(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.elements.get(n)[0];if(r)return r;if(this.outerScope)return this.outerScope.getElement(t)}getElements(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.elements.get(n);return(this.concatOuterScope||r.length===0)&&this.outerScope?ye(r).concat(this.outerScope.getElements(t)):ye(r)}getAllElements(){let t=ye(this.elements.values());return this.outerScope&&(t=t.concat(this.outerScope.getAllElements())),t}};var tf=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(t){this.toDispose.push(t)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(t=>t.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},Zm=class extends tf{constructor(){super(...arguments),this.cache=new Map}has(t){return this.throwIfDisposed(),this.cache.has(t)}set(t,n){this.throwIfDisposed(),this.cache.set(t,n)}get(t,n){if(this.throwIfDisposed(),this.cache.has(t))return this.cache.get(t);if(n){let r=n();return this.cache.set(t,r),r}else return}delete(t){return this.throwIfDisposed(),this.cache.delete(t)}clear(){this.throwIfDisposed(),this.cache.clear()}},nf=class extends tf{constructor(t){super(),this.cache=new Map,this.converter=t??(n=>n)}has(t,n){return this.throwIfDisposed(),this.cacheForContext(t).has(n)}set(t,n,r){this.throwIfDisposed(),this.cacheForContext(t).set(n,r)}get(t,n,r){this.throwIfDisposed();let i=this.cacheForContext(t);if(i.has(n))return i.get(n);if(r){let o=r();return i.set(n,o),o}else return}delete(t,n){return this.throwIfDisposed(),this.cacheForContext(t).delete(n)}clear(t){if(this.throwIfDisposed(),t){let n=this.converter(t);this.cache.delete(n)}else this.cache.clear()}cacheForContext(t){let n=this.converter(t),r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}};var rf=class extends Zm{constructor(t,n){super(),n?(this.toDispose.push(t.workspace.DocumentBuilder.onBuildPhase(n,()=>{this.clear()})),this.toDispose.push(t.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(t.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var of=class{constructor(t){this.reflection=t.shared.AstReflection,this.nameProvider=t.references.NameProvider,this.descriptions=t.workspace.AstNodeDescriptionProvider,this.indexManager=t.shared.workspace.IndexManager,this.globalScopeCache=new rf(t.shared)}getScope(t){let n=[],r=this.reflection.getReferenceType(t),i=st(t.container).localSymbols;if(i){let s=t.container;do i.has(s)&&n.push(i.getStream(s).filter(a=>this.reflection.isSubtype(a.type,r))),s=s.$container;while(s)}let o=this.getGlobalScope(r,t);for(let s=n.length-1;s>=0;s--)o=this.createScope(n[s],o);return o}createScope(t,n,r){return new Ca(ye(t),n,r)}createScopeForNodes(t,n,r){let i=ye(t).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new Ca(i,n,r)}getGlobalScope(t,n){return this.globalScopeCache.get(t,()=>new ef(this.indexManager.allElements(t)))}};function n0(e){return typeof e.$comment=="string"}function t0(e){return typeof e=="object"&&!!e&&("$ref"in e||"$refs"in e||"$error"in e)}var sf=class{constructor(t){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=t.shared.workspace.LangiumDocuments,this.astNodeLocator=t.workspace.AstNodeLocator,this.nameProvider=t.references.NameProvider,this.commentProvider=t.documentation.CommentProvider}serialize(t,n){let r=n??{},i=n?.replacer,o=(a,l)=>this.replacer(a,l,r),s=i?(a,l)=>i(a,l,o):o;try{return this.currentDocument=st(t),JSON.stringify(t,s,n?.space)}finally{this.currentDocument=void 0}}deserialize(t,n){let r=n??{},i=JSON.parse(t);return this.linkNode(i,i,r),i}replacer(t,n,{refText:r,sourceText:i,textRegions:o,comments:s,uriConverter:a}){if(!this.ignoreProperties.has(t))if(it(n)){let l=n.ref,c=r?n.$refText:void 0;if(l){let u=st(l),f="";this.currentDocument&&this.currentDocument!==u&&(a?f=a(u.uri,l):f=u.uri.toString());let d=this.astNodeLocator.getAstNodePath(l);return{$ref:`${f}#${d}`,$refText:c}}else return{$error:n.error?.message??"Could not resolve reference",$refText:c}}else if(Mt(n)){let l=r?n.$refText:void 0,c=[];for(let u of n.items){let f=u.ref,d=st(u.ref),p="";this.currentDocument&&this.currentDocument!==d&&(a?p=a(d.uri,f):p=d.uri.toString());let m=this.astNodeLocator.getAstNodePath(f);c.push(`${p}#${m}`)}return{$refs:c,$refText:l}}else if(Ue(n)){let l;if(o&&(l=this.addAstNodeRegionWithAssignmentsTo({...n}),(!t||n.$document)&&l?.$textRegion&&(l.$textRegion.documentURI=this.currentDocument?.uri.toString())),i&&!t&&(l??(l={...n}),l.$sourceText=n.$cstNode?.text),s){l??(l={...n});let c=this.commentProvider.getComment(n);c&&(l.$comment=c.replace(/\r/g,""))}return l??n}else return n}addAstNodeRegionWithAssignmentsTo(t){let n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(t.$cstNode){let r=t.$textRegion=n(t.$cstNode),i=r.assignments={};return Object.keys(t).filter(o=>!o.startsWith("$")).forEach(o=>{let s=mh(t.$cstNode,o).map(n);s.length!==0&&(i[o]=s)}),t}}linkNode(t,n,r,i,o,s){for(let[l,c]of Object.entries(t))if(Array.isArray(c))for(let u=0;u<c.length;u++){let f=c[u];t0(f)?c[u]=this.reviveReference(t,l,n,f,r):Ue(f)&&this.linkNode(f,n,r,t,l,u)}else t0(c)?t[l]=this.reviveReference(t,l,n,c,r):Ue(c)&&this.linkNode(c,n,r,t,l);let a=t;a.$container=i,a.$containerProperty=o,a.$containerIndex=s}reviveReference(t,n,r,i,o){let s=i.$refText,a=i.$error,l;if(i.$ref){let c=this.getRefNode(r,i.$ref,o.uriConverter);if(Ue(c))return s||(s=this.nameProvider.getName(c)),{$refText:s??"",ref:c};a=c}else if(i.$refs){let c=[];for(let u of i.$refs){let f=this.getRefNode(r,u,o.uriConverter);Ue(f)&&c.push({ref:f})}if(c.length===0)l={$refText:s??"",items:c},a??(a="Could not resolve multi-reference");else return{$refText:s??"",items:c}}if(a)return l??(l={$refText:s??"",ref:void 0}),l.error={info:{container:t,property:n,reference:l},message:a},l}getRefNode(t,n,r){try{let i=n.indexOf("#");if(i===0){let l=this.astNodeLocator.getAstNode(t,n.substring(1));return l||"Could not resolve path: "+n}if(i<0){let l=r?r(n):Ce.parse(n),c=this.langiumDocuments.getDocument(l);return c?c.parseResult.value:"Could not find document for URI: "+n}let o=r?r(n.substring(0,i)):Ce.parse(n.substring(0,i)),s=this.langiumDocuments.getDocument(o);if(!s)return"Could not find document for URI: "+n;if(i===n.length-1)return s.parseResult.value;let a=this.astNodeLocator.getAstNode(s.parseResult.value,n.substring(i+1));return a||"Could not resolve URI: "+n}catch(i){return String(i)}}};var af=class{get map(){return this.fileExtensionMap}constructor(t){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=t?.workspace.TextDocuments}register(t){let n=t.LanguageMetaData;for(let r of n.fileExtensions)this.fileExtensionMap.has(r)&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileExtensionMap.set(r,t);if(n.fileNames)for(let r of n.fileNames)this.fileNameMap.has(r)&&console.warn(`The file name ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileNameMap.set(r,t);this.languageIdMap.set(n.languageId,t)}getServices(t){if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let n=this.textDocuments?.get(t)?.languageId;if(n!==void 0){let s=this.languageIdMap.get(n);if(s)return s}let r=Qe.extname(t),i=Qe.basename(t),o=this.fileNameMap.get(i)??this.fileExtensionMap.get(r);if(!o)throw n?new Error(`The service registry contains no services for the extension '${r}' for language '${n}'.`):new Error(`The service registry contains no services for the extension '${r}'.`);return o}hasServices(t){try{return this.getServices(t),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function Fo(e){return{code:e}}var Jm;(function(e){e.defaults=["fast","slow","built-in"],e.all=e.defaults})(Jm||(Jm={}));var lf=class{constructor(t){this.entries=new Jt,this.knownCategories=new Set(Jm.defaults),this.entriesBefore=[],this.entriesAfter=[],this.reflection=t.shared.AstReflection}register(t,n=this,r="fast"){if(r==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");this.knownCategories.add(r);for(let[i,o]of Object.entries(t)){let s=o;if(Array.isArray(s))for(let a of s){let l={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,l)}else if(typeof s=="function"){let a={check:this.wrapValidationException(s,n),category:r};this.addEntry(i,a)}else ar(s)}}wrapValidationException(t,n){return async(r,i,o)=>{await this.handleException(()=>t.call(n,r,i,o),"An error occurred during validation",i,r)}}async handleException(t,n,r,i){try{await t()}catch(o){if(Sr(o))throw o;console.error(`${n}:`,o),o instanceof Error&&o.stack&&console.error(o.stack);let s=o instanceof Error?o.message:String(o);r("error",`${n}: ${s}`,{node:i})}}addEntry(t,n){if(t==="AstNode"){this.entries.add("AstNode",n);return}for(let r of this.reflection.getAllSubTypes(t))this.entries.add(r,n)}getChecks(t,n){let r=ye(this.entries.get(t)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}registerBeforeDocument(t,n=this){this.entriesBefore.push(this.wrapPreparationException(t,"An error occurred during set-up of the validation",n))}registerAfterDocument(t,n=this){this.entriesAfter.push(this.wrapPreparationException(t,"An error occurred during tear-down of the validation",n))}wrapPreparationException(t,n,r){return async(i,o,s,a)=>{await this.handleException(()=>t.call(r,i,o,s,a),n,o,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(t){return this.knownCategories}};var MM=Object.freeze({validateNode:!0,validateChildren:!0}),cf=class{constructor(t){this.validationRegistry=t.validation.ValidationRegistry,this.metadata=t.LanguageMetaData,this.profiler=t.shared.profilers.LangiumProfiler,this.languageId=t.LanguageMetaData.languageId}async validateDocument(t,n={},r=fe.CancellationToken.None){let i=t.parseResult,o=[];if(await Ge(r),(!n.categories||n.categories.includes("built-in"))&&(this.processLexingErrors(i,o,n),n.stopAfterLexingErrors&&o.some(s=>s.data?.code===Qt.LexingError)||(this.processParsingErrors(i,o,n),n.stopAfterParsingErrors&&o.some(s=>s.data?.code===Qt.ParsingError))||(this.processLinkingErrors(t,o,n),n.stopAfterLinkingErrors&&o.some(s=>s.data?.code===Qt.LinkingError))))return o;try{o.push(...await this.validateAst(i.value,n,r))}catch(s){if(Sr(s))throw s;console.error("An error occurred during validation:",s)}return await Ge(r),o}processLexingErrors(t,n,r){let i=[...t.lexerErrors,...t.lexerReport?.diagnostics??[]];for(let o of i){let s=o.severity??"error",a={severity:Qm(s),range:{start:{line:o.line-1,character:o.column-1},end:{line:o.line-1,character:o.column+o.length-1}},message:o.message,data:FM(s),source:this.getSource()};n.push(a)}}processParsingErrors(t,n,r){for(let i of t.parserErrors){let o;if(Zs(i.token))o=JE(i.token);else if("previousToken"in i){let s=i.previousToken;if(Zs(s)){let a={line:s.endLine-1,character:s.endColumn};o={start:a,end:a}}else{let a={line:0,character:0};o={start:a,end:a}}}if(o){let s={severity:Qm("error"),range:o,message:i.message,data:Fo(Qt.ParsingError),source:this.getSource()};n.push(s)}}}processLinkingErrors(t,n,r){for(let i of t.references){let o=i.error;if(o){let s={node:o.info.container,range:i.$refNode?.range,property:o.info.property,index:o.info.index,data:{code:Qt.LinkingError,containerType:o.info.container.$type,property:o.info.property,refText:o.info.reference.$refText}};n.push(this.toDiagnostic("error",o.message,s))}}}async validateAst(t,n,r=fe.CancellationToken.None){let i=[],o=(s,a,l)=>{i.push(this.toDiagnostic(s,a,l))};return await this.validateAstBefore(t,n,o,r),await this.validateAstNodes(t,n,o,r),await this.validateAstAfter(t,n,o,r),i}async validateAstBefore(t,n,r,i=fe.CancellationToken.None){let o=this.validationRegistry.checksBefore;for(let s of o)await Ge(i),await s(t,r,n.categories??[],i)}async validateAstNodes(t,n,r,i=fe.CancellationToken.None){if(this.profiler?.isActive("validating")){let o=this.profiler.createTask("validating",this.languageId);o.start();try{let s=xt(t).iterator();for(let a of s){o.startSubTask(a.$type);let l=this.validateSingleNodeOptions(a,n);if(l.validateNode)try{let c=this.validationRegistry.getChecks(a.$type,n.categories);for(let u of c)await u(a,r,i)}finally{o.stopSubTask(a.$type)}l.validateChildren||s.prune()}}finally{o.stop()}}else{let o=xt(t).iterator();for(let s of o){await Ge(i);let a=this.validateSingleNodeOptions(s,n);if(a.validateNode){let l=this.validationRegistry.getChecks(s.$type,n.categories);for(let c of l)await c(s,r,i)}a.validateChildren||o.prune()}}}validateSingleNodeOptions(t,n){return MM}async validateAstAfter(t,n,r,i=fe.CancellationToken.None){let o=this.validationRegistry.checksAfter;for(let s of o)await Ge(i),await s(t,r,n.categories??[],i)}toDiagnostic(t,n,r){return{message:n,range:eg(r),severity:Qm(t),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function eg(e){if(e.range)return e.range;let t;return typeof e.property=="string"?t=ra(e.node.$cstNode,e.property,e.index):typeof e.keyword=="string"&&(t=yh(e.node.$cstNode,e.keyword,e.index)),t??(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Qm(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}function FM(e){switch(e){case"error":return Fo(Qt.LexingError);case"warning":return Fo(Qt.LexingWarning);case"info":return Fo(Qt.LexingInfo);case"hint":return Fo(Qt.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}var Qt;(function(e){e.LexingError="lexing-error",e.LexingWarning="lexing-warning",e.LexingInfo="lexing-info",e.LexingHint="lexing-hint",e.ParsingError="parsing-error",e.LinkingError="linking-error"})(Qt||(Qt={}));var uf=class{constructor(t){this.astNodeLocator=t.workspace.AstNodeLocator,this.nameProvider=t.references.NameProvider}createDescription(t,n,r){let i=r??st(t);n??(n=this.nameProvider.getName(t));let o=this.astNodeLocator.getAstNodePath(t);if(!n)throw new Error(`Node at path ${o} has no name.`);let s,a=()=>s??(s=eo(this.nameProvider.getNameNode(t)??t.$cstNode));return{node:t,name:n,get nameSegment(){return a()},selectionSegment:eo(t.$cstNode),type:t.$type,documentUri:i.uri,path:o}}},ff=class{constructor(t){this.nodeLocator=t.workspace.AstNodeLocator}async createDescriptions(t,n=fe.CancellationToken.None){let r=[],i=t.parseResult.value;for(let o of xt(i))await Ge(n),Hr(o).forEach(s=>{s.reference.error||r.push(...this.createInfoDescriptions(s))});return r}createInfoDescriptions(t){let n=t.reference;if(n.error||!n.$refNode)return[];let r=[];it(n)&&n.$nodeDescription?r=[n.$nodeDescription]:Mt(n)&&(r=n.items.map(l=>l.$nodeDescription).filter(l=>l!==void 0));let i=st(t.container).uri,o=this.nodeLocator.getAstNodePath(t.container),s=[],a=eo(n.$refNode);for(let l of r)s.push({sourceUri:i,sourcePath:o,targetUri:l.documentUri,targetPath:l.path,segment:a,local:Qe.equals(l.documentUri,i)});return s}};var df=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(t){if(t.$container){let n=this.getAstNodePath(t.$container),r=this.getPathSegment(t);return n+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:t,$containerIndex:n}){if(!t)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?t+this.indexSeparator+n:t}getAstNode(t,n){return n.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let s=o.indexOf(this.indexSeparator);if(s>0){let a=o.substring(0,s),l=parseInt(o.substring(s+1));return i[a]?.[l]}return i[o]},t)}};var pf=class{constructor(t){this._ready=new Rr,this.onConfigurationSectionUpdateEmitter=new Gu.Emitter,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=t.ServiceRegistry}get ready(){return this._ready.promise}initialize(t){this.workspaceConfig=t.capabilities.workspace?.configuration??!1}async initialized(t){if(this.workspaceConfig){if(t.register){let n=this.serviceRegistry.all;t.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(t.fetchConfiguration){let n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await t.fetchConfiguration(n);n.forEach((i,o)=>{this.updateSectionConfiguration(i.section,r[o])})}}this._ready.resolve()}updateConfiguration(t){typeof t.settings!="object"||t.settings===null||Object.entries(t.settings).forEach(([n,r])=>{this.updateSectionConfiguration(n,r),this.onConfigurationSectionUpdateEmitter.fire({section:n,configuration:r})})}updateSectionConfiguration(t,n){this.settings[t]=n}async getConfiguration(t,n){await this.ready;let r=this.toSectionName(t);if(this.settings[r])return this.settings[r][n]}toSectionName(t){return`${t}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}};var Bo;(function(e){function t(n){return{dispose:async()=>await n()}}e.create=t})(Bo||(Bo={}));var hf=class{constructor(t){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Jt,this.documentPhaseListeners=new Jt,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=de.Changed,this.langiumDocuments=t.workspace.LangiumDocuments,this.langiumDocumentFactory=t.workspace.LangiumDocumentFactory,this.textDocuments=t.workspace.TextDocuments,this.indexManager=t.workspace.IndexManager,this.fileSystemProvider=t.workspace.FileSystemProvider,this.workspaceManager=()=>t.workspace.WorkspaceManager,this.serviceRegistry=t.ServiceRegistry}async build(t,n={},r=fe.CancellationToken.None){for(let i of t){let o=i.uri.toString();if(i.state===de.Validated){if(typeof n.validation=="boolean"&&n.validation)this.resetToState(i,de.IndexedReferences);else if(typeof n.validation=="object"){let s=this.findMissingValidationCategories(i,n);s.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:{categories:s}},result:this.buildState.get(o)?.result}),i.state=de.IndexedReferences)}}else this.buildState.delete(o)}this.currentState=de.Changed,await this.emitUpdate(t.map(i=>i.uri),[]),await this.buildDocuments(t,n,r)}async update(t,n,r=fe.CancellationToken.None){this.currentState=de.Changed;let i=[];for(let l of n){let c=this.langiumDocuments.deleteDocuments(l);for(let u of c)i.push(u.uri),this.cleanUpDeleted(u)}let o=(await Promise.all(t.map(l=>this.findChangedUris(l)))).flat();for(let l of o){let c=this.langiumDocuments.getDocument(l);c===void 0&&(c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},l),c.state=de.Changed,this.langiumDocuments.addDocument(c)),this.resetToState(c,de.Changed)}let s=ye(o).concat(i).map(l=>l.toString()).toSet();this.langiumDocuments.all.filter(l=>!s.has(l.uri.toString())&&this.shouldRelink(l,s)).forEach(l=>this.resetToState(l,de.ComputedScopes)),await this.emitUpdate(o,i),await Ge(r);let a=this.sortDocuments(this.langiumDocuments.all.filter(l=>l.state<de.Validated||!this.buildState.get(l.uri.toString())?.completed||this.resultsAreIncomplete(l,this.updateBuildOptions)).toArray());await this.buildDocuments(a,this.updateBuildOptions,r)}resultsAreIncomplete(t,n){return this.findMissingValidationCategories(t,n).length>=1}findMissingValidationCategories(t,n){let r=this.buildState.get(t.uri.toString()),i=this.serviceRegistry.getServices(t.uri).validation.ValidationRegistry.getAllValidationCategories(t),o=r?.result?.validationChecks?new Set(r?.result?.validationChecks):r?.completed?i:new Set,s=n===void 0||n.validation===!0?i:typeof n.validation=="object"?n.validation.categories??i:[];return ye(s).filter(a=>!o.has(a)).toArray()}async findChangedUris(t){if(this.langiumDocuments.getDocument(t)??this.textDocuments?.get(t))return[t];try{let r=await this.fileSystemProvider.stat(t);if(r.isDirectory)return await this.workspaceManager().searchFolder(t);if(this.workspaceManager().shouldIncludeEntry(r))return[t]}catch{}return[]}async emitUpdate(t,n){await Promise.all(this.updateListeners.map(r=>r(t,n)))}sortDocuments(t){let n=0,r=t.length-1;for(;n<r;){for(;n<t.length&&this.hasTextDocument(t[n]);)n++;for(;r>=0&&!this.hasTextDocument(t[r]);)r--;n<r&&([t[n],t[r]]=[t[r],t[n]])}return t}hasTextDocument(t){return!!this.textDocuments?.get(t.uri)}shouldRelink(t,n){return t.references.some(r=>r.error!==void 0)?!0:this.indexManager.isAffected(t,n)}onUpdate(t){return this.updateListeners.push(t),Bo.create(()=>{let n=this.updateListeners.indexOf(t);n>=0&&this.updateListeners.splice(n,1)})}resetToState(t,n){switch(n){case de.Changed:case de.Parsed:this.indexManager.removeContent(t.uri);case de.IndexedContent:t.localSymbols=void 0;case de.ComputedScopes:this.serviceRegistry.getServices(t.uri).references.Linker.unlink(t);case de.Linked:this.indexManager.removeReferences(t.uri);case de.IndexedReferences:t.diagnostics=void 0,this.buildState.delete(t.uri.toString());case de.Validated:}t.state>n&&(t.state=n)}cleanUpDeleted(t){this.buildState.delete(t.uri.toString()),this.indexManager.remove(t.uri),t.state=de.Changed}async buildDocuments(t,n,r){this.prepareBuild(t,n),await this.runCancelable(t,de.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(t,de.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(t,de.ComputedScopes,r,async s=>{let a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.localSymbols=await a.collectLocalSymbols(s,r)});let i=t.filter(s=>this.shouldLink(s));await this.runCancelable(i,de.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(i,de.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));let o=t.filter(s=>this.shouldValidate(s)?!0:(this.markAsCompleted(s),!1));await this.runCancelable(o,de.Validated,r,async s=>{await this.validate(s,r),this.markAsCompleted(s)})}markAsCompleted(t){let n=this.buildState.get(t.uri.toString());n&&(n.completed=!0)}prepareBuild(t,n){for(let r of t){let i=r.uri.toString(),o=this.buildState.get(i);(!o||o.completed)&&this.buildState.set(i,{completed:!1,options:n,result:o?.result})}}async runCancelable(t,n,r,i){for(let s of t)s.state<n&&(await Ge(r),await i(s),s.state=n,await this.notifyDocumentPhase(s,n,r));let o=t.filter(s=>s.state===n);await this.notifyBuildPhase(o,n,r),this.currentState=n}onBuildPhase(t,n){return this.buildPhaseListeners.add(t,n),Bo.create(()=>{this.buildPhaseListeners.delete(t,n)})}onDocumentPhase(t,n){return this.documentPhaseListeners.add(t,n),Bo.create(()=>{this.documentPhaseListeners.delete(t,n)})}waitUntil(t,n,r){let i;return n&&"path"in n?i=n:r=n,r??(r=fe.CancellationToken.None),i?this.awaitDocumentState(t,i,r):this.awaitBuilderState(t,r)}awaitDocumentState(t,n,r){let i=this.langiumDocuments.getDocument(n);if(i){if(i.state>=t)return Promise.resolve(n);if(r.isCancellationRequested)return Promise.reject(mi);if(this.currentState>=t&&t>i.state)return Promise.reject(new Hu.ResponseError(Ym.RequestFailed,`Document state of ${n.toString()} is ${de[i.state]}, requiring ${de[t]}, but workspace state is already ${de[this.currentState]}. Returning undefined.`))}else return Promise.reject(new Hu.ResponseError(Ym.ServerCancelled,`No document found for URI: ${n.toString()}`));return new Promise((o,s)=>{let a=this.onDocumentPhase(t,c=>{Qe.equals(c.uri,n)&&(a.dispose(),l.dispose(),o(c.uri))}),l=r.onCancellationRequested(()=>{a.dispose(),l.dispose(),s(mi)})})}awaitBuilderState(t,n){return this.currentState>=t?Promise.resolve():n.isCancellationRequested?Promise.reject(mi):new Promise((r,i)=>{let o=this.onBuildPhase(t,()=>{o.dispose(),s.dispose(),r()}),s=n.onCancellationRequested(()=>{o.dispose(),s.dispose(),i(mi)})})}async notifyDocumentPhase(t,n,r){let o=this.documentPhaseListeners.get(n).slice();for(let s of o)try{await Ge(r),await s(t,r)}catch(a){if(!Sr(a))throw a}}async notifyBuildPhase(t,n,r){if(t.length===0)return;let o=this.buildPhaseListeners.get(n).slice();for(let s of o)await Ge(r),await s(t,r)}shouldLink(t){return this.getBuildOptions(t).eagerLinking??!0}shouldValidate(t){return!!this.getBuildOptions(t).validation}async validate(t,n){let r=this.serviceRegistry.getServices(t.uri).validation.DocumentValidator,i=this.getBuildOptions(t),o=typeof i.validation=="object"?{...i.validation}:{};o.categories=this.findMissingValidationCategories(t,i);let s=await r.validateDocument(t,o,n);t.diagnostics?t.diagnostics.push(...s):t.diagnostics=s;let a=this.buildState.get(t.uri.toString());a&&(a.result??(a.result={}),a.result.validationChecks?a.result.validationChecks=ye(a.result.validationChecks).concat(o.categories).distinct().toArray():a.result.validationChecks=[...o.categories])}getBuildOptions(t){return this.buildState.get(t.uri.toString())?.options??{}}};var mf=class{constructor(t){this.symbolIndex=new Map,this.symbolByTypeIndex=new nf,this.referenceIndex=new Map,this.documents=t.workspace.LangiumDocuments,this.serviceRegistry=t.ServiceRegistry,this.astReflection=t.AstReflection}findAllReferences(t,n){let r=st(t).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{Qe.equals(s.targetUri,r)&&s.targetPath===n&&i.push(s)})}),ye(i)}allElements(t,n){let r=ye(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,t)).flat()}getFileDescriptions(t,n){return n?this.symbolByTypeIndex.get(t,n,()=>(this.symbolIndex.get(t)??[]).filter(o=>this.astReflection.isSubtype(o.type,n))):this.symbolIndex.get(t)??[]}remove(t){this.removeContent(t),this.removeReferences(t)}removeContent(t){let n=t.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n)}removeReferences(t){let n=t.toString();this.referenceIndex.delete(n)}async updateContent(t,n=fe.CancellationToken.None){let i=await this.serviceRegistry.getServices(t.uri).references.ScopeComputation.collectExportedSymbols(t,n),o=t.uri.toString();this.symbolIndex.set(o,i),this.symbolByTypeIndex.clear(o)}async updateReferences(t,n=fe.CancellationToken.None){let i=await this.serviceRegistry.getServices(t.uri).workspace.ReferenceDescriptionProvider.createDescriptions(t,n);this.referenceIndex.set(t.uri.toString(),i)}isAffected(t,n){let r=this.referenceIndex.get(t.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}};var gf=class{constructor(t){this.initialBuildOptions={},this._ready=new Rr,this.serviceRegistry=t.ServiceRegistry,this.langiumDocuments=t.workspace.LangiumDocuments,this.documentBuilder=t.workspace.DocumentBuilder,this.fileSystemProvider=t.workspace.FileSystemProvider,this.mutex=t.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(t){this.folders=t.workspaceFolders??void 0}initialized(t){return this.mutex.write(n=>this.initializeWorkspace(this.folders??[],n))}async initializeWorkspace(t,n=fe.CancellationToken.None){let r=await this.performStartup(t);await Ge(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(t){let n=[],r=s=>{n.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};await this.loadAdditionalDocuments(t,r);let i=[];await Promise.all(t.map(s=>this.getRootFolder(s)).map(async s=>this.traverseFolder(s,i)));let o=ye(i).distinct(s=>s.toString()).filter(s=>!this.langiumDocuments.hasDocument(s));return await this.loadWorkspaceDocuments(o,r),this._ready.resolve(),n}async loadWorkspaceDocuments(t,n){await Promise.all(t.map(async r=>{let i=await this.langiumDocuments.getOrCreateDocument(r);n(i)}))}loadAdditionalDocuments(t,n){return Promise.resolve()}getRootFolder(t){return Ce.parse(t.uri)}async traverseFolder(t,n){try{let r=await this.fileSystemProvider.readDirectory(t);await Promise.all(r.map(async i=>{this.shouldIncludeEntry(i)&&(i.isDirectory?await this.traverseFolder(i.uri,n):i.isFile&&n.push(i.uri))}))}catch(r){console.error("Failure to read directory content of "+t.toString(!0),r)}}async searchFolder(t){let n=[];return await this.traverseFolder(t,n),n}shouldIncludeEntry(t){let n=Qe.basename(t.uri);return n.startsWith(".")?!1:t.isDirectory?n!=="node_modules"&&n!=="out":t.isFile?this.serviceRegistry.hasServices(t.uri):!1}};var yf=class{buildUnexpectedCharactersMessage(t,n,r,i,o){return co.buildUnexpectedCharactersMessage(t,n,r,i,o)}buildUnableToPopLexerModeMessage(t){return co.buildUnableToPopLexerModeMessage(t)}},tg={mode:"full"},Wo=class{constructor(t){this.errorMessageProvider=t.parser.LexerErrorMessageProvider,this.tokenBuilder=t.parser.TokenBuilder;let n=this.tokenBuilder.buildTokens(t.Grammar,{caseInsensitive:t.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);let r=r0(n)?Object.values(n):n,i=t.LanguageMetaData.mode==="production";this.chevrotainLexer=new Me(r,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(t,n=tg){let r=this.chevrotainLexer.tokenize(t);return{tokens:r.tokens,errors:r.errors,hidden:r.groups.hidden??[],report:this.tokenBuilder.flushLexingReport?.(t)}}toTokenTypeDictionary(t){if(r0(t))return t;let n=i0(t)?Object.values(t.modes).flat():t,r={};return n.forEach(i=>r[i.name]=i),r}};function ng(e){return Array.isArray(e)&&(e.length===0||"name"in e[0])}function i0(e){return e&&"modes"in e&&"defaultMode"in e}function r0(e){return!ng(e)&&!i0(e)}var o0;(function(e){function t(n){return typeof n=="string"}e.is=t})(o0||(o0={}));var rg;(function(e){function t(n){return typeof n=="string"}e.is=t})(rg||(rg={}));var s0;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(s0||(s0={}));var xf;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(xf||(xf={}));var ve;(function(e){function t(r,i){return r===Number.MAX_VALUE&&(r=xf.MAX_VALUE),i===Number.MAX_VALUE&&(i=xf.MAX_VALUE),{line:r,character:i}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&N.uinteger(i.line)&&N.uinteger(i.character)}e.is=n})(ve||(ve={}));var he;(function(e){function t(r,i,o,s){if(N.uinteger(r)&&N.uinteger(i)&&N.uinteger(o)&&N.uinteger(s))return{start:ve.create(r,i),end:ve.create(o,s)};if(ve.is(r)&&ve.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${o}, ${s}]`)}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&ve.is(i.start)&&ve.is(i.end)}e.is=n})(he||(he={}));var Ef;(function(e){function t(r,i){return{uri:r,range:i}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&he.is(i.range)&&(N.string(i.uri)||N.undefined(i.uri))}e.is=n})(Ef||(Ef={}));var a0;(function(e){function t(r,i,o,s){return{targetUri:r,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&he.is(i.targetRange)&&N.string(i.targetUri)&&he.is(i.targetSelectionRange)&&(he.is(i.originSelectionRange)||N.undefined(i.originSelectionRange))}e.is=n})(a0||(a0={}));var ig;(function(e){function t(r,i,o,s){return{red:r,green:i,blue:o,alpha:s}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&N.numberRange(i.red,0,1)&&N.numberRange(i.green,0,1)&&N.numberRange(i.blue,0,1)&&N.numberRange(i.alpha,0,1)}e.is=n})(ig||(ig={}));var l0;(function(e){function t(r,i){return{range:r,color:i}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&he.is(i.range)&&ig.is(i.color)}e.is=n})(l0||(l0={}));var c0;(function(e){function t(r,i,o){return{label:r,textEdit:i,additionalTextEdits:o}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&N.string(i.label)&&(N.undefined(i.textEdit)||Uo.is(i))&&(N.undefined(i.additionalTextEdits)||N.typedArray(i.additionalTextEdits,Uo.is))}e.is=n})(c0||(c0={}));var u0;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(u0||(u0={}));var f0;(function(e){function t(r,i,o,s,a,l){let c={startLine:r,endLine:i};return N.defined(o)&&(c.startCharacter=o),N.defined(s)&&(c.endCharacter=s),N.defined(a)&&(c.kind=a),N.defined(l)&&(c.collapsedText=l),c}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&N.uinteger(i.startLine)&&N.uinteger(i.startLine)&&(N.undefined(i.startCharacter)||N.uinteger(i.startCharacter))&&(N.undefined(i.endCharacter)||N.uinteger(i.endCharacter))&&(N.undefined(i.kind)||N.string(i.kind))}e.is=n})(f0||(f0={}));var og;(function(e){function t(r,i){return{location:r,message:i}}e.create=t;function n(r){let i=r;return N.defined(i)&&Ef.is(i.location)&&N.string(i.message)}e.is=n})(og||(og={}));var d0;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(d0||(d0={}));var p0;(function(e){e.Unnecessary=1,e.Deprecated=2})(p0||(p0={}));var h0;(function(e){function t(n){let r=n;return N.objectLiteral(r)&&N.string(r.href)}e.is=t})(h0||(h0={}));var wf;(function(e){function t(o,s,a,l,c,u){let f={range:o,message:s};return N.defined(a)&&(f.severity=a),N.defined(l)&&(f.code=l),N.defined(c)&&(f.source=c),N.defined(u)&&(f.relatedInformation=u),f}e.create=t;function n(o){var s;let a=o;return N.defined(a)&&he.is(a.range)&&(N.string(a.message)||yi.is(a.message))&&(N.number(a.severity)||N.undefined(a.severity))&&(N.integer(a.code)||N.string(a.code)||N.undefined(a.code))&&(N.undefined(a.codeDescription)||N.string((s=a.codeDescription)===null||s===void 0?void 0:s.href))&&(N.string(a.source)||N.undefined(a.source))&&(N.undefined(a.relatedInformation)||N.typedArray(a.relatedInformation,og.is))}e.is=n;function r(o){return N.string(o.message)}e.is3_17=r;function i(o){if(N.string(o.message))return o.message;if(yi.is(o.message))return o.message.value;throw new Error(`Unknown message type ${typeof o.message}`)}e.getMessageString=i})(wf||(wf={}));var Xo;(function(e){function t(r,i,...o){let s={title:r,command:i};return N.defined(o)&&o.length>0&&(s.arguments=o),s}e.create=t;function n(r){let i=r;return N.defined(i)&&N.string(i.title)&&(i.tooltip===void 0||N.string(i.tooltip))&&N.string(i.command)}e.is=n})(Xo||(Xo={}));var Uo;(function(e){function t(o,s){return{range:o,newText:s}}e.replace=t;function n(o,s){return{range:{start:o,end:o},newText:s}}e.insert=n;function r(o){return{range:o,newText:""}}e.del=r;function i(o){let s=o;return N.objectLiteral(s)&&N.string(s.newText)&&he.is(s.range)}e.is=i})(Uo||(Uo={}));var Tf;(function(e){function t(r,i,o){let s={label:r};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&N.string(i.label)&&(N.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(N.string(i.description)||i.description===void 0)}e.is=n})(Tf||(Tf={}));var gi;(function(e){function t(n){let r=n;return N.string(r)}e.is=t})(gi||(gi={}));var m0;(function(e){function t(o,s,a){return{range:o,newText:s,annotationId:a}}e.replace=t;function n(o,s,a){return{range:{start:o,end:o},newText:s,annotationId:a}}e.insert=n;function r(o,s){return{range:o,newText:"",annotationId:s}}e.del=r;function i(o){let s=o;return Uo.is(s)&&(Tf.is(s.annotationId)||gi.is(s.annotationId))}e.is=i})(m0||(m0={}));var sg;(function(e){function t(r,i){return{textDocument:r,edits:i}}e.create=t;function n(r){let i=r;return N.defined(i)&&fg.is(i.textDocument)&&Array.isArray(i.edits)}e.is=n})(sg||(sg={}));var ag;(function(e){function t(r,i,o){let s={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){let i=r;return i&&i.kind==="create"&&N.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||N.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||N.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||gi.is(i.annotationId))}e.is=n})(ag||(ag={}));var lg;(function(e){function t(r,i,o,s){let a={kind:"rename",oldUri:r,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}e.create=t;function n(r){let i=r;return i&&i.kind==="rename"&&N.string(i.oldUri)&&N.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||N.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||N.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||gi.is(i.annotationId))}e.is=n})(lg||(lg={}));var cg;(function(e){function t(r,i,o){let s={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){let i=r;return i&&i.kind==="delete"&&N.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||N.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||N.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||gi.is(i.annotationId))}e.is=n})(cg||(cg={}));var ug;(function(e){function t(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>N.string(i.kind)?ag.is(i)||lg.is(i)||cg.is(i):sg.is(i)))}e.is=t})(ug||(ug={}));var g0;(function(e){function t(n){let r=n;return N.objectLiteral(r)&&he.is(r.range)&&gg.isSnippet(r.snippet)&&(r.annotationId===void 0||Tf.is(r.annotationId)||gi.is(r.annotationId))}e.is=t})(g0||(g0={}));var y0;(function(e){function t(r){return{uri:r}}e.create=t;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)}e.is=n})(y0||(y0={}));var x0;(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)&&N.integer(i.version)}e.is=n})(x0||(x0={}));var fg;(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)&&(i.version===null||N.integer(i.version))}e.is=n})(fg||(fg={}));var E0;(function(e){e.ABAP="abap",e.WindowsBat="bat",e.BibTeX="bibtex",e.Clojure="clojure",e.Coffeescript="coffeescript",e.C="c",e.CPP="cpp",e.CSharp="csharp",e.CSS="css",e.D="d",e.Delphi="pascal",e.Diff="diff",e.Dart="dart",e.Dockerfile="dockerfile",e.Elixir="elixir",e.Erlang="erlang",e.FSharp="fsharp",e.GitCommit="git-commit",e.GitRebase="git-rebase",e.Go="go",e.Groovy="groovy",e.Handlebars="handlebars",e.Haskell="haskell",e.HTML="html",e.Ini="ini",e.Java="java",e.JavaScript="javascript",e.JavaScriptReact="javascriptreact",e.JSON="json",e.LaTeX="latex",e.Less="less",e.Lua="lua",e.Makefile="makefile",e.Markdown="markdown",e.ObjectiveC="objective-c",e.ObjectiveCPP="objective-cpp",e.Pascal="pascal",e.Perl="perl",e.Perl6="perl6",e.PHP="php",e.Plaintext="plaintext",e.Powershell="powershell",e.Pug="jade",e.Python="python",e.R="r",e.Razor="razor",e.Ruby="ruby",e.Rust="rust",e.SCSS="scss",e.SASS="sass",e.Scala="scala",e.ShaderLab="shaderlab",e.ShellScript="shellscript",e.SQL="sql",e.Swift="swift",e.TypeScript="typescript",e.TypeScriptReact="typescriptreact",e.TeX="tex",e.VisualBasic="vb",e.XML="xml",e.XSL="xsl",e.YAML="yaml"})(E0||(E0={}));var w0;(function(e){function t(r,i,o,s){return{uri:r,languageId:i,version:o,text:s}}e.create=t;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)&&N.string(i.languageId)&&N.integer(i.version)&&N.string(i.text)}e.is=n})(w0||(w0={}));var dg;(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(n){let r=n;return r===e.PlainText||r===e.Markdown}e.is=t})(dg||(dg={}));var yi;(function(e){function t(n){let r=n;return N.objectLiteral(n)&&dg.is(r.kind)&&N.string(r.value)}e.is=t})(yi||(yi={}));var T0;(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(T0||(T0={}));var v0;(function(e){e.PlainText=1,e.Snippet=2})(v0||(v0={}));var _0;(function(e){e.Deprecated=1})(_0||(_0={}));var A0;(function(e){function t(r,i,o){return{newText:r,insert:i,replace:o}}e.create=t;function n(r){let i=r;return i&&N.string(i.newText)&&he.is(i.insert)&&he.is(i.replace)}e.is=n})(A0||(A0={}));var k0;(function(e){e.asIs=1,e.adjustIndentation=2})(k0||(k0={}));var I0;(function(e){e.Replace=1,e.Merge=2})(I0||(I0={}));var R0;(function(e){function t(n){let r=n;return r&&(N.string(r.detail)||r.detail===void 0)&&(N.string(r.description)||r.description===void 0)}e.is=t})(R0||(R0={}));var S0;(function(e){function t(n){return{label:n}}e.create=t})(S0||(S0={}));var b0;(function(e){function t(n,r){return{items:n||[],isIncomplete:!!r}}e.create=t})(b0||(b0={}));var vf;(function(e){function t(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function n(r){let i=r;return N.string(i)||N.objectLiteral(i)&&N.string(i.language)&&N.string(i.value)}e.is=n})(vf||(vf={}));var N0;(function(e){function t(n){let r=n;return!!r&&N.objectLiteral(r)&&(yi.is(r.contents)||vf.is(r.contents)||N.typedArray(r.contents,vf.is))&&(n.range===void 0||he.is(n.range))}e.is=t})(N0||(N0={}));var L0;(function(e){function t(n,r){return r?{label:n,documentation:r}:{label:n}}e.create=t})(L0||(L0={}));var P0;(function(e){function t(n,r,...i){let o={label:n};return N.defined(r)&&(o.documentation=r),N.defined(i)?o.parameters=i:o.parameters=[],o}e.create=t})(P0||(P0={}));var O0;(function(e){e.Text=1,e.Read=2,e.Write=3})(O0||(O0={}));var C0;(function(e){function t(n,r){let i={range:n};return N.number(r)&&(i.kind=r),i}e.create=t})(C0||(C0={}));var $0;(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})($0||($0={}));var D0;(function(e){e.Deprecated=1})(D0||(D0={}));var M0;(function(e){function t(n,r,i,o,s){let a={name:n,kind:r,location:{uri:o,range:i}};return s&&(a.containerName=s),a}e.create=t})(M0||(M0={}));var F0;(function(e){function t(n,r,i,o){return o!==void 0?{name:n,kind:r,location:{uri:i,range:o}}:{name:n,kind:r,location:{uri:i}}}e.create=t})(F0||(F0={}));var B0;(function(e){function t(r,i,o,s,a,l){let c={name:r,detail:i,kind:o,range:s,selectionRange:a};return l!==void 0&&(c.children=l),c}e.create=t;function n(r){let i=r;return i&&N.string(i.name)&&N.number(i.kind)&&he.is(i.range)&&he.is(i.selectionRange)&&(i.detail===void 0||N.string(i.detail))&&(i.deprecated===void 0||N.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}e.is=n})(B0||(B0={}));var W0;(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorMove="refactor.move",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll",e.Notebook="notebook"})(W0||(W0={}));var _f;(function(e){e.Invoked=1,e.Automatic=2})(_f||(_f={}));var X0;(function(e){function t(r,i,o){let s={diagnostics:r};return i!=null&&(s.only=i),o!=null&&(s.triggerKind=o),s}e.create=t;function n(r){let i=r;return N.defined(i)&&N.typedArray(i.diagnostics,wf.is)&&(i.only===void 0||N.typedArray(i.only,N.string))&&(i.triggerKind===void 0||i.triggerKind===_f.Invoked||i.triggerKind===_f.Automatic)}e.is=n})(X0||(X0={}));var pg;(function(e){e.LLMGenerated=1;function t(n){return N.defined(n)&&n===e.LLMGenerated}e.is=t})(pg||(pg={}));var U0;(function(e){function t(r,i,o){let s={title:r},a=!0;return typeof i=="string"?(a=!1,s.kind=i):Xo.is(i)?s.command=i:s.edit=i,a&&o!==void 0&&(s.kind=o),s}e.create=t;function n(r){let i=r;return i&&N.string(i.title)&&(i.diagnostics===void 0||N.typedArray(i.diagnostics,wf.is))&&(i.kind===void 0||N.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Xo.is(i.command))&&(i.isPreferred===void 0||N.boolean(i.isPreferred))&&(i.edit===void 0||ug.is(i.edit))&&(i.tags===void 0||N.typedArray(i.tags,pg.is))}e.is=n})(U0||(U0={}));var G0;(function(e){function t(r,i){let o={range:r};return N.defined(i)&&(o.data=i),o}e.create=t;function n(r){let i=r;return N.defined(i)&&he.is(i.range)&&(N.undefined(i.command)||Xo.is(i.command))}e.is=n})(G0||(G0={}));var H0;(function(e){function t(r,i){return{tabSize:r,insertSpaces:i}}e.create=t;function n(r){let i=r;return N.defined(i)&&N.uinteger(i.tabSize)&&N.boolean(i.insertSpaces)}e.is=n})(H0||(H0={}));var z0;(function(e){function t(r,i,o){return{range:r,target:i,data:o}}e.create=t;function n(r){let i=r;return N.defined(i)&&he.is(i.range)&&(N.undefined(i.target)||N.string(i.target))}e.is=n})(z0||(z0={}));var j0;(function(e){function t(r,i){return{range:r,parent:i}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&he.is(i.range)&&(i.parent===void 0||e.is(i.parent))}e.is=n})(j0||(j0={}));var Y0;(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator",e.label="label"})(Y0||(Y0={}));var V0;(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(V0||(V0={}));var K0;(function(e){function t(n){let r=n;return N.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}e.is=t})(K0||(K0={}));var q0;(function(e){function t(r,i){return{range:r,text:i}}e.create=t;function n(r){let i=r;return i!=null&&he.is(i.range)&&N.string(i.text)}e.is=n})(q0||(q0={}));var Z0;(function(e){function t(r,i,o){return{range:r,variableName:i,caseSensitiveLookup:o}}e.create=t;function n(r){let i=r;return i!=null&&he.is(i.range)&&N.boolean(i.caseSensitiveLookup)&&(N.string(i.variableName)||i.variableName===void 0)}e.is=n})(Z0||(Z0={}));var J0;(function(e){function t(r,i){return{range:r,expression:i}}e.create=t;function n(r){let i=r;return i!=null&&he.is(i.range)&&(N.string(i.expression)||i.expression===void 0)}e.is=n})(J0||(J0={}));var Q0;(function(e){function t(r,i){return{frameId:r,stoppedLocation:i}}e.create=t;function n(r){let i=r;return N.defined(i)&&he.is(r.stoppedLocation)}e.is=n})(Q0||(Q0={}));var hg;(function(e){e.Type=1,e.Parameter=2;function t(n){return n===1||n===2}e.is=t})(hg||(hg={}));var mg;(function(e){function t(r){return{value:r}}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&(i.tooltip===void 0||N.string(i.tooltip)||yi.is(i.tooltip))&&(i.location===void 0||Ef.is(i.location))&&(i.command===void 0||Xo.is(i.command))}e.is=n})(mg||(mg={}));var eA;(function(e){function t(r,i,o){let s={position:r,label:i};return o!==void 0&&(s.kind=o),s}e.create=t;function n(r){let i=r;return N.objectLiteral(i)&&ve.is(i.position)&&(N.string(i.label)||N.typedArray(i.label,mg.is))&&(i.kind===void 0||hg.is(i.kind))&&i.textEdits===void 0||N.typedArray(i.textEdits,Uo.is)&&(i.tooltip===void 0||N.string(i.tooltip)||yi.is(i.tooltip))&&(i.paddingLeft===void 0||N.boolean(i.paddingLeft))&&(i.paddingRight===void 0||N.boolean(i.paddingRight))}e.is=n})(eA||(eA={}));var gg;(function(e){function t(r){return{kind:"snippet",value:r}}e.createSnippet=t;function n(r){let i=r;return N.objectLiteral(i)&&i.kind==="snippet"&&N.string(i.value)}e.isSnippet=n})(gg||(gg={}));var tA;(function(e){function t(n,r,i,o){return{insertText:n,filterText:r,range:i,command:o}}e.create=t})(tA||(tA={}));var nA;(function(e){function t(n){return{items:n}}e.create=t})(nA||(nA={}));var rA;(function(e){e.Invoked=1,e.Automatic=2})(rA||(rA={}));var iA;(function(e){function t(n,r){return{range:n,text:r}}e.create=t})(iA||(iA={}));var oA;(function(e){function t(n,r){return{triggerKind:n,selectedCompletionInfo:r}}e.create=t})(oA||(oA={}));var sA;(function(e){function t(n){let r=n;return N.objectLiteral(r)&&rg.is(r.uri)&&N.string(r.name)}e.is=t})(sA||(sA={}));var aA;(function(e){function t(o,s,a,l){return new yg(o,s,a,l)}e.create=t;function n(o){let s=o;return!!(N.defined(s)&&N.string(s.uri)&&(N.undefined(s.languageId)||N.string(s.languageId))&&N.uinteger(s.lineCount)&&N.func(s.getText)&&N.func(s.positionAt)&&N.func(s.offsetAt))}e.is=n;function r(o,s){let a=o.getText(),l=i(s,(u,f)=>{let d=u.range.start.line-f.range.start.line;return d===0?u.range.start.character-f.range.start.character:d}),c=a.length;for(let u=l.length-1;u>=0;u--){let f=l[u],d=o.offsetAt(f.range.start),p=o.offsetAt(f.range.end);if(p<=c)a=a.substring(0,d)+f.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}e.applyEdits=r;function i(o,s){if(o.length<=1)return o;let a=o.length/2|0,l=o.slice(0,a),c=o.slice(a);i(l,s),i(c,s);let u=0,f=0,d=0;for(;u<l.length&&f<c.length;)s(l[u],c[f])<=0?o[d++]=l[u++]:o[d++]=c[f++];for(;u<l.length;)o[d++]=l[u++];for(;f<c.length;)o[d++]=c[f++];return o}})(aA||(aA={}));var yg=class{constructor(t,n,r,i){this._uri=t,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){this._content=t.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let t=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(t.push(i),r=!1);let o=n.charAt(i);r=o==="\r"||o===`
117
+ For Further details.`,r}function zD(e){if(e instanceof Ee)return"SUBRULE";if(e instanceof we)return"OPTION";if(e instanceof Ie)return"OR";if(e instanceof Ne)return"AT_LEAST_ONE";if(e instanceof Le)return"AT_LEAST_ONE_SEP";if(e instanceof ke)return"MANY_SEP";if(e instanceof ge)return"MANY";if(e instanceof ue)return"CONSUME";throw Error("non exhaustive match")}function jD(e,t,n){let r=y_(t.configs.elements,o=>o.state.transitions),i=R_(r.filter(o=>o instanceof ci).map(o=>o.tokenType),o=>o.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:e}}function YD(e,t){return e.edges[t.tokenTypeIdx]}function VD(e,t,n){let r=new Lo,i=[];for(let s of e.elements){if(n.is(s.alt)===!1)continue;if(s.state.type===_r){i.push(s);continue}let a=s.state.transitions.length;for(let l=0;l<a;l++){let c=s.state.transitions[l],u=KD(c,t);u!==void 0&&r.add({state:u,alt:s.alt,stack:s.stack})}}let o;if(i.length===0&&r.size===1&&(o=r),o===void 0){o=new Lo;for(let s of r.elements)Cu(s,o)}if(i.length>0&&!QD(o))for(let s of i)o.add(s);return o}function KD(e,t){if(e instanceof ci&&fo(t,e.tokenType))return e.target}function qD(e,t){let n;for(let r of e.elements)if(t.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function F_(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function M_(e,t,n,r){return r=B_(e,r),t.edges[n.tokenTypeIdx]=r,r}function B_(e,t){if(t===Sa)return t;let n=t.configs.key,r=e.states[n];return r!==void 0?r:(t.configs.finalize(),e.states[n]=t,t)}function ZD(e){let t=new Lo,n=e.transitions.length;for(let r=0;r<n;r++){let o={state:e.transitions[r].target,alt:r,stack:[]};Cu(o,t)}return t}function Cu(e,t){let n=e.state;if(n.type===_r){if(e.stack.length>0){let i=[...e.stack],s={state:i.pop(),alt:e.alt,stack:i};Cu(s,t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);let r=n.transitions.length;for(let i=0;i<r;i++){let o=n.transitions[i],s=JD(e,o);s!==void 0&&Cu(s,t)}}function JD(e,t){if(t instanceof Ra)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof ui){let n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}function QD(e){for(let t of e.elements)if(t.state.type===_r)return!0;return!1}function eM(e){for(let t of e.elements)if(t.state.type!==_r)return!1;return!0}function tM(e){if(eM(e))return!0;let t=nM(e.elements);return rM(t)&&!iM(t)}function nM(e){let t=new Map;for(let n of e){let r=sm(n,!1),i=t.get(r);i===void 0&&(i={},t.set(r,i)),i[n.alt]=!0}return t}function rM(e){for(let t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}function iM(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}function oM(e,t){let n;for(let r of e.configs.elements)if(!(t.is(r.alt)===!1||r.state.type===_r)){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}var Oo=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(t){return this.rootNode=new La(t),this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(t){let n=new Co;return n.grammarSource=t,this.appendChild(this.current,n),this.nodeStack.push(n),n}buildLeafNode(t,n){let r=this.createLeafNode(t,!n);return n&&(r.grammarSource=n),this.appendChild(this.current,r),r}createLeafNode(t,n){return new Na(t.startOffset,t.image.length,t.startLine-1,t.startColumn-1,t.endLine-1,t.endColumn,t.tokenType,n)}appendChild(t,n){n.container=t,t.content.push(n)}appendChildren(t,n){for(let r of n)r.container=t;t.content.length===0?t.content=n.slice():t.content.push(...n)}insertChildren(t,n,r){for(let i of r)i.container=t;t.content.splice(n,0,...r)}removeNode(t){let n=t.container;if(n){let r=n.content.indexOf(t);r>=0&&n.content.splice(r,1)}}addHiddenNodes(t){let n=[];for(let o of t)n.push(this.createLeafNode(o,!0));let r=this.current,i=!1;if(r.content.length>0){this.appendChildren(r,n);return}for(;r.container;){let o=r.container.content.indexOf(r);if(o>0){this.insertChildren(r.container,o,n),i=!0;break}r=r.container}i||this.insertChildren(this.rootNode,0,n)}construct(t){let n=this.current;t.$cstNode=n;let r=this.nodeStack.pop();r&&(r.content.length===0?this.removeNode(r):r.content=r.content.slice())}},$u=class{constructor(){this.container=void 0,this.grammarSource=void 0}get root(){let t=this;for(;t.container;)t=t.container;return t}get text(){return this.root.fullText.substring(this.offset,this.end)}},Na=class extends $u{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get astNode(){let t=this.container;if(!t)throw new Error("This node has no associated AST element");return t.astNode}get range(){return{start:{line:this._startLine,character:this._startColumn},end:{line:this._endLine,character:this._endColumn}}}constructor(t,n,r,i,o,s,a,l=!1){super(),this._hidden=l,this._offset=Po(t),this._length=Po(n),this._startLine=Po(r),this._startColumn=Po(i),this._endLine=Po(o),this._endColumn=Po(s),this._tokenType=a}};function Po(e){return e|0}var Co=class extends $u{constructor(){super(...arguments),this.content=[],this._astNode=void 0,this._rangeCache=void 0}get astNode(){let t=this;for(;t;){if(t._astNode)return t._astNode;t=t.container}throw new Error("This node has no associated AST element")}set astNode(t){this._astNode=t}get hidden(){return!1}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let t=this._rangeCache;if(t===void 0){let n=this.firstNonHiddenNode,r=this.lastNonHiddenNode;if(n&&r){let{range:i}=n,{range:o}=r;this._rangeCache=t={start:i.start,end:o.end.line<i.start.line?i.start:o.end}}else return{start:{line:0,character:0},end:{line:0,character:0}}}return t}get firstNonHiddenNode(){for(let t of this.content)if(!t.hidden)return t;return this.content[0]}get lastNonHiddenNode(){for(let t=this.content.length-1;t>=0;t--){let n=this.content[t];if(!n.hidden)return n}return this.content[this.content.length-1]}},La=class extends Co{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(t){super(),this._text="",this._text=t??""}};var um=Symbol("Datatype");function cm(e){return e.$type===um}var W_="\u200B",X_=e=>e.endsWith(W_)?e:e+W_,Du=class{constructor(t,n){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=t.parser.Lexer;let r=this.lexer.definition,i=t.LanguageMetaData.mode==="production";t.shared.profilers.LangiumProfiler?.isActive("parsing")?this.wrapper=new dm(r,{...t.parser.ParserConfig,skipValidations:i,errorMessageProvider:t.parser.ParserErrorMessageProvider},n,t.shared.profilers.LangiumProfiler.createTask("parsing",t.LanguageMetaData.languageId)):this.wrapper=new Bu(r,{...t.parser.ParserConfig,skipValidations:i,errorMessageProvider:t.parser.ParserErrorMessageProvider},n)}alternatives(t,n){this.wrapper.wrapOr(t,n)}optional(t,n){this.wrapper.wrapOption(t,n)}many(t,n){this.wrapper.wrapMany(t,n)}atLeastOne(t,n){this.wrapper.wrapAtLeastOne(t,n)}getRule(t){return this.allRules.get(t)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},Mu=class extends Du{get current(){return this.stack[this.stack.length-1]}constructor(t){super(t,!1),this.nodeBuilder=new Oo,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=t.references.Linker,this.converter=t.parser.ValueConverter,this.astReflection=t.shared.AstReflection}rule(t,n){let r=this.computeRuleType(t),i;Zr(t)&&(i=t.name,this.registerPrecedenceMap(t));let o=this.wrapper.DEFINE_RULE(X_(t.name),this.startImplementation(r,i,n).bind(this));return this.allRules.set(t.name,o),at(t)&&t.entry&&(this.mainRule=o),o}registerPrecedenceMap(t){let n=t.name,r=new Map;for(let i=0;i<t.operators.precedences.length;i++){let o=t.operators.precedences[i];for(let s of o.operators)r.set(s.value,{precedence:i,rightAssoc:o.associativity==="right"})}this.operatorPrecedence.set(n,r)}computeRuleType(t){return Zr(t)?lr(t):t.fragment?void 0:oa(t)?um:lr(t)}parse(t,n={}){this.nodeBuilder.buildRootNode(t);let r=this.lexerResult=this.lexer.tokenize(t);this.wrapper.input=r.tokens;let i=n.rule?this.allRules.get(n.rule):this.mainRule;if(!i)throw new Error(n.rule?`No rule found with name '${n.rule}'`:"No main rule available.");let o=this.doParse(i);return this.nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,lc(o,{deep:!0}),{value:o,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}doParse(t){let n=this.wrapper.rule(t);if(this.stack.length>0&&(n=this.construct()),n===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return this.linkCstNode(n),n}linkCstNode(t){Ue(t)&&t.$cstNode&&(t.$cstNode.astNode=t)}startImplementation(t,n,r){return i=>{let o=!this.isRecording()&&t!==void 0;if(o){let s={$type:t};this.stack.push(s),t===um?s.value="":n!==void 0&&(s.$infixName=n)}return r(i),o?this.construct():void 0}}extractHiddenTokens(t){let n=this.lexerResult.hidden;if(!n.length)return[];let r=t.startOffset;for(let i=0;i<n.length;i++)if(n[i].startOffset>r)return n.splice(0,i);return n.splice(0,n.length)}consume(t,n,r){let i=this.wrapper.wrapConsume(t,n);if(!this.isRecording()&&this.isValidToken(i)){let o=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(o);let s=this.nodeBuilder.buildLeafNode(i,r),{assignment:a,crossRef:l}=this.getAssignment(r),c=this.current;if(a){let u=Yt(r)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,u,s,l)}else if(cm(c)){let u=i.image;Yt(r)||(u=this.converter.convert(u,s).toString()),c.value+=u}}}isValidToken(t){return!t.isInsertedInRecovery&&Js(t)}subrule(t,n,r,i,o){let s;!this.isRecording()&&!r&&(s=this.nodeBuilder.buildCompositeNode(i));let a;try{a=this.wrapper.wrapSubrule(t,n,o)}finally{this.isRecording()||(a===void 0&&!r&&(a=this.construct()),a!==void 0&&s&&s.length>0&&this.performSubruleAssignment(a,i,s))}}performSubruleAssignment(t,n,r){let{assignment:i,crossRef:o}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,t,r,o);else if(!i){let s=this.current;if(cm(s))s.value+=t.toString();else if(typeof t=="object"&&t){let l=this.assignWithoutOverride(t,s);this.stack.pop(),this.stack.push(l)}}}action(t,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode);let i=this.nodeBuilder.buildCompositeNode(n);this.nodeBuilder.appendChild(i,r.$cstNode);let o={$type:t};this.stack.push(o),this.assign(n.operator,n.feature,r,r.$cstNode)}else r.$type=t}}construct(){if(this.isRecording())return;let t=this.stack.pop();return this.nodeBuilder.construct(t),"$infixName"in t?this.constructInfix(t,this.operatorPrecedence.get(t.$infixName)):cm(t)?this.converter.convert(t.value,t.$cstNode):(kE(this.astReflection,t),t)}constructInfix(t,n){let r=t.parts;if(!Array.isArray(r)||r.length===0)return;let i=t.operators;if(!Array.isArray(i)||r.length<2)return r[0];let o=0,s=-1;for(let g=0;g<i.length;g++){let E=i[g],x=n.get(E)??{precedence:1/0,rightAssoc:!1};x.precedence>s?(s=x.precedence,o=g):x.precedence===s&&(x.rightAssoc||(o=g))}let a=i.slice(0,o),l=i.slice(o+1),c=r.slice(0,o+1),u=r.slice(o+1),f={$infixName:t.$infixName,$type:t.$type,$cstNode:t.$cstNode,parts:c,operators:a},d={$infixName:t.$infixName,$type:t.$type,$cstNode:t.$cstNode,parts:u,operators:l},p=this.constructInfix(f,n),m=this.constructInfix(d,n);return{$type:t.$type,$cstNode:t.$cstNode,left:p,operator:i[o],right:m}}getAssignment(t){if(!this.assignmentMap.has(t)){let n=zi(t,fn);this.assignmentMap.set(t,{assignment:n,crossRef:n&&dn(n.terminal)?n.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(t)}assign(t,n,r,i,o){let s=this.current,a;switch(o==="single"&&typeof r=="string"?a=this.linker.buildReference(s,n,i,r):o==="multi"&&typeof r=="string"?a=this.linker.buildMultiReference(s,n,i,r):a=r,this.linkCstNode(a),t){case"=":{s[n]=a;break}case"?=":{s[n]=!0;break}case"+=":Array.isArray(s[n])||(s[n]=[]),s[n].push(a)}}assignWithoutOverride(t,n){for(let[r,i]of Object.entries(n)){let o=t[r];o===void 0?t[r]=i:Array.isArray(o)&&Array.isArray(i)&&(i.push(...o),t[r]=i)}return t.$cstNode=void 0,t}get definitionErrors(){return this.wrapper.definitionErrors}},fm=class{buildMismatchTokenMessage(t){return bn.buildMismatchTokenMessage(t)}buildNotAllInputParsedMessage(t){return bn.buildNotAllInputParsedMessage(t)}buildNoViableAltMessage(t){return bn.buildNoViableAltMessage(t)}buildEarlyExitMessage(t){return bn.buildEarlyExitMessage(t)}},Pa=class extends fm{buildMismatchTokenMessage({expected:t,actual:n}){return`Expecting ${t.LABEL?"`"+t.LABEL+"`":t.name.endsWith(":KW")?`keyword '${t.name.substring(0,t.name.length-3)}'`:`token of type '${t.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:t}){return`Expecting end of file but found \`${t.image}\`.`}},Fu=class extends Du{constructor(t){super(t,!0),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(t){this.resetState();let n=this.lexer.tokenize(t,{mode:"partial"});return this.tokens=n.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(t,n){let r=this.wrapper.DEFINE_RULE(X_(t.name),this.startImplementation(n).bind(this));return this.allRules.set(t.name,r),t.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(t){return n=>{let r=this.keepStackSize();try{t(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let t=this.elementStack.length;return this.stackSize=t,t}resetStackSize(t){this.removeUnexpectedElements(),this.stackSize=t}consume(t,n,r){this.wrapper.wrapConsume(t,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(t,n,r,i,o){this.before(i),this.wrapper.wrapSubrule(t,n,o),this.after(i)}before(t){this.isRecording()||this.elementStack.push(t)}after(t){if(!this.isRecording()){let n=this.elementStack.lastIndexOf(t);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}},sM={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Pa},Bu=class extends va{constructor(t,n,r){let i=n&&"maxLookahead"in n;super(t,{...sM,lookaheadStrategy:i?new Nn({maxLookahead:n.maxLookahead}):new ba({logging:n.skipValidations?()=>{}:void 0,incomplete:r}),...n})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(t,n,r){return this.RULE(t,n,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(t,n){return this.consume(t,n,void 0)}wrapSubrule(t,n,r){return this.subrule(t,n,{ARGS:[r]})}wrapOr(t,n){this.or(t,n)}wrapOption(t,n){this.option(t,n)}wrapMany(t,n){this.many(t,n)}wrapAtLeastOne(t,n){this.atLeastOne(t,n)}rule(t){return t.call(this,{})}},dm=class extends Bu{constructor(t,n,r,i){super(t,n,r),this.task=i}rule(t){this.task.start(),this.task.startSubTask(this.ruleName(t));try{return super.rule(t)}finally{this.task.stopSubTask(this.ruleName(t)),this.task.stop()}}ruleName(t){return t.ruleName}subrule(t,n,r){this.task.startSubTask(this.ruleName(n));try{return super.subrule(t,n,r)}finally{this.task.stopSubTask(this.ruleName(n))}}};function Xu(e,t,n){return aM({parser:t,tokens:n,ruleNames:new Map},e),t}function aM(e,t){let n=ra(t,!1),r=ye(t.rules).filter(at).filter(o=>n.has(o));for(let o of r){let s={...e,consume:1,optional:1,subrule:1,many:1,or:1};e.parser.rule(o,pi(s,o.definition))}let i=ye(t.rules).filter(Zr).filter(o=>n.has(o));for(let o of i)e.parser.rule(o,lM(e,o))}function lM(e,t){let n=t.call.rule.ref;if(!n)throw new Error("Could not resolve reference to infix operator rule: "+t.call.rule.$refText);if(Et(n))throw new Error("Cannot use terminal rule in infix expression");let r=t.operators.precedences.flatMap(p=>p.operators),i={$type:"Group",elements:[]},o={$container:i,$type:"Assignment",feature:"parts",operator:"+=",terminal:t.call},s={$container:i,$type:"Group",elements:[],cardinality:"*"};i.elements.push(o,s);let l={$container:s,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:r}},c={...o,$container:s};s.elements.push(l,c);let f=r.map(p=>e.tokens[p.value]).map((p,m)=>({ALT:()=>e.parser.consume(m,p,l)})),d;return p=>{d??(d=hm(e,n)),e.parser.subrule(0,d,!1,o,p),e.parser.many(0,{DEF:()=>{e.parser.alternatives(0,f),e.parser.subrule(1,d,!1,c,p)}})}}function pi(e,t,n=!1){let r;if(Yt(t))r=mM(e,t);else if(sr(t))r=cM(e,t);else if(fn(t))r=pi(e,t.terminal);else if(dn(t))r=U_(e,t);else if(pn(t))r=uM(e,t);else if(ih(t))r=dM(e,t);else if(lh(t))r=pM(e,t);else if(qr(t))r=hM(e,t);else if(FE(t)){let i=e.consume++;r=()=>e.parser.consume(i,ut,t)}else throw new Qs(t.$cstNode,`Unexpected element type: ${t.$type}`);return G_(e,n?void 0:Wu(t),r,t.cardinality)}function cM(e,t){let n=lr(t);return()=>e.parser.action(n,t)}function uM(e,t){let n=t.rule.ref;if(or(n)){let r=e.subrule++,i=at(n)&&n.fragment,o=t.arguments.length>0?fM(n,t.arguments):()=>({}),s;return a=>{s??(s=hm(e,n)),e.parser.subrule(r,s,i,t,o(a))}}else if(Et(n)){let r=e.consume++,i=pm(e,n.name);return()=>e.parser.consume(r,i,t)}else if(n)ar(n);else throw new Qs(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function fM(e,t){if(t.some(r=>r.calledByName)){let r=t.map(i=>({parameterName:i.parameter?.ref?.name,predicate:yn(i.value)}));return i=>{let o={};for(let{parameterName:s,predicate:a}of r)s&&(o[s]=a(i));return o}}else{let r=t.map(i=>yn(i.value));return i=>{let o={};for(let s=0;s<r.length;s++)if(s<e.parameters.length){let a=e.parameters[s].name,l=r[s];o[a]=l(i)}return o}}}function yn(e){if(ME(e)){let t=yn(e.left),n=yn(e.right);return r=>t(r)||n(r)}else if(DE(e)){let t=yn(e.left),n=yn(e.right);return r=>t(r)&&n(r)}else if(XE(e)){let t=yn(e.value);return n=>!t(n)}else if(UE(e)){let t=e.parameter.ref.name;return n=>n!==void 0&&n[t]===!0}else if(CE(e)){let t=!!e.true;return()=>t}ar(e)}function dM(e,t){if(t.elements.length===1)return pi(e,t.elements[0]);{let n=[];for(let i of t.elements){let o={ALT:pi(e,i,!0)},s=Wu(i);s&&(o.GATE=yn(s)),n.push(o)}let r=e.or++;return i=>e.parser.alternatives(r,n.map(o=>{let s={ALT:()=>o.ALT(i)},a=o.GATE;return a&&(s.GATE=()=>a(i)),s}))}}function pM(e,t){if(t.elements.length===1)return pi(e,t.elements[0]);let n=[];for(let a of t.elements){let l={ALT:pi(e,a,!0)},c=Wu(a);c&&(l.GATE=yn(c)),n.push(l)}let r=e.or++,i=(a,l)=>{let c=l.getRuleStack().join("-");return`uGroup_${a}_${c}`},o=a=>e.parser.alternatives(r,n.map((l,c)=>{let u={ALT:()=>!0},f=e.parser;u.ALT=()=>{if(l.ALT(a),!f.isRecording()){let p=i(r,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);let m=f.unorderedGroups.get(p);typeof m?.[c]>"u"&&(m[c]=!0)}};let d=l.GATE;return d?u.GATE=()=>d(a):u.GATE=()=>!f.unorderedGroups.get(i(r,f))?.[c],u})),s=G_(e,Wu(t),o,"*");return a=>{s(a),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}function hM(e,t){let n=t.elements.map(r=>pi(e,r));return r=>n.forEach(i=>i(r))}function Wu(e){if(qr(e))return e.guardCondition}function U_(e,t,n=t.terminal){if(n)if(pn(n)&&at(n.rule.ref)){let r=n.rule.ref,i=e.subrule++,o;return s=>{o??(o=hm(e,r)),e.parser.subrule(i,o,!1,t,s)}}else if(pn(n)&&Et(n.rule.ref)){let r=e.consume++,i=pm(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}else if(Yt(n)){let r=e.consume++,i=pm(e,n.value);return()=>e.parser.consume(r,i,t)}else throw new Error("Could not build cross reference parser");else{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);let i=kc(t.type.ref)?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+lr(t.type.ref));return U_(e,t,i)}}function mM(e,t){let n=e.consume++,r=e.tokens[t.value];if(!r)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(n,r,t)}function G_(e,t,n,r){let i=t&&yn(t);if(!r)if(i){let o=e.or++;return s=>e.parser.alternatives(o,[{ALT:()=>n(s),GATE:()=>i(s)},{ALT:au(),GATE:()=>!i(s)}])}else return n;if(r==="*"){let o=e.many++;return s=>e.parser.many(o,{DEF:()=>n(s),GATE:i?()=>i(s):void 0})}else if(r==="+"){let o=e.many++;if(i){let s=e.or++;return a=>e.parser.alternatives(s,[{ALT:()=>e.parser.atLeastOne(o,{DEF:()=>n(a)}),GATE:()=>i(a)},{ALT:au(),GATE:()=>!i(a)}])}else return s=>e.parser.atLeastOne(o,{DEF:()=>n(s)})}else if(r==="?"){let o=e.optional++;return s=>e.parser.optional(o,{DEF:()=>n(s),GATE:i?()=>i(s):void 0})}else ar(r)}function hm(e,t){let n=gM(e,t),r=e.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function gM(e,t){if(or(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!at(r);)(qr(r)||ih(r)||lh(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,e.ruleNames.set(t,i),i}}function pm(e,t){let n=e.tokens[t];if(!n)throw new Error(`Token "${t}" not found."`);return n}function H_(e){let t=e.Grammar,n=e.parser.Lexer,r=new Fu(e);return Xu(t,r,n.definition),r.finalize(),r}function z_(e){let t=yM(e);return t.finalize(),t}function yM(e){let t=e.Grammar,n=e.parser.Lexer,r=new Mu(e);return Xu(t,r,n.definition)}var $o=class{constructor(){this.diagnostics=[]}buildTokens(t,n){let r=ye(ra(t,!1)),i=this.buildTerminalTokens(r),o=this.buildKeywordTokens(r,i,n);return o.push(...i),o}flushLexingReport(t){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let t=[...this.diagnostics];return this.diagnostics=[],t}buildTerminalTokens(t){return t.filter(Et).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(t){let n=ro(t),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:t.name,PATTERN:r};return typeof r=="function"&&(i.LINE_BREAKS=!0),t.hidden&&(i.GROUP=Ac(n)?Me.SKIPPED:"hidden"),i}requiresCustomPattern(t){return!!(t.flags.includes("u")||t.flags.includes("s"))}regexPatternFunction(t){let n=new RegExp(t,t.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(t,n,r){return t.filter(or).flatMap(i=>cn(i).filter(Yt)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!r?.caseInsensitive))}buildKeywordToken(t,n,r){let i=this.buildKeywordPattern(t,r),o={name:t.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(t,n)};return typeof i=="function"&&(o.LINE_BREAKS=!0),o}buildKeywordPattern(t,n){return n?new RegExp(ei(t.value),"i"):t.value}findLongerAlt(t,n){return n.reduce((r,i)=>{let o=i?.PATTERN;return o?.source&&ow("^"+o.source+"$",t.value)&&r.push(i),r},[])}};var Do=class{convert(t,n){let r=n.grammarSource;if(dn(r)&&(r=mh(r)),pn(r)){let i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,t,n)}return t}runConverter(t,n,r){switch(t.name.toUpperCase()){case"INT":return Cn.convertInt(n);case"STRING":return Cn.convertString(n);case"ID":return Cn.convertID(n)}switch(vh(t)?.toLowerCase()){case"number":return Cn.convertNumber(n);case"boolean":return Cn.convertBoolean(n);case"bigint":return Cn.convertBigint(n);case"date":return Cn.convertDate(n);default:return n}}},Cn;(function(e){function t(c){let u="";for(let f=1;f<c.length-1;f++){let d=c.charAt(f);if(d==="\\"){let p=c.charAt(++f);u+=n(p)}else u+=d}return u}e.convertString=t;function n(c){switch(c){case"b":return"\b";case"f":return"\f";case"n":return`
118
+ `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return c}}function r(c){return c.charAt(0)==="^"?c.substring(1):c}e.convertID=r;function i(c){return parseInt(c)}e.convertInt=i;function o(c){return BigInt(c)}e.convertBigint=o;function s(c){return new Date(c)}e.convertDate=s;function a(c){return Number(c)}e.convertNumber=a;function l(c){return c.toLowerCase()==="true"}e.convertBoolean=l})(Cn||(Cn={}));var fe=jp(K_()),zu=jp(vm()),ju=jp(Z_()),Km={lspReservedErrorRangeStart:-32899,RequestFailed:-32803,ServerCancelled:-32802,ContentModified:-32801,RequestCancelled:-32800,lspReservedErrorRangeEnd:-32800};function $M(){return new Promise(e=>{typeof setImmediate>"u"?setTimeout(e,0):setImmediate(e)})}var Yu=0,DM=10;function J_(){return Yu=performance.now(),new fe.CancellationTokenSource}var mi=Symbol("OperationCancelled");function Sr(e){return e===mi}async function Ge(e){if(e===fe.CancellationToken.None)return;let t=performance.now();if(t-Yu>=DM&&(Yu=t,await $M(),Yu=performance.now()),e.isCancellationRequested)throw mi}var Rr=class{constructor(){this.promise=new Promise((t,n)=>{this.resolve=r=>(t(r),this),this.reject=r=>(n(r),this)})}};var Vu=class e{constructor(t,n,r,i){this._uri=t,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){for(let r of t)if(e.isIncremental(r)){let i=t0(r.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+r.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),l=Math.max(i.end.line,0),c=this._lineOffsets,u=Q_(r.text,!1,o);if(l-a===u.length)for(let d=0,p=u.length;d<p;d++)c[d+a+1]=u[d];else u.length<1e4?c.splice(a+1,l-a,...u):this._lineOffsets=c=c.slice(0,a+1).concat(u,c.slice(l+1));let f=r.text.length-(s-o);if(f!==0)for(let d=a+1+u.length,p=c.length;d<p;d++)c[d]=c[d]+f}else if(e.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Q_(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:t};for(;r<i;){let s=Math.floor((r+i)/2);n[s]>t?i=s:r=s+1}let o=r-1;return t=this.ensureBeforeEOL(t,n[o]),{line:o,character:t-n[o]}}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line];if(t.character<=0)return r;let i=t.line+1<n.length?n[t.line+1]:this._content.length,o=Math.min(r+t.character,i);return this.ensureBeforeEOL(o,r)}getLineRange(t){let n=this.getLineOffsets();if(t>=n.length){let s=n.length-1;return{start:{line:s,character:0},end:{line:s,character:this._content.length-n[s]}}}else if(t<0)return{start:{line:0,character:0},end:{line:0,character:0}};let r=n[t],i=t+1<n.length?n[t+1]:this._content.length,o=this.ensureBeforeEOL(i,r);return{start:{line:t,character:0},end:{line:t,character:o-r}}}getEOLCharacters(t){let n=this.getLineOffsets();if(t>=n.length)return"";if(t<0)return"";let r=t+1<n.length?n[t+1]:this._content.length,i=this.ensureBeforeEOL(r,n[t]);return this._content.substring(i,r)}ensureBeforeEOL(t,n){for(;t>n&&e0(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},Oa;(function(e){function t(i,o,s,a){return new Vu(i,o,s,a)}e.create=t;function n(i,o,s){if(i instanceof Vu)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}e.update=n;function r(i,o){let s=i.getText(),a=qm(o.map(MM),(u,f)=>{let d=u.range.start.line-f.range.start.line;return d===0?u.range.start.character-f.range.start.character:d}),l=0,c=[];for(let u of a){let f=i.offsetAt(u.range.start);if(f<l)throw new Error("Overlapping edit");f>l&&c.push(s.substring(l,f)),u.newText.length&&c.push(u.newText),l=i.offsetAt(u.range.end)}return c.push(s.substr(l)),c.join("")}e.applyEdits=r})(Oa||(Oa={}));function qm(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);qm(r,t),qm(i,t);let o=0,s=0,a=0;for(;o<r.length&&s<i.length;)t(r[o],i[s])<=0?e[a++]=r[o++]:e[a++]=i[s++];for(;o<r.length;)e[a++]=r[o++];for(;s<i.length;)e[a++]=i[s++];return e}function Q_(e,t,n=0){let r=t?[n]:[];for(let i=0;i<e.length;i++){let o=e.charCodeAt(i);e0(o)&&(o===13&&i+1<e.length&&e.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function e0(e){return e===13||e===10}function t0(e){let t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function MM(e){let t=t0(e.range);return t!==e.range?{newText:e.newText,range:t}:e}var n0;(()=>{"use strict";var e={975:$=>{function I(k){if(typeof k!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(k))}function F(k,b){for(var T,L="",D=0,P=-1,U=0,z=0;z<=k.length;++z){if(z<k.length)T=k.charCodeAt(z);else{if(T===47)break;T=47}if(T===47){if(!(P===z-1||U===1))if(P!==z-1&&U===2){if(L.length<2||D!==2||L.charCodeAt(L.length-1)!==46||L.charCodeAt(L.length-2)!==46){if(L.length>2){var J=L.lastIndexOf("/");if(J!==L.length-1){J===-1?(L="",D=0):D=(L=L.slice(0,J)).length-1-L.lastIndexOf("/"),P=z,U=0;continue}}else if(L.length===2||L.length===1){L="",D=0,P=z,U=0;continue}}b&&(L.length>0?L+="/..":L="..",D=2)}else L.length>0?L+="/"+k.slice(P+1,z):L=k.slice(P+1,z),D=z-P-1;P=z,U=0}else T===46&&U!==-1?++U:U=-1}return L}var N={resolve:function(){for(var k,b="",T=!1,L=arguments.length-1;L>=-1&&!T;L--){var D;L>=0?D=arguments[L]:(k===void 0&&(k=process.cwd()),D=k),I(D),D.length!==0&&(b=D+"/"+b,T=D.charCodeAt(0)===47)}return b=F(b,!T),T?b.length>0?"/"+b:"/":b.length>0?b:"."},normalize:function(k){if(I(k),k.length===0)return".";var b=k.charCodeAt(0)===47,T=k.charCodeAt(k.length-1)===47;return(k=F(k,!b)).length!==0||b||(k="."),k.length>0&&T&&(k+="/"),b?"/"+k:k},isAbsolute:function(k){return I(k),k.length>0&&k.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var k,b=0;b<arguments.length;++b){var T=arguments[b];I(T),T.length>0&&(k===void 0?k=T:k+="/"+T)}return k===void 0?".":N.normalize(k)},relative:function(k,b){if(I(k),I(b),k===b||(k=N.resolve(k))===(b=N.resolve(b)))return"";for(var T=1;T<k.length&&k.charCodeAt(T)===47;++T);for(var L=k.length,D=L-T,P=1;P<b.length&&b.charCodeAt(P)===47;++P);for(var U=b.length-P,z=D<U?D:U,J=-1,Y=0;Y<=z;++Y){if(Y===z){if(U>z){if(b.charCodeAt(P+Y)===47)return b.slice(P+Y+1);if(Y===0)return b.slice(P+Y)}else D>z&&(k.charCodeAt(T+Y)===47?J=Y:Y===0&&(J=0));break}var te=k.charCodeAt(T+Y);if(te!==b.charCodeAt(P+Y))break;te===47&&(J=Y)}var A="";for(Y=T+J+1;Y<=L;++Y)Y!==L&&k.charCodeAt(Y)!==47||(A.length===0?A+="..":A+="/..");return A.length>0?A+b.slice(P+J):(P+=J,b.charCodeAt(P)===47&&++P,b.slice(P))},_makeLong:function(k){return k},dirname:function(k){if(I(k),k.length===0)return".";for(var b=k.charCodeAt(0),T=b===47,L=-1,D=!0,P=k.length-1;P>=1;--P)if((b=k.charCodeAt(P))===47){if(!D){L=P;break}}else D=!1;return L===-1?T?"/":".":T&&L===1?"//":k.slice(0,L)},basename:function(k,b){if(b!==void 0&&typeof b!="string")throw new TypeError('"ext" argument must be a string');I(k);var T,L=0,D=-1,P=!0;if(b!==void 0&&b.length>0&&b.length<=k.length){if(b.length===k.length&&b===k)return"";var U=b.length-1,z=-1;for(T=k.length-1;T>=0;--T){var J=k.charCodeAt(T);if(J===47){if(!P){L=T+1;break}}else z===-1&&(P=!1,z=T+1),U>=0&&(J===b.charCodeAt(U)?--U==-1&&(D=T):(U=-1,D=z))}return L===D?D=z:D===-1&&(D=k.length),k.slice(L,D)}for(T=k.length-1;T>=0;--T)if(k.charCodeAt(T)===47){if(!P){L=T+1;break}}else D===-1&&(P=!1,D=T+1);return D===-1?"":k.slice(L,D)},extname:function(k){I(k);for(var b=-1,T=0,L=-1,D=!0,P=0,U=k.length-1;U>=0;--U){var z=k.charCodeAt(U);if(z!==47)L===-1&&(D=!1,L=U+1),z===46?b===-1?b=U:P!==1&&(P=1):b!==-1&&(P=-1);else if(!D){T=U+1;break}}return b===-1||L===-1||P===0||P===1&&b===L-1&&b===T+1?"":k.slice(b,L)},format:function(k){if(k===null||typeof k!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof k);return(function(b,T){var L=T.dir||T.root,D=T.base||(T.name||"")+(T.ext||"");return L?L===T.root?L+D:L+"/"+D:D})(0,k)},parse:function(k){I(k);var b={root:"",dir:"",base:"",ext:"",name:""};if(k.length===0)return b;var T,L=k.charCodeAt(0),D=L===47;D?(b.root="/",T=1):T=0;for(var P=-1,U=0,z=-1,J=!0,Y=k.length-1,te=0;Y>=T;--Y)if((L=k.charCodeAt(Y))!==47)z===-1&&(J=!1,z=Y+1),L===46?P===-1?P=Y:te!==1&&(te=1):P!==-1&&(te=-1);else if(!J){U=Y+1;break}return P===-1||z===-1||te===0||te===1&&P===z-1&&P===U+1?z!==-1&&(b.base=b.name=U===0&&D?k.slice(1,z):k.slice(U,z)):(U===0&&D?(b.name=k.slice(1,P),b.base=k.slice(1,z)):(b.name=k.slice(U,P),b.base=k.slice(U,z)),b.ext=k.slice(P,z)),U>0?b.dir=k.slice(0,U-1):D&&(b.dir="/"),b},sep:"/",delimiter:":",win32:null,posix:null};N.posix=N,$.exports=N}},t={};function n($){var I=t[$];if(I!==void 0)return I.exports;var F=t[$]={exports:{}};return e[$](F,F.exports,n),F.exports}n.d=($,I)=>{for(var F in I)n.o(I,F)&&!n.o($,F)&&Object.defineProperty($,F,{enumerable:!0,get:I[F]})},n.o=($,I)=>Object.prototype.hasOwnProperty.call($,I),n.r=$=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})};var r={};let i;n.r(r),n.d(r,{URI:()=>d,Utils:()=>V}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function l($,I){if(!$.scheme&&I)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${$.authority}", path: "${$.path}", query: "${$.query}", fragment: "${$.fragment}"}`);if($.scheme&&!o.test($.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if($.path){if($.authority){if(!s.test($.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test($.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let c="",u="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{constructor(I,F,N,k,b,T=!1){M(this,"scheme");M(this,"authority");M(this,"path");M(this,"query");M(this,"fragment");typeof I=="object"?(this.scheme=I.scheme||c,this.authority=I.authority||c,this.path=I.path||c,this.query=I.query||c,this.fragment=I.fragment||c):(this.scheme=(function(L,D){return L||D?L:"file"})(I,T),this.authority=F||c,this.path=(function(L,D){switch(L){case"https":case"http":case"file":D?D[0]!==u&&(D=u+D):D=u}return D})(this.scheme,N||c),this.query=k||c,this.fragment=b||c,l(this,T))}static isUri(I){return I instanceof d||!!I&&typeof I.authority=="string"&&typeof I.fragment=="string"&&typeof I.path=="string"&&typeof I.query=="string"&&typeof I.scheme=="string"&&typeof I.fsPath=="string"&&typeof I.with=="function"&&typeof I.toString=="function"}get fsPath(){return y(this,!1)}with(I){if(!I)return this;let{scheme:F,authority:N,path:k,query:b,fragment:T}=I;return F===void 0?F=this.scheme:F===null&&(F=c),N===void 0?N=this.authority:N===null&&(N=c),k===void 0?k=this.path:k===null&&(k=c),b===void 0?b=this.query:b===null&&(b=c),T===void 0?T=this.fragment:T===null&&(T=c),F===this.scheme&&N===this.authority&&k===this.path&&b===this.query&&T===this.fragment?this:new m(F,N,k,b,T)}static parse(I,F=!1){let N=f.exec(I);return N?new m(N[2]||c,R(N[4]||c),R(N[5]||c),R(N[7]||c),R(N[9]||c),F):new m(c,c,c,c,c)}static file(I){let F=c;if(i&&(I=I.replace(/\\/g,u)),I[0]===u&&I[1]===u){let N=I.indexOf(u,2);N===-1?(F=I.substring(2),I=u):(F=I.substring(2,N),I=I.substring(N)||u)}return new m("file",F,I,c,c)}static from(I){let F=new m(I.scheme,I.authority,I.path,I.query,I.fragment);return l(F,!0),F}toString(I=!1){return w(this,I)}toJSON(){return this}static revive(I){if(I){if(I instanceof d)return I;{let F=new m(I);return F._formatted=I.external,F._fsPath=I._sep===p?I.fsPath:null,F}}return I}}let p=i?1:void 0;class m extends d{constructor(){super(...arguments);M(this,"_formatted",null);M(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=y(this,!1)),this._fsPath}toString(F=!1){return F?w(this,!0):(this._formatted||(this._formatted=w(this,!1)),this._formatted)}toJSON(){let F={$mid:1};return this._fsPath&&(F.fsPath=this._fsPath,F._sep=p),this._formatted&&(F.external=this._formatted),this.path&&(F.path=this.path),this.scheme&&(F.scheme=this.scheme),this.authority&&(F.authority=this.authority),this.query&&(F.query=this.query),this.fragment&&(F.fragment=this.fragment),F}}let g={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function E($,I,F){let N,k=-1;for(let b=0;b<$.length;b++){let T=$.charCodeAt(b);if(T>=97&&T<=122||T>=65&&T<=90||T>=48&&T<=57||T===45||T===46||T===95||T===126||I&&T===47||F&&T===91||F&&T===93||F&&T===58)k!==-1&&(N+=encodeURIComponent($.substring(k,b)),k=-1),N!==void 0&&(N+=$.charAt(b));else{N===void 0&&(N=$.substr(0,b));let L=g[T];L!==void 0?(k!==-1&&(N+=encodeURIComponent($.substring(k,b)),k=-1),N+=L):k===-1&&(k=b)}}return k!==-1&&(N+=encodeURIComponent($.substring(k))),N!==void 0?N:$}function x($){let I;for(let F=0;F<$.length;F++){let N=$.charCodeAt(F);N===35||N===63?(I===void 0&&(I=$.substr(0,F)),I+=g[N]):I!==void 0&&(I+=$[F])}return I!==void 0?I:$}function y($,I){let F;return F=$.authority&&$.path.length>1&&$.scheme==="file"?`//${$.authority}${$.path}`:$.path.charCodeAt(0)===47&&($.path.charCodeAt(1)>=65&&$.path.charCodeAt(1)<=90||$.path.charCodeAt(1)>=97&&$.path.charCodeAt(1)<=122)&&$.path.charCodeAt(2)===58?I?$.path.substr(1):$.path[1].toLowerCase()+$.path.substr(2):$.path,i&&(F=F.replace(/\//g,"\\")),F}function w($,I){let F=I?x:E,N="",{scheme:k,authority:b,path:T,query:L,fragment:D}=$;if(k&&(N+=k,N+=":"),(b||k==="file")&&(N+=u,N+=u),b){let P=b.indexOf("@");if(P!==-1){let U=b.substr(0,P);b=b.substr(P+1),P=U.lastIndexOf(":"),P===-1?N+=F(U,!1,!1):(N+=F(U.substr(0,P),!1,!1),N+=":",N+=F(U.substr(P+1),!1,!0)),N+="@"}b=b.toLowerCase(),P=b.lastIndexOf(":"),P===-1?N+=F(b,!1,!0):(N+=F(b.substr(0,P),!1,!0),N+=b.substr(P))}if(T){if(T.length>=3&&T.charCodeAt(0)===47&&T.charCodeAt(2)===58){let P=T.charCodeAt(1);P>=65&&P<=90&&(T=`/${String.fromCharCode(P+32)}:${T.substr(3)}`)}else if(T.length>=2&&T.charCodeAt(1)===58){let P=T.charCodeAt(0);P>=65&&P<=90&&(T=`${String.fromCharCode(P+32)}:${T.substr(2)}`)}N+=F(T,!0,!1)}return L&&(N+="?",N+=F(L,!1,!1)),D&&(N+="#",N+=I?D:E(D,!1,!1)),N}function _($){try{return decodeURIComponent($)}catch{return $.length>3?$.substr(0,3)+_($.substr(3)):$}}let v=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function R($){return $.match(v)?$.replace(v,(I=>_(I))):$}var B=n(975);let C=B.posix||B,X="/";var V;(function($){$.joinPath=function(I,...F){return I.with({path:C.join(I.path,...F)})},$.resolvePath=function(I,...F){let N=I.path,k=!1;N[0]!==X&&(N=X+N,k=!0);let b=C.resolve(N,...F);return k&&b[0]===X&&!I.authority&&(b=b.substring(1)),I.with({path:b})},$.dirname=function(I){if(I.path.length===0||I.path===X)return I;let F=C.dirname(I.path);return F.length===1&&F.charCodeAt(0)===46&&(F=""),I.with({path:F})},$.basename=function(I){return C.basename(I.path)},$.extname=function(I){return C.extname(I.path)}})(V||(V={})),n0=r})();var{URI:Ce,Utils:Mo}=n0;var Qe;(function(e){e.basename=Mo.basename,e.dirname=Mo.dirname,e.extname=Mo.extname,e.joinPath=Mo.joinPath,e.resolvePath=Mo.resolvePath;let t=typeof process=="object"&&process?.platform==="win32";function n(s,a){return s?.toString()===a?.toString()}e.equals=n;function r(s,a){let l=typeof s=="string"?Ce.parse(s).path:s.path,c=typeof a=="string"?Ce.parse(a).path:a.path,u=l.split("/").filter(g=>g.length>0),f=c.split("/").filter(g=>g.length>0);if(t){let g=/^[A-Z]:$/;if(u[0]&&g.test(u[0])&&(u[0]=u[0].toLowerCase()),f[0]&&g.test(f[0])&&(f[0]=f[0].toLowerCase()),u[0]!==f[0])return c.substring(1)}let d=0;for(;d<u.length&&u[d]===f[d];d++);let p="../".repeat(u.length-d),m=f.slice(d).join("/");return p+m}e.relative=r;function i(s){return Ce.parse(s.toString()).toString()}e.normalize=i;function o(s,a){let l=typeof s=="string"?Ce.parse(s):s,c=typeof a=="string"?Ce.parse(a):a;if(l.scheme!==c.scheme)return!1;let u=l.path,f=c.path;return f.charAt(f.length-1)==="/"&&(f=f.slice(0,-1)),u.charAt(u.length-1)==="/"&&(u=u.slice(0,-1)),f===u?!0:f.length<u.length||f.charAt(u.length)!=="/"?!1:f.startsWith(u)}e.contains=o})(Qe||(Qe={}));var Ku=class{constructor(){this.root={name:"",children:new Map}}normalizeUri(t){return Qe.normalize(t)}clear(){this.root.children.clear()}insert(t,n){let r=this.getNode(this.normalizeUri(t),!0);r.element=n}delete(t){let n=this.getNode(this.normalizeUri(t),!1);n?.parent&&n.parent.children.delete(n.name)}has(t){return this.getNode(this.normalizeUri(t),!1)?.element!==void 0}hasNode(t){return this.getNode(this.normalizeUri(t),!1)!==void 0}find(t){return this.getNode(this.normalizeUri(t),!1)?.element}findNode(t){let n=this.normalizeUri(t),r=this.getNode(n,!1);if(r)return{name:r.name,uri:Qe.joinPath(Ce.parse(n),r.name).toString(),element:r.element}}findChildren(t){let n=this.normalizeUri(t),r=this.getNode(n,!1);return r?Array.from(r.children.values()).map(i=>({name:i.name,uri:Qe.joinPath(Ce.parse(n),i.name).toString(),element:i.element})):[]}all(){return this.collectValues(this.root)}findAll(t){let n=this.getNode(this.normalizeUri(t),!1);return n?this.collectValues(n):[]}getNode(t,n){let r=t.split("/");t.charAt(t.length-1)==="/"&&r.pop();let i=this.root;for(let o of r){let s=i.children.get(o);if(!s)if(n)s={name:o,children:new Map,parent:i},i.children.set(o,s);else return;i=s}return i}collectValues(t){let n=[];t.element&&n.push(t.element);for(let r of t.children.values())n.push(...this.collectValues(r));return n}};var de;(function(e){e[e.Changed=0]="Changed",e[e.Parsed=1]="Parsed",e[e.IndexedContent=2]="IndexedContent",e[e.ComputedScopes=3]="ComputedScopes",e[e.Linked=4]="Linked",e[e.IndexedReferences=5]="IndexedReferences",e[e.Validated=6]="Validated"})(de||(de={}));var qu=class{constructor(t){this.serviceRegistry=t.ServiceRegistry,this.textDocuments=t.workspace.TextDocuments,this.fileSystemProvider=t.workspace.FileSystemProvider}async fromUri(t,n=fe.CancellationToken.None){let r=await this.getInitialText(t,n);return this.createAsync(t,r,n)}async getInitialText(t,n){return this.fileSystemProvider.readFile(t)}fromTextDocument(t,n,r){return n=n??Ce.parse(t.uri),fe.CancellationToken.is(r)?this.createAsync(n,t,r):this.create(n,t,r)}fromString(t,n,r){return fe.CancellationToken.is(r)?this.createAsync(n,t,r):this.create(n,t,r)}fromModel(t,n){return this.create(n,{$model:t})}create(t,n,r){if(typeof n=="string"){let i=this.parse(t,n,r);return this.createLangiumDocument(i,t,void 0,n)}else if("$model"in n){let i={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,t)}else{let i=this.parse(t,n.getText(),r);return this.createLangiumDocument(i,t,n)}}async createAsync(t,n,r){if(typeof n=="string"){let i=await this.parseAsync(t,n,r);return this.createLangiumDocument(i,t,void 0,n)}else{let i=await this.parseAsync(t,n.getText(),r);return this.createLangiumDocument(i,t,n)}}createLangiumDocument(t,n,r,i){let o;if(r)o={parseResult:t,uri:n,state:de.Parsed,references:[],textDocument:r};else{let s=this.createTextDocumentGetter(n,i);o={parseResult:t,uri:n,state:de.Parsed,references:[],get textDocument(){return s()}}}return t.value.$document=o,o}async update(t,n){let r=t.parseResult.value.$cstNode?.root.fullText,i=this.textDocuments?.get(t.uri.toString()),o=await this.getUpdatedText(t,i,n);if(i)Object.defineProperty(t,"textDocument",{value:i});else{let s=this.createTextDocumentGetter(t.uri,o);Object.defineProperty(t,"textDocument",{get:s})}return r!==o&&(t.parseResult=await this.parseAsync(t.uri,o,n),t.parseResult.value.$document=t),t.state=de.Parsed,t}async getUpdatedText(t,n,r){return n?n.getText():await this.fileSystemProvider.readFile(t.uri)}parse(t,n,r){return this.serviceRegistry.getServices(t).parser.LangiumParser.parse(n,r)}parseAsync(t,n,r){return this.serviceRegistry.getServices(t).parser.AsyncParser.parse(n,r)}createTextDocumentGetter(t,n){let r=this.serviceRegistry,i;return()=>i??(i=Oa.create(t.toString(),r.getServices(t).LanguageMetaData.languageId,0,n??""))}},Zu=class{constructor(t){this.documentTrie=new Ku,this.services=t,this.langiumDocumentFactory=t.workspace.LangiumDocumentFactory,this.documentBuilder=()=>t.workspace.DocumentBuilder}get all(){return ye(this.documentTrie.all())}addDocument(t){let n=t.uri.toString();if(this.documentTrie.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentTrie.insert(n,t)}getDocument(t){let n=t.toString();return this.documentTrie.find(n)}getDocuments(t){let n=t.toString();return this.documentTrie.findAll(n)}async getOrCreateDocument(t,n){let r=this.getDocument(t);return r||(r=await this.langiumDocumentFactory.fromUri(t,n),this.addDocument(r),r)}createDocument(t,n,r){if(r)return this.langiumDocumentFactory.fromString(n,t,r).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(n,t);return this.addDocument(i),i}}hasDocument(t){return this.documentTrie.has(t.toString())}invalidateDocument(t){let n=t.toString(),r=this.documentTrie.find(n);return r&&this.documentBuilder().resetToState(r,de.Changed),r}deleteDocument(t){let n=t.toString(),r=this.documentTrie.find(n);return r&&(r.state=de.Changed,this.documentTrie.delete(n)),r}deleteDocuments(t){let n=t.toString(),r=this.documentTrie.findAll(n);for(let i of r)i.state=de.Changed;return this.documentTrie.delete(n),r}};var Fo=Symbol("RefResolving"),Zm=class{constructor(t,n,r,i,o){this.resolver=t,this.node=n,this.property=r,this._ref=void 0,this.$refNode=i,this.$refText=o}get ref(){return this.resolver.resolveReference(this,this.node,this.property)}get $nodeDescription(){return this._nodeDescription}get error(){return Hi(this._ref)?this._ref:void 0}},Jm=class{constructor(t,n,r,i,o){this.resolver=t,this.node=n,this.property=r,this._items=void 0,this.$refNode=i,this.$refText=o}get items(){return this.resolver.resolveMultiReference(this,this.node,this.property)}get error(){return this._linkingError}},Ju=class{constructor(t){this.reflection=t.shared.AstReflection,this.langiumDocuments=()=>t.shared.workspace.LangiumDocuments,this.scopeProvider=t.references.ScopeProvider,this.astNodeLocator=t.workspace.AstNodeLocator,this.profiler=t.shared.profilers.LangiumProfiler,this.languageId=t.LanguageMetaData.languageId,this.referenceResolver={resolveReference:this.resolveReference.bind(this),resolveMultiReference:this.resolveMultiReference.bind(this)}}async link(t,n=fe.CancellationToken.None){if(this.profiler?.isActive("linking")){let r=this.profiler.createTask("linking",this.languageId);r.start();try{for(let i of xt(t.parseResult.value))await Ge(n),Hr(i).forEach(o=>{let s=`${i.$type}:${o.property}`;r.startSubTask(s);try{this.doLink(o,t)}finally{r.stopSubTask(s)}})}finally{r.stop()}}else for(let r of xt(t.parseResult.value))await Ge(n),Hr(r).forEach(i=>this.doLink(i,t))}doLink(t,n){let r=t.reference;if("_ref"in r&&r._ref===void 0){r._ref=Fo;try{let i=this.getCandidate(t);if(Hi(i))r._ref=i;else{r._nodeDescription=i;let o=this.loadAstNode(i);r._ref=o??this.createLinkingError(t,i)}}catch(i){console.error(`An error occurred while resolving reference to '${r.$refText}':`,i);let o=i.message??String(i);r._ref={info:t,message:`An error occurred while resolving reference to '${r.$refText}': ${o}`}}n.references.push(r)}else if("_items"in r&&r._items===void 0){r._items=Fo;try{let i=this.getCandidates(t),o=[];if(Hi(i))r._linkingError=i;else for(let s of i){let a=this.loadAstNode(s);a&&o.push({ref:a,$nodeDescription:s})}r._items=o}catch(i){r._linkingError={info:t,message:`An error occurred while resolving reference to '${r.$refText}': ${i}`},r._items=[]}n.references.push(r)}}unlink(t){for(let n of t.references)"_ref"in n?(n._ref=void 0,delete n._nodeDescription):"_items"in n&&(n._items=void 0,delete n._linkingError);t.references=[]}getCandidate(t){return this.scopeProvider.getScope(t).getElement(t.reference.$refText)??this.createLinkingError(t)}getCandidates(t){let r=this.scopeProvider.getScope(t).getElements(t.reference.$refText).distinct(i=>`${i.documentUri}#${i.path}`).toArray();return r.length>0?r:this.createLinkingError(t)}buildReference(t,n,r,i){return new Zm(this.referenceResolver,t,n,r,i)}buildMultiReference(t,n,r,i){return new Jm(this.referenceResolver,t,n,r,i)}resolveReference(t,n,r){if(Ue(t._ref))return t._ref;if(AE(t._nodeDescription)){let i=this.loadAstNode(t._nodeDescription);t._ref=i??this.createLinkingError({reference:t,container:n,property:r},t._nodeDescription)}else if(t._ref===void 0){t._ref=Fo;let i=Us(n).$document,o=this.getLinkedNode({reference:t,container:n,property:r});if(o.error&&i&&i.state<de.ComputedScopes)return t._ref=void 0;t._ref=o.node??o.error,t._nodeDescription=o.descr,i?.references.push(t)}else t._ref===Fo&&this.throwCyclicReferenceError(n,r,t.$refText);return Ue(t._ref)?t._ref:void 0}resolveMultiReference(t,n,r){if(Array.isArray(t._items))return t._items;if(t._items===void 0){t._items=Fo;let i=Us(n).$document,o=this.getCandidates({reference:t,container:n,property:r}),s=[];if(Hi(o))t._linkingError=o;else{for(let a of o){let l=this.loadAstNode(a);l&&s.push({ref:l,$nodeDescription:a})}s.length===0&&(t._linkingError=this.createLinkingError({reference:t,container:n,property:r}))}t._items=s,i?.references.push(t)}else t._items===Fo&&this.throwCyclicReferenceError(n,r,t.$refText);return Array.isArray(t._items)?t._items:[]}throwCyclicReferenceError(t,n,r){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(t)}/${n} (symbol '${r}')`)}getLinkedNode(t){try{let n=this.getCandidate(t);if(Hi(n))return{error:n};let r=this.loadAstNode(n);return r?{node:r,descr:n}:{descr:n,error:this.createLinkingError(t,n)}}catch(n){console.error(`An error occurred while resolving reference to '${t.reference.$refText}':`,n);let r=n.message??String(n);return{error:{info:t,message:`An error occurred while resolving reference to '${t.reference.$refText}': ${r}`}}}}loadAstNode(t){if(t.node)return t.node;let n=this.langiumDocuments().getDocument(t.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,t.path)}createLinkingError(t,n){let r=Us(t.container).$document;r&&r.state<de.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);let i=this.reflection.getReferenceType(t);return{info:t,message:`Could not resolve reference to ${i} named '${t.reference.$refText}'.`,targetDescription:n}}};function FM(e){return typeof e.name=="string"}var Qu=class{getName(t){if(FM(t))return t.name}getNameNode(t){return ia(t.$cstNode,"name")}};var ef=class{constructor(t){this.nameProvider=t.references.NameProvider,this.index=t.shared.workspace.IndexManager,this.nodeLocator=t.workspace.AstNodeLocator,this.documents=t.shared.workspace.LangiumDocuments,this.hasMultiReference=xt(t.Grammar).some(n=>dn(n)&&n.isMulti)}findDeclarations(t){if(t){let n=Th(t),r=t.astNode;if(n&&r){let i=r[n.feature];if(it(i)||Mt(i))return Vp(i);if(Array.isArray(i)){for(let o of i)if((it(o)||Mt(o))&&o.$refNode&&o.$refNode.offset<=t.offset&&o.$refNode.end>=t.end)return Vp(o)}}if(r){let i=this.nameProvider.getNameNode(r);if(i&&(i===t||QE(t,i)))return this.getSelfNodes(r)}}return[]}getSelfNodes(t){if(this.hasMultiReference){let n=this.index.findAllReferences(t,this.nodeLocator.getAstNodePath(t)),r=this.getNodeFromReferenceDescription(n.head());if(r){for(let i of Hr(r))if(Mt(i.reference)&&i.reference.items.some(o=>o.ref===t))return i.reference.items.map(o=>o.ref)}return[t]}else return[t]}getNodeFromReferenceDescription(t){if(!t)return;let n=this.documents.getDocument(t.sourceUri);if(n)return this.nodeLocator.getAstNode(n.parseResult.value,t.sourcePath)}findDeclarationNodes(t){let n=this.findDeclarations(t),r=[];for(let i of n){let o=this.nameProvider.getNameNode(i)??i.$cstNode;o&&r.push(o)}return r}findReferences(t,n){let r=[];n.includeDeclaration&&r.push(...this.getSelfReferences(t));let i=this.index.findAllReferences(t,this.nodeLocator.getAstNodePath(t));return n.documentUri&&(i=i.filter(o=>Qe.equals(o.sourceUri,n.documentUri))),r.push(...i),ye(r)}getSelfReferences(t){let n=this.getSelfNodes(t),r=[];for(let i of n){let o=this.nameProvider.getNameNode(i);if(o){let s=st(i),a=this.nodeLocator.getAstNodePath(i);r.push({sourceUri:s.uri,sourcePath:a,targetUri:s.uri,targetPath:a,segment:to(o),local:!0})}}return r}};var Jt=class{constructor(t){if(this.map=new Map,t)for(let[n,r]of t)this.add(n,r)}get size(){return sc.sum(ye(this.map.values()).map(t=>t.length))}clear(){this.map.clear()}delete(t,n){if(n===void 0)return this.map.delete(t);{let r=this.map.get(t);if(r){let i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(t):r.splice(i,1),!0}return!1}}get(t){return this.map.get(t)??[]}getStream(t){let n=this.map.get(t);return n?ye(n):ac}has(t,n){if(n===void 0)return this.map.has(t);{let r=this.map.get(t);return r?r.indexOf(n)>=0:!1}}add(t,n){return this.map.has(t)?this.map.get(t).push(n):this.map.set(t,[n]),this}addAll(t,n){return this.map.has(t)?this.map.get(t).push(...n):this.map.set(t,Array.from(n)),this}forEach(t){this.map.forEach((n,r)=>n.forEach(i=>t(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ye(this.map.entries()).flatMap(([t,n])=>n.map(r=>[t,r]))}keys(){return ye(this.map.keys())}values(){return ye(this.map.values()).flat()}entriesGroupedByKey(){return ye(this.map.entries())}},Ca=class{get size(){return this.map.size}constructor(t){if(this.map=new Map,this.inverse=new Map,t)for(let[n,r]of t)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(t,n){return this.map.set(t,n),this.inverse.set(n,t),this}get(t){return this.map.get(t)}getKey(t){return this.inverse.get(t)}delete(t){let n=this.map.get(t);return n!==void 0?(this.map.delete(t),this.inverse.delete(n),!0):!1}};var tf=class{constructor(t){this.nameProvider=t.references.NameProvider,this.descriptions=t.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(t,n=fe.CancellationToken.None){return this.collectExportedSymbolsForNode(t.parseResult.value,t,void 0,n)}async collectExportedSymbolsForNode(t,n,r=cc,i=fe.CancellationToken.None){let o=[];this.addExportedSymbol(t,o,n);for(let s of r(t))await Ge(i),this.addExportedSymbol(s,o,n);return o}addExportedSymbol(t,n,r){let i=this.nameProvider.getName(t);i&&n.push(this.descriptions.createDescription(t,i,r))}async collectLocalSymbols(t,n=fe.CancellationToken.None){let r=t.parseResult.value,i=new Jt;for(let o of cn(r))await Ge(n),this.addLocalSymbol(o,t,i);return i}addLocalSymbol(t,n,r){let i=t.$container;if(i){let o=this.nameProvider.getName(t);o&&r.add(i,this.descriptions.createDescription(t,o,n))}}};var $a=class{constructor(t,n,r){this.elements=t,this.outerScope=n,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.caseInsensitive?this.elements.find(i=>i.name.toLowerCase()===n):this.elements.find(i=>i.name===t);if(r)return r;if(this.outerScope)return this.outerScope.getElement(t)}getElements(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.caseInsensitive?this.elements.filter(i=>i.name.toLowerCase()===n):this.elements.filter(i=>i.name===t);return(this.concatOuterScope||r.isEmpty())&&this.outerScope?r.concat(this.outerScope.getElements(t)):r}};var nf=class{constructor(t,n,r){this.elements=new Jt,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let i of t){let o=this.caseInsensitive?i.name.toLowerCase():i.name;this.elements.add(o,i)}this.outerScope=n}getElement(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.elements.get(n)[0];if(r)return r;if(this.outerScope)return this.outerScope.getElement(t)}getElements(t){let n=this.caseInsensitive?t.toLowerCase():t,r=this.elements.get(n);return(this.concatOuterScope||r.length===0)&&this.outerScope?ye(r).concat(this.outerScope.getElements(t)):ye(r)}getAllElements(){let t=ye(this.elements.values());return this.outerScope&&(t=t.concat(this.outerScope.getAllElements())),t}};var rf=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(t){this.toDispose.push(t)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(t=>t.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},Qm=class extends rf{constructor(){super(...arguments),this.cache=new Map}has(t){return this.throwIfDisposed(),this.cache.has(t)}set(t,n){this.throwIfDisposed(),this.cache.set(t,n)}get(t,n){if(this.throwIfDisposed(),this.cache.has(t))return this.cache.get(t);if(n){let r=n();return this.cache.set(t,r),r}else return}delete(t){return this.throwIfDisposed(),this.cache.delete(t)}clear(){this.throwIfDisposed(),this.cache.clear()}},of=class extends rf{constructor(t){super(),this.cache=new Map,this.converter=t??(n=>n)}has(t,n){return this.throwIfDisposed(),this.cacheForContext(t).has(n)}set(t,n,r){this.throwIfDisposed(),this.cacheForContext(t).set(n,r)}get(t,n,r){this.throwIfDisposed();let i=this.cacheForContext(t);if(i.has(n))return i.get(n);if(r){let o=r();return i.set(n,o),o}else return}delete(t,n){return this.throwIfDisposed(),this.cacheForContext(t).delete(n)}clear(t){if(this.throwIfDisposed(),t){let n=this.converter(t);this.cache.delete(n)}else this.cache.clear()}cacheForContext(t){let n=this.converter(t),r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}};var sf=class extends Qm{constructor(t,n){super(),n?(this.toDispose.push(t.workspace.DocumentBuilder.onBuildPhase(n,()=>{this.clear()})),this.toDispose.push(t.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(t.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}};var af=class{constructor(t){this.reflection=t.shared.AstReflection,this.nameProvider=t.references.NameProvider,this.descriptions=t.workspace.AstNodeDescriptionProvider,this.indexManager=t.shared.workspace.IndexManager,this.globalScopeCache=new sf(t.shared)}getScope(t){let n=[],r=this.reflection.getReferenceType(t),i=st(t.container).localSymbols;if(i){let s=t.container;do i.has(s)&&n.push(i.getStream(s).filter(a=>this.reflection.isSubtype(a.type,r))),s=s.$container;while(s)}let o=this.getGlobalScope(r,t);for(let s=n.length-1;s>=0;s--)o=this.createScope(n[s],o);return o}createScope(t,n,r){return new $a(ye(t),n,r)}createScopeForNodes(t,n,r){let i=ye(t).map(o=>{let s=this.nameProvider.getName(o);if(s)return this.descriptions.createDescription(o,s)}).nonNullable();return new $a(i,n,r)}getGlobalScope(t,n){return this.globalScopeCache.get(t,()=>new nf(this.indexManager.allElements(t)))}};function i0(e){return typeof e.$comment=="string"}function r0(e){return typeof e=="object"&&!!e&&("$ref"in e||"$refs"in e||"$error"in e)}var lf=class{constructor(t){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=t.shared.workspace.LangiumDocuments,this.astNodeLocator=t.workspace.AstNodeLocator,this.nameProvider=t.references.NameProvider,this.commentProvider=t.documentation.CommentProvider}serialize(t,n){let r=n??{},i=n?.replacer,o=(a,l)=>this.replacer(a,l,r),s=i?(a,l)=>i(a,l,o):o;try{return this.currentDocument=st(t),JSON.stringify(t,s,n?.space)}finally{this.currentDocument=void 0}}deserialize(t,n){let r=n??{},i=JSON.parse(t);return this.linkNode(i,i,r),i}replacer(t,n,{refText:r,sourceText:i,textRegions:o,comments:s,uriConverter:a}){if(!this.ignoreProperties.has(t))if(it(n)){let l=n.ref,c=r?n.$refText:void 0;if(l){let u=st(l),f="";this.currentDocument&&this.currentDocument!==u&&(a?f=a(u.uri,l):f=u.uri.toString());let d=this.astNodeLocator.getAstNodePath(l);return{$ref:`${f}#${d}`,$refText:c}}else return{$error:n.error?.message??"Could not resolve reference",$refText:c}}else if(Mt(n)){let l=r?n.$refText:void 0,c=[];for(let u of n.items){let f=u.ref,d=st(u.ref),p="";this.currentDocument&&this.currentDocument!==d&&(a?p=a(d.uri,f):p=d.uri.toString());let m=this.astNodeLocator.getAstNodePath(f);c.push(`${p}#${m}`)}return{$refs:c,$refText:l}}else if(Ue(n)){let l;if(o&&(l=this.addAstNodeRegionWithAssignmentsTo({...n}),(!t||n.$document)&&l?.$textRegion&&(l.$textRegion.documentURI=this.currentDocument?.uri.toString())),i&&!t&&(l??(l={...n}),l.$sourceText=n.$cstNode?.text),s){l??(l={...n});let c=this.commentProvider.getComment(n);c&&(l.$comment=c.replace(/\r/g,""))}return l??n}else return n}addAstNodeRegionWithAssignmentsTo(t){let n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(t.$cstNode){let r=t.$textRegion=n(t.$cstNode),i=r.assignments={};return Object.keys(t).filter(o=>!o.startsWith("$")).forEach(o=>{let s=yh(t.$cstNode,o).map(n);s.length!==0&&(i[o]=s)}),t}}linkNode(t,n,r,i,o,s){for(let[l,c]of Object.entries(t))if(Array.isArray(c))for(let u=0;u<c.length;u++){let f=c[u];r0(f)?c[u]=this.reviveReference(t,l,n,f,r):Ue(f)&&this.linkNode(f,n,r,t,l,u)}else r0(c)?t[l]=this.reviveReference(t,l,n,c,r):Ue(c)&&this.linkNode(c,n,r,t,l);let a=t;a.$container=i,a.$containerProperty=o,a.$containerIndex=s}reviveReference(t,n,r,i,o){let s=i.$refText,a=i.$error,l;if(i.$ref){let c=this.getRefNode(r,i.$ref,o.uriConverter);if(Ue(c))return s||(s=this.nameProvider.getName(c)),{$refText:s??"",ref:c};a=c}else if(i.$refs){let c=[];for(let u of i.$refs){let f=this.getRefNode(r,u,o.uriConverter);Ue(f)&&c.push({ref:f})}if(c.length===0)l={$refText:s??"",items:c},a??(a="Could not resolve multi-reference");else return{$refText:s??"",items:c}}if(a)return l??(l={$refText:s??"",ref:void 0}),l.error={info:{container:t,property:n,reference:l},message:a},l}getRefNode(t,n,r){try{let i=n.indexOf("#");if(i===0){let l=this.astNodeLocator.getAstNode(t,n.substring(1));return l||"Could not resolve path: "+n}if(i<0){let l=r?r(n):Ce.parse(n),c=this.langiumDocuments.getDocument(l);return c?c.parseResult.value:"Could not find document for URI: "+n}let o=r?r(n.substring(0,i)):Ce.parse(n.substring(0,i)),s=this.langiumDocuments.getDocument(o);if(!s)return"Could not find document for URI: "+n;if(i===n.length-1)return s.parseResult.value;let a=this.astNodeLocator.getAstNode(s.parseResult.value,n.substring(i+1));return a||"Could not resolve URI: "+n}catch(i){return String(i)}}};var cf=class{get map(){return this.fileExtensionMap}constructor(t){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=t?.workspace.TextDocuments}register(t){let n=t.LanguageMetaData;for(let r of n.fileExtensions)this.fileExtensionMap.has(r)&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileExtensionMap.set(r,t);if(n.fileNames)for(let r of n.fileNames)this.fileNameMap.has(r)&&console.warn(`The file name ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileNameMap.set(r,t);this.languageIdMap.set(n.languageId,t)}getServices(t){if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let n=this.textDocuments?.get(t)?.languageId;if(n!==void 0){let s=this.languageIdMap.get(n);if(s)return s}let r=Qe.extname(t),i=Qe.basename(t),o=this.fileNameMap.get(i)??this.fileExtensionMap.get(r);if(!o)throw n?new Error(`The service registry contains no services for the extension '${r}' for language '${n}'.`):new Error(`The service registry contains no services for the extension '${r}'.`);return o}hasServices(t){try{return this.getServices(t),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function Bo(e){return{code:e}}var eg;(function(e){e.defaults=["fast","slow","built-in"],e.all=e.defaults})(eg||(eg={}));var uf=class{constructor(t){this.entries=new Jt,this.knownCategories=new Set(eg.defaults),this.entriesBefore=[],this.entriesAfter=[],this.reflection=t.shared.AstReflection}register(t,n=this,r="fast"){if(r==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");this.knownCategories.add(r);for(let[i,o]of Object.entries(t)){let s=o;if(Array.isArray(s))for(let a of s){let l={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,l)}else if(typeof s=="function"){let a={check:this.wrapValidationException(s,n),category:r};this.addEntry(i,a)}else ar(s)}}wrapValidationException(t,n){return async(r,i,o)=>{await this.handleException(()=>t.call(n,r,i,o),"An error occurred during validation",i,r)}}async handleException(t,n,r,i){try{await t()}catch(o){if(Sr(o))throw o;console.error(`${n}:`,o),o instanceof Error&&o.stack&&console.error(o.stack);let s=o instanceof Error?o.message:String(o);r("error",`${n}: ${s}`,{node:i})}}addEntry(t,n){if(t==="AstNode"){this.entries.add("AstNode",n);return}for(let r of this.reflection.getAllSubTypes(t))this.entries.add(r,n)}getChecks(t,n){let r=ye(this.entries.get(t)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}registerBeforeDocument(t,n=this){this.entriesBefore.push(this.wrapPreparationException(t,"An error occurred during set-up of the validation",n))}registerAfterDocument(t,n=this){this.entriesAfter.push(this.wrapPreparationException(t,"An error occurred during tear-down of the validation",n))}wrapPreparationException(t,n,r){return async(i,o,s,a)=>{await this.handleException(()=>t.call(r,i,o,s,a),n,o,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(t){return this.knownCategories}};var BM=Object.freeze({validateNode:!0,validateChildren:!0}),ff=class{constructor(t){this.validationRegistry=t.validation.ValidationRegistry,this.metadata=t.LanguageMetaData,this.profiler=t.shared.profilers.LangiumProfiler,this.languageId=t.LanguageMetaData.languageId}async validateDocument(t,n={},r=fe.CancellationToken.None){let i=t.parseResult,o=[];if(await Ge(r),(!n.categories||n.categories.includes("built-in"))&&(this.processLexingErrors(i,o,n),n.stopAfterLexingErrors&&o.some(s=>s.data?.code===Qt.LexingError)||(this.processParsingErrors(i,o,n),n.stopAfterParsingErrors&&o.some(s=>s.data?.code===Qt.ParsingError))||(this.processLinkingErrors(t,o,n),n.stopAfterLinkingErrors&&o.some(s=>s.data?.code===Qt.LinkingError))))return o;try{o.push(...await this.validateAst(i.value,n,r))}catch(s){if(Sr(s))throw s;console.error("An error occurred during validation:",s)}return await Ge(r),o}processLexingErrors(t,n,r){let i=[...t.lexerErrors,...t.lexerReport?.diagnostics??[]];for(let o of i){let s=o.severity??"error",a={severity:tg(s),range:{start:{line:o.line-1,character:o.column-1},end:{line:o.line-1,character:o.column+o.length-1}},message:o.message,data:WM(s),source:this.getSource()};n.push(a)}}processParsingErrors(t,n,r){for(let i of t.parserErrors){let o;if(Js(i.token))o=ew(i.token);else if("previousToken"in i){let s=i.previousToken;if(Js(s)){let a={line:s.endLine-1,character:s.endColumn};o={start:a,end:a}}else{let a={line:0,character:0};o={start:a,end:a}}}if(o){let s={severity:tg("error"),range:o,message:i.message,data:Bo(Qt.ParsingError),source:this.getSource()};n.push(s)}}}processLinkingErrors(t,n,r){for(let i of t.references){let o=i.error;if(o){let s={node:o.info.container,range:i.$refNode?.range,property:o.info.property,index:o.info.index,data:{code:Qt.LinkingError,containerType:o.info.container.$type,property:o.info.property,refText:o.info.reference.$refText}};n.push(this.toDiagnostic("error",o.message,s))}}}async validateAst(t,n,r=fe.CancellationToken.None){let i=[],o=(s,a,l)=>{i.push(this.toDiagnostic(s,a,l))};return await this.validateAstBefore(t,n,o,r),await this.validateAstNodes(t,n,o,r),await this.validateAstAfter(t,n,o,r),i}async validateAstBefore(t,n,r,i=fe.CancellationToken.None){let o=this.validationRegistry.checksBefore;for(let s of o)await Ge(i),await s(t,r,n.categories??[],i)}async validateAstNodes(t,n,r,i=fe.CancellationToken.None){if(this.profiler?.isActive("validating")){let o=this.profiler.createTask("validating",this.languageId);o.start();try{let s=xt(t).iterator();for(let a of s){o.startSubTask(a.$type);let l=this.validateSingleNodeOptions(a,n);if(l.validateNode)try{let c=this.validationRegistry.getChecks(a.$type,n.categories);for(let u of c)await u(a,r,i)}finally{o.stopSubTask(a.$type)}l.validateChildren||s.prune()}}finally{o.stop()}}else{let o=xt(t).iterator();for(let s of o){await Ge(i);let a=this.validateSingleNodeOptions(s,n);if(a.validateNode){let l=this.validationRegistry.getChecks(s.$type,n.categories);for(let c of l)await c(s,r,i)}a.validateChildren||o.prune()}}}validateSingleNodeOptions(t,n){return BM}async validateAstAfter(t,n,r,i=fe.CancellationToken.None){let o=this.validationRegistry.checksAfter;for(let s of o)await Ge(i),await s(t,r,n.categories??[],i)}toDiagnostic(t,n,r){return{message:n,range:ng(r),severity:tg(t),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function ng(e){if(e.range)return e.range;let t;return typeof e.property=="string"?t=ia(e.node.$cstNode,e.property,e.index):typeof e.keyword=="string"&&(t=Eh(e.node.$cstNode,e.keyword,e.index)),t??(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function tg(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}function WM(e){switch(e){case"error":return Bo(Qt.LexingError);case"warning":return Bo(Qt.LexingWarning);case"info":return Bo(Qt.LexingInfo);case"hint":return Bo(Qt.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}var Qt;(function(e){e.LexingError="lexing-error",e.LexingWarning="lexing-warning",e.LexingInfo="lexing-info",e.LexingHint="lexing-hint",e.ParsingError="parsing-error",e.LinkingError="linking-error"})(Qt||(Qt={}));var df=class{constructor(t){this.astNodeLocator=t.workspace.AstNodeLocator,this.nameProvider=t.references.NameProvider}createDescription(t,n,r){let i=r??st(t);n??(n=this.nameProvider.getName(t));let o=this.astNodeLocator.getAstNodePath(t);if(!n)throw new Error(`Node at path ${o} has no name.`);let s,a=()=>s??(s=to(this.nameProvider.getNameNode(t)??t.$cstNode));return{node:t,name:n,get nameSegment(){return a()},selectionSegment:to(t.$cstNode),type:t.$type,documentUri:i.uri,path:o}}},pf=class{constructor(t){this.nodeLocator=t.workspace.AstNodeLocator}async createDescriptions(t,n=fe.CancellationToken.None){let r=[],i=t.parseResult.value;for(let o of xt(i))await Ge(n),Hr(o).forEach(s=>{s.reference.error||r.push(...this.createInfoDescriptions(s))});return r}createInfoDescriptions(t){let n=t.reference;if(n.error||!n.$refNode)return[];let r=[];it(n)&&n.$nodeDescription?r=[n.$nodeDescription]:Mt(n)&&(r=n.items.map(l=>l.$nodeDescription).filter(l=>l!==void 0));let i=st(t.container).uri,o=this.nodeLocator.getAstNodePath(t.container),s=[],a=to(n.$refNode);for(let l of r)s.push({sourceUri:i,sourcePath:o,targetUri:l.documentUri,targetPath:l.path,segment:a,local:Qe.equals(l.documentUri,i)});return s}};var hf=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(t){if(t.$container){let n=this.getAstNodePath(t.$container),r=this.getPathSegment(t);return n+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:t,$containerIndex:n}){if(!t)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?t+this.indexSeparator+n:t}getAstNode(t,n){return n.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let s=o.indexOf(this.indexSeparator);if(s>0){let a=o.substring(0,s),l=parseInt(o.substring(s+1));return i[a]?.[l]}return i[o]},t)}};var mf=class{constructor(t){this._ready=new Rr,this.onConfigurationSectionUpdateEmitter=new zu.Emitter,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=t.ServiceRegistry}get ready(){return this._ready.promise}initialize(t){this.workspaceConfig=t.capabilities.workspace?.configuration??!1}async initialized(t){if(this.workspaceConfig){if(t.register){let n=this.serviceRegistry.all;t.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(t.fetchConfiguration){let n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await t.fetchConfiguration(n);n.forEach((i,o)=>{this.updateSectionConfiguration(i.section,r[o])})}}this._ready.resolve()}updateConfiguration(t){typeof t.settings!="object"||t.settings===null||Object.entries(t.settings).forEach(([n,r])=>{this.updateSectionConfiguration(n,r),this.onConfigurationSectionUpdateEmitter.fire({section:n,configuration:r})})}updateSectionConfiguration(t,n){this.settings[t]=n}async getConfiguration(t,n){await this.ready;let r=this.toSectionName(t);if(this.settings[r])return this.settings[r][n]}toSectionName(t){return`${t}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}};var Wo;(function(e){function t(n){return{dispose:async()=>await n()}}e.create=t})(Wo||(Wo={}));var gf=class{constructor(t){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Jt,this.documentPhaseListeners=new Jt,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=de.Changed,this.langiumDocuments=t.workspace.LangiumDocuments,this.langiumDocumentFactory=t.workspace.LangiumDocumentFactory,this.textDocuments=t.workspace.TextDocuments,this.indexManager=t.workspace.IndexManager,this.fileSystemProvider=t.workspace.FileSystemProvider,this.workspaceManager=()=>t.workspace.WorkspaceManager,this.serviceRegistry=t.ServiceRegistry}async build(t,n={},r=fe.CancellationToken.None){for(let i of t){let o=i.uri.toString();if(i.state===de.Validated){if(typeof n.validation=="boolean"&&n.validation)this.resetToState(i,de.IndexedReferences);else if(typeof n.validation=="object"){let s=this.findMissingValidationCategories(i,n);s.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:{categories:s}},result:this.buildState.get(o)?.result}),i.state=de.IndexedReferences)}}else this.buildState.delete(o)}this.currentState=de.Changed,await this.emitUpdate(t.map(i=>i.uri),[]),await this.buildDocuments(t,n,r)}async update(t,n,r=fe.CancellationToken.None){this.currentState=de.Changed;let i=[];for(let l of n){let c=this.langiumDocuments.deleteDocuments(l);for(let u of c)i.push(u.uri),this.cleanUpDeleted(u)}let o=(await Promise.all(t.map(l=>this.findChangedUris(l)))).flat();for(let l of o){let c=this.langiumDocuments.getDocument(l);c===void 0&&(c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},l),c.state=de.Changed,this.langiumDocuments.addDocument(c)),this.resetToState(c,de.Changed)}let s=ye(o).concat(i).map(l=>l.toString()).toSet();this.langiumDocuments.all.filter(l=>!s.has(l.uri.toString())&&this.shouldRelink(l,s)).forEach(l=>this.resetToState(l,de.ComputedScopes)),await this.emitUpdate(o,i),await Ge(r);let a=this.sortDocuments(this.langiumDocuments.all.filter(l=>l.state<de.Validated||!this.buildState.get(l.uri.toString())?.completed||this.resultsAreIncomplete(l,this.updateBuildOptions)).toArray());await this.buildDocuments(a,this.updateBuildOptions,r)}resultsAreIncomplete(t,n){return this.findMissingValidationCategories(t,n).length>=1}findMissingValidationCategories(t,n){let r=this.buildState.get(t.uri.toString()),i=this.serviceRegistry.getServices(t.uri).validation.ValidationRegistry.getAllValidationCategories(t),o=r?.result?.validationChecks?new Set(r?.result?.validationChecks):r?.completed?i:new Set,s=n===void 0||n.validation===!0?i:typeof n.validation=="object"?n.validation.categories??i:[];return ye(s).filter(a=>!o.has(a)).toArray()}async findChangedUris(t){if(this.langiumDocuments.getDocument(t)??this.textDocuments?.get(t))return[t];try{let r=await this.fileSystemProvider.stat(t);if(r.isDirectory)return await this.workspaceManager().searchFolder(t);if(this.workspaceManager().shouldIncludeEntry(r))return[t]}catch{}return[]}async emitUpdate(t,n){await Promise.all(this.updateListeners.map(r=>r(t,n)))}sortDocuments(t){let n=0,r=t.length-1;for(;n<r;){for(;n<t.length&&this.hasTextDocument(t[n]);)n++;for(;r>=0&&!this.hasTextDocument(t[r]);)r--;n<r&&([t[n],t[r]]=[t[r],t[n]])}return t}hasTextDocument(t){return!!this.textDocuments?.get(t.uri)}shouldRelink(t,n){return t.references.some(r=>r.error!==void 0)?!0:this.indexManager.isAffected(t,n)}onUpdate(t){return this.updateListeners.push(t),Wo.create(()=>{let n=this.updateListeners.indexOf(t);n>=0&&this.updateListeners.splice(n,1)})}resetToState(t,n){switch(n){case de.Changed:case de.Parsed:this.indexManager.removeContent(t.uri);case de.IndexedContent:t.localSymbols=void 0;case de.ComputedScopes:this.serviceRegistry.getServices(t.uri).references.Linker.unlink(t);case de.Linked:this.indexManager.removeReferences(t.uri);case de.IndexedReferences:t.diagnostics=void 0,this.buildState.delete(t.uri.toString());case de.Validated:}t.state>n&&(t.state=n)}cleanUpDeleted(t){this.buildState.delete(t.uri.toString()),this.indexManager.remove(t.uri),t.state=de.Changed}async buildDocuments(t,n,r){this.prepareBuild(t,n),await this.runCancelable(t,de.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(t,de.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(t,de.ComputedScopes,r,async s=>{let a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.localSymbols=await a.collectLocalSymbols(s,r)});let i=t.filter(s=>this.shouldLink(s));await this.runCancelable(i,de.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(i,de.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));let o=t.filter(s=>this.shouldValidate(s)?!0:(this.markAsCompleted(s),!1));await this.runCancelable(o,de.Validated,r,async s=>{await this.validate(s,r),this.markAsCompleted(s)})}markAsCompleted(t){let n=this.buildState.get(t.uri.toString());n&&(n.completed=!0)}prepareBuild(t,n){for(let r of t){let i=r.uri.toString(),o=this.buildState.get(i);(!o||o.completed)&&this.buildState.set(i,{completed:!1,options:n,result:o?.result})}}async runCancelable(t,n,r,i){for(let s of t)s.state<n&&(await Ge(r),await i(s),s.state=n,await this.notifyDocumentPhase(s,n,r));let o=t.filter(s=>s.state===n);await this.notifyBuildPhase(o,n,r),this.currentState=n}onBuildPhase(t,n){return this.buildPhaseListeners.add(t,n),Wo.create(()=>{this.buildPhaseListeners.delete(t,n)})}onDocumentPhase(t,n){return this.documentPhaseListeners.add(t,n),Wo.create(()=>{this.documentPhaseListeners.delete(t,n)})}waitUntil(t,n,r){let i;return n&&"path"in n?i=n:r=n,r??(r=fe.CancellationToken.None),i?this.awaitDocumentState(t,i,r):this.awaitBuilderState(t,r)}awaitDocumentState(t,n,r){let i=this.langiumDocuments.getDocument(n);if(i){if(i.state>=t)return Promise.resolve(n);if(r.isCancellationRequested)return Promise.reject(mi);if(this.currentState>=t&&t>i.state)return Promise.reject(new ju.ResponseError(Km.RequestFailed,`Document state of ${n.toString()} is ${de[i.state]}, requiring ${de[t]}, but workspace state is already ${de[this.currentState]}. Returning undefined.`))}else return Promise.reject(new ju.ResponseError(Km.ServerCancelled,`No document found for URI: ${n.toString()}`));return new Promise((o,s)=>{let a=this.onDocumentPhase(t,c=>{Qe.equals(c.uri,n)&&(a.dispose(),l.dispose(),o(c.uri))}),l=r.onCancellationRequested(()=>{a.dispose(),l.dispose(),s(mi)})})}awaitBuilderState(t,n){return this.currentState>=t?Promise.resolve():n.isCancellationRequested?Promise.reject(mi):new Promise((r,i)=>{let o=this.onBuildPhase(t,()=>{o.dispose(),s.dispose(),r()}),s=n.onCancellationRequested(()=>{o.dispose(),s.dispose(),i(mi)})})}async notifyDocumentPhase(t,n,r){let o=this.documentPhaseListeners.get(n).slice();for(let s of o)try{await Ge(r),await s(t,r)}catch(a){if(!Sr(a))throw a}}async notifyBuildPhase(t,n,r){if(t.length===0)return;let o=this.buildPhaseListeners.get(n).slice();for(let s of o)await Ge(r),await s(t,r)}shouldLink(t){return this.getBuildOptions(t).eagerLinking??!0}shouldValidate(t){return!!this.getBuildOptions(t).validation}async validate(t,n){let r=this.serviceRegistry.getServices(t.uri).validation.DocumentValidator,i=this.getBuildOptions(t),o=typeof i.validation=="object"?{...i.validation}:{};o.categories=this.findMissingValidationCategories(t,i);let s=await r.validateDocument(t,o,n);t.diagnostics?t.diagnostics.push(...s):t.diagnostics=s;let a=this.buildState.get(t.uri.toString());a&&(a.result??(a.result={}),a.result.validationChecks?a.result.validationChecks=ye(a.result.validationChecks).concat(o.categories).distinct().toArray():a.result.validationChecks=[...o.categories])}getBuildOptions(t){return this.buildState.get(t.uri.toString())?.options??{}}};var yf=class{constructor(t){this.symbolIndex=new Map,this.symbolByTypeIndex=new of,this.referenceIndex=new Map,this.documents=t.workspace.LangiumDocuments,this.serviceRegistry=t.ServiceRegistry,this.astReflection=t.AstReflection}findAllReferences(t,n){let r=st(t).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(s=>{Qe.equals(s.targetUri,r)&&s.targetPath===n&&i.push(s)})}),ye(i)}allElements(t,n){let r=ye(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,t)).flat()}getFileDescriptions(t,n){return n?this.symbolByTypeIndex.get(t,n,()=>(this.symbolIndex.get(t)??[]).filter(o=>this.astReflection.isSubtype(o.type,n))):this.symbolIndex.get(t)??[]}remove(t){this.removeContent(t),this.removeReferences(t)}removeContent(t){let n=t.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n)}removeReferences(t){let n=t.toString();this.referenceIndex.delete(n)}async updateContent(t,n=fe.CancellationToken.None){let i=await this.serviceRegistry.getServices(t.uri).references.ScopeComputation.collectExportedSymbols(t,n),o=t.uri.toString();this.symbolIndex.set(o,i),this.symbolByTypeIndex.clear(o)}async updateReferences(t,n=fe.CancellationToken.None){let i=await this.serviceRegistry.getServices(t.uri).workspace.ReferenceDescriptionProvider.createDescriptions(t,n);this.referenceIndex.set(t.uri.toString(),i)}isAffected(t,n){let r=this.referenceIndex.get(t.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}};var xf=class{constructor(t){this.initialBuildOptions={},this._ready=new Rr,this.serviceRegistry=t.ServiceRegistry,this.langiumDocuments=t.workspace.LangiumDocuments,this.documentBuilder=t.workspace.DocumentBuilder,this.fileSystemProvider=t.workspace.FileSystemProvider,this.mutex=t.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(t){this.folders=t.workspaceFolders??void 0}initialized(t){return this.mutex.write(n=>this.initializeWorkspace(this.folders??[],n))}async initializeWorkspace(t,n=fe.CancellationToken.None){let r=await this.performStartup(t);await Ge(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(t){let n=[],r=s=>{n.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};await this.loadAdditionalDocuments(t,r);let i=[];await Promise.all(t.map(s=>this.getRootFolder(s)).map(async s=>this.traverseFolder(s,i)));let o=ye(i).distinct(s=>s.toString()).filter(s=>!this.langiumDocuments.hasDocument(s));return await this.loadWorkspaceDocuments(o,r),this._ready.resolve(),n}async loadWorkspaceDocuments(t,n){await Promise.all(t.map(async r=>{let i=await this.langiumDocuments.getOrCreateDocument(r);n(i)}))}loadAdditionalDocuments(t,n){return Promise.resolve()}getRootFolder(t){return Ce.parse(t.uri)}async traverseFolder(t,n){try{let r=await this.fileSystemProvider.readDirectory(t);await Promise.all(r.map(async i=>{this.shouldIncludeEntry(i)&&(i.isDirectory?await this.traverseFolder(i.uri,n):i.isFile&&n.push(i.uri))}))}catch(r){console.error("Failure to read directory content of "+t.toString(!0),r)}}async searchFolder(t){let n=[];return await this.traverseFolder(t,n),n}shouldIncludeEntry(t){let n=Qe.basename(t.uri);return n.startsWith(".")?!1:t.isDirectory?n!=="node_modules"&&n!=="out":t.isFile?this.serviceRegistry.hasServices(t.uri):!1}};var Ef=class{buildUnexpectedCharactersMessage(t,n,r,i,o){return uo.buildUnexpectedCharactersMessage(t,n,r,i,o)}buildUnableToPopLexerModeMessage(t){return uo.buildUnableToPopLexerModeMessage(t)}},rg={mode:"full"},Xo=class{constructor(t){this.errorMessageProvider=t.parser.LexerErrorMessageProvider,this.tokenBuilder=t.parser.TokenBuilder;let n=this.tokenBuilder.buildTokens(t.Grammar,{caseInsensitive:t.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);let r=o0(n)?Object.values(n):n,i=t.LanguageMetaData.mode==="production";this.chevrotainLexer=new Me(r,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(t,n=rg){let r=this.chevrotainLexer.tokenize(t);return{tokens:r.tokens,errors:r.errors,hidden:r.groups.hidden??[],report:this.tokenBuilder.flushLexingReport?.(t)}}toTokenTypeDictionary(t){if(o0(t))return t;let n=s0(t)?Object.values(t.modes).flat():t,r={};return n.forEach(i=>r[i.name]=i),r}};function ig(e){return Array.isArray(e)&&(e.length===0||"name"in e[0])}function s0(e){return e&&"modes"in e&&"defaultMode"in e}function o0(e){return!ig(e)&&!s0(e)}var a0;(function(e){function t(n){return typeof n=="string"}e.is=t})(a0||(a0={}));var og;(function(e){function t(n){return typeof n=="string"}e.is=t})(og||(og={}));var l0;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(l0||(l0={}));var wf;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(wf||(wf={}));var _e;(function(e){function t(r,i){return r===Number.MAX_VALUE&&(r=wf.MAX_VALUE),i===Number.MAX_VALUE&&(i=wf.MAX_VALUE),{line:r,character:i}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&S.uinteger(i.line)&&S.uinteger(i.character)}e.is=n})(_e||(_e={}));var he;(function(e){function t(r,i,o,s){if(S.uinteger(r)&&S.uinteger(i)&&S.uinteger(o)&&S.uinteger(s))return{start:_e.create(r,i),end:_e.create(o,s)};if(_e.is(r)&&_e.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${o}, ${s}]`)}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&_e.is(i.start)&&_e.is(i.end)}e.is=n})(he||(he={}));var Tf;(function(e){function t(r,i){return{uri:r,range:i}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&he.is(i.range)&&(S.string(i.uri)||S.undefined(i.uri))}e.is=n})(Tf||(Tf={}));var c0;(function(e){function t(r,i,o,s){return{targetUri:r,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&he.is(i.targetRange)&&S.string(i.targetUri)&&he.is(i.targetSelectionRange)&&(he.is(i.originSelectionRange)||S.undefined(i.originSelectionRange))}e.is=n})(c0||(c0={}));var sg;(function(e){function t(r,i,o,s){return{red:r,green:i,blue:o,alpha:s}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&S.numberRange(i.red,0,1)&&S.numberRange(i.green,0,1)&&S.numberRange(i.blue,0,1)&&S.numberRange(i.alpha,0,1)}e.is=n})(sg||(sg={}));var u0;(function(e){function t(r,i){return{range:r,color:i}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&he.is(i.range)&&sg.is(i.color)}e.is=n})(u0||(u0={}));var f0;(function(e){function t(r,i,o){return{label:r,textEdit:i,additionalTextEdits:o}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&S.string(i.label)&&(S.undefined(i.textEdit)||Go.is(i))&&(S.undefined(i.additionalTextEdits)||S.typedArray(i.additionalTextEdits,Go.is))}e.is=n})(f0||(f0={}));var d0;(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(d0||(d0={}));var p0;(function(e){function t(r,i,o,s,a,l){let c={startLine:r,endLine:i};return S.defined(o)&&(c.startCharacter=o),S.defined(s)&&(c.endCharacter=s),S.defined(a)&&(c.kind=a),S.defined(l)&&(c.collapsedText=l),c}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&S.uinteger(i.startLine)&&S.uinteger(i.startLine)&&(S.undefined(i.startCharacter)||S.uinteger(i.startCharacter))&&(S.undefined(i.endCharacter)||S.uinteger(i.endCharacter))&&(S.undefined(i.kind)||S.string(i.kind))}e.is=n})(p0||(p0={}));var ag;(function(e){function t(r,i){return{location:r,message:i}}e.create=t;function n(r){let i=r;return S.defined(i)&&Tf.is(i.location)&&S.string(i.message)}e.is=n})(ag||(ag={}));var h0;(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(h0||(h0={}));var m0;(function(e){e.Unnecessary=1,e.Deprecated=2})(m0||(m0={}));var g0;(function(e){function t(n){let r=n;return S.objectLiteral(r)&&S.string(r.href)}e.is=t})(g0||(g0={}));var vf;(function(e){function t(o,s,a,l,c,u){let f={range:o,message:s};return S.defined(a)&&(f.severity=a),S.defined(l)&&(f.code=l),S.defined(c)&&(f.source=c),S.defined(u)&&(f.relatedInformation=u),f}e.create=t;function n(o){var s;let a=o;return S.defined(a)&&he.is(a.range)&&(S.string(a.message)||yi.is(a.message))&&(S.number(a.severity)||S.undefined(a.severity))&&(S.integer(a.code)||S.string(a.code)||S.undefined(a.code))&&(S.undefined(a.codeDescription)||S.string((s=a.codeDescription)===null||s===void 0?void 0:s.href))&&(S.string(a.source)||S.undefined(a.source))&&(S.undefined(a.relatedInformation)||S.typedArray(a.relatedInformation,ag.is))}e.is=n;function r(o){return S.string(o.message)}e.is3_17=r;function i(o){if(S.string(o.message))return o.message;if(yi.is(o.message))return o.message.value;throw new Error(`Unknown message type ${typeof o.message}`)}e.getMessageString=i})(vf||(vf={}));var Uo;(function(e){function t(r,i,...o){let s={title:r,command:i};return S.defined(o)&&o.length>0&&(s.arguments=o),s}e.create=t;function n(r){let i=r;return S.defined(i)&&S.string(i.title)&&(i.tooltip===void 0||S.string(i.tooltip))&&S.string(i.command)}e.is=n})(Uo||(Uo={}));var Go;(function(e){function t(o,s){return{range:o,newText:s}}e.replace=t;function n(o,s){return{range:{start:o,end:o},newText:s}}e.insert=n;function r(o){return{range:o,newText:""}}e.del=r;function i(o){let s=o;return S.objectLiteral(s)&&S.string(s.newText)&&he.is(s.range)}e.is=i})(Go||(Go={}));var _f;(function(e){function t(r,i,o){let s={label:r};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&S.string(i.label)&&(S.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(S.string(i.description)||i.description===void 0)}e.is=n})(_f||(_f={}));var gi;(function(e){function t(n){let r=n;return S.string(r)}e.is=t})(gi||(gi={}));var y0;(function(e){function t(o,s,a){return{range:o,newText:s,annotationId:a}}e.replace=t;function n(o,s,a){return{range:{start:o,end:o},newText:s,annotationId:a}}e.insert=n;function r(o,s){return{range:o,newText:"",annotationId:s}}e.del=r;function i(o){let s=o;return Go.is(s)&&(_f.is(s.annotationId)||gi.is(s.annotationId))}e.is=i})(y0||(y0={}));var lg;(function(e){function t(r,i){return{textDocument:r,edits:i}}e.create=t;function n(r){let i=r;return S.defined(i)&&pg.is(i.textDocument)&&Array.isArray(i.edits)}e.is=n})(lg||(lg={}));var cg;(function(e){function t(r,i,o){let s={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){let i=r;return i&&i.kind==="create"&&S.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||S.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||S.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||gi.is(i.annotationId))}e.is=n})(cg||(cg={}));var ug;(function(e){function t(r,i,o,s){let a={kind:"rename",oldUri:r,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(a.options=o),s!==void 0&&(a.annotationId=s),a}e.create=t;function n(r){let i=r;return i&&i.kind==="rename"&&S.string(i.oldUri)&&S.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||S.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||S.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||gi.is(i.annotationId))}e.is=n})(ug||(ug={}));var fg;(function(e){function t(r,i,o){let s={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){let i=r;return i&&i.kind==="delete"&&S.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||S.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||S.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||gi.is(i.annotationId))}e.is=n})(fg||(fg={}));var dg;(function(e){function t(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>S.string(i.kind)?cg.is(i)||ug.is(i)||fg.is(i):lg.is(i)))}e.is=t})(dg||(dg={}));var x0;(function(e){function t(n){let r=n;return S.objectLiteral(r)&&he.is(r.range)&&xg.isSnippet(r.snippet)&&(r.annotationId===void 0||_f.is(r.annotationId)||gi.is(r.annotationId))}e.is=t})(x0||(x0={}));var E0;(function(e){function t(r){return{uri:r}}e.create=t;function n(r){let i=r;return S.defined(i)&&S.string(i.uri)}e.is=n})(E0||(E0={}));var w0;(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){let i=r;return S.defined(i)&&S.string(i.uri)&&S.integer(i.version)}e.is=n})(w0||(w0={}));var pg;(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){let i=r;return S.defined(i)&&S.string(i.uri)&&(i.version===null||S.integer(i.version))}e.is=n})(pg||(pg={}));var T0;(function(e){e.ABAP="abap",e.WindowsBat="bat",e.BibTeX="bibtex",e.Clojure="clojure",e.Coffeescript="coffeescript",e.C="c",e.CPP="cpp",e.CSharp="csharp",e.CSS="css",e.D="d",e.Delphi="pascal",e.Diff="diff",e.Dart="dart",e.Dockerfile="dockerfile",e.Elixir="elixir",e.Erlang="erlang",e.FSharp="fsharp",e.GitCommit="git-commit",e.GitRebase="git-rebase",e.Go="go",e.Groovy="groovy",e.Handlebars="handlebars",e.Haskell="haskell",e.HTML="html",e.Ini="ini",e.Java="java",e.JavaScript="javascript",e.JavaScriptReact="javascriptreact",e.JSON="json",e.LaTeX="latex",e.Less="less",e.Lua="lua",e.Makefile="makefile",e.Markdown="markdown",e.ObjectiveC="objective-c",e.ObjectiveCPP="objective-cpp",e.Pascal="pascal",e.Perl="perl",e.Perl6="perl6",e.PHP="php",e.Plaintext="plaintext",e.Powershell="powershell",e.Pug="jade",e.Python="python",e.R="r",e.Razor="razor",e.Ruby="ruby",e.Rust="rust",e.SCSS="scss",e.SASS="sass",e.Scala="scala",e.ShaderLab="shaderlab",e.ShellScript="shellscript",e.SQL="sql",e.Swift="swift",e.TypeScript="typescript",e.TypeScriptReact="typescriptreact",e.TeX="tex",e.VisualBasic="vb",e.XML="xml",e.XSL="xsl",e.YAML="yaml"})(T0||(T0={}));var v0;(function(e){function t(r,i,o,s){return{uri:r,languageId:i,version:o,text:s}}e.create=t;function n(r){let i=r;return S.defined(i)&&S.string(i.uri)&&S.string(i.languageId)&&S.integer(i.version)&&S.string(i.text)}e.is=n})(v0||(v0={}));var hg;(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(n){let r=n;return r===e.PlainText||r===e.Markdown}e.is=t})(hg||(hg={}));var yi;(function(e){function t(n){let r=n;return S.objectLiteral(n)&&hg.is(r.kind)&&S.string(r.value)}e.is=t})(yi||(yi={}));var _0;(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(_0||(_0={}));var A0;(function(e){e.PlainText=1,e.Snippet=2})(A0||(A0={}));var k0;(function(e){e.Deprecated=1})(k0||(k0={}));var I0;(function(e){function t(r,i,o){return{newText:r,insert:i,replace:o}}e.create=t;function n(r){let i=r;return i&&S.string(i.newText)&&he.is(i.insert)&&he.is(i.replace)}e.is=n})(I0||(I0={}));var R0;(function(e){e.asIs=1,e.adjustIndentation=2})(R0||(R0={}));var S0;(function(e){e.Replace=1,e.Merge=2})(S0||(S0={}));var b0;(function(e){function t(n){let r=n;return r&&(S.string(r.detail)||r.detail===void 0)&&(S.string(r.description)||r.description===void 0)}e.is=t})(b0||(b0={}));var N0;(function(e){function t(n){return{label:n}}e.create=t})(N0||(N0={}));var L0;(function(e){function t(n,r){return{items:n||[],isIncomplete:!!r}}e.create=t})(L0||(L0={}));var Af;(function(e){function t(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function n(r){let i=r;return S.string(i)||S.objectLiteral(i)&&S.string(i.language)&&S.string(i.value)}e.is=n})(Af||(Af={}));var P0;(function(e){function t(n){let r=n;return!!r&&S.objectLiteral(r)&&(yi.is(r.contents)||Af.is(r.contents)||S.typedArray(r.contents,Af.is))&&(n.range===void 0||he.is(n.range))}e.is=t})(P0||(P0={}));var O0;(function(e){function t(n,r){return r?{label:n,documentation:r}:{label:n}}e.create=t})(O0||(O0={}));var C0;(function(e){function t(n,r,...i){let o={label:n};return S.defined(r)&&(o.documentation=r),S.defined(i)?o.parameters=i:o.parameters=[],o}e.create=t})(C0||(C0={}));var $0;(function(e){e.Text=1,e.Read=2,e.Write=3})($0||($0={}));var D0;(function(e){function t(n,r){let i={range:n};return S.number(r)&&(i.kind=r),i}e.create=t})(D0||(D0={}));var M0;(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(M0||(M0={}));var F0;(function(e){e.Deprecated=1})(F0||(F0={}));var B0;(function(e){function t(n,r,i,o,s){let a={name:n,kind:r,location:{uri:o,range:i}};return s&&(a.containerName=s),a}e.create=t})(B0||(B0={}));var W0;(function(e){function t(n,r,i,o){return o!==void 0?{name:n,kind:r,location:{uri:i,range:o}}:{name:n,kind:r,location:{uri:i}}}e.create=t})(W0||(W0={}));var X0;(function(e){function t(r,i,o,s,a,l){let c={name:r,detail:i,kind:o,range:s,selectionRange:a};return l!==void 0&&(c.children=l),c}e.create=t;function n(r){let i=r;return i&&S.string(i.name)&&S.number(i.kind)&&he.is(i.range)&&he.is(i.selectionRange)&&(i.detail===void 0||S.string(i.detail))&&(i.deprecated===void 0||S.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}e.is=n})(X0||(X0={}));var U0;(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorMove="refactor.move",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll",e.Notebook="notebook"})(U0||(U0={}));var kf;(function(e){e.Invoked=1,e.Automatic=2})(kf||(kf={}));var G0;(function(e){function t(r,i,o){let s={diagnostics:r};return i!=null&&(s.only=i),o!=null&&(s.triggerKind=o),s}e.create=t;function n(r){let i=r;return S.defined(i)&&S.typedArray(i.diagnostics,vf.is)&&(i.only===void 0||S.typedArray(i.only,S.string))&&(i.triggerKind===void 0||i.triggerKind===kf.Invoked||i.triggerKind===kf.Automatic)}e.is=n})(G0||(G0={}));var mg;(function(e){e.LLMGenerated=1;function t(n){return S.defined(n)&&n===e.LLMGenerated}e.is=t})(mg||(mg={}));var H0;(function(e){function t(r,i,o){let s={title:r},a=!0;return typeof i=="string"?(a=!1,s.kind=i):Uo.is(i)?s.command=i:s.edit=i,a&&o!==void 0&&(s.kind=o),s}e.create=t;function n(r){let i=r;return i&&S.string(i.title)&&(i.diagnostics===void 0||S.typedArray(i.diagnostics,vf.is))&&(i.kind===void 0||S.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Uo.is(i.command))&&(i.isPreferred===void 0||S.boolean(i.isPreferred))&&(i.edit===void 0||dg.is(i.edit))&&(i.tags===void 0||S.typedArray(i.tags,mg.is))}e.is=n})(H0||(H0={}));var z0;(function(e){function t(r,i){let o={range:r};return S.defined(i)&&(o.data=i),o}e.create=t;function n(r){let i=r;return S.defined(i)&&he.is(i.range)&&(S.undefined(i.command)||Uo.is(i.command))}e.is=n})(z0||(z0={}));var j0;(function(e){function t(r,i){return{tabSize:r,insertSpaces:i}}e.create=t;function n(r){let i=r;return S.defined(i)&&S.uinteger(i.tabSize)&&S.boolean(i.insertSpaces)}e.is=n})(j0||(j0={}));var Y0;(function(e){function t(r,i,o){return{range:r,target:i,data:o}}e.create=t;function n(r){let i=r;return S.defined(i)&&he.is(i.range)&&(S.undefined(i.target)||S.string(i.target))}e.is=n})(Y0||(Y0={}));var V0;(function(e){function t(r,i){return{range:r,parent:i}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&he.is(i.range)&&(i.parent===void 0||e.is(i.parent))}e.is=n})(V0||(V0={}));var K0;(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator",e.label="label"})(K0||(K0={}));var q0;(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(q0||(q0={}));var Z0;(function(e){function t(n){let r=n;return S.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}e.is=t})(Z0||(Z0={}));var J0;(function(e){function t(r,i){return{range:r,text:i}}e.create=t;function n(r){let i=r;return i!=null&&he.is(i.range)&&S.string(i.text)}e.is=n})(J0||(J0={}));var Q0;(function(e){function t(r,i,o){return{range:r,variableName:i,caseSensitiveLookup:o}}e.create=t;function n(r){let i=r;return i!=null&&he.is(i.range)&&S.boolean(i.caseSensitiveLookup)&&(S.string(i.variableName)||i.variableName===void 0)}e.is=n})(Q0||(Q0={}));var eA;(function(e){function t(r,i){return{range:r,expression:i}}e.create=t;function n(r){let i=r;return i!=null&&he.is(i.range)&&(S.string(i.expression)||i.expression===void 0)}e.is=n})(eA||(eA={}));var tA;(function(e){function t(r,i){return{frameId:r,stoppedLocation:i}}e.create=t;function n(r){let i=r;return S.defined(i)&&he.is(r.stoppedLocation)}e.is=n})(tA||(tA={}));var gg;(function(e){e.Type=1,e.Parameter=2;function t(n){return n===1||n===2}e.is=t})(gg||(gg={}));var yg;(function(e){function t(r){return{value:r}}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&(i.tooltip===void 0||S.string(i.tooltip)||yi.is(i.tooltip))&&(i.location===void 0||Tf.is(i.location))&&(i.command===void 0||Uo.is(i.command))}e.is=n})(yg||(yg={}));var nA;(function(e){function t(r,i,o){let s={position:r,label:i};return o!==void 0&&(s.kind=o),s}e.create=t;function n(r){let i=r;return S.objectLiteral(i)&&_e.is(i.position)&&(S.string(i.label)||S.typedArray(i.label,yg.is))&&(i.kind===void 0||gg.is(i.kind))&&i.textEdits===void 0||S.typedArray(i.textEdits,Go.is)&&(i.tooltip===void 0||S.string(i.tooltip)||yi.is(i.tooltip))&&(i.paddingLeft===void 0||S.boolean(i.paddingLeft))&&(i.paddingRight===void 0||S.boolean(i.paddingRight))}e.is=n})(nA||(nA={}));var xg;(function(e){function t(r){return{kind:"snippet",value:r}}e.createSnippet=t;function n(r){let i=r;return S.objectLiteral(i)&&i.kind==="snippet"&&S.string(i.value)}e.isSnippet=n})(xg||(xg={}));var rA;(function(e){function t(n,r,i,o){return{insertText:n,filterText:r,range:i,command:o}}e.create=t})(rA||(rA={}));var iA;(function(e){function t(n){return{items:n}}e.create=t})(iA||(iA={}));var oA;(function(e){e.Invoked=1,e.Automatic=2})(oA||(oA={}));var sA;(function(e){function t(n,r){return{range:n,text:r}}e.create=t})(sA||(sA={}));var aA;(function(e){function t(n,r){return{triggerKind:n,selectedCompletionInfo:r}}e.create=t})(aA||(aA={}));var lA;(function(e){function t(n){let r=n;return S.objectLiteral(r)&&og.is(r.uri)&&S.string(r.name)}e.is=t})(lA||(lA={}));var cA;(function(e){function t(o,s,a,l){return new Eg(o,s,a,l)}e.create=t;function n(o){let s=o;return!!(S.defined(s)&&S.string(s.uri)&&(S.undefined(s.languageId)||S.string(s.languageId))&&S.uinteger(s.lineCount)&&S.func(s.getText)&&S.func(s.positionAt)&&S.func(s.offsetAt))}e.is=n;function r(o,s){let a=o.getText(),l=i(s,(u,f)=>{let d=u.range.start.line-f.range.start.line;return d===0?u.range.start.character-f.range.start.character:d}),c=a.length;for(let u=l.length-1;u>=0;u--){let f=l[u],d=o.offsetAt(f.range.start),p=o.offsetAt(f.range.end);if(p<=c)a=a.substring(0,d)+f.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}e.applyEdits=r;function i(o,s){if(o.length<=1)return o;let a=o.length/2|0,l=o.slice(0,a),c=o.slice(a);i(l,s),i(c,s);let u=0,f=0,d=0;for(;u<l.length&&f<c.length;)s(l[u],c[f])<=0?o[d++]=l[u++]:o[d++]=c[f++];for(;u<l.length;)o[d++]=l[u++];for(;f<c.length;)o[d++]=c[f++];return o}})(cA||(cA={}));var Eg=class{constructor(t,n,r,i){this._uri=t,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){this._content=t.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let t=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(t.push(i),r=!1);let o=n.charAt(i);r=o==="\r"||o===`
119
119
  `,o==="\r"&&i+1<n.length&&n.charAt(i+1)===`
120
- `&&i++}r&&n.length>0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return ve.create(0,t);for(;r<i;){let s=Math.floor((r+i)/2);n[s]>t?i=s:r=s+1}let o=r-1;return ve.create(o,t-n[o])}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line],i=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,i),r)}get lineCount(){return this.getLineOffsets().length}},N;(function(e){let t=Object.prototype.toString;function n(p){return typeof p<"u"}e.defined=n;function r(p){return typeof p>"u"}e.undefined=r;function i(p){return p===!0||p===!1}e.boolean=i;function o(p){return t.call(p)==="[object String]"}e.string=o;function s(p){return t.call(p)==="[object Number]"}e.number=s;function a(p,m,g){return t.call(p)==="[object Number]"&&m<=p&&p<=g}e.numberRange=a;function l(p){return t.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}e.integer=l;function c(p){return t.call(p)==="[object Number]"&&0<=p&&p<=2147483647}e.uinteger=c;function u(p){return t.call(p)==="[object Function]"}e.func=u;function f(p){return p!==null&&typeof p=="object"}e.objectLiteral=f;function d(p,m){return Array.isArray(p)&&p.every(m)}e.typedArray=d})(N||(N={}));function uA(e,t,n){let r,i;typeof e=="string"?(i=t,r=n):(i=e.range.start,r=t),i||(i=ve.create(0,0));let o=dA(e),s=wg(r),a=WM({lines:o,position:i,options:s});return zM({index:0,tokens:a,position:i})}function fA(e,t){let n=wg(t),r=dA(e);if(r.length===0)return!1;let i=r[0],o=r[r.length-1],s=n.start,a=n.end;return!!s?.exec(i)&&!!a?.exec(o)}function dA(e){let t="";return typeof e=="string"?t=e:t=e.text,t.split(tw)}var lA=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,BM=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function WM(e){let t=[],n=e.position.line,r=e.position.character;for(let i=0;i<e.lines.length;i++){let o=i===0,s=i===e.lines.length-1,a=e.lines[i],l=0;if(o&&e.options.start){let u=e.options.start?.exec(a);u&&(l=u.index+u[0].length)}else{let u=e.options.line?.exec(a);u&&(l=u.index+u[0].length)}if(s){let u=e.options.end?.exec(a);u&&(a=a.substring(0,u.index))}if(a=a.substring(0,HM(a)),Eg(a,l)>=a.length){if(t.length>0){let u=ve.create(n,r);t.push({type:"break",content:"",range:he.create(u,u)})}}else{lA.lastIndex=l;let u=lA.exec(a);if(u){let f=u[0],d=u[1],p=ve.create(n,r+l),m=ve.create(n,r+l+f.length);t.push({type:"tag",content:d,range:he.create(p,m)}),l+=f.length,l=Eg(a,l)}if(l<a.length){let f=a.substring(l),d=Array.from(f.matchAll(BM));t.push(...XM(d,f,n,r+l))}}n++,r=0}return t.length>0&&t[t.length-1].type==="break"?t.slice(0,-1):t}function XM(e,t,n,r){let i=[];if(e.length===0){let o=ve.create(n,r),s=ve.create(n,r+t.length);i.push({type:"text",content:t,range:he.create(o,s)})}else{let o=0;for(let a of e){let l=a.index,c=t.substring(o,l);c.length>0&&i.push({type:"text",content:t.substring(o,l),range:he.create(ve.create(n,o+r),ve.create(n,l+r))});let u=c.length+1,f=a[1];if(i.push({type:"inline-tag",content:f,range:he.create(ve.create(n,o+u+r),ve.create(n,o+u+f.length+r))}),u+=f.length,a.length===4){u+=a[2].length;let d=a[3];i.push({type:"text",content:d,range:he.create(ve.create(n,o+u+r),ve.create(n,o+u+d.length+r))})}else i.push({type:"text",content:"",range:he.create(ve.create(n,o+u+r),ve.create(n,o+u+r))});o=l+a[0].length}let s=t.substring(o);s.length>0&&i.push({type:"text",content:s,range:he.create(ve.create(n,o+r),ve.create(n,o+r+s.length))})}return i}var UM=/\S/,GM=/\s*$/;function Eg(e,t){let n=e.substring(t).match(UM);return n?t+n.index:e.length}function HM(e){let t=e.match(GM);if(t&&typeof t.index=="number")return t.index}function zM(e){let t=ve.create(e.position.line,e.position.character);if(e.tokens.length===0)return new Af([],he.create(t,t));let n=[];for(;e.index<e.tokens.length;){let o=jM(e,n[n.length-1]);o&&n.push(o)}let r=n[0]?.range.start??t,i=n[n.length-1]?.range.end??t;return new Af(n,he.create(r,i))}function jM(e,t){let n=e.tokens[e.index];if(n.type==="tag")return hA(e,!1);if(n.type==="text"||n.type==="inline-tag")return pA(e);YM(n,t),e.index++}function YM(e,t){if(t){let n=new kf("",e.range);"inlines"in t?t.inlines.push(n):t.content.inlines.push(n)}}function pA(e){let t=e.tokens[e.index],n=t,r=t,i=[];for(;t&&t.type!=="break"&&t.type!=="tag";)i.push(VM(e)),r=t,t=e.tokens[e.index];return new Da(i,he.create(n.range.start,r.range.end))}function VM(e){return e.tokens[e.index].type==="inline-tag"?hA(e,!0):mA(e)}function hA(e,t){let n=e.tokens[e.index++],r=n.content.substring(1);if(e.tokens[e.index]?.type==="text")if(t){let o=mA(e);return new $a(r,new Da([o],o.range),t,he.create(n.range.start,o.range.end))}else{let o=pA(e);return new $a(r,o,t,he.create(n.range.start,o.range.end))}else{let o=n.range;return new $a(r,new Da([],o),t,o)}}function mA(e){let t=e.tokens[e.index++];return new kf(t.content,t.range)}function wg(e){if(!e)return wg({start:"/**",end:"*/",line:"*"});let{start:t,end:n,line:r}=e;return{start:xg(t,!0),end:xg(n,!1),line:xg(r,!0)}}function xg(e,t){if(typeof e=="string"||typeof e=="object"){let n=typeof e=="string"?ei(e):e.source;return t?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return e}var Af=class{constructor(t,n){this.elements=t,this.range=n}getTag(t){return this.getAllTags().find(n=>n.name===t)}getTags(t){return this.getAllTags().filter(n=>n.name===t)}getAllTags(){return this.elements.filter(t=>"name"in t)}toString(){let t="";for(let n of this.elements)if(t.length===0)t=n.toString();else{let r=n.toString();t+=cA(t)+r}return t.trim()}toMarkdown(t){let n="";for(let r of this.elements)if(n.length===0)n=r.toMarkdown(t);else{let i=r.toMarkdown(t);n+=cA(n)+i}return n.trim()}},$a=class{constructor(t,n,r,i){this.name=t,this.content=n,this.inline=r,this.range=i}toString(){let t=`@${this.name}`,n=this.content.toString();return this.content.inlines.length===1?t=`${t} ${n}`:this.content.inlines.length>1&&(t=`${t}
121
- ${n}`),this.inline?`{${t}}`:t}toMarkdown(t){return t?.renderTag?.(this)??this.toMarkdownDefault(t)}toMarkdownDefault(t){let n=this.content.toMarkdown(t);if(this.inline){let o=KM(this.name,n,t??{});if(typeof o=="string")return o}let r="";t?.tag==="italic"||t?.tag===void 0?r="*":t?.tag==="bold"?r="**":t?.tag==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} \u2014 ${n}`:this.content.inlines.length>1&&(i=`${i}
122
- ${n}`),this.inline?`{${i}}`:i}};function KM(e,t,n){if(e==="linkplain"||e==="linkcode"||e==="link"){let r=t.indexOf(" "),i=t;if(r>0){let s=Eg(t,r);i=t.substring(s),t=t.substring(0,r)}return(e==="linkcode"||e==="link"&&n.link==="code")&&(i=`\`${i}\``),n.renderLink?.(t,i)??qM(t,i)}}function qM(e,t){try{return Ce.parse(e,!0),`[${t}](${e})`}catch{return e}}var Da=class{constructor(t,n){this.inlines=t,this.range=n}toString(){let t="";for(let n=0;n<this.inlines.length;n++){let r=this.inlines[n],i=this.inlines[n+1];t+=r.toString(),i&&i.range.start.line>r.range.start.line&&(t+=`
120
+ `&&i++}r&&n.length>0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return _e.create(0,t);for(;r<i;){let s=Math.floor((r+i)/2);n[s]>t?i=s:r=s+1}let o=r-1;return _e.create(o,t-n[o])}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line],i=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,i),r)}get lineCount(){return this.getLineOffsets().length}},S;(function(e){let t=Object.prototype.toString;function n(p){return typeof p<"u"}e.defined=n;function r(p){return typeof p>"u"}e.undefined=r;function i(p){return p===!0||p===!1}e.boolean=i;function o(p){return t.call(p)==="[object String]"}e.string=o;function s(p){return t.call(p)==="[object Number]"}e.number=s;function a(p,m,g){return t.call(p)==="[object Number]"&&m<=p&&p<=g}e.numberRange=a;function l(p){return t.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}e.integer=l;function c(p){return t.call(p)==="[object Number]"&&0<=p&&p<=2147483647}e.uinteger=c;function u(p){return t.call(p)==="[object Function]"}e.func=u;function f(p){return p!==null&&typeof p=="object"}e.objectLiteral=f;function d(p,m){return Array.isArray(p)&&p.every(m)}e.typedArray=d})(S||(S={}));function dA(e,t,n){let r,i;typeof e=="string"?(i=t,r=n):(i=e.range.start,r=t),i||(i=_e.create(0,0));let o=hA(e),s=vg(r),a=UM({lines:o,position:i,options:s});return YM({index:0,tokens:a,position:i})}function pA(e,t){let n=vg(t),r=hA(e);if(r.length===0)return!1;let i=r[0],o=r[r.length-1],s=n.start,a=n.end;return!!s?.exec(i)&&!!a?.exec(o)}function hA(e){let t="";return typeof e=="string"?t=e:t=e.text,t.split(rw)}var uA=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,XM=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function UM(e){let t=[],n=e.position.line,r=e.position.character;for(let i=0;i<e.lines.length;i++){let o=i===0,s=i===e.lines.length-1,a=e.lines[i],l=0;if(o&&e.options.start){let u=e.options.start?.exec(a);u&&(l=u.index+u[0].length)}else{let u=e.options.line?.exec(a);u&&(l=u.index+u[0].length)}if(s){let u=e.options.end?.exec(a);u&&(a=a.substring(0,u.index))}if(a=a.substring(0,jM(a)),Tg(a,l)>=a.length){if(t.length>0){let u=_e.create(n,r);t.push({type:"break",content:"",range:he.create(u,u)})}}else{uA.lastIndex=l;let u=uA.exec(a);if(u){let f=u[0],d=u[1],p=_e.create(n,r+l),m=_e.create(n,r+l+f.length);t.push({type:"tag",content:d,range:he.create(p,m)}),l+=f.length,l=Tg(a,l)}if(l<a.length){let f=a.substring(l),d=Array.from(f.matchAll(XM));t.push(...GM(d,f,n,r+l))}}n++,r=0}return t.length>0&&t[t.length-1].type==="break"?t.slice(0,-1):t}function GM(e,t,n,r){let i=[];if(e.length===0){let o=_e.create(n,r),s=_e.create(n,r+t.length);i.push({type:"text",content:t,range:he.create(o,s)})}else{let o=0;for(let a of e){let l=a.index,c=t.substring(o,l);c.length>0&&i.push({type:"text",content:t.substring(o,l),range:he.create(_e.create(n,o+r),_e.create(n,l+r))});let u=c.length+1,f=a[1];if(i.push({type:"inline-tag",content:f,range:he.create(_e.create(n,o+u+r),_e.create(n,o+u+f.length+r))}),u+=f.length,a.length===4){u+=a[2].length;let d=a[3];i.push({type:"text",content:d,range:he.create(_e.create(n,o+u+r),_e.create(n,o+u+d.length+r))})}else i.push({type:"text",content:"",range:he.create(_e.create(n,o+u+r),_e.create(n,o+u+r))});o=l+a[0].length}let s=t.substring(o);s.length>0&&i.push({type:"text",content:s,range:he.create(_e.create(n,o+r),_e.create(n,o+r+s.length))})}return i}var HM=/\S/,zM=/\s*$/;function Tg(e,t){let n=e.substring(t).match(HM);return n?t+n.index:e.length}function jM(e){let t=e.match(zM);if(t&&typeof t.index=="number")return t.index}function YM(e){let t=_e.create(e.position.line,e.position.character);if(e.tokens.length===0)return new If([],he.create(t,t));let n=[];for(;e.index<e.tokens.length;){let o=VM(e,n[n.length-1]);o&&n.push(o)}let r=n[0]?.range.start??t,i=n[n.length-1]?.range.end??t;return new If(n,he.create(r,i))}function VM(e,t){let n=e.tokens[e.index];if(n.type==="tag")return gA(e,!1);if(n.type==="text"||n.type==="inline-tag")return mA(e);KM(n,t),e.index++}function KM(e,t){if(t){let n=new Rf("",e.range);"inlines"in t?t.inlines.push(n):t.content.inlines.push(n)}}function mA(e){let t=e.tokens[e.index],n=t,r=t,i=[];for(;t&&t.type!=="break"&&t.type!=="tag";)i.push(qM(e)),r=t,t=e.tokens[e.index];return new Ma(i,he.create(n.range.start,r.range.end))}function qM(e){return e.tokens[e.index].type==="inline-tag"?gA(e,!0):yA(e)}function gA(e,t){let n=e.tokens[e.index++],r=n.content.substring(1);if(e.tokens[e.index]?.type==="text")if(t){let o=yA(e);return new Da(r,new Ma([o],o.range),t,he.create(n.range.start,o.range.end))}else{let o=mA(e);return new Da(r,o,t,he.create(n.range.start,o.range.end))}else{let o=n.range;return new Da(r,new Ma([],o),t,o)}}function yA(e){let t=e.tokens[e.index++];return new Rf(t.content,t.range)}function vg(e){if(!e)return vg({start:"/**",end:"*/",line:"*"});let{start:t,end:n,line:r}=e;return{start:wg(t,!0),end:wg(n,!1),line:wg(r,!0)}}function wg(e,t){if(typeof e=="string"||typeof e=="object"){let n=typeof e=="string"?ei(e):e.source;return t?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return e}var If=class{constructor(t,n){this.elements=t,this.range=n}getTag(t){return this.getAllTags().find(n=>n.name===t)}getTags(t){return this.getAllTags().filter(n=>n.name===t)}getAllTags(){return this.elements.filter(t=>"name"in t)}toString(){let t="";for(let n of this.elements)if(t.length===0)t=n.toString();else{let r=n.toString();t+=fA(t)+r}return t.trim()}toMarkdown(t){let n="";for(let r of this.elements)if(n.length===0)n=r.toMarkdown(t);else{let i=r.toMarkdown(t);n+=fA(n)+i}return n.trim()}},Da=class{constructor(t,n,r,i){this.name=t,this.content=n,this.inline=r,this.range=i}toString(){let t=`@${this.name}`,n=this.content.toString();return this.content.inlines.length===1?t=`${t} ${n}`:this.content.inlines.length>1&&(t=`${t}
121
+ ${n}`),this.inline?`{${t}}`:t}toMarkdown(t){return t?.renderTag?.(this)??this.toMarkdownDefault(t)}toMarkdownDefault(t){let n=this.content.toMarkdown(t);if(this.inline){let o=ZM(this.name,n,t??{});if(typeof o=="string")return o}let r="";t?.tag==="italic"||t?.tag===void 0?r="*":t?.tag==="bold"?r="**":t?.tag==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} \u2014 ${n}`:this.content.inlines.length>1&&(i=`${i}
122
+ ${n}`),this.inline?`{${i}}`:i}};function ZM(e,t,n){if(e==="linkplain"||e==="linkcode"||e==="link"){let r=t.indexOf(" "),i=t;if(r>0){let s=Tg(t,r);i=t.substring(s),t=t.substring(0,r)}return(e==="linkcode"||e==="link"&&n.link==="code")&&(i=`\`${i}\``),n.renderLink?.(t,i)??JM(t,i)}}function JM(e,t){try{return Ce.parse(e,!0),`[${t}](${e})`}catch{return e}}var Ma=class{constructor(t,n){this.inlines=t,this.range=n}toString(){let t="";for(let n=0;n<this.inlines.length;n++){let r=this.inlines[n],i=this.inlines[n+1];t+=r.toString(),i&&i.range.start.line>r.range.start.line&&(t+=`
123
123
  `)}return t}toMarkdown(t){let n="";for(let r=0;r<this.inlines.length;r++){let i=this.inlines[r],o=this.inlines[r+1];n+=i.toMarkdown(t),o&&o.range.start.line>i.range.start.line&&(n+=`
124
- `)}return n}},kf=class{constructor(t,n){this.text=t,this.range=n}toString(){return this.text}toMarkdown(){return this.text}};function cA(e){return e.endsWith(`
124
+ `)}return n}},Rf=class{constructor(t,n){this.text=t,this.range=n}toString(){return this.text}toMarkdown(){return this.text}};function fA(e){return e.endsWith(`
125
125
  `)?`
126
126
  `:`
127
127
 
128
- `}var If=class{constructor(t){this.indexManager=t.shared.workspace.IndexManager,this.commentProvider=t.documentation.CommentProvider}getDocumentation(t){let n=this.commentProvider.getComment(t);if(n&&fA(n))return uA(n).toMarkdown({renderLink:(i,o)=>this.documentationLinkRenderer(t,i,o),renderTag:i=>this.documentationTagRenderer(t,i)})}documentationLinkRenderer(t,n,r){let i=this.findNameInLocalSymbols(t,n)??this.findNameInGlobalScope(t,n);if(i&&i.nameSegment){let o=i.nameSegment.range.start.line+1,s=i.nameSegment.range.start.character+1,a=i.documentUri.with({fragment:`L${o},${s}`});return`[${r}](${a.toString()})`}else return}documentationTagRenderer(t,n){}findNameInLocalSymbols(t,n){let i=st(t).localSymbols;if(!i)return;let o=t;do{let a=i.getStream(o).find(l=>l.name===n);if(a)return a;o=o.$container}while(o)}findNameInGlobalScope(t,n){return this.indexManager.allElements().find(i=>i.name===n)}};var Rf=class{constructor(t){this.grammarConfig=()=>t.parser.GrammarConfig}getComment(t){return n0(t)?t.$comment:ew(t.$cstNode,this.grammarConfig().multilineCommentRules)?.text}};var Sf=class{constructor(t){this.syncParser=t.parser.LangiumParser}parse(t,n){return Promise.resolve(this.syncParser.parse(t))}};var bf;(function(e){e[e.Normal=0]="Normal",e[e.Immediate=1]="Immediate"})(bf||(bf={}));var Nf=class{constructor(){this.previousTokenSource=new fe.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.immediateReads=[],this.done=!0}write(t){this.cancelWrite();let n=q_();return this.previousTokenSource=n,this.enqueue(this.writeQueue,t,n.token)}read(t,n=bf.Normal){if(n===bf.Immediate){let r=Promise.resolve().then(()=>t());this.immediateReads.push(r);let i=()=>{this.immediateReads.splice(this.immediateReads.indexOf(r),1)};return r.then(i,i),r}return this.enqueue(this.readQueue,t)}enqueue(t,n,r=fe.CancellationToken.None){let i=new Rr,o={action:n,deferred:i,cancellationToken:r};return t.push(o),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;let t=[];if(this.writeQueue.length>0)for(t.push(this.writeQueue.shift()),this.done=!1;this.immediateReads.length>0;)await Promise.allSettled(this.immediateReads.slice());else if(this.readQueue.length>0)t.push(...this.readQueue.splice(0,this.readQueue.length)),this.done=!1;else return;await Promise.all(t.map(async({action:n,deferred:r,cancellationToken:i})=>{try{let o=await Promise.resolve().then(()=>n(i));r.resolve(o)}catch(o){Sr(o)?r.resolve(void 0):r.reject(o)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}};var Lf=class{constructor(t){this.grammarElementIdMap=new Oa,this.tokenTypeIdMap=new Oa,this.cstNodeBuilder=new Po,this.grammar=t.Grammar,this.lexer=t.parser.Lexer,this.linker=t.references.Linker}dehydrate(t){return{lexerErrors:t.lexerErrors,lexerReport:t.lexerReport?this.dehydrateLexerReport(t.lexerReport):void 0,parserErrors:t.parserErrors.map(n=>({...n,message:n.message})),value:this.dehydrateAstNode(t.value,this.createDehyrationContext(t.value))}}dehydrateLexerReport(t){return t}createDehyrationContext(t){let n=new Map,r=new Map;for(let i of xt(t))n.set(i,{});if(t.$cstNode)for(let i of qs(t.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(t,n){let r=n.astNodes.get(t);r.$type=t.$type,r.$containerIndex=t.$containerIndex,r.$containerProperty=t.$containerProperty,t.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(t.$cstNode,n));for(let[i,o]of Object.entries(t))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];r[i]=s;for(let a of o)Ue(a)?s.push(this.dehydrateAstNode(a,n)):it(a)?s.push(this.dehydrateReference(a,n)):s.push(a)}else Ue(o)?r[i]=this.dehydrateAstNode(o,n):it(o)?r[i]=this.dehydrateReference(o,n):o!==void 0&&(r[i]=o);return r}dehydrateReference(t,n){let r={};return r.$refText=t.$refText,t.$refNode&&(r.$refNode=n.cstNodes.get(t.$refNode)),r}dehydrateCstNode(t,n){let r=n.cstNodes.get(t);if(nc(t)?r.fullText=t.fullText:r.grammarSource=this.getGrammarElementId(t.grammarSource),r.hidden=t.hidden,nr(t))r.content=t.content.map(i=>this.dehydrateCstNode(i,n));else if(tc(t)){r.tokenType=t.tokenType.name,r.offset=t.offset,r.length=t.length;let{start:i,end:o}=t.range;r.startLine=i.line,r.startColumn=i.character,r.endLine=o.line,r.endColumn=o.character}return r}hydrate(t){let n=t.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:t.lexerErrors,lexerReport:t.lexerReport,parserErrors:t.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(t){let n=new Map,r=new Map;for(let i of xt(t))n.set(i,{});if(t.$cstNode)for(let i of qs(t.$cstNode)){let o;"fullText"in i?o=new Na(i.fullText):"content"in i?o=new Oo:"tokenType"in i&&(o=this.hydrateCstLeafNode(i)),o&&r.set(i,o)}return{astNodes:n,cstNodes:r,linkedCstNodes:new Set}}hydrateAstNode(t,n){let r=n.astNodes.get(t);if(r.$type=t.$type,r.$containerIndex=t.$containerIndex,r.$containerProperty=t.$containerProperty,t.$cstNode){let i=n.cstNodes.get(t.$cstNode);r.$cstNode=i,i&&!n.linkedCstNodes.has(i)&&(n.linkedCstNodes.add(i),i.astNode=r)}for(let[i,o]of Object.entries(t))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];r[i]=s;for(let a of o)Ue(a)?s.push(this.setParent(this.hydrateAstNode(a,n),r)):it(a)?s.push(this.hydrateReference(a,r,i,n)):s.push(a)}else Ue(o)?r[i]=this.setParent(this.hydrateAstNode(o,n),r):it(o)?r[i]=this.hydrateReference(o,r,i,n):o!==void 0&&(r[i]=o);return r}setParent(t,n){return t.$container=n,t}hydrateReference(t,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(t.$refNode),t.$refText)}hydrateCstNode(t,n,r=0){let i=n.cstNodes.get(t);if(typeof t.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(t.grammarSource)),nr(i)){let o=[];for(let s of t.content)o.push(this.hydrateCstNode(s,n,r++));this.cstNodeBuilder.appendChildren(i,o)}return i}hydrateCstLeafNode(t){let n=this.getTokenType(t.tokenType);return new ba(t.offset,t.length,t.startLine,t.startColumn,t.endLine,t.endColumn,n,t.hidden)}getTokenType(t){return this.lexer.definition[t]}getGrammarElementId(t){if(t)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(t)}getGrammarElement(t){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(t)}createGrammarElementIdMap(){let t=0;for(let n of xt(this.grammar))xc(n)&&this.grammarElementIdMap.set(n,t++)}};function Pf(e){return{documentation:{CommentProvider:t=>new Rf(t),DocumentationProvider:t=>new If(t)},parser:{AsyncParser:t=>new Sf(t),GrammarConfig:t=>fw(t),LangiumParser:t=>G_(t),CompletionParser:t=>U_(t),ValueConverter:()=>new $o,TokenBuilder:()=>new Co,Lexer:t=>new Wo(t),ParserErrorMessageProvider:()=>new La,LexerErrorMessageProvider:()=>new yf},workspace:{AstNodeLocator:()=>new df,AstNodeDescriptionProvider:t=>new uf(t),ReferenceDescriptionProvider:t=>new ff(t)},references:{Linker:t=>new qu(t),NameProvider:()=>new Zu,ScopeProvider:t=>new of(t),ScopeComputation:t=>new Qu(t),References:t=>new Ju(t)},serializer:{Hydrator:t=>new Lf(t),JsonSerializer:t=>new sf(t)},validation:{DocumentValidator:t=>new cf(t),ValidationRegistry:t=>new lf(t)},shared:()=>e.shared}}function Of(e){return{ServiceRegistry:t=>new af(t),workspace:{LangiumDocuments:t=>new Ku(t),LangiumDocumentFactory:t=>new Vu(t),DocumentBuilder:t=>new hf(t),IndexManager:t=>new mf(t),WorkspaceManager:t=>new gf(t),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new Nf,ConfigurationProvider:t=>new pf(t)},profilers:{}}}var gA;(function(e){e.merge=(t,n)=>Ma(Ma({},t),n)})(gA||(gA={}));function Go(e,t,n,r,i,o,s,a,l){let c=[e,t,n,r,i,o,s,a,l].reduce(Ma,{});return EA(c)}var ZM=Symbol("isProxy");function EA(e,t){let n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===ZM?!0:xA(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(xA(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return n}var yA=Symbol();function xA(e,t,n,r){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: "+e[t]);if(e[t]===yA)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return e[t]}else if(t in n){let i=n[t];e[t]=yA;try{e[t]=typeof i=="function"?i(r):EA(i,r)}catch(o){throw e[t]=o instanceof Error?o:void 0,o}return e[t]}else return}function Ma(e,t){if(t){for(let[n,r]of Object.entries(t))if(!(n==="__proto__"||n==="constructor"||n==="prototype")&&r!=null)if(typeof r=="object"){let i=e[n];typeof i=="object"&&i!==null?e[n]=Ma(i,r):e[n]=Ma({},r)}else e[n]=r}return e}var wA={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]},Ho;(function(e){e.REGULAR="indentation-sensitive",e.IGNORE_INDENTATION="ignore-indentation"})(Ho||(Ho={}));var Fa=class extends Co{constructor(t=wA){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options={...wA,...t},this.indentTokenType=cr({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=cr({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(t,n){let r=super.buildTokens(t,n);if(!ng(r))throw new Error("Invalid tokens built by default builder");let{indentTokenName:i,dedentTokenName:o,whitespaceTokenName:s,ignoreIndentationDelimiters:a}=this.options,l,c,u,f=[];for(let d of r){for(let[p,m]of a)d.name===p?d.PUSH_MODE=Ho.IGNORE_INDENTATION:d.name===m&&(d.POP_MODE=!0);d.name===o?l=d:d.name===i?c=d:d.name===s?u=d:f.push(d)}if(!l||!c||!u)throw new Error("Some indentation/whitespace tokens not found!");return a.length>0?{modes:{[Ho.REGULAR]:[l,c,...f,u],[Ho.IGNORE_INDENTATION]:[...f,u]},defaultMode:Ho.REGULAR}:[l,c,u,...f]}flushLexingReport(t){return{...super.flushLexingReport(t),remainingDedents:this.flushRemainingDedents(t)}}isStartOfLine(t,n){return n===0||`\r
129
- `.includes(t[n-1])}matchWhitespace(t,n,r,i){this.whitespaceRegExp.lastIndex=n;let o=this.whitespaceRegExp.exec(t);return{currIndentLevel:o?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:o}}createIndentationTokenInstance(t,n,r,i){let o=this.getLineNumber(n,i);return Sn(t,r,i,i+r.length,o,o,1,r.length)}getLineNumber(t,n){return t.substring(0,n).split(/\r\n|\r|\n/).length}indentMatcher(t,n,r,i){if(!this.isStartOfLine(t,n))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(t,n,r,i);return o<=s?null:(this.indentationStack.push(o),a)}dedentMatcher(t,n,r,i){if(!this.isStartOfLine(t,n))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(t,n,r,i);if(o>=s)return null;let l=this.indentationStack.lastIndexOf(o);if(l===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${o} at offset: ${n}. Current indentation stack: ${this.indentationStack}`,offset:n,length:a?.[0]?.length??0,line:this.getLineNumber(t,n),column:1}),null;let c=this.indentationStack.length-l-1,u=t.substring(0,n).match(/[\r\n]+$/)?.[0].length??1;for(let f=0;f<c;f++){let d=this.createIndentationTokenInstance(this.dedentTokenType,t,"",n-(u-1));r.push(d),this.indentationStack.pop()}return null}buildTerminalToken(t){let n=super.buildTerminalToken(t),{indentTokenName:r,dedentTokenName:i,whitespaceTokenName:o}=this.options;return n.name===r?this.indentTokenType:n.name===i?this.dedentTokenType:n.name===o?cr({name:o,pattern:this.whitespaceRegExp,group:Me.SKIPPED}):n}flushRemainingDedents(t){let n=[];for(;this.indentationStack.length>1;)n.push(this.createIndentationTokenInstance(this.dedentTokenType,t,"",t.length)),this.indentationStack.pop();return this.indentationStack=[0],n}},Cf=class extends Wo{constructor(t){if(super(t),t.parser.TokenBuilder instanceof Fa)this.indentationTokenBuilder=t.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(t,n=tg){let r=super.tokenize(t),i=r.report;n?.mode==="full"&&r.tokens.push(...i.remainingDedents),i.remainingDedents=[];let{indentTokenType:o,dedentTokenType:s}=this.indentationTokenBuilder,a=o.tokenTypeIdx,l=s.tokenTypeIdx,c=[],u=r.tokens.length-1;for(let f=0;f<u;f++){let d=r.tokens[f],p=r.tokens[f+1];if(d.tokenTypeIdx===a&&p.tokenTypeIdx===l){f++;continue}c.push(d)}return u>=0&&c.push(r.tokens[u]),r.tokens=c,r}};var Tg=class{stat(t){throw new Error("No file system is available.")}statSync(t){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}},$f={fileSystemProvider:()=>new Tg};var JM={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},QM={AstReflection:()=>new Ks};function eF(){let e=Go(Of($f),QM),t=Go(Pf({shared:e}),JM);return e.ServiceRegistry.register(t),t}function TA(e){let t=eF(),n=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,Ce.parse(`memory:/${n.name??"grammar"}.langium`)),n}var zo={$type:"AnchorDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function os(e){return We.isInstance(e,zo.$type)}var vg={$type:"BlockProperty",key:"key",value:"value"};var Rg={$type:"CalendarBlock",properties:"properties"};function za(e){return We.isInstance(e,Rg.$type)}var Dn={$type:"ConfigEntry"};function _A(e){return We.isInstance(e,Dn.$type)}var Wf={$type:"DefaultDeclaration",entityType:"entityType",properties:"properties"};function nt(e){return We.isInstance(e,Wf.$type)}var Sg={$type:"DescriptionDirective",text:"text"};function ja(e){return We.isInstance(e,Sg.$type)}var Df={$type:"EntityProperty",key:"key",value:"value",values:"values"};var jo={$type:"FootnoteDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ng(e){return We.isInstance(e,jo.$type)}var Yo={$type:"GroupBlock",content:"content",name:"name",properties:"properties",title:"title"};function $e(e){return We.isInstance(e,Yo.$type)}var Ba={$type:"GroupContent"};var _g={$type:"IncludeDeclaration",options:"options",path:"path"};var Ag={$type:"IncludeOption",key:"key",value:"value"};var Vo={$type:"ItemDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ve(e){return We.isInstance(e,Vo.$type)}var Ko={$type:"LabelDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ya(e){return We.isInstance(e,Ko.$type)}var qo={$type:"MilestoneDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function xn(e){return We.isInstance(e,qo.$type)}var Xa={$type:"NonWorkingDeclaration",name:"name",properties:"properties",title:"title"};function Nr(e){return We.isInstance(e,Xa.$type)}var kg={$type:"NowlineDirective",properties:"properties",version:"version"};var br={$type:"NowlineFile",configEntries:"configEntries",directive:"directive",hasConfig:"hasConfig",includes:"includes",roadmapDecl:"roadmapDecl",roadmapEntries:"roadmapEntries"};function ss(e){return We.isInstance(e,br.$type)}var Zo={$type:"ParallelBlock",content:"content",name:"name",properties:"properties",title:"title"};function et(e){return We.isInstance(e,Zo.$type)}var Mf={$type:"ParallelContent"};var Jo={$type:"PersonDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Va(e){return We.isInstance(e,Jo.$type)}var vA={$type:"PersonMemberRef",ref:"ref"};var Ff={$type:"RoadmapDeclaration",name:"name",properties:"properties",title:"title"};var en={$type:"RoadmapEntry"};var bg={$type:"ScaleBlock",properties:"properties"};function AA(e){return We.isInstance(e,bg.$type)}var Qo={$type:"SizeDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function xi(e){return We.isInstance(e,Qo.$type)}var es={$type:"StatusDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ka(e){return We.isInstance(e,es.$type)}var Ua={$type:"StyleDeclaration",name:"name",properties:"properties",title:"title"};function Wt(e){return We.isInstance(e,Ua.$type)}var Ig={$type:"StyleProperty",key:"key",value:"value"};var Wa={$type:"SwimlaneContent"};var ts={$type:"SwimlaneDeclaration",content:"content",name:"name",properties:"properties",title:"title"};function Ke(e){return We.isInstance(e,ts.$type)}var ns={$type:"SymbolDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ei(e){return We.isInstance(e,ns.$type)}var Bf={$type:"TeamContent"};var rs={$type:"TeamDeclaration",content:"content",name:"name",properties:"properties",title:"title"};function tn(e){return We.isInstance(e,rs.$type)}var is={$type:"WaveDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function vt(e){return We.isInstance(e,is.$type)}var Ga={$type:"WorkingDeclaration",name:"name",properties:"properties",title:"title"};function qa(e){return We.isInstance(e,Ga.$type)}var Ha=class extends Ui{constructor(){super(...arguments);M(this,"types",{AnchorDeclaration:{name:zo.$type,properties:{description:{name:zo.description,optional:!0},name:{name:zo.name,optional:!0},properties:{name:zo.properties,defaultValue:[],optional:!0},title:{name:zo.title,optional:!0}},superTypes:[en.$type]},BlockProperty:{name:vg.$type,properties:{key:{name:vg.key},value:{name:vg.value}},superTypes:[]},CalendarBlock:{name:Rg.$type,properties:{properties:{name:Rg.properties,defaultValue:[],optional:!0}},superTypes:[Dn.$type]},ConfigEntry:{name:Dn.$type,properties:{},superTypes:[]},DefaultDeclaration:{name:Wf.$type,properties:{entityType:{name:Wf.entityType},properties:{name:Wf.properties,defaultValue:[],optional:!0}},superTypes:[Dn.$type]},DescriptionDirective:{name:Sg.$type,properties:{text:{name:Sg.text}},superTypes:[Ba.$type,Mf.$type,Wa.$type,Bf.$type]},EntityProperty:{name:Df.$type,properties:{key:{name:Df.key},value:{name:Df.value,optional:!0},values:{name:Df.values,defaultValue:[],optional:!0}},superTypes:[]},FootnoteDeclaration:{name:jo.$type,properties:{description:{name:jo.description,optional:!0},name:{name:jo.name,optional:!0},properties:{name:jo.properties,defaultValue:[],optional:!0},title:{name:jo.title,optional:!0}},superTypes:[en.$type]},GroupBlock:{name:Yo.$type,properties:{content:{name:Yo.content,defaultValue:[]},name:{name:Yo.name,optional:!0},properties:{name:Yo.properties,defaultValue:[],optional:!0},title:{name:Yo.title,optional:!0}},superTypes:[Ba.$type,Mf.$type,Wa.$type]},GroupContent:{name:Ba.$type,properties:{},superTypes:[]},IncludeDeclaration:{name:_g.$type,properties:{options:{name:_g.options,defaultValue:[],optional:!0},path:{name:_g.path}},superTypes:[]},IncludeOption:{name:Ag.$type,properties:{key:{name:Ag.key},value:{name:Ag.value}},superTypes:[]},ItemDeclaration:{name:Vo.$type,properties:{description:{name:Vo.description,optional:!0},name:{name:Vo.name,optional:!0},properties:{name:Vo.properties,defaultValue:[],optional:!0},title:{name:Vo.title,optional:!0}},superTypes:[Ba.$type,Mf.$type,Wa.$type]},LabelDeclaration:{name:Ko.$type,properties:{description:{name:Ko.description,optional:!0},name:{name:Ko.name,optional:!0},properties:{name:Ko.properties,defaultValue:[],optional:!0},title:{name:Ko.title,optional:!0}},superTypes:[en.$type]},MilestoneDeclaration:{name:qo.$type,properties:{description:{name:qo.description,optional:!0},name:{name:qo.name,optional:!0},properties:{name:qo.properties,defaultValue:[],optional:!0},title:{name:qo.title,optional:!0}},superTypes:[en.$type]},NonWorkingDeclaration:{name:Xa.$type,properties:{name:{name:Xa.name,optional:!0},properties:{name:Xa.properties,defaultValue:[],optional:!0},title:{name:Xa.title,optional:!0}},superTypes:[Dn.$type]},NowlineDirective:{name:kg.$type,properties:{properties:{name:kg.properties,defaultValue:[],optional:!0},version:{name:kg.version}},superTypes:[]},NowlineFile:{name:br.$type,properties:{configEntries:{name:br.configEntries,defaultValue:[],optional:!0},directive:{name:br.directive,optional:!0},hasConfig:{name:br.hasConfig,defaultValue:!1,optional:!0},includes:{name:br.includes,defaultValue:[],optional:!0},roadmapDecl:{name:br.roadmapDecl,optional:!0},roadmapEntries:{name:br.roadmapEntries,defaultValue:[],optional:!0}},superTypes:[]},ParallelBlock:{name:Zo.$type,properties:{content:{name:Zo.content,defaultValue:[]},name:{name:Zo.name,optional:!0},properties:{name:Zo.properties,defaultValue:[],optional:!0},title:{name:Zo.title,optional:!0}},superTypes:[Ba.$type,Wa.$type]},ParallelContent:{name:Mf.$type,properties:{},superTypes:[]},PersonDeclaration:{name:Jo.$type,properties:{description:{name:Jo.description,optional:!0},name:{name:Jo.name,optional:!0},properties:{name:Jo.properties,defaultValue:[],optional:!0},title:{name:Jo.title,optional:!0}},superTypes:[en.$type]},PersonMemberRef:{name:vA.$type,properties:{ref:{name:vA.ref}},superTypes:[Bf.$type]},RoadmapDeclaration:{name:Ff.$type,properties:{name:{name:Ff.name,optional:!0},properties:{name:Ff.properties,defaultValue:[],optional:!0},title:{name:Ff.title,optional:!0}},superTypes:[]},RoadmapEntry:{name:en.$type,properties:{},superTypes:[]},ScaleBlock:{name:bg.$type,properties:{properties:{name:bg.properties,defaultValue:[],optional:!0}},superTypes:[Dn.$type]},SizeDeclaration:{name:Qo.$type,properties:{description:{name:Qo.description,optional:!0},name:{name:Qo.name,optional:!0},properties:{name:Qo.properties,defaultValue:[],optional:!0},title:{name:Qo.title,optional:!0}},superTypes:[en.$type]},StatusDeclaration:{name:es.$type,properties:{description:{name:es.description,optional:!0},name:{name:es.name,optional:!0},properties:{name:es.properties,defaultValue:[],optional:!0},title:{name:es.title,optional:!0}},superTypes:[en.$type]},StyleDeclaration:{name:Ua.$type,properties:{name:{name:Ua.name,optional:!0},properties:{name:Ua.properties,defaultValue:[],optional:!0},title:{name:Ua.title,optional:!0}},superTypes:[Dn.$type]},StyleProperty:{name:Ig.$type,properties:{key:{name:Ig.key},value:{name:Ig.value}},superTypes:[]},SwimlaneContent:{name:Wa.$type,properties:{},superTypes:[]},SwimlaneDeclaration:{name:ts.$type,properties:{content:{name:ts.content,defaultValue:[],optional:!0},name:{name:ts.name,optional:!0},properties:{name:ts.properties,defaultValue:[],optional:!0},title:{name:ts.title,optional:!0}},superTypes:[en.$type]},SymbolDeclaration:{name:ns.$type,properties:{description:{name:ns.description,optional:!0},name:{name:ns.name,optional:!0},properties:{name:ns.properties,defaultValue:[],optional:!0},title:{name:ns.title,optional:!0}},superTypes:[Dn.$type]},TeamContent:{name:Bf.$type,properties:{},superTypes:[]},TeamDeclaration:{name:rs.$type,properties:{content:{name:rs.content,defaultValue:[],optional:!0},name:{name:rs.name,optional:!0},properties:{name:rs.properties,defaultValue:[],optional:!0},title:{name:rs.title,optional:!0}},superTypes:[en.$type,Bf.$type]},WaveDeclaration:{name:is.$type,properties:{description:{name:is.description,optional:!0},name:{name:is.name,optional:!0},properties:{name:is.properties,defaultValue:[],optional:!0},title:{name:is.title,optional:!0}},superTypes:[en.$type]},WorkingDeclaration:{name:Ga.$type,properties:{name:{name:Ga.name,optional:!0},properties:{name:Ga.properties,defaultValue:[],optional:!0},title:{name:Ga.title,optional:!0}},superTypes:[Dn.$type]}})}},We=new Ha;function _t(e){let t=[];for(let n of e.content)ja(n)||t.push(n);return t}function*IA(e){for(let t of e)yield*Lg(t)}function*Lg(e){for(let t of _t(e))yield t,($e(t)||et(t))&&(yield*Lg(t))}function*RA(e){for(let t of e.content)tn(t)&&(yield t,yield*RA(t))}function*Pg(e){Ke(e)||$e(e)||et(e)?yield*Lg(e):tn(e)&&(yield*RA(e))}function*Mn(e,t={}){t.config&&(yield*e.configEntries),t.roadmap&&e.roadmapDecl&&(yield e.roadmapDecl);for(let n of e.roadmapEntries)yield n,yield*Pg(n)}function Xf(e,t){kA(e,t);for(let n of Pg(e))kA(n,t)}function kA(e,t){let n=e.properties;if(Array.isArray(n))for(let r of n)t(r,e)}function Uf(e,t){t(e.name,e);for(let n of Pg(e))t(n.name,n)}function SA(e){return e.name}function bA(e){let t=new Set;for(let n of Mn(e,{roadmap:!0})){let r=SA(n);r&&t.add(r)}return t}function NA(e){let t=new Map;for(let n of Mn(e,{roadmap:!0})){let r=SA(n);r&&!t.has(r)&&t.set(r,n)}return t}function Q(e){return e.key.endsWith(":")?e.key.slice(0,-1):e.key}function At(e,t){return e.find(n=>Q(n)===t)}function ie(e,t){return At(e,t)?.value}function Be(e,t){let n=At(e,t);return n?n.value!==void 0?[n.value]:[...n.values]:[]}var ot=/^\d{4}-\d{2}-\d{2}$/;function _e(e){if(!e||!ot.test(e))return null;let[t,n,r]=e.split("-").map(s=>Number.parseInt(s,10)),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r?i:null}function He(e){return _e(e)!==null}var PA={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Cg(e){return Object.hasOwn(PA,e)}var $g=new Set(["date","start","end","every"]);function Za(e){let t=new Map;for(let l of e.properties){let c=Q(l);$g.has(c)&&!t.has(c)&&t.set(c,l)}let n=tF(t),r={own:t,shape:n,wellFormed:!1},i=t.get("date");if(i){let l=Og(i);l.every(He)&&(r.dates=l)}let o=LA(t.get("start"));o!==void 0&&(r.start=o);let s=LA(t.get("end"));s!==void 0&&(r.end=s);let a=t.get("every");if(a){let l=Og(a);l.every(Cg)&&(r.weekdays=l.map(c=>PA[c]))}return r.wellFormed=n!=="malformed"&&(!i||r.dates!==void 0&&r.dates.length>0)&&(!t.has("start")||r.start!==void 0)&&(!t.has("end")||r.end!==void 0)&&!(r.start!==void 0&&r.end!==void 0&&r.end<r.start)&&(!a||r.weekdays!==void 0&&r.weekdays.length>0),r}function Gf(e){return e.some(t=>t.$type==="NonWorkingDeclaration"&&t.name==="weekend")}function tF(e){let t=e.has("start"),n=e.has("end");return e.has("date")?e.has("every")||t||n?"malformed":"dated":e.has("every")?t&&n?"bounded-recurrence":t||n?"half-bounded-recurrence":"open-recurrence":t&&n?"range":"malformed"}function Og(e){return e.value!==void 0?[e.value]:[...e.values]}function LA(e){if(!e)return;let t=Og(e);return t.length===1&&He(t[0])?t[0]:void 0}function Hf(e,t,n){let r=[],i=n.defaults.get(e);if(i){let l=Dg("default-style",i.properties,n);l&&r.push(l),r.push({level:"default",props:i.properties})}let o=At(t,"labels"),s=o?o.value?[o.value]:o.values:[];for(let l of[...s].reverse()){let c=n.labels.get(l);if(!c){r.push({level:"label",id:l,label:void 0});continue}let u=Dg("label-style",c.properties,n);u&&r.push(u)}let a=Dg("entity-style",t,n);return a&&r.push(a),r.push({level:"inline",props:t}),r}function Dg(e,t,n){let r=At(t,"style")?.value;if(r)return{level:e,id:r,decl:n.styles.get(r)}}var zf=["planned","in-progress","active","done","completed","at-risk","blocked"],wi=["none","multiplier","person","people","points","time"],Ja=[...wi,"shield","warning","lock","calendar"],OA=["hide","show"],CA={border:["solid","dashed","dotted"],shadow:["none","subtle","soft","hard"],font:["sans","serif","mono"],weight:["thin","light","normal","bold"],italic:["true","false"],"text-size":["none","xs","sm","md","lg","xl"],padding:["none","xs","sm","md","lg","xl"],spacing:["none","xs","sm","md","lg","xl"],"header-height":["none","xs","sm","md","lg","xl"],"corner-radius":["none","xs","sm","md","lg","xl","full"],bracket:["none","solid","dashed"],"header-position":["beside","above"],"timeline-position":["top","bottom","both"],"minor-grid":["true","false"]},$A=["red","blue","yellow","green","orange","purple","violet","gray","grey","navy","white","none"],DA=["business","full","custom"],MA=["merge","ignore","isolate"],FA=["bg","fg","text","border","icon","shadow","font","weight","italic","text-size","padding","spacing","header-height","corner-radius","bracket","header-position","capacity-icon","timeline-position","minor-grid","non-working"],BA=["header-height","header-position","timeline-position","minor-grid","non-working"],Qa="none",WA=["days-per-week","days-per-month","days-per-quarter","days-per-year"],XA=["name","label-every","label"],UA=["item","label","swimlane","roadmap","milestone","footnote","anchor","parallel","group"],GA=["labels","link","style","description"],HA={RoadmapDeclaration:["author","start","length","scale","calendar","logo","logo-size"],AnchorDeclaration:["date"],SwimlaneDeclaration:["owner","capacity","utilization-warn-at","utilization-over-at","status","after","before"],ItemDeclaration:["size","duration","status","owner","after","before","remaining","capacity"],ParallelBlock:["owner","after","before","status"],GroupBlock:["owner","after","before","status"],MilestoneDeclaration:["date","after"],FootnoteDeclaration:["on"],PersonDeclaration:[],TeamDeclaration:[],LabelDeclaration:[],SizeDeclaration:["effort"],StatusDeclaration:[],WaveDeclaration:["after"]},zA=["locale"];function se(e,t){return e.length*t*.58}function jA(e,t,n){if(se(e,n)<=t)return e;let r=Array.from(e.trimStart());for(let i=r.length-1;i>=1;i--){let s=`${r.slice(0,i).join("").trimEnd()}\u2026`;if(se(s,n)<=t)return s}return`${r[0]??""}\u2026`}function Ti(e,t,n,r=t){if(!e)return[];let i=e.split(/\s+/).filter(a=>a.length>0);if(i.length===0)return[];let o=[],s="";for(let a of i){let l=s?`${s} ${a}`:a,c=o.length===0?r:t;s&&se(l,n)>c?(o.push(s),s=a):s=l}return s&&o.push(s),o}var nF=new Set(wi),rF=/^\d+$/,iF=/^\d+\.\d+$/,oF=/^\d+(?:\.\d+)?%$/;function Lr(e){if(!e)return null;if(rF.test(e)){let t=parseInt(e,10);return t>0?t:null}if(iF.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?t:null}if(oF.test(e)){let t=parseFloat(e.slice(0,-1))/100;return Number.isFinite(t)&&t>0?t:null}return null}function el(e){if(Number.isInteger(e))return String(e);let t=e.toFixed(6);return t=t.replace(/0+$/,""),t=t.replace(/\.$/,""),t}function sF(e){for(let t of e.properties)if(Q(t)==="unicode"&&t.value)return t.value}function tl(e,t){if(e==="none")return null;if(nF.has(e))return{kind:"builtin",name:e};let n=t.get(e);return n?{kind:"literal",text:sF(n)??e}:{kind:"literal",text:e}}function nl(e,t,n){if(!t)return e.length*n*.58;if(t.kind==="builtin"&&t.name==="multiplier")return(e.length+1)*n*.58;let r=1,i=t.kind==="builtin"?YA:.1;return e.length*n*.58+(i+r)*n}var as=.6,YA=.25;function rl(e,t,n,r){if(t?.kind!=="builtin"||t.name==="multiplier")return;let i=n*YA;return r?[se(r,n),n*as,se(e,n),i]:[se(e,n),i]}function vi(e){return e.toISOString().slice(0,10)}var ls={mode:"business",daysPerWeek:5,daysPerMonth:22,daysPerQuarter:65,daysPerYear:260},aF={mode:"full",daysPerWeek:7,daysPerMonth:30,daysPerQuarter:91,daysPerYear:365};function VA(e,t){let r=At(e.roadmapDecl?.properties??[],"calendar")?.value??"business";if(r==="business")return{...ls};if(r==="full")return{...aF};if(t){let i=(o,s)=>{let a=At(t.properties,o),l=a?parseInt(a.value,10):NaN;return Number.isFinite(l)&&l>0?l:s};return{mode:"custom",daysPerWeek:i("days-per-week",ls.daysPerWeek),daysPerMonth:i("days-per-month",ls.daysPerMonth),daysPerQuarter:i("days-per-quarter",ls.daysPerQuarter),daysPerYear:i("days-per-year",ls.daysPerYear)}}return{...ls}}var jf=/^(\d+(?:\.\d+)?)([dwmqy])$/;function cs(e,t){let n=jf.exec(e);if(!n)return 0;let r=parseFloat(n[1]);switch(n[2]){case"d":return r;case"w":return r*t.daysPerWeek;case"m":return r*t.daysPerMonth;case"q":return r*t.daysPerQuarter;case"y":return r*t.daysPerYear;default:return 0}}function KA(e,t,n){return e?jf.test(e)?cs(e,n):t.get(e)?.effortDays??0:0}function qA(e,t,n){let r=ie(e,"duration");if(r&&jf.test(r))return cs(r,n);let i=ie(e,"size"),o=i?t.get(i):void 0;if(!o)return 0;let s=Lr(ie(e,"capacity"))??1;return o.effortDays/s}function ZA(e,t,n){let r=ie(e,"size"),i=r?t.get(r):void 0;if(i)return i.effortDays;let o=ie(e,"duration");if(o&&jf.test(o)){let s=Lr(ie(e,"capacity"))??1;return cs(o,n)*s}return 0}function us(e,t){let n=new Map;for(let[r,i]of e){let s=At(i.properties,"effort")?.value;if(!s)continue;let a=cs(s,t);a<=0||n.set(r,{name:r,title:i.title||void 0,effortDays:a,effortLiteral:s})}return n}function kt(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function Xe(e,t){let n=new Date(e.getTime());return n.setUTCDate(n.getUTCDate()+t),n}function Bg(e){return e!=="business"?[]:[{working:!1,every:new Set([0,6]),id:"weekend",title:"Weekend"}]}function Wg(e,t=Bg(e.mode)){return uF(n=>nk(n,e),t)}function Yf(e,t,n,r){if(!e.hasNonWorkingDays)return Xe(t,r);let i=Math.floor(r);return i<=Math.floor(n)?e.dateAtWorkingIndex(t,n):Xe(e.dateAtWorkingIndex(t,i-1),1)}function tk(e,t){return nk(e,t)}function nk(e,t){switch(e){case"days":return 1;case"weeks":return t.daysPerWeek;case"months":return t.daysPerMonth;case"quarters":return t.daysPerQuarter;case"years":return t.daysPerYear}}function rk(e){switch(e){case"days":return 1;case"weeks":return 7;case"months":return 30;case"quarters":return 91;case"years":return 365}}var ik=864e5,ze=7,lF=4,cF=1e8,ok=14;function uF(e,t){let n=[];for(let g of t){let w=dF(g);w&&n.push(w)}let r=n.map(g=>g.copy),i=mF(n),o=xF(i,yF(n)),s=lk(o,ak(n)),a=wF(n,o),l=(g,w)=>TF(a,g,w),c=s[0],u=s[s.length-1];for(let g of[c,u])if(g.kind!=="mask"||g.workingPerWeek===0)throw new RangeError("working calendar: an unbounded stretch has no working weekday");let f=s.some(g=>g.kind==="non-working"||g.kind==="mask"&&g.workingPerWeek<ze),d=gF(i);if(!f)return fF(e,r,d,l);let p=new Fg(s,ck(n,!1)),m=(g,w)=>p.dateAt(g,w);return{rules:r,hasNonWorkingDays:!0,weekStart:vF(i),workingWeekdays:d,daysPerUnit:e,addUnits:(g,w,x)=>m(g,w*e(x)),isWorkingDay:g=>p.isWorkingDay(g),workingIndexOf:(g,w)=>p.indexOf(g,w),dateAtWorkingIndex:m,nonWorkingRuns:(g,w)=>p.runs(g,w),workingExceptionRuns:l}}function fF(e,t,n,r){return{rules:t,hasNonWorkingDays:!1,weekStart:void 0,workingWeekdays:n,daysPerUnit:e,addUnits:(i,o,s)=>Xe(i,o*e(s)),isWorkingDay:()=>!0,workingIndexOf:(i,o)=>kt(i,o),dateAtWorkingIndex:(i,o)=>Xe(i,o),nonWorkingRuns:()=>[],workingExceptionRuns:r}}function dF(e){let t=e.every===void 0?void 0:hF(e.every),n=e.start!==void 0||e.end!==void 0;if(t===0||e.dates!==void 0&&(t!==void 0||n)||t===void 0&&e.dates===void 0&&(e.start===void 0||e.end===void 0))return;let i=e.start===void 0?-1/0:Pt(e.start),o=e.end===void 0?1/0:Pt(e.end);if(Number.isNaN(i)||Number.isNaN(o)||o<i)return;let s=e.dates?.map(Pt);if(s?.some(Number.isNaN))return;let a=s?s.map(l=>({start:l,end:l+1})):[{start:i,end:o+1}];return{copy:pF(e),working:e.working,mask:t,spans:a}}function pF(e){let t={working:e.working};return e.every!==void 0&&(t.every=new Set(e.every)),e.dates!==void 0&&(t.dates=e.dates.map(n=>new Date(n.getTime()))),e.start!==void 0&&(t.start=new Date(e.start.getTime())),e.end!==void 0&&(t.end=new Date(e.end.getTime())),e.id!==void 0&&(t.id=e.id),e.title!==void 0&&(t.title=e.title),t}function hF(e){let t=0;for(let n of e){if(!Number.isInteger(n)||n<0||n>=ze)throw new RangeError(`working calendar: weekday ${n} is outside 0..6`);t|=1<<n}return t}function mF(e){let t=0,n=0;for(let r of e)r.mask===void 0||!sk(r.spans[0])||(r.working?n|=r.mask:t|=r.mask);return t&~n}function gF(e){let t=new Set;for(let n=0;n<ze;n++)(e&1<<n)===0&&t.add(n);return t}function sk(e){return e.start===-1/0&&e.end===1/0}function yF(e){let t=[];for(let n of e)n.mask===void 0||sk(n.spans[0])||t.push({...n.spans[0],working:n.working,mask:n.mask});return t}function xF(e,t){let n=new Array(ze).fill(0),r=new Array(ze).fill(0),i=(u,f)=>{let d=u.working?r:n;for(let p=0;p<ze;p++)u.mask&1<<p&&(d[p]+=f)},o=()=>{let u=e;for(let f=0;f<ze;f++)n[f]>0&&(u|=1<<f),r[f]>0&&(u&=~(1<<f));return u},s=[];for(let u of t)u.start===-1/0?i(u,1):s.push({at:u.start,span:u,delta:1}),u.end!==1/0&&s.push({at:u.end,span:u,delta:-1});s.sort((u,f)=>u.at-f.at);let a=[],l=-1/0,c=0;for(;;){let u=c<s.length?s[c].at:1/0;if(l<u&&EF(a,{start:l,end:u,mask:o()}),u===1/0)return a;for(;c<s.length&&s[c].at===u;)i(s[c].span,s[c].delta),c++;l=u}}function EF(e,t){let n=e[e.length-1];n&&n.mask===t.mask?n.end=t.end:e.push(t)}function ak(e){let t=[];for(let s of e)if(s.mask===void 0)for(let a of s.spans)t.push({at:a.start,working:s.working,delta:1}),t.push({at:a.end,working:s.working,delta:-1});t.sort((s,a)=>s.at-a.at);let n=[],r=0,i=0,o=0;for(;o<t.length;){let s=t[o].at;for(;o<t.length&&t[o].at===s;)t[o].working?r+=t[o].delta:i+=t[o].delta,o++;if(o===t.length||r===0&&i===0)continue;let a=r>0?"working":"non-working",l=t[o].at,c=n[n.length-1];c&&c.kind===a&&c.end===s?c.end=l:n.push({start:s,end:l,kind:a})}return n}function lk(e,t){let n=[],r=0;for(let i of e){for(;r<t.length&&t[r].end<=i.start;)r++;let o=i.start;for(let s=r;s<t.length&&t[s].start<i.end;s++){let a=Math.max(t[s].start,i.start),l=Math.min(t[s].end,i.end);o<a&&n.push(JA(o,a,i.mask)),n.push({start:a,end:l,kind:t[s].kind}),o=l}o<i.end&&n.push(JA(o,i.end,i.mask))}return n}function JA(e,t,n){let r=[];for(let o=0;o<ze;o++)r.push((n&1<<o)!==0);let i=r.filter(o=>!o).length;return{start:e,end:t,kind:"mask",off:r,workingPerWeek:i}}function ck(e,t){let n=[];for(let[r,i]of e.entries()){let o=i.copy.title;if(i.mask!==void 0||i.working!==t||o===void 0||i.spans.length===0)continue;let s=i.spans.reduce((a,l)=>Math.min(a,l.start),1/0);n.push({title:o,spans:i.spans,first:s,order:r})}return n.sort((r,i)=>r.first-i.first||r.order-i.order),n.map(({title:r,spans:i})=>({title:r,spans:i}))}function wF(e,t){let n=ck(e,!0);if(n.length===0)return[];let r=e.filter(l=>!l.working),i=lk(t,ak(r)),o=new Map;n.forEach((l,c)=>{for(let u of l.spans)for(let f=u.start;f<u.end;f++){if(!dk(i,f))continue;let d=o.get(f)??new Set;d.add(c),o.set(f,d)}});let s=[...o.keys()].sort((l,c)=>l-c),a=[];for(let l=0;l<s.length;){let c=l,u=new Set;for(;c<s.length&&s[c]-s[l]===c-l;){for(let f of o.get(s[c])??[])u.add(f);c++}a.push({from:il(s[l]),through:il(s[c-1]),titles:[...u].sort((f,d)=>f-d).map(f=>n[f].title)}),l=c}return a}function TF(e,t,n){let r=Pt(t),i=Pt(n);return Number.isNaN(r)||Number.isNaN(i)?[]:e.filter(o=>Pt(o.from)<i&&Pt(o.through)>=r).map(o=>({from:new Date(o.from.getTime()),through:new Date(o.through.getTime()),titles:[...o.titles]}))}function vF(e){let t=i=>(e&1<<i)!==0,n,r=0;for(let i=0;i<ze;i++){if(t(i)||!t((i+6)%ze))continue;let o=0;for(;o<ze&&t((i+6-o)%ze);)o++;o>r&&(n=i,r=o)}return n}function Pt(e){return Math.round(e.getTime()/ik)}function il(e){return new Date(e*ik)}function ol(e){return((e+lF)%ze+ze)%ze}function uk(){return new Error("working calendar: remainder scan exceeded its cap (internal error)")}function fk(e,t){let n=0,r=e.length-1;for(;n<r;){let i=n+r>>1;t>=e[i].end?n=i+1:r=i}return n}function dk(e,t){let n=e[fk(e,t)];return n.kind==="mask"?n.off[ol(t)]:n.kind==="non-working"}function Mg(e,t,n){if(e.kind!=="mask")return e.kind==="working"?n-t:0;let r=Math.floor((n-t)/ze),i=r*e.workingPerWeek;for(let o=t+r*ze;o<n;o++)e.off[ol(o)]||i++;return i}function QA(e,t,n){if(e.kind!=="mask")return t+n;let r=t+Math.floor(n/e.workingPerWeek)*ze,i=n%e.workingPerWeek;for(let o=0;o<ok;o++,r++)if(!e.off[ol(r)]){if(i===0)return r;i--}throw uk()}function ek(e,t,n){if(e.kind!=="mask")return t-n;let r=Math.floor((n-1)/e.workingPerWeek),i=t-r*ze,o=n-r*e.workingPerWeek;for(let s=0;s<ok;s++)if(i--,!e.off[ol(i)]&&(o--,o===0))return i;throw uk()}var Fg=class{constructor(t,n){M(this,"pieces");M(this,"titled");this.pieces=t,this.titled=n}isWorkingDay(t){let n=Pt(t);return Number.isNaN(n)||!this.isNonWorking(n)}indexOf(t,n){let r=Pt(t),i=Pt(n);if(Number.isNaN(r)||Number.isNaN(i))return Number.NaN;let o=this.nthFrom(i,0);return o>=r?this.count(r,o):-this.count(o,r)}dateAt(t,n){let r=Pt(t),i=Math.floor(n);return Number.isNaN(r)||!Number.isFinite(i)||Math.abs(i)>cF?new Date(Number.NaN):il(i>=0?this.nthFrom(r,i):this.nthBefore(r,-i))}runs(t,n){let r=Pt(t),i=Pt(n);if(Number.isNaN(r)||Number.isNaN(i)||r>=i)return[];let o=[],s=this.isNonWorking(r)?this.nthBefore(r,1)+1:this.nextNonWorking(r,i);for(;s<i;){let a=this.nthFrom(s,0)-1;o.push({from:il(s),through:il(a),titles:this.titlesIn(s,a)}),s=this.nextNonWorking(a+1,i)}return o}pieceAt(t){return fk(this.pieces,t)}isNonWorking(t){return dk(this.pieces,t)}count(t,n){let r=0;for(let i=this.pieceAt(t);i<this.pieces.length&&this.pieces[i].start<n;i++){let o=this.pieces[i];r+=Mg(o,Math.max(t,o.start),Math.min(n,o.end))}return r}nthFrom(t,n){let r=t,i=n;for(let o=this.pieceAt(t);o<this.pieces.length;o++){let s=this.pieces[o];if(s.end===1/0)return QA(s,r,i);let a=Mg(s,r,s.end);if(i<a)return QA(s,r,i);i-=a,r=s.end}throw new Error("working calendar: forward walk left the last piece (internal error)")}nthBefore(t,n){let r=t,i=n;for(let o=this.pieceAt(t-1);o>=0;o--){let s=this.pieces[o];if(s.start===-1/0)return ek(s,r,i);let a=Mg(s,s.start,r);if(i<=a)return ek(s,r,i);i-=a,r=s.start}throw new Error("working calendar: backward walk left the first piece (internal error)")}nextNonWorking(t,n){for(let r=this.pieceAt(t);r<this.pieces.length&&this.pieces[r].start<n;r++){let i=this.pieces[r],o=Math.max(t,i.start);if(i.kind==="non-working")return o;if(!(i.kind!=="mask"||i.workingPerWeek===ze)){for(let s=0;s<ze&&o+s<i.end;s++)if(i.off[ol(o+s)])return o+s}}return n}titlesIn(t,n){let r=[];for(let i of this.titled)i.spans.some(o=>o.start<=n&&o.end>t)&&r.push(i.title);return r}};function Vf(e,t){let n=VA(e,t.config.calendar),r=_F(n,t.config.calendarDeclarations);try{return{config:n,working:Wg(n,r)}}catch(i){if(!(i instanceof RangeError))throw i;return{config:n,working:Wg(n)}}}function _F(e,t){let n=Gf(t)?[]:Bg(e.mode);for(let r of t){let i=AF(r);i&&n.push(i)}return n.sort(kF)}function AF(e){let t=Za(e);if(!t.wellFormed)return;let n={working:e.$type==="WorkingDeclaration"};return e.name&&(n.id=e.name),e.title!==void 0&&(n.title=e.title),t.dates&&(n.dates=t.dates.map(Xg)),t.start&&(n.start=Xg(t.start)),t.end&&(n.end=Xg(t.end)),t.weekdays&&(n.every=new Set(t.weekdays)),n}function Xg(e){return _e(e)}function kF(e,t){return fs(pk(e),pk(t))||fs(e.title,t.title)||fs(e.id,t.id)||Number(e.working)-Number(t.working)||fs(hk(e),hk(t))||fs(e.start?.getTime(),t.start?.getTime())||fs(e.end?.getTime(),t.end?.getTime())||IF(e.dates??[],t.dates??[])}function pk(e){return e.dates?Math.min(...e.dates.map(t=>t.getTime())):e.start?.getTime()}function hk(e){if(!e.every)return;let t=0;for(let n of e.every)t|=1<<n;return t}function fs(e,t){return e===t?0:e===void 0?-1:t===void 0?1:e<t?-1:1}function IF(e,t){let n=e.map(i=>i.getTime()).sort((i,o)=>i-o),r=t.map(i=>i.getTime()).sort((i,o)=>i-o);for(let i=0;i<Math.min(n.length,r.length);i++)if(n[i]!==r[i])return n[i]-r[i];return n.length-r.length}function mk(e){let{naturalPixelsPerDay:t,dayCount:n,chromeWidth:r,maxWidth:i}=e;if(i===void 0||r+n*t<=i)return t;let o=(i-r)/n,s=Math.min(t,1);return Math.max(s,o)}var Fn=12,Bn=6,Kf=20,_i=38,Or=13,sl=11,al=16,Ug=2;function qf(e){return _i+(Math.max(1,e)-1)*al}function Zf(e,t){return t?qf(e):Kf+(Math.max(1,e)-1)*al}function Gg(e,t){return Math.max(0,Zf(e,t)-_i)}var Ai=12,Hg=12,Pr=5,ds=22,zg=14,ll=10,Ut=8,Cr=14,ki=6,gk=4;function ps(e,t){let n=Fn;if(e){let r=ki+Cr+gk-Fn;n=Fn+Math.max(0,r)}if(t&&!Vg(t.barWidth)){let r=Kg(0,e)+pt;n=Math.max(n,r+Xt)}return n}var Xt=4,$r=2*Ai,jg=ki+Cr+Xt+Ai+Pr,hs=ds+1;function Jf(e){let t=e.barRightX+Bn,n=!1,r=null;e.iconSpills&&(r=t,t=r+Cr,n=!0);let i=null;e.captionWidth!==null&&(n&&(t+=Xt),i=t,t+=e.captionWidth,n=!0);let o=null;e.footnoteCount>0&&(n&&(t+=Xt),o=t,t+=e.footnoteCount*Ut,n=!0);let s=null;return e.dotSpills&&(n&&(t+=Xt),s=t+Pr,t=s+Pr),{iconSpillX:r,captionX:i,footnoteSpillStartX:o,dotSpillCx:s,rightX:t}}var pt=12,cl=6,Yg=6,yk=5,nn=Xt,xk=cl+pt+nn+pt+Yg;function Vg(e){return e<xk}function Kg(e,t){return t?e+ki+Cr+nn:e+cl}function qg(e,t){let n;return t>0?n=e-ds-(t-1)*Ut-nn:n=e-Ai-Pr-nn,n-pt}function ul(e){let{barWidth:t,footnoteLabels:n,hasBeforeGlyph:r}=e,i=Number.POSITIVE_INFINITY;t>=$r&&(i=Math.min(i,-(Ai+Pr)));let o=n.length;if(o>0&&t>=hs)for(let a=0;a<o;a+=1){let c=-ds-(o-1-a)*Ut-se(n[a],ll);i=Math.min(i,c)}return r&&t>=xk&&(i=Math.min(i,qg(0,o))),Math.max(Fn,-i+Xt)}var Dr=13,Wn=3,Xn=4,RF=4,Qf=Dr+RF,SF=.25;function Ek(e,t){if(e.length===0)return{rows:[[]],expanded:!1};let n=[[]],r=0,i=t,o=!1;for(let s of e){let a=n[n.length-1],l=(a.length===0?0:Xn)+s.width,c=r+l;if(c<=i){a.push(s),r=c;continue}if(a.length===0){a.push(s),r=s.width;continue}let u=c-i,f=s.width*SF;if(!o&&u<=f){a.push(s),r=c,i=c,o=!0;continue}n.push([s]),r=s.width,i=t}return{rows:n,expanded:o}}var wk={none:0,xs:2,sm:4,md:8,lg:16,xl:24},Tk={none:0,xs:4,sm:8,md:12,lg:20,xl:32},Ii={none:0,xs:10,sm:12,md:14,lg:18,xl:24},Ri={none:0,xs:2,sm:4,md:8,lg:12,xl:20,full:9999},Zg={xs:18,sm:24,md:36,lg:48,xl:72},Jg=1,rn=4,fl={none:0,xs:16,sm:20,md:24,lg:32,xl:40},vk=fl.md;function dl(e){return Math.round(e/2+3)}var bF=dl(vk),Si=10,pl=22,hl=15,ml="6 4",Qg=36,Gt=16,ey=Gt/2,gl=10,ty=Gt-4,ms=6,ed=2.25,_k=1,It=12,Ak=32,kk=120,ny=240,ry=72,td=28,Ht=16,iy=22,gs=18,nd="Powered by",oy="https://nowline.io",yl=.22,Mr=40,rd=32,Ik=.58,NF=nd.length*rd*Ik,LF=10,xl=NF+LF,sy=xl+74,ay=5,id=xl+81,PF=3*Mr*Ik,OF=id+PF,CF=12+Mr,ly=OF*yl,Rk=CF*yl,od=4;var cy={sans:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',serif:'Georgia, "Times New Roman", serif',mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},Sk={days:7,weeks:4,months:3,quarters:4,years:5},uy=.1,fy=20,dy=2,py="2 2",hy=.13,my=6,gy=2,yy=.12,El=.25,Un=10,sd=14,ad=8,Gn=6,ys=2,ld=3,bi=.5,cd=18,ud=10,xy=6,Ey=11;var bk=18,wl=13,fd=Ii.xs,wy=10,Nk=6,Lk=6,Ty=.12,vy=.06,_y=2;function dd(e){return e.drawn?{header:e.hasTitle||e.hasPins||e.hasBracket?bk:0,pad:Nk}:{header:0,pad:0}}function xs(e,t){return t?e+pt+nn:e}function Ay(e){return e.length*fd*.58}function Es(e){if(e.kind==="item")return Number.NEGATIVE_INFINITY;let t=Number.NEGATIVE_INFINITY,n=e.inlineDatePins??[];for(let r of n)t=Math.max(t,r.glyphTopLeft.x+r.glyphSize);if(e.title&&e.headerHeight>0){let r=n.some(i=>i.side==="after");t=Math.max(t,xs(e.box.x,r)+Ay(e.title))}return t}function $F(e,t){return e.endX-Math.min(t/2,(e.endX-e.startX)/2)}function DF(e,t){return e.startX+Math.min(t/2,(e.endX-e.startX)/2)}function ws(e){return e<3?{headWidth:3,head:"dot"}:{headWidth:Math.min(7,e),head:"arrow"}}var ky=(e,t,n)=>e>=t-.01&&e<=n+.01;function MF(e,t){return t.rowY===void 0||!ky(t.rowY,e.top,e.bottom)?!1:e.rowY===void 0||ky(e.rowY,t.top,t.bottom)}function FF(e,t,n,r,i){let o=[];for(let l of e){if(l.x>=n+1||l.x+l.width<=t-1)continue;let c=l.y-1,u=l.y+l.height+1;u<=r||c>=i||o.push([Math.max(r,c),Math.min(i,u)])}o.sort((l,c)=>l[0]-c[0]);let s=[],a=r;for(let[l,c]of o)l-a>=2&&s.push([a,l]),a=Math.max(a,c);return i-a>=2&&s.push([a,i]),s}function Pk(e,t,n,r){let i=Math.min(n,r),o=Math.max(n,r),s=0;for(let a of e)Math.abs(a.x-t)>1||a.bottom<=i||a.top>=o||s++;return s}function Ok(e,t,n,r){let i=Math.min(n,r),o=Math.max(n,r),s=0;for(let a of e)a.height<=0||t<=a.x||t>=a.x+a.width||a.y+a.height<=i||a.y>=o||s++;return s}function BF(e,t,n,r){let i=Math.min(e.x,t.x),o=Math.max(e.x,t.x),s=Math.min(e.y,t.y),a=Math.max(e.y,t.y),l=null;for(let f of FF(r.blocks,i,o,s,a)){let d=(f[0]+f[1])/2,p=[Pk(r.edges,e.x,e.y,d)+Pk(r.edges,t.x,d,t.y),Ok(r.blocks,e.x,e.y,d)+Ok(r.blocks,t.x,d,t.y),Math.abs(d-e.y)];(!l||WF(p,l.key))&&(l={gap:f,centre:d,key:p})}if(l)return{gap:l.gap,centre:l.centre};let c=Math.min(4,(a-s)/2),u=e.y+n*c;return{gap:[s,a],centre:u}}function WF(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1}function XF(e,t){let n=[0];for(let r=1;r*2.5<=t+.01;r++)n.push(-e*r*2.5,e*r*2.5);return n}function UF(e){let t=[],n=new Map,r=[...e].sort((i,o)=>i.centre-o.centre||i.xLo-o.xLo||i.index-o.index);for(let i of r){let[o,s]=i.gap,a=t.find(c=>c.bundle===i.bundle&&c.y>=o-.01&&c.y<=s+.01),l=i.centre;if(a)l=a.y;else{let c=XF(i.dir,(s-o)/2),u=Number.POSITIVE_INFINITY;for(let f of c){let d=i.centre+f,p=t.filter(m=>m.bundle!==i.bundle&&Math.abs(m.y-d)<2.5-.01&&m.xLo<i.xHi+1&&m.xHi>i.xLo-1).length;if(p<u&&(u=p,l=d),p===0)break}}t.push({y:l,xLo:i.xLo,xHi:i.xHi,bundle:i.bundle}),n.set(i.index,l)}return n}function Ck(e,t,n){let r=new Array(e.length).fill(null),i=[];e.forEach((s,a)=>{let{source:l,target:c}=s,u=c.startX-l.endX>.01;if(MF(l,c)&&c.startX>=l.endX-.01){if(!u)return;let y=l.exitY!==void 0&&ky(l.exitY,c.top,c.bottom)?l.exitY:c.rowY??0;r[a]={fromId:s.fromId,toId:s.toId,waypoints:[{x:l.endX,y},{x:c.paintedX,y}],slack:!0,...ws(c.bottom-c.top)};return}let f=$F(l,n),d=DF(c,n),p,m,g;if(c.top>=l.bottom-.01)g=1,p={x:f,y:l.bottom},m={x:d,y:c.top};else if(c.bottom<=l.top+.01)g=-1,p={x:f,y:l.top},m={x:d,y:c.bottom};else{let y=Math.max(l.bottom,c.bottom)+4;r[a]={fromId:s.fromId,toId:s.toId,waypoints:[{x:f,y:l.bottom},{x:f,y},{x:d,y},{x:d,y:c.bottom}],slack:u,...ws(c.paintedWidth)};return}if(Math.abs(f-d)<.01){r[a]={fromId:s.fromId,toId:s.toId,waypoints:[p,m],slack:u,...ws(c.paintedWidth)};return}let{gap:w,centre:x}=BF(p,m,g,t);i.push({index:a,req:s,from:p,to:m,dir:g,gap:w,centre:x,xLo:Math.min(f,d),xHi:Math.max(f,d),bundle:`${Math.round(d*100)}:${g}`})});let o=UF(i);for(let s of i){let a=o.get(s.index)??s.centre,l=s.req.target.startX-s.req.source.endX>.01;r[s.index]={fromId:s.req.fromId,toId:s.req.toId,waypoints:[s.from,{x:s.from.x,y:a},{x:s.to.x,y:a},s.to],slack:l,...ws(s.req.target.paintedWidth)}}return r}var GF=new Set(" ijlI.,:;!'|`"),HF=new Set('frt()[]{}/\\1-_"'),zF=new Set("mwMW@%"),jF=.95;function $k(e){let t=0;for(let n of e)GF.has(n)?t+=.28:HF.has(n)?t+=.4:zF.has(n)?t+=.9:/[A-Z0-9]/.test(n)?t+=.7:t+=.6;return t}function Dk(e){return $k(e)*12}function Mk(e){return $k(e)*10*jF}var Tl=10,Iy=3,pd=6,Fk=12,Bk=12,Wk=56,Xk=10;function Ry(e,t,n,r=0,i=0){let o=e+Xk,s=o+Fk,a=Dk(t),l=s+a,c=0,u=0,f=0;n&&(c=Tl+Iy+Mk(n),u=l+pd,f=u+Tl+Iy,l=u+c);let d=0;r>0&&(d=l+pd,l=d+r);let p=0;i>0&&(p=l+pd+i,l=p);let m=l-o+Bk,g=Math.max(Wk,m);return{titleTextWidth:a,ownerTextWidth:c,capacityBadgeWidth:r,footnoteIndicatorWidth:i,titleX:s,ownerX:u,ownerTextX:f,badgeX:d,footnoteRightX:p,tabX:o,tabW:g,rightX:o+g}}function hd(e){let t=ie(e.roadmapDecl?.properties??[],"logo");return t||void 0}function VF(e){let t=ie(e.roadmapDecl?.properties??[],"logo-size");return t!==void 0&&t in Zg?t:"md"}function Uk(e,t){let n=e.width/e.height,r=Zg[t],i=r*n;return i>160&&(i=160,r=i/n),{width:i,height:r}}function Gk(e,t){let n=hd(e);if(!(!n||!t)&&t.width>0&&t.height>0&&!(!Number.isFinite(t.width)||!Number.isFinite(t.height)))return{...Uk(t,VF(e)),assetRef:n,intrinsic:t}}function vl(e,t,n){let r=e+24,i=r+10,o=t.length*6,s=Math.max(60,o+10+10),a=r+s+6,l=a+18,c=0,u=0,f=0,d=0,p=l;return n&&(u=l+6,c=n.length*5.5,f=u-3,d=c+6,p=f+d),{labelTextWidth:o,sourceTextWidth:c,tabX:r,tabWidth:s,tabLabelX:i,badgeX:a,badgeSize:18,sourceHaloX:f,sourceHaloWidth:d,sourceTextX:u,chromeRightX:p}}var Hk="lexing-error",zk="parsing-error";function jk(e){if(!e||typeof e!="object")return!1;let t=e.code;return t===Hk||t===zk}function Ni(e){let t=[];for(let n of e.parseResult.lexerErrors)t.push({origin:"lexer",error:n});for(let n of e.parseResult.parserErrors)t.push({origin:"parser",error:n});for(let n of e.diagnostics??[]){let r=n;jk(r.data)||t.push({origin:"validation",diagnostic:r})}return t}var KF=/did you mean ['"]?([^'"?]+)['"]?\??/i;function Yk(e){let t=e.match(KF);return t?t[1].trim():void 0}var qF={"NL.W0700":e=>e.suggested||void 0,"NL.E1101":e=>"suggestion"in e?e.suggestion?.id:void 0};function ZF(e,t){let n=qF[e];return n?.(...t)}function md(e,t){let n=Sy(t);return n===void 0?Yk(e):ZF(n,t.args)}function gd(e){let t=e.toLowerCase();return t.includes("duplicate identifier")?"duplicate-identifier":t.includes("unknown reference")||t.includes("did you mean")?"unknown-reference":t.includes("circular")?"circular-dependency":t.includes("requires")&&t.includes("date:")?"missing-date":t.includes("duration")?"duration":t.includes("include")?"include":t.includes("indent")?"indentation":"validation"}function Sy(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.code=="string"&&Array.isArray(t.args))return t.code}function by(e){let t=Sy(e.data);return t||(typeof e.code=="string"&&e.code!==""?e.code:typeof e.code=="number"?String(e.code):gd(e.message))}var Vk,Kk=()=>Vk??(Vk=TA(`{
128
+ `}var Sf=class{constructor(t){this.indexManager=t.shared.workspace.IndexManager,this.commentProvider=t.documentation.CommentProvider}getDocumentation(t){let n=this.commentProvider.getComment(t);if(n&&pA(n))return dA(n).toMarkdown({renderLink:(i,o)=>this.documentationLinkRenderer(t,i,o),renderTag:i=>this.documentationTagRenderer(t,i)})}documentationLinkRenderer(t,n,r){let i=this.findNameInLocalSymbols(t,n)??this.findNameInGlobalScope(t,n);if(i&&i.nameSegment){let o=i.nameSegment.range.start.line+1,s=i.nameSegment.range.start.character+1,a=i.documentUri.with({fragment:`L${o},${s}`});return`[${r}](${a.toString()})`}else return}documentationTagRenderer(t,n){}findNameInLocalSymbols(t,n){let i=st(t).localSymbols;if(!i)return;let o=t;do{let a=i.getStream(o).find(l=>l.name===n);if(a)return a;o=o.$container}while(o)}findNameInGlobalScope(t,n){return this.indexManager.allElements().find(i=>i.name===n)}};var bf=class{constructor(t){this.grammarConfig=()=>t.parser.GrammarConfig}getComment(t){return i0(t)?t.$comment:nw(t.$cstNode,this.grammarConfig().multilineCommentRules)?.text}};var Nf=class{constructor(t){this.syncParser=t.parser.LangiumParser}parse(t,n){return Promise.resolve(this.syncParser.parse(t))}};var Lf;(function(e){e[e.Normal=0]="Normal",e[e.Immediate=1]="Immediate"})(Lf||(Lf={}));var Pf=class{constructor(){this.previousTokenSource=new fe.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.immediateReads=[],this.done=!0}write(t){this.cancelWrite();let n=J_();return this.previousTokenSource=n,this.enqueue(this.writeQueue,t,n.token)}read(t,n=Lf.Normal){if(n===Lf.Immediate){let r=Promise.resolve().then(()=>t());this.immediateReads.push(r);let i=()=>{this.immediateReads.splice(this.immediateReads.indexOf(r),1)};return r.then(i,i),r}return this.enqueue(this.readQueue,t)}enqueue(t,n,r=fe.CancellationToken.None){let i=new Rr,o={action:n,deferred:i,cancellationToken:r};return t.push(o),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;let t=[];if(this.writeQueue.length>0)for(t.push(this.writeQueue.shift()),this.done=!1;this.immediateReads.length>0;)await Promise.allSettled(this.immediateReads.slice());else if(this.readQueue.length>0)t.push(...this.readQueue.splice(0,this.readQueue.length)),this.done=!1;else return;await Promise.all(t.map(async({action:n,deferred:r,cancellationToken:i})=>{try{let o=await Promise.resolve().then(()=>n(i));r.resolve(o)}catch(o){Sr(o)?r.resolve(void 0):r.reject(o)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}};var Of=class{constructor(t){this.grammarElementIdMap=new Ca,this.tokenTypeIdMap=new Ca,this.cstNodeBuilder=new Oo,this.grammar=t.Grammar,this.lexer=t.parser.Lexer,this.linker=t.references.Linker}dehydrate(t){return{lexerErrors:t.lexerErrors,lexerReport:t.lexerReport?this.dehydrateLexerReport(t.lexerReport):void 0,parserErrors:t.parserErrors.map(n=>({...n,message:n.message})),value:this.dehydrateAstNode(t.value,this.createDehyrationContext(t.value))}}dehydrateLexerReport(t){return t}createDehyrationContext(t){let n=new Map,r=new Map;for(let i of xt(t))n.set(i,{});if(t.$cstNode)for(let i of Zs(t.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(t,n){let r=n.astNodes.get(t);r.$type=t.$type,r.$containerIndex=t.$containerIndex,r.$containerProperty=t.$containerProperty,t.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(t.$cstNode,n));for(let[i,o]of Object.entries(t))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];r[i]=s;for(let a of o)Ue(a)?s.push(this.dehydrateAstNode(a,n)):it(a)?s.push(this.dehydrateReference(a,n)):s.push(a)}else Ue(o)?r[i]=this.dehydrateAstNode(o,n):it(o)?r[i]=this.dehydrateReference(o,n):o!==void 0&&(r[i]=o);return r}dehydrateReference(t,n){let r={};return r.$refText=t.$refText,t.$refNode&&(r.$refNode=n.cstNodes.get(t.$refNode)),r}dehydrateCstNode(t,n){let r=n.cstNodes.get(t);if(ic(t)?r.fullText=t.fullText:r.grammarSource=this.getGrammarElementId(t.grammarSource),r.hidden=t.hidden,nr(t))r.content=t.content.map(i=>this.dehydrateCstNode(i,n));else if(rc(t)){r.tokenType=t.tokenType.name,r.offset=t.offset,r.length=t.length;let{start:i,end:o}=t.range;r.startLine=i.line,r.startColumn=i.character,r.endLine=o.line,r.endColumn=o.character}return r}hydrate(t){let n=t.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:t.lexerErrors,lexerReport:t.lexerReport,parserErrors:t.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(t){let n=new Map,r=new Map;for(let i of xt(t))n.set(i,{});if(t.$cstNode)for(let i of Zs(t.$cstNode)){let o;"fullText"in i?o=new La(i.fullText):"content"in i?o=new Co:"tokenType"in i&&(o=this.hydrateCstLeafNode(i)),o&&r.set(i,o)}return{astNodes:n,cstNodes:r,linkedCstNodes:new Set}}hydrateAstNode(t,n){let r=n.astNodes.get(t);if(r.$type=t.$type,r.$containerIndex=t.$containerIndex,r.$containerProperty=t.$containerProperty,t.$cstNode){let i=n.cstNodes.get(t.$cstNode);r.$cstNode=i,i&&!n.linkedCstNodes.has(i)&&(n.linkedCstNodes.add(i),i.astNode=r)}for(let[i,o]of Object.entries(t))if(!i.startsWith("$"))if(Array.isArray(o)){let s=[];r[i]=s;for(let a of o)Ue(a)?s.push(this.setParent(this.hydrateAstNode(a,n),r)):it(a)?s.push(this.hydrateReference(a,r,i,n)):s.push(a)}else Ue(o)?r[i]=this.setParent(this.hydrateAstNode(o,n),r):it(o)?r[i]=this.hydrateReference(o,r,i,n):o!==void 0&&(r[i]=o);return r}setParent(t,n){return t.$container=n,t}hydrateReference(t,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(t.$refNode),t.$refText)}hydrateCstNode(t,n,r=0){let i=n.cstNodes.get(t);if(typeof t.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(t.grammarSource)),nr(i)){let o=[];for(let s of t.content)o.push(this.hydrateCstNode(s,n,r++));this.cstNodeBuilder.appendChildren(i,o)}return i}hydrateCstLeafNode(t){let n=this.getTokenType(t.tokenType);return new Na(t.offset,t.length,t.startLine,t.startColumn,t.endLine,t.endColumn,n,t.hidden)}getTokenType(t){return this.lexer.definition[t]}getGrammarElementId(t){if(t)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(t)}getGrammarElement(t){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(t)}createGrammarElementIdMap(){let t=0;for(let n of xt(this.grammar))wc(n)&&this.grammarElementIdMap.set(n,t++)}};function Cf(e){return{documentation:{CommentProvider:t=>new bf(t),DocumentationProvider:t=>new Sf(t)},parser:{AsyncParser:t=>new Nf(t),GrammarConfig:t=>pw(t),LangiumParser:t=>z_(t),CompletionParser:t=>H_(t),ValueConverter:()=>new Do,TokenBuilder:()=>new $o,Lexer:t=>new Xo(t),ParserErrorMessageProvider:()=>new Pa,LexerErrorMessageProvider:()=>new Ef},workspace:{AstNodeLocator:()=>new hf,AstNodeDescriptionProvider:t=>new df(t),ReferenceDescriptionProvider:t=>new pf(t)},references:{Linker:t=>new Ju(t),NameProvider:()=>new Qu,ScopeProvider:t=>new af(t),ScopeComputation:t=>new tf(t),References:t=>new ef(t)},serializer:{Hydrator:t=>new Of(t),JsonSerializer:t=>new lf(t)},validation:{DocumentValidator:t=>new ff(t),ValidationRegistry:t=>new uf(t)},shared:()=>e.shared}}function $f(e){return{ServiceRegistry:t=>new cf(t),workspace:{LangiumDocuments:t=>new Zu(t),LangiumDocumentFactory:t=>new qu(t),DocumentBuilder:t=>new gf(t),IndexManager:t=>new yf(t),WorkspaceManager:t=>new xf(t),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new Pf,ConfigurationProvider:t=>new mf(t)},profilers:{}}}var xA;(function(e){e.merge=(t,n)=>Fa(Fa({},t),n)})(xA||(xA={}));function Ho(e,t,n,r,i,o,s,a,l){let c=[e,t,n,r,i,o,s,a,l].reduce(Fa,{});return TA(c)}var QM=Symbol("isProxy");function TA(e,t){let n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===QM?!0:wA(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(wA(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return n}var EA=Symbol();function wA(e,t,n,r){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: "+e[t]);if(e[t]===EA)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return e[t]}else if(t in n){let i=n[t];e[t]=EA;try{e[t]=typeof i=="function"?i(r):TA(i,r)}catch(o){throw e[t]=o instanceof Error?o:void 0,o}return e[t]}else return}function Fa(e,t){if(t){for(let[n,r]of Object.entries(t))if(!(n==="__proto__"||n==="constructor"||n==="prototype")&&r!=null)if(typeof r=="object"){let i=e[n];typeof i=="object"&&i!==null?e[n]=Fa(i,r):e[n]=Fa({},r)}else e[n]=r}return e}var vA={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]},zo;(function(e){e.REGULAR="indentation-sensitive",e.IGNORE_INDENTATION="ignore-indentation"})(zo||(zo={}));var Ba=class extends $o{constructor(t=vA){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options={...vA,...t},this.indentTokenType=cr({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=cr({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(t,n){let r=super.buildTokens(t,n);if(!ig(r))throw new Error("Invalid tokens built by default builder");let{indentTokenName:i,dedentTokenName:o,whitespaceTokenName:s,ignoreIndentationDelimiters:a}=this.options,l,c,u,f=[];for(let d of r){for(let[p,m]of a)d.name===p?d.PUSH_MODE=zo.IGNORE_INDENTATION:d.name===m&&(d.POP_MODE=!0);d.name===o?l=d:d.name===i?c=d:d.name===s?u=d:f.push(d)}if(!l||!c||!u)throw new Error("Some indentation/whitespace tokens not found!");return a.length>0?{modes:{[zo.REGULAR]:[l,c,...f,u],[zo.IGNORE_INDENTATION]:[...f,u]},defaultMode:zo.REGULAR}:[l,c,u,...f]}flushLexingReport(t){return{...super.flushLexingReport(t),remainingDedents:this.flushRemainingDedents(t)}}isStartOfLine(t,n){return n===0||`\r
129
+ `.includes(t[n-1])}matchWhitespace(t,n,r,i){this.whitespaceRegExp.lastIndex=n;let o=this.whitespaceRegExp.exec(t);return{currIndentLevel:o?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:o}}createIndentationTokenInstance(t,n,r,i){let o=this.getLineNumber(n,i);return Sn(t,r,i,i+r.length,o,o,1,r.length)}getLineNumber(t,n){return t.substring(0,n).split(/\r\n|\r|\n/).length}indentMatcher(t,n,r,i){if(!this.isStartOfLine(t,n))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(t,n,r,i);return o<=s?null:(this.indentationStack.push(o),a)}dedentMatcher(t,n,r,i){if(!this.isStartOfLine(t,n))return null;let{currIndentLevel:o,prevIndentLevel:s,match:a}=this.matchWhitespace(t,n,r,i);if(o>=s)return null;let l=this.indentationStack.lastIndexOf(o);if(l===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${o} at offset: ${n}. Current indentation stack: ${this.indentationStack}`,offset:n,length:a?.[0]?.length??0,line:this.getLineNumber(t,n),column:1}),null;let c=this.indentationStack.length-l-1,u=t.substring(0,n).match(/[\r\n]+$/)?.[0].length??1;for(let f=0;f<c;f++){let d=this.createIndentationTokenInstance(this.dedentTokenType,t,"",n-(u-1));r.push(d),this.indentationStack.pop()}return null}buildTerminalToken(t){let n=super.buildTerminalToken(t),{indentTokenName:r,dedentTokenName:i,whitespaceTokenName:o}=this.options;return n.name===r?this.indentTokenType:n.name===i?this.dedentTokenType:n.name===o?cr({name:o,pattern:this.whitespaceRegExp,group:Me.SKIPPED}):n}flushRemainingDedents(t){let n=[];for(;this.indentationStack.length>1;)n.push(this.createIndentationTokenInstance(this.dedentTokenType,t,"",t.length)),this.indentationStack.pop();return this.indentationStack=[0],n}},Df=class extends Xo{constructor(t){if(super(t),t.parser.TokenBuilder instanceof Ba)this.indentationTokenBuilder=t.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(t,n=rg){let r=super.tokenize(t),i=r.report;n?.mode==="full"&&r.tokens.push(...i.remainingDedents),i.remainingDedents=[];let{indentTokenType:o,dedentTokenType:s}=this.indentationTokenBuilder,a=o.tokenTypeIdx,l=s.tokenTypeIdx,c=[],u=r.tokens.length-1;for(let f=0;f<u;f++){let d=r.tokens[f],p=r.tokens[f+1];if(d.tokenTypeIdx===a&&p.tokenTypeIdx===l){f++;continue}c.push(d)}return u>=0&&c.push(r.tokens[u]),r.tokens=c,r}};var _g=class{stat(t){throw new Error("No file system is available.")}statSync(t){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}},Mf={fileSystemProvider:()=>new _g};var eF={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},tF={AstReflection:()=>new qs};function nF(){let e=Ho($f(Mf),tF),t=Ho(Cf({shared:e}),eF);return e.ServiceRegistry.register(t),t}function _A(e){let t=nF(),n=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,Ce.parse(`memory:/${n.name??"grammar"}.langium`)),n}var jo={$type:"AnchorDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function ss(e){return We.isInstance(e,jo.$type)}var Ag={$type:"BlockProperty",key:"key",value:"value"};var bg={$type:"CalendarBlock",properties:"properties"};function ja(e){return We.isInstance(e,bg.$type)}var Dn={$type:"ConfigEntry"};function kA(e){return We.isInstance(e,Dn.$type)}var Uf={$type:"DefaultDeclaration",entityType:"entityType",properties:"properties"};function nt(e){return We.isInstance(e,Uf.$type)}var Ng={$type:"DescriptionDirective",text:"text"};function Ya(e){return We.isInstance(e,Ng.$type)}var Ff={$type:"EntityProperty",key:"key",value:"value",values:"values"};var Yo={$type:"FootnoteDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Pg(e){return We.isInstance(e,Yo.$type)}var Vo={$type:"GroupBlock",content:"content",name:"name",properties:"properties",title:"title"};function $e(e){return We.isInstance(e,Vo.$type)}var Wa={$type:"GroupContent"};var kg={$type:"IncludeDeclaration",options:"options",path:"path"};var Ig={$type:"IncludeOption",key:"key",value:"value"};var Ko={$type:"ItemDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ve(e){return We.isInstance(e,Ko.$type)}var qo={$type:"LabelDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Va(e){return We.isInstance(e,qo.$type)}var Zo={$type:"MilestoneDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function xn(e){return We.isInstance(e,Zo.$type)}var Ua={$type:"NonWorkingDeclaration",name:"name",properties:"properties",title:"title"};function Nr(e){return We.isInstance(e,Ua.$type)}var Rg={$type:"NowlineDirective",properties:"properties",version:"version"};var br={$type:"NowlineFile",configEntries:"configEntries",directive:"directive",hasConfig:"hasConfig",includes:"includes",roadmapDecl:"roadmapDecl",roadmapEntries:"roadmapEntries"};function as(e){return We.isInstance(e,br.$type)}var Jo={$type:"ParallelBlock",content:"content",name:"name",properties:"properties",title:"title"};function et(e){return We.isInstance(e,Jo.$type)}var Bf={$type:"ParallelContent"};var Qo={$type:"PersonDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ka(e){return We.isInstance(e,Qo.$type)}var AA={$type:"PersonMemberRef",ref:"ref"};var Wf={$type:"RoadmapDeclaration",name:"name",properties:"properties",title:"title"};var en={$type:"RoadmapEntry"};var Lg={$type:"ScaleBlock",properties:"properties"};function IA(e){return We.isInstance(e,Lg.$type)}var es={$type:"SizeDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function xi(e){return We.isInstance(e,es.$type)}var ts={$type:"StatusDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function qa(e){return We.isInstance(e,ts.$type)}var Ga={$type:"StyleDeclaration",name:"name",properties:"properties",title:"title"};function Wt(e){return We.isInstance(e,Ga.$type)}var Sg={$type:"StyleProperty",key:"key",value:"value"};var Xa={$type:"SwimlaneContent"};var ns={$type:"SwimlaneDeclaration",content:"content",name:"name",properties:"properties",title:"title"};function Ke(e){return We.isInstance(e,ns.$type)}var rs={$type:"SymbolDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function Ei(e){return We.isInstance(e,rs.$type)}var Xf={$type:"TeamContent"};var is={$type:"TeamDeclaration",content:"content",name:"name",properties:"properties",title:"title"};function tn(e){return We.isInstance(e,is.$type)}var os={$type:"WaveDeclaration",description:"description",name:"name",properties:"properties",title:"title"};function vt(e){return We.isInstance(e,os.$type)}var Ha={$type:"WorkingDeclaration",name:"name",properties:"properties",title:"title"};function Za(e){return We.isInstance(e,Ha.$type)}var za=class extends Gi{constructor(){super(...arguments);M(this,"types",{AnchorDeclaration:{name:jo.$type,properties:{description:{name:jo.description,optional:!0},name:{name:jo.name,optional:!0},properties:{name:jo.properties,defaultValue:[],optional:!0},title:{name:jo.title,optional:!0}},superTypes:[en.$type]},BlockProperty:{name:Ag.$type,properties:{key:{name:Ag.key},value:{name:Ag.value}},superTypes:[]},CalendarBlock:{name:bg.$type,properties:{properties:{name:bg.properties,defaultValue:[],optional:!0}},superTypes:[Dn.$type]},ConfigEntry:{name:Dn.$type,properties:{},superTypes:[]},DefaultDeclaration:{name:Uf.$type,properties:{entityType:{name:Uf.entityType},properties:{name:Uf.properties,defaultValue:[],optional:!0}},superTypes:[Dn.$type]},DescriptionDirective:{name:Ng.$type,properties:{text:{name:Ng.text}},superTypes:[Wa.$type,Bf.$type,Xa.$type,Xf.$type]},EntityProperty:{name:Ff.$type,properties:{key:{name:Ff.key},value:{name:Ff.value,optional:!0},values:{name:Ff.values,defaultValue:[],optional:!0}},superTypes:[]},FootnoteDeclaration:{name:Yo.$type,properties:{description:{name:Yo.description,optional:!0},name:{name:Yo.name,optional:!0},properties:{name:Yo.properties,defaultValue:[],optional:!0},title:{name:Yo.title,optional:!0}},superTypes:[en.$type]},GroupBlock:{name:Vo.$type,properties:{content:{name:Vo.content,defaultValue:[]},name:{name:Vo.name,optional:!0},properties:{name:Vo.properties,defaultValue:[],optional:!0},title:{name:Vo.title,optional:!0}},superTypes:[Wa.$type,Bf.$type,Xa.$type]},GroupContent:{name:Wa.$type,properties:{},superTypes:[]},IncludeDeclaration:{name:kg.$type,properties:{options:{name:kg.options,defaultValue:[],optional:!0},path:{name:kg.path}},superTypes:[]},IncludeOption:{name:Ig.$type,properties:{key:{name:Ig.key},value:{name:Ig.value}},superTypes:[]},ItemDeclaration:{name:Ko.$type,properties:{description:{name:Ko.description,optional:!0},name:{name:Ko.name,optional:!0},properties:{name:Ko.properties,defaultValue:[],optional:!0},title:{name:Ko.title,optional:!0}},superTypes:[Wa.$type,Bf.$type,Xa.$type]},LabelDeclaration:{name:qo.$type,properties:{description:{name:qo.description,optional:!0},name:{name:qo.name,optional:!0},properties:{name:qo.properties,defaultValue:[],optional:!0},title:{name:qo.title,optional:!0}},superTypes:[en.$type]},MilestoneDeclaration:{name:Zo.$type,properties:{description:{name:Zo.description,optional:!0},name:{name:Zo.name,optional:!0},properties:{name:Zo.properties,defaultValue:[],optional:!0},title:{name:Zo.title,optional:!0}},superTypes:[en.$type]},NonWorkingDeclaration:{name:Ua.$type,properties:{name:{name:Ua.name,optional:!0},properties:{name:Ua.properties,defaultValue:[],optional:!0},title:{name:Ua.title,optional:!0}},superTypes:[Dn.$type]},NowlineDirective:{name:Rg.$type,properties:{properties:{name:Rg.properties,defaultValue:[],optional:!0},version:{name:Rg.version}},superTypes:[]},NowlineFile:{name:br.$type,properties:{configEntries:{name:br.configEntries,defaultValue:[],optional:!0},directive:{name:br.directive,optional:!0},hasConfig:{name:br.hasConfig,defaultValue:!1,optional:!0},includes:{name:br.includes,defaultValue:[],optional:!0},roadmapDecl:{name:br.roadmapDecl,optional:!0},roadmapEntries:{name:br.roadmapEntries,defaultValue:[],optional:!0}},superTypes:[]},ParallelBlock:{name:Jo.$type,properties:{content:{name:Jo.content,defaultValue:[]},name:{name:Jo.name,optional:!0},properties:{name:Jo.properties,defaultValue:[],optional:!0},title:{name:Jo.title,optional:!0}},superTypes:[Wa.$type,Xa.$type]},ParallelContent:{name:Bf.$type,properties:{},superTypes:[]},PersonDeclaration:{name:Qo.$type,properties:{description:{name:Qo.description,optional:!0},name:{name:Qo.name,optional:!0},properties:{name:Qo.properties,defaultValue:[],optional:!0},title:{name:Qo.title,optional:!0}},superTypes:[en.$type]},PersonMemberRef:{name:AA.$type,properties:{ref:{name:AA.ref}},superTypes:[Xf.$type]},RoadmapDeclaration:{name:Wf.$type,properties:{name:{name:Wf.name,optional:!0},properties:{name:Wf.properties,defaultValue:[],optional:!0},title:{name:Wf.title,optional:!0}},superTypes:[]},RoadmapEntry:{name:en.$type,properties:{},superTypes:[]},ScaleBlock:{name:Lg.$type,properties:{properties:{name:Lg.properties,defaultValue:[],optional:!0}},superTypes:[Dn.$type]},SizeDeclaration:{name:es.$type,properties:{description:{name:es.description,optional:!0},name:{name:es.name,optional:!0},properties:{name:es.properties,defaultValue:[],optional:!0},title:{name:es.title,optional:!0}},superTypes:[en.$type]},StatusDeclaration:{name:ts.$type,properties:{description:{name:ts.description,optional:!0},name:{name:ts.name,optional:!0},properties:{name:ts.properties,defaultValue:[],optional:!0},title:{name:ts.title,optional:!0}},superTypes:[en.$type]},StyleDeclaration:{name:Ga.$type,properties:{name:{name:Ga.name,optional:!0},properties:{name:Ga.properties,defaultValue:[],optional:!0},title:{name:Ga.title,optional:!0}},superTypes:[Dn.$type]},StyleProperty:{name:Sg.$type,properties:{key:{name:Sg.key},value:{name:Sg.value}},superTypes:[]},SwimlaneContent:{name:Xa.$type,properties:{},superTypes:[]},SwimlaneDeclaration:{name:ns.$type,properties:{content:{name:ns.content,defaultValue:[],optional:!0},name:{name:ns.name,optional:!0},properties:{name:ns.properties,defaultValue:[],optional:!0},title:{name:ns.title,optional:!0}},superTypes:[en.$type]},SymbolDeclaration:{name:rs.$type,properties:{description:{name:rs.description,optional:!0},name:{name:rs.name,optional:!0},properties:{name:rs.properties,defaultValue:[],optional:!0},title:{name:rs.title,optional:!0}},superTypes:[Dn.$type]},TeamContent:{name:Xf.$type,properties:{},superTypes:[]},TeamDeclaration:{name:is.$type,properties:{content:{name:is.content,defaultValue:[],optional:!0},name:{name:is.name,optional:!0},properties:{name:is.properties,defaultValue:[],optional:!0},title:{name:is.title,optional:!0}},superTypes:[en.$type,Xf.$type]},WaveDeclaration:{name:os.$type,properties:{description:{name:os.description,optional:!0},name:{name:os.name,optional:!0},properties:{name:os.properties,defaultValue:[],optional:!0},title:{name:os.title,optional:!0}},superTypes:[en.$type]},WorkingDeclaration:{name:Ha.$type,properties:{name:{name:Ha.name,optional:!0},properties:{name:Ha.properties,defaultValue:[],optional:!0},title:{name:Ha.title,optional:!0}},superTypes:[Dn.$type]}})}},We=new za;function _t(e){let t=[];for(let n of e.content)Ya(n)||t.push(n);return t}function*SA(e){for(let t of e)yield*Og(t)}function*Og(e){for(let t of _t(e))yield t,($e(t)||et(t))&&(yield*Og(t))}function*bA(e){for(let t of e.content)tn(t)&&(yield t,yield*bA(t))}function*Cg(e){Ke(e)||$e(e)||et(e)?yield*Og(e):tn(e)&&(yield*bA(e))}function*Mn(e,t={}){t.config&&(yield*e.configEntries),t.roadmap&&e.roadmapDecl&&(yield e.roadmapDecl);for(let n of e.roadmapEntries)yield n,yield*Cg(n)}function Gf(e,t){RA(e,t);for(let n of Cg(e))RA(n,t)}function RA(e,t){let n=e.properties;if(Array.isArray(n))for(let r of n)t(r,e)}function Hf(e,t){t(e.name,e);for(let n of Cg(e))t(n.name,n)}function NA(e){return e.name}function LA(e){let t=new Set;for(let n of Mn(e,{roadmap:!0})){let r=NA(n);r&&t.add(r)}return t}function PA(e){let t=new Map;for(let n of Mn(e,{roadmap:!0})){let r=NA(n);r&&!t.has(r)&&t.set(r,n)}return t}function ee(e){return e.key.endsWith(":")?e.key.slice(0,-1):e.key}function At(e,t){return e.find(n=>ee(n)===t)}function ie(e,t){return At(e,t)?.value}function Be(e,t){let n=At(e,t);return n?n.value!==void 0?[n.value]:[...n.values]:[]}var ot=/^\d{4}-\d{2}-\d{2}$/;function Te(e){if(!e||!ot.test(e))return null;let[t,n,r]=e.split("-").map(s=>Number.parseInt(s,10)),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r?i:null}function He(e){return Te(e)!==null}var CA={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Dg(e){return Object.hasOwn(CA,e)}var Mg=new Set(["date","start","end","every"]);function Ja(e){let t=new Map;for(let l of e.properties){let c=ee(l);Mg.has(c)&&!t.has(c)&&t.set(c,l)}let n=rF(t),r={own:t,shape:n,wellFormed:!1},i=t.get("date");if(i){let l=$g(i);l.every(He)&&(r.dates=l)}let o=OA(t.get("start"));o!==void 0&&(r.start=o);let s=OA(t.get("end"));s!==void 0&&(r.end=s);let a=t.get("every");if(a){let l=$g(a);l.every(Dg)&&(r.weekdays=l.map(c=>CA[c]))}return r.wellFormed=n!=="malformed"&&(!i||r.dates!==void 0&&r.dates.length>0)&&(!t.has("start")||r.start!==void 0)&&(!t.has("end")||r.end!==void 0)&&!(r.start!==void 0&&r.end!==void 0&&r.end<r.start)&&(!a||r.weekdays!==void 0&&r.weekdays.length>0),r}function zf(e){return e.some(t=>t.$type==="NonWorkingDeclaration"&&t.name==="weekend")}function rF(e){let t=e.has("start"),n=e.has("end");return e.has("date")?e.has("every")||t||n?"malformed":"dated":e.has("every")?t&&n?"bounded-recurrence":t||n?"half-bounded-recurrence":"open-recurrence":t&&n?"range":"malformed"}function $g(e){return e.value!==void 0?[e.value]:[...e.values]}function OA(e){if(!e)return;let t=$g(e);return t.length===1&&He(t[0])?t[0]:void 0}function jf(e,t,n){let r=[],i=n.defaults.get(e);if(i){let l=Fg("default-style",i.properties,n);l&&r.push(l),r.push({level:"default",props:i.properties})}let o=At(t,"labels"),s=o?o.value?[o.value]:o.values:[];for(let l of[...s].reverse()){let c=n.labels.get(l);if(!c){r.push({level:"label",id:l,label:void 0});continue}let u=Fg("label-style",c.properties,n);u&&r.push(u)}let a=Fg("entity-style",t,n);return a&&r.push(a),r.push({level:"inline",props:t}),r}function Fg(e,t,n){let r=At(t,"style")?.value;if(r)return{level:e,id:r,decl:n.styles.get(r)}}var Yf=["planned","in-progress","active","done","completed","at-risk","blocked"],wi=["none","multiplier","person","people","points","time"],Qa=[...wi,"shield","warning","lock","calendar"],$A=["hide","show"],DA={border:["solid","dashed","dotted"],shadow:["none","subtle","soft","hard"],font:["sans","serif","mono"],weight:["thin","light","normal","bold"],italic:["true","false"],"text-size":["none","xs","sm","md","lg","xl"],padding:["none","xs","sm","md","lg","xl"],spacing:["none","xs","sm","md","lg","xl"],"header-height":["none","xs","sm","md","lg","xl"],"corner-radius":["none","xs","sm","md","lg","xl","full"],bracket:["none","solid","dashed"],"header-position":["beside","above"],"timeline-position":["top","bottom","both"],"minor-grid":["true","false"]},MA=["red","blue","yellow","green","orange","purple","violet","gray","grey","navy","white","none"],FA=["business","full","custom"],BA=["merge","ignore","isolate"],WA=["bg","fg","text","border","icon","shadow","font","weight","italic","text-size","padding","spacing","header-height","corner-radius","bracket","header-position","capacity-icon","timeline-position","minor-grid","non-working"],XA=["header-height","header-position","timeline-position","minor-grid","non-working"],el="none",UA=["days-per-week","days-per-month","days-per-quarter","days-per-year"],GA=["name","label-every","label"],HA=["item","label","swimlane","roadmap","milestone","footnote","anchor","parallel","group"],zA=["labels","link","style","description"],jA={RoadmapDeclaration:["author","start","length","scale","calendar","logo","logo-size"],AnchorDeclaration:["date"],SwimlaneDeclaration:["owner","capacity","utilization-warn-at","utilization-over-at","status","after","before"],ItemDeclaration:["size","duration","status","owner","after","before","remaining","capacity"],ParallelBlock:["owner","after","before","status"],GroupBlock:["owner","after","before","status"],MilestoneDeclaration:["date","after"],FootnoteDeclaration:["on"],PersonDeclaration:[],TeamDeclaration:[],LabelDeclaration:[],SizeDeclaration:["effort"],StatusDeclaration:[],WaveDeclaration:["after"]},YA=["locale"];function se(e,t){return e.length*t*.58}function VA(e,t,n){if(se(e,n)<=t)return e;let r=Array.from(e.trimStart());for(let i=r.length-1;i>=1;i--){let s=`${r.slice(0,i).join("").trimEnd()}\u2026`;if(se(s,n)<=t)return s}return`${r[0]??""}\u2026`}function Ti(e,t,n,r=t){if(!e)return[];let i=e.split(/\s+/).filter(a=>a.length>0);if(i.length===0)return[];let o=[],s="";for(let a of i){let l=s?`${s} ${a}`:a,c=o.length===0?r:t;s&&se(l,n)>c?(o.push(s),s=a):s=l}return s&&o.push(s),o}var iF=new Set(wi),oF=/^\d+$/,sF=/^\d+\.\d+$/,aF=/^\d+(?:\.\d+)?%$/;function Lr(e){if(!e)return null;if(oF.test(e)){let t=parseInt(e,10);return t>0?t:null}if(sF.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?t:null}if(aF.test(e)){let t=parseFloat(e.slice(0,-1))/100;return Number.isFinite(t)&&t>0?t:null}return null}function tl(e){if(Number.isInteger(e))return String(e);let t=e.toFixed(6);return t=t.replace(/0+$/,""),t=t.replace(/\.$/,""),t}function lF(e){for(let t of e.properties)if(ee(t)==="unicode"&&t.value)return t.value}function nl(e,t){if(e==="none")return null;if(iF.has(e))return{kind:"builtin",name:e};let n=t.get(e);return n?{kind:"literal",text:lF(n)??e}:{kind:"literal",text:e}}function rl(e,t,n){if(!t)return e.length*n*.58;if(t.kind==="builtin"&&t.name==="multiplier")return(e.length+1)*n*.58;let r=1,i=t.kind==="builtin"?KA:.1;return e.length*n*.58+(i+r)*n}var ls=.6,KA=.25;function il(e,t,n,r){if(t?.kind!=="builtin"||t.name==="multiplier")return;let i=n*KA;return r?[se(r,n),n*ls,se(e,n),i]:[se(e,n),i]}function vi(e){return e.toISOString().slice(0,10)}var cs={mode:"business",daysPerWeek:5,daysPerMonth:22,daysPerQuarter:65,daysPerYear:260},cF={mode:"full",daysPerWeek:7,daysPerMonth:30,daysPerQuarter:91,daysPerYear:365};function qA(e,t){let r=At(e.roadmapDecl?.properties??[],"calendar")?.value??"business";if(r==="business")return{...cs};if(r==="full")return{...cF};if(t){let i=(o,s)=>{let a=At(t.properties,o),l=a?parseInt(a.value,10):NaN;return Number.isFinite(l)&&l>0?l:s};return{mode:"custom",daysPerWeek:i("days-per-week",cs.daysPerWeek),daysPerMonth:i("days-per-month",cs.daysPerMonth),daysPerQuarter:i("days-per-quarter",cs.daysPerQuarter),daysPerYear:i("days-per-year",cs.daysPerYear)}}return{...cs}}var Vf=/^(\d+(?:\.\d+)?)([dwmqy])$/;function us(e,t){let n=Vf.exec(e);if(!n)return 0;let r=parseFloat(n[1]);switch(n[2]){case"d":return r;case"w":return r*t.daysPerWeek;case"m":return r*t.daysPerMonth;case"q":return r*t.daysPerQuarter;case"y":return r*t.daysPerYear;default:return 0}}function ZA(e,t,n){return e?Vf.test(e)?us(e,n):t.get(e)?.effortDays??0:0}function JA(e,t,n){let r=ie(e,"duration");if(r&&Vf.test(r))return us(r,n);let i=ie(e,"size"),o=i?t.get(i):void 0;if(!o)return 0;let s=Lr(ie(e,"capacity"))??1;return o.effortDays/s}function QA(e,t,n){let r=ie(e,"size"),i=r?t.get(r):void 0;if(i)return i.effortDays;let o=ie(e,"duration");if(o&&Vf.test(o)){let s=Lr(ie(e,"capacity"))??1;return us(o,n)*s}return 0}function fs(e,t){let n=new Map;for(let[r,i]of e){let s=At(i.properties,"effort")?.value;if(!s)continue;let a=us(s,t);a<=0||n.set(r,{name:r,title:i.title||void 0,effortDays:a,effortLiteral:s})}return n}function kt(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function Xe(e,t){let n=new Date(e.getTime());return n.setUTCDate(n.getUTCDate()+t),n}function Xg(e){return e!=="business"?[]:[{working:!1,every:new Set([0,6]),id:"weekend",title:"Weekend"}]}function Ug(e,t=Xg(e.mode)){return dF(n=>ik(n,e),t)}function Kf(e,t,n,r){if(!e.hasNonWorkingDays)return Xe(t,r);let i=Math.floor(r);return i<=Math.floor(n)?e.dateAtWorkingIndex(t,n):Xe(e.dateAtWorkingIndex(t,i-1),1)}function rk(e,t){return ik(e,t)}function ik(e,t){switch(e){case"days":return 1;case"weeks":return t.daysPerWeek;case"months":return t.daysPerMonth;case"quarters":return t.daysPerQuarter;case"years":return t.daysPerYear}}function ok(e){switch(e){case"days":return 1;case"weeks":return 7;case"months":return 30;case"quarters":return 91;case"years":return 365}}var sk=864e5,ze=7,uF=4,fF=1e8,ak=14;function dF(e,t){let n=[];for(let g of t){let E=hF(g);E&&n.push(E)}let r=n.map(g=>g.copy),i=yF(n),o=wF(i,EF(n)),s=uk(o,ck(n)),a=vF(n,o),l=(g,E)=>_F(a,g,E),c=s[0],u=s[s.length-1];for(let g of[c,u])if(g.kind!=="mask"||g.workingPerWeek===0)throw new RangeError("working calendar: an unbounded stretch has no working weekday");let f=s.some(g=>g.kind==="non-working"||g.kind==="mask"&&g.workingPerWeek<ze),d=xF(i);if(!f)return pF(e,r,d,l);let p=new Wg(s,fk(n,!1)),m=(g,E)=>p.dateAt(g,E);return{rules:r,hasNonWorkingDays:!0,weekStart:AF(i),workingWeekdays:d,daysPerUnit:e,addUnits:(g,E,x)=>m(g,E*e(x)),isWorkingDay:g=>p.isWorkingDay(g),workingIndexOf:(g,E)=>p.indexOf(g,E),dateAtWorkingIndex:m,nonWorkingRuns:(g,E)=>p.runs(g,E),workingExceptionRuns:l}}function pF(e,t,n,r){return{rules:t,hasNonWorkingDays:!1,weekStart:void 0,workingWeekdays:n,daysPerUnit:e,addUnits:(i,o,s)=>Xe(i,o*e(s)),isWorkingDay:()=>!0,workingIndexOf:(i,o)=>kt(i,o),dateAtWorkingIndex:(i,o)=>Xe(i,o),nonWorkingRuns:()=>[],workingExceptionRuns:r}}function hF(e){let t=e.every===void 0?void 0:gF(e.every),n=e.start!==void 0||e.end!==void 0;if(t===0||e.dates!==void 0&&(t!==void 0||n)||t===void 0&&e.dates===void 0&&(e.start===void 0||e.end===void 0))return;let i=e.start===void 0?-1/0:Pt(e.start),o=e.end===void 0?1/0:Pt(e.end);if(Number.isNaN(i)||Number.isNaN(o)||o<i)return;let s=e.dates?.map(Pt);if(s?.some(Number.isNaN))return;let a=s?s.map(l=>({start:l,end:l+1})):[{start:i,end:o+1}];return{copy:mF(e),working:e.working,mask:t,spans:a}}function mF(e){let t={working:e.working};return e.every!==void 0&&(t.every=new Set(e.every)),e.dates!==void 0&&(t.dates=e.dates.map(n=>new Date(n.getTime()))),e.start!==void 0&&(t.start=new Date(e.start.getTime())),e.end!==void 0&&(t.end=new Date(e.end.getTime())),e.id!==void 0&&(t.id=e.id),e.title!==void 0&&(t.title=e.title),t}function gF(e){let t=0;for(let n of e){if(!Number.isInteger(n)||n<0||n>=ze)throw new RangeError(`working calendar: weekday ${n} is outside 0..6`);t|=1<<n}return t}function yF(e){let t=0,n=0;for(let r of e)r.mask===void 0||!lk(r.spans[0])||(r.working?n|=r.mask:t|=r.mask);return t&~n}function xF(e){let t=new Set;for(let n=0;n<ze;n++)(e&1<<n)===0&&t.add(n);return t}function lk(e){return e.start===-1/0&&e.end===1/0}function EF(e){let t=[];for(let n of e)n.mask===void 0||lk(n.spans[0])||t.push({...n.spans[0],working:n.working,mask:n.mask});return t}function wF(e,t){let n=new Array(ze).fill(0),r=new Array(ze).fill(0),i=(u,f)=>{let d=u.working?r:n;for(let p=0;p<ze;p++)u.mask&1<<p&&(d[p]+=f)},o=()=>{let u=e;for(let f=0;f<ze;f++)n[f]>0&&(u|=1<<f),r[f]>0&&(u&=~(1<<f));return u},s=[];for(let u of t)u.start===-1/0?i(u,1):s.push({at:u.start,span:u,delta:1}),u.end!==1/0&&s.push({at:u.end,span:u,delta:-1});s.sort((u,f)=>u.at-f.at);let a=[],l=-1/0,c=0;for(;;){let u=c<s.length?s[c].at:1/0;if(l<u&&TF(a,{start:l,end:u,mask:o()}),u===1/0)return a;for(;c<s.length&&s[c].at===u;)i(s[c].span,s[c].delta),c++;l=u}}function TF(e,t){let n=e[e.length-1];n&&n.mask===t.mask?n.end=t.end:e.push(t)}function ck(e){let t=[];for(let s of e)if(s.mask===void 0)for(let a of s.spans)t.push({at:a.start,working:s.working,delta:1}),t.push({at:a.end,working:s.working,delta:-1});t.sort((s,a)=>s.at-a.at);let n=[],r=0,i=0,o=0;for(;o<t.length;){let s=t[o].at;for(;o<t.length&&t[o].at===s;)t[o].working?r+=t[o].delta:i+=t[o].delta,o++;if(o===t.length||r===0&&i===0)continue;let a=r>0?"working":"non-working",l=t[o].at,c=n[n.length-1];c&&c.kind===a&&c.end===s?c.end=l:n.push({start:s,end:l,kind:a})}return n}function uk(e,t){let n=[],r=0;for(let i of e){for(;r<t.length&&t[r].end<=i.start;)r++;let o=i.start;for(let s=r;s<t.length&&t[s].start<i.end;s++){let a=Math.max(t[s].start,i.start),l=Math.min(t[s].end,i.end);o<a&&n.push(ek(o,a,i.mask)),n.push({start:a,end:l,kind:t[s].kind}),o=l}o<i.end&&n.push(ek(o,i.end,i.mask))}return n}function ek(e,t,n){let r=[];for(let o=0;o<ze;o++)r.push((n&1<<o)!==0);let i=r.filter(o=>!o).length;return{start:e,end:t,kind:"mask",off:r,workingPerWeek:i}}function fk(e,t){let n=[];for(let[r,i]of e.entries()){let o=i.copy.title;if(i.mask!==void 0||i.working!==t||o===void 0||i.spans.length===0)continue;let s=i.spans.reduce((a,l)=>Math.min(a,l.start),1/0);n.push({title:o,spans:i.spans,first:s,order:r})}return n.sort((r,i)=>r.first-i.first||r.order-i.order),n.map(({title:r,spans:i})=>({title:r,spans:i}))}function vF(e,t){let n=fk(e,!0);if(n.length===0)return[];let r=e.filter(l=>!l.working),i=uk(t,ck(r)),o=new Map;n.forEach((l,c)=>{for(let u of l.spans)for(let f=u.start;f<u.end;f++){if(!hk(i,f))continue;let d=o.get(f)??new Set;d.add(c),o.set(f,d)}});let s=[...o.keys()].sort((l,c)=>l-c),a=[];for(let l=0;l<s.length;){let c=l,u=new Set;for(;c<s.length&&s[c]-s[l]===c-l;){for(let f of o.get(s[c])??[])u.add(f);c++}a.push({from:ol(s[l]),through:ol(s[c-1]),titles:[...u].sort((f,d)=>f-d).map(f=>n[f].title)}),l=c}return a}function _F(e,t,n){let r=Pt(t),i=Pt(n);return Number.isNaN(r)||Number.isNaN(i)?[]:e.filter(o=>Pt(o.from)<i&&Pt(o.through)>=r).map(o=>({from:new Date(o.from.getTime()),through:new Date(o.through.getTime()),titles:[...o.titles]}))}function AF(e){let t=i=>(e&1<<i)!==0,n,r=0;for(let i=0;i<ze;i++){if(t(i)||!t((i+6)%ze))continue;let o=0;for(;o<ze&&t((i+6-o)%ze);)o++;o>r&&(n=i,r=o)}return n}function Pt(e){return Math.round(e.getTime()/sk)}function ol(e){return new Date(e*sk)}function sl(e){return((e+uF)%ze+ze)%ze}function dk(){return new Error("working calendar: remainder scan exceeded its cap (internal error)")}function pk(e,t){let n=0,r=e.length-1;for(;n<r;){let i=n+r>>1;t>=e[i].end?n=i+1:r=i}return n}function hk(e,t){let n=e[pk(e,t)];return n.kind==="mask"?n.off[sl(t)]:n.kind==="non-working"}function Bg(e,t,n){if(e.kind!=="mask")return e.kind==="working"?n-t:0;let r=Math.floor((n-t)/ze),i=r*e.workingPerWeek;for(let o=t+r*ze;o<n;o++)e.off[sl(o)]||i++;return i}function tk(e,t,n){if(e.kind!=="mask")return t+n;let r=t+Math.floor(n/e.workingPerWeek)*ze,i=n%e.workingPerWeek;for(let o=0;o<ak;o++,r++)if(!e.off[sl(r)]){if(i===0)return r;i--}throw dk()}function nk(e,t,n){if(e.kind!=="mask")return t-n;let r=Math.floor((n-1)/e.workingPerWeek),i=t-r*ze,o=n-r*e.workingPerWeek;for(let s=0;s<ak;s++)if(i--,!e.off[sl(i)]&&(o--,o===0))return i;throw dk()}var Wg=class{constructor(t,n){M(this,"pieces");M(this,"titled");this.pieces=t,this.titled=n}isWorkingDay(t){let n=Pt(t);return Number.isNaN(n)||!this.isNonWorking(n)}indexOf(t,n){let r=Pt(t),i=Pt(n);if(Number.isNaN(r)||Number.isNaN(i))return Number.NaN;let o=this.nthFrom(i,0);return o>=r?this.count(r,o):-this.count(o,r)}dateAt(t,n){let r=Pt(t),i=Math.floor(n);return Number.isNaN(r)||!Number.isFinite(i)||Math.abs(i)>fF?new Date(Number.NaN):ol(i>=0?this.nthFrom(r,i):this.nthBefore(r,-i))}runs(t,n){let r=Pt(t),i=Pt(n);if(Number.isNaN(r)||Number.isNaN(i)||r>=i)return[];let o=[],s=this.isNonWorking(r)?this.nthBefore(r,1)+1:this.nextNonWorking(r,i);for(;s<i;){let a=this.nthFrom(s,0)-1;o.push({from:ol(s),through:ol(a),titles:this.titlesIn(s,a)}),s=this.nextNonWorking(a+1,i)}return o}pieceAt(t){return pk(this.pieces,t)}isNonWorking(t){return hk(this.pieces,t)}count(t,n){let r=0;for(let i=this.pieceAt(t);i<this.pieces.length&&this.pieces[i].start<n;i++){let o=this.pieces[i];r+=Bg(o,Math.max(t,o.start),Math.min(n,o.end))}return r}nthFrom(t,n){let r=t,i=n;for(let o=this.pieceAt(t);o<this.pieces.length;o++){let s=this.pieces[o];if(s.end===1/0)return tk(s,r,i);let a=Bg(s,r,s.end);if(i<a)return tk(s,r,i);i-=a,r=s.end}throw new Error("working calendar: forward walk left the last piece (internal error)")}nthBefore(t,n){let r=t,i=n;for(let o=this.pieceAt(t-1);o>=0;o--){let s=this.pieces[o];if(s.start===-1/0)return nk(s,r,i);let a=Bg(s,s.start,r);if(i<=a)return nk(s,r,i);i-=a,r=s.start}throw new Error("working calendar: backward walk left the first piece (internal error)")}nextNonWorking(t,n){for(let r=this.pieceAt(t);r<this.pieces.length&&this.pieces[r].start<n;r++){let i=this.pieces[r],o=Math.max(t,i.start);if(i.kind==="non-working")return o;if(!(i.kind!=="mask"||i.workingPerWeek===ze)){for(let s=0;s<ze&&o+s<i.end;s++)if(i.off[sl(o+s)])return o+s}}return n}titlesIn(t,n){let r=[];for(let i of this.titled)i.spans.some(o=>o.start<=n&&o.end>t)&&r.push(i.title);return r}};function qf(e,t){let n=qA(e,t.config.calendar),r=kF(n,t.config.calendarDeclarations);try{return{config:n,working:Ug(n,r)}}catch(i){if(!(i instanceof RangeError))throw i;return{config:n,working:Ug(n)}}}function kF(e,t){let n=zf(t)?[]:Xg(e.mode);for(let r of t){let i=IF(r);i&&n.push(i)}return n.sort(RF)}function IF(e){let t=Ja(e);if(!t.wellFormed)return;let n={working:e.$type==="WorkingDeclaration"};return e.name&&(n.id=e.name),e.title!==void 0&&(n.title=e.title),t.dates&&(n.dates=t.dates.map(Gg)),t.start&&(n.start=Gg(t.start)),t.end&&(n.end=Gg(t.end)),t.weekdays&&(n.every=new Set(t.weekdays)),n}function Gg(e){return Te(e)}function RF(e,t){return ds(mk(e),mk(t))||ds(e.title,t.title)||ds(e.id,t.id)||Number(e.working)-Number(t.working)||ds(gk(e),gk(t))||ds(e.start?.getTime(),t.start?.getTime())||ds(e.end?.getTime(),t.end?.getTime())||SF(e.dates??[],t.dates??[])}function mk(e){return e.dates?Math.min(...e.dates.map(t=>t.getTime())):e.start?.getTime()}function gk(e){if(!e.every)return;let t=0;for(let n of e.every)t|=1<<n;return t}function ds(e,t){return e===t?0:e===void 0?-1:t===void 0?1:e<t?-1:1}function SF(e,t){let n=e.map(i=>i.getTime()).sort((i,o)=>i-o),r=t.map(i=>i.getTime()).sort((i,o)=>i-o);for(let i=0;i<Math.min(n.length,r.length);i++)if(n[i]!==r[i])return n[i]-r[i];return n.length-r.length}function yk(e){let{naturalPixelsPerDay:t,dayCount:n,chromeWidth:r,maxWidth:i}=e;if(i===void 0||r+n*t<=i)return t;let o=(i-r)/n,s=Math.min(t,1);return Math.max(s,o)}var Fn=12,Bn=6,Zf=20,_i=38,Or=13,al=11,ll=16,Hg=2;function Jf(e){return _i+(Math.max(1,e)-1)*ll}function Qf(e,t){return t?Jf(e):Zf+(Math.max(1,e)-1)*ll}function zg(e,t){return Math.max(0,Qf(e,t)-_i)}var Ai=12,jg=12,Pr=5,ps=22,Yg=14,cl=10,Ut=8,Cr=14,ki=6,xk=4;function hs(e,t){let n=Fn;if(e){let r=ki+Cr+xk-Fn;n=Fn+Math.max(0,r)}if(t&&!qg(t.barWidth)){let r=Zg(0,e)+pt;n=Math.max(n,r+Xt)}return n}var Xt=4,$r=2*Ai,Vg=ki+Cr+Xt+Ai+Pr,ms=ps+1;function ed(e){let t=e.barRightX+Bn,n=!1,r=null;e.iconSpills&&(r=t,t=r+Cr,n=!0);let i=null;e.captionWidth!==null&&(n&&(t+=Xt),i=t,t+=e.captionWidth,n=!0);let o=null;e.footnoteCount>0&&(n&&(t+=Xt),o=t,t+=e.footnoteCount*Ut,n=!0);let s=null;return e.dotSpills&&(n&&(t+=Xt),s=t+Pr,t=s+Pr),{iconSpillX:r,captionX:i,footnoteSpillStartX:o,dotSpillCx:s,rightX:t}}var pt=12,ul=6,Kg=6,Ek=5,nn=Xt,wk=ul+pt+nn+pt+Kg;function qg(e){return e<wk}function Zg(e,t){return t?e+ki+Cr+nn:e+ul}function Jg(e,t){let n;return t>0?n=e-ps-(t-1)*Ut-nn:n=e-Ai-Pr-nn,n-pt}function fl(e){let{barWidth:t,footnoteLabels:n,hasBeforeGlyph:r}=e,i=Number.POSITIVE_INFINITY;t>=$r&&(i=Math.min(i,-(Ai+Pr)));let o=n.length;if(o>0&&t>=ms)for(let a=0;a<o;a+=1){let c=-ps-(o-1-a)*Ut-se(n[a],cl);i=Math.min(i,c)}return r&&t>=wk&&(i=Math.min(i,Jg(0,o))),Math.max(Fn,-i+Xt)}var Dr=13,Wn=3,Xn=4,bF=4,td=Dr+bF,NF=.25;function Tk(e,t){if(e.length===0)return{rows:[[]],expanded:!1};let n=[[]],r=0,i=t,o=!1;for(let s of e){let a=n[n.length-1],l=(a.length===0?0:Xn)+s.width,c=r+l;if(c<=i){a.push(s),r=c;continue}if(a.length===0){a.push(s),r=s.width;continue}let u=c-i,f=s.width*NF;if(!o&&u<=f){a.push(s),r=c,i=c,o=!0;continue}n.push([s]),r=s.width,i=t}return{rows:n,expanded:o}}var vk={none:0,xs:2,sm:4,md:8,lg:16,xl:24},_k={none:0,xs:4,sm:8,md:12,lg:20,xl:32},Ii={none:0,xs:10,sm:12,md:14,lg:18,xl:24},Ri={none:0,xs:2,sm:4,md:8,lg:12,xl:20,full:9999},Qg={xs:18,sm:24,md:36,lg:48,xl:72},ey=1,rn=4,dl={none:0,xs:16,sm:20,md:24,lg:32,xl:40},Ak=dl.md;function pl(e){return Math.round(e/2+3)}var LF=pl(Ak),Si=10,hl=22,ml=15,gl="6 4",ty=36,Gt=16,ny=Gt/2,yl=10,ry=Gt-4,gs=6,nd=2.25,kk=1,It=12,Ik=32,Rk=120,iy=240,oy=72,rd=28,Ht=16,sy=22,ys=18,id="Powered by",ay="https://nowline.io",xl=.22,Mr=40,od=32,Sk=.58,PF=id.length*od*Sk,OF=10,El=PF+OF,ly=El+74,cy=5,sd=El+81,CF=3*Mr*Sk,$F=sd+CF,DF=12+Mr,uy=$F*xl,bk=DF*xl,ad=4;var fy={sans:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',serif:'Georgia, "Times New Roman", serif',mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},Nk={days:7,weeks:4,months:3,quarters:4,years:5},dy=.1,py=20,hy=2,my="2 2",gy=.13,yy=6,xy=2,Ey=.12,wl=.25,Un=10,ld=14,cd=8,Gn=6,xs=2,ud=3,bi=.5,fd=18,dd=10,wy=6,Ty=11;var Lk=18,Tl=13,pd=Ii.xs,vy=10,Pk=6,Ok=6,_y=.12,Ay=.06,ky=2;function hd(e){return e.drawn?{header:e.hasTitle||e.hasPins||e.hasBracket?Lk:0,pad:Pk}:{header:0,pad:0}}function Es(e,t){return t?e+pt+nn:e}function Iy(e){return e.length*pd*.58}function ws(e){if(e.kind==="item")return Number.NEGATIVE_INFINITY;let t=Number.NEGATIVE_INFINITY,n=e.inlineDatePins??[];for(let r of n)t=Math.max(t,r.glyphTopLeft.x+r.glyphSize);if(e.title&&e.headerHeight>0){let r=n.some(i=>i.side==="after");t=Math.max(t,Es(e.box.x,r)+Iy(e.title))}return t}function MF(e,t){return e.endX-Math.min(t/2,(e.endX-e.startX)/2)}function FF(e,t){return e.startX+Math.min(t/2,(e.endX-e.startX)/2)}function Ts(e){return e<3?{headWidth:3,head:"dot"}:{headWidth:Math.min(7,e),head:"arrow"}}var Ry=(e,t,n)=>e>=t-.01&&e<=n+.01;function BF(e,t){return t.rowY===void 0||!Ry(t.rowY,e.top,e.bottom)?!1:e.rowY===void 0||Ry(e.rowY,t.top,t.bottom)}function WF(e,t,n,r,i){let o=[];for(let l of e){if(l.x>=n+1||l.x+l.width<=t-1)continue;let c=l.y-1,u=l.y+l.height+1;u<=r||c>=i||o.push([Math.max(r,c),Math.min(i,u)])}o.sort((l,c)=>l[0]-c[0]);let s=[],a=r;for(let[l,c]of o)l-a>=2&&s.push([a,l]),a=Math.max(a,c);return i-a>=2&&s.push([a,i]),s}function Ck(e,t,n,r){let i=Math.min(n,r),o=Math.max(n,r),s=0;for(let a of e)Math.abs(a.x-t)>1||a.bottom<=i||a.top>=o||s++;return s}function $k(e,t,n,r){let i=Math.min(n,r),o=Math.max(n,r),s=0;for(let a of e)a.height<=0||t<=a.x||t>=a.x+a.width||a.y+a.height<=i||a.y>=o||s++;return s}function XF(e,t,n,r){let i=Math.min(e.x,t.x),o=Math.max(e.x,t.x),s=Math.min(e.y,t.y),a=Math.max(e.y,t.y),l=null;for(let f of WF(r.blocks,i,o,s,a)){let d=(f[0]+f[1])/2,p=[Ck(r.edges,e.x,e.y,d)+Ck(r.edges,t.x,d,t.y),$k(r.blocks,e.x,e.y,d)+$k(r.blocks,t.x,d,t.y),Math.abs(d-e.y)];(!l||UF(p,l.key))&&(l={gap:f,centre:d,key:p})}if(l)return{gap:l.gap,centre:l.centre};let c=Math.min(4,(a-s)/2),u=e.y+n*c;return{gap:[s,a],centre:u}}function UF(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1}function GF(e,t){let n=[0];for(let r=1;r*2.5<=t+.01;r++)n.push(-e*r*2.5,e*r*2.5);return n}function HF(e){let t=[],n=new Map,r=[...e].sort((i,o)=>i.centre-o.centre||i.xLo-o.xLo||i.index-o.index);for(let i of r){let[o,s]=i.gap,a=t.find(c=>c.bundle===i.bundle&&c.y>=o-.01&&c.y<=s+.01),l=i.centre;if(a)l=a.y;else{let c=GF(i.dir,(s-o)/2),u=Number.POSITIVE_INFINITY;for(let f of c){let d=i.centre+f,p=t.filter(m=>m.bundle!==i.bundle&&Math.abs(m.y-d)<2.5-.01&&m.xLo<i.xHi+1&&m.xHi>i.xLo-1).length;if(p<u&&(u=p,l=d),p===0)break}}t.push({y:l,xLo:i.xLo,xHi:i.xHi,bundle:i.bundle}),n.set(i.index,l)}return n}function Dk(e,t,n){let r=new Array(e.length).fill(null),i=[];e.forEach((s,a)=>{let{source:l,target:c}=s,u=c.startX-l.endX>.01;if(BF(l,c)&&c.startX>=l.endX-.01){if(!u)return;let y=l.exitY!==void 0&&Ry(l.exitY,c.top,c.bottom)?l.exitY:c.rowY??0;r[a]={fromId:s.fromId,toId:s.toId,waypoints:[{x:l.endX,y},{x:c.paintedX,y}],slack:!0,...Ts(c.bottom-c.top)};return}let f=MF(l,n),d=FF(c,n),p,m,g;if(c.top>=l.bottom-.01)g=1,p={x:f,y:l.bottom},m={x:d,y:c.top};else if(c.bottom<=l.top+.01)g=-1,p={x:f,y:l.top},m={x:d,y:c.bottom};else{let y=Math.max(l.bottom,c.bottom)+4;r[a]={fromId:s.fromId,toId:s.toId,waypoints:[{x:f,y:l.bottom},{x:f,y},{x:d,y},{x:d,y:c.bottom}],slack:u,...Ts(c.paintedWidth)};return}if(Math.abs(f-d)<.01){r[a]={fromId:s.fromId,toId:s.toId,waypoints:[p,m],slack:u,...Ts(c.paintedWidth)};return}let{gap:E,centre:x}=XF(p,m,g,t);i.push({index:a,req:s,from:p,to:m,dir:g,gap:E,centre:x,xLo:Math.min(f,d),xHi:Math.max(f,d),bundle:`${Math.round(d*100)}:${g}`})});let o=HF(i);for(let s of i){let a=o.get(s.index)??s.centre,l=s.req.target.startX-s.req.source.endX>.01;r[s.index]={fromId:s.req.fromId,toId:s.req.toId,waypoints:[s.from,{x:s.from.x,y:a},{x:s.to.x,y:a},s.to],slack:l,...Ts(s.req.target.paintedWidth)}}return r}var zF=new Set(" ijlI.,:;!'|`"),jF=new Set('frt()[]{}/\\1-_"'),YF=new Set("mwMW@%"),VF=.95;function Mk(e){let t=0;for(let n of e)zF.has(n)?t+=.28:jF.has(n)?t+=.4:YF.has(n)?t+=.9:/[A-Z0-9]/.test(n)?t+=.7:t+=.6;return t}function Fk(e){return Mk(e)*12}function Bk(e){return Mk(e)*10*VF}var vl=10,Sy=3,md=6,Wk=12,Xk=12,Uk=56,Gk=10;function by(e,t,n,r=0,i=0){let o=e+Gk,s=o+Wk,a=Fk(t),l=s+a,c=0,u=0,f=0;n&&(c=vl+Sy+Bk(n),u=l+md,f=u+vl+Sy,l=u+c);let d=0;r>0&&(d=l+md,l=d+r);let p=0;i>0&&(p=l+md+i,l=p);let m=l-o+Xk,g=Math.max(Uk,m);return{titleTextWidth:a,ownerTextWidth:c,capacityBadgeWidth:r,footnoteIndicatorWidth:i,titleX:s,ownerX:u,ownerTextX:f,badgeX:d,footnoteRightX:p,tabX:o,tabW:g,rightX:o+g}}function gd(e){let t=ie(e.roadmapDecl?.properties??[],"logo");return t||void 0}function qF(e){let t=ie(e.roadmapDecl?.properties??[],"logo-size");return t!==void 0&&t in Qg?t:"md"}function Hk(e,t){let n=e.width/e.height,r=Qg[t],i=r*n;return i>160&&(i=160,r=i/n),{width:i,height:r}}function zk(e,t){let n=gd(e);if(!(!n||!t)&&t.width>0&&t.height>0&&!(!Number.isFinite(t.width)||!Number.isFinite(t.height)))return{...Hk(t,qF(e)),assetRef:n,intrinsic:t}}function _l(e,t,n){let r=e+24,i=r+10,o=t.length*6,s=Math.max(60,o+10+10),a=r+s+6,l=a+18,c=0,u=0,f=0,d=0,p=l;return n&&(u=l+6,c=n.length*5.5,f=u-3,d=c+6,p=f+d),{labelTextWidth:o,sourceTextWidth:c,tabX:r,tabWidth:s,tabLabelX:i,badgeX:a,badgeSize:18,sourceHaloX:f,sourceHaloWidth:d,sourceTextX:u,chromeRightX:p}}var jk="lexing-error",Yk="parsing-error";function Vk(e){if(!e||typeof e!="object")return!1;let t=e.code;return t===jk||t===Yk}function Ni(e){let t=[];for(let n of e.parseResult.lexerErrors)t.push({origin:"lexer",error:n});for(let n of e.parseResult.parserErrors)t.push({origin:"parser",error:n});for(let n of e.diagnostics??[]){let r=n;Vk(r.data)||t.push({origin:"validation",diagnostic:r})}return t}var ZF=/did you mean ['"]?([^'"?]+)['"]?\??/i;function Kk(e){let t=e.match(ZF);return t?t[1].trim():void 0}var JF={"NL.W0700":e=>e.suggested||void 0,"NL.E1101":e=>"suggestion"in e?e.suggestion?.id:void 0};function QF(e,t){let n=JF[e];return n?.(...t)}function yd(e,t){let n=Ny(t);return n===void 0?Kk(e):QF(n,t.args)}function xd(e){let t=e.toLowerCase();return t.includes("duplicate identifier")?"duplicate-identifier":t.includes("unknown reference")||t.includes("did you mean")?"unknown-reference":t.includes("circular")?"circular-dependency":t.includes("requires")&&t.includes("date:")?"missing-date":t.includes("duration")?"duration":t.includes("include")?"include":t.includes("indent")?"indentation":"validation"}function Ny(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.code=="string"&&Array.isArray(t.args))return t.code}function Ly(e){let t=Ny(e.data);return t||(typeof e.code=="string"&&e.code!==""?e.code:typeof e.code=="number"?String(e.code):xd(e.message))}var qk,Zk=()=>qk??(qk=_A(`{
130
130
  "$type": "Grammar",
131
131
  "isDeclared": true,
132
132
  "name": "Nowline",
@@ -2913,9 +2913,9 @@ ${n}`),this.inline?`{${i}}`:i}};function KM(e,t,n){if(e==="linkplain"||e==="link
2913
2913
  "imports": [],
2914
2914
  "interfaces": [],
2915
2915
  "types": []
2916
- }`));var JF={languageId:"nowline",fileExtensions:[".nowline"],caseInsensitive:!1,mode:"development"},qk={AstReflection:()=>new Ha},Zk={Grammar:()=>Kk(),LanguageMetaData:()=>JF,parser:{}};var Jk={item:"an item",group:"a group",parallel:"a parallel block",swimlane:"a swimlane",anchor:"an anchor",milestone:"a milestone","floating-milestone":"a milestone without a date",wave:"a wave",label:"a label",size:"a size",status:"a status",person:"a person",team:"a team",footnote:"a footnote",roadmap:"the roadmap",style:"a style",symbol:"a symbol"},QF={item:"item",group:"group",parallel:"parallel block",swimlane:"swimlane",anchor:"anchor",milestone:"milestone","floating-milestone":"milestone",wave:"wave",label:"label",size:"size",status:"status",person:"person",team:"team",footnote:"footnote",roadmap:"roadmap",style:"style",symbol:"symbol"},Ny=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ts(e){return e.kind==="parallel-block"?`the parallel block on line ${e.line}`:e.kind==="group-block"?`the group on line ${e.line}`:`${e.kind} "${e.name}"`}function Qk(e){return e.name||e.line===void 0?`"${e.name}"`:Ts({kind:e.kind==="parallel"?"parallel-block":"group-block",line:e.line})}function Ly(e,t=!0){if(e.name)return`${e.kind} "${e.name}"`;let n=e.kind==="parallel"?"parallel block":e.kind,r=t?"the ":"";return e.line===void 0?`${r}${n}`:`${r}${n} on line ${e.line}`}function eI(e){return e.name?`${Ny(e.kind)} "${e.name}"`:Ny(Ly(e))}function tI(e){return e===null?"has no start floor":`opens no earlier than ${e}`}function nI(e){return e?e.title===void 0?` Did you mean wave:${e.id}?`:` Did you mean wave:${e.id} ("${e.title}")?`:""}function e2(e){let t=e.slice(0,5).map(r=>`"${r}"`),n=e.length-t.length;return n>0?`${t.join(", ")} and ${n} more`:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function yd(e){return`[${e.join(", ")}]`}var rI={"NL.E0001":()=>"Config section must appear before roadmap.","NL.E0002":()=>"Include declarations must appear before the config section.","NL.E0003":()=>"Include declarations must appear before the roadmap section.","NL.E0004":()=>"At least one swimlane is required.","NL.E0005":e=>`Line ${e.line}: mixed tabs and spaces in indentation. Use either tabs or spaces consistently.`,"NL.E0100":e=>`Invalid version format "${e.version}". Expected format: v1, v2, etc.`,"NL.E0101":e=>`This file requires Nowline ${e.version}, but the parser only supports up to ${e.supported}.`,"NL.E0102":e=>`Unknown directive property "${e.key}". Allowed: ${e.allowed}.`,"NL.E0103":e=>`Duplicate directive property "${e.key}".`,"NL.E0104":e=>`Invalid locale "${e.value}". Use a BCP-47 tag like "en-US", "fr", or "fr-CA".`,"NL.E0200":e=>`Invalid include mode "${e.value}". Must be merge, ignore, or isolate.`,"NL.E0201":e=>`Duplicate "${e.key}" option on include.`,"NL.E0202":e=>{switch(e.reason){case"mismatch":return`Included "${e.path}" declares waves ${yd(e.child)}, but this file's waves are ${yd(e.parent)}. Every included roadmap must declare the same waves in the same order: copy this file's wave lines into "${e.path}".`;case"child-none":return`Included "${e.path}" declares no waves, but this file's waves are ${yd(e.parent)}. Copy this file's wave lines into "${e.path}" so its work joins the waves.`;case"parent-none":return`Included "${e.path}" declares waves ${yd(e.child)}, but this file declares none. Declare the same waves here so the barriers apply to the whole roadmap.`;case"floor":return`Wave "${e.id}" in "${e.path}" ${tI(e.childFloor)}, but this file's wave "${e.id}" ${tI(e.parentFloor)}. A wave must have the same start floor in every included roadmap.`}},"NL.E0203":e=>{switch(e.reason){case"not-found":return`Cannot read include "${e.path}": file not found.`;case"is-directory":return`Cannot read include "${e.path}": it is a directory.`;case"permission-denied":return`Cannot read include "${e.path}": permission denied.`;case"not-nowline":return`Cannot read include "${e.path}": only .nowline files can be included.`;case"unreadable":return e.detail?`Cannot read include "${e.path}": ${e.detail}`:`Cannot read include "${e.path}".`}},"NL.E0204":e=>`Circular include: "${e.path}" is already being included (${e.chain}).`,"NL.E0205":e=>`Duplicate include "${e.path}". Include each file once.`,"NL.E0206":e=>`Cannot isolate "${e.path}": it has no roadmap declaration.`,"NL.E0207":e=>e.parentStart&&e.childStart?`Included "${e.path}" declares start:${e.childStart}, which doesn't match this file's start:${e.parentStart}. Both files must declare the same start date, or neither should.`:e.parentStart?`Included "${e.path}" has no start:, but this file declares start:${e.parentStart}. Both files must declare the same start date, or neither should.`:`Included "${e.path}" declares start:${e.childStart}, but this file has no start:. Both files must declare the same start date, or neither should.`,"NL.E0208":e=>{switch(e.reason){case"absolute":return`Include "${e.path}" is an absolute path. With an include root, an include must be a relative path inside it.`;case"parent":return`Include "${e.path}" resolves outside the include root.`;case"symlink":return`Include "${e.path}" resolves outside the include root through a symbolic link.`}},"NL.E0209":e=>`Includes are not supported in this context: "${e.path}" was not read.`,"NL.E0210":e=>`Include "${e.path}" is more than ${e.max} includes deep. Flatten the include chain.`,"NL.E0300":e=>`Duplicate identifier "${e.name}". First declared at ${e.location}.`,"NL.E0301":e=>`${e.type} must have an identifier, a title, or both.`,"NL.E0302":e=>`${e.key}: reference "${e.value}" does not resolve to any declared entity in this file.`,"NL.E0400":e=>`Invalid duration "${e.value}". Use a raw duration literal like 0.5d, 2w, 1m, 2q. Use "size:NAME" to reference a declared size.`,"NL.E0401":e=>`Invalid size "${e.value}". Use the id of a declared size (e.g. xs, m, lg).`,"NL.E0402":e=>`Invalid effort "${e.value}". Use a raw duration literal like 0.5d, 2w, 1m, 2q.`,"NL.E0403":e=>`Invalid remaining value "${e.value}". Use a percentage like 30% or a duration literal like 1w, 0.5d.`,"NL.E0404":e=>`Remaining must be between 0% and 100%, got ${e.value}.`,"NL.E0405":e=>`Invalid ${e.key} "${e.value}". Use ISO 8601 format: YYYY-MM-DD.`,"NL.E0406":e=>`Invalid scale "${e.value}". Use a raw duration literal like 1w, 2w, 1q (no name lookup).`,"NL.E0407":e=>`Invalid calendar "${e.value}". Must be business, full, or custom.`,"NL.E0408":e=>`Property "${e.key}" requires at least one reference.`,"NL.E0410":e=>`"${e.key}:" accepts at most one inline date per direction; collapse the multiple dates to a single binding date or use a declared anchor.`,"NL.E0411":e=>`Inline date in "${e.key}:" is not allowed on ${e.type}. Allowed only on item, parallel, and group, and on a wave's after:; for a milestone use "date:" instead.`,"NL.E0412":e=>`Inline date "${e.date}" in "${e.key}:" requires the roadmap to declare "start:". Add start:YYYY-MM-DD to the roadmap.`,"NL.E0413":e=>`Inline date "${e.date}" in "${e.key}:" is before roadmap start ${e.start}.`,"NL.E0500":e=>`Anchor "${e.name}" requires a "date:" property.`,"NL.E0501":e=>`Anchor "${e.name}" has a date but the roadmap is missing "start:". Add start:YYYY-MM-DD to the roadmap.`,"NL.E0502":e=>`Anchor "${e.name}" date ${e.date} is before roadmap start ${e.start}.`,"NL.E0503":e=>`Milestone "${e.name}" requires at least one of "date:" or "after:".`,"NL.E0504":e=>`Milestone "${e.name}" date ${e.date} is before roadmap start ${e.start}.`,"NL.E0505":()=>'Footnote requires an "on:" property referencing one or more entities.',"NL.E0600":e=>`Item "${e.name}" requires a "size:" or "duration:" property.`,"NL.E0800":e=>`Invalid non-working value "${e.value}". Use hide or show.`,"NL.E0801":e=>`Invalid color "${e.value}" for "${e.key}". Use a named color, hex value, or "none".`,"NL.E0802":e=>`Invalid value "${e.value}" for "${e.key}". Allowed: ${e.allowed}.`,"NL.E0803":e=>`Unknown style property "${e.key}".`,"NL.E0804":e=>`Raw style property "${e.key}" is not allowed on ${e.entity}. Declare a named style in config and reference it via "style:id".`,"NL.E0805":e=>`Symbol id "${e.name}" collides with a built-in icon name. Reserved built-ins: ${e.builtins}.`,"NL.E0806":e=>`Symbol "${e.name}" requires a "unicode:" property (e.g. unicode:"\u{1F4B0}" or unicode:"\\u{1F464}").`,"NL.E0807":e=>`Symbol "${e.name}" unicode: must be a non-empty value.`,"NL.E0808":e=>`Symbol "${e.name}" ascii: must be 1-3 ASCII characters (got ${e.length} character${e.length===1?"":"s"}).`,"NL.E0809":e=>`Unknown symbol property "${e.key}". Allowed: unicode, ascii, link, description.`,"NL.E0810":e=>`Duplicate symbol id "${e.name}". First declared at ${e.location}.`,"NL.E0811":e=>`${e.key}: "${e.value}" is neither a built-in (${e.builtins}) nor a declared symbol. Add "symbol ${e.value} unicode:..." earlier in config or use a quoted Unicode literal.`,"NL.E0812":e=>`${e.key}: symbol "${e.value}" is referenced before its declaration. Move "symbol ${e.value}" above this entry.`,"NL.E0900":e=>`A ${e.kind} declaration takes date:, or start: and end:, or every: with optional start: and end:.`,"NL.E0901":e=>`Unknown ${e.kind} property "${e.key}". Allowed: date, start, end, every.`,"NL.E0902":e=>`${e.key}: on a ${e.kind} declaration takes one date, not a list.`,"NL.E0903":e=>`end: ${e.end} is before start: ${e.start}.`,"NL.E0904":e=>`Invalid weekday "${e.value}". Use sun, mon, tue, wed, thu, fri or sat.`,"NL.E0905":e=>`Weekday "${e.value}" is listed more than once.`,"NL.E0906":()=>"This leaves no working day in the week with no end date. Keep at least one weekday working.","NL.E0907":e=>`Duplicate ${e.kind} id "${e.name}".`,"NL.W0700":e=>`Unknown property "${e.key}" on ${e.entity}. The renderer ignores it.${e.suggested?` Did you mean "${e.suggested}"?`:""}`,"NL.W0701":e=>`Wave "${e.id}" in "${e.path}" differs from this file's definition (${e.fields.map(t=>`${t.field} ${t.there===""?"none":`"${t.there}"`} there, ${t.here===""?"none":`"${t.here}"`} here`).join("; ")}); this file's definition is used.`,"NL.W0702":e=>`"wave:" on ${e.target.kind==="default"?`"default ${e.target.entityType}"`:!e.target.name&&e.target.line!==void 0?`the ${e.target.kind==="parallel"?"parallel block":e.target.kind} on line ${e.target.line}`:`${e.target.kind} "${e.target.name}"`} is ignored: this roadmap declares no waves. Declare waves with "wave <id>" to use it, or remove the property.`,"NL.W0703":e=>`"${e.key}" on "default ${e.entityType}" is ignored: it is a roadmap-only style key. Set it on "default roadmap" instead.`,"NL.W0704":e=>`"timeline-position:${e.position}" draws no dates: "header-height:none" removes every timeline date strip. Set header-height to xs, sm, md, lg or xl to show them.`,"NL.W0705":e=>`days-per-week is ${e.daysPerWeek}, but the week leaves ${e.working} working days.`,"NL.E1100":e=>`Wave ${e.title===void 0?`on line ${e.line}`:`"${e.title}"`} needs an explicit identifier so work can reference it with wave:<id>, e.g. wave build "Build".`,"NL.E1101":e=>{switch(e.reason){case"list":return`"wave:" takes exactly one wave id; an item belongs to at most one wave. Got "${e.value}".`;case"unknown":return`Wave "${e.value}" is not declared. Declared waves: ${e.declared.length>0?e.declared.join(", "):"none"}. Add "wave ${e.value}" above the first swimlane that uses it.${nI(e.suggestion)}`;case"forward":return`Wave "${e.value}" is used before its declaration on line ${e.line}. Declare waves above the swimlanes that use them.`;case"not-a-wave":return`"wave:" must name a wave, but "${e.value}" is ${Jk[e.kind]}.${nI(e.suggestion)}`}},"NL.E1102":e=>`${Ny(Ly(e.entity))} has wave:${e.wave}, but its enclosing ${Ly(e.container,!1)} has wave:${e.containerWave}. A container's wave applies to everything inside it; remove one of the two wave: properties.`,"NL.E1103":e=>{switch(e.reason){case"sequence":{let t=e.items.length>1,n=`${t?"Items":"Item"} ${e.items.map(i=>`"${i}"`).join(", ")} (wave "${e.itemWave}")`,r=typeof e.ref=="string"?`"${e.ref}"`:Ts(e.ref);return`${n} ${t?"come":"comes"} after ${r} (wave "${e.refWave}") in ${Ts(e.flow)}. Work in a lane or group runs in order, so it must also be ordered by wave: move ${r} below "${e.last}", or change their waves.`}case"join":return`Item "${e.name}" (wave "${e.wave}") comes after ${Ts(e.block)} in ${Ts(e.flow)}, and that block cannot end before its track "${e.track}" (wave "${e.trackWave}") does. Move "${e.name}" above the block or into a track of its own, or change one of their waves.`;case"after-item":return e.container?`${eI(e.container)} has after:${e.refId}, but "${e.ref}" is in later wave "${e.refWave}". Wave "${e.refWave}" cannot start until wave "${e.wave}" ends, so "${e.name}" (wave "${e.wave}") inside it could never start: move "${e.name}" to wave "${e.refWave}" or later, or remove the after:.`:`Item "${e.name}" (wave "${e.wave}") has after:${e.refId}, but "${e.ref}" is in later wave "${e.refWave}". Wave "${e.refWave}" cannot start until wave "${e.wave}" ends, so "${e.name}" could never start: move it to wave "${e.refWave}" or later, or remove the after:.`;case"after-wave":return e.container?`${eI(e.container)} (wave "${e.wave}") has after:${e.refId}, but work cannot wait for the end of its own wave or a later one. Use an earlier wave, or move the ${e.container.kind} to a later wave.`:`Item "${e.name}" (wave "${e.wave}") has after:${e.refId}, but work cannot wait for the end of its own wave or a later one. Use an earlier wave, or move "${e.name}" to a later wave.`;case"chain":return`Item "${e.name}" (wave "${e.wave}") could never start: through ${e.chain.join(" \u2192 ")}, it waits for work that cannot start until wave "${e.wave}" has ended. Move "${e.name}" to a later wave, or break the chain.`}},"NL.E1104":e=>{switch(e.reason){case"swimlane":return`"wave:" is not allowed on swimlane "${e.name}": a swimlane spans every wave. Put wave: on its items, or wrap them in "group wave:${e.value}".`;case"milestone":return`"wave:" is not allowed on milestone "${e.name}". To place a milestone at the end of a wave, use after:${e.value}.`;case"other":return`"wave:" is not allowed on ${QF[e.type]} "${e.name}"; only item, group, and parallel can belong to a wave.`}},"NL.E1105":e=>e.reason==="before"?`"before:" is not allowed on wave "${e.name}". A wave's end comes from its items; to give a wave a deadline, add a dated milestone: milestone ${e.name}-due date:<YYYY-MM-DD> after:${e.name}.`:`"${e.key}:" is not allowed on wave "${e.name}". A wave's span comes from its items; only after: (an anchor, a dated milestone, or one ISO date) can hold back a wave's start.`,"NL.E1106":e=>`Wave "${e.name}" has after:${e.ref}, but "${e.ref}" is ${Jk[e.kind]}. A wave's after: accepts only anchors, dated milestones, or one ISO date; to make a wave wait for work, put that work in an earlier wave.`,"NL.W1000":e=>`Now-line date ${e.date} is outside the roadmap window (${e.start} \u2013 ${e.end}); it will not be drawn.`,"NL.W1002":e=>`Wave barriers did not settle after ${e.passes} layout passes, so the drawn schedule may not respect the wave order. The roadmap probably has an ordering conflict that validation did not catch.`,"NL.W1100":e=>{let t=Qk(e);return e.reason==="item"?`before:${e.ref} on ${t} can never be met: ${t} is in wave "${e.wave}", which cannot start until "${e.ref}" (wave "${e.refWave}") has finished. The overrun will be painted.`:`before:${e.ref} on ${t} can never be met: ${t} is in wave "${e.wave}", which cannot finish before wave "${e.ref}" starts. The overrun will be painted.`},"NL.W1101":e=>{let t=Qk(e);switch(e.reason){case"forward-lane":return`${e.key}:${e.ref} on ${t} refers to "${e.ref}", which is in a later swimlane ("${e.lane}"). Layout places swimlanes in order and ignores references to work it has not placed yet, so it ignores this ${e.key}:. Move swimlane "${e.lane}" above swimlane "${e.ownLane}", or remove the ${e.key}:.`;case"forward-flow":return`${e.key}:${e.ref} on ${t} refers to "${e.ref}", which comes later in ${Ts(e.flow)}. Layout ignores references to work it has not placed yet, so it ignores this ${e.key}:. Move "${e.ref}" above ${t}, or remove the ${e.key}:.`;case"ancestor":return`${e.key}:${e.ref} on ${t} refers to "${e.ref}", which contains it. Layout ignores references to an enclosing group or parallel, so it ignores this ${e.key}:. Remove the ${e.key}:.`;case"floating-milestone":return`${e.key}:${e.ref} on ${t} refers to milestone "${e.ref}", which has no date. Floating milestones are placed after all work, so layout ignores this ${e.key}:. Reference the milestone's predecessors or a wave instead.`}},"NL.I1000":e=>`Title on item "${e.name}" is wider than its bar at this scale; it rendered to the right of the bar.`,"NL.I1001":e=>`Label chips on item "${e.name}" did not fit inside the bar; they rendered in a spill column to the right.`,"NL.I1002":e=>`Item "${e.name}" is too narrow to show its marker at this scale; decorations spilled beside the bar.`,"NL.I1003":e=>e.anchor?`Item "${e.name}" extends past its "before:" anchor "${e.anchor}".`:`Item "${e.name}" extends past its "before:" anchor.`,"NL.I1004":e=>`Swimlane "${e.lane}" packed into ${e.rows} rows to avoid overlap.`,"NL.I1005":e=>`Swimlane "${e.lane}" is over capacity in one or more periods (red utilization band).`,"NL.I1006":e=>e.names.length===1?`Wave "${e.names[0]}" won't be displayed: it has no items assigned.`:`Waves ${e2(e.names)} won't be displayed: they have no items assigned.`,"NL.I1007":e=>`Milestone "${e.name}" (${e.date}) is overrun: wave "${e.wave}" ends ${e.end}.`,"NL.I1008":e=>`Item "${e.name}" is pinned to ${e.pin} (${e.key}:), a non-working day; it starts on ${e.start}.`};var H=e=>`\xAB\xA0${e}\xA0\xBB`,iI={item:"un \xE9l\xE9ment",group:"un groupe",parallel:"un bloc parall\xE8le",swimlane:"une swimlane",anchor:"une ancre",milestone:"un jalon","floating-milestone":"un jalon sans date",wave:"une vague",label:"une \xE9tiquette",size:"une taille",status:"un statut",person:"une personne",team:"une \xE9quipe",footnote:"une note de bas de page",roadmap:"la roadmap",style:"un style",symbol:"un symbole"},t2={item:"l'\xE9l\xE9ment",group:"le groupe",parallel:"le bloc parall\xE8le",swimlane:"la swimlane",anchor:"l'ancre",milestone:"le jalon","floating-milestone":"le jalon",wave:"la vague",label:"l'\xE9tiquette",size:"la taille",status:"le statut",person:"la personne",team:"l'\xE9quipe",footnote:"la note de bas de page",roadmap:"la roadmap",style:"le style",symbol:"le symbole"},Py=e=>e.charAt(0).toUpperCase()+e.slice(1);function vs(e){return e.kind==="parallel-block"?`le bloc parall\xE8le \xE0 la ligne ${e.line}`:e.kind==="group-block"?`le groupe \xE0 la ligne ${e.line}`:`${e.kind==="group"?"le groupe":e.kind==="parallel"?"le bloc parall\xE8le":"la swimlane"} ${H(e.name)}`}function Oy(e,t=!1){if(e.name||e.line===void 0)return t?`de ${H(e.name)}`:H(e.name);let n=vs({kind:e.kind==="parallel"?"parallel-block":"group-block",line:e.line});return t?`du ${n.slice(3)}`:n}function Cy(e){let t=e.kind==="item"?"\xE9l\xE9ment":e.kind==="group"?"groupe":"bloc parall\xE8le",n=e.kind==="item"?"l'":"le ";return e.name?`${n}${t} ${H(e.name)}`:e.line===void 0?`${n}${t}`:`${n}${t} \xE0 la ligne ${e.line}`}function oI(e){let t=e.kind==="parallel"?"le bloc parall\xE8le":"le groupe";return e.name?`${t} ${H(e.name)}`:e.line===void 0?t:`${t} \xE0 la ligne ${e.line}`}function sI(e){return e?e.title===void 0?` Vouliez-vous dire wave:${e.id}\xA0?`:` Vouliez-vous dire wave:${e.id} (${H(e.title)})\xA0?`:""}function n2(e){let t=e.slice(0,5).map(H),n=e.length-t.length;return n>0?`${t.join(", ")} et ${n} autre${n>1?"s":""}`:`${t.slice(0,-1).join(", ")} et ${t[t.length-1]}`}function xd(e){return`[${e.join(", ")}]`}function aI(e){return e===null?"n'a pas de borne de d\xE9part":`ne s'ouvre pas avant ${e}`}function lI(e){return e===""?"aucun":H(e)}var r2={title:"titre",style:"style",labels:"\xE9tiquettes",link:"lien",description:"description"},cI={"NL.E0001":()=>"La section config doit pr\xE9c\xE9der la section roadmap.","NL.E0002":()=>"Les d\xE9clarations include doivent pr\xE9c\xE9der la section config.","NL.E0003":()=>"Les d\xE9clarations include doivent pr\xE9c\xE9der la section roadmap.","NL.E0004":()=>"Au moins une swimlane est requise.","NL.E0005":e=>`Ligne ${e.line}\xA0: tabulations et espaces m\xE9lang\xE9s dans l'indentation. Utilisez l'un ou l'autre, mais pas les deux.`,"NL.E0100":e=>`Format de version invalide \xAB\xA0${e.version}\xA0\xBB. Format attendu\xA0: v1, v2, etc.`,"NL.E0101":e=>`Ce fichier requiert Nowline ${e.version}, mais l'analyseur ne prend en charge que jusqu'\xE0 ${e.supported}.`,"NL.E0102":e=>`Propri\xE9t\xE9 de directive inconnue \xAB\xA0${e.key}\xA0\xBB. Valeurs admises\xA0: ${e.allowed}.`,"NL.E0103":e=>`Propri\xE9t\xE9 de directive \xAB\xA0${e.key}\xA0\xBB en double.`,"NL.E0104":e=>`Locale invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez une \xE9tiquette BCP-47 telle que \xAB\xA0en-US\xA0\xBB, \xAB\xA0fr\xA0\xBB ou \xAB\xA0fr-CA\xA0\xBB.`,"NL.E0200":e=>`Mode d'include invalide \xAB\xA0${e.value}\xA0\xBB. Doit \xEAtre merge, ignore ou isolate.`,"NL.E0201":e=>`Option \xAB\xA0${e.key}\xA0\xBB en double sur include.`,"NL.E0202":e=>{switch(e.reason){case"mismatch":return`L'include ${H(e.path)} d\xE9clare les vagues ${xd(e.child)}, mais celles de ce fichier sont ${xd(e.parent)}. Chaque roadmap incluse doit d\xE9clarer les m\xEAmes vagues dans le m\xEAme ordre\xA0: copiez les lignes wave de ce fichier dans ${H(e.path)}.`;case"child-none":return`L'include ${H(e.path)} ne d\xE9clare aucune vague, mais celles de ce fichier sont ${xd(e.parent)}. Copiez les lignes wave de ce fichier dans ${H(e.path)} pour que son travail rejoigne les vagues.`;case"parent-none":return`L'include ${H(e.path)} d\xE9clare les vagues ${xd(e.child)}, mais ce fichier n'en d\xE9clare aucune. D\xE9clarez les m\xEAmes vagues ici pour que les barri\xE8res s'appliquent \xE0 toute la roadmap.`;case"floor":return`La vague ${H(e.id)} dans ${H(e.path)} ${aI(e.childFloor)}, mais la vague ${H(e.id)} de ce fichier ${aI(e.parentFloor)}. Une vague doit avoir la m\xEAme borne de d\xE9part dans chaque roadmap incluse.`}},"NL.E0203":e=>{switch(e.reason){case"not-found":return`Impossible de lire l'include ${H(e.path)}\xA0: fichier introuvable.`;case"is-directory":return`Impossible de lire l'include ${H(e.path)}\xA0: c'est un r\xE9pertoire.`;case"permission-denied":return`Impossible de lire l'include ${H(e.path)}\xA0: permission refus\xE9e.`;case"not-nowline":return`Impossible de lire l'include ${H(e.path)}\xA0: seuls les fichiers .nowline peuvent \xEAtre inclus.`;case"unreadable":return e.detail?`Impossible de lire l'include ${H(e.path)}\xA0: ${e.detail}`:`Impossible de lire l'include ${H(e.path)}.`}},"NL.E0204":e=>`Include circulaire\xA0: ${H(e.path)} est d\xE9j\xE0 en cours d'inclusion (${e.chain}).`,"NL.E0205":e=>`Include ${H(e.path)} en double. Incluez chaque fichier une seule fois.`,"NL.E0206":e=>`Impossible d'isoler ${H(e.path)}\xA0: il ne d\xE9clare aucune roadmap.`,"NL.E0207":e=>e.parentStart&&e.childStart?`L'include ${H(e.path)} d\xE9clare start:${e.childStart}, qui ne correspond pas au start:${e.parentStart} de ce fichier. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`:e.parentStart?`L'include ${H(e.path)} n'a pas de start:, mais ce fichier d\xE9clare start:${e.parentStart}. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`:`L'include ${H(e.path)} d\xE9clare start:${e.childStart}, mais ce fichier n'a pas de start:. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`,"NL.E0208":e=>{switch(e.reason){case"absolute":return`L'include ${H(e.path)} est un chemin absolu. Avec une racine d'include, un include doit \xEAtre un chemin relatif \xE0 l'int\xE9rieur de celle-ci.`;case"parent":return`L'include ${H(e.path)} se r\xE9sout hors de la racine d'include.`;case"symlink":return`L'include ${H(e.path)} se r\xE9sout hors de la racine d'include par un lien symbolique.`}},"NL.E0209":e=>`Les includes ne sont pas pris en charge dans ce contexte\xA0: ${H(e.path)} n'a pas \xE9t\xE9 lu.`,"NL.E0210":e=>`L'include ${H(e.path)} d\xE9passe ${e.max} niveaux d'inclusion. Aplatissez la cha\xEEne d'includes.`,"NL.E0300":e=>`Identifiant en double \xAB\xA0${e.name}\xA0\xBB. Premi\xE8re d\xE9claration \xE0 ${e.location}.`,"NL.E0301":e=>`${e.type} doit comporter un identifiant, un titre, ou les deux.`,"NL.E0302":e=>`La r\xE9f\xE9rence \xAB\xA0${e.value}\xA0\xBB de \xAB\xA0${e.key}:\xA0\xBB ne d\xE9signe aucune entit\xE9 d\xE9clar\xE9e dans ce fichier.`,"NL.E0400":e=>`Dur\xE9e invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un litt\xE9ral de dur\xE9e brut comme 0.5d, 2w, 1m, 2q. Utilisez \xAB\xA0size:NOM\xA0\xBB pour r\xE9f\xE9rencer une taille d\xE9clar\xE9e.`,"NL.E0401":e=>`Taille invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez l'identifiant d'une taille d\xE9clar\xE9e (p.\xA0ex. xs, m, lg).`,"NL.E0402":e=>`Effort invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un litt\xE9ral de dur\xE9e brut comme 0.5d, 2w, 1m, 2q.`,"NL.E0403":e=>`Valeur restante invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un pourcentage tel que 30% ou un litt\xE9ral de dur\xE9e comme 1w, 0.5d.`,"NL.E0404":e=>`La valeur restante doit \xEAtre comprise entre 0 % et 100 %, re\xE7u ${e.value}.`,"NL.E0405":e=>`${e.key} invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez le format ISO 8601\xA0: AAAA-MM-JJ.`,"NL.E0406":e=>`\xC9chelle invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un litt\xE9ral de dur\xE9e brut comme 1w, 2w, 1q (pas de recherche par nom).`,"NL.E0407":e=>`Calendrier invalide \xAB\xA0${e.value}\xA0\xBB. Doit \xEAtre business, full ou custom.`,"NL.E0408":e=>`La propri\xE9t\xE9 \xAB\xA0${e.key}\xA0\xBB exige au moins une r\xE9f\xE9rence.`,"NL.E0410":e=>`\xAB\xA0${e.key}:\xA0\xBB n'accepte qu'une seule date inline par direction\xA0; regroupez les dates en une seule date contraignante ou utilisez une ancre d\xE9clar\xE9e.`,"NL.E0411":e=>`Une date inline dans \xAB\xA0${e.key}:\xA0\xBB n'est pas autoris\xE9e sur ${e.type}. Autoris\xE9e seulement sur item, parallel et group, et sur le \xAB\xA0after:\xA0\xBB d'une vague\xA0; pour un milestone utilisez \xAB\xA0date:\xA0\xBB \xE0 la place.`,"NL.E0412":e=>`La date inline \xAB\xA0${e.date}\xA0\xBB dans \xAB\xA0${e.key}:\xA0\xBB exige que la roadmap d\xE9clare \xAB\xA0start:\xA0\xBB. Ajoutez start:AAAA-MM-JJ \xE0 la roadmap.`,"NL.E0413":e=>`La date inline \xAB\xA0${e.date}\xA0\xBB dans \xAB\xA0${e.key}:\xA0\xBB pr\xE9c\xE8de le d\xE9but de la roadmap (${e.start}).`,"NL.E0500":e=>`L'ancre \xAB\xA0${e.name}\xA0\xBB exige une propri\xE9t\xE9 \xAB\xA0date:\xA0\xBB.`,"NL.E0501":e=>`L'ancre \xAB\xA0${e.name}\xA0\xBB a une date, mais \xAB\xA0start:\xA0\xBB manque sur la roadmap. Ajoutez start:AAAA-MM-JJ \xE0 la roadmap.`,"NL.E0502":e=>`La date ${e.date} de l'ancre \xAB\xA0${e.name}\xA0\xBB pr\xE9c\xE8de le d\xE9but de la roadmap (${e.start}).`,"NL.E0503":e=>`Le jalon \xAB\xA0${e.name}\xA0\xBB exige au moins l'une des propri\xE9t\xE9s \xAB\xA0date:\xA0\xBB ou \xAB\xA0after:\xA0\xBB.`,"NL.E0504":e=>`La date ${e.date} du jalon \xAB\xA0${e.name}\xA0\xBB pr\xE9c\xE8de le d\xE9but de la roadmap (${e.start}).`,"NL.E0505":()=>"Une note de bas de page exige une propri\xE9t\xE9 \xAB\xA0on:\xA0\xBB r\xE9f\xE9ren\xE7ant au moins une entit\xE9.","NL.E0600":e=>`L'\xE9l\xE9ment \xAB\xA0${e.name}\xA0\xBB exige une propri\xE9t\xE9 \xAB\xA0size:\xA0\xBB ou \xAB\xA0duration:\xA0\xBB.`,"NL.E0800":e=>`Valeur non-working invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez hide ou show.`,"NL.E0801":e=>`Couleur invalide \xAB\xA0${e.value}\xA0\xBB pour \xAB\xA0${e.key}\xA0\xBB. Utilisez une couleur nomm\xE9e, une valeur hexad\xE9cimale ou \xAB\xA0none\xA0\xBB.`,"NL.E0802":e=>`Valeur invalide \xAB\xA0${e.value}\xA0\xBB pour \xAB\xA0${e.key}\xA0\xBB. Valeurs admises\xA0: ${e.allowed}.`,"NL.E0803":e=>`Propri\xE9t\xE9 de style inconnue \xAB\xA0${e.key}\xA0\xBB.`,"NL.E0804":e=>`La propri\xE9t\xE9 de style brute \xAB\xA0${e.key}\xA0\xBB n'est pas permise sur ${e.entity}. D\xE9clarez un style nomm\xE9 dans la config et r\xE9f\xE9rencez-le avec \xAB\xA0style:id\xA0\xBB.`,"NL.E0805":e=>`L'identifiant de symbole \xAB\xA0${e.name}\xA0\xBB entre en conflit avec le nom d'une ic\xF4ne int\xE9gr\xE9e. Noms r\xE9serv\xE9s\xA0: ${e.builtins}.`,"NL.E0806":e=>`Le symbole \xAB\xA0${e.name}\xA0\xBB exige une propri\xE9t\xE9 \xAB\xA0unicode:\xA0\xBB (p.\xA0ex. unicode:"\u{1F4B0}" ou unicode:"\\u{1F464}").`,"NL.E0807":e=>`La propri\xE9t\xE9 \xAB\xA0unicode:\xA0\xBB du symbole \xAB\xA0${e.name}\xA0\xBB doit avoir une valeur non vide.`,"NL.E0808":e=>`La propri\xE9t\xE9 \xAB\xA0ascii:\xA0\xBB du symbole \xAB\xA0${e.name}\xA0\xBB doit compter de 1 \xE0 3 caract\xE8res ASCII (re\xE7u\xA0: ${e.length} caract\xE8re${e.length>1?"s":""}).`,"NL.E0809":e=>`Propri\xE9t\xE9 de symbole inconnue \xAB\xA0${e.key}\xA0\xBB. Valeurs admises\xA0: unicode, ascii, link, description.`,"NL.E0810":e=>`Identifiant de symbole en double \xAB\xA0${e.name}\xA0\xBB. Premi\xE8re d\xE9claration \xE0 ${e.location}.`,"NL.E0811":e=>`${e.key}: \xAB\xA0${e.value}\xA0\xBB n'est ni une ic\xF4ne int\xE9gr\xE9e (${e.builtins}) ni un symbole d\xE9clar\xE9. Ajoutez \xAB\xA0symbol ${e.value} unicode:...\xA0\xBB plus haut dans la config ou utilisez un litt\xE9ral Unicode entre guillemets.`,"NL.E0812":e=>`${e.key}: le symbole \xAB\xA0${e.value}\xA0\xBB est r\xE9f\xE9renc\xE9 avant sa d\xE9claration. D\xE9placez \xAB\xA0symbol ${e.value}\xA0\xBB au-dessus de cette entr\xE9e.`,"NL.E0900":e=>`Une d\xE9claration ${e.kind} prend date:, ou start: et end:, ou every: avec start: et end: facultatifs.`,"NL.E0901":e=>`Propri\xE9t\xE9 ${e.kind} inconnue \xAB\xA0${e.key}\xA0\xBB. Autoris\xE9es\xA0: date, start, end, every.`,"NL.E0902":e=>`${e.key}: sur une d\xE9claration ${e.kind} prend une seule date, pas une liste.`,"NL.E0903":e=>`end: ${e.end} pr\xE9c\xE8de start: ${e.start}.`,"NL.E0904":e=>`Jour de semaine invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez sun, mon, tue, wed, thu, fri ou sat.`,"NL.E0905":e=>`Le jour \xAB\xA0${e.value}\xA0\xBB appara\xEEt plusieurs fois.`,"NL.E0906":()=>"Il ne reste aucun jour ouvr\xE9 dans la semaine sans date de fin. Gardez au moins un jour ouvr\xE9.","NL.E0907":e=>`Identifiant ${e.kind} \xAB\xA0${e.name}\xA0\xBB en double.`,"NL.W0700":e=>`Propri\xE9t\xE9 inconnue \xAB\xA0${e.key}\xA0\xBB sur ${e.entity}. Le moteur de rendu l'ignore.${e.suggested?` Vouliez-vous dire \xAB\xA0${e.suggested}\xA0\xBB\xA0?`:""}`,"NL.W0701":e=>`La vague ${H(e.id)} dans ${H(e.path)} diff\xE8re de la d\xE9finition de ce fichier (${e.fields.map(t=>`${r2[t.field]} ${lI(t.there)} l\xE0-bas, ${lI(t.here)} ici`).join("\xA0; ")})\xA0; la d\xE9finition de ce fichier est utilis\xE9e.`,"NL.W0702":e=>`\xAB\xA0wave:\xA0\xBB sur ${e.target.kind==="default"?H(`default ${e.target.entityType}`):!e.target.name&&e.target.line!==void 0?e.target.kind==="item"||e.target.kind==="group"||e.target.kind==="parallel"?Cy({kind:e.target.kind,name:"",line:e.target.line}):`${e.target.kind} \xE0 la ligne ${e.target.line}`:`${e.target.kind} ${H(e.target.name)}`} est ignor\xE9\xA0: cette roadmap ne d\xE9clare aucune vague. D\xE9clarez des vagues avec \xAB\xA0wave <id>\xA0\xBB pour l'utiliser, ou retirez la propri\xE9t\xE9.`,"NL.W0703":e=>`${H(e.key)} sur ${H(`default ${e.entityType}`)} est ignor\xE9\xA0: c'est une cl\xE9 de style propre \xE0 la roadmap. D\xE9finissez-la plut\xF4t sur \xAB\xA0default roadmap\xA0\xBB.`,"NL.W0704":e=>`${H(`timeline-position:${e.position}`)} n'affiche aucune date\xA0: ${H("header-height:none")} retire tous les bandeaux de dates de la frise. Donnez \xE0 header-height la valeur xs, sm, md, lg ou xl pour les afficher.`,"NL.W0705":e=>`days-per-week vaut ${e.daysPerWeek}, mais la semaine laisse ${e.working} jours ouvr\xE9s.`,"NL.E1100":e=>`La vague ${e.title===void 0?`\xE0 la ligne ${e.line}`:H(e.title)} exige un identifiant explicite pour que le travail puisse la r\xE9f\xE9rencer avec wave:<id>, p.\xA0ex. wave build "Build".`,"NL.E1101":e=>{switch(e.reason){case"list":return`\xAB\xA0wave:\xA0\xBB accepte exactement un identifiant de vague\xA0; un \xE9l\xE9ment appartient \xE0 une seule vague au plus. Re\xE7u ${H(e.value)}.`;case"unknown":return`La vague ${H(e.value)} n'est pas d\xE9clar\xE9e. Vagues d\xE9clar\xE9es\xA0: ${e.declared.length>0?e.declared.join(", "):"aucune"}. Ajoutez \xAB\xA0wave ${e.value}\xA0\xBB au-dessus de la premi\xE8re swimlane qui l'utilise.${sI(e.suggestion)}`;case"forward":return`La vague ${H(e.value)} est utilis\xE9e avant sa d\xE9claration \xE0 la ligne ${e.line}. D\xE9clarez les vagues au-dessus des swimlanes qui les utilisent.`;case"not-a-wave":return`\xAB\xA0wave:\xA0\xBB doit nommer une vague, mais ${H(e.value)} est ${iI[e.kind]}.${sI(e.suggestion)}`}},"NL.E1102":e=>`${Py(Cy(e.entity))} a wave:${e.wave}, mais ${Cy(e.container)} qui le contient a wave:${e.containerWave}. La vague d'un conteneur s'applique \xE0 tout ce qu'il contient\xA0; retirez l'une des deux propri\xE9t\xE9s wave:.`,"NL.E1103":e=>{switch(e.reason){case"sequence":{let t=e.items.length>1,n=`${t?"Les \xE9l\xE9ments":"L'\xE9l\xE9ment"} ${e.items.map(H).join(", ")} (vague ${H(e.itemWave)})`,r=typeof e.ref=="string"?H(e.ref):vs(e.ref);return`${n} ${t?"viennent":"vient"} apr\xE8s ${r} (vague ${H(e.refWave)}) dans ${vs(e.flow)}. Le travail d'une swimlane ou d'un groupe s'ex\xE9cute dans l'ordre, il doit donc aussi \xEAtre ordonn\xE9 par vague\xA0: d\xE9placez ${r} sous ${H(e.last)}, ou changez leurs vagues.`}case"join":return`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) vient apr\xE8s ${vs(e.block)} dans ${vs(e.flow)}, et ce bloc ne peut pas se terminer avant sa piste ${H(e.track)} (vague ${H(e.trackWave)}). D\xE9placez ${H(e.name)} au-dessus du bloc ou dans une piste distincte, ou changez l'une de leurs vagues.`;case"after-item":return e.container?`${Py(oI(e.container))} a after:${e.refId}, mais ${H(e.ref)} est dans la vague ult\xE9rieure ${H(e.refWave)}. La vague ${H(e.refWave)} ne peut pas d\xE9marrer avant la fin de la vague ${H(e.wave)}, donc ${H(e.name)} (vague ${H(e.wave)}) \xE0 l'int\xE9rieur ne pourrait jamais d\xE9marrer\xA0: d\xE9placez ${H(e.name)} dans la vague ${H(e.refWave)} ou une vague ult\xE9rieure, ou retirez le after:.`:`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) a after:${e.refId}, mais ${H(e.ref)} est dans la vague ult\xE9rieure ${H(e.refWave)}. La vague ${H(e.refWave)} ne peut pas d\xE9marrer avant la fin de la vague ${H(e.wave)}, donc ${H(e.name)} ne pourrait jamais d\xE9marrer\xA0: d\xE9placez-le dans la vague ${H(e.refWave)} ou une vague ult\xE9rieure, ou retirez le after:.`;case"after-wave":{let t=e.container?.kind==="parallel"?"bloc parall\xE8le":"groupe";return e.container?`${Py(oI(e.container))} (vague ${H(e.wave)}) a after:${e.refId}, mais le travail ne peut pas attendre la fin de sa propre vague ni d'une vague ult\xE9rieure. Utilisez une vague ant\xE9rieure, ou d\xE9placez le ${t} dans une vague ult\xE9rieure.`:`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) a after:${e.refId}, mais le travail ne peut pas attendre la fin de sa propre vague ni d'une vague ult\xE9rieure. Utilisez une vague ant\xE9rieure, ou d\xE9placez ${H(e.name)} dans une vague ult\xE9rieure.`}case"chain":return`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) ne pourrait jamais d\xE9marrer\xA0: via ${e.chain.join(" \u2192 ")}, il attend du travail qui ne peut pas d\xE9marrer avant la fin de la vague ${H(e.wave)}. D\xE9placez ${H(e.name)} dans une vague ult\xE9rieure, ou rompez la cha\xEEne.`}},"NL.E1104":e=>{switch(e.reason){case"swimlane":return`\xAB\xA0wave:\xA0\xBB n'est pas autoris\xE9 sur la swimlane ${H(e.name)}\xA0: une swimlane couvre toutes les vagues. Placez wave: sur ses \xE9l\xE9ments, ou regroupez-les dans \xAB\xA0group wave:${e.value}\xA0\xBB.`;case"milestone":return`\xAB\xA0wave:\xA0\xBB n'est pas autoris\xE9 sur le jalon ${H(e.name)}. Pour placer un jalon \xE0 la fin d'une vague, utilisez after:${e.value}.`;case"other":return`\xAB\xA0wave:\xA0\xBB n'est pas autoris\xE9 sur ${t2[e.type]} ${H(e.name)}\xA0; seuls item, group et parallel peuvent appartenir \xE0 une vague.`}},"NL.E1105":e=>e.reason==="before"?`\xAB\xA0before:\xA0\xBB n'est pas autoris\xE9 sur la vague ${H(e.name)}. La fin d'une vague d\xE9coule de ses \xE9l\xE9ments\xA0; pour donner une \xE9ch\xE9ance \xE0 une vague, ajoutez un jalon dat\xE9\xA0: milestone ${e.name}-due date:<AAAA-MM-JJ> after:${e.name}.`:`\xAB\xA0${e.key}:\xA0\xBB n'est pas autoris\xE9 sur la vague ${H(e.name)}. L'\xE9tendue d'une vague d\xE9coule de ses \xE9l\xE9ments\xA0; seul after: (une ancre, un jalon dat\xE9 ou une date ISO) peut retarder le d\xE9but d'une vague.`,"NL.E1106":e=>`La vague ${H(e.name)} a after:${e.ref}, mais ${H(e.ref)} est ${iI[e.kind]}. Le after: d'une vague accepte seulement des ancres, des jalons dat\xE9s ou une date ISO\xA0; pour qu'une vague attende du travail, placez ce travail dans une vague ant\xE9rieure.`,"NL.W1002":e=>`Les barri\xE8res de vagues ne se sont pas stabilis\xE9es apr\xE8s ${e.passes} passes de mise en page\xA0; le calendrier dessin\xE9 pourrait donc ne pas respecter l'ordre des vagues. La roadmap comporte probablement un conflit d'ordre que la validation n'a pas d\xE9tect\xE9.`,"NL.W1100":e=>{let t=Oy(e);return e.reason==="item"?`before:${e.ref} sur ${t} ne peut jamais \xEAtre respect\xE9\xA0: ${t} est dans la vague ${H(e.wave)}, qui ne peut pas d\xE9marrer avant la fin de ${H(e.ref)} (vague ${H(e.refWave)}). Le d\xE9passement sera peint.`:`before:${e.ref} sur ${t} ne peut jamais \xEAtre respect\xE9\xA0: ${t} est dans la vague ${H(e.wave)}, qui ne peut pas se terminer avant le d\xE9but de la vague ${H(e.ref)}. Le d\xE9passement sera peint.`},"NL.W1101":e=>{let t=Oy(e);switch(e.reason){case"forward-lane":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence ${H(e.ref)}, qui se trouve dans une swimlane ult\xE9rieure (${H(e.lane)}). La mise en page place les swimlanes dans l'ordre et ignore les r\xE9f\xE9rences \xE0 du travail qu'elle n'a pas encore plac\xE9, elle ignore donc ce ${e.key}:. D\xE9placez la swimlane ${H(e.lane)} au-dessus de la swimlane ${H(e.ownLane)}, ou retirez le ${e.key}:.`;case"forward-flow":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence ${H(e.ref)}, qui vient plus tard dans ${vs(e.flow)}. La mise en page ignore les r\xE9f\xE9rences \xE0 du travail qu'elle n'a pas encore plac\xE9, elle ignore donc ce ${e.key}:. D\xE9placez ${H(e.ref)} au-dessus ${Oy(e,!0)}, ou retirez le ${e.key}:.`;case"ancestor":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence ${H(e.ref)}, qui le contient. La mise en page ignore les r\xE9f\xE9rences \xE0 un groupe ou un bloc parall\xE8le englobant, elle ignore donc ce ${e.key}:. Retirez le ${e.key}:.`;case"floating-milestone":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence le jalon ${H(e.ref)}, qui n'a pas de date. Les jalons sans date sont plac\xE9s apr\xE8s tout le travail, la mise en page ignore donc ce ${e.key}:. R\xE9f\xE9rencez plut\xF4t les pr\xE9d\xE9cesseurs du jalon ou une vague.`}},"NL.I1006":e=>e.names.length===1?`La vague ${H(e.names[0])} ne sera pas affich\xE9e\xA0: aucun \xE9l\xE9ment ne lui est affect\xE9.`:`Les vagues ${n2(e.names)} ne seront pas affich\xE9es\xA0: aucun \xE9l\xE9ment ne leur est affect\xE9.`,"NL.I1007":e=>`Le jalon ${H(e.name)} (${e.date}) est d\xE9pass\xE9\xA0: la vague ${H(e.wave)} se termine le ${e.end}.`,"NL.I1008":e=>`L'\xE9l\xE9ment ${H(e.name)} est \xE9pingl\xE9 \xE0 ${e.pin} (${e.key}:), un jour non ouvr\xE9\xA0; il d\xE9marre le ${e.start}.`};var uI={};var fI={};var i2=new Map([["en-US",rI],["fr",cI],["fr-CA",uI],["fr-FR",fI]]);function ht(e,t,...n){for(let r of o2(e)){let o=i2.get(r)?.[t];if(o)return o(...n)}return t}var dI="en-US";function o2(e){let t=[],n=s2(e);for(;n.length>0;){t.includes(n)||t.push(n);let r=n.lastIndexOf("-");if(r<=0)break;n=n.slice(0,r)}return t.includes(dI)||t.push(dI),t}function s2(e){return e.split("-").map((n,r)=>r===0?n.toLowerCase():/^[a-zA-Z]{2}$/.test(n)?n.toUpperCase():n).join("-")}var a2=/[\\/]/;function mI(e){for(let t=e.length-1;t>=0;t--){let n=e.charCodeAt(t);if(n===47||n===92)return t}return-1}function pI(...e){for(let t of e)if(t){if(t.includes("\\")&&!t.includes("/"))return"\\";if(t.includes("/"))return"/"}return"/"}function $y(e){return e?e[0]==="/"||e[0]==="\\"?!0:e.length>=3&&/^[A-Za-z]:[\\/]/.test(e):!1}function wd(e){let t=mI(e);return t<0?".":t===0?e[0]:t===2&&/^[A-Za-z]:[\\/]/.test(e)?e.slice(0,3):e.slice(0,t)}function _l(e){let t=mI(e);return t<0?e:e.slice(t+1)}function Al(e,t){if($y(t))return hI(t,pI(t));let n=pI(e,t);return hI(`${e}${n}${t}`,n)}function hI(e,t){let n="",r=e,i=/^([A-Za-z]:)([\\/])?/.exec(r);i?(n=i[1]+(i[2]?t:""),r=r.slice(i[0].length)):(r[0]==="/"||r[0]==="\\")&&(n=t,r=r.replace(/^[\\/]+/,""));let o=[];for(let s of r.split(a2))if(!(s===""||s===".")){if(s===".."){o.length>0&&o[o.length-1]!==".."?o.pop():n||o.push("..");continue}o.push(s)}return n+o.join(t)}function Ed(e){let t=Al("",e).replace(/\\/g,"/"),n=/^[A-Za-z]:/.test(t)?t.slice(0,2).toLowerCase():"",r=n?t.slice(2):t;return[n,...r.split("/").filter(i=>i!=="")]}function Dy(e,t){let n=Ed(e),r=Ed(t);return n.length<=r.length&&n.every((i,o)=>i===r[o])}function gI(e,t){let n=Ed(e),r=Ed(t);if(n[0]!==r[0])return t;let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return[...n.slice(i).map(()=>".."),...r.slice(i)].join("/")||"."}function Rt(e){return/[\r\n]/.test(e)?e.replace(/\s*[\r\n]+\s*/g," ").trim():e}function yI(e,t,n){if(e===t)return 0;let r=e.length,i=t.length;if(Math.abs(r-i)>n)return n+1;if(r===0)return i;if(i===0)return r;let o=new Array(i+1),s=new Array(i+1);for(let a=0;a<=i;a++)o[a]=a;for(let a=1;a<=r;a++){s[0]=a;let l=a;for(let u=1;u<=i;u++){let f=e.charCodeAt(a-1)===t.charCodeAt(u-1)?0:1;s[u]=Math.min(o[u]+1,s[u-1]+1,o[u-1]+f),s[u]<l&&(l=s[u])}if(l>n)return n+1;let c=o;o=s,s=c}return o[i]}function xI(e,t,n=2){let r,i=n+1;for(let o of t){let s=yI(e,o,n);if(s<i&&(r=o,i=s,s===0))break}return r}function EI(e,t,n=2){let r,i=n+1,o=!1;for(let s of t){let a=yI(e,s,n);a<i?(r=s,i=a,o=!1):a===i&&a<=n&&s!==r&&(o=!0)}return o?void 0:r}function Re(e){return e.name??(e.title===void 0?"<unnamed>":Rt(e.title))}function Fr(e){return e.$type==="NonWorkingDeclaration"?"non-working":e.$type.replace(/Declaration$|Block$/,"").toLowerCase()}function kl(e){let t=Fr(e),n=e.name??(e.title===void 0?void 0:Rt(e.title));return n?`${t} "${n}"`:t}function En(e){let t=e.$cstNode;return t?t.range.start.line+1:0}function Td(e,t){return`"${e}" cannot be set on "default ${t}". Identity-defining, sizing, sequencing, reference, and prose properties must be explicit on each entity.`}function on(e){let t=new Set,n=[];for(let r of e.roadmapEntries)!vt(r)||!r.name||t.has(r.name)||(t.add(r.name),n.push(r));return n}function l2(e){let t=new Map;return on(e).forEach((n,r)=>{t.set(n.name,r+1)}),t}function TI(e){return(e.properties??[]).filter(n=>Q(n)==="wave")}function vI(e){return TI(e)[0]}function My(e){return e.value!==void 0?e.value:e.values.length===1?e.values[0]:`[${e.values.join(", ")}]`}function c2(e){let t=e;for(;t?.$container&&!ss(t.$container);)t=t.$container;let n=t?.$container;if(!(!t||!n||!ss(n)))return{file:n,index:n.roadmapEntries.indexOf(t),waveDecls:_I(n)}}function _I(e){let t=new Map;return e.roadmapEntries.forEach((n,r)=>{vt(n)&&n.name&&!t.has(n.name)&&t.set(n.name,r)}),t}function Fy(e,t,n,r=c2(t)){let i=My(e);if(e.value===void 0&&e.values.length!==1)return{status:"list",value:i};let o=n.get(i);if(o===void 0)return{status:"missing",value:i};if(r){let s=r.waveDecls.get(i);if(s!==void 0&&(r.index<0||s>r.index))return{status:"forward",value:i,line:En(r.file.roadmapEntries[s])}}return{status:"valid",id:i,index:o}}function u2(e){return $e(e)||et(e)}function f2(e,t,n,r){let i=vI(e);if(!i)return t;let o=Fy(i,e,n,r);if(o.status==="valid")return t??o.index}function vd(e,t){let n=new Map,r=new Map,i=new Map,o=(s,a,l)=>{let c=f2(s,a,t,l);c!==void 0&&n.set(s,c);let u=c;if($e(s)||et(s)){let f=[];for(let d of _t(s))f.push(o(d,c,l));c===void 0&&($e(s)?u=f[0]:f.length>0&&!f.includes(void 0)&&(u=Math.min(...f)))}return u!==void 0&&r.set(s,u),u};for(let s of e){let a,l=s.$container;if(ss(l)){let c=i.get(l);c||(c=_I(l),i.set(l,c)),a={file:l,index:l.roadmapEntries.indexOf(s),waveDecls:c}}for(let c of _t(s))o(c,void 0,a)}return{waveOf:n,leadOf:r}}function AI(e){return(e.properties??[]).find(n=>Q(n)==="date")?.value}function _s(e){let t=NA(e);return n=>t.get(n)}function Rl(e,t){let n=null;for(let r of e.properties){if(Q(r)!=="after")continue;let i=r.value!==void 0?[r.value]:r.values;for(let o of i){if(!o)continue;let s;if(ot.test(o))s=o;else{let a=t(o);(os(a)||xn(a))&&(s=AI(a))}s===void 0||!He(s)||(n===null||s>n.date)&&(n={date:s,ref:o})}}return n}var kI=new Set(["before","date","start","length","duration","size","capacity","remaining","wave"]);function Li(e){return vt(e.$container)&&kI.has(Q(e))}var d2={ItemDeclaration:"item",GroupBlock:"group",ParallelBlock:"parallel",SwimlaneDeclaration:"swimlane",AnchorDeclaration:"anchor",MilestoneDeclaration:"milestone",WaveDeclaration:"wave",LabelDeclaration:"label",SizeDeclaration:"size",StatusDeclaration:"status",PersonDeclaration:"person",TeamDeclaration:"team",FootnoteDeclaration:"footnote",RoadmapDeclaration:"roadmap",StyleDeclaration:"style",SymbolDeclaration:"symbol"};function Il(e){return d2[e.$type]??Fr(e)}function p2(e,t){let n=[],r=Re(e),i=!e.name&&e.title===void 0;if(e.name||n.push({severity:"error",code:"NL.E1100",args:{...e.title===void 0?{}:{title:Rt(e.title)},line:En(e)},node:e}),i)return n;for(let o of e.properties){let s=Q(o);if(kI.has(s)){n.push({severity:"error",code:"NL.E1105",args:s==="before"?{reason:"before",name:r}:{reason:"other",key:s,name:r},node:o,property:"key"});continue}if(s!=="after")continue;let a=o.value!==void 0?[o.value]:o.values;for(let l of a){if(!l||ot.test(l))continue;let c=t(l);if(!(!c||os(c))){if(xn(c)){if(AI(c)!==void 0)continue;n.push({severity:"error",code:"NL.E1106",args:{name:r,ref:l,kind:"floating-milestone"},node:o});continue}n.push({severity:"error",code:"NL.E1106",args:{name:r,ref:l,kind:Il(c)},node:o})}}}return n}function _d(e){let t=_s(e);return e.roadmapEntries.filter(vt).flatMap(n=>p2(n,t))}function h2(e){return[...Mn(e,{config:!0,roadmap:!0})].filter(t=>_A(t)?nt(t):!vt(t))}function m2(e,t){let n=e.toLowerCase(),r=t.filter(o=>o.title!==void 0&&Rt(o.title).toLowerCase()===n),i;if(r.length===1)i=r[0];else{let o=EI(e,t.map(s=>s.name));i=o===void 0?void 0:t.find(s=>s.name===o)}if(i)return i.title===void 0?{id:i.name}:{id:i.name,title:Rt(i.title)}}function g2(e,t,n){let r=n(t);if(r)return Il(r);for(let i of e.configEntries)if((Wt(i)||Ei(i))&&i.name===t)return Il(i)}function y2(e,t){let n=e.$container;for(;u2(n);){let r=vI(n);if(r)return Fy(r,n,t).status==="valid"?{container:n,prop:r}:void 0;n=n?.$container}}function wI(e,t){let n=t.name??(t.title===void 0?"":Rt(t.title));return n?{kind:e,name:n}:{kind:e,name:n,line:En(t)}}function x2(e){if(nt(e))return{kind:"default",entityType:e.entityType};let t=e,n=t.name??(t.title===void 0?"":Rt(t.title)),r=Il(e);return n?{kind:r,name:n}:{kind:r,name:n,line:En(e)}}function E2(e,t,n,r,i,o){let s=Fy(n,t,i);switch(s.status){case"list":return{severity:"error",code:"NL.E1101",args:{reason:"list",value:s.value},node:n};case"forward":return{severity:"error",code:"NL.E1101",args:{reason:"forward",value:s.value,line:s.line},node:n};case"missing":{let u=g2(e,s.value,o),f=m2(s.value,r);return{severity:"error",code:"NL.E1101",args:u===void 0?{reason:"unknown",value:s.value,declared:r.map(d=>d.name),...f?{suggestion:f}:{}}:{reason:"not-a-wave",value:s.value,kind:u,...f?{suggestion:f}:{}},node:n}}case"valid":break}let a=y2(t,i);if(!a)return;let l=My(a.prop);if(l===s.id)return;let c=Ve(t)?"item":$e(t)?"group":"parallel";return{severity:"error",code:"NL.E1102",args:{entity:wI(c,t),wave:s.id,container:wI($e(a.container)?"group":"parallel",a.container),containerWave:l},node:n}}function Ad(e){let t=on(e),n=t.length>0,r=l2(e),i=_s(e),o=[];for(let s of h2(e)){let a=TI(s);if(a.length===0)continue;if(!n){for(let m of a)o.push({severity:"warning",code:"NL.W0702",args:{target:x2(s)},node:m,property:"key"});continue}if(nt(s)){for(let m of a)o.push({severity:"error",message:Td("wave",s.entityType),node:m});continue}let l=s,c=Re(l);if(!l.name&&l.title===void 0&&!Ve(s)&&!$e(s)&&!et(s))continue;if(Ke(s)||xn(s)){for(let m of a)o.push({severity:"error",code:"NL.E1104",args:{reason:Ke(s)?"swimlane":"milestone",name:c,value:My(m)},node:m});continue}if(!Ve(s)&&!$e(s)&&!et(s)){for(let m of a)o.push({severity:"error",code:"NL.E1104",args:{reason:"other",type:Il(s),name:c},node:m});continue}let[f,...d]=a,p=E2(e,s,f,t,r,i);if(p&&o.push(p),d.length>0){let m=a.flatMap(g=>g.value!==void 0?[g.value]:g.values);for(let g of d)o.push({severity:"error",code:"NL.E1101",args:{reason:"list",value:`[${m.join(", ")}]`},node:g})}}return o}var w2=["after-wave","after-item","sequence","join"];function Pi(e){return e.name??(e.title===void 0?void 0:Rt(e.title))}function kd(e){let t=Pi(e);if(Ke(e))return{kind:"swimlane",name:Re(e)};let n=$e(e);return t?{kind:n?"group":"parallel",name:t}:{kind:n?"group-block":"parallel-block",line:En(e)}}function II(e){let t=Pi(e);return t!==void 0||e.$type==="ItemDeclaration"?t:{kind:$e(e)?"group-block":"parallel-block",line:En(e)}}function RI(e){return e.$type==="ItemDeclaration"||Pi(e)!==void 0?{name:Re(e)}:{name:"",kind:$e(e)?"group":"parallel",line:En(e)}}function T2(e){let t=$e(e)?"group":"parallel",n=Pi(e);return n?{kind:t,name:n}:{kind:t,name:"",line:En(e)}}function By(e){return(e.value!==void 0?[e.value]:e.values).filter(t=>!!t)}function v2(e){return xn(e)&&!e.properties.some(t=>Q(t)==="date")}function As(e,t,n={}){if(t.length===0)return[];let r=new Map;t.forEach((A,C)=>{A.name&&r.set(A.name,C+1)});let i=A=>t[A-1]?.name??"",{lanes:o,lookup:s}=e,{waveOf:a,leadOf:l}=vd(o,r),c=[],u=new Map,f=0,d=(A,C,W,G)=>{let K=c.length,q={node:A,lane:C,parent:W,children:[],prev:G,start:f++,reg:-1,ew:a.get(A),lw:l.get(A),after:[],afterWaves:[]};if(c.push(q),$e(A)||et(A)){let J=-1;for(let re of _t(A))J=d(re,C,K,$e(A)?J:-1),q.children.push(J);q.reg=f++}else q.reg=q.start;if(A.name){let J=u.get(A.name)??[];J.push(K),u.set(A.name,J)}return K};o.forEach((A,C)=>{let W=-1;for(let G of _t(A))W=d(G,C,-1,W)});let p=(A,C)=>{let W=u.get(A);if(W){for(let G=W.length-1;G>=0;G--)if(c[W[G]].reg<c[C].start)return W[G]}},m=[],g=n.suppressCycleRefs??!0?A2(c,o,s):()=>!1;for(let A=0;A<c.length;A++){let C=c[A],W=RI(C.node);for(let G of C.node.properties){let K=Q(G);if(!(K!=="after"&&K!=="before"))for(let q of By(G)){if(ot.test(q))continue;let J=p(q,A),re=J===void 0?r.get(q):void 0;if(K==="after"&&(J!==void 0?C.after.push({from:J,prop:G,ref:q}):re!==void 0&&C.afterWaves.push({prop:G,ref:q,j:re})),J!==void 0||re!==void 0)continue;let le=u.get(q)?.[0];if(le===void 0&&!v2(s(q))||g(C.node.name,K,q))continue;let ce=!1;for(let pe=C.parent;pe>=0&&!ce;pe=c[pe].parent)ce=c[pe].node.name===q;m.push({severity:"warning",code:"NL.W1101",args:le===void 0?{reason:"floating-milestone",key:K,ref:q,...W}:ce?{reason:"ancestor",key:K,ref:q,...W}:c[le].lane!==C.lane?{reason:"forward-lane",key:K,ref:q,...W,lane:Re(o[c[le].lane]),ownLane:Re(o[C.lane])}:{reason:"forward-flow",key:K,ref:q,...W,flow:kd(_2(c,o,A,le))},node:G})}}}let w=new Array(c.length),x=new Array(c.length);for(let A=c.length-1;A>=0;A--){let C=c[A];if(C.node.$type==="ItemDeclaration"){w[A]=C.ew,x[A]=C.ew;continue}for(let W of C.children){let G=w[W],K=x[W];G!==void 0&&(w[A]=Math.max(w[A]??G,G)),K!==void 0&&(x[A]=Math.min(x[A]??K,K))}}for(let A=0;A<c.length;A++){let C=w[A];if(C===void 0)continue;let W=RI(c[A].node);for(let G of c[A].node.properties)if(Q(G)==="before")for(let K of By(G)){if(ot.test(K))continue;let q=p(K,A);if(q!==void 0){let re=x[q];if(re===void 0||C<=re)continue;m.push({severity:"warning",code:"NL.W1100",args:{reason:"item",ref:K,...W,wave:i(C),refWave:i(re)},node:G});continue}let J=r.get(K);J===void 0||C<J||m.push({severity:"warning",code:"NL.W1100",args:{reason:"wave",ref:K,...W,wave:i(C)},node:G})}}let y=A=>c[A].node.$type!=="ItemDeclaration",E=A=>{let{parent:C}=c[A];return C<0?!1:et(c[C].node)||c[C].children[0]===A},_=new Array(c.length).fill(0),T=new Array(c.length).fill(0),I=A=>{let C=c[A],W=[];C.lw!==void 0&&W.push({term:{kind:C.ew!==void 0?"wave":"lead"},value:C.lw-1});for(let G of C.afterWaves)W.push({term:{kind:"after-wave",prop:G.prop,ref:G.ref},value:G.j});E(A)&&W.push({term:{kind:"parent",from:C.parent},value:_[C.parent]}),C.prev>=0&&W.push({term:{kind:"seq",from:C.prev},value:T[C.prev]});for(let G of C.after)W.push({term:{kind:"after",from:G.from,prop:G.prop,ref:G.ref},value:T[G.from]});return W},B=A=>{let C=_[A];for(let W of c[A].children)C=Math.max(C,T[W]);return C},$=c.map((A,C)=>[2*C+1]),X=c.map(()=>[]);for(let A=0;A<c.length;A++){let C=c[A];E(A)&&$[C.parent].push(2*A),C.prev>=0&&X[C.prev].push(2*A);for(let W of C.after)X[W.from].push(2*A);C.parent>=0&&X[A].push(2*C.parent+1)}let Y=[],D=new Array(2*c.length).fill(!0);for(let A=0;A<c.length;A++)Y.push(2*A,2*A+1);for(let A=0;A<Y.length;A++){let C=Y[A];D[C]=!1;let W=C>>1,G=(C&1)===1,K=G?B(W):Math.max(0,...I(W).map(q=>q.value));if(!(K<=(G?T[W]:_[W]))){G?T[W]=K:_[W]=K;for(let q of G?X[W]:$[W])D[q]||(D[q]=!0,Y.push(q))}}let R=(A,C)=>I(A).filter(W=>W.value===C).map(W=>W.term),S=(A,C)=>{if(!y(A))return[{kind:"start"}];let W=c[A].children.filter(G=>T[G]===C).map(G=>({kind:"child",from:G}));return W.length>0?$e(c[A].node)?W.reverse():W:_[A]===C?[{kind:"start"}]:[]},O=(A,C)=>{let W=[{i:A,via:A}];for(;W.length>0;){let{i:G,via:K}=W.pop(),q=S(G,C);for(let J=q.length-1;J>=0;J--){let re=q[J];if(re.kind==="start"){let le=c[G].ew;if(le!==void 0&&le-1===C)return{origin:G,via:K}}else re.kind==="child"&&W.push({i:re.from,via:G===A?re.from:K})}}},k=(A,C)=>{let W=c[A].ew;return W!==void 0&&W-1===C},L=(A,C)=>{let W=A;for(;c[W].prev>=0||E(W);){let G=c[W].prev;if(G<0){W=c[W].parent;continue}let K=c[G].ew;if(K!==void 0&&K>C)return G;W=G}},v=new Map,P=[],b=new Map,F=(A,C,W)=>`${A}:${c[A].node.properties.indexOf(C)}:${W}`,j=(A,C)=>{let W=[],G=A;for(;;){let K=R(G,C);for(let J of K)if(J.kind==="after-wave")W.push({variant:"after-wave",owner:G,prop:J.prop,ref:J.ref});else if(J.kind==="after")k(J.from,C)&&W.push({variant:"after-item",owner:G,prop:J.prop,ref:J.ref});else if(J.kind==="seq"){let re=J.from,le=c[re].node;if(et(le)&&c[re].ew===void 0){let ce=O(re,C),pe=ce&&(Pi(c[ce.via].node)??Pi(c[ce.origin].node));pe&&W.push({variant:"join",owner:G,block:re,track:pe})}else if(k(re,C)){let ce=II(le);ce&&W.push({variant:"sequence",owner:G,pred:re,ref:ce})}}let q=K.find(J=>J.kind==="parent");if(!q)break;G=q.from}for(let K of w2){let q=W.find(J=>J.variant===K);if(q)return q}},U=(A,C)=>{let W=[{key:2*A,from:-1}],G=new Set([2*A]),K,q=(J,re)=>{G.has(J)||(G.add(J),W.push({key:J,from:re}))};for(let J=0;J<W.length;J++){let re=W[J].key>>1;if(re!==A&&v.has(re)){K??(K=re);continue}if((W[J].key&1)===1){for(let pe of S(re,C))pe.kind==="start"?q(2*re,J):pe.kind==="child"&&q(2*pe.from+1,J);continue}let le=R(re,C),ce=le.find(pe=>pe.kind==="wave"||pe.kind==="lead")??le.find(pe=>pe.kind==="after-wave");if(ce){let pe=[];for(let mt=J;mt>=0;mt=W[mt].from){let gt=W[mt].key>>1;pe[pe.length-1]!==gt&&pe.push(gt)}let rt=Re(c[re].node);return{path:pe,origin:ce.kind==="after-wave"?`${rt} (after:${ce.ref})`:`${rt} (wave "${i(C+1)}")`}}for(let pe of le)pe.kind==="parent"?q(2*pe.from,J):(pe.kind==="seq"||pe.kind==="after")&&q(2*pe.from+1,J)}return{hit:K}},ee=(A,C,W,G)=>{let K=Re(c[C].node),q=i(W),J=i(G+1),re=c[A.owner].node,le=A.owner===C?void 0:T2(re);switch(A.variant){case"after-wave":{let ce=c[A.owner].ew===void 0?void 0:le;return{node:A.prop,run:[C],build:()=>({reason:"after-wave",name:K,wave:q,refId:A.ref,...ce?{container:ce}:{}})}}case"after-item":return{node:A.prop,run:[C],build:()=>({reason:"after-item",name:K,wave:q,refId:A.ref,ref:A.ref,refWave:J,...le?{container:le}:{}})};case"join":{let ce=c[A.block];return{node:c[C].node,run:[C],build:()=>({reason:"join",name:K,wave:q,block:kd(ce.node),flow:kd(SI(c,o,A.block)),track:A.track,trackWave:J})}}case"sequence":{let ce=A.pred,pe=c[ce].parent,rt=mt=>{if(pe<0)return c[mt].lane===c[ce].lane;for(let gt=c[mt].parent;gt>=0;gt=c[gt].parent)if(gt===pe)return!0;return!1};return{node:c[C].node,run:[C],build:mt=>{let gt=mt.filter(rt);return{reason:"sequence",items:gt.map(Ql=>Re(c[Ql].node)),itemWave:q,ref:A.ref,refWave:i(c[ce].ew??G+1),flow:kd(SI(c,o,ce)),last:Re(c[gt[gt.length-1]].node)}},seq:{pred:ce,ref:A.ref,inFlow:rt}}}}},V=(A,C)=>(P.push(C),A!==void 0&&b.set(A,C),C),ne=(A,C,W,G)=>{let K=A.variant==="sequence"?`sequence:${A.pred}:${W}`:A.variant==="join"?`join:${A.block}:${W}`:`${A.variant}:${F(A.owner,A.prop,A.ref)}`,q=b.get(K);return q?(q.run.push(C),q):V(K,ee(A,C,W,G))};for(let A=0;A<c.length;A++){let C=c[A],W=C.ew;if(C.node.$type!=="ItemDeclaration"||W===void 0||_[A]<W)continue;let G=_[A],K=j(A,G),q;if(K)q=ne(K,A,W,G);else{let J=U(A,G);if("path"in J){let re=J.path.slice(1).filter(rt=>!y(rt)||Pi(c[rt].node)!==void 0).map(rt=>Re(c[rt].node)),le=[J.origin,...re.filter((rt,mt)=>re[mt-1]!==rt)],ce=Re(C.node),pe=i(W);q=V(void 0,{node:C.node,run:[A],build:()=>({reason:"chain",name:ce,wave:pe,chain:le})})}else{let re=J.hit===void 0?void 0:v.get(J.hit),le=re?.seq;if(le?.inFlow(A)){let ce=L(A,W),pe=ce===void 0?void 0:II(c[ce].node),rt=ce!==void 0&&pe!==void 0?{variant:"sequence",owner:A,pred:ce,ref:pe}:{variant:"sequence",owner:A,pred:le.pred,ref:le.ref};q=ne(rt,A,W,G)}else q=re,q?.run.push(A)}}q&&v.set(A,q)}for(let A of P)m.push({severity:"error",code:"NL.E1103",args:A.build(A.run),node:A.node});return m}function SI(e,t,n){let r=e[n].parent;return r<0?t[e[n].lane]:e[r].node}function _2(e,t,n,r){let i=new Set;for(let o=e[r].parent;o>=0;o=e[o].parent)i.add(o);for(let o=e[n].parent;o>=0;o=e[o].parent)if(i.has(o))return e[o].node;return t[e[n].lane]}function A2(e,t,n){let r=new Map,i=(c,u)=>{let f=r.get(c)??new Set;f.add(u),r.set(c,f)},o=[],s=(c,u)=>{if(c)for(let f of u){let d=Q(f);if(!(d!=="after"&&d!=="before"))for(let p of By(f))ot.test(p)||(d==="after"?i(c,p):i(p,c),o.push(p))}};for(let c of t)s(c.name,c.properties);for(let c of e)s(c.node.name,c.node.properties);let a=new Set;for(;o.length>0;){let c=o.pop();if(a.has(c))continue;a.add(c);let u=n(c);xn(u)&&s(u.name,u.properties)}let l=(c,u)=>{let f=new Set([c]),d=[c];for(;d.length>0;){let p=d.pop();if(p===u)return!0;for(let m of r.get(p)??[])f.has(m)||(f.add(m),d.push(m))}return!1};return(c,u,f)=>c?u==="after"?l(f,c):l(c,f):!1}function ks(e){return t=>e.anchors.get(t)??e.milestones.get(t)??e.waves?.get(t)}function Sl(e){let t=e.$document?.parseResult;return!!t&&(t.lexerErrors.length>0||t.parserErrors.length>0)}function NI(e,t){return Sl(e)?!1:!!e.roadmapDecl||t.swimlanes.size>0||on(e).length>0}function Hn(e,t){if(!e.$cstNode)return{};let{start:n,end:r}=eg({node:e,...t===void 0?{}:{property:t}});return{line:n.line,range:{start:{line:n.line,character:n.character},end:{line:r.line,character:r.character}}}}function Oi(e,t,n,r,...i){return{severity:e,message:ht("en-US",r,...i),sourcePath:t,...n,code:r,args:i,rule:"wave"}}function Id(e){return e.map(t=>t.name)}function bI(e){let t=n=>{let r=e.properties.find(i=>Q(i)===n);return r?r.value??r.values.join(", "):""};return{title:e.title===void 0?"":Rt(e.title),style:t("style"),labels:t("labels"),link:t("link"),description:e.description?Rt(e.description.text):""}}var k2=["title","style","labels","link","description"];function LI(e,t,n){let r={diagnostics:[],failed:!1};if(n.mode==="ignore"||!n.participates||n.childFile.roadmapEntries.some(p=>vt(p)&&!p.name))return r;let i=n.parentAbs,o=Hn(n.inc),s=n.childRelPath,a=on(e),l=on(n.childFile),c=p=>({diagnostics:[p],failed:!0});if(a.length===0&&l.length===0)return r;if(l.length===0)return c(Oi("error",i,o,"NL.E0202",{reason:"child-none",path:s,parent:Id(a)}));if(a.length===0)return c(Oi("error",i,o,"NL.E0202",{reason:"parent-none",path:s,child:Id(l)}));if(a.length!==l.length||a.some((p,m)=>p.name!==l[m].name))return c(Oi("error",i,o,"NL.E0202",{reason:"mismatch",path:s,child:Id(l),parent:Id(a)}));let u=ks(t),f=ks(n.childContent);for(let p=0;p<a.length;p++){let m=Rl(a[p],u)?.date??null,g=Rl(l[p],f)?.date??null;if(m!==g)return c(Oi("error",i,o,"NL.E0202",{reason:"floor",id:a[p].name,path:s,childFloor:g,parentFloor:m}))}let d=[];for(let p=0;p<a.length;p++){let m=bI(a[p]),g=bI(l[p]),w=k2.filter(x=>m[x]!==g[x]).map(x=>({field:x,there:g[x],here:m[x]}));w.length!==0&&d.push(Oi("warning",i,o,"NL.W0701",{id:a[p].name,path:s,fields:w}))}return{diagnostics:d,failed:!1}}function I2(e){let t=e;for(;t&&!ss(t);)t=t.$container;return t}function PI(e){let{rootFile:t,rootAbs:n,rootContent:r,files:i,edges:o,failed:s}=e,a=[],l=new Set,c=T=>{let I=JSON.stringify([T.sourcePath,T.line,T.code,T.args,T.message]);l.has(I)||(l.add(I),a.push(T))},u=T=>{let I=I2(T);return I?i.get(I):void 0},f=(T,I)=>{let B=Hn(T.node,T.property);return"message"in T?{severity:T.severity,message:T.message,sourcePath:I,...B,rule:"wave"}:Oi(T.severity,I,B,T.code,T.args)},d=[],p=new Set([n]),m=T=>{for(let I of o.get(T)??[])I.mode==="ignore"||!I.participates||p.has(I.childAbs)||(p.add(I.childAbs),s.has(I.childAbs)||d.push({file:I.childFile,abs:I.childAbs}),m(I.childAbs))};m(n);let g=on(t),w=new Map(g.map(T=>[T.name,T]));for(let{file:T,abs:I}of d){for(let $ of _d(T))c(f($,I));for(let $ of Ad(T))c(f($,I));if(w.size===0)continue;let B=($,X)=>{let Y=$===void 0?void 0:w.get($);if(!Y||vt(X))return;let D=Y.$cstNode?Y.$cstNode.range.start.line+1:0;c(Oi("error",I,Hn(X),"NL.E0300",{name:$,location:`${_l(n)}:${D}`}))};T.roadmapDecl&&B(T.roadmapDecl.name,T.roadmapDecl);for(let $ of T.roadmapEntries)Uf($,B);for(let $ of T.configEntries)Wt($)&&B($.name,$)}if(g.length===0)return a;let x=T=>"message"in T?T.message:`${T.code}\0${JSON.stringify(T.args)}`,y=new Map,E={lanes:t.roadmapEntries.filter(Ke),lookup:_s(t)};for(let T of As(E,g,{suppressCycleRefs:!1})){let I=y.get(T.node)??new Set;I.add(x(T)),y.set(T.node,I)}let _=T=>{for(let I of T){if(y.get(I.node)?.has(x(I)))continue;let B=u(I.node);B===void 0||s.has(B)||c(f(I,B))}};_(As({lanes:[...r.swimlanes.values()],lookup:ks(r)},g,{suppressCycleRefs:!1}));for(let T of r.isolatedRegions){let I=T.content.roadmap?u(T.content.roadmap):void 0;if(I!==void 0&&s.has(I))continue;let B=[...T.content.waves?.values()??[]];B.length!==0&&_(As({lanes:[...T.content.swimlanes.values()],lookup:ks(T.content)},B,{suppressCycleRefs:!1}))}return a}function Rd(e){let t=bA(e),n=[];for(let r of e.roadmapEntries)Xf(r,i=>{let o=Q(i);if(o!=="after"&&o!=="before"&&o!=="on"||Li(i))return;let s=i.value?[i.value]:i.values;for(let a of s)a&&((o==="after"||o==="before")&&ot.test(a)||t.has(a)||n.push({prop:i,key:o,value:a}))});return n}function OI(e,t){let n=[],r=new Set([e]),i=o=>{for(let s of t.get(o)??[])if(!(s.mode==="ignore"||r.has(s.childAbs))){if(r.add(s.childAbs),!Sl(s.childFile))for(let{prop:a,key:l,value:c}of Rd(s.childFile)){let u=[{key:l,value:c}];n.push({severity:"error",message:ht("en-US","NL.E0302",...u),sourcePath:s.childAbs,...Hn(a),code:"NL.E0302",args:u})}i(s.childAbs)}};return i(e),n}function Wy(e){return e.includes.some(t=>t.options.find(n=>n.key==="roadmap")?.value!=="ignore")}function CI(e){return e.swimlanes.size>0||e.isolatedRegions.some(t=>CI(t.content))}function $I(e,t,n,r){let i=e.roadmapDecl;return!i||!Wy(e)?[]:r.some(o=>o.severity==="error")?[]:CI(n)?[]:[{severity:"error",message:ht("en-US","NL.E0004"),sourcePath:t,...Hn(i),code:"NL.E0004",args:[]}]}function DI(e){let t=e?.properties.find(n=>n.key==="start");if(!(!t?.value||!He(t.value)))return t.value}function Br(e){return e.code!==void 0||e.rule==="wave"||e.syntax!==void 0}function S2(){return{styles:new Map,defaults:new Map,symbols:new Map,calendarDeclarations:[]}}function b2(){return{persons:new Map,teams:new Map,anchors:new Map,labels:new Map,sizes:new Map,statuses:new Map,swimlanes:new Map,milestones:new Map,footnotes:new Map,isolatedRegions:[]}}var Hy=16;async function zy(e,t,n){let r=n.readFile??(async u=>{let{nodeReadFile:f}=await Promise.resolve().then(()=>(Uy(),Xy));return f(u)}),i=n.includePolicy,o=(i?.kind==="rooted"?i.realPath:void 0)??(async u=>{let{nodeRealPath:f}=await Promise.resolve().then(()=>(Uy(),Xy));return f(u)}),s=Al("",t),a={services:n.services,rootAbs:s,policy:i,realPath:o,displayBase:i?.kind==="rooted"?i.root:wd(s),diagnostics:[],resolving:[],processed:new Map,readFile:r,files:new Map,edges:new Map,failedWaves:new Set},{config:l,content:c}=await BI(e,s,a);return a.diagnostics.push(...PI({rootFile:e,rootAbs:s,rootContent:c,files:a.files,edges:a.edges,failed:a.failedWaves})),a.diagnostics.push(...OI(s,a.edges)),a.diagnostics.push(...$I(e,s,c,a.diagnostics)),{config:l,content:c,diagnostics:a.diagnostics,processedFiles:new Set(a.processed.keys())}}async function BI(e,t,n){if(n.processed.has(t))return n.processed.get(t);t!==n.rootAbs&&n.diagnostics.push(...P2(e,t)),n.resolving.push(t),n.files.set(e,t);let r=S2(),i=b2();F2(r,e),U2(i,e);let o=on(e);o.length>0&&(i.waves=new Map(o.map(c=>[c.name,c])));let s=[];n.edges.set(t,s);let a=new Set;for(let c of e.includes){let u=c.path,f=(T,...I)=>{n.diagnostics.push(N2(t,c,T,...I))};if(n.policy?.kind==="disabled"){f("NL.E0209",{path:u});continue}let d=await L2(t,u,n);if("refused"in d){f("NL.E0208",d.refused);continue}if("unreadable"in d){f("NL.E0203",d.unreadable);continue}let p=d.absPath;if(a.has(p)){f("NL.E0205",{path:u});continue}a.add(p);let m=n.resolving.indexOf(p);if(m>=0){let T=[...n.resolving.slice(m),p].map(I=>gI(n.displayBase,I)).join(" \u2192 ");f("NL.E0204",{path:u,chain:T});continue}if(n.resolving.length>Hy){f("NL.E0210",{path:u,max:Hy});continue}if(!p.endsWith(".nowline")){f("NL.E0203",{reason:"not-nowline",path:u});continue}let g=MI(c,"config")??"merge",w=MI(c,"roadmap")??"merge",x;try{let T=await n.readFile(p);x=await O2(n.services,T,p)}catch(T){f("NL.E0203",WI(u,T));continue}let{config:y,content:E}=await BI(x,p,n);s.push({parentAbs:t,inc:c,childRelPath:u,childAbs:p,mode:w,childFile:x,childContent:E,participates:NI(x,E)}),C2(r,y,g,p,n.diagnostics),$2(i,E,y,w,p,u,n.diagnostics);let _=!Sl(x);if(_&&w==="isolate"&&!E.roadmap&&f("NL.E0206",{path:u}),_&&w!=="ignore"&&x.roadmapDecl){let T=DI(e.roadmapDecl),I=DI(x.roadmapDecl);T!==I&&f("NL.E0207",{path:u,...T?{parentStart:T}:{},...I?{childStart:I}:{}})}}i.waves&&X2(i,i.waves);for(let c of s){let{diagnostics:u,failed:f}=LI(e,i,c);n.diagnostics.push(...u),f&&n.failedWaves.add(c.childAbs)}n.resolving.pop();let l={config:r,content:i};return n.processed.set(t,l),l}function N2(e,t,n,...r){return{severity:"error",message:ht("en-US",n,...r),sourcePath:e,...Hn(t,"path"),code:n,args:r}}async function L2(e,t,n){let r=n.policy;if(r?.kind!=="rooted")return{absPath:Al(wd(e),t)};if($y(t))return{refused:{reason:"absolute",path:t}};let i=Al(wd(e),t);if(!Dy(r.root,i))return{refused:{reason:"parent",path:t}};let o;try{o=await n.realPath(i)}catch(s){return{unreadable:WI(t,s)}}return Dy(r.root,o)?{absPath:o}:{refused:{reason:"symlink",path:t}}}function WI(e,t){switch(t?.code){case"ENOENT":case"ENOTDIR":return{reason:"not-found",path:e};case"EISDIR":return{reason:"is-directory",path:e};case"EACCES":case"EPERM":return{reason:"permission-denied",path:e}}let n=t instanceof Error?t.message:void 0;return{reason:"unreadable",path:e,...n?{detail:n}:{}}}function P2(e,t){let n=e.$document;if(!n)return[];let r=[];for(let i of Ni(n)){if(i.origin==="validation")continue;let o=i.origin==="lexer"?i.error.line:i.error.token?.startLine;r.push({severity:"error",message:i.error.message,sourcePath:t,...o!==void 0&&Number.isFinite(o)?{line:o-1}:{},syntax:i})}return r}function MI(e,t){let n=e.options.find(r=>r.key===t);if(n&&(n.value==="merge"||n.value==="ignore"||n.value==="isolate"))return n.value}async function O2(e,t,n){let r=Ce.file(n),o=e.shared.workspace.LangiumDocumentFactory.fromString(t,r);return await e.shared.workspace.DocumentBuilder.build([o],{validation:!1}),o.parseResult.value}function C2(e,t,n,r,i){if(n==="ignore"||n==="isolate")return;let o=(s,a)=>i.push({severity:"warning",message:`${a} "${s}" from ${_l(r)} is shadowed by the parent's definition.`,sourcePath:r});Gy(e.styles,t.styles,s=>o(s,"Style")),Gy(e.defaults,t.defaults,s=>o(s,"Default")),Gy(e.symbols,t.symbols,s=>o(s,"Symbol")),D2(e.calendarDeclarations,t.calendarDeclarations,s=>o(s.name,M2(s))),t.scale&&!e.scale&&(e.scale=t.scale),t.calendar&&!e.calendar&&(e.calendar=t.calendar)}function $2(e,t,n,r,i,o,s){if(r==="ignore")return;if(r==="isolate"){t.roadmap&&e.isolatedRegions.push({sourcePath:o,config:n,content:t});return}let a=(l,c)=>s.push({severity:"warning",message:`${c} "${l}" from ${_l(i)} is shadowed by the parent's definition.`,sourcePath:i});zn(e.persons,t.persons,l=>a(l,"Person")),zn(e.teams,t.teams,l=>a(l,"Team")),zn(e.anchors,t.anchors,l=>a(l,"Anchor")),zn(e.labels,t.labels,l=>a(l,"Label")),zn(e.sizes,t.sizes,l=>a(l,"Size")),zn(e.statuses,t.statuses,l=>a(l,"Status")),zn(e.swimlanes,t.swimlanes,l=>a(l,"Swimlane")),zn(e.milestones,t.milestones,l=>a(l,"Milestone")),zn(e.footnotes,t.footnotes,l=>a(l,"Footnote")),t.roadmap&&!e.roadmap&&(e.roadmap=t.roadmap)}function Gy(e,t,n){for(let[r,i]of t){if(e.has(r)){e.get(r)!==i&&n(r);continue}e.set(r,i)}}function D2(e,t,n){let r=new Set(e),i=new Set(e.filter(o=>o.name).map(FI));for(let o of t)if(!r.has(o)){if(o.name&&i.has(FI(o))){n(o);continue}e.push(o),r.add(o)}}function FI(e){return`${e.$type}:${e.name}`}function M2(e){return Nr(e)?"Non-working":"Working"}function zn(e,t,n){let r=new Set(e.values());for(let[i,o]of t)if(!r.has(o)){if(!o.name&&o.title){e.set(jy(e,XI(o.title)),o);continue}if(e.has(i)){n(i);continue}e.set(i,o)}}function F2(e,t){for(let n of t.configEntries)B2(e,n)}function B2(e,t){AA(t)?e.scale||(e.scale=t):za(t)?e.calendar||(e.calendar=t):Wt(t)?t.name&&!e.styles.has(t.name)&&e.styles.set(t.name,t):Ei(t)?t.name&&!e.symbols.has(t.name)&&e.symbols.set(t.name,t):nt(t)?e.defaults.has(t.entityType)||e.defaults.set(t.entityType,t):(Nr(t)||qa(t))&&e.calendarDeclarations.push(t)}function W2(e){let t={swimlanes:new Set,persons:new Set,teams:new Set,anchors:new Set,labels:new Set,sizes:new Set,statuses:new Set,milestones:new Set,footnotes:new Set};for(let n of e){let r=n.name;if(r){if(Ke(n))t.swimlanes.add(r);else if(Va(n))t.persons.add(r);else if(tn(n))t.teams.add(r);else if(os(n))t.anchors.add(r);else if(Ya(n))t.labels.add(r);else if(xi(n))t.sizes.add(r);else if(Ka(n))t.statuses.add(r);else if(xn(n))t.milestones.add(r);else if(Ng(n))t.footnotes.add(r);else if(vt(n))for(let i of Object.values(t))i.add(r)}}return t}function X2(e,t){let n=[e.persons,e.teams,e.anchors,e.labels,e.sizes,e.statuses,e.swimlanes,e.milestones,e.footnotes],r=(i,o)=>t.has(i)&&!o.name&&!!o.title;for(let i of n){let o=[...i];if(!o.some(([a,l])=>r(a,l)))continue;let s=new Set([...i.keys(),...t.keys()]);i.clear();for(let[a,l]of o){let c=r(a,l)?jy(i,a,s):a;s.add(c),i.set(c,l)}}}function U2(e,t){t.roadmapDecl&&!e.roadmap&&(e.roadmap=t.roadmapDecl);let n=W2(t.roadmapEntries);for(let r of t.roadmapEntries)G2(e,r,n)}function XI(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"entity"}function jy(e,t,n){let r=o=>e.has(o)||(n?.has(o)??!1);if(!r(t))return t;let i=2;for(;r(`${t}-${i}`);)i++;return`${t}-${i}`}function jn(e,t,n){t.name?e.has(t.name)||e.set(t.name,t):t.title&&e.set(jy(e,XI(t.title),n),t)}function G2(e,t,n){Ke(t)?jn(e.swimlanes,t,n.swimlanes):Va(t)?jn(e.persons,t,n.persons):tn(t)?jn(e.teams,t,n.teams):os(t)?jn(e.anchors,t,n.anchors):Ya(t)?jn(e.labels,t,n.labels):xi(t)?jn(e.sizes,t,n.sizes):Ka(t)?jn(e.statuses,t,n.statuses):xn(t)?jn(e.milestones,t,n.milestones):Ng(t)&&jn(e.footnotes,t,n.footnotes)}function bl(e){let t=e?.roadmapDecl?.properties.find(r=>Q(r)==="start");if(!t)return{kind:"missing"};let n=t.value;return!n||!He(n)?{kind:"invalid"}:{kind:"valid",iso:n,date:new Date(n)}}function Z(e,t,n,r,...i){e(t,ht("en-US",r,...i),{...n,data:{code:r,args:i}})}function Sd(e,t){let n={node:t.node,...t.property===void 0?{}:{property:t.property}};if("message"in t){e(t.severity,t.message,n);return}Z(e,t.severity,n,t.code,t.args)}function Ci(e){let t=e.$cstNode;return t?`line ${t.range.start.line+1}`:"unknown location"}function bd(e){return/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e)}var Yy="v1",Nd=new Set(zf),UI=new Set(wi),Vy=new Set(Ja),Nl=new Set(FA),GI=new Set(OA),HI=new Set(BA),Ll=Object.fromEntries(Object.entries(CA).map(([e,t])=>[e,new Set(t)])),zI=new Set($A),jI=new Set(DA),Ld=new Set(WA),Ky=new Set(XA),qy=new Set(UA),YI={item:new Set(["size","duration","after","before","remaining","link","description","owner"]),milestone:new Set(["date","after","link","description"]),anchor:new Set(["date","link","description"]),footnote:new Set(["on","link","description"]),label:new Set(["link","description"]),swimlane:new Set(["capacity"]),roadmap:new Set,parallel:new Set,group:new Set},Zy=new Set(GA),VI=Object.fromEntries(Object.entries(HA).map(([e,t])=>[e,new Set(t)])),H2=[{keys:new Set(["progress","percent","percentage","pct","complete","completion"]),requires:"remaining",suggest:"status: + remaining:"},{keys:new Set(["date","start"]),requires:"after",entities:new Set(["ItemDeclaration","ParallelBlock","GroupBlock"]),suggest:"after:<date>"}];function KI(e,t,n){let r=e.toLowerCase();for(let i of H2)if(!(!i.keys.has(r)||!t.has(i.requires))&&!(i.entities&&(n===void 0||!i.entities.has(n))))return i.suggest}var $i=/^\d+(?:\.\d+)?[dwmqy]$/,qI=/^\d+%$/,ZI=/^#[0-9a-fA-F]{3,8}$/,JI=/^v\d+$/,Jy=/^\d+$/,QI=/^[dwmqy]$/,Qy=/^\d+(\.\d+)?$/,Pl=/^\d+(\.\d+)?%$/,Pd=/^\d+\.\d+$/,eR=/^\d+$/,tR=/^[\x20-\x7E]{1,3}$/,nR=/^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-\d{3})?$/,rR=new Set(MA),ex=new Set(zA);function oR(e,t){let n=e.configEntries.filter(za),i=e.roadmapDecl?.properties.find(o=>Q(o)==="calendar")?.value;if(n.length>0&&i!=="custom")for(let o of n)t("error",'A "calendar" config block is only valid when the roadmap declares calendar:custom.',{node:o});if(i==="custom"&&n.length===0&&t("error",'calendar:custom requires a "calendar" config block with days-per-week, days-per-month, days-per-quarter, and days-per-year.',{node:e.roadmapDecl,property:"properties"}),i==="custom"&&n.length>0)for(let o of n){let s=new Set(o.properties.map(a=>Q(a)));for(let a of Ld)s.has(a)||t("error",`calendar:custom requires "${a}" in the calendar config block.`,{node:o})}}function sR(e,t){let n=new Set;for(let r of e.properties){let i=Q(r);if(!Ld.has(i)){t("error",`Unknown calendar property "${i}". Allowed: ${[...Ld].join(", ")}.`,{node:r,property:"key"});continue}n.has(i)&&t("error",`Duplicate calendar property "${i}".`,{node:r,property:"key"}),n.add(i),(!Jy.test(r.value)||parseInt(r.value,10)<=0)&&t("error",`"${i}" must be a positive integer, got "${r.value}".`,{node:r,property:"value"})}}function aR(e,t){let n=new Set;for(let r of e.properties){let i=Q(r);if(!Ky.has(i)){t("error",`Unknown scale property "${i}". Allowed: ${[...Ky].join(", ")}.`,{node:r,property:"key"});continue}n.has(i)&&t("error",`Duplicate scale property "${i}".`,{node:r,property:"key"}),n.add(i),i==="label-every"&&(!Jy.test(r.value)||parseInt(r.value,10)<=0)&&t("error",`"label-every" must be a positive integer, got "${r.value}".`,{node:r,property:"value"})}}function lR(e,t){let n=Fr(e),r=Za(e),{own:i}=r;for(let c of e.properties)$g.has(Q(c))||Z(t,"error",{node:c,property:"key"},"NL.E0901",{kind:n,key:Q(c)});r.shape==="malformed"&&Z(t,"error",{node:e},"NL.E0900",{kind:n});let o=i.get("date");o&&o.values.length>0&&o.values.forEach((c,u)=>{He(c)||Z(t,"error",{node:o,property:"values",index:u},"NL.E0405",{key:"date",value:c})});for(let c of["start","end"]){let u=i.get(c);u&&u.values.length>1?Z(t,"error",{node:u},"NL.E0902",{kind:n,key:c}):u&&u.values.length===1&&!He(u.values[0])&&Z(t,"error",{node:u,property:"values",index:0},"NL.E0405",{key:c,value:u.values[0]})}let{start:s,end:a}=r;s&&a&&a<s&&Z(t,"error",{node:i.get("end"),property:"value"},"NL.E0903",{start:s,end:a});let l=i.get("every");if(l){let c=new Set;(l.value!==void 0?[l.value]:l.values).forEach((f,d)=>{let p=l.values.length>0?{node:l,property:"values",index:d}:{node:l,property:"value"};Cg(f)?c.has(f)&&Z(t,"error",p,"NL.E0905",{value:f}):Z(t,"error",p,"NL.E0904",{value:f}),c.add(f)})}}function cR(e,t){let n=e.roadmapDecl;if(!n)return;let r=e.configEntries.filter(fR),i=r.map(y=>({decl:y,facts:Za(y)})).filter(({facts:y})=>y.wellFormed),o=y=>y.weekdays??[],s=i.filter(({facts:y})=>y.shape==="open-recurrence"),a=n.properties.find(y=>Q(y)==="calendar"),l=e.configEntries.find(za),c=a?.value==="custom"&&l!==void 0,u=a?.value==="full",f=c?l.properties.find(y=>Q(y)==="days-per-week"):void 0,d=parseInt(f?.value??"",10),p=c?Number.isFinite(d)&&d>0?d:iR:u?7:iR,m=Gf(r),g=new Set(!c&&!u&&!m?[0,6]:[]);for(let{decl:y,facts:E}of s)if(Nr(y))for(let _ of o(E))g.add(_);for(let{decl:y,facts:E}of s)if(qa(y))for(let _ of o(E))g.delete(_);if(g.size===7)for(let{decl:y}of s)Nr(y)&&Z(t,"error",{node:y},"NL.E0906");for(let{decl:y,facts:E}of i){if(!Nr(y)||E.shape!=="half-bounded-recurrence")continue;new Set([...g,...o(E)]).size===7&&Z(t,"error",{node:y},"NL.E0906")}let w=7-g.size;if(w===0||w===p)return;let x=c?f?{node:f,property:"value"}:{node:l}:a?{node:a}:s.length>0?{node:s[0].decl}:{node:n};Z(t,"warning",x,"NL.W0705",{daysPerWeek:p,working:w})}function uR(e,t){let n=new Map;for(let r of e.configEntries){if(!fR(r)||!r.name)continue;let i=`${r.$type}:${r.name}`;n.has(i)?Z(t,"error",{node:r,property:"name"},"NL.E0907",{kind:Fr(r),name:r.name}):n.set(i,r)}}var iR=5;function fR(e){return Nr(e)||qa(e)}function pR(e,t){e.properties.find(r=>Q(r)==="date")||Z(t,"error",{node:e},"NL.E0500",{name:Re(e)})}function hR(e,t){let n=e.properties.find(s=>Q(s)==="date");if(!n?.value)return;let r=n.value;if(!He(r))return;let i=new Date(r),o=bl(e.$container);switch(o.kind){case"invalid":return;case"missing":Z(t,"error",{node:n,property:"value"},"NL.E0501",{name:Re(e)});return;case"valid":i<o.date&&Z(t,"error",{node:n,property:"value"},"NL.E0502",{name:Re(e),date:r,start:o.iso});return}}function mR(e,t){let n=e.properties.some(i=>Q(i)==="date"),r=e.properties.some(i=>Q(i)==="after");!n&&!r&&Z(t,"error",{node:e},"NL.E0503",{name:Re(e)})}function gR(e,t){let n=e.properties.find(s=>Q(s)==="date");if(!n?.value)return;let r=n.value;if(!He(r))return;let i=new Date(r),o=bl(e.$container);switch(o.kind){case"invalid":return;case"missing":t("error",`Milestone "${Re(e)}" has a date but the roadmap is missing "start:". Add start:YYYY-MM-DD to the roadmap.`,{node:n,property:"value"});return;case"valid":i<o.date&&Z(t,"error",{node:n,property:"value"},"NL.E0504",{name:Re(e),date:r,start:o.iso});return}}function yR(e,t){e.properties.some(r=>Q(r)==="on")||Z(t,"error",{node:e},"NL.E0505")}function xR(e,t){for(let n of e.properties)Q(n)==="footnote"&&t("error",`Property "footnote:" is not valid on ${kl(e)}. Footnotes attach via "on:" on the footnote declaration \u2014 declare \`footnote <id> on:<target-id>\` instead.`,{node:n})}function ER(e,t){let n=e.properties.some(i=>Q(i)==="duration"),r=e.properties.some(i=>Q(i)==="size");!n&&!r&&Z(t,"error",{node:e},"NL.E0600",{name:Re(e)})}function wR(e,t){for(let n of e.properties){let r=Q(n);(r==="size"||r==="duration"||r==="remaining"||r==="capacity")&&t("error",`"${r}" is not valid on ${e.$type==="ParallelBlock"?"parallel":"group"} (computed from children).`,{node:n})}}function TR(e,t){let n=e.content.filter(r=>!ja(r));n.length===0?t("error","Parallel block must contain at least 2 children.",{node:e}):n.length===1&&t("warning","Parallel block has only 1 child. Use at least 2 for parallel execution.",{node:e})}function vR(e,t){e.content.filter(r=>!ja(r)).length===0&&t("error","Group must contain at least 1 child.",{node:e})}function _R(e,t){e.properties.find(r=>Q(r)==="effort")||t("error",`Size "${Re(e)}" requires an "effort:" property.`,{node:e}),e.name&&($i.test(e.name)||QI.test(e.name))&&t("error",`Size id "${e.name}" collides with the raw duration pattern. Choose a different name (e.g. "xs", "small", "quarter").`,{node:e,property:"name"})}function AR(e,t){e.name&&Nd.has(e.name)&&t("error",`Status id "${e.name}" collides with the built-in status value. Built-ins: ${zf.join(", ")}.`,{node:e,property:"name"})}function kR(e,t){let n=new Map;for(let r of e.roadmapEntries)if(xi(r)&&r.name){let i=n.get(r.name);i?t("error",`Duplicate size id "${r.name}". First declared at ${Ci(i)}.`,{node:r,property:"name"}):n.set(r.name,r)}}function IR(e,t){if(nt(e)&&e.entityType!=="swimlane")return;let n=e.properties.find(s=>Q(s)==="utilization-warn-at"),r=e.properties.find(s=>Q(s)==="utilization-over-at");if(!n||!r)return;let i=dR(n.value),o=dR(r.value);i===null||o===null||i>o&&t("error",`utilization-warn-at (${n.value}) must be \u2264 utilization-over-at (${r.value}). Warn fires below over; if both fire at the same point, the warn band collapses to zero.`,{node:n,property:"value"})}function RR(e,t){let n=new Map,r=o=>!!o.title||o.properties.length>0||o.description!==void 0,i=o=>{if(!o.name)return;let s=r(o);n.has(o.name)||n.set(o.name,[]),n.get(o.name).push({node:o,isDeclaration:s}),!s&&o.$container.$type==="NowlineFile"&&t("warning",`Bare "person ${o.name}" at roadmap top level has no declaration. Either add properties (title, link, etc.) or remove the line.`,{node:o})};for(let o of Mn(e))Va(o)&&i(o);for(let[o,s]of n){let a=s.filter(l=>l.isDeclaration);if(a.length>1)for(let l=1;l<a.length;l++)t("error",`Person "${o}" is declared more than once. First declaration at ${Ci(a[0].node)}.`,{node:a[l].node})}}function dR(e){if(!e||e===Qa)return null;if(Pl.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?t/100:null}if(Pd.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?t:null}return null}function SR(e,t){if(Li(e))return;let n=Q(e),r=e.value,i=e.values,o=r?[r]:i;switch(n){case"status":break;case"duration":r&&!$i.test(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0400",{value:r});break;case"size":r&&!bd(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0401",{value:r});break;case"effort":r&&!$i.test(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0402",{value:r});break;case"remaining":{if(r)if(qI.test(r)){let s=parseFloat(r);(s<0||s>100)&&Z(t,"error",{node:e,property:"value"},"NL.E0404",{value:r})}else $i.test(r)||Z(t,"error",{node:e,property:"value"},"NL.E0403",{value:r});break}case"date":case"start":case"end":r&&!He(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0405",{key:n,value:r});break;case"scale":r&&!$i.test(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0406",{value:r});break;case"calendar":r&&!jI.has(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0407",{value:r});break;case"on":case"after":case"before":o.length===0&&Z(t,"error",{node:e},"NL.E0408",{key:n});break;case"capacity":{if(!r)break;let s=e.$container,a=Y2(s);if(a==="invalid")break;a==="lane"?(!Qy.test(r)||parseFloat(r)<=0)&&t("error",`Invalid swimlane capacity "${r}". Use a positive integer (e.g. capacity:5) or decimal (e.g. capacity:1.5). Percent literals are not allowed on swimlanes.`,{node:e,property:"value"}):Pl.test(r)?parseFloat(r)<=0&&t("error",`Item capacity "${r}" must be positive.`,{node:e,property:"value"}):Qy.test(r)?parseFloat(r)<=0&&t("error",`Item capacity "${r}" must be positive.`,{node:e,property:"value"}):t("error",`Invalid item capacity "${r}". Use a positive integer (capacity:2), decimal (capacity:0.5), or percent literal (capacity:50%).`,{node:e,property:"value"});break}case"overcapacity":{t("error",'"overcapacity:" was removed. Use "utilization-over-at:none" (and/or "utilization-warn-at:none") to suppress the lane utilization underline.',{node:e});break}case"utilization-warn-at":case"utilization-over-at":{if(!r)break;if(!V2(e.$container)){t("error",`"${n}:" is only valid on "swimlane" or "default swimlane".`,{node:e});break}if(r===Qa)break;if(Pl.test(r)){parseFloat(r)<=0&&t("error",`${n} value "${r}" must be positive.`,{node:e,property:"value"});break}if(Pd.test(r)){parseFloat(r)<=0&&t("error",`${n} value "${r}" must be positive.`,{node:e,property:"value"});break}if(eR.test(r)){t("error",`Ambiguous ${n} value "${r}". Use the percent form ("${r}%") or the decimal-fraction form ("0.${r}") to make the intent explicit.`,{node:e,property:"value"});break}t("error",`Invalid ${n} value "${r}". Use a positive percent (e.g. 80%), a positive decimal fraction (e.g. 0.8), or "none" to opt out.`,{node:e,property:"value"});break}case"capacity-icon":break;case"icon":break;case"non-working":nt(e.$container)&&OR(r,e,t);break;default:if(Nl.has(n)){if(n==="bg"||n==="fg"||n==="text")r&&!PR(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0801",{value:r,key:n});else if(n in Ll){let s=Ll[n];r&&!s.has(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0802",{value:r,key:n,allowed:[...s].join(", ")})}}break}}function bR(e,t){for(let n of e.properties){let r=Q(n);Nl.has(r)&&Z(t,"error",{node:n},"NL.E0804",{key:r,entity:kl(e)})}}function NR(e,t){let n=VI[e.$type];if(!n)return;let r=e.$type==="ParallelBlock"||e.$type==="GroupBlock"?new Set(["size","duration","remaining","capacity"]):null;for(let i of e.properties){let o=Q(i);if(n.has(o)||Zy.has(o)||Nl.has(o)||o==="footnote"||r?.has(o)||o==="wave"||Li(i))continue;let s=[...n,...Zy],a=KI(o,n,e.$type)??xI(o,s)??"";Z(t,"warning",{node:i,property:"key"},"NL.W0700",{key:o,entity:kl(e),suggested:a})}}function LR(e,t){let n=Q(e),r=e.value;if(n==="bg"||n==="fg"||n==="text")PR(r)||Z(t,"error",{node:e,property:"value"},"NL.E0801",{value:r,key:n});else if(n==="non-working")OR(r,e,t);else if(n in Ll){let i=Ll[n];i.has(r)||Z(t,"error",{node:e,property:"value"},"NL.E0802",{value:r,key:n,allowed:[...i].join(", ")})}else Nl.has(n)||Z(t,"error",{node:e,property:"key"},"NL.E0803",{key:n})}function PR(e){return zI.has(e)||ZI.test(e)}function OR(e,t,n){e===void 0||GI.has(e)||Z(n,"error",{node:t,property:"value"},"NL.E0800",{value:e})}function Y2(e){return e?Ke(e)?"lane":Ve(e)?"item":nt(e)?e.entityType==="swimlane"?"lane":"item":"invalid":"invalid"}function V2(e){return e?!!(Ke(e)||nt(e)&&e.entityType==="swimlane"):!1}function CR(e,t){let n=new Map,r=new Map;for(let i=0;i<e.roadmapEntries.length;i++){let o=e.roadmapEntries[i];xi(o)&&o.name?n.has(o.name)||n.set(o.name,i):Ka(o)&&o.name&&(r.has(o.name)||r.set(o.name,i))}for(let i=0;i<e.roadmapEntries.length;i++){let o=e.roadmapEntries[i];Xf(o,s=>{if(Li(s))return;let a=Q(s);if(a==="size"&&s.value){let l=s.value,c=n.get(l);c===void 0?t("error",`Size "${l}" is not declared. Add "size ${l} effort:<literal>" earlier in the roadmap section.`,{node:s,property:"value"}):c>=i&&t("error",`Size "${l}" is referenced before its declaration. Move "size ${l}" above this entity.`,{node:s,property:"value"})}else if(a==="status"&&s.value){let l=s.value;if(Nd.has(l))return;let c=r.get(l);c===void 0?t("error",`Status "${l}" is not a built-in and has no declaration. Add "status ${l}" earlier in the roadmap section.`,{node:s,property:"value"}):c>=i&&t("error",`Status "${l}" is referenced before its declaration. Move "status ${l}" above this entity.`,{node:s,property:"value"})}})}}function $R(e,t){for(let{prop:n,key:r,value:i}of Rd(e))Z(t,"error",{node:n},"NL.E0302",{key:r,value:i})}function DR(e,t){let n=bl(e),r=i=>{let o=i.properties??[],s=vt(i),a=Ve(i)||et(i)||$e(i)||s;for(let l of o){let c=Q(l);if(c!=="after"&&c!=="before"||s&&c==="before")continue;let f=(l.value?[l.value]:l.values).filter(d=>!!d&&ot.test(d));if(f.length!==0){if(!a){Z(t,"error",{node:l},"NL.E0411",{key:c,type:Fr(i)});continue}f.length>1&&Z(t,"error",{node:l},"NL.E0410",{key:c});for(let d of f){if(!He(d)){Z(t,"error",l.value!==void 0?{node:l,property:"value"}:{node:l,property:"values",index:l.values.indexOf(d)},"NL.E0405",{key:c,value:d});continue}switch(n.kind){case"invalid":continue;case"missing":Z(t,"error",{node:l},"NL.E0412",{key:c,date:d});continue;case"valid":{let p=_e(d);p&&p<n.date&&Z(t,"error",{node:l},"NL.E0413",{key:c,date:d,start:n.iso})}}}}}};for(let i of Mn(e))FR(i)||r(i)}function MR(e,t){let n=new Map,r=(d,p)=>{n.has(d)||n.set(d,new Set),n.get(d).add(p)},i=(d,p,m)=>{if(d)for(let g of p){let w=Q(g);if(w==="after"){let x=g.value?[g.value]:g.values;for(let y of x)y&&(ot.test(y)||r(d,y))}else if(w==="before"){let x=g.value?[g.value]:g.values;for(let y of x)y&&(ot.test(y)||r(y,d))}}},o=d=>{if(vt(d))return;let p=d.name,m=d.properties??[];i(p,m,e)};for(let d of Mn(e))FR(d)||o(d);let s=0,a=1,l=2,c=new Map;for(let d of n.keys())c.set(d,s);let u=new Set,f=(d,p)=>{c.set(d,a),p.push(d);for(let m of n.get(d)??[]){let g=c.get(m)??s;if(g===a){let w=p.indexOf(m),x=p.slice(w).concat(m),y=[...x].sort().join("\u2192");u.has(y)||(u.add(y),t("error",`Circular dependency detected: ${x.join(" \u2192 ")}.`,{node:e.roadmapDecl??e}))}else g===s&&f(m,p)}p.pop(),c.set(d,l)};for(let d of n.keys())(c.get(d)??s)===s&&f(d,[])}function FR(e){return tn(e)&&tn(e.$container)}function BR(e,t){let n=e.hasConfig?kc.findNodeForKeyword(e.$cstNode,"config")?.offset:void 0,r=e.roadmapDecl?.$cstNode?.offset;n!==void 0&&r!==void 0&&n>r&&Z(t,"error",{node:e,property:"hasConfig"},"NL.E0001");for(let i of e.includes){let o=i.$cstNode?.offset??0;n!==void 0&&o>n&&Z(t,"error",{node:i},"NL.E0002"),r!==void 0&&o>r&&Z(t,"error",{node:i},"NL.E0003")}}function WR(e,t){if(!JI.test(e.version)){Z(t,"error",{node:e,property:"version"},"NL.E0100",{version:e.version});return}let n=parseInt(e.version.slice(1),10),r=parseInt(Yy.slice(1),10);n>r&&Z(t,"error",{node:e,property:"version"},"NL.E0101",{version:e.version,supported:Yy})}function XR(e,t){let n=new Set;for(let r of e.properties){let i=Q(r);if(!ex.has(i)){Z(t,"error",{node:r,property:"key"},"NL.E0102",{key:i,allowed:[...ex].join(", ")});continue}if(n.has(i)&&Z(t,"error",{node:r,property:"key"},"NL.E0103",{key:i}),n.add(i),i==="locale"){let o=r.value;nR.test(o)||Z(t,"error",{node:r,property:"value"},"NL.E0104",{value:o})}}}function UR(e,t){!e.name&&!e.title&&Z(t,"error",{node:e},"NL.E0301",{type:e.$type})}function GR(e,t){let n=new Map,r=(i,o)=>{if(!i)return;let s=n.get(i);s?Z(t,"error",{node:o},"NL.E0300",{name:i,location:Ci(s)}):n.set(i,o)};e.roadmapDecl?.name&&r(e.roadmapDecl.name,e.roadmapDecl);for(let i of e.roadmapEntries)Uf(i,r);for(let i of e.configEntries)Wt(i)&&i.name&&r(i.name,i)}function HR(e,t){let n=e.$document?.textDocument.getText()??e.$cstNode?.text;if(!n)return;let r=n.split(/\r?\n/);for(let i=0;i<r.length;i++){let o=r[i];if(o.length===0)continue;let s=o.match(/^([\t ]+)/);if(!s)continue;let a=s[1];if(a.includes(" ")&&a.includes(" ")){Z(t,"error",{node:e},"NL.E0005",{line:i+1});return}}}function zR(e,t){if(Wy(e))return;let n=e.roadmapEntries.some(Ke);e.roadmapDecl&&!n&&Z(t,"error",{node:e.roadmapDecl},"NL.E0004")}function jR(e,t){rR.has(e.value)||Z(t,"error",{node:e,property:"value"},"NL.E0200",{value:e.value})}function YR(e,t){let n=new Set;for(let r of e.options){let i=Q(r);n.has(i)&&Z(t,"error",{node:r},"NL.E0201",{key:i}),n.add(i)}}function VR(e,t){if(!qy.has(e.entityType)){t("error",`"${e.entityType}" is not a supported entity type for default. Allowed: ${[...qy].join(", ")}.`,{node:e,property:"entityType"});return}let n=e.$container,r=-1;for(let o=0;o<n.configEntries.length;o++){let s=n.configEntries[o];if(nt(s)&&s.entityType===e.entityType){if(r<0)r=o;else if(s===e){t("error",`Duplicate "default ${e.entityType}" declaration. Only one is allowed per entity type per file.`,{node:e});break}}}let i=YI[e.entityType];if(i)for(let o of e.properties){let s=Q(o);i.has(s)&&t("error",Td(s,e.entityType),{node:o})}if(e.entityType!=="roadmap")for(let o of e.properties){let s=Q(o);HI.has(s)&&Z(t,"warning",{node:o,property:"key"},"NL.W0703",{key:s,entityType:e.entityType})}}function KR(e,t){let n=e.roadmapDecl;if(!n)return;let r=new Map,i=new Map;for(let c of e.configEntries)Wt(c)&&c.name&&!r.has(c.name)?r.set(c.name,c):nt(c)&&c.entityType==="roadmap"&&(i.has("roadmap")||i.set("roadmap",c));let o=new Map;for(let c of e.roadmapEntries)Ya(c)&&c.name&&!o.has(c.name)&&o.set(c.name,c);let s,a,l=c=>{for(let u of c){let f=Q(u);f==="header-height"?s=u:f==="timeline-position"&&(a=u)}};for(let c of Hf("roadmap",n.properties,{styles:r,defaults:i,labels:o}))switch(c.level){case"inline":break;case"default":l(c.props);break;case"label":return;default:if(!c.decl)return;l(c.decl.properties)}s?.value==="none"&&(a?.value!=="bottom"&&a?.value!=="both"||Z(t,"warning",{node:a,property:"value"},"NL.W0704",{position:a.value}))}function qR(e,t){e.name&&Vy.has(e.name)&&Z(t,"error",{node:e,property:"name"},"NL.E0805",{name:e.name,builtins:[...Ja].sort().join(", ")});let n=e.properties.find(i=>Q(i)==="unicode");n?(!n.value||n.value.length===0)&&Z(t,"error",{node:n,property:"value"},"NL.E0807",{name:Re(e)}):Z(t,"error",{node:e},"NL.E0806",{name:Re(e)});let r=e.properties.find(i=>Q(i)==="ascii");if(r){let i=r.value??"";tR.test(i)||Z(t,"error",{node:r,property:"value"},"NL.E0808",{name:Re(e),length:i.length})}for(let i of e.properties){let o=Q(i);o!=="unicode"&&o!=="ascii"&&o!=="link"&&o!=="description"&&Z(t,"error",{node:i,property:"key"},"NL.E0809",{key:o})}}function ZR(e,t){let n=new Map;for(let r of e.configEntries)if(Ei(r)&&r.name){let i=n.get(r.name);i?Z(t,"error",{node:r,property:"name"},"NL.E0810",{name:r.name,location:Ci(i)}):n.set(r.name,r)}}function JR(e,t){let n=new Map;for(let i=0;i<e.configEntries.length;i++){let o=e.configEntries[i];Ei(o)&&o.name&&(n.has(o.name)||n.set(o.name,i))}let r=(i,o,s,a)=>{if(o!=="icon"&&o!=="capacity-icon"||!s||!bd(s)||o==="capacity-icon"&&UI.has(s)||o==="icon"&&Vy.has(s))return;let l=n.get(s);if(l===void 0){let c=o==="capacity-icon"?[...wi].sort().join(", "):[...Ja].sort().join(", ");Z(t,"error",{node:a,property:"value"},"NL.E0811",{key:o,value:s,builtins:c})}else l>=i&&Z(t,"error",{node:a,property:"value"},"NL.E0812",{key:o,value:s})};for(let i=0;i<e.configEntries.length;i++){let o=e.configEntries[i];if(Wt(o))for(let s of o.properties)r(i,Q(s),s.value,s);else if(nt(o))for(let s of o.properties)r(i,Q(s),s.value,s)}}function QR(e){let t=e.validation.ValidationRegistry,n=e.validation.NowlineValidator,r={NowlineFile:[n.checkFileStructure,n.checkUniqueIdentifiers,n.checkSwimlaneRequired,n.checkIndentationConsistency,n.checkRoadmapOnlyKeywordsPosition,n.checkForwardReferences,n.checkReferenceResolution,n.checkInlineDatePins,n.checkCircularDependencies,n.checkWaves,n.checkDuplicateSizeIds,n.checkCalendarBlockConsistency,n.checkHiddenTimelineStrip,n.checkPersonDeclarations,n.checkDuplicateSymbolIds,n.checkSymbolReferences,n.checkCalendarWeek,n.checkDuplicateCalendarDeclarationIds],NowlineDirective:[n.checkDirectiveVersion,n.checkDirectiveProperties],IncludeOption:[n.checkIncludeMode],IncludeDeclaration:[n.checkIncludeDuplicateOptions],EntityProperty:[n.checkPropertyValues],RoadmapDeclaration:[n.checkEntityIdOrTitle,n.checkRoadmapProperties,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],AnchorDeclaration:[n.checkEntityIdOrTitle,n.checkAnchorRequiredDate,n.checkAnchorAgainstStart,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],SwimlaneDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkUtilizationOrdering,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],ItemDeclaration:[n.checkEntityIdOrTitle,n.checkItemRequiredDuration,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],ParallelBlock:[n.checkParallelMinChildren,n.checkNoComputedProperties,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],GroupBlock:[n.checkGroupMinChildren,n.checkNoComputedProperties,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],MilestoneDeclaration:[n.checkEntityIdOrTitle,n.checkMilestoneRequirement,n.checkMilestoneAgainstStart,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],FootnoteDeclaration:[n.checkEntityIdOrTitle,n.checkFootnoteOn,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],PersonDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],TeamDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],StyleDeclaration:[n.checkEntityIdOrTitle],StyleProperty:[n.checkStylePropertyEnum],SymbolDeclaration:[n.checkEntityIdOrTitle,n.checkSymbolDeclaration],NonWorkingDeclaration:[n.checkCalendarDeclaration],WorkingDeclaration:[n.checkCalendarDeclaration],LabelDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],SizeDeclaration:[n.checkEntityIdOrTitle,n.checkSizeDeclaration,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],StatusDeclaration:[n.checkEntityIdOrTitle,n.checkStatusDeclaration,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],WaveDeclaration:[n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],DefaultDeclaration:[n.checkDefaultDeclaration,n.checkUtilizationOrdering],CalendarBlock:[n.checkCalendarBlock],ScaleBlock:[n.checkScaleBlock]};t.register(r,n)}var Od=class{checkFileStructure(t,n){BR(t,n)}checkRoadmapOnlyKeywordsPosition(t,n){}checkDirectiveVersion(t,n){WR(t,n)}checkDirectiveProperties(t,n){XR(t,n)}checkEntityIdOrTitle(t,n){UR(t,n)}checkUniqueIdentifiers(t,n){GR(t,n)}checkIndentationConsistency(t,n){HR(t,n)}checkSwimlaneRequired(t,n){zR(t,n)}checkIncludeMode(t,n){jR(t,n)}checkIncludeDuplicateOptions(t,n){YR(t,n)}checkPropertyValues(t,n){SR(t,n)}checkAnchorRequiredDate(t,n){pR(t,n)}checkAnchorAgainstStart(t,n){hR(t,n)}checkMilestoneRequirement(t,n){mR(t,n)}checkMilestoneAgainstStart(t,n){gR(t,n)}checkFootnoteOn(t,n){yR(t,n)}checkNoFootnoteProperty(t,n){xR(t,n)}checkItemRequiredDuration(t,n){ER(t,n)}checkNoComputedProperties(t,n){wR(t,n)}checkParallelMinChildren(t,n){TR(t,n)}checkGroupMinChildren(t,n){vR(t,n)}checkNoRawStyleProperties(t,n){bR(t,n)}checkUnknownEntityProperties(t,n){NR(t,n)}checkRoadmapProperties(t,n){}checkStylePropertyEnum(t,n){LR(t,n)}checkSizeDeclaration(t,n){_R(t,n)}checkStatusDeclaration(t,n){AR(t,n)}checkWaves(t,n){for(let o of _d(t))Sd(n,o);for(let o of Ad(t))Sd(n,o);let r=on(t);if(r.length===0)return;let i={lanes:t.roadmapEntries.filter(Ke),lookup:_s(t)};for(let o of As(i,r))Sd(n,o)}checkDuplicateSizeIds(t,n){kR(t,n)}checkUtilizationOrdering(t,n){IR(t,n)}checkDefaultDeclaration(t,n){VR(t,n)}checkHiddenTimelineStrip(t,n){KR(t,n)}checkCalendarBlockConsistency(t,n){oR(t,n)}checkCalendarBlock(t,n){sR(t,n)}checkScaleBlock(t,n){aR(t,n)}checkForwardReferences(t,n){CR(t,n)}checkReferenceResolution(t,n){$R(t,n)}checkInlineDatePins(t,n){DR(t,n)}checkCircularDependencies(t,n){MR(t,n)}checkPersonDeclarations(t,n){RR(t,n)}checkSymbolDeclaration(t,n){qR(t,n)}checkDuplicateSymbolIds(t,n){ZR(t,n)}checkCalendarDeclaration(t,n){lR(t,n)}checkCalendarWeek(t,n){cR(t,n)}checkDuplicateCalendarDeclarationIds(t,n){uR(t,n)}checkSymbolReferences(t,n){JR(t,n)}};var tx=class extends $o{runConverter(t,n,r){return t.name==="PROPERTY_KEY_WITH_COLON"||t.name==="INCLUDE_OPTION_KEY"?n.endsWith(":")?n.slice(0,-1):n:super.runConverter(t,n,r)}},nx=class extends Fa{isStartOfLine(t,n){if(!super.isStartOfLine(t,n))return!1;let r=n-1;for(;r>=0&&(t[r]===" "||t[r]===" ");)r--;for(;r>=0&&(t[r]==="\r"||t[r]===`
2917
- `);)r--;for(;r>=0&&(t[r]===" "||t[r]===" ");)r--;return r<0||t[r]!=="\\"}},eS={parser:{TokenBuilder:()=>new nx({indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[["[","]"]]}),Lexer:e=>new Cf(e),ParserConfig:()=>({maxLookahead:4}),ValueConverter:()=>new tx},validation:{NowlineValidator:()=>new Od}};function rx(e={}){let t=e.shared??Go(Of($f),qk),n=Go(Pf({shared:t}),Zk,eS);return t.ServiceRegistry.register(n),QR(n),{shared:t,Nowline:n}}function ix(e,t){return t.code===void 0?t.message:ht(e,t.code,...t.args??[])}function Di(e){let{content:t}=e,n=[...t.waves?.values()??[]];if(n.length===0)return;let r=new Map;n.forEach((u,f)=>{r.set(u.name,f+1)});let i=ks(t),o=n.map(u=>Rl(u,i)),s=new WeakMap,a=new WeakMap,l=u=>{let f=vd(u,r);for(let[d,p]of f.waveOf)s.set(d,p);for(let[d,p]of f.leadOf)a.set(d,p)};l([...t.swimlanes.values()]);for(let u of t.isolatedRegions)l([...u.content.swimlanes.values()]);let c=u=>Ve(u)?s.get(u):void 0;return{waves:n,index:r,floors:o,waveOf:s,leadOf:a,memberWave:c,isMember:(u,f)=>{let d=c(u);return d!==void 0&&(f===void 0||d===f)}}}var Ol="en-US",eB={"en-US":{nowLabel:"now",quarterPrefix:"Q",waveHeldBy:"held by",waveNoItems:"no items",waveBackgroundItem:"Background (no wave)",waveLegendBackground:"Background work (not in a wave)"},fr:{nowLabel:"maint.",quarterPrefix:"T",waveHeldBy:"retenue par",waveNoItems:"aucun \xE9l\xE9ment",waveBackgroundItem:"Travail de fond (hors vague)",waveLegendBackground:"Travail de fond (dans aucune vague)"}};function tS(e,t){return t??e??Ol}function Yn(e){let t={};for(let n of tB(e)){let r=eB[n];if(r)for(let i of Object.keys(r))t[i]===void 0&&r[i]!==void 0&&(t[i]=r[i])}return t}function tB(e){let t=[],n=nB(e);for(;n.length>0;){t.includes(n)||t.push(n);let r=n.lastIndexOf("-");if(r<=0)break;n=n.slice(0,r)}return t.includes(Ol)||t.push(Ol),t}function nB(e){return e.split("-").map((n,r)=>r===0?n.toLowerCase():/^[a-zA-Z]{2}$/.test(n)?n.toUpperCase():n).join("-")}function Cd(e){return e==="hide"||e==="show"}var nS={red:"#f87171",blue:"#60a5fa",yellow:"#facc15",green:"#34d399",orange:"#fb923c",purple:"#a78bfa",gray:"#94a3b8",navy:"#818cf8",white:"#e2e8f0"},Vn={bg:"none",fg:"#e2e8f0",text:"#e2e8f0",border:"solid",icon:"none",shadow:"none",font:"sans",weight:"normal",italic:!1,textSize:"md",padding:"sm",spacing:"sm",headerHeight:"sm",cornerRadius:"sm",bracket:"none",capacityIcon:"multiplier"},ox={name:"dark",surface:{page:"#0b1220",chart:"#111827",headerBox:"#1e293b"},entities:{roadmap:{...Vn,headerHeight:"md",padding:"md"},swimlane:{...Vn,fg:"#e2e8f0",text:"#e2e8f0",padding:"sm",spacing:"none",textSize:"sm"},item:{...Vn,bg:"#0f172a",fg:"#94a3b8",text:"#e2e8f0",shadow:"subtle",cornerRadius:"sm"},parallel:{...Vn,bg:"#8c84ff",bracket:"dashed",padding:"xs"},group:{...Vn,bg:"#f0a832",bracket:"solid",padding:"xs",fg:"#94a3b8"},anchor:{...Vn,bg:"#0b1220",fg:"#cbd5e1",text:"#cbd5e1",cornerRadius:"sm"},milestone:{...Vn,bg:"#e2e8f0",fg:"#e2e8f0",text:"#0b1220",border:"solid"},footnote:{...Vn,bg:"none",fg:"#94a3b8",text:"#e2e8f0",textSize:"sm"},label:{...Vn,bg:"#1e293b",fg:"#94a3b8",text:"#e2e8f0",textSize:"xs",padding:"xs",cornerRadius:"full"}},swimlane:{bandEven:"#111827",bandOdd:"#0f172a",separator:"#1f2937",frameTabText:"#e2e8f0",frameTabMuted:"#94a3b8",border:"#334155",tabFill:"#1e293b",tabStroke:"#475569",tabText:"#e2e8f0",ownerText:"#94a3b8",footnoteIndicator:"#f87171",rowTintEven:"#0f172a",rowTintOdd:"#1e293b",utilizationOk:"#34d399",utilizationWarn:"#fbbf24",utilizationOver:"#f87171"},timeline:{gridLine:"#475569",minorGridLine:"#334155",nonWorkingSeam:"#6b7a90",nonWorkingFill:"#94a3b8",tickMark:"#334155",labelText:"#cbd5e1",panelFill:"#0f172a",border:"#334155"},header:{cardBorder:"#475569",author:"#94a3b8"},item:{overflowX:"#f87171",linkIconFg:"#94a3b8",overflowTailFill:"#7f1d1d",overflowTailStroke:"#f87171",overflowCaption:"#fecaca"},parallel:{bracketStroke:"#cbd5e1"},anchorDiamond:{fill:"#0f172a",stroke:"#cbd5e1",label:"#cbd5e1",cutLine:"#94a3b8"},milestoneDiamond:{fill:"#e2e8f0",label:"#e2e8f0",cutLineNormal:"#a5b4fc",cutLineOverrun:"#ef4444",slack:"#cbd5e1"},footnotePanel:{fill:"#0f172a",border:"#334155",header:"#e2e8f0",title:"#e2e8f0",description:"#94a3b8",number:"#f87171"},nowline:{stroke:"#f87171",labelText:"#0b1220",labelBg:"#f87171"},milestone:{dashedInk:"#a5b4fc",overrun:"#ef4444"},anchor:{predecessorLine:"#94a3b8"},dependency:{edgeStroke:"#cbd5e1",overflowStroke:"#ef5350"},footnote:{indicatorText:"#f87171",descriptionMuted:"#94a3b8"},includeRegion:{border:"#475569",label:"#cbd5e1",badge:"#94a3b8",fill:"#0b1220",tabFill:"#111827",tabStroke:"#475569",tabText:"#e2e8f0",badgeFill:"#1e293b",badgeStroke:"#475569",badgeText:"#94a3b8"},wave:{stripFill:"#042f2e",stripFillAlt:"#134e4a",labelText:"#99f6e4",labelMuted:"#5eead4",boundary:"#2dd4bf",hatch:"#0f172a",hatchOnDark:"#ffffff"},arrowhead:{neutral:"#94a3b8",light:"#64748b",dark:"#e2e8f0"},status:{done:"#34d399",inProgress:"#60a5fa",atRisk:"#facc15",blocked:"#ef4444",planned:"#94a3b8",neutral:"#94a3b8"},statusTint:{done:"#052e16",inProgress:"#172554",atRisk:"#422006",blocked:"#7f1d1d",planned:"#1e293b",neutral:"#1e293b"},statusDot:{onLight:{done:"#065f46",inProgress:"#1e3a8a",atRisk:"#92400e",blocked:"#991b1b",planned:"#334155",neutral:"#334155"},onDark:{done:"#d1fae5",inProgress:"#dbeafe",atRisk:"#fef3c7",blocked:"#fee2e2",planned:"#e2e8f0",neutral:"#e2e8f0"}},attribution:{mark:"#cbd5e1",link:"#f87171"},diagnostic:{overlayBg:"#7f1d1d",errorText:"#fecaca"}};var rS={red:"#4a4a4a",blue:"#6b6b6b",green:"#8a8a8a",yellow:"#c8c8c8",orange:"#5c5c5c",purple:"#3a3a3a",gray:"#9e9e9e",navy:"#2a2a2a",white:"#ffffff"},Kn={bg:"none",fg:"#1a1a1a",text:"#1a1a1a",border:"solid",icon:"none",shadow:"none",font:"sans",weight:"normal",italic:!1,textSize:"md",padding:"sm",spacing:"sm",headerHeight:"sm",cornerRadius:"sm",bracket:"none",capacityIcon:"multiplier"},sx={name:"grayscale",surface:{page:"#f5f5f5",chart:"#ffffff",headerBox:"#ffffff"},entities:{roadmap:{...Kn,headerHeight:"md",padding:"md"},swimlane:{...Kn,fg:"#3a3a3a",text:"#3a3a3a",padding:"sm",spacing:"none",textSize:"sm"},item:{...Kn,bg:"#ffffff",fg:"#9e9e9e",text:"#1a1a1a",shadow:"subtle",cornerRadius:"sm"},parallel:{...Kn,bg:"#9e9e9e",bracket:"dashed",padding:"xs"},group:{...Kn,bg:"#595959",bracket:"solid",padding:"xs",fg:"#595959"},anchor:{...Kn,bg:"#1a1a1a",fg:"#1a1a1a",text:"#1a1a1a",cornerRadius:"sm"},milestone:{...Kn,bg:"#2a2a2a",fg:"#2a2a2a",text:"#ffffff",border:"solid"},footnote:{...Kn,bg:"none",fg:"#595959",text:"#595959",textSize:"sm"},label:{...Kn,bg:"#e8e8e8",fg:"#595959",text:"#595959",textSize:"xs",padding:"xs",cornerRadius:"full"}},swimlane:{bandEven:"#ffffff",bandOdd:"#f5f5f5",separator:"#d4d4d4",frameTabText:"#3a3a3a",frameTabMuted:"#737373",border:"#d4d4d4",tabFill:"#e8e8e8",tabStroke:"#bdbdbd",tabText:"#3a3a3a",ownerText:"#737373",footnoteIndicator:"#4a4a4a",rowTintEven:"#ffffff",rowTintOdd:"#f5f5f5",utilizationOk:"#8a8a8a",utilizationWarn:"#595959",utilizationOver:"#1a1a1a"},timeline:{gridLine:"#bdbdbd",minorGridLine:"#d4d4d4",nonWorkingSeam:"#9a9a9a",nonWorkingFill:"#737373",tickMark:"#bdbdbd",labelText:"#737373",panelFill:"#ffffff",border:"#d4d4d4"},header:{cardBorder:"#d4d4d4",author:"#737373"},item:{overflowX:"#1a1a1a",linkIconFg:"#1a1a1a",overflowTailFill:"#e8e8e8",overflowTailStroke:"#4a4a4a",overflowCaption:"#3a3a3a"},parallel:{bracketStroke:"#3a3a3a"},anchorDiamond:{fill:"#ffffff",stroke:"#3a3a3a",label:"#3a3a3a",cutLine:"#737373"},milestoneDiamond:{fill:"#1a1a1a",label:"#1a1a1a",cutLineNormal:"#2a2a2a",cutLineOverrun:"#4a4a4a",slack:"#1a1a1a"},footnotePanel:{fill:"#ffffff",border:"#d4d4d4",header:"#1a1a1a",title:"#1a1a1a",description:"#737373",number:"#4a4a4a"},nowline:{stroke:"#1a1a1a",labelText:"#ffffff",labelBg:"#1a1a1a"},milestone:{dashedInk:"#9e9e9e",overrun:"#4a4a4a"},anchor:{predecessorLine:"#9e9e9e"},dependency:{edgeStroke:"#595959",overflowStroke:"#1a1a1a"},footnote:{indicatorText:"#4a4a4a",descriptionMuted:"#737373"},includeRegion:{border:"#9e9e9e",label:"#3a3a3a",badge:"#737373",fill:"#f5f5f5",tabFill:"#ffffff",tabStroke:"#bdbdbd",tabText:"#1a1a1a",badgeFill:"#e8e8e8",badgeStroke:"#bdbdbd",badgeText:"#595959"},wave:{stripFill:"#fafafa",stripFillAlt:"#e0e0e0",labelText:"#212121",labelMuted:"#616161",boundary:"#616161",hatch:"#000000",hatchOnDark:"#ffffff"},arrowhead:{neutral:"#595959",light:"#9e9e9e",dark:"#1a1a1a"},status:{done:"#8a8a8a",inProgress:"#595959",atRisk:"#737373",blocked:"#3a3a3a",planned:"#bdbdbd",neutral:"#bdbdbd"},statusTint:{done:"#ebebeb",inProgress:"#e4e4e4",atRisk:"#eeeeee",blocked:"#dcdcdc",planned:"#f5f5f5",neutral:"#f5f5f5"},statusDot:{onLight:{done:"#3a3a3a",inProgress:"#2a2a2a",atRisk:"#4a4a4a",blocked:"#1a1a1a",planned:"#595959",neutral:"#595959"},onDark:{done:"#d4d4d4",inProgress:"#e8e8e8",atRisk:"#c8c8c8",blocked:"#f0f0f0",planned:"#d4d4d4",neutral:"#d4d4d4"}},attribution:{mark:"#9e9e9e",link:"#1a1a1a"},diagnostic:{overlayBg:"#e8e8e8",errorText:"#1a1a1a"}};var iS={red:"#e53935",blue:"#1e88e5",yellow:"#fdd835",green:"#43a047",orange:"#fb8c00",purple:"#8e24aa",gray:"#9e9e9e",navy:"#0d47a1",white:"#ffffff"},qn={bg:"none",fg:"#0f172a",text:"#0f172a",border:"solid",icon:"none",shadow:"none",font:"sans",weight:"normal",italic:!1,textSize:"md",padding:"sm",spacing:"sm",headerHeight:"sm",cornerRadius:"sm",bracket:"none",capacityIcon:"multiplier"},ax={name:"light",surface:{page:"#f8fafc",chart:"#ffffff",headerBox:"#ffffff"},entities:{roadmap:{...qn,headerHeight:"md",padding:"md"},swimlane:{...qn,fg:"#334155",text:"#334155",padding:"sm",spacing:"none",textSize:"sm"},item:{...qn,bg:"#ffffff",fg:"#94a3b8",text:"#0f172a",shadow:"subtle",cornerRadius:"sm"},parallel:{...qn,bg:"#635cf1",bracket:"dashed",padding:"xs"},group:{...qn,bg:"#ea9818",bracket:"solid",padding:"xs",fg:"#475569"},anchor:{...qn,bg:"#0f172a",fg:"#0f172a",text:"#0f172a",cornerRadius:"sm"},milestone:{...qn,bg:"#312e81",fg:"#312e81",text:"#ffffff",border:"solid"},footnote:{...qn,bg:"none",fg:"#475569",text:"#475569",textSize:"sm"},label:{...qn,bg:"#f1f5f9",fg:"#475569",text:"#475569",textSize:"xs",padding:"xs",cornerRadius:"full"}},swimlane:{bandEven:"#ffffff",bandOdd:"#f8fafc",separator:"#e2e8f0",frameTabText:"#334155",frameTabMuted:"#64748b",border:"#e2e8f0",tabFill:"#f1f5f9",tabStroke:"#cbd5e1",tabText:"#334155",ownerText:"#64748b",footnoteIndicator:"#dc2626",rowTintEven:"#ffffff",rowTintOdd:"#f8fafc",utilizationOk:"#10b981",utilizationWarn:"#f59e0b",utilizationOver:"#ef4444"},timeline:{gridLine:"#cbd5e1",minorGridLine:"#e2e8f0",nonWorkingSeam:"#a0aec0",nonWorkingFill:"#64748b",tickMark:"#cbd5e1",labelText:"#64748b",panelFill:"#ffffff",border:"#e2e8f0"},header:{cardBorder:"#e2e8f0",author:"#64748b"},item:{overflowX:"#dc2626",linkIconFg:"#0f172a",overflowTailFill:"#fee2e2",overflowTailStroke:"#ef4444",overflowCaption:"#b91c1c"},parallel:{bracketStroke:"#334155"},anchorDiamond:{fill:"#ffffff",stroke:"#334155",label:"#334155",cutLine:"#64748b"},milestoneDiamond:{fill:"#0f172a",label:"#0f172a",cutLineNormal:"#1e1b4b",cutLineOverrun:"#b91c1c",slack:"#0f172a"},footnotePanel:{fill:"#ffffff",border:"#e2e8f0",header:"#0f172a",title:"#0f172a",description:"#64748b",number:"#dc2626"},nowline:{stroke:"#e53e3e",labelText:"#ffffff",labelBg:"#e53e3e"},milestone:{dashedInk:"#94a3b8",overrun:"#ef4444"},anchor:{predecessorLine:"#94a3b8"},dependency:{edgeStroke:"#475569",overflowStroke:"#d32f2f"},footnote:{indicatorText:"#e53e3e",descriptionMuted:"#64748b"},includeRegion:{border:"#94a3b8",label:"#334155",badge:"#64748b",fill:"#f8fafc",tabFill:"#ffffff",tabStroke:"#cbd5e1",tabText:"#0f172a",badgeFill:"#e2e8f0",badgeStroke:"#cbd5e1",badgeText:"#475569"},wave:{stripFill:"#f0fdfa",stripFillAlt:"#ccfbf1",labelText:"#134e4a",labelMuted:"#0f766e",boundary:"#0d9488",hatch:"#0f172a",hatchOnDark:"#ffffff"},arrowhead:{neutral:"#475569",light:"#94a3b8",dark:"#0f172a"},status:{done:"#10b981",inProgress:"#3b82f6",atRisk:"#f59e0b",blocked:"#ef4444",planned:"#94a3b8",neutral:"#94a3b8"},statusTint:{done:"#ecfdf5",inProgress:"#eff6ff",atRisk:"#fffbeb",blocked:"#fee2e2",planned:"#f8fafc",neutral:"#f8fafc"},statusDot:{onLight:{done:"#065f46",inProgress:"#1e3a8a",atRisk:"#92400e",blocked:"#991b1b",planned:"#334155",neutral:"#334155"},onDark:{done:"#d1fae5",inProgress:"#dbeafe",atRisk:"#fef3c7",blocked:"#fee2e2",planned:"#e2e8f0",neutral:"#e2e8f0"}},attribution:{mark:"#94a3b8",link:"#e53e3e"},diagnostic:{overlayBg:"#fee2e2",errorText:"#991b1b"}};var oS=["light","dark","grayscale"],lx={light:ax,dark:ox,grayscale:sx};var rB={greyscale:"grayscale"};function cx(e){let t=e.toLowerCase(),n=rB[t]??t;return oS.find(r=>r===n)}var iB={grey:"gray",violet:"purple"};function Zn(e,t){if(e==="none")return"none";if(e.startsWith("#"))return e;let n=t.name==="dark"?nS:t.name==="grayscale"?rS:iS,r=iB[e]??e,i=n[r];return typeof i=="string"?i:e}function oB(e,t){return{bg:Zn(e.bg,t),fg:Zn(e.fg,t),text:Zn(e.text,t),border:e.border,icon:e.icon,shadow:e.shadow,font:e.font,weight:e.weight,italic:e.italic,textSize:e.textSize,padding:e.padding,spacing:e.spacing,headerHeight:e.headerHeight,cornerRadius:e.cornerRadius,bracket:e.bracket,headerPosition:"beside",capacityIcon:e.capacityIcon,timelinePosition:"top",minorGrid:!1,nonWorking:"hide"}}function sS(e,t,n,r){switch(t){case"bg":e.bg=Zn(n,r);break;case"fg":e.fg=Zn(n,r);break;case"text":e.text=Zn(n,r);break;case"border":(n==="solid"||n==="dashed"||n==="dotted")&&(e.border=n);break;case"icon":e.icon=n;break;case"shadow":(n==="none"||n==="subtle"||n==="soft"||n==="hard")&&(e.shadow=n);break;case"font":(n==="sans"||n==="serif"||n==="mono")&&(e.font=n);break;case"weight":(n==="thin"||n==="light"||n==="normal"||n==="bold")&&(e.weight=n);break;case"italic":e.italic=n==="true";break;case"text-size":e.textSize=Cl(n,"xl");break;case"padding":e.padding=Cl(n,"xl");break;case"spacing":e.spacing=Cl(n,"xl");break;case"header-height":e.headerHeight=Cl(n,"xl");break;case"corner-radius":e.cornerRadius=Cl(n,"full");break;case"bracket":(n==="none"||n==="solid"||n==="dashed")&&(e.bracket=n);break;case"header-position":(n==="beside"||n==="above")&&(e.headerPosition=n);break;case"capacity-icon":e.capacityIcon=n;break;case"timeline-position":(n==="top"||n==="bottom"||n==="both")&&(e.timelinePosition=n);break;case"minor-grid":e.minorGrid=n==="true";break;case"non-working":Cd(n)&&(e.nonWorking=n);break;default:break}}function Cl(e,t){let n=["none","xs","sm","md","lg","xl","full"],r=n.indexOf(t),i=n.indexOf(e);return i<0?"md":i>r?n[r]:n[i]}function sB(e,t,n){if(t)for(let r of t.properties)sS(e,Q(r),r.value,n)}function aB(e,t,n){for(let r of t){let i=Q(r);r.value!==void 0&&sS(e,i,r.value,n)}}function Se(e,t,n){let r=n.theme.entities[e],i=oB(r,n.theme);for(let o of Hf(e,t,n))switch(o.level){case"default":case"inline":aB(i,o.props,n.theme);break;case"label":break;default:sB(i,o.decl,n.theme)}return i}function aS(e,t){return Se("label",e.properties,t)}function cS(e,t){let r=At(e.roadmapDecl?.properties??[],"scale")?.value,i="weeks",o,s;if(r)if(r==="days"||r==="weeks"||r==="months"||r==="quarters"||r==="years")i=r;else{let c=/^(\d+)([dwmqy])$/.exec(r);if(c){let u=Math.max(1,parseInt(c[1],10));switch(c[2]){case"d":i="days";break;case"w":i="weeks";break;case"m":i="months";break;case"q":i="quarters";break;case"y":i="years";break}o=ux(i)*u,s=1}}let a=s??Sk[i]??4,l=c=>s===void 0&&!c?{labelEveryDefault:!0}:{};if(t){let c=At(t.properties,"label-every"),u=c&&parseInt(c.value,10)||0,f=u!==0?Math.max(1,u):a;return{unit:i,labelEvery:f,pixelsPerUnit:o??ux(i),...l(u!==0)}}return{unit:i,labelEvery:a,pixelsPerUnit:o??ux(i),...l(!1)}}function ux(e){switch(e){case"days":return Ak;case"weeks":return 40;case"months":return 80;case"quarters":return 160;case"years":return 320}}var lB=.5,fx=.5,$l=7;function Wr(e){return e==="months"||e==="quarters"||e==="years"}function $d(e,t){let n=e.getUTCFullYear(),r=e.getUTCMonth();switch(t){case"months":return new Date(Date.UTC(n,r+1,1));case"quarters":return new Date(Date.UTC(n,r-r%3+3,1));case"years":return new Date(Date.UTC(n+1,0,1))}}function cB(e,t){if(e.getUTCDate()!==1)return!1;let n=e.getUTCMonth();switch(t){case"months":return!0;case"quarters":return n%3===0;case"years":return n===0}}function Mi(e,t,n,r,i){let o=Math.ceil(t-1e-6);if(i?.hasNonWorkingDays){if(!Wr(n)&&o<=0)return 0;let a=o<=0?e:Xe(i.dateAtWorkingIndex(e,o-1),1),l=Wr(n)?lS(a,n):n==="weeks"?uS(a,e,i.weekStart):a;return i.workingIndexOf(e,l)}if(!Wr(n))return Math.ceil(t/r)*r;let s=Xe(e,o);return kt(e,lS(s,n))}function lS(e,t){return cB(e,t)?e:$d(e,t)}function uS(e,t,n){let r=n===void 0?-kt(t,e):n-e.getUTCDay();return Xe(e,(r%$l+$l)%$l)}function uB(e,t,n){return uS(Xe(e,1),t,n)}function Dd(e,t,n,r=Ol){if(e.calendar?.hasNonWorkingDays)return fB(e,t,e.calendar,r);if(Wr(t.unit))return yB(e,t,t.unit,r);let i=n.daysPerUnit(t.unit),o=i*e.pixelsPerDay,s=Math.max(1,Math.round(e.widthPx/e.pixelsPerDay)),a=Math.floor(s/i)+1,l=[];for(let c=0;c<a;c++){let u=c*i,f=e.originX+u*e.pixelsPerDay,d=c%t.labelEvery===0,p=c===a-1;l.push({x:f,labelX:p?void 0:f+o/2,major:d,label:d&&!p?hx(t.unit,Xe(e.domain[0],u),c,r):void 0})}return l}function fB(e,t,n,r){let{unit:i}=t,[o,s]=e.domain,a=x=>Wr(i)?$d(x,i):i==="weeks"?uB(x,o,n.weekStart):Xe(x,1),l=[o];for(let x=a(o);x<s;x=a(x))l.push(x);let c=e.forward(s),u=[];l.forEach((x,y)=>{let E=e.forward(x);(y+1<l.length?e.forward(l[y+1]):c)>E&&!hB(e,i,l,y)&&u.push({date:x,x:E})});let f=i==="days"&&t.labelEveryDefault===!0&&n.weekStart!==void 0,d=(x,y)=>f?pB(x,n,e.showsNonWorking):y%t.labelEvery===0,m=(e.showsNonWorking?rk(i):n.daysPerUnit(i))*e.pixelsPerDay,g=u.map(({date:x,x:y},E)=>{let _=(E+1<u.length?u[E+1].x:c)-y,T=d(x,E),I=T?hx(i,x,E,r):void 0,B=I===void 0?0:se(I,Si),$=Wr(i)?E===0||E===u.length-1:_<m-lB,X=I!==void 0&&!(B>_&&$);return{x:y,columnPx:_,major:T,label:I,labelPx:B,isNarrowed:$,isShown:X}});Wr(i)||dB(g);let w=g.map(x=>({x:x.x,labelX:x.x+x.columnPx/2,major:x.major,label:x.isShown?x.label:void 0}));return s>o&&w.push({x:c,labelX:void 0,major:d(s,u.length),label:void 0}),w}function dB(e){let t=n=>{let r=e[n];return r===void 0||r.isShown?0:r.columnPx/2};e.forEach((n,r)=>{if(n.label===void 0||n.isShown||!n.isNarrowed||!(e[r-1]?.isNarrowed===!0||e[r+1]?.isNarrowed===!0))return;let o=n.labelPx/2,s=n.columnPx/2;n.isShown=o<=s+t(r-1)&&o<=s+t(r+1)})}function pB(e,t,n){let r=t.weekStart;if(n)return e.getUTCDay()===r;let i=(e.getUTCDay()-r+$l)%$l;for(let o=1;o<=i;o++)if(t.isWorkingDay(Xe(e,-o)))return!1;return!0}function hB(e,t,n,r){let i=e.calendar;if(!e.showsNonWorking||!i||!Wr(t)||r===0||r!==n.length-1)return!1;let[o,s]=e.domain;return i.workingIndexOf(o,n[r])>=i.workingIndexOf(o,s)}function dx(e,t,n,r){let i=e.calendar;if(!i?.hasNonWorkingDays)return;let o=i.nonWorkingRuns(e.domain[0],e.domain[1]);if(o.length===0)return;let[s,a]=e.range;if(e.showsNonWorking)return o.map(c=>gB(e,c,n));let l=c=>t.some(u=>Math.abs(u.x-c)<fx&&(u.major||r));return o.map(c=>{let u=e.forward(c.from),f={x:u,width:e.forward(Xe(c.through,1))-u,from:c.from,through:c.through};c.titles.length>0&&(f.titles=c.titles,f.label=dS(c,i.workingWeekdays),f.cut=!0);let d=u-s>fx&&a-u>fx;return n==="days"&&d&&!l(u)&&(f.seam=!0),f})}function px(e){let t=e.calendar?.workingExceptionRuns(e.domain[0],e.domain[1])??[];if(t.length===0)return;let[n]=e.range;return t.map(r=>({x:Math.max(n,e.forward(r.from)),from:r.from,through:r.through,titles:r.titles,label:mB(r)}))}function mB(e){let t=kt(e.from,e.through)+1;return`${e.titles.join(", ")}${fS}+${t}d`}var fS=" \xB7 ";function dS(e,t){let n=0;for(let i=e.from;i<=e.through;i=Xe(i,1))t.has(i.getUTCDay())&&n++;let r=e.titles.join(", ");return n>0?`${r}${fS}${n}d`:r}function gB(e,t,n){let[r,i]=e.range,o=Math.max(r,e.forward(t.from)),s=Math.min(i,e.forward(Xe(t.through,1))),a={x:o,width:s-o,from:t.from,through:t.through};return t.titles.length>0&&(a.titles=t.titles,e.calendar&&(a.label=dS(t,e.calendar.workingWeekdays))),(n==="days"||n==="weeks"||t.titles.length>0)&&(a.band=!0),a}function yB(e,t,n,r){let[i,o]=e.domain,s=[i];for(let c=$d(i,n);c<o;c=$d(c,n))s.push(c);o>i&&s.push(o);let a=s.map(c=>e.forward(c)),l=s.length-1;return s.map((c,u)=>{let f=a[u],d=u%t.labelEvery===0;if(u===l)return{x:f,labelX:void 0,major:d,label:void 0};let p=a[u+1]-f,m=d?hx(n,c,u,r):void 0,g=u===0||u===l-1;return m!==void 0&&g&&se(m,Si)>p&&(m=void 0),{x:f,labelX:f+p/2,major:d,label:m}})}function hx(e,t,n,r){switch(e){case"days":return`${t.getUTCMonth()+1}/${t.getUTCDate()}`;case"weeks":{let i=t.toLocaleString(r,{month:"short",timeZone:"UTC"}),o=t.getUTCDate().toString().padStart(2,"0");return`${i} ${o}`}case"months":return t.toLocaleString(r,{month:"short",timeZone:"UTC"});case"quarters":{let i=Math.floor(t.getUTCMonth()/3)+1;return`${Yn(r).quarterPrefix}${i} ${t.getUTCFullYear()}`}case"years":return`${t.getUTCFullYear()}`}}function pS(e,t,n){let r=n.theme??"light",i=lx[r],o=tS(n.locale,EB(e)),s={theme:i,styles:t.config.styles,defaults:t.config.defaults,labels:t.content.labels},a=Se("roadmap",e.roadmapDecl?.properties??[],s);return{themeName:r,theme:i,locale:o,styleCtx:s,roadmapStyle:a}}function hS(e,t,n,r,i){let{config:o,working:s}=Vf(e,t),a=cS(e,t.config.scale),{startDate:l,endDate:c}=xB(e,i,n.today,a),u=Cd(n.nonWorking)?n.nonWorking:r.roadmapStyle.nonWorking,f=u==="show"&&s.hasNonWorkingDays,d=Math.max(1,s.workingIndexOf(l,c)),p=f?Math.max(1,kt(l,c)):d;return{cal:o,calendar:s,preset:a,schedule:i,startDate:l,naturalEndDate:c,spanDays:d,timelineDays:p,nonWorking:u}}function xB(e,t,n,r){let i=e.roadmapDecl?.properties??[],{config:o,working:s}=t.calendar,{startDate:a}=t,l=ie(i,"length"),c=0;if(l){let m=cs(l,o);m>0&&(c=m)}let u=t.extent.contentEndDay;if(n&&!(c>0)){let m=s.workingIndexOf(a,n);m>0&&(u=Math.max(u,m))}let f=tk(r.unit,o),d=Mi(a,u>0?u:4*o.daysPerWeek,r.unit,f,s),p=Math.max(c,d);return{startDate:a,endDate:s.dateAtWorkingIndex(a,Math.max(1,p))}}function EB(e){return At(e.directive?.properties??[],"locale")?.value}var wB=160,TB=64,vB=1e-6,Is=class{constructor(t,n){M(this,"scale");M(this,"startDate");M(this,"spanDays");M(this,"unit");M(this,"calendar");this.scale=n,this.startDate=t.startDate,this.spanDays=t.spanDays,this.unit=t.preset.unit,this.calendar=t.calendar}isPast(t,n){return this.scale.indexAtX(t)>n+vB}boundaryAtOrAfterX(t){return this.boundaryAtOrAfter(this.scale.indexAtX(t))}boundaryAtOrAfter(t){return Mi(this.startDate,t,this.unit,this.calendar.daysPerUnit(this.unit),this.calendar)}captionColumn(t){let n=this.boundaryAtOrAfter(t);return{start:n,end:this.nextBoundary(n)}}captionLimit(t){let{start:n,end:r}=this.captionColumn(t),i=this.xAt(n),o=r;for(let s=0;s<TB;s++){let a=this.nextBoundary(o);if(a<=o||this.xAt(a)-i>wB)break;o=a}return o}nextBoundary(t){return Mi(this.startDate,t+.5,this.unit,this.calendar.daysPerUnit(this.unit),this.calendar)}xAt(t){return this.scale.forward(this.calendar.dateAtWorkingIndex(this.startDate,t))}captionCapX(t){let n=this.isPast(t,this.spanDays)?Math.max(this.spanDays,this.boundaryAtOrAfterX(t)):this.spanDays;return this.xAt(this.captionLimit(n))}};function mS(e,t){e.box.y+=t;for(let n of e.inlineDatePins??[])n.glyphTopLeft.y+=t;if(e.kind==="item"){for(let n of e.labelChips)n.box.y+=t;e.overflowBox&&(e.overflowBox.y+=t);return}for(let n of e.children)mS(n,t)}function Rs(e,t){e.box.y+=t;for(let n of e.children)mS(n,t);for(let n of e.nested)Rs(n,t)}function gS(e,t){e.box.y+=t;for(let n of e.nestedSwimlanes)Rs(n,t);for(let n of[...e.anchors??[],...e.milestones??[]])n.center.y+=t,n.labelBox.y+=t,n.cutTopY+=t,n.cutBottomY+=t;for(let n of e.milestones??[])for(let r of n.slackArrows??[])r.y+=t;for(let n of e.edges??[])for(let r of n.waypoints)r.y+=t}function yS(e,t,n){e.cutTopY+=n,e.cutBottomY+=n,e.slackArrows?.forEach((r,i)=>{let o=t.slackArrows?.[i];o&&"y"in o&&(r.y+=n)})}var mx=class{constructor(t,n){M(this,"id");M(this,"anchor");this.id=t,this.anchor=n}place(t,n){let r=ie(this.anchor.properties,"date"),i=_e(r);if(!i)return null;let o=t.scale.forwardWithinDomain(i);if(o===null)return null;let s=Se("anchor",this.anchor.properties,t.styleCtx),a=t.markerRowPlacements.get(this.id),l=a?.centerY??t.timeline.markerRow.y,c={x:o,y:l},u=a?.labelBox??{x:o+6+6,y:l-4,width:0,height:12},f=a?.labelSide??"right";t.entityLeftEdges.set(this.id,o),t.entityRightEdges.set(this.id,o),t.entityMidpoints.set(this.id,c);let d={id:this.id,title:this.anchor.title??this.id,center:c,radius:6,style:s,predecessorPoints:[],cutTopY:t.chartTopY,cutBottomY:t.swimlaneBottomY,bumpedUp:(a?.rowIndex??0)>0,labelBox:u,labelSide:f};return!t.scale.showsNonWorking&&!t.calendar.isWorkingDay(i)&&(d.hiddenDate=vi(i)),d}};function Md(e,t,n){let r=[];for(let[i,o]of e){let s=new mx(i,o).place(t,n);s&&r.push(s)}return r}function Fl(e){if(e.kind==="item"){let n=e.textSpills||e.dotSpills||e.iconSpills||e.footnoteSpills;return Math.max(e.box.x+e.box.width,n?e.decorationsRightX:Number.NEGATIVE_INFINITY,e.chipsOutside?e.chipsRightX:Number.NEGATIVE_INFINITY)}let t=Math.max(e.box.x+e.box.width,Es(e));for(let n of e.children)t=Math.max(t,Fl(n));return t}function Xr(e){let t=0;for(let n of e)t=Math.max(t,xS(n.children)),n.nested.length>0&&(t=Math.max(t,Xr(n.nested)));return t}function xS(e){let t=0;for(let n of e)n.kind==="item"?t=Math.max(t,n.box.x+n.box.width):t=Math.max(t,xS(n.children));return t}function Ss(e){let t=0;for(let n of e)t=Math.max(t,ES(n.children)),n.nested.length>0&&(t=Math.max(t,Ss(n.nested)));return t}function ES(e){let t=0;for(let n of e)n.kind==="item"?n.textSpills&&(t=Math.max(t,n.decorationsRightX)):t=Math.max(t,ES(n.children));return t}function AB(e){return e.box.y+e.box.height-rn/2}function gx(e,t){let{box:n}=e;return{startX:e.dateSpan.startX,endX:e.dateSpan.endX,paintedX:n.x,paintedWidth:n.width,top:n.y,bottom:n.y+n.height,rowY:n.y+t/2,exitY:yx(e,t)}}function wS(e){let{box:t}=e;return{startX:t.x,endX:t.x+t.width,paintedX:t.x,paintedWidth:t.width,top:t.y,bottom:t.y+t.height}}function yx(e,t){return e.textSpills?AB(e):e.box.y+t/2}function TS(e){let{box:t,afterDate:n,beforeDate:r,hasLinkIcon:i,footnoteCount:o}=e;if(!n&&!r)return[];let s=[],a=pt,l=t.y+yk,c=Vg(t.width);if(n){let u=Kg(t.x,i),f=c?{x:t.x-Bn-a,y:l}:{x:u,y:l};s.push({side:"after",isoDate:n,glyphTopLeft:f,glyphSize:a,spilled:c})}if(r){let u=t.x+t.width,f=qg(u,o),d=c?{x:u+Bn,y:l}:{x:f,y:l};s.push({side:"before",isoDate:r,glyphTopLeft:d,glyphSize:a,spilled:c})}return s}function Fd(e){let{box:t,afterDate:n,beforeDate:r,title:i}=e;if(!n&&!r)return[];let o=[],s=pt,a=t.y+(wl-s)/2,l=i?xs(t.x,!!n)+Ay(i):t.x;if(n&&(l=Math.max(l,t.x+s),o.push({side:"after",isoDate:n,glyphTopLeft:{x:t.x,y:a},glyphSize:s,spilled:!1})),r){let c=t.x+t.width-Yg-s,u=l>t.x?l+nn:t.x;o.push({side:"before",isoDate:r,glyphTopLeft:{x:Math.max(c,u),y:a},glyphSize:s,spilled:!1})}return o}function St(e){for(let t of e)if(_e(t))return t}function Ur(e){return{after:Be(e,"after").map(n=>{let r=_e(n);return r?{raw:n,date:r}:{raw:n,ref:n}})}}function Bd(e){return e.floors.map(t=>t?_e(t.date):null)}function Wd(e,t,n,r,i=0,o){let s=n.map(c=>c??-1/0),a=[];for(let c=0;c<e;c++){let u=vS(c===0?t:a[c-1],s[c],i);a.push(c===0?u:Math.max(u,o?.S[c]??-1/0))}let l=a.map((c,u)=>Math.max(c,o?.E[u]??-1/0));for(let c=1;c<=e+1;c++){let u=r(a,l).memberEnd,f=[],d=[];for(let p=0;p<e;p++)f.push(p===0?a[0]:vS(d[p-1],s[p],i)),d.push(Math.max(f[p],u[p]??-1/0));if(_S(a,f)&&_S(l,d))return{S:a,E:l,passes:c,capped:!1};a=f,l=d}return r(a,l),{S:a,E:l,passes:e+1,capped:!0}}function vS(e,t,n){return t-e>n?t:e}function _S(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function AS(e,t,n){return Bd(e).map(r=>r?n.workingIndexOf(t,r):null)}var Fi=class{constructor(t,n){M(this,"plan");M(this,"S");M(this,"memberEnd");M(this,"binding");M(this,"memberCount");this.plan=t,this.S=n;let r=t.waves.length;this.memberEnd=new Array(r).fill(-1/0),this.binding=new Array(r).fill(void 0),this.memberCount=new Array(r).fill(0)}floor(t){let n=this.plan.waveOf.get(t),r=t.$type==="ItemDeclaration"?void 0:this.plan.leadOf.get(t),i;return n!==void 0&&(i=this.S[n-1]),r!==void 0&&(i=Math.max(i??-1/0,this.S[r-1])),i}apply(t,n){let r=this.floor(t);return r===void 0?n:Math.max(n,r)}accumulate(t,n){let r=this.plan.memberWave(t);r!==void 0&&(this.memberCount[r-1]++,n>this.memberEnd[r-1]&&(this.memberEnd[r-1]=n,this.binding[r-1]=t))}};function Xd(e,t,n,r,i,o=0){return e.waves.map((s,a)=>{let l={id:s.name,index:a+1,start:t.S[a],end:t.E[a],memberCount:n.memberCount[a]},c=n.binding[a];if(c!==void 0&&n.memberEnd[a]===t.E[a]&&t.E[a]>t.S[a]){let p=c.name??c.title;p!==void 0&&(l.heldBy=p)}let u=i[a],f=e.floors[a]?.ref,d=a===0?r:t.E[a-1];return u!=null&&f!==void 0&&u-d>o&&(l.floorRef=f),l})}var Ot=.5;function kS(e,t,n,r,i){let o=e.waves.map(()=>n);return{plan:e,ids:e.waves.map(s=>s.name),origin:n,floors:Bd(e).map(s=>s?t.forward(s):null),S:o,E:o,pass:new Fi(e,o),frozen:!1,backgroundTooltip:r,visible:i}}function IS(e,t,n){e.S=t,e.E=n,e.pass=new Fi(e.plan,t)}function RS(e,t){e.S=t.S,e.E=t.E,e.frozen=!0,e.solve=t}function Ud(e,t,n){e.ids.forEach((r,i)=>{t.set(r,e.S[i]),n.set(r,e.E[i])})}function Gr(e,t,n){return n.waves?n.waves.pass.apply(e,t):t}function SS(e,t,n){n.waves&&!n.waves.frozen&&n.waves.pass.accumulate(e,t)}function bS(e,t){if(t.waves?.visible)return t.waves.plan.memberWave(e)!==void 0?"member":"background"}function NS(e,t){for(let n of[...e.S,...e.E])if(!(Math.abs(n-e.origin)<Ot)&&Math.abs(t-n)<Ot)return!0;return!1}function xx(e,t){let n=Math.round((e-t.timeline.originX)/t.timeline.pixelsPerDay);if(!t.scale.showsNonWorking)return n;let r=t.timeline.startDate;return t.calendar.workingIndexOf(r,Xe(r,n))}function Gd(e,t){return t.calendar.dateAtWorkingIndex(t.timeline.startDate,xx(e,t))}function LS(e,t,n){return Yf(n.calendar,n.timeline.startDate,xx(e,n),xx(t,n))}function Bl(e,t,n){return Gr(e,Wl(e.properties,t,n),n)}var kB=!0;function PS(){return kB}function Wl(e,t,n){let{after:r}=Ur(e);if(r.length>0){let i=t;for(let o of r){if("date"in o){let a=n.scale.forwardWithinDomain(o.date);a!==null&&(i=Math.max(i,a));continue}let s=n.entityRightEdges.get(o.ref);s!==void 0&&(i=Math.max(i,s))}return i}return t}function OS(e,t,n){if(!n.calendar.hasNonWorkingDays)return;let r=IB(e);if(!r||n.calendar.isWorkingDay(r.date))return;let i=n.scale.forwardWithinDomain(r.date);if(!(i===null||Math.abs(t-i)>=Ot))return{key:r.key,pin:r.raw,start:vi(Gd(t,n))}}function IB(e){let{after:t}=Ur(e);for(let n of t)if("date"in n)return{key:"after",raw:n.raw,date:n.date}}function Ex(e){if(!e||e==="none"||e==="transparent")return 1;let t=e.startsWith("#")?e.slice(1):e;if(t.length===3&&(t=t.split("").map(s=>s+s).join("")),t.length!==6)return 1;let n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(r)+.0722*o(i)}function RB(e,t){return Ex(e)>=.24?t.statusDot.onLight:t.statusDot.onDark}function CS(e,t,n){let r=RB(t,n),i={done:r.done,"in-progress":r.inProgress,"at-risk":r.atRisk,blocked:r.blocked,planned:r.planned,neutral:r.neutral};return i[e]??i.neutral}var SB=.24;function bB(e){return e==="none"?"transparent":e}function Hd(e){return Ex(bB(e))>=SB?"dark":"light"}function bs(e,t,n){return e.scale.showsNonWorking?e.scale.advanceX(t,n)-t:n*e.timeline.pixelsPerDay}function Xl(e,t){return{x:e,startX:e,y:t,height:0}}function $S(e,t){let n=e.schedule.byNode.get(t);if(!n)throw new Error(`layout: item "${t.name??t.title??"(unnamed)"}" is not in the day schedule`);return n.days}function NB(e){let t=new Map(e),n=r=>{for(let i of r.content)tn(i)&&(i.name&&!t.has(i.name)&&t.set(i.name,i),n(i))};for(let r of e.values())n(r);return t}function zd(e,t,n,r){return{cal:t.cal,schedule:t.schedule,styleCtx:{theme:t.theme,styles:e.config.styles,defaults:e.config.defaults,labels:e.content.labels},sizes:us(e.content.sizes,t.cal),labels:e.content.labels,teams:NB(e.content.teams),persons:e.content.persons,symbols:e.config.symbols,footnoteIndex:r.footnotes?.index??new Map,footnoteHosts:r.footnotes?.hosts??new Map,timeline:t.timeline,scale:t.scale,calendar:t.calendar,...t.axisColumns?{axisColumns:t.axisColumns}:{},bandScale:t.bandScale,entityLeftEdges:new Map,entityRightEdges:new Map,entityMidpoints:new Map,markerIds:new Set([...e.content.anchors.keys(),...e.content.milestones.keys()]),placedItems:new Map,itemFlowKey:new Map,currentFlowKey:"",slackCorridors:[],markerRowPlacements:r.markerRowPlacements??new Map,chartTopY:n.chartTopY,chartBottomY:n.chartBottomY,swimlaneBottomY:n.swimlaneBottomY,nextParallelId:0,nextGroupId:0,...t.waves?{waves:t.waves}:{}}}var DS=12,LB=4,jd=13,PB=11;function OB(e,t){return(e?se(e,PB):0)+t}function Vd(e){return Math.max(0,Math.min(_k,(e-Jg)/2))}function wx(e){return Math.max(Jg,e-2*Vd(e))}function MS(e){if(!/[\r\n]/.test(e))return;let t=e.replace(/\r\n?/g,`
2916
+ }`));var e2={languageId:"nowline",fileExtensions:[".nowline"],caseInsensitive:!1,mode:"development"},Jk={AstReflection:()=>new za},Qk={Grammar:()=>Zk(),LanguageMetaData:()=>e2,parser:{}};var eI={item:"an item",group:"a group",parallel:"a parallel block",swimlane:"a swimlane",anchor:"an anchor",milestone:"a milestone","floating-milestone":"a milestone without a date",wave:"a wave",label:"a label",size:"a size",status:"a status",person:"a person",team:"a team",footnote:"a footnote",roadmap:"the roadmap",style:"a style",symbol:"a symbol"},t2={item:"item",group:"group",parallel:"parallel block",swimlane:"swimlane",anchor:"anchor",milestone:"milestone","floating-milestone":"milestone",wave:"wave",label:"label",size:"size",status:"status",person:"person",team:"team",footnote:"footnote",roadmap:"roadmap",style:"style",symbol:"symbol"},Py=e=>e.charAt(0).toUpperCase()+e.slice(1);function vs(e){return e.kind==="parallel-block"?`the parallel block on line ${e.line}`:e.kind==="group-block"?`the group on line ${e.line}`:`${e.kind} "${e.name}"`}function tI(e){return e.name||e.line===void 0?`"${e.name}"`:vs({kind:e.kind==="parallel"?"parallel-block":"group-block",line:e.line})}function Oy(e,t=!0){if(e.name)return`${e.kind} "${e.name}"`;let n=e.kind==="parallel"?"parallel block":e.kind,r=t?"the ":"";return e.line===void 0?`${r}${n}`:`${r}${n} on line ${e.line}`}function nI(e){return e.name?`${Py(e.kind)} "${e.name}"`:Py(Oy(e))}function rI(e){return e===null?"has no start floor":`opens no earlier than ${e}`}function iI(e){return e?e.title===void 0?` Did you mean wave:${e.id}?`:` Did you mean wave:${e.id} ("${e.title}")?`:""}function n2(e){let t=e.slice(0,5).map(r=>`"${r}"`),n=e.length-t.length;return n>0?`${t.join(", ")} and ${n} more`:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Ed(e){return`[${e.join(", ")}]`}var oI={"NL.E0001":()=>"Config section must appear before roadmap.","NL.E0002":()=>"Include declarations must appear before the config section.","NL.E0003":()=>"Include declarations must appear before the roadmap section.","NL.E0004":()=>"At least one swimlane is required.","NL.E0005":e=>`Line ${e.line}: mixed tabs and spaces in indentation. Use either tabs or spaces consistently.`,"NL.E0100":e=>`Invalid version format "${e.version}". Expected format: v1, v2, etc.`,"NL.E0101":e=>`This file requires Nowline ${e.version}, but the parser only supports up to ${e.supported}.`,"NL.E0102":e=>`Unknown directive property "${e.key}". Allowed: ${e.allowed}.`,"NL.E0103":e=>`Duplicate directive property "${e.key}".`,"NL.E0104":e=>`Invalid locale "${e.value}". Use a BCP-47 tag like "en-US", "fr", or "fr-CA".`,"NL.E0200":e=>`Invalid include mode "${e.value}". Must be merge, ignore, or isolate.`,"NL.E0201":e=>`Duplicate "${e.key}" option on include.`,"NL.E0202":e=>{switch(e.reason){case"mismatch":return`Included "${e.path}" declares waves ${Ed(e.child)}, but this file's waves are ${Ed(e.parent)}. Every included roadmap must declare the same waves in the same order: copy this file's wave lines into "${e.path}".`;case"child-none":return`Included "${e.path}" declares no waves, but this file's waves are ${Ed(e.parent)}. Copy this file's wave lines into "${e.path}" so its work joins the waves.`;case"parent-none":return`Included "${e.path}" declares waves ${Ed(e.child)}, but this file declares none. Declare the same waves here so the barriers apply to the whole roadmap.`;case"floor":return`Wave "${e.id}" in "${e.path}" ${rI(e.childFloor)}, but this file's wave "${e.id}" ${rI(e.parentFloor)}. A wave must have the same start floor in every included roadmap.`}},"NL.E0203":e=>{switch(e.reason){case"not-found":return`Cannot read include "${e.path}": file not found.`;case"is-directory":return`Cannot read include "${e.path}": it is a directory.`;case"permission-denied":return`Cannot read include "${e.path}": permission denied.`;case"not-nowline":return`Cannot read include "${e.path}": only .nowline files can be included.`;case"unreadable":return e.detail?`Cannot read include "${e.path}": ${e.detail}`:`Cannot read include "${e.path}".`}},"NL.E0204":e=>`Circular include: "${e.path}" is already being included (${e.chain}).`,"NL.E0205":e=>`Duplicate include "${e.path}". Include each file once.`,"NL.E0206":e=>`Cannot isolate "${e.path}": it has no roadmap declaration.`,"NL.E0207":e=>e.parentStart&&e.childStart?`Included "${e.path}" declares start:${e.childStart}, which doesn't match this file's start:${e.parentStart}. Both files must declare the same start date, or neither should.`:e.parentStart?`Included "${e.path}" has no start:, but this file declares start:${e.parentStart}. Both files must declare the same start date, or neither should.`:`Included "${e.path}" declares start:${e.childStart}, but this file has no start:. Both files must declare the same start date, or neither should.`,"NL.E0208":e=>{switch(e.reason){case"absolute":return`Include "${e.path}" is an absolute path. With an include root, an include must be a relative path inside it.`;case"parent":return`Include "${e.path}" resolves outside the include root.`;case"symlink":return`Include "${e.path}" resolves outside the include root through a symbolic link.`}},"NL.E0209":e=>`Includes are not supported in this context: "${e.path}" was not read.`,"NL.E0210":e=>`Include "${e.path}" is more than ${e.max} includes deep. Flatten the include chain.`,"NL.E0300":e=>`Duplicate identifier "${e.name}". First declared at ${e.location}.`,"NL.E0301":e=>`${e.type} must have an identifier, a title, or both.`,"NL.E0302":e=>`${e.key}: reference "${e.value}" does not resolve to any declared entity in this file.`,"NL.E0400":e=>`Invalid duration "${e.value}". Use a raw duration literal like 0.5d, 2w, 1m, 2q. Use "size:NAME" to reference a declared size.`,"NL.E0401":e=>`Invalid size "${e.value}". Use the id of a declared size (e.g. xs, m, lg).`,"NL.E0402":e=>`Invalid effort "${e.value}". Use a raw duration literal like 0.5d, 2w, 1m, 2q.`,"NL.E0403":e=>`Invalid remaining value "${e.value}". Use a percentage like 30% or a duration literal like 1w, 0.5d.`,"NL.E0404":e=>`Remaining must be between 0% and 100%, got ${e.value}.`,"NL.E0405":e=>`Invalid ${e.key} "${e.value}". Use ISO 8601 format: YYYY-MM-DD.`,"NL.E0406":e=>`Invalid scale "${e.value}". Use a raw duration literal like 1w, 2w, 1q (no name lookup).`,"NL.E0407":e=>`Invalid calendar "${e.value}". Must be business, full, or custom.`,"NL.E0408":e=>`Property "${e.key}" requires at least one reference.`,"NL.E0410":e=>`"${e.key}:" accepts at most one inline date per direction; collapse the multiple dates to a single binding date or use a declared anchor.`,"NL.E0411":e=>`Inline date in "${e.key}:" is not allowed on ${e.type}. Allowed only on item, parallel, and group, and on a wave's after:; for a milestone use "date:" instead.`,"NL.E0412":e=>`Inline date "${e.date}" in "${e.key}:" requires the roadmap to declare "start:". Add start:YYYY-MM-DD to the roadmap.`,"NL.E0413":e=>`Inline date "${e.date}" in "${e.key}:" is before roadmap start ${e.start}.`,"NL.E0414":e=>`Invalid link "${e.value}". Use an absolute http:// or https:// URL, or a quoted "mailto:" URL.`,"NL.E0500":e=>`Anchor "${e.name}" requires a "date:" property.`,"NL.E0501":e=>`Anchor "${e.name}" has a date but the roadmap is missing "start:". Add start:YYYY-MM-DD to the roadmap.`,"NL.E0502":e=>`Anchor "${e.name}" date ${e.date} is before roadmap start ${e.start}.`,"NL.E0503":e=>`Milestone "${e.name}" requires at least one of "date:" or "after:".`,"NL.E0504":e=>`Milestone "${e.name}" date ${e.date} is before roadmap start ${e.start}.`,"NL.E0505":()=>'Footnote requires an "on:" property referencing one or more entities.',"NL.E0600":e=>`Item "${e.name}" requires a "size:" or "duration:" property.`,"NL.E0800":e=>`Invalid non-working value "${e.value}". Use hide or show.`,"NL.E0801":e=>`Invalid color "${e.value}" for "${e.key}". Use a named color, hex value, or "none".`,"NL.E0802":e=>`Invalid value "${e.value}" for "${e.key}". Allowed: ${e.allowed}.`,"NL.E0803":e=>`Unknown style property "${e.key}".`,"NL.E0804":e=>`Raw style property "${e.key}" is not allowed on ${e.entity}. Declare a named style in config and reference it via "style:id".`,"NL.E0805":e=>`Symbol id "${e.name}" collides with a built-in icon name. Reserved built-ins: ${e.builtins}.`,"NL.E0806":e=>`Symbol "${e.name}" requires a "unicode:" property (e.g. unicode:"\u{1F4B0}" or unicode:"\\u{1F464}").`,"NL.E0807":e=>`Symbol "${e.name}" unicode: must be a non-empty value.`,"NL.E0808":e=>`Symbol "${e.name}" ascii: must be 1-3 ASCII characters (got ${e.length} character${e.length===1?"":"s"}).`,"NL.E0809":e=>`Unknown symbol property "${e.key}". Allowed: unicode, ascii, link, description.`,"NL.E0810":e=>`Duplicate symbol id "${e.name}". First declared at ${e.location}.`,"NL.E0811":e=>`${e.key}: "${e.value}" is neither a built-in (${e.builtins}) nor a declared symbol. Add "symbol ${e.value} unicode:..." earlier in config or use a quoted Unicode literal.`,"NL.E0812":e=>`${e.key}: symbol "${e.value}" is referenced before its declaration. Move "symbol ${e.value}" above this entry.`,"NL.E0900":e=>`A ${e.kind} declaration takes date:, or start: and end:, or every: with optional start: and end:.`,"NL.E0901":e=>`Unknown ${e.kind} property "${e.key}". Allowed: date, start, end, every.`,"NL.E0902":e=>`${e.key}: on a ${e.kind} declaration takes one date, not a list.`,"NL.E0903":e=>`end: ${e.end} is before start: ${e.start}.`,"NL.E0904":e=>`Invalid weekday "${e.value}". Use sun, mon, tue, wed, thu, fri or sat.`,"NL.E0905":e=>`Weekday "${e.value}" is listed more than once.`,"NL.E0906":()=>"This leaves no working day in the week with no end date. Keep at least one weekday working.","NL.E0907":e=>`Duplicate ${e.kind} id "${e.name}".`,"NL.W0700":e=>`Unknown property "${e.key}" on ${e.entity}. The renderer ignores it.${e.suggested?` Did you mean "${e.suggested}"?`:""}`,"NL.W0701":e=>`Wave "${e.id}" in "${e.path}" differs from this file's definition (${e.fields.map(t=>`${t.field} ${t.there===""?"none":`"${t.there}"`} there, ${t.here===""?"none":`"${t.here}"`} here`).join("; ")}); this file's definition is used.`,"NL.W0702":e=>`"wave:" on ${e.target.kind==="default"?`"default ${e.target.entityType}"`:!e.target.name&&e.target.line!==void 0?`the ${e.target.kind==="parallel"?"parallel block":e.target.kind} on line ${e.target.line}`:`${e.target.kind} "${e.target.name}"`} is ignored: this roadmap declares no waves. Declare waves with "wave <id>" to use it, or remove the property.`,"NL.W0703":e=>`"${e.key}" on "default ${e.entityType}" is ignored: it is a roadmap-only style key. Set it on "default roadmap" instead.`,"NL.W0704":e=>`"timeline-position:${e.position}" draws no dates: "header-height:none" removes every timeline date strip. Set header-height to xs, sm, md, lg or xl to show them.`,"NL.W0705":e=>`days-per-week is ${e.daysPerWeek}, but the week leaves ${e.working} working days.`,"NL.E1100":e=>`Wave ${e.title===void 0?`on line ${e.line}`:`"${e.title}"`} needs an explicit identifier so work can reference it with wave:<id>, e.g. wave build "Build".`,"NL.E1101":e=>{switch(e.reason){case"list":return`"wave:" takes exactly one wave id; an item belongs to at most one wave. Got "${e.value}".`;case"unknown":return`Wave "${e.value}" is not declared. Declared waves: ${e.declared.length>0?e.declared.join(", "):"none"}. Add "wave ${e.value}" above the first swimlane that uses it.${iI(e.suggestion)}`;case"forward":return`Wave "${e.value}" is used before its declaration on line ${e.line}. Declare waves above the swimlanes that use them.`;case"not-a-wave":return`"wave:" must name a wave, but "${e.value}" is ${eI[e.kind]}.${iI(e.suggestion)}`}},"NL.E1102":e=>`${Py(Oy(e.entity))} has wave:${e.wave}, but its enclosing ${Oy(e.container,!1)} has wave:${e.containerWave}. A container's wave applies to everything inside it; remove one of the two wave: properties.`,"NL.E1103":e=>{switch(e.reason){case"sequence":{let t=e.items.length>1,n=`${t?"Items":"Item"} ${e.items.map(i=>`"${i}"`).join(", ")} (wave "${e.itemWave}")`,r=typeof e.ref=="string"?`"${e.ref}"`:vs(e.ref);return`${n} ${t?"come":"comes"} after ${r} (wave "${e.refWave}") in ${vs(e.flow)}. Work in a lane or group runs in order, so it must also be ordered by wave: move ${r} below "${e.last}", or change their waves.`}case"join":return`Item "${e.name}" (wave "${e.wave}") comes after ${vs(e.block)} in ${vs(e.flow)}, and that block cannot end before its track "${e.track}" (wave "${e.trackWave}") does. Move "${e.name}" above the block or into a track of its own, or change one of their waves.`;case"after-item":return e.container?`${nI(e.container)} has after:${e.refId}, but "${e.ref}" is in later wave "${e.refWave}". Wave "${e.refWave}" cannot start until wave "${e.wave}" ends, so "${e.name}" (wave "${e.wave}") inside it could never start: move "${e.name}" to wave "${e.refWave}" or later, or remove the after:.`:`Item "${e.name}" (wave "${e.wave}") has after:${e.refId}, but "${e.ref}" is in later wave "${e.refWave}". Wave "${e.refWave}" cannot start until wave "${e.wave}" ends, so "${e.name}" could never start: move it to wave "${e.refWave}" or later, or remove the after:.`;case"after-wave":return e.container?`${nI(e.container)} (wave "${e.wave}") has after:${e.refId}, but work cannot wait for the end of its own wave or a later one. Use an earlier wave, or move the ${e.container.kind} to a later wave.`:`Item "${e.name}" (wave "${e.wave}") has after:${e.refId}, but work cannot wait for the end of its own wave or a later one. Use an earlier wave, or move "${e.name}" to a later wave.`;case"chain":return`Item "${e.name}" (wave "${e.wave}") could never start: through ${e.chain.join(" \u2192 ")}, it waits for work that cannot start until wave "${e.wave}" has ended. Move "${e.name}" to a later wave, or break the chain.`}},"NL.E1104":e=>{switch(e.reason){case"swimlane":return`"wave:" is not allowed on swimlane "${e.name}": a swimlane spans every wave. Put wave: on its items, or wrap them in "group wave:${e.value}".`;case"milestone":return`"wave:" is not allowed on milestone "${e.name}". To place a milestone at the end of a wave, use after:${e.value}.`;case"other":return`"wave:" is not allowed on ${t2[e.type]} "${e.name}"; only item, group, and parallel can belong to a wave.`}},"NL.E1105":e=>e.reason==="before"?`"before:" is not allowed on wave "${e.name}". A wave's end comes from its items; to give a wave a deadline, add a dated milestone: milestone ${e.name}-due date:<YYYY-MM-DD> after:${e.name}.`:`"${e.key}:" is not allowed on wave "${e.name}". A wave's span comes from its items; only after: (an anchor, a dated milestone, or one ISO date) can hold back a wave's start.`,"NL.E1106":e=>`Wave "${e.name}" has after:${e.ref}, but "${e.ref}" is ${eI[e.kind]}. A wave's after: accepts only anchors, dated milestones, or one ISO date; to make a wave wait for work, put that work in an earlier wave.`,"NL.W1000":e=>`Now-line date ${e.date} is outside the roadmap window (${e.start} \u2013 ${e.end}); it will not be drawn.`,"NL.W1002":e=>`Wave barriers did not settle after ${e.passes} layout passes, so the drawn schedule may not respect the wave order. The roadmap probably has an ordering conflict that validation did not catch.`,"NL.W1100":e=>{let t=tI(e);return e.reason==="item"?`before:${e.ref} on ${t} can never be met: ${t} is in wave "${e.wave}", which cannot start until "${e.ref}" (wave "${e.refWave}") has finished. The overrun will be painted.`:`before:${e.ref} on ${t} can never be met: ${t} is in wave "${e.wave}", which cannot finish before wave "${e.ref}" starts. The overrun will be painted.`},"NL.W1101":e=>{let t=tI(e);switch(e.reason){case"forward-lane":return`${e.key}:${e.ref} on ${t} refers to "${e.ref}", which is in a later swimlane ("${e.lane}"). Layout places swimlanes in order and ignores references to work it has not placed yet, so it ignores this ${e.key}:. Move swimlane "${e.lane}" above swimlane "${e.ownLane}", or remove the ${e.key}:.`;case"forward-flow":return`${e.key}:${e.ref} on ${t} refers to "${e.ref}", which comes later in ${vs(e.flow)}. Layout ignores references to work it has not placed yet, so it ignores this ${e.key}:. Move "${e.ref}" above ${t}, or remove the ${e.key}:.`;case"ancestor":return`${e.key}:${e.ref} on ${t} refers to "${e.ref}", which contains it. Layout ignores references to an enclosing group or parallel, so it ignores this ${e.key}:. Remove the ${e.key}:.`;case"floating-milestone":return`${e.key}:${e.ref} on ${t} refers to milestone "${e.ref}", which has no date. Floating milestones are placed after all work, so layout ignores this ${e.key}:. Reference the milestone's predecessors or a wave instead.`}},"NL.I1000":e=>`Title on item "${e.name}" is wider than its bar at this scale; it rendered to the right of the bar.`,"NL.I1001":e=>`Label chips on item "${e.name}" did not fit inside the bar; they rendered in a spill column to the right.`,"NL.I1002":e=>`Item "${e.name}" is too narrow to show its marker at this scale; decorations spilled beside the bar.`,"NL.I1003":e=>e.anchor?`Item "${e.name}" extends past its "before:" anchor "${e.anchor}".`:`Item "${e.name}" extends past its "before:" anchor.`,"NL.I1004":e=>`Swimlane "${e.lane}" packed into ${e.rows} rows to avoid overlap.`,"NL.I1005":e=>`Swimlane "${e.lane}" is over capacity in one or more periods (red utilization band).`,"NL.I1006":e=>e.names.length===1?`Wave "${e.names[0]}" won't be displayed: it has no items assigned.`:`Waves ${n2(e.names)} won't be displayed: they have no items assigned.`,"NL.I1007":e=>`Milestone "${e.name}" (${e.date}) is overrun: wave "${e.wave}" ends ${e.end}.`,"NL.I1008":e=>`Item "${e.name}" is pinned to ${e.pin} (${e.key}:), a non-working day; it starts on ${e.start}.`};var H=e=>`\xAB\xA0${e}\xA0\xBB`,sI={item:"un \xE9l\xE9ment",group:"un groupe",parallel:"un bloc parall\xE8le",swimlane:"une swimlane",anchor:"une ancre",milestone:"un jalon","floating-milestone":"un jalon sans date",wave:"une vague",label:"une \xE9tiquette",size:"une taille",status:"un statut",person:"une personne",team:"une \xE9quipe",footnote:"une note de bas de page",roadmap:"la roadmap",style:"un style",symbol:"un symbole"},r2={item:"l'\xE9l\xE9ment",group:"le groupe",parallel:"le bloc parall\xE8le",swimlane:"la swimlane",anchor:"l'ancre",milestone:"le jalon","floating-milestone":"le jalon",wave:"la vague",label:"l'\xE9tiquette",size:"la taille",status:"le statut",person:"la personne",team:"l'\xE9quipe",footnote:"la note de bas de page",roadmap:"la roadmap",style:"le style",symbol:"le symbole"},Cy=e=>e.charAt(0).toUpperCase()+e.slice(1);function _s(e){return e.kind==="parallel-block"?`le bloc parall\xE8le \xE0 la ligne ${e.line}`:e.kind==="group-block"?`le groupe \xE0 la ligne ${e.line}`:`${e.kind==="group"?"le groupe":e.kind==="parallel"?"le bloc parall\xE8le":"la swimlane"} ${H(e.name)}`}function $y(e,t=!1){if(e.name||e.line===void 0)return t?`de ${H(e.name)}`:H(e.name);let n=_s({kind:e.kind==="parallel"?"parallel-block":"group-block",line:e.line});return t?`du ${n.slice(3)}`:n}function Dy(e){let t=e.kind==="item"?"\xE9l\xE9ment":e.kind==="group"?"groupe":"bloc parall\xE8le",n=e.kind==="item"?"l'":"le ";return e.name?`${n}${t} ${H(e.name)}`:e.line===void 0?`${n}${t}`:`${n}${t} \xE0 la ligne ${e.line}`}function aI(e){let t=e.kind==="parallel"?"le bloc parall\xE8le":"le groupe";return e.name?`${t} ${H(e.name)}`:e.line===void 0?t:`${t} \xE0 la ligne ${e.line}`}function lI(e){return e?e.title===void 0?` Vouliez-vous dire wave:${e.id}\xA0?`:` Vouliez-vous dire wave:${e.id} (${H(e.title)})\xA0?`:""}function i2(e){let t=e.slice(0,5).map(H),n=e.length-t.length;return n>0?`${t.join(", ")} et ${n} autre${n>1?"s":""}`:`${t.slice(0,-1).join(", ")} et ${t[t.length-1]}`}function wd(e){return`[${e.join(", ")}]`}function cI(e){return e===null?"n'a pas de borne de d\xE9part":`ne s'ouvre pas avant ${e}`}function uI(e){return e===""?"aucun":H(e)}var o2={title:"titre",style:"style",labels:"\xE9tiquettes",link:"lien",description:"description"},fI={"NL.E0001":()=>"La section config doit pr\xE9c\xE9der la section roadmap.","NL.E0002":()=>"Les d\xE9clarations include doivent pr\xE9c\xE9der la section config.","NL.E0003":()=>"Les d\xE9clarations include doivent pr\xE9c\xE9der la section roadmap.","NL.E0004":()=>"Au moins une swimlane est requise.","NL.E0005":e=>`Ligne ${e.line}\xA0: tabulations et espaces m\xE9lang\xE9s dans l'indentation. Utilisez l'un ou l'autre, mais pas les deux.`,"NL.E0100":e=>`Format de version invalide \xAB\xA0${e.version}\xA0\xBB. Format attendu\xA0: v1, v2, etc.`,"NL.E0101":e=>`Ce fichier requiert Nowline ${e.version}, mais l'analyseur ne prend en charge que jusqu'\xE0 ${e.supported}.`,"NL.E0102":e=>`Propri\xE9t\xE9 de directive inconnue \xAB\xA0${e.key}\xA0\xBB. Valeurs admises\xA0: ${e.allowed}.`,"NL.E0103":e=>`Propri\xE9t\xE9 de directive \xAB\xA0${e.key}\xA0\xBB en double.`,"NL.E0104":e=>`Locale invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez une \xE9tiquette BCP-47 telle que \xAB\xA0en-US\xA0\xBB, \xAB\xA0fr\xA0\xBB ou \xAB\xA0fr-CA\xA0\xBB.`,"NL.E0200":e=>`Mode d'include invalide \xAB\xA0${e.value}\xA0\xBB. Doit \xEAtre merge, ignore ou isolate.`,"NL.E0201":e=>`Option \xAB\xA0${e.key}\xA0\xBB en double sur include.`,"NL.E0202":e=>{switch(e.reason){case"mismatch":return`L'include ${H(e.path)} d\xE9clare les vagues ${wd(e.child)}, mais celles de ce fichier sont ${wd(e.parent)}. Chaque roadmap incluse doit d\xE9clarer les m\xEAmes vagues dans le m\xEAme ordre\xA0: copiez les lignes wave de ce fichier dans ${H(e.path)}.`;case"child-none":return`L'include ${H(e.path)} ne d\xE9clare aucune vague, mais celles de ce fichier sont ${wd(e.parent)}. Copiez les lignes wave de ce fichier dans ${H(e.path)} pour que son travail rejoigne les vagues.`;case"parent-none":return`L'include ${H(e.path)} d\xE9clare les vagues ${wd(e.child)}, mais ce fichier n'en d\xE9clare aucune. D\xE9clarez les m\xEAmes vagues ici pour que les barri\xE8res s'appliquent \xE0 toute la roadmap.`;case"floor":return`La vague ${H(e.id)} dans ${H(e.path)} ${cI(e.childFloor)}, mais la vague ${H(e.id)} de ce fichier ${cI(e.parentFloor)}. Une vague doit avoir la m\xEAme borne de d\xE9part dans chaque roadmap incluse.`}},"NL.E0203":e=>{switch(e.reason){case"not-found":return`Impossible de lire l'include ${H(e.path)}\xA0: fichier introuvable.`;case"is-directory":return`Impossible de lire l'include ${H(e.path)}\xA0: c'est un r\xE9pertoire.`;case"permission-denied":return`Impossible de lire l'include ${H(e.path)}\xA0: permission refus\xE9e.`;case"not-nowline":return`Impossible de lire l'include ${H(e.path)}\xA0: seuls les fichiers .nowline peuvent \xEAtre inclus.`;case"unreadable":return e.detail?`Impossible de lire l'include ${H(e.path)}\xA0: ${e.detail}`:`Impossible de lire l'include ${H(e.path)}.`}},"NL.E0204":e=>`Include circulaire\xA0: ${H(e.path)} est d\xE9j\xE0 en cours d'inclusion (${e.chain}).`,"NL.E0205":e=>`Include ${H(e.path)} en double. Incluez chaque fichier une seule fois.`,"NL.E0206":e=>`Impossible d'isoler ${H(e.path)}\xA0: il ne d\xE9clare aucune roadmap.`,"NL.E0207":e=>e.parentStart&&e.childStart?`L'include ${H(e.path)} d\xE9clare start:${e.childStart}, qui ne correspond pas au start:${e.parentStart} de ce fichier. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`:e.parentStart?`L'include ${H(e.path)} n'a pas de start:, mais ce fichier d\xE9clare start:${e.parentStart}. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`:`L'include ${H(e.path)} d\xE9clare start:${e.childStart}, mais ce fichier n'a pas de start:. Les deux fichiers doivent d\xE9clarer la m\xEAme date de d\xE9but, ou aucun des deux.`,"NL.E0208":e=>{switch(e.reason){case"absolute":return`L'include ${H(e.path)} est un chemin absolu. Avec une racine d'include, un include doit \xEAtre un chemin relatif \xE0 l'int\xE9rieur de celle-ci.`;case"parent":return`L'include ${H(e.path)} se r\xE9sout hors de la racine d'include.`;case"symlink":return`L'include ${H(e.path)} se r\xE9sout hors de la racine d'include par un lien symbolique.`}},"NL.E0209":e=>`Les includes ne sont pas pris en charge dans ce contexte\xA0: ${H(e.path)} n'a pas \xE9t\xE9 lu.`,"NL.E0210":e=>`L'include ${H(e.path)} d\xE9passe ${e.max} niveaux d'inclusion. Aplatissez la cha\xEEne d'includes.`,"NL.E0300":e=>`Identifiant en double \xAB\xA0${e.name}\xA0\xBB. Premi\xE8re d\xE9claration \xE0 ${e.location}.`,"NL.E0301":e=>`${e.type} doit comporter un identifiant, un titre, ou les deux.`,"NL.E0302":e=>`La r\xE9f\xE9rence \xAB\xA0${e.value}\xA0\xBB de \xAB\xA0${e.key}:\xA0\xBB ne d\xE9signe aucune entit\xE9 d\xE9clar\xE9e dans ce fichier.`,"NL.E0400":e=>`Dur\xE9e invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un litt\xE9ral de dur\xE9e brut comme 0.5d, 2w, 1m, 2q. Utilisez \xAB\xA0size:NOM\xA0\xBB pour r\xE9f\xE9rencer une taille d\xE9clar\xE9e.`,"NL.E0401":e=>`Taille invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez l'identifiant d'une taille d\xE9clar\xE9e (p.\xA0ex. xs, m, lg).`,"NL.E0402":e=>`Effort invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un litt\xE9ral de dur\xE9e brut comme 0.5d, 2w, 1m, 2q.`,"NL.E0403":e=>`Valeur restante invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un pourcentage tel que 30% ou un litt\xE9ral de dur\xE9e comme 1w, 0.5d.`,"NL.E0404":e=>`La valeur restante doit \xEAtre comprise entre 0 % et 100 %, re\xE7u ${e.value}.`,"NL.E0405":e=>`${e.key} invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez le format ISO 8601\xA0: AAAA-MM-JJ.`,"NL.E0406":e=>`\xC9chelle invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez un litt\xE9ral de dur\xE9e brut comme 1w, 2w, 1q (pas de recherche par nom).`,"NL.E0407":e=>`Calendrier invalide \xAB\xA0${e.value}\xA0\xBB. Doit \xEAtre business, full ou custom.`,"NL.E0408":e=>`La propri\xE9t\xE9 \xAB\xA0${e.key}\xA0\xBB exige au moins une r\xE9f\xE9rence.`,"NL.E0410":e=>`\xAB\xA0${e.key}:\xA0\xBB n'accepte qu'une seule date inline par direction\xA0; regroupez les dates en une seule date contraignante ou utilisez une ancre d\xE9clar\xE9e.`,"NL.E0411":e=>`Une date inline dans \xAB\xA0${e.key}:\xA0\xBB n'est pas autoris\xE9e sur ${e.type}. Autoris\xE9e seulement sur item, parallel et group, et sur le \xAB\xA0after:\xA0\xBB d'une vague\xA0; pour un milestone utilisez \xAB\xA0date:\xA0\xBB \xE0 la place.`,"NL.E0412":e=>`La date inline \xAB\xA0${e.date}\xA0\xBB dans \xAB\xA0${e.key}:\xA0\xBB exige que la roadmap d\xE9clare \xAB\xA0start:\xA0\xBB. Ajoutez start:AAAA-MM-JJ \xE0 la roadmap.`,"NL.E0413":e=>`La date inline \xAB\xA0${e.date}\xA0\xBB dans \xAB\xA0${e.key}:\xA0\xBB pr\xE9c\xE8de le d\xE9but de la roadmap (${e.start}).`,"NL.E0414":e=>`Lien invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez une URL absolue en http:// ou https://, ou une URL \xAB\xA0mailto:\xA0\xBB entre guillemets.`,"NL.E0500":e=>`L'ancre \xAB\xA0${e.name}\xA0\xBB exige une propri\xE9t\xE9 \xAB\xA0date:\xA0\xBB.`,"NL.E0501":e=>`L'ancre \xAB\xA0${e.name}\xA0\xBB a une date, mais \xAB\xA0start:\xA0\xBB manque sur la roadmap. Ajoutez start:AAAA-MM-JJ \xE0 la roadmap.`,"NL.E0502":e=>`La date ${e.date} de l'ancre \xAB\xA0${e.name}\xA0\xBB pr\xE9c\xE8de le d\xE9but de la roadmap (${e.start}).`,"NL.E0503":e=>`Le jalon \xAB\xA0${e.name}\xA0\xBB exige au moins l'une des propri\xE9t\xE9s \xAB\xA0date:\xA0\xBB ou \xAB\xA0after:\xA0\xBB.`,"NL.E0504":e=>`La date ${e.date} du jalon \xAB\xA0${e.name}\xA0\xBB pr\xE9c\xE8de le d\xE9but de la roadmap (${e.start}).`,"NL.E0505":()=>"Une note de bas de page exige une propri\xE9t\xE9 \xAB\xA0on:\xA0\xBB r\xE9f\xE9ren\xE7ant au moins une entit\xE9.","NL.E0600":e=>`L'\xE9l\xE9ment \xAB\xA0${e.name}\xA0\xBB exige une propri\xE9t\xE9 \xAB\xA0size:\xA0\xBB ou \xAB\xA0duration:\xA0\xBB.`,"NL.E0800":e=>`Valeur non-working invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez hide ou show.`,"NL.E0801":e=>`Couleur invalide \xAB\xA0${e.value}\xA0\xBB pour \xAB\xA0${e.key}\xA0\xBB. Utilisez une couleur nomm\xE9e, une valeur hexad\xE9cimale ou \xAB\xA0none\xA0\xBB.`,"NL.E0802":e=>`Valeur invalide \xAB\xA0${e.value}\xA0\xBB pour \xAB\xA0${e.key}\xA0\xBB. Valeurs admises\xA0: ${e.allowed}.`,"NL.E0803":e=>`Propri\xE9t\xE9 de style inconnue \xAB\xA0${e.key}\xA0\xBB.`,"NL.E0804":e=>`La propri\xE9t\xE9 de style brute \xAB\xA0${e.key}\xA0\xBB n'est pas permise sur ${e.entity}. D\xE9clarez un style nomm\xE9 dans la config et r\xE9f\xE9rencez-le avec \xAB\xA0style:id\xA0\xBB.`,"NL.E0805":e=>`L'identifiant de symbole \xAB\xA0${e.name}\xA0\xBB entre en conflit avec le nom d'une ic\xF4ne int\xE9gr\xE9e. Noms r\xE9serv\xE9s\xA0: ${e.builtins}.`,"NL.E0806":e=>`Le symbole \xAB\xA0${e.name}\xA0\xBB exige une propri\xE9t\xE9 \xAB\xA0unicode:\xA0\xBB (p.\xA0ex. unicode:"\u{1F4B0}" ou unicode:"\\u{1F464}").`,"NL.E0807":e=>`La propri\xE9t\xE9 \xAB\xA0unicode:\xA0\xBB du symbole \xAB\xA0${e.name}\xA0\xBB doit avoir une valeur non vide.`,"NL.E0808":e=>`La propri\xE9t\xE9 \xAB\xA0ascii:\xA0\xBB du symbole \xAB\xA0${e.name}\xA0\xBB doit compter de 1 \xE0 3 caract\xE8res ASCII (re\xE7u\xA0: ${e.length} caract\xE8re${e.length>1?"s":""}).`,"NL.E0809":e=>`Propri\xE9t\xE9 de symbole inconnue \xAB\xA0${e.key}\xA0\xBB. Valeurs admises\xA0: unicode, ascii, link, description.`,"NL.E0810":e=>`Identifiant de symbole en double \xAB\xA0${e.name}\xA0\xBB. Premi\xE8re d\xE9claration \xE0 ${e.location}.`,"NL.E0811":e=>`${e.key}: \xAB\xA0${e.value}\xA0\xBB n'est ni une ic\xF4ne int\xE9gr\xE9e (${e.builtins}) ni un symbole d\xE9clar\xE9. Ajoutez \xAB\xA0symbol ${e.value} unicode:...\xA0\xBB plus haut dans la config ou utilisez un litt\xE9ral Unicode entre guillemets.`,"NL.E0812":e=>`${e.key}: le symbole \xAB\xA0${e.value}\xA0\xBB est r\xE9f\xE9renc\xE9 avant sa d\xE9claration. D\xE9placez \xAB\xA0symbol ${e.value}\xA0\xBB au-dessus de cette entr\xE9e.`,"NL.E0900":e=>`Une d\xE9claration ${e.kind} prend date:, ou start: et end:, ou every: avec start: et end: facultatifs.`,"NL.E0901":e=>`Propri\xE9t\xE9 ${e.kind} inconnue \xAB\xA0${e.key}\xA0\xBB. Autoris\xE9es\xA0: date, start, end, every.`,"NL.E0902":e=>`${e.key}: sur une d\xE9claration ${e.kind} prend une seule date, pas une liste.`,"NL.E0903":e=>`end: ${e.end} pr\xE9c\xE8de start: ${e.start}.`,"NL.E0904":e=>`Jour de semaine invalide \xAB\xA0${e.value}\xA0\xBB. Utilisez sun, mon, tue, wed, thu, fri ou sat.`,"NL.E0905":e=>`Le jour \xAB\xA0${e.value}\xA0\xBB appara\xEEt plusieurs fois.`,"NL.E0906":()=>"Il ne reste aucun jour ouvr\xE9 dans la semaine sans date de fin. Gardez au moins un jour ouvr\xE9.","NL.E0907":e=>`Identifiant ${e.kind} \xAB\xA0${e.name}\xA0\xBB en double.`,"NL.W0700":e=>`Propri\xE9t\xE9 inconnue \xAB\xA0${e.key}\xA0\xBB sur ${e.entity}. Le moteur de rendu l'ignore.${e.suggested?` Vouliez-vous dire \xAB\xA0${e.suggested}\xA0\xBB\xA0?`:""}`,"NL.W0701":e=>`La vague ${H(e.id)} dans ${H(e.path)} diff\xE8re de la d\xE9finition de ce fichier (${e.fields.map(t=>`${o2[t.field]} ${uI(t.there)} l\xE0-bas, ${uI(t.here)} ici`).join("\xA0; ")})\xA0; la d\xE9finition de ce fichier est utilis\xE9e.`,"NL.W0702":e=>`\xAB\xA0wave:\xA0\xBB sur ${e.target.kind==="default"?H(`default ${e.target.entityType}`):!e.target.name&&e.target.line!==void 0?e.target.kind==="item"||e.target.kind==="group"||e.target.kind==="parallel"?Dy({kind:e.target.kind,name:"",line:e.target.line}):`${e.target.kind} \xE0 la ligne ${e.target.line}`:`${e.target.kind} ${H(e.target.name)}`} est ignor\xE9\xA0: cette roadmap ne d\xE9clare aucune vague. D\xE9clarez des vagues avec \xAB\xA0wave <id>\xA0\xBB pour l'utiliser, ou retirez la propri\xE9t\xE9.`,"NL.W0703":e=>`${H(e.key)} sur ${H(`default ${e.entityType}`)} est ignor\xE9\xA0: c'est une cl\xE9 de style propre \xE0 la roadmap. D\xE9finissez-la plut\xF4t sur \xAB\xA0default roadmap\xA0\xBB.`,"NL.W0704":e=>`${H(`timeline-position:${e.position}`)} n'affiche aucune date\xA0: ${H("header-height:none")} retire tous les bandeaux de dates de la frise. Donnez \xE0 header-height la valeur xs, sm, md, lg ou xl pour les afficher.`,"NL.W0705":e=>`days-per-week vaut ${e.daysPerWeek}, mais la semaine laisse ${e.working} jours ouvr\xE9s.`,"NL.E1100":e=>`La vague ${e.title===void 0?`\xE0 la ligne ${e.line}`:H(e.title)} exige un identifiant explicite pour que le travail puisse la r\xE9f\xE9rencer avec wave:<id>, p.\xA0ex. wave build "Build".`,"NL.E1101":e=>{switch(e.reason){case"list":return`\xAB\xA0wave:\xA0\xBB accepte exactement un identifiant de vague\xA0; un \xE9l\xE9ment appartient \xE0 une seule vague au plus. Re\xE7u ${H(e.value)}.`;case"unknown":return`La vague ${H(e.value)} n'est pas d\xE9clar\xE9e. Vagues d\xE9clar\xE9es\xA0: ${e.declared.length>0?e.declared.join(", "):"aucune"}. Ajoutez \xAB\xA0wave ${e.value}\xA0\xBB au-dessus de la premi\xE8re swimlane qui l'utilise.${lI(e.suggestion)}`;case"forward":return`La vague ${H(e.value)} est utilis\xE9e avant sa d\xE9claration \xE0 la ligne ${e.line}. D\xE9clarez les vagues au-dessus des swimlanes qui les utilisent.`;case"not-a-wave":return`\xAB\xA0wave:\xA0\xBB doit nommer une vague, mais ${H(e.value)} est ${sI[e.kind]}.${lI(e.suggestion)}`}},"NL.E1102":e=>`${Cy(Dy(e.entity))} a wave:${e.wave}, mais ${Dy(e.container)} qui le contient a wave:${e.containerWave}. La vague d'un conteneur s'applique \xE0 tout ce qu'il contient\xA0; retirez l'une des deux propri\xE9t\xE9s wave:.`,"NL.E1103":e=>{switch(e.reason){case"sequence":{let t=e.items.length>1,n=`${t?"Les \xE9l\xE9ments":"L'\xE9l\xE9ment"} ${e.items.map(H).join(", ")} (vague ${H(e.itemWave)})`,r=typeof e.ref=="string"?H(e.ref):_s(e.ref);return`${n} ${t?"viennent":"vient"} apr\xE8s ${r} (vague ${H(e.refWave)}) dans ${_s(e.flow)}. Le travail d'une swimlane ou d'un groupe s'ex\xE9cute dans l'ordre, il doit donc aussi \xEAtre ordonn\xE9 par vague\xA0: d\xE9placez ${r} sous ${H(e.last)}, ou changez leurs vagues.`}case"join":return`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) vient apr\xE8s ${_s(e.block)} dans ${_s(e.flow)}, et ce bloc ne peut pas se terminer avant sa piste ${H(e.track)} (vague ${H(e.trackWave)}). D\xE9placez ${H(e.name)} au-dessus du bloc ou dans une piste distincte, ou changez l'une de leurs vagues.`;case"after-item":return e.container?`${Cy(aI(e.container))} a after:${e.refId}, mais ${H(e.ref)} est dans la vague ult\xE9rieure ${H(e.refWave)}. La vague ${H(e.refWave)} ne peut pas d\xE9marrer avant la fin de la vague ${H(e.wave)}, donc ${H(e.name)} (vague ${H(e.wave)}) \xE0 l'int\xE9rieur ne pourrait jamais d\xE9marrer\xA0: d\xE9placez ${H(e.name)} dans la vague ${H(e.refWave)} ou une vague ult\xE9rieure, ou retirez le after:.`:`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) a after:${e.refId}, mais ${H(e.ref)} est dans la vague ult\xE9rieure ${H(e.refWave)}. La vague ${H(e.refWave)} ne peut pas d\xE9marrer avant la fin de la vague ${H(e.wave)}, donc ${H(e.name)} ne pourrait jamais d\xE9marrer\xA0: d\xE9placez-le dans la vague ${H(e.refWave)} ou une vague ult\xE9rieure, ou retirez le after:.`;case"after-wave":{let t=e.container?.kind==="parallel"?"bloc parall\xE8le":"groupe";return e.container?`${Cy(aI(e.container))} (vague ${H(e.wave)}) a after:${e.refId}, mais le travail ne peut pas attendre la fin de sa propre vague ni d'une vague ult\xE9rieure. Utilisez une vague ant\xE9rieure, ou d\xE9placez le ${t} dans une vague ult\xE9rieure.`:`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) a after:${e.refId}, mais le travail ne peut pas attendre la fin de sa propre vague ni d'une vague ult\xE9rieure. Utilisez une vague ant\xE9rieure, ou d\xE9placez ${H(e.name)} dans une vague ult\xE9rieure.`}case"chain":return`L'\xE9l\xE9ment ${H(e.name)} (vague ${H(e.wave)}) ne pourrait jamais d\xE9marrer\xA0: via ${e.chain.join(" \u2192 ")}, il attend du travail qui ne peut pas d\xE9marrer avant la fin de la vague ${H(e.wave)}. D\xE9placez ${H(e.name)} dans une vague ult\xE9rieure, ou rompez la cha\xEEne.`}},"NL.E1104":e=>{switch(e.reason){case"swimlane":return`\xAB\xA0wave:\xA0\xBB n'est pas autoris\xE9 sur la swimlane ${H(e.name)}\xA0: une swimlane couvre toutes les vagues. Placez wave: sur ses \xE9l\xE9ments, ou regroupez-les dans \xAB\xA0group wave:${e.value}\xA0\xBB.`;case"milestone":return`\xAB\xA0wave:\xA0\xBB n'est pas autoris\xE9 sur le jalon ${H(e.name)}. Pour placer un jalon \xE0 la fin d'une vague, utilisez after:${e.value}.`;case"other":return`\xAB\xA0wave:\xA0\xBB n'est pas autoris\xE9 sur ${r2[e.type]} ${H(e.name)}\xA0; seuls item, group et parallel peuvent appartenir \xE0 une vague.`}},"NL.E1105":e=>e.reason==="before"?`\xAB\xA0before:\xA0\xBB n'est pas autoris\xE9 sur la vague ${H(e.name)}. La fin d'une vague d\xE9coule de ses \xE9l\xE9ments\xA0; pour donner une \xE9ch\xE9ance \xE0 une vague, ajoutez un jalon dat\xE9\xA0: milestone ${e.name}-due date:<AAAA-MM-JJ> after:${e.name}.`:`\xAB\xA0${e.key}:\xA0\xBB n'est pas autoris\xE9 sur la vague ${H(e.name)}. L'\xE9tendue d'une vague d\xE9coule de ses \xE9l\xE9ments\xA0; seul after: (une ancre, un jalon dat\xE9 ou une date ISO) peut retarder le d\xE9but d'une vague.`,"NL.E1106":e=>`La vague ${H(e.name)} a after:${e.ref}, mais ${H(e.ref)} est ${sI[e.kind]}. Le after: d'une vague accepte seulement des ancres, des jalons dat\xE9s ou une date ISO\xA0; pour qu'une vague attende du travail, placez ce travail dans une vague ant\xE9rieure.`,"NL.W1002":e=>`Les barri\xE8res de vagues ne se sont pas stabilis\xE9es apr\xE8s ${e.passes} passes de mise en page\xA0; le calendrier dessin\xE9 pourrait donc ne pas respecter l'ordre des vagues. La roadmap comporte probablement un conflit d'ordre que la validation n'a pas d\xE9tect\xE9.`,"NL.W1100":e=>{let t=$y(e);return e.reason==="item"?`before:${e.ref} sur ${t} ne peut jamais \xEAtre respect\xE9\xA0: ${t} est dans la vague ${H(e.wave)}, qui ne peut pas d\xE9marrer avant la fin de ${H(e.ref)} (vague ${H(e.refWave)}). Le d\xE9passement sera peint.`:`before:${e.ref} sur ${t} ne peut jamais \xEAtre respect\xE9\xA0: ${t} est dans la vague ${H(e.wave)}, qui ne peut pas se terminer avant le d\xE9but de la vague ${H(e.ref)}. Le d\xE9passement sera peint.`},"NL.W1101":e=>{let t=$y(e);switch(e.reason){case"forward-lane":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence ${H(e.ref)}, qui se trouve dans une swimlane ult\xE9rieure (${H(e.lane)}). La mise en page place les swimlanes dans l'ordre et ignore les r\xE9f\xE9rences \xE0 du travail qu'elle n'a pas encore plac\xE9, elle ignore donc ce ${e.key}:. D\xE9placez la swimlane ${H(e.lane)} au-dessus de la swimlane ${H(e.ownLane)}, ou retirez le ${e.key}:.`;case"forward-flow":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence ${H(e.ref)}, qui vient plus tard dans ${_s(e.flow)}. La mise en page ignore les r\xE9f\xE9rences \xE0 du travail qu'elle n'a pas encore plac\xE9, elle ignore donc ce ${e.key}:. D\xE9placez ${H(e.ref)} au-dessus ${$y(e,!0)}, ou retirez le ${e.key}:.`;case"ancestor":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence ${H(e.ref)}, qui le contient. La mise en page ignore les r\xE9f\xE9rences \xE0 un groupe ou un bloc parall\xE8le englobant, elle ignore donc ce ${e.key}:. Retirez le ${e.key}:.`;case"floating-milestone":return`${e.key}:${e.ref} sur ${t} r\xE9f\xE9rence le jalon ${H(e.ref)}, qui n'a pas de date. Les jalons sans date sont plac\xE9s apr\xE8s tout le travail, la mise en page ignore donc ce ${e.key}:. R\xE9f\xE9rencez plut\xF4t les pr\xE9d\xE9cesseurs du jalon ou une vague.`}},"NL.I1006":e=>e.names.length===1?`La vague ${H(e.names[0])} ne sera pas affich\xE9e\xA0: aucun \xE9l\xE9ment ne lui est affect\xE9.`:`Les vagues ${i2(e.names)} ne seront pas affich\xE9es\xA0: aucun \xE9l\xE9ment ne leur est affect\xE9.`,"NL.I1007":e=>`Le jalon ${H(e.name)} (${e.date}) est d\xE9pass\xE9\xA0: la vague ${H(e.wave)} se termine le ${e.end}.`,"NL.I1008":e=>`L'\xE9l\xE9ment ${H(e.name)} est \xE9pingl\xE9 \xE0 ${e.pin} (${e.key}:), un jour non ouvr\xE9\xA0; il d\xE9marre le ${e.start}.`};var dI={};var pI={};var s2=new Map([["en-US",oI],["fr",fI],["fr-CA",dI],["fr-FR",pI]]);function ht(e,t,...n){for(let r of a2(e)){let o=s2.get(r)?.[t];if(o)return o(...n)}return t}var hI="en-US";function a2(e){let t=[],n=l2(e);for(;n.length>0;){t.includes(n)||t.push(n);let r=n.lastIndexOf("-");if(r<=0)break;n=n.slice(0,r)}return t.includes(hI)||t.push(hI),t}function l2(e){return e.split("-").map((n,r)=>r===0?n.toLowerCase():/^[a-zA-Z]{2}$/.test(n)?n.toUpperCase():n).join("-")}var c2=/[\\/]/;function yI(e){for(let t=e.length-1;t>=0;t--){let n=e.charCodeAt(t);if(n===47||n===92)return t}return-1}function mI(...e){for(let t of e)if(t){if(t.includes("\\")&&!t.includes("/"))return"\\";if(t.includes("/"))return"/"}return"/"}function My(e){return e?e[0]==="/"||e[0]==="\\"?!0:e.length>=3&&/^[A-Za-z]:[\\/]/.test(e):!1}function vd(e){let t=yI(e);return t<0?".":t===0?e[0]:t===2&&/^[A-Za-z]:[\\/]/.test(e)?e.slice(0,3):e.slice(0,t)}function Al(e){let t=yI(e);return t<0?e:e.slice(t+1)}function kl(e,t){if(My(t))return gI(t,mI(t));let n=mI(e,t);return gI(`${e}${n}${t}`,n)}function gI(e,t){let n="",r=e,i=/^([A-Za-z]:)([\\/])?/.exec(r);i?(n=i[1]+(i[2]?t:""),r=r.slice(i[0].length)):(r[0]==="/"||r[0]==="\\")&&(n=t,r=r.replace(/^[\\/]+/,""));let o=[];for(let s of r.split(c2))if(!(s===""||s===".")){if(s===".."){o.length>0&&o[o.length-1]!==".."?o.pop():n||o.push("..");continue}o.push(s)}return n+o.join(t)}function Td(e){let t=kl("",e).replace(/\\/g,"/"),n=/^[A-Za-z]:/.test(t)?t.slice(0,2).toLowerCase():"",r=n?t.slice(2):t;return[n,...r.split("/").filter(i=>i!=="")]}function Fy(e,t){let n=Td(e),r=Td(t);return n.length<=r.length&&n.every((i,o)=>i===r[o])}function xI(e,t){let n=Td(e),r=Td(t);if(n[0]!==r[0])return t;let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return[...n.slice(i).map(()=>".."),...r.slice(i)].join("/")||"."}function Rt(e){return/[\r\n]/.test(e)?e.replace(/\s*[\r\n]+\s*/g," ").trim():e}function EI(e,t,n){if(e===t)return 0;let r=e.length,i=t.length;if(Math.abs(r-i)>n)return n+1;if(r===0)return i;if(i===0)return r;let o=new Array(i+1),s=new Array(i+1);for(let a=0;a<=i;a++)o[a]=a;for(let a=1;a<=r;a++){s[0]=a;let l=a;for(let u=1;u<=i;u++){let f=e.charCodeAt(a-1)===t.charCodeAt(u-1)?0:1;s[u]=Math.min(o[u]+1,s[u-1]+1,o[u-1]+f),s[u]<l&&(l=s[u])}if(l>n)return n+1;let c=o;o=s,s=c}return o[i]}function wI(e,t,n=2){let r,i=n+1;for(let o of t){let s=EI(e,o,n);if(s<i&&(r=o,i=s,s===0))break}return r}function TI(e,t,n=2){let r,i=n+1,o=!1;for(let s of t){let a=EI(e,s,n);a<i?(r=s,i=a,o=!1):a===i&&a<=n&&s!==r&&(o=!0)}return o?void 0:r}function Re(e){return e.name??(e.title===void 0?"<unnamed>":Rt(e.title))}function Fr(e){return e.$type==="NonWorkingDeclaration"?"non-working":e.$type.replace(/Declaration$|Block$/,"").toLowerCase()}function Il(e){let t=Fr(e),n=e.name??(e.title===void 0?void 0:Rt(e.title));return n?`${t} "${n}"`:t}function En(e){let t=e.$cstNode;return t?t.range.start.line+1:0}function _d(e,t){return`"${e}" cannot be set on "default ${t}". Identity-defining, sizing, sequencing, reference, and prose properties must be explicit on each entity.`}function on(e){let t=new Set,n=[];for(let r of e.roadmapEntries)!vt(r)||!r.name||t.has(r.name)||(t.add(r.name),n.push(r));return n}function u2(e){let t=new Map;return on(e).forEach((n,r)=>{t.set(n.name,r+1)}),t}function _I(e){return(e.properties??[]).filter(n=>ee(n)==="wave")}function AI(e){return _I(e)[0]}function By(e){return e.value!==void 0?e.value:e.values.length===1?e.values[0]:`[${e.values.join(", ")}]`}function f2(e){let t=e;for(;t?.$container&&!as(t.$container);)t=t.$container;let n=t?.$container;if(!(!t||!n||!as(n)))return{file:n,index:n.roadmapEntries.indexOf(t),waveDecls:kI(n)}}function kI(e){let t=new Map;return e.roadmapEntries.forEach((n,r)=>{vt(n)&&n.name&&!t.has(n.name)&&t.set(n.name,r)}),t}function Wy(e,t,n,r=f2(t)){let i=By(e);if(e.value===void 0&&e.values.length!==1)return{status:"list",value:i};let o=n.get(i);if(o===void 0)return{status:"missing",value:i};if(r){let s=r.waveDecls.get(i);if(s!==void 0&&(r.index<0||s>r.index))return{status:"forward",value:i,line:En(r.file.roadmapEntries[s])}}return{status:"valid",id:i,index:o}}function d2(e){return $e(e)||et(e)}function p2(e,t,n,r){let i=AI(e);if(!i)return t;let o=Wy(i,e,n,r);if(o.status==="valid")return t??o.index}function Ad(e,t){let n=new Map,r=new Map,i=new Map,o=(s,a,l)=>{let c=p2(s,a,t,l);c!==void 0&&n.set(s,c);let u=c;if($e(s)||et(s)){let f=[];for(let d of _t(s))f.push(o(d,c,l));c===void 0&&($e(s)?u=f[0]:f.length>0&&!f.includes(void 0)&&(u=Math.min(...f)))}return u!==void 0&&r.set(s,u),u};for(let s of e){let a,l=s.$container;if(as(l)){let c=i.get(l);c||(c=kI(l),i.set(l,c)),a={file:l,index:l.roadmapEntries.indexOf(s),waveDecls:c}}for(let c of _t(s))o(c,void 0,a)}return{waveOf:n,leadOf:r}}function II(e){return(e.properties??[]).find(n=>ee(n)==="date")?.value}function As(e){let t=PA(e);return n=>t.get(n)}function Sl(e,t){let n=null;for(let r of e.properties){if(ee(r)!=="after")continue;let i=r.value!==void 0?[r.value]:r.values;for(let o of i){if(!o)continue;let s;if(ot.test(o))s=o;else{let a=t(o);(ss(a)||xn(a))&&(s=II(a))}s===void 0||!He(s)||(n===null||s>n.date)&&(n={date:s,ref:o})}}return n}var RI=new Set(["before","date","start","length","duration","size","capacity","remaining","wave"]);function Li(e){return vt(e.$container)&&RI.has(ee(e))}var h2={ItemDeclaration:"item",GroupBlock:"group",ParallelBlock:"parallel",SwimlaneDeclaration:"swimlane",AnchorDeclaration:"anchor",MilestoneDeclaration:"milestone",WaveDeclaration:"wave",LabelDeclaration:"label",SizeDeclaration:"size",StatusDeclaration:"status",PersonDeclaration:"person",TeamDeclaration:"team",FootnoteDeclaration:"footnote",RoadmapDeclaration:"roadmap",StyleDeclaration:"style",SymbolDeclaration:"symbol"};function Rl(e){return h2[e.$type]??Fr(e)}function m2(e,t){let n=[],r=Re(e),i=!e.name&&e.title===void 0;if(e.name||n.push({severity:"error",code:"NL.E1100",args:{...e.title===void 0?{}:{title:Rt(e.title)},line:En(e)},node:e}),i)return n;for(let o of e.properties){let s=ee(o);if(RI.has(s)){n.push({severity:"error",code:"NL.E1105",args:s==="before"?{reason:"before",name:r}:{reason:"other",key:s,name:r},node:o,property:"key"});continue}if(s!=="after")continue;let a=o.value!==void 0?[o.value]:o.values;for(let l of a){if(!l||ot.test(l))continue;let c=t(l);if(!(!c||ss(c))){if(xn(c)){if(II(c)!==void 0)continue;n.push({severity:"error",code:"NL.E1106",args:{name:r,ref:l,kind:"floating-milestone"},node:o});continue}n.push({severity:"error",code:"NL.E1106",args:{name:r,ref:l,kind:Rl(c)},node:o})}}}return n}function kd(e){let t=As(e);return e.roadmapEntries.filter(vt).flatMap(n=>m2(n,t))}function g2(e){return[...Mn(e,{config:!0,roadmap:!0})].filter(t=>kA(t)?nt(t):!vt(t))}function y2(e,t){let n=e.toLowerCase(),r=t.filter(o=>o.title!==void 0&&Rt(o.title).toLowerCase()===n),i;if(r.length===1)i=r[0];else{let o=TI(e,t.map(s=>s.name));i=o===void 0?void 0:t.find(s=>s.name===o)}if(i)return i.title===void 0?{id:i.name}:{id:i.name,title:Rt(i.title)}}function x2(e,t,n){let r=n(t);if(r)return Rl(r);for(let i of e.configEntries)if((Wt(i)||Ei(i))&&i.name===t)return Rl(i)}function E2(e,t){let n=e.$container;for(;d2(n);){let r=AI(n);if(r)return Wy(r,n,t).status==="valid"?{container:n,prop:r}:void 0;n=n?.$container}}function vI(e,t){let n=t.name??(t.title===void 0?"":Rt(t.title));return n?{kind:e,name:n}:{kind:e,name:n,line:En(t)}}function w2(e){if(nt(e))return{kind:"default",entityType:e.entityType};let t=e,n=t.name??(t.title===void 0?"":Rt(t.title)),r=Rl(e);return n?{kind:r,name:n}:{kind:r,name:n,line:En(e)}}function T2(e,t,n,r,i,o){let s=Wy(n,t,i);switch(s.status){case"list":return{severity:"error",code:"NL.E1101",args:{reason:"list",value:s.value},node:n};case"forward":return{severity:"error",code:"NL.E1101",args:{reason:"forward",value:s.value,line:s.line},node:n};case"missing":{let u=x2(e,s.value,o),f=y2(s.value,r);return{severity:"error",code:"NL.E1101",args:u===void 0?{reason:"unknown",value:s.value,declared:r.map(d=>d.name),...f?{suggestion:f}:{}}:{reason:"not-a-wave",value:s.value,kind:u,...f?{suggestion:f}:{}},node:n}}case"valid":break}let a=E2(t,i);if(!a)return;let l=By(a.prop);if(l===s.id)return;let c=Ve(t)?"item":$e(t)?"group":"parallel";return{severity:"error",code:"NL.E1102",args:{entity:vI(c,t),wave:s.id,container:vI($e(a.container)?"group":"parallel",a.container),containerWave:l},node:n}}function Id(e){let t=on(e),n=t.length>0,r=u2(e),i=As(e),o=[];for(let s of g2(e)){let a=_I(s);if(a.length===0)continue;if(!n){for(let m of a)o.push({severity:"warning",code:"NL.W0702",args:{target:w2(s)},node:m,property:"key"});continue}if(nt(s)){for(let m of a)o.push({severity:"error",message:_d("wave",s.entityType),node:m});continue}let l=s,c=Re(l);if(!l.name&&l.title===void 0&&!Ve(s)&&!$e(s)&&!et(s))continue;if(Ke(s)||xn(s)){for(let m of a)o.push({severity:"error",code:"NL.E1104",args:{reason:Ke(s)?"swimlane":"milestone",name:c,value:By(m)},node:m});continue}if(!Ve(s)&&!$e(s)&&!et(s)){for(let m of a)o.push({severity:"error",code:"NL.E1104",args:{reason:"other",type:Rl(s),name:c},node:m});continue}let[f,...d]=a,p=T2(e,s,f,t,r,i);if(p&&o.push(p),d.length>0){let m=a.flatMap(g=>g.value!==void 0?[g.value]:g.values);for(let g of d)o.push({severity:"error",code:"NL.E1101",args:{reason:"list",value:`[${m.join(", ")}]`},node:g})}}return o}var v2=["after-wave","after-item","sequence","join"];function Pi(e){return e.name??(e.title===void 0?void 0:Rt(e.title))}function Rd(e){let t=Pi(e);if(Ke(e))return{kind:"swimlane",name:Re(e)};let n=$e(e);return t?{kind:n?"group":"parallel",name:t}:{kind:n?"group-block":"parallel-block",line:En(e)}}function SI(e){let t=Pi(e);return t!==void 0||e.$type==="ItemDeclaration"?t:{kind:$e(e)?"group-block":"parallel-block",line:En(e)}}function bI(e){return e.$type==="ItemDeclaration"||Pi(e)!==void 0?{name:Re(e)}:{name:"",kind:$e(e)?"group":"parallel",line:En(e)}}function _2(e){let t=$e(e)?"group":"parallel",n=Pi(e);return n?{kind:t,name:n}:{kind:t,name:"",line:En(e)}}function Xy(e){return(e.value!==void 0?[e.value]:e.values).filter(t=>!!t)}function A2(e){return xn(e)&&!e.properties.some(t=>ee(t)==="date")}function ks(e,t,n={}){if(t.length===0)return[];let r=new Map;t.forEach((A,O)=>{A.name&&r.set(A.name,O+1)});let i=A=>t[A-1]?.name??"",{lanes:o,lookup:s}=e,{waveOf:a,leadOf:l}=Ad(o,r),c=[],u=new Map,f=0,d=(A,O,W,G)=>{let K=c.length,q={node:A,lane:O,parent:W,children:[],prev:G,start:f++,reg:-1,ew:a.get(A),lw:l.get(A),after:[],afterWaves:[]};if(c.push(q),$e(A)||et(A)){let Q=-1;for(let re of _t(A))Q=d(re,O,K,$e(A)?Q:-1),q.children.push(Q);q.reg=f++}else q.reg=q.start;if(A.name){let Q=u.get(A.name)??[];Q.push(K),u.set(A.name,Q)}return K};o.forEach((A,O)=>{let W=-1;for(let G of _t(A))W=d(G,O,-1,W)});let p=(A,O)=>{let W=u.get(A);if(W){for(let G=W.length-1;G>=0;G--)if(c[W[G]].reg<c[O].start)return W[G]}},m=[],g=n.suppressCycleRefs??!0?I2(c,o,s):()=>!1;for(let A=0;A<c.length;A++){let O=c[A],W=bI(O.node);for(let G of O.node.properties){let K=ee(G);if(!(K!=="after"&&K!=="before"))for(let q of Xy(G)){if(ot.test(q))continue;let Q=p(q,A),re=Q===void 0?r.get(q):void 0;if(K==="after"&&(Q!==void 0?O.after.push({from:Q,prop:G,ref:q}):re!==void 0&&O.afterWaves.push({prop:G,ref:q,j:re})),Q!==void 0||re!==void 0)continue;let le=u.get(q)?.[0];if(le===void 0&&!A2(s(q))||g(O.node.name,K,q))continue;let ce=!1;for(let pe=O.parent;pe>=0&&!ce;pe=c[pe].parent)ce=c[pe].node.name===q;m.push({severity:"warning",code:"NL.W1101",args:le===void 0?{reason:"floating-milestone",key:K,ref:q,...W}:ce?{reason:"ancestor",key:K,ref:q,...W}:c[le].lane!==O.lane?{reason:"forward-lane",key:K,ref:q,...W,lane:Re(o[c[le].lane]),ownLane:Re(o[O.lane])}:{reason:"forward-flow",key:K,ref:q,...W,flow:Rd(k2(c,o,A,le))},node:G})}}}let E=new Array(c.length),x=new Array(c.length);for(let A=c.length-1;A>=0;A--){let O=c[A];if(O.node.$type==="ItemDeclaration"){E[A]=O.ew,x[A]=O.ew;continue}for(let W of O.children){let G=E[W],K=x[W];G!==void 0&&(E[A]=Math.max(E[A]??G,G)),K!==void 0&&(x[A]=Math.min(x[A]??K,K))}}for(let A=0;A<c.length;A++){let O=E[A];if(O===void 0)continue;let W=bI(c[A].node);for(let G of c[A].node.properties)if(ee(G)==="before")for(let K of Xy(G)){if(ot.test(K))continue;let q=p(K,A);if(q!==void 0){let re=x[q];if(re===void 0||O<=re)continue;m.push({severity:"warning",code:"NL.W1100",args:{reason:"item",ref:K,...W,wave:i(O),refWave:i(re)},node:G});continue}let Q=r.get(K);Q===void 0||O<Q||m.push({severity:"warning",code:"NL.W1100",args:{reason:"wave",ref:K,...W,wave:i(O)},node:G})}}let y=A=>c[A].node.$type!=="ItemDeclaration",w=A=>{let{parent:O}=c[A];return O<0?!1:et(c[O].node)||c[O].children[0]===A},_=new Array(c.length).fill(0),v=new Array(c.length).fill(0),R=A=>{let O=c[A],W=[];O.lw!==void 0&&W.push({term:{kind:O.ew!==void 0?"wave":"lead"},value:O.lw-1});for(let G of O.afterWaves)W.push({term:{kind:"after-wave",prop:G.prop,ref:G.ref},value:G.j});w(A)&&W.push({term:{kind:"parent",from:O.parent},value:_[O.parent]}),O.prev>=0&&W.push({term:{kind:"seq",from:O.prev},value:v[O.prev]});for(let G of O.after)W.push({term:{kind:"after",from:G.from,prop:G.prop,ref:G.ref},value:v[G.from]});return W},B=A=>{let O=_[A];for(let W of c[A].children)O=Math.max(O,v[W]);return O},C=c.map((A,O)=>[2*O+1]),X=c.map(()=>[]);for(let A=0;A<c.length;A++){let O=c[A];w(A)&&C[O.parent].push(2*A),O.prev>=0&&X[O.prev].push(2*A);for(let W of O.after)X[W.from].push(2*A);O.parent>=0&&X[A].push(2*O.parent+1)}let V=[],$=new Array(2*c.length).fill(!0);for(let A=0;A<c.length;A++)V.push(2*A,2*A+1);for(let A=0;A<V.length;A++){let O=V[A];$[O]=!1;let W=O>>1,G=(O&1)===1,K=G?B(W):Math.max(0,...R(W).map(q=>q.value));if(!(K<=(G?v[W]:_[W]))){G?v[W]=K:_[W]=K;for(let q of G?X[W]:C[W])$[q]||($[q]=!0,V.push(q))}}let I=(A,O)=>R(A).filter(W=>W.value===O).map(W=>W.term),F=(A,O)=>{if(!y(A))return[{kind:"start"}];let W=c[A].children.filter(G=>v[G]===O).map(G=>({kind:"child",from:G}));return W.length>0?$e(c[A].node)?W.reverse():W:_[A]===O?[{kind:"start"}]:[]},N=(A,O)=>{let W=[{i:A,via:A}];for(;W.length>0;){let{i:G,via:K}=W.pop(),q=F(G,O);for(let Q=q.length-1;Q>=0;Q--){let re=q[Q];if(re.kind==="start"){let le=c[G].ew;if(le!==void 0&&le-1===O)return{origin:G,via:K}}else re.kind==="child"&&W.push({i:re.from,via:G===A?re.from:K})}}},k=(A,O)=>{let W=c[A].ew;return W!==void 0&&W-1===O},b=(A,O)=>{let W=A;for(;c[W].prev>=0||w(W);){let G=c[W].prev;if(G<0){W=c[W].parent;continue}let K=c[G].ew;if(K!==void 0&&K>O)return G;W=G}},T=new Map,L=[],D=new Map,P=(A,O,W)=>`${A}:${c[A].node.properties.indexOf(O)}:${W}`,U=(A,O)=>{let W=[],G=A;for(;;){let K=I(G,O);for(let Q of K)if(Q.kind==="after-wave")W.push({variant:"after-wave",owner:G,prop:Q.prop,ref:Q.ref});else if(Q.kind==="after")k(Q.from,O)&&W.push({variant:"after-item",owner:G,prop:Q.prop,ref:Q.ref});else if(Q.kind==="seq"){let re=Q.from,le=c[re].node;if(et(le)&&c[re].ew===void 0){let ce=N(re,O),pe=ce&&(Pi(c[ce.via].node)??Pi(c[ce.origin].node));pe&&W.push({variant:"join",owner:G,block:re,track:pe})}else if(k(re,O)){let ce=SI(le);ce&&W.push({variant:"sequence",owner:G,pred:re,ref:ce})}}let q=K.find(Q=>Q.kind==="parent");if(!q)break;G=q.from}for(let K of v2){let q=W.find(Q=>Q.variant===K);if(q)return q}},z=(A,O)=>{let W=[{key:2*A,from:-1}],G=new Set([2*A]),K,q=(Q,re)=>{G.has(Q)||(G.add(Q),W.push({key:Q,from:re}))};for(let Q=0;Q<W.length;Q++){let re=W[Q].key>>1;if(re!==A&&T.has(re)){K??(K=re);continue}if((W[Q].key&1)===1){for(let pe of F(re,O))pe.kind==="start"?q(2*re,Q):pe.kind==="child"&&q(2*pe.from+1,Q);continue}let le=I(re,O),ce=le.find(pe=>pe.kind==="wave"||pe.kind==="lead")??le.find(pe=>pe.kind==="after-wave");if(ce){let pe=[];for(let mt=Q;mt>=0;mt=W[mt].from){let gt=W[mt].key>>1;pe[pe.length-1]!==gt&&pe.push(gt)}let rt=Re(c[re].node);return{path:pe,origin:ce.kind==="after-wave"?`${rt} (after:${ce.ref})`:`${rt} (wave "${i(O+1)}")`}}for(let pe of le)pe.kind==="parent"?q(2*pe.from,Q):(pe.kind==="seq"||pe.kind==="after")&&q(2*pe.from+1,Q)}return{hit:K}},J=(A,O,W,G)=>{let K=Re(c[O].node),q=i(W),Q=i(G+1),re=c[A.owner].node,le=A.owner===O?void 0:_2(re);switch(A.variant){case"after-wave":{let ce=c[A.owner].ew===void 0?void 0:le;return{node:A.prop,run:[O],build:()=>({reason:"after-wave",name:K,wave:q,refId:A.ref,...ce?{container:ce}:{}})}}case"after-item":return{node:A.prop,run:[O],build:()=>({reason:"after-item",name:K,wave:q,refId:A.ref,ref:A.ref,refWave:Q,...le?{container:le}:{}})};case"join":{let ce=c[A.block];return{node:c[O].node,run:[O],build:()=>({reason:"join",name:K,wave:q,block:Rd(ce.node),flow:Rd(NI(c,o,A.block)),track:A.track,trackWave:Q})}}case"sequence":{let ce=A.pred,pe=c[ce].parent,rt=mt=>{if(pe<0)return c[mt].lane===c[ce].lane;for(let gt=c[mt].parent;gt>=0;gt=c[gt].parent)if(gt===pe)return!0;return!1};return{node:c[O].node,run:[O],build:mt=>{let gt=mt.filter(rt);return{reason:"sequence",items:gt.map(tc=>Re(c[tc].node)),itemWave:q,ref:A.ref,refWave:i(c[ce].ew??G+1),flow:Rd(NI(c,o,ce)),last:Re(c[gt[gt.length-1]].node)}},seq:{pred:ce,ref:A.ref,inFlow:rt}}}}},Y=(A,O)=>(L.push(O),A!==void 0&&D.set(A,O),O),te=(A,O,W,G)=>{let K=A.variant==="sequence"?`sequence:${A.pred}:${W}`:A.variant==="join"?`join:${A.block}:${W}`:`${A.variant}:${P(A.owner,A.prop,A.ref)}`,q=D.get(K);return q?(q.run.push(O),q):Y(K,J(A,O,W,G))};for(let A=0;A<c.length;A++){let O=c[A],W=O.ew;if(O.node.$type!=="ItemDeclaration"||W===void 0||_[A]<W)continue;let G=_[A],K=U(A,G),q;if(K)q=te(K,A,W,G);else{let Q=z(A,G);if("path"in Q){let re=Q.path.slice(1).filter(rt=>!y(rt)||Pi(c[rt].node)!==void 0).map(rt=>Re(c[rt].node)),le=[Q.origin,...re.filter((rt,mt)=>re[mt-1]!==rt)],ce=Re(O.node),pe=i(W);q=Y(void 0,{node:O.node,run:[A],build:()=>({reason:"chain",name:ce,wave:pe,chain:le})})}else{let re=Q.hit===void 0?void 0:T.get(Q.hit),le=re?.seq;if(le?.inFlow(A)){let ce=b(A,W),pe=ce===void 0?void 0:SI(c[ce].node),rt=ce!==void 0&&pe!==void 0?{variant:"sequence",owner:A,pred:ce,ref:pe}:{variant:"sequence",owner:A,pred:le.pred,ref:le.ref};q=te(rt,A,W,G)}else q=re,q?.run.push(A)}}q&&T.set(A,q)}for(let A of L)m.push({severity:"error",code:"NL.E1103",args:A.build(A.run),node:A.node});return m}function NI(e,t,n){let r=e[n].parent;return r<0?t[e[n].lane]:e[r].node}function k2(e,t,n,r){let i=new Set;for(let o=e[r].parent;o>=0;o=e[o].parent)i.add(o);for(let o=e[n].parent;o>=0;o=e[o].parent)if(i.has(o))return e[o].node;return t[e[n].lane]}function I2(e,t,n){let r=new Map,i=(c,u)=>{let f=r.get(c)??new Set;f.add(u),r.set(c,f)},o=[],s=(c,u)=>{if(c)for(let f of u){let d=ee(f);if(!(d!=="after"&&d!=="before"))for(let p of Xy(f))ot.test(p)||(d==="after"?i(c,p):i(p,c),o.push(p))}};for(let c of t)s(c.name,c.properties);for(let c of e)s(c.node.name,c.node.properties);let a=new Set;for(;o.length>0;){let c=o.pop();if(a.has(c))continue;a.add(c);let u=n(c);xn(u)&&s(u.name,u.properties)}let l=(c,u)=>{let f=new Set([c]),d=[c];for(;d.length>0;){let p=d.pop();if(p===u)return!0;for(let m of r.get(p)??[])f.has(m)||(f.add(m),d.push(m))}return!1};return(c,u,f)=>c?u==="after"?l(f,c):l(c,f):!1}function Is(e){return t=>e.anchors.get(t)??e.milestones.get(t)??e.waves?.get(t)}function bl(e){let t=e.$document?.parseResult;return!!t&&(t.lexerErrors.length>0||t.parserErrors.length>0)}function PI(e,t){return bl(e)?!1:!!e.roadmapDecl||t.swimlanes.size>0||on(e).length>0}function Hn(e,t){if(!e.$cstNode)return{};let{start:n,end:r}=ng({node:e,...t===void 0?{}:{property:t}});return{line:n.line,range:{start:{line:n.line,character:n.character},end:{line:r.line,character:r.character}}}}function Oi(e,t,n,r,...i){return{severity:e,message:ht("en-US",r,...i),sourcePath:t,...n,code:r,args:i,rule:"wave"}}function Sd(e){return e.map(t=>t.name)}function LI(e){let t=n=>{let r=e.properties.find(i=>ee(i)===n);return r?r.value??r.values.join(", "):""};return{title:e.title===void 0?"":Rt(e.title),style:t("style"),labels:t("labels"),link:t("link"),description:e.description?Rt(e.description.text):""}}var R2=["title","style","labels","link","description"];function OI(e,t,n){let r={diagnostics:[],failed:!1};if(n.mode==="ignore"||!n.participates||n.childFile.roadmapEntries.some(p=>vt(p)&&!p.name))return r;let i=n.parentAbs,o=Hn(n.inc),s=n.childRelPath,a=on(e),l=on(n.childFile),c=p=>({diagnostics:[p],failed:!0});if(a.length===0&&l.length===0)return r;if(l.length===0)return c(Oi("error",i,o,"NL.E0202",{reason:"child-none",path:s,parent:Sd(a)}));if(a.length===0)return c(Oi("error",i,o,"NL.E0202",{reason:"parent-none",path:s,child:Sd(l)}));if(a.length!==l.length||a.some((p,m)=>p.name!==l[m].name))return c(Oi("error",i,o,"NL.E0202",{reason:"mismatch",path:s,child:Sd(l),parent:Sd(a)}));let u=Is(t),f=Is(n.childContent);for(let p=0;p<a.length;p++){let m=Sl(a[p],u)?.date??null,g=Sl(l[p],f)?.date??null;if(m!==g)return c(Oi("error",i,o,"NL.E0202",{reason:"floor",id:a[p].name,path:s,childFloor:g,parentFloor:m}))}let d=[];for(let p=0;p<a.length;p++){let m=LI(a[p]),g=LI(l[p]),E=R2.filter(x=>m[x]!==g[x]).map(x=>({field:x,there:g[x],here:m[x]}));E.length!==0&&d.push(Oi("warning",i,o,"NL.W0701",{id:a[p].name,path:s,fields:E}))}return{diagnostics:d,failed:!1}}function S2(e){let t=e;for(;t&&!as(t);)t=t.$container;return t}function CI(e){let{rootFile:t,rootAbs:n,rootContent:r,files:i,edges:o,failed:s}=e,a=[],l=new Set,c=v=>{let R=JSON.stringify([v.sourcePath,v.line,v.code,v.args,v.message]);l.has(R)||(l.add(R),a.push(v))},u=v=>{let R=S2(v);return R?i.get(R):void 0},f=(v,R)=>{let B=Hn(v.node,v.property);return"message"in v?{severity:v.severity,message:v.message,sourcePath:R,...B,rule:"wave"}:Oi(v.severity,R,B,v.code,v.args)},d=[],p=new Set([n]),m=v=>{for(let R of o.get(v)??[])R.mode==="ignore"||!R.participates||p.has(R.childAbs)||(p.add(R.childAbs),s.has(R.childAbs)||d.push({file:R.childFile,abs:R.childAbs}),m(R.childAbs))};m(n);let g=on(t),E=new Map(g.map(v=>[v.name,v]));for(let{file:v,abs:R}of d){for(let C of kd(v))c(f(C,R));for(let C of Id(v))c(f(C,R));if(E.size===0)continue;let B=(C,X)=>{let V=C===void 0?void 0:E.get(C);if(!V||vt(X))return;let $=V.$cstNode?V.$cstNode.range.start.line+1:0;c(Oi("error",R,Hn(X),"NL.E0300",{name:C,location:`${Al(n)}:${$}`}))};v.roadmapDecl&&B(v.roadmapDecl.name,v.roadmapDecl);for(let C of v.roadmapEntries)Hf(C,B);for(let C of v.configEntries)Wt(C)&&B(C.name,C)}if(g.length===0)return a;let x=v=>"message"in v?v.message:`${v.code}\0${JSON.stringify(v.args)}`,y=new Map,w={lanes:t.roadmapEntries.filter(Ke),lookup:As(t)};for(let v of ks(w,g,{suppressCycleRefs:!1})){let R=y.get(v.node)??new Set;R.add(x(v)),y.set(v.node,R)}let _=v=>{for(let R of v){if(y.get(R.node)?.has(x(R)))continue;let B=u(R.node);B===void 0||s.has(B)||c(f(R,B))}};_(ks({lanes:[...r.swimlanes.values()],lookup:Is(r)},g,{suppressCycleRefs:!1}));for(let v of r.isolatedRegions){let R=v.content.roadmap?u(v.content.roadmap):void 0;if(R!==void 0&&s.has(R))continue;let B=[...v.content.waves?.values()??[]];B.length!==0&&_(ks({lanes:[...v.content.swimlanes.values()],lookup:Is(v.content)},B,{suppressCycleRefs:!1}))}return a}function bd(e){let t=LA(e),n=[];for(let r of e.roadmapEntries)Gf(r,i=>{let o=ee(i);if(o!=="after"&&o!=="before"&&o!=="on"||Li(i))return;let s=i.value?[i.value]:i.values;for(let a of s)a&&((o==="after"||o==="before")&&ot.test(a)||t.has(a)||n.push({prop:i,key:o,value:a}))});return n}function $I(e,t){let n=[],r=new Set([e]),i=o=>{for(let s of t.get(o)??[])if(!(s.mode==="ignore"||r.has(s.childAbs))){if(r.add(s.childAbs),!bl(s.childFile))for(let{prop:a,key:l,value:c}of bd(s.childFile)){let u=[{key:l,value:c}];n.push({severity:"error",message:ht("en-US","NL.E0302",...u),sourcePath:s.childAbs,...Hn(a),code:"NL.E0302",args:u})}i(s.childAbs)}};return i(e),n}function Uy(e){return e.includes.some(t=>t.options.find(n=>n.key==="roadmap")?.value!=="ignore")}function DI(e){return e.swimlanes.size>0||e.isolatedRegions.some(t=>DI(t.content))}function MI(e,t,n,r){let i=e.roadmapDecl;return!i||!Uy(e)?[]:r.some(o=>o.severity==="error")?[]:DI(n)?[]:[{severity:"error",message:ht("en-US","NL.E0004"),sourcePath:t,...Hn(i),code:"NL.E0004",args:[]}]}function FI(e){let t=e?.properties.find(n=>n.key==="start");if(!(!t?.value||!He(t.value)))return t.value}function Br(e){return e.code!==void 0||e.rule==="wave"||e.syntax!==void 0}function N2(){return{styles:new Map,defaults:new Map,symbols:new Map,calendarDeclarations:[]}}function L2(){return{persons:new Map,teams:new Map,anchors:new Map,labels:new Map,sizes:new Map,statuses:new Map,swimlanes:new Map,milestones:new Map,footnotes:new Map,isolatedRegions:[]}}var jy=16;async function Yy(e,t,n){let r=n.readFile??(async u=>{let{nodeReadFile:f}=await Promise.resolve().then(()=>(Hy(),Gy));return f(u)}),i=n.includePolicy,o=(i?.kind==="rooted"?i.realPath:void 0)??(async u=>{let{nodeRealPath:f}=await Promise.resolve().then(()=>(Hy(),Gy));return f(u)}),s=kl("",t),a={services:n.services,rootAbs:s,policy:i,realPath:o,displayBase:i?.kind==="rooted"?i.root:vd(s),diagnostics:[],resolving:[],processed:new Map,readFile:r,files:new Map,edges:new Map,failedWaves:new Set},{config:l,content:c}=await XI(e,s,a);return a.diagnostics.push(...CI({rootFile:e,rootAbs:s,rootContent:c,files:a.files,edges:a.edges,failed:a.failedWaves})),a.diagnostics.push(...$I(s,a.edges)),a.diagnostics.push(...MI(e,s,c,a.diagnostics)),{config:l,content:c,diagnostics:a.diagnostics,processedFiles:new Set(a.processed.keys())}}async function XI(e,t,n){if(n.processed.has(t))return n.processed.get(t);t!==n.rootAbs&&n.diagnostics.push(...C2(e,t)),n.resolving.push(t),n.files.set(e,t);let r=N2(),i=L2();W2(r,e),H2(i,e);let o=on(e);o.length>0&&(i.waves=new Map(o.map(c=>[c.name,c])));let s=[];n.edges.set(t,s);let a=new Set;for(let c of e.includes){let u=c.path,f=(v,...R)=>{n.diagnostics.push(P2(t,c,v,...R))};if(n.policy?.kind==="disabled"){f("NL.E0209",{path:u});continue}let d=await O2(t,u,n);if("refused"in d){f("NL.E0208",d.refused);continue}if("unreadable"in d){f("NL.E0203",d.unreadable);continue}let p=d.absPath;if(a.has(p)){f("NL.E0205",{path:u});continue}a.add(p);let m=n.resolving.indexOf(p);if(m>=0){let v=[...n.resolving.slice(m),p].map(R=>xI(n.displayBase,R)).join(" \u2192 ");f("NL.E0204",{path:u,chain:v});continue}if(n.resolving.length>jy){f("NL.E0210",{path:u,max:jy});continue}if(!p.endsWith(".nowline")){f("NL.E0203",{reason:"not-nowline",path:u});continue}let g=BI(c,"config")??"merge",E=BI(c,"roadmap")??"merge",x;try{let v=await n.readFile(p);x=await $2(n.services,v,p)}catch(v){f("NL.E0203",UI(u,v));continue}let{config:y,content:w}=await XI(x,p,n);s.push({parentAbs:t,inc:c,childRelPath:u,childAbs:p,mode:E,childFile:x,childContent:w,participates:PI(x,w)}),D2(r,y,g,p,n.diagnostics),M2(i,w,y,E,p,u,n.diagnostics);let _=!bl(x);if(_&&E==="isolate"&&!w.roadmap&&f("NL.E0206",{path:u}),_&&E!=="ignore"&&x.roadmapDecl){let v=FI(e.roadmapDecl),R=FI(x.roadmapDecl);v!==R&&f("NL.E0207",{path:u,...v?{parentStart:v}:{},...R?{childStart:R}:{}})}}i.waves&&G2(i,i.waves);for(let c of s){let{diagnostics:u,failed:f}=OI(e,i,c);n.diagnostics.push(...u),f&&n.failedWaves.add(c.childAbs)}n.resolving.pop();let l={config:r,content:i};return n.processed.set(t,l),l}function P2(e,t,n,...r){return{severity:"error",message:ht("en-US",n,...r),sourcePath:e,...Hn(t,"path"),code:n,args:r}}async function O2(e,t,n){let r=n.policy;if(r?.kind!=="rooted")return{absPath:kl(vd(e),t)};if(My(t))return{refused:{reason:"absolute",path:t}};let i=kl(vd(e),t);if(!Fy(r.root,i))return{refused:{reason:"parent",path:t}};let o;try{o=await n.realPath(i)}catch(s){return{unreadable:UI(t,s)}}return Fy(r.root,o)?{absPath:o}:{refused:{reason:"symlink",path:t}}}function UI(e,t){switch(t?.code){case"ENOENT":case"ENOTDIR":return{reason:"not-found",path:e};case"EISDIR":return{reason:"is-directory",path:e};case"EACCES":case"EPERM":return{reason:"permission-denied",path:e}}let n=t instanceof Error?t.message:void 0;return{reason:"unreadable",path:e,...n?{detail:n}:{}}}function C2(e,t){let n=e.$document;if(!n)return[];let r=[];for(let i of Ni(n)){if(i.origin==="validation")continue;let o=i.origin==="lexer"?i.error.line:i.error.token?.startLine;r.push({severity:"error",message:i.error.message,sourcePath:t,...o!==void 0&&Number.isFinite(o)?{line:o-1}:{},syntax:i})}return r}function BI(e,t){let n=e.options.find(r=>r.key===t);if(n&&(n.value==="merge"||n.value==="ignore"||n.value==="isolate"))return n.value}async function $2(e,t,n){let r=Ce.file(n),o=e.shared.workspace.LangiumDocumentFactory.fromString(t,r);return await e.shared.workspace.DocumentBuilder.build([o],{validation:!1}),o.parseResult.value}function D2(e,t,n,r,i){if(n==="ignore"||n==="isolate")return;let o=(s,a)=>i.push({severity:"warning",message:`${a} "${s}" from ${Al(r)} is shadowed by the parent's definition.`,sourcePath:r});zy(e.styles,t.styles,s=>o(s,"Style")),zy(e.defaults,t.defaults,s=>o(s,"Default")),zy(e.symbols,t.symbols,s=>o(s,"Symbol")),F2(e.calendarDeclarations,t.calendarDeclarations,s=>o(s.name,B2(s))),t.scale&&!e.scale&&(e.scale=t.scale),t.calendar&&!e.calendar&&(e.calendar=t.calendar)}function M2(e,t,n,r,i,o,s){if(r==="ignore")return;if(r==="isolate"){t.roadmap&&e.isolatedRegions.push({sourcePath:o,config:n,content:t});return}let a=(l,c)=>s.push({severity:"warning",message:`${c} "${l}" from ${Al(i)} is shadowed by the parent's definition.`,sourcePath:i});zn(e.persons,t.persons,l=>a(l,"Person")),zn(e.teams,t.teams,l=>a(l,"Team")),zn(e.anchors,t.anchors,l=>a(l,"Anchor")),zn(e.labels,t.labels,l=>a(l,"Label")),zn(e.sizes,t.sizes,l=>a(l,"Size")),zn(e.statuses,t.statuses,l=>a(l,"Status")),zn(e.swimlanes,t.swimlanes,l=>a(l,"Swimlane")),zn(e.milestones,t.milestones,l=>a(l,"Milestone")),zn(e.footnotes,t.footnotes,l=>a(l,"Footnote")),t.roadmap&&!e.roadmap&&(e.roadmap=t.roadmap)}function zy(e,t,n){for(let[r,i]of t){if(e.has(r)){e.get(r)!==i&&n(r);continue}e.set(r,i)}}function F2(e,t,n){let r=new Set(e),i=new Set(e.filter(o=>o.name).map(WI));for(let o of t)if(!r.has(o)){if(o.name&&i.has(WI(o))){n(o);continue}e.push(o),r.add(o)}}function WI(e){return`${e.$type}:${e.name}`}function B2(e){return Nr(e)?"Non-working":"Working"}function zn(e,t,n){let r=new Set(e.values());for(let[i,o]of t)if(!r.has(o)){if(!o.name&&o.title){e.set(Vy(e,GI(o.title)),o);continue}if(e.has(i)){n(i);continue}e.set(i,o)}}function W2(e,t){for(let n of t.configEntries)X2(e,n)}function X2(e,t){IA(t)?e.scale||(e.scale=t):ja(t)?e.calendar||(e.calendar=t):Wt(t)?t.name&&!e.styles.has(t.name)&&e.styles.set(t.name,t):Ei(t)?t.name&&!e.symbols.has(t.name)&&e.symbols.set(t.name,t):nt(t)?e.defaults.has(t.entityType)||e.defaults.set(t.entityType,t):(Nr(t)||Za(t))&&e.calendarDeclarations.push(t)}function U2(e){let t={swimlanes:new Set,persons:new Set,teams:new Set,anchors:new Set,labels:new Set,sizes:new Set,statuses:new Set,milestones:new Set,footnotes:new Set};for(let n of e){let r=n.name;if(r){if(Ke(n))t.swimlanes.add(r);else if(Ka(n))t.persons.add(r);else if(tn(n))t.teams.add(r);else if(ss(n))t.anchors.add(r);else if(Va(n))t.labels.add(r);else if(xi(n))t.sizes.add(r);else if(qa(n))t.statuses.add(r);else if(xn(n))t.milestones.add(r);else if(Pg(n))t.footnotes.add(r);else if(vt(n))for(let i of Object.values(t))i.add(r)}}return t}function G2(e,t){let n=[e.persons,e.teams,e.anchors,e.labels,e.sizes,e.statuses,e.swimlanes,e.milestones,e.footnotes],r=(i,o)=>t.has(i)&&!o.name&&!!o.title;for(let i of n){let o=[...i];if(!o.some(([a,l])=>r(a,l)))continue;let s=new Set([...i.keys(),...t.keys()]);i.clear();for(let[a,l]of o){let c=r(a,l)?Vy(i,a,s):a;s.add(c),i.set(c,l)}}}function H2(e,t){t.roadmapDecl&&!e.roadmap&&(e.roadmap=t.roadmapDecl);let n=U2(t.roadmapEntries);for(let r of t.roadmapEntries)z2(e,r,n)}function GI(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"entity"}function Vy(e,t,n){let r=o=>e.has(o)||(n?.has(o)??!1);if(!r(t))return t;let i=2;for(;r(`${t}-${i}`);)i++;return`${t}-${i}`}function jn(e,t,n){t.name?e.has(t.name)||e.set(t.name,t):t.title&&e.set(Vy(e,GI(t.title),n),t)}function z2(e,t,n){Ke(t)?jn(e.swimlanes,t,n.swimlanes):Ka(t)?jn(e.persons,t,n.persons):tn(t)?jn(e.teams,t,n.teams):ss(t)?jn(e.anchors,t,n.anchors):Va(t)?jn(e.labels,t,n.labels):xi(t)?jn(e.sizes,t,n.sizes):qa(t)?jn(e.statuses,t,n.statuses):xn(t)?jn(e.milestones,t,n.milestones):Pg(t)&&jn(e.footnotes,t,n.footnotes)}function Nl(e){let t=e?.roadmapDecl?.properties.find(r=>ee(r)==="start");if(!t)return{kind:"missing"};let n=t.value;return!n||!He(n)?{kind:"invalid"}:{kind:"valid",iso:n,date:new Date(n)}}function Z(e,t,n,r,...i){e(t,ht("en-US",r,...i),{...n,data:{code:r,args:i}})}function Nd(e,t){let n={node:t.node,...t.property===void 0?{}:{property:t.property}};if("message"in t){e(t.severity,t.message,n);return}Z(e,t.severity,n,t.code,t.args)}function Ci(e){let t=e.$cstNode;return t?`line ${t.range.start.line+1}`:"unknown location"}function Ld(e){return/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e)}var Ky="v1",Pd=new Set(Yf),HI=new Set(wi),qy=new Set(Qa),Ll=new Set(WA),zI=new Set($A),jI=new Set(XA),Pl=Object.fromEntries(Object.entries(DA).map(([e,t])=>[e,new Set(t)])),YI=new Set(MA),VI=new Set(FA),Od=new Set(UA),Zy=new Set(GA),Jy=new Set(HA),KI={item:new Set(["size","duration","after","before","remaining","link","description","owner"]),milestone:new Set(["date","after","link","description"]),anchor:new Set(["date","link","description"]),footnote:new Set(["on","link","description"]),label:new Set(["link","description"]),swimlane:new Set(["capacity"]),roadmap:new Set,parallel:new Set,group:new Set},Qy=new Set(zA),qI=Object.fromEntries(Object.entries(jA).map(([e,t])=>[e,new Set(t)])),j2=[{keys:new Set(["progress","percent","percentage","pct","complete","completion"]),requires:"remaining",suggest:"status: + remaining:"},{keys:new Set(["date","start"]),requires:"after",entities:new Set(["ItemDeclaration","ParallelBlock","GroupBlock"]),suggest:"after:<date>"}];function ZI(e,t,n){let r=e.toLowerCase();for(let i of j2)if(!(!i.keys.has(r)||!t.has(i.requires))&&!(i.entities&&(n===void 0||!i.entities.has(n))))return i.suggest}var $i=/^\d+(?:\.\d+)?[dwmqy]$/,JI=/^\d+%$/,QI=/^#[0-9a-fA-F]{3,8}$/,eR=/^v\d+$/,ex=/^\d+$/,tR=/^[dwmqy]$/,tx=/^\d+(\.\d+)?$/,Ol=/^\d+(\.\d+)?%$/,Cd=/^\d+\.\d+$/,nR=/^\d+$/,rR=/^[\x20-\x7E]{1,3}$/,iR=/^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-\d{3})?$/,oR=new Set(BA),nx=new Set(YA);function aR(e,t){let n=e.configEntries.filter(ja),i=e.roadmapDecl?.properties.find(o=>ee(o)==="calendar")?.value;if(n.length>0&&i!=="custom")for(let o of n)t("error",'A "calendar" config block is only valid when the roadmap declares calendar:custom.',{node:o});if(i==="custom"&&n.length===0&&t("error",'calendar:custom requires a "calendar" config block with days-per-week, days-per-month, days-per-quarter, and days-per-year.',{node:e.roadmapDecl,property:"properties"}),i==="custom"&&n.length>0)for(let o of n){let s=new Set(o.properties.map(a=>ee(a)));for(let a of Od)s.has(a)||t("error",`calendar:custom requires "${a}" in the calendar config block.`,{node:o})}}function lR(e,t){let n=new Set;for(let r of e.properties){let i=ee(r);if(!Od.has(i)){t("error",`Unknown calendar property "${i}". Allowed: ${[...Od].join(", ")}.`,{node:r,property:"key"});continue}n.has(i)&&t("error",`Duplicate calendar property "${i}".`,{node:r,property:"key"}),n.add(i),(!ex.test(r.value)||parseInt(r.value,10)<=0)&&t("error",`"${i}" must be a positive integer, got "${r.value}".`,{node:r,property:"value"})}}function cR(e,t){let n=new Set;for(let r of e.properties){let i=ee(r);if(!Zy.has(i)){t("error",`Unknown scale property "${i}". Allowed: ${[...Zy].join(", ")}.`,{node:r,property:"key"});continue}n.has(i)&&t("error",`Duplicate scale property "${i}".`,{node:r,property:"key"}),n.add(i),i==="label-every"&&(!ex.test(r.value)||parseInt(r.value,10)<=0)&&t("error",`"label-every" must be a positive integer, got "${r.value}".`,{node:r,property:"value"})}}function uR(e,t){let n=Fr(e),r=Ja(e),{own:i}=r;for(let c of e.properties)Mg.has(ee(c))||Z(t,"error",{node:c,property:"key"},"NL.E0901",{kind:n,key:ee(c)});r.shape==="malformed"&&Z(t,"error",{node:e},"NL.E0900",{kind:n});let o=i.get("date");o&&o.values.length>0&&o.values.forEach((c,u)=>{He(c)||Z(t,"error",{node:o,property:"values",index:u},"NL.E0405",{key:"date",value:c})});for(let c of["start","end"]){let u=i.get(c);u&&u.values.length>1?Z(t,"error",{node:u},"NL.E0902",{kind:n,key:c}):u&&u.values.length===1&&!He(u.values[0])&&Z(t,"error",{node:u,property:"values",index:0},"NL.E0405",{key:c,value:u.values[0]})}let{start:s,end:a}=r;s&&a&&a<s&&Z(t,"error",{node:i.get("end"),property:"value"},"NL.E0903",{start:s,end:a});let l=i.get("every");if(l){let c=new Set;(l.value!==void 0?[l.value]:l.values).forEach((f,d)=>{let p=l.values.length>0?{node:l,property:"values",index:d}:{node:l,property:"value"};Dg(f)?c.has(f)&&Z(t,"error",p,"NL.E0905",{value:f}):Z(t,"error",p,"NL.E0904",{value:f}),c.add(f)})}}function fR(e,t){let n=e.roadmapDecl;if(!n)return;let r=e.configEntries.filter(pR),i=r.map(y=>({decl:y,facts:Ja(y)})).filter(({facts:y})=>y.wellFormed),o=y=>y.weekdays??[],s=i.filter(({facts:y})=>y.shape==="open-recurrence"),a=n.properties.find(y=>ee(y)==="calendar"),l=e.configEntries.find(ja),c=a?.value==="custom"&&l!==void 0,u=a?.value==="full",f=c?l.properties.find(y=>ee(y)==="days-per-week"):void 0,d=parseInt(f?.value??"",10),p=c?Number.isFinite(d)&&d>0?d:sR:u?7:sR,m=zf(r),g=new Set(!c&&!u&&!m?[0,6]:[]);for(let{decl:y,facts:w}of s)if(Nr(y))for(let _ of o(w))g.add(_);for(let{decl:y,facts:w}of s)if(Za(y))for(let _ of o(w))g.delete(_);if(g.size===7)for(let{decl:y}of s)Nr(y)&&Z(t,"error",{node:y},"NL.E0906");for(let{decl:y,facts:w}of i){if(!Nr(y)||w.shape!=="half-bounded-recurrence")continue;new Set([...g,...o(w)]).size===7&&Z(t,"error",{node:y},"NL.E0906")}let E=7-g.size;if(E===0||E===p)return;let x=c?f?{node:f,property:"value"}:{node:l}:a?{node:a}:s.length>0?{node:s[0].decl}:{node:n};Z(t,"warning",x,"NL.W0705",{daysPerWeek:p,working:E})}function dR(e,t){let n=new Map;for(let r of e.configEntries){if(!pR(r)||!r.name)continue;let i=`${r.$type}:${r.name}`;n.has(i)?Z(t,"error",{node:r,property:"name"},"NL.E0907",{kind:Fr(r),name:r.name}):n.set(i,r)}}var sR=5;function pR(e){return Nr(e)||Za(e)}function mR(e,t){e.properties.find(r=>ee(r)==="date")||Z(t,"error",{node:e},"NL.E0500",{name:Re(e)})}function gR(e,t){let n=e.properties.find(s=>ee(s)==="date");if(!n?.value)return;let r=n.value;if(!He(r))return;let i=new Date(r),o=Nl(e.$container);switch(o.kind){case"invalid":return;case"missing":Z(t,"error",{node:n,property:"value"},"NL.E0501",{name:Re(e)});return;case"valid":i<o.date&&Z(t,"error",{node:n,property:"value"},"NL.E0502",{name:Re(e),date:r,start:o.iso});return}}function yR(e,t){let n=e.properties.some(i=>ee(i)==="date"),r=e.properties.some(i=>ee(i)==="after");!n&&!r&&Z(t,"error",{node:e},"NL.E0503",{name:Re(e)})}function xR(e,t){let n=e.properties.find(s=>ee(s)==="date");if(!n?.value)return;let r=n.value;if(!He(r))return;let i=new Date(r),o=Nl(e.$container);switch(o.kind){case"invalid":return;case"missing":t("error",`Milestone "${Re(e)}" has a date but the roadmap is missing "start:". Add start:YYYY-MM-DD to the roadmap.`,{node:n,property:"value"});return;case"valid":i<o.date&&Z(t,"error",{node:n,property:"value"},"NL.E0504",{name:Re(e),date:r,start:o.iso});return}}function ER(e,t){e.properties.some(r=>ee(r)==="on")||Z(t,"error",{node:e},"NL.E0505")}function wR(e,t){for(let n of e.properties)ee(n)==="footnote"&&t("error",`Property "footnote:" is not valid on ${Il(e)}. Footnotes attach via "on:" on the footnote declaration \u2014 declare \`footnote <id> on:<target-id>\` instead.`,{node:n})}function TR(e,t){let n=e.properties.some(i=>ee(i)==="duration"),r=e.properties.some(i=>ee(i)==="size");!n&&!r&&Z(t,"error",{node:e},"NL.E0600",{name:Re(e)})}function vR(e,t){for(let n of e.properties){let r=ee(n);(r==="size"||r==="duration"||r==="remaining"||r==="capacity")&&t("error",`"${r}" is not valid on ${e.$type==="ParallelBlock"?"parallel":"group"} (computed from children).`,{node:n})}}function _R(e,t){let n=e.content.filter(r=>!Ya(r));n.length===0?t("error","Parallel block must contain at least 2 children.",{node:e}):n.length===1&&t("warning","Parallel block has only 1 child. Use at least 2 for parallel execution.",{node:e})}function AR(e,t){e.content.filter(r=>!Ya(r)).length===0&&t("error","Group must contain at least 1 child.",{node:e})}function kR(e,t){e.properties.find(r=>ee(r)==="effort")||t("error",`Size "${Re(e)}" requires an "effort:" property.`,{node:e}),e.name&&($i.test(e.name)||tR.test(e.name))&&t("error",`Size id "${e.name}" collides with the raw duration pattern. Choose a different name (e.g. "xs", "small", "quarter").`,{node:e,property:"name"})}function IR(e,t){e.name&&Pd.has(e.name)&&t("error",`Status id "${e.name}" collides with the built-in status value. Built-ins: ${Yf.join(", ")}.`,{node:e,property:"name"})}function RR(e,t){let n=new Map;for(let r of e.roadmapEntries)if(xi(r)&&r.name){let i=n.get(r.name);i?t("error",`Duplicate size id "${r.name}". First declared at ${Ci(i)}.`,{node:r,property:"name"}):n.set(r.name,r)}}function SR(e,t){if(nt(e)&&e.entityType!=="swimlane")return;let n=e.properties.find(s=>ee(s)==="utilization-warn-at"),r=e.properties.find(s=>ee(s)==="utilization-over-at");if(!n||!r)return;let i=hR(n.value),o=hR(r.value);i===null||o===null||i>o&&t("error",`utilization-warn-at (${n.value}) must be \u2264 utilization-over-at (${r.value}). Warn fires below over; if both fire at the same point, the warn band collapses to zero.`,{node:n,property:"value"})}function bR(e,t){let n=new Map,r=o=>!!o.title||o.properties.length>0||o.description!==void 0,i=o=>{if(!o.name)return;let s=r(o);n.has(o.name)||n.set(o.name,[]),n.get(o.name).push({node:o,isDeclaration:s}),!s&&o.$container.$type==="NowlineFile"&&t("warning",`Bare "person ${o.name}" at roadmap top level has no declaration. Either add properties (title, link, etc.) or remove the line.`,{node:o})};for(let o of Mn(e))Ka(o)&&i(o);for(let[o,s]of n){let a=s.filter(l=>l.isDeclaration);if(a.length>1)for(let l=1;l<a.length;l++)t("error",`Person "${o}" is declared more than once. First declaration at ${Ci(a[0].node)}.`,{node:a[l].node})}}function hR(e){if(!e||e===el)return null;if(Ol.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?t/100:null}if(Cd.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?t:null}return null}function Di(e){return/^(https?:\/\/|mailto:)[^\s]/i.test(e)}function NR(e,t){if(Li(e))return;let n=ee(e),r=e.value,i=e.values,o=r?[r]:i;switch(n){case"status":break;case"duration":r&&!$i.test(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0400",{value:r});break;case"size":r&&!Ld(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0401",{value:r});break;case"effort":r&&!$i.test(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0402",{value:r});break;case"remaining":{if(r)if(JI.test(r)){let s=parseFloat(r);(s<0||s>100)&&Z(t,"error",{node:e,property:"value"},"NL.E0404",{value:r})}else $i.test(r)||Z(t,"error",{node:e,property:"value"},"NL.E0403",{value:r});break}case"date":case"start":case"end":r&&!He(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0405",{key:n,value:r});break;case"scale":r&&!$i.test(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0406",{value:r});break;case"link":r&&!Di(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0414",{value:r});break;case"calendar":r&&!VI.has(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0407",{value:r});break;case"on":case"after":case"before":o.length===0&&Z(t,"error",{node:e},"NL.E0408",{key:n});break;case"capacity":{if(!r)break;let s=e.$container,a=K2(s);if(a==="invalid")break;a==="lane"?(!tx.test(r)||parseFloat(r)<=0)&&t("error",`Invalid swimlane capacity "${r}". Use a positive integer (e.g. capacity:5) or decimal (e.g. capacity:1.5). Percent literals are not allowed on swimlanes.`,{node:e,property:"value"}):Ol.test(r)?parseFloat(r)<=0&&t("error",`Item capacity "${r}" must be positive.`,{node:e,property:"value"}):tx.test(r)?parseFloat(r)<=0&&t("error",`Item capacity "${r}" must be positive.`,{node:e,property:"value"}):t("error",`Invalid item capacity "${r}". Use a positive integer (capacity:2), decimal (capacity:0.5), or percent literal (capacity:50%).`,{node:e,property:"value"});break}case"overcapacity":{t("error",'"overcapacity:" was removed. Use "utilization-over-at:none" (and/or "utilization-warn-at:none") to suppress the lane utilization underline.',{node:e});break}case"utilization-warn-at":case"utilization-over-at":{if(!r)break;if(!q2(e.$container)){t("error",`"${n}:" is only valid on "swimlane" or "default swimlane".`,{node:e});break}if(r===el)break;if(Ol.test(r)){parseFloat(r)<=0&&t("error",`${n} value "${r}" must be positive.`,{node:e,property:"value"});break}if(Cd.test(r)){parseFloat(r)<=0&&t("error",`${n} value "${r}" must be positive.`,{node:e,property:"value"});break}if(nR.test(r)){t("error",`Ambiguous ${n} value "${r}". Use the percent form ("${r}%") or the decimal-fraction form ("0.${r}") to make the intent explicit.`,{node:e,property:"value"});break}t("error",`Invalid ${n} value "${r}". Use a positive percent (e.g. 80%), a positive decimal fraction (e.g. 0.8), or "none" to opt out.`,{node:e,property:"value"});break}case"capacity-icon":break;case"icon":break;case"non-working":nt(e.$container)&&$R(r,e,t);break;default:if(Ll.has(n)){if(n==="bg"||n==="fg"||n==="text")r&&!CR(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0801",{value:r,key:n});else if(n in Pl){let s=Pl[n];r&&!s.has(r)&&Z(t,"error",{node:e,property:"value"},"NL.E0802",{value:r,key:n,allowed:[...s].join(", ")})}}break}}function LR(e,t){for(let n of e.properties){let r=ee(n);Ll.has(r)&&Z(t,"error",{node:n},"NL.E0804",{key:r,entity:Il(e)})}}function PR(e,t){let n=qI[e.$type];if(!n)return;let r=e.$type==="ParallelBlock"||e.$type==="GroupBlock"?new Set(["size","duration","remaining","capacity"]):null;for(let i of e.properties){let o=ee(i);if(n.has(o)||Qy.has(o)||Ll.has(o)||o==="footnote"||r?.has(o)||o==="wave"||Li(i))continue;let s=[...n,...Qy],a=ZI(o,n,e.$type)??wI(o,s)??"";Z(t,"warning",{node:i,property:"key"},"NL.W0700",{key:o,entity:Il(e),suggested:a})}}function OR(e,t){let n=ee(e),r=e.value;if(n==="bg"||n==="fg"||n==="text")CR(r)||Z(t,"error",{node:e,property:"value"},"NL.E0801",{value:r,key:n});else if(n==="non-working")$R(r,e,t);else if(n in Pl){let i=Pl[n];i.has(r)||Z(t,"error",{node:e,property:"value"},"NL.E0802",{value:r,key:n,allowed:[...i].join(", ")})}else Ll.has(n)||Z(t,"error",{node:e,property:"key"},"NL.E0803",{key:n})}function CR(e){return YI.has(e)||QI.test(e)}function $R(e,t,n){e===void 0||zI.has(e)||Z(n,"error",{node:t,property:"value"},"NL.E0800",{value:e})}function K2(e){return e?Ke(e)?"lane":Ve(e)?"item":nt(e)?e.entityType==="swimlane"?"lane":"item":"invalid":"invalid"}function q2(e){return e?!!(Ke(e)||nt(e)&&e.entityType==="swimlane"):!1}function DR(e,t){let n=new Map,r=new Map;for(let i=0;i<e.roadmapEntries.length;i++){let o=e.roadmapEntries[i];xi(o)&&o.name?n.has(o.name)||n.set(o.name,i):qa(o)&&o.name&&(r.has(o.name)||r.set(o.name,i))}for(let i=0;i<e.roadmapEntries.length;i++){let o=e.roadmapEntries[i];Gf(o,s=>{if(Li(s))return;let a=ee(s);if(a==="size"&&s.value){let l=s.value,c=n.get(l);c===void 0?t("error",`Size "${l}" is not declared. Add "size ${l} effort:<literal>" earlier in the roadmap section.`,{node:s,property:"value"}):c>=i&&t("error",`Size "${l}" is referenced before its declaration. Move "size ${l}" above this entity.`,{node:s,property:"value"})}else if(a==="status"&&s.value){let l=s.value;if(Pd.has(l))return;let c=r.get(l);c===void 0?t("error",`Status "${l}" is not a built-in and has no declaration. Add "status ${l}" earlier in the roadmap section.`,{node:s,property:"value"}):c>=i&&t("error",`Status "${l}" is referenced before its declaration. Move "status ${l}" above this entity.`,{node:s,property:"value"})}})}}function MR(e,t){for(let{prop:n,key:r,value:i}of bd(e))Z(t,"error",{node:n},"NL.E0302",{key:r,value:i})}function FR(e,t){let n=Nl(e),r=i=>{let o=i.properties??[],s=vt(i),a=Ve(i)||et(i)||$e(i)||s;for(let l of o){let c=ee(l);if(c!=="after"&&c!=="before"||s&&c==="before")continue;let f=(l.value?[l.value]:l.values).filter(d=>!!d&&ot.test(d));if(f.length!==0){if(!a){Z(t,"error",{node:l},"NL.E0411",{key:c,type:Fr(i)});continue}f.length>1&&Z(t,"error",{node:l},"NL.E0410",{key:c});for(let d of f){if(!He(d)){Z(t,"error",l.value!==void 0?{node:l,property:"value"}:{node:l,property:"values",index:l.values.indexOf(d)},"NL.E0405",{key:c,value:d});continue}switch(n.kind){case"invalid":continue;case"missing":Z(t,"error",{node:l},"NL.E0412",{key:c,date:d});continue;case"valid":{let p=Te(d);p&&p<n.date&&Z(t,"error",{node:l},"NL.E0413",{key:c,date:d,start:n.iso})}}}}}};for(let i of Mn(e))WR(i)||r(i)}function BR(e,t){let n=new Map,r=(d,p)=>{n.has(d)||n.set(d,new Set),n.get(d).add(p)},i=(d,p,m)=>{if(d)for(let g of p){let E=ee(g);if(E==="after"){let x=g.value?[g.value]:g.values;for(let y of x)y&&(ot.test(y)||r(d,y))}else if(E==="before"){let x=g.value?[g.value]:g.values;for(let y of x)y&&(ot.test(y)||r(y,d))}}},o=d=>{if(vt(d))return;let p=d.name,m=d.properties??[];i(p,m,e)};for(let d of Mn(e))WR(d)||o(d);let s=0,a=1,l=2,c=new Map;for(let d of n.keys())c.set(d,s);let u=new Set,f=(d,p)=>{c.set(d,a),p.push(d);for(let m of n.get(d)??[]){let g=c.get(m)??s;if(g===a){let E=p.indexOf(m),x=p.slice(E).concat(m),y=[...x].sort().join("\u2192");u.has(y)||(u.add(y),t("error",`Circular dependency detected: ${x.join(" \u2192 ")}.`,{node:e.roadmapDecl??e}))}else g===s&&f(m,p)}p.pop(),c.set(d,l)};for(let d of n.keys())(c.get(d)??s)===s&&f(d,[])}function WR(e){return tn(e)&&tn(e.$container)}function XR(e,t){let n=e.hasConfig?Rc.findNodeForKeyword(e.$cstNode,"config")?.offset:void 0,r=e.roadmapDecl?.$cstNode?.offset;n!==void 0&&r!==void 0&&n>r&&Z(t,"error",{node:e,property:"hasConfig"},"NL.E0001");for(let i of e.includes){let o=i.$cstNode?.offset??0;n!==void 0&&o>n&&Z(t,"error",{node:i},"NL.E0002"),r!==void 0&&o>r&&Z(t,"error",{node:i},"NL.E0003")}}function UR(e,t){if(!eR.test(e.version)){Z(t,"error",{node:e,property:"version"},"NL.E0100",{version:e.version});return}let n=parseInt(e.version.slice(1),10),r=parseInt(Ky.slice(1),10);n>r&&Z(t,"error",{node:e,property:"version"},"NL.E0101",{version:e.version,supported:Ky})}function GR(e,t){let n=new Set;for(let r of e.properties){let i=ee(r);if(!nx.has(i)){Z(t,"error",{node:r,property:"key"},"NL.E0102",{key:i,allowed:[...nx].join(", ")});continue}if(n.has(i)&&Z(t,"error",{node:r,property:"key"},"NL.E0103",{key:i}),n.add(i),i==="locale"){let o=r.value;iR.test(o)||Z(t,"error",{node:r,property:"value"},"NL.E0104",{value:o})}}}function HR(e,t){!e.name&&!e.title&&Z(t,"error",{node:e},"NL.E0301",{type:e.$type})}function zR(e,t){let n=new Map,r=(i,o)=>{if(!i)return;let s=n.get(i);s?Z(t,"error",{node:o},"NL.E0300",{name:i,location:Ci(s)}):n.set(i,o)};e.roadmapDecl?.name&&r(e.roadmapDecl.name,e.roadmapDecl);for(let i of e.roadmapEntries)Hf(i,r);for(let i of e.configEntries)Wt(i)&&i.name&&r(i.name,i)}function jR(e,t){let n=e.$document?.textDocument.getText()??e.$cstNode?.text;if(!n)return;let r=n.split(/\r?\n/);for(let i=0;i<r.length;i++){let o=r[i];if(o.length===0)continue;let s=o.match(/^([\t ]+)/);if(!s)continue;let a=s[1];if(a.includes(" ")&&a.includes(" ")){Z(t,"error",{node:e},"NL.E0005",{line:i+1});return}}}function YR(e,t){if(Uy(e))return;let n=e.roadmapEntries.some(Ke);e.roadmapDecl&&!n&&Z(t,"error",{node:e.roadmapDecl},"NL.E0004")}function VR(e,t){oR.has(e.value)||Z(t,"error",{node:e,property:"value"},"NL.E0200",{value:e.value})}function KR(e,t){let n=new Set;for(let r of e.options){let i=ee(r);n.has(i)&&Z(t,"error",{node:r},"NL.E0201",{key:i}),n.add(i)}}function qR(e,t){if(!Jy.has(e.entityType)){t("error",`"${e.entityType}" is not a supported entity type for default. Allowed: ${[...Jy].join(", ")}.`,{node:e,property:"entityType"});return}let n=e.$container,r=-1;for(let o=0;o<n.configEntries.length;o++){let s=n.configEntries[o];if(nt(s)&&s.entityType===e.entityType){if(r<0)r=o;else if(s===e){t("error",`Duplicate "default ${e.entityType}" declaration. Only one is allowed per entity type per file.`,{node:e});break}}}let i=KI[e.entityType];if(i)for(let o of e.properties){let s=ee(o);i.has(s)&&t("error",_d(s,e.entityType),{node:o})}if(e.entityType!=="roadmap")for(let o of e.properties){let s=ee(o);jI.has(s)&&Z(t,"warning",{node:o,property:"key"},"NL.W0703",{key:s,entityType:e.entityType})}}function ZR(e,t){let n=e.roadmapDecl;if(!n)return;let r=new Map,i=new Map;for(let c of e.configEntries)Wt(c)&&c.name&&!r.has(c.name)?r.set(c.name,c):nt(c)&&c.entityType==="roadmap"&&(i.has("roadmap")||i.set("roadmap",c));let o=new Map;for(let c of e.roadmapEntries)Va(c)&&c.name&&!o.has(c.name)&&o.set(c.name,c);let s,a,l=c=>{for(let u of c){let f=ee(u);f==="header-height"?s=u:f==="timeline-position"&&(a=u)}};for(let c of jf("roadmap",n.properties,{styles:r,defaults:i,labels:o}))switch(c.level){case"inline":break;case"default":l(c.props);break;case"label":return;default:if(!c.decl)return;l(c.decl.properties)}s?.value==="none"&&(a?.value!=="bottom"&&a?.value!=="both"||Z(t,"warning",{node:a,property:"value"},"NL.W0704",{position:a.value}))}function JR(e,t){e.name&&qy.has(e.name)&&Z(t,"error",{node:e,property:"name"},"NL.E0805",{name:e.name,builtins:[...Qa].sort().join(", ")});let n=e.properties.find(i=>ee(i)==="unicode");n?(!n.value||n.value.length===0)&&Z(t,"error",{node:n,property:"value"},"NL.E0807",{name:Re(e)}):Z(t,"error",{node:e},"NL.E0806",{name:Re(e)});let r=e.properties.find(i=>ee(i)==="ascii");if(r){let i=r.value??"";rR.test(i)||Z(t,"error",{node:r,property:"value"},"NL.E0808",{name:Re(e),length:i.length})}for(let i of e.properties){let o=ee(i);o!=="unicode"&&o!=="ascii"&&o!=="link"&&o!=="description"&&Z(t,"error",{node:i,property:"key"},"NL.E0809",{key:o})}}function QR(e,t){let n=new Map;for(let r of e.configEntries)if(Ei(r)&&r.name){let i=n.get(r.name);i?Z(t,"error",{node:r,property:"name"},"NL.E0810",{name:r.name,location:Ci(i)}):n.set(r.name,r)}}function eS(e,t){let n=new Map;for(let i=0;i<e.configEntries.length;i++){let o=e.configEntries[i];Ei(o)&&o.name&&(n.has(o.name)||n.set(o.name,i))}let r=(i,o,s,a)=>{if(o!=="icon"&&o!=="capacity-icon"||!s||!Ld(s)||o==="capacity-icon"&&HI.has(s)||o==="icon"&&qy.has(s))return;let l=n.get(s);if(l===void 0){let c=o==="capacity-icon"?[...wi].sort().join(", "):[...Qa].sort().join(", ");Z(t,"error",{node:a,property:"value"},"NL.E0811",{key:o,value:s,builtins:c})}else l>=i&&Z(t,"error",{node:a,property:"value"},"NL.E0812",{key:o,value:s})};for(let i=0;i<e.configEntries.length;i++){let o=e.configEntries[i];if(Wt(o))for(let s of o.properties)r(i,ee(s),s.value,s);else if(nt(o))for(let s of o.properties)r(i,ee(s),s.value,s)}}function tS(e){let t=e.validation.ValidationRegistry,n=e.validation.NowlineValidator,r={NowlineFile:[n.checkFileStructure,n.checkUniqueIdentifiers,n.checkSwimlaneRequired,n.checkIndentationConsistency,n.checkRoadmapOnlyKeywordsPosition,n.checkForwardReferences,n.checkReferenceResolution,n.checkInlineDatePins,n.checkCircularDependencies,n.checkWaves,n.checkDuplicateSizeIds,n.checkCalendarBlockConsistency,n.checkHiddenTimelineStrip,n.checkPersonDeclarations,n.checkDuplicateSymbolIds,n.checkSymbolReferences,n.checkCalendarWeek,n.checkDuplicateCalendarDeclarationIds],NowlineDirective:[n.checkDirectiveVersion,n.checkDirectiveProperties],IncludeOption:[n.checkIncludeMode],IncludeDeclaration:[n.checkIncludeDuplicateOptions],EntityProperty:[n.checkPropertyValues],RoadmapDeclaration:[n.checkEntityIdOrTitle,n.checkRoadmapProperties,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],AnchorDeclaration:[n.checkEntityIdOrTitle,n.checkAnchorRequiredDate,n.checkAnchorAgainstStart,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],SwimlaneDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkUtilizationOrdering,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],ItemDeclaration:[n.checkEntityIdOrTitle,n.checkItemRequiredDuration,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],ParallelBlock:[n.checkParallelMinChildren,n.checkNoComputedProperties,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],GroupBlock:[n.checkGroupMinChildren,n.checkNoComputedProperties,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],MilestoneDeclaration:[n.checkEntityIdOrTitle,n.checkMilestoneRequirement,n.checkMilestoneAgainstStart,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],FootnoteDeclaration:[n.checkEntityIdOrTitle,n.checkFootnoteOn,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],PersonDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],TeamDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],StyleDeclaration:[n.checkEntityIdOrTitle],StyleProperty:[n.checkStylePropertyEnum],SymbolDeclaration:[n.checkEntityIdOrTitle,n.checkSymbolDeclaration],NonWorkingDeclaration:[n.checkCalendarDeclaration],WorkingDeclaration:[n.checkCalendarDeclaration],LabelDeclaration:[n.checkEntityIdOrTitle,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],SizeDeclaration:[n.checkEntityIdOrTitle,n.checkSizeDeclaration,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],StatusDeclaration:[n.checkEntityIdOrTitle,n.checkStatusDeclaration,n.checkNoRawStyleProperties,n.checkUnknownEntityProperties],WaveDeclaration:[n.checkNoRawStyleProperties,n.checkNoFootnoteProperty,n.checkUnknownEntityProperties],DefaultDeclaration:[n.checkDefaultDeclaration,n.checkUtilizationOrdering],CalendarBlock:[n.checkCalendarBlock],ScaleBlock:[n.checkScaleBlock]};t.register(r,n)}var $d=class{checkFileStructure(t,n){XR(t,n)}checkRoadmapOnlyKeywordsPosition(t,n){}checkDirectiveVersion(t,n){UR(t,n)}checkDirectiveProperties(t,n){GR(t,n)}checkEntityIdOrTitle(t,n){HR(t,n)}checkUniqueIdentifiers(t,n){zR(t,n)}checkIndentationConsistency(t,n){jR(t,n)}checkSwimlaneRequired(t,n){YR(t,n)}checkIncludeMode(t,n){VR(t,n)}checkIncludeDuplicateOptions(t,n){KR(t,n)}checkPropertyValues(t,n){NR(t,n)}checkAnchorRequiredDate(t,n){mR(t,n)}checkAnchorAgainstStart(t,n){gR(t,n)}checkMilestoneRequirement(t,n){yR(t,n)}checkMilestoneAgainstStart(t,n){xR(t,n)}checkFootnoteOn(t,n){ER(t,n)}checkNoFootnoteProperty(t,n){wR(t,n)}checkItemRequiredDuration(t,n){TR(t,n)}checkNoComputedProperties(t,n){vR(t,n)}checkParallelMinChildren(t,n){_R(t,n)}checkGroupMinChildren(t,n){AR(t,n)}checkNoRawStyleProperties(t,n){LR(t,n)}checkUnknownEntityProperties(t,n){PR(t,n)}checkRoadmapProperties(t,n){}checkStylePropertyEnum(t,n){OR(t,n)}checkSizeDeclaration(t,n){kR(t,n)}checkStatusDeclaration(t,n){IR(t,n)}checkWaves(t,n){for(let o of kd(t))Nd(n,o);for(let o of Id(t))Nd(n,o);let r=on(t);if(r.length===0)return;let i={lanes:t.roadmapEntries.filter(Ke),lookup:As(t)};for(let o of ks(i,r))Nd(n,o)}checkDuplicateSizeIds(t,n){RR(t,n)}checkUtilizationOrdering(t,n){SR(t,n)}checkDefaultDeclaration(t,n){qR(t,n)}checkHiddenTimelineStrip(t,n){ZR(t,n)}checkCalendarBlockConsistency(t,n){aR(t,n)}checkCalendarBlock(t,n){lR(t,n)}checkScaleBlock(t,n){cR(t,n)}checkForwardReferences(t,n){DR(t,n)}checkReferenceResolution(t,n){MR(t,n)}checkInlineDatePins(t,n){FR(t,n)}checkCircularDependencies(t,n){BR(t,n)}checkPersonDeclarations(t,n){bR(t,n)}checkSymbolDeclaration(t,n){JR(t,n)}checkDuplicateSymbolIds(t,n){QR(t,n)}checkCalendarDeclaration(t,n){uR(t,n)}checkCalendarWeek(t,n){fR(t,n)}checkDuplicateCalendarDeclarationIds(t,n){dR(t,n)}checkSymbolReferences(t,n){eS(t,n)}};var rx=class extends Do{runConverter(t,n,r){return t.name==="PROPERTY_KEY_WITH_COLON"||t.name==="INCLUDE_OPTION_KEY"?n.endsWith(":")?n.slice(0,-1):n:super.runConverter(t,n,r)}},ix=class extends Ba{isStartOfLine(t,n){if(!super.isStartOfLine(t,n))return!1;let r=n-1;for(;r>=0&&(t[r]===" "||t[r]===" ");)r--;for(;r>=0&&(t[r]==="\r"||t[r]===`
2917
+ `);)r--;for(;r>=0&&(t[r]===" "||t[r]===" ");)r--;return r<0||t[r]!=="\\"}},nS={parser:{TokenBuilder:()=>new ix({indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[["[","]"]]}),Lexer:e=>new Df(e),ParserConfig:()=>({maxLookahead:4}),ValueConverter:()=>new rx},validation:{NowlineValidator:()=>new $d}};function ox(e={}){let t=e.shared??Ho($f(Mf),Jk),n=Ho(Cf({shared:t}),Qk,nS);return t.ServiceRegistry.register(n),tS(n),{shared:t,Nowline:n}}async function Cl(e,t,n,r={validation:!0}){let{DocumentBuilder:i,LangiumDocumentFactory:o,LangiumDocuments:s}=e.workspace,a=o.fromString(t,n);try{await i.build([a],r)}finally{s.hasDocument(n)||s.addDocument(a),await i.update([],[n])}return a}function sx(e,t){return t.code===void 0?t.message:ht(e,t.code,...t.args??[])}function Mi(e){let{content:t}=e,n=[...t.waves?.values()??[]];if(n.length===0)return;let r=new Map;n.forEach((u,f)=>{r.set(u.name,f+1)});let i=Is(t),o=n.map(u=>Sl(u,i)),s=new WeakMap,a=new WeakMap,l=u=>{let f=Ad(u,r);for(let[d,p]of f.waveOf)s.set(d,p);for(let[d,p]of f.leadOf)a.set(d,p)};l([...t.swimlanes.values()]);for(let u of t.isolatedRegions)l([...u.content.swimlanes.values()]);let c=u=>Ve(u)?s.get(u):void 0;return{waves:n,index:r,floors:o,waveOf:s,leadOf:a,memberWave:c,isMember:(u,f)=>{let d=c(u);return d!==void 0&&(f===void 0||d===f)}}}var $l="en-US",nB={"en-US":{nowLabel:"now",quarterPrefix:"Q",waveHeldBy:"held by",waveNoItems:"no items",waveBackgroundItem:"Background (no wave)",waveLegendBackground:"Background work (not in a wave)"},fr:{nowLabel:"maint.",quarterPrefix:"T",waveHeldBy:"retenue par",waveNoItems:"aucun \xE9l\xE9ment",waveBackgroundItem:"Travail de fond (hors vague)",waveLegendBackground:"Travail de fond (dans aucune vague)"}};function rS(e,t){return t??e??$l}function Yn(e){let t={};for(let n of rB(e)){let r=nB[n];if(r)for(let i of Object.keys(r))t[i]===void 0&&r[i]!==void 0&&(t[i]=r[i])}return t}function rB(e){let t=[],n=iB(e);for(;n.length>0;){t.includes(n)||t.push(n);let r=n.lastIndexOf("-");if(r<=0)break;n=n.slice(0,r)}return t.includes($l)||t.push($l),t}function iB(e){return e.split("-").map((n,r)=>r===0?n.toLowerCase():/^[a-zA-Z]{2}$/.test(n)?n.toUpperCase():n).join("-")}function Dd(e){return e==="hide"||e==="show"}var iS={red:"#f87171",blue:"#60a5fa",yellow:"#facc15",green:"#34d399",orange:"#fb923c",purple:"#a78bfa",gray:"#94a3b8",navy:"#818cf8",white:"#e2e8f0"},Vn={bg:"none",fg:"#e2e8f0",text:"#e2e8f0",border:"solid",icon:"none",shadow:"none",font:"sans",weight:"normal",italic:!1,textSize:"md",padding:"sm",spacing:"sm",headerHeight:"sm",cornerRadius:"sm",bracket:"none",capacityIcon:"multiplier"},ax={name:"dark",surface:{page:"#0b1220",chart:"#111827",headerBox:"#1e293b"},entities:{roadmap:{...Vn,headerHeight:"md",padding:"md"},swimlane:{...Vn,fg:"#e2e8f0",text:"#e2e8f0",padding:"sm",spacing:"none",textSize:"sm"},item:{...Vn,bg:"#0f172a",fg:"#94a3b8",text:"#e2e8f0",shadow:"subtle",cornerRadius:"sm"},parallel:{...Vn,bg:"#8c84ff",bracket:"dashed",padding:"xs"},group:{...Vn,bg:"#f0a832",bracket:"solid",padding:"xs",fg:"#94a3b8"},anchor:{...Vn,bg:"#0b1220",fg:"#cbd5e1",text:"#cbd5e1",cornerRadius:"sm"},milestone:{...Vn,bg:"#e2e8f0",fg:"#e2e8f0",text:"#0b1220",border:"solid"},footnote:{...Vn,bg:"none",fg:"#94a3b8",text:"#e2e8f0",textSize:"sm"},label:{...Vn,bg:"#1e293b",fg:"#94a3b8",text:"#e2e8f0",textSize:"xs",padding:"xs",cornerRadius:"full"}},swimlane:{bandEven:"#111827",bandOdd:"#0f172a",separator:"#1f2937",frameTabText:"#e2e8f0",frameTabMuted:"#94a3b8",border:"#334155",tabFill:"#1e293b",tabStroke:"#475569",tabText:"#e2e8f0",ownerText:"#94a3b8",footnoteIndicator:"#f87171",rowTintEven:"#0f172a",rowTintOdd:"#1e293b",utilizationOk:"#34d399",utilizationWarn:"#fbbf24",utilizationOver:"#f87171"},timeline:{gridLine:"#475569",minorGridLine:"#334155",nonWorkingSeam:"#6b7a90",nonWorkingFill:"#94a3b8",tickMark:"#334155",labelText:"#cbd5e1",panelFill:"#0f172a",border:"#334155"},header:{cardBorder:"#475569",author:"#94a3b8"},item:{overflowX:"#f87171",linkIconFg:"#94a3b8",overflowTailFill:"#7f1d1d",overflowTailStroke:"#f87171",overflowCaption:"#fecaca"},parallel:{bracketStroke:"#cbd5e1"},anchorDiamond:{fill:"#0f172a",stroke:"#cbd5e1",label:"#cbd5e1",cutLine:"#94a3b8"},milestoneDiamond:{fill:"#e2e8f0",label:"#e2e8f0",cutLineNormal:"#a5b4fc",cutLineOverrun:"#ef4444",slack:"#cbd5e1"},footnotePanel:{fill:"#0f172a",border:"#334155",header:"#e2e8f0",title:"#e2e8f0",description:"#94a3b8",number:"#f87171"},nowline:{stroke:"#f87171",labelText:"#0b1220",labelBg:"#f87171"},milestone:{dashedInk:"#a5b4fc",overrun:"#ef4444"},anchor:{predecessorLine:"#94a3b8"},dependency:{edgeStroke:"#cbd5e1",overflowStroke:"#ef5350"},footnote:{indicatorText:"#f87171",descriptionMuted:"#94a3b8"},includeRegion:{border:"#475569",label:"#cbd5e1",badge:"#94a3b8",fill:"#0b1220",tabFill:"#111827",tabStroke:"#475569",tabText:"#e2e8f0",badgeFill:"#1e293b",badgeStroke:"#475569",badgeText:"#94a3b8"},wave:{stripFill:"#042f2e",stripFillAlt:"#134e4a",labelText:"#99f6e4",labelMuted:"#5eead4",boundary:"#2dd4bf",hatch:"#0f172a",hatchOnDark:"#ffffff"},arrowhead:{neutral:"#94a3b8",light:"#64748b",dark:"#e2e8f0"},status:{done:"#34d399",inProgress:"#60a5fa",atRisk:"#facc15",blocked:"#ef4444",planned:"#94a3b8",neutral:"#94a3b8"},statusTint:{done:"#052e16",inProgress:"#172554",atRisk:"#422006",blocked:"#7f1d1d",planned:"#1e293b",neutral:"#1e293b"},statusDot:{onLight:{done:"#065f46",inProgress:"#1e3a8a",atRisk:"#92400e",blocked:"#991b1b",planned:"#334155",neutral:"#334155"},onDark:{done:"#d1fae5",inProgress:"#dbeafe",atRisk:"#fef3c7",blocked:"#fee2e2",planned:"#e2e8f0",neutral:"#e2e8f0"}},attribution:{mark:"#cbd5e1",link:"#f87171"},diagnostic:{overlayBg:"#7f1d1d",errorText:"#fecaca"}};var oS={red:"#4a4a4a",blue:"#6b6b6b",green:"#8a8a8a",yellow:"#c8c8c8",orange:"#5c5c5c",purple:"#3a3a3a",gray:"#9e9e9e",navy:"#2a2a2a",white:"#ffffff"},Kn={bg:"none",fg:"#1a1a1a",text:"#1a1a1a",border:"solid",icon:"none",shadow:"none",font:"sans",weight:"normal",italic:!1,textSize:"md",padding:"sm",spacing:"sm",headerHeight:"sm",cornerRadius:"sm",bracket:"none",capacityIcon:"multiplier"},lx={name:"grayscale",surface:{page:"#f5f5f5",chart:"#ffffff",headerBox:"#ffffff"},entities:{roadmap:{...Kn,headerHeight:"md",padding:"md"},swimlane:{...Kn,fg:"#3a3a3a",text:"#3a3a3a",padding:"sm",spacing:"none",textSize:"sm"},item:{...Kn,bg:"#ffffff",fg:"#9e9e9e",text:"#1a1a1a",shadow:"subtle",cornerRadius:"sm"},parallel:{...Kn,bg:"#9e9e9e",bracket:"dashed",padding:"xs"},group:{...Kn,bg:"#595959",bracket:"solid",padding:"xs",fg:"#595959"},anchor:{...Kn,bg:"#1a1a1a",fg:"#1a1a1a",text:"#1a1a1a",cornerRadius:"sm"},milestone:{...Kn,bg:"#2a2a2a",fg:"#2a2a2a",text:"#ffffff",border:"solid"},footnote:{...Kn,bg:"none",fg:"#595959",text:"#595959",textSize:"sm"},label:{...Kn,bg:"#e8e8e8",fg:"#595959",text:"#595959",textSize:"xs",padding:"xs",cornerRadius:"full"}},swimlane:{bandEven:"#ffffff",bandOdd:"#f5f5f5",separator:"#d4d4d4",frameTabText:"#3a3a3a",frameTabMuted:"#737373",border:"#d4d4d4",tabFill:"#e8e8e8",tabStroke:"#bdbdbd",tabText:"#3a3a3a",ownerText:"#737373",footnoteIndicator:"#4a4a4a",rowTintEven:"#ffffff",rowTintOdd:"#f5f5f5",utilizationOk:"#8a8a8a",utilizationWarn:"#595959",utilizationOver:"#1a1a1a"},timeline:{gridLine:"#bdbdbd",minorGridLine:"#d4d4d4",nonWorkingSeam:"#9a9a9a",nonWorkingFill:"#737373",tickMark:"#bdbdbd",labelText:"#737373",panelFill:"#ffffff",border:"#d4d4d4"},header:{cardBorder:"#d4d4d4",author:"#737373"},item:{overflowX:"#1a1a1a",linkIconFg:"#1a1a1a",overflowTailFill:"#e8e8e8",overflowTailStroke:"#4a4a4a",overflowCaption:"#3a3a3a"},parallel:{bracketStroke:"#3a3a3a"},anchorDiamond:{fill:"#ffffff",stroke:"#3a3a3a",label:"#3a3a3a",cutLine:"#737373"},milestoneDiamond:{fill:"#1a1a1a",label:"#1a1a1a",cutLineNormal:"#2a2a2a",cutLineOverrun:"#4a4a4a",slack:"#1a1a1a"},footnotePanel:{fill:"#ffffff",border:"#d4d4d4",header:"#1a1a1a",title:"#1a1a1a",description:"#737373",number:"#4a4a4a"},nowline:{stroke:"#1a1a1a",labelText:"#ffffff",labelBg:"#1a1a1a"},milestone:{dashedInk:"#9e9e9e",overrun:"#4a4a4a"},anchor:{predecessorLine:"#9e9e9e"},dependency:{edgeStroke:"#595959",overflowStroke:"#1a1a1a"},footnote:{indicatorText:"#4a4a4a",descriptionMuted:"#737373"},includeRegion:{border:"#9e9e9e",label:"#3a3a3a",badge:"#737373",fill:"#f5f5f5",tabFill:"#ffffff",tabStroke:"#bdbdbd",tabText:"#1a1a1a",badgeFill:"#e8e8e8",badgeStroke:"#bdbdbd",badgeText:"#595959"},wave:{stripFill:"#fafafa",stripFillAlt:"#e0e0e0",labelText:"#212121",labelMuted:"#616161",boundary:"#616161",hatch:"#000000",hatchOnDark:"#ffffff"},arrowhead:{neutral:"#595959",light:"#9e9e9e",dark:"#1a1a1a"},status:{done:"#8a8a8a",inProgress:"#595959",atRisk:"#737373",blocked:"#3a3a3a",planned:"#bdbdbd",neutral:"#bdbdbd"},statusTint:{done:"#ebebeb",inProgress:"#e4e4e4",atRisk:"#eeeeee",blocked:"#dcdcdc",planned:"#f5f5f5",neutral:"#f5f5f5"},statusDot:{onLight:{done:"#3a3a3a",inProgress:"#2a2a2a",atRisk:"#4a4a4a",blocked:"#1a1a1a",planned:"#595959",neutral:"#595959"},onDark:{done:"#d4d4d4",inProgress:"#e8e8e8",atRisk:"#c8c8c8",blocked:"#f0f0f0",planned:"#d4d4d4",neutral:"#d4d4d4"}},attribution:{mark:"#9e9e9e",link:"#1a1a1a"},diagnostic:{overlayBg:"#e8e8e8",errorText:"#1a1a1a"}};var sS={red:"#e53935",blue:"#1e88e5",yellow:"#fdd835",green:"#43a047",orange:"#fb8c00",purple:"#8e24aa",gray:"#9e9e9e",navy:"#0d47a1",white:"#ffffff"},qn={bg:"none",fg:"#0f172a",text:"#0f172a",border:"solid",icon:"none",shadow:"none",font:"sans",weight:"normal",italic:!1,textSize:"md",padding:"sm",spacing:"sm",headerHeight:"sm",cornerRadius:"sm",bracket:"none",capacityIcon:"multiplier"},cx={name:"light",surface:{page:"#f8fafc",chart:"#ffffff",headerBox:"#ffffff"},entities:{roadmap:{...qn,headerHeight:"md",padding:"md"},swimlane:{...qn,fg:"#334155",text:"#334155",padding:"sm",spacing:"none",textSize:"sm"},item:{...qn,bg:"#ffffff",fg:"#94a3b8",text:"#0f172a",shadow:"subtle",cornerRadius:"sm"},parallel:{...qn,bg:"#635cf1",bracket:"dashed",padding:"xs"},group:{...qn,bg:"#ea9818",bracket:"solid",padding:"xs",fg:"#475569"},anchor:{...qn,bg:"#0f172a",fg:"#0f172a",text:"#0f172a",cornerRadius:"sm"},milestone:{...qn,bg:"#312e81",fg:"#312e81",text:"#ffffff",border:"solid"},footnote:{...qn,bg:"none",fg:"#475569",text:"#475569",textSize:"sm"},label:{...qn,bg:"#f1f5f9",fg:"#475569",text:"#475569",textSize:"xs",padding:"xs",cornerRadius:"full"}},swimlane:{bandEven:"#ffffff",bandOdd:"#f8fafc",separator:"#e2e8f0",frameTabText:"#334155",frameTabMuted:"#64748b",border:"#e2e8f0",tabFill:"#f1f5f9",tabStroke:"#cbd5e1",tabText:"#334155",ownerText:"#64748b",footnoteIndicator:"#dc2626",rowTintEven:"#ffffff",rowTintOdd:"#f8fafc",utilizationOk:"#10b981",utilizationWarn:"#f59e0b",utilizationOver:"#ef4444"},timeline:{gridLine:"#cbd5e1",minorGridLine:"#e2e8f0",nonWorkingSeam:"#a0aec0",nonWorkingFill:"#64748b",tickMark:"#cbd5e1",labelText:"#64748b",panelFill:"#ffffff",border:"#e2e8f0"},header:{cardBorder:"#e2e8f0",author:"#64748b"},item:{overflowX:"#dc2626",linkIconFg:"#0f172a",overflowTailFill:"#fee2e2",overflowTailStroke:"#ef4444",overflowCaption:"#b91c1c"},parallel:{bracketStroke:"#334155"},anchorDiamond:{fill:"#ffffff",stroke:"#334155",label:"#334155",cutLine:"#64748b"},milestoneDiamond:{fill:"#0f172a",label:"#0f172a",cutLineNormal:"#1e1b4b",cutLineOverrun:"#b91c1c",slack:"#0f172a"},footnotePanel:{fill:"#ffffff",border:"#e2e8f0",header:"#0f172a",title:"#0f172a",description:"#64748b",number:"#dc2626"},nowline:{stroke:"#e53e3e",labelText:"#ffffff",labelBg:"#e53e3e"},milestone:{dashedInk:"#94a3b8",overrun:"#ef4444"},anchor:{predecessorLine:"#94a3b8"},dependency:{edgeStroke:"#475569",overflowStroke:"#d32f2f"},footnote:{indicatorText:"#e53e3e",descriptionMuted:"#64748b"},includeRegion:{border:"#94a3b8",label:"#334155",badge:"#64748b",fill:"#f8fafc",tabFill:"#ffffff",tabStroke:"#cbd5e1",tabText:"#0f172a",badgeFill:"#e2e8f0",badgeStroke:"#cbd5e1",badgeText:"#475569"},wave:{stripFill:"#f0fdfa",stripFillAlt:"#ccfbf1",labelText:"#134e4a",labelMuted:"#0f766e",boundary:"#0d9488",hatch:"#0f172a",hatchOnDark:"#ffffff"},arrowhead:{neutral:"#475569",light:"#94a3b8",dark:"#0f172a"},status:{done:"#10b981",inProgress:"#3b82f6",atRisk:"#f59e0b",blocked:"#ef4444",planned:"#94a3b8",neutral:"#94a3b8"},statusTint:{done:"#ecfdf5",inProgress:"#eff6ff",atRisk:"#fffbeb",blocked:"#fee2e2",planned:"#f8fafc",neutral:"#f8fafc"},statusDot:{onLight:{done:"#065f46",inProgress:"#1e3a8a",atRisk:"#92400e",blocked:"#991b1b",planned:"#334155",neutral:"#334155"},onDark:{done:"#d1fae5",inProgress:"#dbeafe",atRisk:"#fef3c7",blocked:"#fee2e2",planned:"#e2e8f0",neutral:"#e2e8f0"}},attribution:{mark:"#94a3b8",link:"#e53e3e"},diagnostic:{overlayBg:"#fee2e2",errorText:"#991b1b"}};var aS=["light","dark","grayscale"],ux={light:cx,dark:ax,grayscale:lx};var oB={greyscale:"grayscale"};function fx(e){let t=e.toLowerCase(),n=oB[t]??t;return aS.find(r=>r===n)}var sB={grey:"gray",violet:"purple"};function Zn(e,t){if(e==="none")return"none";if(e.startsWith("#"))return e;let n=t.name==="dark"?iS:t.name==="grayscale"?oS:sS,r=sB[e]??e,i=n[r];return typeof i=="string"?i:e}function aB(e,t){return{bg:Zn(e.bg,t),fg:Zn(e.fg,t),text:Zn(e.text,t),border:e.border,icon:e.icon,shadow:e.shadow,font:e.font,weight:e.weight,italic:e.italic,textSize:e.textSize,padding:e.padding,spacing:e.spacing,headerHeight:e.headerHeight,cornerRadius:e.cornerRadius,bracket:e.bracket,headerPosition:"beside",capacityIcon:e.capacityIcon,timelinePosition:"top",minorGrid:!1,nonWorking:"hide"}}function lS(e,t,n,r){switch(t){case"bg":e.bg=Zn(n,r);break;case"fg":e.fg=Zn(n,r);break;case"text":e.text=Zn(n,r);break;case"border":(n==="solid"||n==="dashed"||n==="dotted")&&(e.border=n);break;case"icon":e.icon=n;break;case"shadow":(n==="none"||n==="subtle"||n==="soft"||n==="hard")&&(e.shadow=n);break;case"font":(n==="sans"||n==="serif"||n==="mono")&&(e.font=n);break;case"weight":(n==="thin"||n==="light"||n==="normal"||n==="bold")&&(e.weight=n);break;case"italic":e.italic=n==="true";break;case"text-size":e.textSize=Dl(n,"xl");break;case"padding":e.padding=Dl(n,"xl");break;case"spacing":e.spacing=Dl(n,"xl");break;case"header-height":e.headerHeight=Dl(n,"xl");break;case"corner-radius":e.cornerRadius=Dl(n,"full");break;case"bracket":(n==="none"||n==="solid"||n==="dashed")&&(e.bracket=n);break;case"header-position":(n==="beside"||n==="above")&&(e.headerPosition=n);break;case"capacity-icon":e.capacityIcon=n;break;case"timeline-position":(n==="top"||n==="bottom"||n==="both")&&(e.timelinePosition=n);break;case"minor-grid":e.minorGrid=n==="true";break;case"non-working":Dd(n)&&(e.nonWorking=n);break;default:break}}function Dl(e,t){let n=["none","xs","sm","md","lg","xl","full"],r=n.indexOf(t),i=n.indexOf(e);return i<0?"md":i>r?n[r]:n[i]}function lB(e,t,n){if(t)for(let r of t.properties)lS(e,ee(r),r.value,n)}function cB(e,t,n){for(let r of t){let i=ee(r);r.value!==void 0&&lS(e,i,r.value,n)}}function Se(e,t,n){let r=n.theme.entities[e],i=aB(r,n.theme);for(let o of jf(e,t,n))switch(o.level){case"default":case"inline":cB(i,o.props,n.theme);break;case"label":break;default:lB(i,o.decl,n.theme)}return i}function cS(e,t){return Se("label",e.properties,t)}function fS(e,t){let r=At(e.roadmapDecl?.properties??[],"scale")?.value,i="weeks",o,s;if(r)if(r==="days"||r==="weeks"||r==="months"||r==="quarters"||r==="years")i=r;else{let c=/^(\d+)([dwmqy])$/.exec(r);if(c){let u=Math.max(1,parseInt(c[1],10));switch(c[2]){case"d":i="days";break;case"w":i="weeks";break;case"m":i="months";break;case"q":i="quarters";break;case"y":i="years";break}o=dx(i)*u,s=1}}let a=s??Nk[i]??4,l=c=>s===void 0&&!c?{labelEveryDefault:!0}:{};if(t){let c=At(t.properties,"label-every"),u=c&&parseInt(c.value,10)||0,f=u!==0?Math.max(1,u):a;return{unit:i,labelEvery:f,pixelsPerUnit:o??dx(i),...l(u!==0)}}return{unit:i,labelEvery:a,pixelsPerUnit:o??dx(i),...l(!1)}}function dx(e){switch(e){case"days":return Ik;case"weeks":return 40;case"months":return 80;case"quarters":return 160;case"years":return 320}}var uB=.5,px=.5,Ml=7;function Wr(e){return e==="months"||e==="quarters"||e==="years"}function Md(e,t){let n=e.getUTCFullYear(),r=e.getUTCMonth();switch(t){case"months":return new Date(Date.UTC(n,r+1,1));case"quarters":return new Date(Date.UTC(n,r-r%3+3,1));case"years":return new Date(Date.UTC(n+1,0,1))}}function fB(e,t){if(e.getUTCDate()!==1)return!1;let n=e.getUTCMonth();switch(t){case"months":return!0;case"quarters":return n%3===0;case"years":return n===0}}function Fi(e,t,n,r,i){let o=Math.ceil(t-1e-6);if(i?.hasNonWorkingDays){if(!Wr(n)&&o<=0)return 0;let a=o<=0?e:Xe(i.dateAtWorkingIndex(e,o-1),1),l=Wr(n)?uS(a,n):n==="weeks"?dS(a,e,i.weekStart):a;return i.workingIndexOf(e,l)}if(!Wr(n))return Math.ceil(t/r)*r;let s=Xe(e,o);return kt(e,uS(s,n))}function uS(e,t){return fB(e,t)?e:Md(e,t)}function dS(e,t,n){let r=n===void 0?-kt(t,e):n-e.getUTCDay();return Xe(e,(r%Ml+Ml)%Ml)}function dB(e,t,n){return dS(Xe(e,1),t,n)}function Fd(e,t,n,r=$l){if(e.calendar?.hasNonWorkingDays)return pB(e,t,e.calendar,r);if(Wr(t.unit))return EB(e,t,t.unit,r);let i=n.daysPerUnit(t.unit),o=i*e.pixelsPerDay,s=Math.max(1,Math.round(e.widthPx/e.pixelsPerDay)),a=Math.floor(s/i)+1,l=[];for(let c=0;c<a;c++){let u=c*i,f=e.originX+u*e.pixelsPerDay,d=c%t.labelEvery===0,p=c===a-1;l.push({x:f,labelX:p?void 0:f+o/2,major:d,label:d&&!p?gx(t.unit,Xe(e.domain[0],u),c,r):void 0})}return l}function pB(e,t,n,r){let{unit:i}=t,[o,s]=e.domain,a=x=>Wr(i)?Md(x,i):i==="weeks"?dB(x,o,n.weekStart):Xe(x,1),l=[o];for(let x=a(o);x<s;x=a(x))l.push(x);let c=e.forward(s),u=[];l.forEach((x,y)=>{let w=e.forward(x);(y+1<l.length?e.forward(l[y+1]):c)>w&&!gB(e,i,l,y)&&u.push({date:x,x:w})});let f=i==="days"&&t.labelEveryDefault===!0&&n.weekStart!==void 0,d=(x,y)=>f?mB(x,n,e.showsNonWorking):y%t.labelEvery===0,m=(e.showsNonWorking?ok(i):n.daysPerUnit(i))*e.pixelsPerDay,g=u.map(({date:x,x:y},w)=>{let _=(w+1<u.length?u[w+1].x:c)-y,v=d(x,w),R=v?gx(i,x,w,r):void 0,B=R===void 0?0:se(R,Si),C=Wr(i)?w===0||w===u.length-1:_<m-uB,X=R!==void 0&&!(B>_&&C);return{x:y,columnPx:_,major:v,label:R,labelPx:B,isNarrowed:C,isShown:X}});Wr(i)||hB(g);let E=g.map(x=>({x:x.x,labelX:x.x+x.columnPx/2,major:x.major,label:x.isShown?x.label:void 0}));return s>o&&E.push({x:c,labelX:void 0,major:d(s,u.length),label:void 0}),E}function hB(e){let t=n=>{let r=e[n];return r===void 0||r.isShown?0:r.columnPx/2};e.forEach((n,r)=>{if(n.label===void 0||n.isShown||!n.isNarrowed||!(e[r-1]?.isNarrowed===!0||e[r+1]?.isNarrowed===!0))return;let o=n.labelPx/2,s=n.columnPx/2;n.isShown=o<=s+t(r-1)&&o<=s+t(r+1)})}function mB(e,t,n){let r=t.weekStart;if(n)return e.getUTCDay()===r;let i=(e.getUTCDay()-r+Ml)%Ml;for(let o=1;o<=i;o++)if(t.isWorkingDay(Xe(e,-o)))return!1;return!0}function gB(e,t,n,r){let i=e.calendar;if(!e.showsNonWorking||!i||!Wr(t)||r===0||r!==n.length-1)return!1;let[o,s]=e.domain;return i.workingIndexOf(o,n[r])>=i.workingIndexOf(o,s)}function hx(e,t,n,r){let i=e.calendar;if(!i?.hasNonWorkingDays)return;let o=i.nonWorkingRuns(e.domain[0],e.domain[1]);if(o.length===0)return;let[s,a]=e.range;if(e.showsNonWorking)return o.map(c=>xB(e,c,n));let l=c=>t.some(u=>Math.abs(u.x-c)<px&&(u.major||r));return o.map(c=>{let u=e.forward(c.from),f={x:u,width:e.forward(Xe(c.through,1))-u,from:c.from,through:c.through};c.titles.length>0&&(f.titles=c.titles,f.label=hS(c,i.workingWeekdays),f.cut=!0);let d=u-s>px&&a-u>px;return n==="days"&&d&&!l(u)&&(f.seam=!0),f})}function mx(e){let t=e.calendar?.workingExceptionRuns(e.domain[0],e.domain[1])??[];if(t.length===0)return;let[n]=e.range;return t.map(r=>({x:Math.max(n,e.forward(r.from)),from:r.from,through:r.through,titles:r.titles,label:yB(r)}))}function yB(e){let t=kt(e.from,e.through)+1;return`${e.titles.join(", ")}${pS}+${t}d`}var pS=" \xB7 ";function hS(e,t){let n=0;for(let i=e.from;i<=e.through;i=Xe(i,1))t.has(i.getUTCDay())&&n++;let r=e.titles.join(", ");return n>0?`${r}${pS}${n}d`:r}function xB(e,t,n){let[r,i]=e.range,o=Math.max(r,e.forward(t.from)),s=Math.min(i,e.forward(Xe(t.through,1))),a={x:o,width:s-o,from:t.from,through:t.through};return t.titles.length>0&&(a.titles=t.titles,e.calendar&&(a.label=hS(t,e.calendar.workingWeekdays))),(n==="days"||n==="weeks"||t.titles.length>0)&&(a.band=!0),a}function EB(e,t,n,r){let[i,o]=e.domain,s=[i];for(let c=Md(i,n);c<o;c=Md(c,n))s.push(c);o>i&&s.push(o);let a=s.map(c=>e.forward(c)),l=s.length-1;return s.map((c,u)=>{let f=a[u],d=u%t.labelEvery===0;if(u===l)return{x:f,labelX:void 0,major:d,label:void 0};let p=a[u+1]-f,m=d?gx(n,c,u,r):void 0,g=u===0||u===l-1;return m!==void 0&&g&&se(m,Si)>p&&(m=void 0),{x:f,labelX:f+p/2,major:d,label:m}})}function gx(e,t,n,r){switch(e){case"days":return`${t.getUTCMonth()+1}/${t.getUTCDate()}`;case"weeks":{let i=t.toLocaleString(r,{month:"short",timeZone:"UTC"}),o=t.getUTCDate().toString().padStart(2,"0");return`${i} ${o}`}case"months":return t.toLocaleString(r,{month:"short",timeZone:"UTC"});case"quarters":{let i=Math.floor(t.getUTCMonth()/3)+1;return`${Yn(r).quarterPrefix}${i} ${t.getUTCFullYear()}`}case"years":return`${t.getUTCFullYear()}`}}function mS(e,t,n){let r=n.theme??"light",i=ux[r],o=rS(n.locale,TB(e)),s={theme:i,styles:t.config.styles,defaults:t.config.defaults,labels:t.content.labels},a=Se("roadmap",e.roadmapDecl?.properties??[],s);return{themeName:r,theme:i,locale:o,styleCtx:s,roadmapStyle:a}}function gS(e,t,n,r,i){let{config:o,working:s}=qf(e,t),a=fS(e,t.config.scale),{startDate:l,endDate:c}=wB(e,i,n.today,a),u=Dd(n.nonWorking)?n.nonWorking:r.roadmapStyle.nonWorking,f=u==="show"&&s.hasNonWorkingDays,d=Math.max(1,s.workingIndexOf(l,c)),p=f?Math.max(1,kt(l,c)):d;return{cal:o,calendar:s,preset:a,schedule:i,startDate:l,naturalEndDate:c,spanDays:d,timelineDays:p,nonWorking:u}}function wB(e,t,n,r){let i=e.roadmapDecl?.properties??[],{config:o,working:s}=t.calendar,{startDate:a}=t,l=ie(i,"length"),c=0;if(l){let m=us(l,o);m>0&&(c=m)}let u=t.extent.contentEndDay;if(n&&!(c>0)){let m=s.workingIndexOf(a,n);m>0&&(u=Math.max(u,m))}let f=rk(r.unit,o),d=Fi(a,u>0?u:4*o.daysPerWeek,r.unit,f,s),p=Math.max(c,d);return{startDate:a,endDate:s.dateAtWorkingIndex(a,Math.max(1,p))}}function TB(e){return At(e.directive?.properties??[],"locale")?.value}var vB=160,_B=64,AB=1e-6,Rs=class{constructor(t,n){M(this,"scale");M(this,"startDate");M(this,"spanDays");M(this,"unit");M(this,"calendar");this.scale=n,this.startDate=t.startDate,this.spanDays=t.spanDays,this.unit=t.preset.unit,this.calendar=t.calendar}isPast(t,n){return this.scale.indexAtX(t)>n+AB}boundaryAtOrAfterX(t){return this.boundaryAtOrAfter(this.scale.indexAtX(t))}boundaryAtOrAfter(t){return Fi(this.startDate,t,this.unit,this.calendar.daysPerUnit(this.unit),this.calendar)}captionColumn(t){let n=this.boundaryAtOrAfter(t);return{start:n,end:this.nextBoundary(n)}}captionLimit(t){let{start:n,end:r}=this.captionColumn(t),i=this.xAt(n),o=r;for(let s=0;s<_B;s++){let a=this.nextBoundary(o);if(a<=o||this.xAt(a)-i>vB)break;o=a}return o}nextBoundary(t){return Fi(this.startDate,t+.5,this.unit,this.calendar.daysPerUnit(this.unit),this.calendar)}xAt(t){return this.scale.forward(this.calendar.dateAtWorkingIndex(this.startDate,t))}captionCapX(t){let n=this.isPast(t,this.spanDays)?Math.max(this.spanDays,this.boundaryAtOrAfterX(t)):this.spanDays;return this.xAt(this.captionLimit(n))}};function yS(e,t){e.box.y+=t;for(let n of e.inlineDatePins??[])n.glyphTopLeft.y+=t;if(e.kind==="item"){for(let n of e.labelChips)n.box.y+=t;e.overflowBox&&(e.overflowBox.y+=t);return}for(let n of e.children)yS(n,t)}function Ss(e,t){e.box.y+=t;for(let n of e.children)yS(n,t);for(let n of e.nested)Ss(n,t)}function xS(e,t){e.box.y+=t;for(let n of e.nestedSwimlanes)Ss(n,t);for(let n of[...e.anchors??[],...e.milestones??[]])n.center.y+=t,n.labelBox.y+=t,n.cutTopY+=t,n.cutBottomY+=t;for(let n of e.milestones??[])for(let r of n.slackArrows??[])r.y+=t;for(let n of e.edges??[])for(let r of n.waypoints)r.y+=t}function ES(e,t,n){e.cutTopY+=n,e.cutBottomY+=n,e.slackArrows?.forEach((r,i)=>{let o=t.slackArrows?.[i];o&&"y"in o&&(r.y+=n)})}var yx=class{constructor(t,n){M(this,"id");M(this,"anchor");this.id=t,this.anchor=n}place(t,n){let r=ie(this.anchor.properties,"date"),i=Te(r);if(!i)return null;let o=t.scale.forwardWithinDomain(i);if(o===null)return null;let s=Se("anchor",this.anchor.properties,t.styleCtx),a=t.markerRowPlacements.get(this.id),l=a?.centerY??t.timeline.markerRow.y,c={x:o,y:l},u=a?.labelBox??{x:o+6+6,y:l-4,width:0,height:12},f=a?.labelSide??"right";t.entityLeftEdges.set(this.id,o),t.entityRightEdges.set(this.id,o),t.entityMidpoints.set(this.id,c);let d={id:this.id,title:this.anchor.title??this.id,center:c,radius:6,style:s,predecessorPoints:[],cutTopY:t.chartTopY,cutBottomY:t.swimlaneBottomY,bumpedUp:(a?.rowIndex??0)>0,labelBox:u,labelSide:f};return!t.scale.showsNonWorking&&!t.calendar.isWorkingDay(i)&&(d.hiddenDate=vi(i)),d}};function Bd(e,t,n){let r=[];for(let[i,o]of e){let s=new yx(i,o).place(t,n);s&&r.push(s)}return r}function Wl(e){if(e.kind==="item"){let n=e.textSpills||e.dotSpills||e.iconSpills||e.footnoteSpills;return Math.max(e.box.x+e.box.width,n?e.decorationsRightX:Number.NEGATIVE_INFINITY,e.chipsOutside?e.chipsRightX:Number.NEGATIVE_INFINITY)}let t=Math.max(e.box.x+e.box.width,ws(e));for(let n of e.children)t=Math.max(t,Wl(n));return t}function Xr(e){let t=0;for(let n of e)t=Math.max(t,wS(n.children)),n.nested.length>0&&(t=Math.max(t,Xr(n.nested)));return t}function wS(e){let t=0;for(let n of e)n.kind==="item"?t=Math.max(t,n.box.x+n.box.width):t=Math.max(t,wS(n.children));return t}function bs(e){let t=0;for(let n of e)t=Math.max(t,TS(n.children)),n.nested.length>0&&(t=Math.max(t,bs(n.nested)));return t}function TS(e){let t=0;for(let n of e)n.kind==="item"?n.textSpills&&(t=Math.max(t,n.decorationsRightX)):t=Math.max(t,TS(n.children));return t}function IB(e){return e.box.y+e.box.height-rn/2}function xx(e,t){let{box:n}=e;return{startX:e.dateSpan.startX,endX:e.dateSpan.endX,paintedX:n.x,paintedWidth:n.width,top:n.y,bottom:n.y+n.height,rowY:n.y+t/2,exitY:Ex(e,t)}}function vS(e){let{box:t}=e;return{startX:t.x,endX:t.x+t.width,paintedX:t.x,paintedWidth:t.width,top:t.y,bottom:t.y+t.height}}function Ex(e,t){return e.textSpills?IB(e):e.box.y+t/2}function _S(e){let{box:t,afterDate:n,beforeDate:r,hasLinkIcon:i,footnoteCount:o}=e;if(!n&&!r)return[];let s=[],a=pt,l=t.y+Ek,c=qg(t.width);if(n){let u=Zg(t.x,i),f=c?{x:t.x-Bn-a,y:l}:{x:u,y:l};s.push({side:"after",isoDate:n,glyphTopLeft:f,glyphSize:a,spilled:c})}if(r){let u=t.x+t.width,f=Jg(u,o),d=c?{x:u+Bn,y:l}:{x:f,y:l};s.push({side:"before",isoDate:r,glyphTopLeft:d,glyphSize:a,spilled:c})}return s}function Wd(e){let{box:t,afterDate:n,beforeDate:r,title:i}=e;if(!n&&!r)return[];let o=[],s=pt,a=t.y+(Tl-s)/2,l=i?Es(t.x,!!n)+Iy(i):t.x;if(n&&(l=Math.max(l,t.x+s),o.push({side:"after",isoDate:n,glyphTopLeft:{x:t.x,y:a},glyphSize:s,spilled:!1})),r){let c=t.x+t.width-Kg-s,u=l>t.x?l+nn:t.x;o.push({side:"before",isoDate:r,glyphTopLeft:{x:Math.max(c,u),y:a},glyphSize:s,spilled:!1})}return o}function St(e){for(let t of e)if(Te(t))return t}function Ur(e){return{after:Be(e,"after").map(n=>{let r=Te(n);return r?{raw:n,date:r}:{raw:n,ref:n}})}}function Xd(e){return e.floors.map(t=>t?Te(t.date):null)}function Ud(e,t,n,r,i=0,o){let s=n.map(c=>c??-1/0),a=[];for(let c=0;c<e;c++){let u=AS(c===0?t:a[c-1],s[c],i);a.push(c===0?u:Math.max(u,o?.S[c]??-1/0))}let l=a.map((c,u)=>Math.max(c,o?.E[u]??-1/0));for(let c=1;c<=e+1;c++){let u=r(a,l).memberEnd,f=[],d=[];for(let p=0;p<e;p++)f.push(p===0?a[0]:AS(d[p-1],s[p],i)),d.push(Math.max(f[p],u[p]??-1/0));if(kS(a,f)&&kS(l,d))return{S:a,E:l,passes:c,capped:!1};a=f,l=d}return r(a,l),{S:a,E:l,passes:e+1,capped:!0}}function AS(e,t,n){return t-e>n?t:e}function kS(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function IS(e,t,n){return Xd(e).map(r=>r?n.workingIndexOf(t,r):null)}var Bi=class{constructor(t,n){M(this,"plan");M(this,"S");M(this,"memberEnd");M(this,"binding");M(this,"memberCount");this.plan=t,this.S=n;let r=t.waves.length;this.memberEnd=new Array(r).fill(-1/0),this.binding=new Array(r).fill(void 0),this.memberCount=new Array(r).fill(0)}floor(t){let n=this.plan.waveOf.get(t),r=t.$type==="ItemDeclaration"?void 0:this.plan.leadOf.get(t),i;return n!==void 0&&(i=this.S[n-1]),r!==void 0&&(i=Math.max(i??-1/0,this.S[r-1])),i}apply(t,n){let r=this.floor(t);return r===void 0?n:Math.max(n,r)}accumulate(t,n){let r=this.plan.memberWave(t);r!==void 0&&(this.memberCount[r-1]++,n>this.memberEnd[r-1]&&(this.memberEnd[r-1]=n,this.binding[r-1]=t))}};function Gd(e,t,n,r,i,o=0){return e.waves.map((s,a)=>{let l={id:s.name,index:a+1,start:t.S[a],end:t.E[a],memberCount:n.memberCount[a]},c=n.binding[a];if(c!==void 0&&n.memberEnd[a]===t.E[a]&&t.E[a]>t.S[a]){let p=c.name??c.title;p!==void 0&&(l.heldBy=p)}let u=i[a],f=e.floors[a]?.ref,d=a===0?r:t.E[a-1];return u!=null&&f!==void 0&&u-d>o&&(l.floorRef=f),l})}var Ot=.5;function RS(e,t,n,r,i){let o=e.waves.map(()=>n);return{plan:e,ids:e.waves.map(s=>s.name),origin:n,floors:Xd(e).map(s=>s?t.forward(s):null),S:o,E:o,pass:new Bi(e,o),frozen:!1,backgroundTooltip:r,visible:i}}function SS(e,t,n){e.S=t,e.E=n,e.pass=new Bi(e.plan,t)}function bS(e,t){e.S=t.S,e.E=t.E,e.frozen=!0,e.solve=t}function Hd(e,t,n){e.ids.forEach((r,i)=>{t.set(r,e.S[i]),n.set(r,e.E[i])})}function Gr(e,t,n){return n.waves?n.waves.pass.apply(e,t):t}function NS(e,t,n){n.waves&&!n.waves.frozen&&n.waves.pass.accumulate(e,t)}function LS(e,t){if(t.waves?.visible)return t.waves.plan.memberWave(e)!==void 0?"member":"background"}function PS(e,t){for(let n of[...e.S,...e.E])if(!(Math.abs(n-e.origin)<Ot)&&Math.abs(t-n)<Ot)return!0;return!1}function wx(e,t){let n=Math.round((e-t.timeline.originX)/t.timeline.pixelsPerDay);if(!t.scale.showsNonWorking)return n;let r=t.timeline.startDate;return t.calendar.workingIndexOf(r,Xe(r,n))}function zd(e,t){return t.calendar.dateAtWorkingIndex(t.timeline.startDate,wx(e,t))}function OS(e,t,n){return Kf(n.calendar,n.timeline.startDate,wx(e,n),wx(t,n))}function Xl(e,t,n){return Gr(e,Ul(e.properties,t,n),n)}var RB=!0;function CS(){return RB}function Ul(e,t,n){let{after:r}=Ur(e);if(r.length>0){let i=t;for(let o of r){if("date"in o){let a=n.scale.forwardWithinDomain(o.date);a!==null&&(i=Math.max(i,a));continue}let s=n.entityRightEdges.get(o.ref);s!==void 0&&(i=Math.max(i,s))}return i}return t}function $S(e,t,n){if(!n.calendar.hasNonWorkingDays)return;let r=SB(e);if(!r||n.calendar.isWorkingDay(r.date))return;let i=n.scale.forwardWithinDomain(r.date);if(!(i===null||Math.abs(t-i)>=Ot))return{key:r.key,pin:r.raw,start:vi(zd(t,n))}}function SB(e){let{after:t}=Ur(e);for(let n of t)if("date"in n)return{key:"after",raw:n.raw,date:n.date}}function Tx(e){if(!e||e==="none"||e==="transparent")return 1;let t=e.startsWith("#")?e.slice(1):e;if(t.length===3&&(t=t.split("").map(s=>s+s).join("")),t.length!==6)return 1;let n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(r)+.0722*o(i)}function bB(e,t){return Tx(e)>=.24?t.statusDot.onLight:t.statusDot.onDark}function DS(e,t,n){let r=bB(t,n),i={done:r.done,"in-progress":r.inProgress,"at-risk":r.atRisk,blocked:r.blocked,planned:r.planned,neutral:r.neutral};return i[e]??i.neutral}var NB=.24;function LB(e){return e==="none"?"transparent":e}function jd(e){return Tx(LB(e))>=NB?"dark":"light"}function Ns(e,t,n){return e.scale.showsNonWorking?e.scale.advanceX(t,n)-t:n*e.timeline.pixelsPerDay}function Gl(e,t){return{x:e,startX:e,y:t,height:0}}function MS(e,t){let n=e.schedule.byNode.get(t);if(!n)throw new Error(`layout: item "${t.name??t.title??"(unnamed)"}" is not in the day schedule`);return n.days}function PB(e){let t=new Map(e),n=r=>{for(let i of r.content)tn(i)&&(i.name&&!t.has(i.name)&&t.set(i.name,i),n(i))};for(let r of e.values())n(r);return t}function Yd(e,t,n,r){return{cal:t.cal,schedule:t.schedule,styleCtx:{theme:t.theme,styles:e.config.styles,defaults:e.config.defaults,labels:e.content.labels},sizes:fs(e.content.sizes,t.cal),labels:e.content.labels,teams:PB(e.content.teams),persons:e.content.persons,symbols:e.config.symbols,footnoteIndex:r.footnotes?.index??new Map,footnoteHosts:r.footnotes?.hosts??new Map,timeline:t.timeline,scale:t.scale,calendar:t.calendar,...t.axisColumns?{axisColumns:t.axisColumns}:{},bandScale:t.bandScale,entityLeftEdges:new Map,entityRightEdges:new Map,entityMidpoints:new Map,markerIds:new Set([...e.content.anchors.keys(),...e.content.milestones.keys()]),placedItems:new Map,itemFlowKey:new Map,currentFlowKey:"",slackCorridors:[],markerRowPlacements:r.markerRowPlacements??new Map,chartTopY:n.chartTopY,chartBottomY:n.chartBottomY,swimlaneBottomY:n.swimlaneBottomY,nextParallelId:0,nextGroupId:0,...t.waves?{waves:t.waves}:{}}}var FS=12,OB=4,Vd=13,CB=11;function $B(e,t){return(e?se(e,CB):0)+t}function qd(e){return Math.max(0,Math.min(kk,(e-ey)/2))}function vx(e){return Math.max(ey,e-2*qd(e))}function BS(e){if(!/[\r\n]/.test(e))return;let t=e.replace(/\r\n?/g,`
2918
2918
  `).split(`
2919
- `).map(i=>i.trim()),n=0,r=t.length;for(;n<r&&t[n]==="";)n+=1;for(;r>n&&t[r-1]==="";)r-=1;return t.slice(n,r)}function CB(e,t,n,r=t,i=r){let o=e,s=MS(e);if(s){if(s.length>=2)return{textSpills:!(n<=t&&s.every((u,f)=>se(u,jd)<=(f===0?i:t))),titleLines:s};o=s[0]??""}let a=o.length>0&&se(o,jd)>r,l=n>t;if(!a&&!l)return{textSpills:!1,titleLines:[o]};if(a&&!l)for(let c of[r,i]){let u=Ti(o,t,jd,c);if(u.length>=2&&u.length<=Ug&&u.every((f,d)=>se(f,jd)<=(d===0?c:t)))return{textSpills:!1,titleLines:u}}return{textSpills:!0,titleLines:[o]}}function FS(e,t,n){let r=MS(e);return r&&r.length>=2?r:!t.textSpills&&!n&&t.titleLines.length>=2?t.titleLines:[r?r[0]??"":e]}function BS(e){let{visualWidth:t}=e,n=ps(!!e.hasLinkIcon,e.hasAfterGlyph?{barWidth:t}:void 0),r=Math.max(0,t-n-DS),i=OB(e.metaText,e.metaTrailingWidth??0),o=e.titleFirstLineRightReservePx??ul({barWidth:t,footnoteLabels:[],hasBeforeGlyph:!1}),s=Math.max(0,t-n-o),a=Math.max(s,t-n-Math.max(DS,o-Xt));return{leftInset:n,fit:CB(e.title,r,i,s,a)}}var $B;function WS(e,t,n){$B?.(e,t,n)}var Yd=class{constructor(t){M(this,"geometry");this.geometry=t}get id(){return this.geometry.id}measure(t){return{width:this.geometry.naturalWidth,height:t.bands.bandwidth()+this.geometry.barExtra}}place(t,n){let{naturalWidth:r,visualWidth:i,caption:o,barExtra:s}=this.geometry,a=n.bands.bandwidth(),l=t.x+Vd(r),c={x:l,y:t.y,width:i,height:s>0?a+s:a},{textSpills:u,titleLines:f}=o.fit,d=u?l+i+LB:l+o.leftInset;return{id:this.geometry.id,box:c,textX:d,textSpills:u,titleLines:f}}};function DB(e){switch(e){case"done":case"completed":return"done";case"in-progress":case"active":return"in-progress";case"at-risk":case"blocked":case"planned":return e;case void 0:return"planned";default:return"neutral"}}function MB(e){if(!e)return 0;let t=/^(\d{1,3})%$/.exec(e);return t?Math.max(0,Math.min(100,parseInt(t[1],10)))/100:0}function FB(e,t){if(e)return/^\d+(?:\.\d+)?[dwmqy]$/.test(e)||/^\d+%$/.test(e)?e:t.sizes.get(e)?.effortLiteral??e}function BB(e,t){if(e)return t.teams.get(e)?.title??t.persons.get(e)?.title??e}function WB(e){if(!e)return{icon:"none"};let t=e.toLowerCase();return t.includes("linear.app")?{icon:"linear",href:e}:t.includes("github.com")?{icon:"github",href:e}:t.includes("atlassian.net")||t.includes("jira.")?{icon:"jira",href:e}:{icon:"generic",href:e}}function Kd(e,t,n,r,i){let o=aS(e,t),s=e.title??e.name??"",a=o.padding==="none"?"xs":o.padding,l=Tk[a],c=Math.max(20,Math.round(s.length*5.5+l*2));return i!==void 0&&(c=Math.min(c,i)),{text:s,style:o,box:{x:n,y:r,width:c,height:Dr}}}function XB(e,t){let n=ZA(e,t.sizes,t.cal),r=KA(ie(e,"remaining"),t.sizes,t.cal),i=ie(e,"status"),o=DB(i),s=MB(i);s===0&&o==="done"&&(s=1);let a=/^(\d{1,3})%$/.exec(ie(e,"remaining")??"");return s===0&&o==="in-progress"&&a&&(s=1-Math.max(0,Math.min(100,parseInt(a[1],10)))/100),s===0&&o==="in-progress"&&r>0&&n>0&&(s=Math.max(0,Math.min(1,1-r/n))),{status:o,progress:s}}function UB(e,t,n,r,i,o){let s=ie(e,"duration"),a=!!s&&/^\d+(?:\.\d+)?[dwmqy]$/.test(s),l=n?n.title??n.name:"",c=a?s:l||void 0,u=ie(e,"remaining"),f=FB(u,t),d=BB(ie(e,"owner"),t),p=()=>[c,d].filter(Boolean).join(" "),m;if(r==="in-progress"&&f){let E=p();m=E?`${E} \u2014 ${f} remaining`:`${f} remaining`}else if(r==="in-progress"&&i>0&&i<1){let E=Math.round((1-i)*100),_=p();m=_?`${_} \u2014 ${E}% remaining`:`${E}% remaining`}else(d||c)&&(m=p()||void 0);let g=ie(e,"capacity"),w=Lr(g),x=null,y=0;if(w!==null){let E=el(w),_=tl(o,t.symbols),T=11,I=rl(E,_,T,m);x={value:w,text:E,icon:_,...I!==void 0?{iconDxTerms:I}:{}};let B=I!==void 0?T*as:se(" ",T);y=(m?B:0)+nl(E,_,T)}return{metaText:m,ownerDisplay:d,capacity:x,capacityTrailingWidth:y}}function GB(e,t){let n=new Set;if(e){for(let[r,i]of t.footnoteHosts.entries())if(i.includes(e)){let o=t.footnoteIndex.get(r);o!==void 0&&n.add(o)}}return[...n].sort((r,i)=>r-i)}function HB(e,t,n){return ul({barWidth:e,footnoteLabels:t.map(String),hasBeforeGlyph:St(n)!==void 0})}var zB={done:"done","in-progress":"inProgress","at-risk":"atRisk",blocked:"blocked",planned:"planned",neutral:"neutral"};function jB(e,t,n){let r=zB[t],i={...e};return i.bg===n.entities.item.bg&&(i.bg=n.statusTint[r]),i.fg===n.entities.item.fg&&(i.fg=n.status[r]),i}function YB(e,t,n,r,i){if(n===0)return 0;let o=r-rn-Dr-Wn,s;e&&t?s=Math.max(_i,i)+Wn:e?s=o:s=Math.max(o,i+Wn);let l=s+(n-1)*Qf+Dr+Wn+rn;return Math.max(0,l-r)}function VB(e,t,n){let r=n.axisColumns;if(!t.textSpills||!r)return{lines:e,truncated:!1};let i=Math.max(0,...e.map(g=>se(g,Or))),{metaText:o,capacityTrailingWidth:s}=t.meta,a=(o?se(o,sl):0)+s,l=Math.max(i,a),c=Jf({barRightX:t.barRightX,iconSpills:t.iconSpills,captionWidth:l,footnoteCount:t.visualWidth<hs?t.footnoteCount:0,dotSpills:t.visualWidth<$r}),u=r.captionCapX(t.barRightX);if(c.rightX<=u+KB||c.captionX===null)return{lines:e,truncated:!1};let f=c.rightX-(c.captionX+l),d=u-c.captionX-f,p=!1;return{lines:e.map(g=>{let w=jA(g,d,Or);return w!==g&&(p=!0),w}),truncated:p}}var KB=1e-6;function qd(e,t,n){let r=e.properties,i=Se("item",r,n.styleCtx),o=ie(r,"size"),s=o?n.sizes.get(o)??null:null,a=$S(n,e),l=Be(r,"after"),c=Be(r,"before"),u=bs(n,t,a),f=wx(u),d=WB(ie(r,"link")),p=d.icon!=="none",m=wx(u),g=Be(r,"labels"),w=[];for(let j of g){let U=n.labels.get(j);if(!U)continue;let ee=Kd(U,n.styleCtx,0,0);w.push({id:U,width:ee.box.width})}let x=0;for(let j=0;j<w.length;j+=1)j>0&&(x+=Xn),x+=w[j].width;let y=Math.max(0,m-2*Fn),E=w.length>0&&x>y,{status:_,progress:T}=XB(r,n),I=jB(i,_,n.styleCtx.theme),B=UB(r,n,s,_,T,I.capacityIcon),$=e.title??e.name??"",X=GB(e.name,n),Y=BS({title:$,visualWidth:f,metaText:B.metaText,metaTrailingWidth:B.capacityTrailingWidth,hasLinkIcon:p,hasAfterGlyph:St(l)!==void 0,titleFirstLineRightReservePx:HB(m,X,c)}),D=p&&f<jg,R=Y.fit.textSpills||D,S=VB(FS($,Y.fit,D),{textSpills:R,iconSpills:D,barRightX:t+Vd(u)+f,visualWidth:f,footnoteCount:X.length,meta:B},n),O=S.lines,k=E?Ek(w,f):null,L=k?k.rows.length:w.length>0?1:0,v=B.metaText!==void 0||B.capacity!==null,P=Zf(O.length,v),b=Gg(O.length,v),F=YB(E,R,L,n.bandScale.bandwidth(),P);return{node:e,id:e.name??"",startX:t,durationDays:a,naturalWidth:u,visualWidth:f,naturalVisualWidth:m,style:I,size:s,status:_,progress:T,meta:B,link:d,chips:{samples:w,outside:E,pack:k,rowCount:L},footnoteIndicators:X,caption:{...Y,title:$,iconSpills:D,lines:O,truncated:S.truncated,lastBaseline:P},barExtra:Math.max(b,F)}}function Zd(e,t,n,r){let i=e.properties,o=Be(i,"after"),s=Be(i,"before"),a=Wl(i,t.x,n);n.waves&&(a=Gr(e,a,n));let l=OS(i,a,n),c=n.scale.startX(a),u=r??qd(e,c,n);if(u.startX!==c)throw new Error(`layout: item "${e.name??e.title??"(unnamed)"}" was measured at x ${u.startX} but placed at x ${c}`);let{naturalWidth:f,style:d,status:p,progress:m,footnoteIndicators:g,caption:w}=u,{metaText:x,ownerDisplay:y,capacity:E,capacityTrailingWidth:_}=u.meta,T=u.link,I=T.icon!=="none",B=u.chips.samples,$=u.chips.outside,X=c,Y=c+f,D=c+bs(n,c,u.durationDays),R=!1,S,O;if(s.length>0){let qe,tr;for(let Dt of s){let Ms=_e(Dt),Fs=Ms?n.scale.forwardWithinDomain(Ms)??void 0:n.entityLeftEdges.get(Dt);Fs!==void 0&&(qe===void 0||Fs<qe)&&(qe=Fs,tr=Dt)}qe!==void 0&&D>qe&&(R=!0,S={x:qe,y:t.y,width:Y-qe,height:n.bandScale.bandwidth()},O=tr)}let k=w.title,L=new Yd(u),v={time:n.scale,bands:n.bandScale,style:d},P=L.place({x:X,y:t.y},v),b=P.box,F=n.bandScale.bandwidth(),j=b.width<$r,U=w.iconSpills,ee=b.width<hs,V=P.textSpills||U,ne=w.lines,A=u.chips.pack,C=w.lastBaseline,W=u.barExtra,G=[],K=b.y+F-rn-Dr-Wn,q=b.y+($&&V?Math.max(_i,C):C)+Wn,re=$&&V||!$&&B.length>0?Math.max(K,q):K,le=$?b.x+b.width+Bn:b.x+Fn,ce=le;if(A)for(let qe=0;qe<A.rows.length;qe+=1){let tr=re+qe*Qf,Dt=le;for(let Fs of A.rows[qe]){let wE=Kd(Fs.id,n.styleCtx,Dt,tr);G.push(wE),Dt+=wE.box.width+Xn}let Ms=Dt-Xn;Ms>ce&&(ce=Ms)}else{let qe=le;for(let tr of B){let Dt=Kd(tr.id,n.styleCtx,qe,re);G.push(Dt),qe+=Dt.box.width+Xn}ce=B.length>0?qe-Xn:le}let pe=y??ie(i,"owner"),rt=e.description?.text,mt=g.length>0&&ee,gt=null;if(V){let qe=Math.max(...ne.map(Dt=>se(Dt,Or))),tr=(x?se(x,11):0)+_;gt=Math.max(qe,tr)}let Ql=Jf({barRightX:b.x+b.width,iconSpills:U,captionWidth:gt,footnoteCount:mt?g.length:0,dotSpills:j}),{iconSpillX:nL,footnoteSpillStartX:rL,dotSpillCx:iL}=Ql,oL=Math.max(b.x+b.width,Ql.rightX),Ds=e.name;Ds&&(n.entityLeftEdges.set(Ds,X),n.entityRightEdges.set(Ds,D)),SS(e,D,n);let xE=Ds??Tx(e);n.itemFlowKey.set(xE,n.currentFlowKey),t.startX=X,t.x=D,t.height=Math.max(t.height,n.bandScale.step()+W);let EE=TS({box:b,afterDate:St(o),beforeDate:St(s),hasLinkIcon:I,footnoteCount:g.length}),er={kind:"item",id:Ds,title:k,...ne.length>=2||ne[0]!==k?{titleLines:ne}:{},box:b,dateSpan:{startX:X,endX:Y},status:p,statusDotColor:CS(p,d.bg,n.styleCtx.theme),progressFraction:m,footnoteIndicators:g,labelChips:G,chipsOutside:$,chipsRightX:ce,linkIcon:T.icon,linkHref:T.href,hasOverflow:R,overflowBox:S,overflowAnchorId:O,owner:pe,description:rt,metaText:x,textSpills:V,dotSpills:j,iconSpills:U,footnoteSpills:mt,dotSpillCx:iL,iconSpillX:nL,footnoteSpillStartX:rL,decorationsRightX:oL,capacity:E,size:u.size,style:d,inlineDatePins:EE.length>0?EE:void 0},ec=bS(e,n);return ec!==void 0&&(er.waveRole=ec),ec==="background"&&(er.waveHatch=Hd(d.bg)),l!==void 0&&(er.nonWorkingPin=l),w.truncated&&(er.titleTruncated=!0),ec==="background"&&n.waves&&(er.waveTooltip=n.waves.backgroundTooltip),n.placedItems.set(xE,er),WS(L,v,er),er}function Tx(e){let t=e.$cstNode?.range.start;return`#item@${t?t.line+1:0}:${t?t.character+1:0}`}function vx(e){let t=new Map;for(let n of IA(e))Ve(n)&&t.set(n.name??Tx(n),n);return t}var qB=.01;function ZB(e,t){let n={blocks:[],edges:[]},r=new Map,i=(a,l,c)=>{n.blocks.push({x:a,y:c,width:l,height:0})},o=(a,l)=>{let{box:c}=a;if(a.kind==="item"){n.blocks.push({...c,width:Fl(a)-c.x}),n.edges.push({x:c.x,top:c.y,bottom:c.y+c.height},{x:c.x+c.width,top:c.y,bottom:c.y+c.height});return}l&&a.id&&r.set(a.id,a),a.kind==="group"&&a.waveOnly||(a.headerHeight>0&&n.blocks.push({x:c.x,y:c.y,width:Math.max(c.width,Es(a)-c.x),height:a.headerHeight}),i(c.x,c.width,c.y+c.height),n.edges.push({x:c.x,top:c.y,bottom:c.y+c.height},{x:c.x+c.width,top:c.y,bottom:c.y+c.height}));for(let u of a.children)o(u,l)},s=(a,l)=>{i(a.box.x,a.box.width,a.box.y),i(a.box.x,a.box.width,a.box.y+a.box.height);for(let c of a.children)o(c,l);for(let c of a.nested)s(c,l)};for(let a of e)s(a,!0);for(let a of t){i(a.box.x,a.box.width,a.box.y),i(a.box.x,a.box.width,a.box.y+a.box.height);for(let l of a.nestedSwimlanes)s(l,!1)}return{obstacles:n,containers:r}}function _x(e,t,n,r){let{obstacles:i,containers:o}=ZB(t,n),s=r.bandScale.bandwidth(),a=Se("item",[],r.styleCtx),l=[];for(let[p,m]of e){let g=r.placedItems.get(p);if(!g)continue;let w=gx(g,s);for(let x of Be(m.properties,"after")){let y=r.placedItems.get(x),E=y?void 0:o.get(x),_;if(y?_=gx(y,s):E&&(_=wS(E)),_){l.push({fromId:x,toId:p,source:_,target:w});continue}let T=r.entityMidpoints.get(x);if(!T||w.startX-T.x<=qB)continue;let I=w.rowY??w.top;l.push({fromId:x,toId:p,waypoints:[{x:T.x,y:I},{x:w.paintedX,y:I}],slack:!0,...ws(w.bottom-w.top),style:a})}}let c=l.filter(p=>p!==null&&"source"in p),u=Ck(c,i,r.scale.pixelsPerDay),f=new Map(c.map((p,m)=>[p,u[m]])),d=[];for(let p of l){if(!p)continue;if(!("source"in p)){d.push(p);continue}let m=f.get(p);m&&d.push({...m,style:a})}return d}function Qd(e,t=0){let n=new Map,r=new Map;return[...e.entries()].forEach(([i,o],s)=>{n.set(i,t+s+1),r.set(i,Be(o.properties,"on"))}),{index:n,hosts:r}}var Jd=11,JB=120,QB=6,XS="\u2014 ";function GS(e,t,n,r,i=[]){let o=Ht,s=n+Ht,a=r-2*Ht,l=o+2*Ht,c=o+a-Ht,u=s+td+Ht,f=[],d=0,p=(g,w,x)=>{for(let[y,E]of g){let _=E.title??y,T=E.description?.text,I=eW(_,T,l,c),B=u+d*gs,$=Y=>({x:Y.x,y:B+Y.row*gs,text:Y.text}),X={number:w.footnoteIndex.get(y)??f.length+1,y:B,title:_,titleLines:I.title.map($),description:T,style:Se("footnote",E.properties,w.styleCtx)};I.description.length>0&&(X.descriptionLines=I.description.map($)),x!==void 0&&(X.region=x),f.push(X),d+=I.rows}};p(e,t);for(let g of i){if(g.footnotes.size===0)continue;let w=u+d*gs;d+=1;let x=f.length;p(g.footnotes,g.ctx,g.title),f[x].regionHeadingY=w}return{box:{x:o,y:s,width:a,height:f.length===0?0:td+d*gs+Ht},entries:f}}function eW(e,t,n,r){let i=r-n,o=US(e,i,i),s=o.map((g,w)=>({x:n,row:w,text:g}));if(!t)return{title:s,description:[],rows:o.length};let a=se(XS,Jd),l=t.trim().split(/\s+/)[0]??"",c=n+Math.max(JB,e.length*QB),u=o.length===1&&a+se(l,Jd)<=r-c,f=u?c:n,d=u?o.length-1:o.length,p=US(t,i,r-f-a),m=p.map((g,w)=>({x:w===0?f:n,row:d+w,text:w===0?`${XS}${g}`:g}));return{title:s,description:m,rows:d+p.length}}function US(e,t,n){if(se(e,Jd)<=n)return[e];let r=Ti(e,t,Jd,n);return r.length>0?r:[e]}function Ul(e,t,n){let r=[],i=(o,s,a)=>{let l=_e(ie(s.properties,"date"));if(!l)return;let c=n.forwardWithinDomain(l);c!==null&&r.push({id:o,centerX:c,radius:6,title:s.title??o,fontSize:10,bold:a,date:l,isMilestone:a})};for(let[o,s]of e)i(o,s,!1);for(let[o,s]of t)i(o,s,!0);return r}function tp(e,t){return[...nW(e),...rW(t)]}function Ns(e,t){let n=new Map;for(let[r,i]of e){let o=t+13+i.rowIndex*26;n.set(r,{rowIndex:i.rowIndex,centerY:o,labelBox:{...i.labelBox,y:o-4},labelSide:i.labelSide})}return n}function Ax(e){return`nonworking:${e.from.toISOString().slice(0,10)}`}function kx(e){return`working:${e.from.toISOString().slice(0,10)}`}function zS(e,t,n){return{id:e,centerX:t,radius:0,title:n,fontSize:10,bold:!1}}function nW(e){let t=[];for(let n of e??[])n.label!==void 0&&t.push(zS(Ax(n),n.x,n.label));return t}function rW(e){return(e??[]).map(t=>zS(kx(t),t.x,t.label))}function Bi(e,t,n,r){let i=n;for(let o of e){let s=jS(o,r),a=o.centerX+o.radius+6+s,c=o.centerX-o.radius-6-s>=t&&o.slipFromX===void 0;a>n&&!c&&(i=Math.max(i,a+It))}return i}function jS(e,t){return t(e.title,e.fontSize)*(e.bold?1.05:1)}function np(e){let t=[];for(let n of e)for(let r of n.slackArrows??[])"marker"in r&&r.marker!==n.id&&t.push({from:r.marker,to:n.id});return t}function Ls(e,t,n,r,i=[]){let o=[...e].sort((u,f)=>u.centerX-f.centerX),s=new Map,a=[],l=new Map(e.map(u=>[u.id,u])),c=i.filter(u=>l.has(u.from)&&l.has(u.to));for(let u of o){let f=jS(u,r),d=u.centerX+u.radius+6,p=u.centerX-u.radius-6-f,m=d+f<=n,g=p>=t,w=u.centerX-u.radius,x=u.centerX+u.radius,y=v=>v==="right"?d:p,E=v=>v==="right"?m:g,_=u.slipFromX===void 0?[]:[{left:u.slipFromX-u.radius,right:u.centerX-u.radius}],T=c.filter(v=>v.from===u.id).map(v=>{let P=l.get(v.to);return{left:Math.min(u.centerX,P.centerX)+u.radius,right:Math.max(u.centerX,P.centerX)-P.radius}}).concat(_).filter(v=>v.right>v.left),I=-1,B=Number.POSITIVE_INFINITY;for(let v of c){if(v.to===u.id){let P=s.get(v.from);P&&(B=Math.min(B,P.rowIndex))}if(v.from===u.id){let P=s.get(v.to);P&&(I=Math.max(I,P.rowIndex))}}let $=v=>{let P=y(v);return T.some(b=>b.left<P+f&&b.right>P)},X=v=>E(v)&&!$(v),Y=X("right")||u.slipFromX!==void 0?"right":X("left")?"left":m?"right":"left",D=(v,P)=>{let b=Math.min(w,v),F=Math.max(x,v+f),j=[{left:b,right:F},...T];return a[P].some(U=>j.some(ee=>U.left<ee.right&&U.right>ee.left))},R=-1,S="right",O=d;e:for(let v=a.length-1;v>=0;v--)if(!(v<I||v>B))for(let P of["right","left"]){if(!X(P))continue;let b=y(P);if(!D(b,v)){R=v,S=P,O=b;break e}}if(R===-1&&I>=0&&I<B){let v=I+1;for(let[P,b]of s)b.rowIndex>=v&&s.set(P,{...b,rowIndex:b.rowIndex+1});a.splice(v,0,[]),R=v,S=Y,O=y(S)}else if(R===-1){for(let[v,P]of s)s.set(v,{...P,rowIndex:P.rowIndex+1});a=[[],...a],R=0,S=Y,O=y(S)}let k=Math.min(w,O),L=Math.max(x,O+f);a[R].push({left:k,right:L},...T),s.set(u.id,{rowIndex:R,labelBox:{x:O,y:0,width:f,height:12},labelSide:S})}return{placements:s,rowCount:a.length}}function Ix(e,t){let n=[];for(let r of e){let i=t.placedItems.get(r),o=t.entityRightEdges.get(r);if(o===void 0)continue;let s=i?yx(i,t.bandScale.bandwidth()):void 0;if(!i&&t.waves?.plan.index.has(r)){n.push({ref:r,endX:o,y:s,flowKey:`wave:${r}`,wave:r});continue}let a=t.itemFlowKey.get(r)??`marker:${r}`;if(!i&&t.markerIds.has(r)){n.push({ref:r,endX:o,y:s,marker:!0,flowKey:a});continue}n.push({ref:r,endX:o,y:s,flowKey:a})}return n}function Rx(e){let t=new Map;for(let n of e){let r=t.get(n.flowKey);(!r||n.endX>r.endX)&&t.set(n.flowKey,n)}return Array.from(t.values())}function iW(e,t){return Math.abs(t-e.endX)<=12}function YS(e,t){return e.endX>=t||e.wave!==void 0?null:e.y!==void 0?{x:e.endX,y:e.y}:e.marker&&!iW(e,t)?{x:e.endX,marker:e.ref}:null}function oW(e){let t=null;for(let n of e)n.wave===void 0&&(!t||n.endX>t.endX)&&(t=n);return t}function sW(e,t){let n;for(let r of e)r.wave===void 0||r.endX-t<Ot||(!n||r.endX>n.endX)&&(n=r);return n}var Sx=class{constructor(t,n){M(this,"id");M(this,"milestone");this.id=t,this.milestone=n}place(t){let n=this.milestone,r=Se("milestone",n.properties,t.styleCtx),i=ie(n.properties,"date"),o=Be(n.properties,"after"),s=_e(i),a=t.timeline.markerRow.y,l=6,c=n.title??this.id,u=null,f=a,d=!1,p,m=!1,g,w;if(s){let _=t.scale.forwardWithinDomain(s);if(_===null)return null;u=_,d=!0;let T=t.markerRowPlacements.get(this.id);T&&(f=T.centerY);let I=Ix(o,t),B=Rx(I),$=oW(B),X=sW(B,_);w=X?.wave;let Y=Math.max($&&$.endX>_?$.endX:_,X?.endX??_);Y>_&&(m=!0,Y-_>12&&(g=Y))}else if(o.length>0){let _=Ix(o,t),T=Rx(_);T.sort(($,X)=>X.endX-$.endX);let I=T[0]?.endX??t.timeline.originX;u=I,d=!1;let B=[];for(let $=1;$<T.length;$++){let X=YS(T[$],I);X&&B.push(X)}B.length>0&&(p=B)}if(u===null)return null;let x={x:u,y:f};t.entityLeftEdges.set(this.id,x.x),t.entityRightEdges.set(this.id,x.x),t.entityMidpoints.set(this.id,x);let y={id:this.id,title:c,x:u,radius:l,fixed:d,slackArrows:p,isOverrun:m,style:r,cutTopY:t.chartTopY,cutBottomY:t.swimlaneBottomY};g!==void 0&&(y.slipX=g);let E=g??u;return t.waves&&(g!==void 0||!m)&&NS(t.waves,E)&&(y.onWaveBoundary=!0),w!==void 0&&s&&(y.overrunByWave=w,y.overrunDate=vi(s)),s&&!t.scale.showsNonWorking&&!t.calendar.isWorkingDay(s)&&(y.hiddenDate=vi(s)),y}};function rp(e,t){let n=[];for(let[r,i]of e){let o=new Sx(r,i).place(t);o&&n.push(o)}return n}function ip(e,t){let n=r=>{let i=t.get(r);if(!i)throw new Error(`layout: marker "${r}" has no marker-row placement`);return i};return e.map(r=>{let i=n(r.id),o={id:r.id,title:r.title,center:{x:r.x,y:i.centerY},radius:r.radius,fixed:r.fixed,slackArrows:r.slackArrows?.map(s=>"y"in s?{x:s.x,y:s.y}:{x:s.x,y:n(s.marker).centerY}),isOverrun:r.isOverrun,style:r.style,cutTopY:r.cutTopY,cutBottomY:r.cutBottomY,labelBox:i.labelBox,labelSide:i.labelSide};return r.slipX!==void 0&&(o.slip={x:r.slipX}),r.onWaveBoundary&&(o.onWaveBoundary=!0),r.overrunByWave!==void 0&&(o.overrunByWave=r.overrunByWave),r.overrunDate!==void 0&&(o.overrunDate=r.overrunDate),r.hiddenDate!==void 0&&(o.hiddenDate=r.hiddenDate),o})}function VS(e,t){let n=[];for(let[r,i]of e){if(_e(ie(i.properties,"date")))continue;let o=Ix(Be(i.properties,"after"),t),s=Rx(o);if(s.length===0)continue;s.sort((l,c)=>c.endX-l.endX);let a=s[0].endX;for(let l=1;l<s.length;l++){let c=s[l],u=YS(c,a);u&&"y"in u&&n.push({xStart:c.endX,xEnd:a,y:u.y,slackPredId:c.ref,milestoneId:r})}}return n}var Gl=16,aW=8,lW=6;function qS(e,t,n,r,i,o){bx(e.content.anchors,t);let s=rp(e.content.milestones,t),a=cW(e.content.anchors,s,t);if(a.length===0)return{anchors:[],milestones:[],laneShift:0};let l=Gl,c=Ls(a,l,Bi(a,l,o-Gl,se),se,np(s)),u=n+aW,f=u+c.rowCount*26+lW-r,d=i+f,p=Ns(c.placements,u);t.markerRowPlacements=p,t.chartTopY=r+f,t.swimlaneBottomY=d;let m=Md(e.content.anchors,t,new Set),g=ip(s.map(w=>({...w,cutTopY:t.chartTopY,cutBottomY:d,slackArrows:w.slackArrows?.map(x=>"y"in x?{x:x.x,y:x.y+f}:x)})),p);return{anchors:m,milestones:g,laneShift:f}}function ZS(e,t){let n=[...(e.anchors??[]).map(i=>KS(i,!1)),...(e.milestones??[]).map(i=>KS(i,!0))];return n.length===0?t:Bi(n,e.box.x+Gl,t-Gl,se)+Gl}function JS(e){let t=0;for(let n of[...e.anchors??[],...e.milestones??[]])t=Math.max(t,n.labelBox.x+n.labelBox.width);return t}function cW(e,t,n){let r=Ul(e,new Map,n.scale),i=o=>({id:o.id,centerX:o.slipX??o.x,radius:o.radius,title:o.title,fontSize:10,bold:!0,...o.slipX!==void 0?{slipFromX:o.x}:{}});return r.push(...t.filter(o=>o.fixed).map(i)),r.push(...t.filter(o=>!o.fixed).map(i)),r}function KS(e,t){let n="slip"in e?e.slip?.x:void 0;return{id:e.id??"",centerX:n??e.center.x,radius:e.radius,title:e.title,fontSize:10,bold:t,...n!==void 0?{slipFromX:e.center.x}:{}}}function bx(e,t){for(let n of Ul(e,new Map,t.scale))t.entityLeftEdges.set(n.id,n.centerX),t.entityRightEdges.set(n.id,n.centerX)}var uW=.8,fW=1;function dW(e){let t=[];return eb(e,t),t}function eb(e,t){for(let n of e)if(n.kind==="item"){let r=pW(n);r>0&&n.box.width>0&&t.push({startX:n.box.x,endX:n.box.x+n.box.width,load:r})}else(n.kind==="parallel"||n.kind==="group")&&eb(n.children,t)}function pW(e){return e.capacity?e.capacity.value:e.size?1:0}function tb(e){if(e.capacityValue<=0||e.warnFraction===null&&e.overFraction===null)return null;let t=dW(e.children);if(t.length===0)return null;let n=new Set;for(let s of t)n.add(s.startX),n.add(s.endX);let r=Array.from(n).sort((s,a)=>s-a);if(r.length<2)return null;let i=[];for(let s=0;s<r.length-1;s++){let a=r[s],l=r[s+1],c=(a+l)/2,u=0;for(let f of t)f.startX<=c&&c<f.endX&&(u+=f.load);i.push({startX:a,endX:l,load:u,classification:hW(u,e.capacityValue,e.warnFraction,e.overFraction)})}let o=[];for(let s of i){let a=o[o.length-1];a&&a.classification===s.classification&&a.endX===s.startX?a.endX=s.endX:o.push({...s})}return{segments:o,capacityValue:e.capacityValue,warnFraction:e.warnFraction,overFraction:e.overFraction}}function hW(e,t,n,r){let i=e/t;return r!==null&&i>=r?"red":n!==null&&i>=n?"yellow":"green"}function nb(e,t){let n=t.get("swimlane"),r=QS(ie(e.properties,"utilization-warn-at"),n?ie(n.properties,"utilization-warn-at"):void 0,uW),i=QS(ie(e.properties,"utilization-over-at"),n?ie(n.properties,"utilization-over-at"):void 0,fW);return{warn:r,over:i}}function QS(e,t,n){let i=yW(e??t);return i.kind==="unset"?n:i.kind==="none"?null:i.value}var mW=/^\d+(?:\.\d+)?%$/,gW=/^\d+\.\d+$/;function yW(e){if(e===void 0)return{kind:"unset"};if(e==="none")return{kind:"none"};if(mW.test(e)){let t=parseFloat(e)/100;return Number.isFinite(t)&&t>0?{kind:"number",value:t}:{kind:"unset"}}if(gW.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?{kind:"number",value:t}:{kind:"unset"}}return{kind:"unset"}}var op=class{constructor(t){M(this,"rows");M(this,"opts");M(this,"paintedRightX");this.opts=t,this.paintedRightX=t.laneLeftX,this.rows=[{y:t.originY,height:t.minRowHeight,rightEdge:t.laneLeftX,spillX:t.laneLeftX,contentOffsetY:0}]}placeItem(t){let n=this.rows[this.rows.length-1],i=t.desiredStart>=n.rightEdge&&t.desiredStart>=n.spillX&&!this.rowIntersectsCorridor(n,t)&&!this.rowCrossesOwnCorridor(n,t)?n:this.appendRow(Math.max(this.opts.minRowHeight,t.predictedHeight));return{rowIndex:this.rows.length-1,y:i.y+i.contentOffsetY}}placeBlock(){let t=this.rows[this.rows.length-1];if(t.rightEdge>this.opts.laneLeftX){let n=this.appendRow(this.opts.minRowHeight);return{rowIndex:this.rows.length-1,y:n.y}}return{rowIndex:this.rows.length-1,y:t.y}}commitItem(t){let n=this.rows[t.rowIndex];n.height=Math.max(n.height,n.contentOffsetY+Math.max(t.placed.box.height,t.rowHeight??0)),n.rightEdge=t.logicalEnd,n.spillX=t.spillReservation??this.opts.laneLeftX}commitBlock(t){let n=this.rows[t.rowIndex];n.height=Math.max(n.height,t.blockHeight),n.contentOffsetY=t.contentOffsetY??0,n.rightEdge=t.blockEnd,n.spillX=t.spillReservation??this.opts.laneLeftX,t.paintedRight!==void 0&&t.paintedRight>this.paintedRightX&&(this.paintedRightX=t.paintedRight)}usedHeight(){let t=this.rows[this.rows.length-1];return t.y+t.height-this.opts.originY}usedRightX(){let t=this.paintedRightX;for(let n of this.rows)n.rightEdge>t&&(t=n.rightEdge),n.spillX>t&&(t=n.spillX);return t}rowIntersectsCorridor(t,n){return this.opts.slackCorridors.some(r=>r.y>=t.y&&r.y<t.y+t.height&&n.desiredStart<r.xEnd&&n.desiredEnd>r.xStart&&r.slackPredId!==n.childId&&!n.pendingIds?.has(r.slackPredId))}rowCrossesOwnCorridor(t,n){return this.opts.slackCorridors.some(r=>r.slackPredId===n.childId&&r.xStart<n.desiredStart&&t.rightEdge>Math.max(r.xStart,this.opts.laneLeftX))}appendRow(t){let n=this.rows[this.rows.length-1],r={y:n.y+n.height,height:t,rightEdge:this.opts.laneLeftX,spillX:this.opts.laneLeftX,contentOffsetY:0};return this.rows.push(r),r}};function Nx(e){return Ve(e)?e.name?[e.name]:[]:_t(e).flatMap(Nx)}function sp(e,t,n,r){let i=n.bandScale.step(),o=t.leftX,s=new op({laneLeftX:o,originY:t.firstRowY,minRowHeight:i,slackCorridors:n.slackCorridors}),a=o,l=Number.POSITIVE_INFINITY,c=new Set(_t(e).flatMap(Nx)),u=[];for(let f of _t(e)){for(let $ of Nx(f))c.delete($);if(!Ve(f)){let $=Bl(f,a,n),{rowIndex:X,y:Y}=s.placeBlock(),D=Xl($,Y),R=r.sequenceOne(f,D,n);u.push(R);let S=R.box.x+R.box.width,O=Math.max(i,D.height),k=ib(R);s.commitBlock({rowIndex:X,placed:R,blockHeight:O,blockEnd:S,contentOffsetY:xW(R),spillReservation:k>S?k:null,paintedRight:Fl(R)}),l=Math.min(l,D.startX),a=Math.max(a,D.x);continue}let d=f,p=Bl(d,a,n),m=n.scale.startX(p),g=qd(d,m,n),w=m+g.naturalWidth,x=i+g.barExtra,{rowIndex:y,y:E}=s.placeItem({childId:d.name??"",desiredStart:m,desiredEnd:w,predictedHeight:x,pendingIds:c}),_=Xl(p,E),T=Zd(d,_,n,g);u.push(T),l=Math.min(l,_.startX);let I=Math.max(m+g.naturalWidth,T.box.x+T.box.width),B=m+bs(n,m,g.durationDays);a=Math.max(a,B),s.commitItem({rowIndex:y,placed:T,logicalEnd:I,spillReservation:rb(T),rowHeight:x})}return l===Number.POSITIVE_INFINITY&&(l=n.scale.startX(o)),{children:u,timeCursorX:a,timeStartX:l,packer:s}}function xW(e){return e.kind==="item"?0:(e.children[0]?.box.y??e.box.y)-e.box.y}function rb(e){return e.textSpills||e.chipsOutside||e.dotSpills||e.iconSpills||e.footnoteSpills?Math.max(e.decorationsRightX,e.chipsOutside?e.chipsRightX:0)+6:null}function ib(e){let t=e.box.x+e.box.width;if(e.kind==="item")return Math.max(t,rb(e)??t);let n=Es(e);return Math.max(t,n>t?n+Lk:t,...e.children.map(ib))}var Lx=10;function EW(e,t,n){let r=ie(e.properties,"capacity"),i=Lr(r);if(i===null)return{capacity:null,badgeWidthPx:0};let o=el(i),s=tl(t.capacityIcon,n),a=nl(o,s,Lx),l=rl(o,s,Lx);return{capacity:{value:i,text:o,icon:s,...l!==void 0?{iconDxTerms:l}:{}},badgeWidthPx:a}}var wW=10,TW=38,vW=8;function _W(e,t){let n=ie(e.properties,"owner");if(!n)return;let r=t.teams.get(n);if(r)return{text:r.title??n,kind:"team"};let i=t.persons.get(n);return i?{text:i.title??n,kind:"person"}:{text:n,kind:"team"}}function AW(e,t){if(!e.name)return[];let n=[];for(let[r,i]of t.footnoteHosts.entries())if(i.includes(e.name)){let o=t.footnoteIndex.get(r);o!==void 0&&n.push(o)}return n.sort((r,i)=>r-i),n}function kW(e,t,n){for(let r of e.content)if(r.$type!=="DescriptionDirective")return n.scale.startX(Bl(r,t,n))}var Ps=class{constructor(t,n){M(this,"input");M(this,"helpers");this.input=t,this.helpers=n}get id(){return this.input.lane.name??""}place(t,n){let{lane:r,bandIndex:i}=this.input,{helpers:o}=this,s=Se("swimlane",r.properties,n.styleCtx),a=t.x,l=n.bandScale.step(),c=n.currentFlowKey;n.currentFlowKey=`lane:${r.name??i}`;let{capacity:u,badgeWidthPx:f}=EW(r,s,n.symbols),d=AW(r,n),p=d.length>0?se(d.join(","),Lx):0,m=0,g=_W(r,n),w=r.title??r.name??"",x=w?Ry(m,w,g?.text,f,p):null,y=x?.rightX??0,E=kW(r,a,n),_=!r.title||E===void 0||E>=y+vW,T=t.y+(_?wW:TW),I=sp(r,{leftX:a,firstRowY:T},n,o),{children:B}=I,$=T-t.y,X=Math.max(l+32,$+I.packer.usedHeight()+16),Y=Math.max(I.packer.usedRightX(),y),D={x:m,y:t.y,width:0,height:X},R=u?(()=>{let{warn:S,over:O}=nb(r,n.styleCtx.defaults);return tb({children:B,capacityValue:u.value,warnFraction:S,overFraction:O})})():null;return n.currentFlowKey=c,{positioned:{id:r.name,title:w,box:D,bandIndex:i,children:B,nested:[],style:s,owner:g?.text,ownerKind:g?.kind,footnoteIndicators:d,capacity:u,tab:x,utilization:R},usedHeight:X,usedRightX:Y}}};var IW=18,RW=14,SW=14,bW=16,NW=24;function Px(e,t,n,r,i){let o=n+IW,s=[],a=[],l=!0,c=t.footnoteIndex.size;for(let u of e){l||(o+=bW),l=!1;let f=u.content.roadmap?.title??u.sourcePath,d=o+RW,p=zd(u,{theme:t.styleCtx.theme,cal:t.cal,schedule:t.schedule,timeline:t.timeline,scale:t.scale,calendar:t.calendar,axisColumns:t.axisColumns,bandScale:t.bandScale,waves:t.waves},{chartTopY:d,chartBottomY:d,swimlaneBottomY:d},{footnotes:Qd(u.content.footnotes,c)});c+=u.content.footnotes.size,t.waves?Ud(t.waves,p.entityLeftEdges,p.entityRightEdges):bx(u.content.anchors,p);let m=[],g=d,w=0;for(let I of u.content.swimlanes.values()){p.nextParallelId=0,p.nextGroupId=0;let{positioned:B,usedHeight:$}=new Ps({lane:I,bandIndex:w},r).place({x:p.timeline.originX,y:g},p);m.push(B),g+=$,w++}let x=qS(u,p,o,d,g,i);if(x.laneShift!==0){for(let I of m)Rs(I,x.laneShift);g+=x.laneShift}let y=g,E=Math.max(t.bandScale.bandwidth(),y-o+SW),_={x:0,y:o,width:0,height:E},T={sourcePath:u.sourcePath,label:f,box:_,nestedSwimlanes:m,style:Se("swimlane",[],t.styleCtx)};x.anchors.length>0&&(T.anchors=x.anchors),x.milestones.length>0&&(T.milestones=x.milestones),s.push(T),a.push(p),o+=E}return{regions:s,contexts:a,endY:o}}function ob(e,t,n){let r=Hl(e,t,n);e.box.width=r;for(let i of e.nestedSwimlanes)i.box.width=r}function Hl(e,t,n){let r=e.box.x,{chromeRightX:i}=vl(r,e.label,e.sourcePath),o=Xr(e.nestedSwimlanes),s=Math.max(i,o,JS(e),n)+NW;return Math.min(t-r,s-r)}function sb(e,t,n,r){if(!e)return null;let i=t.scale.forwardWithinDomain(e);if(i===null)return null;let o=t.timeline.box.y,s=t.timeline.tickPanelY,a=Yn(n).nowLabel,l=se(a,gl),c=Math.max(Qg,Math.ceil(l+2*ms)),u=t.timeline.originX-It,f=c/2,d;i-f<u?d="flag-right":i+f>r?d="flag-left":d="center";let p=t.timeline.bottomTickPanelY,m=t.timeline.bottomTickPanelHeight??0,g=p!==void 0&&m>0?p+m:t.swimlaneBottomY;return{x:i,topY:s,bottomY:g,pillTopY:o,pillMode:d,label:a,pillWidth:c,style:Se("item",[],t.styleCtx)}}function ap(e){let t=e.trim().replace(/^#/,"");if(t.length===3&&(t=t.split("").map(n=>n+n).join("")),!/^[0-9a-fA-F]{6}$/.test(t))throw new Error(`Unsupported hex colour: ${e}`);return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function ab(e){let[t,n,r]=ap(e).map(i=>{let o=i/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function lp(e,t){let n=ab(e),r=ab(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var LW=4.5;function ub(e,t,n,r,i){if(!e.frozen||!e.solve)throw new Error("buildWaves: the wave barrier has not settled");let o=Xd(e.plan,e.solve,e.pass,e.origin,e.floors,Ot),s=o.every(y=>y.memberCount===0),a=t.timeline.waveStrip??{y:t.timeline.tickPanelY+t.timeline.tickPanelHeight,height:0};if(!t.timeline.waveStrip&&!s)throw new Error("buildWaves: the timeline has no wave strip");let l=t.timeline.box.x,c=l+t.timeline.box.width,u=a.y+ld,f=a.height-2*ld,d=0,p=o.map((y,E)=>{let _=e.plan.waves[E],T=_.title??y.id,I=y.memberCount===0,B=Gd(y.start,t),$=LS(y.start,y.end,t),X=I?void 0:d++,Y=OW(y.id,t),D=CW(_.properties,X,t),R=Math.max(y.start,l),S=Math.min(y.end,c),O=Math.max(0,S-R),k=St(e.plan.floors[E]?.ref!==void 0?[e.plan.floors[E].ref]:[]),L=k!==void 0&&O>=cl+pt+Gn,v=L?pt+nn:0,P,b=!1;if(!I){if(Y.length>0){let K=Y.length*Ut;P=lb(T,y.id,E+1,O,K+v),b=P!==void 0}P??(P=lb(T,y.id,E+1,O,v))}let F=I?y.start:(R+S)/2,j=I?Ox(B):`${Ox(B)} \u2013 ${Ox($)}`,U=[T,j];I?U.push(n.waveNoItems):y.heldBy!==void 0&&U.push(`${n.waveHeldBy} ${y.heldBy}`);let ee,V=o[E-1];if(!s&&V!==void 0&&y.floorRef!==void 0&&y.start-V.end>Ot){let K=Math.max(V.end,l),q=Math.min(y.start,c),J=se(y.floorRef,Un);if(J+2*Gn<=q-K){let re=(K+q)/2,le=J+2*ys;ee={text:y.floorRef,x:re,halo:{x:re-le/2,y:u,width:le,height:f}}}}let ne={x:y.start,y:a.y,width:y.end-y.start,height:a.height},A=I?void 0:PW(ne,t.timeline.box),C,W,G;if(A){L&&k!==void 0&&(G={side:"after",isoDate:k,glyphTopLeft:{x:A.x+cl,y:a.y+(a.height-pt)/2},glyphSize:pt,spilled:!1});let K=A.x+A.width,q=b?Y.length*Ut:0;if(q){let J=K-Gn+ys,re=K-Gn-q-ys;W={rightX:K-Gn,halo:{x:re,y:u,width:J-re,height:f}}}if(P){let J=fb(P.label),re=q?Math.min(F,K-Gn-q-J/2):F,le=G?Math.max(re,G.glyphTopLeft.x+pt+nn+J/2):re,ce=J+2*ys;C={x:le,halo:{x:le-ce/2,y:u,width:ce,height:f}}}}return{id:y.id,title:T,index:E,...X!==void 0?{visibleOrdinal:X}:{},startX:y.start,endX:y.end,startDate:B,endDate:$,memberCount:y.memberCount,empty:I,...y.heldBy!==void 0?{heldBy:y.heldBy}:{},...y.floorRef!==void 0?{floorRef:y.floorRef}:{},columnBox:{x:y.start,y:t.chartTopY,width:y.end-y.start,height:t.swimlaneBottomY-t.chartTopY},strip:{box:{x:y.start,y:a.y,width:y.end-y.start,height:a.height},...P?{label:P.label}:{},labelKind:P?.kind??"none",labelX:F,...A?{cell:A}:{},...C?{labelDraw:C}:{},...G?{inlineDatePin:G}:{},...W?{superscripts:W}:{},tooltip:U.join(" \xB7 "),footnotesShown:b,...ee?{gapLabel:ee}:{}},style:D,footnoteIndicators:Y}}),m=s?[]:MW(p,e.origin,a.y,t),g=Cx(r),w=i.map(y=>Cx(y.nestedSwimlanes));return{waves:p,boundaries:m,crossings:cb(g,m),regionCrossings:w.map(y=>cb(y,m)),hasBackground:g.length+w.flat().length>0}}function PW(e,t){let n=bi,r={x:e.x,y:e.y+n,width:e.width,height:e.height-2*n},i={x:t.x+n,y:e.y,width:t.width-2*n,height:e.height},o=Math.max(r.x,i.x),s=Math.max(r.y,i.y),a=Math.min(r.x+r.width,i.x+i.width),l=Math.min(r.y+r.height,i.y+i.height);if(!(a<=o||l<=s))return{x:o,y:s,width:a-o,height:l-s}}function fb(e){return se(e,Un)*1.05}function lb(e,t,n,r,i){let o=a=>fb(a)+i+2*Gn<=r;if(o(e))return{kind:"title",label:e};if(t!==e&&o(t))return{kind:"id",label:t};for(let a=e.length-1;a>=3;a--){let l=e.slice(0,a).trimEnd();if(l.length<3)break;let c=`${l}\u2026`;if(o(c))return{kind:"ellipsis",label:c}}let s=`#${n}`;if(o(s))return{kind:"ordinal",label:s}}function OW(e,t){let n=[];for(let[r,i]of t.footnoteHosts.entries()){if(!i.includes(e))continue;let o=t.footnoteIndex.get(r);o!==void 0&&n.push(o)}return n.sort((r,i)=>r-i)}function CW(e,t,n){let r=n.styleCtx.theme,i=new Map,o=ie(e,"style"),s=o?n.styleCtx.styles.get(o):void 0;for(let d of s?.properties??[])i.set(Q(d),d.value);let a=d=>{let p=i.get(d);if(p===void 0)return;let m=Zn(p,r);return m==="none"?void 0:m},l=a("bg"),c=t!==void 0&&t%2===1?r.wave.stripFillAlt:r.wave.stripFill,u=l?$W(c,l,El)??c:c,f=i.get("border");return{...l?{tint:l}:{},stripFill:c,text:a("text")??DW(r.wave,u),boundary:a("fg")??r.wave.boundary,boundaryDash:f==="dashed"?"4 2":f==="dotted"?"1 2":null}}var cp=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function $W(e,t,n){if(!cp.test(e)||!cp.test(t))return;let r=ap(e),i=ap(t);return`#${r.map((o,s)=>Math.round(o*(1-n)+i[s]*n).toString(16).padStart(2,"0")).join("")}`}function DW(e,t){let n=e.labelText;return!cp.test(n)||!cp.test(t)||lp(n,t)>=LW?n:lp(e.hatch,t)>=lp(e.hatchOnDark,t)?e.hatch:e.hatchOnDark}function MW(e,t,n,r){let i=[];for(let a of e)a.empty||(i.push({x:a.startX,wave:a,opening:!0}),i.push({x:a.endX,wave:a,opening:!1}));i.sort((a,l)=>a.x-l.x);let o=[],s=0;for(;s<i.length;){let a=s;for(;a<i.length&&i[a].x-i[s].x<Ot;)a++;let l=i.slice(s,a);s=a;let c=l[0].x;if(Math.abs(c-t)<Ot)continue;let u=(l.find(f=>f.opening)??l[0]).wave;o.push({x:c,topY:n,bottomY:r.swimlaneBottomY,stroke:u.style.boundary,dash:u.style.boundaryDash})}return o}function Cx(e){let t=[],n=r=>{for(let i of r)i.kind==="item"?i.waveRole==="background"&&t.push(i):n(i.children)};for(let r of e)n(r.children),t.push(...Cx(r.nested));return t}function cb(e,t){let n=[];for(let r of e){let i=r.box.x,o=r.box.x+r.box.width;for(let s of t)i<s.x&&s.x<o&&n.push({x:s.x,topY:r.box.y,bottomY:r.box.y+r.box.height,stroke:s.stroke})}return n}function db(e,t,n,r){if(!e.hasBackground)return;let i=t.timeline.originX,o=n.waveLegendBackground,s=cd+xy,a=s+se(o,Un),l={kind:"background",text:o,swatch:{x:i,y:r+(sd-ud)/2,width:cd,height:ud},hatch:Hd(t.styleCtx.theme.entities.item.bg),runs:[{text:o,x:i+s,y:r+Ey}]};return{box:{x:i,y:r,width:a,height:sd},entries:[l]}}function Ox(e){return e.toISOString().slice(0,10)}var pb=1e-6,Os=class{constructor(t){M(this,"domain");M(this,"range");M(this,"pixelsPerDay");M(this,"calendar");M(this,"nonWorking");this.domain=t.domain,this.range=t.range,this.calendar=t.calendar,this.nonWorking=t.nonWorking??"hide";let n=Math.max(1,this.showsNonWorking?kt(t.domain[0],t.domain[1]):this.indexOf(t.domain[1]));this.pixelsPerDay=(t.range[1]-t.range[0])/n}get showsNonWorking(){return this.nonWorking==="show"&&this.calendar?.hasNonWorkingDays===!0}indexOf(t){return this.calendar?this.calendar.workingIndexOf(this.domain[0],t):kt(this.domain[0],t)}dayAt(t){let n=(t-this.range[0])/this.pixelsPerDay;return{days:n,day:Math.floor(n+pb)}}forward(t){return this.showsNonWorking?this.range[0]+kt(this.domain[0],t)*this.pixelsPerDay:this.range[0]+this.indexOf(t)*this.pixelsPerDay}forwardWithinDomain(t){return t<this.domain[0]||t>this.domain[1]?null:this.forward(t)}invert(t){let n=Math.round((t-this.range[0])/this.pixelsPerDay);return this.showsNonWorking?Xe(this.domain[0],n):this.calendar?this.calendar.dateAtWorkingIndex(this.domain[0],n):Xe(this.domain[0],n)}indexAtX(t){let{days:n,day:r}=this.dayAt(t);if(!this.showsNonWorking||!this.calendar)return n;let i=Xe(this.domain[0],r),o=this.calendar.workingIndexOf(this.domain[0],i);return this.calendar.isWorkingDay(i)?o+Math.max(0,n-r):o}startX(t){if(!this.showsNonWorking||!this.calendar)return t;let n=Xe(this.domain[0],this.dayAt(t).day);if(this.calendar.isWorkingDay(n))return t;let r=this.calendar.workingIndexOf(this.domain[0],n);return this.forward(this.calendar.dateAtWorkingIndex(this.domain[0],r))}advanceX(t,n){if(!this.showsNonWorking||!this.calendar)return t+n*this.pixelsPerDay;let r=this.startX(t);if(n<=0)return r;let i=this.indexAtX(r)+n,o=Math.ceil(i-pb)-1,s=i-o,a=this.calendar.dateAtWorkingIndex(this.domain[0],o);return this.forward(a)+s*this.pixelsPerDay}get originX(){return this.range[0]}get widthPx(){return this.range[1]-this.range[0]}};var up=6,BW=4,hb=8,dp=class{constructor(t){M(this,"input");this.input=t}measure(){let{title:t,author:n,style:r,logo:i}=this.input,o=r.headerPosition==="beside",s=WW(t,n,i),a=i?Math.max(ry,i.height+20):ry;return{position:r.headerPosition,titleLines:s.titleLines,authorLines:s.authorLines,cardWidth:s.cardWidth,cardHeight:s.cardHeight,textCardHeight:s.textCardHeight,logoSlot:s.logoSlot,...i?{logo:i}:{},chartLeftX:o?s.boxWidth:0,aboveHeight:a,chartTopY:o?hb:a+hb,minRowsBottomY:o?s.cardHeight+BW:0}}place(t,n){let{title:r,author:i,style:o}=this.input,s=t.position==="beside",a=s?{x:0,y:0,width:t.chartLeftX,height:n.chartBottomY}:{x:0,y:0,width:n.canvasRightX,height:t.aboveHeight},l=s?{x:up,y:n.rowsBottomY-t.cardHeight,width:t.cardWidth,height:t.cardHeight}:{x:0,y:0,width:n.canvasRightX,height:t.aboveHeight},c,u;return t.logo&&(c={box:{x:a.x+l.x+16,y:a.y+l.y+(l.height-t.logo.height)/2,width:t.logo.width,height:t.logo.height},assetRef:t.logo.assetRef,intrinsic:t.logo.intrinsic},u={x:t.logoSlot,y:Math.max(0,(l.height-t.textCardHeight)/2)}),{box:a,position:o.headerPosition,title:r,author:i,titleLines:t.titleLines,authorLines:t.authorLines,cardBox:l,logo:c,...u?{textInset:u}:{},style:o}}};function WW(e,t,n){let r=ny-32,i=Ti(e,r,16),o=Ti(t??"",r,11),s=0;for(let w of i)s=Math.max(s,se(w,16));for(let w of o)s=Math.max(s,se(w,11));let a=i.length>0||o.length>0,l=n?n.width+(a?12:0):0,c=s+32,u=Math.max(kk-up,Math.min(ny-up,c)+l),f=i.length>0?(i.length-1)*20:0,d=o.length>0?18+(o.length-1)*14:0,p=26+f+d+14,m=n?Math.max(p,n.height+20):p,g=u+up;return{titleLines:i,authorLines:o,cardWidth:u,cardHeight:m,textCardHeight:p,logoSlot:l,boxWidth:g}}function pp(e){for(let t of e.waves?.values()??[])if(t.memberCount>0)return!0;return!1}function zl(e,t,n={}){let r=Vf(e,t),{config:i,working:o}=r,s=us(t.content.sizes,i),a=ie(e.roadmapDecl?.properties??[],"start"),l=_e(a)??XW(n.today??new Date),c=S=>o.workingIndexOf(l,S),u=S=>o.dateAtWorkingIndex(l,S),f=(S,O)=>Yf(o,l,S,O),d=0,p=S=>{d=Math.max(d,S)},m=new Map,g=new Map,w=new Map,x=new Map,y=new WeakMap,E=new Map,_=new WeakMap,T=new Map;for(let[S,O]of t.content.anchors){let k=_e(ie(O.properties,"date"));if(k){let L=c(k);g.set(S,L),T.set(S,k),p(L)}}let I=()=>({itemEnd:m,anchorEnd:g,milestoneEnd:w,sizes:s,itemResults:x,inByNode:!0}),B=(S,O,k)=>{let L=b=>{if("date"in b)return c(b.date);let F=b.ref;return S.itemEnd.has(F)?S.itemEnd.get(F):S.anchorEnd.has(F)?S.anchorEnd.get(F):S.milestoneEnd.has(F)?S.milestoneEnd.get(F):0},v=(b,F)=>{let j=F;for(let U of _t(b))j=P(U,j),k(j);return j},P=(b,F)=>{if(Ve(b)){let j=qA(b.properties,S.sizes,i),{after:U}=Ur(b.properties),ee=U.length>0?Math.max(F,...U.map(L)):F;O&&(ee=O.apply(b,ee));let V=ee+j,ne={start:u(ee),end:f(ee,V),days:j};return S.inByNode&&y.set(b,ne),b.name&&(S.itemEnd.set(b.name,V),S.itemResults?.set(b.name,ne)),O?.accumulate(b,V),V}if(et(b)){let{after:j}=Ur(b.properties),U=j.length>0?Math.max(F,...j.map(L)):F;O&&(U=O.apply(b,U));let ee=U;for(let V of _t(b))ee=Math.max(ee,P(V,U));return b.name&&S.itemEnd.set(b.name,ee),ee}if($e(b)){let{after:j}=Ur(b.properties),U=j.length>0?Math.max(F,...j.map(L)):F;O&&(U=O.apply(b,U));let ee=v(b,U);return b.name&&S.itemEnd.set(b.name,ee),ee}return F};return{walkLane:v,resolveAfterDay:L}},$=(S,O)=>{let k=_e(ie(S.properties,"date"));if(k)return c(k);let{after:L}=Ur(S.properties);return L.length>0?Math.max(0,...L.map(O)):void 0},X=(S,O)=>{let k=new Map,L=new Map,v=new Map;for(let[F,j]of S.anchors){let U=_e(ie(j.properties,"date"));if(U){let ee=c(U);L.set(F,ee),p(ee)}}let{walkLane:P,resolveAfterDay:b}=B({itemEnd:k,anchorEnd:L,milestoneEnd:v,sizes:us(S.sizes,i),inByNode:O},void 0,p);for(let F of S.swimlanes.values())P(F,0);for(let[F,j]of S.milestones){let U=$(j,b);U!==void 0&&(v.set(F,U),p(U))}for(let F of S.isolatedRegions)X(F.content,!1)},Y=n.plan!==void 0?n.plan??void 0:Di(t),D;if(Y){let S=Y.waves.map(b=>b.name),O=AS(Y,l,o),k,L=0,v=b=>{L=Math.max(L,b)},P=Wd(S.length,0,O,(b,F)=>{let j=S.map((V,ne)=>[V,F[ne]]);m=new Map(j),x=new Map,y=new WeakMap,L=0;let U=new Fi(Y,b),{walkLane:ee}=B(I(),U,v);for(let V of t.content.swimlanes.values())ee(V,0);for(let V of t.content.isolatedRegions){let ne=B({itemEnd:new Map(j),anchorEnd:new Map,milestoneEnd:new Map,sizes:us(V.content.sizes,i),inByNode:!0},U,v);for(let A of V.content.swimlanes.values())ne.walkLane(A,0)}return k=U,U});p(Math.max(L,...P.S,...P.E.slice(-1))),D=new Map;for(let b of Xd(Y,P,k,0,O))D.set(b.id,{index:b.index,start:u(b.start),end:f(b.start,b.end),memberCount:b.memberCount,...b.heldBy!==void 0?{heldBy:b.heldBy}:{},...b.floorRef!==void 0?{floorRef:b.floorRef}:{}})}else{let{walkLane:S}=B(I(),void 0,p);for(let O of t.content.swimlanes.values())S(O,0)}let{resolveAfterDay:R}=B(I(),void 0,p);for(let[S,O]of t.content.milestones){let k=$(O,R);if(k===void 0)continue;let L=_e(ie(O.properties,"date"))??u(k);w.set(S,k),E.set(S,L),_.set(O,L),p(k)}if(!Y)for(let S of t.content.isolatedRegions)X(S.content,!0);return{startDate:l,calendar:r,items:x,byNode:y,milestones:E,milestoneByNode:_,anchors:T,...D?{waves:D}:{},...Y?{plan:Y}:{},resolved:t,extent:{contentEndDay:d}}}function XW(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))}var UW=8;function yb(e,t,n,r,i){let{locale:o,styleCtx:s}=r,{calendar:a,preset:l,startDate:c,timelineDays:u,nonWorking:f}=i,d=i.naturalEndDate,p=pp(i.schedule)?i.schedule.plan:void 0,m=r.roadmapStyle,g=fl[m.headerHeight]??fl.md,w=g>0&&m.timelinePosition!=="bottom",x=g>0&&(m.timelinePosition==="bottom"||m.timelinePosition==="both"),y=e.roadmapDecl?.title??e.roadmapDecl?.name??"",E=ie(e.roadmapDecl?.properties??[],"author"),_=new dp({title:y,author:E,style:m,logo:Gk(e,n.logo)}),T=_.measure(),{chartLeftX:I}=T,B=mk({naturalPixelsPerDay:l.pixelsPerUnit/a.daysPerUnit(l.unit),dayCount:u,chromeWidth:I+2*It,maxWidth:n.width}),$=u*B,X=I+It,Y=$,R=n.today!==void 0&&n.today>=c&&n.today<=d?Gt:0,S=w?g:0,O=p?fy:0,k=new Os({domain:[c,d],range:[X,X+$],calendar:a,nonWorking:f}),L=tp(dx(k,[],l.unit,!1),px(k)),v=t.content.anchors.size+t.content.milestones.size>0||L.length>0,P=X+Y+It,b=Ul(t.content.anchors,t.content.milestones,k),F=[...b,...L],j=Ls(F,I,Bi(F,I,P,se),se),U=v?Math.max(1,j.rowCount):0,ee=U*26,V=R+S+O+ee,ne=V+UW,A=Bx(T,V),C=A+R,W=C+S,G=W+O,K=Dd(k,l,a,o),q={box:{x:X,y:A,width:$,height:0},ticks:K,pixelsPerDay:B,originX:X,startDate:c,endDate:d,labelStyle:Se("roadmap",[],s),pillRowHeight:R,tickPanelY:C,tickPanelHeight:S,markerRow:{y:G+13,height:ee,collisionY:G-8},minorGrid:m.minorGrid,...p?{waveStrip:{y:W,height:O}}:{}};return Wx(q,k,l.unit),{header:T,headerNode:_,axis:{originX:X,ppd:B,naturalWidth:$,scale:k},naturalChartRightX:P,bands:{timelineY:A,pillRowHeight:R,tickPanelY:C,tickPanelHeight:S,waveStripY:W,markerRowY:G,estimatedMarkerRows:U,rowsHeight:V,chartTopY:A+ne,bottomTickPanelHeight:x?g:0},timeline:q,markers:{datePinned:b,placements:Ns(j.placements,G),hasEntities:v}}}function Bx(e,t){return Math.max(e.chartTopY,e.minRowsBottomY-t)}function Wx(e,t,n){let r=dx(t,e.ticks,n,e.minorGrid);r&&(e.nonWorkingDisplay=t.showsNonWorking?"show":"hide",e.nonWorking=r);let i=px(t);i&&(e.workingExceptions=i)}var xb=8,Xx=class{constructor(t){M(this,"rightX");M(this,"frozen",!1);this.rightX=t}grow(t){if(this.frozen)throw new Error("layout: the canvas grew after it was frozen");return t<=this.rightX?!1:(this.rightX=t,!0)}freeze(){this.frozen=!0}get provisional(){return this.rightX}get final(){if(!this.frozen)throw new Error("layout: the canvas was read before it was final");return this.rightX}},GW;var hp=class{constructor(t,n,r,i,o,s,a){M(this,"file");M(this,"resolved");M(this,"options");M(this,"scope");M(this,"window");M(this,"measured");M(this,"chart");M(this,"canvas");M(this,"chartY");M(this,"draft",{});M(this,"scaleIsFinal",!1);M(this,"band");M(this,"rowsTop");M(this,"rowsBottom");M(this,"why");this.file=t,this.resolved=n,this.options=r,this.scope=i,this.window=o,this.measured=s,this.chart=a,this.canvas=new Xx(s.naturalChartRightX);let l=a.ctx;this.chartY={get top(){return l.chartTopY},set top(c){l.chartTopY=c},get swimlaneBottom(){return l.swimlaneBottomY},set swimlaneBottom(c){l.swimlaneBottomY=c},get bottom(){return l.chartBottomY},set bottom(c){l.chartBottomY=c}}}get ctx(){return this.chart.ctx}get scale(){return this.chart.ctx.scale}finalScale(){if(!this.scaleIsFinal)throw new Error("layout: the final scale was read before the timeline extension");return this.chart.ctx.scale}extendScale(t){if(this.scaleIsFinal)throw new Error("layout: the scale was extended after it was final");this.chart.ctx.scale=t}settleScale(){this.scaleIsFinal=!0}markerBand(){if(!this.band)throw new Error("layout: the marker band was read before the final pack");return this.band}setMarkerBand(t){if(this.band)throw new Error("layout: the marker band was packed twice");this.band=t,this.chart.ctx.markerRowPlacements=t.placements}headerRowsTop(){return this.rowsTop||(this.rowsTop=HW(this.measured,this.options.today,this.finalScale())),this.rowsTop}headerRowsBottom(){if(this.rowsBottom===void 0)throw new Error("layout: the header rows bottom was read before the rows grew");return this.rowsBottom}setHeaderRowsBottom(t){if(this.rowsBottom!==void 0)throw new Error("layout: the header rows grew twice");this.rowsBottom=t}explain(t){this.why=t}report(t,n){GW?.(t,n,this.why),this.why=void 0}};function HW(e,t,n){let{bands:r,header:i}=e;if(!(r.pillRowHeight===0&&t!==void 0&&n.forwardWithinDomain(t)!==null))return{timelineY:r.timelineY,pillRowHeight:r.pillRowHeight,tickPanelY:r.tickPanelY,markerRowY:r.markerRowY,shift:0};let s=Bx(i,Gt+r.rowsHeight),a=s+Gt,l=a-r.tickPanelY;return{timelineY:s,pillRowHeight:Gt,tickPanelY:a,markerRowY:r.markerRowY+l,shift:l}}function zW(e){return e.canvas.grow(e.chart.maxRightX+It)}function jW(e){let{swimlanes:t,includes:n,milestones:r}=e.chart,{calendar:i,preset:o,startDate:s,spanDays:a,nonWorking:l}=e.window,{originX:c,ppd:u}=e.measured.axis,f=e.measured.timeline,d=Xr(t);for(let I of n)d=Math.max(d,Xr(I.nestedSwimlanes));let p=0;for(let I of e.measured.markers.datePinned)p=Math.max(p,I.centerX+I.radius);let m=0;for(let I of r)I.fixed?p=Math.max(p,I.x+I.radius):m=Math.max(m,I.x+I.radius);for(let I of n){for(let B of I.anchors??[])p=Math.max(p,B.center.x+B.radius);for(let B of I.milestones??[])B.fixed?p=Math.max(p,B.center.x+B.radius):m=Math.max(m,B.center.x+B.radius)}let g=Math.max(d,p,m),w=i.daysPerUnit(o.unit),x=e.scale.showsNonWorking?e.scale.indexAtX(g):(g-c)/u,y=x>0?Mi(s,x,o.unit,w,i):0,E=Ss(t);for(let I of n)E=Math.max(E,Ss(I.nestedSwimlanes));let _=new Is(e.window,e.scale);if(E>0){let I=Math.max(a,y);_.isPast(E,I)&&(y=Math.max(y,Math.min(_.boundaryAtOrAfterX(E),_.captionLimit(I))))}let T=!1;if(y>a){let I={bar:d,caption:E,datedMarker:p,afterMilestone:m};e.explain(Object.keys(I).filter(Y=>I[Y]>0&&_.isPast(I[Y],a)));let B=i.dateAtWorkingIndex(s,y),$=e.scale.showsNonWorking?kt(s,B)*u:y*u,X=new Os({domain:[s,B],range:[c,c+$],calendar:i,nonWorking:l});e.extendScale(X),f.endDate=B,f.box.width=$,f.ticks=Dd(X,o,i,e.scope.locale),Wx(f,X,o.unit),e.canvas.grow(c+$+It),T=!0}return e.settleScale(),T}function YW(e){let t=e.measured.timeline,n=new Map;for(let l of e.chart.milestones)l.slipX!==void 0&&n.set(l.id,l.slipX);let r=e.measured.markers.datePinned.map(l=>{let c=l.isMilestone?n.get(l.id):void 0;return{id:l.id,centerX:c??l.centerX,radius:l.radius,title:l.title,fontSize:l.fontSize,bold:l.bold,...c!==void 0?{slipFromX:l.centerX}:{}}});for(let l of e.chart.milestones)l.fixed||r.push({id:l.id,centerX:l.x,radius:l.radius,title:l.title,fontSize:10,bold:!0});let i=tp(t.nonWorking,t.workingExceptions);r.push(...i),e.draft.markerEntries={all:r,calendarCount:i.length};let o=Bi(r,e.measured.header.chartLeftX,e.canvas.provisional,se),s=Eb(e,e.draft.markerEntries);for(let l of e.chart.includes)o=Math.max(o,ZS(l,e.canvas.provisional)),o=Math.max(o,l.box.x+Hl(l,Number.POSITIVE_INFINITY,s));let a=e.canvas.grow(o);return e.canvas.freeze(),a}function Eb(e,t){let{swimlanes:n,includes:r}=e.chart,i=Math.max(Xr(n),Ss(n));for(let s of r){i=Math.max(i,Xr(s.nestedSwimlanes),Ss(s.nestedSwimlanes));for(let a of[...s.anchors??[],...s.milestones??[]])i=Math.max(i,a.labelBox.x+a.labelBox.width)}if(t){let s=t.all.slice(0,t.all.length-t.calendarCount);for(let a of s){let l=se(a.title,a.fontSize)*(a.bold?1.05:1);i=Math.max(i,a.centerX+a.radius+6+l)}}let o=e.options.today?e.scale.forwardWithinDomain(e.options.today):null;return o!==null&&(i=Math.max(i,o)),i}function VW(e){let t=e.canvas.final,n=e.measured.naturalChartRightX,r=Eb(e,Ct(e.draft.markerEntries,"the marker entries")),i=e.chart.swimlanes.length>0&&t!==n;for(let o of e.chart.swimlanes)o.box.width=t;for(let o of e.chart.includes)Hl(o,t,r)!==Hl(o,n,r)&&(i=!0),ob(o,t,r);return i}function KW(e){let t=Ct(e.draft.markerEntries,"the marker entries"),n=Ls(t.all,e.measured.header.chartLeftX,e.canvas.final,se,np(e.chart.milestones)),r=Ns(n.placements,e.headerRowsTop().markerRowY),i=e.measured.markers.hasEntities||t.calendarCount>0?Math.max(1,n.rowCount):0;e.setMarkerBand({rowCount:i,placements:r});let o=!1;for(let[s,a]of e.measured.markers.placements){let l=r.get(s);(!l||!cX(a,l))&&(o=!0)}return o}function qW(e){let t=e.markerBand(),n=e.ctx,r=e.measured.timeline,i=ip(e.chart.milestones,t.placements),o=i.some(s=>n.entityMidpoints.get(s.id??"")?.y!==s.center.y);for(let s of r.nonWorking??[]){if(s.label===void 0)continue;let a=t.placements.get(Ax(s));a&&(s.labelBox=a.labelBox,s.labelSide=a.labelSide)}for(let s of r.workingExceptions??[]){let a=t.placements.get(kx(s));a&&(s.labelBox=a.labelBox,s.labelSide=a.labelSide)}for(let s of e.measured.markers.datePinned){let a=t.placements.get(s.id);a&&n.entityMidpoints.set(s.id,{x:s.centerX,y:a.centerY})}for(let s of i)s.fixed||n.entityMidpoints.set(s.id??"",{x:s.center.x,y:s.center.y});return e.draft.milestones=i,o}function ZW(e){let t=e.markerBand(),n=e.headerRowsTop(),r=e.measured.bands,i=r.estimatedMarkerRows,s=e.ctx.timeline,a=!1;n.pillRowHeight!==r.pillRowHeight&&(s.box.y=n.timelineY,s.pillRowHeight=n.pillRowHeight,s.tickPanelY=n.tickPanelY,s.waveStrip&&(s.waveStrip.y+=n.shift),s.markerRow.y+=n.shift,s.markerRow.collisionY+=n.shift,a=!0);let l=n.shift;t.rowCount>i&&(l+=(t.rowCount-i)*26,s.markerRow.height=t.rowCount*26,a=!0),e.setHeaderRowsBottom(n.markerRowY+s.markerRow.height);let c=r.chartTopY+l;e.chartY.top=c,e.chartY.bottom+=c,e.chartY.swimlaneBottom+=c,s.box.height=e.chartY.bottom-s.box.y;for(let d of e.chart.swimlanes)Rs(d,c);for(let d of e.chart.includes)gS(d,c);let u=e.chart.milestones,f=Ct(e.draft.milestones,"the milestones");for(let d=0;d<f.length;d++)yS(f[d],u[d],c);return a}function JW(e){let t=e.measured.bands.bottomTickPanelHeight;return t<=0?!1:(e.ctx.timeline.bottomTickPanelY=e.chartY.bottom+xb,e.ctx.timeline.bottomTickPanelHeight=t,e.chartY.bottom+=xb+t,!0)}function QW(e){e.finalScale();let t=e.ctx;if(!t.waves)return!1;let n=ub(t.waves,t,Yn(e.scope.locale),e.chart.swimlanes,e.chart.includes);return n.regionCrossings.forEach((r,i)=>{r.length>0&&(e.chart.includes[i].waveCrossings=r)}),e.draft.waves=n,!0}function eX(e){e.finalScale(),e.markerBand();let t=new Set(Ct(e.draft.milestones,"the milestones").map(r=>r.center.x)),n=Md(e.resolved.content.anchors,e.ctx,t);return e.draft.anchors=n,n.length>0}function tX(e){let t=vx(e.chart.laneEntries),n=_x(t,e.chart.swimlanes,e.chart.includes,e.ctx);e.draft.edges=n;let r=0;return e.resolved.content.isolatedRegions.forEach((i,o)=>{let s=e.chart.includes[o],a=e.chart.regionContexts[o];if(!s||!a)return;let l=_x(vx([...i.content.swimlanes.values()]),s.nestedSwimlanes,[],a);l.length>0&&(s.edges=l),r+=l.length}),n.length+r>0}function nX(e){e.finalScale();let t=sb(e.options.today,e.ctx,e.scope.locale,e.canvas.final);return e.draft.nowline=t,t!==null}function rX(e){let t=e.draft.waves;if(!t)return!1;let n=db(t,e.ctx,Yn(e.scope.locale),e.chartY.bottom+ad);return n?(e.chartY.bottom+=ad+n.box.height,e.draft.waveLegend=n,!0):!1}function iX(e){let t=e.resolved.content.isolatedRegions.flatMap((r,i)=>{let o=e.chart.regionContexts[i],s=e.chart.includes[i];return o&&s?[{title:s.label,footnotes:r.content.footnotes,ctx:o}]:[]}),n=GS(e.resolved.content.footnotes,e.ctx,e.chartY.bottom,e.canvas.final,t);return e.draft.footnotes=n,n.entries.length>0}function oX(e){let{header:t,headerNode:n}=e.measured;return e.draft.header=n.place(t,{rowsBottomY:e.headerRowsBottom(),chartBottomY:e.chartY.bottom,canvasRightX:e.canvas.final}),t.position==="beside"}function sX(e){let t=Ct(e.draft.footnotes,"the footnote panel"),n=e.canvas.final,r=t.entries.length>0?t.box.y+t.box.height:e.chartY.bottom,i={x:n-It-ly,y:r+It,width:ly,height:Rk};return e.draft.attributionBox=i,e.draft.height=i.y+i.height+It,!0}var aX=[{name:"growCanvasForSpill",reads:["placement"],writes:["canvas"],run:zW},{name:"extendTimeline",reads:["placement","window","scale"],writes:["scale","timeline","calendarRuns","canvas"],run:jW},{name:"growCanvasForMarkerLabels",reads:["placement","calendarRuns","canvas","scale"],writes:["markerEntries","canvas"],run:YW},{name:"fitWidths",reads:["placement","canvas","markerEntries","scale"],writes:["laneWidths"],run:VW},{name:"packMarkers",reads:["placement","canvas","markerEntries","headerBands","scale"],writes:["markerBand"],run:KW},{name:"placeMarkers",reads:["placement","markerBand","calendarRuns"],writes:["milestones","calendarLabels","markerMidpoints"],run:qW},{name:"growHeaderRows",reads:["placement","markerBand","headerBands","scale","milestones","chartTop","laneBottom"],writes:["chartTop","rowsBottom","laneBottom","chartBottom","laneY","milestones","timeline"],run:ZW},{name:"bottomTickPanel",reads:["headerBands","chartBottom"],writes:["chartBottom","timeline"],run:JW},{name:"waves",reads:["scale","chartTop","laneBottom","timeline","laneY"],writes:["waves","timeline"],run:QW},{name:"anchors",reads:["scale","markerBand","chartTop","laneBottom","milestones"],writes:["anchors","markerMidpoints"],run:eX},{name:"dependencyEdges",reads:["laneY","markerMidpoints"],writes:["edges"],run:tX},{name:"nowline",reads:["scale","canvas","laneBottom","timeline"],writes:["nowline"],run:nX},{name:"waveLegend",reads:["waves","canvas","chartBottom"],writes:["legend","chartBottom"],run:rX},{name:"footnotePanel",reads:["chartBottom","canvas"],writes:["footnotes"],run:iX},{name:"header",reads:["chartBottom","canvas","rowsBottom"],writes:["header"],run:oX},{name:"attribution",reads:["footnotes","chartBottom","canvas"],writes:["attribution"],run:sX}];function wb(e,t=aX){for(let n of t)e.report(n.name,n.run(e));return lX(e)}function lX(e){let{draft:t}=e,{themeName:n,theme:r}=e.scope,{swimlanes:i,includes:o,waveSolve:s}=e.chart,a=e.canvas.final,l=e.measured.header.chartLeftX,c=t.waves,u=t.waveLegend;return{width:a,height:Ct(t.height,"the canvas height"),theme:n,palette:r,backgroundColor:r.surface.page,header:{...Ct(t.header,"the header"),attributionBox:Ct(t.attributionBox,"the attribution box")},timeline:e.measured.timeline,nowline:Ct(t.nowline,"the now-line"),swimlanes:i,anchors:Ct(t.anchors,"the anchors"),milestones:Ct(t.milestones,"the milestones"),edges:Ct(t.edges,"the edges"),footnotes:Ct(t.footnotes,"the footnote panel"),includes:o,chartBox:{x:l,y:e.chartY.top,width:a-l,height:e.chartY.bottom-e.chartY.top},...s?{waveSolve:s}:{},...c?{waves:c.waves}:{},...c&&c.boundaries.length>0?{waveBoundaries:c.boundaries}:{},...c&&c.crossings.length>0?{waveCrossings:c.crossings}:{},...u?{waveLegend:u}:{}}}function Ct(e,t){if(e===void 0)throw new Error(`layout: ${t} was read before its step ran`);return e}function cX(e,t){return e.rowIndex===t.rowIndex&&e.centerY===t.centerY&&e.labelSide===t.labelSide&&e.labelBox.x===t.labelBox.x&&e.labelBox.y===t.labelBox.y&&e.labelBox.width===t.labelBox.width&&e.labelBox.height===t.labelBox.height}var Cs=class extends Map{constructor(t,n=dX){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(Tb(this,t))}has(t){return super.has(Tb(this,t))}set(t,n){return super.set(uX(this,t),n)}delete(t){return super.delete(fX(this,t))}};function Tb({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function uX({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function fX({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function dX(e){return e!==null&&typeof e=="object"?e.valueOf():e}function mp(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function gp(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var vb=Symbol("implicit");function yp(){var e=new Cs,t=[],n=[],r=vb;function i(o){let s=e.get(o);if(s===void 0){if(r!==vb)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Cs;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return yp(t,n).unknown(r)},gp.apply(i,arguments),i}function jl(){var e=yp().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,l=0,c=0,u=.5;delete e.unknown;function f(){var d=t().length,p=i<r,m=p?i:r,g=p?r:i;o=(g-m)/Math.max(1,d-l+c*2),a&&(o=Math.floor(o)),m+=(g-m-o*(d-l))*u,s=o*(1-l),a&&(m=Math.round(m),s=Math.round(s));var w=mp(d).map(function(x){return m+o*x});return n(p?w.reverse():w)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(l=Math.min(1,c=+d),f()):l},e.paddingInner=function(d){return arguments.length?(l=Math.min(1,d),f()):l},e.paddingOuter=function(d){return arguments.length?(c=+d,f()):c},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return jl(t(),[r,i]).round(a).paddingInner(l).paddingOuter(c).align(u)},gp.apply(f(),arguments)}var Ux=class e{constructor(t,n,r){M(this,"bandwidthPx");M(this,"stepPx");M(this,"d3");this.bandwidthPx=t,this.stepPx=n,this.d3=r}static fixedRow(t){return new e(t.bandwidth,t.step)}static forRows(t){let n=Array.from({length:t.count},(i,o)=>String(o)),r=jl().domain(n).range(t.range).paddingInner(t.paddingInner??0).paddingOuter(t.paddingOuter??0);return new e(r.bandwidth(),r.step(),r)}bandwidth(){return this.bandwidthPx}step(){return this.stepPx}forward(t){if(!this.d3)throw new Error("BandScale.forward is only available on closed-domain bands (BandScale.forRows)");let n=this.d3(t);if(n===void 0)throw new Error(`BandScale: unknown band id "${t}"`);return n}},pX={bandwidth:56,step:64};function _b(){return Ux.fixedRow(pX)}var Ab=8;function kb(e,t,n,r,i){let{theme:o,styleCtx:s}=t,{cal:a,calendar:l,schedule:c}=n,u=c.plan,{originX:f,scale:d}=r.axis,{timeline:p}=r,m=zd(e,{theme:o,cal:a,schedule:c,timeline:p,scale:d,calendar:l,axisColumns:new Is(n,d),bandScale:_b(),waves:u?kS(u,d,f,Yn(t.locale).waveBackgroundItem,pp(c)):void 0},{chartTopY:0,chartBottomY:0,swimlaneBottomY:0},{footnotes:Qd(e.content.footnotes),markerRowPlacements:new Map(r.markers.placements)});for(let v of r.markers.datePinned){let P=m.markerRowPlacements.get(v.id);P&&(m.entityLeftEdges.set(v.id,v.centerX),m.entityRightEdges.set(v.id,v.centerX),m.entityMidpoints.set(v.id,{x:v.centerX,y:P.centerY}))}let g=new Map(m.entityLeftEdges),w=new Map(m.entityRightEdges),x=new Map(m.entityMidpoints),y=()=>{m.entityLeftEdges=new Map(g),m.entityRightEdges=new Map(w),m.entityMidpoints=new Map(x),m.placedItems=new Map,m.itemFlowKey=new Map,m.currentFlowKey="",m.waves&&Ud(m.waves,m.entityLeftEdges,m.entityRightEdges)},E=[...e.content.swimlanes.values()],_=Se("swimlane",[],s),T=wk[_.spacing]??0,I=()=>{m.nextParallelId=0,m.nextGroupId=0;let v=[],P=m.chartTopY,b=0,F=m.timeline.originX;for(let j of E){b>0&&(P+=T);let{positioned:U,usedHeight:ee,usedRightX:V}=new Ps({lane:j,bandIndex:b},i).place({x:m.timeline.originX,y:P},m);v.push(U),P+=ee,V>F&&(F=V),b++}return{swimlanes:v,nextY:P,maxRightX:F}},B=e.content.isolatedRegions,$,X,Y=m.waves;if(Y){let v,P=PS()?hX(Y.ids,c,d):void 0,b=Wd(Y.ids.length,Y.origin,Y.floors,(F,j)=>(IS(Y,F,j),y(),v=I(),B.length>0&&Px(B,m,v.nextY+Ab,i,r.naturalChartRightX),Y.pass),Ot,P);RS(Y,b),X={passes:b.passes,capped:b.capped},$=v}else $=I();let D=$.swimlanes,R=$.nextY,S=VS(e.content.milestones,m);S.length>0&&(y(),m.slackCorridors=S,$=I(),D=$.swimlanes,R=$.nextY);let O=[],k=[];if(B.length>0){let v=Px(B,m,R+Ab,i,r.naturalChartRightX);O=v.regions,k=v.contexts,R=v.endY}m.chartBottomY=R,m.swimlaneBottomY=R;let L=rp(e.content.milestones,m);return{ctx:m,swimlanes:D,includes:O,regionContexts:k,milestones:L,laneEntries:E,maxRightX:$.maxRightX,bottomY:R,...X?{waveSolve:X}:{}}}function hX(e,t,n){let r=e.map(i=>t.waves?.get(i));return{S:r.map(i=>i?n.forward(i.start):null),E:r.map(i=>i?n.forward(i.end):null)}}var xp=class{constructor(t,n){M(this,"node");M(this,"helpers");this.node=t,this.helpers=n}get id(){return this.node.name??""}place(t,n){let{node:r}=this,{helpers:i}=this,o=Se("group",r.properties,n.styleCtx),s=Gr(r,Wl(r.properties,t.x,n),n),a=n.waves!==void 0&&r.title===void 0&&ie(r.properties,"wave")!==void 0&&ie(r.properties,"style")===void 0&&Be(r.properties,"labels").length===0,l=a?void 0:r.title??r.name,c=n.currentFlowKey;n.nextGroupId+=1,n.currentFlowKey=`${c}/group:${r.name??`group-${n.nextGroupId}`}`;let u=St(Be(r.properties,"after")),f=St(Be(r.properties,"before")),d=dd({drawn:!a,hasTitle:!!l,hasPins:!!(u||f),hasBracket:o.bracket!=="none"}),p=sp(r,{leftX:s,firstRowY:t.y+d.header+d.pad},n,i),{children:m,timeCursorX:g,timeStartX:w}=p,x=n.bandScale.step(),y=x-n.bandScale.bandwidth(),E=Math.max(x,p.packer.usedHeight())-y,_={x:w,y:t.y,width:g-w,height:d.header+d.pad+E+d.pad};t.startX=_.x,t.x=g,t.height=Math.max(t.height,_.height+y);let T=r.name;T&&(n.entityLeftEdges.set(T,_.x),n.entityRightEdges.set(T,g)),n.currentFlowKey=c;let I=a?[]:Fd({box:_,afterDate:u,beforeDate:f,title:l});return{kind:"group",id:T,title:l,box:_,headerHeight:d.header,children:m,style:o,inlineDatePins:I.length>0?I:void 0,...a?{waveOnly:!0}:{}}}};var Ep=class{constructor(t,n){M(this,"node");M(this,"helpers");this.node=t,this.helpers=n}get id(){return this.node.name??""}place(t,n){let{node:r}=this,{helpers:i}=this,o=Se("parallel",r.properties,n.styleCtx),s=Gr(r,t.x,n),a=St(Be(r.properties,"after")),l=St(Be(r.properties,"before")),c=r.title??r.name,u=dd({drawn:!0,hasTitle:!!c,hasPins:!!(a||l),hasBracket:o.bracket!=="none"}),f=t.y+u.header+u.pad,d=[],p=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=0,w=n.currentFlowKey;n.nextParallelId+=1;let x=r.name??`parallel-${n.nextParallelId}`,y=0;for(let X of r.content){if(X.$type==="DescriptionDirective")continue;n.currentFlowKey=`${w}/par:${x}#${y}`;let Y=Xl(s,f+g),D=i.sequenceOne(X,Y,n);d.push(D),g+=Math.max(n.bandScale.step(),Y.height),p=Math.min(p,Y.startX),m=Math.max(m,Y.x),y++}n.currentFlowKey=w,d.length===0&&(p=n.scale.showsNonWorking?n.scale.startX(s):s,m=p);let E=n.bandScale.step(),_=E-n.bandScale.bandwidth(),T=Math.max(E,g)-_,I={x:p,y:t.y,width:m-p,height:u.header+u.pad+T+u.pad};t.startX=I.x,t.x=m,t.height=Math.max(t.height,I.height+_);let B=r.name;B&&(n.entityLeftEdges.set(B,I.x),n.entityRightEdges.set(B,m));let $=Fd({box:I,afterDate:a,beforeDate:l,title:c});return{kind:"parallel",id:B,title:c,box:I,headerHeight:u.header,children:d,style:o,inlineDatePins:$.length>0?$:void 0}}};function mX(e,t,n){return new Ep(e,{sequenceOne:wp}).place(t,n)}function gX(e,t,n){return new xp(e,{sequenceOne:wp}).place(t,n)}function wp(e,t,n){if(Ve(e))return Zd(e,t,n);if(et(e))return mX(e,t,n);if($e(e))return gX(e,t,n);throw new Error(`Unknown swimlane child type: ${e.$type??"unknown"}`)}var Tp=class{place(t,n,r,i){let o={sequenceOne:wp},s=pS(t,n,r),a=hS(t,n,r,s,i),l=yb(t,n,r,s,a),c=kb(n,s,a,l,o);return wb(new hp(t,n,r,s,a,l,c))}};function Gx(e,t,n={}){let r=n.schedule?.resolved===t?n.schedule:zl(e,t,{today:n.today,plan:Di(t)??null});return new Tp().place(e,t,n,r)}function vp(e){return e.toISOString().slice(0,10)}function Ib(e){return e.id!==void 0?e.id:/[\r\n]/.test(e.title)?e.title.replace(/\s*[\r\n]+\s*/g," ").trim():e.title}function Hx(e,t){for(let n of e)n.kind==="item"?t(n):Hx(n.children,t)}function yX(e,t,n){let r=Ib(e);e.textSpills&&n.push(sn(t,"NL.I1000","info",{name:r},r)),e.chipsOutside&&n.push(sn(t,"NL.I1001","info",{name:r},r)),(e.box.width<$r||e.dotSpills||e.iconSpills||e.footnoteSpills)&&n.push(sn(t,"NL.I1002","info",{name:r},r)),e.hasOverflow&&n.push(sn(t,"NL.I1003","info",{name:r,anchor:e.overflowAnchorId},r)),Rb(e,t,n)}function Rb(e,t,n){let r=e.nonWorkingPin;if(!r)return;let i=Ib(e);n.push(sn(t,"NL.I1008","info",{name:i,pin:r.pin,key:r.key,start:r.start},i))}function sn(e,t,n,r,i){return{message:ht(e,t,r),severity:n,code:t,entityId:i,lspSeverity:n==="warning"?2:3,data:{code:t,args:r}}}function Sb(e,t,n){let r=e.id??e.title,i=[];Hx(e.children,a=>i.push(a));for(let a of i)yX(a,t,n);let o=new Set(i.map(a=>a.box.y));o.size>1&&n.push(sn(t,"NL.I1004","info",{lane:r,rows:o.size},r)),(e.utilization?.segments.some(a=>a.classification==="red")??!1)&&n.push(sn(t,"NL.I1005","info",{lane:r},r));for(let a of e.nested)Sb(a,t,n)}function bb(e,t,n){Hx(e.children,r=>{Rb(r,t,n)});for(let r of e.nested)bb(r,t,n)}function xX(e,t,n){e.waveSolve?.capped&&n.push(sn(t,"NL.W1002","warning",{passes:e.waveSolve.passes}));let r=e.waves??[],i=r.filter(o=>o.empty).map(o=>o.id);if(i.length>0){let o={names:i};n.push(sn(t,"NL.I1006","info",o,i.length===1?i[0]:void 0))}for(let o of e.milestones){if(o.overrunByWave===void 0||o.overrunDate===void 0)continue;let s=r.find(l=>l.id===o.overrunByWave);if(!s)continue;let a=o.id??o.title;n.push(sn(t,"NL.I1007","info",{name:a,date:o.overrunDate,wave:s.id,end:vp(s.endDate)},a))}}function zx(e,t={}){let n=t.locale??"en-US",r=[];for(let i of e.swimlanes)Sb(i,n,r);for(let i of e.includes)for(let o of i.nestedSwimlanes)bb(o,n,r);if(xX(e,n,r),t.today){let i=t.today,o=e.timeline.startDate,s=e.timeline.endDate;(i<o||i>s)&&r.push(sn(n,"NL.W1000","warning",{date:vp(i),start:vp(o),end:vp(s)}))}return r}var Wi=class extends Error{constructor(t){super(t),this.name="TimezoneError"}};function jx(e){if(!e||e.toLowerCase()==="local")return{kind:"local"};if(e.toUpperCase()==="UTC")return{kind:"utc"};if(e==="Z")return{kind:"offset",ms:0};let t=/^([+-])(\d{2})(?::?(\d{2}))?$/.exec(e);if(t){let n=t[1]==="+"?1:-1,r=parseInt(t[2],10),i=t[3]!==void 0?parseInt(t[3],10):0;if(r>23||i>59)throw new Wi(`nowline: invalid timezone offset "${e}". Hours must be 0\u201323 and minutes 0\u201359.`);return{kind:"offset",ms:n*(r*60+i)*6e4}}try{return{kind:"iana",name:Intl.DateTimeFormat(void 0,{timeZone:e}).resolvedOptions().timeZone}}catch{throw new Wi(`nowline: unrecognised timezone "${e}". Use "local", "UTC", an ISO 8601 offset (e.g. "+05:30", "-07:00", "Z"), or an IANA timezone name (e.g. "America/Los_Angeles", "Asia/Kolkata").`)}}function _p(e,t){switch(t.kind){case"local":return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));case"utc":return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));case"offset":{let n=new Date(e.getTime()+t.ms);return new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()))}case"iana":{let n=new Intl.DateTimeFormat("en-CA",{timeZone:t.name,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e),r=0,i=0,o=0;for(let s of n)s.type==="year"?r=parseInt(s.value,10):s.type==="month"?i=parseInt(s.value,10)-1:s.type==="day"&&(o=parseInt(s.value,10));return new Date(Date.UTC(r,i,o))}}}var Nb=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?)(Z|([+-])(\d{2})(?::?(\d{2}))?)$/,Lb=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?$/;function Pb(e){return(ot.test(e)||Nb.test(e)||Lb.test(e))&&!He(e.slice(0,10))}function Yx(e={}){let t=e.zone??{kind:"local"},n=e.clock??(()=>new Date),r=e.now;if(!(r==="-"||r===null)){if(r instanceof Date)return r;if(r!==void 0){if(Pb(r))return;let i=_e(r);if(i)return i;let o=Nb.exec(r);if(o){let s=new Date(r);if(!Number.isNaN(s.getTime())){if(o[2]==="Z")return _p(s,{kind:"utc"});let l=o[3]==="+"?1:-1,c=parseInt(o[4],10),u=o[5]!==void 0?parseInt(o[5],10):0,f=l*(c*60+u)*6e4;return _p(s,{kind:"offset",ms:f})}}return Lb.test(r)?_e(r.slice(0,10))??void 0:void 0}return _p(n(),t)}}function EX(e){return e===2?"warning":e===3?"info":"error"}function Ob(e,t){return{severity:EX(e.severity),code:by(e),message:e.message,suggestion:md(e.message,e.data),file:t,line:(e.range?.start.line??0)+1,column:(e.range?.start.character??0)+1}}function Vx(e,t){return{severity:"error",code:"parse-error",message:e.message,file:t,line:e.token?.startLine??1,column:e.token?.startColumn??1}}function Kx(e,t){return{severity:"error",code:"lex-error",message:e.message,file:t,line:e.line??1,column:e.column??1}}function Cb(e,t){if(e.syntax?.origin==="lexer")return Kx(e.syntax.error,e.sourcePath);if(e.syntax?.origin==="parser")return Vx(e.syntax.error,e.sourcePath);let n=(e.range?.start.line??e.line??0)+1,r=(e.range?.start.character??0)+1;if(!Br(e))return{severity:e.severity,code:"include",message:e.message,file:e.sourcePath,line:n,column:1};let i=t?ix(t,e):e.message,o=md(i,e.code===void 0?void 0:{code:e.code,args:e.args??[]});return{severity:e.severity,code:e.code??gd(e.message),message:i,...o===void 0?{}:{suggestion:o},file:e.sourcePath,line:n,column:r}}function $b(e,t,n="warning"){return{severity:n,code:"render.warning",message:e,file:t,line:1,column:1}}function Db(e,t){return{severity:e.severity,code:e.code,message:e.message,file:t,line:1,column:1}}var Mb="__nowline_browser_noop_include__";async function Fb(e){throw new Error(`${Mb}: include "${e}" was skipped \u2014 running in single-file mode.`)}function qx(e){return e.includes(Mb)}function Ub(e,t){let n=t==="image/png"?TX(e):t==="image/jpeg"?vX(e):_X(e);return n&&n.width>0&&n.height>0?n:void 0}var wX=[137,80,78,71,13,10,26,10];function Zx(e,t){return e[t]<<8|e[t+1]}function Bb(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function Wb(e,t){return e[t]|e[t+1]<<8}function Xb(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16}function Ap(e,t,n){return String.fromCharCode(...e.subarray(t,t+n))}function TX(e){if(!(e.length<24||wX.some((t,n)=>e[n]!==t))&&Ap(e,12,4)==="IHDR")return{width:Bb(e,16),height:Bb(e,20)}}function vX(e){if(e.length<4||e[0]!==255||e[1]!==216)return;let t=2;for(;t+3<e.length;){if(e[t]!==255)return;let n=e[t+1];if(n===255){t+=1;continue}if(n===1||n>=208&&n<=217){t+=2;continue}let r=Zx(e,t+2);if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204)return t+8>=e.length?void 0:{width:Zx(e,t+7),height:Zx(e,t+5)};if(r<2)return;t+=2+r}}function _X(e){if(e.length<16||Ap(e,0,4)!=="RIFF"||Ap(e,8,4)!=="WEBP")return;let t=Ap(e,12,4),n=t==="VP8L"?25:30;if(!(e.length<n)){if(t==="VP8 ")return e[23]!==157||e[24]!==1||e[25]!==42?void 0:{width:Wb(e,26)&16383,height:Wb(e,28)&16383};if(t==="VP8L"){if(e[20]!==47)return;let r=e[21],i=e[22],o=e[23],s=e[24];return{width:1+(r|(i&63)<<8),height:1+(i>>6|o<<2|(s&15)<<10)}}if(t==="VP8X")return{width:1+Xb(e,24),height:1+Xb(e,27)}}}var AX=new Set(["svg","g","defs","symbol","use","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","title","desc","linearGradient","radialGradient","stop","clipPath","mask","pattern","filter","feGaussianBlur","feColorMatrix","feOffset","feMerge","feMergeNode","feFlood","feComposite","feBlend","feDropShadow","image"]),kX=new Set(["d","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","width","height","viewBox","preserveAspectRatio","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","opacity","transform","points","id","clip-path","mask","filter","font-family","font-size","font-weight","font-style","text-anchor","dx","dy","rotate","letter-spacing","word-spacing","xmlns","href","xlink:href","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","maskUnits","maskContentUnits","stdDeviation","values","in","in2","mode","type","result","flood-color","flood-opacity","patternUnits","patternContentUnits","role","aria-label","display","visibility","clip-rule","color","font-variant","font-stretch","text-decoration","dominant-baseline","alignment-baseline","baseline-shift","writing-mode","paint-order","vector-effect","shape-rendering","text-rendering","image-rendering","color-interpolation","color-interpolation-filters"]),IX=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","filter","font-family","font-size","font-weight","font-style","font-variant","font-stretch","text-anchor","text-decoration","letter-spacing","word-spacing","dominant-baseline","alignment-baseline","baseline-shift","writing-mode","stop-color","stop-opacity","flood-color","flood-opacity","display","visibility","color","paint-order","vector-effect","shape-rendering","text-rendering","image-rendering","color-interpolation","color-interpolation-filters"]),RX=new Set(["line-height","text-align","font-variant-ligatures","font-variant-caps","font-variant-numeric","font-variant-east-asian","font-variant-position","font-variant-alternates","font-feature-settings","font-variation-settings","font-kerning","white-space","text-orientation","overflow","isolation","solid-color","solid-opacity","enable-background","color-rendering"]),SX=new Set(["none","normal","auto","initial","inherit","unset"]);function bX(e){return e==="xlink:href"?!1:e.includes(":")||e.startsWith("data-")||e==="version"||e==="baseProfile"||e==="enable-background"}function NX(e){return e==="metadata"||e.includes(":")&&!e.startsWith("svg:")}var LX=new Set(["x","y","width","height"]);function Hb(e){let t=[],n=0,r=e.length;for(;n<r;){if(e[n]!=="<"){let u=n;for(;n<r&&e[n]!=="<";)n++;let f=e.slice(u,n);f.trim().length>0?t.push({kind:"text",text:f}):f.length>0&&t.push({kind:"text",text:f});continue}if(e.startsWith("<!--",n)){let u=e.indexOf("-->",n+4);if(u<0)break;t.push({kind:"comment",text:e.slice(n+4,u)}),n=u+3;continue}if(e.startsWith("<![CDATA[",n)){let u=e.indexOf("]]>",n+9);if(u<0)break;t.push({kind:"cdata",text:e.slice(n+9,u)}),n=u+3;continue}if(e.startsWith("<?",n)){let u=e.indexOf("?>",n+2);if(u<0)break;t.push({kind:"decl",text:e.slice(n+2,u)}),n=u+2;continue}if(e.startsWith("<!",n)){let u=e.indexOf(">",n+2);if(u<0)break;t.push({kind:"decl",text:e.slice(n+2,u)}),n=u+1;continue}if(e[n+1]==="/"){let u=e.indexOf(">",n+2);if(u<0)break;let f=e.slice(n+2,u).trim();t.push({kind:"close",name:f}),n=u+1;continue}let i=PX(e,n);if(i<0)break;let o=e.slice(n+1,i).trim(),s=o.endsWith("/"),a=s?o.slice(0,-1).trim():o,{name:l,attrs:c}=OX(a);t.push({kind:s?"self":"open",name:l,attrs:c}),n=i+1}return t}function PX(e,t){let n=t+1,r=null;for(;n<e.length;){let i=e[n];if(r)i===r&&(r=null);else if(i==='"'||i==="'")r=i;else if(i===">")return n;n++}return-1}function OX(e){let t=0;for(;t<e.length&&/\s/.test(e[t]);)t++;let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.slice(n,t),i={};for(;t<e.length;){for(;t<e.length&&/\s/.test(e[t]);)t++;if(t>=e.length)break;let o=t;for(;t<e.length&&e[t]!=="="&&!/\s/.test(e[t]);)t++;let s=e.slice(o,t);if(t>=e.length||e[t]!=="="){s&&(i[s]="");continue}if(t++,t>=e.length)break;let a=e[t];if(a!=='"'&&a!=="'"){let c=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;i[s]=e.slice(c,t);continue}t++;let l=t;for(;t<e.length&&e[t]!==a;)t++;i[s]=e.slice(l,t),t<e.length&&t++}return{name:r,attrs:i}}function Yl(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function CX(e,t){if(e.startsWith("#")){let n=t.get(e.slice(1));return n?`#${n}`:null}if(/^url\(#[^)]+\)$/.test(e)){let n=e.slice(5,-1),r=t.get(n);return r?`url(#${r})`:null}return null}function zb(e,t={}){let n=t.idPrefix??"nl-logo",r=t.onWarn??(()=>{}),i=Hb(e),o="",s=0;for(let d of i)d.kind==="open"&&d.name==="style"?s++:d.kind==="close"&&d.name==="style"?s=Math.max(0,s-1):s>0&&(d.kind==="text"||d.kind==="cdata")&&(o+=d.text??"");let a=$X(o,d=>r(`sanitizer: dropping ${d}`)),l=new Map,c=0;for(let d of i)if((d.kind==="open"||d.kind==="self")&&d.attrs&&"id"in d.attrs){let p=d.attrs.id;p&&!l.has(p)&&l.set(p,`${n}-${c++}`)}let u=[],f=[];for(let d of i)if(d.kind!=="comment"&&d.kind!=="decl"){if(d.kind==="cdata"){f[f.length-1]&&u.push(Yl(d.text??""));continue}if(d.kind==="text"){if(f.length===0||f[f.length-1]){let p=(d.text??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");u.push(p)}continue}if(d.kind==="open"||d.kind==="self"){let p=d.name??"";if(p==="script"||p==="foreignObject"||p==="animate"||p==="animateTransform"||p==="animateMotion"||p==="set"){r(`sanitizer: dropping <${p}>`),d.kind==="open"&&f.push(!1);continue}if(p==="style"||NX(p)){d.kind==="open"&&f.push(!1);continue}if(!AX.has(p)){r(`sanitizer: dropping unknown element <${p}>`),d.kind==="open"&&f.push(!1);continue}let m=[`<${p}`],g=p==="svg"&&f.length===0,w=DX(d.attrs??{},a,r),x=Object.keys(w).sort();for(let y of x){let E=w[y];if(g&&t.stripRootSize&&LX.has(y))continue;if(/^on/i.test(y)){r(`sanitizer: dropping event handler ${y}`);continue}if(bX(y)||y==="class")continue;if(!kX.has(y)){r(`sanitizer: dropping attribute ${y}`);continue}if(y==="href"||y==="xlink:href"){let T=CX(E,l);if(T===null){r(`sanitizer: dropping external href ${E}`);continue}m.push(` ${y}="${Yl(T)}"`);continue}if(y==="id"){let T=l.get(E);T&&m.push(` id="${Yl(T)}"`);continue}let _=/url\(#([^)]+)\)/gi;if(/data:|javascript:|vbscript:|url\(|expression\s*\(|[\\{}]/i.test(E.replace(_,""))){r(`sanitizer: dropping suspicious value at ${y}`);continue}if(/url\(#/i.test(E)){let T=E.replace(_,(I,B)=>{let $=l.get(B);return $?`url(#${$})`:"none"});m.push(` ${y}="${Yl(T)}"`);continue}m.push(` ${y}="${Yl(E)}"`)}m.push(d.kind==="self"?"/>":">"),u.push(m.join("")),d.kind==="open"&&f.push(!0);continue}d.kind==="close"&&f.pop()&&u.push(`</${d.name}>`)}return u.join("")}function Gb(e){if(e===void 0)return;let t=/^\s*([0-9]*\.?[0-9]+(?:e[+-]?[0-9]+)?)\s*(px)?\s*$/i.exec(e);if(!t)return;let n=Number(t[1]);return n>0&&Number.isFinite(n)?n:void 0}function kp(e){let t=Hb(e).find(s=>(s.kind==="open"||s.kind==="self")&&s.name==="svg");if(!t)return;let n=t.attrs??{},r=Gb(n.width),i=Gb(n.height);if(r!==void 0&&i!==void 0)return{width:r,height:i};let o=(n.viewBox??"").trim().split(/[\s,]+/).map(Number);if(o.length===4&&o.every(Number.isFinite)&&o[2]>0&&o[3]>0)return{width:o[2],height:o[3]}}function jb(e){let t=[];for(let n of e.split(";")){let r=n.indexOf(":");if(r<0)continue;let i=n.slice(0,r).trim().toLowerCase(),o=n.slice(r+1).replace(/!\s*important\s*$/i,"").trim();i&&o&&t.push({property:i,value:o})}return t}function $X(e,t){let n=[],r=e.replace(/\/\*[\s\S]*?\*\//g,""),i=/([^{}]+)\{([^{}]*)\}/g;for(let o of r.matchAll(i)){let s=o[1].trim(),a=s.split(",").map(l=>l.trim());if(s.startsWith("@")||!a.every(l=>/^\.[A-Za-z_][\w-]*$/.test(l))){t(`<style> rule ${s}`);continue}n.push({classes:a.map(l=>l.slice(1)),declarations:jb(o[2])})}return/@[a-z-]+[^{;]*;/i.test(r)&&t("<style> at-rule"),n}function DX(e,t,n){let r=new Set((e.class??"").split(/\s+/).filter(Boolean)),i=[];for(let s of t)s.classes.some(a=>r.has(a))&&i.push(...s.declarations);if(e.style!==void 0&&i.push(...jb(e.style)),i.length===0&&e.style===void 0)return e;let o={...e};delete o.style;for(let{property:s,value:a}of i)IX.has(s)?o[s]=a:!s.startsWith("-")&&!RX.has(s)&&!SX.has(a.toLowerCase())&&n(`sanitizer: dropping style property ${s}`);return o}var MX={".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp"};function FX(e){let t=e.slice(e.lastIndexOf("/")+1),n=t.lastIndexOf(".");return n>0?t.slice(n).toLowerCase():""}async function Yb(e,t,n){if(!e||!t)return;let r=FX(e),i=MX[r];if(!i){n(`unsupported logo format: ${r||"(none)"} (${e})`);return}let o;try{o=await t(e)}catch(l){let c=l instanceof Error?l.message:String(l);n(`logo file not found: ${e} (${c})`);return}let s=o.bytes,a=i==="image/svg+xml"?kp(new TextDecoder().decode(s)):Ub(s,i);if(!a){let l=i==="image/svg+xml"?"no viewBox and no pixel width/height on the root <svg>":`not a readable ${r.slice(1).toUpperCase()} header`;n(`logo could not be parsed: ${e} (${l})`);return}return{ref:e,dimensions:a,asset:o}}var BX=1,WX=0;function XX(){return Ce.parse(`memory:///stage-${++WX}.nowline`)}async function UX(e){if(e.document)return e.document;let{workspace:t}=e.services.shared,n=t.LangiumDocumentFactory.fromString(e.source,XX());return await t.DocumentBuilder.build([n],{validation:!0}),n}function GX(e){return e.origin!=="validation"||e.diagnostic.severity===BX}async function Jx(e){let t=await UX(e),n=Ni(t);if(n.some(GX))return{kind:"invalid",document:t,diagnostics:n};let r=t.parseResult.value,i=await zy(r,e.sourcePath,{services:e.services.Nowline,readFile:e.readSource,includePolicy:e.includePolicy}),o=e.isToleratedIncludeError??(()=>!1),s=T=>T.severity!=="error"||!o(T),a=i.diagnostics.filter(T=>T.severity==="error"&&s(T)),l=i.diagnostics.filter(T=>Br(T)&&s(T)),c=a.find(T=>!Br(T));if(c)return{kind:"include-error",document:t,legacy:c,routed:[],resolved:i};if(a.length>0)return{kind:"include-error",document:t,routed:l,resolved:i};let u=[],f=await Yb(hd(r),e.assetResolver,T=>u.push(T)),{theme:d,today:p,width:m,locale:g,nonWorking:w}=e.layout,x={theme:d,today:p,width:m,locale:g,nonWorking:w},y=Di(i)??null,E=zl(r,i,{today:p,plan:y}),_=Gx(r,i,{...x,schedule:E,logo:f?.dimensions});return{kind:"staged",document:t,ast:r,resolved:i,routed:l,logo:f,warnings:u,plan:y,schedule:E,model:_,layout:x}}var Vb=/&/g,Kb=/</g,qb=/>/g,HX=/"/g,zX=/'/g;function tt(e){return e.replace(Vb,"&amp;").replace(Kb,"&lt;").replace(qb,"&gt;")}function an(e){return e.replace(Vb,"&amp;").replace(Kb,"&lt;").replace(qb,"&gt;").replace(HX,"&quot;").replace(zX,"&#39;")}function $s(e){let t=Object.keys(e).sort(),n=[];for(let r of t){let i=e[r];i==null||i===!1||(i===!0?n.push(r):n.push(`${r}="${an(String(i))}"`))}return n.length?` ${n.join(" ")}`:""}function z(e,t,n){return n===void 0||n===""?`<${e}${$s(t)}/>`:`<${e}${$s(t)}>${n}</${e}>`}function ae(e,t){return`<text${$s(e)}>${tt(t)}</text>`}function h(e){return Number.isFinite(e)?Number.isInteger(e)?e.toString():(Math.round(e*100)/100).toString():"0"}var VX="3 3";function Ip(e,t){let n=e.waypoints;if(n.length<2)return"";let r=t.dependency.edgeStroke,i=n[n.length-1],o=n[n.length-2],s=Math.hypot(i.x-o.x,i.y-o.y);if(s===0)return"";let a=(i.x-o.x)/s,l=(i.y-o.y)/s,c=e.headWidth/2,u=e.head==="dot"?c:e.headWidth*5/7,f=s>u?[...n.slice(0,-1),{x:i.x-a*u,y:i.y-l*u}]:n.slice(0,-1),d=[KX(f,e.slack,r)],p=t.arrowhead.neutral;if(e.head==="dot")d.push(z("circle",{cx:h(i.x-a*c),cy:h(i.y-l*c),r:h(c),fill:p}));else{let m=i.x-a*u,g=i.y-l*u;d.push(z("path",{d:`M${h(m-l*c)} ${h(g+a*c)} L${h(i.x)} ${h(i.y)} L${h(m+l*c)} ${h(g-a*c)} z`,fill:p}))}return z("g",{"data-layer":"dependency"},d.join(""))}function KX(e,t,n){if(e.length<2)return"";let r={fill:"none",stroke:n,"stroke-width":1.1,"stroke-linejoin":"round"};if(!t)return z("path",{d:ZX(e,od),...r});let{solid:i,dotted:o}=qX(e,od);return(i?z("path",{d:i,...r}):"")+(o?z("path",{d:o,...r,"stroke-dasharray":VX,"stroke-linecap":"round"}):"")}function qX(e,t){let n=e.length,r=[],i=[],o=[];for(let a=1;a<n-1;a++){let l=e[a-1],c=e[a],u=e[a+1],f=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-c.x,u.y-c.y),p=Math.min(t,f/2,d/2),m={x:Math.sign(c.x-l.x),y:Math.sign(c.y-l.y)},g={x:Math.sign(u.x-c.x),y:Math.sign(u.y-c.y)};r[a]={x:c.x-m.x*p,y:c.y-m.y*p},i[a]={x:c.x+g.x*p,y:c.y+g.y*p},p>0&&o.push(`M${h(r[a].x)} ${h(r[a].y)} Q${h(c.x)} ${h(c.y)} ${h(i[a].x)} ${h(i[a].y)}`)}let s=[];for(let a=0;a<n-1;a++){let l=a===0?e[0]:i[a],c=a===n-2?e[n-1]:r[a+1],u=`M${h(l.x)} ${h(l.y)} L${h(c.x)} ${h(c.y)}`;Math.abs(e[a+1].y-e[a].y)<1e-9?s.push(u):o.push(u)}return{solid:o.join(" "),dotted:s.join(" ")}}function ZX(e,t){if(e.length<2)return"";let n=[`M${h(e[0].x)} ${h(e[0].y)}`];for(let r=1;r<e.length;r++){let i=e[r-1],o=e[r];if(r===e.length-1){n.push(`L${h(o.x)} ${h(o.y)}`);continue}let s=e[r+1],a=Math.sign(o.x-i.x),l=Math.sign(o.y-i.y),c=Math.sign(s.x-o.x),u=Math.sign(s.y-o.y),f=Math.hypot(o.x-i.x,o.y-i.y),d=Math.hypot(s.x-o.x,s.y-o.y),p=Math.min(t,f/2,d/2);if(p<=0||a!==0&&c!==0||l!==0&&u!==0){n.push(`L${h(o.x)} ${h(o.y)}`);continue}let m={x:o.x-a*p,y:o.y-l*p},g={x:o.x+c*p,y:o.y+u*p};n.push(`L${h(m.x)} ${h(m.y)}`),n.push(`Q${h(o.x)} ${h(o.y)} ${h(g.x)} ${h(g.y)}`)}return n.join(" ")}function Zb(e,t,n,r){if(e.entries.length===0)return"";let i=n.footnotePanel.fill,o=n.footnotePanel.border,s=n.footnotePanel.header,a=n.footnotePanel.title,l=n.footnotePanel.description,c=n.footnotePanel.number,u=[];u.push(z("rect",{x:h(e.box.x),y:h(e.box.y),width:h(e.box.width),height:h(e.box.height),rx:6,ry:6,fill:i,stroke:o,"stroke-width":1,filter:`url(#${t}-shadow-subtle)`})),u.push(ae({x:h(e.box.x+Ht),y:h(e.box.y+iy),"font-family":r.sans,"font-size":12,"font-weight":700,fill:s},"Footnotes"));let f=e.box.x+Ht;for(let d of e.entries){d.region!==void 0&&d.regionHeadingY!==void 0&&u.push(ae({x:h(f),y:h(d.regionHeadingY),"font-family":r.sans,"font-size":10,"font-weight":700,fill:s},d.region)),u.push(ae({x:h(f),y:h(d.y),"font-family":r.sans,"font-size":10,"font-weight":700,fill:c},String(d.number)));for(let p of d.titleLines)u.push(ae({x:h(p.x),y:h(p.y),"font-family":r.sans,"font-size":11,"font-weight":600,fill:a},p.text));for(let p of d.descriptionLines??[])u.push(ae({x:h(p.x),y:h(p.y),"font-family":r.sans,"font-size":11,fill:l},p.text))}return z("g",{"data-layer":"footnotes"},u.join(""))}function Jb(e,t,n,r){let i=e.box.x+e.cardBox.x,o=e.box.y+e.cardBox.y,s=e.cardBox.width,a=e.cardBox.height,l=e.style.bg==="none"?n.surface.headerBox:e.style.bg,c=n.header.cardBorder,u=z("rect",{x:h(i),y:h(o),width:h(s),height:h(a),rx:6,ry:6,fill:l,stroke:c,"stroke-width":1,filter:`url(#${t}-shadow-subtle)`}),f=i+16+(e.textInset?.x??0),d=o+(e.textInset?.y??0),p=[];e.titleLines.forEach((E,_)=>{p.push(ae({x:h(f),y:h(d+26+_*20),"font-family":r[e.style.font],"font-size":16,"font-weight":600,fill:e.style.text},E))});let m=p.join(""),g=d+26+Math.max(0,e.titleLines.length-1)*20,w=n.header.author,x=[];e.authorLines.forEach((E,_)=>{x.push(ae({x:h(f),y:h(g+18+_*14),"font-family":r[e.style.font],"font-size":11,fill:w},E))});let y=x.join("");return z("g",{"data-layer":"header","data-id":`${t}-header`},u+m+y)}function Qb(e,t){let n=e.palette.attribution.mark,r=e.palette.attribution.link;if(e.swimlanes.length===0)return"";let i=e.header.attributionBox.x,o=e.header.attributionBox.y,s=Mr,a=ae({x:"0",y:s,"font-family":t.sans,"font-size":rd,"font-weight":400,fill:n},nd)+ae({x:xl,y:s,"font-family":t.sans,"font-size":Mr,"font-weight":700,fill:n},"now")+z("rect",{x:sy,y:12,width:ay,height:Mr,fill:r})+ae({x:id,y:s,"font-family":t.sans,"font-size":Mr,"font-weight":400,fill:n},"ine"),l=z("g",{transform:`translate(${h(i)} ${h(o)}) scale(${h(yl)})`},a);return z("a",{href:oy,target:"_blank",rel:"noopener","aria-label":"Powered by nowline"},z("g",{"data-layer":"attribution"},l))}async function eN(e,t,n,r){let i=e.assetRef??"",{x:o,y:s,width:a,height:l}=e.box,c;try{if(r.logo&&r.logo.ref===i)c=r.logo.asset;else if(t)c=await t(i);else return""}catch(d){let p=`logo file not found: ${i} (${d instanceof Error?d.message:String(d)})`;if(r.strict)throw d;return r.warn?.(p),""}let u=(c.mime??"").toLowerCase();if(u==="image/svg+xml"){let d=new TextDecoder().decode(c.bytes),p=e.intrinsic??kp(d)??{width:a,height:l},m=new Set,g=zb(d,{idPrefix:`${n}-logo`,onWarn:w=>m.add(w.replace(/^sanitizer: dropping /,"")),stripRootSize:!0});return m.size>0&&r.warn?.(`logo ${i}: removed unsupported SVG content: ${[...m].join(", ")}`),z("svg",{"data-layer":"logo",x:h(o),y:h(s),width:h(a),height:h(l),viewBox:`0 0 ${h(p.width)} ${h(p.height)}`,preserveAspectRatio:"xMidYMid meet",overflow:"hidden"},g)}if(u==="image/png"||u==="image/jpeg"||u==="image/jpg"||u==="image/webp"){let d=JX(c.bytes);return z("image",{"data-layer":"logo",href:`data:${u};base64,${d}`,x:h(o),y:h(s),width:h(a),height:h(l),preserveAspectRatio:"xMidYMid meet"})}let f=`unsupported logo format: ${u} (${i})`;if(r.strict)throw new Error(f);return r.warn?.(f),""}function JX(e){if(typeof btoa<"u"){let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}let t=globalThis;if(t.Buffer)return t.Buffer.from(e).toString("base64");throw new Error("renderer: no base64 encoder available")}var Rp=class{constructor(t="nl"){M(this,"prefix");M(this,"counter",0);this.prefix=t}next(t){let n=`${this.prefix}-${this.counter++}`;return t?`${n}-${t}`:n}};function Sp(e,t,n){let r=e.radius,i=e.center.x,o=e.center.y,s=t.anchorDiamond.fill,a=t.anchorDiamond.stroke,l=z("path",{d:`M${h(i)} ${h(o-r)} L${h(i+r)} ${h(o)} L${h(i)} ${h(o+r)} L${h(i-r)} ${h(o)} Z`,fill:s,stroke:a,"stroke-width":1.25}),c=t.anchorDiamond.label,u=e.labelSide==="left"?e.labelBox.x+e.labelBox.width:e.labelBox.x,f={x:h(u),y:h(o+4),"font-family":n.sans,"font-size":10,fill:c};e.labelSide==="left"&&(f["text-anchor"]="end");let d=e.title?ae(f,e.title):"";return z("g",{"data-layer":"anchor","data-id":e.id??null},tN(e.hiddenDate)+l+d)}function bp(e,t){let n=t.anchorDiamond.cutLine;return z("line",{x1:h(e.center.x),y1:h(e.center.y+e.radius+1),x2:h(e.center.x),y2:h(e.cutBottomY),stroke:n,"stroke-width":1,"stroke-dasharray":"1 3"})}function Np(e,t,n){let r=e.center.x,i=e.center.y,o=e.radius,s=t.milestoneDiamond.cutLineOverrun,a=(m,g)=>z("path",{d:`M${h(m)} ${h(i-o)} L${h(m+o)} ${h(i)} L${h(m)} ${h(i+o)} L${h(m-o)} ${h(i)} Z`,fill:g,stroke:g,"stroke-width":1}),l=e.slip?.x,c;l!==void 0?c=a(r,s)+z("path",{d:`M${h(r+o)} ${h(i)} H${h(l-o)}`,fill:"none",stroke:s,"stroke-width":1.1,"stroke-dasharray":"3 3","stroke-linecap":"round"})+a(l,t.milestoneDiamond.fill):c=a(r,e.isOverrun?s:t.milestoneDiamond.fill);let u=e.isOverrun&&l===void 0?s:t.milestoneDiamond.label,f=e.labelSide==="left"?e.labelBox.x+e.labelBox.width:e.labelBox.x,d={x:h(f),y:h(i+4),"font-family":n.sans,"font-size":10,"font-weight":600,fill:u};e.labelSide==="left"&&(d["text-anchor"]="end");let p=e.title?ae(d,e.title):"";return z("g",{"data-layer":"milestone","data-id":e.id??null},tN(e.hiddenDate)+c+p)}function tN(e){return e===void 0?"":`<title>${tt(e)}</title>`}function Lp(e,t,n){let r=e.slip?.x??e.center.x,i=e.isOverrun&&e.slip===void 0?n.milestoneDiamond.cutLineOverrun:n.milestoneDiamond.cutLineNormal,o=[];if(e.onWaveBoundary||o.push(z("line",{x1:h(r),y1:h(e.center.y+e.radius+1),x2:h(r),y2:h(e.cutBottomY),stroke:i,"stroke-width":2,"stroke-dasharray":ml,"stroke-linecap":"round"})),e.slackArrows&&e.slackArrows.length>0)for(let s of e.slackArrows)o.push(z("path",{d:`M${h(s.x)} ${h(s.y)} H${h(e.center.x-6)}`,fill:"none",stroke:n.milestoneDiamond.slack,"stroke-width":1.1,"stroke-dasharray":"3 3","stroke-linecap":"round","marker-end":`url(#${t}-arrow-dark)`}));return o.join("")}var wn={person:{viewBox:"0 0 24 24",body:'<circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 21a8 8 0 0 1 16 0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"p"},people:{viewBox:"0 0 24 24",body:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="9" cy="7" r="4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M22 21v-2a4 4 0 0 0-3-3.87" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 3.13a4 4 0 0 1 0 7.75" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"P"},points:{viewBox:"0 0 24 24",body:'<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" fill="currentColor" stroke="currentColor" stroke-width="1" stroke-linejoin="round"/>',ascii:"*"},time:{viewBox:"0 0 24 24",body:'<line x1="10" x2="14" y1="2" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="12" x2="15" y1="14" y2="11" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="14" r="8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"t"}},QX={calendar:{viewBox:"0 0 24 24",body:'<rect x="3" y="4" width="18" height="18" rx="2" ry="2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="16" x2="16" y1="2" y2="6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="8" x2="8" y1="2" y2="6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="3" x2="21" y1="10" y2="10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"d"}},nN={...wn,...QX};var Lae={none:"",multiplier:"x",person:wn.person.ascii,people:wn.people.ascii,points:wn.points.ascii,time:wn.time.ascii};var eU={thin:100,light:300,normal:400,bold:700};function tU(e){return Ii[e]??14}function Pp(e,t,n){return{"font-family":t[e.font],"font-size":n??tU(e.textSize),"font-weight":eU[e.weight]??400,"font-style":e.italic?"italic":"normal",fill:e.text}}function nU(e){if(e.border==="dashed")return"4 3";if(e.border==="dotted")return"1 3"}function rN(e,t,n,r,i,o={}){let s=Math.min(Ri[i.cornerRadius]??4,r/2,n/2);return z("rect",{x:h(e),y:h(t),width:h(n),height:h(r),rx:h(s),ry:h(s),fill:i.bg==="none"?"transparent":i.bg,stroke:i.fg,"stroke-width":1,"stroke-dasharray":nU(i)??null,...o})}function Op(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=Math.min(e.x+e.width,t.x+t.width),o=Math.min(e.y+e.height,t.y+t.height);if(!(i<=n||o<=r))return{x:n,y:r,width:i-n,height:o-r}}var rU={none:{dx:0,dy:0,stdDeviation:0,opacity:0},subtle:{dx:0,dy:1,stdDeviation:1.5,opacity:.2},soft:{dx:0,dy:3,stdDeviation:5,opacity:.3},hard:{dx:2,dy:2,stdDeviation:0,opacity:.45}};function iU(e,t){let n=`${e}-shadow-${t}`,r=rU[t],i=`<feGaussianBlur in="SourceAlpha" stdDeviation="${r.stdDeviation}"/><feOffset dx="${r.dx}" dy="${r.dy}" result="offsetblur"/><feComponentTransfer><feFuncA type="linear" slope="${r.opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge>`;return z("filter",{id:n,x:"-50%",y:"-50%",width:"200%",height:"200%"},i)}function iN(e,t){return t==="none"?null:`url(#${e}-shadow-${t})`}function oN(e){return["subtle","soft","hard"].map(t=>iU(e,t)).join("")}var oU=4,sU=8,aU=10;function sN(e,t){return`url(#${e}-wave-hatch-${t})`}function aN(e,t,n){let r=my;return z("pattern",{id:`${e}-wave-hatch-${t}`,width:r,height:r,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)"},z("line",{x1:h(r/2),y1:0,x2:h(r/2),y2:r,stroke:t==="dark"?n.wave.hatch:n.wave.hatchOnDark,"stroke-width":gy,opacity:hy}))}function lN(e){if(!e.waves)return[];let t=new Set,n=i=>{for(let o of i)o.kind==="item"?o.waveRole==="background"&&o.waveHatch&&t.add(o.waveHatch):n(o.children)},r=i=>{for(let o of i)n(o.children),r(o.nested)};r(e.swimlanes);for(let i of e.includes)r(i.nestedSwimlanes);for(let i of e.waveLegend?.entries??[])t.add(i.hatch);return["dark","light"].filter(i=>t.has(i))}function cN(e,t,n,r){let o=Math.min(Ri[t.cornerRadius]??4,e.height/2);return z("rect",{x:h(e.x+.5),y:h(e.y+.5),width:h(Math.max(0,e.width-2*.5)),height:h(Math.max(0,e.height-2*.5)),rx:h(o),ry:h(o),fill:sN(r,n)})}var Qx=4;function lU(e,t){let n=Math.min(Qx-bi,e.width/2,e.height/2),r=1e-6;return{left:e.x<=t.box.x+bi+r?n:0,right:e.x+e.width>=t.box.x+t.box.width-bi-r?n:0}}function cU(e,t){let{x:n,y:r,width:i,height:o}=e,s=(a,l,c)=>a>0?` A${h(a)} ${h(a)} 0 0 1 ${h(l)} ${h(c)}`:"";return`M${h(n+t.left)} ${h(r)} H${h(n+i-t.right)}`+s(t.right,n+i,r+t.right)+` V${h(r+o-t.right)}`+s(t.right,n+i-t.right,r+o)+` H${h(n+t.left)}`+s(t.left,n,r+o-t.left)+` V${h(r+t.left)}`+s(t.left,n+t.left,r)+" Z"}function eE(e,t,n){let r=o=>n&&(n.left>0||n.right>0)?z("path",{d:cU(t,n),...o}):z("rect",{x:h(t.x),y:h(t.y),width:h(t.width),height:h(t.height),...o}),i=r({fill:e.style.stripFill});return e.style.tint?i+r({fill:e.style.tint,"fill-opacity":El}):i}function uN(e,t){let n=e.timeline,r=n.waveStrip;if(!e.waves||!r)return"";let i=[z("rect",{x:h(n.box.x),y:h(r.y),width:h(n.box.width),height:h(r.height),rx:Qx,ry:Qx,fill:t.timeline.panelFill,stroke:t.timeline.border,"stroke-width":1})];for(let o of e.waves){let s=o.strip.cell;s&&i.push(z("g",{"data-id":o.id},`<title>${tt(o.strip.tooltip)}</title>${eE(o,s,lU(s,n))}`))}return z("g",{"data-layer":"wave-strip"},i.join(""))}function Cp(e,t){let n=[];for(let r of e){if(!r.style.tint||r.empty)continue;let i=t?Op(r.columnBox,t):r.columnBox;!i||i.width<=0||i.height<=0||n.push(z("rect",{x:h(i.x),y:h(i.y),width:h(i.width),height:h(i.height),fill:r.style.tint,"fill-opacity":yy}))}return n.length===0?"":z("g",{"data-layer":"wave-bg"},n.join(""))}function $p(e,t){let n=[];for(let r of e??[]){let i=r.topY,o=r.bottomY;t&&(r.x<=t.x||r.x>=t.x+t.width||(i=Math.max(i,t.y),o=Math.min(o,t.y+t.height),o<=i))||n.push(z("line",{x1:h(r.x),y1:h(i),x2:h(r.x),y2:h(o),stroke:r.stroke,"stroke-width":dy,"stroke-dasharray":r.dash}))}return n.length===0?"":z("g",{"data-layer":"wave-boundary"},n.join(""))}function fN(e,t,n){let i=e.timeline.waveStrip;if(!e.waves||!i)return"";let o=i.y+i.height/2+oU,s=[],a=(l,c,u)=>z("rect",{x:h(u.x),y:h(u.y),width:h(u.width),height:h(u.height),fill:t.timeline.panelFill})+ae({x:h(l),y:h(o),"font-family":n.sans,"font-size":Un,"font-style":"italic",fill:t.wave.labelMuted,"text-anchor":"middle"},c);for(let l of e.waves){if(l.strip.gapLabel){let{text:d,x:p,halo:m}=l.strip.gapLabel;s.push(a(p,d,m))}if(!l.strip.cell)continue;let{labelDraw:c,superscripts:u,inlineDatePin:f}=l.strip;if(f&&s.push(Vl([f],l.style.text)),u&&s.push(eE(l,u.halo)),l.strip.label!==void 0&&c&&(s.push(eE(l,c.halo)),s.push(ae({x:h(c.x),y:h(o),"font-family":n.sans,"font-size":Un,"font-weight":600,fill:l.style.text,"text-anchor":"middle"},l.strip.label))),u){let d=u.rightX;for(let p=l.footnoteIndicators.length-1;p>=0;p--)s.push(ae({x:h(d),y:h(i.y+aU),"font-family":n.sans,"font-size":sU,"font-weight":700,fill:l.style.text,"text-anchor":"end"},String(l.footnoteIndicators[p]))),d-=Ut}}return s.length===0?"":z("g",{"data-layer":"wave-labels"},s.join(""))}function Dp(e){if(!e||e.length===0)return"";let t=e.map(n=>z("line",{x1:h(n.x),y1:h(n.topY),x2:h(n.x),y2:h(n.bottomY),stroke:n.stroke,"stroke-width":1,"stroke-dasharray":py}));return z("g",{"data-layer":"wave-cross"},t.join(""))}function uU(e){let t=e.entities.item.bg;return t==="none"?"transparent":t}function dN(e,t,n,r){if(!e)return"";let i=[];for(let o of e.entries){let s=o.swatch,a=uU(n),l={x:h(s.x),y:h(s.y),width:h(s.width),height:h(s.height)};i.push(z("rect",{...l,rx:2,ry:2,fill:a,stroke:n.entities.item.fg,"stroke-width":1})),i.push(z("rect",{x:h(s.x+.5),y:h(s.y+.5),width:h(s.width-1),height:h(s.height-1),rx:2,ry:2,fill:sN(t,o.hatch)}));for(let c of o.runs)i.push(ae({x:h(c.x),y:h(c.y),"font-family":r.sans,"font-size":Un,fill:n.wave.labelText},c.text))}return z("g",{"data-layer":"wave-legend"},i.join(""))}function pN(e,t){let n=e;for(let r of t.iconDxTerms??[])n+=r;return n}function tE(e,t,n,r,i,o){let s=t,{text:a,icon:l}=e,c={"font-family":i,"font-size":r,fill:o};if(!l)return ae({x:h(s),y:h(n),...c},a);if(l.kind==="builtin"&&l.name==="multiplier")return ae({x:h(s),y:h(n),...c},`${a}\xD7`);if(l.kind==="builtin"){let f=wn[l.name],d=ae({x:h(s),y:h(n),...c},a),p=r,m=pN(t,e),g=n-r*.85,w=`<svg x="${h(m)}" y="${h(g)}" width="${h(p)}" height="${h(p)}" viewBox="${f.viewBox}" style="color:${an(o)}" aria-hidden="true">${f.body}</svg>`;return d+w}let u=h(r*.1);return`<text x="${h(s)}" y="${h(n)}" font-family="${an(i)}" font-size="${r}" fill="${an(o)}">${tt(a)}<tspan dx="${u}">${tt(l.text)}</tspan></text>`}function fU(e){let{metaText:t,capacity:n,x:r,baselineY:i,fontSize:o,fontFamily:s,color:a}=e;if(!t&&!n)return"";let l={"font-family":s,"font-size":o,fill:a};if(!n)return ae({x:h(r),y:h(i),...l},t);if(!t)return tE(n,r,i,o,s,a);let c=h(o*as),u=`<text x="${h(r)}" y="${h(i)}" font-family="${an(s)}" font-size="${o}" fill="${an(a)}">`,{text:f,icon:d}=n;if(!d)return u+tt(t)+`<tspan dx="${c}">${tt(f)}</tspan></text>`;if(d.kind==="builtin"&&d.name==="multiplier")return u+tt(t)+`<tspan dx="${c}">${tt(f)}\xD7</tspan></text>`;if(d.kind==="literal"){let T=h(o*.1);return u+tt(t)+`<tspan dx="${c}">${tt(f)}</tspan><tspan dx="${T}">${tt(d.text)}</tspan></text>`}let p=n.iconDxTerms??[],m=r;for(let T of p.slice(0,2))m+=T;let g=wn[d.name],w=o,x=pN(r,n),y=i-o*.85,E=u+tt(t)+"</text>"+ae({x:h(m),y:h(i),...l},f),_=`<svg x="${h(x)}" y="${h(y)}" width="${h(w)}" height="${h(w)}" viewBox="${g.viewBox}" style="color:${an(a)}" aria-hidden="true">${g.body}</svg>`;return E+_}function dU(e,t){let n=nN.calendar,r=`<svg x="${h(e.glyphTopLeft.x)}" y="${h(e.glyphTopLeft.y)}" width="${h(e.glyphSize)}" height="${h(e.glyphSize)}" viewBox="${n.viewBox}" style="color:${an(t)}" aria-hidden="true">${n.body}</svg>`,i=`<title>${tt(e.isoDate)}</title>`;return z("g",{"data-layer":"inline-date-pin","data-side":e.side,"data-date":e.isoDate,"data-spilled":e.spilled?"true":null},i+r)}function Vl(e,t){return!e||e.length===0?"":e.map(n=>dU(n,t)).join("")}function hN(e){return e?.some(t=>t.side==="after")??!1}function pU(e){let t=[];return e.titleTruncated&&t.push(e.title),e.waveTooltip!==void 0&&t.push(e.waveTooltip),t.length>0?`<title>${tt(t.join(`
2920
- `))}</title>`:""}function hU(e,t){let n=[],r=iN(t,e.style.shadow);return n.push(rN(e.box.x,e.box.y,e.box.width,e.box.height,e.style,{filter:r??null})),e.waveRole==="background"&&e.waveHatch&&n.push(cN(e.box,e.style,e.waveHatch,t)),n.join("")}function mU(e){if(e.progressFraction>0){let t=Math.max(0,Math.min(e.box.width,e.box.width*e.progressFraction));return z("rect",{x:h(e.box.x),y:h(e.box.y+e.box.height-rn),width:h(t),height:rn,fill:e.style.fg,opacity:.55})}return""}function gU(e){let t=e.dotSpills&&e.dotSpillCx!==null?e.dotSpillCx:e.box.x+e.box.width-Ai;return z("circle",{cx:h(t),cy:h(e.box.y+Hg),r:Pr,fill:e.statusDotColor})}function yU(e,t){let n;if(e.textSpills)n=e.box.x+e.box.width+Bn,e.iconSpills&&(n+=Cr+Xt);else{let r=!!e.linkIcon&&e.linkIcon!=="none",o=e.inlineDatePins?.find(s=>s.side==="after"&&!s.spilled)?ps(r,{barWidth:e.box.width}):ps(!t.noLinks&&r&&!e.iconSpills);n=e.box.x+o}return n}function xU(e,t,n,r){let i=[],o=e.style.text,s=n.entities.item.text,a=e.textSpills?s:o,l=e.textSpills?s:e.style.fg,c=e.titleLines??(e.title?[e.title]:[]);return c.forEach((u,f)=>{u!==""&&i.push(ae({x:h(t),y:h(e.box.y+Kf+f*al),"font-family":r[e.style.font],"font-size":Or,"font-weight":600,fill:a},u))}),(e.metaText||e.capacity)&&i.push(fU({metaText:e.metaText,capacity:e.capacity,x:t,baselineY:e.box.y+qf(c.length),fontSize:sl,fontFamily:r[e.style.font],color:l})),i.join("")}function EU(e,t,n){let r=[],i=t.entities.item.text;if(e.footnoteIndicators.length>0){let o=e.box.y+zg;if(e.footnoteSpills&&e.footnoteSpillStartX!==null){let s=e.footnoteSpillStartX;for(let a=0;a<e.footnoteIndicators.length;a++){let l=e.footnoteIndicators[a];r.push(ae({x:h(s),y:h(o),"font-family":n.sans,"font-size":ll,"font-weight":700,fill:i},String(l))),s+=Ut}}else{let s=e.box.x+e.box.width-ds;for(let a=e.footnoteIndicators.length-1;a>=0;a--){let l=e.footnoteIndicators[a];r.push(ae({x:h(s),y:h(o),"font-family":n.sans,"font-size":ll,"font-weight":700,fill:e.style.text,"text-anchor":"end"},String(l))),s-=Ut}}}return r.join("")}function wU(e,t,n){let r=[];if(!t.noLinks&&e.linkIcon&&e.linkIcon!=="none"){let i={linear:"#5e6ad2",github:"#0f172a",jira:"#0052cc",generic:n.item.linkIconFg},o=i[e.linkIcon]??i.generic,s=Cr,a=e.iconSpills&&e.iconSpillX!==null?e.iconSpillX:e.box.x+ki,l=e.box.y+ki,c=z("rect",{x:h(a),y:h(l),width:s,height:s,rx:2,ry:2,fill:o}),u=a,f=l,d=z("path",{d:`M${h(u+4)} ${h(f+10)} L${h(u+10)} ${h(f+4)} M${h(u+6)} ${h(f+4)} H${h(u+10)} V${h(f+8)}`,stroke:"#ffffff",fill:"none","stroke-width":1.1,"stroke-linecap":"round","stroke-linejoin":"round"}),p=c+d,m=e.linkHref?z("a",{href:e.linkHref,target:"_blank",rel:"noopener"},p):p;r.push(m)}return r.join("")}function TU(e,t,n){let r=[];if(e.hasOverflow&&e.overflowBox){let i=t.item.overflowTailFill,o=t.item.overflowTailStroke,s=t.item.overflowCaption;r.push(z("rect",{x:h(e.overflowBox.x),y:h(e.overflowBox.y),width:h(e.overflowBox.width),height:h(e.overflowBox.height),fill:i,stroke:o,"stroke-width":1})),e.overflowAnchorId&&e.overflowBox.width>60&&r.push(ae({x:h(e.overflowBox.x+e.overflowBox.width/2),y:h(e.overflowBox.y+e.overflowBox.height/2+3),"font-family":n.sans,"font-size":9,"font-weight":700,fill:s,"text-anchor":"middle"},`past ${e.overflowAnchorId}`))}return r.join("")}function vU(e,t){let n=[];for(let r of e.labelChips){let i=Math.min(Ri[r.style.cornerRadius]??8,r.box.height/2);n.push(z("rect",{x:h(r.box.x),y:h(r.box.y),width:h(r.box.width),height:h(r.box.height),rx:h(i),ry:h(i),fill:r.style.bg==="none"?"transparent":r.style.bg,stroke:r.style.fg,"stroke-width":.5})),n.push(ae({x:h(r.box.x+r.box.width/2),y:h(r.box.y+r.box.height/2+3),...Pp(r.style,t,Ii.xs),"text-anchor":"middle"},r.text))}return n.join("")}function mN(e,t,n,r,i){let o=[];return o.push(pU(e)),o.push(hU(e,n)),o.push(mU(e)),o.push(gU(e)),o.push(Vl(e.inlineDatePins,e.style.fg)),o.push(xU(e,yU(e,t),r,i)),o.push(EU(e,r,i)),o.push(wU(e,t,r)),o.push(TU(e,r,i)),o.push(vU(e,i)),z("g",{"data-layer":"item","data-id":e.id??null},o.join(""))}function _U(e,t,n,r,i,o){let s=[];if(!(e.kind==="group"&&e.waveOnly)){let l=e.box.y+e.headerHeight,c=e.box.height-e.headerHeight;if(e.style.bg!=="none"){let f=t<=_y;s.push(z("rect",{x:h(e.box.x),y:h(l),width:h(e.box.width),height:h(c),fill:f?e.style.bg:"none","fill-opacity":f?t===1?Ty:vy:null,stroke:f?null:e.style.bg,"stroke-opacity":f?null:.6,"stroke-width":f?null:1}))}let u=e.kind==="group"?e.style.fg:i.parallel.bracketStroke;if(e.headerHeight>0&&e.style.bracket!=="none"){let f=e.box.y+wl,d=e.box.x,p=e.box.x+e.box.width;s.push(z("path",{d:`M${h(d)} ${h(l)} V${h(f)} H${h(p)} V${h(l)}`,fill:"none",stroke:u,"stroke-width":1.2,"stroke-dasharray":e.style.bracket==="dashed"?"3 2":null}))}e.title&&e.headerHeight>0&&s.push(ae({x:h(xs(e.box.x,hN(e.inlineDatePins))),y:h(e.box.y+wy),...Pp(e.style,o,fd),"font-weight":600,fill:u},e.title)),s.push(Vl(e.inlineDatePins,e.style.fg))}for(let l of e.children)s.push(yN(l,n,r,i,o,t));return z("g",{"data-layer":e.kind,"data-id":e.id??null},s.join(""))}function yN(e,t,n,r,i,o=0){return e.kind==="item"?mN(e,t,n,r,i):_U(e,o+1,t,n,r,i)}var gN=2;function AU(e,t){switch(e){case"green":return t.swimlane.utilizationOk;case"yellow":return t.swimlane.utilizationWarn;case"red":return t.swimlane.utilizationOver}}function kU(e,t){if(!e.utilization||e.utilization.segments.length===0)return"";let n=e.box.y+e.box.height-gN,r=e.utilization.segments.map(i=>{let o=i.endX-i.startX;return o<=0?"":z("rect",{x:h(i.startX),y:h(n),width:h(o),height:gN,fill:AU(i.classification,t),"data-utilization":i.classification,"data-load":h(i.load)})});return z("g",{"data-layer":"lane-utilization","data-id":e.id??null},r.join(""))}function xN(e,t){let n=e.bandIndex%2===0?t.swimlane.rowTintEven:t.swimlane.rowTintOdd,r=t.swimlane.border;return z("g",{"data-layer":"swimlane-bg","data-id":e.id??null},z("rect",{x:h(e.box.x),y:h(e.box.y),width:h(e.box.width),height:h(e.box.height),fill:n,stroke:r,"stroke-width":1}))}function Mp(e,t,n,r,i){let o=r.swimlane.tabFill,s=r.swimlane.tabStroke,a=r.swimlane.tabText,l=r.swimlane.ownerText,c=r.swimlane.footnoteIndicator,u=[],f=e.tab;if(f){let p=e.footnoteIndicators.length>0?e.footnoteIndicators.join(","):"",m=pl,g=e.box.y+10,w=g+hl;if(u.push(z("rect",{x:h(f.tabX),y:h(g),width:h(f.tabW),height:h(m),rx:4,ry:4,fill:o,stroke:s,"stroke-width":1})),u.push(ae({x:h(f.titleX),y:h(w),"font-family":i[e.style.font],"font-size":12,"font-weight":600,fill:a},e.title)),e.owner){let x=wn[e.ownerKind==="person"?"person":"people"],y=Tl;u.push(`<svg x="${h(f.ownerX)}" y="${h(w-y*.85)}" width="${h(y)}" height="${h(y)}" viewBox="${x.viewBox}" style="color:${an(l)}" aria-hidden="true">${x.body}</svg>`),u.push(ae({x:h(f.ownerTextX),y:h(w),"font-family":i[e.style.font],"font-size":10,fill:l},e.owner))}e.capacity&&u.push(tE(e.capacity,f.badgeX,w,10,i[e.style.font],l)),p&&u.push(ae({x:h(f.footnoteRightX),y:h(g+14),"font-family":i.sans,"font-size":10,"font-weight":700,fill:c,"text-anchor":"end"},p))}for(let d of e.children)u.push(yN(d,t,n,r,i));return u.push(kU(e,r)),z("g",{"data-layer":"swimlane","data-id":e.id??null},u.join(""))}function wN(e,t,n){let r=n.timeline.gridLine,i=n.timeline.minorGridLine,o=e.bottomTickPanelHeight??0,s=e.bottomTickPanelY!==void 0&&o>0,a=e.tickPanelY,l=s?e.bottomTickPanelY+o:e.box.y+e.box.height,c=t,u=e.box.y+e.box.height,f=[];for(let d of e.ticks)if(d.major)f.push(z("line",{x1:h(d.x),y1:h(a),x2:h(d.x),y2:h(l),stroke:r,"stroke-width":1}));else if(e.minorGrid){if(d.labelX===void 0)continue;f.push(z("line",{x1:h(d.x),y1:h(c),x2:h(d.x),y2:h(u),stroke:i,"stroke-width":1}))}for(let d of e.nonWorking??[])d.seam&&f.push(z("line",{x1:h(d.x),y1:h(c),x2:h(d.x),y2:h(u),stroke:n.timeline.nonWorkingSeam,"stroke-width":1,"stroke-dasharray":"1 3"}));return z("g",{"data-layer":"grid"},f.join(""))}function Fp(e,t,n,r){let i=e.box.y+e.box.height,o=[];for(let s of e.nonWorking??[]){if(!s.band)continue;let a={x:s.x,y:t,width:s.width,height:i-t},l=r?Op(a,r):a;!l||l.width<=0||l.height<=0||o.push(z("rect",{x:h(l.x),y:h(l.y),width:h(l.width),height:h(l.height),fill:n.timeline.nonWorkingFill,"fill-opacity":uy}))}return o.length===0?"":z("g",{"data-layer":"non-working"},o.join(""))}function TN(e,t,n){let r=e.box.y+e.box.height,i=[];for(let o of e.nonWorking??[])o.label===void 0||!o.labelBox||(o.cut&&i.push(z("line",{x1:h(o.x),y1:h(o.labelBox.y+4),x2:h(o.x),y2:h(r),stroke:t.timeline.nonWorkingSeam,"stroke-width":1,"stroke-dasharray":"1 3"})),i.push(EN(o.label,o.labelBox,o.labelSide,t,n)));for(let o of e.workingExceptions??[])o.labelBox&&i.push(EN(o.label,o.labelBox,o.labelSide,t,n));return i.length===0?"":z("g",{"data-layer":"non-working-label"},i.join(""))}function EN(e,t,n,r,i){let o=n==="left",s=t.y+4,a={x:h(o?t.x+t.width:t.x),y:h(s+4),"font-family":i.sans,"font-size":10,fill:r.timeline.labelText};return o&&(a["text-anchor"]="end"),ae(a,e)}function vN(e,t,n){let r=t.timeline.panelFill,i=t.timeline.border,o=t.timeline.labelText,s=[],a=e.tickPanelY,l=e.tickPanelHeight,c=l>0,u=e.markerRow.height>0,f=e.waveStrip?e.waveStrip.y+e.waveStrip.height:a+l,d=e.markerRow.height,p=e.bottomTickPanelY,m=e.bottomTickPanelHeight??0,g=p!==void 0&&m>0;c&&s.push(z("rect",{x:h(e.box.x),y:h(a),width:h(e.box.width),height:h(l),rx:4,ry:4,fill:r,stroke:i,"stroke-width":1})),u&&s.push(z("rect",{x:h(e.box.x),y:h(f),width:h(e.box.width),height:h(d),rx:4,ry:4,fill:r,stroke:i,"stroke-width":1})),g&&s.push(z("rect",{x:h(e.box.x),y:h(p),width:h(e.box.width),height:h(m),rx:4,ry:4,fill:r,stroke:i,"stroke-width":1}));for(let w of e.ticks)w.major&&(!w.label||w.labelX===void 0||(c&&s.push(ae({x:h(w.labelX),y:h(a+dl(l)),"font-family":n.sans,"font-size":Si,fill:o,"text-anchor":"middle"},w.label)),g&&s.push(ae({x:h(w.labelX),y:h(p+dl(m)),"font-family":n.sans,"font-size":Si,fill:o,"text-anchor":"middle"},w.label))));return z("g",{"data-layer":"timeline"},s.join(""))}function _N(e,t,n,r,i,o){let s=r.includeRegion.border,a=r.includeRegion.fill,l=r.includeRegion.tabFill,c=r.includeRegion.tabStroke,u=r.includeRegion.tabText,f=r.includeRegion.badgeFill,d=r.includeRegion.badgeStroke,p=r.includeRegion.badgeText,m=e.box.x+8,g=e.box.y,w=e.box.width-16,x=e.box.height,y=z("rect",{x:h(m),y:h(g),width:h(w),height:h(x),rx:8,ry:8,fill:a,stroke:s,"stroke-width":1,"stroke-dasharray":ml}),E=pl,_=vl(e.box.x,e.label,e.sourcePath),T=g-E/2,I=z("rect",{x:h(_.tabX),y:h(T),width:h(_.tabWidth),height:E,rx:4,ry:4,fill:l,stroke:c,"stroke-width":1}),B=ae({x:h(_.tabLabelX),y:h(T+hl),"font-family":i.sans,"font-size":11,"font-weight":600,fill:u},e.label),$=_.badgeX,X=_.badgeSize,Y=g-X/2,D=z("rect",{x:h($),y:h(Y),width:X,height:X,rx:4,ry:4,fill:f,stroke:d,"stroke-width":1}),R=z("path",{d:`M${h($+7)} ${h(Y+4)} H${h($+14)} V${h(Y+11)} M${h($+4)} ${h(Y+7)} H${h($+11)} V${h(Y+14)} H${h($+4)} Z`,stroke:p,"stroke-width":1.4,fill:"none","stroke-linecap":"round","stroke-linejoin":"round"}),S=9,O=g+4,k=z("rect",{x:h(_.sourceHaloX),y:h(O-S),width:h(_.sourceHaloWidth),height:S+6,fill:a}),L=ae({x:h(_.sourceTextX),y:h(O),"font-family":i.mono,"font-size":S,fill:p},e.sourcePath),v={x:m,y:g,width:w,height:x},P=o?Fp(o.timeline,o.chartBox.y,r,v):"",b=o?.waves?Cp(o.waves,v)+$p(o.waveBoundaries,v):"",F=o?.waves?Dp(e.waveCrossings):"",j=e.nestedSwimlanes.map(A=>Mp(A,t,n,r,i)).join(""),U=(e.edges??[]).map(A=>Ip(A,r)).join(""),ee=e.anchors??[],V=e.milestones??[],ne=ee.map(A=>bp(A,r)).join("")+V.map(A=>Lp(A,n,r)).join("")+ee.map(A=>Sp(A,r,i)).join("")+V.map(A=>Np(A,r,i)).join("");return z("g",{"data-layer":"include"},y+P+b+U+j+F+ne+I+B+D+R+k+L)}function AN(e,t,n){if(!e)return"";let r=t.nowline.stroke,i=t.nowline.labelText,o=z("line",{x1:h(e.x),y1:h(e.topY),x2:h(e.x),y2:h(e.bottomY),stroke:r,"stroke-width":ed}),s=IU(e,r),a=RU(e,i,n);return z("g",{"data-layer":"nowline"},o+s+a)}function kN(e){let t=ed/2;return e.pillMode==="flag-right"?e.x-t:e.pillMode==="flag-left"?e.x+t:e.x}function IU(e,t){let n=e.pillTopY,r=e.pillTopY+Gt,i=ey,o=e.pillWidth;if(e.pillMode==="center")return z("rect",{x:h(e.x-o/2),y:h(n),width:h(o),height:h(Gt),rx:i,ry:i,fill:t});let s=kN(e);if(e.pillMode==="flag-right"){let c=s+o,u=[`M ${h(s)} ${h(n)}`,`L ${h(c-i)} ${h(n)}`,`A ${i} ${i} 0 0 1 ${h(c)} ${h(n+i)}`,`L ${h(c)} ${h(r-i)}`,`A ${i} ${i} 0 0 1 ${h(c-i)} ${h(r)}`,`L ${h(s)} ${h(r)}`,"Z"].join(" ");return z("path",{d:u,fill:t})}let a=s-o,l=[`M ${h(s)} ${h(n)}`,`L ${h(a+i)} ${h(n)}`,`A ${i} ${i} 0 0 0 ${h(a)} ${h(n+i)}`,`L ${h(a)} ${h(r-i)}`,`A ${i} ${i} 0 0 0 ${h(a+i)} ${h(r)}`,`L ${h(s)} ${h(r)}`,"Z"].join(" ");return z("path",{d:l,fill:t})}function RU(e,t,n){let r=e.pillTopY+ty,i=kN(e),o,s;return e.pillMode==="center"?(o=e.x,s="middle"):e.pillMode==="flag-right"?(o=i+ms,s="start"):(o=i-ms,s="end"),ae({x:h(o),y:h(r),"font-family":n.sans,"font-size":gl,"font-weight":700,fill:t,"text-anchor":s},e.label)}async function nE(e,t={}){let r=new Rp(t.idPrefix??"nl").next("root"),i=e.palette,o=t.fontFamilies??cy,s=[],a=(u,f)=>`<marker id="${u}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" fill="${f}"/></marker>`,l=`<defs>${oN(r)}`+a(`${r}-arrow-dark`,i.arrowhead.dark)+lN(e).map(u=>aN(r,u,i)).join("")+"</defs>";s.push(l),s.push(z("rect",{x:0,y:0,width:h(e.width),height:h(e.height),fill:e.backgroundColor})),s.push(vN(e.timeline,i,o)),s.push(uN(e,i));for(let u of e.swimlanes)s.push(xN(u,i));s.push(Fp(e.timeline,e.chartBox.y,i)),e.waves&&s.push(Cp(e.waves)),s.push(wN(e.timeline,e.chartBox.y,i)),s.push($p(e.waveBoundaries)),s.push(fN(e,i,o));for(let u of e.edges)s.push(Ip(u,i));for(let u of e.swimlanes)s.push(Mp(u,t,r,i,o));for(let u of e.includes)s.push(_N(u,t,r,i,o,e));s.push(Dp(e.waveCrossings));for(let u of e.anchors)s.push(bp(u,i));for(let u of e.milestones)s.push(Lp(u,r,i));s.push(TN(e.timeline,i,o));for(let u of e.anchors)s.push(Sp(u,i,o));for(let u of e.milestones)s.push(Np(u,i,o));if(s.push(AN(e.nowline,i,o)),s.push(Zb(e.footnotes,r,i,o)),s.push(dN(e.waveLegend,r,i,o)),s.push(Jb(e.header,r,i,o)),s.push(Qb(e,o)),e.header.logo&&(t.logo||t.assetResolver)){let u=await eN(e.header.logo,t.assetResolver,r,t);u&&s.push(u)}return`<svg${$s({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${h(e.width)} ${h(e.height)}`,width:h(e.width),height:h(e.height),"data-theme":e.theme,"data-generator":"nowline"})}>${s.join("")}</svg>`}var rE="/browser-source.nowline",SU={error:3,warning:2,info:1},bU={error:3,warning:2,info:1};function IN(e,t){return SU[e]>=bU[t]}var Bp,RN=0;function SN(){return Bp||(Bp=rx()),Bp}function NU(){return Ce.parse(`memory:///nowline-browser-${++RN}.nowline`)}async function iE(e,t={}){let n=t.filePath??rE,r=SN(),o=r.shared.workspace.LangiumDocumentFactory.fromString(e,NU());return await r.shared.workspace.DocumentBuilder.build([o],{validation:!0}),{ast:o.parseResult.value,diagnostics:bN(o,n)}}function bN(e,t){return NN(Ni(e),t)}function NN(e,t){return e.map(n=>n.origin==="lexer"?Kx(n.error,t):n.origin==="parser"?Vx(n.error,t):Ob(n.diagnostic,t))}async function oE(e,t={}){let n=t.filePath??rE,r=SN(),i,o;if(t.timezone)try{i=jx(t.timezone)}catch(E){if(!(E instanceof Wi))throw E;o=E}let s=o?void 0:Yx({now:t.today,zone:i}),a=await Jx({source:e,sourcePath:n,services:r,readSource:t.readFile??Fb,assetResolver:t.assetResolver,isToleratedIncludeError:E=>qx(E.message),layout:{theme:t.theme,today:s,locale:t.locale,width:t.width,nonWorking:t.nonWorking}});if(a.kind==="invalid")return{kind:"diagnostics",diagnostics:NN(a.diagnostics,n)};let l=a.kind==="include-error"&&a.legacy!==void 0,c=bN(a.document,n);for(let E of a.resolved.diagnostics){if(E.severity==="error"&&qx(E.message)){t.onSkippedInclude?.({sourcePath:E.sourcePath,message:E.message});continue}l&&Br(E)||c.push(Cb(E))}if(a.kind==="include-error"||c.some(E=>E.severity==="error"))return{kind:"diagnostics",diagnostics:c};if(o)return{kind:"diagnostics",diagnostics:[{severity:"error",code:"invalid-timezone",message:o.message,file:n,line:1,column:1}]};let u=[...a.warnings],{logo:f,model:d}=a,p=t.diagnosticLevel??"error",m=zx(d,{today:s??void 0,locale:t.locale??"en-US"}).map(E=>Db(E,n)),g=t.showLinks!==!1,w=t.strict===!0,x=await nE(d,{idPrefix:t.idPrefix,assetResolver:t.assetResolver,logo:f,noLinks:!g,strict:w,warn:E=>u.push(E),fontFamilies:t.fontFamilies}),y=[...m,...u.map(E=>$b(E,n,w?"error":"warning"))].filter(E=>IN(E.severity,p));return w&&y.length>0?{kind:"diagnostics",diagnostics:[...c,...y]}:{kind:"svg",svg:x,warnings:y}}function sE(){Bp=void 0,RN=0}var LN="/embed.nowline",aE=!1;async function PN(e){let{ast:t,diagnostics:n}=await iE(e,{filePath:LN});return{ast:t,errors:n.filter(r=>r.severity==="error").map(r=>r.message)}}async function Wp(e,t={}){let n={filePath:LN,theme:t.theme,today:t.today,timezone:t.timezone,locale:t.locale,width:t.width,nonWorking:t.nonWorking,idPrefix:t.idPrefix,onSkippedInclude:()=>{aE||(aE=!0,console.warn("nowline: `include` directives are skipped in the browser embed (single-file mode). Render multi-file roadmaps with the CLI or the GitHub Action."))}},r=await oE(e,n);if(r.kind==="svg")return r.svg;let i=r.diagnostics.filter(o=>o.severity==="error").map(o=>o.message);throw new Kl(`Failed to render Nowline source: ${i.join("; ")}`,i)}var Kl=class extends Error{constructor(n,r){super(n);M(this,"details",r);this.name="EmbedRenderError"}};function ON(){aE=!1,sE()}var ln=Uint8Array,$t=Uint16Array,dE=Int32Array,pE=new ln([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),hE=new ln([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),CN=new ln([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),FN=function(e,t){for(var n=new $t(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new dE(n[30]),r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return{b:n,r:i}},BN=FN(pE,2),LU=BN.b,cE=BN.r;LU[28]=258,cE[258]=28;var WN=FN(hE,0),jle=WN.b,$N=WN.r,uE=new $t(32768);for(xe=0;xe<32768;++xe)Jn=(xe&43690)>>1|(xe&21845)<<1,Jn=(Jn&52428)>>2|(Jn&13107)<<2,Jn=(Jn&61680)>>4|(Jn&3855)<<4,uE[xe]=((Jn&65280)>>8|(Jn&255)<<8)>>1;var Jn,xe,Jl=(function(e,t,n){for(var r=e.length,i=0,o=new $t(t);i<r;++i)e[i]&&++o[e[i]-1];var s=new $t(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(n){a=new $t(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],u=t-e[i],f=s[e[i]-1]++<<u,d=f|(1<<u)-1;f<=d;++f)a[uE[f]>>l]=c}else for(a=new $t(r),i=0;i<r;++i)e[i]&&(a[i]=uE[s[e[i]-1]++]>>15-e[i]);return a}),Xi=new ln(288);for(xe=0;xe<144;++xe)Xi[xe]=8;var xe;for(xe=144;xe<256;++xe)Xi[xe]=9;var xe;for(xe=256;xe<280;++xe)Xi[xe]=7;var xe;for(xe=280;xe<288;++xe)Xi[xe]=8;var xe,Xp=new ln(32);for(xe=0;xe<32;++xe)Xp[xe]=5;var xe,PU=Jl(Xi,9,0);var OU=Jl(Xp,5,0);var XN=function(e){return(e+7)/8|0},CU=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ln(e.subarray(t,n))};var Qn=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},ql=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},lE=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return{t:GN,l:0};if(i==1){var s=new ln(n[0].s+1);return s[n[0].s]=1,{t:s,l:1}}n.sort(function(T,I){return T.f-I.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,f=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=n[n[c].f<n[f].f?c++:f++],l=n[c!=u&&n[c].f<n[f].f?c++:f++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=o[0].s,r=1;r<i;++r)o[r].s>d&&(d=o[r].s);var p=new $t(d+1),m=fE(n[u-1],p,0);if(m>t){var r=0,g=0,w=m-t,x=1<<w;for(o.sort(function(I,B){return p[B.s]-p[I.s]||I.f-B.f});r<i;++r){var y=o[r].s;if(p[y]>t)g+=x-(1<<m-p[y]),p[y]=t;else break}for(g>>=w;g>0;){var E=o[r].s;p[E]<t?g-=1<<t-p[E]++-1:++r}for(;r>=0&&g;--r){var _=o[r].s;p[_]==t&&(--p[_],++g)}m=t}return{t:new ln(p),l:m}},fE=function(e,t,n){return e.s==-1?Math.max(fE(e.l,t,n+1),fE(e.r,t,n+1)):t[e.s]=n},DN=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new $t(++t),r=0,i=e[0],o=1,s=function(l){n[r++]=l},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return{c:n.subarray(0,r),n:t}},Zl=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},UN=function(e,t,n){var r=n.length,i=XN(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var o=0;o<r;++o)e[i+o+4]=n[o];return(i+4+r)*8},MN=function(e,t,n,r,i,o,s,a,l,c,u){Qn(t,u++,n),++i[256];for(var f=lE(i,15),d=f.t,p=f.l,m=lE(o,15),g=m.t,w=m.l,x=DN(d),y=x.c,E=x.n,_=DN(g),T=_.c,I=_.n,B=new $t(19),$=0;$<y.length;++$)++B[y[$]&31];for(var $=0;$<T.length;++$)++B[T[$]&31];for(var X=lE(B,7),Y=X.t,D=X.l,R=19;R>4&&!Y[CN[R-1]];--R);var S=c+5<<3,O=Zl(i,Xi)+Zl(o,Xp)+s,k=Zl(i,d)+Zl(o,g)+s+14+3*R+Zl(B,Y)+2*B[16]+3*B[17]+7*B[18];if(l>=0&&S<=O&&S<=k)return UN(t,u,e.subarray(l,l+c));var L,v,P,b;if(Qn(t,u,1+(k<O)),u+=2,k<O){L=Jl(d,p,0),v=d,P=Jl(g,w,0),b=g;var F=Jl(Y,D,0);Qn(t,u,E-257),Qn(t,u+5,I-1),Qn(t,u+10,R-4),u+=14;for(var $=0;$<R;++$)Qn(t,u+3*$,Y[CN[$]]);u+=3*R;for(var j=[y,T],U=0;U<2;++U)for(var ee=j[U],$=0;$<ee.length;++$){var V=ee[$]&31;Qn(t,u,F[V]),u+=Y[V],V>15&&(Qn(t,u,ee[$]>>5&127),u+=ee[$]>>12)}}else L=PU,v=Xi,P=OU,b=Xp;for(var $=0;$<a;++$){var ne=r[$];if(ne>255){var V=ne>>18&31;ql(t,u,L[V+257]),u+=v[V+257],V>7&&(Qn(t,u,ne>>23&31),u+=pE[V]);var A=ne&31;ql(t,u,P[A]),u+=b[A],A>3&&(ql(t,u,ne>>5&8191),u+=hE[A])}else ql(t,u,L[ne]),u+=v[ne]}return ql(t,u,L[256]),u+v[256]},$U=new dE([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),GN=new ln(0),DU=function(e,t,n,r,i,o){var s=o.z||e.length,a=new ln(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=o.l,u=(o.r||0)&7;if(t){u&&(l[0]=o.r>>3);for(var f=$U[t-1],d=f>>13,p=f&8191,m=(1<<n)-1,g=o.p||new $t(32768),w=o.h||new $t(m+1),x=Math.ceil(n/3),y=2*x,E=function(le){return(e[le]^e[le+1]<<x^e[le+2]<<y)&m},_=new dE(25e3),T=new $t(288),I=new $t(32),B=0,$=0,X=o.i||0,Y=0,D=o.w||0,R=0;X+2<s;++X){var S=E(X),O=X&32767,k=w[S];if(g[O]=k,w[S]=O,D<=X){var L=s-X;if((B>7e3||Y>24576)&&(L>423||!c)){u=MN(e,l,0,_,T,I,$,Y,R,X-R,u),Y=B=$=0,R=X;for(var v=0;v<286;++v)T[v]=0;for(var v=0;v<30;++v)I[v]=0}var P=2,b=0,F=p,j=O-k&32767;if(L>2&&S==E(X-j))for(var U=Math.min(d,L)-1,ee=Math.min(32767,X),V=Math.min(258,L);j<=ee&&--F&&O!=k;){if(e[X+P]==e[X+P-j]){for(var ne=0;ne<V&&e[X+ne]==e[X+ne-j];++ne);if(ne>P){if(P=ne,b=j,ne>U)break;for(var A=Math.min(j,ne-2),C=0,v=0;v<A;++v){var W=X-j+v&32767,G=g[W],K=W-G&32767;K>C&&(C=K,k=W)}}}O=k,k=g[O],j+=O-k&32767}if(b){_[Y++]=268435456|cE[P]<<18|$N[b];var q=cE[P]&31,J=$N[b]&31;$+=pE[q]+hE[J],++T[257+q],++I[J],D=X+P,++B}else _[Y++]=e[X],++T[e[X]]}}for(X=Math.max(X,D);X<s;++X)_[Y++]=e[X],++T[e[X]];u=MN(e,l,c,_,T,I,$,Y,R,X-R,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=w,o.p=g,o.i=X,o.w=D)}else{for(var X=o.w||0;X<s+c;X+=65535){var re=X+65535;re>=s&&(l[u/8|0]=c,re=s),u=UN(l,u+1,e.subarray(X,re))}o.i=s}return CU(a,0,r+XN(u)+i)};var HN=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,o=n.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=r+=n[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},MU=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ln(o.length+e.length);s.set(o),s.set(e,o.length),e=s,i.w=o.length}return DU(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)};var zN=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};var FU=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=HN();i.p(t.dictionary),zN(e,2,i.d())}};function jN(e,t){t||(t={});var n=HN();n.p(e);var r=MU(e,t,t.dictionary?6:2,4);return FU(r,t),zN(r,r.length-4,n.d()),r}var BU=typeof TextDecoder<"u"&&new TextDecoder,WU=0;try{BU.decode(GN,{stream:!0}),WU=1}catch{}var KN="https://free.nowline.io/open";function YN(e){let t=new TextEncoder().encode(e),n=jN(t),r=32768,i="";for(let o=0;o<n.length;o+=r)i+=String.fromCharCode(...n.subarray(o,o+r));return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function mE({source:e,sourceUrl:t,share:n}){if(n===!1||n==="none")return null;if(typeof n=="object")return t!==void 0&&VN(t)?n.remoteUrl.replace("{url}",encodeURIComponent(t)):n.textUrl.replace("{text}",YN(e));let r=n===!0?KN:n,i=new URL(r);return t!==void 0&&VN(t)?i.hash=`url=${encodeURIComponent(t)}`:i.hash=`text=${YN(e)}`,i.toString()}function VN(e){try{return new URL(e).protocol==="https:"}catch{return!1}}var qN=0;async function ZN(e){let t=e.document??globalThis.document;if(!t)return{rendered:0,failed:0};let n=t.querySelectorAll(e.selector),r=0,i=0,o=++qN,s=e.share??!0,a=[],l=0;for(let c of Array.from(n)){let u=XU(c);if(!u)continue;let f=UU(c),d=`nl-r${o}-${l++}`,p={theme:e.theme,locale:e.locale,width:e.width,nonWorking:e.nonWorking,today:e.today,timezone:e.timezone,idPrefix:d},m=u.parentElement,g=u.nextSibling,x=c.getAttribute("data-nowline-source-url")??void 0??e.sourceUrl;a.push(Wp(f,p).then(y=>{if(GU(u,y),r++,m!==null){let E=mE({source:f,sourceUrl:x,share:s});if(E!==null){let _=t.createElement("a");_.className="nowline-share",_.href=E,_.target="_blank",_.rel="noopener noreferrer",_.textContent="Share on Nowline",m.insertBefore(_,g)}}},y=>{i++,console.error("nowline: render failed",y)}))}return await Promise.all(a),{rendered:r,failed:i}}function XU(e){let t=e.parentElement;return t&&t.tagName.toUpperCase()==="PRE"?t:e}function UU(e){return e.textContent??""}function GU(e,t){e.outerHTML=t}function JN(){qN=0}function Up(){if(typeof globalThis>"u")return"light";let e=globalThis.matchMedia;if(typeof e!="function")return"light";try{return e("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function QN(e,t){return e&&e!=="auto"?cx(e)??t:t}var HU="0.12.1",zU="fd731a2",jU="pre code.language-nowline, code.language-nowline",eL={theme:"auto",startOnLoad:!0,selector:jU,systemTheme:Up(),share:!0},Ae={...eL},gE=!1;function YU(e={}){Ae={theme:e.theme??Ae.theme,startOnLoad:e.startOnLoad??Ae.startOnLoad,selector:e.selector??Ae.selector,locale:e.locale??Ae.locale,width:e.width??Ae.width,nonWorking:e.nonWorking??Ae.nonWorking,today:e.today!==void 0?e.today:Ae.today,timezone:e.timezone??Ae.timezone,share:e.share??Ae.share,sourceUrl:e.sourceUrl??Ae.sourceUrl,systemTheme:Up()}}function tL(){return{theme:QN(Ae.theme,Ae.systemTheme),locale:Ae.locale,width:Ae.width,nonWorking:Ae.nonWorking,today:Ae.today,timezone:Ae.timezone}}async function VU(e,t={}){let n={...tL(),...t};return Wp(e,n)}async function KU(e){return PN(e)}async function yE(e){let t={selector:e?.selector??Ae.selector,theme:e?.theme??tL().theme,locale:e?.locale??Ae.locale,width:e?.width??Ae.width,nonWorking:e?.nonWorking??Ae.nonWorking,today:e?.today!==void 0?e.today:Ae.today,timezone:e?.timezone??Ae.timezone,share:e?.share??Ae.share,sourceUrl:e?.sourceUrl??Ae.sourceUrl,document:e?.document};return ZN(t)}var qU=yE;if(typeof document<"u"&&!gE){gE=!0;let e=()=>{Ae.startOnLoad&&yE()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):queueMicrotask(e)}function ZU(){Ae={...eL,systemTheme:Up()},gE=!1,ON(),JN()}return pL(JU);})();
2919
+ `).map(i=>i.trim()),n=0,r=t.length;for(;n<r&&t[n]==="";)n+=1;for(;r>n&&t[r-1]==="";)r-=1;return t.slice(n,r)}function DB(e,t,n,r=t,i=r){let o=e,s=BS(e);if(s){if(s.length>=2)return{textSpills:!(n<=t&&s.every((u,f)=>se(u,Vd)<=(f===0?i:t))),titleLines:s};o=s[0]??""}let a=o.length>0&&se(o,Vd)>r,l=n>t;if(!a&&!l)return{textSpills:!1,titleLines:[o]};if(a&&!l)for(let c of[r,i]){let u=Ti(o,t,Vd,c);if(u.length>=2&&u.length<=Hg&&u.every((f,d)=>se(f,Vd)<=(d===0?c:t)))return{textSpills:!1,titleLines:u}}return{textSpills:!0,titleLines:[o]}}function WS(e,t,n){let r=BS(e);return r&&r.length>=2?r:!t.textSpills&&!n&&t.titleLines.length>=2?t.titleLines:[r?r[0]??"":e]}function XS(e){let{visualWidth:t}=e,n=hs(!!e.hasLinkIcon,e.hasAfterGlyph?{barWidth:t}:void 0),r=Math.max(0,t-n-FS),i=$B(e.metaText,e.metaTrailingWidth??0),o=e.titleFirstLineRightReservePx??fl({barWidth:t,footnoteLabels:[],hasBeforeGlyph:!1}),s=Math.max(0,t-n-o),a=Math.max(s,t-n-Math.max(FS,o-Xt));return{leftInset:n,fit:DB(e.title,r,i,s,a)}}var MB;function US(e,t,n){MB?.(e,t,n)}var Kd=class{constructor(t){M(this,"geometry");this.geometry=t}get id(){return this.geometry.id}measure(t){return{width:this.geometry.naturalWidth,height:t.bands.bandwidth()+this.geometry.barExtra}}place(t,n){let{naturalWidth:r,visualWidth:i,caption:o,barExtra:s}=this.geometry,a=n.bands.bandwidth(),l=t.x+qd(r),c={x:l,y:t.y,width:i,height:s>0?a+s:a},{textSpills:u,titleLines:f}=o.fit,d=u?l+i+OB:l+o.leftInset;return{id:this.geometry.id,box:c,textX:d,textSpills:u,titleLines:f}}};function FB(e){switch(e){case"done":case"completed":return"done";case"in-progress":case"active":return"in-progress";case"at-risk":case"blocked":case"planned":return e;case void 0:return"planned";default:return"neutral"}}function BB(e){if(!e)return 0;let t=/^(\d{1,3})%$/.exec(e);return t?Math.max(0,Math.min(100,parseInt(t[1],10)))/100:0}function WB(e,t){if(e)return/^\d+(?:\.\d+)?[dwmqy]$/.test(e)||/^\d+%$/.test(e)?e:t.sizes.get(e)?.effortLiteral??e}function XB(e,t){if(e)return t.teams.get(e)?.title??t.persons.get(e)?.title??e}function UB(e){if(!e||!Di(e))return{icon:"none"};let t=e.toLowerCase();return t.includes("linear.app")?{icon:"linear",href:e}:t.includes("github.com")?{icon:"github",href:e}:t.includes("atlassian.net")||t.includes("jira.")?{icon:"jira",href:e}:{icon:"generic",href:e}}function Zd(e,t,n,r,i){let o=cS(e,t),s=e.title??e.name??"",a=o.padding==="none"?"xs":o.padding,l=_k[a],c=Math.max(20,Math.round(s.length*5.5+l*2));return i!==void 0&&(c=Math.min(c,i)),{text:s,style:o,box:{x:n,y:r,width:c,height:Dr}}}function GB(e,t){let n=QA(e,t.sizes,t.cal),r=ZA(ie(e,"remaining"),t.sizes,t.cal),i=ie(e,"status"),o=FB(i),s=BB(i);s===0&&o==="done"&&(s=1);let a=/^(\d{1,3})%$/.exec(ie(e,"remaining")??"");return s===0&&o==="in-progress"&&a&&(s=1-Math.max(0,Math.min(100,parseInt(a[1],10)))/100),s===0&&o==="in-progress"&&r>0&&n>0&&(s=Math.max(0,Math.min(1,1-r/n))),{status:o,progress:s}}function HB(e,t,n,r,i,o){let s=ie(e,"duration"),a=!!s&&/^\d+(?:\.\d+)?[dwmqy]$/.test(s),l=n?n.title??n.name:"",c=a?s:l||void 0,u=ie(e,"remaining"),f=WB(u,t),d=XB(ie(e,"owner"),t),p=()=>[c,d].filter(Boolean).join(" "),m;if(r==="in-progress"&&f){let w=p();m=w?`${w} \u2014 ${f} remaining`:`${f} remaining`}else if(r==="in-progress"&&i>0&&i<1){let w=Math.round((1-i)*100),_=p();m=_?`${_} \u2014 ${w}% remaining`:`${w}% remaining`}else(d||c)&&(m=p()||void 0);let g=ie(e,"capacity"),E=Lr(g),x=null,y=0;if(E!==null){let w=tl(E),_=nl(o,t.symbols),v=11,R=il(w,_,v,m);x={value:E,text:w,icon:_,...R!==void 0?{iconDxTerms:R}:{}};let B=R!==void 0?v*ls:se(" ",v);y=(m?B:0)+rl(w,_,v)}return{metaText:m,ownerDisplay:d,capacity:x,capacityTrailingWidth:y}}function zB(e,t){let n=new Set;if(e){for(let[r,i]of t.footnoteHosts.entries())if(i.includes(e)){let o=t.footnoteIndex.get(r);o!==void 0&&n.add(o)}}return[...n].sort((r,i)=>r-i)}function jB(e,t,n){return fl({barWidth:e,footnoteLabels:t.map(String),hasBeforeGlyph:St(n)!==void 0})}var YB={done:"done","in-progress":"inProgress","at-risk":"atRisk",blocked:"blocked",planned:"planned",neutral:"neutral"};function VB(e,t,n){let r=YB[t],i={...e};return i.bg===n.entities.item.bg&&(i.bg=n.statusTint[r]),i.fg===n.entities.item.fg&&(i.fg=n.status[r]),i}function KB(e,t,n,r,i){if(n===0)return 0;let o=r-rn-Dr-Wn,s;e&&t?s=Math.max(_i,i)+Wn:e?s=o:s=Math.max(o,i+Wn);let l=s+(n-1)*td+Dr+Wn+rn;return Math.max(0,l-r)}function qB(e,t,n){let r=n.axisColumns;if(!t.textSpills||!r)return{lines:e,truncated:!1};let i=Math.max(0,...e.map(g=>se(g,Or))),{metaText:o,capacityTrailingWidth:s}=t.meta,a=(o?se(o,al):0)+s,l=Math.max(i,a),c=ed({barRightX:t.barRightX,iconSpills:t.iconSpills,captionWidth:l,footnoteCount:t.visualWidth<ms?t.footnoteCount:0,dotSpills:t.visualWidth<$r}),u=r.captionCapX(t.barRightX);if(c.rightX<=u+ZB||c.captionX===null)return{lines:e,truncated:!1};let f=c.rightX-(c.captionX+l),d=u-c.captionX-f,p=!1;return{lines:e.map(g=>{let E=VA(g,d,Or);return E!==g&&(p=!0),E}),truncated:p}}var ZB=1e-6;function Jd(e,t,n){let r=e.properties,i=Se("item",r,n.styleCtx),o=ie(r,"size"),s=o?n.sizes.get(o)??null:null,a=MS(n,e),l=Be(r,"after"),c=Be(r,"before"),u=Ns(n,t,a),f=vx(u),d=UB(ie(r,"link")),p=d.icon!=="none",m=vx(u),g=Be(r,"labels"),E=[];for(let U of g){let z=n.labels.get(U);if(!z)continue;let J=Zd(z,n.styleCtx,0,0);E.push({id:z,width:J.box.width})}let x=0;for(let U=0;U<E.length;U+=1)U>0&&(x+=Xn),x+=E[U].width;let y=Math.max(0,m-2*Fn),w=E.length>0&&x>y,{status:_,progress:v}=GB(r,n),R=VB(i,_,n.styleCtx.theme),B=HB(r,n,s,_,v,R.capacityIcon),C=e.title??e.name??"",X=zB(e.name,n),V=XS({title:C,visualWidth:f,metaText:B.metaText,metaTrailingWidth:B.capacityTrailingWidth,hasLinkIcon:p,hasAfterGlyph:St(l)!==void 0,titleFirstLineRightReservePx:jB(m,X,c)}),$=p&&f<Vg,I=V.fit.textSpills||$,F=qB(WS(C,V.fit,$),{textSpills:I,iconSpills:$,barRightX:t+qd(u)+f,visualWidth:f,footnoteCount:X.length,meta:B},n),N=F.lines,k=w?Tk(E,f):null,b=k?k.rows.length:E.length>0?1:0,T=B.metaText!==void 0||B.capacity!==null,L=Qf(N.length,T),D=zg(N.length,T),P=KB(w,I,b,n.bandScale.bandwidth(),L);return{node:e,id:e.name??"",startX:t,durationDays:a,naturalWidth:u,visualWidth:f,naturalVisualWidth:m,style:R,size:s,status:_,progress:v,meta:B,link:d,chips:{samples:E,outside:w,pack:k,rowCount:b},footnoteIndicators:X,caption:{...V,title:C,iconSpills:$,lines:N,truncated:F.truncated,lastBaseline:L},barExtra:Math.max(D,P)}}function Qd(e,t,n,r){let i=e.properties,o=Be(i,"after"),s=Be(i,"before"),a=Ul(i,t.x,n);n.waves&&(a=Gr(e,a,n));let l=$S(i,a,n),c=n.scale.startX(a),u=r??Jd(e,c,n);if(u.startX!==c)throw new Error(`layout: item "${e.name??e.title??"(unnamed)"}" was measured at x ${u.startX} but placed at x ${c}`);let{naturalWidth:f,style:d,status:p,progress:m,footnoteIndicators:g,caption:E}=u,{metaText:x,ownerDisplay:y,capacity:w,capacityTrailingWidth:_}=u.meta,v=u.link,R=v.icon!=="none",B=u.chips.samples,C=u.chips.outside,X=c,V=c+f,$=c+Ns(n,c,u.durationDays),I=!1,F,N;if(s.length>0){let qe,tr;for(let Dt of s){let Fs=Te(Dt),Bs=Fs?n.scale.forwardWithinDomain(Fs)??void 0:n.entityLeftEdges.get(Dt);Bs!==void 0&&(qe===void 0||Bs<qe)&&(qe=Bs,tr=Dt)}qe!==void 0&&$>qe&&(I=!0,F={x:qe,y:t.y,width:V-qe,height:n.bandScale.bandwidth()},N=tr)}let k=E.title,b=new Kd(u),T={time:n.scale,bands:n.bandScale,style:d},L=b.place({x:X,y:t.y},T),D=L.box,P=n.bandScale.bandwidth(),U=D.width<$r,z=E.iconSpills,J=D.width<ms,Y=L.textSpills||z,te=E.lines,A=u.chips.pack,O=E.lastBaseline,W=u.barExtra,G=[],K=D.y+P-rn-Dr-Wn,q=D.y+(C&&Y?Math.max(_i,O):O)+Wn,re=C&&Y||!C&&B.length>0?Math.max(K,q):K,le=C?D.x+D.width+Bn:D.x+Fn,ce=le;if(A)for(let qe=0;qe<A.rows.length;qe+=1){let tr=re+qe*td,Dt=le;for(let Bs of A.rows[qe]){let vE=Zd(Bs.id,n.styleCtx,Dt,tr);G.push(vE),Dt+=vE.box.width+Xn}let Fs=Dt-Xn;Fs>ce&&(ce=Fs)}else{let qe=le;for(let tr of B){let Dt=Zd(tr.id,n.styleCtx,qe,re);G.push(Dt),qe+=Dt.box.width+Xn}ce=B.length>0?qe-Xn:le}let pe=y??ie(i,"owner"),rt=e.description?.text,mt=g.length>0&&J,gt=null;if(Y){let qe=Math.max(...te.map(Dt=>se(Dt,Or))),tr=(x?se(x,11):0)+_;gt=Math.max(qe,tr)}let tc=ed({barRightX:D.x+D.width,iconSpills:z,captionWidth:gt,footnoteCount:mt?g.length:0,dotSpills:U}),{iconSpillX:iL,footnoteSpillStartX:oL,dotSpillCx:sL}=tc,aL=Math.max(D.x+D.width,tc.rightX),Ms=e.name;Ms&&(n.entityLeftEdges.set(Ms,X),n.entityRightEdges.set(Ms,$)),NS(e,$,n);let wE=Ms??_x(e);n.itemFlowKey.set(wE,n.currentFlowKey),t.startX=X,t.x=$,t.height=Math.max(t.height,n.bandScale.step()+W);let TE=_S({box:D,afterDate:St(o),beforeDate:St(s),hasLinkIcon:R,footnoteCount:g.length}),er={kind:"item",id:Ms,title:k,...te.length>=2||te[0]!==k?{titleLines:te}:{},box:D,dateSpan:{startX:X,endX:V},status:p,statusDotColor:DS(p,d.bg,n.styleCtx.theme),progressFraction:m,footnoteIndicators:g,labelChips:G,chipsOutside:C,chipsRightX:ce,linkIcon:v.icon,linkHref:v.href,hasOverflow:I,overflowBox:F,overflowAnchorId:N,owner:pe,description:rt,metaText:x,textSpills:Y,dotSpills:U,iconSpills:z,footnoteSpills:mt,dotSpillCx:sL,iconSpillX:iL,footnoteSpillStartX:oL,decorationsRightX:aL,capacity:w,size:u.size,style:d,inlineDatePins:TE.length>0?TE:void 0},nc=LS(e,n);return nc!==void 0&&(er.waveRole=nc),nc==="background"&&(er.waveHatch=jd(d.bg)),l!==void 0&&(er.nonWorkingPin=l),E.truncated&&(er.titleTruncated=!0),nc==="background"&&n.waves&&(er.waveTooltip=n.waves.backgroundTooltip),n.placedItems.set(wE,er),US(b,T,er),er}function _x(e){let t=e.$cstNode?.range.start;return`#item@${t?t.line+1:0}:${t?t.character+1:0}`}function Ax(e){let t=new Map;for(let n of SA(e))Ve(n)&&t.set(n.name??_x(n),n);return t}var JB=.01;function QB(e,t){let n={blocks:[],edges:[]},r=new Map,i=(a,l,c)=>{n.blocks.push({x:a,y:c,width:l,height:0})},o=(a,l)=>{let{box:c}=a;if(a.kind==="item"){n.blocks.push({...c,width:Wl(a)-c.x}),n.edges.push({x:c.x,top:c.y,bottom:c.y+c.height},{x:c.x+c.width,top:c.y,bottom:c.y+c.height});return}l&&a.id&&r.set(a.id,a),a.kind==="group"&&a.waveOnly||(a.headerHeight>0&&n.blocks.push({x:c.x,y:c.y,width:Math.max(c.width,ws(a)-c.x),height:a.headerHeight}),i(c.x,c.width,c.y+c.height),n.edges.push({x:c.x,top:c.y,bottom:c.y+c.height},{x:c.x+c.width,top:c.y,bottom:c.y+c.height}));for(let u of a.children)o(u,l)},s=(a,l)=>{i(a.box.x,a.box.width,a.box.y),i(a.box.x,a.box.width,a.box.y+a.box.height);for(let c of a.children)o(c,l);for(let c of a.nested)s(c,l)};for(let a of e)s(a,!0);for(let a of t){i(a.box.x,a.box.width,a.box.y),i(a.box.x,a.box.width,a.box.y+a.box.height);for(let l of a.nestedSwimlanes)s(l,!1)}return{obstacles:n,containers:r}}function kx(e,t,n,r){let{obstacles:i,containers:o}=QB(t,n),s=r.bandScale.bandwidth(),a=Se("item",[],r.styleCtx),l=[];for(let[p,m]of e){let g=r.placedItems.get(p);if(!g)continue;let E=xx(g,s);for(let x of Be(m.properties,"after")){let y=r.placedItems.get(x),w=y?void 0:o.get(x),_;if(y?_=xx(y,s):w&&(_=vS(w)),_){l.push({fromId:x,toId:p,source:_,target:E});continue}let v=r.entityMidpoints.get(x);if(!v||E.startX-v.x<=JB)continue;let R=E.rowY??E.top;l.push({fromId:x,toId:p,waypoints:[{x:v.x,y:R},{x:E.paintedX,y:R}],slack:!0,...Ts(E.bottom-E.top),style:a})}}let c=l.filter(p=>p!==null&&"source"in p),u=Dk(c,i,r.scale.pixelsPerDay),f=new Map(c.map((p,m)=>[p,u[m]])),d=[];for(let p of l){if(!p)continue;if(!("source"in p)){d.push(p);continue}let m=f.get(p);m&&d.push({...m,style:a})}return d}function tp(e,t=0){let n=new Map,r=new Map;return[...e.entries()].forEach(([i,o],s)=>{n.set(i,t+s+1),r.set(i,Be(o.properties,"on"))}),{index:n,hosts:r}}var ep=11,eW=120,tW=6,GS="\u2014 ";function zS(e,t,n,r,i=[]){let o=Ht,s=n+Ht,a=r-2*Ht,l=o+2*Ht,c=o+a-Ht,u=s+rd+Ht,f=[],d=0,p=(g,E,x)=>{for(let[y,w]of g){let _=w.title??y,v=w.description?.text,R=nW(_,v,l,c),B=u+d*ys,C=V=>({x:V.x,y:B+V.row*ys,text:V.text}),X={number:E.footnoteIndex.get(y)??f.length+1,y:B,title:_,titleLines:R.title.map(C),description:v,style:Se("footnote",w.properties,E.styleCtx)};R.description.length>0&&(X.descriptionLines=R.description.map(C)),x!==void 0&&(X.region=x),f.push(X),d+=R.rows}};p(e,t);for(let g of i){if(g.footnotes.size===0)continue;let E=u+d*ys;d+=1;let x=f.length;p(g.footnotes,g.ctx,g.title),f[x].regionHeadingY=E}return{box:{x:o,y:s,width:a,height:f.length===0?0:rd+d*ys+Ht},entries:f}}function nW(e,t,n,r){let i=r-n,o=HS(e,i,i),s=o.map((g,E)=>({x:n,row:E,text:g}));if(!t)return{title:s,description:[],rows:o.length};let a=se(GS,ep),l=t.trim().split(/\s+/)[0]??"",c=n+Math.max(eW,e.length*tW),u=o.length===1&&a+se(l,ep)<=r-c,f=u?c:n,d=u?o.length-1:o.length,p=HS(t,i,r-f-a),m=p.map((g,E)=>({x:E===0?f:n,row:d+E,text:E===0?`${GS}${g}`:g}));return{title:s,description:m,rows:d+p.length}}function HS(e,t,n){if(se(e,ep)<=n)return[e];let r=Ti(e,t,ep,n);return r.length>0?r:[e]}function Hl(e,t,n){let r=[],i=(o,s,a)=>{let l=Te(ie(s.properties,"date"));if(!l)return;let c=n.forwardWithinDomain(l);c!==null&&r.push({id:o,centerX:c,radius:6,title:s.title??o,fontSize:10,bold:a,date:l,isMilestone:a})};for(let[o,s]of e)i(o,s,!1);for(let[o,s]of t)i(o,s,!0);return r}function rp(e,t){return[...iW(e),...oW(t)]}function Ls(e,t){let n=new Map;for(let[r,i]of e){let o=t+13+i.rowIndex*26;n.set(r,{rowIndex:i.rowIndex,centerY:o,labelBox:{...i.labelBox,y:o-4},labelSide:i.labelSide})}return n}function Ix(e){return`nonworking:${e.from.toISOString().slice(0,10)}`}function Rx(e){return`working:${e.from.toISOString().slice(0,10)}`}function YS(e,t,n){return{id:e,centerX:t,radius:0,title:n,fontSize:10,bold:!1}}function iW(e){let t=[];for(let n of e??[])n.label!==void 0&&t.push(YS(Ix(n),n.x,n.label));return t}function oW(e){return(e??[]).map(t=>YS(Rx(t),t.x,t.label))}function Wi(e,t,n,r){let i=n;for(let o of e){let s=VS(o,r),a=o.centerX+o.radius+6+s,c=o.centerX-o.radius-6-s>=t&&o.slipFromX===void 0;a>n&&!c&&(i=Math.max(i,a+It))}return i}function VS(e,t){return t(e.title,e.fontSize)*(e.bold?1.05:1)}function ip(e){let t=[];for(let n of e)for(let r of n.slackArrows??[])"marker"in r&&r.marker!==n.id&&t.push({from:r.marker,to:n.id});return t}function Ps(e,t,n,r,i=[]){let o=[...e].sort((u,f)=>u.centerX-f.centerX),s=new Map,a=[],l=new Map(e.map(u=>[u.id,u])),c=i.filter(u=>l.has(u.from)&&l.has(u.to));for(let u of o){let f=VS(u,r),d=u.centerX+u.radius+6,p=u.centerX-u.radius-6-f,m=d+f<=n,g=p>=t,E=u.centerX-u.radius,x=u.centerX+u.radius,y=T=>T==="right"?d:p,w=T=>T==="right"?m:g,_=u.slipFromX===void 0?[]:[{left:u.slipFromX-u.radius,right:u.centerX-u.radius}],v=c.filter(T=>T.from===u.id).map(T=>{let L=l.get(T.to);return{left:Math.min(u.centerX,L.centerX)+u.radius,right:Math.max(u.centerX,L.centerX)-L.radius}}).concat(_).filter(T=>T.right>T.left),R=-1,B=Number.POSITIVE_INFINITY;for(let T of c){if(T.to===u.id){let L=s.get(T.from);L&&(B=Math.min(B,L.rowIndex))}if(T.from===u.id){let L=s.get(T.to);L&&(R=Math.max(R,L.rowIndex))}}let C=T=>{let L=y(T);return v.some(D=>D.left<L+f&&D.right>L)},X=T=>w(T)&&!C(T),V=X("right")||u.slipFromX!==void 0?"right":X("left")?"left":m?"right":"left",$=(T,L)=>{let D=Math.min(E,T),P=Math.max(x,T+f),U=[{left:D,right:P},...v];return a[L].some(z=>U.some(J=>z.left<J.right&&z.right>J.left))},I=-1,F="right",N=d;e:for(let T=a.length-1;T>=0;T--)if(!(T<R||T>B))for(let L of["right","left"]){if(!X(L))continue;let D=y(L);if(!$(D,T)){I=T,F=L,N=D;break e}}if(I===-1&&R>=0&&R<B){let T=R+1;for(let[L,D]of s)D.rowIndex>=T&&s.set(L,{...D,rowIndex:D.rowIndex+1});a.splice(T,0,[]),I=T,F=V,N=y(F)}else if(I===-1){for(let[T,L]of s)s.set(T,{...L,rowIndex:L.rowIndex+1});a=[[],...a],I=0,F=V,N=y(F)}let k=Math.min(E,N),b=Math.max(x,N+f);a[I].push({left:k,right:b},...v),s.set(u.id,{rowIndex:I,labelBox:{x:N,y:0,width:f,height:12},labelSide:F})}return{placements:s,rowCount:a.length}}function Sx(e,t){let n=[];for(let r of e){let i=t.placedItems.get(r),o=t.entityRightEdges.get(r);if(o===void 0)continue;let s=i?Ex(i,t.bandScale.bandwidth()):void 0;if(!i&&t.waves?.plan.index.has(r)){n.push({ref:r,endX:o,y:s,flowKey:`wave:${r}`,wave:r});continue}let a=t.itemFlowKey.get(r)??`marker:${r}`;if(!i&&t.markerIds.has(r)){n.push({ref:r,endX:o,y:s,marker:!0,flowKey:a});continue}n.push({ref:r,endX:o,y:s,flowKey:a})}return n}function bx(e){let t=new Map;for(let n of e){let r=t.get(n.flowKey);(!r||n.endX>r.endX)&&t.set(n.flowKey,n)}return Array.from(t.values())}function sW(e,t){return Math.abs(t-e.endX)<=12}function KS(e,t){return e.endX>=t||e.wave!==void 0?null:e.y!==void 0?{x:e.endX,y:e.y}:e.marker&&!sW(e,t)?{x:e.endX,marker:e.ref}:null}function aW(e){let t=null;for(let n of e)n.wave===void 0&&(!t||n.endX>t.endX)&&(t=n);return t}function lW(e,t){let n;for(let r of e)r.wave===void 0||r.endX-t<Ot||(!n||r.endX>n.endX)&&(n=r);return n}var Nx=class{constructor(t,n){M(this,"id");M(this,"milestone");this.id=t,this.milestone=n}place(t){let n=this.milestone,r=Se("milestone",n.properties,t.styleCtx),i=ie(n.properties,"date"),o=Be(n.properties,"after"),s=Te(i),a=t.timeline.markerRow.y,l=6,c=n.title??this.id,u=null,f=a,d=!1,p,m=!1,g,E;if(s){let _=t.scale.forwardWithinDomain(s);if(_===null)return null;u=_,d=!0;let v=t.markerRowPlacements.get(this.id);v&&(f=v.centerY);let R=Sx(o,t),B=bx(R),C=aW(B),X=lW(B,_);E=X?.wave;let V=Math.max(C&&C.endX>_?C.endX:_,X?.endX??_);V>_&&(m=!0,V-_>12&&(g=V))}else if(o.length>0){let _=Sx(o,t),v=bx(_);v.sort((C,X)=>X.endX-C.endX);let R=v[0]?.endX??t.timeline.originX;u=R,d=!1;let B=[];for(let C=1;C<v.length;C++){let X=KS(v[C],R);X&&B.push(X)}B.length>0&&(p=B)}if(u===null)return null;let x={x:u,y:f};t.entityLeftEdges.set(this.id,x.x),t.entityRightEdges.set(this.id,x.x),t.entityMidpoints.set(this.id,x);let y={id:this.id,title:c,x:u,radius:l,fixed:d,slackArrows:p,isOverrun:m,style:r,cutTopY:t.chartTopY,cutBottomY:t.swimlaneBottomY};g!==void 0&&(y.slipX=g);let w=g??u;return t.waves&&(g!==void 0||!m)&&PS(t.waves,w)&&(y.onWaveBoundary=!0),E!==void 0&&s&&(y.overrunByWave=E,y.overrunDate=vi(s)),s&&!t.scale.showsNonWorking&&!t.calendar.isWorkingDay(s)&&(y.hiddenDate=vi(s)),y}};function op(e,t){let n=[];for(let[r,i]of e){let o=new Nx(r,i).place(t);o&&n.push(o)}return n}function sp(e,t){let n=r=>{let i=t.get(r);if(!i)throw new Error(`layout: marker "${r}" has no marker-row placement`);return i};return e.map(r=>{let i=n(r.id),o={id:r.id,title:r.title,center:{x:r.x,y:i.centerY},radius:r.radius,fixed:r.fixed,slackArrows:r.slackArrows?.map(s=>"y"in s?{x:s.x,y:s.y}:{x:s.x,y:n(s.marker).centerY}),isOverrun:r.isOverrun,style:r.style,cutTopY:r.cutTopY,cutBottomY:r.cutBottomY,labelBox:i.labelBox,labelSide:i.labelSide};return r.slipX!==void 0&&(o.slip={x:r.slipX}),r.onWaveBoundary&&(o.onWaveBoundary=!0),r.overrunByWave!==void 0&&(o.overrunByWave=r.overrunByWave),r.overrunDate!==void 0&&(o.overrunDate=r.overrunDate),r.hiddenDate!==void 0&&(o.hiddenDate=r.hiddenDate),o})}function qS(e,t){let n=[];for(let[r,i]of e){if(Te(ie(i.properties,"date")))continue;let o=Sx(Be(i.properties,"after"),t),s=bx(o);if(s.length===0)continue;s.sort((l,c)=>c.endX-l.endX);let a=s[0].endX;for(let l=1;l<s.length;l++){let c=s[l],u=KS(c,a);u&&"y"in u&&n.push({xStart:c.endX,xEnd:a,y:u.y,slackPredId:c.ref,milestoneId:r})}}return n}var zl=16,cW=8,uW=6;function JS(e,t,n,r,i,o){Lx(e.content,t);let s=op(e.content.milestones,t),a=fW(e.content.anchors,s,t);if(a.length===0)return{anchors:[],milestones:[],laneShift:0};let l=zl,c=Ps(a,l,Wi(a,l,o-zl,se),se,ip(s)),u=n+cW,f=u+c.rowCount*26+uW-r,d=i+f,p=Ls(c.placements,u);t.markerRowPlacements=p,t.chartTopY=r+f,t.swimlaneBottomY=d;let m=Bd(e.content.anchors,t,new Set),g=sp(s.map(E=>({...E,cutTopY:t.chartTopY,cutBottomY:d,slackArrows:E.slackArrows?.map(x=>"y"in x?{x:x.x,y:x.y+f}:x)})),p);return{anchors:m,milestones:g,laneShift:f}}function QS(e,t){let n=[...(e.anchors??[]).map(i=>ZS(i,!1)),...(e.milestones??[]).map(i=>ZS(i,!0))];return n.length===0?t:Wi(n,e.box.x+zl,t-zl,se)+zl}function eb(e){let t=0;for(let n of[...e.anchors??[],...e.milestones??[]])t=Math.max(t,n.labelBox.x+n.labelBox.width);return t}function fW(e,t,n){let r=Hl(e,new Map,n.scale),i=o=>({id:o.id,centerX:o.slipX??o.x,radius:o.radius,title:o.title,fontSize:10,bold:!0,...o.slipX!==void 0?{slipFromX:o.x}:{}});return r.push(...t.filter(o=>o.fixed).map(i)),r.push(...t.filter(o=>!o.fixed).map(i)),r}function ZS(e,t){let n="slip"in e?e.slip?.x:void 0;return{id:e.id??"",centerX:n??e.center.x,radius:e.radius,title:e.title,fontSize:10,bold:t,...n!==void 0?{slipFromX:e.center.x}:{}}}function Lx(e,t){for(let n of Hl(e.anchors,e.milestones,t.scale))t.entityLeftEdges.set(n.id,n.centerX),t.entityRightEdges.set(n.id,n.centerX)}var dW=.8,pW=1;function hW(e){let t=[];return nb(e,t),t}function nb(e,t){for(let n of e)if(n.kind==="item"){let r=mW(n);r>0&&n.box.width>0&&t.push({startX:n.box.x,endX:n.box.x+n.box.width,load:r})}else(n.kind==="parallel"||n.kind==="group")&&nb(n.children,t)}function mW(e){return e.capacity?e.capacity.value:e.size?1:0}function rb(e){if(e.capacityValue<=0||e.warnFraction===null&&e.overFraction===null)return null;let t=hW(e.children);if(t.length===0)return null;let n=new Set;for(let s of t)n.add(s.startX),n.add(s.endX);let r=Array.from(n).sort((s,a)=>s-a);if(r.length<2)return null;let i=[];for(let s=0;s<r.length-1;s++){let a=r[s],l=r[s+1],c=(a+l)/2,u=0;for(let f of t)f.startX<=c&&c<f.endX&&(u+=f.load);i.push({startX:a,endX:l,load:u,classification:gW(u,e.capacityValue,e.warnFraction,e.overFraction)})}let o=[];for(let s of i){let a=o[o.length-1];a&&a.classification===s.classification&&a.endX===s.startX?a.endX=s.endX:o.push({...s})}return{segments:o,capacityValue:e.capacityValue,warnFraction:e.warnFraction,overFraction:e.overFraction}}function gW(e,t,n,r){let i=e/t;return r!==null&&i>=r?"red":n!==null&&i>=n?"yellow":"green"}function ib(e,t){let n=t.get("swimlane"),r=tb(ie(e.properties,"utilization-warn-at"),n?ie(n.properties,"utilization-warn-at"):void 0,dW),i=tb(ie(e.properties,"utilization-over-at"),n?ie(n.properties,"utilization-over-at"):void 0,pW);return{warn:r,over:i}}function tb(e,t,n){let i=EW(e??t);return i.kind==="unset"?n:i.kind==="none"?null:i.value}var yW=/^\d+(?:\.\d+)?%$/,xW=/^\d+\.\d+$/;function EW(e){if(e===void 0)return{kind:"unset"};if(e==="none")return{kind:"none"};if(yW.test(e)){let t=parseFloat(e)/100;return Number.isFinite(t)&&t>0?{kind:"number",value:t}:{kind:"unset"}}if(xW.test(e)){let t=parseFloat(e);return Number.isFinite(t)&&t>0?{kind:"number",value:t}:{kind:"unset"}}return{kind:"unset"}}var ap=class{constructor(t){M(this,"rows");M(this,"opts");M(this,"paintedRightX");this.opts=t,this.paintedRightX=t.laneLeftX,this.rows=[{y:t.originY,height:t.minRowHeight,rightEdge:t.laneLeftX,spillX:t.laneLeftX,contentOffsetY:0}]}placeItem(t){let n=this.rows[this.rows.length-1],i=t.desiredStart>=n.rightEdge&&t.desiredStart>=n.spillX&&!this.rowIntersectsCorridor(n,t)&&!this.rowCrossesOwnCorridor(n,t)?n:this.appendRow(Math.max(this.opts.minRowHeight,t.predictedHeight));return{rowIndex:this.rows.length-1,y:i.y+i.contentOffsetY}}placeBlock(){let t=this.rows[this.rows.length-1];if(t.rightEdge>this.opts.laneLeftX){let n=this.appendRow(this.opts.minRowHeight);return{rowIndex:this.rows.length-1,y:n.y}}return{rowIndex:this.rows.length-1,y:t.y}}commitItem(t){let n=this.rows[t.rowIndex];n.height=Math.max(n.height,n.contentOffsetY+Math.max(t.placed.box.height,t.rowHeight??0)),n.rightEdge=t.logicalEnd,n.spillX=t.spillReservation??this.opts.laneLeftX}commitBlock(t){let n=this.rows[t.rowIndex];n.height=Math.max(n.height,t.blockHeight),n.contentOffsetY=t.contentOffsetY??0,n.rightEdge=t.blockEnd,n.spillX=t.spillReservation??this.opts.laneLeftX,t.paintedRight!==void 0&&t.paintedRight>this.paintedRightX&&(this.paintedRightX=t.paintedRight)}usedHeight(){let t=this.rows[this.rows.length-1];return t.y+t.height-this.opts.originY}usedRightX(){let t=this.paintedRightX;for(let n of this.rows)n.rightEdge>t&&(t=n.rightEdge),n.spillX>t&&(t=n.spillX);return t}rowIntersectsCorridor(t,n){return this.opts.slackCorridors.some(r=>r.y>=t.y&&r.y<t.y+t.height&&n.desiredStart<r.xEnd&&n.desiredEnd>r.xStart&&r.slackPredId!==n.childId&&!n.pendingIds?.has(r.slackPredId))}rowCrossesOwnCorridor(t,n){return this.opts.slackCorridors.some(r=>r.slackPredId===n.childId&&r.xStart<n.desiredStart&&t.rightEdge>Math.max(r.xStart,this.opts.laneLeftX))}appendRow(t){let n=this.rows[this.rows.length-1],r={y:n.y+n.height,height:t,rightEdge:this.opts.laneLeftX,spillX:this.opts.laneLeftX,contentOffsetY:0};return this.rows.push(r),r}};function Px(e){return Ve(e)?e.name?[e.name]:[]:_t(e).flatMap(Px)}function lp(e,t,n,r){let i=n.bandScale.step(),o=t.leftX,s=new ap({laneLeftX:o,originY:t.firstRowY,minRowHeight:i,slackCorridors:n.slackCorridors}),a=o,l=Number.POSITIVE_INFINITY,c=new Set(_t(e).flatMap(Px)),u=[];for(let f of _t(e)){for(let C of Px(f))c.delete(C);if(!Ve(f)){let C=Xl(f,a,n),{rowIndex:X,y:V}=s.placeBlock(),$=Gl(C,V),I=r.sequenceOne(f,$,n);u.push(I);let F=I.box.x+I.box.width,N=Math.max(i,$.height),k=sb(I);s.commitBlock({rowIndex:X,placed:I,blockHeight:N,blockEnd:F,contentOffsetY:wW(I),spillReservation:k>F?k:null,paintedRight:Wl(I)}),l=Math.min(l,$.startX),a=Math.max(a,$.x);continue}let d=f,p=Xl(d,a,n),m=n.scale.startX(p),g=Jd(d,m,n),E=m+g.naturalWidth,x=i+g.barExtra,{rowIndex:y,y:w}=s.placeItem({childId:d.name??"",desiredStart:m,desiredEnd:E,predictedHeight:x,pendingIds:c}),_=Gl(p,w),v=Qd(d,_,n,g);u.push(v),l=Math.min(l,_.startX);let R=Math.max(m+g.naturalWidth,v.box.x+v.box.width),B=m+Ns(n,m,g.durationDays);a=Math.max(a,B),s.commitItem({rowIndex:y,placed:v,logicalEnd:R,spillReservation:ob(v),rowHeight:x})}return l===Number.POSITIVE_INFINITY&&(l=n.scale.startX(o)),{children:u,timeCursorX:a,timeStartX:l,packer:s}}function wW(e){return e.kind==="item"?0:(e.children[0]?.box.y??e.box.y)-e.box.y}function ob(e){return e.textSpills||e.chipsOutside||e.dotSpills||e.iconSpills||e.footnoteSpills?Math.max(e.decorationsRightX,e.chipsOutside?e.chipsRightX:0)+6:null}function sb(e){let t=e.box.x+e.box.width;if(e.kind==="item")return Math.max(t,ob(e)??t);let n=ws(e);return Math.max(t,n>t?n+Ok:t,...e.children.map(sb))}var Ox=10;function TW(e,t,n){let r=ie(e.properties,"capacity"),i=Lr(r);if(i===null)return{capacity:null,badgeWidthPx:0};let o=tl(i),s=nl(t.capacityIcon,n),a=rl(o,s,Ox),l=il(o,s,Ox);return{capacity:{value:i,text:o,icon:s,...l!==void 0?{iconDxTerms:l}:{}},badgeWidthPx:a}}var vW=10,_W=38,AW=8;function kW(e,t){let n=ie(e.properties,"owner");if(!n)return;let r=t.teams.get(n);if(r)return{text:r.title??n,kind:"team"};let i=t.persons.get(n);return i?{text:i.title??n,kind:"person"}:{text:n,kind:"team"}}function IW(e,t){if(!e.name)return[];let n=[];for(let[r,i]of t.footnoteHosts.entries())if(i.includes(e.name)){let o=t.footnoteIndex.get(r);o!==void 0&&n.push(o)}return n.sort((r,i)=>r-i),n}function RW(e,t,n){for(let r of e.content)if(r.$type!=="DescriptionDirective")return n.scale.startX(Xl(r,t,n))}var Os=class{constructor(t,n){M(this,"input");M(this,"helpers");this.input=t,this.helpers=n}get id(){return this.input.lane.name??""}place(t,n){let{lane:r,bandIndex:i}=this.input,{helpers:o}=this,s=Se("swimlane",r.properties,n.styleCtx),a=t.x,l=n.bandScale.step(),c=n.currentFlowKey;n.currentFlowKey=`lane:${r.name??i}`;let{capacity:u,badgeWidthPx:f}=TW(r,s,n.symbols),d=IW(r,n),p=d.length>0?se(d.join(","),Ox):0,m=0,g=kW(r,n),E=r.title??r.name??"",x=E?by(m,E,g?.text,f,p):null,y=x?.rightX??0,w=RW(r,a,n),_=!r.title||w===void 0||w>=y+AW,v=t.y+(_?vW:_W),R=lp(r,{leftX:a,firstRowY:v},n,o),{children:B}=R,C=v-t.y,X=Math.max(l+32,C+R.packer.usedHeight()+16),V=Math.max(R.packer.usedRightX(),y),$={x:m,y:t.y,width:0,height:X},I=u?(()=>{let{warn:F,over:N}=ib(r,n.styleCtx.defaults);return rb({children:B,capacityValue:u.value,warnFraction:F,overFraction:N})})():null;return n.currentFlowKey=c,{positioned:{id:r.name,title:E,box:$,bandIndex:i,children:B,nested:[],style:s,owner:g?.text,ownerKind:g?.kind,footnoteIndicators:d,capacity:u,tab:x,utilization:I},usedHeight:X,usedRightX:V}}};var SW=18,bW=14,NW=14,LW=16,PW=24;function Cx(e,t,n,r,i){let o=n+SW,s=[],a=[],l=!0,c=t.footnoteIndex.size;for(let u of e){l||(o+=LW),l=!1;let f=u.content.roadmap?.title??u.sourcePath,d=o+bW,p=Yd(u,{theme:t.styleCtx.theme,cal:t.cal,schedule:t.schedule,timeline:t.timeline,scale:t.scale,calendar:t.calendar,axisColumns:t.axisColumns,bandScale:t.bandScale,waves:t.waves},{chartTopY:d,chartBottomY:d,swimlaneBottomY:d},{footnotes:tp(u.content.footnotes,c)});c+=u.content.footnotes.size,t.waves?Hd(t.waves,p.entityLeftEdges,p.entityRightEdges):Lx(u.content,p);let m=[],g=d,E=0;for(let R of u.content.swimlanes.values()){p.nextParallelId=0,p.nextGroupId=0;let{positioned:B,usedHeight:C}=new Os({lane:R,bandIndex:E},r).place({x:p.timeline.originX,y:g},p);m.push(B),g+=C,E++}let x=JS(u,p,o,d,g,i);if(x.laneShift!==0){for(let R of m)Ss(R,x.laneShift);g+=x.laneShift}let y=g,w=Math.max(t.bandScale.bandwidth(),y-o+NW),_={x:0,y:o,width:0,height:w},v={sourcePath:u.sourcePath,label:f,box:_,nestedSwimlanes:m,style:Se("swimlane",[],t.styleCtx)};x.anchors.length>0&&(v.anchors=x.anchors),x.milestones.length>0&&(v.milestones=x.milestones),s.push(v),a.push(p),o+=w}return{regions:s,contexts:a,endY:o}}function ab(e,t,n){let r=jl(e,t,n);e.box.width=r;for(let i of e.nestedSwimlanes)i.box.width=r}function jl(e,t,n){let r=e.box.x,{chromeRightX:i}=_l(r,e.label,e.sourcePath),o=Xr(e.nestedSwimlanes),s=Math.max(i,o,eb(e),n)+PW;return Math.min(t-r,s-r)}function lb(e,t,n,r){if(!e)return null;let i=t.scale.forwardWithinDomain(e);if(i===null)return null;let o=t.timeline.box.y,s=t.timeline.tickPanelY,a=Yn(n).nowLabel,l=se(a,yl),c=Math.max(ty,Math.ceil(l+2*gs)),u=t.timeline.originX-It,f=c/2,d;i-f<u?d="flag-right":i+f>r?d="flag-left":d="center";let p=t.timeline.bottomTickPanelY,m=t.timeline.bottomTickPanelHeight??0,g=p!==void 0&&m>0?p+m:t.swimlaneBottomY;return{x:i,topY:s,bottomY:g,pillTopY:o,pillMode:d,label:a,pillWidth:c,style:Se("item",[],t.styleCtx)}}function cp(e){let t=e.trim().replace(/^#/,"");if(t.length===3&&(t=t.split("").map(n=>n+n).join("")),!/^[0-9a-fA-F]{6}$/.test(t))throw new Error(`Unsupported hex colour: ${e}`);return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function cb(e){let[t,n,r]=cp(e).map(i=>{let o=i/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function up(e,t){let n=cb(e),r=cb(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var OW=4.5;function db(e,t,n,r,i){if(!e.frozen||!e.solve)throw new Error("buildWaves: the wave barrier has not settled");let o=Gd(e.plan,e.solve,e.pass,e.origin,e.floors,Ot),s=o.every(y=>y.memberCount===0),a=t.timeline.waveStrip??{y:t.timeline.tickPanelY+t.timeline.tickPanelHeight,height:0};if(!t.timeline.waveStrip&&!s)throw new Error("buildWaves: the timeline has no wave strip");let l=t.timeline.box.x,c=l+t.timeline.box.width,u=a.y+ud,f=a.height-2*ud,d=0,p=o.map((y,w)=>{let _=e.plan.waves[w],v=_.title??y.id,R=y.memberCount===0,B=zd(y.start,t),C=OS(y.start,y.end,t),X=R?void 0:d++,V=$W(y.id,t),$=DW(_.properties,X,t),I=Math.max(y.start,l),F=Math.min(y.end,c),N=Math.max(0,F-I),k=St(e.plan.floors[w]?.ref!==void 0?[e.plan.floors[w].ref]:[]),b=k!==void 0&&N>=ul+pt+Gn,T=b?pt+nn:0,L,D=!1;if(!R){if(V.length>0){let K=V.length*Ut;L=ub(v,y.id,w+1,N,K+T),D=L!==void 0}L??(L=ub(v,y.id,w+1,N,T))}let P=R?y.start:(I+F)/2,U=R?$x(B):`${$x(B)} \u2013 ${$x(C)}`,z=[v,U];R?z.push(n.waveNoItems):y.heldBy!==void 0&&z.push(`${n.waveHeldBy} ${y.heldBy}`);let J,Y=o[w-1];if(!s&&Y!==void 0&&y.floorRef!==void 0&&y.start-Y.end>Ot){let K=Math.max(Y.end,l),q=Math.min(y.start,c),Q=se(y.floorRef,Un);if(Q+2*Gn<=q-K){let re=(K+q)/2,le=Q+2*xs;J={text:y.floorRef,x:re,halo:{x:re-le/2,y:u,width:le,height:f}}}}let te={x:y.start,y:a.y,width:y.end-y.start,height:a.height},A=R?void 0:CW(te,t.timeline.box),O,W,G;if(A){b&&k!==void 0&&(G={side:"after",isoDate:k,glyphTopLeft:{x:A.x+ul,y:a.y+(a.height-pt)/2},glyphSize:pt,spilled:!1});let K=A.x+A.width,q=D?V.length*Ut:0;if(q){let Q=K-Gn+xs,re=K-Gn-q-xs;W={rightX:K-Gn,halo:{x:re,y:u,width:Q-re,height:f}}}if(L){let Q=pb(L.label),re=q?Math.min(P,K-Gn-q-Q/2):P,le=G?Math.max(re,G.glyphTopLeft.x+pt+nn+Q/2):re,ce=Q+2*xs;O={x:le,halo:{x:le-ce/2,y:u,width:ce,height:f}}}}return{id:y.id,title:v,index:w,...X!==void 0?{visibleOrdinal:X}:{},startX:y.start,endX:y.end,startDate:B,endDate:C,memberCount:y.memberCount,empty:R,...y.heldBy!==void 0?{heldBy:y.heldBy}:{},...y.floorRef!==void 0?{floorRef:y.floorRef}:{},columnBox:{x:y.start,y:t.chartTopY,width:y.end-y.start,height:t.swimlaneBottomY-t.chartTopY},strip:{box:{x:y.start,y:a.y,width:y.end-y.start,height:a.height},...L?{label:L.label}:{},labelKind:L?.kind??"none",labelX:P,...A?{cell:A}:{},...O?{labelDraw:O}:{},...G?{inlineDatePin:G}:{},...W?{superscripts:W}:{},tooltip:z.join(" \xB7 "),footnotesShown:D,...J?{gapLabel:J}:{}},style:$,footnoteIndicators:V}}),m=s?[]:BW(p,e.origin,a.y,t),g=Dx(r),E=i.map(y=>Dx(y.nestedSwimlanes));return{waves:p,boundaries:m,crossings:fb(g,m),regionCrossings:E.map(y=>fb(y,m)),hasBackground:g.length+E.flat().length>0}}function CW(e,t){let n=bi,r={x:e.x,y:e.y+n,width:e.width,height:e.height-2*n},i={x:t.x+n,y:e.y,width:t.width-2*n,height:e.height},o=Math.max(r.x,i.x),s=Math.max(r.y,i.y),a=Math.min(r.x+r.width,i.x+i.width),l=Math.min(r.y+r.height,i.y+i.height);if(!(a<=o||l<=s))return{x:o,y:s,width:a-o,height:l-s}}function pb(e){return se(e,Un)*1.05}function ub(e,t,n,r,i){let o=a=>pb(a)+i+2*Gn<=r;if(o(e))return{kind:"title",label:e};if(t!==e&&o(t))return{kind:"id",label:t};for(let a=e.length-1;a>=3;a--){let l=e.slice(0,a).trimEnd();if(l.length<3)break;let c=`${l}\u2026`;if(o(c))return{kind:"ellipsis",label:c}}let s=`#${n}`;if(o(s))return{kind:"ordinal",label:s}}function $W(e,t){let n=[];for(let[r,i]of t.footnoteHosts.entries()){if(!i.includes(e))continue;let o=t.footnoteIndex.get(r);o!==void 0&&n.push(o)}return n.sort((r,i)=>r-i)}function DW(e,t,n){let r=n.styleCtx.theme,i=new Map,o=ie(e,"style"),s=o?n.styleCtx.styles.get(o):void 0;for(let d of s?.properties??[])i.set(ee(d),d.value);let a=d=>{let p=i.get(d);if(p===void 0)return;let m=Zn(p,r);return m==="none"?void 0:m},l=a("bg"),c=t!==void 0&&t%2===1?r.wave.stripFillAlt:r.wave.stripFill,u=l?MW(c,l,wl)??c:c,f=i.get("border");return{...l?{tint:l}:{},stripFill:c,text:a("text")??FW(r.wave,u),boundary:a("fg")??r.wave.boundary,boundaryDash:f==="dashed"?"4 2":f==="dotted"?"1 2":null}}var fp=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function MW(e,t,n){if(!fp.test(e)||!fp.test(t))return;let r=cp(e),i=cp(t);return`#${r.map((o,s)=>Math.round(o*(1-n)+i[s]*n).toString(16).padStart(2,"0")).join("")}`}function FW(e,t){let n=e.labelText;return!fp.test(n)||!fp.test(t)||up(n,t)>=OW?n:up(e.hatch,t)>=up(e.hatchOnDark,t)?e.hatch:e.hatchOnDark}function BW(e,t,n,r){let i=[];for(let a of e)a.empty||(i.push({x:a.startX,wave:a,opening:!0}),i.push({x:a.endX,wave:a,opening:!1}));i.sort((a,l)=>a.x-l.x);let o=[],s=0;for(;s<i.length;){let a=s;for(;a<i.length&&i[a].x-i[s].x<Ot;)a++;let l=i.slice(s,a);s=a;let c=l[0].x;if(Math.abs(c-t)<Ot)continue;let u=(l.find(f=>f.opening)??l[0]).wave;o.push({x:c,topY:n,bottomY:r.swimlaneBottomY,stroke:u.style.boundary,dash:u.style.boundaryDash})}return o}function Dx(e){let t=[],n=r=>{for(let i of r)i.kind==="item"?i.waveRole==="background"&&t.push(i):n(i.children)};for(let r of e)n(r.children),t.push(...Dx(r.nested));return t}function fb(e,t){let n=[];for(let r of e){let i=r.box.x,o=r.box.x+r.box.width;for(let s of t)i<s.x&&s.x<o&&n.push({x:s.x,topY:r.box.y,bottomY:r.box.y+r.box.height,stroke:s.stroke})}return n}function hb(e,t,n,r){if(!e.hasBackground)return;let i=t.timeline.originX,o=n.waveLegendBackground,s=fd+wy,a=s+se(o,Un),l={kind:"background",text:o,swatch:{x:i,y:r+(ld-dd)/2,width:fd,height:dd},hatch:jd(t.styleCtx.theme.entities.item.bg),runs:[{text:o,x:i+s,y:r+Ty}]};return{box:{x:i,y:r,width:a,height:ld},entries:[l]}}function $x(e){return e.toISOString().slice(0,10)}var mb=1e-6,Cs=class{constructor(t){M(this,"domain");M(this,"range");M(this,"pixelsPerDay");M(this,"calendar");M(this,"nonWorking");this.domain=t.domain,this.range=t.range,this.calendar=t.calendar,this.nonWorking=t.nonWorking??"hide";let n=Math.max(1,this.showsNonWorking?kt(t.domain[0],t.domain[1]):this.indexOf(t.domain[1]));this.pixelsPerDay=(t.range[1]-t.range[0])/n}get showsNonWorking(){return this.nonWorking==="show"&&this.calendar?.hasNonWorkingDays===!0}indexOf(t){return this.calendar?this.calendar.workingIndexOf(this.domain[0],t):kt(this.domain[0],t)}dayAt(t){let n=(t-this.range[0])/this.pixelsPerDay;return{days:n,day:Math.floor(n+mb)}}forward(t){return this.showsNonWorking?this.range[0]+kt(this.domain[0],t)*this.pixelsPerDay:this.range[0]+this.indexOf(t)*this.pixelsPerDay}forwardWithinDomain(t){return t<this.domain[0]||t>this.domain[1]?null:this.forward(t)}invert(t){let n=Math.round((t-this.range[0])/this.pixelsPerDay);return this.showsNonWorking?Xe(this.domain[0],n):this.calendar?this.calendar.dateAtWorkingIndex(this.domain[0],n):Xe(this.domain[0],n)}indexAtX(t){let{days:n,day:r}=this.dayAt(t);if(!this.showsNonWorking||!this.calendar)return n;let i=Xe(this.domain[0],r),o=this.calendar.workingIndexOf(this.domain[0],i);return this.calendar.isWorkingDay(i)?o+Math.max(0,n-r):o}startX(t){if(!this.showsNonWorking||!this.calendar)return t;let n=Xe(this.domain[0],this.dayAt(t).day);if(this.calendar.isWorkingDay(n))return t;let r=this.calendar.workingIndexOf(this.domain[0],n);return this.forward(this.calendar.dateAtWorkingIndex(this.domain[0],r))}advanceX(t,n){if(!this.showsNonWorking||!this.calendar)return t+n*this.pixelsPerDay;let r=this.startX(t);if(n<=0)return r;let i=this.indexAtX(r)+n,o=Math.ceil(i-mb)-1,s=i-o,a=this.calendar.dateAtWorkingIndex(this.domain[0],o);return this.forward(a)+s*this.pixelsPerDay}get originX(){return this.range[0]}get widthPx(){return this.range[1]-this.range[0]}};var dp=6,XW=4,gb=8,hp=class{constructor(t){M(this,"input");this.input=t}measure(){let{title:t,author:n,style:r,logo:i}=this.input,o=r.headerPosition==="beside",s=UW(t,n,i),a=i?Math.max(oy,i.height+20):oy;return{position:r.headerPosition,titleLines:s.titleLines,authorLines:s.authorLines,cardWidth:s.cardWidth,cardHeight:s.cardHeight,textCardHeight:s.textCardHeight,logoSlot:s.logoSlot,...i?{logo:i}:{},chartLeftX:o?s.boxWidth:0,aboveHeight:a,chartTopY:o?gb:a+gb,minRowsBottomY:o?s.cardHeight+XW:0}}place(t,n){let{title:r,author:i,style:o}=this.input,s=t.position==="beside",a=s?{x:0,y:0,width:t.chartLeftX,height:n.chartBottomY}:{x:0,y:0,width:n.canvasRightX,height:t.aboveHeight},l=s?{x:dp,y:n.rowsBottomY-t.cardHeight,width:t.cardWidth,height:t.cardHeight}:{x:0,y:0,width:n.canvasRightX,height:t.aboveHeight},c,u;return t.logo&&(c={box:{x:a.x+l.x+16,y:a.y+l.y+(l.height-t.logo.height)/2,width:t.logo.width,height:t.logo.height},assetRef:t.logo.assetRef,intrinsic:t.logo.intrinsic},u={x:t.logoSlot,y:Math.max(0,(l.height-t.textCardHeight)/2)}),{box:a,position:o.headerPosition,title:r,author:i,titleLines:t.titleLines,authorLines:t.authorLines,cardBox:l,logo:c,...u?{textInset:u}:{},style:o}}};function UW(e,t,n){let r=iy-32,i=Ti(e,r,16),o=Ti(t??"",r,11),s=0;for(let E of i)s=Math.max(s,se(E,16));for(let E of o)s=Math.max(s,se(E,11));let a=i.length>0||o.length>0,l=n?n.width+(a?12:0):0,c=s+32,u=Math.max(Rk-dp,Math.min(iy-dp,c)+l),f=i.length>0?(i.length-1)*20:0,d=o.length>0?18+(o.length-1)*14:0,p=26+f+d+14,m=n?Math.max(p,n.height+20):p,g=u+dp;return{titleLines:i,authorLines:o,cardWidth:u,cardHeight:m,textCardHeight:p,logoSlot:l,boxWidth:g}}function mp(e){for(let t of e.waves?.values()??[])if(t.memberCount>0)return!0;return!1}function Yl(e,t,n={}){let r=qf(e,t),{config:i,working:o}=r,s=fs(t.content.sizes,i),a=ie(e.roadmapDecl?.properties??[],"start"),l=Te(a)??GW(n.today??new Date),c=N=>o.workingIndexOf(l,N),u=N=>o.dateAtWorkingIndex(l,N),f=(N,k)=>Kf(o,l,N,k),d=0,p=N=>{d=Math.max(d,N)},m=new Map,g=new Map,E=new Map,x=new Map,y=new WeakMap,w=new Map,_=new WeakMap,v=new Map;for(let[N,k]of t.content.anchors){let b=Te(ie(k.properties,"date"));if(b){let T=c(b);g.set(N,T),v.set(N,b),p(T)}}let R=(N,k)=>{for(let[b,T]of N){let L=Te(ie(T.properties,"date"));L&&k.set(b,c(L))}};R(t.content.milestones,E);let B=()=>({itemEnd:m,anchorEnd:g,milestoneEnd:E,sizes:s,itemResults:x,inByNode:!0}),C=(N,k,b)=>{let T=P=>{if("date"in P)return c(P.date);let U=P.ref;return N.itemEnd.has(U)?N.itemEnd.get(U):N.anchorEnd.has(U)?N.anchorEnd.get(U):N.milestoneEnd.has(U)?N.milestoneEnd.get(U):0},L=(P,U)=>{let z=U;for(let J of _t(P))z=D(J,z),b(z);return z},D=(P,U)=>{if(Ve(P)){let z=JA(P.properties,N.sizes,i),{after:J}=Ur(P.properties),Y=J.length>0?Math.max(U,...J.map(T)):U;k&&(Y=k.apply(P,Y));let te=Y+z,A={start:u(Y),end:f(Y,te),days:z};return N.inByNode&&y.set(P,A),P.name&&(N.itemEnd.set(P.name,te),N.itemResults?.set(P.name,A)),k?.accumulate(P,te),te}if(et(P)){let{after:z}=Ur(P.properties),J=z.length>0?Math.max(U,...z.map(T)):U;k&&(J=k.apply(P,J));let Y=J;for(let te of _t(P))Y=Math.max(Y,D(te,J));return P.name&&N.itemEnd.set(P.name,Y),Y}if($e(P)){let{after:z}=Ur(P.properties),J=z.length>0?Math.max(U,...z.map(T)):U;k&&(J=k.apply(P,J));let Y=L(P,J);return P.name&&N.itemEnd.set(P.name,Y),Y}return U};return{walkLane:L,resolveAfterDay:T}},X=(N,k)=>{let b=Te(ie(N.properties,"date"));if(b)return c(b);let{after:T}=Ur(N.properties);return T.length>0?Math.max(0,...T.map(k)):void 0},V=(N,k)=>{let b=new Map,T=new Map,L=new Map;for(let[U,z]of N.anchors){let J=Te(ie(z.properties,"date"));if(J){let Y=c(J);T.set(U,Y),p(Y)}}R(N.milestones,L);let{walkLane:D,resolveAfterDay:P}=C({itemEnd:b,anchorEnd:T,milestoneEnd:L,sizes:fs(N.sizes,i),inByNode:k},void 0,p);for(let U of N.swimlanes.values())D(U,0);for(let[U,z]of N.milestones){let J=X(z,P);J!==void 0&&(L.set(U,J),p(J))}for(let U of N.isolatedRegions)V(U.content,!1)},$=n.plan!==void 0?n.plan??void 0:Mi(t),I;if($){let N=$.waves.map(P=>P.name),k=IS($,l,o),b,T=0,L=P=>{T=Math.max(T,P)},D=Ud(N.length,0,k,(P,U)=>{let z=N.map((te,A)=>[te,U[A]]);m=new Map(z),x=new Map,y=new WeakMap,T=0;let J=new Bi($,P),{walkLane:Y}=C(B(),J,L);for(let te of t.content.swimlanes.values())Y(te,0);for(let te of t.content.isolatedRegions){let A=C({itemEnd:new Map(z),anchorEnd:new Map,milestoneEnd:new Map,sizes:fs(te.content.sizes,i),inByNode:!0},J,L);for(let O of te.content.swimlanes.values())A.walkLane(O,0)}return b=J,J});p(Math.max(T,...D.S,...D.E.slice(-1))),I=new Map;for(let P of Gd($,D,b,0,k))I.set(P.id,{index:P.index,start:u(P.start),end:f(P.start,P.end),memberCount:P.memberCount,...P.heldBy!==void 0?{heldBy:P.heldBy}:{},...P.floorRef!==void 0?{floorRef:P.floorRef}:{}})}else{let{walkLane:N}=C(B(),void 0,p);for(let k of t.content.swimlanes.values())N(k,0)}let{resolveAfterDay:F}=C(B(),void 0,p);for(let[N,k]of t.content.milestones){let b=X(k,F);if(b===void 0)continue;let T=Te(ie(k.properties,"date"))??u(b);E.set(N,b),w.set(N,T),_.set(k,T),p(b)}if(!$)for(let N of t.content.isolatedRegions)V(N.content,!0);return{startDate:l,calendar:r,items:x,byNode:y,milestones:w,milestoneByNode:_,anchors:v,...I?{waves:I}:{},...$?{plan:$}:{},resolved:t,extent:{contentEndDay:d}}}function GW(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))}var HW=8;function Eb(e,t,n,r,i){let{locale:o,styleCtx:s}=r,{calendar:a,preset:l,startDate:c,timelineDays:u,nonWorking:f}=i,d=i.naturalEndDate,p=mp(i.schedule)?i.schedule.plan:void 0,m=r.roadmapStyle,g=dl[m.headerHeight]??dl.md,E=g>0&&m.timelinePosition!=="bottom",x=g>0&&(m.timelinePosition==="bottom"||m.timelinePosition==="both"),y=e.roadmapDecl?.title??e.roadmapDecl?.name??"",w=ie(e.roadmapDecl?.properties??[],"author"),_=new hp({title:y,author:w,style:m,logo:zk(e,n.logo)}),v=_.measure(),{chartLeftX:R}=v,B=yk({naturalPixelsPerDay:l.pixelsPerUnit/a.daysPerUnit(l.unit),dayCount:u,chromeWidth:R+2*It,maxWidth:n.width}),C=u*B,X=R+It,V=C,I=n.today!==void 0&&n.today>=c&&n.today<=d?Gt:0,F=E?g:0,N=p?py:0,k=new Cs({domain:[c,d],range:[X,X+C],calendar:a,nonWorking:f}),b=rp(hx(k,[],l.unit,!1),mx(k)),T=t.content.anchors.size+t.content.milestones.size>0||b.length>0,L=X+V+It,D=Hl(t.content.anchors,t.content.milestones,k),P=[...D,...b],U=Ps(P,R,Wi(P,R,L,se),se),z=T?Math.max(1,U.rowCount):0,J=z*26,Y=I+F+N+J,te=Y+HW,A=Xx(v,Y),O=A+I,W=O+F,G=W+N,K=Fd(k,l,a,o),q={box:{x:X,y:A,width:C,height:0},ticks:K,pixelsPerDay:B,originX:X,startDate:c,endDate:d,labelStyle:Se("roadmap",[],s),pillRowHeight:I,tickPanelY:O,tickPanelHeight:F,markerRow:{y:G+13,height:J,collisionY:G-8},minorGrid:m.minorGrid,...p?{waveStrip:{y:W,height:N}}:{}};return Ux(q,k,l.unit),{header:v,headerNode:_,axis:{originX:X,ppd:B,naturalWidth:C,scale:k},naturalChartRightX:L,bands:{timelineY:A,pillRowHeight:I,tickPanelY:O,tickPanelHeight:F,waveStripY:W,markerRowY:G,estimatedMarkerRows:z,rowsHeight:Y,chartTopY:A+te,bottomTickPanelHeight:x?g:0},timeline:q,markers:{datePinned:D,placements:Ls(U.placements,G),hasEntities:T}}}function Xx(e,t){return Math.max(e.chartTopY,e.minRowsBottomY-t)}function Ux(e,t,n){let r=hx(t,e.ticks,n,e.minorGrid);r&&(e.nonWorkingDisplay=t.showsNonWorking?"show":"hide",e.nonWorking=r);let i=mx(t);i&&(e.workingExceptions=i)}var wb=8,Gx=class{constructor(t){M(this,"rightX");M(this,"frozen",!1);this.rightX=t}grow(t){if(this.frozen)throw new Error("layout: the canvas grew after it was frozen");return t<=this.rightX?!1:(this.rightX=t,!0)}freeze(){this.frozen=!0}get provisional(){return this.rightX}get final(){if(!this.frozen)throw new Error("layout: the canvas was read before it was final");return this.rightX}},zW;var gp=class{constructor(t,n,r,i,o,s,a){M(this,"file");M(this,"resolved");M(this,"options");M(this,"scope");M(this,"window");M(this,"measured");M(this,"chart");M(this,"canvas");M(this,"chartY");M(this,"draft",{});M(this,"scaleIsFinal",!1);M(this,"band");M(this,"rowsTop");M(this,"rowsBottom");M(this,"why");this.file=t,this.resolved=n,this.options=r,this.scope=i,this.window=o,this.measured=s,this.chart=a,this.canvas=new Gx(s.naturalChartRightX);let l=a.ctx;this.chartY={get top(){return l.chartTopY},set top(c){l.chartTopY=c},get swimlaneBottom(){return l.swimlaneBottomY},set swimlaneBottom(c){l.swimlaneBottomY=c},get bottom(){return l.chartBottomY},set bottom(c){l.chartBottomY=c}}}get ctx(){return this.chart.ctx}get scale(){return this.chart.ctx.scale}finalScale(){if(!this.scaleIsFinal)throw new Error("layout: the final scale was read before the timeline extension");return this.chart.ctx.scale}extendScale(t){if(this.scaleIsFinal)throw new Error("layout: the scale was extended after it was final");this.chart.ctx.scale=t}settleScale(){this.scaleIsFinal=!0}markerBand(){if(!this.band)throw new Error("layout: the marker band was read before the final pack");return this.band}setMarkerBand(t){if(this.band)throw new Error("layout: the marker band was packed twice");this.band=t,this.chart.ctx.markerRowPlacements=t.placements}headerRowsTop(){return this.rowsTop||(this.rowsTop=jW(this.measured,this.options.today,this.finalScale())),this.rowsTop}headerRowsBottom(){if(this.rowsBottom===void 0)throw new Error("layout: the header rows bottom was read before the rows grew");return this.rowsBottom}setHeaderRowsBottom(t){if(this.rowsBottom!==void 0)throw new Error("layout: the header rows grew twice");this.rowsBottom=t}explain(t){this.why=t}report(t,n){zW?.(t,n,this.why),this.why=void 0}};function jW(e,t,n){let{bands:r,header:i}=e;if(!(r.pillRowHeight===0&&t!==void 0&&n.forwardWithinDomain(t)!==null))return{timelineY:r.timelineY,pillRowHeight:r.pillRowHeight,tickPanelY:r.tickPanelY,markerRowY:r.markerRowY,shift:0};let s=Xx(i,Gt+r.rowsHeight),a=s+Gt,l=a-r.tickPanelY;return{timelineY:s,pillRowHeight:Gt,tickPanelY:a,markerRowY:r.markerRowY+l,shift:l}}function YW(e){return e.canvas.grow(e.chart.maxRightX+It)}function VW(e){let{swimlanes:t,includes:n,milestones:r}=e.chart,{calendar:i,preset:o,startDate:s,spanDays:a,nonWorking:l}=e.window,{originX:c,ppd:u}=e.measured.axis,f=e.measured.timeline,d=Xr(t);for(let R of n)d=Math.max(d,Xr(R.nestedSwimlanes));let p=0;for(let R of e.measured.markers.datePinned)p=Math.max(p,R.centerX+R.radius);let m=0;for(let R of r)R.fixed?p=Math.max(p,R.x+R.radius):m=Math.max(m,R.x+R.radius);for(let R of n){for(let B of R.anchors??[])p=Math.max(p,B.center.x+B.radius);for(let B of R.milestones??[])B.fixed?p=Math.max(p,B.center.x+B.radius):m=Math.max(m,B.center.x+B.radius)}let g=Math.max(d,p,m),E=i.daysPerUnit(o.unit),x=e.scale.showsNonWorking?e.scale.indexAtX(g):(g-c)/u,y=x>0?Fi(s,x,o.unit,E,i):0,w=bs(t);for(let R of n)w=Math.max(w,bs(R.nestedSwimlanes));let _=new Rs(e.window,e.scale);if(w>0){let R=Math.max(a,y);_.isPast(w,R)&&(y=Math.max(y,Math.min(_.boundaryAtOrAfterX(w),_.captionLimit(R))))}let v=!1;if(y>a){let R={bar:d,caption:w,datedMarker:p,afterMilestone:m};e.explain(Object.keys(R).filter(V=>R[V]>0&&_.isPast(R[V],a)));let B=i.dateAtWorkingIndex(s,y),C=e.scale.showsNonWorking?kt(s,B)*u:y*u,X=new Cs({domain:[s,B],range:[c,c+C],calendar:i,nonWorking:l});e.extendScale(X),f.endDate=B,f.box.width=C,f.ticks=Fd(X,o,i,e.scope.locale),Ux(f,X,o.unit),e.canvas.grow(c+C+It),v=!0}return e.settleScale(),v}function KW(e){let t=e.measured.timeline,n=new Map;for(let l of e.chart.milestones)l.slipX!==void 0&&n.set(l.id,l.slipX);let r=e.measured.markers.datePinned.map(l=>{let c=l.isMilestone?n.get(l.id):void 0;return{id:l.id,centerX:c??l.centerX,radius:l.radius,title:l.title,fontSize:l.fontSize,bold:l.bold,...c!==void 0?{slipFromX:l.centerX}:{}}});for(let l of e.chart.milestones)l.fixed||r.push({id:l.id,centerX:l.x,radius:l.radius,title:l.title,fontSize:10,bold:!0});let i=rp(t.nonWorking,t.workingExceptions);r.push(...i),e.draft.markerEntries={all:r,calendarCount:i.length};let o=Wi(r,e.measured.header.chartLeftX,e.canvas.provisional,se),s=Tb(e,e.draft.markerEntries);for(let l of e.chart.includes)o=Math.max(o,QS(l,e.canvas.provisional)),o=Math.max(o,l.box.x+jl(l,Number.POSITIVE_INFINITY,s));let a=e.canvas.grow(o);return e.canvas.freeze(),a}function Tb(e,t){let{swimlanes:n,includes:r}=e.chart,i=Math.max(Xr(n),bs(n));for(let s of r){i=Math.max(i,Xr(s.nestedSwimlanes),bs(s.nestedSwimlanes));for(let a of[...s.anchors??[],...s.milestones??[]])i=Math.max(i,a.labelBox.x+a.labelBox.width)}if(t){let s=t.all.slice(0,t.all.length-t.calendarCount);for(let a of s){let l=se(a.title,a.fontSize)*(a.bold?1.05:1);i=Math.max(i,a.centerX+a.radius+6+l)}}let o=e.options.today?e.scale.forwardWithinDomain(e.options.today):null;return o!==null&&(i=Math.max(i,o)),i}function qW(e){let t=e.canvas.final,n=e.measured.naturalChartRightX,r=Tb(e,Ct(e.draft.markerEntries,"the marker entries")),i=e.chart.swimlanes.length>0&&t!==n;for(let o of e.chart.swimlanes)o.box.width=t;for(let o of e.chart.includes)jl(o,t,r)!==jl(o,n,r)&&(i=!0),ab(o,t,r);return i}function ZW(e){let t=Ct(e.draft.markerEntries,"the marker entries"),n=Ps(t.all,e.measured.header.chartLeftX,e.canvas.final,se,ip(e.chart.milestones)),r=Ls(n.placements,e.headerRowsTop().markerRowY),i=e.measured.markers.hasEntities||t.calendarCount>0?Math.max(1,n.rowCount):0;e.setMarkerBand({rowCount:i,placements:r});let o=!1;for(let[s,a]of e.measured.markers.placements){let l=r.get(s);(!l||!fX(a,l))&&(o=!0)}return o}function JW(e){let t=e.markerBand(),n=e.ctx,r=e.measured.timeline,i=sp(e.chart.milestones,t.placements),o=i.some(s=>n.entityMidpoints.get(s.id??"")?.y!==s.center.y);for(let s of r.nonWorking??[]){if(s.label===void 0)continue;let a=t.placements.get(Ix(s));a&&(s.labelBox=a.labelBox,s.labelSide=a.labelSide)}for(let s of r.workingExceptions??[]){let a=t.placements.get(Rx(s));a&&(s.labelBox=a.labelBox,s.labelSide=a.labelSide)}for(let s of e.measured.markers.datePinned){let a=t.placements.get(s.id);a&&n.entityMidpoints.set(s.id,{x:s.centerX,y:a.centerY})}for(let s of i)s.fixed||n.entityMidpoints.set(s.id??"",{x:s.center.x,y:s.center.y});return e.draft.milestones=i,o}function QW(e){let t=e.markerBand(),n=e.headerRowsTop(),r=e.measured.bands,i=r.estimatedMarkerRows,s=e.ctx.timeline,a=!1;n.pillRowHeight!==r.pillRowHeight&&(s.box.y=n.timelineY,s.pillRowHeight=n.pillRowHeight,s.tickPanelY=n.tickPanelY,s.waveStrip&&(s.waveStrip.y+=n.shift),s.markerRow.y+=n.shift,s.markerRow.collisionY+=n.shift,a=!0);let l=n.shift;t.rowCount>i&&(l+=(t.rowCount-i)*26,s.markerRow.height=t.rowCount*26,a=!0),e.setHeaderRowsBottom(n.markerRowY+s.markerRow.height);let c=r.chartTopY+l;e.chartY.top=c,e.chartY.bottom+=c,e.chartY.swimlaneBottom+=c,s.box.height=e.chartY.bottom-s.box.y;for(let d of e.chart.swimlanes)Ss(d,c);for(let d of e.chart.includes)xS(d,c);let u=e.chart.milestones,f=Ct(e.draft.milestones,"the milestones");for(let d=0;d<f.length;d++)ES(f[d],u[d],c);return a}function eX(e){let t=e.measured.bands.bottomTickPanelHeight;return t<=0?!1:(e.ctx.timeline.bottomTickPanelY=e.chartY.bottom+wb,e.ctx.timeline.bottomTickPanelHeight=t,e.chartY.bottom+=wb+t,!0)}function tX(e){e.finalScale();let t=e.ctx;if(!t.waves)return!1;let n=db(t.waves,t,Yn(e.scope.locale),e.chart.swimlanes,e.chart.includes);return n.regionCrossings.forEach((r,i)=>{r.length>0&&(e.chart.includes[i].waveCrossings=r)}),e.draft.waves=n,!0}function nX(e){e.finalScale(),e.markerBand();let t=new Set(Ct(e.draft.milestones,"the milestones").map(r=>r.center.x)),n=Bd(e.resolved.content.anchors,e.ctx,t);return e.draft.anchors=n,n.length>0}function rX(e){let t=Ax(e.chart.laneEntries),n=kx(t,e.chart.swimlanes,e.chart.includes,e.ctx);e.draft.edges=n;let r=0;return e.resolved.content.isolatedRegions.forEach((i,o)=>{let s=e.chart.includes[o],a=e.chart.regionContexts[o];if(!s||!a)return;let l=kx(Ax([...i.content.swimlanes.values()]),s.nestedSwimlanes,[],a);l.length>0&&(s.edges=l),r+=l.length}),n.length+r>0}function iX(e){e.finalScale();let t=lb(e.options.today,e.ctx,e.scope.locale,e.canvas.final);return e.draft.nowline=t,t!==null}function oX(e){let t=e.draft.waves;if(!t)return!1;let n=hb(t,e.ctx,Yn(e.scope.locale),e.chartY.bottom+cd);return n?(e.chartY.bottom+=cd+n.box.height,e.draft.waveLegend=n,!0):!1}function sX(e){let t=e.resolved.content.isolatedRegions.flatMap((r,i)=>{let o=e.chart.regionContexts[i],s=e.chart.includes[i];return o&&s?[{title:s.label,footnotes:r.content.footnotes,ctx:o}]:[]}),n=zS(e.resolved.content.footnotes,e.ctx,e.chartY.bottom,e.canvas.final,t);return e.draft.footnotes=n,n.entries.length>0}function aX(e){let{header:t,headerNode:n}=e.measured;return e.draft.header=n.place(t,{rowsBottomY:e.headerRowsBottom(),chartBottomY:e.chartY.bottom,canvasRightX:e.canvas.final}),t.position==="beside"}function lX(e){let t=Ct(e.draft.footnotes,"the footnote panel"),n=e.canvas.final,r=t.entries.length>0?t.box.y+t.box.height:e.chartY.bottom,i={x:n-It-uy,y:r+It,width:uy,height:bk};return e.draft.attributionBox=i,e.draft.height=i.y+i.height+It,!0}var cX=[{name:"growCanvasForSpill",reads:["placement"],writes:["canvas"],run:YW},{name:"extendTimeline",reads:["placement","window","scale"],writes:["scale","timeline","calendarRuns","canvas"],run:VW},{name:"growCanvasForMarkerLabels",reads:["placement","calendarRuns","canvas","scale"],writes:["markerEntries","canvas"],run:KW},{name:"fitWidths",reads:["placement","canvas","markerEntries","scale"],writes:["laneWidths"],run:qW},{name:"packMarkers",reads:["placement","canvas","markerEntries","headerBands","scale"],writes:["markerBand"],run:ZW},{name:"placeMarkers",reads:["placement","markerBand","calendarRuns"],writes:["milestones","calendarLabels","markerMidpoints"],run:JW},{name:"growHeaderRows",reads:["placement","markerBand","headerBands","scale","milestones","chartTop","laneBottom"],writes:["chartTop","rowsBottom","laneBottom","chartBottom","laneY","milestones","timeline"],run:QW},{name:"bottomTickPanel",reads:["headerBands","chartBottom"],writes:["chartBottom","timeline"],run:eX},{name:"waves",reads:["scale","chartTop","laneBottom","timeline","laneY"],writes:["waves","timeline"],run:tX},{name:"anchors",reads:["scale","markerBand","chartTop","laneBottom","milestones"],writes:["anchors","markerMidpoints"],run:nX},{name:"dependencyEdges",reads:["laneY","markerMidpoints"],writes:["edges"],run:rX},{name:"nowline",reads:["scale","canvas","laneBottom","timeline"],writes:["nowline"],run:iX},{name:"waveLegend",reads:["waves","canvas","chartBottom"],writes:["legend","chartBottom"],run:oX},{name:"footnotePanel",reads:["chartBottom","canvas"],writes:["footnotes"],run:sX},{name:"header",reads:["chartBottom","canvas","rowsBottom"],writes:["header"],run:aX},{name:"attribution",reads:["footnotes","chartBottom","canvas"],writes:["attribution"],run:lX}];function vb(e,t=cX){for(let n of t)e.report(n.name,n.run(e));return uX(e)}function uX(e){let{draft:t}=e,{themeName:n,theme:r}=e.scope,{swimlanes:i,includes:o,waveSolve:s}=e.chart,a=e.canvas.final,l=e.measured.header.chartLeftX,c=t.waves,u=t.waveLegend;return{width:a,height:Ct(t.height,"the canvas height"),theme:n,palette:r,backgroundColor:r.surface.page,header:{...Ct(t.header,"the header"),attributionBox:Ct(t.attributionBox,"the attribution box")},timeline:e.measured.timeline,nowline:Ct(t.nowline,"the now-line"),swimlanes:i,anchors:Ct(t.anchors,"the anchors"),milestones:Ct(t.milestones,"the milestones"),edges:Ct(t.edges,"the edges"),footnotes:Ct(t.footnotes,"the footnote panel"),includes:o,chartBox:{x:l,y:e.chartY.top,width:a-l,height:e.chartY.bottom-e.chartY.top},...s?{waveSolve:s}:{},...c?{waves:c.waves}:{},...c&&c.boundaries.length>0?{waveBoundaries:c.boundaries}:{},...c&&c.crossings.length>0?{waveCrossings:c.crossings}:{},...u?{waveLegend:u}:{}}}function Ct(e,t){if(e===void 0)throw new Error(`layout: ${t} was read before its step ran`);return e}function fX(e,t){return e.rowIndex===t.rowIndex&&e.centerY===t.centerY&&e.labelSide===t.labelSide&&e.labelBox.x===t.labelBox.x&&e.labelBox.y===t.labelBox.y&&e.labelBox.width===t.labelBox.width&&e.labelBox.height===t.labelBox.height}var $s=class extends Map{constructor(t,n=hX){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(_b(this,t))}has(t){return super.has(_b(this,t))}set(t,n){return super.set(dX(this,t),n)}delete(t){return super.delete(pX(this,t))}};function _b({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function dX({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function pX({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function hX(e){return e!==null&&typeof e=="object"?e.valueOf():e}function yp(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function xp(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var Ab=Symbol("implicit");function Ep(){var e=new $s,t=[],n=[],r=Ab;function i(o){let s=e.get(o);if(s===void 0){if(r!==Ab)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new $s;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Ep(t,n).unknown(r)},xp.apply(i,arguments),i}function Vl(){var e=Ep().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,l=0,c=0,u=.5;delete e.unknown;function f(){var d=t().length,p=i<r,m=p?i:r,g=p?r:i;o=(g-m)/Math.max(1,d-l+c*2),a&&(o=Math.floor(o)),m+=(g-m-o*(d-l))*u,s=o*(1-l),a&&(m=Math.round(m),s=Math.round(s));var E=yp(d).map(function(x){return m+o*x});return n(p?E.reverse():E)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(l=Math.min(1,c=+d),f()):l},e.paddingInner=function(d){return arguments.length?(l=Math.min(1,d),f()):l},e.paddingOuter=function(d){return arguments.length?(c=+d,f()):c},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Vl(t(),[r,i]).round(a).paddingInner(l).paddingOuter(c).align(u)},xp.apply(f(),arguments)}var Hx=class e{constructor(t,n,r){M(this,"bandwidthPx");M(this,"stepPx");M(this,"d3");this.bandwidthPx=t,this.stepPx=n,this.d3=r}static fixedRow(t){return new e(t.bandwidth,t.step)}static forRows(t){let n=Array.from({length:t.count},(i,o)=>String(o)),r=Vl().domain(n).range(t.range).paddingInner(t.paddingInner??0).paddingOuter(t.paddingOuter??0);return new e(r.bandwidth(),r.step(),r)}bandwidth(){return this.bandwidthPx}step(){return this.stepPx}forward(t){if(!this.d3)throw new Error("BandScale.forward is only available on closed-domain bands (BandScale.forRows)");let n=this.d3(t);if(n===void 0)throw new Error(`BandScale: unknown band id "${t}"`);return n}},mX={bandwidth:56,step:64};function kb(){return Hx.fixedRow(mX)}var Ib=8;function Rb(e,t,n,r,i){let{theme:o,styleCtx:s}=t,{cal:a,calendar:l,schedule:c}=n,u=c.plan,{originX:f,scale:d}=r.axis,{timeline:p}=r,m=Yd(e,{theme:o,cal:a,schedule:c,timeline:p,scale:d,calendar:l,axisColumns:new Rs(n,d),bandScale:kb(),waves:u?RS(u,d,f,Yn(t.locale).waveBackgroundItem,mp(c)):void 0},{chartTopY:0,chartBottomY:0,swimlaneBottomY:0},{footnotes:tp(e.content.footnotes),markerRowPlacements:new Map(r.markers.placements)});for(let T of r.markers.datePinned){let L=m.markerRowPlacements.get(T.id);L&&(m.entityLeftEdges.set(T.id,T.centerX),m.entityRightEdges.set(T.id,T.centerX),m.entityMidpoints.set(T.id,{x:T.centerX,y:L.centerY}))}let g=new Map(m.entityLeftEdges),E=new Map(m.entityRightEdges),x=new Map(m.entityMidpoints),y=()=>{m.entityLeftEdges=new Map(g),m.entityRightEdges=new Map(E),m.entityMidpoints=new Map(x),m.placedItems=new Map,m.itemFlowKey=new Map,m.currentFlowKey="",m.waves&&Hd(m.waves,m.entityLeftEdges,m.entityRightEdges)},w=[...e.content.swimlanes.values()],_=Se("swimlane",[],s),v=vk[_.spacing]??0,R=()=>{m.nextParallelId=0,m.nextGroupId=0;let T=[],L=m.chartTopY,D=0,P=m.timeline.originX;for(let U of w){D>0&&(L+=v);let{positioned:z,usedHeight:J,usedRightX:Y}=new Os({lane:U,bandIndex:D},i).place({x:m.timeline.originX,y:L},m);T.push(z),L+=J,Y>P&&(P=Y),D++}return{swimlanes:T,nextY:L,maxRightX:P}},B=e.content.isolatedRegions,C,X,V=m.waves;if(V){let T,L=CS()?gX(V.ids,c,d):void 0,D=Ud(V.ids.length,V.origin,V.floors,(P,U)=>(SS(V,P,U),y(),T=R(),B.length>0&&Cx(B,m,T.nextY+Ib,i,r.naturalChartRightX),V.pass),Ot,L);bS(V,D),X={passes:D.passes,capped:D.capped},C=T}else C=R();let $=C.swimlanes,I=C.nextY,F=qS(e.content.milestones,m);F.length>0&&(y(),m.slackCorridors=F,C=R(),$=C.swimlanes,I=C.nextY);let N=[],k=[];if(B.length>0){let T=Cx(B,m,I+Ib,i,r.naturalChartRightX);N=T.regions,k=T.contexts,I=T.endY}m.chartBottomY=I,m.swimlaneBottomY=I;let b=op(e.content.milestones,m);return{ctx:m,swimlanes:$,includes:N,regionContexts:k,milestones:b,laneEntries:w,maxRightX:C.maxRightX,bottomY:I,...X?{waveSolve:X}:{}}}function gX(e,t,n){let r=e.map(i=>t.waves?.get(i));return{S:r.map(i=>i?n.forward(i.start):null),E:r.map(i=>i?n.forward(i.end):null)}}var wp=class{constructor(t,n){M(this,"node");M(this,"helpers");this.node=t,this.helpers=n}get id(){return this.node.name??""}place(t,n){let{node:r}=this,{helpers:i}=this,o=Se("group",r.properties,n.styleCtx),s=Gr(r,Ul(r.properties,t.x,n),n),a=n.waves!==void 0&&r.title===void 0&&ie(r.properties,"wave")!==void 0&&ie(r.properties,"style")===void 0&&Be(r.properties,"labels").length===0,l=a?void 0:r.title??r.name,c=n.currentFlowKey;n.nextGroupId+=1,n.currentFlowKey=`${c}/group:${r.name??`group-${n.nextGroupId}`}`;let u=St(Be(r.properties,"after")),f=St(Be(r.properties,"before")),d=hd({drawn:!a,hasTitle:!!l,hasPins:!!(u||f),hasBracket:o.bracket!=="none"}),p=lp(r,{leftX:s,firstRowY:t.y+d.header+d.pad},n,i),{children:m,timeCursorX:g,timeStartX:E}=p,x=n.bandScale.step(),y=x-n.bandScale.bandwidth(),w=Math.max(x,p.packer.usedHeight())-y,_={x:E,y:t.y,width:g-E,height:d.header+d.pad+w+d.pad};t.startX=_.x,t.x=g,t.height=Math.max(t.height,_.height+y);let v=r.name;v&&(n.entityLeftEdges.set(v,_.x),n.entityRightEdges.set(v,g)),n.currentFlowKey=c;let R=a?[]:Wd({box:_,afterDate:u,beforeDate:f,title:l});return{kind:"group",id:v,title:l,box:_,headerHeight:d.header,children:m,style:o,inlineDatePins:R.length>0?R:void 0,...a?{waveOnly:!0}:{}}}};var Tp=class{constructor(t,n){M(this,"node");M(this,"helpers");this.node=t,this.helpers=n}get id(){return this.node.name??""}place(t,n){let{node:r}=this,{helpers:i}=this,o=Se("parallel",r.properties,n.styleCtx),s=Gr(r,t.x,n),a=St(Be(r.properties,"after")),l=St(Be(r.properties,"before")),c=r.title??r.name,u=hd({drawn:!0,hasTitle:!!c,hasPins:!!(a||l),hasBracket:o.bracket!=="none"}),f=t.y+u.header+u.pad,d=[],p=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=0,E=n.currentFlowKey;n.nextParallelId+=1;let x=r.name??`parallel-${n.nextParallelId}`,y=0;for(let X of r.content){if(X.$type==="DescriptionDirective")continue;n.currentFlowKey=`${E}/par:${x}#${y}`;let V=Gl(s,f+g),$=i.sequenceOne(X,V,n);d.push($),g+=Math.max(n.bandScale.step(),V.height),p=Math.min(p,V.startX),m=Math.max(m,V.x),y++}n.currentFlowKey=E,d.length===0&&(p=n.scale.showsNonWorking?n.scale.startX(s):s,m=p);let w=n.bandScale.step(),_=w-n.bandScale.bandwidth(),v=Math.max(w,g)-_,R={x:p,y:t.y,width:m-p,height:u.header+u.pad+v+u.pad};t.startX=R.x,t.x=m,t.height=Math.max(t.height,R.height+_);let B=r.name;B&&(n.entityLeftEdges.set(B,R.x),n.entityRightEdges.set(B,m));let C=Wd({box:R,afterDate:a,beforeDate:l,title:c});return{kind:"parallel",id:B,title:c,box:R,headerHeight:u.header,children:d,style:o,inlineDatePins:C.length>0?C:void 0}}};function yX(e,t,n){return new Tp(e,{sequenceOne:vp}).place(t,n)}function xX(e,t,n){return new wp(e,{sequenceOne:vp}).place(t,n)}function vp(e,t,n){if(Ve(e))return Qd(e,t,n);if(et(e))return yX(e,t,n);if($e(e))return xX(e,t,n);throw new Error(`Unknown swimlane child type: ${e.$type??"unknown"}`)}var _p=class{place(t,n,r,i){let o={sequenceOne:vp},s=mS(t,n,r),a=gS(t,n,r,s,i),l=Eb(t,n,r,s,a),c=Rb(n,s,a,l,o);return vb(new gp(t,n,r,s,a,l,c))}};function zx(e,t,n={}){let r=n.schedule?.resolved===t?n.schedule:Yl(e,t,{today:n.today,plan:Mi(t)??null});return new _p().place(e,t,n,r)}function Ap(e){return e.toISOString().slice(0,10)}function Sb(e){return e.id!==void 0?e.id:/[\r\n]/.test(e.title)?e.title.replace(/\s*[\r\n]+\s*/g," ").trim():e.title}function jx(e,t){for(let n of e)n.kind==="item"?t(n):jx(n.children,t)}function EX(e,t,n){let r=Sb(e);e.textSpills&&n.push(sn(t,"NL.I1000","info",{name:r},r)),e.chipsOutside&&n.push(sn(t,"NL.I1001","info",{name:r},r)),(e.box.width<$r||e.dotSpills||e.iconSpills||e.footnoteSpills)&&n.push(sn(t,"NL.I1002","info",{name:r},r)),e.hasOverflow&&n.push(sn(t,"NL.I1003","info",{name:r,anchor:e.overflowAnchorId},r)),bb(e,t,n)}function bb(e,t,n){let r=e.nonWorkingPin;if(!r)return;let i=Sb(e);n.push(sn(t,"NL.I1008","info",{name:i,pin:r.pin,key:r.key,start:r.start},i))}function sn(e,t,n,r,i){return{message:ht(e,t,r),severity:n,code:t,entityId:i,lspSeverity:n==="warning"?2:3,data:{code:t,args:r}}}function Nb(e,t,n){let r=e.id??e.title,i=[];jx(e.children,a=>i.push(a));for(let a of i)EX(a,t,n);let o=new Set(i.map(a=>a.box.y));o.size>1&&n.push(sn(t,"NL.I1004","info",{lane:r,rows:o.size},r)),(e.utilization?.segments.some(a=>a.classification==="red")??!1)&&n.push(sn(t,"NL.I1005","info",{lane:r},r));for(let a of e.nested)Nb(a,t,n)}function Lb(e,t,n){jx(e.children,r=>{bb(r,t,n)});for(let r of e.nested)Lb(r,t,n)}function wX(e,t,n){e.waveSolve?.capped&&n.push(sn(t,"NL.W1002","warning",{passes:e.waveSolve.passes}));let r=e.waves??[],i=r.filter(o=>o.empty).map(o=>o.id);if(i.length>0){let o={names:i};n.push(sn(t,"NL.I1006","info",o,i.length===1?i[0]:void 0))}for(let o of e.milestones){if(o.overrunByWave===void 0||o.overrunDate===void 0)continue;let s=r.find(l=>l.id===o.overrunByWave);if(!s)continue;let a=o.id??o.title;n.push(sn(t,"NL.I1007","info",{name:a,date:o.overrunDate,wave:s.id,end:Ap(s.endDate)},a))}}function Yx(e,t={}){let n=t.locale??"en-US",r=[];for(let i of e.swimlanes)Nb(i,n,r);for(let i of e.includes)for(let o of i.nestedSwimlanes)Lb(o,n,r);if(wX(e,n,r),t.today){let i=t.today,o=e.timeline.startDate,s=e.timeline.endDate;(i<o||i>s)&&r.push(sn(n,"NL.W1000","warning",{date:Ap(i),start:Ap(o),end:Ap(s)}))}return r}var Xi=class extends Error{constructor(t){super(t),this.name="TimezoneError"}};function Vx(e){if(!e||e.toLowerCase()==="local")return{kind:"local"};if(e.toUpperCase()==="UTC")return{kind:"utc"};if(e==="Z")return{kind:"offset",ms:0};let t=/^([+-])(\d{2})(?::?(\d{2}))?$/.exec(e);if(t){let n=t[1]==="+"?1:-1,r=parseInt(t[2],10),i=t[3]!==void 0?parseInt(t[3],10):0;if(r>23||i>59)throw new Xi(`nowline: invalid timezone offset "${e}". Hours must be 0\u201323 and minutes 0\u201359.`);return{kind:"offset",ms:n*(r*60+i)*6e4}}try{return{kind:"iana",name:Intl.DateTimeFormat(void 0,{timeZone:e}).resolvedOptions().timeZone}}catch{throw new Xi(`nowline: unrecognised timezone "${e}". Use "local", "UTC", an ISO 8601 offset (e.g. "+05:30", "-07:00", "Z"), or an IANA timezone name (e.g. "America/Los_Angeles", "Asia/Kolkata").`)}}function kp(e,t){switch(t.kind){case"local":return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));case"utc":return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));case"offset":{let n=new Date(e.getTime()+t.ms);return new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()))}case"iana":{let n=new Intl.DateTimeFormat("en-CA",{timeZone:t.name,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e),r=0,i=0,o=0;for(let s of n)s.type==="year"?r=parseInt(s.value,10):s.type==="month"?i=parseInt(s.value,10)-1:s.type==="day"&&(o=parseInt(s.value,10));return new Date(Date.UTC(r,i,o))}}}var Pb=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?)(Z|([+-])(\d{2})(?::?(\d{2}))?)$/,Ob=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?$/;function Cb(e){return(ot.test(e)||Pb.test(e)||Ob.test(e))&&!He(e.slice(0,10))}function Kx(e={}){let t=e.zone??{kind:"local"},n=e.clock??(()=>new Date),r=e.now;if(!(r==="-"||r===null)){if(r instanceof Date)return r;if(r!==void 0){if(Cb(r))return;let i=Te(r);if(i)return i;let o=Pb.exec(r);if(o){let s=new Date(r);if(!Number.isNaN(s.getTime())){if(o[2]==="Z")return kp(s,{kind:"utc"});let l=o[3]==="+"?1:-1,c=parseInt(o[4],10),u=o[5]!==void 0?parseInt(o[5],10):0,f=l*(c*60+u)*6e4;return kp(s,{kind:"offset",ms:f})}}return Ob.test(r)?Te(r.slice(0,10))??void 0:void 0}return kp(n(),t)}}function TX(e){return e===2?"warning":e===3?"info":"error"}function $b(e,t){return{severity:TX(e.severity),code:Ly(e),message:e.message,suggestion:yd(e.message,e.data),file:t,line:(e.range?.start.line??0)+1,column:(e.range?.start.character??0)+1}}function qx(e,t){return{severity:"error",code:"parse-error",message:e.message,file:t,line:e.token?.startLine??1,column:e.token?.startColumn??1}}function Zx(e,t){return{severity:"error",code:"lex-error",message:e.message,file:t,line:e.line??1,column:e.column??1}}function Db(e,t){if(e.syntax?.origin==="lexer")return Zx(e.syntax.error,e.sourcePath);if(e.syntax?.origin==="parser")return qx(e.syntax.error,e.sourcePath);let n=(e.range?.start.line??e.line??0)+1,r=(e.range?.start.character??0)+1;if(!Br(e))return{severity:e.severity,code:"include",message:e.message,file:e.sourcePath,line:n,column:1};let i=t?sx(t,e):e.message,o=yd(i,e.code===void 0?void 0:{code:e.code,args:e.args??[]});return{severity:e.severity,code:e.code??xd(e.message),message:i,...o===void 0?{}:{suggestion:o},file:e.sourcePath,line:n,column:r}}function Mb(e,t,n="warning"){return{severity:n,code:"render.warning",message:e,file:t,line:1,column:1}}function Fb(e,t){return{severity:e.severity,code:e.code,message:e.message,file:t,line:1,column:1}}var Bb="__nowline_browser_noop_include__";async function Wb(e){throw new Error(`${Bb}: include "${e}" was skipped \u2014 running in single-file mode.`)}function Jx(e){return e.includes(Bb)}function Hb(e,t){let n=t==="image/png"?_X(e):t==="image/jpeg"?AX(e):kX(e);return n&&n.width>0&&n.height>0?n:void 0}var vX=[137,80,78,71,13,10,26,10];function Qx(e,t){return e[t]<<8|e[t+1]}function Xb(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function Ub(e,t){return e[t]|e[t+1]<<8}function Gb(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16}function Ip(e,t,n){return String.fromCharCode(...e.subarray(t,t+n))}function _X(e){if(!(e.length<24||vX.some((t,n)=>e[n]!==t))&&Ip(e,12,4)==="IHDR")return{width:Xb(e,16),height:Xb(e,20)}}function AX(e){if(e.length<4||e[0]!==255||e[1]!==216)return;let t=2;for(;t+3<e.length;){if(e[t]!==255)return;let n=e[t+1];if(n===255){t+=1;continue}if(n===1||n>=208&&n<=217){t+=2;continue}let r=Qx(e,t+2);if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204)return t+8>=e.length?void 0:{width:Qx(e,t+7),height:Qx(e,t+5)};if(r<2)return;t+=2+r}}function kX(e){if(e.length<16||Ip(e,0,4)!=="RIFF"||Ip(e,8,4)!=="WEBP")return;let t=Ip(e,12,4),n=t==="VP8L"?25:30;if(!(e.length<n)){if(t==="VP8 ")return e[23]!==157||e[24]!==1||e[25]!==42?void 0:{width:Ub(e,26)&16383,height:Ub(e,28)&16383};if(t==="VP8L"){if(e[20]!==47)return;let r=e[21],i=e[22],o=e[23],s=e[24];return{width:1+(r|(i&63)<<8),height:1+(i>>6|o<<2|(s&15)<<10)}}if(t==="VP8X")return{width:1+Gb(e,24),height:1+Gb(e,27)}}}var IX=new Set(["svg","g","defs","symbol","use","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","title","desc","linearGradient","radialGradient","stop","clipPath","mask","pattern","filter","feGaussianBlur","feColorMatrix","feOffset","feMerge","feMergeNode","feFlood","feComposite","feBlend","feDropShadow","image"]),RX=new Set(["d","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","width","height","viewBox","preserveAspectRatio","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","opacity","transform","points","id","clip-path","mask","filter","font-family","font-size","font-weight","font-style","text-anchor","dx","dy","rotate","letter-spacing","word-spacing","xmlns","href","xlink:href","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","maskUnits","maskContentUnits","stdDeviation","values","in","in2","mode","type","result","flood-color","flood-opacity","patternUnits","patternContentUnits","role","aria-label","display","visibility","clip-rule","color","font-variant","font-stretch","text-decoration","dominant-baseline","alignment-baseline","baseline-shift","writing-mode","paint-order","vector-effect","shape-rendering","text-rendering","image-rendering","color-interpolation","color-interpolation-filters"]),SX=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","filter","font-family","font-size","font-weight","font-style","font-variant","font-stretch","text-anchor","text-decoration","letter-spacing","word-spacing","dominant-baseline","alignment-baseline","baseline-shift","writing-mode","stop-color","stop-opacity","flood-color","flood-opacity","display","visibility","color","paint-order","vector-effect","shape-rendering","text-rendering","image-rendering","color-interpolation","color-interpolation-filters"]),bX=new Set(["line-height","text-align","font-variant-ligatures","font-variant-caps","font-variant-numeric","font-variant-east-asian","font-variant-position","font-variant-alternates","font-feature-settings","font-variation-settings","font-kerning","white-space","text-orientation","overflow","isolation","solid-color","solid-opacity","enable-background","color-rendering"]),NX=new Set(["none","normal","auto","initial","inherit","unset"]);function LX(e){return e==="xlink:href"?!1:e.includes(":")||e.startsWith("data-")||e==="version"||e==="baseProfile"||e==="enable-background"}function PX(e){return e==="metadata"||e.includes(":")&&!e.startsWith("svg:")}var OX=new Set(["x","y","width","height"]);function jb(e){let t=[],n=0,r=e.length;for(;n<r;){if(e[n]!=="<"){let u=n;for(;n<r&&e[n]!=="<";)n++;let f=e.slice(u,n);f.trim().length>0?t.push({kind:"text",text:f}):f.length>0&&t.push({kind:"text",text:f});continue}if(e.startsWith("<!--",n)){let u=e.indexOf("-->",n+4);if(u<0)break;t.push({kind:"comment",text:e.slice(n+4,u)}),n=u+3;continue}if(e.startsWith("<![CDATA[",n)){let u=e.indexOf("]]>",n+9);if(u<0)break;t.push({kind:"cdata",text:e.slice(n+9,u)}),n=u+3;continue}if(e.startsWith("<?",n)){let u=e.indexOf("?>",n+2);if(u<0)break;t.push({kind:"decl",text:e.slice(n+2,u)}),n=u+2;continue}if(e.startsWith("<!",n)){let u=e.indexOf(">",n+2);if(u<0)break;t.push({kind:"decl",text:e.slice(n+2,u)}),n=u+1;continue}if(e[n+1]==="/"){let u=e.indexOf(">",n+2);if(u<0)break;let f=e.slice(n+2,u).trim();t.push({kind:"close",name:f}),n=u+1;continue}let i=CX(e,n);if(i<0)break;let o=e.slice(n+1,i).trim(),s=o.endsWith("/"),a=s?o.slice(0,-1).trim():o,{name:l,attrs:c}=$X(a);t.push({kind:s?"self":"open",name:l,attrs:c}),n=i+1}return t}function CX(e,t){let n=t+1,r=null;for(;n<e.length;){let i=e[n];if(r)i===r&&(r=null);else if(i==='"'||i==="'")r=i;else if(i===">")return n;n++}return-1}function $X(e){let t=0;for(;t<e.length&&/\s/.test(e[t]);)t++;let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.slice(n,t),i={};for(;t<e.length;){for(;t<e.length&&/\s/.test(e[t]);)t++;if(t>=e.length)break;let o=t;for(;t<e.length&&e[t]!=="="&&!/\s/.test(e[t]);)t++;let s=e.slice(o,t);if(t>=e.length||e[t]!=="="){s&&(i[s]="");continue}if(t++,t>=e.length)break;let a=e[t];if(a!=='"'&&a!=="'"){let c=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;i[s]=e.slice(c,t);continue}t++;let l=t;for(;t<e.length&&e[t]!==a;)t++;i[s]=e.slice(l,t),t<e.length&&t++}return{name:r,attrs:i}}function Kl(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function DX(e,t){if(e.startsWith("#")){let n=t.get(e.slice(1));return n?`#${n}`:null}if(/^url\(#[^)]+\)$/.test(e)){let n=e.slice(5,-1),r=t.get(n);return r?`url(#${r})`:null}return null}function Yb(e,t={}){let n=t.idPrefix??"nl-logo",r=t.onWarn??(()=>{}),i=jb(e),o="",s=0;for(let d of i)d.kind==="open"&&d.name==="style"?s++:d.kind==="close"&&d.name==="style"?s=Math.max(0,s-1):s>0&&(d.kind==="text"||d.kind==="cdata")&&(o+=d.text??"");let a=MX(o,d=>r(`sanitizer: dropping ${d}`)),l=new Map,c=0;for(let d of i)if((d.kind==="open"||d.kind==="self")&&d.attrs&&"id"in d.attrs){let p=d.attrs.id;p&&!l.has(p)&&l.set(p,`${n}-${c++}`)}let u=[],f=[];for(let d of i)if(d.kind!=="comment"&&d.kind!=="decl"){if(d.kind==="cdata"){f[f.length-1]&&u.push(Kl(d.text??""));continue}if(d.kind==="text"){if(f.length===0||f[f.length-1]){let p=(d.text??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");u.push(p)}continue}if(d.kind==="open"||d.kind==="self"){let p=d.name??"";if(p==="script"||p==="foreignObject"||p==="animate"||p==="animateTransform"||p==="animateMotion"||p==="set"){r(`sanitizer: dropping <${p}>`),d.kind==="open"&&f.push(!1);continue}if(p==="style"||PX(p)){d.kind==="open"&&f.push(!1);continue}if(!IX.has(p)){r(`sanitizer: dropping unknown element <${p}>`),d.kind==="open"&&f.push(!1);continue}let m=[`<${p}`],g=p==="svg"&&f.length===0,E=FX(d.attrs??{},a,r),x=Object.keys(E).sort();for(let y of x){let w=E[y];if(g&&t.stripRootSize&&OX.has(y))continue;if(/^on/i.test(y)){r(`sanitizer: dropping event handler ${y}`);continue}if(LX(y)||y==="class")continue;if(!RX.has(y)){r(`sanitizer: dropping attribute ${y}`);continue}if(y==="href"||y==="xlink:href"){let v=DX(w,l);if(v===null){r(`sanitizer: dropping external href ${w}`);continue}m.push(` ${y}="${Kl(v)}"`);continue}if(y==="id"){let v=l.get(w);v&&m.push(` id="${Kl(v)}"`);continue}let _=/url\(#([^)]+)\)/gi;if(/data:|javascript:|vbscript:|url\(|expression\s*\(|[\\{}]/i.test(w.replace(_,""))){r(`sanitizer: dropping suspicious value at ${y}`);continue}if(/url\(#/i.test(w)){let v=w.replace(_,(R,B)=>{let C=l.get(B);return C?`url(#${C})`:"none"});m.push(` ${y}="${Kl(v)}"`);continue}m.push(` ${y}="${Kl(w)}"`)}m.push(d.kind==="self"?"/>":">"),u.push(m.join("")),d.kind==="open"&&f.push(!0);continue}d.kind==="close"&&f.pop()&&u.push(`</${d.name}>`)}return u.join("")}function zb(e){if(e===void 0)return;let t=/^\s*([0-9]*\.?[0-9]+(?:e[+-]?[0-9]+)?)\s*(px)?\s*$/i.exec(e);if(!t)return;let n=Number(t[1]);return n>0&&Number.isFinite(n)?n:void 0}function Rp(e){let t=jb(e).find(s=>(s.kind==="open"||s.kind==="self")&&s.name==="svg");if(!t)return;let n=t.attrs??{},r=zb(n.width),i=zb(n.height);if(r!==void 0&&i!==void 0)return{width:r,height:i};let o=(n.viewBox??"").trim().split(/[\s,]+/).map(Number);if(o.length===4&&o.every(Number.isFinite)&&o[2]>0&&o[3]>0)return{width:o[2],height:o[3]}}function Vb(e){let t=[];for(let n of e.split(";")){let r=n.indexOf(":");if(r<0)continue;let i=n.slice(0,r).trim().toLowerCase(),o=n.slice(r+1).replace(/!\s*important\s*$/i,"").trim();i&&o&&t.push({property:i,value:o})}return t}function MX(e,t){let n=[],r=e.replace(/\/\*[\s\S]*?\*\//g,""),i=/([^{}]+)\{([^{}]*)\}/g;for(let o of r.matchAll(i)){let s=o[1].trim(),a=s.split(",").map(l=>l.trim());if(s.startsWith("@")||!a.every(l=>/^\.[A-Za-z_][\w-]*$/.test(l))){t(`<style> rule ${s}`);continue}n.push({classes:a.map(l=>l.slice(1)),declarations:Vb(o[2])})}return/@[a-z-]+[^{;]*;/i.test(r)&&t("<style> at-rule"),n}function FX(e,t,n){let r=new Set((e.class??"").split(/\s+/).filter(Boolean)),i=[];for(let s of t)s.classes.some(a=>r.has(a))&&i.push(...s.declarations);if(e.style!==void 0&&i.push(...Vb(e.style)),i.length===0&&e.style===void 0)return e;let o={...e};delete o.style;for(let{property:s,value:a}of i)SX.has(s)?o[s]=a:!s.startsWith("-")&&!bX.has(s)&&!NX.has(a.toLowerCase())&&n(`sanitizer: dropping style property ${s}`);return o}var BX={".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp"};function WX(e){let t=e.slice(e.lastIndexOf("/")+1),n=t.lastIndexOf(".");return n>0?t.slice(n).toLowerCase():""}async function Kb(e,t,n){if(!e||!t)return;let r=WX(e),i=BX[r];if(!i){n(`unsupported logo format: ${r||"(none)"} (${e})`);return}let o;try{o=await t(e)}catch(l){let c=l instanceof Error?l.message:String(l);n(`logo file not found: ${e} (${c})`);return}let s=o.bytes,a=i==="image/svg+xml"?Rp(new TextDecoder().decode(s)):Hb(s,i);if(!a){let l=i==="image/svg+xml"?"no viewBox and no pixel width/height on the root <svg>":`not a readable ${r.slice(1).toUpperCase()} header`;n(`logo could not be parsed: ${e} (${l})`);return}return{ref:e,dimensions:a,asset:o}}var XX=1,UX=0;function GX(){return Ce.parse(`memory:///stage-${++UX}.nowline`)}async function HX(e){return e.document?e.document:Cl(e.services.shared,e.source,GX())}function zX(e){return e.origin!=="validation"||e.diagnostic.severity===XX}async function eE(e){let t=await HX(e),n=Ni(t);if(n.some(zX))return{kind:"invalid",document:t,diagnostics:n};let r=t.parseResult.value,i=await Yy(r,e.sourcePath,{services:e.services.Nowline,readFile:e.readSource,includePolicy:e.includePolicy}),o=e.isToleratedIncludeError??(()=>!1),s=v=>v.severity!=="error"||!o(v),a=i.diagnostics.filter(v=>v.severity==="error"&&s(v)),l=i.diagnostics.filter(v=>Br(v)&&s(v)),c=a.find(v=>!Br(v));if(c)return{kind:"include-error",document:t,legacy:c,routed:[],resolved:i};if(a.length>0)return{kind:"include-error",document:t,routed:l,resolved:i};let u=[],f=await Kb(gd(r),e.assetResolver,v=>u.push(v)),{theme:d,today:p,width:m,locale:g,nonWorking:E}=e.layout,x={theme:d,today:p,width:m,locale:g,nonWorking:E},y=Mi(i)??null,w=Yl(r,i,{today:p,plan:y}),_=zx(r,i,{...x,schedule:w,logo:f?.dimensions});return{kind:"staged",document:t,ast:r,resolved:i,routed:l,logo:f,warnings:u,plan:y,schedule:w,model:_,layout:x}}var qb=/&/g,Zb=/</g,Jb=/>/g,jX=/"/g,YX=/'/g;function tt(e){return e.replace(qb,"&amp;").replace(Zb,"&lt;").replace(Jb,"&gt;")}function an(e){return e.replace(qb,"&amp;").replace(Zb,"&lt;").replace(Jb,"&gt;").replace(jX,"&quot;").replace(YX,"&#39;")}function Ds(e){let t=Object.keys(e).sort(),n=[];for(let r of t){let i=e[r];i==null||i===!1||(i===!0?n.push(r):n.push(`${r}="${an(String(i))}"`))}return n.length?` ${n.join(" ")}`:""}function j(e,t,n){return n===void 0||n===""?`<${e}${Ds(t)}/>`:`<${e}${Ds(t)}>${n}</${e}>`}function ae(e,t){return`<text${Ds(e)}>${tt(t)}</text>`}function h(e){return Number.isFinite(e)?Number.isInteger(e)?e.toString():(Math.round(e*100)/100).toString():"0"}var qX="3 3";function Sp(e,t){let n=e.waypoints;if(n.length<2)return"";let r=t.dependency.edgeStroke,i=n[n.length-1],o=n[n.length-2],s=Math.hypot(i.x-o.x,i.y-o.y);if(s===0)return"";let a=(i.x-o.x)/s,l=(i.y-o.y)/s,c=e.headWidth/2,u=e.head==="dot"?c:e.headWidth*5/7,f=s>u?[...n.slice(0,-1),{x:i.x-a*u,y:i.y-l*u}]:n.slice(0,-1),d=[ZX(f,e.slack,r)],p=t.arrowhead.neutral;if(e.head==="dot")d.push(j("circle",{cx:h(i.x-a*c),cy:h(i.y-l*c),r:h(c),fill:p}));else{let m=i.x-a*u,g=i.y-l*u;d.push(j("path",{d:`M${h(m-l*c)} ${h(g+a*c)} L${h(i.x)} ${h(i.y)} L${h(m+l*c)} ${h(g-a*c)} z`,fill:p}))}return j("g",{"data-layer":"dependency"},d.join(""))}function ZX(e,t,n){if(e.length<2)return"";let r={fill:"none",stroke:n,"stroke-width":1.1,"stroke-linejoin":"round"};if(!t)return j("path",{d:QX(e,ad),...r});let{solid:i,dotted:o}=JX(e,ad);return(i?j("path",{d:i,...r}):"")+(o?j("path",{d:o,...r,"stroke-dasharray":qX,"stroke-linecap":"round"}):"")}function JX(e,t){let n=e.length,r=[],i=[],o=[];for(let a=1;a<n-1;a++){let l=e[a-1],c=e[a],u=e[a+1],f=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-c.x,u.y-c.y),p=Math.min(t,f/2,d/2),m={x:Math.sign(c.x-l.x),y:Math.sign(c.y-l.y)},g={x:Math.sign(u.x-c.x),y:Math.sign(u.y-c.y)};r[a]={x:c.x-m.x*p,y:c.y-m.y*p},i[a]={x:c.x+g.x*p,y:c.y+g.y*p},p>0&&o.push(`M${h(r[a].x)} ${h(r[a].y)} Q${h(c.x)} ${h(c.y)} ${h(i[a].x)} ${h(i[a].y)}`)}let s=[];for(let a=0;a<n-1;a++){let l=a===0?e[0]:i[a],c=a===n-2?e[n-1]:r[a+1],u=`M${h(l.x)} ${h(l.y)} L${h(c.x)} ${h(c.y)}`;Math.abs(e[a+1].y-e[a].y)<1e-9?s.push(u):o.push(u)}return{solid:o.join(" "),dotted:s.join(" ")}}function QX(e,t){if(e.length<2)return"";let n=[`M${h(e[0].x)} ${h(e[0].y)}`];for(let r=1;r<e.length;r++){let i=e[r-1],o=e[r];if(r===e.length-1){n.push(`L${h(o.x)} ${h(o.y)}`);continue}let s=e[r+1],a=Math.sign(o.x-i.x),l=Math.sign(o.y-i.y),c=Math.sign(s.x-o.x),u=Math.sign(s.y-o.y),f=Math.hypot(o.x-i.x,o.y-i.y),d=Math.hypot(s.x-o.x,s.y-o.y),p=Math.min(t,f/2,d/2);if(p<=0||a!==0&&c!==0||l!==0&&u!==0){n.push(`L${h(o.x)} ${h(o.y)}`);continue}let m={x:o.x-a*p,y:o.y-l*p},g={x:o.x+c*p,y:o.y+u*p};n.push(`L${h(m.x)} ${h(m.y)}`),n.push(`Q${h(o.x)} ${h(o.y)} ${h(g.x)} ${h(g.y)}`)}return n.join(" ")}function Qb(e,t,n,r){if(e.entries.length===0)return"";let i=n.footnotePanel.fill,o=n.footnotePanel.border,s=n.footnotePanel.header,a=n.footnotePanel.title,l=n.footnotePanel.description,c=n.footnotePanel.number,u=[];u.push(j("rect",{x:h(e.box.x),y:h(e.box.y),width:h(e.box.width),height:h(e.box.height),rx:6,ry:6,fill:i,stroke:o,"stroke-width":1,filter:`url(#${t}-shadow-subtle)`})),u.push(ae({x:h(e.box.x+Ht),y:h(e.box.y+sy),"font-family":r.sans,"font-size":12,"font-weight":700,fill:s},"Footnotes"));let f=e.box.x+Ht;for(let d of e.entries){d.region!==void 0&&d.regionHeadingY!==void 0&&u.push(ae({x:h(f),y:h(d.regionHeadingY),"font-family":r.sans,"font-size":10,"font-weight":700,fill:s},d.region)),u.push(ae({x:h(f),y:h(d.y),"font-family":r.sans,"font-size":10,"font-weight":700,fill:c},String(d.number)));for(let p of d.titleLines)u.push(ae({x:h(p.x),y:h(p.y),"font-family":r.sans,"font-size":11,"font-weight":600,fill:a},p.text));for(let p of d.descriptionLines??[])u.push(ae({x:h(p.x),y:h(p.y),"font-family":r.sans,"font-size":11,fill:l},p.text))}return j("g",{"data-layer":"footnotes"},u.join(""))}function eN(e,t,n,r){let i=e.box.x+e.cardBox.x,o=e.box.y+e.cardBox.y,s=e.cardBox.width,a=e.cardBox.height,l=e.style.bg==="none"?n.surface.headerBox:e.style.bg,c=n.header.cardBorder,u=j("rect",{x:h(i),y:h(o),width:h(s),height:h(a),rx:6,ry:6,fill:l,stroke:c,"stroke-width":1,filter:`url(#${t}-shadow-subtle)`}),f=i+16+(e.textInset?.x??0),d=o+(e.textInset?.y??0),p=[];e.titleLines.forEach((w,_)=>{p.push(ae({x:h(f),y:h(d+26+_*20),"font-family":r[e.style.font],"font-size":16,"font-weight":600,fill:e.style.text},w))});let m=p.join(""),g=d+26+Math.max(0,e.titleLines.length-1)*20,E=n.header.author,x=[];e.authorLines.forEach((w,_)=>{x.push(ae({x:h(f),y:h(g+18+_*14),"font-family":r[e.style.font],"font-size":11,fill:E},w))});let y=x.join("");return j("g",{"data-layer":"header","data-id":`${t}-header`},u+m+y)}function tN(e,t){let n=e.palette.attribution.mark,r=e.palette.attribution.link;if(e.swimlanes.length===0)return"";let i=e.header.attributionBox.x,o=e.header.attributionBox.y,s=Mr,a=ae({x:"0",y:s,"font-family":t.sans,"font-size":od,"font-weight":400,fill:n},id)+ae({x:El,y:s,"font-family":t.sans,"font-size":Mr,"font-weight":700,fill:n},"now")+j("rect",{x:ly,y:12,width:cy,height:Mr,fill:r})+ae({x:sd,y:s,"font-family":t.sans,"font-size":Mr,"font-weight":400,fill:n},"ine"),l=j("g",{transform:`translate(${h(i)} ${h(o)}) scale(${h(xl)})`},a);return j("a",{href:ay,target:"_blank",rel:"noopener","aria-label":"Powered by nowline"},j("g",{"data-layer":"attribution"},l))}async function nN(e,t,n,r){let i=e.assetRef??"",{x:o,y:s,width:a,height:l}=e.box,c;try{if(r.logo&&r.logo.ref===i)c=r.logo.asset;else if(t)c=await t(i);else return""}catch(d){let p=`logo file not found: ${i} (${d instanceof Error?d.message:String(d)})`;if(r.strict)throw d;return r.warn?.(p),""}let u=(c.mime??"").toLowerCase();if(u==="image/svg+xml"){let d=new TextDecoder().decode(c.bytes),p=e.intrinsic??Rp(d)??{width:a,height:l},m=new Set,g=Yb(d,{idPrefix:`${n}-logo`,onWarn:E=>m.add(E.replace(/^sanitizer: dropping /,"")),stripRootSize:!0});return m.size>0&&r.warn?.(`logo ${i}: removed unsupported SVG content: ${[...m].join(", ")}`),j("svg",{"data-layer":"logo",x:h(o),y:h(s),width:h(a),height:h(l),viewBox:`0 0 ${h(p.width)} ${h(p.height)}`,preserveAspectRatio:"xMidYMid meet",overflow:"hidden"},g)}if(u==="image/png"||u==="image/jpeg"||u==="image/jpg"||u==="image/webp"){let d=eU(c.bytes);return j("image",{"data-layer":"logo",href:`data:${u};base64,${d}`,x:h(o),y:h(s),width:h(a),height:h(l),preserveAspectRatio:"xMidYMid meet"})}let f=`unsupported logo format: ${u} (${i})`;if(r.strict)throw new Error(f);return r.warn?.(f),""}function eU(e){if(typeof btoa<"u"){let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}let t=globalThis;if(t.Buffer)return t.Buffer.from(e).toString("base64");throw new Error("renderer: no base64 encoder available")}var bp=class{constructor(t="nl"){M(this,"prefix");M(this,"counter",0);this.prefix=t}next(t){let n=`${this.prefix}-${this.counter++}`;return t?`${n}-${t}`:n}};function Np(e,t,n){let r=e.radius,i=e.center.x,o=e.center.y,s=t.anchorDiamond.fill,a=t.anchorDiamond.stroke,l=j("path",{d:`M${h(i)} ${h(o-r)} L${h(i+r)} ${h(o)} L${h(i)} ${h(o+r)} L${h(i-r)} ${h(o)} Z`,fill:s,stroke:a,"stroke-width":1.25}),c=t.anchorDiamond.label,u=e.labelSide==="left"?e.labelBox.x+e.labelBox.width:e.labelBox.x,f={x:h(u),y:h(o+4),"font-family":n.sans,"font-size":10,fill:c};e.labelSide==="left"&&(f["text-anchor"]="end");let d=e.title?ae(f,e.title):"";return j("g",{"data-layer":"anchor","data-id":e.id??null},rN(e.hiddenDate)+l+d)}function Lp(e,t){let n=t.anchorDiamond.cutLine;return j("line",{x1:h(e.center.x),y1:h(e.center.y+e.radius+1),x2:h(e.center.x),y2:h(e.cutBottomY),stroke:n,"stroke-width":1,"stroke-dasharray":"1 3"})}function Pp(e,t,n){let r=e.center.x,i=e.center.y,o=e.radius,s=t.milestoneDiamond.cutLineOverrun,a=(m,g)=>j("path",{d:`M${h(m)} ${h(i-o)} L${h(m+o)} ${h(i)} L${h(m)} ${h(i+o)} L${h(m-o)} ${h(i)} Z`,fill:g,stroke:g,"stroke-width":1}),l=e.slip?.x,c;l!==void 0?c=a(r,s)+j("path",{d:`M${h(r+o)} ${h(i)} H${h(l-o)}`,fill:"none",stroke:s,"stroke-width":1.1,"stroke-dasharray":"3 3","stroke-linecap":"round"})+a(l,t.milestoneDiamond.fill):c=a(r,e.isOverrun?s:t.milestoneDiamond.fill);let u=e.isOverrun&&l===void 0?s:t.milestoneDiamond.label,f=e.labelSide==="left"?e.labelBox.x+e.labelBox.width:e.labelBox.x,d={x:h(f),y:h(i+4),"font-family":n.sans,"font-size":10,"font-weight":600,fill:u};e.labelSide==="left"&&(d["text-anchor"]="end");let p=e.title?ae(d,e.title):"";return j("g",{"data-layer":"milestone","data-id":e.id??null},rN(e.hiddenDate)+c+p)}function rN(e){return e===void 0?"":`<title>${tt(e)}</title>`}function Op(e,t,n){let r=e.slip?.x??e.center.x,i=e.isOverrun&&e.slip===void 0?n.milestoneDiamond.cutLineOverrun:n.milestoneDiamond.cutLineNormal,o=[];if(e.onWaveBoundary||o.push(j("line",{x1:h(r),y1:h(e.center.y+e.radius+1),x2:h(r),y2:h(e.cutBottomY),stroke:i,"stroke-width":2,"stroke-dasharray":gl,"stroke-linecap":"round"})),e.slackArrows&&e.slackArrows.length>0)for(let s of e.slackArrows)o.push(j("path",{d:`M${h(s.x)} ${h(s.y)} H${h(e.center.x-6)}`,fill:"none",stroke:n.milestoneDiamond.slack,"stroke-width":1.1,"stroke-dasharray":"3 3","stroke-linecap":"round","marker-end":`url(#${t}-arrow-dark)`}));return o.join("")}var wn={person:{viewBox:"0 0 24 24",body:'<circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 21a8 8 0 0 1 16 0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"p"},people:{viewBox:"0 0 24 24",body:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="9" cy="7" r="4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M22 21v-2a4 4 0 0 0-3-3.87" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 3.13a4 4 0 0 1 0 7.75" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"P"},points:{viewBox:"0 0 24 24",body:'<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" fill="currentColor" stroke="currentColor" stroke-width="1" stroke-linejoin="round"/>',ascii:"*"},time:{viewBox:"0 0 24 24",body:'<line x1="10" x2="14" y1="2" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="12" x2="15" y1="14" y2="11" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="14" r="8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"t"}},tU={calendar:{viewBox:"0 0 24 24",body:'<rect x="3" y="4" width="18" height="18" rx="2" ry="2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="16" x2="16" y1="2" y2="6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="8" x2="8" y1="2" y2="6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><line x1="3" x2="21" y1="10" y2="10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',ascii:"d"}},iN={...wn,...tU};var Bae={none:"",multiplier:"x",person:wn.person.ascii,people:wn.people.ascii,points:wn.points.ascii,time:wn.time.ascii};var nU={thin:100,light:300,normal:400,bold:700};function rU(e){return Ii[e]??14}function Cp(e,t,n){return{"font-family":t[e.font],"font-size":n??rU(e.textSize),"font-weight":nU[e.weight]??400,"font-style":e.italic?"italic":"normal",fill:e.text}}function iU(e){if(e.border==="dashed")return"4 3";if(e.border==="dotted")return"1 3"}function oN(e,t,n,r,i,o={}){let s=Math.min(Ri[i.cornerRadius]??4,r/2,n/2);return j("rect",{x:h(e),y:h(t),width:h(n),height:h(r),rx:h(s),ry:h(s),fill:i.bg==="none"?"transparent":i.bg,stroke:i.fg,"stroke-width":1,"stroke-dasharray":iU(i)??null,...o})}function $p(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=Math.min(e.x+e.width,t.x+t.width),o=Math.min(e.y+e.height,t.y+t.height);if(!(i<=n||o<=r))return{x:n,y:r,width:i-n,height:o-r}}var oU={none:{dx:0,dy:0,stdDeviation:0,opacity:0},subtle:{dx:0,dy:1,stdDeviation:1.5,opacity:.2},soft:{dx:0,dy:3,stdDeviation:5,opacity:.3},hard:{dx:2,dy:2,stdDeviation:0,opacity:.45}};function sU(e,t){let n=`${e}-shadow-${t}`,r=oU[t],i=`<feGaussianBlur in="SourceAlpha" stdDeviation="${r.stdDeviation}"/><feOffset dx="${r.dx}" dy="${r.dy}" result="offsetblur"/><feComponentTransfer><feFuncA type="linear" slope="${r.opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge>`;return j("filter",{id:n,x:"-50%",y:"-50%",width:"200%",height:"200%"},i)}function sN(e,t){return t==="none"?null:`url(#${e}-shadow-${t})`}function aN(e){return["subtle","soft","hard"].map(t=>sU(e,t)).join("")}var aU=4,lU=8,cU=10;function lN(e,t){return`url(#${e}-wave-hatch-${t})`}function cN(e,t,n){let r=yy;return j("pattern",{id:`${e}-wave-hatch-${t}`,width:r,height:r,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)"},j("line",{x1:h(r/2),y1:0,x2:h(r/2),y2:r,stroke:t==="dark"?n.wave.hatch:n.wave.hatchOnDark,"stroke-width":xy,opacity:gy}))}function uN(e){if(!e.waves)return[];let t=new Set,n=i=>{for(let o of i)o.kind==="item"?o.waveRole==="background"&&o.waveHatch&&t.add(o.waveHatch):n(o.children)},r=i=>{for(let o of i)n(o.children),r(o.nested)};r(e.swimlanes);for(let i of e.includes)r(i.nestedSwimlanes);for(let i of e.waveLegend?.entries??[])t.add(i.hatch);return["dark","light"].filter(i=>t.has(i))}function fN(e,t,n,r){let o=Math.min(Ri[t.cornerRadius]??4,e.height/2);return j("rect",{x:h(e.x+.5),y:h(e.y+.5),width:h(Math.max(0,e.width-2*.5)),height:h(Math.max(0,e.height-2*.5)),rx:h(o),ry:h(o),fill:lN(r,n)})}var tE=4;function uU(e,t){let n=Math.min(tE-bi,e.width/2,e.height/2),r=1e-6;return{left:e.x<=t.box.x+bi+r?n:0,right:e.x+e.width>=t.box.x+t.box.width-bi-r?n:0}}function fU(e,t){let{x:n,y:r,width:i,height:o}=e,s=(a,l,c)=>a>0?` A${h(a)} ${h(a)} 0 0 1 ${h(l)} ${h(c)}`:"";return`M${h(n+t.left)} ${h(r)} H${h(n+i-t.right)}`+s(t.right,n+i,r+t.right)+` V${h(r+o-t.right)}`+s(t.right,n+i-t.right,r+o)+` H${h(n+t.left)}`+s(t.left,n,r+o-t.left)+` V${h(r+t.left)}`+s(t.left,n+t.left,r)+" Z"}function nE(e,t,n){let r=o=>n&&(n.left>0||n.right>0)?j("path",{d:fU(t,n),...o}):j("rect",{x:h(t.x),y:h(t.y),width:h(t.width),height:h(t.height),...o}),i=r({fill:e.style.stripFill});return e.style.tint?i+r({fill:e.style.tint,"fill-opacity":wl}):i}function dN(e,t){let n=e.timeline,r=n.waveStrip;if(!e.waves||!r)return"";let i=[j("rect",{x:h(n.box.x),y:h(r.y),width:h(n.box.width),height:h(r.height),rx:tE,ry:tE,fill:t.timeline.panelFill,stroke:t.timeline.border,"stroke-width":1})];for(let o of e.waves){let s=o.strip.cell;s&&i.push(j("g",{"data-id":o.id},`<title>${tt(o.strip.tooltip)}</title>${nE(o,s,uU(s,n))}`))}return j("g",{"data-layer":"wave-strip"},i.join(""))}function Dp(e,t){let n=[];for(let r of e){if(!r.style.tint||r.empty)continue;let i=t?$p(r.columnBox,t):r.columnBox;!i||i.width<=0||i.height<=0||n.push(j("rect",{x:h(i.x),y:h(i.y),width:h(i.width),height:h(i.height),fill:r.style.tint,"fill-opacity":Ey}))}return n.length===0?"":j("g",{"data-layer":"wave-bg"},n.join(""))}function Mp(e,t){let n=[];for(let r of e??[]){let i=r.topY,o=r.bottomY;t&&(r.x<=t.x||r.x>=t.x+t.width||(i=Math.max(i,t.y),o=Math.min(o,t.y+t.height),o<=i))||n.push(j("line",{x1:h(r.x),y1:h(i),x2:h(r.x),y2:h(o),stroke:r.stroke,"stroke-width":hy,"stroke-dasharray":r.dash}))}return n.length===0?"":j("g",{"data-layer":"wave-boundary"},n.join(""))}function pN(e,t,n){let i=e.timeline.waveStrip;if(!e.waves||!i)return"";let o=i.y+i.height/2+aU,s=[],a=(l,c,u)=>j("rect",{x:h(u.x),y:h(u.y),width:h(u.width),height:h(u.height),fill:t.timeline.panelFill})+ae({x:h(l),y:h(o),"font-family":n.sans,"font-size":Un,"font-style":"italic",fill:t.wave.labelMuted,"text-anchor":"middle"},c);for(let l of e.waves){if(l.strip.gapLabel){let{text:d,x:p,halo:m}=l.strip.gapLabel;s.push(a(p,d,m))}if(!l.strip.cell)continue;let{labelDraw:c,superscripts:u,inlineDatePin:f}=l.strip;if(f&&s.push(ql([f],l.style.text)),u&&s.push(nE(l,u.halo)),l.strip.label!==void 0&&c&&(s.push(nE(l,c.halo)),s.push(ae({x:h(c.x),y:h(o),"font-family":n.sans,"font-size":Un,"font-weight":600,fill:l.style.text,"text-anchor":"middle"},l.strip.label))),u){let d=u.rightX;for(let p=l.footnoteIndicators.length-1;p>=0;p--)s.push(ae({x:h(d),y:h(i.y+cU),"font-family":n.sans,"font-size":lU,"font-weight":700,fill:l.style.text,"text-anchor":"end"},String(l.footnoteIndicators[p]))),d-=Ut}}return s.length===0?"":j("g",{"data-layer":"wave-labels"},s.join(""))}function Fp(e){if(!e||e.length===0)return"";let t=e.map(n=>j("line",{x1:h(n.x),y1:h(n.topY),x2:h(n.x),y2:h(n.bottomY),stroke:n.stroke,"stroke-width":1,"stroke-dasharray":my}));return j("g",{"data-layer":"wave-cross"},t.join(""))}function dU(e){let t=e.entities.item.bg;return t==="none"?"transparent":t}function hN(e,t,n,r){if(!e)return"";let i=[];for(let o of e.entries){let s=o.swatch,a=dU(n),l={x:h(s.x),y:h(s.y),width:h(s.width),height:h(s.height)};i.push(j("rect",{...l,rx:2,ry:2,fill:a,stroke:n.entities.item.fg,"stroke-width":1})),i.push(j("rect",{x:h(s.x+.5),y:h(s.y+.5),width:h(s.width-1),height:h(s.height-1),rx:2,ry:2,fill:lN(t,o.hatch)}));for(let c of o.runs)i.push(ae({x:h(c.x),y:h(c.y),"font-family":r.sans,"font-size":Un,fill:n.wave.labelText},c.text))}return j("g",{"data-layer":"wave-legend"},i.join(""))}function mN(e,t){let n=e;for(let r of t.iconDxTerms??[])n+=r;return n}function rE(e,t,n,r,i,o){let s=t,{text:a,icon:l}=e,c={"font-family":i,"font-size":r,fill:o};if(!l)return ae({x:h(s),y:h(n),...c},a);if(l.kind==="builtin"&&l.name==="multiplier")return ae({x:h(s),y:h(n),...c},`${a}\xD7`);if(l.kind==="builtin"){let f=wn[l.name],d=ae({x:h(s),y:h(n),...c},a),p=r,m=mN(t,e),g=n-r*.85,E=`<svg x="${h(m)}" y="${h(g)}" width="${h(p)}" height="${h(p)}" viewBox="${f.viewBox}" style="color:${an(o)}" aria-hidden="true">${f.body}</svg>`;return d+E}let u=h(r*.1);return`<text x="${h(s)}" y="${h(n)}" font-family="${an(i)}" font-size="${r}" fill="${an(o)}">${tt(a)}<tspan dx="${u}">${tt(l.text)}</tspan></text>`}function pU(e){let{metaText:t,capacity:n,x:r,baselineY:i,fontSize:o,fontFamily:s,color:a}=e;if(!t&&!n)return"";let l={"font-family":s,"font-size":o,fill:a};if(!n)return ae({x:h(r),y:h(i),...l},t);if(!t)return rE(n,r,i,o,s,a);let c=h(o*ls),u=`<text x="${h(r)}" y="${h(i)}" font-family="${an(s)}" font-size="${o}" fill="${an(a)}">`,{text:f,icon:d}=n;if(!d)return u+tt(t)+`<tspan dx="${c}">${tt(f)}</tspan></text>`;if(d.kind==="builtin"&&d.name==="multiplier")return u+tt(t)+`<tspan dx="${c}">${tt(f)}\xD7</tspan></text>`;if(d.kind==="literal"){let v=h(o*.1);return u+tt(t)+`<tspan dx="${c}">${tt(f)}</tspan><tspan dx="${v}">${tt(d.text)}</tspan></text>`}let p=n.iconDxTerms??[],m=r;for(let v of p.slice(0,2))m+=v;let g=wn[d.name],E=o,x=mN(r,n),y=i-o*.85,w=u+tt(t)+"</text>"+ae({x:h(m),y:h(i),...l},f),_=`<svg x="${h(x)}" y="${h(y)}" width="${h(E)}" height="${h(E)}" viewBox="${g.viewBox}" style="color:${an(a)}" aria-hidden="true">${g.body}</svg>`;return w+_}function hU(e,t){let n=iN.calendar,r=`<svg x="${h(e.glyphTopLeft.x)}" y="${h(e.glyphTopLeft.y)}" width="${h(e.glyphSize)}" height="${h(e.glyphSize)}" viewBox="${n.viewBox}" style="color:${an(t)}" aria-hidden="true">${n.body}</svg>`,i=`<title>${tt(e.isoDate)}</title>`;return j("g",{"data-layer":"inline-date-pin","data-side":e.side,"data-date":e.isoDate,"data-spilled":e.spilled?"true":null},i+r)}function ql(e,t){return!e||e.length===0?"":e.map(n=>hU(n,t)).join("")}function gN(e){return e?.some(t=>t.side==="after")??!1}function mU(e){let t=[];return e.titleTruncated&&t.push(e.title),e.waveTooltip!==void 0&&t.push(e.waveTooltip),t.length>0?`<title>${tt(t.join(`
2920
+ `))}</title>`:""}function gU(e,t){let n=[],r=sN(t,e.style.shadow);return n.push(oN(e.box.x,e.box.y,e.box.width,e.box.height,e.style,{filter:r??null})),e.waveRole==="background"&&e.waveHatch&&n.push(fN(e.box,e.style,e.waveHatch,t)),n.join("")}function yU(e){if(e.progressFraction>0){let t=Math.max(0,Math.min(e.box.width,e.box.width*e.progressFraction));return j("rect",{x:h(e.box.x),y:h(e.box.y+e.box.height-rn),width:h(t),height:rn,fill:e.style.fg,opacity:.55})}return""}function xU(e){let t=e.dotSpills&&e.dotSpillCx!==null?e.dotSpillCx:e.box.x+e.box.width-Ai;return j("circle",{cx:h(t),cy:h(e.box.y+jg),r:Pr,fill:e.statusDotColor})}function EU(e,t){let n;if(e.textSpills)n=e.box.x+e.box.width+Bn,e.iconSpills&&(n+=Cr+Xt);else{let r=!!e.linkIcon&&e.linkIcon!=="none",o=e.inlineDatePins?.find(s=>s.side==="after"&&!s.spilled)?hs(r,{barWidth:e.box.width}):hs(!t.noLinks&&r&&!e.iconSpills);n=e.box.x+o}return n}function wU(e,t,n,r){let i=[],o=e.style.text,s=n.entities.item.text,a=e.textSpills?s:o,l=e.textSpills?s:e.style.fg,c=e.titleLines??(e.title?[e.title]:[]);return c.forEach((u,f)=>{u!==""&&i.push(ae({x:h(t),y:h(e.box.y+Zf+f*ll),"font-family":r[e.style.font],"font-size":Or,"font-weight":600,fill:a},u))}),(e.metaText||e.capacity)&&i.push(pU({metaText:e.metaText,capacity:e.capacity,x:t,baselineY:e.box.y+Jf(c.length),fontSize:al,fontFamily:r[e.style.font],color:l})),i.join("")}function TU(e,t,n){let r=[],i=t.entities.item.text;if(e.footnoteIndicators.length>0){let o=e.box.y+Yg;if(e.footnoteSpills&&e.footnoteSpillStartX!==null){let s=e.footnoteSpillStartX;for(let a=0;a<e.footnoteIndicators.length;a++){let l=e.footnoteIndicators[a];r.push(ae({x:h(s),y:h(o),"font-family":n.sans,"font-size":cl,"font-weight":700,fill:i},String(l))),s+=Ut}}else{let s=e.box.x+e.box.width-ps;for(let a=e.footnoteIndicators.length-1;a>=0;a--){let l=e.footnoteIndicators[a];r.push(ae({x:h(s),y:h(o),"font-family":n.sans,"font-size":cl,"font-weight":700,fill:e.style.text,"text-anchor":"end"},String(l))),s-=Ut}}}return r.join("")}function vU(e,t,n){let r=[];if(!t.noLinks&&e.linkIcon&&e.linkIcon!=="none"){let i={linear:"#5e6ad2",github:"#0f172a",jira:"#0052cc",generic:n.item.linkIconFg},o=i[e.linkIcon]??i.generic,s=Cr,a=e.iconSpills&&e.iconSpillX!==null?e.iconSpillX:e.box.x+ki,l=e.box.y+ki,c=j("rect",{x:h(a),y:h(l),width:s,height:s,rx:2,ry:2,fill:o}),u=a,f=l,d=j("path",{d:`M${h(u+4)} ${h(f+10)} L${h(u+10)} ${h(f+4)} M${h(u+6)} ${h(f+4)} H${h(u+10)} V${h(f+8)}`,stroke:"#ffffff",fill:"none","stroke-width":1.1,"stroke-linecap":"round","stroke-linejoin":"round"}),p=c+d,m=e.linkHref&&Di(e.linkHref)?j("a",{href:e.linkHref,target:"_blank",rel:"noopener"},p):p;r.push(m)}return r.join("")}function _U(e,t,n){let r=[];if(e.hasOverflow&&e.overflowBox){let i=t.item.overflowTailFill,o=t.item.overflowTailStroke,s=t.item.overflowCaption;r.push(j("rect",{x:h(e.overflowBox.x),y:h(e.overflowBox.y),width:h(e.overflowBox.width),height:h(e.overflowBox.height),fill:i,stroke:o,"stroke-width":1})),e.overflowAnchorId&&e.overflowBox.width>60&&r.push(ae({x:h(e.overflowBox.x+e.overflowBox.width/2),y:h(e.overflowBox.y+e.overflowBox.height/2+3),"font-family":n.sans,"font-size":9,"font-weight":700,fill:s,"text-anchor":"middle"},`past ${e.overflowAnchorId}`))}return r.join("")}function AU(e,t){let n=[];for(let r of e.labelChips){let i=Math.min(Ri[r.style.cornerRadius]??8,r.box.height/2);n.push(j("rect",{x:h(r.box.x),y:h(r.box.y),width:h(r.box.width),height:h(r.box.height),rx:h(i),ry:h(i),fill:r.style.bg==="none"?"transparent":r.style.bg,stroke:r.style.fg,"stroke-width":.5})),n.push(ae({x:h(r.box.x+r.box.width/2),y:h(r.box.y+r.box.height/2+3),...Cp(r.style,t,Ii.xs),"text-anchor":"middle"},r.text))}return n.join("")}function yN(e,t,n,r,i){let o=[];return o.push(mU(e)),o.push(gU(e,n)),o.push(yU(e)),o.push(xU(e)),o.push(ql(e.inlineDatePins,e.style.fg)),o.push(wU(e,EU(e,t),r,i)),o.push(TU(e,r,i)),o.push(vU(e,t,r)),o.push(_U(e,r,i)),o.push(AU(e,i)),j("g",{"data-layer":"item","data-id":e.id??null},o.join(""))}function kU(e,t,n,r,i,o){let s=[];if(!(e.kind==="group"&&e.waveOnly)){let l=e.box.y+e.headerHeight,c=e.box.height-e.headerHeight;if(e.style.bg!=="none"){let f=t<=ky;s.push(j("rect",{x:h(e.box.x),y:h(l),width:h(e.box.width),height:h(c),fill:f?e.style.bg:"none","fill-opacity":f?t===1?_y:Ay:null,stroke:f?null:e.style.bg,"stroke-opacity":f?null:.6,"stroke-width":f?null:1}))}let u=e.kind==="group"?e.style.fg:i.parallel.bracketStroke;if(e.headerHeight>0&&e.style.bracket!=="none"){let f=e.box.y+Tl,d=e.box.x,p=e.box.x+e.box.width;s.push(j("path",{d:`M${h(d)} ${h(l)} V${h(f)} H${h(p)} V${h(l)}`,fill:"none",stroke:u,"stroke-width":1.2,"stroke-dasharray":e.style.bracket==="dashed"?"3 2":null}))}e.title&&e.headerHeight>0&&s.push(ae({x:h(Es(e.box.x,gN(e.inlineDatePins))),y:h(e.box.y+vy),...Cp(e.style,o,pd),"font-weight":600,fill:u},e.title)),s.push(ql(e.inlineDatePins,e.style.fg))}for(let l of e.children)s.push(EN(l,n,r,i,o,t));return j("g",{"data-layer":e.kind,"data-id":e.id??null},s.join(""))}function EN(e,t,n,r,i,o=0){return e.kind==="item"?yN(e,t,n,r,i):kU(e,o+1,t,n,r,i)}var xN=2;function IU(e,t){switch(e){case"green":return t.swimlane.utilizationOk;case"yellow":return t.swimlane.utilizationWarn;case"red":return t.swimlane.utilizationOver}}function RU(e,t){if(!e.utilization||e.utilization.segments.length===0)return"";let n=e.box.y+e.box.height-xN,r=e.utilization.segments.map(i=>{let o=i.endX-i.startX;return o<=0?"":j("rect",{x:h(i.startX),y:h(n),width:h(o),height:xN,fill:IU(i.classification,t),"data-utilization":i.classification,"data-load":h(i.load)})});return j("g",{"data-layer":"lane-utilization","data-id":e.id??null},r.join(""))}function wN(e,t){let n=e.bandIndex%2===0?t.swimlane.rowTintEven:t.swimlane.rowTintOdd,r=t.swimlane.border;return j("g",{"data-layer":"swimlane-bg","data-id":e.id??null},j("rect",{x:h(e.box.x),y:h(e.box.y),width:h(e.box.width),height:h(e.box.height),fill:n,stroke:r,"stroke-width":1}))}function Bp(e,t,n,r,i){let o=r.swimlane.tabFill,s=r.swimlane.tabStroke,a=r.swimlane.tabText,l=r.swimlane.ownerText,c=r.swimlane.footnoteIndicator,u=[],f=e.tab;if(f){let p=e.footnoteIndicators.length>0?e.footnoteIndicators.join(","):"",m=hl,g=e.box.y+10,E=g+ml;if(u.push(j("rect",{x:h(f.tabX),y:h(g),width:h(f.tabW),height:h(m),rx:4,ry:4,fill:o,stroke:s,"stroke-width":1})),u.push(ae({x:h(f.titleX),y:h(E),"font-family":i[e.style.font],"font-size":12,"font-weight":600,fill:a},e.title)),e.owner){let x=wn[e.ownerKind==="person"?"person":"people"],y=vl;u.push(`<svg x="${h(f.ownerX)}" y="${h(E-y*.85)}" width="${h(y)}" height="${h(y)}" viewBox="${x.viewBox}" style="color:${an(l)}" aria-hidden="true">${x.body}</svg>`),u.push(ae({x:h(f.ownerTextX),y:h(E),"font-family":i[e.style.font],"font-size":10,fill:l},e.owner))}e.capacity&&u.push(rE(e.capacity,f.badgeX,E,10,i[e.style.font],l)),p&&u.push(ae({x:h(f.footnoteRightX),y:h(g+14),"font-family":i.sans,"font-size":10,"font-weight":700,fill:c,"text-anchor":"end"},p))}for(let d of e.children)u.push(EN(d,t,n,r,i));return u.push(RU(e,r)),j("g",{"data-layer":"swimlane","data-id":e.id??null},u.join(""))}function vN(e,t,n){let r=n.timeline.gridLine,i=n.timeline.minorGridLine,o=e.bottomTickPanelHeight??0,s=e.bottomTickPanelY!==void 0&&o>0,a=e.tickPanelY,l=s?e.bottomTickPanelY+o:e.box.y+e.box.height,c=t,u=e.box.y+e.box.height,f=[];for(let d of e.ticks)if(d.major)f.push(j("line",{x1:h(d.x),y1:h(a),x2:h(d.x),y2:h(l),stroke:r,"stroke-width":1}));else if(e.minorGrid){if(d.labelX===void 0)continue;f.push(j("line",{x1:h(d.x),y1:h(c),x2:h(d.x),y2:h(u),stroke:i,"stroke-width":1}))}for(let d of e.nonWorking??[])d.seam&&f.push(j("line",{x1:h(d.x),y1:h(c),x2:h(d.x),y2:h(u),stroke:n.timeline.nonWorkingSeam,"stroke-width":1,"stroke-dasharray":"1 3"}));return j("g",{"data-layer":"grid"},f.join(""))}function Wp(e,t,n,r){let i=e.box.y+e.box.height,o=[];for(let s of e.nonWorking??[]){if(!s.band)continue;let a={x:s.x,y:t,width:s.width,height:i-t},l=r?$p(a,r):a;!l||l.width<=0||l.height<=0||o.push(j("rect",{x:h(l.x),y:h(l.y),width:h(l.width),height:h(l.height),fill:n.timeline.nonWorkingFill,"fill-opacity":dy}))}return o.length===0?"":j("g",{"data-layer":"non-working"},o.join(""))}function _N(e,t,n){let r=e.box.y+e.box.height,i=[];for(let o of e.nonWorking??[])o.label===void 0||!o.labelBox||(o.cut&&i.push(j("line",{x1:h(o.x),y1:h(o.labelBox.y+4),x2:h(o.x),y2:h(r),stroke:t.timeline.nonWorkingSeam,"stroke-width":1,"stroke-dasharray":"1 3"})),i.push(TN(o.label,o.labelBox,o.labelSide,t,n)));for(let o of e.workingExceptions??[])o.labelBox&&i.push(TN(o.label,o.labelBox,o.labelSide,t,n));return i.length===0?"":j("g",{"data-layer":"non-working-label"},i.join(""))}function TN(e,t,n,r,i){let o=n==="left",s=t.y+4,a={x:h(o?t.x+t.width:t.x),y:h(s+4),"font-family":i.sans,"font-size":10,fill:r.timeline.labelText};return o&&(a["text-anchor"]="end"),ae(a,e)}function AN(e,t,n){let r=t.timeline.panelFill,i=t.timeline.border,o=t.timeline.labelText,s=[],a=e.tickPanelY,l=e.tickPanelHeight,c=l>0,u=e.markerRow.height>0,f=e.waveStrip?e.waveStrip.y+e.waveStrip.height:a+l,d=e.markerRow.height,p=e.bottomTickPanelY,m=e.bottomTickPanelHeight??0,g=p!==void 0&&m>0;c&&s.push(j("rect",{x:h(e.box.x),y:h(a),width:h(e.box.width),height:h(l),rx:4,ry:4,fill:r,stroke:i,"stroke-width":1})),u&&s.push(j("rect",{x:h(e.box.x),y:h(f),width:h(e.box.width),height:h(d),rx:4,ry:4,fill:r,stroke:i,"stroke-width":1})),g&&s.push(j("rect",{x:h(e.box.x),y:h(p),width:h(e.box.width),height:h(m),rx:4,ry:4,fill:r,stroke:i,"stroke-width":1}));for(let E of e.ticks)E.major&&(!E.label||E.labelX===void 0||(c&&s.push(ae({x:h(E.labelX),y:h(a+pl(l)),"font-family":n.sans,"font-size":Si,fill:o,"text-anchor":"middle"},E.label)),g&&s.push(ae({x:h(E.labelX),y:h(p+pl(m)),"font-family":n.sans,"font-size":Si,fill:o,"text-anchor":"middle"},E.label))));return j("g",{"data-layer":"timeline"},s.join(""))}function kN(e,t,n,r,i,o){let s=r.includeRegion.border,a=r.includeRegion.fill,l=r.includeRegion.tabFill,c=r.includeRegion.tabStroke,u=r.includeRegion.tabText,f=r.includeRegion.badgeFill,d=r.includeRegion.badgeStroke,p=r.includeRegion.badgeText,m=e.box.x+8,g=e.box.y,E=e.box.width-16,x=e.box.height,y=j("rect",{x:h(m),y:h(g),width:h(E),height:h(x),rx:8,ry:8,fill:a,stroke:s,"stroke-width":1,"stroke-dasharray":gl}),w=hl,_=_l(e.box.x,e.label,e.sourcePath),v=g-w/2,R=j("rect",{x:h(_.tabX),y:h(v),width:h(_.tabWidth),height:w,rx:4,ry:4,fill:l,stroke:c,"stroke-width":1}),B=ae({x:h(_.tabLabelX),y:h(v+ml),"font-family":i.sans,"font-size":11,"font-weight":600,fill:u},e.label),C=_.badgeX,X=_.badgeSize,V=g-X/2,$=j("rect",{x:h(C),y:h(V),width:X,height:X,rx:4,ry:4,fill:f,stroke:d,"stroke-width":1}),I=j("path",{d:`M${h(C+7)} ${h(V+4)} H${h(C+14)} V${h(V+11)} M${h(C+4)} ${h(V+7)} H${h(C+11)} V${h(V+14)} H${h(C+4)} Z`,stroke:p,"stroke-width":1.4,fill:"none","stroke-linecap":"round","stroke-linejoin":"round"}),F=9,N=g+4,k=j("rect",{x:h(_.sourceHaloX),y:h(N-F),width:h(_.sourceHaloWidth),height:F+6,fill:a}),b=ae({x:h(_.sourceTextX),y:h(N),"font-family":i.mono,"font-size":F,fill:p},e.sourcePath),T={x:m,y:g,width:E,height:x},L=o?Wp(o.timeline,o.chartBox.y,r,T):"",D=o?.waves?Dp(o.waves,T)+Mp(o.waveBoundaries,T):"",P=o?.waves?Fp(e.waveCrossings):"",U=e.nestedSwimlanes.map(A=>Bp(A,t,n,r,i)).join(""),z=(e.edges??[]).map(A=>Sp(A,r)).join(""),J=e.anchors??[],Y=e.milestones??[],te=J.map(A=>Lp(A,r)).join("")+Y.map(A=>Op(A,n,r)).join("")+J.map(A=>Np(A,r,i)).join("")+Y.map(A=>Pp(A,r,i)).join("");return j("g",{"data-layer":"include"},y+L+D+z+U+P+te+R+B+$+I+k+b)}function IN(e,t,n){if(!e)return"";let r=t.nowline.stroke,i=t.nowline.labelText,o=j("line",{x1:h(e.x),y1:h(e.topY),x2:h(e.x),y2:h(e.bottomY),stroke:r,"stroke-width":nd}),s=SU(e,r),a=bU(e,i,n);return j("g",{"data-layer":"nowline"},o+s+a)}function RN(e){let t=nd/2;return e.pillMode==="flag-right"?e.x-t:e.pillMode==="flag-left"?e.x+t:e.x}function SU(e,t){let n=e.pillTopY,r=e.pillTopY+Gt,i=ny,o=e.pillWidth;if(e.pillMode==="center")return j("rect",{x:h(e.x-o/2),y:h(n),width:h(o),height:h(Gt),rx:i,ry:i,fill:t});let s=RN(e);if(e.pillMode==="flag-right"){let c=s+o,u=[`M ${h(s)} ${h(n)}`,`L ${h(c-i)} ${h(n)}`,`A ${i} ${i} 0 0 1 ${h(c)} ${h(n+i)}`,`L ${h(c)} ${h(r-i)}`,`A ${i} ${i} 0 0 1 ${h(c-i)} ${h(r)}`,`L ${h(s)} ${h(r)}`,"Z"].join(" ");return j("path",{d:u,fill:t})}let a=s-o,l=[`M ${h(s)} ${h(n)}`,`L ${h(a+i)} ${h(n)}`,`A ${i} ${i} 0 0 0 ${h(a)} ${h(n+i)}`,`L ${h(a)} ${h(r-i)}`,`A ${i} ${i} 0 0 0 ${h(a+i)} ${h(r)}`,`L ${h(s)} ${h(r)}`,"Z"].join(" ");return j("path",{d:l,fill:t})}function bU(e,t,n){let r=e.pillTopY+ry,i=RN(e),o,s;return e.pillMode==="center"?(o=e.x,s="middle"):e.pillMode==="flag-right"?(o=i+gs,s="start"):(o=i-gs,s="end"),ae({x:h(o),y:h(r),"font-family":n.sans,"font-size":yl,"font-weight":700,fill:t,"text-anchor":s},e.label)}async function iE(e,t={}){let r=new bp(t.idPrefix??"nl").next("root"),i=e.palette,o=t.fontFamilies??fy,s=[],a=(u,f)=>`<marker id="${u}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" fill="${f}"/></marker>`,l=`<defs>${aN(r)}`+a(`${r}-arrow-dark`,i.arrowhead.dark)+uN(e).map(u=>cN(r,u,i)).join("")+"</defs>";s.push(l),s.push(j("rect",{x:0,y:0,width:h(e.width),height:h(e.height),fill:e.backgroundColor})),s.push(AN(e.timeline,i,o)),s.push(dN(e,i));for(let u of e.swimlanes)s.push(wN(u,i));s.push(Wp(e.timeline,e.chartBox.y,i)),e.waves&&s.push(Dp(e.waves)),s.push(vN(e.timeline,e.chartBox.y,i)),s.push(Mp(e.waveBoundaries)),s.push(pN(e,i,o));for(let u of e.edges)s.push(Sp(u,i));for(let u of e.swimlanes)s.push(Bp(u,t,r,i,o));for(let u of e.includes)s.push(kN(u,t,r,i,o,e));s.push(Fp(e.waveCrossings));for(let u of e.anchors)s.push(Lp(u,i));for(let u of e.milestones)s.push(Op(u,r,i));s.push(_N(e.timeline,i,o));for(let u of e.anchors)s.push(Np(u,i,o));for(let u of e.milestones)s.push(Pp(u,i,o));if(s.push(IN(e.nowline,i,o)),s.push(Qb(e.footnotes,r,i,o)),s.push(hN(e.waveLegend,r,i,o)),s.push(eN(e.header,r,i,o)),s.push(tN(e,o)),e.header.logo&&(t.logo||t.assetResolver)){let u=await nN(e.header.logo,t.assetResolver,r,t);u&&s.push(u)}return`<svg${Ds({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${h(e.width)} ${h(e.height)}`,width:h(e.width),height:h(e.height),"data-theme":e.theme,"data-generator":"nowline"})}>${s.join("")}</svg>`}var oE="/browser-source.nowline",NU={error:3,warning:2,info:1},LU={error:3,warning:2,info:1};function SN(e,t){return NU[e]>=LU[t]}var Xp,bN=0;function NN(){return Xp||(Xp=ox()),Xp}function PU(){return Ce.parse(`memory:///nowline-browser-${++bN}.nowline`)}async function sE(e,t={}){let n=t.filePath??oE,r=await Cl(NN().shared,e,PU());return{ast:r.parseResult.value,diagnostics:LN(r,n)}}function LN(e,t){return PN(Ni(e),t)}function PN(e,t){return e.map(n=>n.origin==="lexer"?Zx(n.error,t):n.origin==="parser"?qx(n.error,t):$b(n.diagnostic,t))}async function aE(e,t={}){let n=t.filePath??oE,r=NN(),i,o;if(t.timezone)try{i=Vx(t.timezone)}catch(w){if(!(w instanceof Xi))throw w;o=w}let s=o?void 0:Kx({now:t.today,zone:i}),a=await eE({source:e,sourcePath:n,services:r,readSource:t.readFile??Wb,assetResolver:t.assetResolver,isToleratedIncludeError:w=>Jx(w.message),layout:{theme:t.theme,today:s,locale:t.locale,width:t.width,nonWorking:t.nonWorking}});if(a.kind==="invalid")return{kind:"diagnostics",diagnostics:PN(a.diagnostics,n)};let l=a.kind==="include-error"&&a.legacy!==void 0,c=LN(a.document,n);for(let w of a.resolved.diagnostics){if(w.severity==="error"&&Jx(w.message)){t.onSkippedInclude?.({sourcePath:w.sourcePath,message:w.message});continue}l&&Br(w)||c.push(Db(w))}if(a.kind==="include-error"||c.some(w=>w.severity==="error"))return{kind:"diagnostics",diagnostics:c};if(o)return{kind:"diagnostics",diagnostics:[{severity:"error",code:"invalid-timezone",message:o.message,file:n,line:1,column:1}]};let u=[...a.warnings],{logo:f,model:d}=a,p=t.diagnosticLevel??"error",m=Yx(d,{today:s??void 0,locale:t.locale??"en-US"}).map(w=>Fb(w,n)),g=t.showLinks!==!1,E=t.strict===!0,x=await iE(d,{idPrefix:t.idPrefix,assetResolver:t.assetResolver,logo:f,noLinks:!g,strict:E,warn:w=>u.push(w),fontFamilies:t.fontFamilies}),y=[...m,...u.map(w=>Mb(w,n,E?"error":"warning"))].filter(w=>SN(w.severity,p));return E&&y.length>0?{kind:"diagnostics",diagnostics:[...c,...y]}:{kind:"svg",svg:x,warnings:y}}function lE(){Xp=void 0,bN=0}var ON="/embed.nowline",cE=!1;async function CN(e){let{ast:t,diagnostics:n}=await sE(e,{filePath:ON});return{ast:t,errors:n.filter(r=>r.severity==="error").map(r=>r.message)}}async function Up(e,t={}){let n={filePath:ON,theme:t.theme,today:t.today,timezone:t.timezone,locale:t.locale,width:t.width,nonWorking:t.nonWorking,idPrefix:t.idPrefix,onSkippedInclude:()=>{cE||(cE=!0,console.warn("nowline: `include` directives are skipped in the browser embed (single-file mode). Render multi-file roadmaps with the CLI or the GitHub Action."))}},r=await aE(e,n);if(r.kind==="svg")return r.svg;let i=r.diagnostics.filter(o=>o.severity==="error").map(o=>o.message);throw new Zl(`Failed to render Nowline source: ${i.join("; ")}`,i)}var Zl=class extends Error{constructor(n,r){super(n);M(this,"details",r);this.name="EmbedRenderError"}};function $N(){cE=!1,lE()}var ln=Uint8Array,$t=Uint16Array,hE=Int32Array,mE=new ln([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gE=new ln([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),DN=new ln([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),WN=function(e,t){for(var n=new $t(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new hE(n[30]),r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return{b:n,r:i}},XN=WN(mE,2),OU=XN.b,fE=XN.r;OU[28]=258,fE[258]=28;var UN=WN(gE,0),tce=UN.b,MN=UN.r,dE=new $t(32768);for(xe=0;xe<32768;++xe)Jn=(xe&43690)>>1|(xe&21845)<<1,Jn=(Jn&52428)>>2|(Jn&13107)<<2,Jn=(Jn&61680)>>4|(Jn&3855)<<4,dE[xe]=((Jn&65280)>>8|(Jn&255)<<8)>>1;var Jn,xe,ec=(function(e,t,n){for(var r=e.length,i=0,o=new $t(t);i<r;++i)e[i]&&++o[e[i]-1];var s=new $t(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(n){a=new $t(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],u=t-e[i],f=s[e[i]-1]++<<u,d=f|(1<<u)-1;f<=d;++f)a[dE[f]>>l]=c}else for(a=new $t(r),i=0;i<r;++i)e[i]&&(a[i]=dE[s[e[i]-1]++]>>15-e[i]);return a}),Ui=new ln(288);for(xe=0;xe<144;++xe)Ui[xe]=8;var xe;for(xe=144;xe<256;++xe)Ui[xe]=9;var xe;for(xe=256;xe<280;++xe)Ui[xe]=7;var xe;for(xe=280;xe<288;++xe)Ui[xe]=8;var xe,Gp=new ln(32);for(xe=0;xe<32;++xe)Gp[xe]=5;var xe,CU=ec(Ui,9,0);var $U=ec(Gp,5,0);var GN=function(e){return(e+7)/8|0},DU=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ln(e.subarray(t,n))};var Qn=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Jl=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},uE=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return{t:zN,l:0};if(i==1){var s=new ln(n[0].s+1);return s[n[0].s]=1,{t:s,l:1}}n.sort(function(v,R){return v.f-R.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,f=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=n[n[c].f<n[f].f?c++:f++],l=n[c!=u&&n[c].f<n[f].f?c++:f++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=o[0].s,r=1;r<i;++r)o[r].s>d&&(d=o[r].s);var p=new $t(d+1),m=pE(n[u-1],p,0);if(m>t){var r=0,g=0,E=m-t,x=1<<E;for(o.sort(function(R,B){return p[B.s]-p[R.s]||R.f-B.f});r<i;++r){var y=o[r].s;if(p[y]>t)g+=x-(1<<m-p[y]),p[y]=t;else break}for(g>>=E;g>0;){var w=o[r].s;p[w]<t?g-=1<<t-p[w]++-1:++r}for(;r>=0&&g;--r){var _=o[r].s;p[_]==t&&(--p[_],++g)}m=t}return{t:new ln(p),l:m}},pE=function(e,t,n){return e.s==-1?Math.max(pE(e.l,t,n+1),pE(e.r,t,n+1)):t[e.s]=n},FN=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new $t(++t),r=0,i=e[0],o=1,s=function(l){n[r++]=l},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return{c:n.subarray(0,r),n:t}},Ql=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},HN=function(e,t,n){var r=n.length,i=GN(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var o=0;o<r;++o)e[i+o+4]=n[o];return(i+4+r)*8},BN=function(e,t,n,r,i,o,s,a,l,c,u){Qn(t,u++,n),++i[256];for(var f=uE(i,15),d=f.t,p=f.l,m=uE(o,15),g=m.t,E=m.l,x=FN(d),y=x.c,w=x.n,_=FN(g),v=_.c,R=_.n,B=new $t(19),C=0;C<y.length;++C)++B[y[C]&31];for(var C=0;C<v.length;++C)++B[v[C]&31];for(var X=uE(B,7),V=X.t,$=X.l,I=19;I>4&&!V[DN[I-1]];--I);var F=c+5<<3,N=Ql(i,Ui)+Ql(o,Gp)+s,k=Ql(i,d)+Ql(o,g)+s+14+3*I+Ql(B,V)+2*B[16]+3*B[17]+7*B[18];if(l>=0&&F<=N&&F<=k)return HN(t,u,e.subarray(l,l+c));var b,T,L,D;if(Qn(t,u,1+(k<N)),u+=2,k<N){b=ec(d,p,0),T=d,L=ec(g,E,0),D=g;var P=ec(V,$,0);Qn(t,u,w-257),Qn(t,u+5,R-1),Qn(t,u+10,I-4),u+=14;for(var C=0;C<I;++C)Qn(t,u+3*C,V[DN[C]]);u+=3*I;for(var U=[y,v],z=0;z<2;++z)for(var J=U[z],C=0;C<J.length;++C){var Y=J[C]&31;Qn(t,u,P[Y]),u+=V[Y],Y>15&&(Qn(t,u,J[C]>>5&127),u+=J[C]>>12)}}else b=CU,T=Ui,L=$U,D=Gp;for(var C=0;C<a;++C){var te=r[C];if(te>255){var Y=te>>18&31;Jl(t,u,b[Y+257]),u+=T[Y+257],Y>7&&(Qn(t,u,te>>23&31),u+=mE[Y]);var A=te&31;Jl(t,u,L[A]),u+=D[A],A>3&&(Jl(t,u,te>>5&8191),u+=gE[A])}else Jl(t,u,b[te]),u+=T[te]}return Jl(t,u,b[256]),u+T[256]},MU=new hE([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zN=new ln(0),FU=function(e,t,n,r,i,o){var s=o.z||e.length,a=new ln(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=o.l,u=(o.r||0)&7;if(t){u&&(l[0]=o.r>>3);for(var f=MU[t-1],d=f>>13,p=f&8191,m=(1<<n)-1,g=o.p||new $t(32768),E=o.h||new $t(m+1),x=Math.ceil(n/3),y=2*x,w=function(le){return(e[le]^e[le+1]<<x^e[le+2]<<y)&m},_=new hE(25e3),v=new $t(288),R=new $t(32),B=0,C=0,X=o.i||0,V=0,$=o.w||0,I=0;X+2<s;++X){var F=w(X),N=X&32767,k=E[F];if(g[N]=k,E[F]=N,$<=X){var b=s-X;if((B>7e3||V>24576)&&(b>423||!c)){u=BN(e,l,0,_,v,R,C,V,I,X-I,u),V=B=C=0,I=X;for(var T=0;T<286;++T)v[T]=0;for(var T=0;T<30;++T)R[T]=0}var L=2,D=0,P=p,U=N-k&32767;if(b>2&&F==w(X-U))for(var z=Math.min(d,b)-1,J=Math.min(32767,X),Y=Math.min(258,b);U<=J&&--P&&N!=k;){if(e[X+L]==e[X+L-U]){for(var te=0;te<Y&&e[X+te]==e[X+te-U];++te);if(te>L){if(L=te,D=U,te>z)break;for(var A=Math.min(U,te-2),O=0,T=0;T<A;++T){var W=X-U+T&32767,G=g[W],K=W-G&32767;K>O&&(O=K,k=W)}}}N=k,k=g[N],U+=N-k&32767}if(D){_[V++]=268435456|fE[L]<<18|MN[D];var q=fE[L]&31,Q=MN[D]&31;C+=mE[q]+gE[Q],++v[257+q],++R[Q],$=X+L,++B}else _[V++]=e[X],++v[e[X]]}}for(X=Math.max(X,$);X<s;++X)_[V++]=e[X],++v[e[X]];u=BN(e,l,c,_,v,R,C,V,I,X-I,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=E,o.p=g,o.i=X,o.w=$)}else{for(var X=o.w||0;X<s+c;X+=65535){var re=X+65535;re>=s&&(l[u/8|0]=c,re=s),u=HN(l,u+1,e.subarray(X,re))}o.i=s}return DU(a,0,r+GN(u)+i)};var jN=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,o=n.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=r+=n[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},BU=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ln(o.length+e.length);s.set(o),s.set(e,o.length),e=s,i.w=o.length}return FU(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)};var YN=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};var WU=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=jN();i.p(t.dictionary),YN(e,2,i.d())}};function VN(e,t){t||(t={});var n=jN();n.p(e);var r=BU(e,t,t.dictionary?6:2,4);return WU(r,t),YN(r,r.length-4,n.d()),r}var XU=typeof TextDecoder<"u"&&new TextDecoder,UU=0;try{XU.decode(zN,{stream:!0}),UU=1}catch{}var ZN="https://free.nowline.io/open";function KN(e){let t=new TextEncoder().encode(e),n=VN(t),r=32768,i="";for(let o=0;o<n.length;o+=r)i+=String.fromCharCode(...n.subarray(o,o+r));return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function yE({source:e,sourceUrl:t,share:n}){if(n===!1||n==="none")return null;if(typeof n=="object")return t!==void 0&&qN(t)?n.remoteUrl.replace("{url}",encodeURIComponent(t)):n.textUrl.replace("{text}",KN(e));let r=n===!0?ZN:n,i=new URL(r);return t!==void 0&&qN(t)?i.hash=`url=${encodeURIComponent(t)}`:i.hash=`text=${KN(e)}`,i.toString()}function qN(e){try{return new URL(e).protocol==="https:"}catch{return!1}}var JN=0;async function QN(e){let t=e.document??globalThis.document;if(!t)return{rendered:0,failed:0};let n=t.querySelectorAll(e.selector),r=0,i=0,o=++JN,s=e.share??!0,a=[],l=0;for(let c of Array.from(n)){let u=GU(c);if(!u)continue;let f=HU(c),d=`nl-r${o}-${l++}`,p={theme:e.theme,locale:e.locale,width:e.width,nonWorking:e.nonWorking,today:e.today,timezone:e.timezone,idPrefix:d},m=u.parentElement,g=u.nextSibling,x=c.getAttribute("data-nowline-source-url")??void 0??e.sourceUrl;a.push(Up(f,p).then(y=>{if(zU(u,y),r++,m!==null){let w=yE({source:f,sourceUrl:x,share:s});if(w!==null){let _=t.createElement("a");_.className="nowline-share",_.href=w,_.target="_blank",_.rel="noopener noreferrer",_.textContent="Share on Nowline",m.insertBefore(_,g)}}},y=>{i++,console.error("nowline: render failed",y)}))}return await Promise.all(a),{rendered:r,failed:i}}function GU(e){let t=e.parentElement;return t&&t.tagName.toUpperCase()==="PRE"?t:e}function HU(e){return e.textContent??""}function zU(e,t){e.outerHTML=t}function eL(){JN=0}function Hp(){if(typeof globalThis>"u")return"light";let e=globalThis.matchMedia;if(typeof e!="function")return"light";try{return e("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function tL(e,t){return e&&e!=="auto"?fx(e)??t:t}var jU="0.13.0",YU="348d8c6",VU="pre code.language-nowline, code.language-nowline",nL={theme:"auto",startOnLoad:!0,selector:VU,systemTheme:Hp(),share:!0},Ae={...nL},xE=!1;function KU(e={}){Ae={theme:e.theme??Ae.theme,startOnLoad:e.startOnLoad??Ae.startOnLoad,selector:e.selector??Ae.selector,locale:e.locale??Ae.locale,width:e.width??Ae.width,nonWorking:e.nonWorking??Ae.nonWorking,today:e.today!==void 0?e.today:Ae.today,timezone:e.timezone??Ae.timezone,share:e.share??Ae.share,sourceUrl:e.sourceUrl??Ae.sourceUrl,systemTheme:Hp()}}function rL(){return{theme:tL(Ae.theme,Ae.systemTheme),locale:Ae.locale,width:Ae.width,nonWorking:Ae.nonWorking,today:Ae.today,timezone:Ae.timezone}}async function qU(e,t={}){let n={...rL(),...t};return Up(e,n)}async function ZU(e){return CN(e)}async function EE(e){let t={selector:e?.selector??Ae.selector,theme:e?.theme??rL().theme,locale:e?.locale??Ae.locale,width:e?.width??Ae.width,nonWorking:e?.nonWorking??Ae.nonWorking,today:e?.today!==void 0?e.today:Ae.today,timezone:e?.timezone??Ae.timezone,share:e?.share??Ae.share,sourceUrl:e?.sourceUrl??Ae.sourceUrl,document:e?.document};return QN(t)}var JU=EE;if(typeof document<"u"&&!xE){xE=!0;let e=()=>{Ae.startOnLoad&&EE()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):queueMicrotask(e)}function QU(){Ae={...nL,systemTheme:Hp()},xE=!1,$N(),eL()}return mL(eG);})();
2921
2921
  //# sourceMappingURL=nowline.min.js.map