@likec4/mcp 1.49.0 → 1.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export{};
@@ -1,2 +1,2 @@
1
- import{C as e,D as t,T as n,c as r,d as i,f as a,h as o,ht as s,l as c,o as l,p as u,u as d,ut as f}from"./@chevrotain/gast.mjs";import{c as ee,d as p,f as m,g as te,h as ne,i as h,m as re,p as ie,r as g,s as _}from"./chevrotain.mjs";function v(e,t){return e<t}function y(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(c===void 0?o===o&&!s(o):n(o,c)))var c=o,l=a}return l}function b(e){return e&&e.length?y(e,f,v):void 0}function x(e,n){return e&&e.length?p(e,t(n,2)):[]}function S(e,t,n){return`${e.name}_${t}_${n}`}var C=class{constructor(e){this.target=e}isEpsilon(){return!1}},w=class extends C{constructor(e,t){super(e),this.tokenType=t}},T=class extends C{constructor(e){super(e)}isEpsilon(){return!0}},E=class extends C{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}};function ae(e){let t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};oe(t,e);let n=e.length;for(let r=0;r<n;r++){let n=e[r],i=O(t,n,n);i!==void 0&&R(t,n,i)}return t}function oe(e,t){let n=t.length;for(let r=0;r<n;r++){let n=t[r],i=B(e,n,void 0,{type:2}),a=B(e,n,void 0,{type:7});i.stop=a,e.ruleToStartState.set(n,i),e.ruleToStopState.set(n,a)}}function D(e,t,n){return n instanceof o?I(e,t,n.terminalType,n):n instanceof r?L(e,t,n):n instanceof l?de(e,t,n):n instanceof c?fe(e,t,n):n instanceof d?se(e,t,n):n instanceof u?ce(e,t,n):n instanceof i?le(e,t,n):n instanceof a?ue(e,t,n):O(e,t,n)}function se(e,t,n){let r=B(e,t,n,{type:5});return M(e,r),A(e,t,n,N(e,t,r,n,O(e,t,n)))}function ce(e,t,n){let r=B(e,t,n,{type:5});return M(e,r),A(e,t,n,N(e,t,r,n,O(e,t,n)),I(e,t,n.separator,n))}function le(e,t,n){let r=B(e,t,n,{type:4});return M(e,r),k(e,t,n,N(e,t,r,n,O(e,t,n)))}function ue(e,t,n){let r=B(e,t,n,{type:4});return M(e,r),k(e,t,n,N(e,t,r,n,O(e,t,n)),I(e,t,n.separator,n))}function de(t,n,r){let i=B(t,n,r,{type:1});return M(t,i),N(t,n,i,r,...e(r.definition,e=>D(t,n,e)))}function fe(e,t,n){let r=B(e,t,n,{type:1});return M(e,r),j(e,t,n,N(e,t,r,n,O(e,t,n)))}function O(t,n,r){let i=ne(e(r.definition,e=>D(t,n,e)),e=>e!==void 0);return i.length===1?i[0]:i.length===0?void 0:F(t,i)}function k(e,t,n,r,i){let a=r.left,o=r.right,s=B(e,t,n,{type:11});M(e,s);let c=B(e,t,n,{type:12});return a.loopback=s,c.loopback=s,e.decisionMap[S(t,i?`RepetitionMandatoryWithSeparator`:`RepetitionMandatory`,n.idx)]=s,z(o,s),i===void 0?(z(s,a),z(s,c)):(z(s,c),z(s,i.left),z(i.right,a)),{left:a,right:c}}function A(e,t,n,r,i){let a=r.left,o=r.right,s=B(e,t,n,{type:10});M(e,s);let c=B(e,t,n,{type:12}),l=B(e,t,n,{type:9});return s.loopback=l,c.loopback=l,z(s,a),z(s,c),z(o,l),i===void 0?z(l,s):(z(l,c),z(l,i.left),z(i.right,a)),e.decisionMap[S(t,i?`RepetitionWithSeparator`:`Repetition`,n.idx)]=s,{left:s,right:c}}function j(e,t,n,r){let i=r.left,a=r.right;return z(i,a),e.decisionMap[S(t,`Option`,n.idx)]=i,r}function M(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function N(e,t,n,r,...i){let a=B(e,t,r,{type:8,start:n});n.end=a;for(let e of i)e===void 0?z(n,a):(z(n,e.left),z(e.right,a));let o={left:n,right:a};return e.decisionMap[S(t,P(r),r.idx)]=n,o}function P(e){if(e instanceof l)return`Alternation`;if(e instanceof c)return`Option`;if(e instanceof d)return`Repetition`;if(e instanceof u)return`RepetitionWithSeparator`;if(e instanceof i)return`RepetitionMandatory`;if(e instanceof a)return`RepetitionMandatoryWithSeparator`;throw Error(`Invalid production type encountered`)}function F(e,t){let n=t.length;for(let r=0;r<n-1;r++){let n=t[r],i;n.left.transitions.length===1&&(i=n.left.transitions[0]);let a=i instanceof E,o=i,s=t[r+1].left;n.left.type===1&&n.right.type===1&&i!==void 0&&(a&&o.followState===n.right||i.target===n.right)?(a?o.followState=s:i.target=s,pe(e,n.right)):z(n.right,s)}let r=t[0],i=t[n-1];return{left:r.left,right:i.right}}function I(e,t,n,r){let i=B(e,t,r,{type:1}),a=B(e,t,r,{type:1});return V(i,new w(a,n)),{left:i,right:a}}function L(e,t,n){let r=n.referencedRule,i=e.ruleToStartState.get(r),a=B(e,t,n,{type:1}),o=B(e,t,n,{type:1});return V(a,new E(i,r,o)),{left:a,right:o}}function R(e,t,n){let r=e.ruleToStartState.get(t);z(r,n.left);let i=e.ruleToStopState.get(t);return z(n.right,i),{left:r,right:i}}function z(e,t){V(e,new T(t))}function B(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 V(e,t){e.transitions.length===0&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function pe(e,t){e.states.splice(e.states.indexOf(t),1)}const H={};var U=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let t=W(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return e(this.configs,e=>e.alt)}get key(){let e=``;for(let t in this.map)e+=t+`:`;return e}};function W(e,t=!0){return`${t?`a${e.alt}`:``}s${e.state.stateNumber}:${e.stack.map(e=>e.stateNumber.toString()).join(`_`)}`}function me(e,t){let n={};return r=>{let i=r.toString(),a=n[i];return a===void 0?(a={atnStartState:e,decision:t,states:{}},n[i]=a,a):a}}var G=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e=``,t=this.predicates.length;for(let n=0;n<t;n++)e+=this.predicates[n]===!0?`1`:`0`;return e}};const K=new G;var he=class extends g{constructor(e){super(),this.logging=e?.logging??(e=>console.log(e))}initialize(e){this.atn=ae(e.rules),this.dfas=ge(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(t){let{prodOccurrence:r,rule:i,hasPredicates:a,dynamicTokensEnabled:o}=t,s=this.dfas,c=this.logging,l=S(i,`Alternation`,r),u=this.atn.decisionMap[l].decision,d=e(h({maxLookahead:1,occurrence:r,prodType:`Alternation`,rule:i}),t=>e(t,e=>e[0]));if(q(d,!1)&&!o){let e=m(d,(e,t,r)=>(n(t,t=>{t&&(e[t.tokenTypeIdx]=r,n(t.categoryMatches,t=>{e[t]=r}))}),e),{});return a?function(t){let n=e[this.LA(1).tokenTypeIdx];if(t!==void 0&&n!==void 0){let e=t[n]?.GATE;if(e!==void 0&&e.call(this)===!1)return}return n}:function(){return e[this.LA(1).tokenTypeIdx]}}else if(a)return function(e){let t=new G,n=e===void 0?0:e.length;for(let r=0;r<n;r++){let n=e?.[r].GATE;t.set(r,n===void 0||n.call(this))}let r=J.call(this,s,u,t,c);return typeof r==`number`?r:void 0};else return function(){let e=J.call(this,s,u,K,c);return typeof e==`number`?e:void 0}}buildLookaheadForOptional(t){let{prodOccurrence:r,rule:i,prodType:a,dynamicTokensEnabled:o}=t,s=this.dfas,c=this.logging,l=S(i,a,r),u=this.atn.decisionMap[l].decision,d=e(h({maxLookahead:1,occurrence:r,prodType:a,rule:i}),t=>e(t,e=>e[0]));if(q(d)&&d[0][0]&&!o){let e=d[0],t=te(e);if(t.length===1&&ie(t[0].categoryMatches)){let e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}else{let e=m(t,(e,t)=>(t!==void 0&&(e[t.tokenTypeIdx]=!0,n(t.categoryMatches,t=>{e[t]=!0})),e),{});return function(){return e[this.LA(1).tokenTypeIdx]===!0}}}return function(){let e=J.call(this,s,u,K,c);return typeof e==`object`?!1:e===0}}};function q(e,t=!0){let n=new Set;for(let r of e){let e=new Set;for(let i of r){if(i===void 0){if(t)break;return!1}let r=[i.tokenTypeIdx].concat(i.categoryMatches);for(let t of r)if(n.has(t)){if(!e.has(t))return!1}else n.add(t),e.add(t)}}return!0}function ge(e){let t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=me(e.decisionStates[r],r);return n}function J(e,t,n,r){let i=e[t](n),a=i.start;return a===void 0&&(a=Z(i,Y(De(i.atnStartState))),i.start=a),_e.apply(this,[i,a,n,r])}function _e(e,t,n,r){let i=t,a=1,o=[],s=this.LA(a++);for(;;){let t=Ce(i,s);if(t===void 0&&(t=ve.apply(this,[e,i,s,a,n,r])),t===H)return Se(o,i,s);if(t.isAcceptState===!0)return t.prediction;i=t,o.push(s),s=this.LA(a++)}}function ve(e,t,n,r,i,a){let o=we(t.configs,n,i);if(o.size===0)return X(e,t,n,H),H;let s=Y(o),c=Ee(o,i);if(c!==void 0)s.isAcceptState=!0,s.prediction=c,s.configs.uniqueAlt=c;else if($(o)){let t=b(o.alts);s.isAcceptState=!0,s.prediction=t,s.configs.uniqueAlt=t,ye.apply(this,[e,r,o.alts,a])}return s=X(e,t,n,s),s}function ye(e,t,n,r){let i=[];for(let e=1;e<=t;e++)i.push(this.LA(e).tokenType);let a=e.atnStartState,o=a.rule,s=a.production;r(be({topLevelRule:o,ambiguityIndices:n,production:s,prefixPath:i}))}function be(t){let n=e(t.prefixPath,e=>_(e)).join(`, `),r=t.production.idx===0?``:t.production.idx,i=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(`, `)}> in <${xe(t.production)}${r}> inside <${t.topLevelRule.name}> Rule,\n<${n}> may appears as a prefix path in all these alternatives.\n`;return i+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
2
- For Further details.`,i}function xe(e){if(e instanceof r)return`SUBRULE`;if(e instanceof c)return`OPTION`;if(e instanceof l)return`OR`;if(e instanceof i)return`AT_LEAST_ONE`;if(e instanceof a)return`AT_LEAST_ONE_SEP`;if(e instanceof u)return`MANY_SEP`;if(e instanceof d)return`MANY`;if(e instanceof o)return`CONSUME`;throw Error(`non exhaustive match`)}function Se(e,t,n){return{actualToken:n,possibleTokenTypes:x(re(t.configs.elements,e=>e.state.transitions).filter(e=>e instanceof w).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:e}}function Ce(e,t){return e.edges[t.tokenTypeIdx]}function we(e,t,n){let r=new U,i=[];for(let a of e.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===7){i.push(a);continue}let e=a.state.transitions.length;for(let n=0;n<e;n++){let e=a.state.transitions[n],i=Te(e,t);i!==void 0&&r.add({state:i,alt:a.alt,stack:a.stack})}}let a;if(i.length===0&&r.size===1&&(a=r),a===void 0){a=new U;for(let e of r.elements)Q(e,a)}if(i.length>0&&!ke(a))for(let e of i)a.add(e);return a}function Te(e,t){if(e instanceof w&&ee(t,e.tokenType))return e.target}function Ee(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 Y(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function X(e,t,n,r){return r=Z(e,r),t.edges[n.tokenTypeIdx]=r,r}function Z(e,t){if(t===H)return t;let n=t.configs.key,r=e.states[n];return r===void 0?(t.configs.finalize(),e.states[n]=t,t):r}function De(e){let t=new U,n=e.transitions.length;for(let r=0;r<n;r++)Q({state:e.transitions[r].target,alt:r,stack:[]},t);return t}function Q(e,t){let n=e.state;if(n.type===7){if(e.stack.length>0){let n=[...e.stack];Q({state:n.pop(),alt:e.alt,stack:n},t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);let r=n.transitions.length;for(let i=0;i<r;i++){let r=n.transitions[i],a=Oe(e,r);a!==void 0&&Q(a,t)}}function Oe(e,t){if(t instanceof T)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof E){let n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}function ke(e){for(let t of e.elements)if(t.state.type===7)return!0;return!1}function Ae(e){for(let t of e.elements)if(t.state.type!==7)return!1;return!0}function $(e){if(Ae(e))return!0;let t=je(e.elements);return Me(t)&&!Ne(t)}function je(e){let t=new Map;for(let n of e){let e=W(n,!1),r=t.get(e);r===void 0&&(r={},t.set(e,r)),r[n.alt]=!0}return t}function Me(e){for(let t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}function Ne(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}export{he as t};
1
+ import{i as e,l as t,r as n,u as r}from"./chevrotain.mjs";import{C as i,E as a,L as o,N as s,P as c,_ as l,c as u,d,f,h as p,l as m,o as h,p as g,q as _,u as v,x as y,z as b}from"./@chevrotain/cst-dts-gen.mjs";function x(e,t,n){return`${e.name}_${t}_${n}`}var S=class{constructor(e){this.target=e}isEpsilon(){return!1}},C=class extends S{constructor(e,t){super(e),this.tokenType=t}},w=class extends S{constructor(e){super(e)}isEpsilon(){return!0}},T=class extends S{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}};function ee(e){let t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};te(t,e);let n=e.length;for(let r=0;r<n;r++){let n=e[r],i=k(t,n,n);i!==void 0&&ce(t,n,i)}return t}function te(e,t){let n=t.length;for(let r=0;r<n;r++){let n=t[r],i=R(e,n,void 0,{type:2}),a=R(e,n,void 0,{type:7});i.stop=a,e.ruleToStartState.set(n,i),e.ruleToStopState.set(n,a)}}function E(e,t,n){return n instanceof p?I(e,t,n.terminalType,n):n instanceof u?se(e,t,n):n instanceof h?ie(e,t,n):n instanceof m?ae(e,t,n):n instanceof v?D(e,t,n):n instanceof g?O(e,t,n):n instanceof d?ne(e,t,n):n instanceof f?re(e,t,n):k(e,t,n)}function D(e,t,n){let r=R(e,t,n,{type:5});return M(e,r),j(e,t,n,N(e,t,r,n,k(e,t,n)))}function O(e,t,n){let r=R(e,t,n,{type:5});return M(e,r),j(e,t,n,N(e,t,r,n,k(e,t,n)),I(e,t,n.separator,n))}function ne(e,t,n){let r=R(e,t,n,{type:4});return M(e,r),A(e,t,n,N(e,t,r,n,k(e,t,n)))}function re(e,t,n){let r=R(e,t,n,{type:4});return M(e,r),A(e,t,n,N(e,t,r,n,k(e,t,n)),I(e,t,n.separator,n))}function ie(e,t,n){let r=R(e,t,n,{type:1});return M(e,r),N(e,t,r,n,...c(n.definition,n=>E(e,t,n)))}function ae(e,t,n){let r=R(e,t,n,{type:1});return M(e,r),oe(e,t,n,N(e,t,r,n,k(e,t,n)))}function k(e,t,n){let r=o(c(n.definition,n=>E(e,t,n)),e=>e!==void 0);return r.length===1?r[0]:r.length===0?void 0:F(e,r)}function A(e,t,n,r,i){let a=r.left,o=r.right,s=R(e,t,n,{type:11});M(e,s);let c=R(e,t,n,{type:12});return a.loopback=s,c.loopback=s,e.decisionMap[x(t,i?`RepetitionMandatoryWithSeparator`:`RepetitionMandatory`,n.idx)]=s,L(o,s),i===void 0?(L(s,a),L(s,c)):(L(s,c),L(s,i.left),L(i.right,a)),{left:a,right:c}}function j(e,t,n,r,i){let a=r.left,o=r.right,s=R(e,t,n,{type:10});M(e,s);let c=R(e,t,n,{type:12}),l=R(e,t,n,{type:9});return s.loopback=l,c.loopback=l,L(s,a),L(s,c),L(o,l),i===void 0?L(l,s):(L(l,c),L(l,i.left),L(i.right,a)),e.decisionMap[x(t,i?`RepetitionWithSeparator`:`Repetition`,n.idx)]=s,{left:s,right:c}}function oe(e,t,n,r){let i=r.left,a=r.right;return L(i,a),e.decisionMap[x(t,`Option`,n.idx)]=i,r}function M(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function N(e,t,n,r,...i){let a=R(e,t,r,{type:8,start:n});n.end=a;for(let e of i)e===void 0?L(n,a):(L(n,e.left),L(e.right,a));let o={left:n,right:a};return e.decisionMap[x(t,P(r),r.idx)]=n,o}function P(e){if(e instanceof h)return`Alternation`;if(e instanceof m)return`Option`;if(e instanceof v)return`Repetition`;if(e instanceof g)return`RepetitionWithSeparator`;if(e instanceof d)return`RepetitionMandatory`;if(e instanceof f)return`RepetitionMandatoryWithSeparator`;throw Error(`Invalid production type encountered`)}function F(e,t){let n=t.length;for(let r=0;r<n-1;r++){let n=t[r],i;n.left.transitions.length===1&&(i=n.left.transitions[0]);let a=i instanceof T,o=i,s=t[r+1].left;n.left.type===1&&n.right.type===1&&i!==void 0&&(a&&o.followState===n.right||i.target===n.right)?(a?o.followState=s:i.target=s,B(e,n.right)):L(n.right,s)}let r=t[0],i=t[n-1];return{left:r.left,right:i.right}}function I(e,t,n,r){let i=R(e,t,r,{type:1}),a=R(e,t,r,{type:1});return z(i,new C(a,n)),{left:i,right:a}}function se(e,t,n){let r=n.referencedRule,i=e.ruleToStartState.get(r),a=R(e,t,n,{type:1}),o=R(e,t,n,{type:1});return z(a,new T(i,r,o)),{left:a,right:o}}function ce(e,t,n){let r=e.ruleToStartState.get(t);L(r,n.left);let i=e.ruleToStopState.get(t);return L(n.right,i),{left:r,right:i}}function L(e,t){z(e,new w(t))}function R(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 z(e,t){e.transitions.length===0&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function B(e,t){e.states.splice(e.states.indexOf(t),1)}const V={};var H=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let t=U(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return c(this.configs,e=>e.alt)}get key(){let e=``;for(let t in this.map)e+=t+`:`;return e}};function U(e,t=!0){return`${t?`a${e.alt}`:``}s${e.state.stateNumber}:${e.stack.map(e=>e.stateNumber.toString()).join(`_`)}`}function W(e,t){let n={};return r=>{let i=r.toString(),a=n[i];return a===void 0?(a={atnStartState:e,decision:t,states:{}},n[i]=a,a):a}}var G=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e=``,t=this.predicates.length;for(let n=0;n<t;n++)e+=this.predicates[n]===!0?`1`:`0`;return e}};const K=new G;var le=class extends n{constructor(e){super(),this.logging=e?.logging??(e=>console.log(e))}initialize(e){this.atn=ee(e.rules),this.dfas=J(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(t){let{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:a}=t,o=this.dfas,s=this.logging,l=x(r,`Alternation`,n),u=this.atn.decisionMap[l].decision,d=c(e({maxLookahead:1,occurrence:n,prodType:`Alternation`,rule:r}),e=>c(e,e=>e[0]));if(q(d,!1)&&!a){let e=y(d,(e,t,n)=>(b(t,t=>{t&&(e[t.tokenTypeIdx]=n,b(t.categoryMatches,t=>{e[t]=n}))}),e),{});return i?function(t){let n=e[this.LA(1).tokenTypeIdx];if(t!==void 0&&n!==void 0){let e=t[n]?.GATE;if(e!==void 0&&e.call(this)===!1)return}return n}:function(){return e[this.LA(1).tokenTypeIdx]}}else if(i)return function(e){let t=new G,n=e===void 0?0:e.length;for(let r=0;r<n;r++){let n=e?.[r].GATE;t.set(r,n===void 0||n.call(this))}let r=Y.call(this,o,u,t,s);return typeof r==`number`?r:void 0};else return function(){let e=Y.call(this,o,u,K,s);return typeof e==`number`?e:void 0}}buildLookaheadForOptional(t){let{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:o}=t,s=this.dfas,l=this.logging,u=x(r,i,n),d=this.atn.decisionMap[u].decision,f=c(e({maxLookahead:1,occurrence:n,prodType:i,rule:r}),e=>c(e,e=>e[0]));if(q(f)&&f[0][0]&&!o){let e=f[0],t=_(e);if(t.length===1&&a(t[0].categoryMatches)){let e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}else{let e=y(t,(e,t)=>(t!==void 0&&(e[t.tokenTypeIdx]=!0,b(t.categoryMatches,t=>{e[t]=!0})),e),{});return function(){return e[this.LA(1).tokenTypeIdx]===!0}}}return function(){let e=Y.call(this,s,d,K,l);return typeof e==`object`?!1:e===0}}};function q(e,t=!0){let n=new Set;for(let r of e){let e=new Set;for(let i of r){if(i===void 0){if(t)break;return!1}let r=[i.tokenTypeIdx].concat(i.categoryMatches);for(let t of r)if(n.has(t)){if(!e.has(t))return!1}else n.add(t),e.add(t)}}return!0}function J(e){let t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=W(e.decisionStates[r],r);return n}function Y(e,t,n,r){let i=e[t](n),a=i.start;return a===void 0&&(a=Q(i,X(be(i.atnStartState))),i.start=a),ue.apply(this,[i,a,n,r])}function ue(e,t,n,r){let i=t,a=1,o=[],s=this.LA(a++);for(;;){let t=ge(i,s);if(t===void 0&&(t=de.apply(this,[e,i,s,a,n,r])),t===V)return he(o,i,s);if(t.isAcceptState===!0)return t.prediction;i=t,o.push(s),s=this.LA(a++)}}function de(e,t,n,r,a,o){let s=_e(t.configs,n,a);if(s.size===0)return Z(e,t,n,V),V;let c=X(s),l=ye(s,a);if(l!==void 0)c.isAcceptState=!0,c.prediction=l,c.configs.uniqueAlt=l;else if(we(s)){let t=i(s.alts);c.isAcceptState=!0,c.prediction=t,c.configs.uniqueAlt=t,fe.apply(this,[e,r,s.alts,o])}return c=Z(e,t,n,c),c}function fe(e,t,n,r){let i=[];for(let e=1;e<=t;e++)i.push(this.LA(e).tokenType);let a=e.atnStartState,o=a.rule,s=a.production;r(pe({topLevelRule:o,ambiguityIndices:n,production:s,prefixPath:i}))}function pe(e){let n=c(e.prefixPath,e=>t(e)).join(`, `),r=e.production.idx===0?``:e.production.idx,i=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(`, `)}> in <${me(e.production)}${r}> inside <${e.topLevelRule.name}> Rule,\n<${n}> may appears as a prefix path in all these alternatives.\n`;return i+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
2
+ For Further details.`,i}function me(e){if(e instanceof u)return`SUBRULE`;if(e instanceof m)return`OPTION`;if(e instanceof h)return`OR`;if(e instanceof d)return`AT_LEAST_ONE`;if(e instanceof f)return`AT_LEAST_ONE_SEP`;if(e instanceof g)return`MANY_SEP`;if(e instanceof v)return`MANY`;if(e instanceof p)return`CONSUME`;throw Error(`non exhaustive match`)}function he(e,t,n){return{actualToken:n,possibleTokenTypes:l(s(t.configs.elements,e=>e.state.transitions).filter(e=>e instanceof C).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:e}}function ge(e,t){return e.edges[t.tokenTypeIdx]}function _e(e,t,n){let r=new H,i=[];for(let a of e.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===7){i.push(a);continue}let e=a.state.transitions.length;for(let n=0;n<e;n++){let e=a.state.transitions[n],i=ve(e,t);i!==void 0&&r.add({state:i,alt:a.alt,stack:a.stack})}}let a;if(i.length===0&&r.size===1&&(a=r),a===void 0){a=new H;for(let e of r.elements)$(e,a)}if(i.length>0&&!Se(a))for(let e of i)a.add(e);return a}function ve(e,t){if(e instanceof C&&r(t,e.tokenType))return e.target}function ye(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 X(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function Z(e,t,n,r){return r=Q(e,r),t.edges[n.tokenTypeIdx]=r,r}function Q(e,t){if(t===V)return t;let n=t.configs.key,r=e.states[n];return r===void 0?(t.configs.finalize(),e.states[n]=t,t):r}function be(e){let t=new H,n=e.transitions.length;for(let r=0;r<n;r++)$({state:e.transitions[r].target,alt:r,stack:[]},t);return t}function $(e,t){let n=e.state;if(n.type===7){if(e.stack.length>0){let n=[...e.stack];$({state:n.pop(),alt:e.alt,stack:n},t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);let r=n.transitions.length;for(let i=0;i<r;i++){let r=n.transitions[i],a=xe(e,r);a!==void 0&&$(a,t)}}function xe(e,t){if(t instanceof w)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof T){let n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}function Se(e){for(let t of e.elements)if(t.state.type===7)return!0;return!1}function Ce(e){for(let t of e.elements)if(t.state.type!==7)return!1;return!0}function we(e){if(Ce(e))return!0;let t=Te(e.elements);return Ee(t)&&!De(t)}function Te(e){let t=new Map;for(let n of e){let e=U(n,!1),r=t.get(e);r===void 0&&(r={},t.set(e,r)),r[n.alt]=!0}return t}function Ee(e){for(let t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}function De(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}export{le as t};