@sheetxl/sdk 0.7.28-beta.1 → 0.7.28-beta.3

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.
Files changed (33) hide show
  1. package/README.md +3 -0
  2. package/browser/cjs/1mH2uhx_Dmceu88H.cjs +33 -0
  3. package/browser/cjs/B4PKKgaDTG9aSO-f.cjs +1 -0
  4. package/browser/cjs/{nMss3hrHzgX9s6dC.cjs → BX6A6xGDOr_td9mw.cjs} +2 -2
  5. package/browser/cjs/{DfVZ_U2YapkL3Y3y.cjs → CWCKcp58KidyndaL.cjs} +1 -1
  6. package/browser/cjs/{nE4y6hua6AwWSil7.cjs → D6cjnwWR_iUSe1f6.cjs} +1 -1
  7. package/browser/cjs/index.cjs +2 -2
  8. package/browser/esm/{CWKJatjtHKfWtM2b.mjs → B1gpnr-7kLU7jTy-.mjs} +2 -2
  9. package/browser/esm/{AyOmyt_vaPirbWnn.mjs → C78IaCXqwCcraBPe.mjs} +5789 -5690
  10. package/browser/esm/{CkhE5KvHQvKzw4Ll.mjs → CPgz9_iM7xyAcytg.mjs} +2 -2
  11. package/browser/esm/{BvaEmG7AaTSm7dFt.mjs → CX1NO_a1QPjXDvTU.mjs} +213 -207
  12. package/browser/esm/{Dpwf1IgHZjpEpK-K.mjs → DZfds6s3ayTZrozO.mjs} +1 -1
  13. package/browser/esm/{BJ5lU2Y0r4Vy8n4q.mjs → Dv8FyXyeygJPXoHo.mjs} +2 -2
  14. package/browser/esm/{uFvYxePB3xD2HrP0.mjs → Rj8e7SashcMlcdZJ.mjs} +2 -2
  15. package/browser/esm/index.mjs +419 -414
  16. package/node/esm/{CYXOvL3qwWeDE0xf.mjs → 8VtzCFSmLPKxJjOa.mjs} +2 -2
  17. package/node/esm/{qxrG4h6T0dAo8eZ6.mjs → BkY99r-c3BhlT_Kv.mjs} +303 -297
  18. package/node/esm/{Dgmq_XXiU2AQw1tX.mjs → DE3eIaqkk5xzmV1c.mjs} +1 -1
  19. package/node/esm/index.mjs +7450 -7367
  20. package/package.json +6 -6
  21. package/resources/locales/de/model.msg.json +12 -0
  22. package/resources/locales/en/model.msg.json +12 -0
  23. package/types/scripting.d.ts +76 -7
  24. package/types/src/calculation/ICalculation.d.ts +5 -0
  25. package/types/src/calculation/compiler/CompilerUtils.d.ts +20 -0
  26. package/types/src/calculation/compiler/FormulaParser.d.ts +32 -6
  27. package/types/src/calculation/functions/Operators.d.ts +1 -1
  28. package/types/src/calculation/grid/CalcGrid.d.ts +2 -0
  29. package/types/src/calculation/grid/ICalcGrid.d.ts +11 -0
  30. package/types/src/cellRange/ICellRange.d.ts +60 -3
  31. package/types/src/sheet/SheetRange.d.ts +12 -1
  32. package/browser/cjs/D590vnHyyrIYenQ7.cjs +0 -33
  33. package/browser/cjs/DsII2GRIYGbaZjIE.cjs +0 -1
