@likec4/mcp 1.55.0 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/likec4-mcp.mjs +3 -0
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
- package/dist/chunks/libs/@hono/mcp.mjs +45 -0
- package/dist/chunks/libs/@hono/node-server.mjs +1 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
- package/dist/chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/chunks/libs/@ungap/structured-clone.mjs +1 -0
- package/dist/chunks/libs/bail.mjs +1 -0
- package/dist/chunks/libs/ccount.mjs +1 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
- package/dist/chunks/libs/chevrotain.mjs +58 -0
- package/dist/chunks/libs/chokidar.mjs +3 -0
- package/dist/chunks/libs/chroma-js.mjs +15 -0
- package/dist/chunks/libs/citty.mjs +5 -0
- package/dist/chunks/libs/comma-separated-tokens.mjs +1 -0
- package/dist/chunks/libs/decode-named-character-reference.mjs +1 -0
- package/dist/chunks/libs/defu.mjs +1 -0
- package/dist/chunks/libs/destr.mjs +1 -0
- package/dist/chunks/libs/devlop.mjs +1 -0
- package/dist/chunks/libs/escape-string-regexp.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -0
- package/dist/chunks/libs/extend.mjs +1 -0
- package/dist/chunks/libs/fdir.mjs +1 -0
- package/dist/chunks/libs/graphology-dag.mjs +1 -0
- package/dist/chunks/libs/graphology.mjs +1 -0
- package/dist/chunks/libs/hast-util-sanitize.mjs +1 -0
- package/dist/chunks/libs/hast-util-to-html.mjs +9 -0
- package/dist/chunks/libs/hono.mjs +1 -0
- package/dist/chunks/libs/immer.mjs +1 -0
- package/dist/chunks/libs/is-error-instance.mjs +1 -0
- package/dist/chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/chunks/libs/isexe.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +14 -0
- package/dist/chunks/libs/khroma.mjs +1 -0
- package/dist/chunks/libs/langium.mjs +29 -0
- package/dist/chunks/libs/longest-streak.mjs +1 -0
- package/dist/chunks/libs/markdown-table.mjs +2 -0
- package/dist/chunks/libs/mdast-util-find-and-replace.mjs +1 -0
- package/dist/chunks/libs/mdast-util-from-markdown.mjs +3 -0
- package/dist/chunks/libs/mdast-util-gfm.mjs +15 -0
- package/dist/chunks/libs/mdast-util-to-hast.mjs +11 -0
- package/dist/chunks/libs/merge-error-cause.mjs +2 -0
- package/dist/chunks/libs/micromark-extension-gfm.mjs +1 -0
- package/dist/chunks/libs/mnemonist.mjs +1 -0
- package/dist/chunks/libs/nano-spawn.mjs +3 -0
- package/dist/chunks/libs/natural-compare-lite.mjs +9 -0
- package/dist/chunks/libs/ohash.mjs +1 -0
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -0
- package/dist/chunks/libs/p-timeout.mjs +1 -0
- package/dist/chunks/libs/parse-ms.mjs +1 -0
- package/dist/chunks/libs/pathe.mjs +1 -0
- package/dist/chunks/libs/pretty-ms.mjs +1 -0
- package/dist/chunks/libs/rehype-sanitize.mjs +1 -0
- package/dist/chunks/libs/rehype-stringify.mjs +1 -0
- package/dist/chunks/libs/remark-gfm.mjs +1 -0
- package/dist/chunks/libs/remark-github-blockquote-alert.mjs +3 -0
- package/dist/chunks/libs/remark-parse.mjs +1 -0
- package/dist/chunks/libs/remark-rehype.mjs +1 -0
- package/dist/chunks/libs/remeda.mjs +1 -0
- package/dist/chunks/libs/safe-stringify.mjs +1 -0
- package/dist/chunks/libs/strip-indent.mjs +1 -0
- package/dist/chunks/libs/tinyrainbow.mjs +1 -0
- package/dist/chunks/libs/trough.mjs +1 -0
- package/dist/chunks/libs/ts-graphviz.mjs +4 -0
- package/dist/chunks/libs/ufo.mjs +1 -0
- package/dist/chunks/libs/unified.mjs +1 -0
- package/dist/chunks/libs/unstorage.mjs +1 -0
- package/dist/chunks/libs/which.mjs +1 -0
- package/dist/chunks/libs/word-wrap.mjs +12 -0
- package/dist/chunks/rolldown-runtime.mjs +1 -0
- package/dist/chunks/src.mjs +1228 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +21 -17
- package/dist/THIRD-PARTY-LICENSES.md +0 -2318
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
- package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
- package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
- package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +0 -15
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/_chunks/libs/@radix-ui/colors.mjs +0 -1
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +0 -1
- package/dist/_chunks/libs/bail.mjs +0 -1
- package/dist/_chunks/libs/ccount.mjs +0 -1
- package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
- package/dist/_chunks/libs/chevrotain.mjs +0 -58
- package/dist/_chunks/libs/chokidar.mjs +0 -3
- package/dist/_chunks/libs/citty.mjs +0 -5
- package/dist/_chunks/libs/comma-separated-tokens.mjs +0 -1
- package/dist/_chunks/libs/decode-named-character-reference.mjs +0 -1
- package/dist/_chunks/libs/defu.mjs +0 -1
- package/dist/_chunks/libs/destr.mjs +0 -1
- package/dist/_chunks/libs/devlop.mjs +0 -1
- package/dist/_chunks/libs/escape-string-regexp.mjs +0 -1
- package/dist/_chunks/libs/eventemitter3.mjs +0 -1
- package/dist/_chunks/libs/extend.mjs +0 -1
- package/dist/_chunks/libs/fast-equals.mjs +0 -1
- package/dist/_chunks/libs/fdir.mjs +0 -1
- package/dist/_chunks/libs/graphology-dag.mjs +0 -1
- package/dist/_chunks/libs/graphology.mjs +0 -1
- package/dist/_chunks/libs/hast-util-sanitize.mjs +0 -1
- package/dist/_chunks/libs/hast-util-to-html.mjs +0 -9
- package/dist/_chunks/libs/immer.mjs +0 -1
- package/dist/_chunks/libs/is-error-instance.mjs +0 -1
- package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/_chunks/libs/isexe.mjs +0 -1
- package/dist/_chunks/libs/json5.mjs +0 -14
- package/dist/_chunks/libs/khroma.mjs +0 -1
- package/dist/_chunks/libs/langium.mjs +0 -30
- package/dist/_chunks/libs/longest-streak.mjs +0 -1
- package/dist/_chunks/libs/markdown-table.mjs +0 -2
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +0 -1
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +0 -3
- package/dist/_chunks/libs/mdast-util-gfm.mjs +0 -15
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +0 -11
- package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +0 -1
- package/dist/_chunks/libs/mnemonist.mjs +0 -1
- package/dist/_chunks/libs/nano-spawn.mjs +0 -3
- package/dist/_chunks/libs/natural-compare-lite.mjs +0 -9
- package/dist/_chunks/libs/ohash.mjs +0 -1
- package/dist/_chunks/libs/p-limit.mjs +0 -1
- package/dist/_chunks/libs/p-queue.mjs +0 -1
- package/dist/_chunks/libs/p-timeout.mjs +0 -1
- package/dist/_chunks/libs/parse-ms.mjs +0 -1
- package/dist/_chunks/libs/pathe.mjs +0 -1
- package/dist/_chunks/libs/pretty-ms.mjs +0 -1
- package/dist/_chunks/libs/rehype-sanitize.mjs +0 -1
- package/dist/_chunks/libs/rehype-stringify.mjs +0 -1
- package/dist/_chunks/libs/remark-gfm.mjs +0 -1
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +0 -3
- package/dist/_chunks/libs/remark-parse.mjs +0 -1
- package/dist/_chunks/libs/remark-rehype.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -2
- package/dist/_chunks/libs/safe-stringify.mjs +0 -1
- package/dist/_chunks/libs/strip-indent.mjs +0 -1
- package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/_chunks/libs/trough.mjs +0 -1
- package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/_chunks/libs/ufo.mjs +0 -1
- package/dist/_chunks/libs/unified.mjs +0 -1
- package/dist/_chunks/libs/unstorage.mjs +0 -1
- package/dist/_chunks/libs/which.mjs +0 -1
- package/dist/_chunks/libs/word-wrap.mjs +0 -12
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/_chunks/src.mjs +0 -1228
- /package/dist/{_chunks → chunks}/libs/character-entities-html4.mjs +0 -0
- /package/dist/{_chunks → chunks}/libs/character-entities-legacy.mjs +0 -0
- /package/dist/{_chunks → chunks}/libs/character-entities.mjs +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={tomato1:`#fffcfc`,tomato2:`#fff8f7`,tomato3:`#feebe7`,tomato4:`#ffdcd3`,tomato5:`#ffcdc2`,tomato6:`#fdbdaf`,tomato7:`#f5a898`,tomato8:`#ec8e7b`,tomato9:`#e54d2e`,tomato10:`#dd4425`,tomato11:`#d13415`,tomato12:`#5c271f`},t={red1:`#fffcfc`,red2:`#fff7f7`,red3:`#feebec`,red4:`#ffdbdc`,red5:`#ffcdce`,red6:`#fdbdbe`,red7:`#f4a9aa`,red8:`#eb8e90`,red9:`#e5484d`,red10:`#dc3e42`,red11:`#ce2c31`,red12:`#641723`},n={ruby1:`#fffcfd`,ruby2:`#fff7f8`,ruby3:`#feeaed`,ruby4:`#ffdce1`,ruby5:`#ffced6`,ruby6:`#f8bfc8`,ruby7:`#efacb8`,ruby8:`#e592a3`,ruby9:`#e54666`,ruby10:`#dc3b5d`,ruby11:`#ca244d`,ruby12:`#64172b`},r={crimson1:`#fffcfd`,crimson2:`#fef7f9`,crimson3:`#ffe9f0`,crimson4:`#fedce7`,crimson5:`#facedd`,crimson6:`#f3bed1`,crimson7:`#eaacc3`,crimson8:`#e093b2`,crimson9:`#e93d82`,crimson10:`#df3478`,crimson11:`#cb1d63`,crimson12:`#621639`},i={pink1:`#fffcfe`,pink2:`#fef7fb`,pink3:`#fee9f5`,pink4:`#fbdcef`,pink5:`#f6cee7`,pink6:`#efbfdd`,pink7:`#e7acd0`,pink8:`#dd93c2`,pink9:`#d6409f`,pink10:`#cf3897`,pink11:`#c2298a`,pink12:`#651249`},a={purple1:`#fefcfe`,purple2:`#fbf7fe`,purple3:`#f7edfe`,purple4:`#f2e2fc`,purple5:`#ead5f9`,purple6:`#e0c4f4`,purple7:`#d1afec`,purple8:`#be93e4`,purple9:`#8e4ec6`,purple10:`#8347b9`,purple11:`#8145b5`,purple12:`#402060`},o={violet1:`#fdfcfe`,violet2:`#faf8ff`,violet3:`#f4f0fe`,violet4:`#ebe4ff`,violet5:`#e1d9ff`,violet6:`#d4cafe`,violet7:`#c2b5f5`,violet8:`#aa99ec`,violet9:`#6e56cf`,violet10:`#654dc4`,violet11:`#6550b9`,violet12:`#2f265f`},s={indigo1:`#fdfdfe`,indigo2:`#f7f9ff`,indigo3:`#edf2fe`,indigo4:`#e1e9ff`,indigo5:`#d2deff`,indigo6:`#c1d0ff`,indigo7:`#abbdf9`,indigo8:`#8da4ef`,indigo9:`#3e63dd`,indigo10:`#3358d4`,indigo11:`#3a5bc7`,indigo12:`#1f2d5c`},c={blue1:`#fbfdff`,blue2:`#f4faff`,blue3:`#e6f4fe`,blue4:`#d5efff`,blue5:`#c2e5ff`,blue6:`#acd8fc`,blue7:`#8ec8f6`,blue8:`#5eb1ef`,blue9:`#0090ff`,blue10:`#0588f0`,blue11:`#0d74ce`,blue12:`#113264`},l={teal1:`#fafefd`,teal2:`#f3fbf9`,teal3:`#e0f8f3`,teal4:`#ccf3ea`,teal5:`#b8eae0`,teal6:`#a1ded2`,teal7:`#83cdc1`,teal8:`#53b9ab`,teal9:`#12a594`,teal10:`#0d9b8a`,teal11:`#008573`,teal12:`#0d3d38`},u={grass1:`#fbfefb`,grass2:`#f5fbf5`,grass3:`#e9f6e9`,grass4:`#daf1db`,grass5:`#c9e8ca`,grass6:`#b2ddb5`,grass7:`#94ce9a`,grass8:`#65ba74`,grass9:`#46a758`,grass10:`#3e9b4f`,grass11:`#2a7e3b`,grass12:`#203c25`},d={lime1:`#fcfdfa`,lime2:`#f8faf3`,lime3:`#eef6d6`,lime4:`#e2f0bd`,lime5:`#d3e7a6`,lime6:`#c2da91`,lime7:`#abc978`,lime8:`#8db654`,lime9:`#bdee63`,lime10:`#b0e64c`,lime11:`#5c7c2f`,lime12:`#37401c`},f={yellow1:`#fdfdf9`,yellow2:`#fefce9`,yellow3:`#fffab8`,yellow4:`#fff394`,yellow5:`#ffe770`,yellow6:`#f3d768`,yellow7:`#e4c767`,yellow8:`#d5ae39`,yellow9:`#ffe629`,yellow10:`#ffdc00`,yellow11:`#9e6c00`,yellow12:`#473b1f`},p={amber1:`#fefdfb`,amber2:`#fefbe9`,amber3:`#fff7c2`,amber4:`#ffee9c`,amber5:`#fbe577`,amber6:`#f3d673`,amber7:`#e9c162`,amber8:`#e2a336`,amber9:`#ffc53d`,amber10:`#ffba18`,amber11:`#ab6400`,amber12:`#4f3422`},m={orange1:`#fefcfb`,orange2:`#fff7ed`,orange3:`#ffefd6`,orange4:`#ffdfb5`,orange5:`#ffd19a`,orange6:`#ffc182`,orange7:`#f5ae73`,orange8:`#ec9455`,orange9:`#f76b15`,orange10:`#ef5f00`,orange11:`#cc4e00`,orange12:`#582d1d`};export{s as a,i as c,n as d,l as f,f as h,u as i,a as l,o as m,c as n,d as o,e as p,r,m as s,p as t,t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=typeof self==`object`?self:globalThis,t=(t,n)=>{let r=(e,n)=>(t.set(n,e),e),i=a=>{if(t.has(a))return t.get(a);let[o,s]=n[a];switch(o){case 0:case-1:return r(s,a);case 1:{let e=r([],a);for(let t of s)e.push(i(t));return e}case 2:{let e=r({},a);for(let[t,n]of s)e[i(t)]=i(n);return e}case 3:return r(new Date(s),a);case 4:{let{source:e,flags:t}=s;return r(new RegExp(e,t),a)}case 5:{let e=r(new Map,a);for(let[t,n]of s)e.set(i(t),i(n));return e}case 6:{let e=r(new Set,a);for(let t of s)e.add(i(t));return e}case 7:{let{name:t,message:n}=s;return r(new e[t](n),a)}case 8:return r(BigInt(s),a);case`BigInt`:return r(Object(BigInt(s)),a);case`ArrayBuffer`:return r(new Uint8Array(s).buffer,s);case`DataView`:{let{buffer:e}=new Uint8Array(s);return r(new DataView(e),s)}}return r(new e[o](s),a)};return i},n=e=>t(new Map,e)(0),{toString:r}={},{keys:i}=Object,a=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=r.call(e).slice(8,-1);switch(n){case`Array`:return[1,``];case`Object`:return[2,``];case`Date`:return[3,``];case`RegExp`:return[4,``];case`Map`:return[5,``];case`Set`:return[6,``];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},o=([e,t])=>e===0&&(t===`function`||t===`symbol`),s=(e,t,n,r)=>{let s=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},c=r=>{if(n.has(r))return n.get(r);let[l,u]=a(r);switch(l){case 0:{let t=r;switch(u){case`bigint`:l=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+u);t=null;break;case`undefined`:return s([-1],r)}return s([l,t],r)}case 1:{if(u){let e=r;return u===`DataView`?e=new Uint8Array(r.buffer):u===`ArrayBuffer`&&(e=new Uint8Array(r)),s([u,[...e]],r)}let e=[],t=s([l,e],r);for(let t of r)e.push(c(t));return t}case 2:{if(u)switch(u){case`BigInt`:return s([u,r.toString()],r);case`Boolean`:case`Number`:case`String`:return s([u,r.valueOf()],r)}if(t&&`toJSON`in r)return c(r.toJSON());let n=[],d=s([l,n],r);for(let t of i(r))(e||!o(a(r[t])))&&n.push([c(t),c(r[t])]);return d}case 3:return s([l,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return s([l,{source:e,flags:t}],r)}case 5:{let t=[],n=s([l,t],r);for(let[n,i]of r)(e||!(o(a(n))||o(a(i))))&&t.push([c(n),c(i)]);return n}case 6:{let t=[],n=s([l,t],r);for(let n of r)(e||!o(a(n)))&&t.push(c(n));return n}}let{message:d}=r;return s([l,{name:u,message:d}],r)};return c},c=(e,{json:t,lossy:n}={})=>{let r=[];return s(!(t||n),!!t,new Map,r)(e),r};var l=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?n(c(e,t)):structuredClone(e):(e,t)=>n(c(e,t));export{l as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){if(e)throw e}export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}export{e as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e,l as t,r as n,u as r}from"./chevrotain.mjs";import{C as i,E as a,L as o,N as s,P as c,_ as l,c as u,d,f,h as p,l as m,o as h,p as g,q as _,u as v,x as y,z as b}from"./@chevrotain/cst-dts-gen.mjs";function x(e,t,n){return`${e.name}_${t}_${n}`}var S=class{constructor(e){this.target=e}isEpsilon(){return!1}},C=class extends S{constructor(e,t){super(e),this.tokenType=t}},w=class extends S{constructor(e){super(e)}isEpsilon(){return!0}},T=class extends S{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}};function ee(e){let t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};te(t,e);let n=e.length;for(let r=0;r<n;r++){let n=e[r],i=k(t,n,n);i!==void 0&&ce(t,n,i)}return t}function te(e,t){let n=t.length;for(let r=0;r<n;r++){let n=t[r],i=R(e,n,void 0,{type:2}),a=R(e,n,void 0,{type:7});i.stop=a,e.ruleToStartState.set(n,i),e.ruleToStopState.set(n,a)}}function E(e,t,n){return n instanceof p?I(e,t,n.terminalType,n):n instanceof u?se(e,t,n):n instanceof h?ie(e,t,n):n instanceof m?ae(e,t,n):n instanceof v?D(e,t,n):n instanceof g?O(e,t,n):n instanceof d?ne(e,t,n):n instanceof f?re(e,t,n):k(e,t,n)}function D(e,t,n){let r=R(e,t,n,{type:5});return M(e,r),j(e,t,n,N(e,t,r,n,k(e,t,n)))}function O(e,t,n){let r=R(e,t,n,{type:5});return M(e,r),j(e,t,n,N(e,t,r,n,k(e,t,n)),I(e,t,n.separator,n))}function ne(e,t,n){let r=R(e,t,n,{type:4});return M(e,r),A(e,t,n,N(e,t,r,n,k(e,t,n)))}function re(e,t,n){let r=R(e,t,n,{type:4});return M(e,r),A(e,t,n,N(e,t,r,n,k(e,t,n)),I(e,t,n.separator,n))}function ie(e,t,n){let r=R(e,t,n,{type:1});return M(e,r),N(e,t,r,n,...c(n.definition,n=>E(e,t,n)))}function ae(e,t,n){let r=R(e,t,n,{type:1});return M(e,r),oe(e,t,n,N(e,t,r,n,k(e,t,n)))}function k(e,t,n){let r=o(c(n.definition,n=>E(e,t,n)),e=>e!==void 0);return r.length===1?r[0]:r.length===0?void 0:F(e,r)}function A(e,t,n,r,i){let a=r.left,o=r.right,s=R(e,t,n,{type:11});M(e,s);let c=R(e,t,n,{type:12});return a.loopback=s,c.loopback=s,e.decisionMap[x(t,i?`RepetitionMandatoryWithSeparator`:`RepetitionMandatory`,n.idx)]=s,L(o,s),i===void 0?(L(s,a),L(s,c)):(L(s,c),L(s,i.left),L(i.right,a)),{left:a,right:c}}function j(e,t,n,r,i){let a=r.left,o=r.right,s=R(e,t,n,{type:10});M(e,s);let c=R(e,t,n,{type:12}),l=R(e,t,n,{type:9});return s.loopback=l,c.loopback=l,L(s,a),L(s,c),L(o,l),i===void 0?L(l,s):(L(l,c),L(l,i.left),L(i.right,a)),e.decisionMap[x(t,i?`RepetitionWithSeparator`:`Repetition`,n.idx)]=s,{left:s,right:c}}function oe(e,t,n,r){let i=r.left,a=r.right;return L(i,a),e.decisionMap[x(t,`Option`,n.idx)]=i,r}function M(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function N(e,t,n,r,...i){let a=R(e,t,r,{type:8,start:n});n.end=a;for(let e of i)e===void 0?L(n,a):(L(n,e.left),L(e.right,a));let o={left:n,right:a};return e.decisionMap[x(t,P(r),r.idx)]=n,o}function P(e){if(e instanceof h)return`Alternation`;if(e instanceof m)return`Option`;if(e instanceof v)return`Repetition`;if(e instanceof g)return`RepetitionWithSeparator`;if(e instanceof d)return`RepetitionMandatory`;if(e instanceof f)return`RepetitionMandatoryWithSeparator`;throw Error(`Invalid production type encountered`)}function F(e,t){let n=t.length;for(let r=0;r<n-1;r++){let n=t[r],i;n.left.transitions.length===1&&(i=n.left.transitions[0]);let a=i instanceof T,o=i,s=t[r+1].left;n.left.type===1&&n.right.type===1&&i!==void 0&&(a&&o.followState===n.right||i.target===n.right)?(a?o.followState=s:i.target=s,B(e,n.right)):L(n.right,s)}let r=t[0],i=t[n-1];return{left:r.left,right:i.right}}function I(e,t,n,r){let i=R(e,t,r,{type:1}),a=R(e,t,r,{type:1});return z(i,new C(a,n)),{left:i,right:a}}function se(e,t,n){let r=n.referencedRule,i=e.ruleToStartState.get(r),a=R(e,t,n,{type:1}),o=R(e,t,n,{type:1});return z(a,new T(i,r,o)),{left:a,right:o}}function ce(e,t,n){let r=e.ruleToStartState.get(t);L(r,n.left);let i=e.ruleToStopState.get(t);return L(n.right,i),{left:r,right:i}}function L(e,t){z(e,new w(t))}function R(e,t,n,r){let i=Object.assign({atn:e,production:n,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},r);return e.states.push(i),i}function z(e,t){e.transitions.length===0&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function B(e,t){e.states.splice(e.states.indexOf(t),1)}const V={};var H=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let t=U(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return c(this.configs,e=>e.alt)}get key(){let e=``;for(let t in this.map)e+=t+`:`;return e}};function U(e,t=!0){return`${t?`a${e.alt}`:``}s${e.state.stateNumber}:${e.stack.map(e=>e.stateNumber.toString()).join(`_`)}`}function W(e,t){let n={};return r=>{let i=r.toString(),a=n[i];return a===void 0?(a={atnStartState:e,decision:t,states:{}},n[i]=a,a):a}}var G=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e=``,t=this.predicates.length;for(let n=0;n<t;n++)e+=this.predicates[n]===!0?`1`:`0`;return e}};const K=new G;var le=class extends n{constructor(e){super(),this.logging=e?.logging??(e=>console.log(e))}initialize(e){this.atn=ee(e.rules),this.dfas=J(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(t){let{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:a}=t,o=this.dfas,s=this.logging,l=x(r,`Alternation`,n),u=this.atn.decisionMap[l].decision,d=c(e({maxLookahead:1,occurrence:n,prodType:`Alternation`,rule:r}),e=>c(e,e=>e[0]));if(q(d,!1)&&!a){let e=y(d,(e,t,n)=>(b(t,t=>{t&&(e[t.tokenTypeIdx]=n,b(t.categoryMatches,t=>{e[t]=n}))}),e),{});return i?function(t){let n=e[this.LA(1).tokenTypeIdx];if(t!==void 0&&n!==void 0){let e=t[n]?.GATE;if(e!==void 0&&e.call(this)===!1)return}return n}:function(){return e[this.LA(1).tokenTypeIdx]}}else if(i)return function(e){let t=new G,n=e===void 0?0:e.length;for(let r=0;r<n;r++){let n=e?.[r].GATE;t.set(r,n===void 0||n.call(this))}let r=Y.call(this,o,u,t,s);return typeof r==`number`?r:void 0};else return function(){let e=Y.call(this,o,u,K,s);return typeof e==`number`?e:void 0}}buildLookaheadForOptional(t){let{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:o}=t,s=this.dfas,l=this.logging,u=x(r,i,n),d=this.atn.decisionMap[u].decision,f=c(e({maxLookahead:1,occurrence:n,prodType:i,rule:r}),e=>c(e,e=>e[0]));if(q(f)&&f[0][0]&&!o){let e=f[0],t=_(e);if(t.length===1&&a(t[0].categoryMatches)){let e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}else{let e=y(t,(e,t)=>(t!==void 0&&(e[t.tokenTypeIdx]=!0,b(t.categoryMatches,t=>{e[t]=!0})),e),{});return function(){return e[this.LA(1).tokenTypeIdx]===!0}}}return function(){let e=Y.call(this,s,d,K,l);return typeof e==`object`?!1:e===0}}};function q(e,t=!0){let n=new Set;for(let r of e){let e=new Set;for(let i of r){if(i===void 0){if(t)break;return!1}let r=[i.tokenTypeIdx].concat(i.categoryMatches);for(let t of r)if(n.has(t)){if(!e.has(t))return!1}else n.add(t),e.add(t)}}return!0}function J(e){let t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=W(e.decisionStates[r],r);return n}function Y(e,t,n,r){let i=e[t](n),a=i.start;return a===void 0&&(a=Q(i,X(be(i.atnStartState))),i.start=a),ue.apply(this,[i,a,n,r])}function ue(e,t,n,r){let i=t,a=1,o=[],s=this.LA(a++);for(;;){let t=ge(i,s);if(t===void 0&&(t=de.apply(this,[e,i,s,a,n,r])),t===V)return he(o,i,s);if(t.isAcceptState===!0)return t.prediction;i=t,o.push(s),s=this.LA(a++)}}function de(e,t,n,r,a,o){let s=_e(t.configs,n,a);if(s.size===0)return Z(e,t,n,V),V;let c=X(s),l=ye(s,a);if(l!==void 0)c.isAcceptState=!0,c.prediction=l,c.configs.uniqueAlt=l;else if(we(s)){let t=i(s.alts);c.isAcceptState=!0,c.prediction=t,c.configs.uniqueAlt=t,fe.apply(this,[e,r,s.alts,o])}return c=Z(e,t,n,c),c}function fe(e,t,n,r){let i=[];for(let e=1;e<=t;e++)i.push(this.LA(e).tokenType);let a=e.atnStartState,o=a.rule,s=a.production;r(pe({topLevelRule:o,ambiguityIndices:n,production:s,prefixPath:i}))}function pe(e){let n=c(e.prefixPath,e=>t(e)).join(`, `),r=e.production.idx===0?``:e.production.idx,i=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(`, `)}> in <${me(e.production)}${r}> inside <${e.topLevelRule.name}> Rule,\n<${n}> may appears as a prefix path in all these alternatives.\n`;return i+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
2
|
-
For Further details.`,i}function me(e){if(e instanceof u)return`SUBRULE`;if(e instanceof m)return`OPTION`;if(e instanceof h)return`OR`;if(e instanceof d)return`AT_LEAST_ONE`;if(e instanceof f)return`AT_LEAST_ONE_SEP`;if(e instanceof g)return`MANY_SEP`;if(e instanceof v)return`MANY`;if(e instanceof p)return`CONSUME`;throw Error(`non exhaustive match`)}function he(e,t,n){return{actualToken:n,possibleTokenTypes:l(s(t.configs.elements,e=>e.state.transitions).filter(e=>e instanceof C).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:e}}function ge(e,t){return e.edges[t.tokenTypeIdx]}function _e(e,t,n){let r=new H,i=[];for(let a of e.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===7){i.push(a);continue}let e=a.state.transitions.length;for(let n=0;n<e;n++){let e=a.state.transitions[n],i=ve(e,t);i!==void 0&&r.add({state:i,alt:a.alt,stack:a.stack})}}let a;if(i.length===0&&r.size===1&&(a=r),a===void 0){a=new H;for(let e of r.elements)$(e,a)}if(i.length>0&&!Se(a))for(let e of i)a.add(e);return a}function ve(e,t){if(e instanceof C&&r(t,e.tokenType))return e.target}function ye(e,t){let n;for(let r of e.elements)if(t.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function X(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function Z(e,t,n,r){return r=Q(e,r),t.edges[n.tokenTypeIdx]=r,r}function Q(e,t){if(t===V)return t;let n=t.configs.key,r=e.states[n];return r===void 0?(t.configs.finalize(),e.states[n]=t,t):r}function be(e){let t=new H,n=e.transitions.length;for(let r=0;r<n;r++)$({state:e.transitions[r].target,alt:r,stack:[]},t);return t}function $(e,t){let n=e.state;if(n.type===7){if(e.stack.length>0){let n=[...e.stack];$({state:n.pop(),alt:e.alt,stack:n},t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);let r=n.transitions.length;for(let i=0;i<r;i++){let r=n.transitions[i],a=xe(e,r);a!==void 0&&$(a,t)}}function xe(e,t){if(t instanceof w)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof T){let n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}function Se(e){for(let t of e.elements)if(t.state.type===7)return!0;return!1}function Ce(e){for(let t of e.elements)if(t.state.type!==7)return!1;return!0}function we(e){if(Ce(e))return!0;let t=Te(e.elements);return Ee(t)&&!De(t)}function Te(e){let t=new Map;for(let n of e){let e=U(n,!1),r=t.get(e);r===void 0&&(r={},t.set(e,r)),r[n.alt]=!0}return t}function Ee(e){for(let t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}function De(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}export{le as t};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./@chevrotain/regexp-to-ast.mjs";import{$ as n,A as r,B as i,D as a,E as o,F as s,G as c,H as l,I as u,J as d,K as f,L as p,M as m,N as h,O as g,P as _,Q as v,R as y,S as b,T as x,U as S,V as C,W as ee,X as w,Y as T,Z as E,a as D,b as O,c as k,d as A,et as j,f as M,g as te,h as N,i as ne,j as P,k as F,l as I,m as L,n as re,o as ie,p as ae,q as R,r as oe,s as z,t as B,u as V,v as se,w as H,x as U,y as ce,z as W}from"./@chevrotain/cst-dts-gen.mjs";import{i as le,n as ue,r as de,t as fe}from"./@chevrotain/utils.mjs";var pe=class{walk(e,t=[]){W(e.definition,(n,r)=>{let i=C(e.definition,r+1);if(n instanceof k)this.walkProdRef(n,i,t);else if(n instanceof N)this.walkTerminal(n,i,t);else if(n instanceof z)this.walkFlat(n,i,t);else if(n instanceof I)this.walkOption(n,i,t);else if(n instanceof A)this.walkAtLeastOne(n,i,t);else if(n instanceof M)this.walkAtLeastOneSep(n,i,t);else if(n instanceof ae)this.walkManySep(n,i,t);else if(n instanceof V)this.walkMany(n,i,t);else if(n instanceof ie)this.walkOr(n,i,t);else throw Error(`non exhaustive match`)})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){let r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){let r=[new I({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=me(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new I({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=me(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);W(e.definition,e=>{let t=new z({definition:[e]});this.walk(t,r)})}};function me(e,t,n){return[new I({definition:[new N({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function he(e){if(e instanceof k)return he(e.referencedRule);if(e instanceof N)return ve(e);if(ne(e))return ge(e);if(re(e))return _e(e);throw Error(`non exhaustive match`)}function ge(e){let t=[],n=e.definition,r=0,i=n.length>r,a,o=!0;for(;i&&o;)a=n[r],o=oe(a),t=t.concat(he(a)),r+=1,i=n.length>r;return se(t)}function _e(e){return se(R(_(e.definition,e=>he(e))))}function ve(e){return[e.terminalType]}const ye=`_~IN~_`;var be=class extends pe{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let r=Se(e.referencedRule,e.idx)+this.topProd.name,i=he(new z({definition:t.concat(n)}));this.follows[r]=i}};function xe(e){let t={};return W(e,e=>{d(t,new be(e).startWalking())}),t}function Se(e,t){return e.name+t+ye}let Ce={};const we=new e;function Te(e){let t=e.toString();if(Ce.hasOwnProperty(t))return Ce[t];{let e=we.pattern(t);return Ce[t]=e,e}}function Ee(){Ce={}}const De=`Complement Sets are not supported for first char optimization`,Oe=`Unable to use "first char" lexer optimizations:
|
|
2
|
-
`;function ke(e,t=!1){try{let t=Te(e);return Ae(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===De)t&&le(`${Oe}\tUnable to optimize: < ${e.toString()} >\n Complement Sets cannot be automatically optimized.
|
|
3
|
-
This will disable the lexer's first char optimizations.
|
|
4
|
-
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
|
|
5
|
-
This will disable the lexer's first char optimizations.
|
|
6
|
-
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),de(`${Oe}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Ae(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)Ae(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:je(a.value,t,n);break;case`Set`:if(a.complement===!0)throw Error(De);W(a.value,e=>{if(typeof e==`number`)je(e,t,n);else{let r=e;if(n===!0)for(let e=r.from;e<=r.to;e++)je(e,t,n);else{for(let e=r.from;e<=r.to&&e<ht;e++)je(e,t,n);if(r.to>=ht){let e=r.from>=ht?r.from:ht,n=r.to,i=K(e),a=K(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:Ae(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&Pe(a)===!1||a.type!==`Group`&&o===!1)break}break;default:throw Error(`non exhaustive match!`)}return F(t)}function je(e,t,n){let r=K(e);t[r]=r,n===!0&&Me(e,t)}function Me(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=K(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=K(e.charCodeAt(0));t[n]=n}}}function Ne(e,t){return u(e.value,e=>{if(typeof e==`number`)return g(t,e);{let n=e;return u(t,e=>n.from<=e&&e<=n.to)!==void 0}})}function Pe(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?j(e.value)?y(e.value,Pe):Pe(e.value):!1}var Fe=class extends t{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){g(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Ne(e,this.targetCharCodes)===void 0&&(this.found=!0):Ne(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Ie(e,t){if(t instanceof RegExp){let n=Te(t),r=new Fe(e);return r.visit(n),r.found}else return u(t,t=>g(e,t.charCodeAt(0)))!==void 0}const G=`PATTERN`,Le=`defaultMode`,Re=`modes`;let ze=typeof RegExp(`(?:)`).sticky==`boolean`;function Be(e,t){t=ee(t,{useSticky:ze,debug:!1,safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
|
|
7
|
-
`],tracer:(e,t)=>t()});let n=t.tracer;n(`initCharCodeToOptimizedIndexMap`,()=>{_t()});let i;n(`Reject Lexer.NA`,()=>{i=O(e,e=>e[G]===J.NA)});let s=!1,c;n(`Transform Patterns`,()=>{s=!1,c=_(i,e=>{let n=e[G];if(x(n)){let e=n.source;return e.length===1&&e!==`^`&&e!==`$`&&e!==`.`&&!n.ignoreCase?e:e.length===2&&e[0]===`\\`&&!g([`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`],e[1])?e[1]:t.useSticky?it(n):rt(n)}else if(E(n))return s=!0,{exec:n};else if(typeof n==`object`)return s=!0,n;else if(typeof n==`string`){if(n.length===1)return n;{let e=n.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`),r=new RegExp(e);return t.useSticky?it(r):rt(r)}}else throw Error(`non exhaustive match`)})});let l,u,d,f,p;n(`misc mapping`,()=>{l=_(i,e=>e.tokenTypeIdx),u=_(i,e=>{let t=e.GROUP;if(t!==J.SKIPPED){if(r(t))return t;if(H(t))return!1;throw Error(`non exhaustive match`)}}),d=_(i,e=>{let t=e.LONGER_ALT;if(t)return j(t)?_(t,e=>a(i,e)):[a(i,t)]}),f=_(i,e=>e.PUSH_MODE),p=_(i,e=>P(e,`POP_MODE`))});let m;n(`Line Terminator Handling`,()=>{let e=pt(t.lineTerminatorCharacters);m=_(i,e=>!1),t.positionTracking!==`onlyOffset`&&(m=_(i,t=>P(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:dt(t,e)===!1&&Ie(e,t.PATTERN)))});let h,v,y,b;n(`Misc Mapping #2`,()=>{h=_(i,ct),v=_(c,lt),y=U(i,(e,t)=>{let n=t.GROUP;return r(n)&&n!==J.SKIPPED&&(e[n]=[]),e},{}),b=_(c,(e,t)=>({pattern:c[t],longerAlt:d[t],canLineTerminator:m[t],isCustom:h[t],short:v[t],group:u[t],push:f[t],pop:p[t],tokenTypeIdx:l[t],tokenType:i[t]}))});let S=!0,C=[];return t.safeMode||n(`First Char Optimization`,()=>{C=U(i,(e,n,r)=>{if(typeof n.PATTERN==`string`)mt(e,K(n.PATTERN.charCodeAt(0)),b[r]);else if(j(n.START_CHARS_HINT)){let t;W(n.START_CHARS_HINT,n=>{let i=K(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,mt(e,i,b[r]))})}else if(x(n.PATTERN))if(n.PATTERN.unicode)S=!1,t.ensureOptimizations&&de(`${Oe}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
8
|
-
This will disable the lexer's first char optimizations.
|
|
9
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=ke(n.PATTERN,t.ensureOptimizations);o(i)&&(S=!1),W(i,t=>{mt(e,t,b[r])})}else t.ensureOptimizations&&de(`${Oe}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n This will disable the lexer's first char optimizations.
|
|
10
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),S=!1;return e},[])}),{emptyGroups:y,patternIdxToConfig:b,charCodeToPatternIdxToConfig:C,hasCustom:s,canBeOptimized:S}}function Ve(e,t){let n=[],r=Ue(e);n=n.concat(r.errors);let i=We(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(He(a)),n=n.concat(Qe(a)),n=n.concat($e(a,t)),n=n.concat(et(a)),n}function He(e){let t=[],n=p(e,e=>x(e[G]));return t=t.concat(Ke(n)),t=t.concat(Ye(n)),t=t.concat(Xe(n)),t=t.concat(Ze(n)),t=t.concat(qe(n)),t}function Ue(e){let t=p(e,e=>!P(e,G));return{errors:_(t,e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:q.MISSING_PATTERN,tokenTypes:[e]})),valid:S(e,t)}}function We(e){let t=p(e,e=>{let t=e[G];return!x(t)&&!E(t)&&!P(t,`exec`)&&!r(t)});return{errors:_(t,e=>({message:`Token Type: ->`+e.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:[e]})),valid:S(e,t)}}const Ge=/[^\\][$]/;function Ke(e){class n extends t{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return _(p(e,e=>{let t=e.PATTERN;try{let e=Te(t),r=new n;return r.visit(e),r.found}catch{return Ge.test(t.source)}}),e=>({message:`Unexpected RegExp Anchor Error:
|
|
11
|
-
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
12
|
-
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}function qe(e){return _(p(e,e=>e.PATTERN.test(``)),e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:q.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}const Je=/[^\\[][\^]|^\^/;function Ye(e){class n extends t{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return _(p(e,e=>{let t=e.PATTERN;try{let e=Te(t),r=new n;return r.visit(e),r.found}catch{return Je.test(t.source)}}),e=>({message:`Unexpected RegExp Anchor Error:
|
|
13
|
-
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
14
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}function Xe(e){return _(p(e,e=>{let t=e[G];return t instanceof RegExp&&(t.multiline||t.global)}),e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}function Ze(e){let t=[],n=_(e,n=>U(e,(e,r)=>n.PATTERN.source===r.PATTERN.source&&!g(t,r)&&r.PATTERN!==J.NA?(t.push(r),e.push(r),e):e,[]));return n=c(n),_(p(n,e=>e.length>1),e=>{let t=_(e,e=>e.name);return{message:`The same RegExp pattern ->${s(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}function Qe(e){return _(p(e,e=>{if(!P(e,`GROUP`))return!1;let t=e.GROUP;return t!==J.SKIPPED&&t!==J.NA&&!r(t)}),e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}function $e(e,t){return _(p(e,e=>e.PUSH_MODE!==void 0&&!g(t,e.PUSH_MODE)),e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}function et(e){let t=[],n=U(e,(e,t,n)=>{let i=t.PATTERN;return i===J.NA||(r(i)?e.push({str:i,idx:n,tokenType:t}):x(i)&&nt(i)&&e.push({str:i.source,idx:n,tokenType:t})),e},[]);return W(e,(e,r)=>{W(n,({str:n,idx:i,tokenType:a})=>{if(r<i&&tt(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:q.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}function tt(e,t){if(x(t)){let n=t.exec(e);return n!==null&&n.index===0}else if(E(t))return t(e,0,[],{});else if(P(t,`exec`))return t.exec(e,0,[],{});else if(typeof t==`string`)return t===e;else throw Error(`non exhaustive match`)}function nt(e){return u([`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`],t=>e.source.indexOf(t)!==-1)===void 0}function rt(e){let t=e.ignoreCase?`i`:``;return RegExp(`^(?:${e.source})`,t)}function it(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}function at(e,t,n){let r=[];return P(e,Le)||r.push({message:`A MultiMode Lexer cannot be initialized without a <`+Le+`> property in its definition
|
|
15
|
-
`,type:q.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),P(e,Re)||r.push({message:`A MultiMode Lexer cannot be initialized without a <`+Re+`> property in its definition
|
|
16
|
-
`,type:q.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),P(e,Re)&&P(e,Le)&&!P(e.modes,e.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Le}: <${e.defaultMode}>which does not exist\n`,type:q.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),P(e,Re)&&W(e.modes,(e,t)=>{W(e,(n,i)=>{H(n)?r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${t}> at index: <${i}>\n`,type:q.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):P(n,`LONGER_ALT`)&&W(j(n.LONGER_ALT)?n.LONGER_ALT:[n.LONGER_ALT],i=>{!H(i)&&!g(e,i)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${n.name}> outside of mode <${t}>\n`,type:q.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),r}function ot(e,t,n){let r=[],i=!1,a=O(c(R(F(e.modes))),e=>e[G]===J.NA),o=pt(n);return t&&W(a,e=>{let t=dt(e,o);if(t!==!1){let n={message:ft(e,t),type:t.issue,tokenType:e};r.push(n)}else P(e,`LINE_BREAKS`)?e.LINE_BREAKS===!0&&(i=!0):Ie(o,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|
17
|
-
This Lexer has been defined to track line and column information,
|
|
18
|
-
But none of the Token Types can be identified as matching a line terminator.
|
|
19
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
20
|
-
for details.`,type:q.NO_LINE_BREAKS_FLAGS}),r}function st(e){let t={};return W(T(e),n=>{let r=e[n];if(j(r))t[n]=[];else throw Error(`non exhaustive match`)}),t}function ct(e){let t=e.PATTERN;if(x(t))return!1;if(E(t)||P(t,`exec`))return!0;if(r(t))return!1;throw Error(`non exhaustive match`)}function lt(e){return r(e)&&e.length===1?e.charCodeAt(0):!1}const ut={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return e.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function dt(e,t){if(P(e,`LINE_BREAKS`))return!1;if(x(e.PATTERN)){try{Ie(t,e.PATTERN)}catch(e){return{issue:q.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}else if(r(e.PATTERN))return!1;else if(ct(e))return{issue:q.CUSTOM_LINE_BREAK};else throw Error(`non exhaustive match`)}function ft(e,t){if(t.issue===q.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
21
|
-
\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
22
|
-
\tThe problem is in the <${e.name}> Token Type\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}function pt(e){return _(e,e=>r(e)?e.charCodeAt(0):e)}function mt(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}const ht=256;let gt=[];function K(e){return e<256?e:gt[e]}function _t(){if(o(gt)){gt=Array(65536);for(let e=0;e<65536;e++)gt[e]=e>255?255+~~(e/255):e}}function vt(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[n]===!0}function yt(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let bt=1;const xt={};function St(e){let t=Ct(e);wt(t),Et(t),Tt(t),W(t,e=>{e.isParent=e.categoryMatches.length>0})}function Ct(e){let t=f(e),n=e,r=!0;for(;r;){n=c(R(_(n,e=>e.CATEGORIES)));let e=S(n,t);t=t.concat(e),o(e)?r=!1:n=e}return t}function wt(e){W(e,e=>{Ot(e)||(xt[bt]=e,e.tokenTypeIdx=bt++),kt(e)&&!j(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),kt(e)||(e.CATEGORIES=[]),At(e)||(e.categoryMatches=[]),jt(e)||(e.categoryMatchesMap={})})}function Tt(e){W(e,e=>{e.categoryMatches=[],W(e.categoryMatchesMap,(t,n)=>{e.categoryMatches.push(xt[n].tokenTypeIdx)})})}function Et(e){W(e,e=>{Dt([],e)})}function Dt(e,t){W(e,e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),W(t.CATEGORIES,n=>{let r=e.concat(t);g(r,n)||Dt(r,n)})}function Ot(e){return P(e,`tokenTypeIdx`)}function kt(e){return P(e,`CATEGORIES`)}function At(e){return P(e,`categoryMatches`)}function jt(e){return P(e,`categoryMatchesMap`)}function Mt(e){return P(e,`tokenTypeIdx`)}const Nt={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,n,r,i){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`}};var q;(function(e){e[e.MISSING_PATTERN=0]=`MISSING_PATTERN`,e[e.INVALID_PATTERN=1]=`INVALID_PATTERN`,e[e.EOI_ANCHOR_FOUND=2]=`EOI_ANCHOR_FOUND`,e[e.UNSUPPORTED_FLAGS_FOUND=3]=`UNSUPPORTED_FLAGS_FOUND`,e[e.DUPLICATE_PATTERNS_FOUND=4]=`DUPLICATE_PATTERNS_FOUND`,e[e.INVALID_GROUP_TYPE_FOUND=5]=`INVALID_GROUP_TYPE_FOUND`,e[e.PUSH_MODE_DOES_NOT_EXIST=6]=`PUSH_MODE_DOES_NOT_EXIST`,e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]=`MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE`,e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]=`MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY`,e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]=`MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST`,e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]=`LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED`,e[e.SOI_ANCHOR_FOUND=11]=`SOI_ANCHOR_FOUND`,e[e.EMPTY_MATCH_PATTERN=12]=`EMPTY_MATCH_PATTERN`,e[e.NO_LINE_BREAKS_FLAGS=13]=`NO_LINE_BREAKS_FLAGS`,e[e.UNREACHABLE_PATTERN=14]=`UNREACHABLE_PATTERN`,e[e.IDENTIFY_TERMINATOR=15]=`IDENTIFY_TERMINATOR`,e[e.CUSTOM_LINE_BREAK=16]=`CUSTOM_LINE_BREAK`,e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]=`MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE`})(q||={});const Pt={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
23
|
-
`,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Nt,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Pt);var J=class{constructor(e,t=Pt){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=(e,t)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=ue(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}else return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
24
|
-
a boolean 2nd argument is no longer supported`);this.config=d({},Pt,t);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n==`number`&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,()=>{let n,r=!0;this.TRACE_INIT(`Lexer Config handling`,()=>{if(this.config.lineTerminatorsPattern===Pt.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ut;else if(this.config.lineTerminatorCharacters===Pt.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
25
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.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),j(e)?n={modes:{defaultMode:f(e)},defaultMode:Le}:(r=!1,n=f(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT(`performRuntimeChecks`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(at(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT(`performWarningRuntimeChecks`,()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(ot(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},W(n.modes,(e,t)=>{n.modes[t]=O(e,e=>H(e))});let i=T(n.modes);if(W(n.modes,(e,n)=>{this.TRACE_INIT(`Mode: <${n}> processing`,()=>{if(this.modes.push(n),this.config.skipValidations===!1&&this.TRACE_INIT(`validatePatterns`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Ve(e,i))}),o(this.lexerDefinitionErrors)){St(e);let r;this.TRACE_INIT(`analyzeTokenTypes`,()=>{r=Be(e,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[n]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[n]=r.charCodeToPatternIdxToConfig,this.emptyGroups=d({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[n]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,!o(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let e=_(this.lexerDefinitionErrors,e=>e.message).join(`-----------------------
|
|
26
|
-
`);throw Error(`Errors detected in definition of Lexer:
|
|
27
|
-
`+e)}W(this.lexerDefinitionWarning,e=>{le(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(ze?(this.chopInput=v,this.match=this.matchWithTest):(this.updateLastIndex=w,this.match=this.matchWithExec),r&&(this.handleModes=w),this.trackStartLines===!1&&(this.computeNewColumn=v),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=w),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=U(this.canModeBeOptimized,(e,t,n)=>(t===!1&&e.push(n),e),[]);if(t.ensureOptimizations&&!o(e))throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.\n Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
28
|
-
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{Ee()}),this.TRACE_INIT(`toFastProperties`,()=>{fe(this)})})}tokenize(e,t=this.defaultMode){if(!o(this.lexerDefinitionErrors)){let e=_(this.lexerDefinitionErrors,e=>e.message).join(`-----------------------
|
|
29
|
-
`);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
30
|
-
`+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,u,d,f,p,m,h,g,_,v=e,y=v.length,b=0,x=0,S=this.hasCustom?0:Math.floor(e.length/10),C=Array(S),ee=[],w=this.trackStartLines?1:void 0,T=this.trackStartLines?1:void 0,E=st(this.emptyGroups),D=this.trackStartLines,O=this.config.lineTerminatorsPattern,k=0,A=[],j=[],M=[],te=[];Object.freeze(te);let N;function ne(){return A}function P(e){let t=K(e),n=j[t];return n===void 0?te:n}let F=e=>{if(M.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);ee.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{M.pop();let e=l(M);A=this.patternIdxToConfig[e],j=this.charCodeToPatternIdxToConfig[e],k=A.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;N=j&&t?P:ne}};function I(e){M.push(e),j=this.charCodeToPatternIdxToConfig[e],A=this.patternIdxToConfig[e],k=A.length,k=A.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;N=j&&t?P:ne}I.call(this,t);let L,re=this.config.recoveryEnabled;for(;b<y;){s=null;let t=v.charCodeAt(b),l=N(t),S=l.length;for(n=0;n<S;n++){L=l[n];let r=L.pattern;c=null;let d=L.short;if(d===!1?L.isCustom===!0?(_=r.exec(v,b,C,E),_===null?s=null:(s=_[0],_.payload!==void 0&&(c=_.payload))):(this.updateLastIndex(r,b),s=this.match(r,e,b)):t===d&&(s=r),s!==null){if(o=L.longerAlt,o!==void 0){let t=o.length;for(i=0;i<t;i++){let t=A[o[i]],n=t.pattern;if(u=null,t.isCustom===!0?(_=n.exec(v,b,C,E),_===null?a=null:(a=_[0],_.payload!==void 0&&(u=_.payload))):(this.updateLastIndex(n,b),a=this.match(n,e,b)),a&&a.length>s.length){s=a,c=u,L=t;break}}}break}}if(s!==null){if(d=s.length,f=L.group,f!==void 0&&(p=L.tokenTypeIdx,m=this.createTokenInstance(s,b,p,L.tokenType,w,T,d),this.handlePayload(m,c),f===!1?x=this.addToken(C,x,m):E[f].push(m)),e=this.chopInput(e,d),b+=d,T=this.computeNewColumn(T,d),D===!0&&L.canLineTerminator===!0){let e=0,t,n;O.lastIndex=0;do t=O.test(s),t===!0&&(n=O.lastIndex-1,e++);while(t===!0);e!==0&&(w+=e,T=d-n,this.updateTokenEndLineColumnLocation(m,f,n,e,w,T,d))}this.handleModes(L,F,I,m)}else{let t=b,n=w,i=T,a=re===!1;for(;a===!1&&b<y;)for(e=this.chopInput(e,1),b++,r=0;r<k;r++){let t=A[r],n=t.pattern,i=t.short;if(i===!1?t.isCustom===!0?a=n.exec(v,b,C,E)!==null:(this.updateLastIndex(n,b),a=n.exec(e)!==null):v.charCodeAt(b)===i&&(a=!0),a===!0)break}if(h=b-t,T=this.computeNewColumn(T,h),g=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(v,t,h,n,i),ee.push({offset:t,line:n,column:i,length:h,message:g}),re===!1)break}}return this.hasCustom||(C.length=x),{tokens:C,groups:E,errors:ee}}handleModes(e,t,n,r){if(e.pop===!0){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&s===!0||(e.endLine=i+c,e.endColumn=a-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}matchWithTest(e,t,n){return e.test(t)===!0?t.substring(n,e.lastIndex):null}matchWithExec(e,t){let n=e.exec(t);return n===null?null:n[0]}};J.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.`,J.NA=/NOT_APPLICABLE/;function Ft(e){return It(e)?e.LABEL:e.name}function It(e){return r(e.LABEL)&&e.LABEL!==``}const Lt=`categories`,Rt=`label`,zt=`group`,Bt=`push_mode`,Vt=`pop_mode`,Ht=`longer_alt`,Ut=`line_breaks`,Wt=`start_chars_hint`;function Gt(e){return Kt(e)}function Kt(e){let t=e.pattern,n={};if(n.name=e.name,H(t)||(n.PATTERN=t),P(e,`parent`))throw`The parent property is no longer supported.
|
|
31
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return P(e,Lt)&&(n.CATEGORIES=e[Lt]),St([n]),P(e,Rt)&&(n.LABEL=e[Rt]),P(e,zt)&&(n.GROUP=e[zt]),P(e,Vt)&&(n.POP_MODE=e[Vt]),P(e,Bt)&&(n.PUSH_MODE=e[Bt]),P(e,Ht)&&(n.LONGER_ALT=e[Ht]),P(e,Ut)&&(n.LINE_BREAKS=e[Ut]),P(e,Wt)&&(n.START_CHARS_HINT=e[Wt]),n}const Y=Gt({name:`EOF`,pattern:J.NA});St([Y]);function qt(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function Jt(e,t){return vt(e,t)}const Yt={buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:r}){return`Expecting ${It(e)?`--> ${Ft(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return`Redundant input, expecting EOF but found: `+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
|
|
32
|
-
but found: '`+s(t).image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:\n${_(_(U(e,(e,t)=>e.concat(t),[]),e=>`[${_(e,e=>Ft(e)).join(`, `)}]`),(e,t)=>` ${t+1}. ${e}`).join(`
|
|
33
|
-
`)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
|
|
34
|
-
but found: '`+s(t).image+`'`;return n?`Expecting: `+n+i:`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\n <${_(e,e=>`[${_(e,e=>Ft(e)).join(`,`)}]`).join(` ,`)}>`+i}};Object.freeze(Yt);const Xt={buildRuleNotFoundError(e,t){return`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
|
|
35
|
-
inside top level rule: ->`+e.name+`<-`}},X={buildDuplicateFoundError(e,t){function n(e){return e instanceof N?e.terminalType.name:e instanceof k?e.nonTerminalName:``}let r=e.name,i=s(t),a=i.idx,o=B(i),c=n(i),l=`->${o}${a>0?a:``}<- ${c?`with argument: ->${c}<-`:``}
|
|
36
|
-
appears more than once (${t.length} times) in the top level rule: ->${r}<-.
|
|
37
|
-
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
38
|
-
`;return l=l.replace(/[ \t]+/g,` `),l=l.replace(/\s\s+/g,`
|
|
39
|
-
`),l},buildNamespaceConflictError(e){return`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(e){let t=_(e.prefixPath,e=>Ft(e)).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(` ,`)}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){let t=_(e.prefixPath,e=>Ft(e)).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(` ,`)}> in <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
40
|
-
For Further details.`,r},buildEmptyRepetitionError(e){let t=B(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError(e){return`deprecated`},buildEmptyAlternationError(e){return`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`},buildTooManyAlternativesError(e){return`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(e){let t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${`${t} --> ${_(e.leftRecursionPath,e=>e.name).concat([t]).join(` --> `)}`}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return`deprecated`},buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof L?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};function Zt(e,t){let n=new Qt(e,t);return n.resolveRefs(),n.errors}var Qt=class extends D{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){W(F(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:$.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},$t=class extends pe{constructor(e,t){super(),this.topProd=e,this.path=t,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=f(this.path.ruleStack).reverse(),this.occurrenceStack=f(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){o(this.ruleStack)?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},en=class extends $t{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName=``,this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found&&(this.possibleTokTypes=he(new z({definition:t.concat(n)})),this.found=!0)}},tn=class extends pe{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},nn=class extends tn{walkMany(e,t,n){if(e.idx===this.occurrence){let e=s(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}},rn=class extends tn{walkManySep(e,t,n){if(e.idx===this.occurrence){let e=s(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}},an=class extends tn{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let e=s(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}},on=class extends tn{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let e=s(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}};function sn(e,t,n=[]){n=f(n);let r=[],i=0;function a(t){return t.concat(C(e,i+1))}function s(e){let i=sn(a(e),t,n);return r.concat(i)}for(;n.length<t&&i<e.length;){let t=e[i];if(t instanceof z||t instanceof k)return s(t.definition);if(t instanceof I)r=s(t.definition);else if(t instanceof A)return s(t.definition.concat([new V({definition:t.definition})]));else if(t instanceof M)return s([new z({definition:t.definition}),new V({definition:[new N({terminalType:t.separator})].concat(t.definition)})]);else if(t instanceof ae)r=s(t.definition.concat([new V({definition:[new N({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof V)r=s(t.definition.concat([new V({definition:t.definition})]));else if(t instanceof ie)return W(t.definition,e=>{o(e.definition)===!1&&(r=s(e.definition))}),r;else if(t instanceof N)n.push(t.terminalType);else throw Error(`non exhaustive match`);i++}return r.push({partialPath:n,suffixDef:C(e,i)}),r}function cn(e,t,n,r){let a=`EXIT_NONE_TERMINAL`,s=[a],c=`EXIT_ALTERNATIVE`,u=!1,d=t.length,p=d-r-1,m=[],h=[];for(h.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!o(h);){let e=h.pop();if(e===c){u&&l(h).idx<=p&&h.pop();continue}let r=e.def,g=e.idx,_=e.ruleStack,v=e.occurrenceStack;if(o(r))continue;let y=r[0];if(y===a){let e={idx:g,def:C(r),ruleStack:i(_),occurrenceStack:i(v)};h.push(e)}else if(y instanceof N)if(g<d-1){let e=g+1,i=t[e];if(n(i,y.terminalType)){let t={idx:e,def:C(r),ruleStack:_,occurrenceStack:v};h.push(t)}}else if(g===d-1)m.push({nextTokenType:y.terminalType,nextTokenOccurrence:y.idx,ruleStack:_,occurrenceStack:v}),u=!0;else throw Error(`non exhaustive match`);else if(y instanceof k){let e=f(_);e.push(y.nonTerminalName);let t=f(v);t.push(y.idx);let n={idx:g,def:y.definition.concat(s,C(r)),ruleStack:e,occurrenceStack:t};h.push(n)}else if(y instanceof I){let e={idx:g,def:C(r),ruleStack:_,occurrenceStack:v};h.push(e),h.push(c);let t={idx:g,def:y.definition.concat(C(r)),ruleStack:_,occurrenceStack:v};h.push(t)}else if(y instanceof A){let e=new V({definition:y.definition,idx:y.idx}),t={idx:g,def:y.definition.concat([e],C(r)),ruleStack:_,occurrenceStack:v};h.push(t)}else if(y instanceof M){let e=new V({definition:[new N({terminalType:y.separator})].concat(y.definition),idx:y.idx}),t={idx:g,def:y.definition.concat([e],C(r)),ruleStack:_,occurrenceStack:v};h.push(t)}else if(y instanceof ae){let e={idx:g,def:C(r),ruleStack:_,occurrenceStack:v};h.push(e),h.push(c);let t=new V({definition:[new N({terminalType:y.separator})].concat(y.definition),idx:y.idx}),n={idx:g,def:y.definition.concat([t],C(r)),ruleStack:_,occurrenceStack:v};h.push(n)}else if(y instanceof V){let e={idx:g,def:C(r),ruleStack:_,occurrenceStack:v};h.push(e),h.push(c);let t=new V({definition:y.definition,idx:y.idx}),n={idx:g,def:y.definition.concat([t],C(r)),ruleStack:_,occurrenceStack:v};h.push(n)}else if(y instanceof ie)for(let e=y.definition.length-1;e>=0;e--){let t={idx:g,def:y.definition[e].definition.concat(C(r)),ruleStack:_,occurrenceStack:v};h.push(t),h.push(c)}else if(y instanceof z)h.push({idx:g,def:y.definition.concat(C(r)),ruleStack:_,occurrenceStack:v});else if(y instanceof L)h.push(ln(y,g,_,v));else throw Error(`non exhaustive match`)}return m}function ln(e,t,n,r){let i=f(n);i.push(e.name);let a=f(r);return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}var Z;(function(e){e[e.OPTION=0]=`OPTION`,e[e.REPETITION=1]=`REPETITION`,e[e.REPETITION_MANDATORY=2]=`REPETITION_MANDATORY`,e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]=`REPETITION_MANDATORY_WITH_SEPARATOR`,e[e.REPETITION_WITH_SEPARATOR=4]=`REPETITION_WITH_SEPARATOR`,e[e.ALTERNATION=5]=`ALTERNATION`})(Z||={});function un(e){if(e instanceof I||e===`Option`)return Z.OPTION;if(e instanceof V||e===`Repetition`)return Z.REPETITION;if(e instanceof A||e===`RepetitionMandatory`)return Z.REPETITION_MANDATORY;if(e instanceof M||e===`RepetitionMandatoryWithSeparator`)return Z.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof ae||e===`RepetitionWithSeparator`)return Z.REPETITION_WITH_SEPARATOR;if(e instanceof ie||e===`Alternation`)return Z.ALTERNATION;throw Error(`non exhaustive match`)}function dn(e){let{occurrence:t,rule:n,prodType:r,maxLookahead:i}=e,a=un(r);return a===Z.ALTERNATION?Sn(t,n,i):Cn(t,n,a,i)}function fn(e,t,n,r,i,a){let o=Sn(e,t,n);return a(o,r,En(o)?yt:vt,i)}function pn(e,t,n,r,i,a){let o=Cn(e,t,i,n),s=En(o)?yt:vt;return a(o[0],s,r)}function mn(e,t,n,r){let i=e.length,a=y(e,e=>y(e,e=>e.length===1));if(t)return function(t){let r=_(t,e=>e.GATE);for(let t=0;t<i;t++){let i=e[t],a=i.length,o=r[t];if(!(o!==void 0&&o.call(this)===!1))nextPath:for(let e=0;e<a;e++){let r=i[e],a=r.length;for(let e=0;e<a;e++)if(n(this.LA(e+1),r[e])===!1)continue nextPath;return t}}};if(a&&!r){let t=U(_(e,e=>R(e)),(e,t,n)=>(W(t,t=>{P(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),W(t.categoryMatches,t=>{P(e,t)||(e[t]=n)})}),e),{});return function(){return t[this.LA(1).tokenTypeIdx]}}else return function(){for(let t=0;t<i;t++){let r=e[t],i=r.length;nextPath:for(let e=0;e<i;e++){let i=r[e],a=i.length;for(let e=0;e<a;e++)if(n(this.LA(e+1),i[e])===!1)continue nextPath;return t}}}}function hn(e,t,n){let r=y(e,e=>e.length===1),i=e.length;if(r&&!n){let t=R(e);if(t.length===1&&o(t[0].categoryMatches)){let e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}else{let e=U(t,(e,t,n)=>(e[t.tokenTypeIdx]=!0,W(t.categoryMatches,t=>{e[t]=!0}),e),[]);return function(){return e[this.LA(1).tokenTypeIdx]===!0}}}else return function(){nextPath:for(let n=0;n<i;n++){let r=e[n],i=r.length;for(let e=0;e<i;e++)if(t(this.LA(e+1),r[e])===!1)continue nextPath;return!0}return!1}}var gn=class extends pe{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=n.concat(r),!0):!1}walkOption(e,t,n){this.checkIsTarget(e,Z.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,Z.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,Z.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}},_n=class extends D{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(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 vn(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function yn(e){let t=[``];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let e=0;e<t.length;e++){let n=t[e];i.push(n+`_`+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){let t=`_`+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function bn(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let e=0;e<t.length;e++)if(i[t[e]]===!0)return!1}return!0}function xn(e,t){let n=_(e,e=>sn([e],1)),r=vn(n.length),i=_(n,e=>{let t={};return W(e,e=>{W(yn(e.partialPath),e=>{t[e]=!0})}),t}),a=n;for(let e=1;e<=t;e++){let n=a;a=vn(n.length);for(let s=0;s<n.length;s++){let c=n[s];for(let n=0;n<c.length;n++){let l=c[n].partialPath,u=c[n].suffixDef,d=yn(l);if(bn(i,d,s)||o(u)||l.length===t){let e=r[s];if(wn(e,l)===!1){e.push(l);for(let e=0;e<d.length;e++){let t=d[e];i[s][t]=!0}}}else{let t=sn(u,e+1,l);a[s]=a[s].concat(t),W(t,e=>{W(yn(e.partialPath),e=>{i[s][e]=!0})})}}}}return r}function Sn(e,t,n,r){let i=new _n(e,Z.ALTERNATION,r);return t.accept(i),xn(i.result,n)}function Cn(e,t,n,r){let i=new _n(e,n);t.accept(i);let a=i.result,o=new gn(t,e,n).startWalking();return xn([new z({definition:a}),new z({definition:o})],r)}function wn(e,t){compareOtherPath:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){let n=t[e],i=r[e];if(!(n===i||i.categoryMatchesMap[n.tokenTypeIdx]!==void 0))continue compareOtherPath}return!0}}return!1}function Tn(e,t){return e.length<t.length&&y(e,(e,n)=>{let r=t[n];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]})}function En(e){return y(e,e=>y(e,e=>y(e,e=>o(e.categoryMatches))))}function Dn(e){return _(e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}),e=>Object.assign({type:$.CUSTOM_LOOKAHEAD_VALIDATION},e))}function On(e,t,n,r){let i=h(e,e=>kn(e,n)),a=Gn(e,t,n),o=h(e,e=>Vn(e,n)),s=h(e,t=>Nn(t,e,r,n));return i.concat(a,o,s)}function kn(e,t){let n=new Mn;e.accept(n);let r=n.allProductions;return _(F(b(m(r,An),e=>e.length>1)),n=>{let r=s(n),i=t.buildDuplicateFoundError(e,n),a=B(r),o={message:i,type:$.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},c=jn(r);return c&&(o.parameter=c),o})}function An(e){return`${B(e)}_#_${e.idx}_#_${jn(e)}`}function jn(e){return e instanceof N?e.terminalType.name:e instanceof k?e.nonTerminalName:``}var Mn=class extends D{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 Nn(e,t,n,r){let i=[];if(U(t,(t,n)=>n.name===e.name?t+1:t,0)>1){let t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:$.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function Pn(e,t,n){let r=[],i;return g(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:$.INVALID_RULE_OVERRIDE,ruleName:e})),r}function Fn(e,t,n,r=[]){let i=[],a=In(t.definition);if(o(a))return[];{let t=e.name;g(a,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:$.LEFT_RECURSION,ruleName:t});let o=h(S(a,r.concat([e])),t=>{let i=f(r);return i.push(t),Fn(e,t,n,i)});return i.concat(o)}}function In(e){let t=[];if(o(e))return t;let n=s(e);if(n instanceof k)t.push(n.referencedRule);else if(n instanceof z||n instanceof I||n instanceof A||n instanceof M||n instanceof ae||n instanceof V)t=t.concat(In(n.definition));else if(n instanceof ie)t=R(_(n.definition,e=>In(e.definition)));else if(!(n instanceof N))throw Error(`non exhaustive match`);let r=oe(n),i=e.length>1;if(r&&i){let n=C(e);return t.concat(In(n))}else return t}var Ln=class extends D{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Rn(e,t){let n=new Ln;e.accept(n);let r=n.alternations;return h(r,n=>h(i(n.definition),(r,i)=>o(cn([r],[],vt,1))?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:$.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]))}function zn(e,t,n){let r=new Ln;e.accept(r);let i=r.alternations;return i=O(i,e=>e.ignoreAmbiguities===!0),h(i,r=>{let i=r.idx,a=Sn(i,e,r.maxLookahead||t,r),o=Un(a,r,e,n),s=Wn(a,r,e,n);return o.concat(s)})}var Bn=class extends D{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 Vn(e,t){let n=new Ln;e.accept(n);let r=n.alternations;return h(r,n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:$.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[])}function Hn(e,t,n){let r=[];return W(e,e=>{let i=new Bn;e.accept(i);let a=i.allProductions;W(a,i=>{let a=un(i),s=i.maxLookahead||t,c=i.idx,l=Cn(c,e,a,s)[0];if(o(R(l))){let t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:$.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}function Un(e,t,n,r){let i=[];return _(U(e,(n,r,a)=>(t.definition[a].ignoreAmbiguities===!0||W(r,r=>{let o=[a];W(e,(e,n)=>{a!==n&&wn(e,r)&&t.definition[n].ignoreAmbiguities!==!0&&o.push(n)}),o.length>1&&!wn(i,r)&&(i.push(r),n.push({alts:o,path:r}))}),n),[]),e=>{let i=_(e.alts,e=>e+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:$.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}})}function Wn(e,t,n,r){let i=U(e,(e,t,n)=>{let r=_(t,e=>({idx:n,path:e}));return e.concat(r)},[]);return c(h(i,e=>{if(t.definition[e.idx].ignoreAmbiguities===!0)return[];let a=e.idx,o=e.path;return _(p(i,e=>t.definition[e.idx].ignoreAmbiguities!==!0&&e.idx<a&&Tn(e.path,o)),e=>{let i=[e.idx+1,a+1],o=t.idx===0?``:t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:$.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}})}))}function Gn(e,t,n){let r=[],i=_(t,e=>e.name);return W(e,e=>{let t=e.name;if(g(i,t)){let i=n.buildNamespaceConflictError(e);r.push({message:i,type:$.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}function Kn(e){let t=ee(e,{errMsgProvider:Xt}),n={};return W(e.rules,e=>{n[e.name]=e}),Zt(n,t.errMsgProvider)}function qn(e){return e=ee(e,{errMsgProvider:X}),On(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}const Jn=`MismatchedTokenException`,Yn=`NoViableAltException`,Xn=`EarlyExitException`,Zn=`NotAllInputParsedException`,Qn=[Jn,Yn,Xn,Zn];Object.freeze(Qn);function $n(e){return g(Qn,e.name)}var er=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},tr=class extends er{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Jn}},nr=class extends er{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Yn}},rr=class extends er{constructor(e,t){super(e,t),this.name=Zn}},ir=class extends er{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Xn}};const ar={},or=`InRuleRecoveryException`;var sr=class extends Error{constructor(e){super(e),this.name=or}},cr=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=P(e,`recoveryEnabled`)?e.recoveryEnabled:Q.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=lr)}getTokenToInsert(e){let t=qt(e,``,NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){let a=this.findReSyncTokenType(),o=this.exportLexerState(),s=[],c=!1,l=this.LA(1),u=this.LA(1),d=()=>{let e=this.LA(0),t=new tr(this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:l,previous:e,ruleName:this.getCurrRuleFullName()}),l,this.LA(0));t.resyncedTokens=i(s),this.SAVE_ERROR(t)};for(;!c;)if(this.tokenMatcher(u,r)){d();return}else if(n.call(this)){d(),e.apply(this,t);return}else this.tokenMatcher(u,a)?c=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,s));this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,t,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new sr(`sad sad panda`)}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||o(t))return!1;let n=this.LA(1);return u(t,e=>this.tokenMatcher(n,e))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return g(this.getFollowSetFromFollowKey(t),e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA(1),n=2;for(;;){let r=u(e,e=>Jt(t,e));if(r!==void 0)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return ar;let e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return _(e,(n,r)=>r===0?ar:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])})}flattenFollowSet(){return R(_(this.buildFullFollowKeyStack(),e=>this.getFollowSetFromFollowKey(e)))}getFollowSetFromFollowKey(e){if(e===ar)return[Y];let t=e.ruleName+e.idxInCallingRule+ye+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,Y)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return i(t)}attemptInRepetitionRecovery(e,t,n,r,i,a,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:f(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return _(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function lr(e,t,n,r,i,a,o){let s=this.getKeyForAutomaticLookahead(r,i),c=this.firstAfterRepMap[s];if(c===void 0){let e=this.getCurrRuleFullName(),t=this.getGAstProductions()[e];c=new a(t,i).startWalking(),this.firstAfterRepMap[s]=c}let l=c.token,u=c.occurrence,d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&l===void 0&&(l=Y,u=1),!(l===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(l,u,o)&&this.tryInRepetitionRecovery(e,t,n,l)}const ur=1024,dr=1280,fr=1536;function pr(e,t,n){return n|t|e}var mr=class{constructor(e){this.maxLookahead=e?.maxLookahead??Q.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(o(t)){let n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return h(e,e=>Fn(e,e,X))}validateEmptyOrAlternatives(e){return h(e,e=>Rn(e,X))}validateAmbiguousAlternationAlternatives(e,t){return h(e,e=>zn(e,t,X))}validateSomeNonEmptyLookaheadPath(e,t){return Hn(e,t,X)}buildLookaheadForAlternation(e){return fn(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,mn)}buildLookaheadForOptional(e){return pn(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,un(e.prodType),hn)}},hr=class{initLooksAhead(e){this.dynamicTokensEnabled=P(e,`dynamicTokensEnabled`)?e.dynamicTokensEnabled:Q.dynamicTokensEnabled,this.maxLookahead=P(e,`maxLookahead`)?e.maxLookahead:Q.maxLookahead,this.lookaheadStrategy=P(e,`lookaheadStrategy`)?e.lookaheadStrategy:new mr({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){W(e,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:o}=_r(e);W(t,t=>{let n=t.idx===0?``:t.idx;this.TRACE_INIT(`${B(t)}${n}`,()=>{let n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),r=pr(this.fullRuleNameToShort[e.name],256,t.idx);this.setLaFuncCache(r,n)})}),W(n,t=>{this.computeLookaheadFunc(e,t.idx,768,`Repetition`,t.maxLookahead,B(t))}),W(r,t=>{this.computeLookaheadFunc(e,t.idx,512,`Option`,t.maxLookahead,B(t))}),W(i,t=>{this.computeLookaheadFunc(e,t.idx,ur,`RepetitionMandatory`,t.maxLookahead,B(t))}),W(a,t=>{this.computeLookaheadFunc(e,t.idx,fr,`RepetitionMandatoryWithSeparator`,t.maxLookahead,B(t))}),W(o,t=>{this.computeLookaheadFunc(e,t.idx,dr,`RepetitionWithSeparator`,t.maxLookahead,B(t))})})})}computeLookaheadFunc(e,t,n,r,i,a){this.TRACE_INIT(`${a}${t===0?``:t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),o=pr(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(o,a)})}getKeyForAutomaticLookahead(e,t){return pr(this.getLastExplicitRuleShortName(),e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}};const gr=new class extends D{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)}};function _r(e){gr.reset(),e.accept(gr);let t=gr.dslMethods;return gr.reset(),t}function vr(e,t){isNaN(e.startOffset)===!0?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset)}function yr(e,t){isNaN(e.startOffset)===!0?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function br(e,t,n){e.children[n]===void 0?e.children[n]=[t]:e.children[n].push(t)}function xr(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)}function Sr(e,t){Object.defineProperty(e,`name`,{enumerable:!1,configurable:!0,writable:!1,value:t})}function Cr(e,t){let n=T(e),r=n.length;for(let i=0;i<r;i++){let r=e[n[i]],a=r.length;for(let e=0;e<a;e++){let n=r[e];n.tokenTypeIdx===void 0&&this[n.name](n.children,t)}}}function wr(e,t){let n=function(){};return Sr(n,e+`BaseSemantics`),n.prototype={visit:function(e,t){if(j(e)&&(e=e[0]),!H(e))return this[e.name](e.children,t)},validateVisitor:function(){let e=Dr(this,t);if(!o(e)){let t=_(e,e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join(`
|
|
41
|
-
|
|
42
|
-
`).replace(/\n/g,`
|
|
43
|
-
`)}`)}}},n.prototype.constructor=n,n._RULE_NAMES=t,n}function Tr(e,t,n){let r=function(){};Sr(r,e+`BaseSemanticsWithDefaults`);let i=Object.create(n.prototype);return W(t,e=>{i[e]=Cr}),r.prototype=i,r.prototype.constructor=r,r}var Er;(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(Er||={});function Dr(e,t){return Or(e,t)}function Or(e,t){return c(_(p(t,t=>E(e[t])===!1),t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:Er.MISSING_METHOD,methodName:t})))}var kr=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=P(e,`nodeLocationTracking`)?e.nodeLocationTracking:Q.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=w,this.cstFinallyStateUpdate=w,this.cstPostTerminal=w,this.cstPostNonTerminal=w,this.cstPostRule=w;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=yr,this.setNodeLocationFromNode=yr,this.cstPostRule=w,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=w,this.setNodeLocationFromNode=w,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=vr,this.setNodeLocationFromNode=vr,this.cstPostRule=w,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=w,this.setNodeLocationFromNode=w,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=w,this.setNodeLocationFromNode=w,this.cstPostRule=w,this.setInitialNodeLocation=w;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){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];br(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];xr(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(H(this.baseCstVisitorConstructor)){let e=wr(this.className,T(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(H(this.baseCstVisitorWithDefaultsConstructor)){let e=Tr(this.className,T(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}},Ar=class{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){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Kr:this.tokVector[t]}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()}},jr=class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}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,t,n=qr){if(g(this.definedRulesNames,e)){let t={message:X.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:$.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=qr){let r=Pn(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if($n(e))return!1;throw e}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return te(F(this.gastProductionsCache))}},Mr=class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=yt,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},P(t,`serializedGrammar`))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
44
|
-
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
45
|
-
For Further details.`);if(j(e)){if(o(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
46
|
-
Note that the first argument for the parser constructor
|
|
47
|
-
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.
|
|
48
|
-
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
49
|
-
For Further details.`)}if(j(e))this.tokensMap=U(e,(e,t)=>(e[t.name]=t,e),{});else if(P(e,`modes`)&&y(R(F(e.modes)),Mt))this.tokensMap=U(se(R(F(e.modes))),(e,t)=>(e[t.name]=t,e),{});else if(n(e))this.tokensMap=f(e);else throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap.EOF=Y,this.tokenMatcher=y(P(e,`modes`)?R(F(e.modes)):F(e),e=>o(e.categoryMatches))?yt:vt,St(F(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=P(n,`resyncEnabled`)?n.resyncEnabled:qr.resyncEnabled,i=P(n,`recoveryValueFunc`)?n.recoveryValueFunc:qr.recoveryValueFunc,a=this.ruleShortNameIdx<<12;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return o=this.outputCst===!0?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK.length===1,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if($n(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r))if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}else return n(e);else{if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}}else if(r)return this.moveToTerminatedState(),n(e);else throw t}else throw e}optionInternal(e,t){let n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r=this.getLaFuncFromCache(n),i;if(typeof e!=`function`){i=e.DEF;let t=e.GATE;if(t!==void 0){let e=r;r=()=>t.call(this)&&e.call(this)}}else i=e;if(r.call(this)===!0)return i.call(this)}atLeastOneInternal(e,t){let n=this.getKeyForAutomaticLookahead(ur,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r=this.getLaFuncFromCache(n),i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=()=>e.call(this)&&t.call(this)}}else i=t;if(r.call(this)===!0){let e=this.doSingleRepetition(i);for(;r.call(this)===!0&&e===!0;)e=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],r,ur,e,an)}atLeastOneSepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(fr,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){r.call(this);let t=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,on],t,fr,e,on)}else throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r=this.getLaFuncFromCache(n),i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=()=>e.call(this)&&t.call(this)}}else i=t;let a=!0;for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],r,768,e,nn,a)}manySepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(dr,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){r.call(this);let t=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,rn],t,dr,e,rn)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,fr,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=this.getKeyForAutomaticLookahead(256,t),r=j(e)?e:e.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new rr(t,e))}}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw $n(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA(1);this.tokenMatcher(t,e)===!0?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new tr(r,t,i))}consumeInternalRecovery(e,t,n){if(this.recoveryEnabled&&n.name===`MismatchedTokenException`&&!this.isBackTracking()){let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===or?n:e}}else throw n}saveRecogState(){let e=this.errors,t=f(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Y)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},Nr=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=P(e,`errorMessageProvider`)?e.errorMessageProvider:Q.errorMessageProvider}SAVE_ERROR(e){if($n(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:f(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return f(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],a=Cn(e,i,t,this.maxLookahead)[0],o=[];for(let e=1;e<=this.maxLookahead;e++)o.push(this.LA(e));let s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new ir(s,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=this.getGAstProductions()[n],i=Sn(e,r,this.maxLookahead),a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:a,previous:o,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new nr(s,this.LA(1),o))}},Pr=class{initContentAssist(){}computeContentAssist(e,t){let n=this.gastProductionsCache[e];if(H(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return cn([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let t=s(e.ruleStack),n=this.getGAstProductions()[t];return new en(n,e).startWalking()}};const Fr={description:`This Object indicates the Parser is during Recording Phase`};Object.freeze(Fr);const Ir=Gt({name:`RECORDING_PHASE_TOKEN`,pattern:J.NA});St([Ir]);const Lr=qt(Ir,`This IToken indicates the Parser is in Recording Phase
|
|
50
|
-
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Lr);const Rr={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
51
|
-
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};var zr=class{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++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}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,t){return()=>!0}LA_RECORD(e){return Kr}topLevelRuleRecord(e,t){try{let n=new L({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(e.KNOWN_RECORDER_ERROR!==!0)try{e.message+=`
|
|
52
|
-
This error was thrown during the "grammar recording phase" For more info see:
|
|
53
|
-
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Br.call(this,I,e,t)}atLeastOneInternalRecord(e,t){Br.call(this,A,t,e)}atLeastOneSepFirstInternalRecord(e,t){Br.call(this,M,t,e,!0)}manyInternalRecord(e,t){Br.call(this,V,t,e)}manySepFirstInternalRecord(e,t){Br.call(this,ae,t,e,!0)}orInternalRecord(e,t){return Vr.call(this,e,t)}subruleInternalRecord(e,t,n){if(Ur(t),!e||P(e,`ruleName`)===!1){let n=Error(`<SUBRULE${Hr(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=l(this.recordingProdStack),i=e.ruleName,a=new k({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Rr:Fr}consumeInternalRecord(e,t,n){if(Ur(t),!Ot(e)){let n=Error(`<CONSUME${Hr(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=l(this.recordingProdStack),i=new N({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),Lr}};function Br(e,t,n,r=!1){Ur(n);let i=l(this.recordingProdStack),a=E(t)?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),P(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),Fr}function Vr(e,t){Ur(t);let n=l(this.recordingProdStack),r=j(e)===!1,i=r===!1?e:e.DEF,a=new ie({definition:[],idx:t,ignoreAmbiguities:r&&e.IGNORE_AMBIGUITIES===!0});return P(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=ce(i,e=>E(e.GATE)),n.definition.push(a),W(i,e=>{let t=new z({definition:[]});a.definition.push(t),P(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:P(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),Fr}function Hr(e){return e===0?``:`${e}`}function Ur(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var Wr=class{initPerformanceTracer(e){if(P(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Q.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=ue(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}else return t()}};function Gr(e,t){t.forEach(t=>{let n=t.prototype;Object.getOwnPropertyNames(n).forEach(r=>{if(r===`constructor`)return;let i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(e.prototype,r,i):e.prototype[r]=t.prototype[r]})})}const Kr=qt(Y,``,NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Kr);const Q=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Yt,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),qr=Object.freeze({recoveryValueFunc:()=>void 0,resyncEnabled:!0});var $;(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})($||={});function Jr(e=void 0){return function(){return e}}var Yr=class e{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 t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{fe(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),W(this.definedRulesNames,e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=Kn({rules:F(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(o(r)&&this.skipValidations===!1){let e=qn({rules:F(this.gastProductionsCache),tokenTypes:F(this.tokensMap),errMsgProvider:X,grammarName:n}),t=Dn({lookaheadStrategy:this.lookaheadStrategy,rules:F(this.gastProductionsCache),tokenTypes:F(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(e,t)}}),o(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{this.resyncFollows=xe(F(this.gastProductionsCache))}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:F(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(F(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&!o(this.definitionErrors))throw t=_(this.definitionErrors,e=>e.message),Error(`Parser Definition Errors detected:\n ${t.join(`
|
|
54
|
-
-------------------------------
|
|
55
|
-
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initContentAssist(),n.initGastRecorder(t),n.initPerformanceTracer(t),P(t,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
56
|
-
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
57
|
-
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
58
|
-
For further details.`);this.skipValidations=P(t,`skipValidations`)?t.skipValidations:Q.skipValidations}};Yr.DEFER_DEFINITION_ERRORS_HANDLING=!1,Gr(Yr,[cr,hr,kr,Ar,Mr,jr,Nr,Pr,zr,Wr]);var Xr=class extends Yr{constructor(e,t=Q){let n=f(t);n.outputCst=!1,super(e,n)}};export{Yt as a,qt as c,J as d,Nt as f,dn as i,Ft as l,Xr as n,Y as o,mr as r,Gt as s,Jr as t,Jt as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import*as e from"node:path";import{join as t,relative as n,resolve as r,sep as i}from"node:path";import{EventEmitter as a}from"node:events";import{lstat as o,open as s,readdir as c,realpath as l,stat as u}from"node:fs/promises";import{type as d}from"node:os";import{stat as f,unwatchFile as p,watch as m,watchFile as ee}from"node:fs";import{Readable as te}from"node:stream";const h={FILE_TYPE:`files`,DIR_TYPE:`directories`,FILE_DIR_TYPE:`files_directories`,EVERYTHING_TYPE:`all`},g={root:`.`,fileFilter:e=>!0,directoryFilter:e=>!0,type:h.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(g);const _=`READDIRP_RECURSIVE_ERROR`,ne=new Set([`ENOENT`,`EPERM`,`EACCES`,`ELOOP`,_]),v=[h.DIR_TYPE,h.EVERYTHING_TYPE,h.FILE_DIR_TYPE,h.FILE_TYPE],re=new Set([h.DIR_TYPE,h.EVERYTHING_TYPE,h.FILE_DIR_TYPE]),y=new Set([h.EVERYTHING_TYPE,h.FILE_DIR_TYPE,h.FILE_TYPE]),b=e=>ne.has(e.code),x=process.platform===`win32`,S=e=>!0,C=e=>{if(e===void 0)return S;if(typeof e==`function`)return e;if(typeof e==`string`){let t=e.trim();return e=>e.basename===t}if(Array.isArray(e)){let t=e.map(e=>e.trim());return e=>t.some(t=>e.basename===t)}return S};var ie=class extends te{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...g,...e},{root:n,type:i}=t;this._fileFilter=C(t.fileFilter),this._directoryFilter=C(t.directoryFilter);let a=t.lstat?o:u;x?this._stat=e=>a(e,{bigint:!0}):this._stat=a,this._maxDepth=t.depth!=null&&Number.isSafeInteger(t.depth)?t.depth:g.depth,this._wantsDir=i?re.has(i):!1,this._wantsFile=i?y.has(i):!1,this._wantsEverything=i===h.EVERYTHING_TYPE,this._root=r(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?`dirent`:`stats`,this._rdOptions={encoding:`utf8`,withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:r,depth:i}=t,a=n.splice(0,e).map(e=>this._formatEntry(e,r)),o=await Promise.all(a);for(let t of o){if(!t)continue;if(this.destroyed)return;let n=await this._getEntryType(t);n===`directory`&&this._directoryFilter(t)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(t.fullPath,i+1)),this._wantsDir&&(this.push(t),e--)):(n===`file`||this._includeAsFile(t))&&this._fileFilter(t)&&this._wantsFile&&(this.push(t),e--)}}else{let e=this.parents.pop();if(!e){this.push(null);break}if(this.parent=await e,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(e,t){let n;try{n=await c(e,this._rdOptions)}catch(e){this._onError(e)}return{files:n,depth:t,path:e}}async _formatEntry(e,i){let a,o=this._isDirent?e.name:e;try{let s=r(t(i,o));a={path:n(this._root,s),fullPath:s,basename:o},a[this._statsProp]=this._isDirent?e:await this._stat(s)}catch(e){this._onError(e);return}return a}_onError(e){b(e)&&!this.destroyed?this.emit(`warn`,e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return``;let t=e[this._statsProp];if(t.isFile())return`file`;if(t.isDirectory())return`directory`;if(t&&t.isSymbolicLink()){let t=e.fullPath;try{let e=await l(t),n=await o(e);if(n.isFile())return`file`;if(n.isDirectory()){let n=e.length;if(t.startsWith(e)&&t.substr(n,1)===i){let n=Error(`Circular symlink detected: "${t}" points to "${e}"`);return n.code=_,this._onError(n)}return`directory`}}catch(e){return this._onError(e),``}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}};function ae(e,t={}){let n=t.entryType||t.type;if(n===`both`&&(n=h.FILE_DIR_TYPE),n&&(t.type=n),!e)throw Error(`readdirp: root argument is required. Usage: readdirp(root, options)`);if(typeof e!=`string`)throw TypeError(`readdirp: root argument must be a string. Usage: readdirp(root, options)`);if(n&&!v.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${v.join(`, `)}`);return t.root=e,new ie(t)}const w=()=>{},T=process.platform,E=T===`win32`,D=T===`darwin`,oe=T===`linux`,se=T===`freebsd`,O=d()===`OS400`,k={ALL:`all`,READY:`ready`,ADD:`add`,CHANGE:`change`,ADD_DIR:`addDir`,UNLINK:`unlink`,UNLINK_DIR:`unlinkDir`,RAW:`raw`,ERROR:`error`},A=k,ce={lstat:o,stat:u},j=`listeners`,M=`errHandlers`,N=`rawEmitters`,le=[j,M,N],ue=new Set(`3dm.3ds.3g2.3gp.7z.a.aac.adp.afdesign.afphoto.afpub.ai.aif.aiff.alz.ape.apk.appimage.ar.arj.asf.au.avi.bak.baml.bh.bin.bk.bmp.btif.bz2.bzip2.cab.caf.cgm.class.cmx.cpio.cr2.cur.dat.dcm.deb.dex.djvu.dll.dmg.dng.doc.docm.docx.dot.dotm.dra.DS_Store.dsk.dts.dtshd.dvb.dwg.dxf.ecelp4800.ecelp7470.ecelp9600.egg.eol.eot.epub.exe.f4v.fbs.fh.fla.flac.flatpak.fli.flv.fpx.fst.fvt.g3.gh.gif.graffle.gz.gzip.h261.h263.h264.icns.ico.ief.img.ipa.iso.jar.jpeg.jpg.jpgv.jpm.jxr.key.ktx.lha.lib.lvp.lz.lzh.lzma.lzo.m3u.m4a.m4v.mar.mdi.mht.mid.midi.mj2.mka.mkv.mmr.mng.mobi.mov.movie.mp3.mp4.mp4a.mpeg.mpg.mpga.mxu.nef.npx.numbers.nupkg.o.odp.ods.odt.oga.ogg.ogv.otf.ott.pages.pbm.pcx.pdb.pdf.pea.pgm.pic.png.pnm.pot.potm.potx.ppa.ppam.ppm.pps.ppsm.ppsx.ppt.pptm.pptx.psd.pya.pyc.pyo.pyv.qt.rar.ras.raw.resources.rgb.rip.rlc.rmf.rmvb.rpm.rtf.rz.s3m.s7z.scpt.sgi.shar.snap.sil.sketch.slk.smv.snk.so.stl.suo.sub.swf.tar.tbz.tbz2.tga.tgz.thmx.tif.tiff.tlz.ttc.ttf.txz.udf.uvh.uvi.uvm.uvp.uvs.uvu.viv.vob.war.wav.wax.wbmp.wdp.weba.webm.webp.whl.wim.wm.wma.wmv.wmx.woff.woff2.wrm.wvx.xbm.xif.xla.xlam.xls.xlsb.xlsm.xlsx.xlt.xltm.xltx.xm.xmind.xpi.xpm.xwd.xz.z.zip.zipx`.split(`.`)),de=t=>ue.has(e.extname(t).slice(1).toLowerCase()),P=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},F=(e,t,n)=>{let r=e[t];r instanceof Set||(e[t]=r=new Set([r])),r.add(n)},I=e=>t=>{let n=e[t];n instanceof Set?n.clear():delete e[t]},L=(e,t,n)=>{let r=e[t];r instanceof Set?r.delete(n):r===n&&delete e[t]},R=e=>e instanceof Set?e.size===0:!e,z=new Map;function B(t,n,r,i,a){let o=(n,i)=>{r(t),a(n,i,{watchedPath:t}),i&&t!==i&&V(e.resolve(t,i),j,e.join(t,i))};try{return m(t,{persistent:n.persistent},o)}catch(e){i(e);return}}const V=(e,t,n,r,i)=>{let a=z.get(e);a&&P(a[t],e=>{e(n,r,i)})},H=(e,t,n,r)=>{let{listener:i,errHandler:a,rawEmitter:o}=r,c=z.get(t),l;if(!n.persistent)return l=B(e,n,i,a,o),l?l.close.bind(l):void 0;if(c)F(c,j,i),F(c,M,a),F(c,N,o);else{if(l=B(e,n,V.bind(null,t,j),a,V.bind(null,t,N)),!l)return;l.on(A.ERROR,async n=>{let r=V.bind(null,t,M);if(c&&(c.watcherUnusable=!0),E&&n.code===`EPERM`)try{await(await s(e,`r`)).close(),r(n)}catch{}else r(n)}),c={listeners:i,errHandlers:a,rawEmitters:o,watcher:l},z.set(t,c)}return()=>{L(c,j,i),L(c,M,a),L(c,N,o),R(c.listeners)&&(c.watcher.close(),z.delete(t),le.forEach(I(c)),c.watcher=void 0,Object.freeze(c))}},U=new Map,fe=(e,t,n,r)=>{let{listener:i,rawEmitter:a}=r,o=U.get(t),s=o&&o.options;return s&&(s.persistent<n.persistent||s.interval>n.interval)&&(p(t),o=void 0),o?(F(o,j,i),F(o,N,a)):(o={listeners:i,rawEmitters:a,options:n,watcher:ee(t,n,(n,r)=>{P(o.rawEmitters,e=>{e(A.CHANGE,t,{curr:n,prev:r})});let i=n.mtimeMs;(n.size!==r.size||i>r.mtimeMs||i===0)&&P(o.listeners,t=>t(e,n))})},U.set(t,o)),()=>{L(o,j,i),L(o,N,a),R(o.listeners)&&(U.delete(t),p(t),o.options=o.watcher=void 0,Object.freeze(o))}};var pe=class{fsw;_boundHandleError;constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(t,n){let r=this.fsw.options,i=e.dirname(t),a=e.basename(t);this.fsw._getWatchedDir(i).add(a);let o=e.resolve(t),s={persistent:r.persistent};n||=w;let c;return r.usePolling?(s.interval=r.interval!==r.binaryInterval&&de(a)?r.binaryInterval:r.interval,c=fe(t,o,s,{listener:n,rawEmitter:this.fsw._emitRaw})):c=H(t,o,s,{listener:n,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),c}_handleFile(t,n,r){if(this.fsw.closed)return;let i=e.dirname(t),a=e.basename(t),o=this.fsw._getWatchedDir(i),s=n;if(o.has(a))return;let c=async(e,n)=>{if(this.fsw._throttle(`watch`,t,5)){if(!n||n.mtimeMs===0)try{let n=await u(t);if(this.fsw.closed)return;let r=n.atimeMs,i=n.mtimeMs;if((!r||r<=i||i!==s.mtimeMs)&&this.fsw._emit(A.CHANGE,t,n),(D||oe||se)&&s.ino!==n.ino){this.fsw._closeFile(e),s=n;let r=this._watchWithNodeFs(t,c);r&&this.fsw._addPathCloser(e,r)}else s=n}catch{this.fsw._remove(i,a)}else if(o.has(a)){let e=n.atimeMs,r=n.mtimeMs;(!e||e<=r||r!==s.mtimeMs)&&this.fsw._emit(A.CHANGE,t,n),s=n}}},l=this._watchWithNodeFs(t,c);if(!(r&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(A.ADD,t,0))return;this.fsw._emit(A.ADD,t,n)}return l}async _handleSymlink(e,t,n,r){if(this.fsw.closed)return;let i=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let t;try{t=await l(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(i)!==t&&(this.fsw._symlinkPaths.set(i,t),this.fsw._emit(A.CHANGE,n,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(i,t),this.fsw._emit(A.ADD,n,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(t,n,r,i,a,o,s){t=e.join(t,``);let c=i?`${t}:${i}`:t;if(s=this.fsw._throttle(`readdir`,c,1e3),!s)return;let l=this.fsw._getWatchedDir(r.path),u=new Set,d=this.fsw._readdirp(t,{fileFilter:e=>r.filterPath(e),directoryFilter:e=>r.filterDir(e)});if(d)return d.on(`data`,async s=>{if(this.fsw.closed){d=void 0;return}let c=s.path,f=e.join(t,c);if(u.add(c),!(s.stats.isSymbolicLink()&&await this._handleSymlink(s,t,f,c))){if(this.fsw.closed){d=void 0;return}(c===i||!i&&!l.has(c))&&(this.fsw._incrReadyCount(),f=e.join(a,e.relative(a,f)),this._addToNodeFs(f,n,r,o+1))}}).on(A.ERROR,this._boundHandleError),new Promise((e,n)=>{if(!d)return n();d.once(`end`,()=>{if(this.fsw.closed){d=void 0;return}let n=s?s.clear():!1;e(void 0),l.getChildren().filter(e=>e!==t&&!u.has(e)).forEach(e=>{this.fsw._remove(t,e)}),d=void 0,n&&this._handleRead(t,!1,r,i,a,o,s)})})}async _handleDir(t,n,r,i,a,o,s){let c=this.fsw._getWatchedDir(e.dirname(t)),l=c.has(e.basename(t));!(r&&this.fsw.options.ignoreInitial)&&!a&&!l&&this.fsw._emit(A.ADD_DIR,t,n),c.add(e.basename(t)),this.fsw._getWatchedDir(t);let u,d=this.fsw.options.depth;if((d==null||i<=d)&&!this.fsw._symlinkPaths.has(s)){if(!a&&(await this._handleRead(t,r,o,a,t,i,void 0),this.fsw.closed))return;u=this._watchWithNodeFs(t,(e,n)=>{n&&n.mtimeMs===0||this._handleRead(e,!1,o,a,t,i,void 0)})}return u}async _addToNodeFs(t,n,r,i,a){let o=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return o(),!1;let s=this.fsw._getWatchHelpers(t);r&&(s.filterPath=e=>r.filterPath(e),s.filterDir=e=>r.filterDir(e));try{let r=await ce[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,r))return o(),!1;let c=this.fsw.options.followSymlinks,u;if(r.isDirectory()){let o=e.resolve(t),d=c?await l(t):t;if(this.fsw.closed||(u=await this._handleDir(s.watchPath,r,n,i,a,s,d),this.fsw.closed))return;o!==d&&d!==void 0&&this.fsw._symlinkPaths.set(o,d)}else if(r.isSymbolicLink()){let a=c?await l(t):t;if(this.fsw.closed)return;let o=e.dirname(s.watchPath);if(this.fsw._getWatchedDir(o).add(s.watchPath),this.fsw._emit(A.ADD,s.watchPath,r),u=await this._handleDir(o,r,n,i,t,s,a),this.fsw.closed)return;a!==void 0&&this.fsw._symlinkPaths.set(e.resolve(t),a)}else u=this._handleFile(s.watchPath,r,n);return o(),u&&this.fsw._addPathCloser(t,u),!1}catch(e){if(this.fsw._handleError(e))return o(),t}}};
|
|
2
|
-
/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
|
|
3
|
-
const me=/\\/g,W=/\/\//g,he=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,ge=/^\.[/\\]/;function G(e){return Array.isArray(e)?e:[e]}const K=e=>typeof e==`object`&&!!e&&!(e instanceof RegExp);function _e(t){return typeof t==`function`?t:typeof t==`string`?e=>t===e:t instanceof RegExp?e=>t.test(e):typeof t==`object`&&t?n=>{if(t.path===n)return!0;if(t.recursive){let r=e.relative(t.path,n);return r?!r.startsWith(`..`)&&!e.isAbsolute(r):!1}return!1}:()=>!1}function ve(t){if(typeof t!=`string`)throw Error(`string expected`);t=e.normalize(t),t=t.replace(/\\/g,`/`);let n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(W,`/`),n&&(t=`/`+t),t}function q(e,t,n){let r=ve(t);for(let t=0;t<e.length;t++){let i=e[t];if(i(r,n))return!0}return!1}function ye(e,t){if(e==null)throw TypeError(`anymatch: specify first argument`);let n=G(e).map(e=>_e(e));return t==null?(e,t)=>q(n,e,t):q(n,t)}const J=e=>{let t=G(e).flat();if(!t.every(e=>typeof e==`string`))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(X)},Y=e=>{let t=e.replace(me,`/`),n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(W,`/`),n&&(t=`/`+t),t},X=t=>Y(e.normalize(Y(t))),Z=(t=``)=>n=>typeof n==`string`?X(e.isAbsolute(n)?n:e.join(t,n)):n,be=(t,n)=>e.isAbsolute(t)?t:e.join(n,t),Q=Object.freeze(new Set);var xe=class{path;_removeWatcher;items;constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==`.`&&e!==`..`&&t.add(e)}async remove(t){let{items:n}=this;if(!n||(n.delete(t),n.size>0))return;let r=this.path;try{await c(r)}catch{this._removeWatcher&&this._removeWatcher(e.dirname(r),e.basename(r))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path=``,this._removeWatcher=w,this.items=Q,Object.freeze(this)}},Se=class{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,n,r){this.fsw=r;let i=t;this.path=t=t.replace(ge,``),this.watchPath=i,this.fullWatchPath=e.resolve(i),this.dirParts=[],this.dirParts.forEach(e=>{e.length>1&&e.pop()}),this.followSymlinks=n,this.statMethod=n?`stat`:`lstat`}entryPath(t){return e.join(this.watchPath,e.relative(this.watchPath,t.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},$=class extends a{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?G(e.ignored):G([]),awaitWriteFinish:t===!0?n:typeof t==`object`?{...n,...t}:!1};O&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let i=process.env.CHOKIDAR_USEPOLLING;if(i!==void 0){let e=i.toLowerCase();e===`false`||e===`0`?r.usePolling=!1:e===`true`||e===`1`?r.usePolling=!0:r.usePolling=!!e}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=w,this._readyEmitted=!0,process.nextTick(()=>this.emit(k.READY)))},this._emitRaw=(...e)=>this.emit(k.RAW,...e),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new pe(this),Object.freeze(r)}_addIgnoredPath(e){if(K(e)){for(let t of this._ignoredPaths)if(K(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==`string`)for(let t of this._ignoredPaths)K(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(t,n,r){let{cwd:i}=this.options;this.closed=!1,this._closePromise=void 0;let a=J(t);return i&&(a=a.map(e=>be(e,i))),a.forEach(e=>{this._removeIgnoredPath(e)}),this._userIgnored=void 0,this._readyCount||=0,this._readyCount+=a.length,Promise.all(a.map(async e=>{let t=await this._nodeFsHandler._addToNodeFs(e,!r,void 0,0,n);return t&&this._emitReady(),t})).then(t=>{this.closed||t.forEach(t=>{t&&this.add(e.dirname(t),e.basename(n||t))})}),this}unwatch(t){if(this.closed)return this;let n=J(t),{cwd:r}=this.options;return n.forEach(t=>{!e.isAbsolute(t)&&!this._closers.has(t)&&(r&&(t=e.join(r,t)),t=e.resolve(t)),this._closePath(t),this._addIgnoredPath(t),this._watched.has(t)&&this._addIgnoredPath({path:t,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(t=>{let n=t();n instanceof Promise&&e.push(n)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((n,r)=>{let i=(this.options.cwd?e.relative(this.options.cwd,r):r)||`.`;t[i]=n.getChildren().sort()}),t}emitWithAll(e,t){this.emit(e,...t),e!==k.ERROR&&this.emit(k.ALL,e,...t)}async _emit(t,n,r){if(this.closed)return;let i=this.options;E&&(n=e.normalize(n)),i.cwd&&(n=e.relative(i.cwd,n));let a=[n];r!=null&&a.push(r);let o=i.awaitWriteFinish,s;if(o&&(s=this._pendingWrites.get(n)))return s.lastChange=new Date,this;if(i.atomic){if(t===k.UNLINK)return this._pendingUnlinks.set(n,[t,...a]),setTimeout(()=>{this._pendingUnlinks.forEach((e,t)=>{this.emit(...e),this.emit(k.ALL,...e),this._pendingUnlinks.delete(t)})},typeof i.atomic==`number`?i.atomic:100),this;t===k.ADD&&this._pendingUnlinks.has(n)&&(t=k.CHANGE,this._pendingUnlinks.delete(n))}if(o&&(t===k.ADD||t===k.CHANGE)&&this._readyEmitted)return this._awaitWriteFinish(n,o.stabilityThreshold,t,(e,n)=>{e?(t=k.ERROR,a[0]=e,this.emitWithAll(t,a)):n&&(a.length>1?a[1]=n:a.push(n),this.emitWithAll(t,a))}),this;if(t===k.CHANGE&&!this._throttle(k.CHANGE,n,50))return this;if(i.alwaysStat&&r===void 0&&(t===k.ADD||t===k.ADD_DIR||t===k.CHANGE)){let t=i.cwd?e.join(i.cwd,n):n,r;try{r=await u(t)}catch{}if(!r||this.closed)return;a.push(r)}return this.emitWithAll(t,a),this}_handleError(e){let t=e&&e.code;return e&&t!==`ENOENT`&&t!==`ENOTDIR`&&(!this.options.ignorePermissionErrors||t!==`EPERM`&&t!==`EACCES`)&&this.emit(k.ERROR,e),e||this.closed}_throttle(e,t,n){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw Error(`invalid throttle`);let i=r.get(t);if(i)return i.count++,!1;let a,o=()=>{let e=r.get(t),n=e?e.count:0;return r.delete(t),clearTimeout(a),e&&clearTimeout(e.timeoutObject),n};a=setTimeout(o,n);let s={timeoutObject:a,clear:o,count:0};return r.set(t,s),s}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,n,r,i){let a=this.options.awaitWriteFinish;if(typeof a!=`object`)return;let o=a.pollInterval,s,c=t;this.options.cwd&&!e.isAbsolute(t)&&(c=e.join(this.options.cwd,t));let l=new Date,u=this._pendingWrites;function d(e){f(c,(r,a)=>{if(r||!u.has(t)){r&&r.code!==`ENOENT`&&i(r);return}let c=Number(new Date);e&&a.size!==e.size&&(u.get(t).lastChange=c),c-u.get(t).lastChange>=n?(u.delete(t),i(void 0,a)):s=setTimeout(d,o,a)})}u.has(t)||(u.set(t,{lastChange:l,cancelWait:()=>(u.delete(t),clearTimeout(s),r)}),s=setTimeout(d,o))}_isIgnored(e,t){if(this.options.atomic&&he.test(e))return!0;if(!this._userIgnored){let{cwd:e}=this.options,t=(this.options.ignored||[]).map(Z(e));this._userIgnored=ye([...[...this._ignoredPaths].map(Z(e)),...t],void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new Se(e,this.options.followSymlinks,this)}_getWatchedDir(t){let n=e.resolve(t);return this._watched.has(n)||this._watched.set(n,new xe(n,this._boundRemove)),this._watched.get(n)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(t,n,r){let i=e.join(t,n),a=e.resolve(i);if(r??=this._watched.has(i)||this._watched.has(a),!this._throttle(`remove`,i,100))return;!r&&this._watched.size===1&&this.add(t,n,!0),this._getWatchedDir(i).getChildren().forEach(e=>this._remove(i,e));let o=this._getWatchedDir(t),s=o.has(n);o.remove(n),this._symlinkPaths.has(a)&&this._symlinkPaths.delete(a);let c=i;if(this.options.cwd&&(c=e.relative(this.options.cwd,i)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===k.ADD)return;this._watched.delete(i),this._watched.delete(a);let l=r?k.UNLINK_DIR:k.UNLINK;s&&!this._isIgnored(i)&&this._emit(l,i),this._closePath(i)}_closePath(t){this._closeFile(t);let n=e.dirname(t);this._getWatchedDir(n).remove(e.basename(t))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(e=>e()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);n||(n=[],this._closers.set(e,n)),n.push(t)}_readdirp(e,t){if(this.closed)return;let n=ae(e,{type:k.ALL,alwaysStat:!0,lstat:!0,...t,depth:0});return this._streams.add(n),n.once(`close`,()=>{n=void 0}),n.once(`end`,()=>{n&&=(this._streams.delete(n),void 0)}),n}};function Ce(e,t={}){let n=new $(t);return n.add(e),n}var we={watch:Ce,FSWatcher:$};export{we as t};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{parseArgs as e}from"node:util";const t=/\d/,n=[`-`,`_`,`/`,`.`];function r(e=``){if(!t.test(e))return e!==e.toLowerCase()}function i(e,t){let i=t??n,a=[];if(!e||typeof e!=`string`)return a;let o=``,s,c;for(let t of e){let e=i.includes(t);if(e===!0){a.push(o),o=``,s=void 0;continue}let n=r(t);if(c===!1){if(s===!1&&n===!0){a.push(o),o=t,s=n;continue}if(s===!0&&n===!1&&o.length>1){let e=o.at(-1);a.push(o.slice(0,Math.max(0,o.length-1))),o=e+t,s=n;continue}}o+=t,s=n,c=e}return a.push(o),a}function a(e){return e?e[0].toUpperCase()+e.slice(1):``}function o(e){return e?e[0].toLowerCase()+e.slice(1):``}function s(e,t){return e?(Array.isArray(e)?e:i(e)).map(e=>a(t?.normalize?e.toLowerCase():e)).join(``):``}function c(e,t){return o(s(e||``,t))}function l(e,t){return e?(Array.isArray(e)?e:i(e)).map(e=>e.toLowerCase()).join(t??`-`):``}function u(e){return l(e||``,`_`)}function d(e){return Array.isArray(e)?e:e===void 0?[]:[e]}function f(e,t=``){let n=[];for(let t of e)for(let[e,r]of t.entries())n[e]=Math.max(n[e]||0,r.length);return e.map(e=>e.map((e,r)=>t+e[r===0?`padStart`:`padEnd`](n[r])).join(` `)).join(`
|
|
2
|
-
`)}function p(e){return typeof e==`function`?e():e}var m=class extends Error{code;constructor(e,t){super(e),this.name=`CLIError`,this.code=t}};function h(t=[],n={}){let r=new Set(n.boolean||[]),i=new Set(n.string||[]),a=n.alias||{},o=n.default||{},s=new Map,c=new Map;for(let[e,t]of Object.entries(a)){let n=t;for(let t of n)s.set(e,t),c.has(t)||c.set(t,[]),c.get(t).push(e),s.set(t,e),c.has(e)||c.set(e,[]),c.get(e).push(t)}let l={};function u(e){if(r.has(e))return`boolean`;let t=c.get(e)||[];for(let e of t)if(r.has(e))return`boolean`;return`string`}function d(e){if(i.has(e))return!0;let t=c.get(e)||[];for(let e of t)if(i.has(e))return!0;return!1}let f=new Set([...r,...i,...Object.keys(a),...Object.values(a).flat(),...Object.keys(o)]);for(let e of f)l[e]||(l[e]={type:u(e),default:o[e]});for(let[e,t]of s.entries())e.length===1&&l[t]&&!l[t].short&&(l[t].short=e);let p=[],m={};for(let e=0;e<t.length;e++){let n=t[e];if(n===`--`){p.push(...t.slice(e));break}if(n.startsWith(`--no-`)){let e=n.slice(5);m[e]=!0;continue}p.push(n)}let h;try{h=e({args:p,options:Object.keys(l).length>0?l:void 0,allowPositionals:!0,strict:!1})}catch{h={values:{},positionals:p}}let g={_:[]};g._=h.positionals;for(let[e,t]of Object.entries(h.values)){let n=t;u(e)===`boolean`&&typeof t==`string`?n=t!==`false`:d(e)&&typeof t==`boolean`&&(n=``),g[e]=n}for(let[e]of Object.entries(m)){g[e]=!1;let t=s.get(e);t&&(g[t]=!1);let n=c.get(e);if(n)for(let e of n)g[e]=!1}for(let[e,t]of s.entries())g[e]!==void 0&&g[t]===void 0&&(g[t]=g[e]),g[t]!==void 0&&g[e]===void 0&&(g[e]=g[t]),g[e]!==g[t]&&o[t]===g[t]&&(g[t]=g[e]);return g}const g=(()=>{let e=globalThis.process?.env??{};return e.NO_COLOR===`1`||e.TERM===`dumb`||e.TEST||e.CI})(),_=(e,t=39)=>n=>g?n:`\u001B[${e}m${n}\u001B[${t}m`,v=_(1,22),y=_(36),b=_(90),x=_(4,24);function S(e,t){let n={boolean:[],string:[],alias:{},default:{}},r=C(t);for(let e of r){if(e.type===`positional`)continue;e.type===`string`||e.type===`enum`?n.string.push(e.name):e.type===`boolean`&&n.boolean.push(e.name),e.default!==void 0&&(n.default[e.name]=e.default),e.alias&&(n.alias[e.name]=e.alias);let t=c(e.name),r=l(e.name);if(t!==e.name||r!==e.name){let i=d(n.alias[e.name]||[]);t!==e.name&&!i.includes(t)&&i.push(t),r!==e.name&&!i.includes(r)&&i.push(r),i.length>0&&(n.alias[e.name]=i)}}let i=h(e,n),[...a]=i._,o=new Proxy(i,{get(e,t){return e[t]??e[c(t)]??e[l(t)]}});for(let[,e]of r.entries())if(e.type===`positional`){let t=a.shift();if(t!==void 0)o[e.name]=t;else if(e.default===void 0&&e.required!==!1)throw new m(`Missing required positional argument: ${e.name.toUpperCase()}`,`EARG`);else o[e.name]=e.default}else if(e.type===`enum`){let t=o[e.name],n=e.options||[];if(t!==void 0&&n.length>0&&!n.includes(t))throw new m(`Invalid value for argument: ${y(`--${e.name}`)} (${y(t)}). Expected one of: ${n.map(e=>y(e)).join(`, `)}.`,`EARG`)}else if(e.required&&o[e.name]===void 0)throw new m(`Missing required argument: --${e.name}`,`EARG`);return o}function C(e){let t=[];for(let[n,r]of Object.entries(e||{}))t.push({...r,name:n,alias:d(r.alias)});return t}async function w(e){return Promise.all(e.map(e=>p(e)))}function T(e){return e}async function E(e,t){let n=await p(e.args||{}),r=S(t.rawArgs,n),i={rawArgs:t.rawArgs,args:r,data:t.data,cmd:e},a=await w(e.plugins??[]),o,s;try{for(let e of a)await e.setup?.(i);typeof e.setup==`function`&&await e.setup(i);let r=await p(e.subCommands);if(r&&Object.keys(r).length>0){let i=k(t.rawArgs,n),a=t.rawArgs[i];if(a){let e=await O(r,a);if(!e)throw new m(`Unknown command ${y(a)}`,`E_UNKNOWN_COMMAND`);await E(e,{rawArgs:t.rawArgs.slice(i+1)})}else{let n=await p(e.default);if(n){if(e.run)throw new m(`Cannot specify both 'run' and 'default' on the same command.`,`E_DEFAULT_CONFLICT`);let i=await O(r,n);if(!i)throw new m(`Default sub command ${y(n)} not found in subCommands.`,`E_UNKNOWN_COMMAND`);await E(i,{rawArgs:t.rawArgs})}else if(!e.run)throw new m(`No command specified.`,`E_NO_COMMAND`)}}typeof e.run==`function`&&(o=await e.run(i))}catch(e){s=e}let c=[];if(typeof e.cleanup==`function`)try{await e.cleanup(i)}catch(e){c.push(e)}for(let e of[...a].reverse())try{await e.cleanup?.(i)}catch(e){c.push(e)}if(s)throw s;if(c.length===1)throw c[0];if(c.length>1)throw Error(`Multiple cleanup errors`,{cause:c});return{result:o}}async function D(e,t,n){let r=await p(e.subCommands);if(r&&Object.keys(r).length>0){let n=k(t,await p(e.args||{})),i=t[n],a=await O(r,i);if(a)return D(a,t.slice(n+1),e)}return[e,n]}async function O(e,t){if(t in e)return p(e[t]);for(let n of Object.values(e)){let e=await p(n),r=await p(e?.meta);if(r?.alias&&d(r.alias).includes(t))return e}}function k(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r===`--`)return-1;if(r.startsWith(`-`)){!r.includes(`=`)&&A(r,t)&&n++;continue}return n}return-1}function A(e,t){let n=e.replace(/^-{1,2}/,``),r=c(n);for(let[e,i]of Object.entries(t))if(!(i.type!==`string`&&i.type!==`enum`)&&(r===c(e)||(Array.isArray(i.alias)?i.alias:i.alias?[i.alias]:[]).includes(n)))return!0;return!1}async function j(e,t){try{console.log(await N(e,t)+`
|
|
3
|
-
`)}catch(e){console.error(e)}}const M=/^no[-A-Z]/;async function N(e,t){let n=await p(e.meta||{}),r=C(await p(e.args||{})),i=await p(t?.meta||{}),a=`${i.name?`${i.name} `:``}`+(n.name||process.argv[1]),o=[],s=[],c=[],l=[];for(let e of r)if(e.type===`positional`){let t=e.name.toUpperCase(),n=e.required!==!1&&e.default===void 0;s.push([y(t+P(e)),F(e,n)]),l.push(n?`<${t}>`:`[${t}]`)}else{let t=e.required===!0&&e.default===void 0,n=[...(e.alias||[]).map(e=>`-${e}`),`--${e.name}`].join(`, `)+P(e);if(o.push([y(n),F(e,t)]),e.type===`boolean`&&(e.default===!0||e.negativeDescription)&&!M.test(e.name)){let n=[...(e.alias||[]).map(e=>`--no-${e}`),`--no-${e.name}`].join(`, `);o.push([y(n),[e.negativeDescription,t?b(`(Required)`):``].filter(Boolean).join(` `)])}t&&l.push(`--${e.name}`+P(e))}if(e.subCommands){let t=[],n=await p(e.subCommands);for(let[e,r]of Object.entries(n)){let n=await p((await p(r))?.meta);if(n?.hidden)continue;let i=d(n?.alias),a=[e,...i].join(`, `);c.push([y(a),n?.description||``]),t.push(e,...i)}l.push(t.join(`|`))}let u=[],m=n.version||i.version;u.push(b(`${n.description} (${a+(m?` v${m}`:``)})`),``);let h=o.length>0||s.length>0;return u.push(`${x(v(`USAGE`))} ${y(`${a}${h?` [OPTIONS]`:``} ${l.join(` `)}`)}`,``),s.length>0&&(u.push(x(v(`ARGUMENTS`)),``),u.push(f(s,` `)),u.push(``)),o.length>0&&(u.push(x(v(`OPTIONS`)),``),u.push(f(o,` `)),u.push(``)),c.length>0&&(u.push(x(v(`COMMANDS`)),``),u.push(f(c,` `)),u.push(``,`Use ${y(`${a} <command> --help`)} for more information about a command.`)),u.filter(e=>typeof e==`string`).join(`
|
|
4
|
-
`)}function P(e){let t=e.valueHint?`=<${e.valueHint}>`:``,n=t||`=<${u(e.name)}>`;return!e.type||e.type===`positional`||e.type===`boolean`?t:e.type===`enum`&&e.options?.length?`=<${e.options.join(`|`)}>`:n}function F(e,t){let n=t?b(`(Required)`):``,r=e.default===void 0?``:b(`(Default: ${e.default})`);return[e.description,n,r].filter(Boolean).join(` `)}async function I(e,t={}){let n=t.rawArgs||process.argv.slice(2),r=t.showUsage||j;try{let t=await L(e);if(t.help.length>0&&n.some(e=>t.help.includes(e)))await r(...await D(e,n)),process.exit(0);else if(n.length===1&&t.version.includes(n[0])){let t=typeof e.meta==`function`?await e.meta():await e.meta;if(!t?.version)throw new m(`No version specified`,`E_NO_VERSION`);console.log(t.version)}else await E(e,{rawArgs:n})}catch(t){t instanceof m?(await r(...await D(e,n)),console.error(t.message)):console.error(t,`
|
|
5
|
-
`),process.exit(1)}}async function L(e){let t=await p(e.args||{}),n=new Set,r=new Set;for(let[e,i]of Object.entries(t)){n.add(e);for(let e of d(i.alias))r.add(e)}return{help:R(`help`,`h`,n,r),version:R(`version`,`v`,n,r)}}function R(e,t,n,r){return n.has(e)||r.has(e)?[]:n.has(t)||r.has(t)?[`--${e}`]:[`--${e}`,`-${t}`]}export{I as n,T as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./character-entities.mjs";const t={}.hasOwnProperty;function n(n){return t.call(e,n)?e[n]:!1}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function t(n,r,i=`.`,a){if(!e(r))return t(n,{},i,a);let o={...r};for(let r of Object.keys(n)){if(r===`__proto__`||r===`constructor`)continue;let s=n[r];s!=null&&(a&&a(o,r,s,i)||(Array.isArray(s)&&Array.isArray(o[r])?o[r]=[...s,...o[r]]:e(s)&&e(o[r])?o[r]=t(s,o[r],(i?`${i}.`:``)+r.toString(),a):o[r]=s))}return o}function n(e){return(...n)=>n.reduce((n,r)=>t(n,r,``,e),{})}const r=n();export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,t=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,n=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function r(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){i(e);return}return t}function i(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function a(i,a={}){if(typeof i!=`string`)return i;if(i[0]===`"`&&i[i.length-1]===`"`&&i.indexOf(`\\`)===-1)return i.slice(1,-1);let o=i.trim();if(o.length<=9)switch(o.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!n.test(i)){if(a.strict)throw SyntaxError(`[destr] Invalid JSON`);return i}try{if(e.test(i)||t.test(i)){if(a.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(i,r)}return JSON.parse(i)}catch(e){if(a.strict)throw e;return i}}export{a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){}export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as e,t}from"../rolldown-runtime.mjs";var n=e(t(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"../rolldown-runtime.mjs";var t=e(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const{getOwnPropertyNames:e,getOwnPropertySymbols:t}=Object,{hasOwnProperty:n}=Object.prototype;function r(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function i(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function a(n){return e(n).concat(t(n))}const o=Object.hasOwn||((e,t)=>n.call(e,t)),{getOwnPropertyDescriptor:s,keys:c}=Object,l=Object.is||function(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t};function u(e,t){return e===t}function d(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e),new Uint8Array(t))}function f(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function p(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function m(e,t){return l(e.getTime(),t.getTime())}function h(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function g(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function _(e,t,n){let r=c(e),i=r.length;if(c(t).length!==i)return!1;for(;i-- >0;)if(!w(e,t,n,r[i]))return!1;return!0}function v(e,t,n){let r=a(e),i=r.length;if(a(t).length!==i)return!1;let o,c,l;for(;i-- >0;)if(o=r[i],!w(e,t,n,o)||(c=s(e,o),l=s(t,o),(c||l)&&(!c||!l||c.configurable!==l.configurable||c.enumerable!==l.enumerable||c.writable!==l.writable)))return!1;return!0}function y(e,t){return l(e.valueOf(),t.valueOf())}function b(e,t){return e.source===t.source&&e.flags===t.flags}function x(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function S(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function C(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function w(e,t,n,r){return(r===`_owner`||r===`__o`||r===`__v`)&&(e.$$typeof||t.$$typeof)?!0:o(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const T=Object.prototype.toString;function E(e){let t=A(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:s,areRegExpsEqual:c,areSetsEqual:l,getUnsupportedCustomComparator:u}=e;return function(e,d,f){if(e===d)return!0;if(e==null||d==null)return!1;let p=typeof e;if(p!==typeof d)return!1;if(p!==`object`)return p===`number`||p===`bigint`?o(e,d,f):p===`function`?i(e,d,f):!1;let m=e.constructor;if(m!==d.constructor)return!1;if(m===Object)return s(e,d,f);if(m===Array)return n(e,d,f);if(m===Date)return r(e,d,f);if(m===RegExp)return c(e,d,f);if(m===Map)return a(e,d,f);if(m===Set)return l(e,d,f);if(m===Promise)return!1;if(Array.isArray(e))return n(e,d,f);let h=T.call(e),g=t[h];if(g)return g(e,d,f);let _=u&&u(e,d,f,h);return _?_(e,d,f):!1}}function D({circular:e,createCustomConfig:t,strict:n}){let a={areArrayBuffersEqual:d,areArraysEqual:n?v:f,areDataViewsEqual:p,areDatesEqual:m,areErrorsEqual:h,areFunctionsEqual:u,areMapsEqual:n?r(g,v):g,areNumbersEqual:l,areObjectsEqual:n?v:_,arePrimitiveWrappersEqual:y,areRegExpsEqual:b,areSetsEqual:n?r(x,v):x,areTypedArraysEqual:n?r(S,v):S,areUrlsEqual:C,getUnsupportedCustomComparator:void 0};if(t&&(a=Object.assign({},a,t(a))),e){let e=i(a.areArraysEqual),t=i(a.areMapsEqual),n=i(a.areObjectsEqual),r=i(a.areSetsEqual);a=Object.assign({},a,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:r})}return a}function O(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function k({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}function A({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}j(),j({strict:!0}),j({circular:!0}),j({circular:!0,strict:!0}),j({createInternalComparator:()=>l}),j({strict:!0,createInternalComparator:()=>l}),j({circular:!0,createInternalComparator:()=>l}),j({circular:!0,createInternalComparator:()=>l,strict:!0});function j(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=E(D(e));return k({circular:t,comparator:a,createState:r,equals:n?n(a):O(a),strict:i})}export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"../rolldown-runtime.mjs";var n=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.normalizePath=t.convertSlashes=t.cleanPath=void 0;let n=e(`path`);function r(e){let t=(0,n.normalize)(e);return t.length>1&&t[t.length-1]===n.sep&&(t=t.substring(0,t.length-1)),t}t.cleanPath=r;let i=/[\\/]/g;function a(e,t){return e.replace(i,t)}t.convertSlashes=a;function o(e,t){let{resolvePaths:i,normalizePath:o,pathSeparator:s}=t,c=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return i&&(e=(0,n.resolve)(e)),(o||c)&&(e=r(e)),e===`.`?``:a(e[e.length-1]===s?e:e+s,s)}t.normalizePath=o})),r=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.build=t.joinDirectoryPath=t.joinPathWithBasePath=void 0;let r=e(`path`),i=n();function a(e,t){return t+e}t.joinPathWithBasePath=a;function o(e,t){return function(n,a){return a.startsWith(e)?a.replace(e,``)+n:(0,i.convertSlashes)((0,r.relative)(e,a),t.pathSeparator)+t.pathSeparator+n}}function s(e){return e}function c(e,t,n){return t+e+n}t.joinDirectoryPath=c;function l(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?o(e,t):r?a:s}t.build=l})),i=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.build=void 0;function t(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function n(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}let r=(e,t)=>{t.push(e||`.`)},i=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},a=()=>{};function o(e,o){let{includeDirs:s,filters:c,relativePaths:l}=o;return s?l?c&&c.length?n(e):t(e):c&&c.length?i:r:a}e.build=o})),a=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.build=void 0;let t=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},n=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},r=(e,t,n,r)=>{n.files++},i=(e,t)=>{t.push(e)},a=()=>{};function o(e){let{excludeFiles:o,filters:s,onlyCounts:c}=e;return o?a:s&&s.length?c?t:n:c?r:i}e.build=o})),o=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.build=void 0;let t=e=>e,n=()=>[``].slice(0,0);function r(e){return e.group?n:t}e.build=r})),s=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.build=void 0;let t=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},n=()=>{};function r(e){return e.group?t:n}e.build=r})),c=t((t=>{var n=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,`__esModule`,{value:!0}),t.build=void 0;let r=n(e(`fs`)),i=function(e,t,n){let{queue:i,options:{suppressErrors:a}}=t;i.enqueue(),r.default.stat(e,(r,o)=>{if(r){i.dequeue(a?null:r,t);return}n(o,e),i.dequeue(null,t)})},a=function(e,t,n){let{queue:i,options:{suppressErrors:a}}=t;i.enqueue(),r.default.realpath(e,(e,o)=>{if(e){i.dequeue(a?null:e,t);return}r.default.lstat(o,(e,r)=>{n(r,o),i.dequeue(null,t)})})},o=function(e,t,n){try{n(r.default.statSync(e),e)}catch(e){if(!t.options.suppressErrors)throw e}},s=function(e,t,n){try{let t=r.default.realpathSync(e);n(r.default.lstatSync(t),t)}catch(e){if(!t.options.suppressErrors)throw e}};function c(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:e.useRealPaths?t?s:a:t?o:i}t.build=c})),l=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.build=void 0;let t=e=>e.counts,n=e=>e.groups,r=e=>e.paths,i=e=>e.paths.slice(0,e.options.maxFiles),a=(e,t,n)=>(l(t,n,e.counts,e.options.suppressErrors),null),o=(e,t,n)=>(l(t,n,e.paths,e.options.suppressErrors),null),s=(e,t,n)=>(l(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),c=(e,t,n)=>(l(t,n,e.groups,e.options.suppressErrors),null);function l(e,t,n,r){t(e&&!r?e:null,n)}function u(e,l){let{onlyCounts:u,group:d,maxFiles:f}=e;return u?l?t:a:d?l?n:c:f?l?i:s:l?r:o}e.build=u})),u=t((t=>{var n=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,`__esModule`,{value:!0}),t.build=void 0;let r=n(e(`fs`)),i={withFileTypes:!0},a=(e,t,n,a)=>{if(e.queue.enqueue(),n<0){e.queue.dequeue(null,e);return}e.counts.directories++,r.default.readdir(t||`.`,i,function(r,i=[]){a(i,t,n),e.queue.dequeue(e.options.suppressErrors?null:r,e)})},o=(e,t,n,a)=>{if(n<0)return;e.counts.directories++;let o=[];try{o=r.default.readdirSync(t||`.`,i)}catch(t){if(!e.options.suppressErrors)throw t}a(o,t,n)};function s(e){return e?o:a}t.build=s})),d=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Queue=void 0,e.Queue=class{onQueueEmpty;count=0;constructor(e){this.onQueueEmpty=e}enqueue(){this.count++}dequeue(e,t){(--this.count===0||e)&&this.onQueueEmpty(e,t)}}})),f=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Counter=void 0,e.Counter=class{_files=0;_directories=0;set files(e){this._files=e}get files(){return this._files}set directories(e){this._directories=e}get directories(){return this._directories}get dirs(){return this._directories}}})),p=t((t=>{var p=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),m=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),h=t&&t.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!==`default`&&Object.prototype.hasOwnProperty.call(e,n)&&p(t,e,n);return m(t,e),t};Object.defineProperty(t,`__esModule`,{value:!0}),t.Walker=void 0;let g=e(`path`),_=n(),v=h(r()),y=h(i()),b=h(a()),x=h(o()),S=h(s()),C=h(c()),w=h(l()),T=h(u()),E=d(),D=f();t.Walker=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=w.build(t,this.isSynchronous),this.state={paths:[``].slice(0,0),groups:[],counts:new D.Counter,options:t,queue:new E.Queue((e,t)=>this.callbackInvoker(t,e,n))},this.root=(0,_.normalizePath)(e,this.state.options),this.joinPath=v.build(this.root,t),this.pushDirectory=y.build(this.root,t),this.pushFile=b.build(t),this.getArray=x.build(t),this.groupFiles=S.build(t),this.resolveSymlink=C.build(t,this.isSynchronous),this.walkDirectory=T.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,t,n)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:o,exclude:s,maxFiles:c,signal:l}}=this.state;if(l&&l.aborted||c&&r.length>c)return;this.pushDirectory(t,r,i);let u=this.getArray(this.state.paths);for(let r=0;r<e.length;++r){let c=e[r];if(c.isFile()||c.isSymbolicLink()&&!a&&!o){let e=this.joinPath(c.name,t);this.pushFile(e,u,this.state.counts,i)}else if(c.isDirectory()){let e=v.joinDirectoryPath(c.name,t,this.state.options.pathSeparator);if(s&&s(c.name,e))continue;this.walkDirectory(this.state,e,n-1,this.walk)}else if(c.isSymbolicLink()&&this.resolveSymlink){let e=v.joinPathWithBasePath(c.name,t);this.resolveSymlink(e,this.state,(e,t)=>{if(e.isDirectory()){if(t=(0,_.normalizePath)(t,this.state.options),s&&s(c.name,t))return;this.walkDirectory(this.state,t,n-1,this.walk)}else{let e=(0,g.basename)(t),n=(0,_.normalizePath)((0,g.dirname)(t),this.state.options);t=this.joinPath(e,n),this.pushFile(t,u,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,u)}}})),m=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callback=e.promise=void 0;let t=p();function n(e,t){return new Promise((n,i)=>{r(e,t,(e,t)=>{if(e)return i(e);n(t)})})}e.promise=n;function r(e,n,r){new t.Walker(e,n,r).start()}e.callback=r})),h=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.sync=void 0;let t=p();function n(e,n){return new t.Walker(e,n).start()}e.sync=n})),g=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.APIBuilder=void 0;let t=m(),n=h();e.APIBuilder=class{root;options;constructor(e,t){this.root=e,this.options=t}withPromise(){return(0,t.promise)(this.root,this.options)}withCallback(e){(0,t.callback)(this.root,this.options,e)}sync(){return(0,n.sync)(this.root,this.options)}}})),_=t(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),v=t((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=_();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),y=t(((e,t)=>{let n=v(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:y}=_(),b=e=>e===l||e===a,x=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let _=t||{},v=e.length-1,S=_.parts===!0||_.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=!1,z=!1,B=0,V,H,U={value:``,depth:0,isGlob:!1},W=()=>D>=v,G=()=>E.charCodeAt(D+1),K=()=>(V=H,E.charCodeAt(++D));for(;D<v;){H=K();let e;if(H===a){I=U.backslashes=!0,H=K(),H===u&&(F=!0);continue}if(F===!0||H===u){for(B++;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,K();continue}if(H===u){B++;continue}if(F!==!0&&H===s&&(H=K())===s){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(F!==!0&&H===o){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===h&&(B--,B===0)){F=!1,A=U.isBrace=!0,z=!0;break}}if(S===!0)continue;break}if(H===l){if(C.push(D),w.push(U),U={value:``,depth:0,isGlob:!1},z===!0)continue;if(V===s&&D===O+1){O+=2;continue}k=D+1;continue}if(_.noext!==!0&&(H===p||H===i||H===r||H===m||H===c)&&G()===d){if(M=U.isGlob=!0,N=U.isExtglob=!0,z=!0,H===c&&D===O&&(R=!0),S===!0){for(;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,H=K();continue}if(H===g){M=U.isGlob=!0,z=!0;break}}continue}break}if(H===r){if(V===r&&(P=U.isGlobstar=!0),M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===m){if(M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===f){for(;W()!==!0&&(e=K());){if(e===a){I=U.backslashes=!0,K();continue}if(e===y){j=U.isBracket=!0,M=U.isGlob=!0,z=!0;break}}if(S===!0)continue;break}if(_.nonegate!==!0&&H===c&&D===O){L=U.negated=!0,O++;continue}if(_.noparen!==!0&&H===d){if(M=U.isGlob=!0,S===!0){for(;W()!==!0&&(H=K());){if(H===d){I=U.backslashes=!0,H=K();continue}if(H===g){z=!0;break}}continue}break}if(M===!0){if(z=!0,S===!0)continue;break}}_.noext===!0&&(N=!1,M=!1);let q=E,J=``,Y=``;O>0&&(J=E.slice(0,O),E=E.slice(O),k-=O),q&&M===!0&&k>0?(q=E.slice(0,k),Y=E.slice(k)):M===!0?(q=``,Y=E):q=E,q&&q!==``&&q!==`/`&&q!==E&&b(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),_.unescape===!0&&(Y&&=n.removeBackslashes(Y),q&&I===!0&&(q=n.removeBackslashes(q)));let X={prefix:J,input:e,start:O,base:q,glob:Y,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:P,negated:L,negatedExtglob:R};if(_.tokens===!0&&(X.maxDepth=0,b(H)||w.push(U),X.tokens=w),_.parts===!0||_.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);_.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=J):w[n].value=a,x(w[n]),X.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),_.tokens&&(w[w.length-1].value=n,x(w[w.length-1]),X.maxDepth+=w[w.length-1].depth)}X.slashes=C,X.parts=T}return X}})),b=t(((e,t)=>{let n=_(),r=v(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(!(!a||r!==a.repeat(r.length)||i!==a.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return`${n.length===1?r.escapeRegex(n[0]):`[${n.map(e=>r.escapeRegex(e)).join(``)}]`}*`},y=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},b=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};for(let e of i){let t=g(e);if(t)return{risky:!0,safeOutput:t};if(y(e)>r)return{risky:!0}}return{risky:!1}},x=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),v=n.extglobChars(_),{DOT_LITERAL:y,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:D,NO_DOTS_SLASH:O,QMARK:k,QMARK_NO_DOT:A,STAR:j,START_ANCHOR:M}=_,N=e=>`(${g}(?:(?!${M}${e.dot?T:y}).)*?)`,P=d.dot?``:E,F=d.dot?k:A,I=d.bash===!0?N(d):j;d.capture&&(I=`(${I})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let L={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,L),p=e.length;let R=[],z=[],B=[],V=m,H,U=()=>L.index===p-1,W=L.peek=(t=1)=>e[L.index+t],G=L.advance=()=>e[++L.index]||``,K=()=>e.slice(L.index+1),q=(e=``,t=0)=>{L.consumed+=e,L.index+=t},J=e=>{L.output+=e.output==null?e.value:e.output,q(e.value)},Y=()=>{let e=1;for(;W()===`!`&&(W(2)!==`(`||W(3)===`?`);)G(),L.start++,e++;return e%2==0?!1:(L.negated=!0,L.start++,!0)},X=e=>{L[e]++,B.push(e)},Z=e=>{L[e]--,B.pop()},Q=e=>{if(V.type===`globstar`){let t=L.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||R.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(L.output=L.output.slice(0,-V.output.length),V.type=`star`,V.value=`*`,V.output=I,L.output+=V.output)}if(R.length&&e.type!==`paren`&&(R[R.length-1].inner+=e.value),(e.value||e.output)&&J(e),V&&V.type===`text`&&e.type===`text`){V.output=(V.output||V.value)+e.value,V.value+=e.value;return}e.prev=V,h.push(e),V=e},$=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=V,n.parens=L.parens,n.output=L.output,n.startIndex=L.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;X(`parens`),Q({type:e,value:t,output:L.output?``:w}),Q({type:`paren`,extglob:!0,value:G(),output:r}),R.push(n)},ee=n=>{let i=e.slice(n.startIndex,L.index+1),a=b(e.slice(n.startIndex+2,L.index),d);if((n.type===`plus`||n.type===`star`)&&a.risky){let e=a.safeOutput?(n.output?``:w)+(d.capture?`(${a.safeOutput})`:a.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;L.output=n.output+t.output,L.backtrack=!0,Q({type:`paren`,extglob:!0,value:H,output:``}),Z(`parens`);return}let o=n.close+(d.capture?`)`:``),s;if(n.type===`negate`){let e=I;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=N(d)),(e!==I||U()||/^\)+$/.test(K()))&&(o=n.close=`)$))${e}`),n.inner.includes(`*`)&&(s=K())&&/^\.[^\\/.]+$/.test(s)&&(o=n.close=`)${x(s,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(L.negatedExtglob=!0)}Q({type:`paren`,extglob:!0,value:H,output:o}),Z(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?k.repeat(a.length):``):o===0?F+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?y.repeat(r.length):i===`*`?t?t+i+(a?I:``):I:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(L.output=e,L):(L.output=r.wrapOutput(i,L,t),L)}for(;!U();){if(H=G(),H===`\0`)continue;if(H===`\\`){let e=W();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){H+=`\\`,Q({type:`text`,value:H});continue}let t=/^\\+/.exec(K()),n=0;if(t&&t[0].length>2&&(n=t[0].length,L.index+=n,n%2!=0&&(H+=`\\`)),d.unescape===!0?H=G():H+=G(),L.brackets===0){Q({type:`text`,value:H});continue}}if(L.brackets>0&&(H!==`]`||V.value===`[`||V.value===`[^`)){if(d.posix!==!1&&H===`:`){let e=V.value.slice(1);if(e.includes(`[`)&&(V.posix=!0,e.includes(`:`))){let e=V.value.lastIndexOf(`[`),t=V.value.slice(0,e),n=a[V.value.slice(e+2)];if(n){V.value=t+n,L.backtrack=!0,G(),!m.output&&h.indexOf(V)===1&&(m.output=w);continue}}}(H===`[`&&W()!==`:`||H===`-`&&W()===`]`)&&(H=`\\${H}`),H===`]`&&(V.value===`[`||V.value===`[^`)&&(H=`\\${H}`),d.posix===!0&&H===`!`&&V.value===`[`&&(H=`^`),V.value+=H,J({value:H});continue}if(L.quotes===1&&H!==`"`){H=r.escapeRegex(H),V.value+=H,J({value:H});continue}if(H===`"`){L.quotes=L.quotes===1?0:1,d.keepQuotes===!0&&Q({type:`text`,value:H});continue}if(H===`(`){X(`parens`),Q({type:`paren`,value:H});continue}if(H===`)`){if(L.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=R[R.length-1];if(e&&L.parens===e.parens+1){ee(R.pop());continue}Q({type:`paren`,value:H,output:L.parens?`)`:`\\)`}),Z(`parens`);continue}if(H===`[`){if(d.nobracket===!0||!K().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));H=`\\${H}`}else X(`brackets`);Q({type:`bracket`,value:H});continue}if(H===`]`){if(d.nobracket===!0||V&&V.type===`bracket`&&V.value.length===1){Q({type:`text`,value:H,output:`\\${H}`});continue}if(L.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));Q({type:`text`,value:H,output:`\\${H}`});continue}Z(`brackets`);let e=V.value.slice(1);if(V.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(H=`/${H}`),V.value+=H,J({value:H}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(V.value);if(L.output=L.output.slice(0,-V.value.length),d.literalBrackets===!0){L.output+=t,V.value=t;continue}V.value=`(${g}${t}|${V.value})`,L.output+=V.value;continue}if(H===`{`&&d.nobrace!==!0){X(`braces`);let e={type:`brace`,value:H,output:`(`,outputIndex:L.output.length,tokensIndex:L.tokens.length};z.push(e),Q(e);continue}if(H===`}`){let e=z[z.length-1];if(d.nobrace===!0||!e){Q({type:`text`,value:H,output:H});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),L.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=L.output.slice(0,e.outputIndex),r=L.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,H=t=`\\}`,L.output=n;for(let e of r)L.output+=e.output||e.value}Q({type:`brace`,value:H,output:t}),Z(`braces`),z.pop();continue}if(H===`|`){R.length>0&&R[R.length-1].conditions++,Q({type:`text`,value:H});continue}if(H===`,`){let e=H,t=z[z.length-1];t&&B[B.length-1]===`braces`&&(t.comma=!0,e=`|`),Q({type:`comma`,value:H,output:e});continue}if(H===`/`){if(V.type===`dot`&&L.index===L.start+1){L.start=L.index+1,L.consumed=``,L.output=``,h.pop(),V=m;continue}Q({type:`slash`,value:H,output:C});continue}if(H===`.`){if(L.braces>0&&V.type===`dot`){V.value===`.`&&(V.output=y);let e=z[z.length-1];V.type=`dots`,V.output+=H,V.value+=H,e.dots=!0;continue}if(L.braces+L.parens===0&&V.type!==`bos`&&V.type!==`slash`){Q({type:`text`,value:H,output:y});continue}Q({type:`dot`,value:H,output:y});continue}if(H===`?`){if(!(V&&V.value===`(`)&&d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){$(`qmark`,H);continue}if(V&&V.type===`paren`){let e=W(),t=H;(V.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(K()))&&(t=`\\${H}`),Q({type:`text`,value:H,output:t});continue}if(d.dot!==!0&&(V.type===`slash`||V.type===`bos`)){Q({type:`qmark`,value:H,output:A});continue}Q({type:`qmark`,value:H,output:k});continue}if(H===`!`){if(d.noextglob!==!0&&W()===`(`&&(W(2)!==`?`||!/[!=<:]/.test(W(3)))){$(`negate`,H);continue}if(d.nonegate!==!0&&L.index===0){Y();continue}}if(H===`+`){if(d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){$(`plus`,H);continue}if(V&&V.value===`(`||d.regex===!1){Q({type:`plus`,value:H,output:S});continue}if(V&&(V.type===`bracket`||V.type===`paren`||V.type===`brace`)||L.parens>0){Q({type:`plus`,value:H});continue}Q({type:`plus`,value:S});continue}if(H===`@`){if(d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){Q({type:`at`,extglob:!0,value:H,output:``});continue}Q({type:`text`,value:H});continue}if(H!==`*`){(H===`$`||H===`^`)&&(H=`\\${H}`);let e=o.exec(K());e&&(H+=e[0],L.index+=e[0].length),Q({type:`text`,value:H});continue}if(V&&(V.type===`globstar`||V.star===!0)){V.type=`star`,V.star=!0,V.value+=H,V.output=I,L.backtrack=!0,L.globstar=!0,q(H);continue}let t=K();if(d.noextglob!==!0&&/^\([^?]/.test(t)){$(`star`,H);continue}if(V.type===`star`){if(d.noglobstar===!0){q(H);continue}let n=V.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){Q({type:`star`,value:H,output:``});continue}let o=L.braces>0&&(n.type===`comma`||n.type===`brace`),s=R.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){Q({type:`star`,value:H,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[L.index+4];if(n&&n!==`/`)break;t=t.slice(3),q(`/**`,3)}if(n.type===`bos`&&U()){V.type=`globstar`,V.value+=H,V.output=N(d),L.output=V.output,L.globstar=!0,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&U()){L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=N(d)+(d.strictSlashes?`)`:`|$)`),V.value+=H,L.globstar=!0,L.output+=n.output+V.output,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=`${N(d)}${C}|${C}${e})`,V.value+=H,L.output+=n.output+V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){V.type=`globstar`,V.value+=H,V.output=`(?:^|${C}|${N(d)}${C})`,L.output=V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}L.output=L.output.slice(0,-V.output.length),V.type=`globstar`,V.output=N(d),V.value+=H,L.output+=V.output,L.globstar=!0,q(H);continue}let n={type:`star`,value:H,output:I};if(d.bash===!0){n.output=`.*?`,(V.type===`bos`||V.type===`slash`)&&(n.output=P+n.output),Q(n);continue}if(V&&(V.type===`bracket`||V.type===`paren`)&&d.regex===!0){n.output=H,Q(n);continue}(L.index===L.start||V.type===`slash`||V.type===`dot`)&&(V.type===`dot`?(L.output+=D,V.output+=D):d.dot===!0?(L.output+=O,V.output+=O):(L.output+=P,V.output+=P),W()!==`*`&&(L.output+=w,V.output+=w)),Q(n)}for(;L.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L.output=r.escapeLast(L.output,`[`),Z(`brackets`)}for(;L.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));L.output=r.escapeLast(L.output,`(`),Z(`parens`)}for(;L.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));L.output=r.escapeLast(L.output,`{`),Z(`braces`)}if(d.strictSlashes!==!0&&(V.type===`star`||V.type===`bracket`)&&Q({type:`maybe_slash`,value:``,output:`${C}?`}),L.backtrack===!0){L.output=``;for(let e of L.tokens)L.output+=e.output==null?e.value:e.output,e.suffix&&(L.output+=e.suffix)}return L};x.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=x})),x=t(((e,t)=>{let n=y(),r=b(),i=v(),a=_(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),r?p:!0)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),S=t(((e,t)=>{let n=x(),r=v();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i})),C=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Builder=void 0;let n=e(`path`),r=g();var i=null;try{e.resolve(`picomatch`),i=S()}catch{}t.Builder=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:n.sep,filters:[]};globFunction;constructor(e){this.options={...this.options,...e},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(e){return this.options.pathSeparator=e,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(e){return this.options.maxDepth=e,this}withMaxFiles(e){return this.options.maxFiles=e,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:e=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=e,this.withFullPaths()}withAbortSignal(e){return this.options.signal=e,this}normalize(){return this.options.normalizePath=!0,this}filter(e){return this.options.filters.push(e),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(e){return this.options.exclude=e,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(e){return new r.APIBuilder(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}crawlWithOptions(e,t){return this.options={...this.options,...t},new r.APIBuilder(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||i;if(!n)throw Error(`Please specify a glob function to use glob matching.`);var r=this.globCache[e.join(`\0`)];return r||(r=n(e,...t),this.globCache[e.join(`\0`)]=r),this.options.filters.push(e=>r(e)),this}}})),w=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),T=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.fdir=void 0;let r=C();Object.defineProperty(e,`fdir`,{enumerable:!0,get:function(){return r.Builder}}),n(w(),e)}));export{S as n,T as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"../rolldown-runtime.mjs";var t=e((e=>{e.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<`u`,e.SYMBOL_SUPPORT=typeof Symbol<`u`})),n=e(((e,n)=>{var r=t(),i=r.ARRAY_BUFFER_SUPPORT,a=r.SYMBOL_SUPPORT;n.exports=function(e,t){var n,r,o,s,c;if(!e)throw Error(`obliterator/forEach: invalid iterable.`);if(typeof t!=`function`)throw Error(`obliterator/forEach: expecting a callback.`);if(Array.isArray(e)||i&&ArrayBuffer.isView(e)||typeof e==`string`||e.toString()===`[object Arguments]`){for(o=0,s=e.length;o<s;o++)t(e[o],o);return}if(typeof e.forEach==`function`){e.forEach(t);return}if(a&&Symbol.iterator in e&&typeof e.next!=`function`&&(e=e[Symbol.iterator]()),typeof e.next==`function`){for(n=e,o=0;c=n.next(),c.done!==!0;)t(c.value,o),o++;return}for(r in e)e.hasOwnProperty(r)&&t(e[r],r)}})),r=e(((e,t)=>{function n(e){if(typeof e!=`function`)throw Error(`obliterator/iterator: expecting a function!`);this.next=e}typeof Symbol<`u`&&(n.prototype[Symbol.iterator]=function(){return this}),n.of=function(){var e=arguments,t=e.length,r=0;return new n(function(){return r>=t?{done:!0}:{done:!1,value:e[r++]}})},n.empty=function(){return new n(function(){return{done:!0}})},n.fromSequence=function(e){var t=0,r=e.length;return new n(function(){return t>=r?{done:!0}:{done:!1,value:e[t++]}})},n.is=function(e){return e instanceof n?!0:typeof e==`object`&&!!e&&typeof e.next==`function`},t.exports=n})),i=e((e=>{var t=2**8-1,n=2**16-1,r=2**32-1,i=2**7-1,a=2**15-1,o=2**31-1;e.getPointerArray=function(e){var i=e-1;if(i<=t)return Uint8Array;if(i<=n)return Uint16Array;if(i<=r)return Uint32Array;throw Error(`mnemonist: Pointer Array of size > 4294967295 is not supported.`)},e.getSignedPointerArray=function(e){var t=e-1;return t<=i?Int8Array:t<=a?Int16Array:t<=o?Int32Array:Float64Array},e.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var s={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(t,n){var r=null,i=0,a,o,c,l,u;for(l=0,u=t.length;l<u;l++)c=n?n(t[l]):t[l],o=e.getNumberType(c),a=s[o.name],a>i&&(i=a,r=o);return r},e.isTypedArray=function(e){return typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)},e.concat=function(){var e=0,t,n,r;for(t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=new arguments[0].constructor(e);for(t=0,n=0;t<r;t++)i.set(arguments[t],n),n+=arguments[t].length;return i},e.indices=function(t){for(var n=new(e.getPointerArray(t))(t),r=0;r<t;r++)n[r]=r;return n}})),a=e((e=>{var t=n(),r=i();function a(e){return Array.isArray(e)||r.isTypedArray(e)}function o(e){if(typeof e.length==`number`)return e.length;if(typeof e.size==`number`)return e.size}function s(e){var n=o(e),r=typeof n==`number`?Array(n):[],i=0;return t(e,function(e){r[i++]=e}),r}function c(e){var n=o(e),i=typeof n==`number`?r.getPointerArray(n):Array,a=typeof n==`number`?Array(n):[],s=typeof n==`number`?new i(n):[],c=0;return t(e,function(e){a[c]=e,s[c]=c++}),[a,s]}e.isArrayLike=a,e.guessLength=o,e.toArray=s,e.toArrayWithIndices=c})),o=e(((e,t)=>{t.exports=function(e){return typeof e==`object`&&!!e&&typeof e.addUndirectedEdgeWithKey==`function`&&typeof e.dropNode==`function`&&typeof e.multi==`boolean`}})),s=e(((e,t)=>{var n=a(),i=r();function o(e,t){if(arguments.length<2)throw Error(`mnemonist/fixed-deque: expecting an Array class and a capacity.`);if(typeof t!=`number`||t<=0)throw Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=e,this.capacity=t,this.items=new e(this.capacity),this.clear()}o.prototype.clear=function(){this.start=0,this.size=0},o.prototype.push=function(e){if(this.size===this.capacity)throw Error(`mnemonist/fixed-deque.push: deque capacity (`+this.capacity+`) exceeded!`);var t=this.start+this.size;return t>=this.capacity&&(t-=this.capacity),this.items[t]=e,++this.size},o.prototype.unshift=function(e){if(this.size===this.capacity)throw Error(`mnemonist/fixed-deque.unshift: deque capacity (`+this.capacity+`) exceeded!`);var t=this.start-1;return this.start===0&&(t=this.capacity-1),this.items[t]=e,this.start=t,++this.size},o.prototype.pop=function(){if(this.size!==0){this.size--;var e=this.start+this.size;return e>=this.capacity&&(e-=this.capacity),this.items[e]}},o.prototype.shift=function(){if(this.size!==0){var e=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[e]}},o.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]},o.prototype.peekLast=function(){if(this.size!==0){var e=this.start+this.size-1;return e>=this.capacity&&(e-=this.capacity),this.items[e]}},o.prototype.get=function(e){if(!(this.size===0||e>=this.capacity))return e=this.start+e,e>=this.capacity&&(e-=this.capacity),this.items[e]},o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=this.capacity,r=this.size,i=this.start,a=0;a<r;)e.call(t,this.items[i],a,this),i++,a++,i===n&&(i=0)},o.prototype.toArray=function(){var e=this.start+this.size;if(e<this.capacity)return this.items.slice(this.start,e);for(var t=new this.ArrayClass(this.size),n=this.capacity,r=this.size,i=this.start,a=0;a<r;)t[a]=this.items[i],i++,a++,i===n&&(i=0);return t},o.prototype.values=function(){var e=this.items,t=this.capacity,n=this.size,r=this.start,a=0;return new i(function(){if(a>=n)return{done:!0};var i=e[r];return r++,a++,r===t&&(r=0),{value:i,done:!1}})},o.prototype.entries=function(){var e=this.items,t=this.capacity,n=this.size,r=this.start,a=0;return new i(function(){if(a>=n)return{done:!0};var i=e[r];return r++,r===t&&(r=0),{value:[a++,i],done:!1}})},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.inspect=function(){var e=this.toArray();return e.type=this.ArrayClass.name,e.capacity=this.capacity,Object.defineProperty(e,`constructor`,{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e,t,r){if(arguments.length<3&&(r=n.guessLength(e),typeof r!=`number`))throw Error(`mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.`);var i=new o(t,r);if(n.isArrayLike(e)){var a,s;for(a=0,s=e.length;a<s;a++)i.items[a]=e[a];return i.size=s,i}return n.forEach(e,function(e){i.push(e)}),i},t.exports=o})),c=e((e=>{let t=o(),n=s();function r(e,t){let n=0;return e.forEachInNeighbor(t,()=>{n++}),n}function i(e,i){if(!t(e))throw Error(`graphology-dag/topological-sort: the given graph is not a valid graphology instance.`);if(e.type===`undirected`||e.undirectedSize!==0)throw Error(`graphology-dag/topological-sort: cannot work if graph is not directed.`);if(e.order===0)return;let a=new n(Array,e.order),o={},s=0;e.forEachNode((t,n)=>{let i=e.multi?r(e,t):e.inDegree(t);i===0?a.push([t,n,0]):(o[t]=i,s+=i)});let c=0;function l(e,t){let n=--o[e];s--,n===0&&a.push([e,t,c+1]),o[e]=n}for(;a.size!==0;){let[t,n,r]=a.shift();c=r,i(t,n,r),e.forEachOutNeighbor(t,l)}if(s!==0)throw Error(`graphology-dag/topological-sort: given graph is not acyclic.`)}function a(e){if(!t(e))throw Error(`graphology-dag/topological-sort: the given graph is not a valid graphology instance.`);let n=Array(e.order),r=0;return i(e,e=>{n[r++]=e}),n}e.topologicalSort=a})),l=e(((e,t)=>{let n=o();t.exports=function(e,t,r){if(!n(e))throw Error(`graphology-dag/will-create-cycle: the given graph is not a valid graphology instance.`);if(t=``+t,r=``+r,t===r)return!0;if(!e.hasNode(t)||!e.hasNode(r)||e.hasDirectedEdge(t,r))return!1;if(e.hasDirectedEdge(r,t))return!0;let i=e.outNeighbors(r);function a(e){i.push(e)}for(;i.length!==0;){let n=i.pop();if(n===t)return!0;e.forEachOutNeighbor(n,a)}return!1}}));export{r as a,i,c as n,n as o,a as r,l as t};
|