@sheetxl/sdk 0.4.9 → 0.4.11
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/browser/cjs/1aBi7EjSv7rlHImN.cjs +7 -0
- package/browser/cjs/2U_vaFrfcRohWzeU.cjs +7 -0
- package/browser/cjs/2nOrVMTAGGx_9TGL.cjs +7 -0
- package/browser/cjs/36TOhwWf_rpUol3H.cjs +7 -0
- package/browser/cjs/5zykq8Nm9_DGD2DJ.cjs +7 -0
- package/browser/cjs/7sNFPxy75NuqCDQh.cjs +7 -0
- package/browser/cjs/B73Zu8_s9vFWOh_O.cjs +7 -0
- package/browser/cjs/BAsFktGxZpUGmZLe.cjs +7 -0
- package/browser/cjs/BEsz-1T9Bb9AaMYL.cjs +7 -0
- package/browser/cjs/B_NhkERIkAJotIbp.cjs +7 -0
- package/browser/cjs/BdTk8Nhw8G_OzMbe.cjs +7 -0
- package/browser/cjs/Bo-zjba28_CWMlTu.cjs +7 -0
- package/browser/cjs/C06jNASkAfV7kAJt.cjs +7 -0
- package/browser/cjs/C9wOzvC_v6DonctC.cjs +7 -0
- package/browser/cjs/CMCnH7IuCm_auikF.cjs +7 -0
- package/browser/cjs/CVXGzVLWLx2CJQm9.cjs +13 -0
- package/browser/cjs/CaFJIY4BbuoM7WDD.cjs +7 -0
- package/{node/esm/CT933Kus8lsY5BJ2.mjs → browser/cjs/CcEyzUYgzJ50PUJe.cjs} +2 -5
- package/browser/cjs/Ch3tbUYQx16tKF7k.cjs +7 -0
- package/browser/cjs/Cv7d06asyk54h4qg.cjs +7 -0
- package/browser/cjs/DDRgvBqROJxESdD7.cjs +7 -0
- package/browser/cjs/DHpCAbHLYqvLP0Z6.cjs +7 -0
- package/browser/cjs/DNv6ybWP5Fldgc2s.cjs +7 -0
- package/browser/cjs/Dl3IO1DS4B5jgpKI.cjs +7 -0
- package/browser/cjs/DtBxSbHruNTMTsh-.cjs +10 -0
- package/browser/cjs/EU56rWjRMrkea9af.cjs +7 -0
- package/browser/cjs/Yi2_Rw5GDVzd_VxU.cjs +7 -0
- package/browser/cjs/ZJKVquWhB5WR-iPJ.cjs +7 -0
- package/browser/cjs/ZcKbNkAX98aqbRl3.cjs +7 -0
- package/browser/cjs/index.cjs +4 -3
- package/browser/cjs/kyw6u7fpNVXpqgsI.cjs +7 -0
- package/browser/cjs/nQY-7MdNrbTu3EmK.cjs +7 -0
- package/browser/cjs/trblZTDJ1nAz0rWR.cjs +7 -0
- package/browser/cjs/uyHKBD07R0GGZXep.cjs +10 -0
- package/browser/esm/1RkwhM87R80gyTMd.mjs +7 -0
- package/browser/esm/5w39mZuW-sWnmmdV.mjs +7 -0
- package/browser/esm/A8C5de6v1CBMgJZq.mjs +7 -0
- package/browser/esm/B9JgD2n0XcFJj3bo.mjs +7 -0
- package/browser/esm/BEs22-ynP5XGO3w2.mjs +7 -0
- package/browser/esm/BHc7eG4nZizeMBb5.mjs +7 -0
- package/browser/esm/BO0ncqgpx-62w_oX.mjs +7 -0
- package/browser/esm/BQCIUvZDEabV77HK.mjs +7 -0
- package/browser/esm/BVi-ZLSVMKE-zvx4.mjs +7 -0
- package/browser/esm/BsDRByzxyMQ1n9k6.mjs +7 -0
- package/browser/esm/BuUARF4geX1QlFaV.mjs +7 -0
- package/browser/esm/Bv47rNz3qnYylQjD.mjs +7 -0
- package/browser/esm/C-CL0OoNkb1zC70z.mjs +7 -0
- package/browser/esm/CK55N2ZgYHqyYvC2.mjs +7 -0
- package/browser/esm/{leTtDbQ6871lFfJe.mjs → CM_TdYA35a4ZBdwx.mjs} +2 -7
- package/browser/esm/COIpRrbH0PIAxGAv.mjs +7 -0
- package/browser/esm/CV82qaLuZfxcBBSy.mjs +10 -0
- package/browser/esm/CW0tmrVd5h3U4RZa.mjs +7 -0
- package/browser/esm/ChEVz9V1woVRX6WL.mjs +7 -0
- package/browser/esm/CuVRE_tWXcHiZiqD.mjs +7 -0
- package/browser/esm/DCgtfzoZVReua9he.mjs +7 -0
- package/browser/esm/DS7nkzMuzXOAIPF2.mjs +7 -0
- package/browser/esm/DTfK5ukJi2A2cG4a.mjs +13 -0
- package/browser/esm/Dk8xANVVmSj4hMfy.mjs +7 -0
- package/browser/esm/DkBcYI5GMfGWjMpw.mjs +7 -0
- package/browser/esm/DoolQNF8KdKfxJym.mjs +7 -0
- package/browser/esm/Du5u3LhdTaqIps_D.mjs +7 -0
- package/browser/esm/DyvAZkeumXN8GHi4.mjs +7 -0
- package/browser/esm/PVTl6mvmxvLJIzh9.mjs +7 -0
- package/browser/esm/Y5czqevaHtgUcl4L.mjs +7 -0
- package/browser/esm/iKCrpPPbOnKlkUDb.mjs +7 -0
- package/browser/esm/index.mjs +2 -84
- package/browser/esm/lfu13YaazVLqtmeU.mjs +10 -0
- package/browser/esm/s7QvhDE2kJkgBcZ8.mjs +7 -0
- package/licenses/dependencies.txt +3 -3
- package/node/esm/3LAM4nbl-SF93GnL.mjs +80 -0
- package/{browser/esm/6U_gCZNSSMBtVpQI.mjs → node/esm/BMXFtr-jXZGBZS1-.mjs} +1 -1
- package/node/esm/{CYI5_V7h9SYP9uuu.mjs → BmYqJNOwK3UJW3Xe.mjs} +1 -1
- package/node/esm/{DxQdDzIhBW98FzK0.mjs → C9U5rfU-8XoDc_V8.mjs} +4 -4
- package/node/esm/{BMwuCJEUqdaa7U-p.mjs → CFWQqFvDJMGXn8Qq.mjs} +1 -1
- package/node/esm/{De2OxC60SZUNAEyp.mjs → CFsZ2V-cxUHf5_Sy.mjs} +1 -1
- package/node/esm/{BIsxN-sskhnDr5fG.mjs → COCgGLfPgG-NG4Ei.mjs} +1 -1
- package/node/esm/{Dfr8q3AEbG7QZ6Xr.mjs → CW0oFlrKt5Uj6nuK.mjs} +1 -1
- package/node/esm/{CswjcUAc3OQ1SAwa.mjs → CXrQQnxTwsX0wNvN.mjs} +2 -2
- package/node/esm/{-vEyF-b1iAJfL3xp.mjs → CfeR1dXEw7Hep352.mjs} +1 -1
- package/node/esm/{Cu9r1uru0-RQmPlz.mjs → Ck1Jwm7rnsCLVeO1.mjs} +1 -1
- package/node/esm/{V08nP8uFHLrde5Md.mjs → Cn1RL1hYSYnF25uZ.mjs} +1 -1
- package/{browser/esm/P_0pzZ_mRTUIQOo8.mjs → node/esm/CnhQwEj214g59Jgw.mjs} +1 -1
- package/{browser/esm/CatWZ5LT2Nm4rT4U.mjs → node/esm/Cuk6l5jbAp5qG99L.mjs} +1 -1
- package/node/esm/{DYiuMNxXQxzsyogd.mjs → D8Hpg5A5WcmsFCPu.mjs} +1 -1
- package/node/esm/{bLL4P-mQqtHnzf3p.mjs → D90o-RTQ6VATF0Rk.mjs} +1 -1
- package/{browser/esm/CT933Kus8lsY5BJ2.mjs → node/esm/DLdBwr1RlyAhJCV0.mjs} +1 -1
- package/{browser/esm/225JOcHgUUs1EIBP.mjs → node/esm/DRM7eoEZII5c6Rbr.mjs} +1 -1
- package/{browser/esm/SwZDnMDw8b9gb6VD.mjs → node/esm/DSPiPnJGbhnNKLaY.mjs} +1 -1
- package/node/esm/{LpwVK3fzNuCZJlGb.mjs → DUlT61b-CgdPCdu7.mjs} +1 -1
- package/{browser/esm/BEWDCb-GzXXALTyM.mjs → node/esm/DWlgrg4IlFnKTR6y.mjs} +1 -1
- package/node/esm/{CydkHy4FDohjJzxv.mjs → DbLo1yZBy3dKaDrf.mjs} +1 -1
- package/node/esm/{Br12zSs0kOLavLkw.mjs → DpmEPBmhU3gneOpb.mjs} +1 -1
- package/{browser/esm/_N05nCCXsyDthwPS.mjs → node/esm/JIc401vM9srbtF9d.mjs} +1 -1
- package/node/esm/{Dtn71I8yWx6At8T4.mjs → KATYAmh0NIiQ-uaD.mjs} +1 -1
- package/node/esm/{DU-md5cmoqIFoIRF.mjs → QvMgUimFvzdL6-mo.mjs} +2 -2
- package/node/esm/{DRFDJvGYzZ2y7MNr.mjs → VINTYbFQolKKX9Cn.mjs} +1 -1
- package/node/esm/index.mjs +21 -16
- package/node/esm/{DtJRjSTG45Z8JwZ-.mjs → jqWzWUQAPXE6S4pP.mjs} +1 -1
- package/node/esm/{D8eFLYgEWXBVLJzP.mjs → p6tOM2g4fibuTbKy.mjs} +1 -1
- package/node/esm/{bz-ja27axdBXn18A.mjs → sroYp2c6WrIr_3vO.mjs} +2 -2
- package/node/esm/{BRW_h-uc47yzfnF7.mjs → uUNVoKRRBhW28hYx.mjs} +1 -1
- package/package.json +4 -4
- package/browser/cjs/B-re3P7cjOaJW97v.cjs +0 -6
- package/browser/cjs/B4xf1YLqOOQ2BAAw.cjs +0 -6
- package/browser/cjs/BQX47jn1fcYJXavn.cjs +0 -6
- package/browser/cjs/BZSt5E8X7SYSVhPs.cjs +0 -6
- package/browser/cjs/B_RNceQBZ8p6fj3Q.cjs +0 -6
- package/browser/cjs/BbwQg7G0IFkXlUYY.cjs +0 -6
- package/browser/cjs/BjwfHgXl1fEZAU3g.cjs +0 -60
- package/browser/cjs/Bm5UJ5gS-Q06VEPK.cjs +0 -7
- package/browser/cjs/C3td5E8SlcrJ5Mv-.cjs +0 -15
- package/browser/cjs/CGHOtBonLRy9pyo4.cjs +0 -6
- package/browser/cjs/CS2JAHasZYfPuOEI.cjs +0 -6
- package/browser/cjs/CSkIIY8fgAYcsfJ0.cjs +0 -6
- package/browser/cjs/CTM9G6roqBNmXvvV.cjs +0 -6
- package/browser/cjs/Cje8OteEkSLIh4eg.cjs +0 -6
- package/browser/cjs/CnRawGcFEjRg8E7W.cjs +0 -6
- package/browser/cjs/Cq-KGEktCK47S1ii.cjs +0 -6
- package/browser/cjs/CqczY8H5IIx8Ki4Z.cjs +0 -6
- package/browser/cjs/DLVyZuPozs2kGRVY.cjs +0 -6
- package/browser/cjs/DQtLMWxJks5D1_ut.cjs +0 -6
- package/browser/cjs/DSeBxJODV2wiVBFh.cjs +0 -6
- package/browser/cjs/DSx2MKFyVvU32PBX.cjs +0 -6
- package/browser/cjs/DlgBYRYQwJb2Cmz0.cjs +0 -124
- package/browser/cjs/DmMxyZPbvj8EvAvA.cjs +0 -6
- package/browser/cjs/DxXvv5mYl4GyI4oU.cjs +0 -13
- package/browser/cjs/K35RWj2GxR0lKfCY.cjs +0 -32
- package/browser/cjs/L5ui83i8s4hwRnmo.cjs +0 -6
- package/browser/cjs/Ntd4n6__drNXyV8Q.cjs +0 -6
- package/browser/cjs/OpVs8OmX1WcXQ1RU.cjs +0 -6
- package/browser/cjs/WZhB_pgRZi4U_oXo.cjs +0 -6
- package/browser/cjs/eL9bgEPz6WhChraJ.cjs +0 -6
- package/browser/cjs/nRRE57j_GGf6KVD8.cjs +0 -6
- package/browser/cjs/pPmY7gcYQCH96lE4.cjs +0 -6
- package/browser/cjs/xjh_alRipVqo8cZy.cjs +0 -1501
- package/browser/esm/-vEyF-b1iAJfL3xp.mjs +0 -10
- package/browser/esm/9sdhSM-1zkdTJ6pD.mjs +0 -5651
- package/browser/esm/B5GEE2P8-Fc2ApiM.mjs +0 -426
- package/browser/esm/BMWawWgFuxMRf1cM.mjs +0 -10
- package/browser/esm/BRW_h-uc47yzfnF7.mjs +0 -10
- package/browser/esm/BhPXhyivX9t4qJ2l.mjs +0 -820
- package/browser/esm/Br12zSs0kOLavLkw.mjs +0 -10
- package/browser/esm/BsN1Iav913PM0DTb.mjs +0 -21
- package/browser/esm/C8aGSiCyYUCLobsp.mjs +0 -10
- package/browser/esm/CYI5_V7h9SYP9uuu.mjs +0 -10
- package/browser/esm/Cu1bjUPEdAVn7e23.mjs +0 -10
- package/browser/esm/CydkHy4FDohjJzxv.mjs +0 -10
- package/browser/esm/CzRlLyr7iG0quh7r.mjs +0 -472
- package/browser/esm/DStq39R2rKQKUU7b.mjs +0 -24
- package/browser/esm/DbT42LuoRjjQ7Rtu.mjs +0 -3974
- package/browser/esm/DdU01D1n6S9BZnIr.mjs +0 -10
- package/browser/esm/De2OxC60SZUNAEyp.mjs +0 -10
- package/browser/esm/DtJRjSTG45Z8JwZ-.mjs +0 -10
- package/browser/esm/DwOgeqVyZwdrw1FB.mjs +0 -24004
- package/browser/esm/HTu8yzgCTwbf9HU4.mjs +0 -29
- package/browser/esm/LpwVK3fzNuCZJlGb.mjs +0 -10
- package/browser/esm/PC3F5BEQCLQN_a3x.mjs +0 -10
- package/browser/esm/cthDTk2_8Syhe1Uh.mjs +0 -10
- package/browser/esm/eYXmF3L6pehVXEBJ.mjs +0 -1575
- package/node/esm/225JOcHgUUs1EIBP.mjs +0 -10
- package/node/esm/6U_gCZNSSMBtVpQI.mjs +0 -10
- package/node/esm/BEWDCb-GzXXALTyM.mjs +0 -10
- package/node/esm/CatWZ5LT2Nm4rT4U.mjs +0 -10
- package/node/esm/D6NZZinV6uCFvvPK.mjs +0 -80
- package/node/esm/P_0pzZ_mRTUIQOo8.mjs +0 -10
- package/node/esm/SwZDnMDw8b9gb6VD.mjs +0 -10
- package/node/esm/_N05nCCXsyDthwPS.mjs +0 -10
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.4.11
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import{$ as e}from"./B9JgD2n0XcFJj3bo.mjs";var t,n,o;(n=t||(t={})).Orientation={Column:"column",Row:"row"},n.Orientations={...n.Orientation,Both:"both"},n.Direction={Up:"up",Down:"down",Left:"left",Right:"right"},(e=>{e.Code={Parse:0,Null:1,Div0:2,Value:3,Ref:4,Name:5,Num:6,NA:7,GettingData:8,Spill:9,Connect:10,Blocked:11,Unknown:12,Field:13,Calc:14,Busy:16,Python:19,Timeout:20},e.Label={Parse:"#PARSE!",Null:"#NULL!",Div0:"#DIV/0!",Value:"#VALUE!",Ref:"#REF!",Name:"#NAME?",Num:"#NUM!",NA:"#N/A",GettingData:"#GETTING_DATA",Spill:"#SPILL!",Connect:"#CONNECT!",Blocked:"#BLOCKED!",Unknown:"#UNKNOWN!",Field:"#FIELD!",Calc:"#CALC!",Busy:"#BUSY!",Python:"#PYTHON!",Timeout:"#TIMEOUT!"};class t extends Error{constructor(e,t,n,o){super(n,o),this._label=t,this._code=e,this.details=o}static{this.code=e.Code.Unknown}get isFormulaError(){return!0}getLabel(){return this._label}getCode(){return this._code}equals(e){return!!e&&(this._code===e._code||this._code===e.code)}get[Symbol.toStringTag](){return"[FormulaError]"}toString(){return this.message||this._label}}e.Known=t;class n extends t{constructor(t,n){super(e.Code.Parse,e.Label.Parse,t,n)}static{this.code=e.Code.Parse}getDetails(){const e=this.details;return{line:e?.line??1,column:e?.column??1,offset:e?.offset??0,length:e?.length??0}}}e.Parse=n;class o extends t{constructor(t,n){super(e.Code.Null,e.Label.Null,t,n)}static{this.code=e.Code.Null}}e.Null=o;class i extends t{constructor(t,n){super(e.Code.Div0,e.Label.Div0,t,n)}static{this.code=e.Code.Div0}}e.Div0=i;class r extends t{constructor(t,n){super(e.Code.Value,e.Label.Value,t,n)}static{this.code=e.Code.Value}}e.Value=r;class a extends t{constructor(t,n){super(e.Code.Ref,e.Label.Ref,t,n)}static{this.code=e.Code.Ref}}e.Ref=a;class s extends t{constructor(t,n){super(e.Code.Name,e.Label.Name,t,n)}static{this.code=e.Code.Name}}e.Name=s;class l extends t{constructor(t,n){super(e.Code.Num,e.Label.Num,t,n)}static{this.code=e.Code.Num}}e.Num=l;class c extends t{constructor(t,n){super(e.Code.NA,e.Label.NA,t,n)}static{this.code=e.Code.NA}}e.NA=c;class d extends t{constructor(t,n){super(e.Code.GettingData,e.Label.GettingData,t,n)}static{this.code=e.Code.GettingData}}e.GettingData=d;class u extends t{constructor(t,n){super(e.Code.Spill,e.Label.Spill,t,n)}static{this.code=e.Code.Spill}}e.Spill=u;class p extends t{constructor(t,n){super(e.Code.Connect,e.Label.Connect,t,n)}static{this.code=e.Code.Connect}}e.Connect=p;class m extends t{constructor(t,n){super(e.Code.Blocked,e.Label.Blocked,t,n)}static{this.code=e.Code.Blocked}}e.Blocked=m;class y extends t{constructor(t,n){super(e.Code.Unknown,e.Label.Unknown,t,n)}static{this.code=e.Code.Unknown}}e.Unknown=y;class f extends t{constructor(t,n){super(e.Code.Field,e.Label.Field,t,n)}static{this.code=e.Code.Field}}e.Field=f;class h extends t{constructor(t,n){super(e.Code.Calc,e.Label.Calc,t,n)}static{this.code=e.Code.Calc}}e.Calc=h;class g extends t{constructor(t,n){super(e.Code.Busy,e.Label.Busy,t,n)}static{this.code=e.Code.Busy}}e.Busy=g;class w extends t{constructor(t,n){super(e.Code.Python,e.Label.Python,t,n)}static{this.code=e.Code.Python}}e.Python=w;class C extends t{constructor(t,n){super(e.Code.Timeout,e.Label.Timeout,t,n)}static{this.code=e.Code.Timeout}}e.Timeout=C})(o||(o={}));const i={};i[o.Code.Parse]=o.Parse,i[o.Code.Null]=o.Null,i[o.Code.Div0]=o.Div0,i[o.Code.Value]=o.Value,i[o.Code.Ref]=o.Ref,i[o.Code.Name]=o.Name,i[o.Code.Num]=o.Num,i[o.Code.NA]=o.NA,i[o.Code.GettingData]=o.GettingData,i[o.Code.Spill]=o.Spill,i[o.Code.Connect]=o.Connect,i[o.Code.Blocked]=o.Blocked,i[o.Code.Unknown]=o.Unknown,i[o.Code.Field]=o.Field,i[o.Code.Calc]=o.Calc,i[o.Code.Busy]=o.Busy,i[o.Code.Python]=o.Python,i[o.Code.Timeout]=o.Timeout;const r=new Map,a=new Map,s=new Map,l=new Map,c=Object.keys(i);for(let e=0;e<c.length;e++){const t=c[e],n=i[t];s.set(o.Label[t],n),l.set(o.Code[t],n);const d=new n;r.set(d.getLabel(),d),a.set(d.getCode(),d)}const d=a.get(o.Code.Unknown);var u;(u=o||(o={})).BuiltIn={Parse:new u.Parse,Null:new u.Null,Div0:new u.Div0,Value:new u.Value,Ref:new u.Ref,Name:new u.Name,Num:new u.Num,NA:new u.NA,GettingData:new u.GettingData,Spill:new u.Spill,Connect:new u.Connect,Blocked:new u.Blocked,Unknown:new u.Unknown,Field:new u.Field,Calc:new u.Calc,Busy:new u.Busy,Python:new u.Python,Timeout:new u.Timeout},u.getBuiltInByLabel=e=>r.get(e),u.newTypedError=(e,t,n)=>{let o;return o="string"==typeof e?s.get(e):l.get(e),o||(o=u.Unknown),new o(t,n)},u.getBuiltInById=e=>a.get(e)||d;let p=null,m=null;const y={compilerOptions:{target:"esnext"}};const f=async()=>"\n interface FirstTest {\n isTrue?: boolean;\n }\n",h=new Map([["IReferenceRange","r"],["IRange","l"]]),g=new Map([["IWorkbook","workbook"],["ISheet","sheet"],["ICellRanges","ranges"],["ICellRange","range"],["IFormulaContext","context"]]),w=(e,t)=>{Array.from(t.keys()).forEach(n=>{const o=t.get(n);t.set(`${e}.${n}`,o)})},C=new Map([["Scalar","*"],["FormulaError.Known","e"],["Date","Date"],["JSON","JSON"]]),x=new Map([]),b="SheetXL";w(b,h),w(b,g),w(b,x);const T=new Map([["Promise",()=>({async:!0})],["Observable",()=>({stream:!0})]]);let k=null;async function N(){if(k)return k;try{return await(await import("./Y5czqevaHtgUcl4L.mjs")).initialize()}catch(e){throw k=null,e}finally{k=null}}async function S(t){const n=t?.source??null;if(!n)return null;const o=(t.disableBundle||t.declarationsOnly)??!1,i=[f(),N()],r=await Promise.all(i),a=r[0],s=r[1];let l="",c=null;const d=[],u={allowJs:!0,declaration:!1,sourceMap:!1,inlineSourceMap:!1,inlineSources:!1,isolatedModules:!0,preserveConstEnums:!1,module:99,noResolve:!0,emitDeclarationOnly:!1,target:s.ScriptTarget.ES2020},w="script",x=`${w}.ts`,b="lib.d.ts",k="global.d.ts",S={[x]:n,[b]:"\n/**\n * Represents the completion of an asynchronous operation\n */\ninterface Promise<T> {\n /**\n * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The\n * resolved value cannot be modified from the callback.\n * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).\n * @returns A Promise for the completion of the callback.\n */\n finally(onfinally?: (() => void) | undefined | null): Promise<T>;\n}\n",[k]:a},E={getSourceFile:(e,t,n,o)=>s.createSourceFile(e,S[e],s.ScriptTarget.Latest,!0),fileExists:e=>void 0!==S[e],readFile:e=>S[e],writeFile:(e,t)=>{S[e]=t},getCurrentDirectory:()=>"./",getCanonicalFileName:e=>e,useCaseSensitiveFileNames:()=>!0,getDefaultLibFileName:e=>b,getNewLine:()=>"\n"},L=s.createProgram([x,k],u,E),D=L.getTypeChecker(),v=L.getSourceFile(x),F=L.emit();F.diagnostics.length>0&&console.warn(F.diagnostics),l=S[`${w}.js`];const K=(e,t,n,o)=>{if(e){if(e.kind===s.SyntaxKind.NumberKeyword)t.scalar="n";else if(e.kind===s.SyntaxKind.StringKeyword)t.scalar="s";else if(e.kind===s.SyntaxKind.BooleanKeyword)t.scalar="b";else if(e.kind===s.SyntaxKind.UndefinedKeyword||e.kind===s.SyntaxKind.NullKeyword||e.kind===s.SyntaxKind.VoidKeyword){if(o)return void $(e,new Error(`'undefined' is not a valid type for input: '${e?.parent?.name?.escapedText}'.`));t.scalar="z"}else if(e.kind===s.SyntaxKind.BigIntKeyword)t.scalar="n";else if(e.kind===s.SyntaxKind.AnyKeyword)t.scalar="z";else if(e.kind===s.SyntaxKind.ArrayType){const i=e.elementType;if(!i)return void $(e,new Error(`'Array' must be typed: '${e?.parent?.name?.escapedText}'.`));t.arrayDepth=(t.arrayDepth??0)+1,K(i,t,n,o)}else if(e.kind!==s.SyntaxKind.TupleType&&e.kind===s.SyntaxKind.TypeReference){const i=e.typeName?.getText?.()??null,r=h.get(i);let a=!1;r&&(t.range=r,a=!0);const s=C.get(i);if(s&&(t.scalar=s),void 0!==s&&(a=!0),o){const e=g.get(i);if(e)return e}else{const n=T.get(i);if(n){const o={...t,...n()};let r=0;if(o.async&&r++,o.stream&&r++,r>1)return void $(e,new Error(`'${i}' cannot have multiple modifiers: '${e?.parent?.name?.escapedText}'.`));t=o,a=!0}}if(!a)return void $("node",new Error(`'${i}' is not a valid type: '${e?.parent?.name?.escapedText}'.`));const l=e.typeArguments;if(l){if(1!==l.length)return void $(e,new Error(`'${i}' must be typed with exactly 1 type: '${e?.parent?.name?.escapedText}'.`));K(l[0],t,n,o)}}}else $(e,new Error(`Type is not defined for '${t?.name??"return"}'.`))},P=[],$=(e,t)=>{P.push(t)};if(s.forEachChild(v,e=>{if(n=e,0!==(s.getCombinedModifierFlags(n)&s.ModifierFlags.Export)&&s.isFunctionDeclaration(e)){const n={},o={parameters:{}},i=e?.name?.getText();try{n.name=i;const r=D.getSymbolAtLocation(e.name).getDocumentationComment(D);if(r&&r.length>0&&r[0].text){let e=r[0].text;e=e.replace(/[\r\n]+/g,"\\n").trim(),o.summary=e}const a={};K(e.type,a,n,!1),n.returnType=a;const l={};t=e,0!==(s.getCombinedModifierFlags(t)&s.ModifierFlags.Default)&&(l.default=!0,c=i),Object.keys(l).length>0&&(n.behavior=l),n.parameters=[];const u=new Map;for(let t=0;t<e.parameters.length;t++){const i=e.parameters[t],r={};r.name=i.name?.getText();const a=K(i.type,r,n,!0);if(a){if(0!==n.parameters.length){const t=e?.parent,o=t?.name?.getText();return void $(e,new Error(`'${n.name}' contexts must be the first parameter: '${o}'.`))}n.context=a;continue}let l;if((void 0!==i.initializer&&null!==i.initializer||void 0!==i.questionToken&&null!==i.questionToken)&&(r.optional=!0,i.initializer))try{l=i.initializer.kind===s.SyntaxKind.StringLiteral?i.initializer.text:i.initializer.kind===s.SyntaxKind.NumericLiteral?parseFloat(i.initializer.text):i.initializer.kind===s.SyntaxKind.TrueKeyword||i.initializer.kind===s.SyntaxKind.FalseKeyword?i.initializer.kind===s.SyntaxKind.TrueKeyword:i.initializer.kind===s.SyntaxKind.NullKeyword?null:i.initializer.kind===s.SyntaxKind.ObjectLiteralExpression||i.initializer.kind===s.SyntaxKind.ArrayLiteralExpression?i.initializer.getText():i.initializer.getText?.()}catch(e){console.warn(`Couldn't extract default value for parameter '${r.name}'`,e)}i.dotDotDotToken&&(r.rest=!0),n.parameters.push(r);const c={description:""};o.parameters[r.name]=c;const d=D.getSymbolAtLocation(i.name).getDocumentationComment(D);d&&d.length>0&&d[0].text&&(c.description=d[0].text),void 0!==l&&(c.defaultValue=l),u.set(r.name,r)}if(e.jsDoc&&e.jsDoc.length>0){const t=e.jsDoc;for(let e=0;e<t.length;e++){const r=t[e]?.tags;if(r)for(let e=0;e<r.length;e++){const t=r[e];let a=t?.tagName?.text;if(!a)continue;a=a.toLowerCase();let l=t.comment;const c="hidden"===a;if(("string"==typeof l||c)&&("string"==typeof l&&(l=l.replace(/[\r\n]+/g,"\\n").trim()),c||!l||(l=l.split(/\\n/)[0],l&&0!==l.length))){if(l&&"string"==typeof l){const e=/\{@link(code|plain)?\s+([^}|]+)(?:\s*\|\s*([^}]+))?\}/g;let t,n=l,i=[];for(;null!==(t=e.exec(l));){const[e,n,o,i]=t,r=[o.trim()];i&&r.push(i.trim())}l=n,i.length>0&&"see"===a&&(o.links||(o.links=[]),o.links.push(...i))}if("name"===a){const e=l;e!==i&&(o.name=e)}else if("description"!==a)if("summary"===a){const e=l;e&&(o.summary=e)}else if("param"===a){const e=t.name?.text,n=u.get(e);if(!n){P.push(new Error(`Parameter '${e}' not found in function '${i}'.`));continue}if(t.typeExpression&&t.typeExpression.type)try{const e=t.typeExpression.type;if(e.kind===s.SyntaxKind.UnionType){const t=[];n.enums=t,e.types.forEach(e=>{if(e.kind===s.SyntaxKind.LiteralType){const n=e.literal.text;n&&t.push(n)}})}}catch(e){console.warn("Error parsing JSDoc type expression:",e)}}else if("returns"===a||"return"===a)n.returnType.description=l;else if("category"===a)o.category=l;else if("hidden"===a){let e=!0;const t=l?.toLowerCase();"false"===t?e=!1:"true"!==t&&(e=l),!1!==e&&(o.hidden=e??!0)}}}}}0===Object.keys(n.returnType).length&&delete n.returnType,d.push([n,o])}catch(t){$(e,new Error(`'${i}': ${t.message}`))}}var t,n}),P.length>0)throw console.warn(P),new Error("There were compilation errors.",{cause:P});if(0===d.length)throw new Error("No exported functions.");const B=`${e.uuidV4()}-script`;try{o||0!==P.length||(l=await async function(e,t,n="/script.js",o="__SHEETXL"){try{const e=await async function(){if(p)return p;if(m){if(await m,!p)throw new Error("ESBuild initialization promise resolved, but instance is not available.");return p}let e,t;m=new Promise((n,o)=>{e=n,t=o});try{const{initialize:t}=await import("./lfu13YaazVLqtmeU.mjs");return p=await t(),e(),p}catch(e){throw console.error("Failed to import or initialize esbuild:",e),m=null,t(e),e}}(),i="@sheetxl/primitives",r=`\n export const FormulaContext = globalThis.${o}?.FormulaContext;\n export const ScalarType = globalThis.${o}?.ScalarType;\n export const Observable = globalThis.${o}?.Observable;\n export const IRange = globalThis.${o}?.IRange;\n export const FormulaError = globalThis.${o}?.FormulaError;\n // Add more exports as needed\n `,a={name:"sheetxl-esbuild-in-memory",setup(e){const o="sheetxl-"+(new Date).getTime();e.onResolve({filter:new RegExp(`^(${n.replace("/","\\/")}|${i})$`)},e=>({path:e.path,namespace:o})),e.onResolve({filter:/.*/},e=>{if(e.namespace!==o)return console.warn(`esbuild: Treating import "${e.path}" as external.`),{path:e.path,external:!0}}),e.onLoad({filter:/.*/,namespace:o},e=>{let a;if(e.path===n)a=t;else{if(e.path!==i)return{errors:[{text:`Cannot load unknown path in ${o}: ${e.path}`}]};a=r}return{contents:a,loader:"ts"}})}},s=await e.build({entryPoints:[n],bundle:!0,write:!1,format:"esm",plugins:[a],sourcemap:"inline",tsconfigRaw:y,minify:!0,platform:"neutral"});if(s.outputFiles&&s.outputFiles.length>0)return s.outputFiles[0].text;throw s.errors&&s.errors.length>0?new Error(`esbuild bundling failed: ${s.errors.map(e=>e.text).join("\n")}`):new Error("esbuild did not produce an output file.")}catch(e){throw console.error("esbuild bundling process failed:",e),e}}(0,l,w))}catch{console.warn("Error bundling script")}const R={functions:d,commitId:B,source:n,name:"Script",language:"typescript",compiled:l};return c&&(R.autoRun=c),R}export{S as compileModule};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.4.11
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import{n as e,j as t,c as n,e as r,t as i,g as o,a as s,b as a,d as c,f as u,h as l,r as h,m as f,i as d}from"./CV82qaLuZfxcBBSy.mjs";var p="object"==typeof global&&global&&global.Object===Object&&global,m="object"==typeof self&&self&&self.Object===Object&&self,E=p||m||Function("return this")(),g=E.Symbol,T=Object.prototype,A=T.hasOwnProperty,I=T.toString,v=g?g.toStringTag:void 0;var N=Object.prototype.toString;var y=g?g.toStringTag:void 0;function R(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":y&&y in Object(e)?function(e){var t=A.call(e,v),n=e[v];try{e[v]=void 0;var r=!0}catch(e){}var i=I.call(e);return r&&(t?e[v]=n:delete e[v]),i}(e):function(e){return N.call(e)}(e)}function O(e){return null!=e&&"object"==typeof e}function S(e){return"symbol"==typeof e||O(e)&&"[object Symbol]"==R(e)}function _(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var L=Array.isArray,x=g?g.prototype:void 0,C=x?x.toString:void 0;function k(e){if("string"==typeof e)return e;if(L(e))return _(e,k)+"";if(S(e))return C?C.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}var b=/\s/;var P=/^\s+/;function w(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&b.test(e.charAt(t)););return t}(e)+1).replace(P,""):e}function M(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var U=/^[-+]0x[0-9a-f]+$/i,F=/^0b[01]+$/i,D=/^0o[0-7]+$/i,j=parseInt;var B=1/0;function $(e){return e?(e=function(e){if("number"==typeof e)return e;if(S(e))return NaN;if(M(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=M(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=w(e);var n=F.test(e);return n||D.test(e)?j(e.slice(2),n?2:8):U.test(e)?NaN:+e}(e))===B||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function W(e){var t=$(e),n=t%1;return t==t?n?t-n:t:0}function G(e){return e}function K(e){if(!M(e))return!1;var t=R(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var z,V=E["__core-js_shared__"],H=(z=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||""))?"Symbol(src)_1."+z:"";var Y=Function.prototype.toString;function X(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var q=/^\[object .+?Constructor\]$/,Z=Function.prototype,Q=Object.prototype,J=Z.toString,ee=Q.hasOwnProperty,te=RegExp("^"+J.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ne(e){return!(!M(e)||(t=e,H&&H in t))&&(K(e)?te:q).test(X(e));var t}function re(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ne(n)?n:void 0}var ie=re(E,"WeakMap"),oe=Object.create,se=function(){function e(){}return function(t){if(!M(t))return{};if(oe)return oe(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function ae(){}var ce=Date.now;var ue,le,he,fe=function(){try{var e=re(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),de=fe?function(e,t){return fe(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:G,pe=(ue=de,le=0,he=0,function(){var e=ce(),t=16-(e-he);if(he=e,t>0){if(++le>=800)return arguments[0]}else le=0;return ue.apply(void 0,arguments)});function me(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Ee(e,t,n,r){for(var i=e.length,o=n+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function ge(e){return e!=e}function Te(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Ee(e,ge,n)}function Ae(e,t){return!!(null==e?0:e.length)&&Te(e,t,0)>-1}var Ie=/^(?:0|[1-9]\d*)$/;function ve(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ie.test(e))&&e>-1&&e%1==0&&e<t}function Ne(e,t,n){"__proto__"==t&&fe?fe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ye(e,t){return e===t||e!=e&&t!=t}var Re=Object.prototype.hasOwnProperty;function Oe(e,t,n){var r=e[t];Re.call(e,t)&&ye(r,n)&&(void 0!==n||t in e)||Ne(e,t,n)}function Se(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],c=void 0;void 0===c&&(c=e[a]),i?Ne(n,a,c):Oe(n,a,c)}return n}var _e=Math.max;function Le(e,t){return pe(function(e,t,n){return t=_e(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=_e(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,t,G),e+"")}function xe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ce(e){return null!=e&&xe(e.length)&&!K(e)}function ke(e,t,n){if(!M(n))return!1;var r=typeof t;return!!("number"==r?Ce(n)&&ve(t,n.length):"string"==r&&t in n)&&ye(n[t],e)}var be=Object.prototype;function Pe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||be)}function we(e){return O(e)&&"[object Arguments]"==R(e)}var Me=Object.prototype,Ue=Me.hasOwnProperty,Fe=Me.propertyIsEnumerable,De=we(function(){return arguments}())?we:function(e){return O(e)&&Ue.call(e,"callee")&&!Fe.call(e,"callee")};var je="object"==typeof exports&&exports&&!exports.nodeType&&exports,Be=je&&"object"==typeof module&&module&&!module.nodeType&&module,$e=Be&&Be.exports===je?E.Buffer:void 0,We=($e?$e.isBuffer:void 0)||function(){return!1},Ge={};function Ke(e){return function(t){return e(t)}}Ge["[object Float32Array]"]=Ge["[object Float64Array]"]=Ge["[object Int8Array]"]=Ge["[object Int16Array]"]=Ge["[object Int32Array]"]=Ge["[object Uint8Array]"]=Ge["[object Uint8ClampedArray]"]=Ge["[object Uint16Array]"]=Ge["[object Uint32Array]"]=!0,Ge["[object Arguments]"]=Ge["[object Array]"]=Ge["[object ArrayBuffer]"]=Ge["[object Boolean]"]=Ge["[object DataView]"]=Ge["[object Date]"]=Ge["[object Error]"]=Ge["[object Function]"]=Ge["[object Map]"]=Ge["[object Number]"]=Ge["[object Object]"]=Ge["[object RegExp]"]=Ge["[object Set]"]=Ge["[object String]"]=Ge["[object WeakMap]"]=!1;var ze="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ve=ze&&"object"==typeof module&&module&&!module.nodeType&&module,He=Ve&&Ve.exports===ze&&p.process,Ye=function(){try{var e=Ve&&Ve.require&&Ve.require("util").types;return e||He&&He.binding&&He.binding("util")}catch(e){}}(),Xe=Ye&&Ye.isTypedArray,qe=Xe?Ke(Xe):function(e){return O(e)&&xe(e.length)&&!!Ge[R(e)]},Ze=Object.prototype.hasOwnProperty;function Qe(e,t){var n=L(e),r=!n&&De(e),i=!n&&!r&&We(e),o=!n&&!r&&!i&&qe(e),s=n||r||i||o,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var u in e)!t&&!Ze.call(e,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ve(u,c))||a.push(u);return a}function Je(e,t){return function(n){return e(t(n))}}var et=Je(Object.keys,Object),tt=Object.prototype.hasOwnProperty;function nt(e){if(!Pe(e))return et(e);var t=[];for(var n in Object(e))tt.call(e,n)&&"constructor"!=n&&t.push(n);return t}function rt(e){return Ce(e)?Qe(e):nt(e)}var it,ot=Object.prototype.hasOwnProperty,st=(it=function(e,t){if(Pe(t)||Ce(t))Se(t,rt(t),e);else for(var n in t)ot.call(t,n)&&Oe(e,n,t[n])},Le(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=it.length>3&&"function"==typeof i?(r--,i):void 0,o&&ke(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var s=t[n];s&&it(e,s,n,i)}return e}));var at=Object.prototype.hasOwnProperty;function ct(e){if(!M(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Pe(e),n=[];for(var r in e)("constructor"!=r||!t&&at.call(e,r))&&n.push(r);return n}function ut(e){return Ce(e)?Qe(e,!0):ct(e)}var lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ht=/^\w*$/;function ft(e,t){if(L(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!S(e))||(ht.test(e)||!lt.test(e)||null!=t&&e in Object(t))}var dt=re(Object,"create");var pt=Object.prototype.hasOwnProperty;var mt=Object.prototype.hasOwnProperty;function Et(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function gt(e,t){for(var n=e.length;n--;)if(ye(e[n][0],t))return n;return-1}Et.prototype.clear=function(){this.__data__=dt?dt(null):{},this.size=0},Et.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Et.prototype.get=function(e){var t=this.__data__;if(dt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return pt.call(t,e)?t[e]:void 0},Et.prototype.has=function(e){var t=this.__data__;return dt?void 0!==t[e]:mt.call(t,e)},Et.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=dt&&void 0===t?"__lodash_hash_undefined__":t,this};var Tt=Array.prototype.splice;function At(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}At.prototype.clear=function(){this.__data__=[],this.size=0},At.prototype.delete=function(e){var t=this.__data__,n=gt(t,e);return!(n<0)&&(n==t.length-1?t.pop():Tt.call(t,n,1),--this.size,!0)},At.prototype.get=function(e){var t=this.__data__,n=gt(t,e);return n<0?void 0:t[n][1]},At.prototype.has=function(e){return gt(this.__data__,e)>-1},At.prototype.set=function(e,t){var n=this.__data__,r=gt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var It=re(E,"Map");function vt(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Nt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Nt.prototype.clear=function(){this.size=0,this.__data__={hash:new Et,map:new(It||At),string:new Et}},Nt.prototype.delete=function(e){var t=vt(this,e).delete(e);return this.size-=t?1:0,t},Nt.prototype.get=function(e){return vt(this,e).get(e)},Nt.prototype.has=function(e){return vt(this,e).has(e)},Nt.prototype.set=function(e,t){var n=vt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function yt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(yt.Cache||Nt),n}yt.Cache=Nt;var Rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ot=/\\(\\)?/g,St=function(e){var t=yt(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Rt,function(e,n,r,i){t.push(r?i.replace(Ot,"$1"):n||e)}),t});function _t(e,t){return L(e)?e:ft(e,t)?[e]:St(function(e){return null==e?"":k(e)}(e))}function Lt(e){if("string"==typeof e||S(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function xt(e,t){for(var n=0,r=(t=_t(t,e)).length;null!=e&&n<r;)e=e[Lt(t[n++])];return n&&n==r?e:void 0}function Ct(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var kt=g?g.isConcatSpreadable:void 0;function bt(e){return L(e)||De(e)||!!(kt&&e&&e[kt])}function Pt(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=bt),i||(i=[]);++o<s;){var a=e[o];n(a)?Ct(i,a):r||(i[i.length]=a)}return i}function wt(e){return(null==e?0:e.length)?Pt(e):[]}var Mt=Je(Object.getPrototypeOf,Object);function Ut(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}function Ft(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function Dt(e){var t=this.__data__=new At(e);this.size=t.size}Dt.prototype.clear=function(){this.__data__=new At,this.size=0},Dt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Dt.prototype.get=function(e){return this.__data__.get(e)},Dt.prototype.has=function(e){return this.__data__.has(e)},Dt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof At){var r=n.__data__;if(!It||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Nt(r)}return n.set(e,t),this.size=n.size,this};var jt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Bt=jt&&"object"==typeof module&&module&&!module.nodeType&&module,$t=Bt&&Bt.exports===jt?E.Buffer:void 0,Wt=$t?$t.allocUnsafe:void 0;function Gt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function Kt(){return[]}var zt=Object.prototype.propertyIsEnumerable,Vt=Object.getOwnPropertySymbols,Ht=Vt?function(e){return null==e?[]:(e=Object(e),Gt(Vt(e),function(t){return zt.call(e,t)}))}:Kt;var Yt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ct(t,Ht(e)),e=Mt(e);return t}:Kt;function Xt(e,t,n){var r=t(e);return L(e)?r:Ct(r,n(e))}function qt(e){return Xt(e,rt,Ht)}var Zt=re(E,"DataView"),Qt=re(E,"Promise"),Jt=re(E,"Set"),en="[object Map]",tn="[object Promise]",nn="[object Set]",rn="[object WeakMap]",on="[object DataView]",sn=X(Zt),an=X(It),cn=X(Qt),un=X(Jt),ln=X(ie),hn=R;(Zt&&hn(new Zt(new ArrayBuffer(1)))!=on||It&&hn(new It)!=en||Qt&&hn(Qt.resolve())!=tn||Jt&&hn(new Jt)!=nn||ie&&hn(new ie)!=rn)&&(hn=function(e){var t=R(e),n="[object Object]"==t?e.constructor:void 0,r=n?X(n):"";if(r)switch(r){case sn:return on;case an:return en;case cn:return tn;case un:return nn;case ln:return rn}return t});var fn=Object.prototype.hasOwnProperty;var dn=E.Uint8Array;var pn=/\w*$/;var mn=g?g.prototype:void 0,En=mn?mn.valueOf:void 0;function gn(e,t,n){var r,i,o,s,a,c=e.constructor;switch(t){case"[object ArrayBuffer]":return a=new(s=e).constructor(s.byteLength),new dn(a).set(new dn(s)),a;case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return o=(i=e).buffer,new i.constructor(o,i.byteOffset,i.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e){var t=e.buffer;return new e.constructor(t,e.byteOffset,e.length)}(e);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return function(e){var t=new e.constructor(e.source,pn.exec(e));return t.lastIndex=e.lastIndex,t}(e);case"[object Symbol]":return r=e,En?Object(En.call(r)):{}}}var Tn=Ye&&Ye.isMap,An=Tn?Ke(Tn):function(e){return O(e)&&"[object Map]"==hn(e)};var In=Ye&&Ye.isSet,vn=In?Ke(In):function(e){return O(e)&&"[object Set]"==hn(e)},Nn="[object Arguments]",yn="[object Function]",Rn="[object Object]",On={};function Sn(e,t,n,r,i,o){var s;if(void 0!==s)return s;if(!M(e))return e;var a=L(e);if(a)return s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&fn.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(e,s);var c=hn(e),u=c==yn||"[object GeneratorFunction]"==c;if(We(e))return function(e){var t=e.length,n=Wt?Wt(t):new e.constructor(t);return e.copy(n),n}(e);if(c==Rn||c==Nn||u&&!i)return s=u?{}:function(e){return"function"!=typeof e.constructor||Pe(e)?{}:se(Mt(e))}(e),function(e,t){return Se(e,Ht(e),t)}(e,function(e,t){return e&&Se(t,rt(t),e)}(s,e));if(!On[c])return i?e:{};s=gn(e,c),o||(o=new Dt);var l=o.get(e);if(l)return l;o.set(e,s),vn(e)?e.forEach(function(r){s.add(Sn(r,t,n,r,e,o))}):An(e)&&e.forEach(function(r,i){s.set(i,Sn(r,t,n,i,e,o))});var h=a?void 0:qt(e);return me(h||e,function(r,i){h&&(r=e[i=r]),Oe(s,i,Sn(r,t,n,i,e,o))}),s}On[Nn]=On["[object Array]"]=On["[object ArrayBuffer]"]=On["[object DataView]"]=On["[object Boolean]"]=On["[object Date]"]=On["[object Float32Array]"]=On["[object Float64Array]"]=On["[object Int8Array]"]=On["[object Int16Array]"]=On["[object Int32Array]"]=On["[object Map]"]=On["[object Number]"]=On[Rn]=On["[object RegExp]"]=On["[object Set]"]=On["[object String]"]=On["[object Symbol]"]=On["[object Uint8Array]"]=On["[object Uint8ClampedArray]"]=On["[object Uint16Array]"]=On["[object Uint32Array]"]=!0,On["[object Error]"]=On[yn]=On["[object WeakMap]"]=!1;function _n(e){return Sn(e,4)}function Ln(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i}function xn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Nt;++t<n;)this.add(e[t])}function Cn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function kn(e,t){return e.has(t)}xn.prototype.add=xn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},xn.prototype.has=function(e){return this.__data__.has(e)};function bn(e,t,n,r,i,o){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(e),l=o.get(t);if(u&&l)return u==t&&l==e;var h=-1,f=!0,d=2&n?new xn:void 0;for(o.set(e,t),o.set(t,e);++h<a;){var p=e[h],m=t[h];if(r)var E=s?r(m,p,h,t,e,o):r(p,m,h,e,t,o);if(void 0!==E){if(E)continue;f=!1;break}if(d){if(!Cn(t,function(e,t){if(!kn(d,t)&&(p===e||i(p,e,n,r,o)))return d.push(t)})){f=!1;break}}else if(p!==m&&!i(p,m,n,r,o)){f=!1;break}}return o.delete(e),o.delete(t),f}function Pn(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function wn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Mn=g?g.prototype:void 0,Un=Mn?Mn.valueOf:void 0;var Fn=Object.prototype.hasOwnProperty;var Dn="[object Arguments]",jn="[object Array]",Bn="[object Object]",$n=Object.prototype.hasOwnProperty;function Wn(e,t,n,r,i,o){var s=L(e),a=L(t),c=s?jn:hn(e),u=a?jn:hn(t),l=(c=c==Dn?Bn:c)==Bn,h=(u=u==Dn?Bn:u)==Bn,f=c==u;if(f&&We(e)){if(!We(t))return!1;s=!0,l=!1}if(f&&!l)return o||(o=new Dt),s||qe(e)?bn(e,t,n,r,i,o):function(e,t,n,r,i,o,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new dn(e),new dn(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ye(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Pn;case"[object Set]":var c=1&r;if(a||(a=wn),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;r|=2,s.set(e,t);var l=bn(a(e),a(t),r,i,o,s);return s.delete(e),l;case"[object Symbol]":if(Un)return Un.call(e)==Un.call(t)}return!1}(e,t,c,n,r,i,o);if(!(1&n)){var d=l&&$n.call(e,"__wrapped__"),p=h&&$n.call(t,"__wrapped__");if(d||p){var m=d?e.value():e,E=p?t.value():t;return o||(o=new Dt),i(m,E,n,r,o)}}return!!f&&(o||(o=new Dt),function(e,t,n,r,i,o){var s=1&n,a=qt(e),c=a.length;if(c!=qt(t).length&&!s)return!1;for(var u=c;u--;){var l=a[u];if(!(s?l in t:Fn.call(t,l)))return!1}var h=o.get(e),f=o.get(t);if(h&&f)return h==t&&f==e;var d=!0;o.set(e,t),o.set(t,e);for(var p=s;++u<c;){var m=e[l=a[u]],E=t[l];if(r)var g=s?r(E,m,l,t,e,o):r(m,E,l,e,t,o);if(!(void 0===g?m===E||i(m,E,n,r,o):g)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var T=e.constructor,A=t.constructor;T==A||!("constructor"in e)||!("constructor"in t)||"function"==typeof T&&T instanceof T&&"function"==typeof A&&A instanceof A||(d=!1)}return o.delete(e),o.delete(t),d}(e,t,n,r,i,o))}function Gn(e,t,n,r,i){return e===t||(null==e||null==t||!O(e)&&!O(t)?e!=e&&t!=t:Wn(e,t,n,r,Gn,i))}function Kn(e){return e==e&&!M(e)}function zn(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Vn(e){var t=function(e){for(var t=rt(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Kn(i)]}return t}(e);return 1==t.length&&t[0][2]?zn(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,r){var i=n.length,o=i;if(null==e)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){var a=(s=n[i])[0],c=e[a],u=s[1];if(s[2]){if(void 0===c&&!(a in e))return!1}else if(!Gn(u,c,3,r,new Dt))return!1}return!0}(n,0,t)}}function Hn(e,t){return null!=e&&t in Object(e)}function Yn(e,t,n){for(var r=-1,i=(t=_t(t,e)).length,o=!1;++r<i;){var s=Lt(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&xe(i)&&ve(s,i)&&(L(e)||De(e))}function Xn(e,t){return ft(e)&&Kn(t)?zn(Lt(e),t):function(n){var r=function(e,t,n){var r=null==e?void 0:xt(e,t);return void 0===r?n:r}(n,e);return void 0===r&&r===t?function(e,t){return null!=e&&Yn(e,t,Hn)}(n,e):Gn(t,r,3)}}function qn(e){return ft(e)?(t=Lt(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return xt(t,e)}}(e);var t}function Zn(e){return"function"==typeof e?e:null==e?G:"object"==typeof e?L(e)?Xn(e[0],e[1]):Vn(e):qn(e)}function Qn(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r}var Jn=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var a=o[++r];if(!1===t(i[a],a,i))break}return e};var er,tr=(er=function(e,t){return e&&Jn(e,t,rt)},function(e,t){if(null==e)return e;if(!Ce(e))return er(e,t);for(var n=e.length,r=-1,i=Object(e);++r<n&&!1!==t(i[r],r,i););return e});function nr(e,t,n,r){return tr(e,function(e,i,o){t(r,e,n(e),o)}),r}var rr=Object.prototype,ir=rr.hasOwnProperty,or=Le(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&ke(t[0],t[1],i)&&(r=1);++n<r;)for(var o=t[n],s=ut(o),a=-1,c=s.length;++a<c;){var u=s[a],l=e[u];(void 0===l||ye(l,rr[u])&&!ir.call(e,u))&&(e[u]=o[u])}return e});function sr(e){return O(e)&&Ce(e)}var ar=Le(function(e,t){return sr(e)?function(e,t,n,r){var i=-1,o=Ae,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;t.length>=200&&(o=kn,s=!1,t=new xn(t));e:for(;++i<a;){var l=e[i],h=l;if(l=0!==l?l:0,s&&h==h){for(var f=u;f--;)if(t[f]===h)continue e;c.push(l)}else o(t,h,r)||c.push(l)}return c}(e,Pt(t,0,sr,!0)):[]});function cr(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}function ur(e,t,n){var r=null==e?0:e.length;return r?Ut(e,(t=void 0===t?1:W(t))<0?0:t,r):[]}function lr(e,t,n){var r=null==e?0:e.length;return r?Ut(e,0,(t=r-(t=void 0===t?1:W(t)))<0?0:t):[]}function hr(e,t){var n;return(L(e)?me:tr)(e,"function"==typeof(n=t)?n:G)}function fr(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function dr(e,t){var n=!0;return tr(e,function(e,r,i){return n=!!t(e,r,i)}),n}function pr(e,t,n){return(L(e)?fr:dr)(e,Zn(t))}function mr(e,t){var n=[];return tr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function Er(e,t){return(L(e)?Gt:mr)(e,Zn(t))}var gr=Math.max;var Tr,Ar=(Tr=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:W(n);return i<0&&(i=gr(r+i,0)),Ee(e,Zn(t),i)},function(e,t,n){var r=Object(e);if(!Ce(e)){var i=Zn(t);e=rt(e),t=function(e){return i(r[e],e,r)}}var o=Tr(e,t,n);return o>-1?r[i?e[o]:o]:void 0});function Ir(e){return e&&e.length?e[0]:void 0}function vr(e,t){var n=-1,r=Ce(e)?Array(e.length):[];return tr(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function Nr(e,t){return(L(e)?_:vr)(e,Zn(t))}function yr(e,t){return Pt(Nr(e,t))}var Rr,Or,Sr=Object.prototype.hasOwnProperty,_r=(Rr=function(e,t,n){Sr.call(e,n)?e[n].push(t):Ne(e,n,[t])},function(e,t){var n=L(e)?Qn:nr,r=Or?Or():{};return n(e,Rr,Zn(t),r)}),Lr=Object.prototype.hasOwnProperty;function xr(e,t){return null!=e&&Lr.call(e,t)}function Cr(e,t){return null!=e&&Yn(e,t,xr)}function kr(e){return"string"==typeof e||!L(e)&&O(e)&&"[object String]"==R(e)}function br(e){return null==e?[]:function(e,t){return _(t,function(t){return e[t]})}(e,rt(e))}var Pr=Math.max;function wr(e,t,n,r){e=Ce(e)?e:br(e),n=n?W(n):0;var i=e.length;return n<0&&(n=Pr(i+n,0)),kr(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Te(e,t,n)>-1}function Mr(e,t,n){if(!(null==e?0:e.length))return-1;return Te(e,t,0)}var Ur=Object.prototype.hasOwnProperty;function Fr(e){if(null==e)return!0;if(Ce(e)&&(L(e)||"string"==typeof e||"function"==typeof e.splice||We(e)||qe(e)||De(e)))return!e.length;var t=hn(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Pe(e))return!nt(e).length;for(var n in e)if(Ur.call(e,n))return!1;return!0}var Dr=Ye&&Ye.isRegExp,jr=Dr?Ke(Dr):function(e){return O(e)&&"[object RegExp]"==R(e)};function Br(e){return void 0===e}function $r(e,t,n,r){if(!M(e))return e;for(var i=-1,o=(t=_t(t,e)).length,s=o-1,a=e;null!=a&&++i<o;){var c=Lt(t[i]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=s){var l=a[c];void 0===(u=void 0)&&(u=M(l)?l:ve(t[i+1])?[]:{})}Oe(a,c,u),a=a[c]}return e}function Wr(e,t){if(null==e)return{};var n=_(function(e){return Xt(e,ut,Yt)}(e),function(e){return[e]});return t=Zn(t),function(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=xt(e,s);n(a,s)&&$r(o,_t(s,e),a)}return o}(e,n,function(e,n){return t(e,n[0])})}function Gr(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function Kr(e,t,n){var r=L(e)?Ft:Gr,i=arguments.length<3;return r(e,Zn(t),n,i,tr)}function zr(e,t){return(L(e)?Gt:mr)(e,function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}(Zn(t)))}function Vr(e,t){var n;return tr(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function Hr(e,t,n){return(L(e)?Cn:Vr)(e,Zn(t))}var Yr=Jt&&1/wn(new Jt([,-0]))[1]==1/0?function(e){return new Jt(e)}:ae;function Xr(e){return e&&e.length?function(e,t,n){var r=-1,i=Ae,o=e.length,s=!0,a=[],c=a;if(o>=200){var u=Yr(e);if(u)return wn(u);s=!1,i=kn,c=new xn}else c=a;e:for(;++r<o;){var l=e[r],h=l;if(l=0!==l?l:0,s&&h==h){for(var f=c.length;f--;)if(c[f]===h)continue e;a.push(l)}else i(c,h,n)||(c!==a&&c.push(h),a.push(l))}return a}(e):[]}function qr(e){console&&console.error&&console.error(`Error: ${e}`)}function Zr(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function Qr(e){const t=(new Date).getTime(),n=e();return{time:(new Date).getTime()-t,value:n}}function Jr(e){function t(){}t.prototype=e;const n=new t;function r(){return typeof n.bar}return r(),r(),e}function ei(e){return kr((t=e).LABEL)&&""!==t.LABEL?e.LABEL:e.name;var t}class ti{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),hr(this.definition,t=>{t.accept(e)})}}class ni extends ti{constructor(e){super([]),this.idx=1,st(this,Wr(e,e=>void 0!==e))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class ri extends ti{constructor(e){super(e.definition),this.orgText="",st(this,Wr(e,e=>void 0!==e))}}class ii extends ti{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,st(this,Wr(e,e=>void 0!==e))}}class oi extends ti{constructor(e){super(e.definition),this.idx=1,st(this,Wr(e,e=>void 0!==e))}}class si extends ti{constructor(e){super(e.definition),this.idx=1,st(this,Wr(e,e=>void 0!==e))}}class ai extends ti{constructor(e){super(e.definition),this.idx=1,st(this,Wr(e,e=>void 0!==e))}}class ci extends ti{constructor(e){super(e.definition),this.idx=1,st(this,Wr(e,e=>void 0!==e))}}class ui extends ti{constructor(e){super(e.definition),this.idx=1,st(this,Wr(e,e=>void 0!==e))}}class li extends ti{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,st(this,Wr(e,e=>void 0!==e))}}class hi{constructor(e){this.idx=1,st(this,Wr(e,e=>void 0!==e))}accept(e){e.visit(this)}}function fi(e){function t(e){return Nr(e,fi)}if(e instanceof ni){const t={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return kr(e.label)&&(t.label=e.label),t}if(e instanceof ii)return{type:"Alternative",definition:t(e.definition)};if(e instanceof oi)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof si)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof ai)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:fi(new hi({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof ui)return{type:"RepetitionWithSeparator",idx:e.idx,separator:fi(new hi({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof ci)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof li)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof hi){const t={type:"Terminal",name:e.terminalType.name,label:ei(e.terminalType),idx:e.idx};kr(e.label)&&(t.terminalLabel=e.label);const n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=jr(n)?n.source:n),t}if(e instanceof ri)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}class di{visit(e){const t=e;switch(t.constructor){case ni:return this.visitNonTerminal(t);case ii:return this.visitAlternative(t);case oi:return this.visitOption(t);case si:return this.visitRepetitionMandatory(t);case ai:return this.visitRepetitionMandatoryWithSeparator(t);case ui:return this.visitRepetitionWithSeparator(t);case ci:return this.visitRepetition(t);case li:return this.visitAlternation(t);case hi:return this.visitTerminal(t);case ri: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 pi(e,t=[]){return!!(e instanceof oi||e instanceof ci||e instanceof ui)||(e instanceof li?Hr(e.definition,e=>pi(e,t)):!(e instanceof ni&&wr(t,e))&&(e instanceof ti&&(e instanceof ni&&t.push(e),pr(e.definition,e=>pi(e,t)))))}function mi(e){if(e instanceof ni)return"SUBRULE";if(e instanceof oi)return"OPTION";if(e instanceof li)return"OR";if(e instanceof si)return"AT_LEAST_ONE";if(e instanceof ai)return"AT_LEAST_ONE_SEP";if(e instanceof ui)return"MANY_SEP";if(e instanceof ci)return"MANY";if(e instanceof hi)return"CONSUME";throw Error("non exhaustive match")}class Ei{walk(e,t=[]){hr(e.definition,(n,r)=>{const i=ur(e.definition,r+1);if(n instanceof ni)this.walkProdRef(n,i,t);else if(n instanceof hi)this.walkTerminal(n,i,t);else if(n instanceof ii)this.walkFlat(n,i,t);else if(n instanceof oi)this.walkOption(n,i,t);else if(n instanceof si)this.walkAtLeastOne(n,i,t);else if(n instanceof ai)this.walkAtLeastOneSep(n,i,t);else if(n instanceof ui)this.walkManySep(n,i,t);else if(n instanceof ci)this.walkMany(n,i,t);else{if(!(n instanceof li))throw Error("non exhaustive match");this.walkOr(n,i,t)}})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){const r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){const r=[new oi({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){const r=gi(e,t,n);this.walk(e,r)}walkMany(e,t,n){const r=[new oi({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){const r=gi(e,t,n);this.walk(e,r)}walkOr(e,t,n){const r=t.concat(n);hr(e.definition,e=>{const t=new ii({definition:[e]});this.walk(t,r)})}}function gi(e,t,n){return[new oi({definition:[new hi({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function Ti(e){if(e instanceof ni)return Ti(e.referencedRule);if(e instanceof hi)return[e.terminalType];if(function(e){return e instanceof ii||e instanceof oi||e instanceof ci||e instanceof si||e instanceof ai||e instanceof ui||e instanceof hi||e instanceof ri}(e))return function(e){let t=[];const n=e.definition;let r,i=0,o=n.length>i,s=!0;for(;o&&s;)r=n[i],s=pi(r),t=t.concat(Ti(r)),i+=1,o=n.length>i;return Xr(t)}(e);if(function(e){return e instanceof li}(e))return function(e){const t=Nr(e.definition,e=>Ti(e));return Xr(wt(t))}(e);throw Error("non exhaustive match")}const Ai="_~IN~_";class Ii extends Ei{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const r=(i=e.referencedRule,o=e.idx,i.name+o+Ai+this.topProd.name);var i,o;const s=t.concat(n),a=Ti(new ii({definition:s}));this.follows[r]=a}}function vi(e){return e.charCodeAt(0)}function Ni(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function yi(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function Ri(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function Oi(e){return"Character"===e.type}const Si=[];for(let e=vi("0");e<=vi("9");e++)Si.push(e);const _i=[vi("_")].concat(Si);for(let e=vi("a");e<=vi("z");e++)_i.push(e);for(let e=vi("A");e<=vi("Z");e++)_i.push(e);const Li=[vi(" "),vi("\f"),vi("\n"),vi("\r"),vi("\t"),vi("\v"),vi("\t"),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi(" "),vi("\u2028"),vi("\u2029"),vi(" "),vi(" "),vi(" "),vi("\ufeff")],xi=/[0-9a-fA-F]/,Ci=/[0-9]/,ki=/[1-9]/;class bi{visitChildren(e){for(const t in e){const n=e[t];e.hasOwnProperty(t)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let Pi={};const wi=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("/");const t=this.disjunction();this.consumeChar("/");const 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":yi(n,"global");break;case"i":yi(n,"ignoreCase");break;case"m":yi(n,"multiLine");break;case"u":yi(n,"unicode");break;case"y":yi(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(){const 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(){const 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(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead"}Ri(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return function(){throw Error("Internal Error - Should never get here!")}()}quantifier(e=!1){let t;const 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"{":const 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&&void 0===t)return;Ri(t)}if(!0!==e||void 0!==t)return Ri(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;const 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()}if(void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),Ri(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[vi("\n"),vi("\r"),vi("\u2028"),vi("\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=Si;break;case"D":e=Si,t=!0;break;case"s":e=Li;break;case"S":e=Li,t=!0;break;case"w":e=_i;break;case"W":e=_i,t=!0}if(Ri(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=vi("\f");break;case"n":e=vi("\n");break;case"r":e=vi("\r");break;case"t":e=vi("\t");break;case"v":e=vi("\v")}if(Ri(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const 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:vi("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:vi(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:vi(this.popChar())}}}characterClass(){const e=[];let t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const t=this.classAtom();if(t.type,Oi(t)&&this.isRangeDash()){this.consumeChar("-");const n=this.classAtom();if(n.type,Oi(n)){if(n.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:n.value})}else Ni(t.value,e),e.push(vi("-")),Ni(n.value,e)}else Ni(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:vi("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;if(this.consumeChar("("),"?"===this.peekChar(0))this.consumeChar("?"),this.consumeChar(":"),e=!1;else this.groupIdx++;const t=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(!1===ki.test(e))throw Error("Expecting a positive integer");for(;Ci.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===Ci.test(e))throw Error("Expecting an integer");for(;Ci.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case"\n":case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:vi(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return"-"===this.peekChar()&&this.isClassAtom(1)}isDigit(){return Ci.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return"?"===this.peekChar(1)&&("="===this.peekChar(2)||"!"===this.peekChar(2));default:return!1}}isQuantifier(){const e=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let n=0;n<e;n++){const e=this.popChar();if(!1===xi.test(e))throw Error("Expecting a HexDecimal digits");t+=e}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(void 0!==e&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}};function Mi(e){const t=e.toString();if(Pi.hasOwnProperty(t))return Pi[t];{const e=wi.pattern(t);return Pi[t]=e,e}}const Ui="Complement Sets are not supported for first char optimization",Fi='Unable to use "first char" lexer optimizations:\n';function Di(e,t=!1){try{const t=Mi(e);return ji(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Ui)t&&Zr(`${Fi}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";t&&(n="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),qr(`${Fi}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function ji(e,t,n){switch(e.type){case"Disjunction":for(let r=0;r<e.value.length;r++)ji(e.value[r],t,n);break;case"Alternative":const r=e.value;for(let e=0;e<r.length;e++){const i=r[e];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const o=i;switch(o.type){case"Character":Bi(o.value,t,n);break;case"Set":if(!0===o.complement)throw Error(Ui);hr(o.value,e=>{if("number"==typeof e)Bi(e,t,n);else{const r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)Bi(e,t,n);else{for(let e=r.from;e<=r.to&&e<co;e++)Bi(e,t,n);if(r.to>=co){const e=r.from>=co?r.from:co,n=r.to,i=lo(e),o=lo(n);for(let e=i;e<=o;e++)t[e]=e}}}});break;case"Group":ji(o.value,t,n);break;default:throw Error("Non Exhaustive Match")}const s=void 0!==o.quantifier&&0===o.quantifier.atLeast;if("Group"===o.type&&!1===Wi(o)||"Group"!==o.type&&!1===s)break}break;default:throw Error("non exhaustive match!")}return br(t)}function Bi(e,t,n){const r=lo(e);t[r]=r,!0===n&&function(e,t){const n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){const e=lo(r.charCodeAt(0));t[e]=e}else{const e=n.toLowerCase();if(e!==n){const n=lo(e.charCodeAt(0));t[n]=n}}}(e,t)}function $i(e,t){return Ar(e.value,e=>{if("number"==typeof e)return wr(t,e);{const n=e;return void 0!==Ar(t,e=>n.from<=e&&e<=n.to)}})}function Wi(e){const t=e.quantifier;return!(!t||0!==t.atLeast)||!!e.value&&(L(e.value)?pr(e.value,Wi):Wi(e.value))}class Gi extends bi{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}super.visitChildren(e)}}visitCharacter(e){wr(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===$i(e,this.targetCharCodes)&&(this.found=!0):void 0!==$i(e,this.targetCharCodes)&&(this.found=!0)}}function Ki(e,t){if(t instanceof RegExp){const n=Mi(t),r=new Gi(e);return r.visit(n),r.found}return void 0!==Ar(t,t=>wr(e,t.charCodeAt(0)))}const zi="PATTERN",Vi="defaultMode",Hi="modes";let Yi="boolean"==typeof new RegExp("(?:)").sticky;function Xi(e,t){const n=(t=or(t,{useSticky:Yi,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer;let r;n("initCharCodeToOptimizedIndexMap",()=>{!function(){if(Fr(uo)){uo=new Array(65536);for(let e=0;e<65536;e++)uo[e]=e>255?255+~~(e/255):e}}()}),n("Reject Lexer.NA",()=>{r=zr(e,e=>e[zi]===Ro.NA)});let i,o,s,a,c,u,l,h,f,d,p,m=!1;n("Transform Patterns",()=>{m=!1,i=Nr(r,e=>{const n=e[zi];if(jr(n)){const e=n.source;return 1!==e.length||"^"===e||"$"===e||"."===e||n.ignoreCase?2!==e.length||"\\"!==e[0]||wr(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?t.useSticky?eo(n):Ji(n):e[1]:e}if(K(n))return m=!0,{exec:n};if("object"==typeof n)return m=!0,n;if("string"==typeof n){if(1===n.length)return n;{const e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=new RegExp(e);return t.useSticky?eo(r):Ji(r)}}throw Error("non exhaustive match")})}),n("misc mapping",()=>{o=Nr(r,e=>e.tokenTypeIdx),s=Nr(r,e=>{const t=e.GROUP;if(t!==Ro.SKIPPED){if(kr(t))return t;if(Br(t))return!1;throw Error("non exhaustive match")}}),a=Nr(r,e=>{const t=e.LONGER_ALT;if(t){return L(t)?Nr(t,e=>Mr(r,e)):[Mr(r,t)]}}),c=Nr(r,e=>e.PUSH_MODE),u=Nr(r,e=>Cr(e,"POP_MODE"))}),n("Line Terminator Handling",()=>{const e=so(t.lineTerminatorCharacters);l=Nr(r,e=>!1),"onlyOffset"!==t.positionTracking&&(l=Nr(r,t=>Cr(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===oo(t,e)&&Ki(e,t.PATTERN)))}),n("Misc Mapping #2",()=>{h=Nr(r,no),f=Nr(i,ro),d=Kr(r,(e,t)=>{const n=t.GROUP;return kr(n)&&n!==Ro.SKIPPED&&(e[n]=[]),e},{}),p=Nr(i,(e,t)=>({pattern:i[t],longerAlt:a[t],canLineTerminator:l[t],isCustom:h[t],short:f[t],group:s[t],push:c[t],pop:u[t],tokenTypeIdx:o[t],tokenType:r[t]}))});let E=!0,g=[];return t.safeMode||n("First Char Optimization",()=>{g=Kr(r,(e,n,r)=>{if("string"==typeof n.PATTERN){const t=lo(n.PATTERN.charCodeAt(0));ao(e,t,p[r])}else if(L(n.START_CHARS_HINT)){let t;hr(n.START_CHARS_HINT,n=>{const i=lo("string"==typeof n?n.charCodeAt(0):n);t!==i&&(t=i,ao(e,i,p[r]))})}else if(jr(n.PATTERN))if(n.PATTERN.unicode)E=!1,t.ensureOptimizations&&qr(`${Fi}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const i=Di(n.PATTERN,t.ensureOptimizations);Fr(i)&&(E=!1),hr(i,t=>{ao(e,t,p[r])})}else t.ensureOptimizations&&qr(`${Fi}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),E=!1;return e},[])}),{emptyGroups:d,patternIdxToConfig:p,charCodeToPatternIdxToConfig:g,hasCustom:m,canBeOptimized:E}}function qi(e,t){let n=[];const r=function(e){const t=Er(e,e=>!Cr(e,zi)),n=Nr(t,e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:No.MISSING_PATTERN,tokenTypes:[e]})),r=ar(e,t);return{errors:n,valid:r}}(e);n=n.concat(r.errors);const i=function(e){const t=Er(e,e=>{const t=e[zi];return!(jr(t)||K(t)||Cr(t,"exec")||kr(t))}),n=Nr(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:No.INVALID_PATTERN,tokenTypes:[e]})),r=ar(e,t);return{errors:n,valid:r}}(r.valid),o=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[];const n=Er(e,e=>jr(e[zi]));return t=t.concat(function(e){class t extends bi{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}const n=Er(e,e=>{const n=e.PATTERN;try{const e=Mi(n),r=new t;return r.visit(e),r.found}catch(e){return Zi.test(n.source)}}),r=Nr(n,e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:No.EOI_ANCHOR_FOUND,tokenTypes:[e]}));return r}(n)),t=t.concat(function(e){class t extends bi{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}const n=Er(e,e=>{const n=e.PATTERN;try{const e=Mi(n),r=new t;return r.visit(e),r.found}catch(e){return Qi.test(n.source)}}),r=Nr(n,e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:No.SOI_ANCHOR_FOUND,tokenTypes:[e]}));return r}(n)),t=t.concat(function(e){const t=Er(e,e=>{const t=e[zi];return t instanceof RegExp&&(t.multiline||t.global)}),n=Nr(t,e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:No.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}));return n}(n)),t=t.concat(function(e){const t=[];let n=Nr(e,n=>Kr(e,(e,r)=>(n.PATTERN.source!==r.PATTERN.source||wr(t,r)||r.PATTERN===Ro.NA||(t.push(r),e.push(r)),e),[]));n=Ln(n);const r=Nr(Er(n,e=>e.length>1),e=>{const t=Nr(e,e=>e.name);return{message:`The same RegExp pattern ->${Ir(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:No.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}});return r}(n)),t=t.concat(function(e){const t=Er(e,e=>e.PATTERN.test("")),n=Nr(t,e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:No.EMPTY_MATCH_PATTERN,tokenTypes:[e]}));return n}(n)),t}(o)),n=n.concat(function(e){const t=Er(e,e=>{if(!Cr(e,"GROUP"))return!1;const t=e.GROUP;return t!==Ro.SKIPPED&&t!==Ro.NA&&!kr(t)}),n=Nr(t,e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:No.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}));return n}(o)),n=n.concat(function(e,t){const n=Er(e,e=>void 0!==e.PUSH_MODE&&!wr(t,e.PUSH_MODE)),r=Nr(n,e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:No.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}));return r}(o,t)),n=n.concat(function(e){const t=[],n=Kr(e,(e,t,n)=>{const r=t.PATTERN;return r===Ro.NA||(kr(r)?e.push({str:r,idx:n,tokenType:t}):jr(r)&&(i=r,void 0===Ar([".","\\","[","]","|","^","$","(",")","?","*","+","{"],e=>-1!==i.source.indexOf(e)))&&e.push({str:r.source,idx:n,tokenType:t})),e;var i},[]);return hr(e,(e,r)=>{hr(n,({str:n,idx:i,tokenType:o})=>{if(r<i&&function(e,t){if(jr(t)){const n=t.exec(e);return null!==n&&0===n.index}if(K(t))return t(e,0,[],{});if(Cr(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(n,e.PATTERN)){const n=`Token: ->${o.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:No.UNREACHABLE_PATTERN,tokenTypes:[e,o]})}})}),t}(o)),n}const Zi=/[^\\][$]/;const Qi=/[^\\[][\^]|^\^/;function Ji(e){const t=e.ignoreCase?"i":"";return new RegExp(`^(?:${e.source})`,t)}function eo(e){const t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function to(e,t,n){const r=[];let i=!1;const o=zr(Ln(wt(br(e.modes))),e=>e[zi]===Ro.NA),s=so(n);return t&&hr(o,e=>{const t=oo(e,s);if(!1!==t){const n=function(e,t){if(t.issue===No.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===No.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(e,t),i={message:n,type:t.issue,tokenType:e};r.push(i)}else Cr(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(i=!0):Ki(s,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n\tfor details.",type:No.NO_LINE_BREAKS_FLAGS}),r}function no(e){const t=e.PATTERN;if(jr(t))return!1;if(K(t))return!0;if(Cr(t,"exec"))return!0;if(kr(t))return!1;throw Error("non exhaustive match")}function ro(e){return!(!kr(e)||1!==e.length)&&e.charCodeAt(0)}const io={test:function(e){const t=e.length;for(let n=this.lastIndex;n<t;n++){const t=e.charCodeAt(n);if(10===t)return this.lastIndex=n+1,!0;if(13===t)return 10===e.charCodeAt(n+1)?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function oo(e,t){if(Cr(e,"LINE_BREAKS"))return!1;if(jr(e.PATTERN)){try{Ki(t,e.PATTERN)}catch(e){return{issue:No.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(kr(e.PATTERN))return!1;if(no(e))return{issue:No.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function so(e){return Nr(e,e=>kr(e)?e.charCodeAt(0):e)}function ao(e,t,n){void 0===e[t]?e[t]=[n]:e[t].push(n)}const co=256;let uo=[];function lo(e){return e<co?e:uo[e]}function ho(e,t){const n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function fo(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let po=1;const mo={};function Eo(e){const t=function(e){let t=_n(e),n=e,r=!0;for(;r;){n=Ln(wt(Nr(n,e=>e.CATEGORIES)));const e=ar(n,t);t=t.concat(e),Fr(e)?r=!1:n=e}return t}(e);!function(e){hr(e,e=>{To(e)||(mo[po]=e,e.tokenTypeIdx=po++),Ao(e)&&!L(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Ao(e)||(e.CATEGORIES=[]),Cr(e,"categoryMatches")||(e.categoryMatches=[]),function(e){return Cr(e,"categoryMatchesMap")}(e)||(e.categoryMatchesMap={})})}(t),function(e){hr(e,e=>{go([],e)})}(t),function(e){hr(e,e=>{e.categoryMatches=[],hr(e.categoryMatchesMap,(t,n)=>{e.categoryMatches.push(mo[n].tokenTypeIdx)})})}(t),hr(t,e=>{e.isParent=e.categoryMatches.length>0})}function go(e,t){hr(e,e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),hr(t.CATEGORIES,n=>{const r=e.concat(t);wr(r,n)||go(r,n)})}function To(e){return Cr(e,"tokenTypeIdx")}function Ao(e){return Cr(e,"CATEGORIES")}function Io(e){return Cr(e,"tokenTypeIdx")}const vo={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`};var No;!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"}(No||(No={}));const yo={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:vo,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(yo);class Ro{constructor(e,t=yo){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(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=Qr(t),o=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=st({},yo,t);const n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof n&&(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===yo.lineTerminatorsPattern)this.config.lineTerminatorsPattern=io;else if(this.config.lineTerminatorCharacters===yo.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n\tFor 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),L(e)?n={modes:{defaultMode:_n(e)},defaultMode:Vi}:(r=!1,n=_n(e))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){const t=[];return Cr(e,Vi)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+Vi+"> property in its definition\n",type:No.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Cr(e,Hi)||t.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:No.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Cr(e,Hi)&&Cr(e,Vi)&&!Cr(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${Vi}: <${e.defaultMode}>which does not exist\n`,type:No.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Cr(e,Hi)&&hr(e.modes,(e,n)=>{hr(e,(r,i)=>{Br(r)?t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${n}> at index: <${i}>\n`,type:No.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Cr(r,"LONGER_ALT")&&hr(L(r.LONGER_ALT)?r.LONGER_ALT:[r.LONGER_ALT],i=>{Br(i)||wr(e,i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${r.name}> outside of mode <${n}>\n`,type:No.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),t}(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(to(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},hr(n.modes,(e,t)=>{n.modes[t]=zr(e,e=>Br(e))});const i=rt(n.modes);if(hr(n.modes,(e,n)=>{this.TRACE_INIT(`Mode: <${n}> processing`,()=>{if(this.modes.push(n),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(qi(e,i))}),Fr(this.lexerDefinitionErrors)){let r;Eo(e),this.TRACE_INIT("analyzeTokenTypes",()=>{r=Xi(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=st({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[n]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,!Fr(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const e=Nr(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+e)}hr(this.lexerDefinitionWarning,e=>{Zr(e.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(Yi?(this.chopInput=G,this.match=this.matchWithTest):(this.updateLastIndex=ae,this.match=this.matchWithExec),r&&(this.handleModes=ae),!1===this.trackStartLines&&(this.computeNewColumn=G),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=ae),/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))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const e=Kr(this.canModeBeOptimized,(e,t,n)=>(!1===t&&e.push(n),e),[]);if(t.ensureOptimizations&&!Fr(e))throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Pi={}}),this.TRACE_INIT("toFastProperties",()=>{Jr(this)})})}tokenize(e,t=this.defaultMode){if(!Fr(this.lexerDefinitionErrors)){const e=Nr(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,o,s,a,c,u,l,h,f,d,p,m,E;const g=e,T=g.length;let A=0,I=0;const v=this.hasCustom?0:Math.floor(e.length/10),N=new Array(v),y=[];let R=this.trackStartLines?1:void 0,O=this.trackStartLines?1:void 0;const S=function(e){const t={};return hr(rt(e),n=>{const r=e[n];if(!L(r))throw Error("non exhaustive match");t[n]=[]}),t}(this.emptyGroups),_=this.trackStartLines,x=this.config.lineTerminatorsPattern;let C=0,k=[],b=[];const P=[],w=[];let M;function U(){return k}function F(e){const t=lo(e),n=b[t];return void 0===n?w:n}Object.freeze(w);const D=e=>{if(1===P.length&&void 0===e.tokenType.PUSH_MODE){const t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);y.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{P.pop();const e=cr(P);k=this.patternIdxToConfig[e],b=this.charCodeToPatternIdxToConfig[e],C=k.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=b&&t?F:U}};function j(e){P.push(e),b=this.charCodeToPatternIdxToConfig[e],k=this.patternIdxToConfig[e],C=k.length,C=k.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=b&&t?F:U}let B;j.call(this,t);const $=this.config.recoveryEnabled;for(;A<T;){a=null;const t=g.charCodeAt(A),v=M(t),L=v.length;for(n=0;n<L;n++){B=v[n];const r=B.pattern;c=null;const l=B.short;if(!1!==l?t===l&&(a=r):!0===B.isCustom?(E=r.exec(g,A,N,S),null!==E?(a=E[0],void 0!==E.payload&&(c=E.payload)):a=null):(this.updateLastIndex(r,A),a=this.match(r,e,A)),null!==a){if(s=B.longerAlt,void 0!==s){const t=s.length;for(i=0;i<t;i++){const t=k[s[i]],n=t.pattern;if(u=null,!0===t.isCustom?(E=n.exec(g,A,N,S),null!==E?(o=E[0],void 0!==E.payload&&(u=E.payload)):o=null):(this.updateLastIndex(n,A),o=this.match(n,e,A)),o&&o.length>a.length){a=o,c=u,B=t;break}}}break}}if(null!==a){if(l=a.length,h=B.group,void 0!==h&&(f=B.tokenTypeIdx,d=this.createTokenInstance(a,A,f,B.tokenType,R,O,l),this.handlePayload(d,c),!1===h?I=this.addToken(N,I,d):S[h].push(d)),e=this.chopInput(e,l),A+=l,O=this.computeNewColumn(O,l),!0===_&&!0===B.canLineTerminator){let e,t,n=0;x.lastIndex=0;do{e=x.test(a),!0===e&&(t=x.lastIndex-1,n++)}while(!0===e);0!==n&&(R+=n,O=l-t,this.updateTokenEndLineColumnLocation(d,h,t,n,R,O,l))}this.handleModes(B,D,j,d)}else{const t=A,n=R,i=O;let o=!1===$;for(;!1===o&&A<T;)for(e=this.chopInput(e,1),A++,r=0;r<C;r++){const t=k[r],n=t.pattern,i=t.short;if(!1!==i?g.charCodeAt(A)===i&&(o=!0):!0===t.isCustom?o=null!==n.exec(g,A,N,S):(this.updateLastIndex(n,A),o=null!==n.exec(e)),!0===o)break}if(p=A-t,O=this.computeNewColumn(O,p),m=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(g,t,p,n,i),y.push({offset:t,line:n,column:i,length:p,message:m}),!1===$)break}}return this.hasCustom||(N.length=I),{tokens:N,groups:S,errors:y}}handleModes(e,t,n,r){if(!0===e.pop){const i=e.push;t(r),void 0!==i&&n.call(this,i)}else void 0!==e.push&&n.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,n,r,i,o,s){let a,c;void 0!==t&&(a=n===s-1,c=a?-1:0,1===r&&!0===a||(e.endLine=i+c,e.endColumn=o-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,o){return{image:e,startOffset:t,startLine:i,startColumn:o,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,o,s){return{image:e,startOffset:t,endOffset:t+s-1,startLine:i,endLine:i,startColumn:o,endColumn:o+s-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}matchWithTest(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchWithExec(e,t){const n=e.exec(t);return null!==n?n[0]:null}}function Oo(e){return So(e)?e.LABEL:e.name}function So(e){return kr(e.LABEL)&&""!==e.LABEL}Ro.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.",Ro.NA=/NOT_APPLICABLE/;const _o="parent",Lo="categories",xo="label",Co="group",ko="push_mode",bo="pop_mode",Po="longer_alt",wo="line_breaks",Mo="start_chars_hint";function Uo(e){return function(e){const t=e.pattern,n={};n.name=e.name,Br(t)||(n.PATTERN=t);if(Cr(e,_o))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";Cr(e,Lo)&&(n.CATEGORIES=e[Lo]);Eo([n]),Cr(e,xo)&&(n.LABEL=e[xo]);Cr(e,Co)&&(n.GROUP=e[Co]);Cr(e,bo)&&(n.POP_MODE=e[bo]);Cr(e,ko)&&(n.PUSH_MODE=e[ko]);Cr(e,Po)&&(n.LONGER_ALT=e[Po]);Cr(e,wo)&&(n.LINE_BREAKS=e[wo]);Cr(e,Mo)&&(n.START_CHARS_HINT=e[Mo]);return n}(e)}const Fo=Uo({name:"EOF",pattern:Ro.NA});function Do(e,t,n,r,i,o,s,a){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}Eo([Fo]);const jo={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${So(e)?`--\x3e ${Oo(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>"Redundant input, expecting EOF but found: "+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){const o="Expecting: ",s="\nbut found: '"+Ir(t).image+"'";if(r)return o+r+s;{const t=Nr(Kr(e,(e,t)=>e.concat(t),[]),e=>`[${Nr(e,e=>Oo(e)).join(", ")}]`);return o+`one of these possible Token sequences:\n${Nr(t,(e,t)=>` ${t+1}. ${e}`).join("\n")}`+s}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){const i="Expecting: ",o="\nbut found: '"+Ir(t).image+"'";if(n)return i+n+o;return i+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${Nr(e,e=>`[${Nr(e,e=>Oo(e)).join(",")}]`).join(" ,")}>`+o}};Object.freeze(jo);const Bo={buildRuleNotFoundError:(e,t)=>"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},$o={buildDuplicateFoundError(e,t){const n=e.name,r=Ir(t),i=r.idx,o=mi(r),s=(a=r)instanceof hi?a.terminalType.name:a instanceof ni?a.nonTerminalName:"";var a;let c=`->${o}${i>0?i:""}<- ${s?`with argument: ->${s}<-`:""}\n appears more than once (${t.length} times) in the top level rule: ->${n}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,"\n"),c},buildNamespaceConflictError:e=>`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){const t=Nr(e.prefixPath,e=>Oo(e)).join(", "),n=0===e.alternation.idx?"":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){const t=Nr(e.prefixPath,e=>Oo(e)).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;let 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\nFor Further details.",r},buildEmptyRepetitionError(e){let t=mi(e.repetition);0!==e.repetition.idx&&(t+=e.repetition.idx);return`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:e=>"deprecated",buildEmptyAlternationError:e=>`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=>`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){const 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} --\x3e ${Nr(e.leftRecursionPath,e=>e.name).concat([t]).join(" --\x3e ")}`}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;t=e.topLevelRule instanceof ri?e.topLevelRule.name:e.topLevelRule;return`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class Wo extends di{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){hr(br(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:ua.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Go extends Ei{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=_n(this.path.ruleStack).reverse(),this.occurrenceStack=_n(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){const r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){Fr(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Ko extends Go{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){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const e=t.concat(n),r=new ii({definition:e});this.possibleTokTypes=Ti(r),this.found=!0}}}class zo extends Ei{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}}class Vo extends zo{walkMany(e,t,n){if(e.idx===this.occurrence){const e=Ir(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof hi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}}class Ho extends zo{walkManySep(e,t,n){if(e.idx===this.occurrence){const e=Ir(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof hi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}}class Yo extends zo{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){const e=Ir(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof hi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}}class Xo extends zo{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){const e=Ir(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof hi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}}function qo(e,t,n=[]){n=_n(n);let r=[],i=0;function o(o){const s=qo(o.concat(ur(e,i+1)),t,n);return r.concat(s)}for(;n.length<t&&i<e.length;){const t=e[i];if(t instanceof ii)return o(t.definition);if(t instanceof ni)return o(t.definition);if(t instanceof oi)r=o(t.definition);else{if(t instanceof si){return o(t.definition.concat([new ci({definition:t.definition})]))}if(t instanceof ai){return o([new ii({definition:t.definition}),new ci({definition:[new hi({terminalType:t.separator})].concat(t.definition)})])}if(t instanceof ui){const e=t.definition.concat([new ci({definition:[new hi({terminalType:t.separator})].concat(t.definition)})]);r=o(e)}else if(t instanceof ci){const e=t.definition.concat([new ci({definition:t.definition})]);r=o(e)}else{if(t instanceof li)return hr(t.definition,e=>{!1===Fr(e.definition)&&(r=o(e.definition))}),r;if(!(t instanceof hi))throw Error("non exhaustive match");n.push(t.terminalType)}}i++}return r.push({partialPath:n,suffixDef:ur(e,i)}),r}function Zo(e,t,n,r){const i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE";let a=!1;const c=t.length,u=c-r-1,l=[],h=[];for(h.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!Fr(h);){const e=h.pop();if(e===s){a&&cr(h).idx<=u&&h.pop();continue}const r=e.def,f=e.idx,d=e.ruleStack,p=e.occurrenceStack;if(Fr(r))continue;const m=r[0];if(m===i){const e={idx:f,def:ur(r),ruleStack:lr(d),occurrenceStack:lr(p)};h.push(e)}else if(m instanceof hi)if(f<c-1){const e=f+1;if(n(t[e],m.terminalType)){const t={idx:e,def:ur(r),ruleStack:d,occurrenceStack:p};h.push(t)}}else{if(f!==c-1)throw Error("non exhaustive match");l.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:d,occurrenceStack:p}),a=!0}else if(m instanceof ni){const e=_n(d);e.push(m.nonTerminalName);const t=_n(p);t.push(m.idx);const n={idx:f,def:m.definition.concat(o,ur(r)),ruleStack:e,occurrenceStack:t};h.push(n)}else if(m instanceof oi){const e={idx:f,def:ur(r),ruleStack:d,occurrenceStack:p};h.push(e),h.push(s);const t={idx:f,def:m.definition.concat(ur(r)),ruleStack:d,occurrenceStack:p};h.push(t)}else if(m instanceof si){const e=new ci({definition:m.definition,idx:m.idx}),t={idx:f,def:m.definition.concat([e],ur(r)),ruleStack:d,occurrenceStack:p};h.push(t)}else if(m instanceof ai){const e=new hi({terminalType:m.separator}),t=new ci({definition:[e].concat(m.definition),idx:m.idx}),n={idx:f,def:m.definition.concat([t],ur(r)),ruleStack:d,occurrenceStack:p};h.push(n)}else if(m instanceof ui){const e={idx:f,def:ur(r),ruleStack:d,occurrenceStack:p};h.push(e),h.push(s);const t=new hi({terminalType:m.separator}),n=new ci({definition:[t].concat(m.definition),idx:m.idx}),i={idx:f,def:m.definition.concat([n],ur(r)),ruleStack:d,occurrenceStack:p};h.push(i)}else if(m instanceof ci){const e={idx:f,def:ur(r),ruleStack:d,occurrenceStack:p};h.push(e),h.push(s);const t=new ci({definition:m.definition,idx:m.idx}),n={idx:f,def:m.definition.concat([t],ur(r)),ruleStack:d,occurrenceStack:p};h.push(n)}else if(m instanceof li)for(let e=m.definition.length-1;e>=0;e--){const t={idx:f,def:m.definition[e].definition.concat(ur(r)),ruleStack:d,occurrenceStack:p};h.push(t),h.push(s)}else if(m instanceof ii)h.push({idx:f,def:m.definition.concat(ur(r)),ruleStack:d,occurrenceStack:p});else{if(!(m instanceof ri))throw Error("non exhaustive match");h.push(Qo(m,f,d,p))}}return l}function Qo(e,t,n,r){const i=_n(n);i.push(e.name);const o=_n(r);return o.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:o}}var Jo;function es(e){if(e instanceof oi||"Option"===e)return Jo.OPTION;if(e instanceof ci||"Repetition"===e)return Jo.REPETITION;if(e instanceof si||"RepetitionMandatory"===e)return Jo.REPETITION_MANDATORY;if(e instanceof ai||"RepetitionMandatoryWithSeparator"===e)return Jo.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof ui||"RepetitionWithSeparator"===e)return Jo.REPETITION_WITH_SEPARATOR;if(e instanceof li||"Alternation"===e)return Jo.ALTERNATION;throw Error("non exhaustive match")}function ts(e,t,n,r){const i=e.length,o=pr(e,e=>pr(e,e=>1===e.length));if(t)return function(t){const r=Nr(t,e=>e.GATE);for(let t=0;t<i;t++){const i=e[t],o=i.length,s=r[t];if(void 0===s||!1!==s.call(this))e:for(let e=0;e<o;e++){const r=i[e],o=r.length;for(let e=0;e<o;e++){const t=this.LA(e+1);if(!1===n(t,r[e]))continue e}return t}}};if(o&&!r){const t=Kr(Nr(e,e=>wt(e)),(e,t,n)=>(hr(t,t=>{Cr(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),hr(t.categoryMatches,t=>{Cr(e,t)||(e[t]=n)})}),e),{});return function(){const e=this.LA(1);return t[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){const r=e[t],i=r.length;e:for(let e=0;e<i;e++){const i=r[e],o=i.length;for(let e=0;e<o;e++){const t=this.LA(e+1);if(!1===n(t,i[e]))continue e}return t}}}}function ns(e,t,n){const r=pr(e,e=>1===e.length),i=e.length;if(r&&!n){const t=wt(e);if(1===t.length&&Fr(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=Kr(t,(e,t,n)=>(e[t.tokenTypeIdx]=!0,hr(t.categoryMatches,t=>{e[t]=!0}),e),[]);return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let n=0;n<i;n++){const r=e[n],i=r.length;for(let e=0;e<i;e++){const n=this.LA(e+1);if(!1===t(n,r[e]))continue e}return!0}return!1}}!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"}(Jo||(Jo={}));class rs extends Ei{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)}walkOption(e,t,n){this.checkIsTarget(e,Jo.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,Jo.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,Jo.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,Jo.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,Jo.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}}class is extends di{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||void 0!==this.targetRef&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Jo.OPTION)}visitRepetition(e){this.checkIsTarget(e,Jo.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Jo.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Jo.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Jo.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Jo.ALTERNATION)}}function os(e){const t=new Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function ss(e){let t=[""];for(let n=0;n<e.length;n++){const r=e[n],i=[];for(let e=0;e<t.length;e++){const n=t[e];i.push(n+"_"+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){const t="_"+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function as(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;const i=e[r];for(let e=0;e<t.length;e++){if(!0===i[t[e]])return!1}}return!0}function cs(e,t){const n=Nr(e,e=>qo([e],1)),r=os(n.length),i=Nr(n,e=>{const t={};return hr(e,e=>{hr(ss(e.partialPath),e=>{t[e]=!0})}),t});let o=n;for(let e=1;e<=t;e++){const n=o;o=os(n.length);for(let s=0;s<n.length;s++){const a=n[s];for(let n=0;n<a.length;n++){const c=a[n].partialPath,u=a[n].suffixDef,l=ss(c);if(as(i,l,s)||Fr(u)||c.length===t){const e=r[s];if(!1===hs(e,c)){e.push(c);for(let e=0;e<l.length;e++){const t=l[e];i[s][t]=!0}}}else{const t=qo(u,e+1,c);o[s]=o[s].concat(t),hr(t,e=>{hr(ss(e.partialPath),e=>{i[s][e]=!0})})}}}}return r}function us(e,t,n,r){const i=new is(e,Jo.ALTERNATION,r);return t.accept(i),cs(i.result,n)}function ls(e,t,n,r){const i=new is(e,n);t.accept(i);const o=i.result,s=new rs(t,e,n).startWalking();return cs([new ii({definition:o}),new ii({definition:s})],r)}function hs(e,t){e:for(let n=0;n<e.length;n++){const r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){const n=t[e],i=r[e];if(!1===(n===i||void 0!==i.categoryMatchesMap[n.tokenTypeIdx]))continue e}return!0}}return!1}function fs(e){return pr(e,e=>pr(e,e=>pr(e,e=>Fr(e.categoryMatches))))}function ds(e,t,n,r){const i=yr(e,e=>function(e,t){const n=new Es;e.accept(n);const r=n.allProductions,i=_r(r,ps),o=Nr(br(Wr(i,e=>e.length>1)),n=>{const r=Ir(n),i=t.buildDuplicateFoundError(e,n),o=mi(r),s={message:i,type:ua.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:o,occurrence:r.idx},a=ms(r);return a&&(s.parameter=a),s});return o}(e,n)),o=function(e,t,n){const r=[],i=Nr(t,e=>e.name);return hr(e,e=>{const t=e.name;if(wr(i,t)){const i=n.buildNamespaceConflictError(e);r.push({message:i,type:ua.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}(e,t,n),s=yr(e,e=>function(e,t){const n=new As;e.accept(n);const r=yr(n.alternations,n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:ua.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[]);return r}(e,n)),a=yr(e,t=>function(e,t,n,r){const i=[],o=Kr(t,(t,n)=>n.name===e.name?t+1:t,0);if(o>1){const t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:ua.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,r,n));return i.concat(o,s,a)}function ps(e){return`${mi(e)}_#_${e.idx}_#_${ms(e)}`}function ms(e){return e instanceof hi?e.terminalType.name:e instanceof ni?e.nonTerminalName:""}class Es extends di{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 gs(e,t,n,r=[]){const i=[],o=Ts(t.definition);if(Fr(o))return[];{const t=e.name;wr(o,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:ua.LEFT_RECURSION,ruleName:t});const s=yr(ar(o,r.concat([e])),t=>{const i=_n(r);return i.push(t),gs(e,t,n,i)});return i.concat(s)}}function Ts(e){let t=[];if(Fr(e))return t;const n=Ir(e);if(n instanceof ni)t.push(n.referencedRule);else if(n instanceof ii||n instanceof oi||n instanceof si||n instanceof ai||n instanceof ui||n instanceof ci)t=t.concat(Ts(n.definition));else if(n instanceof li)t=wt(Nr(n.definition,e=>Ts(e.definition)));else if(!(n instanceof hi))throw Error("non exhaustive match");const r=pi(n),i=e.length>1;if(r&&i){const n=ur(e);return t.concat(Ts(n))}return t}class As extends di{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Is(e,t,n){const r=new As;e.accept(r);let i=r.alternations;i=zr(i,e=>!0===e.ignoreAmbiguities);const o=yr(i,r=>{const i=r.idx,o=r.maxLookahead||t,s=us(i,e,o,r),a=function(e,t,n,r){const i=[],o=Kr(e,(n,r,o)=>(!0===t.definition[o].ignoreAmbiguities||hr(r,r=>{const s=[o];hr(e,(e,n)=>{o!==n&&hs(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&s.push(n)}),s.length>1&&!hs(i,r)&&(i.push(r),n.push({alts:s,path:r}))}),n),[]),s=Nr(o,e=>{const i=Nr(e.alts,e=>e+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:ua.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}});return s}(s,r,e,n),c=function(e,t,n,r){const i=Kr(e,(e,t,n)=>{const r=Nr(t,e=>({idx:n,path:e}));return e.concat(r)},[]),o=Ln(yr(i,e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];const o=e.idx,s=e.path;return Nr(Er(i,e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<o&&(n=e.path,r=s,n.length<r.length&&pr(n,(e,t)=>{const n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]}));var n,r}),e=>{const i=[e.idx+1,o+1],s=0===t.idx?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:ua.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:s,alternatives:i}})}));return o}(s,r,e,n);return a.concat(c)});return o}class vs extends di{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 Ns(e){const t=or(e,{errMsgProvider:Bo}),n={};return hr(e.rules,e=>{n[e.name]=e}),function(e,t){const n=new Wo(e,t);return n.resolveRefs(),n.errors}(n,t.errMsgProvider)}const ys="MismatchedTokenException",Rs="NoViableAltException",Os="EarlyExitException",Ss="NotAllInputParsedException",_s=[ys,Rs,Os,Ss];function Ls(e){return wr(_s,e.name)}Object.freeze(_s);class xs 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)}}class Cs extends xs{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=ys}}class ks extends xs{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Rs}}class bs extends xs{constructor(e,t){super(e,t),this.name=Ss}}class Ps extends xs{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Os}}const ws={},Ms="InRuleRecoveryException";class Us extends Error{constructor(e){super(e),this.name=Ms}}function Fs(e,t,n,r,i,o,s){const a=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[a];if(void 0===c){const e=this.getCurrRuleFullName();c=new o(this.getGAstProductions()[e],i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence;const h=c.isEndOfRule;1===this.RULE_STACK.length&&h&&void 0===u&&(u=Fo,l=1),void 0!==u&&void 0!==l&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(e,t,n,u)}const Ds=1024,js=1280,Bs=1536;function $s(e,t,n){return n|t|e}class Ws{constructor(e){var t;this.maxLookahead=null!==(t=null==e?void 0:e.maxLookahead)&&void 0!==t?t:aa.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if(Fr(t)){const 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 yr(e,e=>gs(e,e,$o))}validateEmptyOrAlternatives(e){return yr(e,e=>function(e,t){const n=new As;return e.accept(n),yr(n.alternations,n=>yr(lr(n.definition),(r,i)=>Fr(Zo([r],[],ho,1))?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:ua.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]))}(e,$o))}validateAmbiguousAlternationAlternatives(e,t){return yr(e,e=>Is(e,t,$o))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,n){const r=[];return hr(e,e=>{const i=new vs;e.accept(i),hr(i.allProductions,i=>{const o=es(i),s=i.maxLookahead||t;if(Fr(wt(ls(i.idx,e,o,s)[0]))){const t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:ua.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}(e,t,$o)}buildLookaheadForAlternation(e){return function(e,t,n,r,i,o){const s=us(e,t,n);return o(s,r,fs(s)?fo:ho,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,ts)}buildLookaheadForOptional(e){return function(e,t,n,r,i,o){const s=ls(e,t,i,n),a=fs(s)?fo:ho;return o(s[0],a,r)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,es(e.prodType),ns)}}const Gs=new class extends di{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 Ks(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function zs(e,t){!0===isNaN(e.startOffset)?(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==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function Vs(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function Hs(e,t){const n=rt(e),r=n.length;for(let i=0;i<r;i++){const r=e[n[i]],o=r.length;for(let e=0;e<o;e++){const n=r[e];void 0===n.tokenTypeIdx&&this[n.name](n.children,t)}}}function Ys(e,t){const n=function(){};Vs(n,e+"BaseSemantics");const r={visit:function(e,t){if(L(e)&&(e=e[0]),!Br(e))return this[e.name](e.children,t)},validateVisitor:function(){const e=function(e,t){const n=function(e,t){const n=Er(t,t=>!1===K(e[t])),r=Nr(n,t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:Xs.MISSING_METHOD,methodName:t}));return Ln(r)}(e,t);return n}(this,t);if(!Fr(e)){const t=Nr(e,e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join("\n\n").replace(/\n/g,"\n\t")}`)}}};return(n.prototype=r).constructor=n,n._RULE_NAMES=t,n}var Xs;!function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"}(Xs||(Xs={}));const qs={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(qs);const Zs=!0,Qs=Math.pow(2,8)-1,Js=Uo({name:"RECORDING_PHASE_TOKEN",pattern:Ro.NA});Eo([Js]);const ea=Do(Js,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(ea);const ta={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}};function na(e,t,n,r=!1){oa(n);const i=cr(this.recordingProdStack),o=K(t)?t:t.DEF,s=new e({definition:[],idx:n});return r&&(s.separator=t.SEP),Cr(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),qs}function ra(e,t){oa(t);const n=cr(this.recordingProdStack),r=!1===L(e),i=!1===r?e:e.DEF,o=new li({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});Cr(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD);const s=Hr(i,e=>K(e.GATE));return o.hasPredicates=s,n.definition.push(o),hr(i,e=>{const t=new ii({definition:[]});o.definition.push(t),Cr(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Cr(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),qs}function ia(e){return 0===e?"":`${e}`}function oa(e){if(e<0||e>Qs){const t=new Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than ${Qs+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}const sa=Do(Fo,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(sa);const aa=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:jo,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ca=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var ua,la,ha;!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"}(ua||(ua={}));class fa{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const t=this.className;this.TRACE_INIT("toFastProps",()=>{Jr(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),hr(this.definedRulesNames,e=>{const t=this[e].originalGrammarAction;let n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=Ns({rules:br(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(Fr(n)&&!1===this.skipValidations){const n=(e={rules:br(this.gastProductionsCache),tokenTypes:br(this.tokensMap),errMsgProvider:$o,grammarName:t},ds((e=or(e,{errMsgProvider:$o})).rules,e.tokenTypes,e.errMsgProvider,e.grammarName)),r=function(e){return Nr(e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}),e=>Object.assign({type:ua.CUSTOM_LOOKAHEAD_VALIDATION},e))}({lookaheadStrategy:this.lookaheadStrategy,rules:br(this.gastProductionsCache),tokenTypes:br(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(n,r)}var e}),Fr(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const e=function(e){const t={};return hr(e,e=>{const n=new Ii(e).startWalking();st(t,n)}),t}(br(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var e,t;null===(t=(e=this.lookaheadStrategy).initialize)||void 0===t||t.call(e,{rules:br(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(br(this.gastProductionsCache))})),!fa.DEFER_DEFINITION_ERRORS_HANDLING&&!Fr(this.definitionErrors))throw e=Nr(this.definitionErrors,e=>e.message),new Error(`Parser Definition Errors detected:\n ${e.join("\n-------------------------------\n")}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;const 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),Cr(t,"ignoredIssues"))throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\tPlease use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=Cr(t,"skipValidations")?t.skipValidations:aa.skipValidations}}fa.DEFER_DEFINITION_ERRORS_HANDLING=!1,la=fa,ha=[class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Cr(e,"recoveryEnabled")?e.recoveryEnabled:aa.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Fs)}getTokenToInsert(e){const t=Do(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){const i=this.findReSyncTokenType(),o=this.exportLexerState(),s=[];let a=!1;const c=this.LA(1);let u=this.LA(1);const l=()=>{const e=this.LA(0),t=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),n=new Cs(t,c,this.LA(0));n.resyncedTokens=lr(s),this.SAVE_ERROR(n)};for(;!a;){if(this.tokenMatcher(u,r))return void l();if(n.call(this))return l(),void e.apply(this,t);this.tokenMatcher(u,i)?a=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,s))}this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,t,n){return!1!==n&&!this.tokenMatcher(this.LA(1),e)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t))}getFollowsForInRuleRecovery(e,t){const 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)){const e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new Us("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(Fr(t))return!1;const n=this.LA(1);return void 0!==Ar(t,e=>this.tokenMatcher(n,e))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey();return wr(this.getFollowSetFromFollowKey(t),e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),n=2;for(;;){const r=Ar(e,e=>ho(t,e));if(void 0!==r)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return ws;const e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return Nr(e,(n,r)=>0===r?ws:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])})}flattenFollowSet(){return wt(Nr(this.buildFullFollowKeyStack(),e=>this.getFollowSetFromFollowKey(e)))}getFollowSetFromFollowKey(e){if(e===ws)return[Fo];const t=e.ruleName+e.idxInCallingRule+Ai+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,Fo)||t.push(e),t}reSyncTo(e){const t=[];let n=this.LA(1);for(;!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return lr(t)}attemptInRepetitionRecovery(e,t,n,r,i,o,s){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:_n(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return Nr(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}},class{initLooksAhead(e){this.dynamicTokensEnabled=Cr(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:aa.dynamicTokensEnabled,this.maxLookahead=Cr(e,"maxLookahead")?e.maxLookahead:aa.maxLookahead,this.lookaheadStrategy=Cr(e,"lookaheadStrategy")?e.lookaheadStrategy:new Ws({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){hr(e,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{const{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:s}=function(e){Gs.reset(),e.accept(Gs);const t=Gs.dslMethods;return Gs.reset(),t}(e);hr(t,t=>{const n=0===t.idx?"":t.idx;this.TRACE_INIT(`${mi(t)}${n}`,()=>{const n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),r=$s(this.fullRuleNameToShort[e.name],256,t.idx);this.setLaFuncCache(r,n)})}),hr(n,t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,mi(t))}),hr(r,t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,mi(t))}),hr(i,t=>{this.computeLookaheadFunc(e,t.idx,Ds,"RepetitionMandatory",t.maxLookahead,mi(t))}),hr(o,t=>{this.computeLookaheadFunc(e,t.idx,Bs,"RepetitionMandatoryWithSeparator",t.maxLookahead,mi(t))}),hr(s,t=>{this.computeLookaheadFunc(e,t.idx,js,"RepetitionWithSeparator",t.maxLookahead,mi(t))})})})}computeLookaheadFunc(e,t,n,r,i,o){this.TRACE_INIT(`${o}${0===t?"":t}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),s=$s(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(s,o)})}getKeyForAutomaticLookahead(e,t){return $s(this.getLastExplicitRuleShortName(),e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Cr(e,"nodeLocationTracking")?e.nodeLocationTracking:aa.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zs,this.setNodeLocationFromNode=zs,this.cstPostRule=ae,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=ae,this.setNodeLocationFromNode=ae,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ks,this.setNodeLocationFromNode=Ks,this.cstPostRule=ae,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=ae,this.setNodeLocationFromNode=ae,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);this.setNodeLocationFromToken=ae,this.setNodeLocationFromNode=ae,this.cstPostRule=ae,this.setInitialNodeLocation=ae}else this.cstInvocationStateUpdate=ae,this.cstFinallyStateUpdate=ae,this.cstPostTerminal=ae,this.cstPostNonTerminal=ae,this.cstPostRule=ae}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==1?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==1?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,o;i=t,o=e,void 0===(r=n).children[o]?r.children[o]=[i]:r.children[o].push(i),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];!function(e,t,n){void 0===e.children[t]?e.children[t]=[n]:e.children[t].push(n)}(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(Br(this.baseCstVisitorConstructor)){const e=Ys(this.className,rt(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Br(this.baseCstVisitorWithDefaultsConstructor)){const e=function(e,t,n){const r=function(){};Vs(r,e+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return hr(t,e=>{i[e]=Hs}),(r.prototype=i).constructor=r,r}(this.className,rt(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)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)):sa}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?sa: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()}},class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=fo,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},Cr(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if(L(e)){if(Fr(e))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if(L(e))this.tokensMap=Kr(e,(e,t)=>(e[t.name]=t,e),{});else if(Cr(e,"modes")&&pr(wt(br(e.modes)),Io)){const t=Xr(wt(br(e.modes)));this.tokensMap=Kr(t,(e,t)=>(e[t.name]=t,e),{})}else{if(!M(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=_n(e)}this.tokensMap.EOF=Fo;const n=pr(Cr(e,"modes")?wt(br(e.modes)):br(e),e=>Fr(e.categoryMatches));this.tokenMatcher=n?fo:ho,Eo(br(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.`);const r=Cr(n,"resyncEnabled")?n.resyncEnabled:ca.resyncEnabled,i=Cr(n,"recoveryValueFunc")?n.recoveryValueFunc:ca.recoveryValueFunc,o=this.ruleShortNameIdx<<12;let s;return this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o,s=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),t.apply(this,n);const 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(o,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(s,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){const r=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Ls(e)){const t=e;if(i){const r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){const 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){const n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof e){r=e.DEF;const t=e.GATE;if(void 0!==t){const e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){const n=this.getKeyForAutomaticLookahead(Ds,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Jo.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,Ds,e,Yo)}atLeastOneSepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(Bs,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(e,Jo.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,Xo],t,Bs,e,Xo)}}manyInternal(e,t){const n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let o=!0;for(;!0===i.call(this)&&!0===o;)o=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Vo,o)}manySepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(js,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(n).call(this)){r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,Ho],t,js,e,Ho)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,Bs,e,i)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const n=this.getKeyForAutomaticLookahead(256,t),r=L(e)?e:e.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(void 0!==i)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(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new bs(t,e))}}subruleInternal(e,t,n){let r;try{const i=void 0!==n?n.ARGS:void 0;return this.subruleIdx=t,r=e.apply(this,i),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw Ls(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{const t=this.LA(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(void 0!==n&&void 0!==n.LABEL?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r;const i=this.LA(0);throw r=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Cs(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;{const r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===Ms?n:e}}}saveRecogState(){const e=this.errors,t=_n(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 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Fo)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},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=ca){if(wr(this.definedRulesNames,e)){const t={message:$o.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:ua.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);const r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=ca){const r=function(e,t,n){const r=[];let i;return wr(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:ua.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(Ls(e))return!1;throw e}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Nr(br(this.gastProductionsCache),fi)}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Cr(e,"errorMessageProvider")?e.errorMessageProvider:aa.errorMessageProvider}SAVE_ERROR(e){if(Ls(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:_n(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return _n(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){const r=this.getCurrRuleFullName(),i=ls(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],o=[];for(let e=1;e<=this.maxLookahead;e++)o.push(this.LA(e));const s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new Ps(s,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const n=this.getCurrRuleFullName(),r=us(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));const o=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:o,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ks(s,this.LA(1),o))}},class{initContentAssist(){}computeContentAssist(e,t){const n=this.gastProductionsCache[e];if(Br(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Zo([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=Ir(e.ruleStack),n=this.getGAstProductions()[t];return new Ko(n,e).startWalking()}},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++){const 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",()=>{const e=this;for(let t=0;t<10;t++){const 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 sa}topLevelRuleRecord(e,t){try{const n=new ri({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=e.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(t){throw e}throw e}}optionInternalRecord(e,t){return na.call(this,oi,e,t)}atLeastOneInternalRecord(e,t){na.call(this,si,t,e)}atLeastOneSepFirstInternalRecord(e,t){na.call(this,ai,t,e,Zs)}manyInternalRecord(e,t){na.call(this,ci,t,e)}manySepFirstInternalRecord(e,t){na.call(this,ui,t,e,Zs)}orInternalRecord(e,t){return ra.call(this,e,t)}subruleInternalRecord(e,t,n){if(oa(t),!e||!1===Cr(e,"ruleName")){const n=new Error(`<SUBRULE${ia(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}const r=cr(this.recordingProdStack),i=e.ruleName,o=new ni({idx:t,nonTerminalName:i,label:null==n?void 0:n.LABEL,referencedRule:void 0});return r.definition.push(o),this.outputCst?ta:qs}consumeInternalRecord(e,t,n){if(oa(t),!To(e)){const n=new Error(`<CONSUME${ia(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}const r=cr(this.recordingProdStack),i=new hi({idx:t,terminalType:e,label:null==n?void 0:n.LABEL});return r.definition.push(i),ea}},class{initPerformanceTracer(e){if(Cr(e,"traceInitPerf")){const t=e.traceInitPerf,n="number"==typeof t;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=aa.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=Qr(t),o=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}],ha.forEach(e=>{const t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if("constructor"===n)return;const r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(la.prototype,n,r):la.prototype[n]=e.prototype[n]})});class da extends fa{constructor(e,t=aa){const n=_n(t);n.outputCst=!1,super(e,n)}}const pa=Uo({name:"WhiteSpace",pattern:/\s+/,group:Ro.SKIPPED}),ma=Uo({name:"String",pattern:/"(""|[^"])*"/}),Ea=Uo({name:"SingleQuotedString",pattern:/'(''|[^'])*'/}),ga=Uo({name:"SheetQuoted",pattern:/'((?![\\/[\]*?:]).)+?'!/}),Ta=Uo({name:"FunctionToken",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\(/}),Aa=Uo({name:"NamedTableReference",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\[/}),Ia=Uo({name:"BracketedString",pattern:/\[([^[\]]*)\]/,longer_alt:[Aa,ma]}),va=Uo({name:"LiteralError",pattern:/#PARSE!|#NULL!|#DIV\/0!|#VALUE!|#NUM!|#FIELD!|#N\/A|#GETTING_DATA|#SPILL!|#CONNECT!|#BLOCKED!|#UNKNOWN!|#FIELD!|#CALC!|#BUSY!|#PYTHON!|#TIMEOUT!/}),Na=Uo({name:"RefError",pattern:/#REF!|#NAME\?/}),ya=Uo({name:"Sheet",pattern:/[A-Za-z_.\d\u007F-\uFFFF]+!/}),Ra=/^[a-zA-Z_][a-zA-Z0-9_.?]*:?/,Oa=Uo({name:"Name",pattern:{exec:(e,t)=>{try{const n=Ra.exec(e.substring(t));if(n){const e=n[0];if(e.endsWith(":")){const t=e.length;return"."===e[t-2]?[e.substring(0,t-2)]:[e.substring(0,t-1)]}return[e]}}catch(e){console.warn("Error parsing name",e)}return null}},line_breaks:!1,start_chars_hint:(()=>{const 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})()}),Sa=Uo({name:"Cell",pattern:/[$]?[A-Za-z]{1,3}[$]?[1-9][0-9]*/,longer_alt:Oa}),_a=Uo({name:"Column",pattern:/[$]?[A-Za-z]{1,3}/,longer_alt:Oa}),La=Uo({name:"AbsRow",pattern:/[$][0-9]+/,longer_alt:Oa}),xa=Uo({name:"NumberToken",pattern:/[0-9]+[.]?[0-9]*([eE][+-][0-9]+)?/}),Ca=Uo({name:"Boolean",pattern:/TRUE|FALSE/i}),ka=Uo({name:"Comma",pattern:/,/}),ba=Uo({name:"RangeUnion",pattern:/:/}),Pa=Uo({name:"RangeTrimFull",pattern:/\.:\./}),wa=Uo({name:"RangeTrimLeading",pattern:/\.:/}),Ma=Uo({name:"RangeTrimTrailing",pattern:/:\./}),Ua=Uo({name:"Semicolon",pattern:/;/}),Fa=Uo({name:"OpenParen",pattern:/\(/}),Da=Uo({name:"CloseParen",pattern:/\)/}),ja=Uo({name:"OpenSquareParen",pattern:/\[/}),Ba=Uo({name:"CloseSquareParen",pattern:/]/});Uo({name:"exclamationMark",pattern:/!/});const $a=Uo({name:"OpenCurlyParen",pattern:/{/}),Wa=Uo({name:"CloseCurlyParen",pattern:/}/}),Ga=Uo({name:"QuoteS",pattern:/'/}),Ka=Uo({name:"MulOp",pattern:/\*/}),za=Uo({name:"PlusOp",pattern:/\+/}),Va=Uo({name:"DivOp",pattern:/\//}),Ha=Uo({name:"MinOp",pattern:/-/}),Ya=Uo({name:"ImplicitIntersectOp",pattern:/@/}),Xa=Uo({name:"ConcatOp",pattern:/&/}),qa=Uo({name:"ExOp",pattern:/\^/}),Za=Uo({name:"PercentOp",pattern:/%/}),Qa=Uo({name:"TableSpecifier",pattern:/#(All|Data|Headers|Totals|This Row)/i}),Ja=Uo({name:"ArrayAnchorOp",pattern:/#/,longer_alt:[Qa,va,Na]}),ec=Uo({name:"GtOp",pattern:/>/}),tc=Uo({name:"EqOp",pattern:/=/}),nc=Uo({name:"LtOp",pattern:/</}),rc=[pa,ma,ga,Ea,Ta,Aa,Ia,va,Na,ya,Sa,Ca,_a,La,Qa,Ja,Ya,Oa,xa,ka,Pa,wa,Ma,ba,Ua,Fa,Da,ja,Ba,$a,Wa,Ga,Ka,za,Va,Ha,Xa,qa,Ka,Za,Uo({name:"NeqOp",pattern:/<>/}),Uo({name:"GteOp",pattern:/>=/}),Uo({name:"LteOp",pattern:/<=/}),ec,tc,nc],ic=new Ro(rc,{ensureOptimizations:!0}),oc={};rc.forEach(e=>{oc[e.name]=e});const sc={boolean:3,string:2,number:1},ac=(e,t)=>{let n=e+t;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},cc=(e,t)=>{let n=e-t;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},uc=(e,t)=>{let n=e*t;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},lc=(e,t)=>{if(0===t)return 1/0;let n=e/t;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},hc=(e,t)=>{const n=e**t;return isFinite(n)?n:Number.NaN},fc=(e="",t="")=>{null===e&&(e=""),null===t&&(t="");return"boolean"===typeof e&&(e=e?"TRUE":"FALSE"),"boolean"===typeof t&&(t=t?"TRUE":"FALSE"),""+e+t},dc=(e=null,t=null)=>typeof e===typeof t&&e===t,pc=(e=null,t=null)=>typeof e!==typeof t||e!==t,mc=(e=null,t=null)=>{const n=typeof e,r=typeof t;return n===r?e>t:sc[n]>sc[r]},Ec=(e=null,t=null)=>{const n=typeof e,r=typeof t;return n===r?e>=t:sc[n]>=sc[r]},gc=(e=null,t=null)=>{const n=typeof e,r=typeof t;return n===r?e<t:sc[n]<sc[r]},Tc=(e=null,t=null)=>{const n=typeof e,r=typeof t;return n===r?e<=t:sc[n]<=sc[r]},Ac={type:r.Number,coerce:!0,includeBoolean:!0,includeMistyped:!0,mismatchFill:e.BuiltIn.NA},Ic={type:r.String,coerce:!0,includeMistyped:!0,mismatchFill:e.BuiltIn.NA},vc={type:null,coerce:!0,includeMistyped:!0,mismatchFill:e.BuiltIn.NA},Nc=(t,o,s,a)=>{if(null!==o&&void 0!==o.colStart&&(o=t.getValueAt(o.rowStart,o.colStart)),null!==s&&void 0!==s.colStart&&(s=t.getValueAt(s.rowStart,s.colStart)),"number"==typeof o&&"number"==typeof s)return a(o,s);let c,u;if(o?.isIRange?c=o:s?.isIRange&&(u=s),!c&&!u){const t=!1;return o=n(o,i(o,!0),r.Number,!0,t),s=n(s,i(s,!0),r.Number,!0,t),o instanceof e.Value?o:s instanceof e.Value?s:a(o,s)}return c||(c=t.getRange(o)),c.broadcast(s,a,Ac).fillEmpty(0)},yc=(e,t,n,r)=>{let i,o;return null!==t&&void 0!==t.colStart&&(t=e.getValueAt(t.rowStart,t.colStart)),null!==n&&void 0!==n.colStart&&(n=e.getValueAt(n.rowStart,n.colStart)),t?.isIRange?(i=t,o=n):n?.isIRange&&(i=n,o=t),i?i.broadcast(o,r,vc):r(t,n)},Rc=(t,o)=>{null==o&&(o=0);let s,a=1;if("+"===t)return o;if("-"!==t)throw new e.Value(`Unrecognized prefix: ${t}`);return a=-a,o?.isIRange&&(s=o),s?s.broadcast(a,uc,vc):"number"!=typeof(o=n(o,i(o,!0),r.Number))||isNaN(o)?e.BuiltIn.Value:o*a},Oc=(t,n,r,i)=>{if(!n)return e.BuiltIn.Ref;if(n.isIReferenceRange&&(n=n.getCoords()),void 0===n.colStart)return e.BuiltIn.Ref;if(r.isIReferenceRange&&(r=r.getCoords()),void 0===r.colStart)return e.BuiltIn.Ref;const o=i(n,r);return o?t.getReference(o):e.BuiltIn.Null},Sc={"+":(e,t,n)=>Nc(e,t,n,ac),"-":(e,t,n)=>Nc(e,t,n,cc),"*":(e,t,n)=>Nc(e,t,n,uc),"/":(e,t,n)=>Nc(e,t,n,lc),"^":(e,t,n)=>Nc(e,t,n,hc)," ":(e,n,r,i)=>Oc(e,n,r,t.intersectRanges),":":(e,n,r,i)=>Oc(e,n,r,t.unionRanges),".:.":(e,n,r,i)=>{const o=Oc(e,n,r,t.unionRanges);return e.getFunction("TRIMRANGE").execute(o,3,3)},".:":(e,n,r,i)=>{const o=Oc(e,n,r,t.unionRanges);return e.getFunction("TRIMRANGE").execute(o,1,1)},":.":(e,n,r,i)=>{const o=Oc(e,n,r,t.unionRanges);return e.getFunction("TRIMRANGE").execute(o,2,2)},"&":(e,t,o)=>((e,t,o,s)=>{if(null!==t&&void 0!==t.colStart&&(t=e.getValueAt(t.rowStart,t.colStart)),null!==o&&void 0!==o.colStart&&(o=e.getValueAt(o.rowStart,o.colStart)),"string"==typeof t&&"string"==typeof o)return s(t,o);let a,c;return t?.isIRange?a=t:o?.isIRange&&(c=o),a||c?(a||(a=e.getRange(t)),a.broadcast(o,s,Ic)):s(t=n(t,i(t,!0),r.String),o=n(o,i(o,!0),r.String))})(e,t,o,fc),"=":(e,t,n)=>yc(e,t,n,dc),"<>":(e,t,n)=>yc(e,t,n,pc),">":(e,t,n)=>yc(e,t,n,mc),"<":(e,t,n)=>yc(e,t,n,gc),">=":(e,t,n)=>yc(e,t,n,Ec),"<=":(e,t,n)=>yc(e,t,n,Tc)},_c={"-":(e,t)=>Rc("-",t),"+":(e,t)=>Rc("+",t),"@":(t,n)=>{if(!n||!n.isIReferenceRange)return n;const r=n.getCoords(),i=n,o=t.getPosition(),s=i.getHeight(),a=i.getWidth();if(a>1&&s>1)return e.BuiltIn.Value;if(s>1){const e=o.rowIndex-r.rowStart;if(e>=0&&e<s)return i.getValueAt(e,0)}else{if(!(a>1))return i.getValueAt(0,0);{const e=o.colIndex-r.colStart;if(e>=0&&e<a)return i.getValueAt(0,e)}}return e.BuiltIn.Value}},Lc={"%":(e,t)=>Nc(e,t,100,lc),"#":(t,n)=>{const r=t.getSpillAt(n.rowStart,n.colStart);return r||e.BuiltIn.Ref}};function xc(e){const t=(e=e.toUpperCase()).length;let n=0;for(let r=0;r<t;r++){const i=e.charCodeAt(r);isNaN(i)||(n+=(i-64)*26**(t-r-1))}return n}function Cc(e){return{type:"cell",value:Object.freeze({colIndex:e.colIndex,rowIndex:e.rowIndex,$colIndex:e.$colIndex||!1,$rowIndex:e.$rowIndex||!1}),inputs:null,isReference:!0}}function kc(e,t){const n=e.startsWith("$");n&&(e=e.substring(1));let r=parseInt(e)-1;return n||r===Number.MIN_SAFE_INTEGER||(r-=t.colIndex),{type:"cell",value:Object.freeze({colIndex:Number.MIN_SAFE_INTEGER,$colIndex:!1,rowIndex:r,$rowIndex:n}),inputs:null,isReference:!0}}function bc(e,t){return{type:"function",value:e=e.toUpperCase(),inputs:t}}function Pc(e,t){return{type:"tableReference",value:e,inputs:t}}function wc(e){return{type:"tableSpecifier",value:e,inputs:null,isReference:!0}}function Mc(e,t,n,r=!1){const i={type:"infix",value:e,inputs:[t,n]};return r&&(i.isReference=!0),i}function Uc(e,t,n=!1){const r={type:"postfix",value:e,inputs:[t]};return n&&(r.isReference=!0),r}function Fc(e,t,n=!1){const r={type:"prefix",value:e,inputs:[t]};return n&&(r.isReference=!0),r}function Dc(e){return{type:"named",value:e,inputs:null,isReference:!0}}function jc(e){return{type:"number",value:Number(e),isLiteral:!0}}function Bc(e){let t=e;const n=e&&e.length>1&&'"'===e[0]&&'"'===e[e.length-1];return n&&(t=e.substring(1,e.length-1)),{type:n?"quotedString":"string",value:t,isLiteral:!0}}function $c(e){return{type:"boolean",value:"TRUE"===e||"TRUE"===e.toUpperCase(),isLiteral:!0}}function Wc(t){return{type:"error",value:e.getBuiltInByLabel(t.toUpperCase()),isLiteral:!0}}function Gc(t){return{type:"error",value:t?e.getBuiltInByLabel(t.toUpperCase()):e.BuiltIn.Ref,inputs:null,isReference:!0}}function Kc(e,t){const n=function e(n,r){const i=n.inputs;let o;if(i){const t=i.length;for(let r=0;r<t;r++){const t=i[r],s=e(t,n);s!==t&&(o||(o=[...i]),o[r]=s)}}const s=o?{...n,inputs:o}:n,a=t(s,r);return void 0===a?s:a}(e,void 0);return n||this}function zc(e,t){let n=0,r=Kc(e,e=>{const t={...e};return t.evalIndex=n++,t});const i=new Array(n),s=new Set,a=new Map;let c;const u=new Map,l=[],h=[];r=Kc(r,(e,t)=>{const n=e.type,r=e.evalIndex;if(i[r]=null,e.isReference){const t=e,r={node:e,index:u.size,op:null,value:null,inputs:null};if(u.set(t,r),"cell"===n){const n=t.value;return n.$colIndex&&(r.hasHorizontalAbs=!0),n.$rowIndex&&(r.hasVerticalAbs=!0),r.value=a.size,a.set(t,a.size),s.add(r),e.refIndex=h.length,void h.push(r.index)}if("infix"===n||"prefix"===n||"postfix"===n||"spill"===n){const n=t.inputs,i=n.length,o=e.value;r.op=o;const a=new Array(i);r.inputs=a;for(let e=0;e<i;e++){const t=n[e],i=u.get(t);i&&(i.hasHorizontalAbs&&(r.hasHorizontalAbs=!0),i.hasVerticalAbs&&(r.hasVerticalAbs=!0)),a[e]=i?i.index:-1,s.delete(i)}if(s.add(r),qc.includes(o)){const t=n[0],i=!!t&&"cell"===t.type,o=n[1],s=!!o&&"cell"===o.type;i&&s&&(h.splice(o.refIndex,1),o.refIndex=t.refIndex,e.refIndex=t.refIndex,h[t.refIndex]=r.index)}else"#"===o&&(e.refIndex=n[0].refIndex);return void l.push(e)}if("error"===n||"named"===n){c||(c=new Map);const i=t.value;let o=c.get(i);return r.op=n,void 0===o&&(o=c.size,c.set(i,o)),r.value=o,s.add(r),e.refIndex=h.length,void h.push(r.index)}"tableReference"===n&&(r.op=n),"tableSpecifier"===n&&(r.op=n),"structuredArg"===n&&(r.op=n)}else if(t&&t.isReference){const t=e,n={node:e,index:u.size,op:"function",value:e.value,inputs:null};u.set(t,n)}if(e.isLiteral)if("array"!==n)i[r]=e.value;else{const t=e.value,n=t.length,s=new Array(n);for(let e=0;e<n;e++){const n=t[e].value,r=n.length,i=new Array(r);for(let e=0;e<r;e++){const t=n[e];let r=t.value;if("prefix"===t.type){const e=t.value;r=t.inputs[0].value,"-"===e&&(r=-r)}i[e]=r}s[e]=i}i[r]=o(s)}else{if("empty"!==n)return l.push(e),e;i[r]=void 0}});const f=new Array(a.size);a.forEach((e,t)=>{const n=t.value,r=n.colIndex,i=n.rowIndex,o=n.$colIndex,s=n.$rowIndex,a={colStart:r,rowStart:i,colEnd:r,rowEnd:i,$colStart:o,$rowStart:s,$colEnd:o,$rowEnd:s};r===Number.MIN_SAFE_INTEGER&&(a.colEnd=Number.MAX_SAFE_INTEGER),i===Number.MIN_SAFE_INTEGER&&(a.rowEnd=Number.MAX_SAFE_INTEGER),n.sheetName&&(a.sheetName=n.sheetName),f[e]=a});const d=f.length,p=new Array(d);for(let e=0;e<d;e++)p[e]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,sheetName:null};const m=new Array(u.size);let E;u.forEach(e=>{m[e.index]=e}),c&&(E=[],c.forEach((e,t)=>{E.push(t)}));const g=[];s.forEach(e=>{g.push(e.index)});const T=l.length;for(let e=0;e<T;e++){const t=l[e],n=t.type;if("infix"===n){const e=t.value;t.fn=Sc[e]}else if("prefix"===n){const e=t.value;t.fn=_c[e]}else if("postfix"===n){const e=t.value;t.fn=Lc[e]}}const A=function(e){const t=[],n=(e,n)=>{const r={type:e.type,value:e.value};void 0!==e.evalIndex&&(r.evalIndex=e.evalIndex),void 0!==e.refIndex&&(r.refIndex=e.refIndex),n&&(r.ctx=n),t.push(r)},r=(e,n,r,i)=>{if(null==n)return;if(t.length>1&&"whitespace"===e&&"whitespace"===t[t.length-1].type)return;const o={type:e,value:n};r&&(o.ctx=r),void 0!==i&&(o.evalIndex=i),t.push(o)};!function e(t,i,o){const s=t.evalIndex??o??0,a=t.type,c=(t,n,i)=>{if(!t)return;const o=t.length;for(let s=0;s<o;s++)e(t[s],n,i),s<o-1&&r("comma",",",n)};if(t.isLiteral){if(r("whitespace",t.wsBefore,i),"array"===a){r("type","{",i);const n=t.value,o=n.length;for(let t=0;t<o;t++){const a=n[t],c=a.value,u=c.length;for(let t=0;t<u;t++){const n=c[t];r("whitespace",n.wsBefore,i),e(n,i,s),r("whitespace",n.wsAfter,i),t<u-1&&r("comma",",",i)}t<o-1&&(r("whitespace",a.wsBefore,i),r("comma",";",i),r("whitespace",a.wsAfter,i))}t.error||r("type","}",i)}else"quotedString"===a?(t={type:a,value:'"'+t.value+'"'},n(t,i)):n(t,i);r("whitespace",t.wsAfter,i)}else if("infix"===a)e(t.inputs[0],i,s),r("whitespace",t.wsBefore,i),n(t,i),r("whitespace",t.wsAfter,i),e(t.inputs[1],i,s);else if("prefix"===a)r("whitespace",t.wsBefore,i),n(t,i),r("whitespace",t.wsAfter,i),e(t.inputs[0],i,s);else if("postfix"===a)e(t.inputs[0],i,s),r("whitespace",t.wsBefore,i),n(t,i),r("whitespace",t.wsAfter,i);else{r("whitespace",t.wsBefore,i);const o=t.inputs;switch(a){case"function":n(t,i);const u={name:String(t.value),argIndex:-1};if(r("paren","(",u,t.evalIndex),o){const t=o.length;for(let n=0;n<t;n++){const i={...u,argIndex:n};e(o[n],i,s),n<t-1&&r("comma",",",i)}}t.error||r("paren",")",u,t.evalIndex);break;case"cell":n(t,i);break;case"paren":r(a,"(",i,s),c(o,i,s),t.error||r(a,")",i,s);break;case"squareParen":r(a,"[",i,s),c(o,i,s),t.error||r(a,"]",i,s);break;case"tableReference":n(t,i);const l={name:String(t.value),argIndex:-1};if(r("paren","[",l),o){const t=o.length;for(let n=0;n<t;n++){const i={...l,argIndex:n};e(o[n],i,s),n<t-1&&r("comma",",",i)}}t.error||r("paren","]",l);break;default:void 0!==t.value&&n(t,i),o&&o.forEach(t=>e(t,i,s))}r("whitespace",t.wsAfter,i)}}(e);const i=t.length;for(let e=0;e<i;e++){const n=t[e];if("whitespace"===n.type&&void 0===n.evalIndex){const r=t[e+1];r&&void 0!==r.evalIndex&&(n.evalIndex=r.evalIndex)}}return t}(r);return{ast:r,evaluations:i,executions:l,precedentsAbsolute:p,precedentsExecute:m,precedentsNamed:E,precedentsRelative:f,precedentsRoot:g,references:h,tokens:A,error:t}}function Vc(t,n){let r,i=-1,o="";Number.isSafeInteger(t.previousToken?.startLine)?(i=t.previousToken.startLine,r=t.previousToken.endColumn+1):Number.isSafeInteger(t.token?.startLine)&&(i=t.token.startLine,r=t.token.startColumn),-1!==i?(o+="\n"+n.split("\n")[i-1]+"\n",o+=Array(r-1).fill(" ").join("")+"^\n",o+=`Error at position ${i}:${r}\n`+t.message,t.errorLocation={line:i,column:r}):o=n+"\n"+t.message;const s=new e.Parse(o);return s.details=t,s}const Hc=function(e,t){return t.wsBefore&&(e.wsBefore=t.wsBefore),t.wsAfter&&(e.wsAfter=t.wsAfter),t.image&&(e.image=t.image),e},Yc="_XLFN.",Xc=Object.freeze([[":",".:.",".:",,":."],["^"],["*","/"],["+","-"],["&"],["<",">","=","<>","<=",">="]]),qc=Object.freeze([":",".:.",".:",,":."]),Zc=Object.freeze([":"," ",".:.",".:",,":."]),Qc=Object.freeze(["@"]),Jc=Object.freeze(["#"]),eu=Object.freeze(Zc.concat(Qc).concat(Jc)),{String:tu,SheetQuoted:nu,SingleQuotedString:ru,FunctionToken:iu,NamedTableReference:ou,LiteralError:su,RefError:au,Cell:cu,Sheet:uu,Name:lu,NumberToken:hu,Boolean:fu,Column:du,AbsRow:pu,ImplicitIntersectOp:mu,Comma:Eu,RangeUnion:gu,RangeTrimFull:Tu,RangeTrimLeading:Au,RangeTrimTrailing:Iu,Semicolon:vu,OpenParen:Nu,CloseParen:yu,OpenSquareParen:Ru,CloseSquareParen:Ou,OpenCurlyParen:Su,CloseCurlyParen:_u,MulOp:Lu,PlusOp:xu,DivOp:Cu,MinOp:ku,ConcatOp:bu,ExOp:Pu,PercentOp:wu,ArrayAnchorOp:Mu,TableSpecifier:Uu,BracketedString:Fu,NeqOp:Du,GteOp:ju,LteOp:Bu,GtOp:$u,EqOp:Wu,LtOp:Gu}=oc;class Ku extends da{constructor(){super(oc,{nodeLocationTracking:"full",maxLookahead:1,skipValidations:!0,recoveryEnabled:!0}),this.position={colIndex:0,rowIndex:0},this.astErrors=[];const e=this,t=(t,n,r)=>{let i;e.CONSUME(n);const o=e.getLexerPosition();i=e.ACTION(()=>(i={type:t,value:null,inputs:null},this._ensureWhitespace(i,o,!0)));const s=[],a=e.SUBRULE(e.intersectOp);a&&s.push(a);const c=e.SUBRULE(e.group),u=e.OPTION(()=>this.CONSUME(r));return i=e.ACTION(()=>{if(c)for(let e=0;e<c.length;e++)s.push(c[e]);return i&&(u||this._reportError(i,"Missing closing parenthesis",o),i.inputs=s),this._ensureWhitespace(i,e.getLexerPosition(),!1,!0)}),i};e.RULE("infixOp",()=>{const t=[],n=[e.SUBRULE(e.postfixOp)];return e.MANY(()=>{const r=e.OR(e.c1||(e.c1=[{ALT:()=>e.CONSUME(gu).image},{ALT:()=>e.CONSUME(xu).image},{ALT:()=>e.CONSUME(ku).image},{ALT:()=>e.CONSUME(Lu).image},{ALT:()=>e.CONSUME(Cu).image},{ALT:()=>e.CONSUME(Pu).image},{ALT:()=>e.CONSUME(bu).image},{ALT:()=>e.CONSUME($u).image},{ALT:()=>e.CONSUME(Wu).image},{ALT:()=>e.CONSUME(Gu).image},{ALT:()=>e.CONSUME(Du).image},{ALT:()=>e.CONSUME(ju).image},{ALT:()=>e.CONSUME(Bu).image},{ALT:()=>e.CONSUME(Tu).image},{ALT:()=>e.CONSUME(Au).image},{ALT:()=>e.CONSUME(Iu).image}]));t.push([r,e.getLexerPosition(),eu.includes(r)]),n.push(e.SUBRULE2(e.postfixOp))}),e.ACTION(()=>{let e=t.length;const r=Xc.length;for(let i=0;e>0&&i<r;i++){const r=Xc[i];let o=t.length;for(let i=0;i<o;i++){const s=t[i],a=s[0];if(!r.includes(a))continue;let c=Mc(a,n[i],n[i+1],s[2]);c=this._ensureWhitespace(c,s[1]),t.splice(i,1),n.splice(i,2,c),i--,o--,e--}}}),n[0]}),e.RULE("plusMinusOp",()=>e.OR([{ALT:()=>e.CONSUME(xu).image},{ALT:()=>e.CONSUME(ku).image}])),e.RULE("postfixOp",()=>{let t=e.SUBRULE(e.prefixOp);const n=[];return e.MANY(()=>{const t=e.OR([{ALT:()=>e.CONSUME(wu).image},{ALT:()=>e.CONSUME(Mu).image}]);e.ACTION(()=>{n.push([t,e.getLexerPosition()])})}),e.ACTION(()=>{const e=n.length;if(0!==e)for(let r=0;r<e;r++){const e=n[r],i=e[0],o=e[1],s=eu.includes(i);t=Uc(i,t,s),t=this._ensureWhitespace(t,o)}}),t}),e.RULE("prefixOp",()=>{const t=[];e.MANY(()=>{const n=e.OR([{ALT:()=>e.CONSUME(xu).image},{ALT:()=>e.CONSUME(ku).image},{ALT:()=>e.CONSUME(mu).image}]);e.ACTION(()=>{t.push([n,e.getLexerPosition()])})});let n=e.SUBRULE(e.formula);return e.ACTION(()=>{const e=t.length;if(0!==e)for(let r=e-1;r>=0;r--){const e=t[r],i=e[0],o=e[1],s=eu.includes(i);n=Fc(i,n,s),n=this._ensureWhitespace(n,o)}}),n}),e.RULE("intersectOp",()=>{const t=[e.SUBRULE(e.infixOp)];return e.MANY(()=>{e.OPTION({GATE:()=>{const t=e.LA(0);return e.LA(1).startOffset>t.endOffset+1},DEF:()=>{t.push(e.SUBRULE3(e.infixOp))}})}),e.ACTION(()=>{for(;t.length>1;){let e=t.length-1;for(let n=0;n<e;n++){const r=t[n],i=t[n+1],o=Mc(" ",r,i,!0);if(delete r.wsAfter,i.wsBefore){const e=i.wsBefore.slice(0,-1),t=e.length;delete i.wsBefore,t>0&&(o.wsBefore=e)}n+1<e&&delete i.wsAfter,t.splice(n,2,o),n--,e--}}}),t[0]}),e.RULE("formula",()=>e.OR9([{ALT:()=>e.SUBRULE(e.referenceWithoutInfix)},{ALT:()=>e.SUBRULE(e.function)},{ALT:()=>e.SUBRULE(e.paren)},{ALT:()=>e.SUBRULE(e.namedTableReference)},{ALT:()=>e.SUBRULE(e.bracketedString)},{ALT:()=>e.SUBRULE(e.squareParen)},{ALT:()=>e.SUBRULE(e.literal)},{ALT:()=>e.SUBRULE(e.literalArray)}])),e.RULE("group",()=>{const t=[];return e.MANY(()=>{e.CONSUME(Eu);const n=e.SUBRULE2(e.intersectOp);e.ACTION(()=>{t.push(n)})}),t}),e.RULE("paren",()=>t("paren",Nu,yu)),e.RULE("literalArray",()=>{let t={type:"row",value:[],isLiteral:!0};e.CONSUME(Su);const n=e.getLexerPosition();let r=e.ACTION(()=>this._ensureWhitespace({type:"array",value:[t],isLiteral:!0},n,!0));const i=e.SUBRULE(e.literalForArray);e.ACTION(()=>{t.value.push(i)}),e.MANY(()=>{const n=e.OR([{ALT:()=>e.CONSUME(Eu).image},{ALT:()=>e.CONSUME(vu).image}]),i=e.SUBRULE2(e.literalForArray);e.ACTION(()=>{","===n||(t={type:"row",value:[],isLiteral:!0},r.value.push(t)),t.value.push(i)})});const o=e.OPTION(()=>this.CONSUME(_u));return r=e.ACTION(()=>(o||this._reportError(r,"Missing closing parenthesis '}'",n),this._ensureWhitespace(r,e.getLexerPosition(),!1,!0))),r}),e.RULE("literalForArray",()=>e.OR([{ALT:()=>{const t=e.OPTION(()=>e.SUBRULE(e.plusMinusOp)),n=e.CONSUME(hu),r=e.ACTION(()=>this._ensureWhitespace(jc(n.image),e.getLexerPosition()));return t?e.ACTION(()=>function(e,t){return{type:"prefix",value:e,inputs:[t]}}(t,r)):r}},{ALT:()=>{const t=e.CONSUME(tu);return e.ACTION(()=>this._ensureWhitespace(Bc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(fu);return e.ACTION(()=>this._ensureWhitespace($c(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(su);return e.ACTION(()=>this._ensureWhitespace(Wc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(au);return e.ACTION(()=>this._ensureWhitespace(Gc(t.image),e.getLexerPosition()))}}])),e.RULE("literal",()=>e.OR([{ALT:()=>{const t=e.CONSUME(hu);return e.ACTION(()=>this._ensureWhitespace(jc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(tu);return e.ACTION(()=>this._ensureWhitespace(Bc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(fu);return e.ACTION(()=>this._ensureWhitespace($c(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(su);return e.ACTION(()=>this._ensureWhitespace(Wc(t.image),e.getLexerPosition()))}}])),e.RULE("function",()=>{const t=e.CONSUME(iu).image.slice(0,-1),n=e.getLexerPosition(),r=e.SUBRULE(e.functionArguments);let i=e.ACTION(()=>this._ensureWhitespace(bc(t,r),n,!0));const o=e.OPTION(()=>this.CONSUME(yu));return i=e.ACTION(()=>(o||this._reportError(i,"Missing closing parenthesis ')'",n),this._ensureWhitespace(i,e.getLexerPosition(),!1,!0))),i}),e.RULE("functionArguments",()=>{const t=[];return e.MANY2(()=>{let n;e.CONSUME2(Eu),n=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),t.push(n)}),e.OPTION(()=>{t.push(e.SUBRULE(e.intersectOp)),e.MANY(()=>{let n;e.CONSUME1(Eu),n=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),t.push(n),e.OPTION3(()=>{t.pop(),t.push(e.SUBRULE2(e.intersectOp))})})}),t}),e.RULE("bracketedString",()=>{const t=e.CONSUME(Fu),n=e.getLexerPosition();return e.ACTION(()=>{const r=t.image;let i=Pc("",[wc(r.substring(1,r.length-1))]);return i=this._ensureWhitespace(i,n,!0,!1),i=this._ensureWhitespace(i,e.getLexerPosition(),!1,!0),i})}),e.RULE("squareParen",()=>{e.CONSUME(Ru);const t=e.getLexerPosition();let n=Pc("",[e.SUBRULE(e.structuredArgument)]);const r=e.OPTION(()=>this.CONSUME(Ou));return e.ACTION(()=>{r||this._reportError(n,"Missing closing parenthesis ']'",t),n=this._ensureWhitespace(n,t,!0,!1),n=this._ensureWhitespace(n,e.getLexerPosition(),!1,!0)}),n}),e.RULE("namedTableReference",()=>{const t=e.CONSUME(ou).image.slice(0,-1),n=e.getLexerPosition(),r=e.SUBRULE(e.structuredArguments);let i=e.ACTION(()=>this._ensureWhitespace(Pc(t,r),n,!0));const o=e.OPTION(()=>this.CONSUME(Ou));return i=e.ACTION(()=>(o||this._reportError(i,"Missing closing parenthesis ']'",n),this._ensureWhitespace(i,e.getLexerPosition(),!1,!0))),i}),e.RULE("structuredArguments",()=>{const t=[];return e.MANY2(()=>{e.CONSUME2(Eu),e.ACTION(()=>{t.push(this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0))})}),e.OPTION(()=>{const n=e.SUBRULE(e.structuredArgument);e.ACTION(()=>{n&&t.push(n)}),e.MANY(()=>{e.CONSUME1(Eu),e.OPTION3(()=>{let n=e.SUBRULE2(e.structuredArgument);e.ACTION(()=>{n||(n=this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),t.push(n)})})})}),t}),e.RULE("structuredArgument",()=>{const t=e.OPTION(()=>e.CONSUME(mu)),n=e.getLexerPosition(),r=e.OPTION2(()=>this.CONSUME(Ru));let i=e.OR([{ALT:()=>{const t=e.CONSUME(Uu);return e.ACTION(()=>this._ensureWhitespace(wc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(Fu);return e.ACTION(()=>this._ensureWhitespace(wc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(lu);return e.ACTION(()=>this._ensureWhitespace(Dc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(ru);return e.ACTION(()=>this._ensureWhitespace(Bc(t.image),e.getLexerPosition()))}}]);if(r){const t=e.OPTION3(()=>this.CONSUME(yu));e.ACTION(()=>(t||this._reportError(i,"Missing closing parenthesis ']'",n),this._ensureWhitespace(i,e.getLexerPosition(),!1,!0))),i={type:"structuredArg",value:null,inputs:[i]}}return e.ACTION(()=>{t&&(i=Fc(t.image,i,!0),i=this._ensureWhitespace(i,e.getLexerPosition()))}),i}),e.RULE("referenceWithoutInfix",()=>e.OR([{ALT:()=>e.SUBRULE(e.reference)},{ALT:()=>{const t=e.SUBRULE(e.prefixSheetName),n=e.SUBRULE2(e.formula);return e.ACTION(()=>{if((e=n)&&e.isFormulaError)return n;var e;n.ref&&(n.ref.sheet=t)}),n}}])),e.RULE("reference",()=>{const t=e.OPTION4(()=>e.CONSUME(mu));let n=e.OR([{ALT:()=>{const t=e.CONSUME(cu),n=e.getLexerPosition(),r=e.OPTION(()=>e.CONSUME(Mu));return e.ACTION(()=>{const i=this._ensureWhitespace(function(e,t){const n=e.match(/([$]?)([A-Za-z]{1,3})([$]?)([1-9][0-9]*)/);let r=xc(n[2])-1;const i=1===n[1].length;let o=+n[4]-1;const s=1===n[3].length;return i||r===Number.MIN_SAFE_INTEGER||(r-=t.colIndex),s||o===Number.MIN_SAFE_INTEGER||(o-=t.rowIndex),{type:"cell",value:Object.freeze({colIndex:r,rowIndex:o,$colIndex:i,$rowIndex:s}),inputs:null,isReference:!0}}(t.image,e.position),n);return r?this._ensureWhitespace(Uc("#",i,!0),n):i})}},{ALT:()=>{const t=e.CONSUME(lu);return e.ACTION(()=>this._ensureWhitespace(Dc(t.image),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(du);return e.ACTION(()=>this._ensureWhitespace(function(e,t){const n=e.startsWith("$");n&&(e=e.substring(1));let r=xc(e)-1;return n||r===Number.MIN_SAFE_INTEGER||(r-=t.colIndex),{type:"cell",value:Object.freeze({colIndex:r,rowIndex:Number.MIN_SAFE_INTEGER,$colIndex:n,$rowIndex:!1}),inputs:null,isReference:!0}}(t.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(pu);return e.ACTION(()=>this._ensureWhitespace(kc(t.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const t=e.CONSUME(au);return e.ACTION(()=>this._ensureWhitespace(Gc(t.image),e.getLexerPosition()))}}]);return e.ACTION(()=>{t&&(n=Fc(t,n,!0),n=this._ensureWhitespace(n,e.getLexerPosition()))}),n}),e.RULE("prefixSheetName",()=>e.OR([{ALT:()=>e.CONSUME(uu).image.slice(0,-1)},{ALT:()=>e.CONSUME(nu).image.slice(1,-2).replace(/''/g,"'")}])),e.performSelfAnalysis()}_reportError(e,t,n=void 0,r="SyntaxError"){void 0===n&&(n=this.getLexerPosition()),e.error=!0,this.astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_ensureWhitespace(e,t,n=!1,r=!1){if(!e)return console.warn("node is null"),e;const i=this.input,o=i[t];if(e.image||(e.image=o.image),!r){const n=o.startOffset,r=i[t-1],s=r?.endOffset??-1;s+1<n&&(e.wsBefore=" ".repeat(n-s-1))}if(!n){const n=o.endOffset,r=i[t+1],s=r?.startOffset??this.inputTextLength;n+1<s&&(e.wsAfter=" ".repeat(s-n-1))}return e}_createAST(t,n){const r=function(t){const n=ic.tokenize(t);if(n.errors.length>0){const r=n.errors[0],i=r.line,o=r.column;let s="\n"+t.split("\n")[i-1]+"\n";throw s+=Array(o-1).fill(" ").join("")+"^\n",r.message=s+`Error at position ${i}:${o}\n`+r.message,r.errorLocation={line:i,column:o},new e.Parse(r.message,{line:i,column:o,offset:r.offset,length:r.length})}return n}(n);let i;if(!r)return i={type:"text",value:n},i;const o=r.tokens;this.input=o,this.inputTextLength=n.length;const s=t.getPosition();return this.position=s,this.astErrors=[],this.reset(),i=this.intersectOp(),i=Kc(i,(e,t)=>{let n=e.type;if("function"===n&&e.value&&e.value.toUpperCase().startsWith(Yc)){const t=e.value.substring(6);let r=e.image.substring(6),i=e;"ANCHORARRAY"===t?(i=Uc("#",e.inputs[0],!0),r="#"):"SINGLE"===t?(i=Fc("@",e.inputs[0],!0),r="@"):i=bc(t,e.inputs),Hc(i,e),i.image=r,n=(e=i).type}const r=t?.isReference;if(r){const n=t.value;if((":"===n||".:."===n||".:"===n||":."===n)&&Number.isInteger(e.value)){const n=t.inputs[0]===e?t.inputs[1]:t.inputs[0];if(n&&Number.isInteger(n.value)){const t=kc(e.image,s);return Hc(t,e),t}}}else if("cell"===n){const t=e.value;if(t.rowIndex===Number.MIN_SAFE_INTEGER||t.colIndex>=16384){const t=Dc(e.image);return Hc(t,e),t}}return e}),i}build(t,n){if(0===n.length)throw Error("Input must not be empty.");let r,i,o;try{r=this._createAST(t,n)}catch(t){o=t instanceof e.Parse?t:new e.Parse(t.message,t)}const a=this.errors;if(a.length>0){o=Vc(a[0],n)}const c=this.astErrors;if(c.length>0){o=Vc(c[0],n)}return i=r?zc(r,o):{ast:null,evaluations:s.EmptyArray,executions:s.EmptyArray,precedentsAbsolute:s.EmptyArray,precedentsExecute:s.EmptyArray,precedentsNamed:null,precedentsRelative:s.EmptyArray,precedentsRoot:s.EmptyArray,references:s.EmptyArray,tokens:s.EmptyArray,error:o},i}}class zu{constructor(e,t){this._options=e,this._compiled=t}getTextAt(e,t,n=!1){return n?c(this._compiled.tokens):a(this._compiled.tokens,e,t)}getTokens(){return this._compiled.tokens}getError(){return this._compiled.error??null}isEquals(e){if(!(e&&e instanceof zu))return!1;if(this===e)return!0;const t=this._compiled.tokens,n=e._compiled.tokens;if(t.length!==n.length)return!1;return c(t)===c(n)}getReferences(){const e=this._compiled,t=e.references,n=t.length;if(0===n)return s.EmptyArray;const r=e.precedentsExecute,i=e.precedentsRelative,o=new Array(n);for(let s=0;s<n;s++){const n=r[t[s]],a=n.inputs;if(a&&2===a.length){const e=i[r[a[0]].value],t=i[r[a[1]].value];o[s]={colStart:e.colStart,rowStart:e.rowStart,colEnd:t.colEnd,rowEnd:t.rowEnd,$colStart:e.$colStart,$rowStart:e.$rowStart,$colEnd:t.$colEnd,$rowEnd:t.$rowEnd,sheetName:e.sheetName}}else if("cell"===n.node.type){const e=i[n.value];o[s]={...e}}else if("named"===n.op){const t=e.precedentsNamed;o[s]=t[n.value]}else"error"===n.op&&(o[s]=n.node.value)}return o}setReferenceAt(e,n){const r=this._compiled,i=r.references;if(0===i.length)return s.EmptyArray;const o=r.precedentsExecute,a=i[e];if(void 0===a)throw new Error(`Invalid reference index: ${e}`);const c=o[a],u=c.node,l=u.inputs??s.EmptyArray;let h,f,d=!1;n&&(h={colIndex:n.colStart,rowIndex:n.rowStart,$colIndex:n.$colStart??!1,$rowIndex:n.$rowStart??!1},n.sheetName&&(h.sheetName=n.sheetName),d=!t.isSingleCell(n),d&&(f={colIndex:n.colEnd,rowIndex:n.rowEnd,$colIndex:n.$colEnd??!1,$rowIndex:n.$rowEnd??!1},n.colEnd===Number.MAX_SAFE_INTEGER&&(f.colIndex=Number.MIN_SAFE_INTEGER),n.rowEnd===Number.MAX_SAFE_INTEGER&&(f.rowIndex=Number.MIN_SAFE_INTEGER)));const p=2===l.length;let m=-1,E=-1;if(p)m=l[0].evalIndex,E=l[1].evalIndex;else{if("cell"!==u.type)throw"named"===c.op?new Error("Cannot setReference for a named reference"):new Error(`Invalidate reference index: ${e}`);m=u.evalIndex}const g=this._compiled.ast,T=Kc(g,e=>{if(!e||!e.isReference)return;const t=e.type;if(!n&&qc.includes(e.value)){const e=l[0],t=l[1];let n=e.evalIndex===m,r=t.evalIndex===E;if(n||r){const e=Gc();return e.image="#REF!",e}}if(!("cell"===t||"error"===t))return;const r=e.evalIndex;let i,o=r===m;if(o||r===E){if(n)if(p===d){let t=o?h:f;i={...e},i.value=t,i.image=null}else i=d?Mc(":",Cc(h),Cc(f),!0):Cc(h);else i=Gc(),i.image="#REF!";return i}});if(T===g)return this;const A=zc(T,this._compiled.error),I=this._options;return new zu(I,A)}_resolveNamed(t,n,r,i){const o=this._options?.getNamed;if(!o)return e.BuiltIn.Name;let s=o?.(t,this._options.getSheetName?.())?.[0];return s?(s.isFormulaError||(s=u(s,n,r,i)),s):e.BuiltIn.Name}getDirectPrecedentsAt(n,r,i=!1,o,a){const c=this._compiled,l=c.precedentsRoot,h=l.length;if(0===h)return s.EmptyArray;const f=c.precedentsRelative,d=c.precedentsAbsolute,p=f.length;for(let e=0;e<p;e++){const t=f[e];let i=d[e],o=u(t,n,r,i);d[e]=o}let m=!1;const E=c.precedentsExecute,g=E.length,T=Vu;for(let i=0;i<g;i++){const o=E[i],s=o.op;if(!s){const e=d[o.value];T[o.index]=e;continue}if("named"===s){m=!0,T[o.index]=this._resolveNamed(o.node.value,n,r);continue}if("error"===s){T[o.index]=o.node.value;continue}if("@"===s||"#"===s){T[o.index]=T[o.inputs[0]];continue}const a=o.inputs;if(!a)continue;let c=T[a[0]];if(void 0===c){T[o.index]=e.BuiltIn.Value;continue}if(c.isFormulaError){T[o.index]=c;continue}let u,l=T[a[1]];void 0!==l?l.isFormulaError?T[o.index]=l:(" "===s?u=t.intersectRanges(c,l):":"!==s&&".:."!==s&&":."!==s&&".:"!==s||(u=T[o.index]=t.unionRanges(c,l)),T[o.index]=u??e.BuiltIn.Null):T[o.index]=e.BuiltIn.Value}const A=new Array(h);for(let e=0;e<h;e++){const t=l[e],n=T[t];if(A[e]=void 0!==n?.rowStart?{...n}:n,o||a){const r=E[t];m&&"named"===r.op?(o&&(o[e]=n.$colStart||n.$colEnd),a&&(a[e]=n.$rowStart||n.$rowEnd)):(o&&(o[e]=r.hasVerticalAbs),a&&(a[e]=r.hasHorizontalAbs))}}return A}evaluate(t,n,r){const i=t.getPosition(),o=i?.rowIndex??0,s=i?.colIndex??0;let a=this._compiled;if(void 0!==n){let e;if(Kc(a.ast,t=>{t.evalIndex===n&&(e=t)}),!e)throw new Error(`Invalid evalIndex: ${n}`);a=zc(e,a.error)}if(a.error)return a.error;const c=a.evaluations,l=a.executions;let h,d;r||(r=this._resolvePrecedents(t));const p=a.precedentsExecute,m=a.precedentsRelative,E=a.precedentsAbsolute,g=p.length;for(let e=0;e<g;e++){const n=p[e],r=n.op;if(r){if("named"===r){const e=n.node;let r=this._resolveNamed(n.node.value,o,s);void 0!==r?.colStart&&(r=t.getReference(r)),c[e.evalIndex]=r}else if("error"===r){const e=n.node;c[e.evalIndex]=n.node.value}}else{const t=m[n.value];let r=E[e];const i=u(t,o,s,r),a=n.node;c[a.evalIndex]=i}}const T=a.precedentsRoot,A=T.length;if(A!==r.length)return e.BuiltIn.Parse;for(let e=0;e<A;e++){const t=p[T[e]].node;let n=r[e];n.isIRange&&"cell"===t.type&&n.size>1&&(n=n.getValueAt(0,0)??null),c[t.evalIndex]=n}let I;const v=n=>{const r=n.inputs,i=r?r.length:0;let o;switch(n.type){case"infix":const s=n.value;let a=c[r[0].evalIndex],u=c[r[1].evalIndex];if("+"===s&&"number"==typeof a&&"number"==typeof u){const e=a+u;return Math.abs(e)<99e-14?0:e}if("-"===s&&"number"==typeof a&&"number"==typeof u){const e=a-u;return Math.abs(e)<99e-14?0:e}if(a&&a.isFormulaError)return a;if(u&&u.isFormulaError)return u;const l=n.fn;return o=l?l(t,a,u):e.BuiltIn.Value,o=f(o,null),o;case"function":I||(I=new Array(i)),I.length!==i&&(I.length=i);for(let e=0;e<i;e++)I[e]=c[r[e].evalIndex];return o=this._callFunction(t,n,I),o&&"function"==typeof o.then?o.then(r=>{r=f(r,t),o instanceof e.Known&&(d=o),c[n.evalIndex]=r}).catch(t=>{const r=t instanceof e.Known?t:new e.Value("Uncaught error",{cause:t});c[n.evalIndex]=r}):o instanceof e.Known&&(d=o),o;case"prefix":case"postfix":let h=c[r[0].evalIndex];if(h&&h.isFormulaError)return h;const p=n.fn;return o=p?p(t,h):e.BuiltIn.Value,o;case"paren":if(1===i)return c[r[0].evalIndex];{const e=new Array(i);for(let t=0;t<i;t++)e[t]=c[r[t].evalIndex];return e}case"named":return null;case"empty":return}};let N=l.length;for(let e=0;e<N;e++){const t=l[e];if(d)return d;if(h)h=h.then(()=>{const e=v(t);return c[t.evalIndex]=e,e});else{const e=v(t);c[t.evalIndex]=e,e&&"function"==typeof e.then&&(h=e)}}if(h)return h.then(()=>{const e=c[c.length-1];return this._finalizeReturnValue(t,e)});const y=c[c.length-1];return this._finalizeReturnValue(t,y)}_resolvePrecedents(t){const n=t.getPosition(),r=n?.rowIndex??0,i=n?.colIndex??0;const o=this.getDirectPrecedentsAt(r,i),a=o.length;let c;if(a>0){c=new Array(a);for(let n=0;n<a;n++){const r=o[n];if(r instanceof e.Known)c[n]=r;else if(Array.isArray(r)){const e=new Array(r.length);for(let n=0;n<r.length;n++)e[n]=t.getReference(r[n]);c[n]=e}else c[n]=t.getReference(r)}}else c=s.EmptyArray;return c}wrapImplicit(e,t,n){const r=this._compiled.ast;if(!r||!r.isReference)return this;if("cell"===r.type)return this;if("@"===r.value)return this;if(!n)return this;const i=l(t)+h(e);if(n.has(i))return this;const o=zc(Fc("@",r,!0),this._compiled.error);return new zu(this._options,o)}_callFunction(t,n,r){const i=n?.cacheFn??t.getFunction(n.value);if(!i)return new e.Parse;const o=i.isBuiltIn();let s;o?n.cacheFn=i:this._context=t;try{s=i.execute(...r)}catch(t){s=t instanceof e.Known?t:new e.Value(t.message,{cause:t})}return o||(this._context=null),void 0===s?new e.Parse:s}_finalizeReturnValue(t,n){if(n&&void 0!==n.colStart&&(n=t.getValueAt(n.rowStart,n.colStart)),Array.isArray(n))if(1===n.length&&Array.isArray(n[0])&&1===n[0].length)n=n[0][0],Array.isArray(n)&&(n=e.BuiltIn.Value);else try{n=t.getRange(n)}catch(t){n=e.BuiltIn.Value}return n?.isIRange?1===n.size?(n=n.getValueAt(0,0,Hu),null===(n=f(n,t))&&(n=0)):n=n.fillEmpty(0):null===(n=f(n,t))&&(n=0),n}get[Symbol.toStringTag](){return"[FormulaBlock]"}toString(){const e=this._compiled;if(e.error)return e.error.toString();const t=this._context;if(t){const e=t.getPosition();return this.getTextAt(e.rowIndex,e.colIndex)}return c(e.tokens)}}const Vu=new Array(20);for(let e=0;e<Vu.length;e++)Vu[e]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,sheetName:null};const Hu={type:null};class Yu{constructor(e){this._options={getEntireCoords:d,...e},this._astBuilder=new Ku}parse(e,t){const n=e.getPosition();n.sheetName;const r=this._astBuilder.build(e,t);return new zu(this._options,r)}eval(e,t){return this.parse(e,t).evaluate(e)}}export{Yu as FormulaParser};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.4.11
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
const e={ENCODEURL:{s:"Returns a URL-encoded string",p:{text:{d:"is a string to be URL encoded"}}},WEBSERVICE:{s:"Retrieves data from a web service.",p:{url:{d:"is the URL of the web service"}}}};export{e as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.4.11
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import{k as e}from"./CV82qaLuZfxcBBSy.mjs";function t(e,t){for(var i=0;i<t.length;i++){const r=t[i];if("string"!=typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const i=Object.getOwnPropertyDescriptor(r,t);i&&Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var i,r={exports:{}};var n=(i||(i=1,r.exports=function e(){var t,i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:{},r=!i.document&&!!i.postMessage,n=i.IS_PAPA_WORKER||!1,s={},a=0,o={};function h(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=k(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new c(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,t){var r=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<r){let t=this._config.newline;t||(s=this._config.quoteChar||'"',t=this._handle.guessLineEndings(e,s)),e=[...e.split(t).slice(r)].join(t)}this.isFirstChunk&&v(this._config.beforeFirstChunk)&&void 0!==(s=this._config.beforeFirstChunk(e))&&(e=s),this.isFirstChunk=!1,this._halted=!1,r=this._partialLine+e;var s=(this._partialLine="",this._handle.parse(r,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=s.meta.cursor,this._finished||(this._partialLine=r.substring(e-this._baseIndex),this._baseIndex=e),s&&s.data&&(this._rowCount+=s.data.length),r=this._finished||this._config.preview&&this._rowCount>=this._config.preview,n)i.postMessage({results:s,workerId:o.WORKER_ID,finished:r});else if(v(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!r||!v(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),r||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){v(this._config.error)?this._config.error(e):n&&this._config.error&&i.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),h.call(this,e),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),r||(t.onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var e,i=this._config.downloadRequestHeaders;for(e in i)t.setRequestHeader(e,i[e])}var n;this._config.chunkSize&&(n=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+n));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}r&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(new Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),h.call(this,e);var t,i,r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,i=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input,n=(this._config.chunkSize&&(n=Math.min(this._start+this._config.chunkSize,this._input.size),e=i.call(e,this._start,n)),t.readAsText(e,this._config.encoding));r||this._chunkLoaded({target:{result:n}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function f(e){var t;h.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,i;if(!this._finished)return e=this._config.chunkSize,t=e?(i=t.substring(0,e),t.substring(e)):(i=t,""),this._finished=!t,this.parseChunk(i)}}function l(e){h.call(this,e=e||{});var t=[],i=!0,r=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):i=!0},this._streamData=b(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=b(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=b(function(){this._streamCleanUp(),r=!0,this._streamData("")},this),this._streamCleanUp=b(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function c(e){var t,i,r,n,s=Math.pow(2,53),a=-s,h=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,u=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,d=this,f=0,l=0,c=!1,_=!1,m=[],y={data:[],errors:[],meta:{}};function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function w(){if(y&&r&&(R("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(y.data=y.data.filter(function(e){return!b(e)})),E()){if(y)if(Array.isArray(y.data[0])){for(var t=0;E()&&t<y.data.length;t++)y.data[t].forEach(d);y.data.splice(0,1)}else y.data.forEach(d);function d(t,i){v(e.transformHeader)&&(t=e.transformHeader(t,i)),m.push(t)}}function i(t,i){for(var r=e.header?{}:[],n=0;n<t.length;n++){var o=n,d=t[n];d=((t,i)=>(t=>(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)))(t)?"true"===i||"TRUE"===i||"false"!==i&&"FALSE"!==i&&((e=>{if(h.test(e)&&(e=parseFloat(e),a<e&&e<s))return 1})(i)?parseFloat(i):u.test(i)?new Date(i):""===i?null:i):i)(o=e.header?n>=m.length?"__parsed_extra":m[n]:o,d=e.transform?e.transform(d,o):d),"__parsed_extra"===o?(r[o]=r[o]||[],r[o].push(d)):r[o]=d}return e.header&&(n>m.length?R("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+n,l+i):n<m.length&&R("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+n,l+i)),r}var n;y&&(e.header||e.dynamicTyping||e.transform)&&(n=1,!y.data.length||Array.isArray(y.data[0])?(y.data=y.data.map(i),n=y.data.length):y.data=i(y.data,0),e.header&&y.meta&&(y.meta.fields=m),l+=n)}function E(){return e.header&&0===m.length}function R(e,t,i,r){e={type:e,code:t,message:i},void 0!==r&&(e.row=r),y.errors.push(e)}v(e.step)&&(n=e.step,e.step=function(t){y=t,E()?w():(w(),0!==y.data.length&&(f+=t.data.length,e.preview&&f>e.preview?i.abort():(y.data=y.data[0],n(y,d))))}),this.parse=function(n,s,a){var h=e.quoteChar||'"';return e.newline||(e.newline=this.guessLineEndings(n,h)),r=!1,e.delimiter?v(e.delimiter)&&(e.delimiter=e.delimiter(n),y.meta.delimiter=e.delimiter):((h=((t,i,r,n,s)=>{var a,h,u,d;s=s||[",","\t","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var f=0;f<s.length;f++){for(var l,c=s[f],p=0,_=0,m=0,y=(u=void 0,new g({comments:n,delimiter:c,newline:i,preview:10}).parse(t)),k=0;k<y.data.length;k++)r&&b(y.data[k])?m++:(_+=l=y.data[k].length,void 0===u?u=l:0<l&&(p+=Math.abs(l-u),u=l));0<y.data.length&&(_/=y.data.length-m),(void 0===h||p<=h)&&(void 0===d||d<_)&&1.99<_&&(h=p,a=c,d=_)}return{successful:!!(e.delimiter=a),bestDelimiter:a}})(n,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=h.bestDelimiter:(r=!0,e.delimiter=o.DefaultDelimiter),y.meta.delimiter=e.delimiter),h=k(e),e.preview&&e.header&&h.preview++,t=n,i=new g(h),y=i.parse(t,s,a),w(),c?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return c},this.pause=function(){c=!0,i.abort(),t=v(e.chunk)?"":t.substring(i.getCharIndex())},this.resume=function(){d.streamer._halted?(c=!1,d.streamer.parseChunk(t,!0)):setTimeout(d.resume,3)},this.aborted=function(){return _},this.abort=function(){_=!0,i.abort(),y.meta.aborted=!0,v(e.complete)&&e.complete(y),t=""},this.guessLineEndings=function(e,t){e=e.substring(0,1048576),t=new RegExp(p(t)+"([^]*?)"+p(t),"gm");var i=(e=e.replace(t,"")).split("\r");if(e=1<(t=e.split("\n")).length&&t[0].length<i[0].length,1===i.length||e)return"\n";for(var r=0,n=0;n<i.length;n++)"\n"===i[n][0]&&r++;return r>=i.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,i=e.newline,r=e.comments,n=e.step,s=e.preview,a=e.fastMode,h=null,u=!1,d=null==e.quoteChar?'"':e.quoteChar,f=d;if(void 0!==e.escapeChar&&(f=e.escapeChar),("string"!=typeof t||-1<o.BAD_DELIMITERS.indexOf(t))&&(t=","),r===t)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<o.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==i&&"\r"!==i&&"\r\n"!==i&&(i="\n");var l=0,c=!1;this.parse=function(o,g,_){if("string"!=typeof o)throw new Error("Input must be a string");var m=o.length,y=t.length,k=i.length,b=r.length,w=v(n),E=[],R=[],C=[],O=l=0;if(!o)return P();if(a||!1!==a&&-1===o.indexOf(d)){for(var S=o.split(i),x=0;x<S.length;x++){if(C=S[x],l+=C.length,x!==S.length-1)l+=i.length;else if(_)return P();if(!r||C.substring(0,b)!==r){if(w){if(E=[],F(C.split(t)),U(),c)return P()}else F(C.split(t));if(s&&s<=x)return E=E.slice(0,s),P(!0)}}return P()}for(var A=o.indexOf(t,l),I=o.indexOf(i,l),T=new RegExp(p(f)+p(d),"g"),D=o.indexOf(d,l);;)if(o[l]===d)for(D=l,l++;;){if(-1===(D=o.indexOf(d,D+1)))return _||R.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:E.length,index:l}),z();if(D===m-1)return z(o.substring(l,D).replace(T,d));if(d===f&&o[D+1]===f)D++;else if(d===f||0===D||o[D-1]!==f){-1!==A&&A<D+1&&(A=o.indexOf(t,D+1));var L=j(-1===(I=-1!==I&&I<D+1?o.indexOf(i,D+1):I)?A:Math.min(A,I));if(o.substr(D+1+L,y)===t){C.push(o.substring(l,D).replace(T,d)),o[l=D+1+L+y]!==d&&(D=o.indexOf(d,l)),A=o.indexOf(t,l),I=o.indexOf(i,l);break}if(L=j(I),o.substring(D+1+L,D+1+L+k)===i){if(C.push(o.substring(l,D).replace(T,d)),M(D+1+L+k),A=o.indexOf(t,l),D=o.indexOf(d,l),w&&(U(),c))return P();if(s&&E.length>=s)return P(!0);break}R.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:E.length,index:l}),D++}}else if(r&&0===C.length&&o.substring(l,l+b)===r){if(-1===I)return P();l=I+k,I=o.indexOf(i,l),A=o.indexOf(t,l)}else if(-1!==A&&(A<I||-1===I))C.push(o.substring(l,A)),l=A+y,A=o.indexOf(t,l);else{if(-1===I)break;if(C.push(o.substring(l,I)),M(I+k),w&&(U(),c))return P();if(s&&E.length>=s)return P(!0)}return z();function F(e){E.push(e),O=l}function j(e){var t=0;return-1!==e&&(e=o.substring(D+1,e))&&""===e.trim()?e.length:t}function z(e){return _||(void 0===e&&(e=o.substring(l)),C.push(e),l=m,F(C),w&&U()),P()}function M(e){l=e,F(C),C=[],I=o.indexOf(i,l)}function P(r){if(e.header&&!g&&E.length&&!u){var n=E[0],s=Object.create(null),a=new Set(n);let t=!1;for(let i=0;i<n.length;i++){let r=n[i];if(s[r=v(e.transformHeader)?e.transformHeader(r,i):r]){let e,o=s[r];for(;e=r+"_"+o,o++,a.has(e););a.add(e),n[i]=e,s[r]++,t=!0,(h=null===h?{}:h)[e]=r}else s[r]=1,n[i]=r;a.add(r)}t&&console.warn("Duplicate headers found and renamed."),u=!0}return{data:E,errors:R,meta:{delimiter:t,linebreak:i,aborted:c,truncated:!!r,cursor:O+(g||0),renamedHeaders:h}}}function U(){n(P()),E=[],R=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return l}}function _(e){var t=e.data,i=s[t.workerId],r=!1;if(t.error)i.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){r=!0,m(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(v(i.userStep)){for(var a=0;a<t.results.data.length&&(i.userStep({data:t.results.data[a],errors:t.results.errors,meta:t.results.meta},n),!r);a++);delete t.results}else v(i.userChunk)&&(i.userChunk(t.results,n,t.file),delete t.results)}t.finished&&!r&&m(t.workerId,t.results)}function m(e,t){var i=s[e];v(i.userComplete)&&i.userComplete(t),i.terminate(),delete s[e]}function y(){throw new Error("Not implemented.")}function k(e){if("object"!=typeof e||null===e)return e;var t,i=Array.isArray(e)?[]:{};for(t in e)i[t]=k(e[t]);return i}function b(e,t){return function(){e.apply(t,arguments)}}function v(e){return"function"==typeof e}return o.parse=function(t,r){var n=(r=r||{}).dynamicTyping||!1;if(v(n)&&(r.dynamicTypingFunction=n,n={}),r.dynamicTyping=n,r.transform=!!v(r.transform)&&r.transform,!r.worker||!o.WORKERS_SUPPORTED)return n=null,o.NODE_STREAM_INPUT,"string"==typeof t?(t=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(t),n=new(r.download?u:f)(r)):!0===t.readable&&v(t.read)&&v(t.on)?n=new l(r):(i.File&&t instanceof File||t instanceof Object)&&(n=new d(r)),n.stream(t);(n=(()=>{var t;return!!o.WORKERS_SUPPORTED&&(t=(()=>{var t=i.URL||i.webkitURL||null,r=e.toString();return o.BLOB_URL||(o.BLOB_URL=t.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))})(),(t=new i.Worker(t)).onmessage=_,t.id=a++,s[t.id]=t)})()).userStep=r.step,n.userChunk=r.chunk,n.userComplete=r.complete,n.userError=r.error,r.step=v(r.step),r.chunk=v(r.chunk),r.complete=v(r.complete),r.error=v(r.error),delete r.worker,n.postMessage({input:t,config:r,workerId:n.id})},o.unparse=function(e,t){var i=!1,r=!0,n=",",s="\r\n",a='"',h=a+a,u=!1,d=null,f=!1,l=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(n=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(i=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(h=t.escapeChar+a),t.escapeFormulae instanceof RegExp?f=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(f=/^[=+\-@\t\r].*$/)}})(),new RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return c(null,e,u);if("object"==typeof e[0])return c(d||Object.keys(e[0]),e,u)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),c(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function c(e,t,i){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),h=!Array.isArray(t[0]);if(o&&r){for(var u=0;u<e.length;u++)0<u&&(a+=n),a+=g(e[u],u);0<t.length&&(a+=s)}for(var d=0;d<t.length;d++){var f=(o?e:t[d]).length,l=!1,c=o?0===Object.keys(t[d]).length:0===t[d].length;if(i&&!o&&(l="greedy"===i?""===t[d].join("").trim():1===t[d].length&&0===t[d][0].length),"greedy"===i&&o){for(var p=[],_=0;_<f;_++){var m=h?e[_]:_;p.push(t[d][m])}l=""===p.join("").trim()}if(!l){for(var y=0;y<f;y++){0<y&&!c&&(a+=n);var k=o&&h?e[y]:y;a+=g(t[d][k],y)}d<t.length-1&&(!i||0<f&&!c)&&(a+=s)}}return a}function g(e,t){var r,s;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(s=!1,f&&"string"==typeof e&&f.test(e)&&(e="'"+e,s=!0),r=e.toString().replace(l,h),(s=s||!0===i||"function"==typeof i&&i(e,t)||Array.isArray(i)&&i[t]||((e,t)=>{for(var i=0;i<t.length;i++)if(-1<e.indexOf(t[i]))return!0;return!1})(r,o.BAD_DELIMITERS)||-1<r.indexOf(n)||" "===r.charAt(0)||" "===r.charAt(r.length-1))?a+r+a:r)}},o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\ufeff",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!r&&!!i.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=g,o.ParserHandle=c,o.NetworkStreamer=u,o.FileStreamer=d,o.StringStreamer=f,o.ReadableStreamStreamer=l,i.jQuery&&((t=i.jQuery).fn.parse=function(e){var r=e.config||{},n=[];return this.each(function(e){if("INPUT"!==t(this).prop("tagName").toUpperCase()||"file"!==t(this).attr("type").toLowerCase()||!i.FileReader||!this.files||0===this.files.length)return!0;for(var s=0;s<this.files.length;s++)n.push({file:this.files[s],inputElem:this,instanceConfig:t.extend({},r)})}),s(),this;function s(){if(0===n.length)v(e.complete)&&e.complete();else{var i,r,s,h,u=n[0];if(v(e.before)){var d=e.before(u.file,u.inputElem);if("object"==typeof d){if("abort"===d.action)return i="AbortError",r=u.file,s=u.inputElem,h=d.reason,void(v(e.error)&&e.error({name:i},r,s,h));if("skip"===d.action)return void a();"object"==typeof d.config&&(u.instanceConfig=t.extend(u.instanceConfig,d.config))}else if("skip"===d)return void a()}var f=u.instanceConfig.complete;u.instanceConfig.complete=function(e){v(f)&&f(e,u.file,u.inputElem),a()},o.parse(u.file,u.instanceConfig)}}function a(){n.splice(0,1),s()}}),n&&(i.onmessage=function(e){e=e.data,void 0===o.WORKER_ID&&e&&(o.WORKER_ID=e.workerId),"string"==typeof e.input?i.postMessage({workerId:o.WORKER_ID,results:o.parse(e.input,e.config),finished:!0}):(i.File&&e.input instanceof File||e.input instanceof Object)&&(e=o.parse(e.input,e.config))&&i.postMessage({workerId:o.WORKER_ID,results:e,finished:!0})}),(u.prototype=Object.create(h.prototype)).constructor=u,(d.prototype=Object.create(h.prototype)).constructor=d,(f.prototype=Object.create(f.prototype)).constructor=f,(l.prototype=Object.create(h.prototype)).constructor=l,o}()),r.exports);const s=t({__proto__:null,default:e(n)},[n]);export{s as p};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.4.11
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
const t={ASC:{s:"Converts a string to full-width characters to half-width. Uses the double-byte character set (DBCS).",p:{text:{d:"is a text or a reference to a cell containing text"}},h:"DBCS"},ARRAYTOTEXT:{s:"Returns a text representation of an array",p:{array:{d:"the array to represent as text"},format:{d:"0 for relaxed format, 1 for strict format",v:0}}},CHAR:{s:"Returns the character specified by the code number from the character set for your computer",p:{number:{d:"is a number between 1 and 255 specifying which character you want"}}},CLEAN:{s:"Removes all nonprintable characters from text",p:{text:{d:"is the text you want to clean"}}},CODE:{s:"Returns the Unicode value of the first character in a text string",p:{text:{d:"is the text string whose Unicode value you want"}}},CONCAT:{s:"Concatenates a list or range of text strings",p:{text:{d:"text1,text2,... are 1 to 252 text strings or ranges to be joined"}}},CONCATENATE:{s:"Joins several text strings into one text string",p:{text:{d:"text1, text2,... are 1 to 252 text strings or ranges to be joined"}},c:"Compatibility"},DETECTLANGUAGE:{s:"Detects the language of a given text.",p:{text:{d:"is the text to detect the language of"}},h:"Unimplemented"},DBCS:{s:"Changes half-width characters to full-width characters. Uses the double-byte character set (DBCS).",p:{text:{d:"is a text or a reference to a cell containing text"}},h:"DBCS"},DOLLAR:{s:"Converts a number to text in currency format",p:{number:{d:"is the number to convert"},decimals:{d:"is the number of digits to the right of the decimal point",v:2}}},EXACT:{s:"Checks whether two text strings are exactly the same, and returns TRUE or FALSE. EXACT is case-sensitive",p:{text1:{d:"is the first text string"},text2:{d:"is the second text string"}}},FIND:{s:"Returns the starting position of one text string within another text string. FIND is case-sensitive",p:{findText:{d:"Returns the starting position of one text string within another text string. FIND is case-sensitive"},withinText:{d:"is the text you want to search"},startNum:{d:"specifies the character at which to start the search. The first character in Within_text is character number 1",v:1}}},FINDB:{s:"Finds the starting position of one text string with another text string. FINDB is case-sensitive. Use with double-byte characters.",p:{findText:{d:"is the text you want to find"},withinText:{d:"is the text you want to search"},startNum:{d:"is the position in within_text to start searching",v:1}},h:"DBCS"},FIXED:{s:"Rounds a number to the specified number of decimals and returns the result as text with or without commas",p:{number:{d:"is the number you want to round and convert to text"},decimals:{d:"is the number of digits to the right of the decimal point",v:2},noCommas:{d:"is a logical value: do not display commas in the returned text = TRUE; do display commas in the returned text = FALSE",v:!1}}},LEFT:{s:"Returns the specified number of characters from the start of a text string",p:{text:{d:"is the text string from which you want to extract characters"},numChars:{d:"specifies how many characters you want LEFT to extract",v:1}}},LEFTB:{s:"Returns the leftmost num_bytes characters from text. Uses double-byte characters.",p:{text:{d:"is the text string from which you want to extract characters"},numBytes:{d:"is the number of bytes to extract",v:1}},h:"DBCS"},LEN:{s:"Returns the number of characters in a text string",p:{text:{d:"is the text whose length you want to find. Spaces count as characters"}}},LENB:{s:"Returns the number of bytes in a text string. Uses double-byte characters.",p:{text:{d:"is the text string from which you want to extract characters"}}},LOWER:{s:"Converts all letters in a text string to lowercase",p:{text:{d:"is the text you want to convert to lowercase. Characters in Text that are not letters are not changed"}}},MID:{s:"Returns the characters from the middle of a text string, given a starting position and length",p:{text:{d:"is the text string from which you want to extract characters"},startNum:{d:"is the position of the first character you want to extract"},numChars:{d:"specifies how many characters to return from Text"}}},MIDB:{s:"Returns characters from the middle of a text string. Uses double-byte characters.",p:{text:{d:"is the text string from which you want to extract characters"},startNum:{d:"is the position of the first character you want to extract"},numBytes:{d:"is the number of bytes to extract"}},h:"DBCS"},NUMBERVALUE:{s:"Converts text to number in a locale-independent manner",p:{text:{d:"is the text string you want to convert"},decimalSeparator:{d:"is the character that separates the integer part from the decimal part of the number",v:"."},groupSeparator:{d:"is the character that separates groups of thousands",v:","}}},PERCENTOF:{s:"Returns the percentage of a subset of a given data set",p:{dataSubset:{d:"is the subset"},dataAll:{d:"is the data set"}},h:"Unimplemented"},PHONETIC:{s:"Returns the phonetic spelling of a text string",p:{reference:{d:"Text string or a reference to a single cell or a range of cells that contain a furigana text string"}},h:"Unimplemented"},PROPER:{s:"Converts the first letter of each word in a text string to uppercase",p:{text:{d:"is the text string you want to convert"}}},REGEXEXTRACT:{s:"Extracts substrings of 'text' based on the provided REGEX 'pattern'",p:{text:{d:"is the text string from which you want to extract characters"},pattern:{d:"The regular expression to be applied"},returnMode:{d:"Specify which matches to return",v:0},caseSensitivity:{d:"Whether the match is case sensitive",v:!1}},h:"Unimplemented"},REGEXREPLACE:{s:"Returns 'text', with 'replacement' in place of matches with 'pattern'",p:{text:{d:"is the text string from which you want to extract characters"},pattern:{d:"The regular expression to be applied"},replacement:{d:"The replacement string"},occurrence:{d:"The occurrence of the match to replace",v:0},caseSensitivity:{d:"Whether the match is case sensitive",v:!1}},h:"Unimplemented"},REGEXTEST:{s:"Checks whether the input matches the pattern, and returns TRUE or FALSE",p:{text:{d:"is the text string to be checked"},pattern:{d:"is the regular expression to be applied"},caseSensitivity:{d:"Whether the match is case sensitive",v:!1}},h:"Unimplemented"},REPLACE:{s:"Replaces part of a text string with a different text string",p:{oldText:{d:"is the text string to be changed"},startNum:{d:"is the position of the first character you want to replace"},numChars:{d:"is the number of characters to replace"},newText:{d:"is the text string that will replace old_text"}}},REPLACEB:{s:"Replaces part of a text string with a different text string using the number of bytes. Uses the double-byte character set (DBCS).",p:{oldText:{d:"is the text string to be changed"},startNum:{d:"is the position of the first character you want to replace"},numBytes:{d:"is the number of bytes to replace"},newText:{d:"is the text string that will replace old_text"}},h:"DBCS"},REPT:{s:"Repeats text a given number of times",p:{text:{d:"is the text you want to repeat"},numberTimes:{d:"is the number of times you want to repeat text"}}},RIGHT:{s:"Returns the specified number of characters from the end of a text string",p:{text:{d:"is the text string that contains the characters you want to extract"},numChars:{d:"specifies how many characters you want to extract",v:1}}},RIGHTB:{s:"Returns the rightmost num_bytes characters from text. Uses double-byte characters.",p:{text:{d:"is the text string from which you want to extract characters"},numBytes:{d:"is the number of bytes to extract",v:1}}},SEARCH:{s:"Returns the number of the character at which a specific character or text string is first found, reading left to right (not case-sensitive)",p:{findText:{d:"Returns the number of the character at which a specific character or text string is first found, reading left to right (not case-sensitive)"},withinText:{d:"is the text in which you want to search for Find_text"},startNum:{d:"is the character number in Within_text, counting from the left, at which you want to start searching",v:1}}},SEARCHB:{s:"Returns the number of the character at which a specific character or text string is first found, reading left to right (not case-sensitive). Uses the double-byte character set (DBCS).",p:{findText:{d:"Returns the number of the character at which a specific character or text string is first found, reading left to right (not case-sensitive)"},withinText:{d:"is the text in which you want to search for Find_text"},startBytes:{d:"is the character number in Within_text, counting from the left, at which you want to start searching",v:1}},h:"DBCS"},SUBSTITUTE:{s:"Replaces existing text with new text in a text string",p:{text:{d:"is the text or the reference to a cell containing text in which you want to substitute characters"},oldText:{d:"is the existing text you want to replace. If the case of Old_text does not match the case of text, SUBSTITUTE will not replace the text"},newText:{d:"is the text you want to replace Old_text with"},instanceNum:{d:"specifies which occurrence of Old_text you want to replace. If omitted, every instance of Old_text is replaced"}}},T:{s:"Checks whether a value is text, and returns the text if it is, or returns double quotes (empty text) if it is not",p:{value:{d:"is the value to test"}}},TEXT:{s:"Converts a value to text in a specific number format",p:{value:{d:"is a number, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value"},formatText:{d:"is a text string that defines the number format to use"}}},TEXTAFTER:{s:"Returns text that's after delimiting characters.",p:{text:{d:"The text you want to search for the delimiter."},delimiter:{d:"The character or string to use as a delimiter."},instanceNum:{d:"The desired occurrence of delimiter. The default is 1. A negative number searches from the end.",v:1},matchMode:{d:"Searches the text for a delimiter match. By default, a case-sensitive match is done.",v:0},matchEnd:{d:"Whether to match the delimiter against the end of text. By default, they're not matched.",v:0},ifNotFound:{d:"Returned if no match is found. By default, #N/A is returned.",v:"undefined"}}},TEXTJOIN:{s:"Concatenates a list or range of text strings using a delimiter",p:{delimiter:{d:"Character or string to insert between each text item"},ignoreEmpty:{d:"if TRUE(default), ignores empty cells"},text:{d:"text1,text2,... are 1 to 252 text strings or ranges to be joined"}}},TEXTSPLIT:{s:"Splits text into rows or columns using delimiters.",p:{text:{d:"The text to split"},colDelimiter:{d:"The column delimiter(s) - can be string or array of strings"},rowDelimiter:{d:"The row delimiter(s), null/undefined means no row splitting",v:null},ignoreEmpty:{d:"Whether to ignore empty values (defaults to `false`)",v:!1},matchMode:{d:"Whether to use case-sensitive (0) or case-insensitive (1) match (defaults to `0`)",v:0},padWith:{d:"Value to use for padding if matrix is uneven (defaults to `#N/A`)",v:"undefined"}}},TEXTBEFORE:{s:"Returns text that's before delimiting characters.",p:{text:{d:"The text you want to search for the delimiter."},delimiter:{d:"The character or string to use as a delimiter."},instanceNum:{d:"The desired occurrence of delimiter. The default is 1. A negative number searches from the end.",v:1},matchMode:{d:"Whether to use case-sensitive (0) or case-insensitive (1) match (defaults to `0`)",v:0},matchEnd:{d:"Whether to match the delimiter against the end of text. By default, they're not matched.",v:0},ifNotFound:{d:"Returned if no match is found. By default, #N/A is returned.",v:"undefined"}}},TRANSLATE:{s:"Translate a text string from one language to another using the Microsoft Translator service.",p:{text:{d:"The text to translate."},sourceLanguage:{d:"Specifiy the source language your text is currently in. Expressed as a two-letter language code."},targetLanguage:{d:"Specifiy the source language you want your text to be translated to. Expressed as a two-letter language code."}},h:"Unimplemented"},TRIM:{s:"Removes all spaces from text except for single spaces between words.",p:{text:{d:"The text from which you want to remove extra spaces."}}},UNICHAR:{s:"Returns the Unicode character referenced by the given numeric value",p:{number:{d:"is the Unicode number representing a character"}}},UNICODE:{s:"Returns the number (code point) corresponding to the first character of the text",p:{text:{d:"is the character that you want the Unicode value of"}}},UPPER:{s:"Converts a text string to all uppercase letters",p:{text:{d:"is the text you want converted to uppercase, a reference or a text string"}}},VALUE:{s:"Converts a text string that represents a number to a number",p:{text:{d:"is the text enclosed in quotation marks or a reference to a cell containing the text you want to convert"}}},VALUETOTEXT:{s:"Returns a text representation of a value",p:{value:{d:"the value to represent as text"},format:{d:"the format of the text",v:0}}}};export{t as default};
|