crewx 0.8.7-rc.9 → 0.8.7
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.
- package/dist/assets/MarketPage-Nn6v2smX.js +46 -0
- package/dist/assets/{PromptTab-cl9sfmFb.js → PromptTab-BLj5DYwG.js} +7 -7
- package/dist/assets/_baseUniq-Da8Sle23.js +1 -0
- package/dist/assets/{arc-DYgzygQL.js → arc-CRV7Gm3c.js} +1 -1
- package/dist/assets/architectureDiagram-UYN6MBPD-_c-wCif-.js +36 -0
- package/dist/assets/blockDiagram-ZHA2E4KO-PL5Jtj2V.js +121 -0
- package/dist/assets/{c4Diagram-6F5ED5ID-S4ajWchm.js → c4Diagram-6F5ED5ID-_lOiUsIR.js} +1 -1
- package/dist/assets/channel-CDBdV73-.js +1 -0
- package/dist/assets/{chunk-5HRBRIJM-DdIWzSDE.js → chunk-5HRBRIJM-DAUxGvAh.js} +1 -1
- package/dist/assets/{chunk-7U56Z5CX-B2SJfGfH.js → chunk-7U56Z5CX-BVCYB-Np.js} +1 -1
- package/dist/assets/{chunk-ASOPGD6M-CRhfhuRL.js → chunk-ASOPGD6M-Dqv_Eb6I.js} +1 -1
- package/dist/assets/{chunk-KFBOBJHC-VkCfykDb.js → chunk-KFBOBJHC-CGUpApfa.js} +1 -1
- package/dist/assets/{chunk-T2TOU4HS-BBOBB315.js → chunk-T2TOU4HS-J2SNjA-0.js} +1 -1
- package/dist/assets/{chunk-TMUBEWPD-B05Hvb6L.js → chunk-TMUBEWPD-DKxHm_Td.js} +1 -1
- package/dist/assets/classDiagram-LNE6IOMH-CGD7eu5w.js +1 -0
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-CGD7eu5w.js +1 -0
- package/dist/assets/clone-QnduyJ89.js +1 -0
- package/dist/assets/dagre-4EVJKHTY-CeNbYgy6.js +4 -0
- package/dist/assets/diagram-QW4FP2JN-CF1MsCdY.js +24 -0
- package/dist/assets/{erDiagram-6RL3IURR-Caa8VZC7.js → erDiagram-6RL3IURR-DJLQukyY.js} +2 -2
- package/dist/assets/{flowDiagram-7ASYPVHJ-BYB55sjs.js → flowDiagram-7ASYPVHJ-BP-ToBPt.js} +1 -1
- package/dist/assets/{ganttDiagram-NTVNEXSI-BcXYcxaw.js → ganttDiagram-NTVNEXSI-BCztwWm3.js} +3 -3
- package/dist/assets/gitGraph-YCYPL57B-C4wWI2lu.js +133 -0
- package/dist/assets/gitGraphDiagram-NRZ2UAAF-BOPfFGjh.js +65 -0
- package/dist/assets/graph-LhZDDtD9.js +1 -0
- package/dist/assets/index.browser-CAdCkbEw.js +18 -0
- package/dist/assets/infoDiagram-A4XQUW5V-DxhY4Cnk.js +2 -0
- package/dist/assets/{journeyDiagram-G5WM74LC-CTb5stoS.js → journeyDiagram-G5WM74LC-Dn2RRgG3.js} +1 -1
- package/dist/assets/{kanban-definition-QRCXZQQD-CZ3-crbl.js → kanban-definition-QRCXZQQD-DxkXkkdi.js} +1 -1
- package/dist/assets/layout-BsjmiMVZ.js +1 -0
- package/dist/assets/{linear-oyjLajg6.js → linear-CtHlokEZ.js} +1 -1
- package/dist/assets/main-3IYf82MG.css +10 -0
- package/dist/assets/main-aGv85UbW.js +1167 -0
- package/dist/assets/min-BF7UvoIw.js +1 -0
- package/dist/assets/{mindmap-definition-GWI6TPTV-g-E1kkGy.js → mindmap-definition-GWI6TPTV-BBRhXbd9.js} +1 -1
- package/dist/assets/pieDiagram-YF2LJOPJ-DP_ktdUS.js +30 -0
- package/dist/assets/{quadrantDiagram-OS5C2QUG-DqONkkH3.js → quadrantDiagram-OS5C2QUG-BIh4kwTo.js} +1 -1
- package/dist/assets/{requirementDiagram-MIRIMTAZ-CDm3xZTZ.js → requirementDiagram-MIRIMTAZ-Fe9rmLFI.js} +2 -2
- package/dist/assets/{sankeyDiagram-Y46BX6SQ-C8m3ps_n.js → sankeyDiagram-Y46BX6SQ-CoadFop_.js} +1 -1
- package/dist/assets/{sequenceDiagram-G6AWOVSC-PUahfxSS.js → sequenceDiagram-G6AWOVSC-QKs8kkyp.js} +1 -1
- package/dist/assets/stateDiagram-MAYHULR4-DgmimeQe.js +1 -0
- package/dist/assets/stateDiagram-v2-4JROLMXI-D87jsHh8.js +1 -0
- package/dist/assets/{timeline-definition-U7ZMHBDA-DfW8CJOh.js → timeline-definition-U7ZMHBDA-BnBpyaqh.js} +1 -1
- package/dist/assets/{xychartDiagram-6QU3TZC5--W0eFB2U.js → xychartDiagram-6QU3TZC5-BMvMTHLV.js} +2 -2
- package/dist/index.html +2 -2
- package/dist-server/app.module.js +8 -0
- package/dist-server/common/analytics.client.js +180 -0
- package/dist-server/common/analytics.module.js +21 -0
- package/dist-server/common/device-id.js +33 -0
- package/dist-server/domain/cli/cli.service.js +66 -4
- package/dist-server/domain/cron/cron.controller.js +147 -0
- package/dist-server/domain/cron/cron.module.js +22 -0
- package/dist-server/domain/cron/cron.service.js +77 -0
- package/dist-server/domain/cron/dto/cron.dto.js +80 -0
- package/dist-server/domain/goal/dto/goal.dto.js +49 -0
- package/dist-server/domain/goal/goal.controller.js +86 -0
- package/dist-server/domain/goal/goal.module.js +22 -0
- package/dist-server/domain/goal/goal.service.js +197 -0
- package/dist-server/domain/goal/parser/goal-md-parser.js +166 -0
- package/dist-server/domain/goal/parser/goal-md-serializer.js +110 -0
- package/dist-server/domain/market/default-marketplace.json +24 -0
- package/dist-server/domain/market/market.controller.js +12 -1
- package/dist-server/domain/market/market.service.js +151 -24
- package/dist-server/domain/planner/dto/planner.dto.js +6 -0
- package/dist-server/domain/planner/planner.service.js +24 -0
- package/dist-server/domain/settings/settings.controller.js +52 -0
- package/dist-server/domain/settings/settings.module.js +22 -0
- package/dist-server/domain/settings/settings.service.js +105 -0
- package/dist-server/domain/task/task.service.js +20 -0
- package/dist-server/domain/thread/dto/reorder-pins.dto.js +22 -0
- package/dist-server/domain/thread/thread.controller.js +42 -0
- package/dist-server/domain/thread/thread.service.js +37 -8
- package/dist-server/main.js +1 -0
- package/dist-server/package.json +3 -0
- package/dist-server/repository/task.repository.js +4 -0
- package/dist-server/repository/thread.repository.js +33 -0
- package/package.json +18 -11
- package/packages/cli/dist/builtin.js +1 -0
- package/packages/cli/dist/commands/init.js +218 -8
- package/packages/cli/package.json +2 -1
- package/server.js +6 -3
- package/dist/assets/MarketPage-CYlog_V3.js +0 -56
- package/dist/assets/architectureDiagram-UYN6MBPD-DkFr8VD5.js +0 -36
- package/dist/assets/blockDiagram-ZHA2E4KO-CeS_9eQ3.js +0 -121
- package/dist/assets/channel-KugJxpEW.js +0 -1
- package/dist/assets/classDiagram-LNE6IOMH-Dh2bzbr1.js +0 -1
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-Dh2bzbr1.js +0 -1
- package/dist/assets/dagre-4EVJKHTY-BmAfUy_4.js +0 -4
- package/dist/assets/diagram-QW4FP2JN-DGkNOkq7.js +0 -24
- package/dist/assets/gitGraph-YCYPL57B-b0cpL-El.js +0 -133
- package/dist/assets/gitGraphDiagram-NRZ2UAAF-DNe90DJb.js +0 -65
- package/dist/assets/graph-BlwPajkw.js +0 -1
- package/dist/assets/infoDiagram-A4XQUW5V-DkfOwbGq.js +0 -2
- package/dist/assets/layout-Bvwu4dCi.js +0 -1
- package/dist/assets/main-AcISG6yO.css +0 -10
- package/dist/assets/main-DuQdhdJ6.js +0 -1065
- package/dist/assets/pieDiagram-YF2LJOPJ-BcSbaPQT.js +0 -30
- package/dist/assets/stateDiagram-MAYHULR4-BTIpX8jZ.js +0 -1
- package/dist/assets/stateDiagram-v2-4JROLMXI-BNz0BIrY.js +0 -1
- package/packages/cli/dist/commands/task-db.d.ts +0 -33
- package/packages/cli/dist/commands/task-db.js +0 -107
- package/packages/cli/dist/examples/deny-secrets-plugin.d.ts +0 -22
- package/packages/cli/dist/examples/deny-secrets-plugin.js +0 -40
- package/packages/cli/dist/plugins/examples/echo-hook.d.ts +0 -24
- package/packages/cli/dist/plugins/examples/echo-hook.js +0 -60
- package/packages/cli/dist/plugins/examples/verify-echo-hook.d.ts +0 -8
- package/packages/cli/dist/plugins/examples/verify-echo-hook.js +0 -47
- package/packages/cli/dist/plugins/sqlite-tracing.d.ts +0 -11
- package/packages/cli/dist/plugins/sqlite-tracing.js +0 -19
- package/packages/cli/dist/repository/workspace.repository.d.ts +0 -26
- package/packages/cli/dist/repository/workspace.repository.js +0 -111
- package/packages/cli/dist/schema/tasks.d.ts +0 -7
- package/packages/cli/dist/schema/tasks.js +0 -48
- /package/dist/assets/{gemini-logo.svg → google-logo.svg} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var Mh=Object.defineProperty;var Dh=(t,e,n)=>e in t?Mh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Tt=(t,e,n)=>(Dh(t,typeof e!="symbol"?e+"":e,n),n);import{bV as Fh,cp as _n}from"./main-aGv85UbW.js";import{m as st,f as Gh,d as Uh}from"./min-BF7UvoIw.js";import{b as Bh,l as jh,c as Hh,m as Wh,r as ao,n as zi}from"./_baseUniq-Da8Sle23.js";function zh(t,e){return Bh(st(t,e))}function Kh(t,e){return t&&t.length?jh(t,Hh(e)):[]}function ce(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function ze(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function Vh(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Sr(t){return typeof t=="object"&&t!==null&&ce(t.container)&&ze(t.reference)&&typeof t.message=="string"}class pl{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return ce(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,n);return r[n]=s,s}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function an(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function gl(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function ml(t){return an(t)&&typeof t.fullText=="string"}class oe{constructor(e,n){this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){const n=e[Symbol.iterator]();return new oe(()=>({first:this.startFn(),firstDone:!1}),r=>{let i;if(!r.firstDone){do if(i=this.nextFn(r.first),!i.done)return i;while(!i.done);r.firstDone=!0}do if(i=n.next(),!i.done)return i;while(!i.done);return Ie})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=qh(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new oe(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?Ie:{done:!1,value:e(i)}})}filter(e){return new oe(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return Ie})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new oe(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){const s=e(i);if(br(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return Ie})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new oe(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(br(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return Ie})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new oe(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new oe(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?Ie:this.nextFn(n.state)))}distinct(e){const n=new Set;return this.filter(r=>{const i=e?e(r):r;return n.has(i)?!1:(n.add(i),!0)})}exclude(e,n){const r=new Set;for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function qh(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function br(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Yh=new oe(()=>{},()=>Ie),Ie=Object.freeze({done:!0,value:void 0});function ne(...t){if(t.length===1){const e=t[0];if(e instanceof oe)return e;if(br(e))return new oe(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new oe(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:Ie)}return t.length>1?new oe(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){const n=t[e.collIndex++];br(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return Ie}):Yh}class aa extends oe{constructor(e,n,r){super(()=>({iterators:r!=null&&r.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(n(a.value)[Symbol.iterator]()),a}return Ie})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var ds;(function(t){function e(s){return s.reduce((a,o)=>a+o,0)}t.sum=e;function n(s){return s.reduce((a,o)=>a*o,0)}t.product=n;function r(s){return s.reduce((a,o)=>Math.min(a,o))}t.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}t.max=i})(ds||(ds={}));function hs(t){return new aa(t,e=>an(e)?e.content:[],{includeRoot:!0})}function Xh(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function ps(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function kr(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var Et;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside"})(Et||(Et={}));function Jh(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<t.start.character)return Et.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>e.end.character)return Et.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return n&&r?Et.Inside:n?Et.OverlapBack:Et.OverlapFront}function Qh(t,e){return Jh(t,e)>Et.After}const Zh=/^[\w\p{L}]$/u;function ep(t,e){if(t){const n=tp(t,!0);if(n&&oo(n,e))return n;if(ml(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(oo(s,e))return s}}}}function oo(t,e){return gl(t)&&e.includes(t.tokenType.name)}function tp(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}class yl extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function oi(t){throw new Error("Error! The input value was not handled.")}const Ki="AbstractRule",Vi="AbstractType",uo="Condition",np="TypeDefinition",co="ValueLiteral",Tl="AbstractElement";function rp(t){return F.isInstance(t,Tl)}const ip="ArrayLiteral",sp="ArrayType",vl="BooleanLiteral";function ap(t){return F.isInstance(t,vl)}const Al="Conjunction";function op(t){return F.isInstance(t,Al)}const El="Disjunction";function up(t){return F.isInstance(t,El)}const cp="Grammar",Rl="InferredType";function $l(t){return F.isInstance(t,Rl)}const Sl="Interface";function _l(t){return F.isInstance(t,Sl)}const Il="Negation";function lp(t){return F.isInstance(t,Il)}const fp="NumberLiteral",dp="Parameter",xl="ParameterReference";function hp(t){return F.isInstance(t,xl)}const Cl="ParserRule";function we(t){return F.isInstance(t,Cl)}const pp="ReferenceType",gp="ReturnType";function mp(t){return F.isInstance(t,gp)}const wl="SimpleType";function yp(t){return F.isInstance(t,wl)}const Tp="StringLiteral",gs="TerminalRule";function zt(t){return F.isInstance(t,gs)}const Nl="Type";function bl(t){return F.isInstance(t,Nl)}const vp="UnionType",kl="Action";function ui(t){return F.isInstance(t,kl)}const Ol="Alternatives";function Pl(t){return F.isInstance(t,Ol)}const Ll="Assignment";function Ft(t){return F.isInstance(t,Ll)}const Ml="CharacterRange";function Ap(t){return F.isInstance(t,Ml)}const Dl="CrossReference";function oa(t){return F.isInstance(t,Dl)}const Fl="EndOfFile";function Ep(t){return F.isInstance(t,Fl)}const Gl="Group";function ua(t){return F.isInstance(t,Gl)}const Ul="Keyword";function Gt(t){return F.isInstance(t,Ul)}const Bl="NegatedToken";function Rp(t){return F.isInstance(t,Bl)}const jl="RegexToken";function $p(t){return F.isInstance(t,jl)}const Hl="RuleCall";function Ut(t){return F.isInstance(t,Hl)}const Wl="TerminalAlternatives";function Sp(t){return F.isInstance(t,Wl)}const zl="TerminalGroup";function _p(t){return F.isInstance(t,zl)}const Kl="TerminalRuleCall";function Ip(t){return F.isInstance(t,Kl)}const Vl="UnorderedGroup";function ql(t){return F.isInstance(t,Vl)}const Yl="UntilToken";function xp(t){return F.isInstance(t,Yl)}const Xl="Wildcard";function Cp(t){return F.isInstance(t,Xl)}class Jl extends pl{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","ArrayLiteral","ArrayType","Assignment","BooleanLiteral","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","EndOfFile","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","NamedArgument","NegatedToken","Negation","NumberLiteral","Parameter","ParameterReference","ParserRule","ReferenceType","RegexToken","ReturnType","RuleCall","SimpleType","StringLiteral","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","TypeDefinition","UnionType","UnorderedGroup","UntilToken","ValueLiteral","Wildcard"]}computeIsSubtype(e,n){switch(e){case kl:case Ol:case Ll:case Ml:case Dl:case Fl:case Gl:case Ul:case Bl:case jl:case Hl:case Wl:case zl:case Kl:case Vl:case Yl:case Xl:return this.isSubtype(Tl,n);case ip:case fp:case Tp:return this.isSubtype(co,n);case sp:case pp:case wl:case vp:return this.isSubtype(np,n);case vl:return this.isSubtype(uo,n)||this.isSubtype(co,n);case Al:case El:case Il:case xl:return this.isSubtype(uo,n);case Rl:case Sl:case Nl:return this.isSubtype(Vi,n);case Cl:return this.isSubtype(Ki,n)||this.isSubtype(Vi,n);case gs:return this.isSubtype(Ki,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return Vi;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Ki;case"Grammar:usedGrammars":return cp;case"NamedArgument:parameter":case"ParameterReference:parameter":return dp;case"TerminalRuleCall:rule":return gs;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"AbstractElement":return{name:"AbstractElement",properties:[{name:"cardinality"},{name:"lookahead"}]};case"ArrayLiteral":return{name:"ArrayLiteral",properties:[{name:"elements",defaultValue:[]}]};case"ArrayType":return{name:"ArrayType",properties:[{name:"elementType"}]};case"BooleanLiteral":return{name:"BooleanLiteral",properties:[{name:"true",defaultValue:!1}]};case"Conjunction":return{name:"Conjunction",properties:[{name:"left"},{name:"right"}]};case"Disjunction":return{name:"Disjunction",properties:[{name:"left"},{name:"right"}]};case"Grammar":return{name:"Grammar",properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case"GrammarImport":return{name:"GrammarImport",properties:[{name:"path"}]};case"InferredType":return{name:"InferredType",properties:[{name:"name"}]};case"Interface":return{name:"Interface",properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case"NamedArgument":return{name:"NamedArgument",properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case"Negation":return{name:"Negation",properties:[{name:"value"}]};case"NumberLiteral":return{name:"NumberLiteral",properties:[{name:"value"}]};case"Parameter":return{name:"Parameter",properties:[{name:"name"}]};case"ParameterReference":return{name:"ParameterReference",properties:[{name:"parameter"}]};case"ParserRule":return{name:"ParserRule",properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case"ReferenceType":return{name:"ReferenceType",properties:[{name:"referenceType"}]};case"ReturnType":return{name:"ReturnType",properties:[{name:"name"}]};case"SimpleType":return{name:"SimpleType",properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case"StringLiteral":return{name:"StringLiteral",properties:[{name:"value"}]};case"TerminalRule":return{name:"TerminalRule",properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case"Type":return{name:"Type",properties:[{name:"name"},{name:"type"}]};case"TypeAttribute":return{name:"TypeAttribute",properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case"UnionType":return{name:"UnionType",properties:[{name:"types",defaultValue:[]}]};case"Action":return{name:"Action",properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case"Alternatives":return{name:"Alternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"Assignment":return{name:"Assignment",properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case"CharacterRange":return{name:"CharacterRange",properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case"CrossReference":return{name:"CrossReference",properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case"EndOfFile":return{name:"EndOfFile",properties:[{name:"cardinality"},{name:"lookahead"}]};case"Group":return{name:"Group",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case"Keyword":return{name:"Keyword",properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case"NegatedToken":return{name:"NegatedToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"RegexToken":return{name:"RegexToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case"RuleCall":return{name:"RuleCall",properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalGroup":return{name:"TerminalGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalRuleCall":return{name:"TerminalRuleCall",properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"UnorderedGroup":return{name:"UnorderedGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"UntilToken":return{name:"UntilToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"Wildcard":return{name:"Wildcard",properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const F=new Jl;function wp(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{ce(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):ce(n)&&(n.$container=t,n.$containerProperty=e))}function ci(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function qe(t){const n=Np(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Np(t){for(;t.$container;)t=t.$container;return t}function ca(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e==null?void 0:e.range;return new oe(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(ce(s)){if(r.keyIndex++,lo(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const a=r.arrayIndex++,o=s[a];if(ce(o)&&lo(o,n))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return Ie})}function ir(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new aa(t,n=>ca(n,e))}function nn(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new aa(t,n=>ca(n,e),{includeRoot:!0})}function lo(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?Qh(r,e):!1}function Ql(t){return new oe(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const n=e.keys[e.keyIndex];if(!n.startsWith("$")){const r=t[n];if(ze(r))return e.keyIndex++,{done:!1,value:{reference:r,container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(ze(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Ie})}function bp(t,e){const n=t.getTypeMetaData(e.$type),r=e;for(const i of n.properties)i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=Zl(i.defaultValue))}function Zl(t){return Array.isArray(t)?[...t.map(Zl)]:t}function w(t){return t.charCodeAt(0)}function qi(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function In(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function en(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function kp(){throw Error("Internal Error - Should never get here!")}function fo(t){return t.type==="Character"}const Or=[];for(let t=w("0");t<=w("9");t++)Or.push(t);const Pr=[w("_")].concat(Or);for(let t=w("a");t<=w("z");t++)Pr.push(t);for(let t=w("A");t<=w("Z");t++)Pr.push(t);const ho=[w(" "),w("\f"),w(`
|
|
2
|
+
`),w("\r"),w(" "),w("\v"),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w(" "),w("\u2028"),w("\u2029"),w(" "),w(" "),w(" "),w("\uFEFF")],Op=/[0-9a-fA-F]/,Tr=/[0-9]/,Pp=/[1-9]/;class ef{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":In(r,"global");break;case"i":In(r,"ignoreCase");break;case"m":In(r,"multiLine");break;case"u":In(r,"unicode");break;case"y":In(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break}en(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return kp()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;en(n);break}if(!(e===!0&&n===void 0)&&en(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),en(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[w(`
|
|
3
|
+
`),w("\r"),w("\u2028"),w("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,n=!1;switch(this.popChar()){case"d":e=Or;break;case"D":e=Or,n=!0;break;case"s":e=ho;break;case"S":e=ho,n=!0;break;case"w":e=Pr;break;case"W":e=Pr,n=!0;break}if(en(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=w("\f");break;case"n":e=w(`
|
|
4
|
+
`);break;case"r":e=w("\r");break;case"t":e=w(" ");break;case"v":e=w("\v");break}if(en(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:w("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:w(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
5
|
+
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:w(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,fo(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,fo(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else qi(r.value,e),e.push(w("-")),qi(i.value,e)}else qi(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|
6
|
+
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:w("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(Pp.test(e)===!1)throw Error("Expecting a positive integer");for(;Tr.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Tr.test(e)===!1)throw Error("Expecting an integer");for(;Tr.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
|
|
7
|
+
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:w(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Tr.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
|
8
|
+
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
|
9
|
+
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let n="";for(let i=0;i<e;i++){const s=this.popChar();if(Op.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class li{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const Lp=/\r?\n/gm,Mp=new ef;class Dp extends li{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n===`
|
|
10
|
+
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=fi(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!!`
|
|
11
|
+
`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Yi=new Dp;function Fp(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Yi.reset(t),Yi.visit(Mp.pattern(t)),Yi.multiline}catch{return!1}}function po(t){return(typeof t=="string"?new RegExp(t):t).test(" ")}function fi(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gp(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:fi(e)).join("")}function Up(t,e){const n=Bp(t),r=e.match(n);return!!r&&r[0].length>0}function Bp(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",a;function o(c){s+=n.substr(r,c),r+=c}function u(c){s+="(?:"+n.substr(r,c)+"|$)",r+=c}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":u(3);break;case"x":u(4);break;case"u":e.unicode?n[r+2]==="{"?u(n.indexOf("}",r)-r+1):u(6):u(2);break;case"p":case"P":e.unicode?u(n.indexOf("}",r)-r+1):u(2);break;case"k":u(n.indexOf(">",r)-r+1);break;default:u(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],u(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):u(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=n.substr(a,r-a);break;case"<":switch(n[r+3]){case"=":case"!":a=r,r+=4,i(),s+=n.substr(a,r-a);break;default:o(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++r,s;default:u(1);break}return s}return new RegExp(i(),t.flags)}function jp(t){return t.rules.find(e=>we(e)&&e.entry)}function Hp(t){return t.rules.filter(e=>zt(e)&&e.hidden)}function tf(t,e){const n=new Set,r=jp(t);if(!r)return new Set(t.rules);const i=[r].concat(Hp(t));for(const a of i)nf(a,n,e);const s=new Set;for(const a of t.rules)(n.has(a.name)||zt(a)&&a.hidden)&&s.add(a);return s}function nf(t,e,n){e.add(t.name),ir(t).forEach(r=>{if(Ut(r)||n){const i=r.rule.ref;i&&!e.has(i.name)&&nf(i,e,n)}})}function Wp(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=sf(t.type.ref);return e==null?void 0:e.terminal}}function zp(t){return t.hidden&&!da(t).test(" ")}function Kp(t,e){return!t||!e?[]:la(t,e,t.astNode,!0)}function rf(t,e,n){if(!t||!e)return;const r=la(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function la(t,e,n,r){if(!r){const i=ci(t.grammarSource,Ft);if(i&&i.feature===e)return[t]}return an(t)&&t.astNode===n?t.content.flatMap(i=>la(i,e,n,!1)):[]}function Vp(t,e,n){if(!t)return;const r=qp(t,e,t==null?void 0:t.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function qp(t,e,n){if(t.astNode!==n)return[];if(Gt(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=hs(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===n?Gt(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function Yp(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=ci(t.grammarSource,Ft);if(r)return r;t=t.container}}function sf(t){let e=t;return $l(e)&&(ui(e.$container)?e=e.$container.$container:we(e.$container)?e=e.$container:oi(e.$container)),af(t,e,new Map)}function af(t,e,n){var r;function i(s,a){let o;return ci(s,Ft)||(o=af(a,a,n)),n.set(t,o),o}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of ir(e)){if(Ft(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Ut(s)&&we(s.rule.ref))return i(s,s.rule.ref);if(yp(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function fa(t){return of(t,new Set)}function of(t,e){if(e.has(t))return!0;e.add(t);for(const n of ir(t))if(Ut(n)){if(!n.rule.ref||we(n.rule.ref)&&!of(n.rule.ref,e))return!1}else{if(Ft(n))return!1;if(ui(n))return!1}return!!t.definition}function uf(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e){if(we(e))return e.name;if(_l(e)||bl(e))return e.name}}}function di(t){var e;if(we(t))return fa(t)?t.name:(e=uf(t))!==null&&e!==void 0?e:t.name;if(_l(t)||bl(t)||mp(t))return t.name;if(ui(t)){const n=Xp(t);if(n)return n}else if($l(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function Xp(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return di(t.type.ref)}function Jp(t){var e,n,r;return zt(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":fa(t)?t.name:(r=uf(t))!==null&&r!==void 0?r:t.name}function da(t){const e={s:!1,i:!1,u:!1},n=yn(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const ha=/[\s\S]/.source;function yn(t,e){if(Sp(t))return Qp(t);if(_p(t))return Zp(t);if(Ap(t))return ng(t);if(Ip(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return at(yn(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(Rp(t))return tg(t);if(xp(t))return eg(t);if($p(t)){const n=t.regex.lastIndexOf("/"),r=t.regex.substring(1,n),i=t.regex.substring(n+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),at(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(Cp(t))return at(ha,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t==null?void 0:t.$type}`)}}}function Qp(t){return at(t.elements.map(e=>yn(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function Zp(t){return at(t.elements.map(e=>yn(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function eg(t){return at(`${ha}*?${yn(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function tg(t){return at(`(?!${yn(t.terminal)})${ha}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function ng(t){return t.right?at(`[${Xi(t.left)}-${Xi(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):at(Xi(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function Xi(t){return fi(t.value)}function at(t,e){var n;return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}function rg(t){const e=[],n=t.Grammar;for(const r of n.rules)zt(r)&&zp(r)&&Fp(da(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:Zh}}var cf=typeof global=="object"&&global&&global.Object===Object&&global,ig=typeof self=="object"&&self&&self.Object===Object&&self,Ye=cf||ig||Function("return this")(),Ne=Ye.Symbol,lf=Object.prototype,sg=lf.hasOwnProperty,ag=lf.toString,xn=Ne?Ne.toStringTag:void 0;function og(t){var e=sg.call(t,xn),n=t[xn];try{t[xn]=void 0;var r=!0}catch{}var i=ag.call(t);return r&&(e?t[xn]=n:delete t[xn]),i}var ug=Object.prototype,cg=ug.toString;function lg(t){return cg.call(t)}var fg="[object Null]",dg="[object Undefined]",go=Ne?Ne.toStringTag:void 0;function Nt(t){return t==null?t===void 0?dg:fg:go&&go in Object(t)?og(t):lg(t)}function Ge(t){return t!=null&&typeof t=="object"}var hg="[object Symbol]";function hi(t){return typeof t=="symbol"||Ge(t)&&Nt(t)==hg}function pi(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var M=Array.isArray,mo=Ne?Ne.prototype:void 0,yo=mo?mo.toString:void 0;function ff(t){if(typeof t=="string")return t;if(M(t))return pi(t,ff)+"";if(hi(t))return yo?yo.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var pg=/\s/;function gg(t){for(var e=t.length;e--&&pg.test(t.charAt(e)););return e}var mg=/^\s+/;function yg(t){return t&&t.slice(0,gg(t)+1).replace(mg,"")}function be(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var To=NaN,Tg=/^[-+]0x[0-9a-f]+$/i,vg=/^0b[01]+$/i,Ag=/^0o[0-7]+$/i,Eg=parseInt;function Rg(t){if(typeof t=="number")return t;if(hi(t))return To;if(be(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=be(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=yg(t);var n=vg.test(t);return n||Ag.test(t)?Eg(t.slice(2),n?2:8):Tg.test(t)?To:+t}var vo=1/0,$g=17976931348623157e292;function Sg(t){if(!t)return t===0?t:0;if(t=Rg(t),t===vo||t===-vo){var e=t<0?-1:1;return e*$g}return t===t?t:0}function gi(t){var e=Sg(t),n=e%1;return e===e?n?e-n:e:0}function on(t){return t}var _g="[object AsyncFunction]",Ig="[object Function]",xg="[object GeneratorFunction]",Cg="[object Proxy]";function ft(t){if(!be(t))return!1;var e=Nt(t);return e==Ig||e==xg||e==_g||e==Cg}var Ji=Ye["__core-js_shared__"],Ao=function(){var t=/[^.]+$/.exec(Ji&&Ji.keys&&Ji.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function wg(t){return!!Ao&&Ao in t}var Ng=Function.prototype,bg=Ng.toString;function Kt(t){if(t!=null){try{return bg.call(t)}catch{}try{return t+""}catch{}}return""}var kg=/[\\^$.*+?()[\]{}|]/g,Og=/^\[object .+?Constructor\]$/,Pg=Function.prototype,Lg=Object.prototype,Mg=Pg.toString,Dg=Lg.hasOwnProperty,Fg=RegExp("^"+Mg.call(Dg).replace(kg,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Gg(t){if(!be(t)||wg(t))return!1;var e=ft(t)?Fg:Og;return e.test(Kt(t))}function Ug(t,e){return t==null?void 0:t[e]}function Vt(t,e){var n=Ug(t,e);return Gg(n)?n:void 0}var ms=Vt(Ye,"WeakMap"),Eo=Object.create,Bg=function(){function t(){}return function(e){if(!be(e))return{};if(Eo)return Eo(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function jg(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function X(){}function Hg(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var Wg=800,zg=16,Kg=Date.now;function Vg(t){var e=0,n=0;return function(){var r=Kg(),i=zg-(r-n);if(n=r,i>0){if(++e>=Wg)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function qg(t){return function(){return t}}var Lr=function(){try{var t=Vt(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Yg=Lr?function(t,e){return Lr(t,"toString",{configurable:!0,enumerable:!1,value:qg(e),writable:!0})}:on,Xg=Vg(Yg);function df(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function hf(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function Jg(t){return t!==t}function Qg(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function pa(t,e,n){return e===e?Qg(t,e,n):hf(t,Jg,n)}function pf(t,e){var n=t==null?0:t.length;return!!n&&pa(t,e,0)>-1}var Zg=9007199254740991,em=/^(?:0|[1-9]\d*)$/;function mi(t,e){var n=typeof t;return e=e??Zg,!!e&&(n=="number"||n!="symbol"&&em.test(t))&&t>-1&&t%1==0&&t<e}function ga(t,e,n){e=="__proto__"&&Lr?Lr(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function sr(t,e){return t===e||t!==t&&e!==e}var tm=Object.prototype,nm=tm.hasOwnProperty;function yi(t,e,n){var r=t[e];(!(nm.call(t,e)&&sr(r,n))||n===void 0&&!(e in t))&&ga(t,e,n)}function ma(t,e,n,r){var i=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var o=e[s],u=void 0;u===void 0&&(u=t[o]),i?ga(n,o,u):yi(n,o,u)}return n}var Ro=Math.max;function rm(t,e,n){return e=Ro(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=Ro(r.length-e,0),a=Array(s);++i<s;)a[i]=r[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=r[i];return o[e]=n(a),jg(t,this,o)}}function ya(t,e){return Xg(rm(t,e,on),t+"")}var im=9007199254740991;function Ta(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=im}function Xe(t){return t!=null&&Ta(t.length)&&!ft(t)}function gf(t,e,n){if(!be(n))return!1;var r=typeof e;return(r=="number"?Xe(n)&&mi(e,n.length):r=="string"&&e in n)?sr(n[e],t):!1}function sm(t){return ya(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,a&&gf(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,s)}return e})}var am=Object.prototype;function ar(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||am;return t===n}function om(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var um="[object Arguments]";function $o(t){return Ge(t)&&Nt(t)==um}var mf=Object.prototype,cm=mf.hasOwnProperty,lm=mf.propertyIsEnumerable,Ti=$o(function(){return arguments}())?$o:function(t){return Ge(t)&&cm.call(t,"callee")&&!lm.call(t,"callee")};function fm(){return!1}var yf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,So=yf&&typeof module=="object"&&module&&!module.nodeType&&module,dm=So&&So.exports===yf,_o=dm?Ye.Buffer:void 0,hm=_o?_o.isBuffer:void 0,Mn=hm||fm,pm="[object Arguments]",gm="[object Array]",mm="[object Boolean]",ym="[object Date]",Tm="[object Error]",vm="[object Function]",Am="[object Map]",Em="[object Number]",Rm="[object Object]",$m="[object RegExp]",Sm="[object Set]",_m="[object String]",Im="[object WeakMap]",xm="[object ArrayBuffer]",Cm="[object DataView]",wm="[object Float32Array]",Nm="[object Float64Array]",bm="[object Int8Array]",km="[object Int16Array]",Om="[object Int32Array]",Pm="[object Uint8Array]",Lm="[object Uint8ClampedArray]",Mm="[object Uint16Array]",Dm="[object Uint32Array]",B={};B[wm]=B[Nm]=B[bm]=B[km]=B[Om]=B[Pm]=B[Lm]=B[Mm]=B[Dm]=!0;B[pm]=B[gm]=B[xm]=B[mm]=B[Cm]=B[ym]=B[Tm]=B[vm]=B[Am]=B[Em]=B[Rm]=B[$m]=B[Sm]=B[_m]=B[Im]=!1;function Fm(t){return Ge(t)&&Ta(t.length)&&!!B[Nt(t)]}function vi(t){return function(e){return t(e)}}var Tf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pn=Tf&&typeof module=="object"&&module&&!module.nodeType&&module,Gm=Pn&&Pn.exports===Tf,Qi=Gm&&cf.process,Rt=function(){try{var t=Pn&&Pn.require&&Pn.require("util").types;return t||Qi&&Qi.binding&&Qi.binding("util")}catch{}}(),Io=Rt&&Rt.isTypedArray,va=Io?vi(Io):Fm,Um=Object.prototype,Bm=Um.hasOwnProperty;function vf(t,e){var n=M(t),r=!n&&Ti(t),i=!n&&!r&&Mn(t),s=!n&&!r&&!i&&va(t),a=n||r||i||s,o=a?om(t.length,String):[],u=o.length;for(var c in t)(e||Bm.call(t,c))&&!(a&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||mi(c,u)))&&o.push(c);return o}function Af(t,e){return function(n){return t(e(n))}}var jm=Af(Object.keys,Object),Hm=Object.prototype,Wm=Hm.hasOwnProperty;function Ef(t){if(!ar(t))return jm(t);var e=[];for(var n in Object(t))Wm.call(t,n)&&n!="constructor"&&e.push(n);return e}function ke(t){return Xe(t)?vf(t):Ef(t)}var zm=Object.prototype,Km=zm.hasOwnProperty,ys=sm(function(t,e){if(ar(e)||Xe(e)){ma(e,ke(e),t);return}for(var n in e)Km.call(e,n)&&yi(t,n,e[n])});function Vm(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var qm=Object.prototype,Ym=qm.hasOwnProperty;function Xm(t){if(!be(t))return Vm(t);var e=ar(t),n=[];for(var r in t)r=="constructor"&&(e||!Ym.call(t,r))||n.push(r);return n}function Rf(t){return Xe(t)?vf(t,!0):Xm(t)}var Jm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Qm=/^\w*$/;function Aa(t,e){if(M(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||hi(t)?!0:Qm.test(t)||!Jm.test(t)||e!=null&&t in Object(e)}var Dn=Vt(Object,"create");function Zm(){this.__data__=Dn?Dn(null):{},this.size=0}function ey(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ty="__lodash_hash_undefined__",ny=Object.prototype,ry=ny.hasOwnProperty;function iy(t){var e=this.__data__;if(Dn){var n=e[t];return n===ty?void 0:n}return ry.call(e,t)?e[t]:void 0}var sy=Object.prototype,ay=sy.hasOwnProperty;function oy(t){var e=this.__data__;return Dn?e[t]!==void 0:ay.call(e,t)}var uy="__lodash_hash_undefined__";function cy(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Dn&&e===void 0?uy:e,this}function Bt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Bt.prototype.clear=Zm;Bt.prototype.delete=ey;Bt.prototype.get=iy;Bt.prototype.has=oy;Bt.prototype.set=cy;function ly(){this.__data__=[],this.size=0}function Ai(t,e){for(var n=t.length;n--;)if(sr(t[n][0],e))return n;return-1}var fy=Array.prototype,dy=fy.splice;function hy(t){var e=this.__data__,n=Ai(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():dy.call(e,n,1),--this.size,!0}function py(t){var e=this.__data__,n=Ai(e,t);return n<0?void 0:e[n][1]}function gy(t){return Ai(this.__data__,t)>-1}function my(t,e){var n=this.__data__,r=Ai(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function dt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}dt.prototype.clear=ly;dt.prototype.delete=hy;dt.prototype.get=py;dt.prototype.has=gy;dt.prototype.set=my;var Fn=Vt(Ye,"Map");function yy(){this.size=0,this.__data__={hash:new Bt,map:new(Fn||dt),string:new Bt}}function Ty(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Ei(t,e){var n=t.__data__;return Ty(e)?n[typeof e=="string"?"string":"hash"]:n.map}function vy(t){var e=Ei(this,t).delete(t);return this.size-=e?1:0,e}function Ay(t){return Ei(this,t).get(t)}function Ey(t){return Ei(this,t).has(t)}function Ry(t,e){var n=Ei(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function ht(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ht.prototype.clear=yy;ht.prototype.delete=vy;ht.prototype.get=Ay;ht.prototype.has=Ey;ht.prototype.set=Ry;var $y="Expected a function";function Ea(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError($y);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var a=t.apply(this,r);return n.cache=s.set(i,a)||s,a};return n.cache=new(Ea.Cache||ht),n}Ea.Cache=ht;var Sy=500;function _y(t){var e=Ea(t,function(r){return n.size===Sy&&n.clear(),r}),n=e.cache;return e}var Iy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xy=/\\(\\)?/g,Cy=_y(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Iy,function(n,r,i,s){e.push(i?s.replace(xy,"$1"):r||n)}),e});function wy(t){return t==null?"":ff(t)}function Ri(t,e){return M(t)?t:Aa(t,e)?[t]:Cy(wy(t))}function or(t){if(typeof t=="string"||hi(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Ra(t,e){e=Ri(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[or(e[n++])];return n&&n==r?t:void 0}function Ny(t,e,n){var r=t==null?void 0:Ra(t,e);return r===void 0?n:r}function $a(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var xo=Ne?Ne.isConcatSpreadable:void 0;function by(t){return M(t)||Ti(t)||!!(xo&&t&&t[xo])}function Sa(t,e,n,r,i){var s=-1,a=t.length;for(n||(n=by),i||(i=[]);++s<a;){var o=t[s];n(o)?$a(i,o):r||(i[i.length]=o)}return i}function De(t){var e=t==null?0:t.length;return e?Sa(t):[]}var $f=Af(Object.getPrototypeOf,Object);function Sf(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function ky(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function Oy(){this.__data__=new dt,this.size=0}function Py(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function Ly(t){return this.__data__.get(t)}function My(t){return this.__data__.has(t)}var Dy=200;function Fy(t,e){var n=this.__data__;if(n instanceof dt){var r=n.__data__;if(!Fn||r.length<Dy-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ht(r)}return n.set(t,e),this.size=n.size,this}function Ke(t){var e=this.__data__=new dt(t);this.size=e.size}Ke.prototype.clear=Oy;Ke.prototype.delete=Py;Ke.prototype.get=Ly;Ke.prototype.has=My;Ke.prototype.set=Fy;function Gy(t,e){return t&&ma(e,ke(e),t)}var _f=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Co=_f&&typeof module=="object"&&module&&!module.nodeType&&module,Uy=Co&&Co.exports===_f,wo=Uy?Ye.Buffer:void 0,No=wo?wo.allocUnsafe:void 0;function By(t,e){var n=t.length,r=No?No(n):new t.constructor(n);return t.copy(r),r}function _a(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var a=t[n];e(a,n,t)&&(s[i++]=a)}return s}function If(){return[]}var jy=Object.prototype,Hy=jy.propertyIsEnumerable,bo=Object.getOwnPropertySymbols,Ia=bo?function(t){return t==null?[]:(t=Object(t),_a(bo(t),function(e){return Hy.call(t,e)}))}:If;function Wy(t,e){return ma(t,Ia(t),e)}var zy=Object.getOwnPropertySymbols,Ky=zy?function(t){for(var e=[];t;)$a(e,Ia(t)),t=$f(t);return e}:If;function xf(t,e,n){var r=e(t);return M(t)?r:$a(r,n(t))}function Ts(t){return xf(t,ke,Ia)}function Vy(t){return xf(t,Rf,Ky)}var vs=Vt(Ye,"DataView"),As=Vt(Ye,"Promise"),rn=Vt(Ye,"Set"),ko="[object Map]",qy="[object Object]",Oo="[object Promise]",Po="[object Set]",Lo="[object WeakMap]",Mo="[object DataView]",Yy=Kt(vs),Xy=Kt(Fn),Jy=Kt(As),Qy=Kt(rn),Zy=Kt(ms),xe=Nt;(vs&&xe(new vs(new ArrayBuffer(1)))!=Mo||Fn&&xe(new Fn)!=ko||As&&xe(As.resolve())!=Oo||rn&&xe(new rn)!=Po||ms&&xe(new ms)!=Lo)&&(xe=function(t){var e=Nt(t),n=e==qy?t.constructor:void 0,r=n?Kt(n):"";if(r)switch(r){case Yy:return Mo;case Xy:return ko;case Jy:return Oo;case Qy:return Po;case Zy:return Lo}return e});var eT=Object.prototype,tT=eT.hasOwnProperty;function nT(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&tT.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Mr=Ye.Uint8Array;function rT(t){var e=new t.constructor(t.byteLength);return new Mr(e).set(new Mr(t)),e}function iT(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var sT=/\w*$/;function aT(t){var e=new t.constructor(t.source,sT.exec(t));return e.lastIndex=t.lastIndex,e}var Do=Ne?Ne.prototype:void 0,Fo=Do?Do.valueOf:void 0;function oT(t){return Fo?Object(Fo.call(t)):{}}function uT(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var cT="[object Boolean]",lT="[object Date]",fT="[object Map]",dT="[object Number]",hT="[object RegExp]",pT="[object Set]",gT="[object String]",mT="[object Symbol]",yT="[object ArrayBuffer]",TT="[object DataView]",vT="[object Float32Array]",AT="[object Float64Array]",ET="[object Int8Array]",RT="[object Int16Array]",$T="[object Int32Array]",ST="[object Uint8Array]",_T="[object Uint8ClampedArray]",IT="[object Uint16Array]",xT="[object Uint32Array]";function CT(t,e,n){var r=t.constructor;switch(e){case yT:return rT(t);case cT:case lT:return new r(+t);case TT:return iT(t);case vT:case AT:case ET:case RT:case $T:case ST:case _T:case IT:case xT:return uT(t);case fT:return new r;case dT:case gT:return new r(t);case hT:return aT(t);case pT:return new r;case mT:return oT(t)}}function wT(t){return typeof t.constructor=="function"&&!ar(t)?Bg($f(t)):{}}var NT="[object Map]";function bT(t){return Ge(t)&&xe(t)==NT}var Go=Rt&&Rt.isMap,kT=Go?vi(Go):bT,OT="[object Set]";function PT(t){return Ge(t)&&xe(t)==OT}var Uo=Rt&&Rt.isSet,LT=Uo?vi(Uo):PT,Cf="[object Arguments]",MT="[object Array]",DT="[object Boolean]",FT="[object Date]",GT="[object Error]",wf="[object Function]",UT="[object GeneratorFunction]",BT="[object Map]",jT="[object Number]",Nf="[object Object]",HT="[object RegExp]",WT="[object Set]",zT="[object String]",KT="[object Symbol]",VT="[object WeakMap]",qT="[object ArrayBuffer]",YT="[object DataView]",XT="[object Float32Array]",JT="[object Float64Array]",QT="[object Int8Array]",ZT="[object Int16Array]",ev="[object Int32Array]",tv="[object Uint8Array]",nv="[object Uint8ClampedArray]",rv="[object Uint16Array]",iv="[object Uint32Array]",G={};G[Cf]=G[MT]=G[qT]=G[YT]=G[DT]=G[FT]=G[XT]=G[JT]=G[QT]=G[ZT]=G[ev]=G[BT]=G[jT]=G[Nf]=G[HT]=G[WT]=G[zT]=G[KT]=G[tv]=G[nv]=G[rv]=G[iv]=!0;G[GT]=G[wf]=G[VT]=!1;function _r(t,e,n,r,i,s){var a;if(a!==void 0)return a;if(!be(t))return t;var o=M(t);if(o)return a=nT(t),Hg(t,a);var u=xe(t),c=u==wf||u==UT;if(Mn(t))return By(t);if(u==Nf||u==Cf||c&&!i)return a=c?{}:wT(t),Wy(t,Gy(a,t));if(!G[u])return i?t:{};a=CT(t,u),s||(s=new Ke);var l=s.get(t);if(l)return l;s.set(t,a),LT(t)?t.forEach(function(h){a.add(_r(h,e,n,h,t,s))}):kT(t)&&t.forEach(function(h,g){a.set(g,_r(h,e,n,g,t,s))});var f=Ts,d=o?void 0:f(t);return df(d||t,function(h,g){d&&(g=h,h=t[g]),yi(a,g,_r(h,e,n,g,t,s))}),a}var sv=4;function ie(t){return _r(t,sv)}function ur(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}var av="__lodash_hash_undefined__";function ov(t){return this.__data__.set(t,av),this}function uv(t){return this.__data__.has(t)}function un(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new ht;++e<n;)this.add(t[e])}un.prototype.add=un.prototype.push=ov;un.prototype.has=uv;function bf(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function xa(t,e){return t.has(e)}var cv=1,lv=2;function kf(t,e,n,r,i,s){var a=n&cv,o=t.length,u=e.length;if(o!=u&&!(a&&u>o))return!1;var c=s.get(t),l=s.get(e);if(c&&l)return c==e&&l==t;var f=-1,d=!0,h=n&lv?new un:void 0;for(s.set(t,e),s.set(e,t);++f<o;){var g=t[f],m=e[f];if(r)var T=a?r(m,g,f,e,t,s):r(g,m,f,t,e,s);if(T!==void 0){if(T)continue;d=!1;break}if(h){if(!bf(e,function(y,E){if(!xa(h,E)&&(g===y||i(g,y,n,r,s)))return h.push(E)})){d=!1;break}}else if(!(g===m||i(g,m,n,r,s))){d=!1;break}}return s.delete(t),s.delete(e),d}function fv(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Ca(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var dv=1,hv=2,pv="[object Boolean]",gv="[object Date]",mv="[object Error]",yv="[object Map]",Tv="[object Number]",vv="[object RegExp]",Av="[object Set]",Ev="[object String]",Rv="[object Symbol]",$v="[object ArrayBuffer]",Sv="[object DataView]",Bo=Ne?Ne.prototype:void 0,Zi=Bo?Bo.valueOf:void 0;function _v(t,e,n,r,i,s,a){switch(n){case Sv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case $v:return!(t.byteLength!=e.byteLength||!s(new Mr(t),new Mr(e)));case pv:case gv:case Tv:return sr(+t,+e);case mv:return t.name==e.name&&t.message==e.message;case vv:case Ev:return t==e+"";case yv:var o=fv;case Av:var u=r&dv;if(o||(o=Ca),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=hv,a.set(t,e);var l=kf(o(t),o(e),r,i,s,a);return a.delete(t),l;case Rv:if(Zi)return Zi.call(t)==Zi.call(e)}return!1}var Iv=1,xv=Object.prototype,Cv=xv.hasOwnProperty;function wv(t,e,n,r,i,s){var a=n&Iv,o=Ts(t),u=o.length,c=Ts(e),l=c.length;if(u!=l&&!a)return!1;for(var f=u;f--;){var d=o[f];if(!(a?d in e:Cv.call(e,d)))return!1}var h=s.get(t),g=s.get(e);if(h&&g)return h==e&&g==t;var m=!0;s.set(t,e),s.set(e,t);for(var T=a;++f<u;){d=o[f];var y=t[d],E=e[d];if(r)var v=a?r(E,y,d,e,t,s):r(y,E,d,t,e,s);if(!(v===void 0?y===E||i(y,E,n,r,s):v)){m=!1;break}T||(T=d=="constructor")}if(m&&!T){var S=t.constructor,O=e.constructor;S!=O&&"constructor"in t&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof O=="function"&&O instanceof O)&&(m=!1)}return s.delete(t),s.delete(e),m}var Nv=1,jo="[object Arguments]",Ho="[object Array]",vr="[object Object]",bv=Object.prototype,Wo=bv.hasOwnProperty;function kv(t,e,n,r,i,s){var a=M(t),o=M(e),u=a?Ho:xe(t),c=o?Ho:xe(e);u=u==jo?vr:u,c=c==jo?vr:c;var l=u==vr,f=c==vr,d=u==c;if(d&&Mn(t)){if(!Mn(e))return!1;a=!0,l=!1}if(d&&!l)return s||(s=new Ke),a||va(t)?kf(t,e,n,r,i,s):_v(t,e,u,n,r,i,s);if(!(n&Nv)){var h=l&&Wo.call(t,"__wrapped__"),g=f&&Wo.call(e,"__wrapped__");if(h||g){var m=h?t.value():t,T=g?e.value():e;return s||(s=new Ke),i(m,T,n,r,s)}}return d?(s||(s=new Ke),wv(t,e,n,r,i,s)):!1}function wa(t,e,n,r,i){return t===e?!0:t==null||e==null||!Ge(t)&&!Ge(e)?t!==t&&e!==e:kv(t,e,n,r,wa,i)}var Ov=1,Pv=2;function Lv(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var a=n[i];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=n[i];var o=a[0],u=t[o],c=a[1];if(a[2]){if(u===void 0&&!(o in t))return!1}else{var l=new Ke,f;if(!(f===void 0?wa(c,u,Ov|Pv,r,l):f))return!1}}return!0}function Of(t){return t===t&&!be(t)}function Mv(t){for(var e=ke(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Of(i)]}return e}function Pf(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function Dv(t){var e=Mv(t);return e.length==1&&e[0][2]?Pf(e[0][0],e[0][1]):function(n){return n===t||Lv(n,t,e)}}function Fv(t,e){return t!=null&&e in Object(t)}function Lf(t,e,n){e=Ri(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var a=or(e[r]);if(!(s=t!=null&&n(t,a)))break;t=t[a]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&Ta(i)&&mi(a,i)&&(M(t)||Ti(t)))}function Gv(t,e){return t!=null&&Lf(t,e,Fv)}var Uv=1,Bv=2;function jv(t,e){return Aa(t)&&Of(e)?Pf(or(t),e):function(n){var r=Ny(n,t);return r===void 0&&r===e?Gv(n,t):wa(e,r,Uv|Bv)}}function Hv(t){return function(e){return e==null?void 0:e[t]}}function Wv(t){return function(e){return Ra(e,t)}}function zv(t){return Aa(t)?Hv(or(t)):Wv(t)}function Je(t){return typeof t=="function"?t:t==null?on:typeof t=="object"?M(t)?jv(t[0],t[1]):Dv(t):zv(t)}function Kv(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var a=t[i];e(r,a,n(a),t)}return r}function Vv(t){return function(e,n,r){for(var i=-1,s=Object(e),a=r(e),o=a.length;o--;){var u=a[++i];if(n(s[u],u,s)===!1)break}return e}}var qv=Vv();function Yv(t,e){return t&&qv(t,e,ke)}function Xv(t,e){return function(n,r){if(n==null)return n;if(!Xe(n))return t(n,r);for(var i=n.length,s=-1,a=Object(n);++s<i&&r(a[s],s,a)!==!1;);return n}}var qt=Xv(Yv);function Jv(t,e,n,r){return qt(t,function(i,s,a){e(r,i,n(i),a)}),r}function Qv(t,e){return function(n,r){var i=M(n)?Kv:Jv,s=e?e():{};return i(n,t,Je(r),s)}}var Mf=Object.prototype,Zv=Mf.hasOwnProperty,Na=ya(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&gf(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],a=Rf(s),o=-1,u=a.length;++o<u;){var c=a[o],l=t[c];(l===void 0||sr(l,Mf[c])&&!Zv.call(t,c))&&(t[c]=s[c])}return t});function zo(t){return Ge(t)&&Xe(t)}var eA=200;function tA(t,e,n,r){var i=-1,s=pf,a=!0,o=t.length,u=[],c=e.length;if(!o)return u;e.length>=eA&&(s=xa,a=!1,e=new un(e));e:for(;++i<o;){var l=t[i],f=l;if(l=l!==0?l:0,a&&f===f){for(var d=c;d--;)if(e[d]===f)continue e;u.push(l)}else s(e,f,r)||u.push(l)}return u}var $i=ya(function(t,e){return zo(t)?tA(t,Sa(e,1,zo,!0)):[]});function cn(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function te(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:gi(e),Sf(t,e<0?0:e,r)):[]}function Gn(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:gi(e),e=r-e,Sf(t,0,e<0?0:e)):[]}function nA(t){return typeof t=="function"?t:on}function N(t,e){var n=M(t)?df:qt;return n(t,nA(e))}function rA(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function iA(t,e){var n=!0;return qt(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Ve(t,e,n){var r=M(t)?rA:iA;return r(t,Je(e))}function Df(t,e){var n=[];return qt(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function Pe(t,e){var n=M(t)?_a:Df;return n(t,Je(e))}function sA(t){return function(e,n,r){var i=Object(e);if(!Xe(e)){var s=Je(n);e=ke(e),n=function(o){return s(i[o],o,i)}}var a=t(e,n,r);return a>-1?i[s?e[a]:a]:void 0}}var aA=Math.max;function oA(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:gi(n);return i<0&&(i=aA(r+i,0)),hf(t,Je(e),i)}var ln=sA(oA);function Ue(t){return t&&t.length?t[0]:void 0}function uA(t,e){var n=-1,r=Xe(t)?Array(t.length):[];return qt(t,function(i,s,a){r[++n]=e(i,s,a)}),r}function x(t,e){var n=M(t)?pi:uA;return n(t,Je(e))}function Ce(t,e){return Sa(x(t,e))}var cA=Object.prototype,lA=cA.hasOwnProperty,fA=Qv(function(t,e,n){lA.call(t,n)?t[n].push(e):ga(t,n,[e])}),dA=Object.prototype,hA=dA.hasOwnProperty;function pA(t,e){return t!=null&&hA.call(t,e)}function C(t,e){return t!=null&&Lf(t,e,pA)}var gA="[object String]";function Be(t){return typeof t=="string"||!M(t)&&Ge(t)&&Nt(t)==gA}function mA(t,e){return pi(e,function(n){return t[n]})}function J(t){return t==null?[]:mA(t,ke(t))}var yA=Math.max;function ge(t,e,n,r){t=Xe(t)?t:J(t),n=n?gi(n):0;var i=t.length;return n<0&&(n=yA(i+n,0)),Be(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&pa(t,e,n)>-1}function Ko(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return pa(t,e,i)}var TA="[object Map]",vA="[object Set]",AA=Object.prototype,EA=AA.hasOwnProperty;function U(t){if(t==null)return!0;if(Xe(t)&&(M(t)||typeof t=="string"||typeof t.splice=="function"||Mn(t)||va(t)||Ti(t)))return!t.length;var e=xe(t);if(e==TA||e==vA)return!t.size;if(ar(t))return!Ef(t).length;for(var n in t)if(EA.call(t,n))return!1;return!0}var RA="[object RegExp]";function $A(t){return Ge(t)&&Nt(t)==RA}var Vo=Rt&&Rt.isRegExp,$t=Vo?vi(Vo):$A;function ut(t){return t===void 0}var SA="Expected a function";function _A(t){if(typeof t!="function")throw new TypeError(SA);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function IA(t,e,n,r){if(!be(t))return t;e=Ri(e,t);for(var i=-1,s=e.length,a=s-1,o=t;o!=null&&++i<s;){var u=or(e[i]),c=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(i!=a){var l=o[u];c=void 0,c===void 0&&(c=be(l)?l:mi(e[i+1])?[]:{})}yi(o,u,c),o=o[u]}return t}function xA(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var a=e[r],o=Ra(t,a);n(o,a)&&IA(s,Ri(a,t),o)}return s}function CA(t,e){if(t==null)return{};var n=pi(Vy(t),function(r){return[r]});return e=Je(e),xA(t,n,function(r,i){return e(r,i[0])})}function wA(t,e,n,r,i){return i(t,function(s,a,o){n=r?(r=!1,s):e(n,s,a,o)}),n}function Ee(t,e,n){var r=M(t)?ky:wA,i=arguments.length<3;return r(t,Je(e),n,i,qt)}function Si(t,e){var n=M(t)?_a:Df;return n(t,_A(Je(e)))}function NA(t,e){var n;return qt(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function bA(t,e,n){var r=M(t)?bf:NA;return r(t,Je(e))}var kA=1/0,OA=rn&&1/Ca(new rn([,-0]))[1]==kA?function(t){return new rn(t)}:X,PA=200;function LA(t,e,n){var r=-1,i=pf,s=t.length,a=!0,o=[],u=o;if(s>=PA){var c=OA(t);if(c)return Ca(c);a=!1,i=xa,u=new un}else u=o;e:for(;++r<s;){var l=t[r],f=l;if(l=l!==0?l:0,a&&f===f){for(var d=u.length;d--;)if(u[d]===f)continue e;o.push(l)}else i(u,f,n)||(u!==o&&u.push(f),o.push(l))}return o}function ba(t){return t&&t.length?LA(t):[]}function Es(t){console&&console.error&&console.error(`Error: ${t}`)}function Ff(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Gf(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function Uf(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}var Bf=typeof global=="object"&&global&&global.Object===Object&&global,MA=typeof self=="object"&&self&&self.Object===Object&&self,pt=Bf||MA||Function("return this")(),St=pt.Symbol,jf=Object.prototype,DA=jf.hasOwnProperty,FA=jf.toString,Cn=St?St.toStringTag:void 0;function GA(t){var e=DA.call(t,Cn),n=t[Cn];try{t[Cn]=void 0;var r=!0}catch{}var i=FA.call(t);return r&&(e?t[Cn]=n:delete t[Cn]),i}var UA=Object.prototype,BA=UA.toString;function jA(t){return BA.call(t)}var HA="[object Null]",WA="[object Undefined]",qo=St?St.toStringTag:void 0;function bt(t){return t==null?t===void 0?WA:HA:qo&&qo in Object(t)?GA(t):jA(t)}function _t(t){return t!=null&&typeof t=="object"}var zA="[object Symbol]";function _i(t){return typeof t=="symbol"||_t(t)&&bt(t)==zA}function Ii(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var he=Array.isArray,Yo=St?St.prototype:void 0,Xo=Yo?Yo.toString:void 0;function Hf(t){if(typeof t=="string")return t;if(he(t))return Ii(t,Hf)+"";if(_i(t))return Xo?Xo.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var KA=/\s/;function VA(t){for(var e=t.length;e--&&KA.test(t.charAt(e)););return e}var qA=/^\s+/;function YA(t){return t&&t.slice(0,VA(t)+1).replace(qA,"")}function ct(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Jo=NaN,XA=/^[-+]0x[0-9a-f]+$/i,JA=/^0b[01]+$/i,QA=/^0o[0-7]+$/i,ZA=parseInt;function eE(t){if(typeof t=="number")return t;if(_i(t))return Jo;if(ct(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ct(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=YA(t);var n=JA.test(t);return n||QA.test(t)?ZA(t.slice(2),n?2:8):XA.test(t)?Jo:+t}var Qo=1/0,tE=17976931348623157e292;function nE(t){if(!t)return t===0?t:0;if(t=eE(t),t===Qo||t===-Qo){var e=t<0?-1:1;return e*tE}return t===t?t:0}function rE(t){var e=nE(t),n=e%1;return e===e?n?e-n:e:0}function xi(t){return t}var iE="[object AsyncFunction]",sE="[object Function]",aE="[object GeneratorFunction]",oE="[object Proxy]";function Wf(t){if(!ct(t))return!1;var e=bt(t);return e==sE||e==aE||e==iE||e==oE}var es=pt["__core-js_shared__"],Zo=function(){var t=/[^.]+$/.exec(es&&es.keys&&es.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function uE(t){return!!Zo&&Zo in t}var cE=Function.prototype,lE=cE.toString;function Yt(t){if(t!=null){try{return lE.call(t)}catch{}try{return t+""}catch{}}return""}var fE=/[\\^$.*+?()[\]{}|]/g,dE=/^\[object .+?Constructor\]$/,hE=Function.prototype,pE=Object.prototype,gE=hE.toString,mE=pE.hasOwnProperty,yE=RegExp("^"+gE.call(mE).replace(fE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function TE(t){if(!ct(t)||uE(t))return!1;var e=Wf(t)?yE:dE;return e.test(Yt(t))}function vE(t,e){return t==null?void 0:t[e]}function Xt(t,e){var n=vE(t,e);return TE(n)?n:void 0}var Rs=Xt(pt,"WeakMap");function AE(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var EE=800,RE=16,$E=Date.now;function SE(t){var e=0,n=0;return function(){var r=$E(),i=RE-(r-n);if(n=r,i>0){if(++e>=EE)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function _E(t){return function(){return t}}var Dr=function(){try{var t=Xt(Object,"defineProperty");return t({},"",{}),t}catch{}}(),IE=Dr?function(t,e){return Dr(t,"toString",{configurable:!0,enumerable:!1,value:_E(e),writable:!0})}:xi,xE=SE(IE);function CE(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function wE(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function NE(t){return t!==t}function bE(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function kE(t,e,n){return e===e?bE(t,e,n):wE(t,NE,n)}var OE=9007199254740991,PE=/^(?:0|[1-9]\d*)$/;function Ci(t,e){var n=typeof t;return e=e??OE,!!e&&(n=="number"||n!="symbol"&&PE.test(t))&&t>-1&&t%1==0&&t<e}function zf(t,e,n){e=="__proto__"&&Dr?Dr(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function wi(t,e){return t===e||t!==t&&e!==e}var LE=Object.prototype,ME=LE.hasOwnProperty;function ka(t,e,n){var r=t[e];(!(ME.call(t,e)&&wi(r,n))||n===void 0&&!(e in t))&&zf(t,e,n)}function DE(t,e,n,r){var i=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var o=e[s],u=void 0;u===void 0&&(u=t[o]),i?zf(n,o,u):ka(n,o,u)}return n}var eu=Math.max;function FE(t,e,n){return e=eu(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=eu(r.length-e,0),a=Array(s);++i<s;)a[i]=r[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=r[i];return o[e]=n(a),AE(t,this,o)}}function GE(t,e){return xE(FE(t,e,xi),t+"")}var UE=9007199254740991;function Oa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=UE}function Jt(t){return t!=null&&Oa(t.length)&&!Wf(t)}function BE(t,e,n){if(!ct(n))return!1;var r=typeof e;return(r=="number"?Jt(n)&&Ci(e,n.length):r=="string"&&e in n)?wi(n[e],t):!1}function jE(t){return GE(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,a&&BE(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,s)}return e})}var HE=Object.prototype;function Pa(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||HE;return t===n}function WE(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var zE="[object Arguments]";function tu(t){return _t(t)&&bt(t)==zE}var Kf=Object.prototype,KE=Kf.hasOwnProperty,VE=Kf.propertyIsEnumerable,Vf=tu(function(){return arguments}())?tu:function(t){return _t(t)&&KE.call(t,"callee")&&!VE.call(t,"callee")};function qE(){return!1}var qf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nu=qf&&typeof module=="object"&&module&&!module.nodeType&&module,YE=nu&&nu.exports===qf,ru=YE?pt.Buffer:void 0,XE=ru?ru.isBuffer:void 0,$s=XE||qE,JE="[object Arguments]",QE="[object Array]",ZE="[object Boolean]",eR="[object Date]",tR="[object Error]",nR="[object Function]",rR="[object Map]",iR="[object Number]",sR="[object Object]",aR="[object RegExp]",oR="[object Set]",uR="[object String]",cR="[object WeakMap]",lR="[object ArrayBuffer]",fR="[object DataView]",dR="[object Float32Array]",hR="[object Float64Array]",pR="[object Int8Array]",gR="[object Int16Array]",mR="[object Int32Array]",yR="[object Uint8Array]",TR="[object Uint8ClampedArray]",vR="[object Uint16Array]",AR="[object Uint32Array]",j={};j[dR]=j[hR]=j[pR]=j[gR]=j[mR]=j[yR]=j[TR]=j[vR]=j[AR]=!0;j[JE]=j[QE]=j[lR]=j[ZE]=j[fR]=j[eR]=j[tR]=j[nR]=j[rR]=j[iR]=j[sR]=j[aR]=j[oR]=j[uR]=j[cR]=!1;function ER(t){return _t(t)&&Oa(t.length)&&!!j[bt(t)]}function Yf(t){return function(e){return t(e)}}var Xf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ln=Xf&&typeof module=="object"&&module&&!module.nodeType&&module,RR=Ln&&Ln.exports===Xf,ts=RR&&Bf.process,Fr=function(){try{var t=Ln&&Ln.require&&Ln.require("util").types;return t||ts&&ts.binding&&ts.binding("util")}catch{}}(),iu=Fr&&Fr.isTypedArray,Jf=iu?Yf(iu):ER,$R=Object.prototype,SR=$R.hasOwnProperty;function Qf(t,e){var n=he(t),r=!n&&Vf(t),i=!n&&!r&&$s(t),s=!n&&!r&&!i&&Jf(t),a=n||r||i||s,o=a?WE(t.length,String):[],u=o.length;for(var c in t)(e||SR.call(t,c))&&!(a&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ci(c,u)))&&o.push(c);return o}function Zf(t,e){return function(n){return t(e(n))}}var _R=Zf(Object.keys,Object),IR=Object.prototype,xR=IR.hasOwnProperty;function CR(t){if(!Pa(t))return _R(t);var e=[];for(var n in Object(t))xR.call(t,n)&&n!="constructor"&&e.push(n);return e}function cr(t){return Jt(t)?Qf(t):CR(t)}var wR=Object.prototype,NR=wR.hasOwnProperty,Qe=jE(function(t,e){if(Pa(e)||Jt(e)){DE(e,cr(e),t);return}for(var n in e)NR.call(e,n)&&ka(t,n,e[n])});function bR(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var kR=Object.prototype,OR=kR.hasOwnProperty;function PR(t){if(!ct(t))return bR(t);var e=Pa(t),n=[];for(var r in t)r=="constructor"&&(e||!OR.call(t,r))||n.push(r);return n}function LR(t){return Jt(t)?Qf(t,!0):PR(t)}var MR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,DR=/^\w*$/;function La(t,e){if(he(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||_i(t)?!0:DR.test(t)||!MR.test(t)||e!=null&&t in Object(e)}var Un=Xt(Object,"create");function FR(){this.__data__=Un?Un(null):{},this.size=0}function GR(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var UR="__lodash_hash_undefined__",BR=Object.prototype,jR=BR.hasOwnProperty;function HR(t){var e=this.__data__;if(Un){var n=e[t];return n===UR?void 0:n}return jR.call(e,t)?e[t]:void 0}var WR=Object.prototype,zR=WR.hasOwnProperty;function KR(t){var e=this.__data__;return Un?e[t]!==void 0:zR.call(e,t)}var VR="__lodash_hash_undefined__";function qR(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Un&&e===void 0?VR:e,this}function jt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}jt.prototype.clear=FR;jt.prototype.delete=GR;jt.prototype.get=HR;jt.prototype.has=KR;jt.prototype.set=qR;function YR(){this.__data__=[],this.size=0}function Ni(t,e){for(var n=t.length;n--;)if(wi(t[n][0],e))return n;return-1}var XR=Array.prototype,JR=XR.splice;function QR(t){var e=this.__data__,n=Ni(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():JR.call(e,n,1),--this.size,!0}function ZR(t){var e=this.__data__,n=Ni(e,t);return n<0?void 0:e[n][1]}function e$(t){return Ni(this.__data__,t)>-1}function t$(t,e){var n=this.__data__,r=Ni(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function gt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}gt.prototype.clear=YR;gt.prototype.delete=QR;gt.prototype.get=ZR;gt.prototype.has=e$;gt.prototype.set=t$;var Bn=Xt(pt,"Map");function n$(){this.size=0,this.__data__={hash:new jt,map:new(Bn||gt),string:new jt}}function r$(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function bi(t,e){var n=t.__data__;return r$(e)?n[typeof e=="string"?"string":"hash"]:n.map}function i$(t){var e=bi(this,t).delete(t);return this.size-=e?1:0,e}function s$(t){return bi(this,t).get(t)}function a$(t){return bi(this,t).has(t)}function o$(t,e){var n=bi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function mt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}mt.prototype.clear=n$;mt.prototype.delete=i$;mt.prototype.get=s$;mt.prototype.has=a$;mt.prototype.set=o$;var u$="Expected a function";function Ma(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(u$);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var a=t.apply(this,r);return n.cache=s.set(i,a)||s,a};return n.cache=new(Ma.Cache||mt),n}Ma.Cache=mt;var c$=500;function l$(t){var e=Ma(t,function(r){return n.size===c$&&n.clear(),r}),n=e.cache;return e}var f$=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d$=/\\(\\)?/g,h$=l$(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(f$,function(n,r,i,s){e.push(i?s.replace(d$,"$1"):r||n)}),e});function p$(t){return t==null?"":Hf(t)}function ki(t,e){return he(t)?t:La(t,e)?[t]:h$(p$(t))}function lr(t){if(typeof t=="string"||_i(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Da(t,e){e=ki(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[lr(e[n++])];return n&&n==r?t:void 0}function g$(t,e,n){var r=t==null?void 0:Da(t,e);return r===void 0?n:r}function ed(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var m$=Zf(Object.getPrototypeOf,Object);function y$(){this.__data__=new gt,this.size=0}function T$(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function v$(t){return this.__data__.get(t)}function A$(t){return this.__data__.has(t)}var E$=200;function R$(t,e){var n=this.__data__;if(n instanceof gt){var r=n.__data__;if(!Bn||r.length<E$-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new mt(r)}return n.set(t,e),this.size=n.size,this}function ot(t){var e=this.__data__=new gt(t);this.size=e.size}ot.prototype.clear=y$;ot.prototype.delete=T$;ot.prototype.get=v$;ot.prototype.has=A$;ot.prototype.set=R$;function $$(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var a=t[n];e(a,n,t)&&(s[i++]=a)}return s}function td(){return[]}var S$=Object.prototype,_$=S$.propertyIsEnumerable,su=Object.getOwnPropertySymbols,nd=su?function(t){return t==null?[]:(t=Object(t),$$(su(t),function(e){return _$.call(t,e)}))}:td,I$=Object.getOwnPropertySymbols,x$=I$?function(t){for(var e=[];t;)ed(e,nd(t)),t=m$(t);return e}:td;function rd(t,e,n){var r=e(t);return he(t)?r:ed(r,n(t))}function au(t){return rd(t,cr,nd)}function C$(t){return rd(t,LR,x$)}var Ss=Xt(pt,"DataView"),_s=Xt(pt,"Promise"),Is=Xt(pt,"Set"),ou="[object Map]",w$="[object Object]",uu="[object Promise]",cu="[object Set]",lu="[object WeakMap]",fu="[object DataView]",N$=Yt(Ss),b$=Yt(Bn),k$=Yt(_s),O$=Yt(Is),P$=Yt(Rs),vt=bt;(Ss&&vt(new Ss(new ArrayBuffer(1)))!=fu||Bn&&vt(new Bn)!=ou||_s&&vt(_s.resolve())!=uu||Is&&vt(new Is)!=cu||Rs&&vt(new Rs)!=lu)&&(vt=function(t){var e=bt(t),n=e==w$?t.constructor:void 0,r=n?Yt(n):"";if(r)switch(r){case N$:return fu;case b$:return ou;case k$:return uu;case O$:return cu;case P$:return lu}return e});var du=pt.Uint8Array,L$="__lodash_hash_undefined__";function M$(t){return this.__data__.set(t,L$),this}function D$(t){return this.__data__.has(t)}function Gr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new mt;++e<n;)this.add(t[e])}Gr.prototype.add=Gr.prototype.push=M$;Gr.prototype.has=D$;function id(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function F$(t,e){return t.has(e)}var G$=1,U$=2;function sd(t,e,n,r,i,s){var a=n&G$,o=t.length,u=e.length;if(o!=u&&!(a&&u>o))return!1;var c=s.get(t),l=s.get(e);if(c&&l)return c==e&&l==t;var f=-1,d=!0,h=n&U$?new Gr:void 0;for(s.set(t,e),s.set(e,t);++f<o;){var g=t[f],m=e[f];if(r)var T=a?r(m,g,f,e,t,s):r(g,m,f,t,e,s);if(T!==void 0){if(T)continue;d=!1;break}if(h){if(!id(e,function(y,E){if(!F$(h,E)&&(g===y||i(g,y,n,r,s)))return h.push(E)})){d=!1;break}}else if(!(g===m||i(g,m,n,r,s))){d=!1;break}}return s.delete(t),s.delete(e),d}function B$(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function j$(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var H$=1,W$=2,z$="[object Boolean]",K$="[object Date]",V$="[object Error]",q$="[object Map]",Y$="[object Number]",X$="[object RegExp]",J$="[object Set]",Q$="[object String]",Z$="[object Symbol]",eS="[object ArrayBuffer]",tS="[object DataView]",hu=St?St.prototype:void 0,ns=hu?hu.valueOf:void 0;function nS(t,e,n,r,i,s,a){switch(n){case tS:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case eS:return!(t.byteLength!=e.byteLength||!s(new du(t),new du(e)));case z$:case K$:case Y$:return wi(+t,+e);case V$:return t.name==e.name&&t.message==e.message;case X$:case Q$:return t==e+"";case q$:var o=B$;case J$:var u=r&H$;if(o||(o=j$),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=W$,a.set(t,e);var l=sd(o(t),o(e),r,i,s,a);return a.delete(t),l;case Z$:if(ns)return ns.call(t)==ns.call(e)}return!1}var rS=1,iS=Object.prototype,sS=iS.hasOwnProperty;function aS(t,e,n,r,i,s){var a=n&rS,o=au(t),u=o.length,c=au(e),l=c.length;if(u!=l&&!a)return!1;for(var f=u;f--;){var d=o[f];if(!(a?d in e:sS.call(e,d)))return!1}var h=s.get(t),g=s.get(e);if(h&&g)return h==e&&g==t;var m=!0;s.set(t,e),s.set(e,t);for(var T=a;++f<u;){d=o[f];var y=t[d],E=e[d];if(r)var v=a?r(E,y,d,e,t,s):r(y,E,d,t,e,s);if(!(v===void 0?y===E||i(y,E,n,r,s):v)){m=!1;break}T||(T=d=="constructor")}if(m&&!T){var S=t.constructor,O=e.constructor;S!=O&&"constructor"in t&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof O=="function"&&O instanceof O)&&(m=!1)}return s.delete(t),s.delete(e),m}var oS=1,pu="[object Arguments]",gu="[object Array]",Ar="[object Object]",uS=Object.prototype,mu=uS.hasOwnProperty;function cS(t,e,n,r,i,s){var a=he(t),o=he(e),u=a?gu:vt(t),c=o?gu:vt(e);u=u==pu?Ar:u,c=c==pu?Ar:c;var l=u==Ar,f=c==Ar,d=u==c;if(d&&$s(t)){if(!$s(e))return!1;a=!0,l=!1}if(d&&!l)return s||(s=new ot),a||Jf(t)?sd(t,e,n,r,i,s):nS(t,e,u,n,r,i,s);if(!(n&oS)){var h=l&&mu.call(t,"__wrapped__"),g=f&&mu.call(e,"__wrapped__");if(h||g){var m=h?t.value():t,T=g?e.value():e;return s||(s=new ot),i(m,T,n,r,s)}}return d?(s||(s=new ot),aS(t,e,n,r,i,s)):!1}function Fa(t,e,n,r,i){return t===e?!0:t==null||e==null||!_t(t)&&!_t(e)?t!==t&&e!==e:cS(t,e,n,r,Fa,i)}var lS=1,fS=2;function dS(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var a=n[i];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=n[i];var o=a[0],u=t[o],c=a[1];if(a[2]){if(u===void 0&&!(o in t))return!1}else{var l=new ot,f;if(!(f===void 0?Fa(c,u,lS|fS,r,l):f))return!1}}return!0}function ad(t){return t===t&&!ct(t)}function hS(t){for(var e=cr(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,ad(i)]}return e}function od(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function pS(t){var e=hS(t);return e.length==1&&e[0][2]?od(e[0][0],e[0][1]):function(n){return n===t||dS(n,t,e)}}function gS(t,e){return t!=null&&e in Object(t)}function mS(t,e,n){e=ki(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var a=lr(e[r]);if(!(s=t!=null&&n(t,a)))break;t=t[a]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&Oa(i)&&Ci(a,i)&&(he(t)||Vf(t)))}function yS(t,e){return t!=null&&mS(t,e,gS)}var TS=1,vS=2;function AS(t,e){return La(t)&&ad(e)?od(lr(t),e):function(n){var r=g$(n,t);return r===void 0&&r===e?yS(n,t):Fa(e,r,TS|vS)}}function ES(t){return function(e){return e==null?void 0:e[t]}}function RS(t){return function(e){return Da(e,t)}}function $S(t){return La(t)?ES(lr(t)):RS(t)}function Oi(t){return typeof t=="function"?t:t==null?xi:typeof t=="object"?he(t)?AS(t[0],t[1]):pS(t):$S(t)}function SS(t){return function(e,n,r){for(var i=-1,s=Object(e),a=r(e),o=a.length;o--;){var u=a[++i];if(n(s[u],u,s)===!1)break}return e}}var _S=SS();function IS(t,e){return t&&_S(t,e,cr)}function xS(t,e){return function(n,r){if(n==null)return n;if(!Jt(n))return t(n,r);for(var i=n.length,s=-1,a=Object(n);++s<i&&r(a[s],s,a)!==!1;);return n}}var Pi=xS(IS);function CS(t){return typeof t=="function"?t:xi}function wS(t,e){var n=he(t)?CE:Pi;return n(t,CS(e))}function NS(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function bS(t,e){var n=!0;return Pi(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function kS(t,e,n){var r=he(t)?NS:bS;return r(t,Oi(e))}function OS(t,e){var n=-1,r=Jt(t)?Array(t.length):[];return Pi(t,function(i,s,a){r[++n]=e(i,s,a)}),r}function ud(t,e){var n=he(t)?Ii:OS;return n(t,Oi(e))}var PS="[object String]";function Ur(t){return typeof t=="string"||!he(t)&&_t(t)&&bt(t)==PS}function LS(t,e){return Ii(e,function(n){return t[n]})}function MS(t){return t==null?[]:LS(t,cr(t))}var DS=Math.max;function FS(t,e,n,r){t=Jt(t)?t:MS(t),n=n?rE(n):0;var i=t.length;return n<0&&(n=DS(i+n,0)),Ur(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&kE(t,e,n)>-1}var GS="[object RegExp]";function US(t){return _t(t)&&bt(t)==GS}var yu=Fr&&Fr.isRegExp,BS=yu?Yf(yu):US;function jS(t,e,n,r){if(!ct(t))return t;e=ki(e,t);for(var i=-1,s=e.length,a=s-1,o=t;o!=null&&++i<s;){var u=lr(e[i]),c=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(i!=a){var l=o[u];c=void 0,c===void 0&&(c=ct(l)?l:Ci(e[i+1])?[]:{})}ka(o,u,c),o=o[u]}return t}function HS(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var a=e[r],o=Da(t,a);n(o,a)&&jS(s,ki(a,t),o)}return s}function Ze(t,e){if(t==null)return{};var n=Ii(C$(t),function(r){return[r]});return e=Oi(e),HS(t,n,function(r,i){return e(r,i[0])})}function WS(t,e){var n;return Pi(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function zS(t,e,n){var r=he(t)?id:WS;return r(t,Oi(e))}function KS(t){return VS(t)?t.LABEL:t.name}function VS(t){return Ur(t.LABEL)&&t.LABEL!==""}class et{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),wS(this.definition,n=>{n.accept(e)})}}class le extends et{constructor(e){super([]),this.idx=1,Qe(this,Ze(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Tn extends et{constructor(e){super(e.definition),this.orgText="",Qe(this,Ze(e,n=>n!==void 0))}}class pe extends et{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Qe(this,Ze(e,n=>n!==void 0))}}class re extends et{constructor(e){super(e.definition),this.idx=1,Qe(this,Ze(e,n=>n!==void 0))}}class Re extends et{constructor(e){super(e.definition),this.idx=1,Qe(this,Ze(e,n=>n!==void 0))}}class $e extends et{constructor(e){super(e.definition),this.idx=1,Qe(this,Ze(e,n=>n!==void 0))}}class V extends et{constructor(e){super(e.definition),this.idx=1,Qe(this,Ze(e,n=>n!==void 0))}}class me extends et{constructor(e){super(e.definition),this.idx=1,Qe(this,Ze(e,n=>n!==void 0))}}class ye extends et{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Qe(this,Ze(e,n=>n!==void 0))}}class H{constructor(e){this.idx=1,Qe(this,Ze(e,n=>n!==void 0))}accept(e){e.visit(this)}}function qS(t){return ud(t,Ir)}function Ir(t){function e(n){return ud(n,Ir)}if(t instanceof le){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return Ur(t.label)&&(n.label=t.label),n}else{if(t instanceof pe)return{type:"Alternative",definition:e(t.definition)};if(t instanceof re)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Re)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof $e)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Ir(new H({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof me)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Ir(new H({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof V)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof ye)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof H){const n={type:"Terminal",name:t.terminalType.name,label:KS(t.terminalType),idx:t.idx};Ur(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=BS(r)?r.source:r),n}else{if(t instanceof Tn)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class vn{visit(e){const n=e;switch(n.constructor){case le:return this.visitNonTerminal(n);case pe:return this.visitAlternative(n);case re:return this.visitOption(n);case Re:return this.visitRepetitionMandatory(n);case $e:return this.visitRepetitionMandatoryWithSeparator(n);case me:return this.visitRepetitionWithSeparator(n);case V:return this.visitRepetition(n);case ye:return this.visitAlternation(n);case H:return this.visitTerminal(n);case Tn:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function YS(t){return t instanceof pe||t instanceof re||t instanceof V||t instanceof Re||t instanceof $e||t instanceof me||t instanceof H||t instanceof Tn}function Br(t,e=[]){return t instanceof re||t instanceof V||t instanceof me?!0:t instanceof ye?zS(t.definition,r=>Br(r,e)):t instanceof le&&FS(e,t)?!1:t instanceof et?(t instanceof le&&e.push(t),kS(t.definition,r=>Br(r,e))):!1}function XS(t){return t instanceof ye}function We(t){if(t instanceof le)return"SUBRULE";if(t instanceof re)return"OPTION";if(t instanceof ye)return"OR";if(t instanceof Re)return"AT_LEAST_ONE";if(t instanceof $e)return"AT_LEAST_ONE_SEP";if(t instanceof me)return"MANY_SEP";if(t instanceof V)return"MANY";if(t instanceof H)return"CONSUME";throw Error("non exhaustive match")}class Li{walk(e,n=[]){N(e.definition,(r,i)=>{const s=te(e.definition,i+1);if(r instanceof le)this.walkProdRef(r,s,n);else if(r instanceof H)this.walkTerminal(r,s,n);else if(r instanceof pe)this.walkFlat(r,s,n);else if(r instanceof re)this.walkOption(r,s,n);else if(r instanceof Re)this.walkAtLeastOne(r,s,n);else if(r instanceof $e)this.walkAtLeastOneSep(r,s,n);else if(r instanceof me)this.walkManySep(r,s,n);else if(r instanceof V)this.walkMany(r,s,n);else if(r instanceof ye)this.walkOr(r,s,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new re({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=Tu(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new re({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=Tu(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);N(e.definition,s=>{const a=new pe({definition:[s]});this.walk(a,i)})}}function Tu(t,e,n){return[new re({definition:[new H({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function fr(t){if(t instanceof le)return fr(t.referencedRule);if(t instanceof H)return ZS(t);if(YS(t))return JS(t);if(XS(t))return QS(t);throw Error("non exhaustive match")}function JS(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,a=!0;for(;i&&a;)s=n[r],a=Br(s),e=e.concat(fr(s)),r=r+1,i=n.length>r;return ba(e)}function QS(t){const e=x(t.definition,n=>fr(n));return ba(De(e))}function ZS(t){return[t.terminalType]}const cd="_~IN~_";class e_ extends Li{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=n_(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),a=new pe({definition:s}),o=fr(a);this.follows[i]=o}}function t_(t){const e={};return N(t,n=>{const r=new e_(n).startWalking();ys(e,r)}),e}function n_(t,e){return t.name+e+cd}let xr={};const r_=new ef;function Mi(t){const e=t.toString();if(xr.hasOwnProperty(e))return xr[e];{const n=r_.pattern(e);return xr[e]=n,n}}function i_(){xr={}}const ld="Complement Sets are not supported for first char optimization",jr=`Unable to use "first char" lexer optimizations:
|
|
12
|
+
`;function s_(t,e=!1){try{const n=Mi(t);return xs(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===ld)e&&Ff(`${jr} Unable to optimize: < ${t.toString()} >
|
|
13
|
+
Complement Sets cannot be automatically optimized.
|
|
14
|
+
This will disable the lexer's first char optimizations.
|
|
15
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
|
|
16
|
+
This will disable the lexer's first char optimizations.
|
|
17
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Es(`${jr}
|
|
18
|
+
Failed parsing: < ${t.toString()} >
|
|
19
|
+
Using the @chevrotain/regexp-to-ast library
|
|
20
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function xs(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)xs(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":Er(a.value,e,n);break;case"Set":if(a.complement===!0)throw Error(ld);N(a.value,u=>{if(typeof u=="number")Er(u,e,n);else{const c=u;if(n===!0)for(let l=c.from;l<=c.to;l++)Er(l,e,n);else{for(let l=c.from;l<=c.to&&l<kn;l++)Er(l,e,n);if(c.to>=kn){const l=c.from>=kn?c.from:kn,f=c.to,d=It(l),h=It(f);for(let g=d;g<=h;g++)e[g]=g}}}});break;case"Group":xs(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Cs(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return J(e)}function Er(t,e,n){const r=It(t);e[r]=r,n===!0&&a_(t,e)}function a_(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=It(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=It(i.charCodeAt(0));e[s]=s}}}function vu(t,e){return ln(t.value,n=>{if(typeof n=="number")return ge(e,n);{const r=n;return ln(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Cs(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?M(t.value)?Ve(t.value,Cs):Cs(t.value):!1}class o_ extends li{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){ge(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?vu(e,this.targetCharCodes)===void 0&&(this.found=!0):vu(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Ga(t,e){if(e instanceof RegExp){const n=Mi(e),r=new o_(t);return r.visit(n),r.found}else return ln(e,n=>ge(t,n.charCodeAt(0)))!==void 0}const Ht="PATTERN",bn="defaultMode",Rr="modes";let fd=typeof new RegExp("(?:)").sticky=="boolean";function u_(t,e){e=Na(e,{useSticky:fd,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
21
|
+
`],tracer:(E,v)=>v()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{b_()});let r;n("Reject Lexer.NA",()=>{r=Si(t,E=>E[Ht]===de.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=x(r,E=>{const v=E[Ht];if($t(v)){const S=v.source;return S.length===1&&S!=="^"&&S!=="$"&&S!=="."&&!v.ignoreCase?S:S.length===2&&S[0]==="\\"&&!ge(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],S[1])?S[1]:e.useSticky?Eu(v):Au(v)}else{if(ft(v))return i=!0,{exec:v};if(typeof v=="object")return i=!0,v;if(typeof v=="string"){if(v.length===1)return v;{const S=v.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),O=new RegExp(S);return e.useSticky?Eu(O):Au(O)}}else throw Error("non exhaustive match")}})});let a,o,u,c,l;n("misc mapping",()=>{a=x(r,E=>E.tokenTypeIdx),o=x(r,E=>{const v=E.GROUP;if(v!==de.SKIPPED){if(Be(v))return v;if(ut(v))return!1;throw Error("non exhaustive match")}}),u=x(r,E=>{const v=E.LONGER_ALT;if(v)return M(v)?x(v,O=>Ko(r,O)):[Ko(r,v)]}),c=x(r,E=>E.PUSH_MODE),l=x(r,E=>C(E,"POP_MODE"))});let f;n("Line Terminator Handling",()=>{const E=pd(e.lineTerminatorCharacters);f=x(r,v=>!1),e.positionTracking!=="onlyOffset"&&(f=x(r,v=>C(v,"LINE_BREAKS")?!!v.LINE_BREAKS:hd(v,E)===!1&&Ga(E,v.PATTERN)))});let d,h,g,m;n("Misc Mapping #2",()=>{d=x(r,dd),h=x(s,C_),g=Ee(r,(E,v)=>{const S=v.GROUP;return Be(S)&&S!==de.SKIPPED&&(E[S]=[]),E},{}),m=x(s,(E,v)=>({pattern:s[v],longerAlt:u[v],canLineTerminator:f[v],isCustom:d[v],short:h[v],group:o[v],push:c[v],pop:l[v],tokenTypeIdx:a[v],tokenType:r[v]}))});let T=!0,y=[];return e.safeMode||n("First Char Optimization",()=>{y=Ee(r,(E,v,S)=>{if(typeof v.PATTERN=="string"){const O=v.PATTERN.charCodeAt(0),se=It(O);rs(E,se,m[S])}else if(M(v.START_CHARS_HINT)){let O;N(v.START_CHARS_HINT,se=>{const Le=typeof se=="string"?se.charCodeAt(0):se,Te=It(Le);O!==Te&&(O=Te,rs(E,Te,m[S]))})}else if($t(v.PATTERN))if(v.PATTERN.unicode)T=!1,e.ensureOptimizations&&Es(`${jr} Unable to analyze < ${v.PATTERN.toString()} > pattern.
|
|
22
|
+
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
23
|
+
This will disable the lexer's first char optimizations.
|
|
24
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const O=s_(v.PATTERN,e.ensureOptimizations);U(O)&&(T=!1),N(O,se=>{rs(E,se,m[S])})}else e.ensureOptimizations&&Es(`${jr} TokenType: <${v.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
25
|
+
This will disable the lexer's first char optimizations.
|
|
26
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),T=!1;return E},[])}),{emptyGroups:g,patternIdxToConfig:m,charCodeToPatternIdxToConfig:y,hasCustom:i,canBeOptimized:T}}function c_(t,e){let n=[];const r=f_(t);n=n.concat(r.errors);const i=d_(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(l_(s)),n=n.concat(A_(s)),n=n.concat(E_(s,e)),n=n.concat(R_(s)),n}function l_(t){let e=[];const n=Pe(t,r=>$t(r[Ht]));return e=e.concat(p_(n)),e=e.concat(y_(n)),e=e.concat(T_(n)),e=e.concat(v_(n)),e=e.concat(g_(n)),e}function f_(t){const e=Pe(t,i=>!C(i,Ht)),n=x(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:q.MISSING_PATTERN,tokenTypes:[i]})),r=$i(t,e);return{errors:n,valid:r}}function d_(t){const e=Pe(t,i=>{const s=i[Ht];return!$t(s)&&!ft(s)&&!C(s,"exec")&&!Be(s)}),n=x(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:q.INVALID_PATTERN,tokenTypes:[i]})),r=$i(t,e);return{errors:n,valid:r}}const h_=/[^\\][$]/;function p_(t){class e extends li{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=Pe(t,i=>{const s=i.PATTERN;try{const a=Mi(s),o=new e;return o.visit(a),o.found}catch{return h_.test(s.source)}});return x(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
27
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
28
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function g_(t){const e=Pe(t,r=>r.PATTERN.test(""));return x(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:q.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const m_=/[^\\[][\^]|^\^/;function y_(t){class e extends li{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=Pe(t,i=>{const s=i.PATTERN;try{const a=Mi(s),o=new e;return o.visit(a),o.found}catch{return m_.test(s.source)}});return x(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
29
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
30
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function T_(t){const e=Pe(t,r=>{const i=r[Ht];return i instanceof RegExp&&(i.multiline||i.global)});return x(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function v_(t){const e=[];let n=x(t,s=>Ee(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!ge(e,o)&&o.PATTERN!==de.NA&&(e.push(o),a.push(o)),a),[]));n=ur(n);const r=Pe(n,s=>s.length>1);return x(r,s=>{const a=x(s,u=>u.name);return{message:`The same RegExp pattern ->${Ue(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function A_(t){const e=Pe(t,r=>{if(!C(r,"GROUP"))return!1;const i=r.GROUP;return i!==de.SKIPPED&&i!==de.NA&&!Be(i)});return x(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function E_(t,e){const n=Pe(t,i=>i.PUSH_MODE!==void 0&&!ge(e,i.PUSH_MODE));return x(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function R_(t){const e=[],n=Ee(t,(r,i,s)=>{const a=i.PATTERN;return a===de.NA||(Be(a)?r.push({str:a,idx:s,tokenType:i}):$t(a)&&S_(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return N(t,(r,i)=>{N(n,({str:s,idx:a,tokenType:o})=>{if(i<a&&$_(s,r.PATTERN)){const u=`Token: ->${o.name}<- can never be matched.
|
|
31
|
+
Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
|
|
32
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:u,type:q.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function $_(t,e){if($t(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(ft(e))return e(t,0,[],{});if(C(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function S_(t){return ln([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function Au(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function Eu(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function __(t,e,n){const r=[];return C(t,bn)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+bn+`> property in its definition
|
|
33
|
+
`,type:q.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),C(t,Rr)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Rr+`> property in its definition
|
|
34
|
+
`,type:q.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),C(t,Rr)&&C(t,bn)&&!C(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${bn}: <${t.defaultMode}>which does not exist
|
|
35
|
+
`,type:q.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),C(t,Rr)&&N(t.modes,(i,s)=>{N(i,(a,o)=>{if(ut(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
|
|
36
|
+
`,type:q.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(C(a,"LONGER_ALT")){const u=M(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];N(u,c=>{!ut(c)&&!ge(i,c)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${a.name}> outside of mode <${s}>
|
|
37
|
+
`,type:q.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function I_(t,e,n){const r=[];let i=!1;const s=ur(De(J(t.modes))),a=Si(s,u=>u[Ht]===de.NA),o=pd(n);return e&&N(a,u=>{const c=hd(u,o);if(c!==!1){const f={message:N_(u,c),type:c.issue,tokenType:u};r.push(f)}else C(u,"LINE_BREAKS")?u.LINE_BREAKS===!0&&(i=!0):Ga(o,u.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|
38
|
+
This Lexer has been defined to track line and column information,
|
|
39
|
+
But none of the Token Types can be identified as matching a line terminator.
|
|
40
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
41
|
+
for details.`,type:q.NO_LINE_BREAKS_FLAGS}),r}function x_(t){const e={},n=ke(t);return N(n,r=>{const i=t[r];if(M(i))e[r]=[];else throw Error("non exhaustive match")}),e}function dd(t){const e=t.PATTERN;if($t(e))return!1;if(ft(e))return!0;if(C(e,"exec"))return!0;if(Be(e))return!1;throw Error("non exhaustive match")}function C_(t){return Be(t)&&t.length===1?t.charCodeAt(0):!1}const w_={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function hd(t,e){if(C(t,"LINE_BREAKS"))return!1;if($t(t.PATTERN)){try{Ga(e,t.PATTERN)}catch(n){return{issue:q.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(Be(t.PATTERN))return!1;if(dd(t))return{issue:q.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function N_(t,e){if(e.issue===q.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
42
|
+
The problem is in the <${t.name}> Token Type
|
|
43
|
+
Root cause: ${e.errMsg}.
|
|
44
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
45
|
+
The problem is in the <${t.name}> Token Type
|
|
46
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function pd(t){return x(t,n=>Be(n)?n.charCodeAt(0):n)}function rs(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const kn=256;let Cr=[];function It(t){return t<kn?t:Cr[t]}function b_(){if(U(Cr)){Cr=new Array(65536);for(let t=0;t<65536;t++)Cr[t]=t>255?255+~~(t/255):t}}function dr(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function Hr(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let Ru=1;const gd={};function hr(t){const e=k_(t);O_(e),L_(e),P_(e),N(e,n=>{n.isParent=n.categoryMatches.length>0})}function k_(t){let e=ie(t),n=t,r=!0;for(;r;){n=ur(De(x(n,s=>s.CATEGORIES)));const i=$i(n,e);e=e.concat(i),U(i)?r=!1:n=i}return e}function O_(t){N(t,e=>{yd(e)||(gd[Ru]=e,e.tokenTypeIdx=Ru++),$u(e)&&!M(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),$u(e)||(e.CATEGORIES=[]),M_(e)||(e.categoryMatches=[]),D_(e)||(e.categoryMatchesMap={})})}function P_(t){N(t,e=>{e.categoryMatches=[],N(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(gd[r].tokenTypeIdx)})})}function L_(t){N(t,e=>{md([],e)})}function md(t,e){N(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),N(e.CATEGORIES,n=>{const r=t.concat(e);ge(r,n)||md(r,n)})}function yd(t){return C(t,"tokenTypeIdx")}function $u(t){return C(t,"CATEGORIES")}function M_(t){return C(t,"categoryMatches")}function D_(t){return C(t,"categoryMatchesMap")}function F_(t){return C(t,"tokenTypeIdx")}const G_={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var q;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(q||(q={}));const On={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
47
|
+
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:G_,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(On);class de{constructor(e,n=On){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);const{time:o,value:u}=Gf(s),c=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,u}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
48
|
+
a boolean 2nd argument is no longer supported`);this.config=ys({},On,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===On.lineTerminatorsPattern)this.config.lineTerminatorsPattern=w_;else if(this.config.lineTerminatorCharacters===On.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
49
|
+
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),M(e)?i={modes:{defaultMode:ie(e)},defaultMode:bn}:(s=!1,i=ie(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(__(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(I_(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},N(i.modes,(o,u)=>{i.modes[u]=Si(o,c=>ut(c))});const a=ke(i.modes);if(N(i.modes,(o,u)=>{this.TRACE_INIT(`Mode: <${u}> processing`,()=>{if(this.modes.push(u),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(c_(o,a))}),U(this.lexerDefinitionErrors)){hr(o);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=u_(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[u]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[u]=c.charCodeToPatternIdxToConfig,this.emptyGroups=ys({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[u]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,!U(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const u=x(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
|
|
50
|
+
`);throw new Error(`Errors detected in definition of Lexer:
|
|
51
|
+
`+u)}N(this.lexerDefinitionWarning,o=>{Ff(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(fd?(this.chopInput=on,this.match=this.matchWithTest):(this.updateLastIndex=X,this.match=this.matchWithExec),s&&(this.handleModes=X),this.trackStartLines===!1&&(this.computeNewColumn=on),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=X),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=Ee(this.canModeBeOptimized,(u,c,l)=>(c===!1&&u.push(l),u),[]);if(n.ensureOptimizations&&!U(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
|
|
52
|
+
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
53
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{i_()}),this.TRACE_INIT("toFastProperties",()=>{Uf(this)})})}tokenize(e,n=this.defaultMode){if(!U(this.lexerDefinitionErrors)){const i=x(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
|
|
54
|
+
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
55
|
+
`+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,a,o,u,c,l,f,d,h,g,m,T,y;const E=e,v=E.length;let S=0,O=0;const se=this.hasCustom?0:Math.floor(e.length/10),Le=new Array(se),Te=[];let He=this.trackStartLines?1:void 0,Se=this.trackStartLines?1:void 0;const $=x_(this.emptyGroups),A=this.trackStartLines,R=this.config.lineTerminatorsPattern;let _=0,P=[],k=[];const b=[],ve=[];Object.freeze(ve);let Q;function K(){return P}function Pt(ae){const _e=It(ae),Zt=k[_e];return Zt===void 0?ve:Zt}const Lh=ae=>{if(b.length===1&&ae.tokenType.PUSH_MODE===void 0){const _e=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ae);Te.push({offset:ae.startOffset,line:ae.startLine,column:ae.startColumn,length:ae.image.length,message:_e})}else{b.pop();const _e=cn(b);P=this.patternIdxToConfig[_e],k=this.charCodeToPatternIdxToConfig[_e],_=P.length;const Zt=this.canModeBeOptimized[_e]&&this.config.safeMode===!1;k&&Zt?Q=Pt:Q=K}};function ro(ae){b.push(ae),k=this.charCodeToPatternIdxToConfig[ae],P=this.patternIdxToConfig[ae],_=P.length,_=P.length;const _e=this.canModeBeOptimized[ae]&&this.config.safeMode===!1;k&&_e?Q=Pt:Q=K}ro.call(this,n);let Me;const io=this.config.recoveryEnabled;for(;S<v;){u=null;const ae=E.charCodeAt(S),_e=Q(ae),Zt=_e.length;for(r=0;r<Zt;r++){Me=_e[r];const Ae=Me.pattern;c=null;const tt=Me.short;if(tt!==!1?ae===tt&&(u=Ae):Me.isCustom===!0?(y=Ae.exec(E,S,Le,$),y!==null?(u=y[0],y.payload!==void 0&&(c=y.payload)):u=null):(this.updateLastIndex(Ae,S),u=this.match(Ae,e,S)),u!==null){if(o=Me.longerAlt,o!==void 0){const yt=o.length;for(s=0;s<yt;s++){const nt=P[o[s]],Lt=nt.pattern;if(l=null,nt.isCustom===!0?(y=Lt.exec(E,S,Le,$),y!==null?(a=y[0],y.payload!==void 0&&(l=y.payload)):a=null):(this.updateLastIndex(Lt,S),a=this.match(Lt,e,S)),a&&a.length>u.length){u=a,c=l,Me=nt;break}}}break}}if(u!==null){if(f=u.length,d=Me.group,d!==void 0&&(h=Me.tokenTypeIdx,g=this.createTokenInstance(u,S,h,Me.tokenType,He,Se,f),this.handlePayload(g,c),d===!1?O=this.addToken(Le,O,g):$[d].push(g)),e=this.chopInput(e,f),S=S+f,Se=this.computeNewColumn(Se,f),A===!0&&Me.canLineTerminator===!0){let Ae=0,tt,yt;R.lastIndex=0;do tt=R.test(u),tt===!0&&(yt=R.lastIndex-1,Ae++);while(tt===!0);Ae!==0&&(He=He+Ae,Se=f-yt,this.updateTokenEndLineColumnLocation(g,d,yt,Ae,He,Se,f))}this.handleModes(Me,Lh,ro,g)}else{const Ae=S,tt=He,yt=Se;let nt=io===!1;for(;nt===!1&&S<v;)for(e=this.chopInput(e,1),S++,i=0;i<_;i++){const Lt=P[i],Wi=Lt.pattern,so=Lt.short;if(so!==!1?E.charCodeAt(S)===so&&(nt=!0):Lt.isCustom===!0?nt=Wi.exec(E,S,Le,$)!==null:(this.updateLastIndex(Wi,S),nt=Wi.exec(e)!==null),nt===!0)break}if(m=S-Ae,Se=this.computeNewColumn(Se,m),T=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(E,Ae,m,tt,yt),Te.push({offset:Ae,line:tt,column:yt,length:m,message:T}),io===!1)break}}return this.hasCustom||(Le.length=O),{tokens:Le,groups:$,errors:Te}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=n}updateTokenEndLineColumnLocation(e,n,r,i,s,a,o){let u,c;n!==void 0&&(u=r===o-1,c=u?-1:0,i===1&&u===!0||(e.endLine=s+c,e.endColumn=a-1+-c))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,a){return{image:e,startOffset:n,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:n+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}de.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";de.NA=/NOT_APPLICABLE/;function sn(t){return Td(t)?t.LABEL:t.name}function Td(t){return Be(t.LABEL)&&t.LABEL!==""}const U_="parent",Su="categories",_u="label",Iu="group",xu="push_mode",Cu="pop_mode",wu="longer_alt",Nu="line_breaks",bu="start_chars_hint";function vd(t){return B_(t)}function B_(t){const e=t.pattern,n={};if(n.name=t.name,ut(e)||(n.PATTERN=e),C(t,U_))throw`The parent property is no longer supported.
|
|
56
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return C(t,Su)&&(n.CATEGORIES=t[Su]),hr([n]),C(t,_u)&&(n.LABEL=t[_u]),C(t,Iu)&&(n.GROUP=t[Iu]),C(t,Cu)&&(n.POP_MODE=t[Cu]),C(t,xu)&&(n.PUSH_MODE=t[xu]),C(t,wu)&&(n.LONGER_ALT=t[wu]),C(t,Nu)&&(n.LINE_BREAKS=t[Nu]),C(t,bu)&&(n.START_CHARS_HINT=t[bu]),n}const xt=vd({name:"EOF",pattern:de.NA});hr([xt]);function Ua(t,e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function Ad(t,e){return dr(t,e)}const tn={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${Td(t)?`--> ${sn(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
|
|
57
|
+
but found: '`+Ue(e).image+"'";if(r)return s+r+o;{const u=Ee(t,(d,h)=>d.concat(h),[]),c=x(u,d=>`[${x(d,h=>sn(h)).join(", ")}]`),f=`one of these possible Token sequences:
|
|
58
|
+
${x(c,(d,h)=>` ${h+1}. ${d}`).join(`
|
|
59
|
+
`)}`;return s+f+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",a=`
|
|
60
|
+
but found: '`+Ue(e).image+"'";if(n)return i+n+a;{const u=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
61
|
+
<${x(t,c=>`[${x(c,l=>sn(l)).join(",")}]`).join(" ,")}>`;return i+u+a}}};Object.freeze(tn);const j_={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|
62
|
+
inside top level rule: ->`+t.name+"<-"}},Dt={buildDuplicateFoundError(t,e){function n(l){return l instanceof H?l.terminalType.name:l instanceof le?l.nonTerminalName:""}const r=t.name,i=Ue(e),s=i.idx,a=We(i),o=n(i),u=s>0;let c=`->${a}${u?s:""}<- ${o?`with argument: ->${o}<-`:""}
|
|
63
|
+
appears more than once (${e.length} times) in the top level rule: ->${r}<-.
|
|
64
|
+
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
65
|
+
`;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
|
|
66
|
+
`),c},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
|
|
67
|
+
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|
68
|
+
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
69
|
+
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
70
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=x(t.prefixPath,i=>sn(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
71
|
+
in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|
72
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
73
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
74
|
+
For Further details.`},buildAlternationAmbiguityError(t){const e=x(t.prefixPath,i=>sn(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|
75
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
76
|
+
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
77
|
+
For Further details.`,r},buildEmptyRepetitionError(t){let e=We(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|
78
|
+
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
79
|
+
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|
80
|
+
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
81
|
+
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=x(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|
82
|
+
rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
83
|
+
without consuming any Tokens. The grammar path that causes this is:
|
|
84
|
+
${r}
|
|
85
|
+
To fix this refactor your grammar to remove the left recursion.
|
|
86
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Tn?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function H_(t,e){const n=new W_(t,e);return n.resolveRefs(),n.errors}class W_ extends vn{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){N(J(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:fe.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class z_ extends Li{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=ie(this.path.ruleStack).reverse(),this.occurrenceStack=ie(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){U(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class K_ extends z_{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new pe({definition:i});this.possibleTokTypes=fr(s),this.found=!0}}}class Di extends Li{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class V_ extends Di{walkMany(e,n,r){if(e.idx===this.occurrence){const i=Ue(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class ku extends Di{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=Ue(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class q_ extends Di{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=Ue(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class Ou extends Di{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Ue(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function ws(t,e,n=[]){n=ie(n);let r=[],i=0;function s(o){return o.concat(te(t,i+1))}function a(o){const u=ws(s(o),e,n);return r.concat(u)}for(;n.length<e&&i<t.length;){const o=t[i];if(o instanceof pe)return a(o.definition);if(o instanceof le)return a(o.definition);if(o instanceof re)r=a(o.definition);else if(o instanceof Re){const u=o.definition.concat([new V({definition:o.definition})]);return a(u)}else if(o instanceof $e){const u=[new pe({definition:o.definition}),new V({definition:[new H({terminalType:o.separator})].concat(o.definition)})];return a(u)}else if(o instanceof me){const u=o.definition.concat([new V({definition:[new H({terminalType:o.separator})].concat(o.definition)})]);r=a(u)}else if(o instanceof V){const u=o.definition.concat([new V({definition:o.definition})]);r=a(u)}else{if(o instanceof ye)return N(o.definition,u=>{U(u.definition)===!1&&(r=a(u.definition))}),r;if(o instanceof H)n.push(o.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:te(t,i)}),r}function Ed(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const u=e.length,c=u-r-1,l=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!U(f);){const d=f.pop();if(d===a){o&&cn(f).idx<=c&&f.pop();continue}const h=d.def,g=d.idx,m=d.ruleStack,T=d.occurrenceStack;if(U(h))continue;const y=h[0];if(y===i){const E={idx:g,def:te(h),ruleStack:Gn(m),occurrenceStack:Gn(T)};f.push(E)}else if(y instanceof H)if(g<u-1){const E=g+1,v=e[E];if(n(v,y.terminalType)){const S={idx:E,def:te(h),ruleStack:m,occurrenceStack:T};f.push(S)}}else if(g===u-1)l.push({nextTokenType:y.terminalType,nextTokenOccurrence:y.idx,ruleStack:m,occurrenceStack:T}),o=!0;else throw Error("non exhaustive match");else if(y instanceof le){const E=ie(m);E.push(y.nonTerminalName);const v=ie(T);v.push(y.idx);const S={idx:g,def:y.definition.concat(s,te(h)),ruleStack:E,occurrenceStack:v};f.push(S)}else if(y instanceof re){const E={idx:g,def:te(h),ruleStack:m,occurrenceStack:T};f.push(E),f.push(a);const v={idx:g,def:y.definition.concat(te(h)),ruleStack:m,occurrenceStack:T};f.push(v)}else if(y instanceof Re){const E=new V({definition:y.definition,idx:y.idx}),v=y.definition.concat([E],te(h)),S={idx:g,def:v,ruleStack:m,occurrenceStack:T};f.push(S)}else if(y instanceof $e){const E=new H({terminalType:y.separator}),v=new V({definition:[E].concat(y.definition),idx:y.idx}),S=y.definition.concat([v],te(h)),O={idx:g,def:S,ruleStack:m,occurrenceStack:T};f.push(O)}else if(y instanceof me){const E={idx:g,def:te(h),ruleStack:m,occurrenceStack:T};f.push(E),f.push(a);const v=new H({terminalType:y.separator}),S=new V({definition:[v].concat(y.definition),idx:y.idx}),O=y.definition.concat([S],te(h)),se={idx:g,def:O,ruleStack:m,occurrenceStack:T};f.push(se)}else if(y instanceof V){const E={idx:g,def:te(h),ruleStack:m,occurrenceStack:T};f.push(E),f.push(a);const v=new V({definition:y.definition,idx:y.idx}),S=y.definition.concat([v],te(h)),O={idx:g,def:S,ruleStack:m,occurrenceStack:T};f.push(O)}else if(y instanceof ye)for(let E=y.definition.length-1;E>=0;E--){const v=y.definition[E],S={idx:g,def:v.definition.concat(te(h)),ruleStack:m,occurrenceStack:T};f.push(S),f.push(a)}else if(y instanceof pe)f.push({idx:g,def:y.definition.concat(te(h)),ruleStack:m,occurrenceStack:T});else if(y instanceof Tn)f.push(Y_(y,g,m,T));else throw Error("non exhaustive match")}return l}function Y_(t,e,n,r){const i=ie(n);i.push(t.name);const s=ie(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var z;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(z||(z={}));function Ba(t){if(t instanceof re||t==="Option")return z.OPTION;if(t instanceof V||t==="Repetition")return z.REPETITION;if(t instanceof Re||t==="RepetitionMandatory")return z.REPETITION_MANDATORY;if(t instanceof $e||t==="RepetitionMandatoryWithSeparator")return z.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof me||t==="RepetitionWithSeparator")return z.REPETITION_WITH_SEPARATOR;if(t instanceof ye||t==="Alternation")return z.ALTERNATION;throw Error("non exhaustive match")}function Pu(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=Ba(r);return s===z.ALTERNATION?Fi(e,n,i):Gi(e,n,s,i)}function X_(t,e,n,r,i,s){const a=Fi(t,e,n),o=Sd(a)?Hr:dr;return s(a,r,o,i)}function J_(t,e,n,r,i,s){const a=Gi(t,e,i,n),o=Sd(a)?Hr:dr;return s(a[0],o,r)}function Q_(t,e,n,r){const i=t.length,s=Ve(t,a=>Ve(a,o=>o.length===1));if(e)return function(a){const o=x(a,u=>u.GATE);for(let u=0;u<i;u++){const c=t[u],l=c.length,f=o[u];if(!(f!==void 0&&f.call(this)===!1))e:for(let d=0;d<l;d++){const h=c[d],g=h.length;for(let m=0;m<g;m++){const T=this.LA(m+1);if(n(T,h[m])===!1)continue e}return u}}};if(s&&!r){const a=x(t,u=>De(u)),o=Ee(a,(u,c,l)=>(N(c,f=>{C(u,f.tokenTypeIdx)||(u[f.tokenTypeIdx]=l),N(f.categoryMatches,d=>{C(u,d)||(u[d]=l)})}),u),{});return function(){const u=this.LA(1);return o[u.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){const o=t[a],u=o.length;e:for(let c=0;c<u;c++){const l=o[c],f=l.length;for(let d=0;d<f;d++){const h=this.LA(d+1);if(n(h,l[d])===!1)continue e}return a}}}}function Z_(t,e,n){const r=Ve(t,s=>s.length===1),i=t.length;if(r&&!n){const s=De(t);if(s.length===1&&U(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const a=Ee(s,(o,u,c)=>(o[u.tokenTypeIdx]=!0,N(u.categoryMatches,l=>{o[l]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const a=t[s],o=a.length;for(let u=0;u<o;u++){const c=this.LA(u+1);if(e(c,a[u])===!1)continue e}return!0}return!1}}class eI extends Li{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(e,n,r){this.checkIsTarget(e,z.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,z.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,z.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class Rd extends vn{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,z.OPTION)}visitRepetition(e){this.checkIsTarget(e,z.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,z.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,z.ALTERNATION)}}function Lu(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function is(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let s=0;s<e.length;s++){const a=e[s];i.push(a+"_"+r.tokenTypeIdx);for(let o=0;o<r.categoryMatches.length;o++){const u="_"+r.categoryMatches[o];i.push(a+u)}}e=i}return e}function tI(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let s=0;s<e.length;s++){const a=e[s];if(i[a]===!0)return!1}}return!0}function $d(t,e){const n=x(t,a=>ws([a],1)),r=Lu(n.length),i=x(n,a=>{const o={};return N(a,u=>{const c=is(u.partialPath);N(c,l=>{o[l]=!0})}),o});let s=n;for(let a=1;a<=e;a++){const o=s;s=Lu(o.length);for(let u=0;u<o.length;u++){const c=o[u];for(let l=0;l<c.length;l++){const f=c[l].partialPath,d=c[l].suffixDef,h=is(f);if(tI(i,h,u)||U(d)||f.length===e){const m=r[u];if(Ns(m,f)===!1){m.push(f);for(let T=0;T<h.length;T++){const y=h[T];i[u][y]=!0}}}else{const m=ws(d,a+1,f);s[u]=s[u].concat(m),N(m,T=>{const y=is(T.partialPath);N(y,E=>{i[u][E]=!0})})}}}}return r}function Fi(t,e,n,r){const i=new Rd(t,z.ALTERNATION,r);return e.accept(i),$d(i.result,n)}function Gi(t,e,n,r){const i=new Rd(t,n);e.accept(i);const s=i.result,o=new eI(e,t,n).startWalking(),u=new pe({definition:s}),c=new pe({definition:o});return $d([u,c],r)}function Ns(t,e){e:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const s=e[i],a=r[i];if((s===a||a.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function nI(t,e){return t.length<e.length&&Ve(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function Sd(t){return Ve(t,e=>Ve(e,n=>Ve(n,r=>U(r.categoryMatches))))}function rI(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return x(e,n=>Object.assign({type:fe.CUSTOM_LOOKAHEAD_VALIDATION},n))}function iI(t,e,n,r){const i=Ce(t,u=>sI(u,n)),s=yI(t,e,n),a=Ce(t,u=>hI(u,n)),o=Ce(t,u=>uI(u,t,r,n));return i.concat(s,a,o)}function sI(t,e){const n=new oI;t.accept(n);const r=n.allProductions,i=fA(r,aI),s=CA(i,o=>o.length>1);return x(J(s),o=>{const u=Ue(o),c=e.buildDuplicateFoundError(t,o),l=We(u),f={message:c,type:fe.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:u.idx},d=_d(u);return d&&(f.parameter=d),f})}function aI(t){return`${We(t)}_#_${t.idx}_#_${_d(t)}`}function _d(t){return t instanceof H?t.terminalType.name:t instanceof le?t.nonTerminalName:""}class oI extends vn{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function uI(t,e,n,r){const i=[];if(Ee(e,(a,o)=>o.name===t.name?a+1:a,0)>1){const a=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:a,type:fe.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function cI(t,e,n){const r=[];let i;return ge(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:fe.INVALID_RULE_OVERRIDE,ruleName:t})),r}function Id(t,e,n,r=[]){const i=[],s=wr(e.definition);if(U(s))return[];{const a=t.name;ge(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:fe.LEFT_RECURSION,ruleName:a});const u=$i(s,r.concat([t])),c=Ce(u,l=>{const f=ie(r);return f.push(l),Id(t,l,n,f)});return i.concat(c)}}function wr(t){let e=[];if(U(t))return e;const n=Ue(t);if(n instanceof le)e.push(n.referencedRule);else if(n instanceof pe||n instanceof re||n instanceof Re||n instanceof $e||n instanceof me||n instanceof V)e=e.concat(wr(n.definition));else if(n instanceof ye)e=De(x(n.definition,s=>wr(s.definition)));else if(!(n instanceof H))throw Error("non exhaustive match");const r=Br(n),i=t.length>1;if(r&&i){const s=te(t);return e.concat(wr(s))}else return e}class ja extends vn{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function lI(t,e){const n=new ja;t.accept(n);const r=n.alternations;return Ce(r,s=>{const a=Gn(s.definition);return Ce(a,(o,u)=>{const c=Ed([o],[],dr,1);return U(c)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:u}),type:fe.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:u+1}]:[]})})}function fI(t,e,n){const r=new ja;t.accept(r);let i=r.alternations;return i=Si(i,a=>a.ignoreAmbiguities===!0),Ce(i,a=>{const o=a.idx,u=a.maxLookahead||e,c=Fi(o,t,u,a),l=gI(c,a,t,n),f=mI(c,a,t,n);return l.concat(f)})}class dI extends vn{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function hI(t,e){const n=new ja;t.accept(n);const r=n.alternations;return Ce(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:fe.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function pI(t,e,n){const r=[];return N(t,i=>{const s=new dI;i.accept(s);const a=s.allProductions;N(a,o=>{const u=Ba(o),c=o.maxLookahead||e,l=o.idx,d=Gi(l,i,u,c)[0];if(U(De(d))){const h=n.buildEmptyRepetitionError({topLevelRule:i,repetition:o});r.push({message:h,type:fe.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function gI(t,e,n,r){const i=[],s=Ee(t,(o,u,c)=>(e.definition[c].ignoreAmbiguities===!0||N(u,l=>{const f=[c];N(t,(d,h)=>{c!==h&&Ns(d,l)&&e.definition[h].ignoreAmbiguities!==!0&&f.push(h)}),f.length>1&&!Ns(i,l)&&(i.push(l),o.push({alts:f,path:l}))}),o),[]);return x(s,o=>{const u=x(o.alts,l=>l+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:u,prefixPath:o.path}),type:fe.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:o.alts}})}function mI(t,e,n,r){const i=Ee(t,(a,o,u)=>{const c=x(o,l=>({idx:u,path:l}));return a.concat(c)},[]);return ur(Ce(i,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const u=a.idx,c=a.path,l=Pe(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<u&&nI(d.path,c));return x(l,d=>{const h=[d.idx+1,u+1],g=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:h,prefixPath:d.path}),type:fe.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:g,alternatives:h}})}))}function yI(t,e,n){const r=[],i=x(e,s=>s.name);return N(t,s=>{const a=s.name;if(ge(i,a)){const o=n.buildNamespaceConflictError(s);r.push({message:o,type:fe.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),r}function TI(t){const e=Na(t,{errMsgProvider:j_}),n={};return N(t.rules,r=>{n[r.name]=r}),H_(n,e.errMsgProvider)}function vI(t){return t=Na(t,{errMsgProvider:Dt}),iI(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const xd="MismatchedTokenException",Cd="NoViableAltException",wd="EarlyExitException",Nd="NotAllInputParsedException",bd=[xd,Cd,wd,Nd];Object.freeze(bd);function Wr(t){return ge(bd,t.name)}class Ui extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class kd extends Ui{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=xd}}class AI extends Ui{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Cd}}class EI extends Ui{constructor(e,n){super(e,n),this.name=Nd}}class RI extends Ui{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=wd}}const ss={},Od="InRuleRecoveryException";class $I extends Error{constructor(e){super(e),this.name=Od}}class SI{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=C(e,"recoveryEnabled")?e.recoveryEnabled:lt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=_I)}getTokenToInsert(e){const n=Ua(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,n,r,i){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let u=!1;const c=this.LA(1);let l=this.LA(1);const f=()=>{const d=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:d,ruleName:this.getCurrRuleFullName()}),g=new kd(h,c,this.LA(0));g.resyncedTokens=Gn(o),this.SAVE_ERROR(g)};for(;!u;)if(this.tokenMatcher(l,i)){f();return}else if(r.call(this)){f(),e.apply(this,n);return}else this.tokenMatcher(l,s)?u=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,n,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const r=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new $I("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||U(n))return!1;const r=this.LA(1);return ln(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return ge(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=ln(e,s=>Ad(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return ss;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return x(e,(r,i)=>i===0?ss:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=x(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return De(e)}getFollowSetFromFollowKey(e){if(e===ss)return[xt];const n=e.ruleName+e.idxInCallingRule+cd+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,xt)||n.push(e),n}reSyncTo(e){const n=[];let r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return Gn(n)}attemptInRepetitionRecovery(e,n,r,i,s,a,o){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=ie(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return x(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function _I(t,e,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let u=this.firstAfterRepMap[o];if(u===void 0){const d=this.getCurrRuleFullName(),h=this.getGAstProductions()[d];u=new s(h,i).startWalking(),this.firstAfterRepMap[o]=u}let c=u.token,l=u.occurrence;const f=u.isEndOfRule;this.RULE_STACK.length===1&&f&&c===void 0&&(c=xt,l=1),!(c===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,l,a)&&this.tryInRepetitionRecovery(t,e,n,c)}const II=4,kt=8,Pd=1<<kt,Ld=2<<kt,bs=3<<kt,ks=4<<kt,Os=5<<kt,Nr=6<<kt;function as(t,e,n){return n|e|t}class Ha{constructor(e){var n;this.maxLookahead=(n=e==null?void 0:e.maxLookahead)!==null&&n!==void 0?n:lt.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(U(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...s]}return n}validateNoLeftRecursion(e){return Ce(e,n=>Id(n,n,Dt))}validateEmptyOrAlternatives(e){return Ce(e,n=>lI(n,Dt))}validateAmbiguousAlternationAlternatives(e,n){return Ce(e,r=>fI(r,n,Dt))}validateSomeNonEmptyLookaheadPath(e,n){return pI(e,n,Dt)}buildLookaheadForAlternation(e){return X_(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Q_)}buildLookaheadForOptional(e){return J_(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Ba(e.prodType),Z_)}}class xI{initLooksAhead(e){this.dynamicTokensEnabled=C(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:lt.dynamicTokensEnabled,this.maxLookahead=C(e,"maxLookahead")?e.maxLookahead:lt.maxLookahead,this.lookaheadStrategy=C(e,"lookaheadStrategy")?e.lookaheadStrategy:new Ha({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){N(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:u}=wI(n);N(r,c=>{const l=c.idx===0?"":c.idx;this.TRACE_INIT(`${We(c)}${l}`,()=>{const f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:n,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=as(this.fullRuleNameToShort[n.name],Pd,c.idx);this.setLaFuncCache(d,f)})}),N(i,c=>{this.computeLookaheadFunc(n,c.idx,bs,"Repetition",c.maxLookahead,We(c))}),N(s,c=>{this.computeLookaheadFunc(n,c.idx,Ld,"Option",c.maxLookahead,We(c))}),N(a,c=>{this.computeLookaheadFunc(n,c.idx,ks,"RepetitionMandatory",c.maxLookahead,We(c))}),N(o,c=>{this.computeLookaheadFunc(n,c.idx,Nr,"RepetitionMandatoryWithSeparator",c.maxLookahead,We(c))}),N(u,c=>{this.computeLookaheadFunc(n,c.idx,Os,"RepetitionWithSeparator",c.maxLookahead,We(c))})})})}computeLookaheadFunc(e,n,r,i,s,a){this.TRACE_INIT(`${a}${n===0?"":n}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),u=as(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(u,o)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return as(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class CI extends vn{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const $r=new CI;function wI(t){$r.reset(),t.accept($r);const e=$r.dslMethods;return $r.reset(),e}function Mu(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function Du(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function NI(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function bI(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const kI="name";function Md(t,e){Object.defineProperty(t,kI,{enumerable:!1,configurable:!0,writable:!1,value:e})}function OI(t,e){const n=ke(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],a=t[s],o=a.length;for(let u=0;u<o;u++){const c=a[u];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}function PI(t,e){const n=function(){};Md(n,t+"BaseSemantics");const r={visit:function(i,s){if(M(i)&&(i=i[0]),!ut(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=MI(this,e);if(!U(i)){const s=x(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
87
|
+
${s.join(`
|
|
88
|
+
|
|
89
|
+
`).replace(/\n/g,`
|
|
90
|
+
`)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function LI(t,e,n){const r=function(){};Md(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return N(e,s=>{i[s]=OI}),r.prototype=i,r.prototype.constructor=r,r}var Ps;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Ps||(Ps={}));function MI(t,e){return DI(t,e)}function DI(t,e){const n=Pe(e,i=>ft(t[i])===!1),r=x(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:Ps.MISSING_METHOD,methodName:i}));return ur(r)}class FI{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=C(e,"nodeLocationTracking")?e.nodeLocationTracking:lt.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=X,this.cstFinallyStateUpdate=X,this.cstPostTerminal=X,this.cstPostNonTerminal=X,this.cstPostRule=X;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Du,this.setNodeLocationFromNode=Du,this.cstPostRule=X,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Mu,this.setNodeLocationFromNode=Mu,this.cstPostRule=X,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=X,this.setInitialNodeLocation=X;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];NI(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];bI(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(ut(this.baseCstVisitorConstructor)){const e=PI(this.className,ke(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ut(this.baseCstVisitorWithDefaultsConstructor)){const e=LI(this.className,ke(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class GI{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Kr}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?Kr:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class UI{ACTION(e){return e.call(this)}consume(e,n,r){return this.consumeInternal(n,e,r)}subrule(e,n,r){return this.subruleInternal(n,e,r)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,n,r=Vr){if(ge(this.definedRulesNames,e)){const a={message:Dt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:fe.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=Vr){const i=cI(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,n,r);return this[e]=s,s}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,n),!0}catch(i){if(Wr(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return qS(J(this.gastProductionsCache))}}class BI{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Hr,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},C(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
91
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
92
|
+
For Further details.`);if(M(e)){if(U(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
93
|
+
Note that the first argument for the parser constructor
|
|
94
|
+
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
95
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
96
|
+
For Further details.`)}if(M(e))this.tokensMap=Ee(e,(s,a)=>(s[a.name]=a,s),{});else if(C(e,"modes")&&Ve(De(J(e.modes)),F_)){const s=De(J(e.modes)),a=ba(s);this.tokensMap=Ee(a,(o,u)=>(o[u.name]=u,o),{})}else if(be(e))this.tokensMap=ie(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=xt;const r=C(e,"modes")?De(J(e.modes)):J(e),i=Ve(r,s=>U(s.categoryMatches));this.tokenMatcher=i?Hr:dr,hr(J(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
97
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=C(r,"resyncEnabled")?r.resyncEnabled:Vr.resyncEnabled,s=C(r,"recoveryValueFunc")?r.recoveryValueFunc:Vr.recoveryValueFunc,a=this.ruleShortNameIdx<<II+kt;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...l){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,l);const f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...l){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,l)}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(Wr(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return r(e);else{if(this.outputCst){const u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,a.partialCstResult=u}throw a}}else{if(i)return this.moveToTerminatedState(),r(e);throw a}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(Ld,n);return this.optionInternalLogic(e,n,r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(ks,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=n;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,ks,e,q_)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Nr,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Ou],o,Nr,e,Ou)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(bs,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const u=i;i=()=>o.call(this)&&u.call(this)}}else s=n;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,bs,e,V_,a)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Os,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,ku],o,Os,e,ku)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,Nr,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(Pd,n),i=M(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(n,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new EI(n,e))}}subruleInternal(e,n,r){let i;try{const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,n,r){throw Wr(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,n,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,n,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,n,r){let i;const s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new kd(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===Od?r:s}}else throw r}saveRecogState(){const e=this.errors,n=ie(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),xt)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class jI{initErrorHandler(e){this._errors=[],this.errorMessageProvider=C(e,"errorMessageProvider")?e.errorMessageProvider:lt.errorMessageProvider}SAVE_ERROR(e){if(Wr(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:ie(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return ie(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],o=Gi(e,s,n,this.maxLookahead)[0],u=[];for(let l=1;l<=this.maxLookahead;l++)u.push(this.LA(l));const c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:u,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new RI(c,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=Fi(e,i,this.maxLookahead),a=[];for(let c=1;c<=this.maxLookahead;c++)a.push(this.LA(c));const o=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new AI(u,this.LA(1),o))}}class HI{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(ut(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Ed([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=Ue(e.ruleStack),i=this.getGAstProductions()[n];return new K_(i,e).startWalking()}}const Bi={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Bi);const Fu=!0,Gu=Math.pow(2,kt)-1,Dd=vd({name:"RECORDING_PHASE_TOKEN",pattern:de.NA});hr([Dd]);const Fd=Ua(Dd,`This IToken indicates the Parser is in Recording Phase
|
|
98
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Fd);const WI={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
99
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class zI{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return Kr}topLevelRuleRecord(e,n){try{const r=new Tn({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
|
|
100
|
+
This error was thrown during the "grammar recording phase" For more info see:
|
|
101
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return wn.call(this,re,e,n)}atLeastOneInternalRecord(e,n){wn.call(this,Re,n,e)}atLeastOneSepFirstInternalRecord(e,n){wn.call(this,$e,n,e,Fu)}manyInternalRecord(e,n){wn.call(this,V,n,e)}manySepFirstInternalRecord(e,n){wn.call(this,me,n,e,Fu)}orInternalRecord(e,n){return KI.call(this,e,n)}subruleInternalRecord(e,n,r){if(zr(n),!e||C(e,"ruleName")===!1){const o=new Error(`<SUBRULE${Uu(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
102
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=cn(this.recordingProdStack),s=e.ruleName,a=new le({idx:n,nonTerminalName:s,label:r==null?void 0:r.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?WI:Bi}consumeInternalRecord(e,n,r){if(zr(n),!yd(e)){const a=new Error(`<CONSUME${Uu(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
103
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=cn(this.recordingProdStack),s=new H({idx:n,terminalType:e,label:r==null?void 0:r.LABEL});return i.definition.push(s),Fd}}function wn(t,e,n,r=!1){zr(n);const i=cn(this.recordingProdStack),s=ft(e)?e:e.DEF,a=new t({definition:[],idx:n});return r&&(a.separator=e.SEP),C(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),Bi}function KI(t,e){zr(e);const n=cn(this.recordingProdStack),r=M(t)===!1,i=r===!1?t:t.DEF,s=new ye({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});C(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const a=bA(i,o=>ft(o.GATE));return s.hasPredicates=a,n.definition.push(s),N(i,o=>{const u=new pe({definition:[]});s.definition.push(u),C(o,"IGNORE_AMBIGUITIES")?u.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:C(o,"GATE")&&(u.ignoreAmbiguities=!0),this.recordingProdStack.push(u),o.ALT.call(this),this.recordingProdStack.pop()}),Bi}function Uu(t){return t===0?"":`${t}`}function zr(t){if(t<0||t>Gu){const e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
104
|
+
Idx value must be a none negative value smaller than ${Gu+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class VI{initPerformanceTracer(e){if(C(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=lt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=Gf(n),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function qI(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const Kr=Ua(xt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Kr);const lt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:tn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Vr=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var fe;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(fe||(fe={}));function Bu(t=void 0){return function(){return t}}class pr{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{Uf(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),N(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=TI({rules:J(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(U(r)&&this.skipValidations===!1){const i=vI({rules:J(this.gastProductionsCache),tokenTypes:J(this.tokensMap),errMsgProvider:Dt,grammarName:n}),s=rI({lookaheadStrategy:this.lookaheadStrategy,rules:J(this.gastProductionsCache),tokenTypes:J(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),U(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=t_(J(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:J(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(J(this.gastProductionsCache))})),!pr.DEFER_DEFINITION_ERRORS_HANDLING&&!U(this.definitionErrors))throw e=x(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|
105
|
+
${e.join(`
|
|
106
|
+
-------------------------------
|
|
107
|
+
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),C(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
108
|
+
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
109
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
110
|
+
For further details.`);this.skipValidations=C(n,"skipValidations")?n.skipValidations:lt.skipValidations}}pr.DEFER_DEFINITION_ERRORS_HANDLING=!1;qI(pr,[SI,xI,FI,GI,BI,UI,jI,HI,zI,VI]);class YI extends pr{constructor(e,n=lt){const r=ie(n);r.outputCst=!1,super(e,r)}}function fn(t,e,n){return`${t.name}_${e}_${n}`}const Ct=1,XI=2,Gd=4,Ud=5,gr=7,JI=8,QI=9,ZI=10,ex=11,Bd=12;class Wa{constructor(e){this.target=e}isEpsilon(){return!1}}class za extends Wa{constructor(e,n){super(e),this.tokenType=n}}class jd extends Wa{constructor(e){super(e)}isEpsilon(){return!0}}class Ka extends Wa{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function tx(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};nx(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Qt(e,i,i);s!==void 0&&hx(e,i,s)}return e}function nx(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Z(t,i,void 0,{type:XI}),a=Z(t,i,void 0,{type:gr});s.stop=a,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,a)}}function Hd(t,e,n){return n instanceof H?Va(t,e,n.terminalType,n):n instanceof le?dx(t,e,n):n instanceof ye?ox(t,e,n):n instanceof re?ux(t,e,n):n instanceof V?rx(t,e,n):n instanceof me?ix(t,e,n):n instanceof Re?sx(t,e,n):n instanceof $e?ax(t,e,n):Qt(t,e,n)}function rx(t,e,n){const r=Z(t,e,n,{type:Ud});Ot(t,r);const i=An(t,e,r,n,Qt(t,e,n));return zd(t,e,n,i)}function ix(t,e,n){const r=Z(t,e,n,{type:Ud});Ot(t,r);const i=An(t,e,r,n,Qt(t,e,n)),s=Va(t,e,n.separator,n);return zd(t,e,n,i,s)}function sx(t,e,n){const r=Z(t,e,n,{type:Gd});Ot(t,r);const i=An(t,e,r,n,Qt(t,e,n));return Wd(t,e,n,i)}function ax(t,e,n){const r=Z(t,e,n,{type:Gd});Ot(t,r);const i=An(t,e,r,n,Qt(t,e,n)),s=Va(t,e,n.separator,n);return Wd(t,e,n,i,s)}function ox(t,e,n){const r=Z(t,e,n,{type:Ct});Ot(t,r);const i=st(n.definition,a=>Hd(t,e,a));return An(t,e,r,n,...i)}function ux(t,e,n){const r=Z(t,e,n,{type:Ct});Ot(t,r);const i=An(t,e,r,n,Qt(t,e,n));return cx(t,e,n,i)}function Qt(t,e,n){const r=Wh(st(n.definition,i=>Hd(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:fx(t,r)}function Wd(t,e,n,r,i){const s=r.left,a=r.right,o=Z(t,e,n,{type:ex});Ot(t,o);const u=Z(t,e,n,{type:Bd});return s.loopback=o,u.loopback=o,t.decisionMap[fn(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,Y(a,o),i===void 0?(Y(o,s),Y(o,u)):(Y(o,u),Y(o,i.left),Y(i.right,s)),{left:s,right:u}}function zd(t,e,n,r,i){const s=r.left,a=r.right,o=Z(t,e,n,{type:ZI});Ot(t,o);const u=Z(t,e,n,{type:Bd}),c=Z(t,e,n,{type:QI});return o.loopback=c,u.loopback=c,Y(o,s),Y(o,u),Y(a,c),i!==void 0?(Y(c,u),Y(c,i.left),Y(i.right,s)):Y(c,o),t.decisionMap[fn(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:u}}function cx(t,e,n,r){const i=r.left,s=r.right;return Y(i,s),t.decisionMap[fn(e,"Option",n.idx)]=i,r}function Ot(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function An(t,e,n,r,...i){const s=Z(t,e,r,{type:JI,start:n});n.end=s;for(const o of i)o!==void 0?(Y(n,o.left),Y(o.right,s)):Y(n,s);const a={left:n,right:s};return t.decisionMap[fn(e,lx(r),r.idx)]=n,a}function lx(t){if(t instanceof ye)return"Alternation";if(t instanceof re)return"Option";if(t instanceof V)return"Repetition";if(t instanceof me)return"RepetitionWithSeparator";if(t instanceof Re)return"RepetitionMandatory";if(t instanceof $e)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function fx(t,e){const n=e.length;for(let s=0;s<n-1;s++){const a=e[s];let o;a.left.transitions.length===1&&(o=a.left.transitions[0]);const u=o instanceof Ka,c=o,l=e[s+1].left;a.left.type===Ct&&a.right.type===Ct&&o!==void 0&&(u&&c.followState===a.right||o.target===a.right)?(u?c.followState=l:o.target=l,px(t,a.right)):Y(a.right,l)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function Va(t,e,n,r){const i=Z(t,e,r,{type:Ct}),s=Z(t,e,r,{type:Ct});return qa(i,new za(s,n)),{left:i,right:s}}function dx(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.get(r),s=Z(t,e,n,{type:Ct}),a=Z(t,e,n,{type:Ct}),o=new Ka(i,r,a);return qa(s,o),{left:s,right:a}}function hx(t,e,n){const r=t.ruleToStartState.get(e);Y(r,n.left);const i=t.ruleToStopState.get(e);return Y(n.right,i),{left:r,right:i}}function Y(t,e){const n=new jd(e);qa(t,n)}function Z(t,e,n,r){const i=Object.assign({atn:t,production:n,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},r);return t.states.push(i),i}function qa(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function px(t,e){t.states.splice(t.states.indexOf(e),1)}const qr={};class Ls{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=Kd(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return st(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function Kd(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function gx(t,e){const n={};return r=>{const i=r.toString();let s=n[i];return s!==void 0||(s={atnStartState:t,decision:e,states:{}},n[i]=s),s}}class Vd{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,n){this.predicates[e]=n}toString(){let e="";const n=this.predicates.length;for(let r=0;r<n;r++)e+=this.predicates[r]===!0?"1":"0";return e}}const ju=new Vd;class mx extends Ha{constructor(e){var n;super(),this.logging=(n=e==null?void 0:e.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=tx(e.rules),this.dfas=yx(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,u=fn(r,"Alternation",n),l=this.atn.decisionMap[u].decision,f=st(Pu({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),d=>st(d,h=>h[0]));if(Hu(f,!1)&&!s){const d=ao(f,(h,g,m)=>(zi(g,T=>{T&&(h[T.tokenTypeIdx]=m,zi(T.categoryMatches,y=>{h[y]=m}))}),h),{});return i?function(h){var g;const m=this.LA(1),T=d[m.tokenTypeIdx];if(h!==void 0&&T!==void 0){const y=(g=h[T])===null||g===void 0?void 0:g.GATE;if(y!==void 0&&y.call(this)===!1)return}return T}:function(){const h=this.LA(1);return d[h.tokenTypeIdx]}}else return i?function(d){const h=new Vd,g=d===void 0?0:d.length;for(let T=0;T<g;T++){const y=d==null?void 0:d[T].GATE;h.set(T,y===void 0||y.call(this))}const m=os.call(this,a,l,h,o);return typeof m=="number"?m:void 0}:function(){const d=os.call(this,a,l,ju,o);return typeof d=="number"?d:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,u=fn(r,i,n),l=this.atn.decisionMap[u].decision,f=st(Pu({maxLookahead:1,occurrence:n,prodType:i,rule:r}),d=>st(d,h=>h[0]));if(Hu(f)&&f[0][0]&&!s){const d=f[0],h=Gh(d);if(h.length===1&&Fh(h[0].categoryMatches)){const m=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===m}}else{const g=ao(h,(m,T)=>(T!==void 0&&(m[T.tokenTypeIdx]=!0,zi(T.categoryMatches,y=>{m[y]=!0})),m),{});return function(){const m=this.LA(1);return g[m.tokenTypeIdx]===!0}}}return function(){const d=os.call(this,a,l,ju,o);return typeof d=="object"?!1:d===0}}}function Hu(t,e=!0){const n=new Set;for(const r of t){const i=new Set;for(const s of r){if(s===void 0){if(e)break;return!1}const a=[s.tokenTypeIdx].concat(s.categoryMatches);for(const o of a)if(n.has(o)){if(!i.has(o))return!1}else n.add(o),i.add(o)}}return!0}function yx(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=gx(t.decisionStates[r],r);return n}function os(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const o=Cx(i.atnStartState);s=Yd(i,qd(o)),i.start=s}return Tx.apply(this,[i,s,n,r])}function Tx(t,e,n,r){let i=e,s=1;const a=[];let o=this.LA(s++);for(;;){let u=Sx(i,o);if(u===void 0&&(u=vx.apply(this,[t,i,o,s,n,r])),u===qr)return $x(a,i,o);if(u.isAcceptState===!0)return u.prediction;i=u,a.push(o),o=this.LA(s++)}}function vx(t,e,n,r,i,s){const a=_x(e.configs,n,i);if(a.size===0)return Wu(t,e,n,qr),qr;let o=qd(a);const u=xx(a,i);if(u!==void 0)o.isAcceptState=!0,o.prediction=u,o.configs.uniqueAlt=u;else if(kx(a)){const c=Uh(a.alts);o.isAcceptState=!0,o.prediction=c,o.configs.uniqueAlt=c,Ax.apply(this,[t,r,a.alts,s])}return o=Wu(t,e,n,o),o}function Ax(t,e,n,r){const i=[];for(let c=1;c<=e;c++)i.push(this.LA(c).tokenType);const s=t.atnStartState,a=s.rule,o=s.production,u=Ex({topLevelRule:a,ambiguityIndices:n,production:o,prefixPath:i});r(u)}function Ex(t){const e=st(t.prefixPath,i=>sn(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${Rx(t.production)}${n}> inside <${t.topLevelRule.name}> Rule,
|
|
111
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
112
|
+
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
113
|
+
For Further details.`,r}function Rx(t){if(t instanceof le)return"SUBRULE";if(t instanceof re)return"OPTION";if(t instanceof ye)return"OR";if(t instanceof Re)return"AT_LEAST_ONE";if(t instanceof $e)return"AT_LEAST_ONE_SEP";if(t instanceof me)return"MANY_SEP";if(t instanceof V)return"MANY";if(t instanceof H)return"CONSUME";throw Error("non exhaustive match")}function $x(t,e,n){const r=zh(e.configs.elements,s=>s.state.transitions),i=Kh(r.filter(s=>s instanceof za).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function Sx(t,e){return t.edges[e.tokenTypeIdx]}function _x(t,e,n){const r=new Ls,i=[];for(const a of t.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===gr){i.push(a);continue}const o=a.state.transitions.length;for(let u=0;u<o;u++){const c=a.state.transitions[u],l=Ix(c,e);l!==void 0&&r.add({state:l,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new Ls;for(const a of r.elements)Yr(a,s)}if(i.length>0&&!Nx(s))for(const a of i)s.add(a);return s}function Ix(t,e){if(t instanceof za&&Ad(e,t.tokenType))return t.target}function xx(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function qd(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function Wu(t,e,n,r){return r=Yd(t,r),e.edges[n.tokenTypeIdx]=r,r}function Yd(t,e){if(e===qr)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function Cx(t){const e=new Ls,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};Yr(s,e)}return e}function Yr(t,e){const n=t.state;if(n.type===gr){if(t.stack.length>0){const i=[...t.stack],a={state:i.pop(),alt:t.alt,stack:i};Yr(a,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i<r;i++){const s=n.transitions[i],a=wx(t,s);a!==void 0&&Yr(a,e)}}function wx(t,e){if(e instanceof jd)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Ka){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function Nx(t){for(const e of t.elements)if(e.state.type===gr)return!0;return!1}function bx(t){for(const e of t.elements)if(e.state.type!==gr)return!1;return!0}function kx(t){if(bx(t))return!0;const e=Ox(t.elements);return Px(e)&&!Lx(e)}function Ox(t){const e=new Map;for(const n of t){const r=Kd(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function Px(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function Lx(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var zu;(function(t){function e(n){return typeof n=="string"}t.is=e})(zu||(zu={}));var Ms;(function(t){function e(n){return typeof n=="string"}t.is=e})(Ms||(Ms={}));var Ku;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Ku||(Ku={}));var Xr;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Xr||(Xr={}));var D;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Xr.MAX_VALUE),i===Number.MAX_VALUE&&(i=Xr.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&p.uinteger(i.line)&&p.uinteger(i.character)}t.is=n})(D||(D={}));var L;(function(t){function e(r,i,s,a){if(p.uinteger(r)&&p.uinteger(i)&&p.uinteger(s)&&p.uinteger(a))return{start:D.create(r,i),end:D.create(s,a)};if(D.is(r)&&D.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${a}]`)}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&D.is(i.start)&&D.is(i.end)}t.is=n})(L||(L={}));var Jr;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.range)&&(p.string(i.uri)||p.undefined(i.uri))}t.is=n})(Jr||(Jr={}));var Vu;(function(t){function e(r,i,s,a){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.targetRange)&&p.string(i.targetUri)&&L.is(i.targetSelectionRange)&&(L.is(i.originSelectionRange)||p.undefined(i.originSelectionRange))}t.is=n})(Vu||(Vu={}));var Ds;(function(t){function e(r,i,s,a){return{red:r,green:i,blue:s,alpha:a}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.numberRange(i.red,0,1)&&p.numberRange(i.green,0,1)&&p.numberRange(i.blue,0,1)&&p.numberRange(i.alpha,0,1)}t.is=n})(Ds||(Ds={}));var qu;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&L.is(i.range)&&Ds.is(i.color)}t.is=n})(qu||(qu={}));var Yu;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.string(i.label)&&(p.undefined(i.textEdit)||hn.is(i))&&(p.undefined(i.additionalTextEdits)||p.typedArray(i.additionalTextEdits,hn.is))}t.is=n})(Yu||(Yu={}));var Xu;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(Xu||(Xu={}));var Ju;(function(t){function e(r,i,s,a,o,u){const c={startLine:r,endLine:i};return p.defined(s)&&(c.startCharacter=s),p.defined(a)&&(c.endCharacter=a),p.defined(o)&&(c.kind=o),p.defined(u)&&(c.collapsedText=u),c}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.uinteger(i.startLine)&&p.uinteger(i.startLine)&&(p.undefined(i.startCharacter)||p.uinteger(i.startCharacter))&&(p.undefined(i.endCharacter)||p.uinteger(i.endCharacter))&&(p.undefined(i.kind)||p.string(i.kind))}t.is=n})(Ju||(Ju={}));var Fs;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&Jr.is(i.location)&&p.string(i.message)}t.is=n})(Fs||(Fs={}));var Qu;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Qu||(Qu={}));var Zu;(function(t){t.Unnecessary=1,t.Deprecated=2})(Zu||(Zu={}));var ec;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&p.string(r.href)}t.is=e})(ec||(ec={}));var Qr;(function(t){function e(r,i,s,a,o,u){let c={range:r,message:i};return p.defined(s)&&(c.severity=s),p.defined(a)&&(c.code=a),p.defined(o)&&(c.source=o),p.defined(u)&&(c.relatedInformation=u),c}t.create=e;function n(r){var i;let s=r;return p.defined(s)&&L.is(s.range)&&p.string(s.message)&&(p.number(s.severity)||p.undefined(s.severity))&&(p.integer(s.code)||p.string(s.code)||p.undefined(s.code))&&(p.undefined(s.codeDescription)||p.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(p.string(s.source)||p.undefined(s.source))&&(p.undefined(s.relatedInformation)||p.typedArray(s.relatedInformation,Fs.is))}t.is=n})(Qr||(Qr={}));var dn;(function(t){function e(r,i,...s){let a={title:r,command:i};return p.defined(s)&&s.length>0&&(a.arguments=s),a}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.title)&&p.string(i.command)}t.is=n})(dn||(dn={}));var hn;(function(t){function e(s,a){return{range:s,newText:a}}t.replace=e;function n(s,a){return{range:{start:s,end:s},newText:a}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const a=s;return p.objectLiteral(a)&&p.string(a.newText)&&L.is(a.range)}t.is=i})(hn||(hn={}));var Gs;(function(t){function e(r,i,s){const a={label:r};return i!==void 0&&(a.needsConfirmation=i),s!==void 0&&(a.description=s),a}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.string(i.label)&&(p.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(p.string(i.description)||i.description===void 0)}t.is=n})(Gs||(Gs={}));var pn;(function(t){function e(n){const r=n;return p.string(r)}t.is=e})(pn||(pn={}));var tc;(function(t){function e(s,a,o){return{range:s,newText:a,annotationId:o}}t.replace=e;function n(s,a,o){return{range:{start:s,end:s},newText:a,annotationId:o}}t.insert=n;function r(s,a){return{range:s,newText:"",annotationId:a}}t.del=r;function i(s){const a=s;return hn.is(a)&&(Gs.is(a.annotationId)||pn.is(a.annotationId))}t.is=i})(tc||(tc={}));var Us;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&zs.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(Us||(Us={}));var Bs;(function(t){function e(r,i,s){let a={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="create"&&p.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||pn.is(i.annotationId))}t.is=n})(Bs||(Bs={}));var js;(function(t){function e(r,i,s,a){let o={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(o.options=s),a!==void 0&&(o.annotationId=a),o}t.create=e;function n(r){let i=r;return i&&i.kind==="rename"&&p.string(i.oldUri)&&p.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||pn.is(i.annotationId))}t.is=n})(js||(js={}));var Hs;(function(t){function e(r,i,s){let a={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="delete"&&p.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||p.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||p.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||pn.is(i.annotationId))}t.is=n})(Hs||(Hs={}));var Ws;(function(t){function e(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>p.string(i.kind)?Bs.is(i)||js.is(i)||Hs.is(i):Us.is(i)))}t.is=e})(Ws||(Ws={}));var nc;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)}t.is=n})(nc||(nc={}));var rc;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&p.integer(i.version)}t.is=n})(rc||(rc={}));var zs;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&(i.version===null||p.integer(i.version))}t.is=n})(zs||(zs={}));var ic;(function(t){function e(r,i,s,a){return{uri:r,languageId:i,version:s,text:a}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&p.string(i.languageId)&&p.integer(i.version)&&p.string(i.text)}t.is=n})(ic||(ic={}));var Ks;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(Ks||(Ks={}));var jn;(function(t){function e(n){const r=n;return p.objectLiteral(n)&&Ks.is(r.kind)&&p.string(r.value)}t.is=e})(jn||(jn={}));var sc;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(sc||(sc={}));var ac;(function(t){t.PlainText=1,t.Snippet=2})(ac||(ac={}));var oc;(function(t){t.Deprecated=1})(oc||(oc={}));var uc;(function(t){function e(r,i,s){return{newText:r,insert:i,replace:s}}t.create=e;function n(r){const i=r;return i&&p.string(i.newText)&&L.is(i.insert)&&L.is(i.replace)}t.is=n})(uc||(uc={}));var cc;(function(t){t.asIs=1,t.adjustIndentation=2})(cc||(cc={}));var lc;(function(t){function e(n){const r=n;return r&&(p.string(r.detail)||r.detail===void 0)&&(p.string(r.description)||r.description===void 0)}t.is=e})(lc||(lc={}));var fc;(function(t){function e(n){return{label:n}}t.create=e})(fc||(fc={}));var dc;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(dc||(dc={}));var Zr;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return p.string(i)||p.objectLiteral(i)&&p.string(i.language)&&p.string(i.value)}t.is=n})(Zr||(Zr={}));var hc;(function(t){function e(n){let r=n;return!!r&&p.objectLiteral(r)&&(jn.is(r.contents)||Zr.is(r.contents)||p.typedArray(r.contents,Zr.is))&&(n.range===void 0||L.is(n.range))}t.is=e})(hc||(hc={}));var pc;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(pc||(pc={}));var gc;(function(t){function e(n,r,...i){let s={label:n};return p.defined(r)&&(s.documentation=r),p.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(gc||(gc={}));var mc;(function(t){t.Text=1,t.Read=2,t.Write=3})(mc||(mc={}));var yc;(function(t){function e(n,r){let i={range:n};return p.number(r)&&(i.kind=r),i}t.create=e})(yc||(yc={}));var Tc;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(Tc||(Tc={}));var vc;(function(t){t.Deprecated=1})(vc||(vc={}));var Ac;(function(t){function e(n,r,i,s,a){let o={name:n,kind:r,location:{uri:s,range:i}};return a&&(o.containerName=a),o}t.create=e})(Ac||(Ac={}));var Ec;(function(t){function e(n,r,i,s){return s!==void 0?{name:n,kind:r,location:{uri:i,range:s}}:{name:n,kind:r,location:{uri:i}}}t.create=e})(Ec||(Ec={}));var Rc;(function(t){function e(r,i,s,a,o,u){let c={name:r,detail:i,kind:s,range:a,selectionRange:o};return u!==void 0&&(c.children=u),c}t.create=e;function n(r){let i=r;return i&&p.string(i.name)&&p.number(i.kind)&&L.is(i.range)&&L.is(i.selectionRange)&&(i.detail===void 0||p.string(i.detail))&&(i.deprecated===void 0||p.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(Rc||(Rc={}));var $c;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})($c||($c={}));var ei;(function(t){t.Invoked=1,t.Automatic=2})(ei||(ei={}));var Sc;(function(t){function e(r,i,s){let a={diagnostics:r};return i!=null&&(a.only=i),s!=null&&(a.triggerKind=s),a}t.create=e;function n(r){let i=r;return p.defined(i)&&p.typedArray(i.diagnostics,Qr.is)&&(i.only===void 0||p.typedArray(i.only,p.string))&&(i.triggerKind===void 0||i.triggerKind===ei.Invoked||i.triggerKind===ei.Automatic)}t.is=n})(Sc||(Sc={}));var _c;(function(t){function e(r,i,s){let a={title:r},o=!0;return typeof i=="string"?(o=!1,a.kind=i):dn.is(i)?a.command=i:a.edit=i,o&&s!==void 0&&(a.kind=s),a}t.create=e;function n(r){let i=r;return i&&p.string(i.title)&&(i.diagnostics===void 0||p.typedArray(i.diagnostics,Qr.is))&&(i.kind===void 0||p.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||dn.is(i.command))&&(i.isPreferred===void 0||p.boolean(i.isPreferred))&&(i.edit===void 0||Ws.is(i.edit))}t.is=n})(_c||(_c={}));var Ic;(function(t){function e(r,i){let s={range:r};return p.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return p.defined(i)&&L.is(i.range)&&(p.undefined(i.command)||dn.is(i.command))}t.is=n})(Ic||(Ic={}));var xc;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.uinteger(i.tabSize)&&p.boolean(i.insertSpaces)}t.is=n})(xc||(xc={}));var Cc;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return p.defined(i)&&L.is(i.range)&&(p.undefined(i.target)||p.string(i.target))}t.is=n})(Cc||(Cc={}));var wc;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(wc||(wc={}));var Nc;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(Nc||(Nc={}));var bc;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(bc||(bc={}));var kc;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}t.is=e})(kc||(kc={}));var Oc;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&p.string(i.text)}t.is=n})(Oc||(Oc={}));var Pc;(function(t){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&p.boolean(i.caseSensitiveLookup)&&(p.string(i.variableName)||i.variableName===void 0)}t.is=n})(Pc||(Pc={}));var Lc;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&(p.string(i.expression)||i.expression===void 0)}t.is=n})(Lc||(Lc={}));var Mc;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return p.defined(i)&&L.is(r.stoppedLocation)}t.is=n})(Mc||(Mc={}));var Vs;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(Vs||(Vs={}));var qs;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&(i.tooltip===void 0||p.string(i.tooltip)||jn.is(i.tooltip))&&(i.location===void 0||Jr.is(i.location))&&(i.command===void 0||dn.is(i.command))}t.is=n})(qs||(qs={}));var Dc;(function(t){function e(r,i,s){const a={position:r,label:i};return s!==void 0&&(a.kind=s),a}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&D.is(i.position)&&(p.string(i.label)||p.typedArray(i.label,qs.is))&&(i.kind===void 0||Vs.is(i.kind))&&i.textEdits===void 0||p.typedArray(i.textEdits,hn.is)&&(i.tooltip===void 0||p.string(i.tooltip)||jn.is(i.tooltip))&&(i.paddingLeft===void 0||p.boolean(i.paddingLeft))&&(i.paddingRight===void 0||p.boolean(i.paddingRight))}t.is=n})(Dc||(Dc={}));var Fc;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(Fc||(Fc={}));var Gc;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(Gc||(Gc={}));var Uc;(function(t){function e(n){return{items:n}}t.create=e})(Uc||(Uc={}));var Bc;(function(t){t.Invoked=0,t.Automatic=1})(Bc||(Bc={}));var jc;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(jc||(jc={}));var Hc;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(Hc||(Hc={}));var Wc;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&Ms.is(r.uri)&&p.string(r.name)}t.is=e})(Wc||(Wc={}));var zc;(function(t){function e(s,a,o,u){return new Mx(s,a,o,u)}t.create=e;function n(s){let a=s;return!!(p.defined(a)&&p.string(a.uri)&&(p.undefined(a.languageId)||p.string(a.languageId))&&p.uinteger(a.lineCount)&&p.func(a.getText)&&p.func(a.positionAt)&&p.func(a.offsetAt))}t.is=n;function r(s,a){let o=s.getText(),u=i(a,(l,f)=>{let d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d}),c=o.length;for(let l=u.length-1;l>=0;l--){let f=u[l],d=s.offsetAt(f.range.start),h=s.offsetAt(f.range.end);if(h<=c)o=o.substring(0,d)+f.newText+o.substring(h,o.length);else throw new Error("Overlapping edit");c=d}return o}t.applyEdits=r;function i(s,a){if(s.length<=1)return s;const o=s.length/2|0,u=s.slice(0,o),c=s.slice(o);i(u,a),i(c,a);let l=0,f=0,d=0;for(;l<u.length&&f<c.length;)a(u[l],c[f])<=0?s[d++]=u[l++]:s[d++]=c[f++];for(;l<u.length;)s[d++]=u[l++];for(;f<c.length;)s[d++]=c[f++];return s}})(zc||(zc={}));let Mx=class{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(i);r=s==="\r"||s===`
|
|
114
|
+
`,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
|
|
115
|
+
`&&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return D.create(0,e);for(;r<i;){let a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}let s=r-1;return D.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var p;(function(t){const e=Object.prototype.toString;function n(h){return typeof h<"u"}t.defined=n;function r(h){return typeof h>"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function a(h){return e.call(h)==="[object Number]"}t.number=a;function o(h,g,m){return e.call(h)==="[object Number]"&&g<=h&&h<=m}t.numberRange=o;function u(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=u;function c(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=c;function l(h){return e.call(h)==="[object Function]"}t.func=l;function f(h){return h!==null&&typeof h=="object"}t.objectLiteral=f;function d(h,g){return Array.isArray(h)&&h.every(g)}t.typedArray=d})(p||(p={}));class Dx{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new Jd(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new Ya;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new Ys(e.startOffset,e.image.length,ps(e),e.tokenType,!1);return r.grammarSource=n,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const n=e.container;if(n){const r=n.content.indexOf(e);r>=0&&n.content.splice(r,1)}}construct(e){const n=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=n;const r=this.nodeStack.pop();(r==null?void 0:r.content.length)===0&&this.removeNode(r)}addHiddenTokens(e){for(const n of e){const r=new Ys(n.startOffset,n.image.length,ps(n),n.tokenType,!0);r.root=this.rootNode,this.addHiddenToken(this.rootNode,r)}}addHiddenToken(e,n){const{offset:r,end:i}=n;for(let s=0;s<e.content.length;s++){const a=e.content[s],{offset:o,end:u}=a;if(an(a)&&r>o&&i<u){this.addHiddenToken(a,n);return}else if(i<=o){e.content.splice(s,0,n);return}}e.content.push(n)}}class Xd{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,n;const r=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(n=this.container)===null||n===void 0?void 0:n.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class Ys extends Xd{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,n,r,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=n,this._range=r}}class Ya extends Xd{constructor(){super(...arguments),this.content=new Xa(this)}get children(){return this.content}get offset(){var e,n;return(n=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&n!==void 0?n:0}get length(){return this.end-this.offset}get end(){var e,n;return(n=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:0}get range(){const e=this.firstNonHiddenNode,n=this.lastNonHiddenNode;if(e&&n){if(this._rangeCache===void 0){const{range:r}=e,{range:i}=n;this._rangeCache={start:r.start,end:i.end.line<r.start.line?r.start:i.end}}return this._rangeCache}else return{start:D.create(0,0),end:D.create(0,0)}}get firstNonHiddenNode(){for(const e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){const n=this.content[e];if(!n.hidden)return n}return this.content[this.content.length-1]}}class Xa extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,Xa.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,n,...r){return this.addParents(r),super.splice(e,n,...r)}addParents(e){for(const n of e)n.container=this.parent}}class Jd extends Ya{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const Xs=Symbol("Datatype");function us(t){return t.$type===Xs}const Kc="",Qd=t=>t.endsWith(Kc)?t:t+Kc;class Zd{constructor(e){this._unorderedGroups=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition;this.wrapper=new jx(n,Object.assign(Object.assign({},e.parser.ParserConfig),{errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,n){this.wrapper.wrapOr(e,n)}optional(e,n){this.wrapper.wrapOption(e,n)}many(e,n){this.wrapper.wrapMany(e,n)}atLeastOne(e,n){this.wrapper.wrapAtLeastOne(e,n)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class Fx extends Zd{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Dx,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,n){const r=e.fragment?void 0:fa(e)?Xs:di(e),i=this.wrapper.DEFINE_RULE(Qd(e.name),this.startImplementation(r,n).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);const n=this.lexer.tokenize(e);this.wrapper.input=n.tokens;const r=this.mainRule.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(n.hidden),this.unorderedGroups.clear(),{value:r,lexerErrors:n.errors,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{if(!this.isRecording()){const s={$type:e};this.stack.push(s),e===Xs&&(s.value="")}let i;try{i=n(r)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.nodeBuilder.buildLeafNode(i,r),{assignment:a,isCrossRef:o}=this.getAssignment(r),u=this.current;if(a){const c=Gt(r)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,c,s,o)}else if(us(u)){let c=i.image;Gt(r)||(c=this.converter.convert(c,s).toString()),u.value+=c}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i){let s;this.isRecording()||(s=this.nodeBuilder.buildCompositeNode(r));const a=this.wrapper.wrapSubrule(e,n,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(a,r,s)}performSubruleAssignment(e,n,r){const{assignment:i,isCrossRef:s}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,e,r,s);else if(!i){const a=this.current;if(us(a))a.value+=e.toString();else if(typeof e=="object"&&e){const o=e.$type,u=this.assignWithoutOverride(e,a);o&&(u.$type=o);const c=u;this.stack.pop(),this.stack.push(c)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(!r.$cstNode&&n.feature&&n.operator){r=this.construct(!1);const s=r.$cstNode.feature;this.nodeBuilder.buildCompositeNode(s)}const i={$type:e};this.stack.pop(),this.stack.push(i),n.feature&&n.operator&&this.assign(n.operator,n.feature,r,r.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;const n=this.current;return wp(n),this.nodeBuilder.construct(n),e&&this.stack.pop(),us(n)?this.converter.convert(n.value,n.$cstNode):(bp(this.astReflection,n),n)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=ci(e,Ft);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?oa(n.terminal):!1})}return this.assignmentMap.get(e)}assign(e,n,r,i,s){const a=this.current;let o;switch(s&&typeof r=="string"?o=this.linker.buildReference(a,n,i,r):o=r,e){case"=":{a[n]=o;break}case"?=":{a[n]=!0;break}case"+=":Array.isArray(a[n])||(a[n]=[]),a[n].push(o)}}assignWithoutOverride(e,n){for(const[r,i]of Object.entries(n)){const s=e[r];s===void 0?e[r]=i:Array.isArray(s)&&Array.isArray(i)&&(i.push(...s),e[r]=i)}return e}get definitionErrors(){return this.wrapper.definitionErrors}}class Gx{buildMismatchTokenMessage(e){return tn.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return tn.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return tn.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return tn.buildEarlyExitMessage(e)}}class eh extends Gx{buildMismatchTokenMessage({expected:e,actual:n}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class Ux extends Zd{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const n=this.lexer.tokenize(e);return this.tokens=n.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,n){const r=this.wrapper.DEFINE_RULE(Qd(e.name),this.startImplementation(n).bind(this));return e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return n=>{const r=this.keepStackSize();try{e(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,n,r){this.wrapper.wrapConsume(e,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,n,r,i){this.before(r),this.wrapper.wrapSubrule(e,n,i),this.after(r)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){const n=this.elementStack.lastIndexOf(e);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}}const Bx={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new eh};class jx extends YI{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},Bx),{lookaheadStrategy:r?new Ha({maxLookahead:n.maxLookahead}):new mx}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n){return this.RULE(e,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n)}wrapSubrule(e,n,r){return this.subrule(e,n,{ARGS:[r]})}wrapOr(e,n){this.or(e,n)}wrapOption(e,n){this.option(e,n)}wrapMany(e,n){this.many(e,n)}wrapAtLeastOne(e,n){this.atLeastOne(e,n)}}function th(t,e,n){return Hx({parser:e,tokens:n,rules:new Map,ruleNames:new Map},t),e}function Hx(t,e){const n=tf(e,!1),r=ne(e.rules).filter(we).filter(i=>n.has(i));for(const i of r){const s=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});s.rules.set(i.name,t.parser.rule(i,Wt(s,i.definition)))}}function Wt(t,e,n=!1){let r;if(Gt(e))r=Xx(t,e);else if(ui(e))r=Wx(t,e);else if(Ft(e))r=Wt(t,e.terminal);else if(oa(e))r=nh(t,e);else if(Ut(e))r=zx(t,e);else if(Pl(e))r=Vx(t,e);else if(ql(e))r=qx(t,e);else if(ua(e))r=Yx(t,e);else if(Ep(e)){const i=t.consume++;r=()=>t.parser.consume(i,xt,e)}else throw new yl(e.$cstNode,`Unexpected element type: ${e.$type}`);return rh(t,n?void 0:ti(e),r,e.cardinality)}function Wx(t,e){const n=di(e);return()=>t.parser.action(n,e)}function zx(t,e){const n=e.rule.ref;if(we(n)){const r=t.subrule++,i=e.arguments.length>0?Kx(n,e.arguments):()=>({});return s=>t.parser.subrule(r,ih(t,n),e,i(s))}else if(zt(n)){const r=t.consume++,i=Js(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)oi();else throw new yl(e.$cstNode,`Undefined rule type: ${e.$type}`)}function Kx(t,e){const n=e.map(r=>it(r.value));return r=>{const i={};for(let s=0;s<n.length;s++){const a=t.parameters[s],o=n[s];i[a.name]=o(r)}return i}}function it(t){if(up(t)){const e=it(t.left),n=it(t.right);return r=>e(r)||n(r)}else if(op(t)){const e=it(t.left),n=it(t.right);return r=>e(r)&&n(r)}else if(lp(t)){const e=it(t.value);return n=>!e(n)}else if(hp(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(ap(t)){const e=!!t.true;return()=>e}oi()}function Vx(t,e){if(e.elements.length===1)return Wt(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:Wt(t,i,!0)},a=ti(i);a&&(s.GATE=it(a)),n.push(s)}const r=t.or++;return i=>t.parser.alternatives(r,n.map(s=>{const a={ALT:()=>s.ALT(i)},o=s.GATE;return o&&(a.GATE=()=>o(i)),a}))}}function qx(t,e){if(e.elements.length===1)return Wt(t,e.elements[0]);const n=[];for(const o of e.elements){const u={ALT:Wt(t,o,!0)},c=ti(o);c&&(u.GATE=it(c)),n.push(u)}const r=t.or++,i=(o,u)=>{const c=u.getRuleStack().join("-");return`uGroup_${o}_${c}`},s=o=>t.parser.alternatives(r,n.map((u,c)=>{const l={ALT:()=>!0},f=t.parser;l.ALT=()=>{if(u.ALT(o),!f.isRecording()){const h=i(r,f);f.unorderedGroups.get(h)||f.unorderedGroups.set(h,[]);const g=f.unorderedGroups.get(h);typeof(g==null?void 0:g[c])>"u"&&(g[c]=!0)}};const d=u.GATE;return d?l.GATE=()=>d(o):l.GATE=()=>{const h=f.unorderedGroups.get(i(r,f));return!(h!=null&&h[c])},l})),a=rh(t,ti(e),s,"*");return o=>{a(o),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function Yx(t,e){const n=e.elements.map(r=>Wt(t,r));return r=>n.forEach(i=>i(r))}function ti(t){if(ua(t))return t.guardCondition}function nh(t,e,n=e.terminal){if(n)if(Ut(n)&&we(n.rule.ref)){const r=t.subrule++;return i=>t.parser.subrule(r,ih(t,n.rule.ref),e,i)}else if(Ut(n)&&zt(n.rule.ref)){const r=t.consume++,i=Js(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(Gt(n)){const r=t.consume++,i=Js(t,n.value);return()=>t.parser.consume(r,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=sf(e.type.ref),i=r==null?void 0:r.terminal;if(!i)throw new Error("Could not find name assignment for type: "+di(e.type.ref));return nh(t,e,i)}}function Xx(t,e){const n=t.consume++,r=t.tokens[e.value];if(!r)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(n,r,e)}function rh(t,e,n,r){const i=e&&it(e);if(!r)if(i){const s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>n(a),GATE:()=>i(a)},{ALT:Bu(),GATE:()=>!i(a)}])}else return n;if(r==="*"){const s=t.many++;return a=>t.parser.many(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else if(r==="+"){const s=t.many++;if(i){const a=t.or++;return o=>t.parser.alternatives(a,[{ALT:()=>t.parser.atLeastOne(s,{DEF:()=>n(o)}),GATE:()=>i(o)},{ALT:Bu(),GATE:()=>!i(o)}])}else return a=>t.parser.atLeastOne(s,{DEF:()=>n(a)})}else if(r==="?"){const s=t.optional++;return a=>t.parser.optional(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else oi()}function ih(t,e){const n=Jx(t,e),r=t.rules.get(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Jx(t,e){if(we(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!we(r);)(ua(r)||Pl(r)||ql(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,t.ruleNames.set(e,i),i}}function Js(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function Qx(t){const e=t.Grammar,n=t.parser.Lexer,r=new Ux(t);return th(e,r,n.definition),r.finalize(),r}function Zx(t){const e=eC(t);return e.finalize(),e}function eC(t){const e=t.Grammar,n=t.parser.Lexer,r=new Fx(t);return th(e,r,n.definition)}class sh{buildTokens(e,n){const r=ne(tf(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return i.forEach(a=>{const o=a.PATTERN;typeof o=="object"&&o&&"test"in o&&po(o)?s.unshift(a):s.push(a)}),s}buildTerminalTokens(e){return e.filter(zt).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=da(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=po(n)?de.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){const n=new RegExp(e,e.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(e,n,r){return e.filter(we).flatMap(i=>ir(i).filter(Gt)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!(r!=null&&r.caseInsensitive)))}buildKeywordToken(e,n,r){return{name:e.value,PATTERN:this.buildKeywordPattern(e,r),LONGER_ALT:this.findLongerAlt(e,n)}}buildKeywordPattern(e,n){return n?new RegExp(Gp(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i==null?void 0:i.PATTERN;return s!=null&&s.source&&Up("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class ah{convert(e,n){let r=n.grammarSource;if(oa(r)&&(r=Wp(r)),Ut(r)){const i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,n)}return e}runConverter(e,n,r){var i;switch(e.name.toUpperCase()){case"INT":return rt.convertInt(n);case"STRING":return rt.convertString(n);case"ID":return rt.convertID(n)}switch((i=Jp(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return rt.convertNumber(n);case"boolean":return rt.convertBoolean(n);case"bigint":return rt.convertBigint(n);case"date":return rt.convertDate(n);default:return n}}}var rt;(function(t){function e(c){let l="";for(let f=1;f<c.length-1;f++){const d=c.charAt(f);if(d==="\\"){const h=c.charAt(++f);l+=n(h)}else l+=d}return l}t.convertString=e;function n(c){switch(c){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
116
|
+
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return c}}function r(c){return c.charAt(0)==="^"?c.substring(1):c}t.convertID=r;function i(c){return parseInt(c)}t.convertInt=i;function s(c){return BigInt(c)}t.convertBigint=s;function a(c){return new Date(c)}t.convertDate=a;function o(c){return Number(c)}t.convertNumber=o;function u(c){return c.toLowerCase()==="true"}t.convertBoolean=u})(rt||(rt={}));var Hn={},ji={};Object.defineProperty(ji,"__esModule",{value:!0});let Qs;function Zs(){if(Qs===void 0)throw new Error("No runtime abstraction layer installed");return Qs}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");Qs=n}t.install=e})(Zs||(Zs={}));ji.default=Zs;var ue={};Object.defineProperty(ue,"__esModule",{value:!0});ue.stringArray=ue.array=ue.func=ue.error=ue.number=ue.string=ue.boolean=void 0;function tC(t){return t===!0||t===!1}ue.boolean=tC;function oh(t){return typeof t=="string"||t instanceof String}ue.string=oh;function nC(t){return typeof t=="number"||t instanceof Number}ue.number=nC;function rC(t){return t instanceof Error}ue.error=rC;function iC(t){return typeof t=="function"}ue.func=iC;function uh(t){return Array.isArray(t)}ue.array=uh;function sC(t){return uh(t)&&t.every(e=>oh(e))}ue.stringArray=sC;var gn={};Object.defineProperty(gn,"__esModule",{value:!0});gn.Emitter=gn.Event=void 0;const aC=ji;var Vc;(function(t){const e={dispose(){}};t.None=function(){return e}})(Vc||(gn.Event=Vc={}));class oC{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,a=r.length;s<a;s++)try{n.push(r[s].apply(i[s],e))}catch(o){(0,aC.default)().console.error(o)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class Hi{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new oC),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=Hi._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}gn.Emitter=Hi;Hi._noop=function(){};var ee;Object.defineProperty(Hn,"__esModule",{value:!0});var ea=Hn.CancellationTokenSource=ee=Hn.CancellationToken=void 0;const uC=ji,cC=ue,ta=gn;var ni;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ta.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ta.Event.None});function e(n){const r=n;return r&&(r===t.None||r===t.Cancelled||cC.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(ni||(ee=Hn.CancellationToken=ni={}));const lC=Object.freeze(function(t,e){const n=(0,uC.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}});class qc{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?lC:(this._emitter||(this._emitter=new ta.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class fC{get token(){return this._token||(this._token=new qc),this._token}cancel(){this._token?this._token.cancel():this._token=ni.Cancelled}dispose(){this._token?this._token instanceof qc&&this._token.dispose():this._token=ni.None}}ea=Hn.CancellationTokenSource=fC;function dC(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let Yc=0,hC=10;const ri=Symbol("OperationCancelled");function Ja(t){return t===ri}async function Fe(t){if(t===ee.None)return;const e=Date.now();if(e-Yc>=hC&&(Yc=e,await dC()),t.isCancellationRequested)throw ri}class Qa{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class Wn{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(const r of e)if(Wn.isIncremental(r)){const i=lh(r.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(a,this._content.length);const o=Math.max(i.start.line,0),u=Math.max(i.end.line,0);let c=this._lineOffsets;const l=Xc(r.text,!1,s);if(u-o===l.length)for(let d=0,h=l.length;d<h;d++)c[d+o+1]=l[d];else l.length<1e4?c.splice(o+1,u-o,...l):this._lineOffsets=c=c.slice(0,o+1).concat(l,c.slice(u+1));const f=r.text.length-(a-s);if(f!==0)for(let d=o+1+l.length,h=c.length;d<h;d++)c[d]=c[d]+f}else if(Wn.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=Xc(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const n=this.getLineOffsets();let r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){const a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}const s=r-1;return e=this.ensureBeforeEOL(e,n[s]),{line:s,character:e-n[s]}}offsetAt(e){const n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;const r=n[e.line];if(e.character<=0)return r;const i=e.line+1<n.length?n[e.line+1]:this._content.length,s=Math.min(r+e.character,i);return this.ensureBeforeEOL(s,r)}ensureBeforeEOL(e,n){for(;e>n&&ch(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var na;(function(t){function e(i,s,a,o){return new Wn(i,s,a,o)}t.create=e;function n(i,s,a){if(i instanceof Wn)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){const a=i.getText(),o=ra(s.map(pC),(l,f)=>{const d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d});let u=0;const c=[];for(const l of o){const f=i.offsetAt(l.range.start);if(f<u)throw new Error("Overlapping edit");f>u&&c.push(a.substring(u,f)),l.newText.length&&c.push(l.newText),u=i.offsetAt(l.range.end)}return c.push(a.substr(u)),c.join("")}t.applyEdits=r})(na||(na={}));function ra(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);ra(r,e),ra(i,e);let s=0,a=0,o=0;for(;s<r.length&&a<i.length;)e(r[s],i[a])<=0?t[o++]=r[s++]:t[o++]=i[a++];for(;s<r.length;)t[o++]=r[s++];for(;a<i.length;)t[o++]=i[a++];return t}function Xc(t,e,n=0){const r=e?[n]:[];for(let i=0;i<t.length;i++){const s=t.charCodeAt(i);ch(s)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function ch(t){return t===13||t===10}function lh(t){const e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function pC(t){const e=lh(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var fh;(()=>{var t={470:i=>{function s(u){if(typeof u!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(u))}function a(u,c){for(var l,f="",d=0,h=-1,g=0,m=0;m<=u.length;++m){if(m<u.length)l=u.charCodeAt(m);else{if(l===47)break;l=47}if(l===47){if(!(h===m-1||g===1))if(h!==m-1&&g===2){if(f.length<2||d!==2||f.charCodeAt(f.length-1)!==46||f.charCodeAt(f.length-2)!==46){if(f.length>2){var T=f.lastIndexOf("/");if(T!==f.length-1){T===-1?(f="",d=0):d=(f=f.slice(0,T)).length-1-f.lastIndexOf("/"),h=m,g=0;continue}}else if(f.length===2||f.length===1){f="",d=0,h=m,g=0;continue}}c&&(f.length>0?f+="/..":f="..",d=2)}else f.length>0?f+="/"+u.slice(h+1,m):f=u.slice(h+1,m),d=m-h-1;h=m,g=0}else l===46&&g!==-1?++g:g=-1}return f}var o={resolve:function(){for(var u,c="",l=!1,f=arguments.length-1;f>=-1&&!l;f--){var d;f>=0?d=arguments[f]:(u===void 0&&(u=process.cwd()),d=u),s(d),d.length!==0&&(c=d+"/"+c,l=d.charCodeAt(0)===47)}return c=a(c,!l),l?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(u){if(s(u),u.length===0)return".";var c=u.charCodeAt(0)===47,l=u.charCodeAt(u.length-1)===47;return(u=a(u,!c)).length!==0||c||(u="."),u.length>0&&l&&(u+="/"),c?"/"+u:u},isAbsolute:function(u){return s(u),u.length>0&&u.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var u,c=0;c<arguments.length;++c){var l=arguments[c];s(l),l.length>0&&(u===void 0?u=l:u+="/"+l)}return u===void 0?".":o.normalize(u)},relative:function(u,c){if(s(u),s(c),u===c||(u=o.resolve(u))===(c=o.resolve(c)))return"";for(var l=1;l<u.length&&u.charCodeAt(l)===47;++l);for(var f=u.length,d=f-l,h=1;h<c.length&&c.charCodeAt(h)===47;++h);for(var g=c.length-h,m=d<g?d:g,T=-1,y=0;y<=m;++y){if(y===m){if(g>m){if(c.charCodeAt(h+y)===47)return c.slice(h+y+1);if(y===0)return c.slice(h+y)}else d>m&&(u.charCodeAt(l+y)===47?T=y:y===0&&(T=0));break}var E=u.charCodeAt(l+y);if(E!==c.charCodeAt(h+y))break;E===47&&(T=y)}var v="";for(y=l+T+1;y<=f;++y)y!==f&&u.charCodeAt(y)!==47||(v.length===0?v+="..":v+="/..");return v.length>0?v+c.slice(h+T):(h+=T,c.charCodeAt(h)===47&&++h,c.slice(h))},_makeLong:function(u){return u},dirname:function(u){if(s(u),u.length===0)return".";for(var c=u.charCodeAt(0),l=c===47,f=-1,d=!0,h=u.length-1;h>=1;--h)if((c=u.charCodeAt(h))===47){if(!d){f=h;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":u.slice(0,f)},basename:function(u,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');s(u);var l,f=0,d=-1,h=!0;if(c!==void 0&&c.length>0&&c.length<=u.length){if(c.length===u.length&&c===u)return"";var g=c.length-1,m=-1;for(l=u.length-1;l>=0;--l){var T=u.charCodeAt(l);if(T===47){if(!h){f=l+1;break}}else m===-1&&(h=!1,m=l+1),g>=0&&(T===c.charCodeAt(g)?--g==-1&&(d=l):(g=-1,d=m))}return f===d?d=m:d===-1&&(d=u.length),u.slice(f,d)}for(l=u.length-1;l>=0;--l)if(u.charCodeAt(l)===47){if(!h){f=l+1;break}}else d===-1&&(h=!1,d=l+1);return d===-1?"":u.slice(f,d)},extname:function(u){s(u);for(var c=-1,l=0,f=-1,d=!0,h=0,g=u.length-1;g>=0;--g){var m=u.charCodeAt(g);if(m!==47)f===-1&&(d=!1,f=g+1),m===46?c===-1?c=g:h!==1&&(h=1):c!==-1&&(h=-1);else if(!d){l=g+1;break}}return c===-1||f===-1||h===0||h===1&&c===f-1&&c===l+1?"":u.slice(c,f)},format:function(u){if(u===null||typeof u!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof u);return function(c,l){var f=l.dir||l.root,d=l.base||(l.name||"")+(l.ext||"");return f?f===l.root?f+d:f+"/"+d:d}(0,u)},parse:function(u){s(u);var c={root:"",dir:"",base:"",ext:"",name:""};if(u.length===0)return c;var l,f=u.charCodeAt(0),d=f===47;d?(c.root="/",l=1):l=0;for(var h=-1,g=0,m=-1,T=!0,y=u.length-1,E=0;y>=l;--y)if((f=u.charCodeAt(y))!==47)m===-1&&(T=!1,m=y+1),f===46?h===-1?h=y:E!==1&&(E=1):h!==-1&&(E=-1);else if(!T){g=y+1;break}return h===-1||m===-1||E===0||E===1&&h===m-1&&h===g+1?m!==-1&&(c.base=c.name=g===0&&d?u.slice(1,m):u.slice(g,m)):(g===0&&d?(c.name=u.slice(1,h),c.base=u.slice(1,m)):(c.name=u.slice(g,h),c.base=u.slice(g,m)),c.ext=u.slice(h,m)),g>0?c.dir=u.slice(0,g-1):d&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,i.exports=o}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}n.d=(i,s)=>{for(var a in s)n.o(s,a)&&!n.o(i,a)&&Object.defineProperty(i,a,{enumerable:!0,get:s[a]})},n.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),n.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var r={};(()=>{let i;n.r(r),n.d(r,{URI:()=>d,Utils:()=>Se}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,a=/^\//,o=/^\/\//;function u($,A){if(!$.scheme&&A)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${$.authority}", path: "${$.path}", query: "${$.query}", fragment: "${$.fragment}"}`);if($.scheme&&!s.test($.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if($.path){if($.authority){if(!a.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(o.test($.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const c="",l="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{constructor(A,R,_,P,k,b=!1){Tt(this,"scheme");Tt(this,"authority");Tt(this,"path");Tt(this,"query");Tt(this,"fragment");typeof A=="object"?(this.scheme=A.scheme||c,this.authority=A.authority||c,this.path=A.path||c,this.query=A.query||c,this.fragment=A.fragment||c):(this.scheme=function(ve,Q){return ve||Q?ve:"file"}(A,b),this.authority=R||c,this.path=function(ve,Q){switch(ve){case"https":case"http":case"file":Q?Q[0]!==l&&(Q=l+Q):Q=l}return Q}(this.scheme,_||c),this.query=P||c,this.fragment=k||c,u(this,b))}static isUri(A){return A instanceof d||!!A&&typeof A.authority=="string"&&typeof A.fragment=="string"&&typeof A.path=="string"&&typeof A.query=="string"&&typeof A.scheme=="string"&&typeof A.fsPath=="string"&&typeof A.with=="function"&&typeof A.toString=="function"}get fsPath(){return E(this)}with(A){if(!A)return this;let{scheme:R,authority:_,path:P,query:k,fragment:b}=A;return R===void 0?R=this.scheme:R===null&&(R=c),_===void 0?_=this.authority:_===null&&(_=c),P===void 0?P=this.path:P===null&&(P=c),k===void 0?k=this.query:k===null&&(k=c),b===void 0?b=this.fragment:b===null&&(b=c),R===this.scheme&&_===this.authority&&P===this.path&&k===this.query&&b===this.fragment?this:new g(R,_,P,k,b)}static parse(A,R=!1){const _=f.exec(A);return _?new g(_[2]||c,se(_[4]||c),se(_[5]||c),se(_[7]||c),se(_[9]||c),R):new g(c,c,c,c,c)}static file(A){let R=c;if(i&&(A=A.replace(/\\/g,l)),A[0]===l&&A[1]===l){const _=A.indexOf(l,2);_===-1?(R=A.substring(2),A=l):(R=A.substring(2,_),A=A.substring(_)||l)}return new g("file",R,A,c,c)}static from(A){const R=new g(A.scheme,A.authority,A.path,A.query,A.fragment);return u(R,!0),R}toString(A=!1){return v(this,A)}toJSON(){return this}static revive(A){if(A){if(A instanceof d)return A;{const R=new g(A);return R._formatted=A.external,R._fsPath=A._sep===h?A.fsPath:null,R}}return A}}const h=i?1:void 0;class g extends d{constructor(){super(...arguments);Tt(this,"_formatted",null);Tt(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=E(this)),this._fsPath}toString(R=!1){return R?v(this,!0):(this._formatted||(this._formatted=v(this,!1)),this._formatted)}toJSON(){const R={$mid:1};return this._fsPath&&(R.fsPath=this._fsPath,R._sep=h),this._formatted&&(R.external=this._formatted),this.path&&(R.path=this.path),this.scheme&&(R.scheme=this.scheme),this.authority&&(R.authority=this.authority),this.query&&(R.query=this.query),this.fragment&&(R.fragment=this.fragment),R}}const m={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 T($,A,R){let _,P=-1;for(let k=0;k<$.length;k++){const b=$.charCodeAt(k);if(b>=97&&b<=122||b>=65&&b<=90||b>=48&&b<=57||b===45||b===46||b===95||b===126||A&&b===47||R&&b===91||R&&b===93||R&&b===58)P!==-1&&(_+=encodeURIComponent($.substring(P,k)),P=-1),_!==void 0&&(_+=$.charAt(k));else{_===void 0&&(_=$.substr(0,k));const ve=m[b];ve!==void 0?(P!==-1&&(_+=encodeURIComponent($.substring(P,k)),P=-1),_+=ve):P===-1&&(P=k)}}return P!==-1&&(_+=encodeURIComponent($.substring(P))),_!==void 0?_:$}function y($){let A;for(let R=0;R<$.length;R++){const _=$.charCodeAt(R);_===35||_===63?(A===void 0&&(A=$.substr(0,R)),A+=m[_]):A!==void 0&&(A+=$[R])}return A!==void 0?A:$}function E($,A){let R;return R=$.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?$.path[1].toLowerCase()+$.path.substr(2):$.path,i&&(R=R.replace(/\//g,"\\")),R}function v($,A){const R=A?y:T;let _="",{scheme:P,authority:k,path:b,query:ve,fragment:Q}=$;if(P&&(_+=P,_+=":"),(k||P==="file")&&(_+=l,_+=l),k){let K=k.indexOf("@");if(K!==-1){const Pt=k.substr(0,K);k=k.substr(K+1),K=Pt.lastIndexOf(":"),K===-1?_+=R(Pt,!1,!1):(_+=R(Pt.substr(0,K),!1,!1),_+=":",_+=R(Pt.substr(K+1),!1,!0)),_+="@"}k=k.toLowerCase(),K=k.lastIndexOf(":"),K===-1?_+=R(k,!1,!0):(_+=R(k.substr(0,K),!1,!0),_+=k.substr(K))}if(b){if(b.length>=3&&b.charCodeAt(0)===47&&b.charCodeAt(2)===58){const K=b.charCodeAt(1);K>=65&&K<=90&&(b=`/${String.fromCharCode(K+32)}:${b.substr(3)}`)}else if(b.length>=2&&b.charCodeAt(1)===58){const K=b.charCodeAt(0);K>=65&&K<=90&&(b=`${String.fromCharCode(K+32)}:${b.substr(2)}`)}_+=R(b,!0,!1)}return ve&&(_+="?",_+=R(ve,!1,!1)),Q&&(_+="#",_+=A?Q:T(Q,!1,!1)),_}function S($){try{return decodeURIComponent($)}catch{return $.length>3?$.substr(0,3)+S($.substr(3)):$}}const O=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function se($){return $.match(O)?$.replace(O,A=>S(A)):$}var Le=n(470);const Te=Le.posix||Le,He="/";var Se;(function($){$.joinPath=function(A,...R){return A.with({path:Te.join(A.path,...R)})},$.resolvePath=function(A,...R){let _=A.path,P=!1;_[0]!==He&&(_=He+_,P=!0);let k=Te.resolve(_,...R);return P&&k[0]===He&&!A.authority&&(k=k.substring(1)),A.with({path:k})},$.dirname=function(A){if(A.path.length===0||A.path===He)return A;let R=Te.dirname(A.path);return R.length===1&&R.charCodeAt(0)===46&&(R=""),A.with({path:R})},$.basename=function(A){return Te.basename(A.path)},$.extname=function(A){return Te.extname(A.path)}})(Se||(Se={}))})(),fh=r})();const{URI:mn,Utils:Nn}=fh;var wt;(function(t){t.basename=Nn.basename,t.dirname=Nn.dirname,t.extname=Nn.extname,t.joinPath=Nn.joinPath,t.resolvePath=Nn.resolvePath;function e(r,i){return(r==null?void 0:r.toString())===(i==null?void 0:i.toString())}t.equals=e;function n(r,i){const s=typeof r=="string"?r:r.path,a=typeof i=="string"?i:i.path,o=s.split("/").filter(d=>d.length>0),u=a.split("/").filter(d=>d.length>0);let c=0;for(;c<o.length&&o[c]===u[c];c++);const l="../".repeat(o.length-c),f=u.slice(c).join("/");return l+f}t.relative=n})(wt||(wt={}));var W;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(W||(W={}));class gC{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=ee.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??mn.parse(e.uri),r?this.createAsync(n,e,r):this.create(n,e)}fromString(e,n,r){return r?this.createAsync(n,e,r):this.create(n,e)}fromModel(e,n){return this.create(n,{$model:e})}create(e,n){if(typeof n=="string"){const r=this.parse(e,n);return this.createLangiumDocument(r,e,void 0,n)}else if("$model"in n){const r={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(r,e)}else{const r=this.parse(e,n.getText());return this.createLangiumDocument(r,e,n)}}async createAsync(e,n,r){if(typeof n=="string"){const i=await this.parseAsync(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else{const i=await this.parseAsync(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}createLangiumDocument(e,n,r,i){let s;if(r)s={parseResult:e,uri:n,state:W.Parsed,references:[],textDocument:r};else{const a=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:W.Parsed,references:[],get textDocument(){return a()}}}return e.value.$document=s,s}async update(e,n){var r,i;const s=(r=e.parseResult.value.$cstNode)===null||r===void 0?void 0:r.root.fullText,a=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),o=a?a.getText():await this.fileSystemProvider.readFile(e.uri);if(a)Object.defineProperty(e,"textDocument",{value:a});else{const u=this.createTextDocumentGetter(e.uri,o);Object.defineProperty(e,"textDocument",{get:u})}return s!==o&&(e.parseResult=await this.parseAsync(e.uri,o,n),e.parseResult.value.$document=e),e.state=W.Parsed,e}parse(e,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(n)}parseAsync(e,n,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(n,r)}createTextDocumentGetter(e,n){const r=this.serviceRegistry;let i;return()=>i??(i=na.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class mC{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return ne(this.documentMap.values())}addDocument(e){const n=e.uri.toString();if(this.documentMap.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentMap.set(n,e)}getDocument(e){const n=e.toString();return this.documentMap.get(n)}async getOrCreateDocument(e,n){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,n),this.addDocument(r),r)}createDocument(e,n,r){if(r)return this.langiumDocumentFactory.fromString(n,e,r).then(i=>(this.addDocument(i),i));{const i=this.langiumDocumentFactory.fromString(n,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=W.Changed,r.precomputedScopes=void 0,r.references=[],r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=W.Changed,this.documentMap.delete(n)),r}}class yC{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,n=ee.None){for(const r of nn(e.parseResult.value))await Fe(n),Ql(r).forEach(i=>this.doLink(i,e))}doLink(e,n){const r=e.reference;if(r._ref===void 0)try{const i=this.getCandidate(e);if(Sr(i))r._ref=i;else if(r._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){const s=this.loadAstNode(i);r._ref=s??this.createLinkingError(e,i)}}catch(i){r._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${r.$refText}': ${i}`})}n.references.push(r)}unlink(e){for(const n of e.references)delete n._ref,delete n._nodeDescription;e.references=[]}getCandidate(e){const r=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return r??this.createLinkingError(e)}buildReference(e,n,r,i){const s=this,a={$refNode:r,$refText:i,get ref(){var o;if(ce(this._ref))return this._ref;if(Vh(this._nodeDescription)){const u=s.loadAstNode(this._nodeDescription);this._ref=u??s.createLinkingError({reference:a,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){const u=s.getLinkedNode({reference:a,container:e,property:n});if(u.error&&qe(e).state<W.ComputedScopes)return;this._ref=(o=u.node)!==null&&o!==void 0?o:u.error,this._nodeDescription=u.descr}return ce(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Sr(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){try{const n=this.getCandidate(e);if(Sr(n))return{error:n};const r=this.loadAstNode(n);return r?{node:r,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${n}`})}}}loadAstNode(e){if(e.node)return e.node;const n=this.langiumDocuments().getDocument(e.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,e.path)}createLinkingError(e,n){const r=qe(e.container);r.state<W.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);const i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:n})}}function TC(t){return typeof t.name=="string"}class vC{getName(e){if(TC(e))return e.name}getNameNode(e){return rf(e.$cstNode,"name")}}class AC{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const n=Yp(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(ze(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(ze(s)&&s.$refNode&&s.$refNode.offset<=e.offset&&s.$refNode.end>=e.end)return s.ref}}if(r){const i=this.nameProvider.getNameNode(r);if(i&&(i===e||Xh(e,i)))return r}}}findDeclarationNode(e){const n=this.findDeclaration(e);if(n!=null&&n.$cstNode){const r=this.nameProvider.getNameNode(n);return r??n.$cstNode}}findReferences(e,n){const r=[];if(n.includeDeclaration){const s=this.getReferenceToSelf(e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>wt.equals(s.sourceUri,n.documentUri))),r.push(...i),ne(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=qe(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:kr(n),local:!0}}}}class Za{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return ds.sum(ne(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,n){if(n===void 0)return this.map.delete(e);{const r=this.map.get(e);if(r){const i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(e):r.splice(i,1),!0}return!1}}get(e){var n;return(n=this.map.get(e))!==null&&n!==void 0?n:[]}has(e,n){if(n===void 0)return this.map.has(e);{const r=this.map.get(e);return r?r.indexOf(n)>=0:!1}}add(e,n){return this.map.has(e)?this.map.get(e).push(n):this.map.set(e,[n]),this}addAll(e,n){return this.map.has(e)?this.map.get(e).push(...n):this.map.set(e,Array.from(n)),this}forEach(e){this.map.forEach((n,r)=>n.forEach(i=>e(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ne(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return ne(this.map.keys())}values(){return ne(this.map.values()).flat()}entriesGroupedByKey(){return ne(this.map.entries())}}class Jc{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[n,r]of e)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,n){return this.map.set(e,n),this.inverse.set(n,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const n=this.map.get(e);return n!==void 0?(this.map.delete(e),this.inverse.delete(n),!0):!1}}class EC{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=ee.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=ca,i=ee.None){const s=[];this.exportNode(e,s,n);for(const a of r(e))await Fe(i),this.exportNode(a,s,n);return s}exportNode(e,n,r){const i=this.nameProvider.getName(e);i&&n.push(this.descriptions.createDescription(e,i,r))}async computeLocalScopes(e,n=ee.None){const r=e.parseResult.value,i=new Za;for(const s of ir(r))await Fe(n),this.processNode(s,e,i);return i}processNode(e,n,r){const i=e.$container;if(i){const s=this.nameProvider.getName(e);s&&r.add(i,this.descriptions.createDescription(e,s,n))}}}class Qc{constructor(e,n,r){var i;this.elements=e,this.outerScope=n,this.caseInsensitive=(i=r==null?void 0:r.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const n=this.caseInsensitive?this.elements.find(r=>r.name.toLowerCase()===e.toLowerCase()):this.elements.find(r=>r.name===e);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}}class RC{constructor(e,n,r){var i;this.elements=new Map,this.caseInsensitive=(i=r==null?void 0:r.caseInsensitive)!==null&&i!==void 0?i:!1;for(const s of e){const a=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(a,s)}this.outerScope=n}getElement(e){const n=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(n);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=ne(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class dh{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class $C extends dh{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,n){this.throwIfDisposed(),this.cache.set(e,n)}get(e,n){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(n){const r=n();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class SC extends dh{constructor(e){super(),this.cache=new Map,this.converter=e??(n=>n)}has(e,n){return this.throwIfDisposed(),this.cacheForContext(e).has(n)}set(e,n,r){this.throwIfDisposed(),this.cacheForContext(e).set(n,r)}get(e,n,r){this.throwIfDisposed();const i=this.cacheForContext(e);if(i.has(n))return i.get(n);if(r){const s=r();return i.set(n,s),s}else return}delete(e,n){return this.throwIfDisposed(),this.cacheForContext(e).delete(n)}clear(e){if(this.throwIfDisposed(),e){const n=this.converter(e);this.cache.delete(n)}else this.cache.clear()}cacheForContext(e){const n=this.converter(e);let r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}}class _C extends $C{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class IC{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new _C(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=qe(e.container).precomputedScopes;if(i){let a=e.container;do{const o=i.get(a);o.length>0&&n.push(ne(o).filter(u=>this.reflection.isSubtype(u.type,r))),a=a.$container}while(a)}let s=this.getGlobalScope(r,e);for(let a=n.length-1;a>=0;a--)s=this.createScope(n[a],s);return s}createScope(e,n,r){return new Qc(ne(e),n,r)}createScopeForNodes(e,n,r){const i=ne(e).map(s=>{const a=this.nameProvider.getName(s);if(a)return this.descriptions.createDescription(s,a)}).nonNullable();return new Qc(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new RC(this.indexManager.allElements(e)))}}function xC(t){return typeof t.$comment=="string"}function Zc(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class CC{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,n={}){const r=n==null?void 0:n.replacer,i=(a,o)=>this.replacer(a,o,n),s=r?(a,o)=>r(a,o,i):i;try{return this.currentDocument=qe(e),JSON.stringify(e,s,n==null?void 0:n.space)}finally{this.currentDocument=void 0}}deserialize(e,n={}){const r=JSON.parse(e);return this.linkNode(r,r,n),r}replacer(e,n,{refText:r,sourceText:i,textRegions:s,comments:a,uriConverter:o}){var u,c,l,f;if(!this.ignoreProperties.has(e))if(ze(n)){const d=n.ref,h=r?n.$refText:void 0;if(d){const g=qe(d);let m="";this.currentDocument&&this.currentDocument!==g&&(o?m=o(g.uri,n):m=g.uri.toString());const T=this.astNodeLocator.getAstNodePath(d);return{$ref:`${m}#${T}`,$refText:h}}else return{$error:(c=(u=n.error)===null||u===void 0?void 0:u.message)!==null&&c!==void 0?c:"Could not resolve reference",$refText:h}}else if(ce(n)){let d;if(s&&(d=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&(d!=null&&d.$textRegion)&&(d.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(d??(d=Object.assign({},n)),d.$sourceText=(f=n.$cstNode)===null||f===void 0?void 0:f.text),a){d??(d=Object.assign({},n));const h=this.commentProvider.getComment(n);h&&(d.$comment=h.replace(/\r/g,""))}return d??n}else return n}addAstNodeRegionWithAssignmentsTo(e){const n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(e.$cstNode){const r=e.$textRegion=n(e.$cstNode),i=r.assignments={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const a=Kp(e.$cstNode,s).map(n);a.length!==0&&(i[s]=a)}),e}}linkNode(e,n,r,i,s,a){for(const[u,c]of Object.entries(e))if(Array.isArray(c))for(let l=0;l<c.length;l++){const f=c[l];Zc(f)?c[l]=this.reviveReference(e,u,n,f,r):ce(f)&&this.linkNode(f,n,r,e,u,l)}else Zc(c)?e[u]=this.reviveReference(e,u,n,c,r):ce(c)&&this.linkNode(c,n,r,e,u);const o=e;o.$container=i,o.$containerProperty=s,o.$containerIndex=a}reviveReference(e,n,r,i,s){let a=i.$refText,o=i.$error;if(i.$ref){const u=this.getRefNode(r,i.$ref,s.uriConverter);if(ce(u))return a||(a=this.nameProvider.getName(u)),{$refText:a??"",ref:u};o=u}if(o){const u={$refText:a??""};return u.error={container:e,property:n,message:o,reference:u},u}else return}getRefNode(e,n,r){try{const i=n.indexOf("#");if(i===0){const u=this.astNodeLocator.getAstNode(e,n.substring(1));return u||"Could not resolve path: "+n}if(i<0){const u=r?r(n):mn.parse(n),c=this.langiumDocuments.getDocument(u);return c?c.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):mn.parse(n.substring(0,i)),a=this.langiumDocuments.getDocument(s);if(!a)return"Could not find document for URI: "+n;if(i===n.length-1)return a.parseResult.value;const o=this.astNodeLocator.getAstNode(a.parseResult.value,n.substring(i+1));return o||"Could not resolve URI: "+n}catch(i){return String(i)}}}class wC{register(e){if(!this.singleton&&!this.map){this.singleton=e;return}if(!this.map&&(this.map={},this.singleton)){for(const n of this.singleton.LanguageMetaData.fileExtensions)this.map[n]=this.singleton;this.singleton=void 0}for(const n of e.LanguageMetaData.fileExtensions)this.map[n]!==void 0&&this.map[n]!==e&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[n]=e}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.map===void 0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const n=wt.extname(e),r=this.map[n];if(!r)throw new Error(`The service registry contains no services for the extension '${n}'.`);return r}get all(){return this.singleton!==void 0?[this.singleton]:this.map!==void 0?Object.values(this.map):[]}}function el(t){return{code:t}}var ii;(function(t){t.all=["fast","slow","built-in"]})(ii||(ii={}));class NC{constructor(e){this.entries=new Za,this.reflection=e.shared.AstReflection}register(e,n=this,r="fast"){if(r==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[i,s]of Object.entries(e)){const a=s;if(Array.isArray(a))for(const o of a){const u={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,u)}else if(typeof a=="function"){const o={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,o)}}}wrapValidationException(e,n){return async(r,i,s)=>{try{await e.call(n,r,i,s)}catch(a){if(Ja(a))throw a;console.error("An error occurred during validation:",a);const o=a instanceof Error?a.message:String(a);a instanceof Error&&a.stack&&console.error(a.stack),i("error","An error occurred during validation: "+o,{node:r})}}}addEntry(e,n){if(e==="AstNode"){this.entries.add("AstNode",n);return}for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,n)}getChecks(e,n){let r=ne(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}}class bC{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=ee.None){const i=e.parseResult,s=[];if(await Fe(r),(!n.categories||n.categories.includes("built-in"))&&(this.processLexingErrors(i,s,n),n.stopAfterLexingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===At.LexingError})||(this.processParsingErrors(i,s,n),n.stopAfterParsingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===At.ParsingError}))||(this.processLinkingErrors(e,s,n),n.stopAfterLinkingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===At.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(a){if(Ja(a))throw a;console.error("An error occurred during validation:",a)}return await Fe(r),s}processLexingErrors(e,n,r){for(const i of e.lexerErrors){const s={severity:cs("error"),range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:el(At.LexingError),source:this.getSource()};n.push(s)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const a=i.previousToken;if(isNaN(a.startOffset)){const o={line:0,character:0};s={start:o,end:o}}else{const o={line:a.endLine-1,character:a.endColumn};s={start:o,end:o}}}}else s=ps(i.token);if(s){const a={severity:cs("error"),range:s,message:i.message,data:el(At.ParsingError),source:this.getSource()};n.push(a)}}}processLinkingErrors(e,n,r){for(const i of e.references){const s=i.error;if(s){const a={node:s.container,property:s.property,index:s.index,data:{code:At.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,a))}}}async validateAst(e,n,r=ee.None){const i=[],s=(a,o,u)=>{i.push(this.toDiagnostic(a,o,u))};return await Promise.all(nn(e).map(async a=>{await Fe(r);const o=this.validationRegistry.getChecks(a.$type,n.categories);for(const u of o)await u(a,s,r)})),i}toDiagnostic(e,n,r){return{message:n,range:kC(r),severity:cs(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function kC(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=rf(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Vp(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function cs(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}var At;(function(t){t.LexingError="lexing-error",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(At||(At={}));class OC{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r=qe(e)){n??(n=this.nameProvider.getName(e));const i=this.astNodeLocator.getAstNodePath(e);if(!n)throw new Error(`Node at path ${i} has no name.`);let s;const a=()=>{var o;return s??(s=kr((o=this.nameProvider.getNameNode(e))!==null&&o!==void 0?o:e.$cstNode))};return{node:e,name:n,get nameSegment(){return a()},selectionSegment:kr(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}}class PC{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=ee.None){const r=[],i=e.parseResult.value;for(const s of nn(i))await Fe(n),Ql(s).filter(a=>!Sr(a)).forEach(a=>{const o=this.createDescription(a);o&&r.push(o)});return r}createDescription(e){const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=qe(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:kr(r),local:wt.equals(n.documentUri,i)}}}class LC{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const n=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return n+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:n}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?e+this.indexSeparator+n:e}getAstNode(e,n){return n.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;const a=s.indexOf(this.indexSeparator);if(a>0){const o=s.substring(0,a),u=parseInt(s.substring(a+1)),c=i[o];return c==null?void 0:c[u]}return i[s]},e)}}class MC{constructor(e){this._ready=new Qa,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var n,r;this.workspaceConfig=(r=(n=e.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&r!==void 0?r:!1}async initialized(e){if(this.workspaceConfig){if(e.register){const n=this.serviceRegistry.all;e.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){const n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(n);n.forEach((i,s)=>{this.updateSectionConfiguration(i.section,r[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(n=>{this.updateSectionConfiguration(n,e.settings[n])})}updateSectionConfiguration(e,n){this.settings[e]=n}async getConfiguration(e,n){await this.ready;const r=this.toSectionName(e);if(this.settings[r])return this.settings[r][n]}toSectionName(e){return`${e}`}}var si;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(si||(si={}));class DC{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Za,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=W.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,n={},r=ee.None){var i,s;for(const a of e){const o=a.uri.toString();if(a.state===W.Validated){if(typeof n.validation=="boolean"&&n.validation)a.state=W.IndexedReferences,a.diagnostics=void 0,this.buildState.delete(o);else if(typeof n.validation=="object"){const u=this.buildState.get(o),c=(i=u==null?void 0:u.result)===null||i===void 0?void 0:i.validationChecks;if(c){const f=((s=n.validation.categories)!==null&&s!==void 0?s:ii.all).filter(d=>!c.includes(d));f.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:f})},result:u.result}),a.state=W.IndexedReferences)}}}else this.buildState.delete(o)}this.currentState=W.Changed,await this.emitUpdate(e.map(a=>a.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=ee.None){this.currentState=W.Changed;for(const a of n)this.langiumDocuments.deleteDocument(a),this.buildState.delete(a.toString()),this.indexManager.remove(a);for(const a of e){if(!this.langiumDocuments.invalidateDocument(a)){const u=this.langiumDocumentFactory.fromModel({$type:"INVALID"},a);u.state=W.Changed,this.langiumDocuments.addDocument(u)}this.buildState.delete(a.toString())}const i=ne(e).concat(n).map(a=>a.toString()).toSet();this.langiumDocuments.all.filter(a=>!i.has(a.uri.toString())&&this.shouldRelink(a,i)).forEach(a=>{this.serviceRegistry.getServices(a.uri).references.Linker.unlink(a),a.state=Math.min(a.state,W.ComputedScopes),a.diagnostics=void 0}),await this.emitUpdate(e,n),await Fe(r);const s=this.langiumDocuments.all.filter(a=>{var o;return a.state<W.Linked||!(!((o=this.buildState.get(a.uri.toString()))===null||o===void 0)&&o.completed)}).toArray();await this.buildDocuments(s,this.updateBuildOptions,r)}async emitUpdate(e,n){await Promise.all(this.updateListeners.map(r=>r(e,n)))}shouldRelink(e,n){return e.references.some(r=>r.error!==void 0)?!0:this.indexManager.isAffected(e,n)}onUpdate(e){return this.updateListeners.push(e),si.create(()=>{const n=this.updateListeners.indexOf(e);n>=0&&this.updateListeners.splice(n,1)})}async buildDocuments(e,n,r){this.prepareBuild(e,n),await this.runCancelable(e,W.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,W.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,W.ComputedScopes,r,async s=>{const a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,r)}),await this.runCancelable(e,W.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,W.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,W.Validated,r,s=>this.validate(s,r));for(const s of e){const a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,n){for(const r of e){const i=r.uri.toString(),s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:n,result:s==null?void 0:s.result})}}async runCancelable(e,n,r,i){const s=e.filter(a=>a.state<n);for(const a of s)await Fe(r),await i(a),a.state=n;await this.notifyBuildPhase(s,n,r),this.currentState=n}onBuildPhase(e,n){return this.buildPhaseListeners.add(e,n),si.create(()=>{this.buildPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=ee.None),i){const s=this.langiumDocuments.getDocument(i);if(s&&s.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):r.isCancellationRequested?Promise.reject(ri):new Promise((s,a)=>{const o=this.onBuildPhase(e,()=>{if(o.dispose(),u.dispose(),i){const c=this.langiumDocuments.getDocument(i);s(c==null?void 0:c.uri)}else s(void 0)}),u=r.onCancellationRequested(()=>{o.dispose(),u.dispose(),a(ri)})})}async notifyBuildPhase(e,n,r){if(e.length===0)return;const i=this.buildPhaseListeners.get(n);for(const s of i)await Fe(r),await s(e,r)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,n){var r,i;const s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,a=this.getBuildOptions(e).validation,o=typeof a=="object"?a:void 0,u=await s.validateDocument(e,o,n);e.diagnostics?e.diagnostics.push(...u):e.diagnostics=u;const c=this.buildState.get(e.uri.toString());if(c){(r=c.result)!==null&&r!==void 0||(c.result={});const l=(i=o==null?void 0:o.categories)!==null&&i!==void 0?i:ii.all;c.result.validationChecks?c.result.validationChecks.push(...l):c.result.validationChecks=[...l]}}getBuildOptions(e){var n,r;return(r=(n=this.buildState.get(e.uri.toString()))===null||n===void 0?void 0:n.options)!==null&&r!==void 0?r:{}}}class FC{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new SC,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=qe(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(a=>{wt.equals(a.targetUri,r)&&a.targetPath===n&&i.push(a)})}),ne(i)}allElements(e,n){let r=ne(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,n){var r;return n?this.symbolByTypeIndex.get(e,n,()=>{var s;return((s=this.symbolIndex.get(e))!==null&&s!==void 0?s:[]).filter(o=>this.astReflection.isSubtype(o.type,n))}):(r=this.symbolIndex.get(e))!==null&&r!==void 0?r:[]}remove(e){const n=e.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n),this.referenceIndex.delete(n)}async updateContent(e,n=ee.None){const i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,n),s=e.uri.toString();this.symbolIndex.set(s,i),this.symbolByTypeIndex.clear(s)}async updateReferences(e,n=ee.None){const i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,n);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,n){const r=this.referenceIndex.get(e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class GC{constructor(e){this.initialBuildOptions={},this._ready=new Qa,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}initialize(e){var n;this.folders=(n=e.workspaceFolders)!==null&&n!==void 0?n:void 0}initialized(e){return this.mutex.write(n=>{var r;return this.initializeWorkspace((r=this.folders)!==null&&r!==void 0?r:[],n)})}async initializeWorkspace(e,n=ee.None){const r=await this.performStartup(e);await Fe(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(e){const n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),r=[],i=s=>{r.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,i))),this._ready.resolve(),r}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return mn.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.readDirectory(n);await Promise.all(s.map(async a=>{if(this.includeEntry(e,a,r)){if(a.isDirectory)await this.traverseFolder(e,a.uri,r,i);else if(a.isFile){const o=await this.langiumDocuments.getOrCreateDocument(a.uri);i(o)}}}))}includeEntry(e,n,r){const i=wt.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=wt.extname(n.uri);return r.includes(s)}return!1}}class UC{constructor(e){const n=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=tl(n)?Object.values(n):n;this.chevrotainLexer=new de(r,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var n;const r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:(n=r.groups.hidden)!==null&&n!==void 0?n:[]}}toTokenTypeDictionary(e){if(tl(e))return e;const n=hh(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function BC(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function hh(t){return t&&"modes"in t&&"defaultMode"in t}function tl(t){return!BC(t)&&!hh(t)}function jC(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=D.create(0,0));const s=ph(t),a=eo(r),o=zC({lines:s,position:i,options:a});return XC({index:0,tokens:o,position:i})}function HC(t,e){const n=eo(e),r=ph(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],a=n.start,o=n.end;return!!(a!=null&&a.exec(i))&&!!(o!=null&&o.exec(s))}function ph(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(Lp)}const nl=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,WC=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function zC(t){var e,n,r;const i=[];let s=t.position.line,a=t.position.character;for(let o=0;o<t.lines.length;o++){const u=o===0,c=o===t.lines.length-1;let l=t.lines[o],f=0;if(u&&t.options.start){const h=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);h&&(f=h.index+h[0].length)}else{const h=(n=t.options.line)===null||n===void 0?void 0:n.exec(l);h&&(f=h.index+h[0].length)}if(c){const h=(r=t.options.end)===null||r===void 0?void 0:r.exec(l);h&&(l=l.substring(0,h.index))}if(l=l.substring(0,YC(l)),ia(l,f)>=l.length){if(i.length>0){const h=D.create(s,a);i.push({type:"break",content:"",range:L.create(h,h)})}}else{nl.lastIndex=f;const h=nl.exec(l);if(h){const g=h[0],m=h[1],T=D.create(s,a+f),y=D.create(s,a+f+g.length);i.push({type:"tag",content:m,range:L.create(T,y)}),f+=g.length,f=ia(l,f)}if(f<l.length){const g=l.substring(f),m=Array.from(g.matchAll(WC));i.push(...KC(m,g,s,a+f))}}s++,a=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function KC(t,e,n,r){const i=[];if(t.length===0){const s=D.create(n,r),a=D.create(n,r+e.length);i.push({type:"text",content:e,range:L.create(s,a)})}else{let s=0;for(const o of t){const u=o.index,c=e.substring(s,u);c.length>0&&i.push({type:"text",content:e.substring(s,u),range:L.create(D.create(n,s+r),D.create(n,u+r))});let l=c.length+1;const f=o[1];if(i.push({type:"inline-tag",content:f,range:L.create(D.create(n,s+l+r),D.create(n,s+l+f.length+r))}),l+=f.length,o.length===4){l+=o[2].length;const d=o[3];i.push({type:"text",content:d,range:L.create(D.create(n,s+l+r),D.create(n,s+l+d.length+r))})}else i.push({type:"text",content:"",range:L.create(D.create(n,s+l+r),D.create(n,s+l+r))});s=u+o[0].length}const a=e.substring(s);a.length>0&&i.push({type:"text",content:a,range:L.create(D.create(n,s+r),D.create(n,s+r+a.length))})}return i}const VC=/\S/,qC=/\s*$/;function ia(t,e){const n=t.substring(e).match(VC);return n?e+n.index:t.length}function YC(t){const e=t.match(qC);if(e&&typeof e.index=="number")return e.index}function XC(t){var e,n,r,i;const s=D.create(t.position.line,t.position.character);if(t.tokens.length===0)return new rl([],L.create(s,s));const a=[];for(;t.index<t.tokens.length;){const c=JC(t,a[a.length-1]);c&&a.push(c)}const o=(n=(e=a[0])===null||e===void 0?void 0:e.range.start)!==null&&n!==void 0?n:s,u=(i=(r=a[a.length-1])===null||r===void 0?void 0:r.range.end)!==null&&i!==void 0?i:s;return new rl(a,L.create(o,u))}function JC(t,e){const n=t.tokens[t.index];if(n.type==="tag")return mh(t,!1);if(n.type==="text"||n.type==="inline-tag")return gh(t);QC(n,e),t.index++}function QC(t,e){if(e){const n=new Th("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function gh(t){let e=t.tokens[t.index];const n=e;let r=e;const i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(ZC(t)),r=e,e=t.tokens[t.index];return new sa(i,L.create(n.range.start,r.range.end))}function ZC(t){return t.tokens[t.index].type==="inline-tag"?mh(t,!0):yh(t)}function mh(t,e){const n=t.tokens[t.index++],r=n.content.substring(1),i=t.tokens[t.index];if((i==null?void 0:i.type)==="text")if(e){const s=yh(t);return new fs(r,new sa([s],s.range),e,L.create(n.range.start,s.range.end))}else{const s=gh(t);return new fs(r,s,e,L.create(n.range.start,s.range.end))}else{const s=n.range;return new fs(r,new sa([],s),e,s)}}function yh(t){const e=t.tokens[t.index++];return new Th(e.content,e.range)}function eo(t){if(!t)return eo({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:ls(e,!0),end:ls(n,!1),line:ls(r,!0)}}function ls(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?fi(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class rl{constructor(e,n){this.elements=e,this.range=n}getTag(e){return this.getAllTags().find(n=>n.name===e)}getTags(e){return this.getAllTags().filter(n=>n.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const n of this.elements)if(e.length===0)e=n.toString();else{const r=n.toString();e+=il(e)+r}return e.trim()}toMarkdown(e){let n="";for(const r of this.elements)if(n.length===0)n=r.toMarkdown(e);else{const i=r.toMarkdown(e);n+=il(n)+i}return n.trim()}}class fs{constructor(e,n,r,i){this.name=e,this.content=n,this.inline=r,this.range=i}toString(){let e=`@${this.name}`;const n=this.content.toString();return this.content.inlines.length===1?e=`${e} ${n}`:this.content.inlines.length>1&&(e=`${e}
|
|
117
|
+
${n}`),this.inline?`{${e}}`:e}toMarkdown(e){var n,r;return(r=(n=e==null?void 0:e.renderTag)===null||n===void 0?void 0:n.call(e,this))!==null&&r!==void 0?r:this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=ew(this.name,n,e??{});if(typeof s=="string")return s}let r="";(e==null?void 0:e.tag)==="italic"||(e==null?void 0:e.tag)===void 0?r="*":(e==null?void 0:e.tag)==="bold"?r="**":(e==null?void 0:e.tag)==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} — ${n}`:this.content.inlines.length>1&&(i=`${i}
|
|
118
|
+
${n}`),this.inline?`{${i}}`:i}}function ew(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let a=e;if(s>0){const u=ia(e,s);a=e.substring(u),e=e.substring(0,s)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(a=`\`${a}\``),(i=(r=n.renderLink)===null||r===void 0?void 0:r.call(n,e,a))!==null&&i!==void 0?i:tw(e,a)}}function tw(t,e){try{return mn.parse(t,!0),`[${e}](${t})`}catch{return t}}class sa{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];e+=r.toString(),i&&i.range.start.line>r.range.start.line&&(e+=`
|
|
119
|
+
`)}return e}toMarkdown(e){let n="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];n+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(n+=`
|
|
120
|
+
`)}return n}}class Th{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function il(t){return t.endsWith(`
|
|
121
|
+
`)?`
|
|
122
|
+
`:`
|
|
123
|
+
|
|
124
|
+
`}class nw{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&HC(n))return jC(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){var i;const s=(i=this.findNameInPrecomputedScopes(e,n))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,n);if(s&&s.nameSegment){const a=s.nameSegment.range.start.line+1,o=s.nameSegment.range.start.character+1,u=s.documentUri.with({fragment:`L${a},${o}`});return`[${r}](${u.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=qe(e).precomputedScopes;if(!i)return;let s=e;do{const o=i.get(s).find(u=>u.name===n);if(o)return o;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class rw{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return xC(e)?e.$comment:(n=ep(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class iw{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e){return Promise.resolve(this.syncParser.parse(e))}}class sw{constructor(){this.previousTokenSource=new ea,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=new ea;return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r){const i=new Qa,s={action:n,deferred:i,cancellationToken:r??ee.None};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){Ja(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class aw{constructor(e){this.grammarElementIdMap=new Jc,this.tokenTypeIdMap=new Jc,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors.map(n=>Object.assign({},n)),parserErrors:e.parserErrors.map(n=>Object.assign({},n)),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of nn(e))n.set(i,{});if(e.$cstNode)for(const i of hs(e.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)ce(o)?a.push(this.dehydrateAstNode(o,n)):ze(o)?a.push(this.dehydrateReference(o,n)):a.push(o)}else ce(s)?r[i]=this.dehydrateAstNode(s,n):ze(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=n.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return ml(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),an(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):gl(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of nn(e))n.set(s,{});let i;if(e.$cstNode)for(const s of hs(e.$cstNode)){let a;"fullText"in s?(a=new Jd(s.fullText),i=a):"content"in s?a=new Ya:"tokenType"in s&&(a=this.hydrateCstLeafNode(s)),a&&(r.set(s,a),a.root=i)}return{astNodes:n,cstNodes:r}}hydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=n.cstNodes.get(e.$cstNode));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)ce(o)?a.push(this.setParent(this.hydrateAstNode(o,n),r)):ze(o)?a.push(this.hydrateReference(o,r,i,n)):a.push(o)}else ce(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):ze(s)?r[i]=this.hydrateReference(s,r,i,n):s!==void 0&&(r[i]=s);return r}setParent(e,n){return e.$container=n,e}hydrateReference(e,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,n,r=0){const i=n.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=n.astNodes.get(e.astNode),an(i))for(const s of e.content){const a=this.hydrateCstNode(s,n,r++);i.content.push(a)}return i}hydrateCstLeafNode(e){const n=this.getTokenType(e.tokenType),r=e.offset,i=e.length,s=e.startLine,a=e.startColumn,o=e.endLine,u=e.endColumn,c=e.hidden;return new Ys(r,i,{start:{line:s,character:a},end:{line:o,character:u}},n,c)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap();const n=this.grammarElementIdMap.getKey(e);if(n)return n;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(const n of nn(this.grammar))rp(n)&&this.grammarElementIdMap.set(n,e++)}}function En(t){return{documentation:{CommentProvider:e=>new rw(e),DocumentationProvider:e=>new nw(e)},parser:{AsyncParser:e=>new iw(e),GrammarConfig:e=>rg(e),LangiumParser:e=>Zx(e),CompletionParser:e=>Qx(e),ValueConverter:()=>new ah,TokenBuilder:()=>new sh,Lexer:e=>new UC(e),ParserErrorMessageProvider:()=>new eh},workspace:{AstNodeLocator:()=>new LC,AstNodeDescriptionProvider:e=>new OC(e),ReferenceDescriptionProvider:e=>new PC(e)},references:{Linker:e=>new yC(e),NameProvider:()=>new vC,ScopeProvider:e=>new IC(e),ScopeComputation:e=>new EC(e),References:e=>new AC(e)},serializer:{Hydrator:e=>new aw(e),JsonSerializer:e=>new CC(e)},validation:{DocumentValidator:e=>new bC(e),ValidationRegistry:e=>new NC(e)},shared:()=>t.shared}}function Rn(t){return{ServiceRegistry:()=>new wC,workspace:{LangiumDocuments:e=>new mC(e),LangiumDocumentFactory:e=>new gC(e),DocumentBuilder:e=>new DC(e),IndexManager:e=>new FC(e),WorkspaceManager:e=>new GC(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new sw,ConfigurationProvider:e=>new MC(e)}}}var sl;(function(t){t.merge=(e,n)=>ai(ai({},e),n)})(sl||(sl={}));function Oe(t,e,n,r,i,s,a,o,u){const c=[t,e,n,r,i,s,a,o,u].reduce(ai,{});return vh(c)}const al=Symbol("isProxy");function vh(t,e){const n=new Proxy({},{deleteProperty:()=>!1,get:(r,i)=>ul(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(ul(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Reflect.ownKeys(t),al]});return n[al]=!0,n}const ol=Symbol();function ul(t,e,n,r){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===ol)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in n){const i=n[e];t[e]=ol;try{t[e]=typeof i=="function"?i(r):vh(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function ai(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=ai(i,r):t[n]=r}}return t}class ow{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const $n={fileSystemProvider:()=>new ow},uw={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},cw={AstReflection:()=>new Jl};function lw(){const t=Oe(Rn($n),cw),e=Oe(En({shared:t}),uw);return t.ServiceRegistry.register(e),e}function mr(t){var e;const n=lw(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,mn.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var fw=Object.defineProperty,I=(t,e)=>fw(t,"name",{value:e,configurable:!0}),dw="Statement",hw="Architecture";function pw(t){return je.isInstance(t,hw)}I(pw,"isArchitecture");var Ah="Branch";function gw(t){return je.isInstance(t,Ah)}I(gw,"isBranch");var mw="Checkout",yw="CherryPicking",Eh="Commit";function Tw(t){return je.isInstance(t,Eh)}I(Tw,"isCommit");var vw="Common";function Aw(t){return je.isInstance(t,vw)}I(Aw,"isCommon");var Rh="GitGraph";function Ew(t){return je.isInstance(t,Rh)}I(Ew,"isGitGraph");var Rw="Info";function $w(t){return je.isInstance(t,Rw)}I($w,"isInfo");var $h="Merge";function Sw(t){return je.isInstance(t,$h)}I(Sw,"isMerge");var _w="Packet";function Iw(t){return je.isInstance(t,_w)}I(Iw,"isPacket");var xw="PacketBlock";function Cw(t){return je.isInstance(t,xw)}I(Cw,"isPacketBlock");var ww="Pie";function Nw(t){return je.isInstance(t,ww)}I(Nw,"isPie");var bw="PieSection";function kw(t){return je.isInstance(t,bw)}I(kw,"isPieSection");var Ow="Direction",zn,Sh=(zn=class extends pl{getAllTypes(){return["Architecture","Branch","Checkout","CherryPicking","Commit","Common","Direction","Edge","GitGraph","Group","Info","Junction","Merge","Packet","PacketBlock","Pie","PieSection","Service","Statement"]}computeIsSubtype(e,n){switch(e){case Ah:case mw:case yw:case Eh:case $h:return this.isSubtype(dw,n);case Ow:return this.isSubtype(Rh,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"Architecture":return{name:"Architecture",properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case"Branch":return{name:"Branch",properties:[{name:"name"},{name:"order"}]};case"Checkout":return{name:"Checkout",properties:[{name:"branch"}]};case"CherryPicking":return{name:"CherryPicking",properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case"Commit":return{name:"Commit",properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Common":return{name:"Common",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Edge":return{name:"Edge",properties:[{name:"lhsDir"},{name:"lhsGroup",defaultValue:!1},{name:"lhsId"},{name:"lhsInto",defaultValue:!1},{name:"rhsDir"},{name:"rhsGroup",defaultValue:!1},{name:"rhsId"},{name:"rhsInto",defaultValue:!1},{name:"title"}]};case"GitGraph":return{name:"GitGraph",properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case"Group":return{name:"Group",properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case"Info":return{name:"Info",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Junction":return{name:"Junction",properties:[{name:"id"},{name:"in"}]};case"Merge":return{name:"Merge",properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Packet":return{name:"Packet",properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case"PacketBlock":return{name:"PacketBlock",properties:[{name:"end"},{name:"label"},{name:"start"}]};case"Pie":return{name:"Pie",properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case"PieSection":return{name:"PieSection",properties:[{name:"label"},{name:"value"}]};case"Service":return{name:"Service",properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case"Direction":return{name:"Direction",properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};default:return{name:e,properties:[]}}}},I(zn,"MermaidAstReflection"),zn),je=new Sh,cl,Pw=I(()=>cl??(cl=mr('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","name":"Info","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"InfoGrammar"),ll,Lw=I(()=>ll??(ll=mr(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","name":"Packet","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}`)),"PacketGrammar"),fl,Mw=I(()=>fl??(fl=mr('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","name":"Pie","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"PieGrammar"),dl,Dw=I(()=>dl??(dl=mr('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","name":"Architecture","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LeftPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RightPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Arrow","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"ArchitectureGrammar"),hl,Fw=I(()=>hl??(hl=mr(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"ParserRule","name":"GitGraph","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}`)),"GitGraphGrammar"),Gw={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},Uw={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},Bw={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},jw={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},Hw={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},yr={AstReflection:I(()=>new Sh,"AstReflection")},Ww={Grammar:I(()=>Pw(),"Grammar"),LanguageMetaData:I(()=>Gw,"LanguageMetaData"),parser:{}},zw={Grammar:I(()=>Lw(),"Grammar"),LanguageMetaData:I(()=>Uw,"LanguageMetaData"),parser:{}},Kw={Grammar:I(()=>Mw(),"Grammar"),LanguageMetaData:I(()=>Bw,"LanguageMetaData"),parser:{}},Vw={Grammar:I(()=>Dw(),"Grammar"),LanguageMetaData:I(()=>jw,"LanguageMetaData"),parser:{}},qw={Grammar:I(()=>Fw(),"Grammar"),LanguageMetaData:I(()=>Hw,"LanguageMetaData"),parser:{}},Yw=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,Xw=/accTitle[\t ]*:([^\n\r]*)/,Jw=/title([\t ][^\n\r]*|)/,Qw={ACC_DESCR:Yw,ACC_TITLE:Xw,TITLE:Jw},Kn,to=(Kn=class extends ah{runConverter(e,n,r){let i=this.runCommonConverter(e,n,r);return i===void 0&&(i=this.runCustomConverter(e,n,r)),i===void 0?super.runConverter(e,n,r):i}runCommonConverter(e,n,r){const i=Qw[e.name];if(i===void 0)return;const s=i.exec(n);if(s!==null){if(s[1]!==void 0)return s[1].trim().replace(/[\t ]{2,}/gm," ");if(s[2]!==void 0)return s[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,`
|
|
125
|
+
`)}}},I(Kn,"AbstractMermaidValueConverter"),Kn),Vn,no=(Vn=class extends to{runCustomConverter(e,n,r){}},I(Vn,"CommonValueConverter"),Vn),qn,Sn=(qn=class extends sh{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,n,r){const i=super.buildKeywordTokens(e,n,r);return i.forEach(s=>{this.keywords.has(s.name)&&s.PATTERN!==void 0&&(s.PATTERN=new RegExp(s.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),i}},I(qn,"AbstractMermaidTokenBuilder"),qn),Yn;Yn=class extends Sn{},I(Yn,"CommonTokenBuilder");var Xn,Zw=(Xn=class extends Sn{constructor(){super(["gitGraph"])}},I(Xn,"GitGraphTokenBuilder"),Xn),_h={parser:{TokenBuilder:I(()=>new Zw,"TokenBuilder"),ValueConverter:I(()=>new no,"ValueConverter")}};function Ih(t=$n){const e=Oe(Rn(t),yr),n=Oe(En({shared:e}),qw,_h);return e.ServiceRegistry.register(n),{shared:e,GitGraph:n}}I(Ih,"createGitGraphServices");var Jn,eN=(Jn=class extends Sn{constructor(){super(["info","showInfo"])}},I(Jn,"InfoTokenBuilder"),Jn),xh={parser:{TokenBuilder:I(()=>new eN,"TokenBuilder"),ValueConverter:I(()=>new no,"ValueConverter")}};function Ch(t=$n){const e=Oe(Rn(t),yr),n=Oe(En({shared:e}),Ww,xh);return e.ServiceRegistry.register(n),{shared:e,Info:n}}I(Ch,"createInfoServices");var Qn,tN=(Qn=class extends Sn{constructor(){super(["packet-beta"])}},I(Qn,"PacketTokenBuilder"),Qn),wh={parser:{TokenBuilder:I(()=>new tN,"TokenBuilder"),ValueConverter:I(()=>new no,"ValueConverter")}};function Nh(t=$n){const e=Oe(Rn(t),yr),n=Oe(En({shared:e}),zw,wh);return e.ServiceRegistry.register(n),{shared:e,Packet:n}}I(Nh,"createPacketServices");var Zn,nN=(Zn=class extends Sn{constructor(){super(["pie","showData"])}},I(Zn,"PieTokenBuilder"),Zn),er,rN=(er=class extends to{runCustomConverter(e,n,r){if(e.name==="PIE_SECTION_LABEL")return n.replace(/"/g,"").trim()}},I(er,"PieValueConverter"),er),bh={parser:{TokenBuilder:I(()=>new nN,"TokenBuilder"),ValueConverter:I(()=>new rN,"ValueConverter")}};function kh(t=$n){const e=Oe(Rn(t),yr),n=Oe(En({shared:e}),Kw,bh);return e.ServiceRegistry.register(n),{shared:e,Pie:n}}I(kh,"createPieServices");var tr,iN=(tr=class extends Sn{constructor(){super(["architecture"])}},I(tr,"ArchitectureTokenBuilder"),tr),nr,sN=(nr=class extends to{runCustomConverter(e,n,r){if(e.name==="ARCH_ICON")return n.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return n.replace(/["()]/g,"");if(e.name==="ARCH_TITLE")return n.replace(/[[\]]/g,"").trim()}},I(nr,"ArchitectureValueConverter"),nr),Oh={parser:{TokenBuilder:I(()=>new iN,"TokenBuilder"),ValueConverter:I(()=>new sN,"ValueConverter")}};function Ph(t=$n){const e=Oe(Rn(t),yr),n=Oe(En({shared:e}),Vw,Oh);return e.ServiceRegistry.register(n),{shared:e,Architecture:n}}I(Ph,"createArchitectureServices");var Mt={},aN={info:I(async()=>{const{createInfoServices:t}=await _n(()=>Promise.resolve().then(()=>cN),void 0),e=t().Info.parser.LangiumParser;Mt.info=e},"info"),packet:I(async()=>{const{createPacketServices:t}=await _n(()=>Promise.resolve().then(()=>lN),void 0),e=t().Packet.parser.LangiumParser;Mt.packet=e},"packet"),pie:I(async()=>{const{createPieServices:t}=await _n(()=>Promise.resolve().then(()=>fN),void 0),e=t().Pie.parser.LangiumParser;Mt.pie=e},"pie"),architecture:I(async()=>{const{createArchitectureServices:t}=await _n(()=>Promise.resolve().then(()=>dN),void 0),e=t().Architecture.parser.LangiumParser;Mt.architecture=e},"architecture"),gitGraph:I(async()=>{const{createGitGraphServices:t}=await _n(()=>Promise.resolve().then(()=>hN),void 0),e=t().GitGraph.parser.LangiumParser;Mt.gitGraph=e},"gitGraph")};async function oN(t,e){const n=aN[t];if(!n)throw new Error(`Unknown diagram type: ${t}`);Mt[t]||await n();const i=Mt[t].parse(e);if(i.lexerErrors.length>0||i.parserErrors.length>0)throw new uN(i);return i.value}I(oN,"parse");var rr,uN=(rr=class extends Error{constructor(e){const n=e.lexerErrors.map(i=>i.message).join(`
|
|
126
|
+
`),r=e.parserErrors.map(i=>i.message).join(`
|
|
127
|
+
`);super(`Parsing failed: ${n} ${r}`),this.result=e}},I(rr,"MermaidParseError"),rr);const cN=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:xh,createInfoServices:Ch},Symbol.toStringTag,{value:"Module"})),lN=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:wh,createPacketServices:Nh},Symbol.toStringTag,{value:"Module"})),fN=Object.freeze(Object.defineProperty({__proto__:null,PieModule:bh,createPieServices:kh},Symbol.toStringTag,{value:"Module"})),dN=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:Oh,createArchitectureServices:Ph},Symbol.toStringTag,{value:"Module"})),hN=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:_h,createGitGraphServices:Ih},Symbol.toStringTag,{value:"Module"}));export{oN as p};
|
|
128
|
+
function __vite__mapDeps(indexes) {
|
|
129
|
+
if (!__vite__mapDeps.viteFileDeps) {
|
|
130
|
+
__vite__mapDeps.viteFileDeps = []
|
|
131
|
+
}
|
|
132
|
+
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
133
|
+
}
|