@@ -0,0 +1 @@
1
+ const e=require("./1mH2uhx_Dmceu88H.cjs"),t=require("./BX6A6xGDOr_td9mw.cjs");let n=require("@sheetxl/primitives"),r=require("@sheetxl/utils");var i=[`All`,`Data`,`Headers`,`Totals`,`This Row`],a=class{constructor(n=e.nt){let r=function(e){let t=[...i];if(e)for(let n of Object.values(e)){let e=n?.trim();e&&!t.some(t=>t.toLowerCase()===e.toLowerCase())&&t.push(e)}return t.sort((e,t)=>t.length-e.length),t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)}(n.specifiers),a=t.a({name:`WhiteSpace`,pattern:/\s+/,group:t.o.SKIPPED}),o=t.a({name:`TableSpecifier`,pattern:RegExp(`\\[#(?:${r})\\]`,`i`)}),s=[a,o,t.a({name:`BracketedColumn`,pattern:/\[([^[\]]*)\]/,longer_alt:[o]}),t.a({name:`BareSpecifier`,pattern:RegExp(`#(?:${r})`,`i`)}),t.a({name:`ColumnSep`,pattern:/:/}),t.a({name:`ListSep`,pattern:new RegExp(n.separators.separatorFunction.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))})];this._lexer=new t.o(s,{ensureOptimizations:!0});let c={};s.forEach(e=>{c[e.name]=e}),this._vocabulary=c}getVocabulary(){return this._vocabulary}tokenize(e){return this._lexer.tokenize(e)}},o=class extends t.n{constructor(t=e.nt){let n=new a(t),r=n.getVocabulary();super(r,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=n;let{TableSpecifier:i,BracketedColumn:o,BareSpecifier:s,ColumnSep:c,ListSep:l}=r,u=this;u.RULE(`ruleContent`,()=>{let e=[],t=u.SUBRULE(u.ruleItem);return u.ACTION(()=>{t&&e.push(t)}),u.MANY(()=>{u.CONSUME(l),u.OPTION(()=>{let t=u.SUBRULE2(u.ruleItem);u.ACTION(()=>{t&&e.push(t)})})}),e}),u.RULE(`ruleItem`,()=>u.OR([{ALT:()=>u.SUBRULE(u.ruleSpecifier)},{ALT:()=>u.SUBRULE(u.ruleColumnOrRange)}])),u.RULE(`ruleSpecifier`,()=>u.OR([{ALT:()=>{let n=u.CONSUME(i);return u.ACTION(()=>{let r=e.Q(n.image,t);return r.image=n.image,r})}},{ALT:()=>{let n=u.CONSUME(s);return u.ACTION(()=>{let r=e.Q(n.image,t);return r.image=n.image,r})}}])),u.RULE(`ruleColumnOrRange`,()=>{let t=u.CONSUME(o),n,r;return u.OPTION(()=>{n=u.CONSUME(c),r=u.CONSUME2(o)}),u.ACTION(()=>{let i=e.X(t.image);if(i.image=t.image,!r)return i;let a=e.X(r.image);a.image=r.image;let o=e.R(`:`,i,a,!0);return o.image=n?.image??`:`,o})}),u.performSelfAnalysis()}_parseInner(e){let t=this._lexer.tokenize(e);return t.errors.length>0||t.tokens.length===0?[]:(this.input=t.tokens,this.reset(),this.ruleContent()??[])}_parseContent(t){if(!t)return[];let n=t.trim();if(!n)return[];let r=n[0];if(r===`@`){let t=n.slice(1).trim();if(!t){let t=e.G(`@`,null,!0);return t.image=`@`,[t]}let r=e.X(t);r.image=t;let i=e.G(`@`,r,!0);return i.image=`@`,[i]}if(r!==`[`&&r!==`#`){let n=e.X(t);return n.image=t,[n]}return this._parseInner(n)}parse(t,n,r){let i=()=>({root:e.Z(``,[]),errors:[]});if(!r)return i();let a=r.indexOf(`[`);if(a===-1)return i();let o=r.slice(0,a),s=r.slice(a+1,-1),c=this._parseContent(s);return{root:e.Z(o,c),errors:this.errors.length>0?[...this.errors]:[]}}},s=new Set([`:`,`.:.`,`.:`,`:.`]),c=new Set([`.:.`,`.:`,`:.`]),l=t=>{if(!t)return null;if(t.type===e.tt.Cell){let e=t.value;return e.rowIndex===-(2**53-1)?`col`:e.colIndex===-(2**53-1)?`row`:null}return Number.isInteger(t.value)?`row`:null},u=(e,t)=>{let n=parseInt(e.charCodeAt(0)===36?e.substring(1):e,10);return n>=1&&n<=t},d=`A formula must not be empty`;function f(e,t){let n=e?.[0]?.image;if(!n){let e=t?.image;return e?`Expected a value after '${e}'`:`Expected a value`}return`Unexpected '${n}'`}var p={...t.r,buildNoViableAltMessage:e=>f(e.actual,e.previous),buildEarlyExitMessage:e=>f(e.actual,e.previous),buildNotAllInputParsedMessage:e=>{let n=e.firstRedundant?.image;return n?`Unexpected '${n}'`:t.r.buildNotAllInputParsedMessage(e)},buildMismatchTokenMessage:e=>{let n=e.actual?.image;return e.expected===t.i&&n?`Unexpected '${n}'`:t.r.buildMismatchTokenMessage(e)}},m=class extends t.n{constructor(n){let r=n?.lexer??t.t.shared(n?.lexerOptions),i=r.getVocabulary();super(i,{skipValidations:!0,recoveryEnabled:!0,...n,nodeLocationTracking:`full`,errorMessageProvider:p,maxLookahead:1}),this._ruleInfixOp=this.RULE(`ruleInfixOp`,()=>{let{PlusOp:t,MinOp:n,MulOp:r,DivOp:i,ExOp:a,ConcatOp:o,GtOp:s,EqOp:c,LtOp:l,NeqOp:u,GteOp:d,LteOp:f}=this._vocab,p=[];return p.push({node:this.SUBRULE(this._rulePostfixOp)}),this.MANY(()=>{let m=this.OR(this._c1||=[{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(r).image},{ALT:()=>this.CONSUME(i).image},{ALT:()=>this.CONSUME(a).image},{ALT:()=>this.CONSUME(o).image},{ALT:()=>this.CONSUME(s).image},{ALT:()=>this.CONSUME(c).image},{ALT:()=>this.CONSUME(l).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image}]),h={value:m,index:this.getLexerPosition(),isRange:e.$.includes(m)},g=this.SUBRULE2(this._rulePostfixOp);p.push({op:h,node:g})}),this.ACTION(()=>{let t=p.length-1,n=e.A.length;for(let r=0;t>0&&r<n;r++){let n=e.A[r],i=1;for(;i<p.length;){let r=p[i].op;if(n.includes(r.value)){let n=p[i-1].node,a=p[i].node,o=e.R(r.value,n,a,r.isRange);o=this._tag(o,r.index),p[i-1].node=o,p.splice(i,1),t--}else i++}}}),p[0].node}),this._rulePlusMinusOp=this.RULE(`rulePlusMinusOp`,()=>{let{PlusOp:e,MinOp:t}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)}])}),this._rulePostfixOp=this.RULE(`rulePostfixOp`,()=>{let{PercentOp:t}=this._vocab,n=this.SUBRULE(this._rulePrefixOp),r=[];return this.MANY(()=>{let e=this.CONSUME(t).image;this.ACTION(()=>{r.push([e,this.getLexerPosition()])})}),this.ACTION(()=>{let t=r.length;if(t!==0)for(let i=0;i<t;i++){let t=r[i],a=t[0],o=t[1],s=e.$.includes(a);n=e.W(a,n,s),n=this._tag(n,o)}}),n}),this._rulePrefixOp=this.RULE(`rulePrefixOp`,()=>{let{PlusOp:t,MinOp:n,ImplicitIntersectOp:r}=this._vocab,i=[];this.MANY(()=>{let e=this.OR([{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(r).image}]);this.ACTION(()=>{i.push([e,this.getLexerPosition()])})});let a=this.SUBRULE(this._ruleRangeOp);return this.ACTION(()=>{let t=i.length;if(t!==0)for(let n=t-1;n>=0;n--){let t=i[n],r=t[0],o=t[1],s=e.$.includes(r);a=e.G(r,a,s),a=this._tag(a,o)}}),a}),this._ruleRangeOp=this.RULE(`ruleRangeOp`,()=>{let{RangeOp:t,RangeTrimFullOp:n,RangeTrimLeadingOp:r,RangeTrimTrailingOp:i,ArrayAnchorOp:a}=this._vocab,o=[];return o.push({node:this.SUBRULE(this._ruleCallOp)}),this.MANY2(()=>{this.CONSUME(a),o.push({anchor:this.getLexerPosition()})}),this.MANY(()=>{let e={value:this.OR(this._c2||=[{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(r).image},{ALT:()=>this.CONSUME(i).image}]),index:this.getLexerPosition()},s=this.SUBRULE2(this._ruleCallOp);o.push({op:e,node:s}),this.MANY3(()=>{this.CONSUME2(a),o.push({anchor:this.getLexerPosition()})})}),this.ACTION(()=>{for(let t=1;t<o.length;t++){let n=o[t];if(n.anchor!==void 0){o[0].node=this._tag(e.W(`#`,o[0].node,!0),n.anchor);continue}let r=n.op,i=e.R(r.value,o[0].node,n.node,!0);i=this._tag(i,r.index),o[0].node=i}}),o[0].node}),this._ruleCallOp=this.RULE(`ruleCallOp`,()=>{let{OpenParen:t,CloseParen:n}=this._vocab,r=this.SUBRULE(this._ruleFormula);return this.MANY({GATE:()=>{let e=this.LA(0),n=this.LA(1);return!(!e||!n||n.tokenType!==t)&&n.startOffset===e.endOffset+1},DEF:()=>{this.CONSUME(t);let i=this.getLexerPosition(),a=this.SUBRULE(this._ruleFunctionArguments),o=r,s=this.ACTION(()=>this._tag(e.N(o,a),i)),c=this.OPTION(()=>this.CONSUME(n));this.ACTION(()=>{c||this._reportError(s,`Missing closing parenthesis ')'`,i),this._tagClose(s,this.getLexerPosition()),r=s})}}),r}),this._ruleIntersectOp=this.RULE(`ruleIntersectOp`,()=>{let t=[this.SUBRULE(this._ruleInfixOp)];return this.MANY(()=>{this.OPTION({GATE:()=>{let e=this.LA(0);return this.LA(1).startOffset>e.endOffset+1},DEF:()=>{t.push(this.SUBRULE3(this._ruleInfixOp))}})}),this.ACTION(()=>{for(;t.length>1;){let n=t.length-1;for(let r=0;r<n;r++){let i=t[r],a=t[r+1],o=e.R(` `,i,a,!0),s=this._tokenMap.get(i);s&&delete s.tokenIndexClose;let c=this._tokenMap.get(a),l=c?.tokenIndex;if(l!==void 0){let e=this.input[l],t=this.input[l-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(o.wsBefore=n)}c&&delete c.tokenIndex,r+1<n&&c&&delete c.tokenIndexClose,t.splice(r,2,o),r--,n--}}}),t[0]}),this._ruleFormula=this.RULE(`ruleFormula`,()=>this.OR9([{ALT:()=>this.SUBRULE(this._ruleLiteral)},{ALT:()=>this.SUBRULE(this._ruleReference)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>this.SUBRULE(this._ruleParen)},{ALT:()=>this.SUBRULE(this._ruleTableReference)},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleLiteralArray)}])),this._ruleGroup=this.RULE(`ruleGroup`,()=>{let{ArgSeparator:e}=this._vocab,t=[];return this.MANY(()=>{this.CONSUME(e);let n=this.SUBRULE2(this._ruleIntersectOp);this.ACTION(()=>{t.push(n)})}),t}),this._ruleParen=this.RULE(`ruleParen`,()=>{let{OpenParen:t,CloseParen:n}=this._vocab;return this._processParen(e.tt.Paren,t,n)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:t,CloseCurlyParen:n,ColSeparator:r,RowSeparator:i}=this._vocab,a=e.V();this.CONSUME(t);let o=this.getLexerPosition(),s=this.ACTION(()=>this._tag(e.z(a),o)),c=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{a.value.push(c)}),this.MANY(()=>{let t=!1;this.OR([{ALT:()=>{this.CONSUME(r),t=!0}},{ALT:()=>this.CONSUME(i)}]);let n=this.SUBRULE2(this._ruleLiteralForArray);this.ACTION(()=>{t||(a=e.V(),s.value.push(a)),a.value.push(n)})});let l=this.OPTION(()=>this.CONSUME(n));return s=this.ACTION(()=>(l||this._reportError(s,`Missing closing parenthesis '}'`,o),this._tagClose(s,this.getLexerPosition()))),s}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:t,BooleanToken:n,LiteralError:r,RefError:i}=this._vocab;return this.OR([{ALT:()=>{let t=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),n=this.SUBRULE(this._ruleNumber),r=this.ACTION(()=>this._tag(e.U(n.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>t?e.K(t.image,r):r)}},{ALT:()=>{let n=this.CONSUME(t);return this.ACTION(()=>this._tag(e.Y(n.image),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(n);return this.ACTION(()=>this._tag(e.M(t.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(r);return this.ACTION(()=>this._tag(e.B(t.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(i);return this.ACTION(()=>this._tag(e.q(t.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:t,BooleanToken:n,LiteralError:r,RefError:i}=this._vocab;return this.OR([{ALT:()=>{let t=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(e.U(t.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let n=this.CONSUME(t);return this.ACTION(()=>this._tag(e.Y(n.image),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(n);return this.ACTION(()=>this._tag(e.M(t.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(r);return this.ACTION(()=>this._tag(e.B(t.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(i);return this.ACTION(()=>this._tag(e.q(t.image,this._locale),this.getLexerPosition()))}}])}),this._ruleFunction=this.RULE(`ruleFunction`,()=>{let{FunctionToken:t,OpenParen:n,CloseParen:r}=this._vocab,i=this.CONSUME(t).image,a=this.getLexerPosition();this.CONSUME(n);let o=this.SUBRULE(this._ruleFunctionArguments),s=this.ACTION(()=>this._tag(e.L(i,o),a)),c=this.OPTION(()=>this.CONSUME(r));return s=this.ACTION(()=>(c||this._reportError(s,`Missing closing parenthesis ')'`,a),this._tagClose(s,this.getLexerPosition()))),s}),this._ruleFunctionArguments=this.RULE(`ruleFunctionArguments`,()=>{let{ArgSeparator:t,CloseParen:n}=this._vocab,r=[];return this.OPTION({GATE:()=>this.LA(1).tokenType!==n,DEF:()=>{let n;this.OPTION2(()=>{n=this.SUBRULE(this._ruleIntersectOp)}),n=this.ACTION(()=>n??this._tagClose(e.I(),this.getLexerPosition())),r.push(n),this.MANY(()=>{let n;this.CONSUME(t),this.OPTION3(()=>{n=this.SUBRULE2(this._ruleIntersectOp)}),n=this.ACTION(()=>n??this._tagClose(e.I(),this.getLexerPosition())),r.push(n)})}}),r}),this._ruleBracketedString=this.RULE(`ruleBracketedString`,()=>{let{BracketedString:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleTableReference=this.RULE(`ruleTableReference`,()=>{let{TableReference:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleReference=this.RULE(`ruleReference`,()=>{let{Sheet:t,SheetQuoted:n,DivOp:r,MulOp:i,PlusOp:a,MinOp:o,ArgSeparator:s,Cell:c,NamedToken:l,SingleQuotedString:u,Column:d,AbsRow:f,DigitToken:p,RefError:m}=this._vocab,h;this.OPTION2({GATE:()=>{for(let e=1;e<6;e++){let c=this.LA(e);if(c.tokenType===t||c.tokenType===n)return!0;if(c.image===``||c.image===`)`||c.tokenType===r||c.tokenType===i||c.tokenType===a||c.tokenType===o||c.tokenType===s)break}return!1},DEF:()=>{h=this.SUBRULE(this._rulePrefixSheetName)}});let g=this.OR([{ALT:()=>{let t=this.CONSUME(c),n=this.getLexerPosition();return this.ACTION(()=>this._tag(e.P(t.image,this.rowIndex,this.colIndex),n))}},{ALT:()=>{let t=this.OR2([{ALT:()=>this.CONSUME(l)},{ALT:()=>this.CONSUME(u)}]);return this.ACTION(()=>this._tag(e.H(t.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let t=this.CONSUME(d);return this.ACTION(()=>this._tag(e.F(t.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(f);return this.ACTION(()=>this._tag(e.J(t.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(p);return this.ACTION(()=>this._tag(e.J(t.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(m);return this.ACTION(()=>this._tag(e.q(t.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(h&&g){if(h.name===``)return void this._reportError(g,`'${h.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let t=g;g.type===e.tt.Postfix&&g.inputs?.[0]&&(t=g.inputs[0]),t.type!==e.tt.Cell&&t.type!==e.tt.Named&&t.type!==e.tt.Row&&t.type!==e.tt.TableColumn&&t.type!==e.tt.Error||(t.value.scope=h.name,t.value.scopeImage=h.image)}}),g}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,RangeOp:r,Sheet:i}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===r,DEF:()=>{e+=this.CONSUME(n).image,this.CONSUME(r),e+=`:`}});let a=this.CONSUME(i).image;return{name:e+a.slice(0,-1),image:e+a}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:t}=this._vocab,n=this.SUBRULE(this._ruleIntersectOp),r=[];return this.MANY(()=>{this.CONSUME(t),r.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>r.length===0?n:{type:e.tt.List,value:`,`,inputs:[n,...r],isReference:!0})}),this._lexer=r,this._locale=r.getLocale(),this._vocab=i,this._srParser=n?.srParser??new o(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(t,r,i,a){let o=this._lexer.tokenize(i),f;if(!o)return{root:{type:e.tt.Unparsed,value:i},errors:[]};let p=o.tokens;if(p.length===0)throw new n.FormulaError.Parse(d);return this.input=p,this._inputText=i,this._inputTextLength=i.length,this.rowIndex=t,this.colIndex=r,this._astErrors=[],this._tokenMap=new Map,this.reset(),f=this._ruleRoot(),f&&this._bindAllWhitespace(f),f=e.et(f,(n,r)=>{let i=n.type,a=r?.isReference?r.value:void 0,o=typeof a==`string`&&s.has(a),d=typeof a==`string`&&c.has(a),f=o?r.inputs:void 0,p=f?f[0]===n?f[1]:f[0]:void 0,m=this._lexer.getMaxRow();if(o&&i!==e.tt.Cell&&Number.isInteger(n.value)){let r=e.J(n.image,t);return e.j(r,n),l(p)===`row`?u(n.image,m)||this._reportError(r,`'${n.image}' is not a valid row — rows run from 1 to ${m}`):this._reportError(r,`'${n.image}' is not a valid reference — a whole row can only pair with another row (as in ${n.image}:${n.image})`),r}if(d&&i===e.tt.Named)return this._reportError(n,`'${n.image??n.value?.nameId}' is a name — '${a}' needs a cell or range on both sides`),n;if(i===e.tt.Cell){let t=n.value,r=t.colIndex===-(2**53-1),i=t.rowIndex===-(2**53-1);if((r||i)&&l(p)===(r?`row`:`col`))return r&&!u(n.image,m)&&this._reportError(n,`'${n.image}' is not a valid row — rows run from 1 to ${m}`),n;if(r||i||t.colIndex>=16384){let o=e.H(n.image);e.j(o,n);let s=t.scope;return s&&(o.value.scope=s,o.value.scopeImage=t.scopeImage),r?this._reportError(o,`'${n.image}' is not a valid reference — a row needs a column (use ${n.image}:${n.image} for the whole row)`):i&&n.image.includes(`$`)?this._reportError(o,`'${n.image}' is not a valid reference — a whole column can only pair with another column (as in ${n.image}:${n.image})`):d&&this._reportError(o,`'${n.image}' is a name — '${a}' needs a cell or range on both sides`),o}}return n}),a&&f&&(f=e.g(f,a,null)),{root:f,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(t){if(t){if(this._bindNodeWhitespace(t),t.inputs)for(let e of t.inputs)e&&this._bindAllWhitespace(e);if(t.type===e.tt.Array&&Array.isArray(t.value)){for(let e of t.value)if(e&&Array.isArray(e.value))for(let t of e.value)t&&this._bindAllWhitespace(t)}}}};exports.FormulaCompiler=class{constructor(e){e={...e},this._editing=e.profile===`editing`,this._parser=new m(e)}compile(t,r,i,a,o,s,c,l){if(a.length===0){let e=new n.FormulaError.Parse(d);return this._compileUnparsed(t,o,a,{input:a,cause:e,causes:[e]})}if(a.length>e.rt.MAX_EXPRESSION_LENGTH){let r=new n.FormulaError.Parse((u=a.length,`A formula must not be longer than ${e.rt.MAX_EXPRESSION_LENGTH} characters (this one is ${u})`));return this._compileUnparsed(t,o,a,{input:a,cause:r,causes:[r]})}var u;let f,p,m=[];try{let e=this._parser.parse(r,i,a,l);f=e.root,m=e.errors}catch(e){p=n.FormulaError.isError(e,n.FormulaError.Code.Parse)?e:new n.FormulaError.Parse(e.message,e)}let h=[];for(let t of m)h.push(e.E(t));if(f){e.w(f,s??null)&&h.push(new n.FormulaError.Parse(`The implicit intersection operator ' ' requires a cell or range on both sides`)),e.C(f,s??null)&&h.push(new n.FormulaError.Parse(`The spill anchor operator '#' requires a cell or range`)),e.T(f,s??null)&&h.push(new n.FormulaError.Parse(`Expected a reference; a value cannot be converted to one.`));let t=e.y(f,s??null);t&&h.push(new n.FormulaError.Parse(t));let r=e.b(f,s??null);r&&h.push(new n.FormulaError.Parse(r));let i=e.x(f,s??null);i&&h.push(new n.FormulaError.Parse(i));let a=e.S(f);a&&h.push(new n.FormulaError.Parse(a))}h.length>0&&!p&&(p=h[0]);let g=null;if(p&&(g={input:a,cause:p,causes:h.length>0?h:[p]}),!f){if(this._editing){let e=this._recoverCompiled(t,r,i,a,o,g,c);if(e)return e}return this._compileUnparsed(t,o,a,g)}f=e.O(f,s??null),f=e._(f,s??null),o&&(f=e.D(f,o,c));let _=e.v(t,o,f,this._editing,g,s??null);return this._editing&&g&&e.k(_.getTokens(),o)!==a?this._recoverCompiled(t,r,i,a,o,g,c)||this._compileUnparsed(t,o,a,g):_}autoCorrect(e){let t;try{let n=this._parser.getLexer().tokenize(e,!1);if(n.errors.length>0)return null;t=n.tokens}catch{return null}let n=[];for(let e of t){let t=e.tokenType?.name;if(t===`OpenParen`)n.push(`)`);else if(t===`OpenCurlyParen`)n.push(`}`);else if((t===`CloseParen`||t===`CloseCurlyParen`)&&n.pop()!==(t===`CloseParen`?`)`:`}`))return null}return n.length===0?null:e+n.reverse().join(``)}_compileUnparsed(t,n,i,a){let o={runtime:t,symbols:n,getFunction:null,ast:null,evaluations:r.CommonUtils.EmptyArray,executions:r.CommonUtils.EmptyArray,bindings:r.CommonUtils.EmptyArray,referencesAbsolute:r.CommonUtils.EmptyArray,referencesExecute:r.CommonUtils.EmptyArray,referencesRelative:r.CommonUtils.EmptyArray,referencesRoot:r.CommonUtils.EmptyArray,referenceIndices:r.CommonUtils.EmptyArray,getTokens:()=>[{type:e.tt.Unparsed,value:i,text:i}],namedIds:r.CommonUtils.EmptyArray,symbolIds:r.CommonUtils.EmptyArray,hasTotals:!1,isReferenceOnly:!1,error:a,transform:()=>o};return o}_recoverCompiled(t,n,r,i,a,o,s){let c,l=i.length;try{let e=this._parser.getLexer().tokenize(i,!1);c=e.tokens,e.errors.length>0&&(l=Math.min(l,e.errors[0].offset))}catch{return null}let u=[];for(let e=c.length-1;e>=0&&u.length<24;e--){let t=(c[e].endOffset??-1)+1;t>0&&t<i.length&&t<=l&&u.push(t)}for(let c of u){let l=i.slice(0,c),u,d;try{u=this._parser.parse(n,r,l).root}catch{continue}if(!u||u.type===e.tt.Unparsed)continue;try{let n=e._(u,null),r=a?e.D(n,a,s):n;d=e.v(t,a,r,!0,o)}catch{continue}if(e.k(d.getTokens(),a)!==l)continue;let f=i.slice(c);if(f.length===0)return d;let p,m={...d,getTokens:()=>(p||(p=[...d.getTokens()],this._appendUnparsedTail(p,f)),p),transform:()=>m};return m}return null}_appendUnparsedTail(t,n){let r=[];for(let n of t)n.type===e.tt.Paren&&n.text===`(`?r.push({ctx:n.context,argIndex:0}):n.type===e.tt.Paren&&n.text===`)`?r.pop():n.type===e.tt.Separator&&r.length>0&&r[r.length-1].argIndex++;let i=r.length>0?r[r.length-1]:void 0,a=i?.ctx?{...i.ctx,argIndex:i.ctx.argIndex===-1?i.argIndex:i.ctx.argIndex}:void 0,o=(n,r)=>{let i={type:e.tt.Unparsed,value:n,text:n};a&&(i.context=a),r&&(i.isLookup=!0),t.push(i)},s=/[A-Za-z_][A-Za-z0-9_]*$/.exec(n),c=s?s.index:-1;c>=0&&(c===0||!/[A-Za-z0-9_.]/.test(n[c-1]))?(c>0&&o(n.slice(0,c)),o(n.slice(c),!0)):o(n)}};
@@ -1,4 +1,4 @@
1
- const e=require("./D590vnHyyrIYenQ7.cjs");let t=require("@sheetxl/primitives");function n(e){console&&console.error&&console.error(`Error: ${e}`)}function r(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function i(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function a(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}var o=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},s=class extends o{constructor(e){super([]),this.idx=1,Object.assign(this,v(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},c=class extends o{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,v(e))}},l=class extends o{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,v(e))}},u=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},d=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},f=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},p=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},m=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},h=class extends o{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,v(e))}},g=class{constructor(e){this.idx=1,Object.assign(this,v(e))}accept(e){e.visit(this)}};function _(e){function t(e){return e.map(_)}if(e instanceof s){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof l)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof u)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof d)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof f)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:_(new g({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof m)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:_(new g({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof p)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof h)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof g){let t={type:`Terminal`,name:e.terminalType.name,label:(n=e.terminalType,typeof(r=n).LABEL==`string`&&r.LABEL!==``?n.LABEL:n.name),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=i instanceof RegExp?i.source:i),t}if(e instanceof c)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`);var n,r}function v(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var y=class{visit(e){let t=e;switch(t.constructor){case s:return this.visitNonTerminal(t);case l:return this.visitAlternative(t);case u:return this.visitOption(t);case d:return this.visitRepetitionMandatory(t);case f:return this.visitRepetitionMandatoryWithSeparator(t);case m:return this.visitRepetitionWithSeparator(t);case p:return this.visitRepetition(t);case h:return this.visitAlternation(t);case g:return this.visitTerminal(t);case c:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function b(e,t=[]){return e instanceof u||e instanceof p||e instanceof m||(e instanceof h?e.definition.some(e=>b(e,t)):!(e instanceof s&&t.includes(e))&&e instanceof o&&(e instanceof s&&t.push(e),e.definition.every(e=>b(e,t))))}function x(e){if(e instanceof s)return`SUBRULE`;if(e instanceof u)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 m)return`MANY_SEP`;if(e instanceof p)return`MANY`;if(e instanceof g)return`CONSUME`;throw Error(`non exhaustive match`)}var S=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof s)this.walkProdRef(n,i,t);else if(n instanceof g)this.walkTerminal(n,i,t);else if(n instanceof l)this.walkFlat(n,i,t);else if(n instanceof u)this.walkOption(n,i,t);else if(n instanceof d)this.walkAtLeastOne(n,i,t);else if(n instanceof f)this.walkAtLeastOneSep(n,i,t);else if(n instanceof m)this.walkManySep(n,i,t);else if(n instanceof p)this.walkMany(n,i,t);else{if(!(n instanceof h))throw Error(`non exhaustive match`);this.walkOr(n,i,t)}})}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 u({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=C(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new u({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=C(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new l({definition:[e]});this.walk(t,r)})}};function C(e,t,n){return[new u({definition:[new g({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function w(e){if(e instanceof s)return w(e.referencedRule);if(e instanceof g)return[e.terminalType];if(function(e){return e instanceof l||e instanceof u||e instanceof p||e instanceof d||e instanceof f||e instanceof m||e instanceof g||e instanceof c}(e))return function(e){let t=[],n=e.definition,r,i=0,a=n.length>i,o=!0;for(;a&&o;)r=n[i],o=b(r),t=t.concat(w(r)),i+=1,a=n.length>i;return[...new Set(t)]}(e);if(function(e){return e instanceof h}(e))return function(e){let t=e.definition.map(e=>w(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var T=`_~IN~_`,E=class extends S{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=(i=e.referencedRule,a=e.idx,i.name+a+T+this.topProd.name);var i,a;let o=w(new l({definition:t.concat(n)}));this.follows[r]=o}};function D(e){return e.charCodeAt(0)}function O(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function k(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function A(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function j(){throw Error(`Internal Error - Should never get here!`)}function M(e){return e.type===`Character`}var N=[];for(let e=D(`0`);e<=D(`9`);e++)N.push(e);var P=[D(`_`)].concat(N);for(let e=D(`a`);e<=D(`z`);e++)P.push(e);for(let e=D(`A`);e<=D(`Z`);e++)P.push(e);var ee=[D(` `),D(`\f`),D(`
1
+ const e=require("./1mH2uhx_Dmceu88H.cjs");let t=require("@sheetxl/primitives");function n(e){console&&console.error&&console.error(`Error: ${e}`)}function r(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function i(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function a(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}var o=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},s=class extends o{constructor(e){super([]),this.idx=1,Object.assign(this,v(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},c=class extends o{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,v(e))}},l=class extends o{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,v(e))}},u=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},d=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},f=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},p=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},m=class extends o{constructor(e){super(e.definition),this.idx=1,Object.assign(this,v(e))}},h=class extends o{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,v(e))}},g=class{constructor(e){this.idx=1,Object.assign(this,v(e))}accept(e){e.visit(this)}};function _(e){function t(e){return e.map(_)}if(e instanceof s){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof l)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof u)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof d)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof f)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:_(new g({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof m)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:_(new g({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof p)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof h)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof g){let t={type:`Terminal`,name:e.terminalType.name,label:(n=e.terminalType,typeof(r=n).LABEL==`string`&&r.LABEL!==``?n.LABEL:n.name),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=i instanceof RegExp?i.source:i),t}if(e instanceof c)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`);var n,r}function v(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var y=class{visit(e){let t=e;switch(t.constructor){case s:return this.visitNonTerminal(t);case l:return this.visitAlternative(t);case u:return this.visitOption(t);case d:return this.visitRepetitionMandatory(t);case f:return this.visitRepetitionMandatoryWithSeparator(t);case m:return this.visitRepetitionWithSeparator(t);case p:return this.visitRepetition(t);case h:return this.visitAlternation(t);case g:return this.visitTerminal(t);case c:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function b(e,t=[]){return e instanceof u||e instanceof p||e instanceof m||(e instanceof h?e.definition.some(e=>b(e,t)):!(e instanceof s&&t.includes(e))&&e instanceof o&&(e instanceof s&&t.push(e),e.definition.every(e=>b(e,t))))}function x(e){if(e instanceof s)return`SUBRULE`;if(e instanceof u)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 m)return`MANY_SEP`;if(e instanceof p)return`MANY`;if(e instanceof g)return`CONSUME`;throw Error(`non exhaustive match`)}var S=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof s)this.walkProdRef(n,i,t);else if(n instanceof g)this.walkTerminal(n,i,t);else if(n instanceof l)this.walkFlat(n,i,t);else if(n instanceof u)this.walkOption(n,i,t);else if(n instanceof d)this.walkAtLeastOne(n,i,t);else if(n instanceof f)this.walkAtLeastOneSep(n,i,t);else if(n instanceof m)this.walkManySep(n,i,t);else if(n instanceof p)this.walkMany(n,i,t);else{if(!(n instanceof h))throw Error(`non exhaustive match`);this.walkOr(n,i,t)}})}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 u({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=C(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new u({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=C(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new l({definition:[e]});this.walk(t,r)})}};function C(e,t,n){return[new u({definition:[new g({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function w(e){if(e instanceof s)return w(e.referencedRule);if(e instanceof g)return[e.terminalType];if(function(e){return e instanceof l||e instanceof u||e instanceof p||e instanceof d||e instanceof f||e instanceof m||e instanceof g||e instanceof c}(e))return function(e){let t=[],n=e.definition,r,i=0,a=n.length>i,o=!0;for(;a&&o;)r=n[i],o=b(r),t=t.concat(w(r)),i+=1,a=n.length>i;return[...new Set(t)]}(e);if(function(e){return e instanceof h}(e))return function(e){let t=e.definition.map(e=>w(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var T=`_~IN~_`,E=class extends S{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=(i=e.referencedRule,a=e.idx,i.name+a+T+this.topProd.name);var i,a;let o=w(new l({definition:t.concat(n)}));this.follows[r]=o}};function D(e){return e.charCodeAt(0)}function O(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function k(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function A(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function j(){throw Error(`Internal Error - Should never get here!`)}function M(e){return e.type===`Character`}var N=[];for(let e=D(`0`);e<=D(`9`);e++)N.push(e);var P=[D(`_`)].concat(N);for(let e=D(`a`);e<=D(`z`);e++)P.push(e);for(let e=D(`A`);e<=D(`Z`);e++)P.push(e);var ee=[D(` `),D(`\f`),D(`
2
2
  `),D(`\r`),D(` `),D(`\v`),D(` `),D(`\xA0`),D(` `),D(` `),D(` `),D(` `),D(` `),D(` `),D(` `),D(` `),D(` `),D(` `),D(` `),D(` `),D(`\u2028`),D(`\u2029`),D(` `),D(` `),D(` `),D(``)],te=/[0-9a-fA-F]/,F=/[0-9]/,ne=/[1-9]/,I=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Lookbehind`:this.visitLookbehind(e);break;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},L={},re=new class{constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:k(n,`global`);break;case`i`:k(n,`ignoreCase`);break;case`m`:k(n,`multiLine`);break;case`u`:k(n,`unicode`);break;case`y`:k(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:let t;switch(this.consumeChar(`?`),this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}}A(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return j()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`)}if(!0===e&&t===void 0)return;A(t)}if(!0!==e||t!==void 0)return A(t)?(this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t):void 0}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),A(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):j()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[D(`
3
3
  `),D(`\r`),D(`\u2028`),D(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case`d`:e=N;break;case`D`:e=N,t=!0;break;case`s`:e=ee;break;case`S`:e=ee,t=!0;break;case`w`:e=P;break;case`W`:e=P,t=!0}return A(e)?{type:`Set`,value:e,complement:t}:j()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=D(`\f`);break;case`n`:e=D(`
4
4
  `);break;case`r`:e=D(`\r`);break;case`t`:e=D(` `);break;case`v`:e=D(`\v`)}return A(e)?{type:`Character`,value:e}:j()}controlLetterEscapeAtom(){this.consumeChar(`c`);let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar(`0`),{type:`Character`,value:D(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:D(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
@@ -54,4 +54,4 @@ For Further details.`,r},buildEmptyRepetitionError(e){let t=x(e.repetition);retu
54
54
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
55
55
  For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(Pe)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else{if(typeof e!=`object`||!e)throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap=Object.assign({},e)}this.tokensMap.EOF=q;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?Oe:B,V(Object.values(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=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:dn.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:dn.recoveryValueFunc,a=this.ruleShortNameIdx<<12,o;return this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a,o=!0===this.outputCst?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(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Pt(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}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if(typeof e!=`function`){r=e.DEF;let t=e.GATE;if(t!==void 0){let e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){let n=this.getKeyForAutomaticLookahead(Ut,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Y.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,Ut,e,tt)}atLeastOneSepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(Gt,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(e,Y.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,nt],t,Gt,e,nt)}}manyInternal(e,t){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let a=!0;for(;!0===i.call(this)&&!0===a;)a=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,$e,a)}manySepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(Wt,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(n).call(this)){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,et],t,Wt,e,et)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,Gt,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=Array.isArray(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(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.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 Pt(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_FAST(1);!0===this.tokenMatcher(t,e)?(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 It(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||n.name!==`MismatchedTokenException`||this.isBackTracking())throw n;{let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),q)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(Z)}onAfterParse(e){if(!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Rt(t,e))}for(;this.tokVector.at(-1)===Z;)this.tokVector.pop()}},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=dn){if(this.definedRulesNames.includes(e)){let t={message:J.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Q.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=dn){let r=function(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Q.INVALID_RULE_OVERRIDE,ruleName:e})),r}(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){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(Pt(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(_)}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:$.errorMessageProvider}SAVE_ERROR(e){if(Pt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=ht(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:a,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new zt(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=mt(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));let a=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Lt(o,this.LA(1),a))}},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 Z}topLevelRuleRecord(e,t){try{let n=new c({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message+=`
56
56
  This error was thrown during the "grammar recording phase" For more info see:
57
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return X.call(this,u,e,t)}atLeastOneInternalRecord(e,t){X.call(this,d,t,e)}atLeastOneSepFirstInternalRecord(e,t){X.call(this,f,t,e,nn)}manyInternalRecord(e,t){X.call(this,p,t,e)}manySepFirstInternalRecord(e,t){X.call(this,m,t,e,nn)}orInternalRecord(e,t){return cn.call(this,e,t)}subruleInternalRecord(e,t,n){if(un(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${ln(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=this.recordingProdStack.at(-1),i=e.ruleName,a=new s({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?sn:tn}consumeInternalRecord(e,t,n){if(un(t),!Me(e)){let n=Error(`<CONSUME${ln(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=this.recordingProdStack.at(-1),i=new g({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),on}},class{initPerformanceTracer(e){if(Object.hasOwn(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=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:a}=i(t),o=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,a}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(fn.prototype,n,r):fn.prototype[n]=e.prototype[n]})});var mn=class extends pn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},hn=class n{static shared(t){let r=t?.locale??e.tt,i=t?.maxColumn??yn,a=t?.maxRow??bn,o=vn.get(r);o||(o=new Map,vn.set(r,o));let s=`${i}:${a}`,c=o.get(s);return c||(c=new n({locale:r,maxColumn:i,maxRow:a}),o.set(s,c)),c}constructor(t){let n=t?.maxColumn??yn,r=t?.maxRow??bn,i=t?.locale??e.tt;this._locale=i,this._maxColumn=n,this._maxRow=r;let{separatorFunction:a,separatorColumn:o,separatorRow:s,separatorDecimal:c}=i.separators;if(o===s)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${o}')`);let l=K({name:`WhiteSpace`,pattern:/\s+/,group:W.SKIPPED}),u=K({name:`StringToken`,pattern:/"(""|[^"])*"/}),d=K({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),f=K({name:`TableReference`,pattern:{exec:wn},line_breaks:!1,start_chars_hint:_n}),p=K({name:`BracketedString`,pattern:{exec:En},line_breaks:!1,start_chars_hint:[91],longer_alt:[f,u]}),m=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),h=K({name:`LiteralError`,pattern:RegExp(m(i.errorLiterals)+`#PARSE!|#NULL!|#DIV\\/0!|#VALUE!|#NUM!|#FIELD!|#N\\/A|#GETTING_DATA|#SPILL!|#CONNECT!|#BLOCKED!|#UNKNOWN!|#CALC!|#BUSY!|#PYTHON!|#TIMEOUT!`)}),g=K({name:`RefError`,pattern:RegExp(m(i.errorRefs)+`#REF!|#NAME\\?`)}),_=K({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),v=K({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),y=K({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),b=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,x=K({name:`NamedToken`,pattern:{exec:(e,t)=>{b.lastIndex=t;let n=b.exec(e);if(!n)return null;let r=n[0],i=r.indexOf(`.:`);return i===-1?r.endsWith(`:`)&&(r=r.slice(0,-1)):r=r.substring(0,i),[r]}},line_breaks:!1,start_chars_hint:_n}),S=K({name:`Cell`,pattern:{exec:Cn(n,r)},line_breaks:!1,start_chars_hint:[36,...gn],longer_alt:x}),C=K({name:`Column`,pattern:{exec:Sn(n)},line_breaks:!1,start_chars_hint:[36,...gn],longer_alt:x}),w=K({name:`AbsRow`,pattern:/[$][0-9]+/}),T=c===`.`?`\\.`:c,E=K({name:`NumberToken`,pattern:RegExp(`[0-9]+${T}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${T}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),D=K({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),O=K({name:`DigitToken`,pattern:/[0-9]+/}),k=[`TRUE`,`FALSE`];for(let e of[i.booleanTrue,i.booleanFalse]){let t=e?.trim();t&&!k.some(e=>e.toLowerCase()===t.toLowerCase())&&k.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let A=K({name:`BooleanToken`,pattern:new RegExp(k.join(`|`),`i`)}),j=K({name:`ArgSeparator`,pattern:Tn(a)}),M=K({name:`ColSeparator`,pattern:Tn(o)}),N=K({name:`RowSeparator`,pattern:Tn(s)}),P=K({name:`RangeOp`,pattern:/:/}),ee=K({name:`RangeTrimFullOp`,pattern:/\.:\./}),te=K({name:`RangeTrimLeadingOp`,pattern:/\.:/}),F=K({name:`RangeTrimTrailingOp`,pattern:/:\./}),ne=K({name:`OpenParen`,pattern:/\(/}),I=K({name:`CloseParen`,pattern:/\)/}),L=K({name:`OpenCurlyParen`,pattern:/{/}),re=K({name:`CloseCurlyParen`,pattern:/}/}),ie=K({name:`QuoteS`,pattern:/'/}),ae=K({name:`MulOp`,pattern:/\*(?!\*)/}),oe=K({name:`PlusOp`,pattern:/\+/}),se=K({name:`DivOp`,pattern:/\//}),ce=K({name:`MinOp`,pattern:/-/}),le=K({name:`ImplicitIntersectOp`,pattern:/@/}),ue=K({name:`ConcatOp`,pattern:/&/}),de=K({name:`ExOp`,pattern:/\^/}),fe=K({name:`PercentOp`,pattern:/%/}),pe=K({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[h,g]}),R=K({name:`GtOp`,pattern:/>/}),me=K({name:`EqOp`,pattern:/=/}),he=K({name:`LtOp`,pattern:/</}),ge=[l,u,v,_,y,d,f,p,h,g,j,...o===a?[]:[M],N,ee,te,F,P,S,A,C,w,E,D,O,pe,le,x,ne,I,L,re,ie,ae,oe,se,ce,ue,de,fe,K({name:`NeqOp`,pattern:/<>/}),K({name:`GteOp`,pattern:/>=/}),K({name:`LteOp`,pattern:/<=/}),R,me,he];this._lexer=new W(ge,{ensureOptimizations:!0});let _e={};ge.forEach(e=>{_e[e.name]=e}),o===a&&(_e.ColSeparator=j),this._vocabulary=_e}tokenize(e,n=!0){let r=this._lexer.tokenize(e);if(n&&r.errors.length>0){let n=r.errors[0],i=n.line,a=n.column,o=e.substr(n.offset,n.length||1),s=o?`Unexpected character '${o}'`:n.message;throw new t.FormulaError.Parse(s,{line:i,column:a,offset:n.offset,length:n.length})}return r}getVocabulary(){return this._vocabulary}getLocale(){return this._locale}getMaxColumn(){return this._maxColumn}getMaxRow(){return this._maxRow}getSeparators(){return this._locale.separators}},gn=(()=>{let e=[];for(let t=65;t<=90;t++)e.push(t);for(let t=97;t<=122;t++)e.push(t);for(let t=48;t<=57;t++)e.push(t);return e})().filter(e=>e<48||e>57),_n=(()=>{let e=[...gn,95,92];for(let t=127;t<=65535;t++)e.push(t);return e})(),vn=new WeakMap,yn=16384,bn=1048576;function xn(e,t,n){let r=0;for(let i=t;i<n;i++){let t=e.charCodeAt(i);r=26*r+(t>=97?t-96:t-64)}return r}function Sn(e){return(t,n)=>{let r=n;t.charCodeAt(r)===36&&r++;let i=r;for(;r<t.length&&r-i<3;){let e=t.charCodeAt(r);if(!(e>=65&&e<=90||e>=97&&e<=122))break;r++}if(r-i===0||xn(t,i,r)>e)return null;if(r<t.length){let e=t.charCodeAt(r);if(e>=48&&e<=57)return null}return[t.substring(n,r)]}}function Cn(e,t){return(n,r)=>{let i=r;n.charCodeAt(i)===36&&i++;let a=i;for(;i<n.length&&i-a<3;){let e=n.charCodeAt(i);if(!(e>=65&&e<=90||e>=97&&e<=122))break;i++}if(i-a===0||xn(n,a,i)>e)return null;i<n.length&&n.charCodeAt(i)===36&&i++;let o=i;if(i>=n.length)return null;let s=n.charCodeAt(i);if(s<49||s>57)return null;for(i++;i<n.length;){let e=n.charCodeAt(i);if(!(e>=48&&e<=57))break;i++}return parseInt(n.substring(o,i),10)>t?null:[n.substring(r,i)]}}function wn(e,t){let n=e.charCodeAt(t);if(!(n>=65&&n<=90||n>=97&&n<=122||n===95||n>=127&&n<=65535))return null;let r=t+1;for(;r<e.length;){let t=e.charCodeAt(r);if(!(t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===95||t===46||t>=127&&t<=65535))break;r++}if(r>=e.length||e.charCodeAt(r)!==91)return null;let i=0;for(;r<e.length;){let n=e.charCodeAt(r);if(n===91)i++;else if(n===93&&(i--,i===0))return[e.substring(t,r+1)];r++}return null}function Tn(e){return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}function En(e,t){if(e.charCodeAt(t)!==91)return null;let n=0,r=t;for(;r<e.length;){let i=e.charCodeAt(r);if(i===91)n++;else if(i===93&&(n--,n===0))return[e.substring(t,r+1)];r++}return null}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return hn}});
57
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return X.call(this,u,e,t)}atLeastOneInternalRecord(e,t){X.call(this,d,t,e)}atLeastOneSepFirstInternalRecord(e,t){X.call(this,f,t,e,nn)}manyInternalRecord(e,t){X.call(this,p,t,e)}manySepFirstInternalRecord(e,t){X.call(this,m,t,e,nn)}orInternalRecord(e,t){return cn.call(this,e,t)}subruleInternalRecord(e,t,n){if(un(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${ln(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=this.recordingProdStack.at(-1),i=e.ruleName,a=new s({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?sn:tn}consumeInternalRecord(e,t,n){if(un(t),!Me(e)){let n=Error(`<CONSUME${ln(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=this.recordingProdStack.at(-1),i=new g({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),on}},class{initPerformanceTracer(e){if(Object.hasOwn(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=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:a}=i(t),o=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,a}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(fn.prototype,n,r):fn.prototype[n]=e.prototype[n]})});var mn=class extends pn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},hn=class n{static shared(t){let r=t?.locale??e.nt,i=t?.maxColumn??yn,a=t?.maxRow??bn,o=vn.get(r);o||(o=new Map,vn.set(r,o));let s=`${i}:${a}`,c=o.get(s);return c||(c=new n({locale:r,maxColumn:i,maxRow:a}),o.set(s,c)),c}constructor(t){let n=t?.maxColumn??yn,r=t?.maxRow??bn,i=t?.locale??e.nt;this._locale=i,this._maxColumn=n,this._maxRow=r;let{separatorFunction:a,separatorColumn:o,separatorRow:s,separatorDecimal:c}=i.separators;if(o===s)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${o}')`);let l=K({name:`WhiteSpace`,pattern:/\s+/,group:W.SKIPPED}),u=K({name:`StringToken`,pattern:/"(""|[^"])*"/}),d=K({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),f=K({name:`TableReference`,pattern:{exec:wn},line_breaks:!1,start_chars_hint:_n}),p=K({name:`BracketedString`,pattern:{exec:En},line_breaks:!1,start_chars_hint:[91],longer_alt:[f,u]}),m=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),h=K({name:`LiteralError`,pattern:RegExp(m(i.errorLiterals)+`#PARSE!|#NULL!|#DIV\\/0!|#VALUE!|#NUM!|#FIELD!|#N\\/A|#GETTING_DATA|#SPILL!|#CONNECT!|#BLOCKED!|#UNKNOWN!|#CALC!|#BUSY!|#PYTHON!|#TIMEOUT!`)}),g=K({name:`RefError`,pattern:RegExp(m(i.errorRefs)+`#REF!|#NAME\\?`)}),_=K({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),v=K({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),y=K({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),b=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,x=K({name:`NamedToken`,pattern:{exec:(e,t)=>{b.lastIndex=t;let n=b.exec(e);if(!n)return null;let r=n[0],i=r.indexOf(`.:`);return i===-1?r.endsWith(`:`)&&(r=r.slice(0,-1)):r=r.substring(0,i),[r]}},line_breaks:!1,start_chars_hint:_n}),S=K({name:`Cell`,pattern:{exec:Cn(n,r)},line_breaks:!1,start_chars_hint:[36,...gn],longer_alt:x}),C=K({name:`Column`,pattern:{exec:Sn(n)},line_breaks:!1,start_chars_hint:[36,...gn],longer_alt:x}),w=K({name:`AbsRow`,pattern:/[$][0-9]+/}),T=c===`.`?`\\.`:c,E=K({name:`NumberToken`,pattern:RegExp(`[0-9]+${T}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${T}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),D=K({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),O=K({name:`DigitToken`,pattern:/[0-9]+/}),k=[`TRUE`,`FALSE`];for(let e of[i.booleanTrue,i.booleanFalse]){let t=e?.trim();t&&!k.some(e=>e.toLowerCase()===t.toLowerCase())&&k.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let A=K({name:`BooleanToken`,pattern:new RegExp(k.join(`|`),`i`)}),j=K({name:`ArgSeparator`,pattern:Tn(a)}),M=K({name:`ColSeparator`,pattern:Tn(o)}),N=K({name:`RowSeparator`,pattern:Tn(s)}),P=K({name:`RangeOp`,pattern:/:/}),ee=K({name:`RangeTrimFullOp`,pattern:/\.:\./}),te=K({name:`RangeTrimLeadingOp`,pattern:/\.:/}),F=K({name:`RangeTrimTrailingOp`,pattern:/:\./}),ne=K({name:`OpenParen`,pattern:/\(/}),I=K({name:`CloseParen`,pattern:/\)/}),L=K({name:`OpenCurlyParen`,pattern:/{/}),re=K({name:`CloseCurlyParen`,pattern:/}/}),ie=K({name:`QuoteS`,pattern:/'/}),ae=K({name:`MulOp`,pattern:/\*(?!\*)/}),oe=K({name:`PlusOp`,pattern:/\+/}),se=K({name:`DivOp`,pattern:/\//}),ce=K({name:`MinOp`,pattern:/-/}),le=K({name:`ImplicitIntersectOp`,pattern:/@/}),ue=K({name:`ConcatOp`,pattern:/&/}),de=K({name:`ExOp`,pattern:/\^/}),fe=K({name:`PercentOp`,pattern:/%/}),pe=K({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[h,g]}),R=K({name:`GtOp`,pattern:/>/}),me=K({name:`EqOp`,pattern:/=/}),he=K({name:`LtOp`,pattern:/</}),ge=[l,u,v,_,y,d,f,p,h,g,j,...o===a?[]:[M],N,ee,te,F,P,S,A,C,w,E,D,O,pe,le,x,ne,I,L,re,ie,ae,oe,se,ce,ue,de,fe,K({name:`NeqOp`,pattern:/<>/}),K({name:`GteOp`,pattern:/>=/}),K({name:`LteOp`,pattern:/<=/}),R,me,he];this._lexer=new W(ge,{ensureOptimizations:!0});let _e={};ge.forEach(e=>{_e[e.name]=e}),o===a&&(_e.ColSeparator=j),this._vocabulary=_e}tokenize(e,n=!0){let r=this._lexer.tokenize(e);if(n&&r.errors.length>0){let n=r.errors[0],i=n.line,a=n.column,o=e.substr(n.offset,n.length||1),s=o?`Unexpected character '${o}'`:n.message;throw new t.FormulaError.Parse(s,{line:i,column:a,offset:n.offset,length:n.length})}return r}getVocabulary(){return this._vocabulary}getLocale(){return this._locale}getMaxColumn(){return this._maxColumn}getMaxRow(){return this._maxRow}getSeparators(){return this._locale.separators}},gn=(()=>{let e=[];for(let t=65;t<=90;t++)e.push(t);for(let t=97;t<=122;t++)e.push(t);for(let t=48;t<=57;t++)e.push(t);return e})().filter(e=>e<48||e>57),_n=(()=>{let e=[...gn,95,92];for(let t=127;t<=65535;t++)e.push(t);return e})(),vn=new WeakMap,yn=16384,bn=1048576;function xn(e,t,n){let r=0;for(let i=t;i<n;i++){let t=e.charCodeAt(i);r=26*r+(t>=97?t-96:t-64)}return r}function Sn(e){return(t,n)=>{let r=n;t.charCodeAt(r)===36&&r++;let i=r;for(;r<t.length&&r-i<3;){let e=t.charCodeAt(r);if(!(e>=65&&e<=90||e>=97&&e<=122))break;r++}if(r-i===0||xn(t,i,r)>e)return null;if(r<t.length){let e=t.charCodeAt(r);if(e>=48&&e<=57)return null}return[t.substring(n,r)]}}function Cn(e,t){return(n,r)=>{let i=r;n.charCodeAt(i)===36&&i++;let a=i;for(;i<n.length&&i-a<3;){let e=n.charCodeAt(i);if(!(e>=65&&e<=90||e>=97&&e<=122))break;i++}if(i-a===0||xn(n,a,i)>e)return null;i<n.length&&n.charCodeAt(i)===36&&i++;let o=i;if(i>=n.length)return null;let s=n.charCodeAt(i);if(s<49||s>57)return null;for(i++;i<n.length;){let e=n.charCodeAt(i);if(!(e>=48&&e<=57))break;i++}return parseInt(n.substring(o,i),10)>t?null:[n.substring(r,i)]}}function wn(e,t){let n=e.charCodeAt(t);if(!(n>=65&&n<=90||n>=97&&n<=122||n===95||n>=127&&n<=65535))return null;let r=t+1;for(;r<e.length;){let t=e.charCodeAt(r);if(!(t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===95||t===46||t>=127&&t<=65535))break;r++}if(r>=e.length||e.charCodeAt(r)!==91)return null;let i=0;for(;r<e.length;){let n=e.charCodeAt(r);if(n===91)i++;else if(n===93&&(i--,i===0))return[e.substring(t,r+1)];r++}return null}function Tn(e){return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}function En(e,t){if(e.charCodeAt(t)!==91)return null;let n=0,r=t;for(;r<e.length;){let i=e.charCodeAt(r);if(i===91)n++;else if(i===93&&(n--,n===0))return[e.substring(t,r+1)];r++}return null}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return hn}});
@@ -1 +1 @@
1
- const e=require("./B7_pDFYCVzt-3hUs.cjs"),t=require("./D590vnHyyrIYenQ7.cjs");let n=require("@sheetxl/primitives"),r=require("@sheetxl/utils"),i=require("@sheetxl/formulas");i=e.r(i,1);let a=require("@sheetxl/formulas-extended");a=e.r(a,1);var o=[{pkg:`@sheetxl/formulas`,id:`@sheetxl/formulas`,files:[`functions.json`]},{pkg:`@sheetxl/formulas-extended`,id:`@sheetxl/formulas-extended`,files:[`functions.json`]},{pkg:`@sheetxl/sdk`,id:`@sheetxl/sdk:grammar`,files:[`grammar.json`]}],s=new Set;function c(e,t){let n=`${e.id}\0${t}`;s.has(n)||(s.add(n),r.DefaultLanguagePackService.registerPack(e.id,t,async()=>{let n={tag:t};return await Promise.all(e.files.map(async i=>{let a=await(0,r.fetchLocaleResource)(e.pkg,`${t}/${i}`).catch(()=>{});a&&(i===`functions.json`?n.functions=a:Object.assign(n,a))})),n}))}function l(e){if(e&&e!==`en`&&!e.startsWith(`en-`))for(let t of o)c(t,e)}var u=!1,d=new WeakMap;function f(){let e=t.an(),n=e?.functionHelp;if(!e||!n)return Promise.resolve(null);let r=d.get(e);return r||(r=n().then(e=>(e&&typeof e==`object`&&`default`in e?e.default:e)??null).catch(()=>null),d.set(e,r)),r}var p=(e,i,a,o,s,c)=>{let l=Object.keys(o);for(let u of l){let l=o[u],d=u,p=e=>{let t=null;e.s?t=e.s:e.r||e.g||(t=n.ScalarType.Number);let i={name:e.n,scalar:t,range:e.r??null,arrayDepth:e.d??0,optional:e.m===`?`,rest:e.m===`...`,enums:e.e??r.CommonUtils.EmptyArray};return e.l&&(i.lambda=e.l),e.a!==void 0&&(i.lambdaArity=e.a),e.o&&(i.errors=e.o),e.v!==void 0&&(i.defaultValue=e.v),e.u&&(i.omittable=!0),e.w!==void 0&&(i.omittedValue=e.w),e.g&&(i.repeating=e.g.map(p)),delete i.dim,i},m=[],h=l.p;if(h)for(let e=0;e<h.length;e++)m.push(p(h[e]));let g=null;l.r&&(g={},l.r.s&&(g.scalar=l.r.s),l.r.r&&(g.range=l.r.r===`p`||l.r.r===`r`||l.r.r===`m`?l.r.r:null),l.r.d&&(g.arrayDepth=l.r.d??0),l.r.l&&(g.lambda=l.r.l||null));let _={name:d,parameters:m,returnType:g,context:l.c?`calculation`:null,behavior:null},v=a[l.fn??d],y,b=new t.Gt(_,v,i,async e=>{if(!s)return null;let n;y?n=y:(n=(await s()).default,y=n);let i=n?.[d];if(!i)return console.warn(`No descriptor found for built-in function: ${d}`),null;let a=(await f())?.[d],o=i.p,l=o?{...o}:r.CommonUtils.EmptyObject,u=Object.keys(l);if(u.length>0)for(let e=0;e<u.length;e++){let t=u[e],n=o[t],r=a?.p?.[t];l[t]={description:r?.d??n.d??``,example:r?.e??n.e,defaultValue:n.v}}return{name:d,nameLocal:t.an()?.functions?.[d]??d,summary:a?.s??i.s??``,category:a?.c??i.c??c??null,parameters:l,deprecated:i.h??!1,links:i.l??r.CommonUtils.EmptyArray}},!0);e.set(d,b)}};exports.initializeFunctions=function(e,t){u||(u=!0,l(r.DefaultLanguagePackService.getActive()),r.DefaultLanguagePackService.addChangeListener(e=>l(e)));let n=(0,i.default)(e,p);if((0,a.default)(e,p,n),t)for(let r of t)r(e,p,n);return n};
1
+ const e=require("./B7_pDFYCVzt-3hUs.cjs"),t=require("./1mH2uhx_Dmceu88H.cjs");let n=require("@sheetxl/primitives"),r=require("@sheetxl/utils"),i=require("@sheetxl/formulas");i=e.r(i,1);let a=require("@sheetxl/formulas-extended");a=e.r(a,1);var o=[{pkg:`@sheetxl/formulas`,id:`@sheetxl/formulas`,files:[`functions.json`]},{pkg:`@sheetxl/formulas-extended`,id:`@sheetxl/formulas-extended`,files:[`functions.json`]},{pkg:`@sheetxl/sdk`,id:`@sheetxl/sdk:grammar`,files:[`grammar.json`]}],s=new Set;function c(e,t){let n=`${e.id}\0${t}`;s.has(n)||(s.add(n),r.DefaultLanguagePackService.registerPack(e.id,t,async()=>{let n={tag:t};return await Promise.all(e.files.map(async i=>{let a=await(0,r.fetchLocaleResource)(e.pkg,`${t}/${i}`).catch(()=>{});a&&(i===`functions.json`?n.functions=a:Object.assign(n,a))})),n}))}function l(e){if(e&&e!==`en`&&!e.startsWith(`en-`))for(let t of o)c(t,e)}var u=!1,d=new WeakMap;function f(){let e=t.on(),n=e?.functionHelp;if(!e||!n)return Promise.resolve(null);let r=d.get(e);return r||(r=n().then(e=>(e&&typeof e==`object`&&`default`in e?e.default:e)??null).catch(()=>null),d.set(e,r)),r}var p=(e,i,a,o,s,c)=>{let l=Object.keys(o);for(let u of l){let l=o[u],d=u,p=e=>{let t=null;e.s?t=e.s:e.r||e.g||(t=n.ScalarType.Number);let i={name:e.n,scalar:t,range:e.r??null,arrayDepth:e.d??0,optional:e.m===`?`,rest:e.m===`...`,enums:e.e??r.CommonUtils.EmptyArray};return e.l&&(i.lambda=e.l),e.a!==void 0&&(i.lambdaArity=e.a),e.o&&(i.errors=e.o),e.v!==void 0&&(i.defaultValue=e.v),e.u&&(i.omittable=!0),e.w!==void 0&&(i.omittedValue=e.w),e.g&&(i.repeating=e.g.map(p)),delete i.dim,i},m=[],h=l.p;if(h)for(let e=0;e<h.length;e++)m.push(p(h[e]));let g=null;l.r&&(g={},l.r.s&&(g.scalar=l.r.s),l.r.r&&(g.range=l.r.r===`p`||l.r.r===`r`||l.r.r===`m`?l.r.r:null),l.r.d&&(g.arrayDepth=l.r.d??0),l.r.l&&(g.lambda=l.r.l||null));let _={name:d,parameters:m,returnType:g,context:l.c?`calculation`:null,behavior:null},v=a[l.fn??d],y,b=new t.Kt(_,v,i,async e=>{if(!s)return null;let n;y?n=y:(n=(await s()).default,y=n);let i=n?.[d];if(!i)return console.warn(`No descriptor found for built-in function: ${d}`),null;let a=(await f())?.[d],o=i.p,l=o?{...o}:r.CommonUtils.EmptyObject,u=Object.keys(l);if(u.length>0)for(let e=0;e<u.length;e++){let t=u[e],n=o[t],r=a?.p?.[t];l[t]={description:r?.d??n.d??``,example:r?.e??n.e,defaultValue:n.v}}return{name:d,nameLocal:t.on()?.functions?.[d]??d,summary:a?.s??i.s??``,category:a?.c??i.c??c??null,parameters:l,deprecated:i.h??!1,links:i.l??r.CommonUtils.EmptyArray}},!0);e.set(d,b)}};exports.initializeFunctions=function(e,t){u||(u=!0,l(r.DefaultLanguagePackService.getActive()),r.DefaultLanguagePackService.addChangeListener(e=>l(e)));let n=(0,i.default)(e,p);if((0,a.default)(e,p,n),t)for(let r of t)r(e,p,n);return n};
@@ -1 +1 @@
1
- exports.loadEnumManifest=async function(){let e=`@0.7.28-beta.1`;e!==`@local`&&e!==`@0.0.0`||(e=``);let t=`https://cdn.jsdelivr.net/npm/@sheetxl/sdk${e}/types/scripting-enums.json`,n=await fetch(t);if(!n.ok)throw Error(`Unable to load script enum runtime (${n.status}) from ${t}.`);return n.json()};
1
+ exports.loadEnumManifest=async function(){let e=`@0.7.28-beta.3`;e!==`@local`&&e!==`@0.0.0`||(e=``);let t=`https://cdn.jsdelivr.net/npm/@sheetxl/sdk${e}/types/scripting-enums.json`,n=await fetch(t);if(!n.ok)throw Error(`Unable to load script enum runtime (${n.status}) from ${t}.`);return n.json()};