@speclynx/apidom-json-path 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/apidom-json-path.browser.js +6849 -6836
- package/dist/apidom-json-path.browser.min.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPath=t():e.apidomJsonPath=t()}(self,()=>(()=>{"use strict";var e={d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ASTTranslator:()=>M,ApiDOMEvaluationRealm:()=>mt,CSTOptimizedTranslator:()=>x,CSTTranslator:()=>f,EvaluationRealm:()=>ge,Grammar:()=>n,JSONEvaluationRealm:()=>fe,JSONNormalizedPathError:()=>F,JSONPathError:()=>m,JSONPathEvaluateError:()=>xe,JSONPathParseError:()=>y,NormalizedPath:()=>s,XMLTranslator:()=>L,evaluate:()=>gt,functions:()=>r,parse:()=>N,test:()=>D});var s={};e.r(s),e.d(s,{escape:()=>P,from:()=>$,test:()=>B,to:()=>j});var r={};function n(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"jsonpath-query",lower:"jsonpath-query",index:0,isBkr:!1},this.rules[1]={name:"segments",lower:"segments",index:1,isBkr:!1},this.rules[2]={name:"B",lower:"b",index:2,isBkr:!1},this.rules[3]={name:"S",lower:"s",index:3,isBkr:!1},this.rules[4]={name:"root-identifier",lower:"root-identifier",index:4,isBkr:!1},this.rules[5]={name:"selector",lower:"selector",index:5,isBkr:!1},this.rules[6]={name:"name-selector",lower:"name-selector",index:6,isBkr:!1},this.rules[7]={name:"string-literal",lower:"string-literal",index:7,isBkr:!1},this.rules[8]={name:"double-quoted",lower:"double-quoted",index:8,isBkr:!1},this.rules[9]={name:"single-quoted",lower:"single-quoted",index:9,isBkr:!1},this.rules[10]={name:"ESC",lower:"esc",index:10,isBkr:!1},this.rules[11]={name:"unescaped",lower:"unescaped",index:11,isBkr:!1},this.rules[12]={name:"escapable",lower:"escapable",index:12,isBkr:!1},this.rules[13]={name:"hexchar",lower:"hexchar",index:13,isBkr:!1},this.rules[14]={name:"non-surrogate",lower:"non-surrogate",index:14,isBkr:!1},this.rules[15]={name:"high-surrogate",lower:"high-surrogate",index:15,isBkr:!1},this.rules[16]={name:"low-surrogate",lower:"low-surrogate",index:16,isBkr:!1},this.rules[17]={name:"HEXDIG",lower:"hexdig",index:17,isBkr:!1},this.rules[18]={name:"wildcard-selector",lower:"wildcard-selector",index:18,isBkr:!1},this.rules[19]={name:"index-selector",lower:"index-selector",index:19,isBkr:!1},this.rules[20]={name:"int",lower:"int",index:20,isBkr:!1},this.rules[21]={name:"DIGIT1",lower:"digit1",index:21,isBkr:!1},this.rules[22]={name:"slice-selector",lower:"slice-selector",index:22,isBkr:!1},this.rules[23]={name:"start",lower:"start",index:23,isBkr:!1},this.rules[24]={name:"end",lower:"end",index:24,isBkr:!1},this.rules[25]={name:"step",lower:"step",index:25,isBkr:!1},this.rules[26]={name:"filter-selector",lower:"filter-selector",index:26,isBkr:!1},this.rules[27]={name:"logical-expr",lower:"logical-expr",index:27,isBkr:!1},this.rules[28]={name:"logical-or-expr",lower:"logical-or-expr",index:28,isBkr:!1},this.rules[29]={name:"logical-and-expr",lower:"logical-and-expr",index:29,isBkr:!1},this.rules[30]={name:"basic-expr",lower:"basic-expr",index:30,isBkr:!1},this.rules[31]={name:"paren-expr",lower:"paren-expr",index:31,isBkr:!1},this.rules[32]={name:"logical-not-op",lower:"logical-not-op",index:32,isBkr:!1},this.rules[33]={name:"test-expr",lower:"test-expr",index:33,isBkr:!1},this.rules[34]={name:"filter-query",lower:"filter-query",index:34,isBkr:!1},this.rules[35]={name:"rel-query",lower:"rel-query",index:35,isBkr:!1},this.rules[36]={name:"current-node-identifier",lower:"current-node-identifier",index:36,isBkr:!1},this.rules[37]={name:"comparison-expr",lower:"comparison-expr",index:37,isBkr:!1},this.rules[38]={name:"literal",lower:"literal",index:38,isBkr:!1},this.rules[39]={name:"comparable",lower:"comparable",index:39,isBkr:!1},this.rules[40]={name:"comparison-op",lower:"comparison-op",index:40,isBkr:!1},this.rules[41]={name:"singular-query",lower:"singular-query",index:41,isBkr:!1},this.rules[42]={name:"rel-singular-query",lower:"rel-singular-query",index:42,isBkr:!1},this.rules[43]={name:"abs-singular-query",lower:"abs-singular-query",index:43,isBkr:!1},this.rules[44]={name:"singular-query-segments",lower:"singular-query-segments",index:44,isBkr:!1},this.rules[45]={name:"name-segment",lower:"name-segment",index:45,isBkr:!1},this.rules[46]={name:"index-segment",lower:"index-segment",index:46,isBkr:!1},this.rules[47]={name:"number",lower:"number",index:47,isBkr:!1},this.rules[48]={name:"frac",lower:"frac",index:48,isBkr:!1},this.rules[49]={name:"exp",lower:"exp",index:49,isBkr:!1},this.rules[50]={name:"true",lower:"true",index:50,isBkr:!1},this.rules[51]={name:"false",lower:"false",index:51,isBkr:!1},this.rules[52]={name:"null",lower:"null",index:52,isBkr:!1},this.rules[53]={name:"function-name",lower:"function-name",index:53,isBkr:!1},this.rules[54]={name:"function-name-first",lower:"function-name-first",index:54,isBkr:!1},this.rules[55]={name:"function-name-char",lower:"function-name-char",index:55,isBkr:!1},this.rules[56]={name:"LCALPHA",lower:"lcalpha",index:56,isBkr:!1},this.rules[57]={name:"function-expr",lower:"function-expr",index:57,isBkr:!1},this.rules[58]={name:"function-argument",lower:"function-argument",index:58,isBkr:!1},this.rules[59]={name:"segment",lower:"segment",index:59,isBkr:!1},this.rules[60]={name:"child-segment",lower:"child-segment",index:60,isBkr:!1},this.rules[61]={name:"bracketed-selection",lower:"bracketed-selection",index:61,isBkr:!1},this.rules[62]={name:"member-name-shorthand",lower:"member-name-shorthand",index:62,isBkr:!1},this.rules[63]={name:"name-first",lower:"name-first",index:63,isBkr:!1},this.rules[64]={name:"name-char",lower:"name-char",index:64,isBkr:!1},this.rules[65]={name:"DIGIT",lower:"digit",index:65,isBkr:!1},this.rules[66]={name:"ALPHA",lower:"alpha",index:66,isBkr:!1},this.rules[67]={name:"descendant-segment",lower:"descendant-segment",index:67,isBkr:!1},this.rules[68]={name:"normalized-path",lower:"normalized-path",index:68,isBkr:!1},this.rules[69]={name:"normal-index-segment",lower:"normal-index-segment",index:69,isBkr:!1},this.rules[70]={name:"normal-selector",lower:"normal-selector",index:70,isBkr:!1},this.rules[71]={name:"normal-name-selector",lower:"normal-name-selector",index:71,isBkr:!1},this.rules[72]={name:"normal-single-quoted",lower:"normal-single-quoted",index:72,isBkr:!1},this.rules[73]={name:"normal-unescaped",lower:"normal-unescaped",index:73,isBkr:!1},this.rules[74]={name:"normal-escapable",lower:"normal-escapable",index:74,isBkr:!1},this.rules[75]={name:"normal-hexchar",lower:"normal-hexchar",index:75,isBkr:!1},this.rules[76]={name:"normal-HEXDIG",lower:"normal-hexdig",index:76,isBkr:!1},this.rules[77]={name:"normal-index-selector",lower:"normal-index-selector",index:77,isBkr:!1},this.rules[78]={name:"dot-prefix",lower:"dot-prefix",index:78,isBkr:!1},this.rules[79]={name:"double-dot-prefix",lower:"double-dot-prefix",index:79,isBkr:!1},this.rules[80]={name:"left-bracket",lower:"left-bracket",index:80,isBkr:!1},this.rules[81]={name:"right-bracket",lower:"right-bracket",index:81,isBkr:!1},this.rules[82]={name:"left-paren",lower:"left-paren",index:82,isBkr:!1},this.rules[83]={name:"right-paren",lower:"right-paren",index:83,isBkr:!1},this.rules[84]={name:"comma",lower:"comma",index:84,isBkr:!1},this.rules[85]={name:"colon",lower:"colon",index:85,isBkr:!1},this.rules[86]={name:"dquote",lower:"dquote",index:86,isBkr:!1},this.rules[87]={name:"squote",lower:"squote",index:87,isBkr:!1},this.rules[88]={name:"questionmark",lower:"questionmark",index:88,isBkr:!1},this.rules[89]={name:"disjunction",lower:"disjunction",index:89,isBkr:!1},this.rules[90]={name:"conjunction",lower:"conjunction",index:90,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,2]},this.rules[0].opcodes[1]={type:4,index:4},this.rules[0].opcodes[2]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:2,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:3},this.rules[1].opcodes[3]={type:4,index:59},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:6,string:[32]},this.rules[2].opcodes[2]={type:6,string:[9]},this.rules[2].opcodes[3]={type:6,string:[10]},this.rules[2].opcodes[4]={type:6,string:[13]},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:0,max:1/0},this.rules[3].opcodes[1]={type:4,index:2},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:7,string:[36]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[5].opcodes[1]={type:4,index:6},this.rules[5].opcodes[2]={type:4,index:18},this.rules[5].opcodes[3]={type:4,index:22},this.rules[5].opcodes[4]={type:4,index:19},this.rules[5].opcodes[5]={type:4,index:26},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:4,index:7},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,6]},this.rules[7].opcodes[1]={type:2,children:[2,3,5]},this.rules[7].opcodes[2]={type:4,index:86},this.rules[7].opcodes[3]={type:3,min:0,max:1/0},this.rules[7].opcodes[4]={type:4,index:8},this.rules[7].opcodes[5]={type:4,index:86},this.rules[7].opcodes[6]={type:2,children:[7,8,10]},this.rules[7].opcodes[7]={type:4,index:87},this.rules[7].opcodes[8]={type:3,min:0,max:1/0},this.rules[7].opcodes[9]={type:4,index:9},this.rules[7].opcodes[10]={type:4,index:87},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:1,children:[1,2,3,6]},this.rules[8].opcodes[1]={type:4,index:11},this.rules[8].opcodes[2]={type:6,string:[39]},this.rules[8].opcodes[3]={type:2,children:[4,5]},this.rules[8].opcodes[4]={type:4,index:10},this.rules[8].opcodes[5]={type:6,string:[34]},this.rules[8].opcodes[6]={type:2,children:[7,8]},this.rules[8].opcodes[7]={type:4,index:10},this.rules[8].opcodes[8]={type:4,index:12},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2,3,6]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:6,string:[34]},this.rules[9].opcodes[3]={type:2,children:[4,5]},this.rules[9].opcodes[4]={type:4,index:10},this.rules[9].opcodes[5]={type:6,string:[39]},this.rules[9].opcodes[6]={type:2,children:[7,8]},this.rules[9].opcodes[7]={type:4,index:10},this.rules[9].opcodes[8]={type:4,index:12},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[92]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[11].opcodes[1]={type:5,min:32,max:33},this.rules[11].opcodes[2]={type:5,min:35,max:38},this.rules[11].opcodes[3]={type:5,min:40,max:91},this.rules[11].opcodes[4]={type:5,min:93,max:55295},this.rules[11].opcodes[5]={type:5,min:57344,max:1114111},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8]},this.rules[12].opcodes[1]={type:6,string:[98]},this.rules[12].opcodes[2]={type:6,string:[102]},this.rules[12].opcodes[3]={type:6,string:[110]},this.rules[12].opcodes[4]={type:6,string:[114]},this.rules[12].opcodes[5]={type:6,string:[116]},this.rules[12].opcodes[6]={type:7,string:[47]},this.rules[12].opcodes[7]={type:7,string:[92]},this.rules[12].opcodes[8]={type:2,children:[9,10]},this.rules[12].opcodes[9]={type:6,string:[117]},this.rules[12].opcodes[10]={type:4,index:13},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:1,children:[1,2]},this.rules[13].opcodes[1]={type:4,index:14},this.rules[13].opcodes[2]={type:2,children:[3,4,5,6]},this.rules[13].opcodes[3]={type:4,index:15},this.rules[13].opcodes[4]={type:7,string:[92]},this.rules[13].opcodes[5]={type:6,string:[117]},this.rules[13].opcodes[6]={type:4,index:16},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:1,children:[1,11]},this.rules[14].opcodes[1]={type:2,children:[2,9]},this.rules[14].opcodes[2]={type:1,children:[3,4,5,6,7,8]},this.rules[14].opcodes[3]={type:4,index:65},this.rules[14].opcodes[4]={type:7,string:[97]},this.rules[14].opcodes[5]={type:7,string:[98]},this.rules[14].opcodes[6]={type:7,string:[99]},this.rules[14].opcodes[7]={type:7,string:[101]},this.rules[14].opcodes[8]={type:7,string:[102]},this.rules[14].opcodes[9]={type:3,min:3,max:3},this.rules[14].opcodes[10]={type:4,index:17},this.rules[14].opcodes[11]={type:2,children:[12,13,14]},this.rules[14].opcodes[12]={type:7,string:[100]},this.rules[14].opcodes[13]={type:5,min:48,max:55},this.rules[14].opcodes[14]={type:3,min:2,max:2},this.rules[14].opcodes[15]={type:4,index:17},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2,7]},this.rules[15].opcodes[1]={type:7,string:[100]},this.rules[15].opcodes[2]={type:1,children:[3,4,5,6]},this.rules[15].opcodes[3]={type:7,string:[56]},this.rules[15].opcodes[4]={type:7,string:[57]},this.rules[15].opcodes[5]={type:7,string:[97]},this.rules[15].opcodes[6]={type:7,string:[98]},this.rules[15].opcodes[7]={type:3,min:2,max:2},this.rules[15].opcodes[8]={type:4,index:17},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,2,7]},this.rules[16].opcodes[1]={type:7,string:[100]},this.rules[16].opcodes[2]={type:1,children:[3,4,5,6]},this.rules[16].opcodes[3]={type:7,string:[99]},this.rules[16].opcodes[4]={type:7,string:[100]},this.rules[16].opcodes[5]={type:7,string:[101]},this.rules[16].opcodes[6]={type:7,string:[102]},this.rules[16].opcodes[7]={type:3,min:2,max:2},this.rules[16].opcodes[8]={type:4,index:17},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[17].opcodes[1]={type:4,index:65},this.rules[17].opcodes[2]={type:7,string:[97]},this.rules[17].opcodes[3]={type:7,string:[98]},this.rules[17].opcodes[4]={type:7,string:[99]},this.rules[17].opcodes[5]={type:7,string:[100]},this.rules[17].opcodes[6]={type:7,string:[101]},this.rules[17].opcodes[7]={type:7,string:[102]},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:7,string:[42]},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:4,index:20},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:1,children:[1,2]},this.rules[20].opcodes[1]={type:7,string:[48]},this.rules[20].opcodes[2]={type:2,children:[3,5,6]},this.rules[20].opcodes[3]={type:3,min:0,max:1},this.rules[20].opcodes[4]={type:7,string:[45]},this.rules[20].opcodes[5]={type:4,index:21},this.rules[20].opcodes[6]={type:3,min:0,max:1/0},this.rules[20].opcodes[7]={type:4,index:65},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:5,min:49,max:57},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:2,children:[1,5,6,7,11]},this.rules[22].opcodes[1]={type:3,min:0,max:1},this.rules[22].opcodes[2]={type:2,children:[3,4]},this.rules[22].opcodes[3]={type:4,index:23},this.rules[22].opcodes[4]={type:4,index:3},this.rules[22].opcodes[5]={type:4,index:85},this.rules[22].opcodes[6]={type:4,index:3},this.rules[22].opcodes[7]={type:3,min:0,max:1},this.rules[22].opcodes[8]={type:2,children:[9,10]},this.rules[22].opcodes[9]={type:4,index:24},this.rules[22].opcodes[10]={type:4,index:3},this.rules[22].opcodes[11]={type:3,min:0,max:1},this.rules[22].opcodes[12]={type:2,children:[13,14]},this.rules[22].opcodes[13]={type:4,index:85},this.rules[22].opcodes[14]={type:3,min:0,max:1},this.rules[22].opcodes[15]={type:2,children:[16,17]},this.rules[22].opcodes[16]={type:4,index:3},this.rules[22].opcodes[17]={type:4,index:25},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:4,index:20},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:4,index:20},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:4,index:20},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:2,children:[1,2,3]},this.rules[26].opcodes[1]={type:4,index:88},this.rules[26].opcodes[2]={type:4,index:3},this.rules[26].opcodes[3]={type:4,index:27},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:4,index:28},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:29},this.rules[28].opcodes[2]={type:3,min:0,max:1/0},this.rules[28].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[28].opcodes[4]={type:4,index:3},this.rules[28].opcodes[5]={type:4,index:89},this.rules[28].opcodes[6]={type:4,index:3},this.rules[28].opcodes[7]={type:4,index:29},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:2,children:[1,2]},this.rules[29].opcodes[1]={type:4,index:30},this.rules[29].opcodes[2]={type:3,min:0,max:1/0},this.rules[29].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[29].opcodes[4]={type:4,index:3},this.rules[29].opcodes[5]={type:4,index:90},this.rules[29].opcodes[6]={type:4,index:3},this.rules[29].opcodes[7]={type:4,index:30},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:1,children:[1,2,3]},this.rules[30].opcodes[1]={type:4,index:31},this.rules[30].opcodes[2]={type:4,index:37},this.rules[30].opcodes[3]={type:4,index:33},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:2,children:[1,5,6,7,8,9]},this.rules[31].opcodes[1]={type:3,min:0,max:1},this.rules[31].opcodes[2]={type:2,children:[3,4]},this.rules[31].opcodes[3]={type:4,index:32},this.rules[31].opcodes[4]={type:4,index:3},this.rules[31].opcodes[5]={type:4,index:82},this.rules[31].opcodes[6]={type:4,index:3},this.rules[31].opcodes[7]={type:4,index:27},this.rules[31].opcodes[8]={type:4,index:3},this.rules[31].opcodes[9]={type:4,index:83},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:7,string:[33]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:2,children:[1,5]},this.rules[33].opcodes[1]={type:3,min:0,max:1},this.rules[33].opcodes[2]={type:2,children:[3,4]},this.rules[33].opcodes[3]={type:4,index:32},this.rules[33].opcodes[4]={type:4,index:3},this.rules[33].opcodes[5]={type:1,children:[6,7]},this.rules[33].opcodes[6]={type:4,index:34},this.rules[33].opcodes[7]={type:4,index:57},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:1,children:[1,2]},this.rules[34].opcodes[1]={type:4,index:35},this.rules[34].opcodes[2]={type:4,index:0},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:2,children:[1,2]},this.rules[35].opcodes[1]={type:4,index:36},this.rules[35].opcodes[2]={type:4,index:1},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:7,string:[64]},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:2,children:[1,2,3,4,5]},this.rules[37].opcodes[1]={type:4,index:39},this.rules[37].opcodes[2]={type:4,index:3},this.rules[37].opcodes[3]={type:4,index:40},this.rules[37].opcodes[4]={type:4,index:3},this.rules[37].opcodes[5]={type:4,index:39},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[38].opcodes[1]={type:4,index:47},this.rules[38].opcodes[2]={type:4,index:7},this.rules[38].opcodes[3]={type:4,index:50},this.rules[38].opcodes[4]={type:4,index:51},this.rules[38].opcodes[5]={type:4,index:52},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:1,children:[1,2,3]},this.rules[39].opcodes[1]={type:4,index:41},this.rules[39].opcodes[2]={type:4,index:57},this.rules[39].opcodes[3]={type:4,index:38},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2,3,4,5,6]},this.rules[40].opcodes[1]={type:7,string:[61,61]},this.rules[40].opcodes[2]={type:7,string:[33,61]},this.rules[40].opcodes[3]={type:7,string:[60,61]},this.rules[40].opcodes[4]={type:7,string:[62,61]},this.rules[40].opcodes[5]={type:7,string:[60]},this.rules[40].opcodes[6]={type:7,string:[62]},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:1,children:[1,2]},this.rules[41].opcodes[1]={type:4,index:42},this.rules[41].opcodes[2]={type:4,index:43},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:4,index:36},this.rules[42].opcodes[2]={type:4,index:44},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:2,children:[1,2]},this.rules[43].opcodes[1]={type:4,index:4},this.rules[43].opcodes[2]={type:4,index:44},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:3,min:0,max:1/0},this.rules[44].opcodes[1]={type:2,children:[2,3]},this.rules[44].opcodes[2]={type:4,index:3},this.rules[44].opcodes[3]={type:1,children:[4,5]},this.rules[44].opcodes[4]={type:4,index:45},this.rules[44].opcodes[5]={type:4,index:46},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:1,children:[1,5]},this.rules[45].opcodes[1]={type:2,children:[2,3,4]},this.rules[45].opcodes[2]={type:4,index:80},this.rules[45].opcodes[3]={type:4,index:6},this.rules[45].opcodes[4]={type:4,index:81},this.rules[45].opcodes[5]={type:2,children:[6,7]},this.rules[45].opcodes[6]={type:4,index:78},this.rules[45].opcodes[7]={type:4,index:62},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:2,children:[1,2,3]},this.rules[46].opcodes[1]={type:4,index:80},this.rules[46].opcodes[2]={type:4,index:19},this.rules[46].opcodes[3]={type:4,index:81},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:2,children:[1,4,6]},this.rules[47].opcodes[1]={type:1,children:[2,3]},this.rules[47].opcodes[2]={type:4,index:20},this.rules[47].opcodes[3]={type:7,string:[45,48]},this.rules[47].opcodes[4]={type:3,min:0,max:1},this.rules[47].opcodes[5]={type:4,index:48},this.rules[47].opcodes[6]={type:3,min:0,max:1},this.rules[47].opcodes[7]={type:4,index:49},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:2,children:[1,2]},this.rules[48].opcodes[1]={type:7,string:[46]},this.rules[48].opcodes[2]={type:3,min:1,max:1/0},this.rules[48].opcodes[3]={type:4,index:65},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:2,children:[1,2,6]},this.rules[49].opcodes[1]={type:7,string:[101]},this.rules[49].opcodes[2]={type:3,min:0,max:1},this.rules[49].opcodes[3]={type:1,children:[4,5]},this.rules[49].opcodes[4]={type:7,string:[45]},this.rules[49].opcodes[5]={type:7,string:[43]},this.rules[49].opcodes[6]={type:3,min:1,max:1/0},this.rules[49].opcodes[7]={type:4,index:65},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[116,114,117,101]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[102,97,108,115,101]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[110,117,108,108]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:4,index:54},this.rules[53].opcodes[2]={type:3,min:0,max:1/0},this.rules[53].opcodes[3]={type:4,index:55},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:4,index:56},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:1,children:[1,2,3]},this.rules[55].opcodes[1]={type:4,index:54},this.rules[55].opcodes[2]={type:7,string:[95]},this.rules[55].opcodes[3]={type:4,index:65},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:5,min:97,max:122},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:2,children:[1,2,3,4,13,14]},this.rules[57].opcodes[1]={type:4,index:53},this.rules[57].opcodes[2]={type:4,index:82},this.rules[57].opcodes[3]={type:4,index:3},this.rules[57].opcodes[4]={type:3,min:0,max:1},this.rules[57].opcodes[5]={type:2,children:[6,7]},this.rules[57].opcodes[6]={type:4,index:58},this.rules[57].opcodes[7]={type:3,min:0,max:1/0},this.rules[57].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[57].opcodes[9]={type:4,index:3},this.rules[57].opcodes[10]={type:4,index:84},this.rules[57].opcodes[11]={type:4,index:3},this.rules[57].opcodes[12]={type:4,index:58},this.rules[57].opcodes[13]={type:4,index:3},this.rules[57].opcodes[14]={type:4,index:83},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[58].opcodes[1]={type:4,index:27},this.rules[58].opcodes[2]={type:4,index:34},this.rules[58].opcodes[3]={type:4,index:57},this.rules[58].opcodes[4]={type:4,index:38},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:1,children:[1,2]},this.rules[59].opcodes[1]={type:4,index:60},this.rules[59].opcodes[2]={type:4,index:67},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:1,children:[1,2]},this.rules[60].opcodes[1]={type:4,index:61},this.rules[60].opcodes[2]={type:2,children:[3,4]},this.rules[60].opcodes[3]={type:4,index:78},this.rules[60].opcodes[4]={type:1,children:[5,6]},this.rules[60].opcodes[5]={type:4,index:18},this.rules[60].opcodes[6]={type:4,index:62},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3,4,10,11]},this.rules[61].opcodes[1]={type:4,index:80},this.rules[61].opcodes[2]={type:4,index:3},this.rules[61].opcodes[3]={type:4,index:5},this.rules[61].opcodes[4]={type:3,min:0,max:1/0},this.rules[61].opcodes[5]={type:2,children:[6,7,8,9]},this.rules[61].opcodes[6]={type:4,index:3},this.rules[61].opcodes[7]={type:4,index:84},this.rules[61].opcodes[8]={type:4,index:3},this.rules[61].opcodes[9]={type:4,index:5},this.rules[61].opcodes[10]={type:4,index:3},this.rules[61].opcodes[11]={type:4,index:81},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:2,children:[1,2]},this.rules[62].opcodes[1]={type:4,index:63},this.rules[62].opcodes[2]={type:3,min:0,max:1/0},this.rules[62].opcodes[3]={type:4,index:64},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[63].opcodes[1]={type:4,index:66},this.rules[63].opcodes[2]={type:7,string:[95]},this.rules[63].opcodes[3]={type:5,min:128,max:55295},this.rules[63].opcodes[4]={type:5,min:57344,max:1114111},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:1,children:[1,2]},this.rules[64].opcodes[1]={type:4,index:63},this.rules[64].opcodes[2]={type:4,index:65},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:5,min:48,max:57},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:1,children:[1,2]},this.rules[66].opcodes[1]={type:5,min:65,max:90},this.rules[66].opcodes[2]={type:5,min:97,max:122},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:2,children:[1,2]},this.rules[67].opcodes[1]={type:4,index:79},this.rules[67].opcodes[2]={type:1,children:[3,4,5]},this.rules[67].opcodes[3]={type:4,index:61},this.rules[67].opcodes[4]={type:4,index:18},this.rules[67].opcodes[5]={type:4,index:62},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:2,children:[1,2]},this.rules[68].opcodes[1]={type:4,index:4},this.rules[68].opcodes[2]={type:3,min:0,max:1/0},this.rules[68].opcodes[3]={type:4,index:69},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:2,children:[1,2,3]},this.rules[69].opcodes[1]={type:4,index:80},this.rules[69].opcodes[2]={type:4,index:70},this.rules[69].opcodes[3]={type:4,index:81},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:1,children:[1,2]},this.rules[70].opcodes[1]={type:4,index:71},this.rules[70].opcodes[2]={type:4,index:77},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:2,children:[1,2,4]},this.rules[71].opcodes[1]={type:4,index:87},this.rules[71].opcodes[2]={type:3,min:0,max:1/0},this.rules[71].opcodes[3]={type:4,index:72},this.rules[71].opcodes[4]={type:4,index:87},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:1,children:[1,2]},this.rules[72].opcodes[1]={type:4,index:73},this.rules[72].opcodes[2]={type:2,children:[3,4]},this.rules[72].opcodes[3]={type:4,index:10},this.rules[72].opcodes[4]={type:4,index:74},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[73].opcodes[1]={type:5,min:32,max:38},this.rules[73].opcodes[2]={type:5,min:40,max:91},this.rules[73].opcodes[3]={type:5,min:93,max:55295},this.rules[73].opcodes[4]={type:5,min:57344,max:1114111},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8]},this.rules[74].opcodes[1]={type:6,string:[98]},this.rules[74].opcodes[2]={type:6,string:[102]},this.rules[74].opcodes[3]={type:6,string:[110]},this.rules[74].opcodes[4]={type:6,string:[114]},this.rules[74].opcodes[5]={type:6,string:[116]},this.rules[74].opcodes[6]={type:7,string:[39]},this.rules[74].opcodes[7]={type:7,string:[92]},this.rules[74].opcodes[8]={type:2,children:[9,10]},this.rules[74].opcodes[9]={type:6,string:[117]},this.rules[74].opcodes[10]={type:4,index:75},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:2,children:[1,2,3]},this.rules[75].opcodes[1]={type:7,string:[48]},this.rules[75].opcodes[2]={type:7,string:[48]},this.rules[75].opcodes[3]={type:1,children:[4,7,10,13]},this.rules[75].opcodes[4]={type:2,children:[5,6]},this.rules[75].opcodes[5]={type:7,string:[48]},this.rules[75].opcodes[6]={type:5,min:48,max:55},this.rules[75].opcodes[7]={type:2,children:[8,9]},this.rules[75].opcodes[8]={type:7,string:[48]},this.rules[75].opcodes[9]={type:6,string:[98]},this.rules[75].opcodes[10]={type:2,children:[11,12]},this.rules[75].opcodes[11]={type:7,string:[48]},this.rules[75].opcodes[12]={type:5,min:101,max:102},this.rules[75].opcodes[13]={type:2,children:[14,15]},this.rules[75].opcodes[14]={type:7,string:[49]},this.rules[75].opcodes[15]={type:4,index:76},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:4,index:65},this.rules[76].opcodes[2]={type:5,min:97,max:102},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:7,string:[48]},this.rules[77].opcodes[2]={type:2,children:[3,4]},this.rules[77].opcodes[3]={type:4,index:21},this.rules[77].opcodes[4]={type:3,min:0,max:1/0},this.rules[77].opcodes[5]={type:4,index:65},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:7,string:[46]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:7,string:[46,46]},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:7,string:[91]},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:7,string:[93]},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:7,string:[40]},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:7,string:[41]},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:7,string:[44]},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:7,string:[58]},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:6,string:[34]},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:6,string:[39]},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:7,string:[63]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:7,string:[124,124]},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:7,string:[38,38]},this.toString=function(){let e="";return e+="; JSONPath: Query Expressions for JSON\n",e+="; https://www.rfc-editor.org/rfc/rfc9535\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1\n",e+="jsonpath-query = root-identifier segments\n",e+="segments = *(S segment)\n",e+="\n",e+="B = %x20 / ; Space\n",e+=" %x09 / ; Horizontal tab\n",e+=" %x0A / ; Line feed or New line\n",e+=" %x0D ; Carriage return\n",e+="S = *B ; optional blank space\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1\n",e+='root-identifier = "$"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3\n",e+="selector = name-selector /\n",e+=" wildcard-selector /\n",e+=" slice-selector /\n",e+=" index-selector /\n",e+=" filter-selector\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1\n",e+="name-selector = string-literal\n",e+="\n",e+='string-literal = dquote *double-quoted dquote / ; "string", MODIFICATION: surrogate text rule used\n',e+=" squote *single-quoted squote ; 'string', MODIFICATION: surrogate text rule used\n",e+="\n",e+="double-quoted = unescaped /\n",e+=" %x27 / ; '\n",e+=' ESC %x22 / ; \\"\n',e+=" ESC escapable\n",e+="\n",e+="single-quoted = unescaped /\n",e+=' %x22 / ; "\n',e+=" ESC %x27 / ; \\'\n",e+=" ESC escapable\n",e+="\n",e+="ESC = %x5C ; \\ backslash\n",e+="\n",e+="unescaped = %x20-21 / ; see RFC 8259\n",e+=' ; omit 0x22 "\n',e+=" %x23-26 /\n",e+=" ; omit 0x27 '\n",e+=" %x28-5B /\n",e+=" ; omit 0x5C \\\n",e+=" %x5D-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="\n",e+="escapable = %x62 / ; b BS backspace U+0008\n",e+=" %x66 / ; f FF form feed U+000C\n",e+=" %x6E / ; n LF line feed U+000A\n",e+=" %x72 / ; r CR carriage return U+000D\n",e+=" %x74 / ; t HT horizontal tab U+0009\n",e+=' "/" / ; / slash (solidus) U+002F\n',e+=' "\\" / ; \\ backslash (reverse solidus) U+005C\n',e+=" (%x75 hexchar) ; uXXXX U+XXXX\n",e+="\n",e+="hexchar = non-surrogate /\n",e+=' (high-surrogate "\\" %x75 low-surrogate)\n',e+='non-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /\n',e+=' ("D" %x30-37 2HEXDIG )\n',e+='high-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG\n',e+='low-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG\n',e+="\n",e+='HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1\n",e+='wildcard-selector = "*"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1\n",e+="index-selector = int ; decimal integer\n",e+="\n",e+='int = "0" /\n',e+=' (["-"] DIGIT1 *DIGIT) ; - optional\n',e+="DIGIT1 = %x31-39 ; 1-9 non-zero digit\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1\n",e+="slice-selector = [start S] colon S [end S] [colon [S step ]] ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="start = int ; included in selection\n",e+="end = int ; not included in selection\n",e+="step = int ; default: 1\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1\n",e+="filter-selector = questionmark S logical-expr ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="logical-expr = logical-or-expr\n",e+="logical-or-expr = logical-and-expr *(S disjunction S logical-and-expr) ; MODIFICATION: surrogate text rule used\n",e+=" ; disjunction\n",e+=" ; binds less tightly than conjunction\n",e+="logical-and-expr = basic-expr *(S conjunction S basic-expr) ; MODIFICATION: surrogate text rule used\n",e+=" ; conjunction\n",e+=" ; binds more tightly than disjunction\n",e+="\n",e+="basic-expr = paren-expr /\n",e+=" comparison-expr /\n",e+=" test-expr\n",e+="\n",e+="paren-expr = [logical-not-op S] left-paren S logical-expr S right-paren ; MODIFICATION: surrogate text rule used\n",e+=" ; parenthesized expression\n",e+='logical-not-op = "!" ; logical NOT operator\n',e+="\n",e+="test-expr = [logical-not-op S]\n",e+=" (filter-query / ; existence/non-existence\n",e+=" function-expr) ; LogicalType or NodesType\n",e+="filter-query = rel-query / jsonpath-query\n",e+="rel-query = current-node-identifier segments\n",e+='current-node-identifier = "@"\n',e+="\n",e+="comparison-expr = comparable S comparison-op S comparable\n",e+="literal = number / string-literal /\n",e+=" true / false / null\n",e+="comparable = singular-query / ; singular query value\n",e+=" function-expr / ; ValueType\n",e+=" literal\n",e+=" ; MODIFICATION: https://www.rfc-editor.org/errata/eid8352\n",e+='comparison-op = "==" / "!=" /\n',e+=' "<=" / ">=" /\n',e+=' "<" / ">"\n',e+="\n",e+="singular-query = rel-singular-query / abs-singular-query\n",e+="rel-singular-query = current-node-identifier singular-query-segments\n",e+="abs-singular-query = root-identifier singular-query-segments\n",e+="singular-query-segments = *(S (name-segment / index-segment))\n",e+="name-segment = (left-bracket name-selector right-bracket) / ; MODIFICATION: surrogate text rule used\n",e+=" (dot-prefix member-name-shorthand) ; MODIFICATION: surrogate text rule used\n",e+="index-segment = left-bracket index-selector right-bracket ; MODIFICATION: surrogate text rule used\n",e+="\n",e+='number = (int / "-0") [ frac ] [ exp ] ; decimal number\n',e+='frac = "." 1*DIGIT ; decimal fraction\n',e+='exp = "e" [ "-" / "+" ] 1*DIGIT ; decimal exponent\n',e+="true = %x74.72.75.65 ; true\n",e+="false = %x66.61.6c.73.65 ; false\n",e+="null = %x6e.75.6c.6c ; null\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.4\n",e+="function-name = function-name-first *function-name-char\n",e+="function-name-first = LCALPHA\n",e+='function-name-char = function-name-first / "_" / DIGIT\n',e+='LCALPHA = %x61-7A ; "a".."z"\n',e+="\n",e+="function-expr = function-name left-paren S [function-argument ; MODIFICATION: surrogate text rule used\n",e+=" *(S comma S function-argument)] S right-paren ; MODIFICATION: surrogate text rule used\n",e+="function-argument = logical-expr / ; MODIFICATION: https://www.rfc-editor.org/errata/eid8343\n",e+=" filter-query / ; (includes singular-query)\n",e+=" function-expr /\n",e+=" literal\n",e+="\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5\n",e+="segment = child-segment / descendant-segment\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1\n",e+="child-segment = bracketed-selection /\n",e+=" (dot-prefix ; MODIFICATION: surrogate text rule used\n",e+=" (wildcard-selector /\n",e+=" member-name-shorthand))\n",e+="\n",e+="bracketed-selection = left-bracket S selector *(S comma S selector) S right-bracket\n",e+=" ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="member-name-shorthand = name-first *name-char\n",e+="name-first = ALPHA /\n",e+=' "_" /\n',e+=" %x80-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="name-char = name-first / DIGIT\n",e+="\n",e+="DIGIT = %x30-39 ; 0-9\n",e+="ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1\n",e+="descendant-segment = double-dot-prefix (bracketed-selection / ; MODIFICATION: surrogate text rule used\n",e+=" wildcard-selector /\n",e+=" member-name-shorthand)\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths\n",e+="normalized-path = root-identifier *(normal-index-segment)\n",e+="normal-index-segment = left-bracket normal-selector right-bracket ; MODIFICATION: surrogate text rule used\n",e+="normal-selector = normal-name-selector / normal-index-selector\n",e+="normal-name-selector = squote *normal-single-quoted squote ; 'string', MODIFICATION: surrogate text rule used\n",e+="normal-single-quoted = normal-unescaped /\n",e+=" ESC normal-escapable\n",e+="normal-unescaped = ; omit %x0-1F control codes\n",e+=" %x20-26 /\n",e+=" ; omit 0x27 '\n",e+=" %x28-5B /\n",e+=" ; omit 0x5C \\\n",e+=" %x5D-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="\n",e+="normal-escapable = %x62 / ; b BS backspace U+0008\n",e+=" %x66 / ; f FF form feed U+000C\n",e+=" %x6E / ; n LF line feed U+000A\n",e+=" %x72 / ; r CR carriage return U+000D\n",e+=" %x74 / ; t HT horizontal tab U+0009\n",e+=" \"'\" / ; ' apostrophe U+0027\n",e+=' "\\" / ; \\ backslash (reverse solidus) U+005C\n',e+=" (%x75 normal-hexchar)\n",e+=" ; certain values u00xx U+00XX\n",e+='normal-hexchar = "0" "0"\n',e+=" (\n",e+=' ("0" %x30-37) / ; "00"-"07"\n',e+=" ; omit U+0008-U+000A BS HT LF\n",e+=' ("0" %x62) / ; "0b"\n',e+=" ; omit U+000C-U+000D FF CR\n",e+=' ("0" %x65-66) / ; "0e"-"0f"\n',e+=' ("1" normal-HEXDIG)\n',e+=" )\n",e+='normal-HEXDIG = DIGIT / %x61-66 ; "0"-"9", "a"-"f"\n',e+='normal-index-selector = "0" / (DIGIT1 *DIGIT)\n',e+=" ; non-negative decimal integer\n",e+="\n",e+="; Surrogate named rules\n",e+='dot-prefix = "."\n',e+='double-dot-prefix = ".."\n',e+='left-bracket = "["\n',e+='right-bracket = "]"\n',e+='left-paren = "("\n',e+='right-paren = ")"\n',e+='comma = ","\n',e+='colon = ":"\n',e+='dquote = %x22 ; "\n',e+="squote = %x27 ; '\n",e+='questionmark = "?"\n',e+='disjunction = "||"\n',e+='conjunction = "&&"\n','; JSONPath: Query Expressions for JSON\n; https://www.rfc-editor.org/rfc/rfc9535\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1\njsonpath-query = root-identifier segments\nsegments = *(S segment)\n\nB = %x20 / ; Space\n %x09 / ; Horizontal tab\n %x0A / ; Line feed or New line\n %x0D ; Carriage return\nS = *B ; optional blank space\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1\nroot-identifier = "$"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3\nselector = name-selector /\n wildcard-selector /\n slice-selector /\n index-selector /\n filter-selector\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1\nname-selector = string-literal\n\nstring-literal = dquote *double-quoted dquote / ; "string", MODIFICATION: surrogate text rule used\n squote *single-quoted squote ; \'string\', MODIFICATION: surrogate text rule used\n\ndouble-quoted = unescaped /\n %x27 / ; \'\n ESC %x22 / ; \\"\n ESC escapable\n\nsingle-quoted = unescaped /\n %x22 / ; "\n ESC %x27 / ; \\\'\n ESC escapable\n\nESC = %x5C ; \\ backslash\n\nunescaped = %x20-21 / ; see RFC 8259\n ; omit 0x22 "\n %x23-26 /\n ; omit 0x27 \'\n %x28-5B /\n ; omit 0x5C \\\n %x5D-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\n\nescapable = %x62 / ; b BS backspace U+0008\n %x66 / ; f FF form feed U+000C\n %x6E / ; n LF line feed U+000A\n %x72 / ; r CR carriage return U+000D\n %x74 / ; t HT horizontal tab U+0009\n "/" / ; / slash (solidus) U+002F\n "\\" / ; \\ backslash (reverse solidus) U+005C\n (%x75 hexchar) ; uXXXX U+XXXX\n\nhexchar = non-surrogate /\n (high-surrogate "\\" %x75 low-surrogate)\nnon-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /\n ("D" %x30-37 2HEXDIG )\nhigh-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG\nlow-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG\n\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1\nwildcard-selector = "*"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1\nindex-selector = int ; decimal integer\n\nint = "0" /\n (["-"] DIGIT1 *DIGIT) ; - optional\nDIGIT1 = %x31-39 ; 1-9 non-zero digit\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1\nslice-selector = [start S] colon S [end S] [colon [S step ]] ; MODIFICATION: surrogate text rule used\n\nstart = int ; included in selection\nend = int ; not included in selection\nstep = int ; default: 1\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1\nfilter-selector = questionmark S logical-expr ; MODIFICATION: surrogate text rule used\n\nlogical-expr = logical-or-expr\nlogical-or-expr = logical-and-expr *(S disjunction S logical-and-expr) ; MODIFICATION: surrogate text rule used\n ; disjunction\n ; binds less tightly than conjunction\nlogical-and-expr = basic-expr *(S conjunction S basic-expr) ; MODIFICATION: surrogate text rule used\n ; conjunction\n ; binds more tightly than disjunction\n\nbasic-expr = paren-expr /\n comparison-expr /\n test-expr\n\nparen-expr = [logical-not-op S] left-paren S logical-expr S right-paren ; MODIFICATION: surrogate text rule used\n ; parenthesized expression\nlogical-not-op = "!" ; logical NOT operator\n\ntest-expr = [logical-not-op S]\n (filter-query / ; existence/non-existence\n function-expr) ; LogicalType or NodesType\nfilter-query = rel-query / jsonpath-query\nrel-query = current-node-identifier segments\ncurrent-node-identifier = "@"\n\ncomparison-expr = comparable S comparison-op S comparable\nliteral = number / string-literal /\n true / false / null\ncomparable = singular-query / ; singular query value\n function-expr / ; ValueType\n literal\n ; MODIFICATION: https://www.rfc-editor.org/errata/eid8352\ncomparison-op = "==" / "!=" /\n "<=" / ">=" /\n "<" / ">"\n\nsingular-query = rel-singular-query / abs-singular-query\nrel-singular-query = current-node-identifier singular-query-segments\nabs-singular-query = root-identifier singular-query-segments\nsingular-query-segments = *(S (name-segment / index-segment))\nname-segment = (left-bracket name-selector right-bracket) / ; MODIFICATION: surrogate text rule used\n (dot-prefix member-name-shorthand) ; MODIFICATION: surrogate text rule used\nindex-segment = left-bracket index-selector right-bracket ; MODIFICATION: surrogate text rule used\n\nnumber = (int / "-0") [ frac ] [ exp ] ; decimal number\nfrac = "." 1*DIGIT ; decimal fraction\nexp = "e" [ "-" / "+" ] 1*DIGIT ; decimal exponent\ntrue = %x74.72.75.65 ; true\nfalse = %x66.61.6c.73.65 ; false\nnull = %x6e.75.6c.6c ; null\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.4\nfunction-name = function-name-first *function-name-char\nfunction-name-first = LCALPHA\nfunction-name-char = function-name-first / "_" / DIGIT\nLCALPHA = %x61-7A ; "a".."z"\n\nfunction-expr = function-name left-paren S [function-argument ; MODIFICATION: surrogate text rule used\n *(S comma S function-argument)] S right-paren ; MODIFICATION: surrogate text rule used\nfunction-argument = logical-expr / ; MODIFICATION: https://www.rfc-editor.org/errata/eid8343\n filter-query / ; (includes singular-query)\n function-expr /\n literal\n\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5\nsegment = child-segment / descendant-segment\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1\nchild-segment = bracketed-selection /\n (dot-prefix ; MODIFICATION: surrogate text rule used\n (wildcard-selector /\n member-name-shorthand))\n\nbracketed-selection = left-bracket S selector *(S comma S selector) S right-bracket\n ; MODIFICATION: surrogate text rule used\n\nmember-name-shorthand = name-first *name-char\nname-first = ALPHA /\n "_" /\n %x80-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\nname-char = name-first / DIGIT\n\nDIGIT = %x30-39 ; 0-9\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1\ndescendant-segment = double-dot-prefix (bracketed-selection / ; MODIFICATION: surrogate text rule used\n wildcard-selector /\n member-name-shorthand)\n\n; https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths\nnormalized-path = root-identifier *(normal-index-segment)\nnormal-index-segment = left-bracket normal-selector right-bracket ; MODIFICATION: surrogate text rule used\nnormal-selector = normal-name-selector / normal-index-selector\nnormal-name-selector = squote *normal-single-quoted squote ; \'string\', MODIFICATION: surrogate text rule used\nnormal-single-quoted = normal-unescaped /\n ESC normal-escapable\nnormal-unescaped = ; omit %x0-1F control codes\n %x20-26 /\n ; omit 0x27 \'\n %x28-5B /\n ; omit 0x5C \\\n %x5D-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\n\nnormal-escapable = %x62 / ; b BS backspace U+0008\n %x66 / ; f FF form feed U+000C\n %x6E / ; n LF line feed U+000A\n %x72 / ; r CR carriage return U+000D\n %x74 / ; t HT horizontal tab U+0009\n "\'" / ; \' apostrophe U+0027\n "\\" / ; \\ backslash (reverse solidus) U+005C\n (%x75 normal-hexchar)\n ; certain values u00xx U+00XX\nnormal-hexchar = "0" "0"\n (\n ("0" %x30-37) / ; "00"-"07"\n ; omit U+0008-U+000A BS HT LF\n ("0" %x62) / ; "0b"\n ; omit U+000C-U+000D FF CR\n ("0" %x65-66) / ; "0e"-"0f"\n ("1" normal-HEXDIG)\n )\nnormal-HEXDIG = DIGIT / %x61-66 ; "0"-"9", "a"-"f"\nnormal-index-selector = "0" / (DIGIT1 *DIGIT)\n ; non-negative decimal integer\n\n; Surrogate named rules\ndot-prefix = "."\ndouble-dot-prefix = ".."\nleft-bracket = "["\nright-bracket = "]"\nleft-paren = "("\nright-paren = ")"\ncomma = ","\ncolon = ":"\ndquote = %x22 ; "\nsquote = %x27 ; \'\nquestionmark = "?"\ndisjunction = "||"\nconjunction = "&&"\n'}}e.r(r),e.d(r,{count:()=>we,length:()=>be,match:()=>Se,search:()=>Ae,value:()=>ke});const o=function(){const e=u,t=a,s=this,r="parser.js: Parser(): ";s.ast=void 0,s.stats=void 0,s.trace=void 0,s.callbacks=[];let n,o,i,l,c,p,h,d=0,m=0,y=0,g=0,f=0,x=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};s.parse=(a,u,b,w)=>{const T=`${r}parse(): `;d=0,m=0,y=0,g=0,f=0,n=void 0,o=void 0,i=void 0,l=void 0,x.refresh(),c=void 0,p=void 0,h=void 0,l=t.stringToChars(b),n=a.rules,o=a.udts;const E=u.toLowerCase();let S;for(const e in n)if(n.hasOwnProperty(e)&&E===n[e].lower){S=n[e].index;break}if(void 0===S)throw new Error(`${T}start rule name '${startRule}' not recognized`);(()=>{const e=`${r}initializeCallbacks(): `;let t,i;for(c=[],p=[],t=0;t<n.length;t+=1)c[t]=void 0;for(t=0;t<o.length;t+=1)p[t]=void 0;const l=[];for(t=0;t<n.length;t+=1)l.push(n[t].lower);for(t=0;t<o.length;t+=1)l.push(o[t].lower);for(const r in s.callbacks)if(s.callbacks.hasOwnProperty(r)){if(t=l.indexOf(r.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${r}' not a rule or udt name`);if(i=s.callbacks[r]?s.callbacks[r]:void 0,"function"!=typeof i&&void 0!==i)throw new Error(`${e}syntax callback[${r}] must be function reference or falsy)`);t<n.length?c[t]=i:p[t-n.length]=i}})(),s.trace&&s.trace.init(n,o,l),s.stats&&s.stats.init(n,o),s.ast&&s.ast.init(n,o,l),h=w,i=[{type:e.RNM,index:S}],k(0,0),i=void 0;let A=!1;switch(x.state){case e.ACTIVE:throw new Error(`${T}final state should never be 'ACTIVE'`);case e.NOMATCH:A=!1;break;case e.EMPTY:case e.MATCH:A=x.phraseLength===l.length;break;default:throw new Error("unrecognized state")}return{success:A,state:x.state,stateName:e.idName(x.state),length:l.length,matched:x.phraseLength,maxMatched:f,maxTreeDepth:y,nodeHits:g}};const b=(t,s,n,o)=>{if(s.phraseLength>n){let e=`${r}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${s.phraseLength}`,e+=` must be <= remaining chars: ${n}`,new Error(e)}switch(s.state){case e.ACTIVE:if(!o)throw new Error(`${r}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:s.phraseLength=0;break;case e.MATCH:0===s.phraseLength&&(s.state=e.EMPTY);break;case e.NOMATCH:s.phraseLength=0;break;default:throw new Error(`${r}opRNM(${t.name}): callback function return error. Unrecognized return state: ${s.state}`)}},w=(t,c)=>{let a,u,m;const y=i[t],g=o[y.index];x.UdtIndex=g.index,d||(m=s.ast&&s.ast.udtDefined(y.index),m&&(u=n.length+y.index,a=s.ast.getLength(),s.ast.down(u,g.name)));const f=l.length-c;p[y.index](x,l,c,h),((t,s,n)=>{if(s.phraseLength>n){let e=`${r}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${s.phraseLength}`,e+=` must be <= remaining chars: ${n}`,new Error(e)}switch(s.state){case e.ACTIVE:throw new Error(`${r}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);s.phraseLength=0;break;case e.MATCH:if(0===s.phraseLength){if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);s.state=e.EMPTY}break;case e.NOMATCH:s.phraseLength=0;break;default:throw new Error(`${r}opUDT(${t.name}): callback function return error. Unrecognized return state: ${s.state}`)}})(g,x,f),d||m&&(x.state===e.NOMATCH?s.ast.setLength(a):s.ast.up(u,g.name,c,x.phraseLength))},k=(t,o)=>{const a=`${r}opExecute(): `,u=i[t];switch(g+=1,m>y&&(y=m),m+=1,x.refresh(),s.trace&&s.trace.down(u,o),u.type){case e.ALT:((t,s)=>{const r=i[t];for(let t=0;t<r.children.length&&(k(r.children[t],s),x.state===e.NOMATCH);t+=1);})(t,o);break;case e.CAT:((t,r)=>{let n,o,l,c;const a=i[t];s.ast&&(o=s.ast.getLength()),n=!0,l=r,c=0;for(let t=0;t<a.children.length;t+=1){if(k(a.children[t],l),x.state===e.NOMATCH){n=!1;break}l+=x.phraseLength,c+=x.phraseLength}n?(x.state=0===c?e.EMPTY:e.MATCH,x.phraseLength=c):(x.state=e.NOMATCH,x.phraseLength=0,s.ast&&s.ast.setLength(o))})(t,o);break;case e.REP:((t,r)=>{let n,o,c,a;const u=i[t];if(0===u.max)return x.state=e.EMPTY,void(x.phraseLength=0);for(o=r,c=0,a=0,s.ast&&(n=s.ast.getLength());!(o>=l.length)&&(k(t+1,o),x.state!==e.NOMATCH)&&x.state!==e.EMPTY&&(a+=1,c+=x.phraseLength,o+=x.phraseLength,a!==u.max););x.state===e.EMPTY||a>=u.min?(x.state=0===c?e.EMPTY:e.MATCH,x.phraseLength=c):(x.state=e.NOMATCH,x.phraseLength=0,s.ast&&s.ast.setLength(n))})(t,o);break;case e.RNM:((t,r)=>{let o,a,u;const p=i[t],m=n[p.index],y=c[m.index];if(d||(a=s.ast&&s.ast.ruleDefined(p.index),a&&(o=s.ast.getLength(),s.ast.down(p.index,n[p.index].name))),y){const t=l.length-r;y(x,l,r,h),b(m,x,t,!0),x.state===e.ACTIVE&&(u=i,i=m.opcodes,k(0,r),i=u,y(x,l,r,h),b(m,x,t,!1))}else u=i,i=m.opcodes,k(0,r,x),i=u;d||a&&(x.state===e.NOMATCH?s.ast.setLength(o):s.ast.up(p.index,m.name,r,x.phraseLength))})(t,o);break;case e.TRG:((t,s)=>{const r=i[t];x.state=e.NOMATCH,s<l.length&&r.min<=l[s]&&l[s]<=r.max&&(x.state=e.MATCH,x.phraseLength=1)})(t,o);break;case e.TBS:((t,s)=>{const r=i[t],n=r.string.length;if(x.state=e.NOMATCH,s+n<=l.length){for(let e=0;e<n;e+=1)if(l[s+e]!==r.string[e])return;x.state=e.MATCH,x.phraseLength=n}})(t,o);break;case e.TLS:((t,s)=>{let r;const n=i[t];x.state=e.NOMATCH;const o=n.string.length;if(0!==o){if(s+o<=l.length){for(let e=0;e<o;e+=1)if(r=l[s+e],r>=65&&r<=90&&(r+=32),r!==n.string[e])return;x.state=e.MATCH,x.phraseLength=o}}else x.state=e.EMPTY})(t,o);break;case e.UDT:w(t,o);break;case e.AND:((t,s)=>{switch(d+=1,k(t+1,s),d-=1,x.phraseLength=0,x.state){case e.EMPTY:case e.MATCH:x.state=e.EMPTY;break;case e.NOMATCH:x.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${x.state}`)}})(t,o);break;case e.NOT:((t,s)=>{switch(d+=1,k(t+1,s),d-=1,x.phraseLength=0,x.state){case e.EMPTY:case e.MATCH:x.state=e.NOMATCH;break;case e.NOMATCH:x.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${x.state}`)}})(t,o);break;default:throw new Error(`${a}unrecognized operator`)}d||o+x.phraseLength>f&&(f=o+x.phraseLength),s.stats&&s.stats.collect(u,x),s.trace&&s.trace.up(u,x.state,o,x.phraseLength),m-=1}},i=function(){const e=u,t=a,s=this;let r,n,o,i=0;const l=[],c=[],p=[];function h(e){let t="";for(;e-- >0;)t+=" ";return t}s.callbacks=[],s.init=(e,t,a)=>{let u;c.length=0,p.length=0,i=0,r=e,n=t,o=a;const h=[];for(u=0;u<r.length;u+=1)h.push(r[u].lower);for(u=0;u<n.length;u+=1)h.push(n[u].lower);for(i=r.length+n.length,u=0;u<i;u+=1)l[u]=void 0;for(const e in s.callbacks)if(s.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(u=h.indexOf(t),u<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);l[u]=s.callbacks[e]}},s.ruleDefined=e=>!!l[e],s.udtDefined=e=>!!l[r.length+e],s.down=(t,s)=>{const r=p.length;return c.push(r),p.push({name:s,thisIndex:r,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),r},s.up=(t,s,r,n)=>{const o=p.length,i=c.pop();return p.push({name:s,thisIndex:o,thatIndex:i,state:e.SEM_POST,callbackIndex:t,phraseIndex:r,phraseLength:n,stack:c.length}),p[i].thatIndex=o,p[i].phraseIndex=r,p[i].phraseLength=n,o},s.translate=t=>{let s,r;for(let n=0;n<p.length;n+=1)r=p[n],s=l[r.callbackIndex],s&&(r.state===e.SEM_PRE?s(e.SEM_PRE,o,r.phraseIndex,r.phraseLength,t):s&&s(e.SEM_POST,o,r.phraseIndex,r.phraseLength,t))},s.setLength=e=>{p.length=e,c.length=e>0?p[e-1].stack:0},s.getLength=()=>p.length,s.toXml=()=>{let s="",r=0;return s+='<?xml version="1.0" encoding="utf-8"?>\n',s+=`<root nodes="${p.length/2}" characters="${o.length}">\n`,s+="\x3c!-- input string --\x3e\n",s+=h(r+2),s+=t.charsToString(o),s+="\n",p.forEach(n=>{n.state===e.SEM_PRE?(r+=1,s+=h(r),s+=`<node name="${n.name}" index="${n.phraseIndex}" length="${n.phraseLength}">\n`,s+=h(r+2),s+=t.charsToString(o,n.phraseIndex,n.phraseLength),s+="\n"):(s+=h(r),s+=`</node>\x3c!-- name="${n.name}" --\x3e\n`,r-=1)}),s+="</root>\n",s}},l=function(){const e=u,t=a,s="parser.js: Trace(): ";let r,n,o,i="",l=0;const c=this,p=e=>{let t="",s=0;if(e>=0)for(;e--;)s+=1,5===s?(t+="|",s=0):t+=".";return t};c.init=(e,t,s)=>{n=e,o=t,r=s};const h=r=>{let i;switch(r.type){case e.ALT:i="ALT";break;case e.CAT:i="CAT";break;case e.REP:i=r.max===1/0?`REP(${r.min},inf)`:`REP(${r.min},${r.max})`;break;case e.RNM:i=`RNM(${n[r.index].name})`;break;case e.TRG:i=`TRG(${r.min},${r.max})`;break;case e.TBS:i=r.string.length>6?`TBS(${t.charsToString(r.string,0,3)}...)`:`TBS(${t.charsToString(r.string,0,6)})`;break;case e.TLS:i=r.string.length>6?`TLS(${t.charsToString(r.string,0,3)}...)`:`TLS(${t.charsToString(r.string,0,6)})`;break;case e.UDT:i=`UDT(${o[r.index].name})`;break;case e.AND:i="AND";break;case e.NOT:i="NOT";break;default:throw new Error(`${s}Trace: opName: unrecognized opcode`)}return i};c.down=(e,s)=>{const n=p(l),o=Math.min(100,r.length-s);let c=t.charsToString(r,s,o);o<r.length-s&&(c+="..."),c=`${n}|-|[${h(e)}]${c}\n`,i+=c,l+=1},c.up=(n,o,c,a)=>{const u=`${s}trace.up: `;l-=1;const d=p(l);let m,y,g;switch(o){case e.EMPTY:g="|E|",y="''";break;case e.MATCH:g="|M|",m=Math.min(100,a),y=m<a?`'${t.charsToString(r,c,m)}...'`:`'${t.charsToString(r,c,m)}'`;break;case e.NOMATCH:g="|N|",y="";break;default:throw new Error(`${u} unrecognized state`)}y=`${d}${g}[${h(n)}]${y}\n`,i+=y},c.displayTrace=()=>i},c=function(){const e=u;let t,s,r;const n=[],o=[],i=[];this.init=(e,r)=>{t=e,s=r,d()},this.collect=(t,s)=>{m(r,s.state,s.phraseLength),m(n[t.type],s.state,s.phraseLength),t.type===e.RNM&&m(o[t.index],s.state,s.phraseLength),t.type===e.UDT&&m(i[t.index],s.state,s.phraseLength)},this.displayStats=()=>{let t="";const s={match:0,empty:0,nomatch:0,total:0},r=(e,t,r,n,o)=>{s.match+=t,s.empty+=r,s.nomatch+=n,s.total+=o;return`${e} | ${l(t)} | ${l(r)} | ${l(n)} | ${l(o)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=r(" ALT",n[e.ALT].match,n[e.ALT].empty,n[e.ALT].nomatch,n[e.ALT].total),t+=r(" CAT",n[e.CAT].match,n[e.CAT].empty,n[e.CAT].nomatch,n[e.CAT].total),t+=r(" REP",n[e.REP].match,n[e.REP].empty,n[e.REP].nomatch,n[e.REP].total),t+=r(" RNM",n[e.RNM].match,n[e.RNM].empty,n[e.RNM].nomatch,n[e.RNM].total),t+=r(" TRG",n[e.TRG].match,n[e.TRG].empty,n[e.TRG].nomatch,n[e.TRG].total),t+=r(" TBS",n[e.TBS].match,n[e.TBS].empty,n[e.TBS].nomatch,n[e.TBS].total),t+=r(" TLS",n[e.TLS].match,n[e.TLS].empty,n[e.TLS].nomatch,n[e.TLS].total),t+=r(" UDT",n[e.UDT].match,n[e.UDT].empty,n[e.UDT].nomatch,n[e.UDT].total),t+=r(" AND",n[e.AND].match,n[e.AND].empty,n[e.AND].nomatch,n[e.AND].total),t+=r(" NOT",n[e.NOT].match,n[e.NOT].empty,n[e.NOT].nomatch,n[e.NOT].total),t+=r("TOTAL",s.match,s.empty,s.nomatch,s.total),t},this.displayHits=e=>{let t="";const s=(e,t,s,n,o)=>{r.match+=e,r.empty+=t,r.nomatch+=s,r.total+=n;return`| ${l(e)} | ${l(t)} | ${l(s)} | ${l(n)} | ${o}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(o.sort(c),i.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(o.sort(p),i.sort(p),t+=" RULES/UDTS BY INDEX\n"):(o.sort(a),i.sort(a),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<o.length;e+=1){let r=o[e];r.total&&(t+=s(r.match,r.empty,r.nomatch,r.total,r.name))}for(let e=0;e<i.length;e+=1){let r=i[e];r.total&&(t+=s(r.match,r.empty,r.nomatch,r.total,r.name))}return t};const l=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,a=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),p=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,h=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},d=()=>{n.length=0,r=new h,n[e.ALT]=new h,n[e.CAT]=new h,n[e.REP]=new h,n[e.RNM]=new h,n[e.TRG]=new h,n[e.TBS]=new h,n[e.TLS]=new h,n[e.UDT]=new h,n[e.AND]=new h,n[e.NOT]=new h,o.length=0;for(let e=0;e<t.length;e+=1)o.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(s.length>0){i.length=0;for(let e=0;e<s.length;e+=1)i.push({empty:0,match:0,nomatch:0,total:0,name:s[e].name,lower:s[e].lower,index:s[e].index})}},m=(t,s)=>{switch(t.total+=1,s){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${s}`)}}},a={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,s)=>{let r=e;for(;!(void 0===t||t<0);){if(void 0===s){r=e.slice(t);break}if(s<=0)return"";r=e.slice(t,t+s);break}return String.fromCodePoint(...r)}},u={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case u.ALT:return"ALT";case u.CAT:return"CAT";case u.REP:return"REP";case u.RNM:return"RNM";case u.TRG:return"TRG";case u.TBS:return"TBS";case u.TLS:return"TLS";case u.UDT:return"UDT";case u.AND:return"AND";case u.NOT:return"NOT";case u.ACTIVE:return"ACTIVE";case u.EMPTY:return"EMPTY";case u.MATCH:return"MATCH";case u.NOMATCH:return"NOMATCH";case u.SEM_PRE:return"SEM_PRE";case u.SEM_POST:return"SEM_POST";case u.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};const p=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const h=class extends l{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let s=-1;for(let r=0;r<e.length;r++){const n=e[r];if(n.includes("M|")){const e=n.match(/]'(.*)'$/);e&&e[1]&&(s=r)}if(r>s){const e=n.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new p(...t)}};class d extends Error{constructor(e,t=void 0){if(super(e,t),this.name=this.constructor.name,"string"==typeof e&&(this.message=e),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,null!=t&&"object"==typeof t&&Object.hasOwn(t,"cause")&&!("cause"in this)){const{cause:e}=t;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}if(null!=t&&"object"==typeof t){const{cause:e,...s}=t;Object.assign(this,s)}}}const m=d;const y=class extends m{},g=e=>(t,s,r,n,o)=>{if("object"!=typeof o||null===o||Array.isArray(o))throw new y("parser's user data must be an object");if(!o.options?.optimize||0!==n||!o.options?.droppableTypes?.includes(e)){if(t===u.SEM_PRE){const t={type:e,text:a.charsToString(s,r,n),start:r,length:n,children:[]};if(o.stack.length>0){const e=o.stack[o.stack.length-1],s=e.children[e.children.length-1],r="text"===e.type&&"text"===t.type;o.options?.optimize&&o.options?.collapsibleTypes?.includes(t.type)&&s?.type===t.type?(s.text+=t.text,s.length+=t.length):r||e.children.push(t)}else o.root=t;o.stack.push(t)}t===u.SEM_POST&&o.stack.pop()}};const f=class extends i{constructor(){super(),this.callbacks["jsonpath-query"]=g("jsonpath-query"),this.callbacks.segments=g("segments"),this.callbacks.B=g("text"),this.callbacks.S=g("text"),this.callbacks["root-identifier"]=g("root-identifier"),this.callbacks.selector=g("selector"),this.callbacks["name-selector"]=g("name-selector"),this.callbacks["string-literal"]=g("string-literal"),this.callbacks["double-quoted"]=g("double-quoted"),this.callbacks["single-quoted"]=g("single-quoted"),this.callbacks["wildcard-selector"]=g("wildcard-selector"),this.callbacks["index-selector"]=g("index-selector"),this.callbacks["slice-selector"]=g("slice-selector"),this.callbacks.start=g("start"),this.callbacks.end=g("end"),this.callbacks.step=g("step"),this.callbacks["filter-selector"]=g("filter-selector"),this.callbacks["logical-expr"]=g("logical-expr"),this.callbacks["logical-or-expr"]=g("logical-or-expr"),this.callbacks["logical-and-expr"]=g("logical-and-expr"),this.callbacks["basic-expr"]=g("basic-expr"),this.callbacks["paren-expr"]=g("paren-expr"),this.callbacks["logical-not-op"]=g("logical-not-op"),this.callbacks["test-expr"]=g("test-expr"),this.callbacks["filter-query"]=g("filter-query"),this.callbacks["rel-query"]=g("rel-query"),this.callbacks["current-node-identifier"]=g("current-node-identifier"),this.callbacks["comparison-expr"]=g("comparison-expr"),this.callbacks.literal=g("literal"),this.callbacks.comparable=g("comparable"),this.callbacks["comparison-op"]=g("comparison-op"),this.callbacks["singular-query"]=g("singular-query"),this.callbacks["rel-singular-query"]=g("rel-singular-query"),this.callbacks["abs-singular-query"]=g("abs-singular-query"),this.callbacks["singular-query-segments"]=g("singular-query-segments"),this.callbacks["name-segment"]=g("name-segment"),this.callbacks["index-segment"]=g("index-segment"),this.callbacks.number=g("number"),this.callbacks.true=g("true"),this.callbacks.false=g("false"),this.callbacks.null=g("null"),this.callbacks["function-name"]=g("function-name"),this.callbacks["function-expr"]=g("function-expr"),this.callbacks["function-argument"]=g("function-argument"),this.callbacks.segment=g("segment"),this.callbacks["child-segment"]=g("child-segment"),this.callbacks["bracketed-selection"]=g("bracketed-selection"),this.callbacks["member-name-shorthand"]=g("member-name-shorthand"),this.callbacks["descendant-segment"]=g("descendant-segment"),this.callbacks["normalized-path"]=g("normalized-path"),this.callbacks["normal-index-segment"]=g("normal-index-segment"),this.callbacks["normal-selector"]=g("normal-selector"),this.callbacks["normal-name-selector"]=g("normal-name-selector"),this.callbacks["normal-index-selector"]=g("normal-index-selector"),this.callbacks["normal-single-quoted"]=g("normal-single-quoted"),this.callbacks["dot-prefix"]=g("text"),this.callbacks["double-dot-prefix"]=g("text"),this.callbacks["left-bracket"]=g("text"),this.callbacks["right-bracket"]=g("text"),this.callbacks.comma=g("text"),this.callbacks.colon=g("text"),this.callbacks.dquote=g("text"),this.callbacks.squote=g("text"),this.callbacks.questionmark=g("text"),this.callbacks.disjunction=g("text"),this.callbacks.conjunction=g("text"),this.callbacks["left-paren"]=g("text"),this.callbacks["right-paren"]=g("text")}getTree(){const e={stack:[],root:null};return this.translate(e),e.root}};const x=class extends f{collapsibleTypes=["single-quoted","double-quoted","normal-single-quoted"];droppableTypes=["text","segments","singular-query-segments"];constructor({collapsibleTypes:e,droppableTypes:t}={}){super(),Array.isArray(e)&&(this.collapsibleTypes=e),Array.isArray(t)&&(this.droppableTypes=t)}getTree(){const e={stack:[],root:null,options:{optimize:!0,collapsibleTypes:this.collapsibleTypes,droppableTypes:this.droppableTypes}};return this.translate(e),e.root}},b=e=>T(`"${e}"`),w=e=>{let t="";for(let s=0;s<e.length;s++){const r=e[s];if("\\"===r){if(s++,s>=e.length){t+="\\";break}const r=e[s];switch(r){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"/":t+="/";break;case"\\":t+="\\";break;case"'":t+="'";break;case'"':t+='"';break;case"u":{const r=e.slice(s+1,s+5);t+=String.fromCharCode(parseInt(r,16)),s+=4;break}default:t+=r}}else t+=r}return T(JSON.stringify(t))},k=e=>{const t=parseInt(e,10);if(!Number.isSafeInteger(t))throw new RangeError(`Integer value out of safe range [-(2^53)+1, (2^53)-1], got: ${e}`);return t},T=e=>JSON.parse(e),E={count:{params:[{type:"NodesType"}],returns:"ValueType"},length:{params:[{type:"ValueType"}],returns:"ValueType"},value:{params:[{type:"NodesType"}],returns:"ValueType"},match:{params:[{type:"ValueType"},{type:"ValueType"}],returns:"LogicalType"},search:{params:[{type:"ValueType"},{type:"ValueType"}],returns:"LogicalType"}},S=e=>{if("FilterQuery"!==e.type)return!1;const{query:t}=e;if(!t||!t.segments)return!1;for(const e of t.segments){if("ChildSegment"!==e.type)return!1;const{selector:t}=e;if("NameSelector"!==t.type&&"IndexSelector"!==t.type){if("BracketedSelection"!==t.type)return!1;{if(1!==t.selectors.length)return!1;const e=t.selectors[0];if("NameSelector"!==e.type&&"IndexSelector"!==e.type)return!1}}}return!0},A=(e,t,s)=>{if("NodesType"===t){if("Literal"===e.type)throw new RangeError(`Function ${s}() requires NodesType argument, got literal`);if("TestExpr"===e.type&&"FilterQuery"===e.expression?.type)return;if("FilterQuery"===e.type)return;throw new RangeError(`Function ${s}() requires NodesType argument`)}if("ValueType"===t){if("Literal"===e.type)return;if("FunctionExpr"===e.type)return;if("TestExpr"===e.type&&"FunctionExpr"===e.expression?.type)return;if("TestExpr"===e.type&&"FilterQuery"===e.expression?.type){if(!S(e.expression))throw new RangeError(`Function ${s}() requires ValueType argument, got non-singular query`);return}if("FilterQuery"===e.type){if(!S(e))throw new RangeError(`Function ${s}() requires ValueType argument, got non-singular query`);return}throw new RangeError(`Function ${s}() requires ValueType argument`)}},I=e=>{if(!e)return null;if("FunctionExpr"===e.type){const t=E[e.name];return t?t.returns:null}return"Literal"===e.type||"RelSingularQuery"===e.type||"AbsSingularQuery"===e.type?"ValueType":"FilterQuery"===e.type?"NodesType":"LogicalOrExpr"===e.type||"LogicalAndExpr"===e.type||"LogicalNotExpr"===e.type||"ComparisonExpr"===e.type?"LogicalType":"TestExpr"===e.type?I(e.expression):null},O=(e,t,s={parent:null,path:[]})=>{const r=t[e.type];if(!r)throw new y(`No transformer for CST node type: ${e.type}`);return r(e,{parent:e,path:[...s.path,e]})},v={"jsonpath-query"(e,t){const s=e.children.find(e=>"segments"===e.type);return{type:"JsonPathQuery",segments:s?s.children.filter(({type:e})=>"segment"===e).map(e=>O(e,v,t)):[]}},segment(e,t){const s=e.children.find(({type:e})=>["child-segment","descendant-segment"].includes(e));return O(s,v,t)},selector(e,t){const s=e.children.find(({type:e})=>["name-selector","wildcard-selector","slice-selector","index-selector","filter-selector"].includes(e));return O(s,v,t)},"name-selector"(e,t){const s=e.children.find(({type:e})=>"string-literal"===e),r=O(s,v,t);return{type:"NameSelector",value:r.value,format:r.format}},"string-literal"(e){const t=e.children.find(({type:e,text:t})=>"text"===e&&"'"===t),s=e.children.find(({type:e})=>["double-quoted","single-quoted"].includes(e));return{type:"StringLiteral",value:s?(t?w:b)(s.text):"",format:t?"single-quoted":"double-quoted"}},"wildcard-selector":()=>({type:"WildcardSelector"}),"index-selector":e=>({type:"IndexSelector",value:k(e.text)}),"slice-selector"(e){const t=e.children.find(({type:e})=>"start"===e),s=e.children.find(({type:e})=>"end"===e),r=e.children.find(({type:e})=>"step"===e);return{type:"SliceSelector",start:t?k(t.text):null,end:s?k(s.text):null,step:r?k(r.text):null}},"filter-selector"(e,t){const s=e.children.find(({type:e})=>"logical-expr"===e),r=O(s,v,t);if("TestExpr"===r.type){if("ValueType"===I(r.expression)){const e="FunctionExpr"===r.expression.type?r.expression.name:"expression";throw new RangeError(`Function ${e}() returns ValueType which cannot be used as existence test; result must be compared`)}}if("LogicalNotExpr"===r.type&&"TestExpr"===r.expression?.type){const e=r.expression.expression;if("ValueType"===I(e)){const t="FunctionExpr"===e.type?e.name:"expression";throw new RangeError(`Function ${t}() returns ValueType which cannot be used as existence test; result must be compared`)}}return{type:"FilterSelector",expression:r}},"logical-expr"(e,t){const s=e.children.find(({type:e})=>"logical-or-expr"===e);return O(s,v,t)},"logical-or-expr"(e,t){const s=e.children.filter(({type:e})=>"logical-and-expr"===e);if(1===s.length)return O(s[0],v,t);let r=O(s[0],v,t);for(let e=1;e<s.length;e+=1){r={type:"LogicalOrExpr",left:r,right:O(s[e],v,t)}}return r},"logical-and-expr"(e,t){const s=e.children.filter(({type:e})=>"basic-expr"===e);if(1===s.length)return O(s[0],v,t);let r=O(s[0],v,t);for(let e=1;e<s.length;e+=1){r={type:"LogicalAndExpr",left:r,right:O(s[e],v,t)}}return r},"basic-expr"(e,t){const s=e.children.find(({type:e})=>["paren-expr","comparison-expr","test-expr"].includes(e));return O(s,v,t)},"paren-expr"(e,t){const s=e.children.some(e=>"logical-not-op"===e.type),r=e.children.find(e=>"logical-expr"===e.type),n=O(r,v,t);return s?{type:"LogicalNotExpr",expression:n}:n},"test-expr"(e,t){const s=e.children.some(({type:e})=>"logical-not-op"===e),r=e.children.find(({type:e})=>["filter-query","function-expr"].includes(e)),n={type:"TestExpr",expression:O(r,v,t)};return s?{type:"LogicalNotExpr",expression:n}:n},"filter-query"(e,t){const s=e.children.find(({type:e})=>["rel-query","jsonpath-query"].includes(e));return{type:"FilterQuery",query:O(s,v,t)}},"rel-query"(e,t){const s=e.children.find(e=>"segments"===e.type);return{type:"RelQuery",segments:s?s.children.filter(e=>"segment"===e.type).map(e=>O(e,v,t)):[]}},"comparison-expr"(e,t){const s=e.children.filter(({type:e})=>["comparable","comparison-op"].includes(e)),[r,n,o]=s,i=O(r,v,t),l=O(o,v,t),c=I(i),a=I(l);if("LogicalType"===c){const e="FunctionExpr"===i.type?i.name:"expression";throw new RangeError(`Function ${e}() returns LogicalType which cannot be compared`)}if("LogicalType"===a){const e="FunctionExpr"===l.type?l.name:"expression";throw new RangeError(`Function ${e}() returns LogicalType which cannot be compared`)}return{type:"ComparisonExpr",left:i,op:n.text,right:l}},literal(e,t){const s=e.children.find(({type:e})=>["number","string-literal","true","false","null"].includes(e));if("string-literal"===s.type){return{type:"Literal",value:O(s,v,t).value}}return{type:"Literal",value:T(s.text)}},comparable(e,t){const s=e.children.find(({type:e})=>["singular-query","function-expr","literal"].includes(e));return O(s,v,t)},"singular-query"(e,t){const s=e.children.find(({type:e})=>["rel-singular-query","abs-singular-query"].includes(e));return O(s,v,t)},"rel-singular-query"(e,t){const s=e.children.find(({type:e})=>"singular-query-segments"===e),r=s?s.children.filter(({type:e})=>["name-segment","index-segment"].includes(e)).map(e=>({type:"SingularQuerySegment",selector:O(e,v,t)})):[];return{type:"RelSingularQuery",segments:r}},"abs-singular-query"(e,t){const s=e.children.find(({type:e})=>"singular-query-segments"===e),r=s?s.children.filter(({type:e})=>["name-segment","index-segment"].includes(e)).map(e=>({type:"SingularQuerySegment",selector:O(e,v,t)})):[];return{type:"AbsSingularQuery",segments:r}},"name-segment"(e,t){const s=e.children.find(({type:e})=>["name-selector","member-name-shorthand"].includes(e));return O(s,v,t)},"index-segment"(e,t){const s=e.children.find(({type:e})=>"index-selector"===e);return O(s,v,t)},"function-expr"(e,t){const s=e.children.find(({type:e})=>"function-name"===e),r=e.children.filter(({type:e})=>"function-argument"===e),n=r.map(e=>O(e,v,t));return((e,t)=>{const s=E[e];if(!s)return;const r=s.params.length,n=t.length;if(n<r)throw new RangeError(`Function ${e}() requires ${r} argument(s), got ${n}`);if(n>r)throw new RangeError(`Function ${e}() requires ${r} argument(s), got ${n}`);for(let n=0;n<r;n++)A(t[n],s.params[n].type,e)})(s.text,n),{type:"FunctionExpr",name:s.text,arguments:n}},"function-argument"(e,t){const s=e.children.find(({type:e})=>["logical-expr","function-expr","filter-query","literal"].includes(e));return O(s,v,t)},"child-segment"(e,t){const s=e.children.find(({type:e})=>["bracketed-selection","wildcard-selector","member-name-shorthand"].includes(e));return{type:"ChildSegment",selector:O(s,v,t)}},"bracketed-selection":(e,t)=>({type:"BracketedSelection",selectors:e.children.filter(({type:e})=>"selector"===e).map(e=>O(e,v,t))}),"member-name-shorthand":e=>({type:"NameSelector",value:e.text,format:"shorthand"}),"descendant-segment"(e,t){const s=e.children.find(({type:e})=>["bracketed-selection","wildcard-selector","member-name-shorthand"].includes(e));return{type:"DescendantSegment",selector:O(s,v,t)}},"normalized-path":(e,t)=>({type:"JsonPathQuery",segments:e.children.filter(({type:e})=>"normal-index-segment"===e).map(e=>O(e,v,t))}),"normal-index-segment"(e,t){const s=e.children.find(({type:e})=>"normal-selector"===e);return{type:"ChildSegment",selector:O(s,v,t)}},"normal-selector"(e,t){const s=e.children.find(({type:e})=>["normal-name-selector","normal-index-selector"].includes(e));return O(s,v,t)},"normal-name-selector"(e){const t=e.children.find(({type:e})=>"normal-single-quoted"===e);return{type:"NameSelector",value:t?w(t.text):"",format:"single-quoted"}},"normal-index-selector":e=>({type:"IndexSelector",value:k(e.text)})},C=v;const M=class extends x{getTree(){const e=super.getTree();return O(e,C)}},q=new n,N=(e,{normalized:t=!1,stats:s=!1,trace:r=!1,translator:n=new M}={})=>{if("string"!=typeof e)throw new TypeError("JSONPath must be a string");try{const i=new o;n&&(i.ast=n),s&&(i.stats=new c),r&&(i.trace=new h);const l=t?"normalized-path":"jsonpath-query",a=i.parse(q,l,e);return{result:a,tree:a.success&&n?i.ast.getTree():void 0,stats:i.stats,trace:i.trace}}catch(t){const s=t instanceof RangeError?`Invalid JSONPath expression: ${t.message}`:"Unexpected error during JSONPath parsing";throw new y(s,{cause:t,jsonPath:e})}};const L=class extends f{getTree(){return this.toXml()}},D=(e,{normalized:t=!1,wellTyped:s=!0}={})=>{if("string"!=typeof e)return!1;try{const{result:r}=N(e,{normalized:t,stats:!1,trace:!1,translator:s?new M:null});return r.success}catch{return!1}};const F=class extends m{},B=e=>D(e,{normalized:!0}),P=e=>{if("string"!=typeof e)throw new TypeError("Selector must be a string");let t="";for(const s of e){const e=s.codePointAt(0);switch(e){case 8:t+="\\b";break;case 9:t+="\\t";break;case 10:t+="\\n";break;case 12:t+="\\f";break;case 13:t+="\\r";break;case 39:t+="\\'";break;case 92:t+="\\\\";break;default:t+=e<=31?`\\u${e.toString(16).padStart(4,"0")}`:s}}return t},$=e=>{if(!Array.isArray(e))throw new F("Selectors must be an array, got: "+typeof e,{selectors:e});try{return`$${e.map(e=>{if("string"==typeof e)return`['${P(e)}']`;if("number"==typeof e){if(!Number.isSafeInteger(e)||e<0)throw new TypeError(`Index selector must be a non-negative safe integer, got: ${e}`);return`[${e}]`}throw new TypeError("Selector must be a string or non-negative integer, got: "+typeof e)}).join("")}`}catch(t){throw new F("Failed to compile normalized JSONPath",{cause:t,selectors:e})}},j=e=>{if("string"!=typeof e)throw new F("Normalized path must be a string, got: "+typeof e,{normalizedPath:e});const t=N(e,{normalized:!0});if(!t.result.success)throw new F("Invalid normalized path",{normalizedPath:e});const{tree:s}=t;return s.segments.map(e=>e.selector.value)},R=(e,t,s,r)=>{const{realm:n}=e,{value:o}=s;if(n.isObject(t)&&n.hasProperty(t,o)){r(n.getProperty(t,o),o)}},_=(e,t,s,r)=>{const{realm:n}=e,{value:o}=s;if(!n.isArray(t))return;const i=n.getLength(t),l=((e,t)=>e>=0?e:t+e)(o,i);if(l>=0&&l<i){r(n.getElement(t,l),l)}},H=(e,t,s,r)=>{const{realm:n}=e;for(const[e,s]of n.entries(t))r(s,e)},U=(e,t)=>e>=0?Math.min(e,t):Math.max(t+e,0),z=(e,t,s,r)=>{const{realm:n}=e,{start:o,end:i,step:l}=s;if(!n.isArray(t))return;const c=((e,t,s,r)=>{const n=s??1;if(0===n)return null;let o,i;if(n>0){const s=0,n=r,l=null!==e?U(e,r):s,c=null!==t?U(t,r):n;o=Math.max(l,0),i=Math.min(c,r)}else{const s=r-1,n=-r-1,l=null!==e?e>=0?Math.min(e,r-1):Math.max(r+e,-1):s,c=null!==t?t>=0?Math.min(t,r-1):Math.max(r+t,-1):n;i=Math.min(l,r-1),o=Math.max(c,-1)}return{lower:o,upper:i,step:n}})(o,i,l,n.getLength(t));if(null===c)return;const{lower:a,upper:u,step:p}=c;if(p>0)for(let e=a;e<u;e+=p){r(n.getElement(t,e),e)}else for(let e=u;e>a;e+=p){r(n.getElement(t,e),e)}},V=(e,t,s,r)=>r.value,G=(e,t,s)=>{const{realm:r}=e,{selector:n}=s;switch(n.type){case"NameSelector":{const{value:e}=n;return r.isObject(t)&&r.hasProperty(t,e)?r.getProperty(t,e):void 0}case"IndexSelector":{const{value:e}=n;if(!r.isArray(t))return;const s=r.getLength(t),o=e>=0?e:s+e;return o>=0&&o<s?r.getElement(t,o):void 0}default:return}},X=(e,t,s,r)=>{const{selectors:n}=s;for(const s of n)de(e,t,s,r)},Q=(e,t,s)=>{const r=[],n=e=>{r.push(e)},{selector:o}=s;switch(o.type){case"BracketedSelection":X(e,t,o,n);break;case"NameSelector":case"WildcardSelector":case"IndexSelector":case"SliceSelector":case"FilterSelector":de(e,t,o,n)}return r},Y=(e,t,s,r)=>{let n=s;for(const t of r){const s=[];if("DescendantSegment"===t.type){const r=n=>{const{realm:o}=e,i=Q(e,n,t);s.push(...i);for(const[,e]of o.entries(n))r(e)};for(const e of n)r(e)}else for(const r of n){const n=Q(e,r,t);s.push(...n)}n=s}return n},J=(e,t,s,r)=>{const{query:n}=r;let o;switch(n.type){case"RelQuery":o=((e,t,s,r)=>{const{segments:n}=r;return 0===n.length?[s]:Y(e,0,[s],n)})(e,0,s,n);break;case"JsonPathQuery":o=((e,t,s,r)=>{const{segments:n}=r;return 0===n.length?[t]:Y(e,0,[t],n)})(e,t,0,n);break;default:o=[]}return i=o,Object.defineProperty(i,"_isNodelist",{value:!0,enumerable:!1,writable:!1}),i;var i};let K;const W=(e,t,s,r)=>{const{name:n,arguments:o}=r,i=e.functions[n];if("function"!=typeof i)return;const l=o.map(r=>((e,t,s,r)=>{switch(r.type){case"Literal":case"RelSingularQuery":case"AbsSingularQuery":case"FunctionExpr":return Z(e,t,s,r);case"FilterQuery":return J(e,t,s,r);case"TestExpr":return"FilterQuery"===r.expression.type?J(e,t,s,r.expression):"FunctionExpr"===r.expression.type?Z(e,t,s,r.expression):K(e,t,s,r);case"LogicalOrExpr":case"LogicalAndExpr":case"LogicalNotExpr":case"ComparisonExpr":return K(e,t,s,r);default:return}})(e,t,s,r));return i(e.realm,...l)},Z=(e,t,s,r)=>{switch(r.type){case"Literal":return V(e,t,s,r);case"RelSingularQuery":return((e,t,s,r)=>{let n=s;for(const t of r.segments)if(n=G(e,n,t),void 0===n)return;return n})(e,0,s,r);case"AbsSingularQuery":return((e,t,s,r)=>{let n=t;for(const t of r.segments)if(n=G(e,n,t),void 0===n)return;return n})(e,t,0,r);case"FunctionExpr":return W(e,t,s,r);default:return}},ee=(e,t,s,r)=>{const{left:n,op:o,right:i}=r,l=Z(e,t,s,n),c=Z(e,t,s,i);return e.realm.compare(l,o,c)},te=e=>Array.isArray(e),se=e=>{if(!(e=>"object"==typeof e&&null!==e&&!te(e))(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(e)},re=e=>"string"==typeof e,ne=e=>"number"==typeof e&&Number.isFinite(e),oe=e=>"boolean"==typeof e,ie=e=>null===e,le=e=>void 0===e,ce=e=>te(e)&&!0===e._isNodelist,ae=e=>ce(e)?1===e.length?e[0]:void 0:e,ue=(e,t,s,r)=>{switch(r.type){case"LogicalOrExpr":return!!ue(e,t,s,r.left)||ue(e,t,s,r.right);case"LogicalAndExpr":return!!ue(e,t,s,r.left)&&ue(e,t,s,r.right);case"LogicalNotExpr":return!ue(e,t,s,r.expression);case"TestExpr":{const{expression:n}=r;if("FilterQuery"===n.type){return J(e,t,s,n).length>0}if("FunctionExpr"===n.type){const r=W(e,t,s,n);return"boolean"==typeof r?r:void 0!==r&&(te(r)?r.length>0:Boolean(r))}return!1}case"ComparisonExpr":return ee(e,t,s,r);default:return!1}};K=ue;const pe=ue,he=(e,t,s,r)=>{const{realm:n,root:o}=e,{expression:i}=s;for(const[s,l]of n.entries(t)){pe(e,o,l,i)&&r(l,s)}},de=(e,t,s,r)=>{switch(s.type){case"NameSelector":R(e,t,s,r);break;case"IndexSelector":_(e,t,s,r);break;case"WildcardSelector":H(e,t,s,r);break;case"SliceSelector":z(e,t,s,r);break;case"FilterSelector":he(e,t,s,r)}},me=(e,t,s,r)=>{switch(s.type){case"BracketedSelection":X(e,t,s,r);break;case"NameSelector":case"WildcardSelector":case"IndexSelector":case"SliceSelector":case"FilterSelector":de(e,t,s,r)}},ye=(e,t,s,r)=>{switch(s.type){case"ChildSegment":((e,t,s,r)=>{const{selector:n}=s;me(e,t,n,r)})(e,t,s,r);break;case"DescendantSegment":((e,t,s,r)=>{const{selector:n}=s;me(e,t,n,r)})(e,t,s,r)}};const ge=class{name="";isObject(e){throw new m("Realm.isObject(value) must be implemented in a subclass")}isArray(e){throw new m("Realm.isArray(value) must be implemented in a subclass")}isString(e){throw new m("Realm.isString(value) must be implemented in a subclass")}isNumber(e){throw new m("Realm.isNumber(value) must be implemented in a subclass")}isBoolean(e){throw new m("Realm.isBoolean(value) must be implemented in a subclass")}isNull(e){throw new m("Realm.isNull(value) must be implemented in a subclass")}getString(e){throw new m("Realm.getString(value) must be implemented in a subclass")}getProperty(e,t){throw new m("Realm.getProperty(value, key) must be implemented in a subclass")}hasProperty(e,t){throw new m("Realm.hasProperty(value, key) must be implemented in a subclass")}getElement(e,t){throw new m("Realm.getElement(value, index) must be implemented in a subclass")}getKeys(e){throw new m("Realm.getKeys(value) must be implemented in a subclass")}getLength(e){throw new m("Realm.getLength(value) must be implemented in a subclass")}*entries(e){throw new m("Realm.entries(value) must be implemented in a subclass")}compare(e,t,s){throw new m("Realm.compare(left, operator, right) must be implemented in a subclass")}};const fe=class extends ge{name="json";isObject(e){return se(e)}isArray(e){return te(e)}isString(e){return re(e)}isNumber(e){return ne(e)}isBoolean(e){return oe(e)}isNull(e){return ie(e)}getString(e){return re(e)?e:void 0}getProperty(e,t){if(se(e))return Object.hasOwn(e,t)?e[t]:void 0}hasProperty(e,t){return!!se(e)&&Object.hasOwn(e,t)}getElement(e,t){if(te(e)&&!(t<0||t>=e.length))return e[t]}getKeys(e){return se(e)?Object.keys(e):[]}getLength(e){return re(e)?[...e].length:te(e)?e.length:se(e)?Object.keys(e).length:0}*entries(e){if(this.isArray(e))for(let t=0;t<e.length;t+=1)yield[t,e[t]];else if(this.isObject(e))for(const t of Object.keys(e))yield[t,e[t]]}#e(e,t){if(e===t)return!0;if(le(e)&&le(t))return!0;if(le(e)||le(t))return!1;if(ie(e)&&ie(t))return!0;if(ie(e)||ie(t))return!1;if(typeof e!=typeof t)return!1;if(te(e)&&te(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(!this.#e(e[s],t[s]))return!1;return!0}if(se(e)&&se(t)){const s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(const r of s){if(!Object.hasOwn(t,r))return!1;if(!this.#e(e[r],t[r]))return!1}return!0}return!1}compare(e,t,s){switch(t){case"==":return this.#e(e,s);case"!=":return!this.#e(e,s);case"<":return!le(e)&&!le(s)&&((ne(e)&&ne(s)||!(!re(e)||!re(s)))&&e<s);case"<=":return!le(e)&&!le(s)&&(ne(e)&&ne(s)||re(e)&&re(s)?e<=s:this.#e(e,s));case">":return!le(e)&&!le(s)&&((ne(e)&&ne(s)||!(!re(e)||!re(s)))&&e>s);case">=":return!le(e)&&!le(s)&&(ne(e)&&ne(s)||re(e)&&re(s)?e>=s:this.#e(e,s));default:return!1}}};const xe=class extends m{},be=(e,t)=>{const s=ae(t);if(le(s))return;const r=e.getLength(s);return r>0||e.isString(s)||e.isArray(s)||e.isObject(s)?r:void 0},we=(e,t)=>{if(ce(t))return t.length},ke=(e,t)=>{if(ce(t)&&1===t.length)return t[0]},Te=new Map,Ee=(e,t=!1)=>{const s=t?`anchored:${e}`:`unanchored:${e}`;if(Te.has(s))return Te.get(s);const r=(e=>{let t="",s=!1,r=0;for(;r<e.length;){const n=e[r];if("\\"===n&&r+1<e.length){const o=e[r+1];if(o>="1"&&o<="9")return null;if(!s&&("b"===o||"B"===o))return null;t+=n+o,r+=2;continue}if("["!==n||s)if("]"===n&&s)s=!1,t+=n,r+=1;else{if("("===n&&r+2<e.length&&"?"===e[r+1]){const t=e[r+2];if("="===t||"!"===t)return null;if("<"===t&&r+3<e.length){const t=e[r+3];if("="===t||"!"===t)return null;if(/[a-zA-Z]/.test(t))return null}}"."!==n||s?(t+=n,r+=1):(t+="[^\\n\\r]",r+=1)}else s=!0,t+=n,r+=1}return t})(e);if(null===r)return Te.set(s,null),null;try{const e=t?`^(?:${r})$`:r,n=new RegExp(e,"u");return Te.set(s,n),n}catch{return Te.set(s,null),null}},Se=(e,t,s)=>{const r=ae(t),n=ae(s),o=e.getString(r),i=e.getString(n);if(void 0===o||void 0===i)return!1;const l=Ee(i,!0);return null!==l&&l.test(o)},Ae=(e,t,s)=>{const r=ae(t),n=ae(s),o=e.getString(r),i=e.getString(n);if(void 0===o||void 0===i)return!1;const l=Ee(i,!1);return null!==l&&l.test(o)},Ie=(e,t,{callback:s,realm:n=new fe,functions:o=r}={})=>{const i=N(t);if(!i.result.success)throw new xe(`Invalid JSONPath expression: ${t}`,{expression:t});try{const t=i.tree,{segments:r}=t,l=[];if(0===r.length)return l.push(e),"function"==typeof s&&s(e,"$"),l;const c={realm:n,root:e,functions:o},a=[];for(a.push({value:e,path:[],segmentIndex:0});a.length>0;){const e=a.pop(),{value:t,path:o,segmentIndex:i}=e;if(i>=r.length){const e=$(o);l.push(t),"function"==typeof s&&s(t,e);continue}const u=r[i],p=[];if(ye(c,t,u,(e,t)=>{p.push({value:e,pathSegment:t})}),"DescendantSegment"===u.type){const e=[];for(const[s,r]of n.entries(t))e.push({value:r,pathSegment:s});for(let t=e.length-1;t>=0;t-=1){const{value:s,pathSegment:r}=e[t];a.push({value:s,path:[...o,r],segmentIndex:i})}}for(let e=p.length-1;e>=0;e-=1){const{value:t,pathSegment:s}=p[e];a.push({value:t,path:[...o,s],segmentIndex:i+1})}}return l}catch(e){throw new xe("Unexpected error during JSONPath evaluation",{cause:e,expression:t})}};function Oe(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function ve(e){return function t(s){return 0===arguments.length||Oe(s)?t:e.apply(this,arguments)}}function Ce(e){return function t(s,r){switch(arguments.length){case 0:return t;case 1:return Oe(s)?t:ve(function(t){return e(s,t)});default:return Oe(s)&&Oe(r)?t:Oe(s)?ve(function(t){return e(t,r)}):Oe(r)?ve(function(t){return e(s,t)}):e(s,r)}}}function Me(e){for(var t,s=[];!(t=e.next()).done;)s.push(t.value);return s}function qe(e,t,s){for(var r=0,n=s.length;r<n;){if(e(t,s[r]))return!0;r+=1}return!1}function Ne(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const Le="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var De=Object.prototype.toString;const Fe=function(){return"[object Arguments]"===De.call(arguments)?function(e){return"[object Arguments]"===De.call(e)}:function(e){return Ne("callee",e)}}();var Be=!{toString:null}.propertyIsEnumerable("toString"),Pe=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],$e=function(){return arguments.propertyIsEnumerable("length")}(),je=function(e,t){for(var s=0;s<e.length;){if(e[s]===t)return!0;s+=1}return!1};const Re="function"!=typeof Object.keys||$e?ve(function(e){if(Object(e)!==e)return[];var t,s,r=[],n=$e&&Fe(e);for(t in e)!Ne(t,e)||n&&"length"===t||(r[r.length]=t);if(Be)for(s=Pe.length-1;s>=0;)Ne(t=Pe[s],e)&&!je(r,t)&&(r[r.length]=t),s-=1;return r}):ve(function(e){return Object(e)!==e?[]:Object.keys(e)});const _e=ve(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function He(e,t,s,r){var n=Me(e);function o(e,t){return Ue(e,t,s.slice(),r.slice())}return!qe(function(e,t){return!qe(o,t,e)},Me(t),n)}function Ue(e,t,s,r){if(Le(e,t))return!0;var n=_e(e);if(n!==_e(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(n){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!Le(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!Le(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var o=s.length-1;o>=0;){if(s[o]===e)return r[o]===t;o-=1}switch(n){case"Map":return e.size===t.size&&He(e.entries(),t.entries(),s.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&He(e.values(),t.values(),s.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var i=Re(e);if(i.length!==Re(t).length)return!1;var l=s.concat([e]),c=r.concat([t]);for(o=i.length-1;o>=0;){var a=i[o];if(!Ne(a,t)||!Ue(t[a],e[a],l,c))return!1;o-=1}return!0}const ze=Ce(function(e,t){return Ue(e,t,[],[])});const Ve=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class Ge{elements;constructor(e){this.elements=e??[]}toValue(){return this.elements.map(e=>({key:e.key?.toValue(),value:e.value?.toValue()}))}map(e,t){return this.elements.map(s=>{const r=s.value,n=s.key;if(void 0===r||void 0===n)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,r,n,s):e(r,n,s)})}filter(e,t){const s=this.elements.filter(s=>{const r=s.value,n=s.key;return void 0!==r&&void 0!==n&&(void 0!==t?e.call(t,r,n,s):e(r,n,s))});return new Ge(s)}reject(e,t){const s=[];for(const r of this.elements){const n=r.value,o=r.key;void 0!==n&&void 0!==o&&(e.call(t,n,o,r)||s.push(r))}return new Ge(s)}forEach(e,t){this.elements.forEach((s,r)=>{const n=s.value,o=s.key;void 0!==n&&void 0!==o&&(void 0!==t?e.call(t,n,o,s,r):e(n,o,s,r))})}find(e,t){return this.elements.find(s=>{const r=s.value,n=s.key;return void 0!==r&&void 0!==n&&(void 0!==t?e.call(t,r,n,s):e(r,n,s))})}keys(){return this.elements.map(e=>e.key?.toValue()).filter(e=>void 0!==e)}values(){return this.elements.map(e=>e.value?.toValue()).filter(e=>void 0!==e)}get length(){return this.elements.length}get isEmpty(){return 0===this.length}get first(){return this.elements[0]}get(e){return this.elements[e]}push(e){return this.elements.push(e),this}includesKey(e){return this.elements.some(t=>t.key?.equals(e))}[Symbol.iterator](){return this.elements[Symbol.iterator]()}}const Xe=Ge;class Qe{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(e,t,s){void 0!==t&&(this.meta=t),void 0!==s&&(this.attributes=s),void 0!==e&&(this.content=e)}get element(){return this._storedElement}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof Qe)this._content=e;else if(null!=e&&"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e&&"symbol"!=typeof e)if(e instanceof Ve)this._content=e;else if(e instanceof Xe)this._content=e.elements;else if(Array.isArray(e))this._content=e.map(e=>this.refract(e));else{if("object"!=typeof e)throw new Error("Cannot set content to value of type "+typeof e);this._content=Object.entries(e).map(([e,t])=>new this.MemberElement(e,t))}else this._content=e}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof Qe?this._meta=e:this.meta.set(e??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof Qe?this._attributes=e:this.attributes.set(e??{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get children(){const{_content:e}=this;if(Array.isArray(e))return e;if(e instanceof Ve){const t=[];return e.key&&t.push(e.key),e.value&&t.push(e.value),t}return e instanceof Qe?[e]:[]}get isFrozen(){return Object.isFrozen(this)}freeze(){if(!this.isFrozen){this._meta&&(this._meta.parent=this,this._meta.freeze()),this._attributes&&(this._attributes.parent=this,this._attributes.freeze());for(const e of this.children)e.parent=this,e.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:e}=this;return e instanceof Qe||e instanceof Ve?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){const t=e instanceof Qe?e.toValue():e;return ze(this.toValue(),t)}primitive(){}set(e){return this.content=e,this}toRef(e){const t=this.id.toValue();if(""===t)throw new Error("Cannot create reference to an element without an ID");const s=new this.RefElement(t);return"string"==typeof e&&(s.path=this.refract(e)),s}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}hasMetaProperty(e){return!this.isMetaEmpty&&this.meta.hasKey(e)}get isMetaEmpty(){return void 0===this._meta||this.meta.isEmpty}getAttributesProperty(e,t){if(!this.hasAttributesProperty(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.attributes.set(e,t)}return this.attributes.get(e)}setAttributesProperty(e,t){this.attributes.set(e,t)}hasAttributesProperty(e){return!this.isAttributesEmpty&&this.attributes.hasKey(e)}get isAttributesEmpty(){return void 0===this._attributes||this.attributes.isEmpty}}const Ye=Qe;const Je=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="string"}primitive(){return"string"}get length(){return this.content?.length??0}};const Ke=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="number"}primitive(){return"number"}};const We=class extends Ye{constructor(e,t,s){super(e??null,t,s),this.element="null"}primitive(){return"null"}set(e){throw new Error("Cannot set the value of null")}};const Ze=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="boolean"}primitive(){return"boolean"}};class et extends Ye{constructor(e,t,s){super(e||[],t,s)}get length(){return this._content.length}get isEmpty(){return 0===this.length}get first(){return this._content[0]}get second(){return this._content[1]}get last(){return this._content.at(-1)}push(...e){for(const t of e)this._content.push(this.refract(t));return this}shift(){return this._content.shift()}unshift(e){this._content.unshift(this.refract(e))}includes(e){return this._content.some(t=>t.equals(e))}findElements(e,t){const s=t||{},r=!!s.recursive,n=void 0===s.results?[]:s.results;for(let t=0;t<this._content.length;t+=1){const s=this._content[t],o=s;r&&"function"==typeof o.findElements&&o.findElements(e,{results:n,recursive:r}),e(s,t,void 0)&&n.push(s)}return n}find(e){const t=this.findElements(e,{recursive:!0});return new this.ArrayElement(t)}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>{const s=t.classes;return"function"==typeof s.includes&&s.includes(e)})}getById(e){return this.find(t=>t.id.toValue()===e).first}concat(e){return new(0,this.constructor)(this._content.concat(e._content))}[Symbol.iterator](){return this._content[Symbol.iterator]()}}const tt=et;const st=class extends tt{constructor(e,t,s){super(e||[],t,s),this.element="array"}primitive(){return"array"}get(e){return this._content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}set(e,t){return"number"==typeof e&&void 0!==t?this._content[e]=this.refract(t):this.content=e,this}remove(e){return this._content.splice(e,1)[0]??null}map(e,t){return this._content.map(e,t)}flatMap(e,t){return this._content.flatMap(e,t)}compactMap(e,t){const s=[];for(const r of this._content){const n=e.call(t,r);n&&s.push(n)}return s}filter(e,t){const s=this._content.filter(e,t);return new this.constructor(s)}reject(e,t){const s=[];for(const r of this._content)e.call(t,r)||s.push(r);return new this.constructor(s)}reduce(e,t){let s,r;void 0!==t?(s=0,r=this.refract(t)):(s=1,r=this.first);for(let t=s;t<this.length;t+=1){const s=e(r,this._content[t],t,this);r=void 0===s?s:this.refract(s)}return r}forEach(e,t){this._content.forEach((s,r)=>{e.call(t,s,r)})}empty(){return new this.constructor([])}};const rt=class extends Ye{constructor(e,t,s,r){super(new Ve,s,r),this.element="member",void 0!==e&&(this.key=e),arguments.length>=2&&(this.value=t)}primitive(){return"member"}get key(){return this._content.key}set key(e){this._content.key=this.refract(e)}get value(){return this._content.value}set value(e){this._content.value=void 0===e?void 0:this.refract(e)}};const nt=class extends tt{constructor(e,t,s){super(e||[],t,s),this.element="object"}primitive(){return"object"}toValue(){return this._content.reduce((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e),{})}get(e){const t=this.getMember(e);if(t)return t.value}getValue(e){const t=this.get(e);if(t)return t.toValue()}getMember(e){if(void 0!==e)return this._content.find(t=>t.key.toValue()===e)}remove(e){let t=null;return this.content=this._content.filter(s=>s.key.toValue()!==e||(t=s,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if("string"==typeof e){const s=this.getMember(e);s?s.value=t:this._content.push(new rt(e,t))}else if("object"==typeof e&&!Array.isArray(e))for(const t of Object.keys(e))this.set(t,e[t]);return this}keys(){return this._content.map(e=>e.key.toValue())}values(){return this._content.map(e=>e.value.toValue())}hasKey(e){return this._content.some(t=>t.key.equals(e))}items(){return this._content.map(e=>[e.key.toValue(),e.value.toValue()])}map(e,t){return this._content.map(s=>e.call(t,s.value,s.key,s))}compactMap(e,t){const s=[];return this.forEach((r,n,o)=>{const i=e.call(t,r,n,o);i&&s.push(i)}),s}filter(e,t){return new Xe(this._content).filter(e,t)}reject(e,t){const s=[];for(const r of this._content)e.call(t,r.value,r.key,r)||s.push(r);return new Xe(s)}forEach(e,t){this._content.forEach(s=>e.call(t,s.value,s.key,s))}reduce(e,t){let s,r;void 0!==t?(s=0,r=this.refract(t)):(s=1,r=this._content[0]?.value);for(let t=s;t<this._content.length;t+=1){const s=this._content[t],n=e(r,s.value,s.key,s,this);r=void 0===n?n:this.refract(n)}return r}empty(){return new this.constructor([])}},ot=e=>e instanceof Je,it=e=>e instanceof Ke,lt=e=>e instanceof We,ct=e=>e instanceof Ze,at=e=>e instanceof st,ut=e=>e instanceof nt;const pt=class extends Ye{constructor(e,t,s){super(e||[],t,s),this.element="ref",this.path||(this.path="element")}get path(){if(this.hasAttributesProperty("path"))return this.attributes.get("path")}set path(e){this.attributes.set("path",e)}};function ht(e){return void 0===e?new We:dt(e)}function dt(e){if(e instanceof Ye)return e;if("string"==typeof e)return new Je(e);if("number"==typeof e)return new Ke(e);if("boolean"==typeof e)return new Ze(e);if(null===e)return new We;if(Array.isArray(e))return new st(e.map(ht));if("object"==typeof e)return new nt(e);throw new Error("Cannot refract value of type "+typeof e)}Ye.prototype.ObjectElement=nt,Ye.prototype.ArrayElement=st,Ye.prototype.RefElement=pt,Ye.prototype.MemberElement=rt,Ye.prototype.refract=dt;const mt=class extends ge{name="apidom";isObject(e){return ut(e)}isArray(e){return at(e)}isString(e){return ot(e)}isNumber(e){return it(e)}isBoolean(e){return ct(e)}isNull(e){return lt(e)}getString(e){return ot(e)?e.toValue():"string"==typeof e?e:void 0}getProperty(e,t){if(ut(e)&&e.hasKey(t))return e.get(t)}hasProperty(e,t){return!!ut(e)&&e.hasKey(t)}getElement(e,t){if(at(e)&&!(t<0||t>=e.length))return e.get(t)}getKeys(e){return ut(e)?e.keys():[]}getLength(e){return ot(e)?[...e.toValue()].length:at(e)||ut(e)?e.length:"string"==typeof e?[...e].length:Array.isArray(e)?e.length:0}*entries(e){if(at(e)){let t=0;for(const s of e)yield[t,s],t+=1}else if(ut(e))for(const t of e)yield[t.key.toValue(),t.value]}compare(e,t,s){if(void 0===e||void 0===s)return"=="===t?void 0===e&&void 0===s:"!="===t&&!(void 0===e&&void 0===s);const r=it(e)||"number"==typeof e,n=it(s)||"number"==typeof s;if(r&&n){const r=it(e)?e.toValue():e,n=it(s)?s.toValue():s,o=Object.is(r,-0)?0:r,i=Object.is(n,-0)?0:n;switch(t){case"==":return o===i;case"!=":return o!==i;case"<":return o<i;case">":return o>i;case"<=":return o<=i;case">=":return o>=i;default:return!1}}const o=ot(e)||"string"==typeof e,i=ot(s)||"string"==typeof s;if(o&&i){const r=ot(e)?e.toValue():e,n=ot(s)?s.toValue():s;switch(t){case"==":return r===n;case"!=":return r!==n;case"<":return r<n;case">":return r>n;case"<=":return r<=n;case">=":return r>=n;default:return!1}}return"=="===t?dt(e).equals(s):"!="===t&&!dt(e).equals(s)}},yt=new mt,gt=(e,t,s={})=>Ie(e,t,{...s,realm:yt});return t})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPath=t():e.apidomJsonPath=t()}(self,()=>(()=>{"use strict";var e={d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ASTTranslator:()=>M,ApiDOMEvaluationRealm:()=>mt,CSTOptimizedTranslator:()=>x,CSTTranslator:()=>f,EvaluationRealm:()=>ge,Grammar:()=>n,JSONEvaluationRealm:()=>fe,JSONNormalizedPathError:()=>F,JSONPathError:()=>m,JSONPathEvaluateError:()=>xe,JSONPathParseError:()=>y,NormalizedPath:()=>s,XMLTranslator:()=>L,evaluate:()=>gt,functions:()=>r,parse:()=>N,test:()=>D});var s={};e.r(s),e.d(s,{escape:()=>P,from:()=>$,test:()=>B,to:()=>j});var r={};function n(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"jsonpath-query",lower:"jsonpath-query",index:0,isBkr:!1},this.rules[1]={name:"segments",lower:"segments",index:1,isBkr:!1},this.rules[2]={name:"B",lower:"b",index:2,isBkr:!1},this.rules[3]={name:"S",lower:"s",index:3,isBkr:!1},this.rules[4]={name:"root-identifier",lower:"root-identifier",index:4,isBkr:!1},this.rules[5]={name:"selector",lower:"selector",index:5,isBkr:!1},this.rules[6]={name:"name-selector",lower:"name-selector",index:6,isBkr:!1},this.rules[7]={name:"string-literal",lower:"string-literal",index:7,isBkr:!1},this.rules[8]={name:"double-quoted",lower:"double-quoted",index:8,isBkr:!1},this.rules[9]={name:"single-quoted",lower:"single-quoted",index:9,isBkr:!1},this.rules[10]={name:"ESC",lower:"esc",index:10,isBkr:!1},this.rules[11]={name:"unescaped",lower:"unescaped",index:11,isBkr:!1},this.rules[12]={name:"escapable",lower:"escapable",index:12,isBkr:!1},this.rules[13]={name:"hexchar",lower:"hexchar",index:13,isBkr:!1},this.rules[14]={name:"non-surrogate",lower:"non-surrogate",index:14,isBkr:!1},this.rules[15]={name:"high-surrogate",lower:"high-surrogate",index:15,isBkr:!1},this.rules[16]={name:"low-surrogate",lower:"low-surrogate",index:16,isBkr:!1},this.rules[17]={name:"HEXDIG",lower:"hexdig",index:17,isBkr:!1},this.rules[18]={name:"wildcard-selector",lower:"wildcard-selector",index:18,isBkr:!1},this.rules[19]={name:"index-selector",lower:"index-selector",index:19,isBkr:!1},this.rules[20]={name:"int",lower:"int",index:20,isBkr:!1},this.rules[21]={name:"DIGIT1",lower:"digit1",index:21,isBkr:!1},this.rules[22]={name:"slice-selector",lower:"slice-selector",index:22,isBkr:!1},this.rules[23]={name:"start",lower:"start",index:23,isBkr:!1},this.rules[24]={name:"end",lower:"end",index:24,isBkr:!1},this.rules[25]={name:"step",lower:"step",index:25,isBkr:!1},this.rules[26]={name:"filter-selector",lower:"filter-selector",index:26,isBkr:!1},this.rules[27]={name:"logical-expr",lower:"logical-expr",index:27,isBkr:!1},this.rules[28]={name:"logical-or-expr",lower:"logical-or-expr",index:28,isBkr:!1},this.rules[29]={name:"logical-and-expr",lower:"logical-and-expr",index:29,isBkr:!1},this.rules[30]={name:"basic-expr",lower:"basic-expr",index:30,isBkr:!1},this.rules[31]={name:"paren-expr",lower:"paren-expr",index:31,isBkr:!1},this.rules[32]={name:"logical-not-op",lower:"logical-not-op",index:32,isBkr:!1},this.rules[33]={name:"test-expr",lower:"test-expr",index:33,isBkr:!1},this.rules[34]={name:"filter-query",lower:"filter-query",index:34,isBkr:!1},this.rules[35]={name:"rel-query",lower:"rel-query",index:35,isBkr:!1},this.rules[36]={name:"current-node-identifier",lower:"current-node-identifier",index:36,isBkr:!1},this.rules[37]={name:"comparison-expr",lower:"comparison-expr",index:37,isBkr:!1},this.rules[38]={name:"literal",lower:"literal",index:38,isBkr:!1},this.rules[39]={name:"comparable",lower:"comparable",index:39,isBkr:!1},this.rules[40]={name:"comparison-op",lower:"comparison-op",index:40,isBkr:!1},this.rules[41]={name:"singular-query",lower:"singular-query",index:41,isBkr:!1},this.rules[42]={name:"rel-singular-query",lower:"rel-singular-query",index:42,isBkr:!1},this.rules[43]={name:"abs-singular-query",lower:"abs-singular-query",index:43,isBkr:!1},this.rules[44]={name:"singular-query-segments",lower:"singular-query-segments",index:44,isBkr:!1},this.rules[45]={name:"name-segment",lower:"name-segment",index:45,isBkr:!1},this.rules[46]={name:"index-segment",lower:"index-segment",index:46,isBkr:!1},this.rules[47]={name:"number",lower:"number",index:47,isBkr:!1},this.rules[48]={name:"frac",lower:"frac",index:48,isBkr:!1},this.rules[49]={name:"exp",lower:"exp",index:49,isBkr:!1},this.rules[50]={name:"true",lower:"true",index:50,isBkr:!1},this.rules[51]={name:"false",lower:"false",index:51,isBkr:!1},this.rules[52]={name:"null",lower:"null",index:52,isBkr:!1},this.rules[53]={name:"function-name",lower:"function-name",index:53,isBkr:!1},this.rules[54]={name:"function-name-first",lower:"function-name-first",index:54,isBkr:!1},this.rules[55]={name:"function-name-char",lower:"function-name-char",index:55,isBkr:!1},this.rules[56]={name:"LCALPHA",lower:"lcalpha",index:56,isBkr:!1},this.rules[57]={name:"function-expr",lower:"function-expr",index:57,isBkr:!1},this.rules[58]={name:"function-argument",lower:"function-argument",index:58,isBkr:!1},this.rules[59]={name:"segment",lower:"segment",index:59,isBkr:!1},this.rules[60]={name:"child-segment",lower:"child-segment",index:60,isBkr:!1},this.rules[61]={name:"bracketed-selection",lower:"bracketed-selection",index:61,isBkr:!1},this.rules[62]={name:"member-name-shorthand",lower:"member-name-shorthand",index:62,isBkr:!1},this.rules[63]={name:"name-first",lower:"name-first",index:63,isBkr:!1},this.rules[64]={name:"name-char",lower:"name-char",index:64,isBkr:!1},this.rules[65]={name:"DIGIT",lower:"digit",index:65,isBkr:!1},this.rules[66]={name:"ALPHA",lower:"alpha",index:66,isBkr:!1},this.rules[67]={name:"descendant-segment",lower:"descendant-segment",index:67,isBkr:!1},this.rules[68]={name:"normalized-path",lower:"normalized-path",index:68,isBkr:!1},this.rules[69]={name:"normal-index-segment",lower:"normal-index-segment",index:69,isBkr:!1},this.rules[70]={name:"normal-selector",lower:"normal-selector",index:70,isBkr:!1},this.rules[71]={name:"normal-name-selector",lower:"normal-name-selector",index:71,isBkr:!1},this.rules[72]={name:"normal-single-quoted",lower:"normal-single-quoted",index:72,isBkr:!1},this.rules[73]={name:"normal-unescaped",lower:"normal-unescaped",index:73,isBkr:!1},this.rules[74]={name:"normal-escapable",lower:"normal-escapable",index:74,isBkr:!1},this.rules[75]={name:"normal-hexchar",lower:"normal-hexchar",index:75,isBkr:!1},this.rules[76]={name:"normal-HEXDIG",lower:"normal-hexdig",index:76,isBkr:!1},this.rules[77]={name:"normal-index-selector",lower:"normal-index-selector",index:77,isBkr:!1},this.rules[78]={name:"dot-prefix",lower:"dot-prefix",index:78,isBkr:!1},this.rules[79]={name:"double-dot-prefix",lower:"double-dot-prefix",index:79,isBkr:!1},this.rules[80]={name:"left-bracket",lower:"left-bracket",index:80,isBkr:!1},this.rules[81]={name:"right-bracket",lower:"right-bracket",index:81,isBkr:!1},this.rules[82]={name:"left-paren",lower:"left-paren",index:82,isBkr:!1},this.rules[83]={name:"right-paren",lower:"right-paren",index:83,isBkr:!1},this.rules[84]={name:"comma",lower:"comma",index:84,isBkr:!1},this.rules[85]={name:"colon",lower:"colon",index:85,isBkr:!1},this.rules[86]={name:"dquote",lower:"dquote",index:86,isBkr:!1},this.rules[87]={name:"squote",lower:"squote",index:87,isBkr:!1},this.rules[88]={name:"questionmark",lower:"questionmark",index:88,isBkr:!1},this.rules[89]={name:"disjunction",lower:"disjunction",index:89,isBkr:!1},this.rules[90]={name:"conjunction",lower:"conjunction",index:90,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,2]},this.rules[0].opcodes[1]={type:4,index:4},this.rules[0].opcodes[2]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:2,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:3},this.rules[1].opcodes[3]={type:4,index:59},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:6,string:[32]},this.rules[2].opcodes[2]={type:6,string:[9]},this.rules[2].opcodes[3]={type:6,string:[10]},this.rules[2].opcodes[4]={type:6,string:[13]},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:0,max:1/0},this.rules[3].opcodes[1]={type:4,index:2},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:7,string:[36]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[5].opcodes[1]={type:4,index:6},this.rules[5].opcodes[2]={type:4,index:18},this.rules[5].opcodes[3]={type:4,index:22},this.rules[5].opcodes[4]={type:4,index:19},this.rules[5].opcodes[5]={type:4,index:26},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:4,index:7},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,6]},this.rules[7].opcodes[1]={type:2,children:[2,3,5]},this.rules[7].opcodes[2]={type:4,index:86},this.rules[7].opcodes[3]={type:3,min:0,max:1/0},this.rules[7].opcodes[4]={type:4,index:8},this.rules[7].opcodes[5]={type:4,index:86},this.rules[7].opcodes[6]={type:2,children:[7,8,10]},this.rules[7].opcodes[7]={type:4,index:87},this.rules[7].opcodes[8]={type:3,min:0,max:1/0},this.rules[7].opcodes[9]={type:4,index:9},this.rules[7].opcodes[10]={type:4,index:87},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:1,children:[1,2,3,6]},this.rules[8].opcodes[1]={type:4,index:11},this.rules[8].opcodes[2]={type:6,string:[39]},this.rules[8].opcodes[3]={type:2,children:[4,5]},this.rules[8].opcodes[4]={type:4,index:10},this.rules[8].opcodes[5]={type:6,string:[34]},this.rules[8].opcodes[6]={type:2,children:[7,8]},this.rules[8].opcodes[7]={type:4,index:10},this.rules[8].opcodes[8]={type:4,index:12},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2,3,6]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:6,string:[34]},this.rules[9].opcodes[3]={type:2,children:[4,5]},this.rules[9].opcodes[4]={type:4,index:10},this.rules[9].opcodes[5]={type:6,string:[39]},this.rules[9].opcodes[6]={type:2,children:[7,8]},this.rules[9].opcodes[7]={type:4,index:10},this.rules[9].opcodes[8]={type:4,index:12},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[92]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[11].opcodes[1]={type:5,min:32,max:33},this.rules[11].opcodes[2]={type:5,min:35,max:38},this.rules[11].opcodes[3]={type:5,min:40,max:91},this.rules[11].opcodes[4]={type:5,min:93,max:55295},this.rules[11].opcodes[5]={type:5,min:57344,max:1114111},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8]},this.rules[12].opcodes[1]={type:6,string:[98]},this.rules[12].opcodes[2]={type:6,string:[102]},this.rules[12].opcodes[3]={type:6,string:[110]},this.rules[12].opcodes[4]={type:6,string:[114]},this.rules[12].opcodes[5]={type:6,string:[116]},this.rules[12].opcodes[6]={type:7,string:[47]},this.rules[12].opcodes[7]={type:7,string:[92]},this.rules[12].opcodes[8]={type:2,children:[9,10]},this.rules[12].opcodes[9]={type:6,string:[117]},this.rules[12].opcodes[10]={type:4,index:13},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:1,children:[1,2]},this.rules[13].opcodes[1]={type:4,index:14},this.rules[13].opcodes[2]={type:2,children:[3,4,5,6]},this.rules[13].opcodes[3]={type:4,index:15},this.rules[13].opcodes[4]={type:7,string:[92]},this.rules[13].opcodes[5]={type:6,string:[117]},this.rules[13].opcodes[6]={type:4,index:16},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:1,children:[1,11]},this.rules[14].opcodes[1]={type:2,children:[2,9]},this.rules[14].opcodes[2]={type:1,children:[3,4,5,6,7,8]},this.rules[14].opcodes[3]={type:4,index:65},this.rules[14].opcodes[4]={type:7,string:[97]},this.rules[14].opcodes[5]={type:7,string:[98]},this.rules[14].opcodes[6]={type:7,string:[99]},this.rules[14].opcodes[7]={type:7,string:[101]},this.rules[14].opcodes[8]={type:7,string:[102]},this.rules[14].opcodes[9]={type:3,min:3,max:3},this.rules[14].opcodes[10]={type:4,index:17},this.rules[14].opcodes[11]={type:2,children:[12,13,14]},this.rules[14].opcodes[12]={type:7,string:[100]},this.rules[14].opcodes[13]={type:5,min:48,max:55},this.rules[14].opcodes[14]={type:3,min:2,max:2},this.rules[14].opcodes[15]={type:4,index:17},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2,7]},this.rules[15].opcodes[1]={type:7,string:[100]},this.rules[15].opcodes[2]={type:1,children:[3,4,5,6]},this.rules[15].opcodes[3]={type:7,string:[56]},this.rules[15].opcodes[4]={type:7,string:[57]},this.rules[15].opcodes[5]={type:7,string:[97]},this.rules[15].opcodes[6]={type:7,string:[98]},this.rules[15].opcodes[7]={type:3,min:2,max:2},this.rules[15].opcodes[8]={type:4,index:17},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,2,7]},this.rules[16].opcodes[1]={type:7,string:[100]},this.rules[16].opcodes[2]={type:1,children:[3,4,5,6]},this.rules[16].opcodes[3]={type:7,string:[99]},this.rules[16].opcodes[4]={type:7,string:[100]},this.rules[16].opcodes[5]={type:7,string:[101]},this.rules[16].opcodes[6]={type:7,string:[102]},this.rules[16].opcodes[7]={type:3,min:2,max:2},this.rules[16].opcodes[8]={type:4,index:17},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[17].opcodes[1]={type:4,index:65},this.rules[17].opcodes[2]={type:7,string:[97]},this.rules[17].opcodes[3]={type:7,string:[98]},this.rules[17].opcodes[4]={type:7,string:[99]},this.rules[17].opcodes[5]={type:7,string:[100]},this.rules[17].opcodes[6]={type:7,string:[101]},this.rules[17].opcodes[7]={type:7,string:[102]},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:7,string:[42]},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:4,index:20},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:1,children:[1,2]},this.rules[20].opcodes[1]={type:7,string:[48]},this.rules[20].opcodes[2]={type:2,children:[3,5,6]},this.rules[20].opcodes[3]={type:3,min:0,max:1},this.rules[20].opcodes[4]={type:7,string:[45]},this.rules[20].opcodes[5]={type:4,index:21},this.rules[20].opcodes[6]={type:3,min:0,max:1/0},this.rules[20].opcodes[7]={type:4,index:65},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:5,min:49,max:57},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:2,children:[1,5,6,7,11]},this.rules[22].opcodes[1]={type:3,min:0,max:1},this.rules[22].opcodes[2]={type:2,children:[3,4]},this.rules[22].opcodes[3]={type:4,index:23},this.rules[22].opcodes[4]={type:4,index:3},this.rules[22].opcodes[5]={type:4,index:85},this.rules[22].opcodes[6]={type:4,index:3},this.rules[22].opcodes[7]={type:3,min:0,max:1},this.rules[22].opcodes[8]={type:2,children:[9,10]},this.rules[22].opcodes[9]={type:4,index:24},this.rules[22].opcodes[10]={type:4,index:3},this.rules[22].opcodes[11]={type:3,min:0,max:1},this.rules[22].opcodes[12]={type:2,children:[13,14]},this.rules[22].opcodes[13]={type:4,index:85},this.rules[22].opcodes[14]={type:3,min:0,max:1},this.rules[22].opcodes[15]={type:2,children:[16,17]},this.rules[22].opcodes[16]={type:4,index:3},this.rules[22].opcodes[17]={type:4,index:25},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:4,index:20},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:4,index:20},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:4,index:20},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:2,children:[1,2,3]},this.rules[26].opcodes[1]={type:4,index:88},this.rules[26].opcodes[2]={type:4,index:3},this.rules[26].opcodes[3]={type:4,index:27},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:4,index:28},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:29},this.rules[28].opcodes[2]={type:3,min:0,max:1/0},this.rules[28].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[28].opcodes[4]={type:4,index:3},this.rules[28].opcodes[5]={type:4,index:89},this.rules[28].opcodes[6]={type:4,index:3},this.rules[28].opcodes[7]={type:4,index:29},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:2,children:[1,2]},this.rules[29].opcodes[1]={type:4,index:30},this.rules[29].opcodes[2]={type:3,min:0,max:1/0},this.rules[29].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[29].opcodes[4]={type:4,index:3},this.rules[29].opcodes[5]={type:4,index:90},this.rules[29].opcodes[6]={type:4,index:3},this.rules[29].opcodes[7]={type:4,index:30},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:1,children:[1,2,3]},this.rules[30].opcodes[1]={type:4,index:31},this.rules[30].opcodes[2]={type:4,index:37},this.rules[30].opcodes[3]={type:4,index:33},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:2,children:[1,5,6,7,8,9]},this.rules[31].opcodes[1]={type:3,min:0,max:1},this.rules[31].opcodes[2]={type:2,children:[3,4]},this.rules[31].opcodes[3]={type:4,index:32},this.rules[31].opcodes[4]={type:4,index:3},this.rules[31].opcodes[5]={type:4,index:82},this.rules[31].opcodes[6]={type:4,index:3},this.rules[31].opcodes[7]={type:4,index:27},this.rules[31].opcodes[8]={type:4,index:3},this.rules[31].opcodes[9]={type:4,index:83},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:7,string:[33]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:2,children:[1,5]},this.rules[33].opcodes[1]={type:3,min:0,max:1},this.rules[33].opcodes[2]={type:2,children:[3,4]},this.rules[33].opcodes[3]={type:4,index:32},this.rules[33].opcodes[4]={type:4,index:3},this.rules[33].opcodes[5]={type:1,children:[6,7]},this.rules[33].opcodes[6]={type:4,index:34},this.rules[33].opcodes[7]={type:4,index:57},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:1,children:[1,2]},this.rules[34].opcodes[1]={type:4,index:35},this.rules[34].opcodes[2]={type:4,index:0},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:2,children:[1,2]},this.rules[35].opcodes[1]={type:4,index:36},this.rules[35].opcodes[2]={type:4,index:1},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:7,string:[64]},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:2,children:[1,2,3,4,5]},this.rules[37].opcodes[1]={type:4,index:39},this.rules[37].opcodes[2]={type:4,index:3},this.rules[37].opcodes[3]={type:4,index:40},this.rules[37].opcodes[4]={type:4,index:3},this.rules[37].opcodes[5]={type:4,index:39},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[38].opcodes[1]={type:4,index:47},this.rules[38].opcodes[2]={type:4,index:7},this.rules[38].opcodes[3]={type:4,index:50},this.rules[38].opcodes[4]={type:4,index:51},this.rules[38].opcodes[5]={type:4,index:52},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:1,children:[1,2,3]},this.rules[39].opcodes[1]={type:4,index:41},this.rules[39].opcodes[2]={type:4,index:57},this.rules[39].opcodes[3]={type:4,index:38},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2,3,4,5,6]},this.rules[40].opcodes[1]={type:7,string:[61,61]},this.rules[40].opcodes[2]={type:7,string:[33,61]},this.rules[40].opcodes[3]={type:7,string:[60,61]},this.rules[40].opcodes[4]={type:7,string:[62,61]},this.rules[40].opcodes[5]={type:7,string:[60]},this.rules[40].opcodes[6]={type:7,string:[62]},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:1,children:[1,2]},this.rules[41].opcodes[1]={type:4,index:42},this.rules[41].opcodes[2]={type:4,index:43},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:4,index:36},this.rules[42].opcodes[2]={type:4,index:44},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:2,children:[1,2]},this.rules[43].opcodes[1]={type:4,index:4},this.rules[43].opcodes[2]={type:4,index:44},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:3,min:0,max:1/0},this.rules[44].opcodes[1]={type:2,children:[2,3]},this.rules[44].opcodes[2]={type:4,index:3},this.rules[44].opcodes[3]={type:1,children:[4,5]},this.rules[44].opcodes[4]={type:4,index:45},this.rules[44].opcodes[5]={type:4,index:46},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:1,children:[1,5]},this.rules[45].opcodes[1]={type:2,children:[2,3,4]},this.rules[45].opcodes[2]={type:4,index:80},this.rules[45].opcodes[3]={type:4,index:6},this.rules[45].opcodes[4]={type:4,index:81},this.rules[45].opcodes[5]={type:2,children:[6,7]},this.rules[45].opcodes[6]={type:4,index:78},this.rules[45].opcodes[7]={type:4,index:62},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:2,children:[1,2,3]},this.rules[46].opcodes[1]={type:4,index:80},this.rules[46].opcodes[2]={type:4,index:19},this.rules[46].opcodes[3]={type:4,index:81},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:2,children:[1,4,6]},this.rules[47].opcodes[1]={type:1,children:[2,3]},this.rules[47].opcodes[2]={type:4,index:20},this.rules[47].opcodes[3]={type:7,string:[45,48]},this.rules[47].opcodes[4]={type:3,min:0,max:1},this.rules[47].opcodes[5]={type:4,index:48},this.rules[47].opcodes[6]={type:3,min:0,max:1},this.rules[47].opcodes[7]={type:4,index:49},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:2,children:[1,2]},this.rules[48].opcodes[1]={type:7,string:[46]},this.rules[48].opcodes[2]={type:3,min:1,max:1/0},this.rules[48].opcodes[3]={type:4,index:65},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:2,children:[1,2,6]},this.rules[49].opcodes[1]={type:7,string:[101]},this.rules[49].opcodes[2]={type:3,min:0,max:1},this.rules[49].opcodes[3]={type:1,children:[4,5]},this.rules[49].opcodes[4]={type:7,string:[45]},this.rules[49].opcodes[5]={type:7,string:[43]},this.rules[49].opcodes[6]={type:3,min:1,max:1/0},this.rules[49].opcodes[7]={type:4,index:65},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[116,114,117,101]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[102,97,108,115,101]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[110,117,108,108]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:4,index:54},this.rules[53].opcodes[2]={type:3,min:0,max:1/0},this.rules[53].opcodes[3]={type:4,index:55},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:4,index:56},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:1,children:[1,2,3]},this.rules[55].opcodes[1]={type:4,index:54},this.rules[55].opcodes[2]={type:7,string:[95]},this.rules[55].opcodes[3]={type:4,index:65},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:5,min:97,max:122},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:2,children:[1,2,3,4,13,14]},this.rules[57].opcodes[1]={type:4,index:53},this.rules[57].opcodes[2]={type:4,index:82},this.rules[57].opcodes[3]={type:4,index:3},this.rules[57].opcodes[4]={type:3,min:0,max:1},this.rules[57].opcodes[5]={type:2,children:[6,7]},this.rules[57].opcodes[6]={type:4,index:58},this.rules[57].opcodes[7]={type:3,min:0,max:1/0},this.rules[57].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[57].opcodes[9]={type:4,index:3},this.rules[57].opcodes[10]={type:4,index:84},this.rules[57].opcodes[11]={type:4,index:3},this.rules[57].opcodes[12]={type:4,index:58},this.rules[57].opcodes[13]={type:4,index:3},this.rules[57].opcodes[14]={type:4,index:83},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[58].opcodes[1]={type:4,index:27},this.rules[58].opcodes[2]={type:4,index:34},this.rules[58].opcodes[3]={type:4,index:57},this.rules[58].opcodes[4]={type:4,index:38},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:1,children:[1,2]},this.rules[59].opcodes[1]={type:4,index:60},this.rules[59].opcodes[2]={type:4,index:67},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:1,children:[1,2]},this.rules[60].opcodes[1]={type:4,index:61},this.rules[60].opcodes[2]={type:2,children:[3,4]},this.rules[60].opcodes[3]={type:4,index:78},this.rules[60].opcodes[4]={type:1,children:[5,6]},this.rules[60].opcodes[5]={type:4,index:18},this.rules[60].opcodes[6]={type:4,index:62},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3,4,10,11]},this.rules[61].opcodes[1]={type:4,index:80},this.rules[61].opcodes[2]={type:4,index:3},this.rules[61].opcodes[3]={type:4,index:5},this.rules[61].opcodes[4]={type:3,min:0,max:1/0},this.rules[61].opcodes[5]={type:2,children:[6,7,8,9]},this.rules[61].opcodes[6]={type:4,index:3},this.rules[61].opcodes[7]={type:4,index:84},this.rules[61].opcodes[8]={type:4,index:3},this.rules[61].opcodes[9]={type:4,index:5},this.rules[61].opcodes[10]={type:4,index:3},this.rules[61].opcodes[11]={type:4,index:81},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:2,children:[1,2]},this.rules[62].opcodes[1]={type:4,index:63},this.rules[62].opcodes[2]={type:3,min:0,max:1/0},this.rules[62].opcodes[3]={type:4,index:64},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[63].opcodes[1]={type:4,index:66},this.rules[63].opcodes[2]={type:7,string:[95]},this.rules[63].opcodes[3]={type:5,min:128,max:55295},this.rules[63].opcodes[4]={type:5,min:57344,max:1114111},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:1,children:[1,2]},this.rules[64].opcodes[1]={type:4,index:63},this.rules[64].opcodes[2]={type:4,index:65},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:5,min:48,max:57},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:1,children:[1,2]},this.rules[66].opcodes[1]={type:5,min:65,max:90},this.rules[66].opcodes[2]={type:5,min:97,max:122},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:2,children:[1,2]},this.rules[67].opcodes[1]={type:4,index:79},this.rules[67].opcodes[2]={type:1,children:[3,4,5]},this.rules[67].opcodes[3]={type:4,index:61},this.rules[67].opcodes[4]={type:4,index:18},this.rules[67].opcodes[5]={type:4,index:62},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:2,children:[1,2]},this.rules[68].opcodes[1]={type:4,index:4},this.rules[68].opcodes[2]={type:3,min:0,max:1/0},this.rules[68].opcodes[3]={type:4,index:69},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:2,children:[1,2,3]},this.rules[69].opcodes[1]={type:4,index:80},this.rules[69].opcodes[2]={type:4,index:70},this.rules[69].opcodes[3]={type:4,index:81},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:1,children:[1,2]},this.rules[70].opcodes[1]={type:4,index:71},this.rules[70].opcodes[2]={type:4,index:77},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:2,children:[1,2,4]},this.rules[71].opcodes[1]={type:4,index:87},this.rules[71].opcodes[2]={type:3,min:0,max:1/0},this.rules[71].opcodes[3]={type:4,index:72},this.rules[71].opcodes[4]={type:4,index:87},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:1,children:[1,2]},this.rules[72].opcodes[1]={type:4,index:73},this.rules[72].opcodes[2]={type:2,children:[3,4]},this.rules[72].opcodes[3]={type:4,index:10},this.rules[72].opcodes[4]={type:4,index:74},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[73].opcodes[1]={type:5,min:32,max:38},this.rules[73].opcodes[2]={type:5,min:40,max:91},this.rules[73].opcodes[3]={type:5,min:93,max:55295},this.rules[73].opcodes[4]={type:5,min:57344,max:1114111},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8]},this.rules[74].opcodes[1]={type:6,string:[98]},this.rules[74].opcodes[2]={type:6,string:[102]},this.rules[74].opcodes[3]={type:6,string:[110]},this.rules[74].opcodes[4]={type:6,string:[114]},this.rules[74].opcodes[5]={type:6,string:[116]},this.rules[74].opcodes[6]={type:7,string:[39]},this.rules[74].opcodes[7]={type:7,string:[92]},this.rules[74].opcodes[8]={type:2,children:[9,10]},this.rules[74].opcodes[9]={type:6,string:[117]},this.rules[74].opcodes[10]={type:4,index:75},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:2,children:[1,2,3]},this.rules[75].opcodes[1]={type:7,string:[48]},this.rules[75].opcodes[2]={type:7,string:[48]},this.rules[75].opcodes[3]={type:1,children:[4,7,10,13]},this.rules[75].opcodes[4]={type:2,children:[5,6]},this.rules[75].opcodes[5]={type:7,string:[48]},this.rules[75].opcodes[6]={type:5,min:48,max:55},this.rules[75].opcodes[7]={type:2,children:[8,9]},this.rules[75].opcodes[8]={type:7,string:[48]},this.rules[75].opcodes[9]={type:6,string:[98]},this.rules[75].opcodes[10]={type:2,children:[11,12]},this.rules[75].opcodes[11]={type:7,string:[48]},this.rules[75].opcodes[12]={type:5,min:101,max:102},this.rules[75].opcodes[13]={type:2,children:[14,15]},this.rules[75].opcodes[14]={type:7,string:[49]},this.rules[75].opcodes[15]={type:4,index:76},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:4,index:65},this.rules[76].opcodes[2]={type:5,min:97,max:102},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:7,string:[48]},this.rules[77].opcodes[2]={type:2,children:[3,4]},this.rules[77].opcodes[3]={type:4,index:21},this.rules[77].opcodes[4]={type:3,min:0,max:1/0},this.rules[77].opcodes[5]={type:4,index:65},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:7,string:[46]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:7,string:[46,46]},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:7,string:[91]},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:7,string:[93]},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:7,string:[40]},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:7,string:[41]},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:7,string:[44]},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:7,string:[58]},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:6,string:[34]},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:6,string:[39]},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:7,string:[63]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:7,string:[124,124]},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:7,string:[38,38]},this.toString=function(){let e="";return e+="; JSONPath: Query Expressions for JSON\n",e+="; https://www.rfc-editor.org/rfc/rfc9535\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1\n",e+="jsonpath-query = root-identifier segments\n",e+="segments = *(S segment)\n",e+="\n",e+="B = %x20 / ; Space\n",e+=" %x09 / ; Horizontal tab\n",e+=" %x0A / ; Line feed or New line\n",e+=" %x0D ; Carriage return\n",e+="S = *B ; optional blank space\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1\n",e+='root-identifier = "$"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3\n",e+="selector = name-selector /\n",e+=" wildcard-selector /\n",e+=" slice-selector /\n",e+=" index-selector /\n",e+=" filter-selector\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1\n",e+="name-selector = string-literal\n",e+="\n",e+='string-literal = dquote *double-quoted dquote / ; "string", MODIFICATION: surrogate text rule used\n',e+=" squote *single-quoted squote ; 'string', MODIFICATION: surrogate text rule used\n",e+="\n",e+="double-quoted = unescaped /\n",e+=" %x27 / ; '\n",e+=' ESC %x22 / ; \\"\n',e+=" ESC escapable\n",e+="\n",e+="single-quoted = unescaped /\n",e+=' %x22 / ; "\n',e+=" ESC %x27 / ; \\'\n",e+=" ESC escapable\n",e+="\n",e+="ESC = %x5C ; \\ backslash\n",e+="\n",e+="unescaped = %x20-21 / ; see RFC 8259\n",e+=' ; omit 0x22 "\n',e+=" %x23-26 /\n",e+=" ; omit 0x27 '\n",e+=" %x28-5B /\n",e+=" ; omit 0x5C \\\n",e+=" %x5D-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="\n",e+="escapable = %x62 / ; b BS backspace U+0008\n",e+=" %x66 / ; f FF form feed U+000C\n",e+=" %x6E / ; n LF line feed U+000A\n",e+=" %x72 / ; r CR carriage return U+000D\n",e+=" %x74 / ; t HT horizontal tab U+0009\n",e+=' "/" / ; / slash (solidus) U+002F\n',e+=' "\\" / ; \\ backslash (reverse solidus) U+005C\n',e+=" (%x75 hexchar) ; uXXXX U+XXXX\n",e+="\n",e+="hexchar = non-surrogate /\n",e+=' (high-surrogate "\\" %x75 low-surrogate)\n',e+='non-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /\n',e+=' ("D" %x30-37 2HEXDIG )\n',e+='high-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG\n',e+='low-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG\n',e+="\n",e+='HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1\n",e+='wildcard-selector = "*"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1\n",e+="index-selector = int ; decimal integer\n",e+="\n",e+='int = "0" /\n',e+=' (["-"] DIGIT1 *DIGIT) ; - optional\n',e+="DIGIT1 = %x31-39 ; 1-9 non-zero digit\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1\n",e+="slice-selector = [start S] colon S [end S] [colon [S step ]] ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="start = int ; included in selection\n",e+="end = int ; not included in selection\n",e+="step = int ; default: 1\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1\n",e+="filter-selector = questionmark S logical-expr ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="logical-expr = logical-or-expr\n",e+="logical-or-expr = logical-and-expr *(S disjunction S logical-and-expr) ; MODIFICATION: surrogate text rule used\n",e+=" ; disjunction\n",e+=" ; binds less tightly than conjunction\n",e+="logical-and-expr = basic-expr *(S conjunction S basic-expr) ; MODIFICATION: surrogate text rule used\n",e+=" ; conjunction\n",e+=" ; binds more tightly than disjunction\n",e+="\n",e+="basic-expr = paren-expr /\n",e+=" comparison-expr /\n",e+=" test-expr\n",e+="\n",e+="paren-expr = [logical-not-op S] left-paren S logical-expr S right-paren ; MODIFICATION: surrogate text rule used\n",e+=" ; parenthesized expression\n",e+='logical-not-op = "!" ; logical NOT operator\n',e+="\n",e+="test-expr = [logical-not-op S]\n",e+=" (filter-query / ; existence/non-existence\n",e+=" function-expr) ; LogicalType or NodesType\n",e+="filter-query = rel-query / jsonpath-query\n",e+="rel-query = current-node-identifier segments\n",e+='current-node-identifier = "@"\n',e+="\n",e+="comparison-expr = comparable S comparison-op S comparable\n",e+="literal = number / string-literal /\n",e+=" true / false / null\n",e+="comparable = singular-query / ; singular query value\n",e+=" function-expr / ; ValueType\n",e+=" literal\n",e+=" ; MODIFICATION: https://www.rfc-editor.org/errata/eid8352\n",e+='comparison-op = "==" / "!=" /\n',e+=' "<=" / ">=" /\n',e+=' "<" / ">"\n',e+="\n",e+="singular-query = rel-singular-query / abs-singular-query\n",e+="rel-singular-query = current-node-identifier singular-query-segments\n",e+="abs-singular-query = root-identifier singular-query-segments\n",e+="singular-query-segments = *(S (name-segment / index-segment))\n",e+="name-segment = (left-bracket name-selector right-bracket) / ; MODIFICATION: surrogate text rule used\n",e+=" (dot-prefix member-name-shorthand) ; MODIFICATION: surrogate text rule used\n",e+="index-segment = left-bracket index-selector right-bracket ; MODIFICATION: surrogate text rule used\n",e+="\n",e+='number = (int / "-0") [ frac ] [ exp ] ; decimal number\n',e+='frac = "." 1*DIGIT ; decimal fraction\n',e+='exp = "e" [ "-" / "+" ] 1*DIGIT ; decimal exponent\n',e+="true = %x74.72.75.65 ; true\n",e+="false = %x66.61.6c.73.65 ; false\n",e+="null = %x6e.75.6c.6c ; null\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.4\n",e+="function-name = function-name-first *function-name-char\n",e+="function-name-first = LCALPHA\n",e+='function-name-char = function-name-first / "_" / DIGIT\n',e+='LCALPHA = %x61-7A ; "a".."z"\n',e+="\n",e+="function-expr = function-name left-paren S [function-argument ; MODIFICATION: surrogate text rule used\n",e+=" *(S comma S function-argument)] S right-paren ; MODIFICATION: surrogate text rule used\n",e+="function-argument = logical-expr / ; MODIFICATION: https://www.rfc-editor.org/errata/eid8343\n",e+=" filter-query / ; (includes singular-query)\n",e+=" function-expr /\n",e+=" literal\n",e+="\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5\n",e+="segment = child-segment / descendant-segment\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1\n",e+="child-segment = bracketed-selection /\n",e+=" (dot-prefix ; MODIFICATION: surrogate text rule used\n",e+=" (wildcard-selector /\n",e+=" member-name-shorthand))\n",e+="\n",e+="bracketed-selection = left-bracket S selector *(S comma S selector) S right-bracket\n",e+=" ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="member-name-shorthand = name-first *name-char\n",e+="name-first = ALPHA /\n",e+=' "_" /\n',e+=" %x80-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="name-char = name-first / DIGIT\n",e+="\n",e+="DIGIT = %x30-39 ; 0-9\n",e+="ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1\n",e+="descendant-segment = double-dot-prefix (bracketed-selection / ; MODIFICATION: surrogate text rule used\n",e+=" wildcard-selector /\n",e+=" member-name-shorthand)\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths\n",e+="normalized-path = root-identifier *(normal-index-segment)\n",e+="normal-index-segment = left-bracket normal-selector right-bracket ; MODIFICATION: surrogate text rule used\n",e+="normal-selector = normal-name-selector / normal-index-selector\n",e+="normal-name-selector = squote *normal-single-quoted squote ; 'string', MODIFICATION: surrogate text rule used\n",e+="normal-single-quoted = normal-unescaped /\n",e+=" ESC normal-escapable\n",e+="normal-unescaped = ; omit %x0-1F control codes\n",e+=" %x20-26 /\n",e+=" ; omit 0x27 '\n",e+=" %x28-5B /\n",e+=" ; omit 0x5C \\\n",e+=" %x5D-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="\n",e+="normal-escapable = %x62 / ; b BS backspace U+0008\n",e+=" %x66 / ; f FF form feed U+000C\n",e+=" %x6E / ; n LF line feed U+000A\n",e+=" %x72 / ; r CR carriage return U+000D\n",e+=" %x74 / ; t HT horizontal tab U+0009\n",e+=" \"'\" / ; ' apostrophe U+0027\n",e+=' "\\" / ; \\ backslash (reverse solidus) U+005C\n',e+=" (%x75 normal-hexchar)\n",e+=" ; certain values u00xx U+00XX\n",e+='normal-hexchar = "0" "0"\n',e+=" (\n",e+=' ("0" %x30-37) / ; "00"-"07"\n',e+=" ; omit U+0008-U+000A BS HT LF\n",e+=' ("0" %x62) / ; "0b"\n',e+=" ; omit U+000C-U+000D FF CR\n",e+=' ("0" %x65-66) / ; "0e"-"0f"\n',e+=' ("1" normal-HEXDIG)\n',e+=" )\n",e+='normal-HEXDIG = DIGIT / %x61-66 ; "0"-"9", "a"-"f"\n',e+='normal-index-selector = "0" / (DIGIT1 *DIGIT)\n',e+=" ; non-negative decimal integer\n",e+="\n",e+="; Surrogate named rules\n",e+='dot-prefix = "."\n',e+='double-dot-prefix = ".."\n',e+='left-bracket = "["\n',e+='right-bracket = "]"\n',e+='left-paren = "("\n',e+='right-paren = ")"\n',e+='comma = ","\n',e+='colon = ":"\n',e+='dquote = %x22 ; "\n',e+="squote = %x27 ; '\n",e+='questionmark = "?"\n',e+='disjunction = "||"\n',e+='conjunction = "&&"\n','; JSONPath: Query Expressions for JSON\n; https://www.rfc-editor.org/rfc/rfc9535\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1\njsonpath-query = root-identifier segments\nsegments = *(S segment)\n\nB = %x20 / ; Space\n %x09 / ; Horizontal tab\n %x0A / ; Line feed or New line\n %x0D ; Carriage return\nS = *B ; optional blank space\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1\nroot-identifier = "$"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3\nselector = name-selector /\n wildcard-selector /\n slice-selector /\n index-selector /\n filter-selector\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1\nname-selector = string-literal\n\nstring-literal = dquote *double-quoted dquote / ; "string", MODIFICATION: surrogate text rule used\n squote *single-quoted squote ; \'string\', MODIFICATION: surrogate text rule used\n\ndouble-quoted = unescaped /\n %x27 / ; \'\n ESC %x22 / ; \\"\n ESC escapable\n\nsingle-quoted = unescaped /\n %x22 / ; "\n ESC %x27 / ; \\\'\n ESC escapable\n\nESC = %x5C ; \\ backslash\n\nunescaped = %x20-21 / ; see RFC 8259\n ; omit 0x22 "\n %x23-26 /\n ; omit 0x27 \'\n %x28-5B /\n ; omit 0x5C \\\n %x5D-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\n\nescapable = %x62 / ; b BS backspace U+0008\n %x66 / ; f FF form feed U+000C\n %x6E / ; n LF line feed U+000A\n %x72 / ; r CR carriage return U+000D\n %x74 / ; t HT horizontal tab U+0009\n "/" / ; / slash (solidus) U+002F\n "\\" / ; \\ backslash (reverse solidus) U+005C\n (%x75 hexchar) ; uXXXX U+XXXX\n\nhexchar = non-surrogate /\n (high-surrogate "\\" %x75 low-surrogate)\nnon-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /\n ("D" %x30-37 2HEXDIG )\nhigh-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG\nlow-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG\n\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1\nwildcard-selector = "*"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1\nindex-selector = int ; decimal integer\n\nint = "0" /\n (["-"] DIGIT1 *DIGIT) ; - optional\nDIGIT1 = %x31-39 ; 1-9 non-zero digit\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1\nslice-selector = [start S] colon S [end S] [colon [S step ]] ; MODIFICATION: surrogate text rule used\n\nstart = int ; included in selection\nend = int ; not included in selection\nstep = int ; default: 1\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1\nfilter-selector = questionmark S logical-expr ; MODIFICATION: surrogate text rule used\n\nlogical-expr = logical-or-expr\nlogical-or-expr = logical-and-expr *(S disjunction S logical-and-expr) ; MODIFICATION: surrogate text rule used\n ; disjunction\n ; binds less tightly than conjunction\nlogical-and-expr = basic-expr *(S conjunction S basic-expr) ; MODIFICATION: surrogate text rule used\n ; conjunction\n ; binds more tightly than disjunction\n\nbasic-expr = paren-expr /\n comparison-expr /\n test-expr\n\nparen-expr = [logical-not-op S] left-paren S logical-expr S right-paren ; MODIFICATION: surrogate text rule used\n ; parenthesized expression\nlogical-not-op = "!" ; logical NOT operator\n\ntest-expr = [logical-not-op S]\n (filter-query / ; existence/non-existence\n function-expr) ; LogicalType or NodesType\nfilter-query = rel-query / jsonpath-query\nrel-query = current-node-identifier segments\ncurrent-node-identifier = "@"\n\ncomparison-expr = comparable S comparison-op S comparable\nliteral = number / string-literal /\n true / false / null\ncomparable = singular-query / ; singular query value\n function-expr / ; ValueType\n literal\n ; MODIFICATION: https://www.rfc-editor.org/errata/eid8352\ncomparison-op = "==" / "!=" /\n "<=" / ">=" /\n "<" / ">"\n\nsingular-query = rel-singular-query / abs-singular-query\nrel-singular-query = current-node-identifier singular-query-segments\nabs-singular-query = root-identifier singular-query-segments\nsingular-query-segments = *(S (name-segment / index-segment))\nname-segment = (left-bracket name-selector right-bracket) / ; MODIFICATION: surrogate text rule used\n (dot-prefix member-name-shorthand) ; MODIFICATION: surrogate text rule used\nindex-segment = left-bracket index-selector right-bracket ; MODIFICATION: surrogate text rule used\n\nnumber = (int / "-0") [ frac ] [ exp ] ; decimal number\nfrac = "." 1*DIGIT ; decimal fraction\nexp = "e" [ "-" / "+" ] 1*DIGIT ; decimal exponent\ntrue = %x74.72.75.65 ; true\nfalse = %x66.61.6c.73.65 ; false\nnull = %x6e.75.6c.6c ; null\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.4\nfunction-name = function-name-first *function-name-char\nfunction-name-first = LCALPHA\nfunction-name-char = function-name-first / "_" / DIGIT\nLCALPHA = %x61-7A ; "a".."z"\n\nfunction-expr = function-name left-paren S [function-argument ; MODIFICATION: surrogate text rule used\n *(S comma S function-argument)] S right-paren ; MODIFICATION: surrogate text rule used\nfunction-argument = logical-expr / ; MODIFICATION: https://www.rfc-editor.org/errata/eid8343\n filter-query / ; (includes singular-query)\n function-expr /\n literal\n\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5\nsegment = child-segment / descendant-segment\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1\nchild-segment = bracketed-selection /\n (dot-prefix ; MODIFICATION: surrogate text rule used\n (wildcard-selector /\n member-name-shorthand))\n\nbracketed-selection = left-bracket S selector *(S comma S selector) S right-bracket\n ; MODIFICATION: surrogate text rule used\n\nmember-name-shorthand = name-first *name-char\nname-first = ALPHA /\n "_" /\n %x80-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\nname-char = name-first / DIGIT\n\nDIGIT = %x30-39 ; 0-9\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1\ndescendant-segment = double-dot-prefix (bracketed-selection / ; MODIFICATION: surrogate text rule used\n wildcard-selector /\n member-name-shorthand)\n\n; https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths\nnormalized-path = root-identifier *(normal-index-segment)\nnormal-index-segment = left-bracket normal-selector right-bracket ; MODIFICATION: surrogate text rule used\nnormal-selector = normal-name-selector / normal-index-selector\nnormal-name-selector = squote *normal-single-quoted squote ; \'string\', MODIFICATION: surrogate text rule used\nnormal-single-quoted = normal-unescaped /\n ESC normal-escapable\nnormal-unescaped = ; omit %x0-1F control codes\n %x20-26 /\n ; omit 0x27 \'\n %x28-5B /\n ; omit 0x5C \\\n %x5D-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\n\nnormal-escapable = %x62 / ; b BS backspace U+0008\n %x66 / ; f FF form feed U+000C\n %x6E / ; n LF line feed U+000A\n %x72 / ; r CR carriage return U+000D\n %x74 / ; t HT horizontal tab U+0009\n "\'" / ; \' apostrophe U+0027\n "\\" / ; \\ backslash (reverse solidus) U+005C\n (%x75 normal-hexchar)\n ; certain values u00xx U+00XX\nnormal-hexchar = "0" "0"\n (\n ("0" %x30-37) / ; "00"-"07"\n ; omit U+0008-U+000A BS HT LF\n ("0" %x62) / ; "0b"\n ; omit U+000C-U+000D FF CR\n ("0" %x65-66) / ; "0e"-"0f"\n ("1" normal-HEXDIG)\n )\nnormal-HEXDIG = DIGIT / %x61-66 ; "0"-"9", "a"-"f"\nnormal-index-selector = "0" / (DIGIT1 *DIGIT)\n ; non-negative decimal integer\n\n; Surrogate named rules\ndot-prefix = "."\ndouble-dot-prefix = ".."\nleft-bracket = "["\nright-bracket = "]"\nleft-paren = "("\nright-paren = ")"\ncomma = ","\ncolon = ":"\ndquote = %x22 ; "\nsquote = %x27 ; \'\nquestionmark = "?"\ndisjunction = "||"\nconjunction = "&&"\n'}}e.r(r),e.d(r,{count:()=>we,length:()=>be,match:()=>Se,search:()=>Ae,value:()=>ke});const o=function(){const e=u,t=a,s=this,r="parser.js: Parser(): ";s.ast=void 0,s.stats=void 0,s.trace=void 0,s.callbacks=[];let n,o,i,l,c,p,h,d=0,m=0,y=0,g=0,f=0,x=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};s.parse=(a,u,b,w)=>{const T=`${r}parse(): `;d=0,m=0,y=0,g=0,f=0,n=void 0,o=void 0,i=void 0,l=void 0,x.refresh(),c=void 0,p=void 0,h=void 0,l=t.stringToChars(b),n=a.rules,o=a.udts;const E=u.toLowerCase();let S;for(const e in n)if(n.hasOwnProperty(e)&&E===n[e].lower){S=n[e].index;break}if(void 0===S)throw new Error(`${T}start rule name '${startRule}' not recognized`);(()=>{const e=`${r}initializeCallbacks(): `;let t,i;for(c=[],p=[],t=0;t<n.length;t+=1)c[t]=void 0;for(t=0;t<o.length;t+=1)p[t]=void 0;const l=[];for(t=0;t<n.length;t+=1)l.push(n[t].lower);for(t=0;t<o.length;t+=1)l.push(o[t].lower);for(const r in s.callbacks)if(s.callbacks.hasOwnProperty(r)){if(t=l.indexOf(r.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${r}' not a rule or udt name`);if(i=s.callbacks[r]?s.callbacks[r]:void 0,"function"!=typeof i&&void 0!==i)throw new Error(`${e}syntax callback[${r}] must be function reference or falsy)`);t<n.length?c[t]=i:p[t-n.length]=i}})(),s.trace&&s.trace.init(n,o,l),s.stats&&s.stats.init(n,o),s.ast&&s.ast.init(n,o,l),h=w,i=[{type:e.RNM,index:S}],k(0,0),i=void 0;let A=!1;switch(x.state){case e.ACTIVE:throw new Error(`${T}final state should never be 'ACTIVE'`);case e.NOMATCH:A=!1;break;case e.EMPTY:case e.MATCH:A=x.phraseLength===l.length;break;default:throw new Error("unrecognized state")}return{success:A,state:x.state,stateName:e.idName(x.state),length:l.length,matched:x.phraseLength,maxMatched:f,maxTreeDepth:y,nodeHits:g}};const b=(t,s,n,o)=>{if(s.phraseLength>n){let e=`${r}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${s.phraseLength}`,e+=` must be <= remaining chars: ${n}`,new Error(e)}switch(s.state){case e.ACTIVE:if(!o)throw new Error(`${r}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:s.phraseLength=0;break;case e.MATCH:0===s.phraseLength&&(s.state=e.EMPTY);break;case e.NOMATCH:s.phraseLength=0;break;default:throw new Error(`${r}opRNM(${t.name}): callback function return error. Unrecognized return state: ${s.state}`)}},w=(t,c)=>{let a,u,m;const y=i[t],g=o[y.index];x.UdtIndex=g.index,d||(m=s.ast&&s.ast.udtDefined(y.index),m&&(u=n.length+y.index,a=s.ast.getLength(),s.ast.down(u,g.name)));const f=l.length-c;p[y.index](x,l,c,h),((t,s,n)=>{if(s.phraseLength>n){let e=`${r}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${s.phraseLength}`,e+=` must be <= remaining chars: ${n}`,new Error(e)}switch(s.state){case e.ACTIVE:throw new Error(`${r}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);s.phraseLength=0;break;case e.MATCH:if(0===s.phraseLength){if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);s.state=e.EMPTY}break;case e.NOMATCH:s.phraseLength=0;break;default:throw new Error(`${r}opUDT(${t.name}): callback function return error. Unrecognized return state: ${s.state}`)}})(g,x,f),d||m&&(x.state===e.NOMATCH?s.ast.setLength(a):s.ast.up(u,g.name,c,x.phraseLength))},k=(t,o)=>{const a=`${r}opExecute(): `,u=i[t];switch(g+=1,m>y&&(y=m),m+=1,x.refresh(),s.trace&&s.trace.down(u,o),u.type){case e.ALT:((t,s)=>{const r=i[t];for(let t=0;t<r.children.length&&(k(r.children[t],s),x.state===e.NOMATCH);t+=1);})(t,o);break;case e.CAT:((t,r)=>{let n,o,l,c;const a=i[t];s.ast&&(o=s.ast.getLength()),n=!0,l=r,c=0;for(let t=0;t<a.children.length;t+=1){if(k(a.children[t],l),x.state===e.NOMATCH){n=!1;break}l+=x.phraseLength,c+=x.phraseLength}n?(x.state=0===c?e.EMPTY:e.MATCH,x.phraseLength=c):(x.state=e.NOMATCH,x.phraseLength=0,s.ast&&s.ast.setLength(o))})(t,o);break;case e.REP:((t,r)=>{let n,o,c,a;const u=i[t];if(0===u.max)return x.state=e.EMPTY,void(x.phraseLength=0);for(o=r,c=0,a=0,s.ast&&(n=s.ast.getLength());!(o>=l.length)&&(k(t+1,o),x.state!==e.NOMATCH)&&x.state!==e.EMPTY&&(a+=1,c+=x.phraseLength,o+=x.phraseLength,a!==u.max););x.state===e.EMPTY||a>=u.min?(x.state=0===c?e.EMPTY:e.MATCH,x.phraseLength=c):(x.state=e.NOMATCH,x.phraseLength=0,s.ast&&s.ast.setLength(n))})(t,o);break;case e.RNM:((t,r)=>{let o,a,u;const p=i[t],m=n[p.index],y=c[m.index];if(d||(a=s.ast&&s.ast.ruleDefined(p.index),a&&(o=s.ast.getLength(),s.ast.down(p.index,n[p.index].name))),y){const t=l.length-r;y(x,l,r,h),b(m,x,t,!0),x.state===e.ACTIVE&&(u=i,i=m.opcodes,k(0,r),i=u,y(x,l,r,h),b(m,x,t,!1))}else u=i,i=m.opcodes,k(0,r,x),i=u;d||a&&(x.state===e.NOMATCH?s.ast.setLength(o):s.ast.up(p.index,m.name,r,x.phraseLength))})(t,o);break;case e.TRG:((t,s)=>{const r=i[t];x.state=e.NOMATCH,s<l.length&&r.min<=l[s]&&l[s]<=r.max&&(x.state=e.MATCH,x.phraseLength=1)})(t,o);break;case e.TBS:((t,s)=>{const r=i[t],n=r.string.length;if(x.state=e.NOMATCH,s+n<=l.length){for(let e=0;e<n;e+=1)if(l[s+e]!==r.string[e])return;x.state=e.MATCH,x.phraseLength=n}})(t,o);break;case e.TLS:((t,s)=>{let r;const n=i[t];x.state=e.NOMATCH;const o=n.string.length;if(0!==o){if(s+o<=l.length){for(let e=0;e<o;e+=1)if(r=l[s+e],r>=65&&r<=90&&(r+=32),r!==n.string[e])return;x.state=e.MATCH,x.phraseLength=o}}else x.state=e.EMPTY})(t,o);break;case e.UDT:w(t,o);break;case e.AND:((t,s)=>{switch(d+=1,k(t+1,s),d-=1,x.phraseLength=0,x.state){case e.EMPTY:case e.MATCH:x.state=e.EMPTY;break;case e.NOMATCH:x.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${x.state}`)}})(t,o);break;case e.NOT:((t,s)=>{switch(d+=1,k(t+1,s),d-=1,x.phraseLength=0,x.state){case e.EMPTY:case e.MATCH:x.state=e.NOMATCH;break;case e.NOMATCH:x.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${x.state}`)}})(t,o);break;default:throw new Error(`${a}unrecognized operator`)}d||o+x.phraseLength>f&&(f=o+x.phraseLength),s.stats&&s.stats.collect(u,x),s.trace&&s.trace.up(u,x.state,o,x.phraseLength),m-=1}},i=function(){const e=u,t=a,s=this;let r,n,o,i=0;const l=[],c=[],p=[];function h(e){let t="";for(;e-- >0;)t+=" ";return t}s.callbacks=[],s.init=(e,t,a)=>{let u;c.length=0,p.length=0,i=0,r=e,n=t,o=a;const h=[];for(u=0;u<r.length;u+=1)h.push(r[u].lower);for(u=0;u<n.length;u+=1)h.push(n[u].lower);for(i=r.length+n.length,u=0;u<i;u+=1)l[u]=void 0;for(const e in s.callbacks)if(s.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(u=h.indexOf(t),u<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);l[u]=s.callbacks[e]}},s.ruleDefined=e=>!!l[e],s.udtDefined=e=>!!l[r.length+e],s.down=(t,s)=>{const r=p.length;return c.push(r),p.push({name:s,thisIndex:r,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),r},s.up=(t,s,r,n)=>{const o=p.length,i=c.pop();return p.push({name:s,thisIndex:o,thatIndex:i,state:e.SEM_POST,callbackIndex:t,phraseIndex:r,phraseLength:n,stack:c.length}),p[i].thatIndex=o,p[i].phraseIndex=r,p[i].phraseLength=n,o},s.translate=t=>{let s,r;for(let n=0;n<p.length;n+=1)r=p[n],s=l[r.callbackIndex],s&&(r.state===e.SEM_PRE?s(e.SEM_PRE,o,r.phraseIndex,r.phraseLength,t):s&&s(e.SEM_POST,o,r.phraseIndex,r.phraseLength,t))},s.setLength=e=>{p.length=e,c.length=e>0?p[e-1].stack:0},s.getLength=()=>p.length,s.toXml=()=>{let s="",r=0;return s+='<?xml version="1.0" encoding="utf-8"?>\n',s+=`<root nodes="${p.length/2}" characters="${o.length}">\n`,s+="\x3c!-- input string --\x3e\n",s+=h(r+2),s+=t.charsToString(o),s+="\n",p.forEach(n=>{n.state===e.SEM_PRE?(r+=1,s+=h(r),s+=`<node name="${n.name}" index="${n.phraseIndex}" length="${n.phraseLength}">\n`,s+=h(r+2),s+=t.charsToString(o,n.phraseIndex,n.phraseLength),s+="\n"):(s+=h(r),s+=`</node>\x3c!-- name="${n.name}" --\x3e\n`,r-=1)}),s+="</root>\n",s}},l=function(){const e=u,t=a,s="parser.js: Trace(): ";let r,n,o,i="",l=0;const c=this,p=e=>{let t="",s=0;if(e>=0)for(;e--;)s+=1,5===s?(t+="|",s=0):t+=".";return t};c.init=(e,t,s)=>{n=e,o=t,r=s};const h=r=>{let i;switch(r.type){case e.ALT:i="ALT";break;case e.CAT:i="CAT";break;case e.REP:i=r.max===1/0?`REP(${r.min},inf)`:`REP(${r.min},${r.max})`;break;case e.RNM:i=`RNM(${n[r.index].name})`;break;case e.TRG:i=`TRG(${r.min},${r.max})`;break;case e.TBS:i=r.string.length>6?`TBS(${t.charsToString(r.string,0,3)}...)`:`TBS(${t.charsToString(r.string,0,6)})`;break;case e.TLS:i=r.string.length>6?`TLS(${t.charsToString(r.string,0,3)}...)`:`TLS(${t.charsToString(r.string,0,6)})`;break;case e.UDT:i=`UDT(${o[r.index].name})`;break;case e.AND:i="AND";break;case e.NOT:i="NOT";break;default:throw new Error(`${s}Trace: opName: unrecognized opcode`)}return i};c.down=(e,s)=>{const n=p(l),o=Math.min(100,r.length-s);let c=t.charsToString(r,s,o);o<r.length-s&&(c+="..."),c=`${n}|-|[${h(e)}]${c}\n`,i+=c,l+=1},c.up=(n,o,c,a)=>{const u=`${s}trace.up: `;l-=1;const d=p(l);let m,y,g;switch(o){case e.EMPTY:g="|E|",y="''";break;case e.MATCH:g="|M|",m=Math.min(100,a),y=m<a?`'${t.charsToString(r,c,m)}...'`:`'${t.charsToString(r,c,m)}'`;break;case e.NOMATCH:g="|N|",y="";break;default:throw new Error(`${u} unrecognized state`)}y=`${d}${g}[${h(n)}]${y}\n`,i+=y},c.displayTrace=()=>i},c=function(){const e=u;let t,s,r;const n=[],o=[],i=[];this.init=(e,r)=>{t=e,s=r,d()},this.collect=(t,s)=>{m(r,s.state,s.phraseLength),m(n[t.type],s.state,s.phraseLength),t.type===e.RNM&&m(o[t.index],s.state,s.phraseLength),t.type===e.UDT&&m(i[t.index],s.state,s.phraseLength)},this.displayStats=()=>{let t="";const s={match:0,empty:0,nomatch:0,total:0},r=(e,t,r,n,o)=>{s.match+=t,s.empty+=r,s.nomatch+=n,s.total+=o;return`${e} | ${l(t)} | ${l(r)} | ${l(n)} | ${l(o)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=r(" ALT",n[e.ALT].match,n[e.ALT].empty,n[e.ALT].nomatch,n[e.ALT].total),t+=r(" CAT",n[e.CAT].match,n[e.CAT].empty,n[e.CAT].nomatch,n[e.CAT].total),t+=r(" REP",n[e.REP].match,n[e.REP].empty,n[e.REP].nomatch,n[e.REP].total),t+=r(" RNM",n[e.RNM].match,n[e.RNM].empty,n[e.RNM].nomatch,n[e.RNM].total),t+=r(" TRG",n[e.TRG].match,n[e.TRG].empty,n[e.TRG].nomatch,n[e.TRG].total),t+=r(" TBS",n[e.TBS].match,n[e.TBS].empty,n[e.TBS].nomatch,n[e.TBS].total),t+=r(" TLS",n[e.TLS].match,n[e.TLS].empty,n[e.TLS].nomatch,n[e.TLS].total),t+=r(" UDT",n[e.UDT].match,n[e.UDT].empty,n[e.UDT].nomatch,n[e.UDT].total),t+=r(" AND",n[e.AND].match,n[e.AND].empty,n[e.AND].nomatch,n[e.AND].total),t+=r(" NOT",n[e.NOT].match,n[e.NOT].empty,n[e.NOT].nomatch,n[e.NOT].total),t+=r("TOTAL",s.match,s.empty,s.nomatch,s.total),t},this.displayHits=e=>{let t="";const s=(e,t,s,n,o)=>{r.match+=e,r.empty+=t,r.nomatch+=s,r.total+=n;return`| ${l(e)} | ${l(t)} | ${l(s)} | ${l(n)} | ${o}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(o.sort(c),i.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(o.sort(p),i.sort(p),t+=" RULES/UDTS BY INDEX\n"):(o.sort(a),i.sort(a),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<o.length;e+=1){let r=o[e];r.total&&(t+=s(r.match,r.empty,r.nomatch,r.total,r.name))}for(let e=0;e<i.length;e+=1){let r=i[e];r.total&&(t+=s(r.match,r.empty,r.nomatch,r.total,r.name))}return t};const l=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,a=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),p=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,h=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},d=()=>{n.length=0,r=new h,n[e.ALT]=new h,n[e.CAT]=new h,n[e.REP]=new h,n[e.RNM]=new h,n[e.TRG]=new h,n[e.TBS]=new h,n[e.TLS]=new h,n[e.UDT]=new h,n[e.AND]=new h,n[e.NOT]=new h,o.length=0;for(let e=0;e<t.length;e+=1)o.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(s.length>0){i.length=0;for(let e=0;e<s.length;e+=1)i.push({empty:0,match:0,nomatch:0,total:0,name:s[e].name,lower:s[e].lower,index:s[e].index})}},m=(t,s)=>{switch(t.total+=1,s){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${s}`)}}},a={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,s)=>{let r=e;for(;!(void 0===t||t<0);){if(void 0===s){r=e.slice(t);break}if(s<=0)return"";r=e.slice(t,t+s);break}return String.fromCodePoint(...r)}},u={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case u.ALT:return"ALT";case u.CAT:return"CAT";case u.REP:return"REP";case u.RNM:return"RNM";case u.TRG:return"TRG";case u.TBS:return"TBS";case u.TLS:return"TLS";case u.UDT:return"UDT";case u.AND:return"AND";case u.NOT:return"NOT";case u.ACTIVE:return"ACTIVE";case u.EMPTY:return"EMPTY";case u.MATCH:return"MATCH";case u.NOMATCH:return"NOMATCH";case u.SEM_PRE:return"SEM_PRE";case u.SEM_POST:return"SEM_POST";case u.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};const p=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const h=class extends l{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let s=-1;for(let r=0;r<e.length;r++){const n=e[r];if(n.includes("M|")){const e=n.match(/]'(.*)'$/);e&&e[1]&&(s=r)}if(r>s){const e=n.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new p(...t)}};class d extends Error{constructor(e,t=void 0){if(super(e,t),this.name=this.constructor.name,"string"==typeof e&&(this.message=e),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,null!=t&&"object"==typeof t&&Object.hasOwn(t,"cause")&&!("cause"in this)){const{cause:e}=t;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}if(null!=t&&"object"==typeof t){const{cause:e,...s}=t;Object.assign(this,s)}}}const m=d;const y=class extends m{},g=e=>(t,s,r,n,o)=>{if("object"!=typeof o||null===o||Array.isArray(o))throw new y("parser's user data must be an object");if(!o.options?.optimize||0!==n||!o.options?.droppableTypes?.includes(e)){if(t===u.SEM_PRE){const t={type:e,text:a.charsToString(s,r,n),start:r,length:n,children:[]};if(o.stack.length>0){const e=o.stack[o.stack.length-1],s=e.children[e.children.length-1],r="text"===e.type&&"text"===t.type;o.options?.optimize&&o.options?.collapsibleTypes?.includes(t.type)&&s?.type===t.type?(s.text+=t.text,s.length+=t.length):r||e.children.push(t)}else o.root=t;o.stack.push(t)}t===u.SEM_POST&&o.stack.pop()}};const f=class extends i{constructor(){super(),this.callbacks["jsonpath-query"]=g("jsonpath-query"),this.callbacks.segments=g("segments"),this.callbacks.B=g("text"),this.callbacks.S=g("text"),this.callbacks["root-identifier"]=g("root-identifier"),this.callbacks.selector=g("selector"),this.callbacks["name-selector"]=g("name-selector"),this.callbacks["string-literal"]=g("string-literal"),this.callbacks["double-quoted"]=g("double-quoted"),this.callbacks["single-quoted"]=g("single-quoted"),this.callbacks["wildcard-selector"]=g("wildcard-selector"),this.callbacks["index-selector"]=g("index-selector"),this.callbacks["slice-selector"]=g("slice-selector"),this.callbacks.start=g("start"),this.callbacks.end=g("end"),this.callbacks.step=g("step"),this.callbacks["filter-selector"]=g("filter-selector"),this.callbacks["logical-expr"]=g("logical-expr"),this.callbacks["logical-or-expr"]=g("logical-or-expr"),this.callbacks["logical-and-expr"]=g("logical-and-expr"),this.callbacks["basic-expr"]=g("basic-expr"),this.callbacks["paren-expr"]=g("paren-expr"),this.callbacks["logical-not-op"]=g("logical-not-op"),this.callbacks["test-expr"]=g("test-expr"),this.callbacks["filter-query"]=g("filter-query"),this.callbacks["rel-query"]=g("rel-query"),this.callbacks["current-node-identifier"]=g("current-node-identifier"),this.callbacks["comparison-expr"]=g("comparison-expr"),this.callbacks.literal=g("literal"),this.callbacks.comparable=g("comparable"),this.callbacks["comparison-op"]=g("comparison-op"),this.callbacks["singular-query"]=g("singular-query"),this.callbacks["rel-singular-query"]=g("rel-singular-query"),this.callbacks["abs-singular-query"]=g("abs-singular-query"),this.callbacks["singular-query-segments"]=g("singular-query-segments"),this.callbacks["name-segment"]=g("name-segment"),this.callbacks["index-segment"]=g("index-segment"),this.callbacks.number=g("number"),this.callbacks.true=g("true"),this.callbacks.false=g("false"),this.callbacks.null=g("null"),this.callbacks["function-name"]=g("function-name"),this.callbacks["function-expr"]=g("function-expr"),this.callbacks["function-argument"]=g("function-argument"),this.callbacks.segment=g("segment"),this.callbacks["child-segment"]=g("child-segment"),this.callbacks["bracketed-selection"]=g("bracketed-selection"),this.callbacks["member-name-shorthand"]=g("member-name-shorthand"),this.callbacks["descendant-segment"]=g("descendant-segment"),this.callbacks["normalized-path"]=g("normalized-path"),this.callbacks["normal-index-segment"]=g("normal-index-segment"),this.callbacks["normal-selector"]=g("normal-selector"),this.callbacks["normal-name-selector"]=g("normal-name-selector"),this.callbacks["normal-index-selector"]=g("normal-index-selector"),this.callbacks["normal-single-quoted"]=g("normal-single-quoted"),this.callbacks["dot-prefix"]=g("text"),this.callbacks["double-dot-prefix"]=g("text"),this.callbacks["left-bracket"]=g("text"),this.callbacks["right-bracket"]=g("text"),this.callbacks.comma=g("text"),this.callbacks.colon=g("text"),this.callbacks.dquote=g("text"),this.callbacks.squote=g("text"),this.callbacks.questionmark=g("text"),this.callbacks.disjunction=g("text"),this.callbacks.conjunction=g("text"),this.callbacks["left-paren"]=g("text"),this.callbacks["right-paren"]=g("text")}getTree(){const e={stack:[],root:null};return this.translate(e),e.root}};const x=class extends f{collapsibleTypes=["single-quoted","double-quoted","normal-single-quoted"];droppableTypes=["text","segments","singular-query-segments"];constructor({collapsibleTypes:e,droppableTypes:t}={}){super(),Array.isArray(e)&&(this.collapsibleTypes=e),Array.isArray(t)&&(this.droppableTypes=t)}getTree(){const e={stack:[],root:null,options:{optimize:!0,collapsibleTypes:this.collapsibleTypes,droppableTypes:this.droppableTypes}};return this.translate(e),e.root}},b=e=>T(`"${e}"`),w=e=>{let t="";for(let s=0;s<e.length;s++){const r=e[s];if("\\"===r){if(s++,s>=e.length){t+="\\";break}const r=e[s];switch(r){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"/":t+="/";break;case"\\":t+="\\";break;case"'":t+="'";break;case'"':t+='"';break;case"u":{const r=e.slice(s+1,s+5);t+=String.fromCharCode(parseInt(r,16)),s+=4;break}default:t+=r}}else t+=r}return T(JSON.stringify(t))},k=e=>{const t=parseInt(e,10);if(!Number.isSafeInteger(t))throw new RangeError(`Integer value out of safe range [-(2^53)+1, (2^53)-1], got: ${e}`);return t},T=e=>JSON.parse(e),E={count:{params:[{type:"NodesType"}],returns:"ValueType"},length:{params:[{type:"ValueType"}],returns:"ValueType"},value:{params:[{type:"NodesType"}],returns:"ValueType"},match:{params:[{type:"ValueType"},{type:"ValueType"}],returns:"LogicalType"},search:{params:[{type:"ValueType"},{type:"ValueType"}],returns:"LogicalType"}},S=e=>{if("FilterQuery"!==e.type)return!1;const{query:t}=e;if(!t||!t.segments)return!1;for(const e of t.segments){if("ChildSegment"!==e.type)return!1;const{selector:t}=e;if("NameSelector"!==t.type&&"IndexSelector"!==t.type){if("BracketedSelection"!==t.type)return!1;{if(1!==t.selectors.length)return!1;const e=t.selectors[0];if("NameSelector"!==e.type&&"IndexSelector"!==e.type)return!1}}}return!0},A=(e,t,s)=>{if("NodesType"===t){if("Literal"===e.type)throw new RangeError(`Function ${s}() requires NodesType argument, got literal`);if("TestExpr"===e.type&&"FilterQuery"===e.expression?.type)return;if("FilterQuery"===e.type)return;throw new RangeError(`Function ${s}() requires NodesType argument`)}if("ValueType"===t){if("Literal"===e.type)return;if("FunctionExpr"===e.type)return;if("TestExpr"===e.type&&"FunctionExpr"===e.expression?.type)return;if("TestExpr"===e.type&&"FilterQuery"===e.expression?.type){if(!S(e.expression))throw new RangeError(`Function ${s}() requires ValueType argument, got non-singular query`);return}if("FilterQuery"===e.type){if(!S(e))throw new RangeError(`Function ${s}() requires ValueType argument, got non-singular query`);return}throw new RangeError(`Function ${s}() requires ValueType argument`)}},I=e=>{if(!e)return null;if("FunctionExpr"===e.type){const t=E[e.name];return t?t.returns:null}return"Literal"===e.type||"RelSingularQuery"===e.type||"AbsSingularQuery"===e.type?"ValueType":"FilterQuery"===e.type?"NodesType":"LogicalOrExpr"===e.type||"LogicalAndExpr"===e.type||"LogicalNotExpr"===e.type||"ComparisonExpr"===e.type?"LogicalType":"TestExpr"===e.type?I(e.expression):null},O=(e,t,s={parent:null,path:[]})=>{const r=t[e.type];if(!r)throw new y(`No transformer for CST node type: ${e.type}`);return r(e,{parent:e,path:[...s.path,e]})},v={"jsonpath-query"(e,t){const s=e.children.find(e=>"segments"===e.type);return{type:"JsonPathQuery",segments:s?s.children.filter(({type:e})=>"segment"===e).map(e=>O(e,v,t)):[]}},segment(e,t){const s=e.children.find(({type:e})=>["child-segment","descendant-segment"].includes(e));return O(s,v,t)},selector(e,t){const s=e.children.find(({type:e})=>["name-selector","wildcard-selector","slice-selector","index-selector","filter-selector"].includes(e));return O(s,v,t)},"name-selector"(e,t){const s=e.children.find(({type:e})=>"string-literal"===e),r=O(s,v,t);return{type:"NameSelector",value:r.value,format:r.format}},"string-literal"(e){const t=e.children.find(({type:e,text:t})=>"text"===e&&"'"===t),s=e.children.find(({type:e})=>["double-quoted","single-quoted"].includes(e));return{type:"StringLiteral",value:s?(t?w:b)(s.text):"",format:t?"single-quoted":"double-quoted"}},"wildcard-selector":()=>({type:"WildcardSelector"}),"index-selector":e=>({type:"IndexSelector",value:k(e.text)}),"slice-selector"(e){const t=e.children.find(({type:e})=>"start"===e),s=e.children.find(({type:e})=>"end"===e),r=e.children.find(({type:e})=>"step"===e);return{type:"SliceSelector",start:t?k(t.text):null,end:s?k(s.text):null,step:r?k(r.text):null}},"filter-selector"(e,t){const s=e.children.find(({type:e})=>"logical-expr"===e),r=O(s,v,t);if("TestExpr"===r.type){if("ValueType"===I(r.expression)){const e="FunctionExpr"===r.expression.type?r.expression.name:"expression";throw new RangeError(`Function ${e}() returns ValueType which cannot be used as existence test; result must be compared`)}}if("LogicalNotExpr"===r.type&&"TestExpr"===r.expression?.type){const e=r.expression.expression;if("ValueType"===I(e)){const t="FunctionExpr"===e.type?e.name:"expression";throw new RangeError(`Function ${t}() returns ValueType which cannot be used as existence test; result must be compared`)}}return{type:"FilterSelector",expression:r}},"logical-expr"(e,t){const s=e.children.find(({type:e})=>"logical-or-expr"===e);return O(s,v,t)},"logical-or-expr"(e,t){const s=e.children.filter(({type:e})=>"logical-and-expr"===e);if(1===s.length)return O(s[0],v,t);let r=O(s[0],v,t);for(let e=1;e<s.length;e+=1){r={type:"LogicalOrExpr",left:r,right:O(s[e],v,t)}}return r},"logical-and-expr"(e,t){const s=e.children.filter(({type:e})=>"basic-expr"===e);if(1===s.length)return O(s[0],v,t);let r=O(s[0],v,t);for(let e=1;e<s.length;e+=1){r={type:"LogicalAndExpr",left:r,right:O(s[e],v,t)}}return r},"basic-expr"(e,t){const s=e.children.find(({type:e})=>["paren-expr","comparison-expr","test-expr"].includes(e));return O(s,v,t)},"paren-expr"(e,t){const s=e.children.some(e=>"logical-not-op"===e.type),r=e.children.find(e=>"logical-expr"===e.type),n=O(r,v,t);return s?{type:"LogicalNotExpr",expression:n}:n},"test-expr"(e,t){const s=e.children.some(({type:e})=>"logical-not-op"===e),r=e.children.find(({type:e})=>["filter-query","function-expr"].includes(e)),n={type:"TestExpr",expression:O(r,v,t)};return s?{type:"LogicalNotExpr",expression:n}:n},"filter-query"(e,t){const s=e.children.find(({type:e})=>["rel-query","jsonpath-query"].includes(e));return{type:"FilterQuery",query:O(s,v,t)}},"rel-query"(e,t){const s=e.children.find(e=>"segments"===e.type);return{type:"RelQuery",segments:s?s.children.filter(e=>"segment"===e.type).map(e=>O(e,v,t)):[]}},"comparison-expr"(e,t){const s=e.children.filter(({type:e})=>["comparable","comparison-op"].includes(e)),[r,n,o]=s,i=O(r,v,t),l=O(o,v,t),c=I(i),a=I(l);if("LogicalType"===c){const e="FunctionExpr"===i.type?i.name:"expression";throw new RangeError(`Function ${e}() returns LogicalType which cannot be compared`)}if("LogicalType"===a){const e="FunctionExpr"===l.type?l.name:"expression";throw new RangeError(`Function ${e}() returns LogicalType which cannot be compared`)}return{type:"ComparisonExpr",left:i,op:n.text,right:l}},literal(e,t){const s=e.children.find(({type:e})=>["number","string-literal","true","false","null"].includes(e));if("string-literal"===s.type){return{type:"Literal",value:O(s,v,t).value}}return{type:"Literal",value:T(s.text)}},comparable(e,t){const s=e.children.find(({type:e})=>["singular-query","function-expr","literal"].includes(e));return O(s,v,t)},"singular-query"(e,t){const s=e.children.find(({type:e})=>["rel-singular-query","abs-singular-query"].includes(e));return O(s,v,t)},"rel-singular-query"(e,t){const s=e.children.find(({type:e})=>"singular-query-segments"===e),r=s?s.children.filter(({type:e})=>["name-segment","index-segment"].includes(e)).map(e=>({type:"SingularQuerySegment",selector:O(e,v,t)})):[];return{type:"RelSingularQuery",segments:r}},"abs-singular-query"(e,t){const s=e.children.find(({type:e})=>"singular-query-segments"===e),r=s?s.children.filter(({type:e})=>["name-segment","index-segment"].includes(e)).map(e=>({type:"SingularQuerySegment",selector:O(e,v,t)})):[];return{type:"AbsSingularQuery",segments:r}},"name-segment"(e,t){const s=e.children.find(({type:e})=>["name-selector","member-name-shorthand"].includes(e));return O(s,v,t)},"index-segment"(e,t){const s=e.children.find(({type:e})=>"index-selector"===e);return O(s,v,t)},"function-expr"(e,t){const s=e.children.find(({type:e})=>"function-name"===e),r=e.children.filter(({type:e})=>"function-argument"===e),n=r.map(e=>O(e,v,t));return((e,t)=>{const s=E[e];if(!s)return;const r=s.params.length,n=t.length;if(n<r)throw new RangeError(`Function ${e}() requires ${r} argument(s), got ${n}`);if(n>r)throw new RangeError(`Function ${e}() requires ${r} argument(s), got ${n}`);for(let n=0;n<r;n++)A(t[n],s.params[n].type,e)})(s.text,n),{type:"FunctionExpr",name:s.text,arguments:n}},"function-argument"(e,t){const s=e.children.find(({type:e})=>["logical-expr","function-expr","filter-query","literal"].includes(e));return O(s,v,t)},"child-segment"(e,t){const s=e.children.find(({type:e})=>["bracketed-selection","wildcard-selector","member-name-shorthand"].includes(e));return{type:"ChildSegment",selector:O(s,v,t)}},"bracketed-selection":(e,t)=>({type:"BracketedSelection",selectors:e.children.filter(({type:e})=>"selector"===e).map(e=>O(e,v,t))}),"member-name-shorthand":e=>({type:"NameSelector",value:e.text,format:"shorthand"}),"descendant-segment"(e,t){const s=e.children.find(({type:e})=>["bracketed-selection","wildcard-selector","member-name-shorthand"].includes(e));return{type:"DescendantSegment",selector:O(s,v,t)}},"normalized-path":(e,t)=>({type:"JsonPathQuery",segments:e.children.filter(({type:e})=>"normal-index-segment"===e).map(e=>O(e,v,t))}),"normal-index-segment"(e,t){const s=e.children.find(({type:e})=>"normal-selector"===e);return{type:"ChildSegment",selector:O(s,v,t)}},"normal-selector"(e,t){const s=e.children.find(({type:e})=>["normal-name-selector","normal-index-selector"].includes(e));return O(s,v,t)},"normal-name-selector"(e){const t=e.children.find(({type:e})=>"normal-single-quoted"===e);return{type:"NameSelector",value:t?w(t.text):"",format:"single-quoted"}},"normal-index-selector":e=>({type:"IndexSelector",value:k(e.text)})},C=v;const M=class extends x{getTree(){const e=super.getTree();return O(e,C)}},q=new n,N=(e,{normalized:t=!1,stats:s=!1,trace:r=!1,translator:n=new M}={})=>{if("string"!=typeof e)throw new TypeError("JSONPath must be a string");try{const i=new o;n&&(i.ast=n),s&&(i.stats=new c),r&&(i.trace=new h);const l=t?"normalized-path":"jsonpath-query",a=i.parse(q,l,e);return{result:a,tree:a.success&&n?i.ast.getTree():void 0,stats:i.stats,trace:i.trace}}catch(t){const s=t instanceof RangeError?`Invalid JSONPath expression: ${t.message}`:"Unexpected error during JSONPath parsing";throw new y(s,{cause:t,jsonPath:e})}};const L=class extends f{getTree(){return this.toXml()}},D=(e,{normalized:t=!1,wellTyped:s=!0}={})=>{if("string"!=typeof e)return!1;try{const{result:r}=N(e,{normalized:t,stats:!1,trace:!1,translator:s?new M:null});return r.success}catch{return!1}};const F=class extends m{},B=e=>D(e,{normalized:!0}),P=e=>{if("string"!=typeof e)throw new TypeError("Selector must be a string");let t="";for(const s of e){const e=s.codePointAt(0);switch(e){case 8:t+="\\b";break;case 9:t+="\\t";break;case 10:t+="\\n";break;case 12:t+="\\f";break;case 13:t+="\\r";break;case 39:t+="\\'";break;case 92:t+="\\\\";break;default:t+=e<=31?`\\u${e.toString(16).padStart(4,"0")}`:s}}return t},$=e=>{if(!Array.isArray(e))throw new F("Selectors must be an array, got: "+typeof e,{selectors:e});try{return`$${e.map(e=>{if("string"==typeof e)return`['${P(e)}']`;if("number"==typeof e){if(!Number.isSafeInteger(e)||e<0)throw new TypeError(`Index selector must be a non-negative safe integer, got: ${e}`);return`[${e}]`}throw new TypeError("Selector must be a string or non-negative integer, got: "+typeof e)}).join("")}`}catch(t){throw new F("Failed to compile normalized JSONPath",{cause:t,selectors:e})}},j=e=>{if("string"!=typeof e)throw new F("Normalized path must be a string, got: "+typeof e,{normalizedPath:e});const t=N(e,{normalized:!0});if(!t.result.success)throw new F("Invalid normalized path",{normalizedPath:e});const{tree:s}=t;return s.segments.map(e=>e.selector.value)},R=(e,t,s,r)=>{const{realm:n}=e,{value:o}=s;if(n.isObject(t)&&n.hasProperty(t,o)){r(n.getProperty(t,o),o)}},_=(e,t,s,r)=>{const{realm:n}=e,{value:o}=s;if(!n.isArray(t))return;const i=n.getLength(t),l=((e,t)=>e>=0?e:t+e)(o,i);if(l>=0&&l<i){r(n.getElement(t,l),l)}},H=(e,t,s,r)=>{const{realm:n}=e;for(const[e,s]of n.entries(t))r(s,e)},U=(e,t)=>e>=0?Math.min(e,t):Math.max(t+e,0),z=(e,t,s,r)=>{const{realm:n}=e,{start:o,end:i,step:l}=s;if(!n.isArray(t))return;const c=((e,t,s,r)=>{const n=s??1;if(0===n)return null;let o,i;if(n>0){const s=0,n=r,l=null!==e?U(e,r):s,c=null!==t?U(t,r):n;o=Math.max(l,0),i=Math.min(c,r)}else{const s=r-1,n=-r-1,l=null!==e?e>=0?Math.min(e,r-1):Math.max(r+e,-1):s,c=null!==t?t>=0?Math.min(t,r-1):Math.max(r+t,-1):n;i=Math.min(l,r-1),o=Math.max(c,-1)}return{lower:o,upper:i,step:n}})(o,i,l,n.getLength(t));if(null===c)return;const{lower:a,upper:u,step:p}=c;if(p>0)for(let e=a;e<u;e+=p){r(n.getElement(t,e),e)}else for(let e=u;e>a;e+=p){r(n.getElement(t,e),e)}},V=(e,t,s,r)=>r.value,G=(e,t,s)=>{const{realm:r}=e,{selector:n}=s;switch(n.type){case"NameSelector":{const{value:e}=n;return r.isObject(t)&&r.hasProperty(t,e)?r.getProperty(t,e):void 0}case"IndexSelector":{const{value:e}=n;if(!r.isArray(t))return;const s=r.getLength(t),o=e>=0?e:s+e;return o>=0&&o<s?r.getElement(t,o):void 0}default:return}},X=(e,t,s,r)=>{const{selectors:n}=s;for(const s of n)de(e,t,s,r)},Q=(e,t,s)=>{const r=[],n=e=>{r.push(e)},{selector:o}=s;switch(o.type){case"BracketedSelection":X(e,t,o,n);break;case"NameSelector":case"WildcardSelector":case"IndexSelector":case"SliceSelector":case"FilterSelector":de(e,t,o,n)}return r},Y=(e,t,s,r)=>{let n=s;for(const t of r){const s=[];if("DescendantSegment"===t.type){const r=n=>{const{realm:o}=e,i=Q(e,n,t);s.push(...i);for(const[,e]of o.entries(n))r(e)};for(const e of n)r(e)}else for(const r of n){const n=Q(e,r,t);s.push(...n)}n=s}return n},J=(e,t,s,r)=>{const{query:n}=r;let o;switch(n.type){case"RelQuery":o=((e,t,s,r)=>{const{segments:n}=r;return 0===n.length?[s]:Y(e,0,[s],n)})(e,0,s,n);break;case"JsonPathQuery":o=((e,t,s,r)=>{const{segments:n}=r;return 0===n.length?[t]:Y(e,0,[t],n)})(e,t,0,n);break;default:o=[]}return i=o,Object.defineProperty(i,"_isNodelist",{value:!0,enumerable:!1,writable:!1}),i;var i};let K;const W=(e,t,s,r)=>{const{name:n,arguments:o}=r,i=e.functions[n];if("function"!=typeof i)return;const l=o.map(r=>((e,t,s,r)=>{switch(r.type){case"Literal":case"RelSingularQuery":case"AbsSingularQuery":case"FunctionExpr":return Z(e,t,s,r);case"FilterQuery":return J(e,t,s,r);case"TestExpr":return"FilterQuery"===r.expression.type?J(e,t,s,r.expression):"FunctionExpr"===r.expression.type?Z(e,t,s,r.expression):K(e,t,s,r);case"LogicalOrExpr":case"LogicalAndExpr":case"LogicalNotExpr":case"ComparisonExpr":return K(e,t,s,r);default:return}})(e,t,s,r));return i(e.realm,...l)},Z=(e,t,s,r)=>{switch(r.type){case"Literal":return V(e,t,s,r);case"RelSingularQuery":return((e,t,s,r)=>{let n=s;for(const t of r.segments)if(n=G(e,n,t),void 0===n)return;return n})(e,0,s,r);case"AbsSingularQuery":return((e,t,s,r)=>{let n=t;for(const t of r.segments)if(n=G(e,n,t),void 0===n)return;return n})(e,t,0,r);case"FunctionExpr":return W(e,t,s,r);default:return}},ee=(e,t,s,r)=>{const{left:n,op:o,right:i}=r,l=Z(e,t,s,n),c=Z(e,t,s,i);return e.realm.compare(l,o,c)},te=e=>Array.isArray(e),se=e=>{if(!(e=>"object"==typeof e&&null!==e&&!te(e))(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(e)},re=e=>"string"==typeof e,ne=e=>"number"==typeof e&&Number.isFinite(e),oe=e=>"boolean"==typeof e,ie=e=>null===e,le=e=>void 0===e,ce=e=>te(e)&&!0===e._isNodelist,ae=e=>ce(e)?1===e.length?e[0]:void 0:e,ue=(e,t,s,r)=>{switch(r.type){case"LogicalOrExpr":return!!ue(e,t,s,r.left)||ue(e,t,s,r.right);case"LogicalAndExpr":return!!ue(e,t,s,r.left)&&ue(e,t,s,r.right);case"LogicalNotExpr":return!ue(e,t,s,r.expression);case"TestExpr":{const{expression:n}=r;if("FilterQuery"===n.type){return J(e,t,s,n).length>0}if("FunctionExpr"===n.type){const r=W(e,t,s,n);return"boolean"==typeof r?r:void 0!==r&&(te(r)?r.length>0:Boolean(r))}return!1}case"ComparisonExpr":return ee(e,t,s,r);default:return!1}};K=ue;const pe=ue,he=(e,t,s,r)=>{const{realm:n,root:o}=e,{expression:i}=s;for(const[s,l]of n.entries(t)){pe(e,o,l,i)&&r(l,s)}},de=(e,t,s,r)=>{switch(s.type){case"NameSelector":R(e,t,s,r);break;case"IndexSelector":_(e,t,s,r);break;case"WildcardSelector":H(e,t,s,r);break;case"SliceSelector":z(e,t,s,r);break;case"FilterSelector":he(e,t,s,r)}},me=(e,t,s,r)=>{switch(s.type){case"BracketedSelection":X(e,t,s,r);break;case"NameSelector":case"WildcardSelector":case"IndexSelector":case"SliceSelector":case"FilterSelector":de(e,t,s,r)}},ye=(e,t,s,r)=>{switch(s.type){case"ChildSegment":((e,t,s,r)=>{const{selector:n}=s;me(e,t,n,r)})(e,t,s,r);break;case"DescendantSegment":((e,t,s,r)=>{const{selector:n}=s;me(e,t,n,r)})(e,t,s,r)}};const ge=class{name="";isObject(e){throw new m("Realm.isObject(value) must be implemented in a subclass")}isArray(e){throw new m("Realm.isArray(value) must be implemented in a subclass")}isString(e){throw new m("Realm.isString(value) must be implemented in a subclass")}isNumber(e){throw new m("Realm.isNumber(value) must be implemented in a subclass")}isBoolean(e){throw new m("Realm.isBoolean(value) must be implemented in a subclass")}isNull(e){throw new m("Realm.isNull(value) must be implemented in a subclass")}getString(e){throw new m("Realm.getString(value) must be implemented in a subclass")}getProperty(e,t){throw new m("Realm.getProperty(value, key) must be implemented in a subclass")}hasProperty(e,t){throw new m("Realm.hasProperty(value, key) must be implemented in a subclass")}getElement(e,t){throw new m("Realm.getElement(value, index) must be implemented in a subclass")}getKeys(e){throw new m("Realm.getKeys(value) must be implemented in a subclass")}getLength(e){throw new m("Realm.getLength(value) must be implemented in a subclass")}*entries(e){throw new m("Realm.entries(value) must be implemented in a subclass")}compare(e,t,s){throw new m("Realm.compare(left, operator, right) must be implemented in a subclass")}};const fe=class extends ge{name="json";isObject(e){return se(e)}isArray(e){return te(e)}isString(e){return re(e)}isNumber(e){return ne(e)}isBoolean(e){return oe(e)}isNull(e){return ie(e)}getString(e){return re(e)?e:void 0}getProperty(e,t){if(se(e))return Object.hasOwn(e,t)?e[t]:void 0}hasProperty(e,t){return!!se(e)&&Object.hasOwn(e,t)}getElement(e,t){if(te(e)&&!(t<0||t>=e.length))return e[t]}getKeys(e){return se(e)?Object.keys(e):[]}getLength(e){return re(e)?[...e].length:te(e)?e.length:se(e)?Object.keys(e).length:0}*entries(e){if(this.isArray(e))for(let t=0;t<e.length;t+=1)yield[t,e[t]];else if(this.isObject(e))for(const t of Object.keys(e))yield[t,e[t]]}#e(e,t){if(e===t)return!0;if(le(e)&&le(t))return!0;if(le(e)||le(t))return!1;if(ie(e)&&ie(t))return!0;if(ie(e)||ie(t))return!1;if(typeof e!=typeof t)return!1;if(te(e)&&te(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(!this.#e(e[s],t[s]))return!1;return!0}if(se(e)&&se(t)){const s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(const r of s){if(!Object.hasOwn(t,r))return!1;if(!this.#e(e[r],t[r]))return!1}return!0}return!1}compare(e,t,s){switch(t){case"==":return this.#e(e,s);case"!=":return!this.#e(e,s);case"<":return!le(e)&&!le(s)&&((ne(e)&&ne(s)||!(!re(e)||!re(s)))&&e<s);case"<=":return!le(e)&&!le(s)&&(ne(e)&&ne(s)||re(e)&&re(s)?e<=s:this.#e(e,s));case">":return!le(e)&&!le(s)&&((ne(e)&&ne(s)||!(!re(e)||!re(s)))&&e>s);case">=":return!le(e)&&!le(s)&&(ne(e)&&ne(s)||re(e)&&re(s)?e>=s:this.#e(e,s));default:return!1}}};const xe=class extends m{},be=(e,t)=>{const s=ae(t);if(le(s))return;const r=e.getLength(s);return r>0||e.isString(s)||e.isArray(s)||e.isObject(s)?r:void 0},we=(e,t)=>{if(ce(t))return t.length},ke=(e,t)=>{if(ce(t)&&1===t.length)return t[0]},Te=new Map,Ee=(e,t=!1)=>{const s=t?`anchored:${e}`:`unanchored:${e}`;if(Te.has(s))return Te.get(s);const r=(e=>{let t="",s=!1,r=0;for(;r<e.length;){const n=e[r];if("\\"===n&&r+1<e.length){const o=e[r+1];if(o>="1"&&o<="9")return null;if(!s&&("b"===o||"B"===o))return null;t+=n+o,r+=2;continue}if("["!==n||s)if("]"===n&&s)s=!1,t+=n,r+=1;else{if("("===n&&r+2<e.length&&"?"===e[r+1]){const t=e[r+2];if("="===t||"!"===t)return null;if("<"===t&&r+3<e.length){const t=e[r+3];if("="===t||"!"===t)return null;if(/[a-zA-Z]/.test(t))return null}}"."!==n||s?(t+=n,r+=1):(t+="[^\\n\\r]",r+=1)}else s=!0,t+=n,r+=1}return t})(e);if(null===r)return Te.set(s,null),null;try{const e=t?`^(?:${r})$`:r,n=new RegExp(e,"u");return Te.set(s,n),n}catch{return Te.set(s,null),null}},Se=(e,t,s)=>{const r=ae(t),n=ae(s),o=e.getString(r),i=e.getString(n);if(void 0===o||void 0===i)return!1;const l=Ee(i,!0);return null!==l&&l.test(o)},Ae=(e,t,s)=>{const r=ae(t),n=ae(s),o=e.getString(r),i=e.getString(n);if(void 0===o||void 0===i)return!1;const l=Ee(i,!1);return null!==l&&l.test(o)},Ie=(e,t,{callback:s,realm:n=new fe,functions:o=r,trace:i=!0}={})=>{const{result:l,trace:c,tree:a}=N(t,{trace:!!i});if(!l.success){let e=`Invalid JSONPath expression: "${t}". Syntax error at position ${l.maxMatched}`;throw e+=c?`, expected ${c.inferExpectations()}`:"",new y(e,{jsonPath:t})}try{const{segments:t}=a,r=[];if(0===t.length)return r.push(e),"function"==typeof s&&s(e,"$"),r;const i={realm:n,root:e,functions:o},l=[];for(l.push({value:e,path:[],segmentIndex:0});l.length>0;){const e=l.pop(),{value:o,path:c,segmentIndex:a}=e;if(a>=t.length){const e=$(c);r.push(o),"function"==typeof s&&s(o,e);continue}const u=t[a],p=[];if(ye(i,o,u,(e,t)=>{p.push({value:e,pathSegment:t})}),"DescendantSegment"===u.type){const e=[];for(const[t,s]of n.entries(o))e.push({value:s,pathSegment:t});for(let t=e.length-1;t>=0;t-=1){const{value:s,pathSegment:r}=e[t];l.push({value:s,path:[...c,r],segmentIndex:a})}}for(let e=p.length-1;e>=0;e-=1){const{value:t,pathSegment:s}=p[e];l.push({value:t,path:[...c,s],segmentIndex:a+1})}}return r}catch(e){throw new xe("Unexpected error during JSONPath evaluation",{cause:e,expression:t})}};function Oe(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function ve(e){return function t(s){return 0===arguments.length||Oe(s)?t:e.apply(this,arguments)}}function Ce(e){return function t(s,r){switch(arguments.length){case 0:return t;case 1:return Oe(s)?t:ve(function(t){return e(s,t)});default:return Oe(s)&&Oe(r)?t:Oe(s)?ve(function(t){return e(t,r)}):Oe(r)?ve(function(t){return e(s,t)}):e(s,r)}}}function Me(e){for(var t,s=[];!(t=e.next()).done;)s.push(t.value);return s}function qe(e,t,s){for(var r=0,n=s.length;r<n;){if(e(t,s[r]))return!0;r+=1}return!1}function Ne(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const Le="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var De=Object.prototype.toString;const Fe=function(){return"[object Arguments]"===De.call(arguments)?function(e){return"[object Arguments]"===De.call(e)}:function(e){return Ne("callee",e)}}();var Be=!{toString:null}.propertyIsEnumerable("toString"),Pe=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],$e=function(){return arguments.propertyIsEnumerable("length")}(),je=function(e,t){for(var s=0;s<e.length;){if(e[s]===t)return!0;s+=1}return!1};const Re="function"!=typeof Object.keys||$e?ve(function(e){if(Object(e)!==e)return[];var t,s,r=[],n=$e&&Fe(e);for(t in e)!Ne(t,e)||n&&"length"===t||(r[r.length]=t);if(Be)for(s=Pe.length-1;s>=0;)Ne(t=Pe[s],e)&&!je(r,t)&&(r[r.length]=t),s-=1;return r}):ve(function(e){return Object(e)!==e?[]:Object.keys(e)});const _e=ve(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function He(e,t,s,r){var n=Me(e);function o(e,t){return Ue(e,t,s.slice(),r.slice())}return!qe(function(e,t){return!qe(o,t,e)},Me(t),n)}function Ue(e,t,s,r){if(Le(e,t))return!0;var n=_e(e);if(n!==_e(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(n){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!Le(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!Le(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var o=s.length-1;o>=0;){if(s[o]===e)return r[o]===t;o-=1}switch(n){case"Map":return e.size===t.size&&He(e.entries(),t.entries(),s.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&He(e.values(),t.values(),s.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var i=Re(e);if(i.length!==Re(t).length)return!1;var l=s.concat([e]),c=r.concat([t]);for(o=i.length-1;o>=0;){var a=i[o];if(!Ne(a,t)||!Ue(t[a],e[a],l,c))return!1;o-=1}return!0}const ze=Ce(function(e,t){return Ue(e,t,[],[])});const Ve=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class Ge{elements;constructor(e){this.elements=e??[]}toValue(){return this.elements.map(e=>({key:e.key?.toValue(),value:e.value?.toValue()}))}map(e,t){return this.elements.map(s=>{const r=s.value,n=s.key;if(void 0===r||void 0===n)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,r,n,s):e(r,n,s)})}filter(e,t){const s=this.elements.filter(s=>{const r=s.value,n=s.key;return void 0!==r&&void 0!==n&&(void 0!==t?e.call(t,r,n,s):e(r,n,s))});return new Ge(s)}reject(e,t){const s=[];for(const r of this.elements){const n=r.value,o=r.key;void 0!==n&&void 0!==o&&(e.call(t,n,o,r)||s.push(r))}return new Ge(s)}forEach(e,t){this.elements.forEach((s,r)=>{const n=s.value,o=s.key;void 0!==n&&void 0!==o&&(void 0!==t?e.call(t,n,o,s,r):e(n,o,s,r))})}find(e,t){return this.elements.find(s=>{const r=s.value,n=s.key;return void 0!==r&&void 0!==n&&(void 0!==t?e.call(t,r,n,s):e(r,n,s))})}keys(){return this.elements.map(e=>e.key?.toValue()).filter(e=>void 0!==e)}values(){return this.elements.map(e=>e.value?.toValue()).filter(e=>void 0!==e)}get length(){return this.elements.length}get isEmpty(){return 0===this.length}get first(){return this.elements[0]}get(e){return this.elements[e]}push(e){return this.elements.push(e),this}includesKey(e){return this.elements.some(t=>t.key?.equals(e))}[Symbol.iterator](){return this.elements[Symbol.iterator]()}}const Xe=Ge;class Qe{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(e,t,s){void 0!==t&&(this.meta=t),void 0!==s&&(this.attributes=s),void 0!==e&&(this.content=e)}get element(){return this._storedElement}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof Qe)this._content=e;else if(null!=e&&"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e&&"symbol"!=typeof e)if(e instanceof Ve)this._content=e;else if(e instanceof Xe)this._content=e.elements;else if(Array.isArray(e))this._content=e.map(e=>this.refract(e));else{if("object"!=typeof e)throw new Error("Cannot set content to value of type "+typeof e);this._content=Object.entries(e).map(([e,t])=>new this.MemberElement(e,t))}else this._content=e}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof Qe?this._meta=e:this.meta.set(e??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof Qe?this._attributes=e:this.attributes.set(e??{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get children(){const{_content:e}=this;if(Array.isArray(e))return e;if(e instanceof Ve){const t=[];return e.key&&t.push(e.key),e.value&&t.push(e.value),t}return e instanceof Qe?[e]:[]}get isFrozen(){return Object.isFrozen(this)}freeze(){if(!this.isFrozen){this._meta&&(this._meta.parent=this,this._meta.freeze()),this._attributes&&(this._attributes.parent=this,this._attributes.freeze());for(const e of this.children)e.parent=this,e.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:e}=this;return e instanceof Qe||e instanceof Ve?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){const t=e instanceof Qe?e.toValue():e;return ze(this.toValue(),t)}primitive(){}set(e){return this.content=e,this}toRef(e){const t=this.id.toValue();if(""===t)throw new Error("Cannot create reference to an element without an ID");const s=new this.RefElement(t);return"string"==typeof e&&(s.path=this.refract(e)),s}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}hasMetaProperty(e){return!this.isMetaEmpty&&this.meta.hasKey(e)}get isMetaEmpty(){return void 0===this._meta||this.meta.isEmpty}getAttributesProperty(e,t){if(!this.hasAttributesProperty(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.attributes.set(e,t)}return this.attributes.get(e)}setAttributesProperty(e,t){this.attributes.set(e,t)}hasAttributesProperty(e){return!this.isAttributesEmpty&&this.attributes.hasKey(e)}get isAttributesEmpty(){return void 0===this._attributes||this.attributes.isEmpty}}const Ye=Qe;const Je=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="string"}primitive(){return"string"}get length(){return this.content?.length??0}};const Ke=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="number"}primitive(){return"number"}};const We=class extends Ye{constructor(e,t,s){super(e??null,t,s),this.element="null"}primitive(){return"null"}set(e){throw new Error("Cannot set the value of null")}};const Ze=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="boolean"}primitive(){return"boolean"}};class et extends Ye{constructor(e,t,s){super(e||[],t,s)}get length(){return this._content.length}get isEmpty(){return 0===this.length}get first(){return this._content[0]}get second(){return this._content[1]}get last(){return this._content.at(-1)}push(...e){for(const t of e)this._content.push(this.refract(t));return this}shift(){return this._content.shift()}unshift(e){this._content.unshift(this.refract(e))}includes(e){return this._content.some(t=>t.equals(e))}findElements(e,t){const s=t||{},r=!!s.recursive,n=void 0===s.results?[]:s.results;for(let t=0;t<this._content.length;t+=1){const s=this._content[t],o=s;r&&"function"==typeof o.findElements&&o.findElements(e,{results:n,recursive:r}),e(s,t,void 0)&&n.push(s)}return n}find(e){const t=this.findElements(e,{recursive:!0});return new this.ArrayElement(t)}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>{const s=t.classes;return"function"==typeof s.includes&&s.includes(e)})}getById(e){return this.find(t=>t.id.toValue()===e).first}concat(e){return new(0,this.constructor)(this._content.concat(e._content))}[Symbol.iterator](){return this._content[Symbol.iterator]()}}const tt=et;const st=class extends tt{constructor(e,t,s){super(e||[],t,s),this.element="array"}primitive(){return"array"}get(e){return this._content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}set(e,t){return"number"==typeof e&&void 0!==t?this._content[e]=this.refract(t):this.content=e,this}remove(e){return this._content.splice(e,1)[0]??null}map(e,t){return this._content.map(e,t)}flatMap(e,t){return this._content.flatMap(e,t)}compactMap(e,t){const s=[];for(const r of this._content){const n=e.call(t,r);n&&s.push(n)}return s}filter(e,t){const s=this._content.filter(e,t);return new this.constructor(s)}reject(e,t){const s=[];for(const r of this._content)e.call(t,r)||s.push(r);return new this.constructor(s)}reduce(e,t){let s,r;void 0!==t?(s=0,r=this.refract(t)):(s=1,r=this.first);for(let t=s;t<this.length;t+=1){const s=e(r,this._content[t],t,this);r=void 0===s?s:this.refract(s)}return r}forEach(e,t){this._content.forEach((s,r)=>{e.call(t,s,r)})}empty(){return new this.constructor([])}};const rt=class extends Ye{constructor(e,t,s,r){super(new Ve,s,r),this.element="member",void 0!==e&&(this.key=e),arguments.length>=2&&(this.value=t)}primitive(){return"member"}get key(){return this._content.key}set key(e){this._content.key=this.refract(e)}get value(){return this._content.value}set value(e){this._content.value=void 0===e?void 0:this.refract(e)}};const nt=class extends tt{constructor(e,t,s){super(e||[],t,s),this.element="object"}primitive(){return"object"}toValue(){return this._content.reduce((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e),{})}get(e){const t=this.getMember(e);if(t)return t.value}getValue(e){const t=this.get(e);if(t)return t.toValue()}getMember(e){if(void 0!==e)return this._content.find(t=>t.key.toValue()===e)}remove(e){let t=null;return this.content=this._content.filter(s=>s.key.toValue()!==e||(t=s,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if("string"==typeof e){const s=this.getMember(e);s?s.value=t:this._content.push(new rt(e,t))}else if("object"==typeof e&&!Array.isArray(e))for(const t of Object.keys(e))this.set(t,e[t]);return this}keys(){return this._content.map(e=>e.key.toValue())}values(){return this._content.map(e=>e.value.toValue())}hasKey(e){return this._content.some(t=>t.key.equals(e))}items(){return this._content.map(e=>[e.key.toValue(),e.value.toValue()])}map(e,t){return this._content.map(s=>e.call(t,s.value,s.key,s))}compactMap(e,t){const s=[];return this.forEach((r,n,o)=>{const i=e.call(t,r,n,o);i&&s.push(i)}),s}filter(e,t){return new Xe(this._content).filter(e,t)}reject(e,t){const s=[];for(const r of this._content)e.call(t,r.value,r.key,r)||s.push(r);return new Xe(s)}forEach(e,t){this._content.forEach(s=>e.call(t,s.value,s.key,s))}reduce(e,t){let s,r;void 0!==t?(s=0,r=this.refract(t)):(s=1,r=this._content[0]?.value);for(let t=s;t<this._content.length;t+=1){const s=this._content[t],n=e(r,s.value,s.key,s,this);r=void 0===n?n:this.refract(n)}return r}empty(){return new this.constructor([])}},ot=e=>e instanceof Je,it=e=>e instanceof Ke,lt=e=>e instanceof We,ct=e=>e instanceof Ze,at=e=>e instanceof st,ut=e=>e instanceof nt;const pt=class extends Ye{constructor(e,t,s){super(e||[],t,s),this.element="ref",this.path||(this.path="element")}get path(){if(this.hasAttributesProperty("path"))return this.attributes.get("path")}set path(e){this.attributes.set("path",e)}};function ht(e){return void 0===e?new We:dt(e)}function dt(e){if(e instanceof Ye)return e;if("string"==typeof e)return new Je(e);if("number"==typeof e)return new Ke(e);if("boolean"==typeof e)return new Ze(e);if(null===e)return new We;if(Array.isArray(e))return new st(e.map(ht));if("object"==typeof e)return new nt(e);throw new Error("Cannot refract value of type "+typeof e)}Ye.prototype.ObjectElement=nt,Ye.prototype.ArrayElement=st,Ye.prototype.RefElement=pt,Ye.prototype.MemberElement=rt,Ye.prototype.refract=dt;const mt=class extends ge{name="apidom";isObject(e){return ut(e)}isArray(e){return at(e)}isString(e){return ot(e)}isNumber(e){return it(e)}isBoolean(e){return ct(e)}isNull(e){return lt(e)}getString(e){return ot(e)?e.toValue():"string"==typeof e?e:void 0}getProperty(e,t){if(ut(e)&&e.hasKey(t))return e.get(t)}hasProperty(e,t){return!!ut(e)&&e.hasKey(t)}getElement(e,t){if(at(e)&&!(t<0||t>=e.length))return e.get(t)}getKeys(e){return ut(e)?e.keys():[]}getLength(e){return ot(e)?[...e.toValue()].length:at(e)||ut(e)?e.length:"string"==typeof e?[...e].length:Array.isArray(e)?e.length:0}*entries(e){if(at(e)){let t=0;for(const s of e)yield[t,s],t+=1}else if(ut(e))for(const t of e)yield[t.key.toValue(),t.value]}compare(e,t,s){if(void 0===e||void 0===s)return"=="===t?void 0===e&&void 0===s:"!="===t&&!(void 0===e&&void 0===s);const r=it(e)||"number"==typeof e,n=it(s)||"number"==typeof s;if(r&&n){const r=it(e)?e.toValue():e,n=it(s)?s.toValue():s,o=Object.is(r,-0)?0:r,i=Object.is(n,-0)?0:n;switch(t){case"==":return o===i;case"!=":return o!==i;case"<":return o<i;case">":return o>i;case"<=":return o<=i;case">=":return o>=i;default:return!1}}const o=ot(e)||"string"==typeof e,i=ot(s)||"string"==typeof s;if(o&&i){const r=ot(e)?e.toValue():e,n=ot(s)?s.toValue():s;switch(t){case"==":return r===n;case"!=":return r!==n;case"<":return r<n;case">":return r>n;case"<=":return r<=n;case">=":return r>=n;default:return!1}}return"=="===t?dt(e).equals(s):"!="===t&&!dt(e).equals(s)}},yt=new mt,gt=(e,t,s={})=>Ie(e,t,{...s,realm:yt});return t})());
|