Socket
Socket
Sign inDemoInstall

jora

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jora - npm Package Compare versions

Comparing version 1.0.0-alpha.13 to 1.0.0-beta.1

src/lang/error.js

31

CHANGELOG.md

@@ -0,1 +1,32 @@

## 1.0.0-beta.1 (May 14, 2020)
- Added `[...expr]` syntax
- Added `$$` root reference (`arg1`), which refers to second parameter of closest function or `undefined` when no such
- Added `reduce()` method
- Added support for methods as a reference to definition's value, i.e. `$method: => 123; $method() or path.$method()`
- Added `walk()` method to traverse AST
- Allowed numbers without integer part, i.e. `.123` or `.5e-4`
- Allowed numbers and literals as property name in object literals, i.e. `{ 1: 'ok', null: 'ok' }`
- Changed `=` and `!=` operators to use `Object.is()` instead of `===` and `!==` operators
- Changed behaviour for references to undefined definitions, now an exception raises in default mode, but no exceptions in tolerant mode
- Changed array-like access notation (i.e. `foo[expr]`) to behave like `pick()` method
- Reworked `pick()` method:
- Return first entry value when no argument gived
- String values are treat as an array
- Added support for negative indicies for array and strings
- Return a value for object and function as reference, instead of entry
- Pass index or key to function reference as second parameter (can be accessed by `$$`)
- When no arguments given or reference is `undefined` for object, return first entry value instead of value with key `undefined`
- Cast boolean values to a number index when access to an array or string, i.e. `false` -> `0` and `true` -> `1`
- Improved tolerant mode to not fail on methods that doesn't exists, such invocations silently returns `undefined`
- Improved parse and some compile errors
- Fixed suggestion in empty function body for new syntax, i.e. `group(=>)` will suggest between `=>` and `)`
- Fixed `~=` operator to produce a boolean result only
- Removed `mapToArray()` method, use `entries().({ nameProp: key, ...value })` instead
- Grand internal refactoring around AST processing:
- Parser generates less virtual nodes, so parse->stringify is much closer to original code (white spaces and comments mostly lost)
- Suggestion subsystem moved aside from parser to a separate module which uses in stat mode only
- Various fixes and improvements in suggestions
- The new approach allows to implement more complex suggestion scenarios like suggestions in array values for operators `in`, `not in`, `has` and `has no` which was added (e.g. in query `["a", "b", 1, 2][$ in ["b", 2]]` jora will suggest only `"a"` and `1` values in array after `in` operator)
## 1.0.0-alpha.13 (January 6, 2020)

@@ -2,0 +33,0 @@

2

dist/jora.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).jora=t()}(this,(function(){"use strict";var e={version:"1.0.0-alpha.13"},t=Object.freeze({__proto__:null,version:"1.0.0-alpha.13",default:e}),r=function(){var e=function(e,t,r,n){for(r=r||{},n=e.length;n--;r[e[n]]=t);return r},t=[2,5],r=[1,13],n=[1,34],s=[1,18],a=[1,7],i=[1,8],o=[1,10],c=[1,11],u=[1,12],h=[1,19],l=[1,20],p=[1,21],y=[1,22],g=[1,25],f=[1,27],d=[1,28],b=[1,29],m=[1,30],k=[1,31],v=[1,32],_=[1,33],$=[5,18,52,54],O=[1,38],S=[1,46],A=[1,45],R=[1,39],x=[1,40],C=[1,41],w=[1,42],E=[1,43],P=[1,44],N=[1,47],I=[1,48],T=[1,49],j=[1,50],q=[1,51],M=[1,52],L=[1,53],F=[1,54],B=[1,55],Y=[1,56],D=[1,57],U=[5,9,14,15,17,18,19,22,23,24,44,45,46,47,50,52,53,54,56,57,58,59,60,62],G=[5,10,12,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,52,54,61,63],z=[1,58],J=[1,59],H=[1,60],Z=[1,61],V=[1,62],Q=[1,63],K=[1,64],W=[1,67],X=[2,45],ee=[2,46],te=[5,10,12,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,50,52,54,56,57,58,59,60,61,63,69],re=[1,81],ne=[1,94],se=[1,96],ae=[1,97],ie=[1,98],oe=[5,10,12,18,21,52,54,61,63],ce=[5,10,12,18,21,29,30,41,52,54,61,63],ue=[5,10,12,18,21,23,24,25,26,27,28,29,30,34,35,36,37,38,39,40,41,52,54,61,63],he=[52,61],le=[12,52],pe=[61,63],ye=[5,10,12,18,21,25,26,27,28,29,30,41,52,54,61,63],ge=[5,10,12,18,21,25,26,27,28,29,30,34,35,40,41,52,54,61,63],fe=[5,10,12,18,21,25,26,27,28,29,30,34,35,36,37,38,39,40,41,52,54,61,63],de=[1,166],be=[54,61],me={trace:function(){},yy:{},symbols_:{error:2,root:3,block:4,EOF:5,definitions:6,e:7,def:8,$:9,";":10,$ident:11,":":12,ident:13,SYMBOL:14,$SYMBOL:15,query:16,FUNCTION_START:17,FUNCTION_END:18,FUNCTION:19,sortingCompareList:20,"|":21,NOT:22,"-":23,"+":24,IN:25,HAS:26,NOTIN:27,HASNO:28,AND:29,OR:30,"*":31,"/":32,"%":33,"=":34,"!=":35,"<":36,"<=":37,">":38,">=":39,"~=":40,"?":41,queryRoot:42,relativePath:43,"@":44,"#":45,STRING:46,LITERAL:47,object:48,array:49,"[":50,sliceNotation:51,"]":52,"(":53,")":54,arguments:55,".":56,".(":57,".[":58,"..":59,"..(":60,",":61,"{":62,"}":63,properties:64,property:65,"...":66,arrayItems:67,sortingCompare:68,ORDER:69,sliceNotationComponent:70,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",9:"$",10:";",12:":",14:"SYMBOL",15:"$SYMBOL",17:"FUNCTION_START",18:"FUNCTION_END",19:"FUNCTION",21:"|",22:"NOT",23:"-",24:"+",25:"IN",26:"HAS",27:"NOTIN",28:"HASNO",29:"AND",30:"OR",31:"*",32:"/",33:"%",34:"=",35:"!=",36:"<",37:"<=",38:">",39:">=",40:"~=",41:"?",44:"@",45:"#",46:"STRING",47:"LITERAL",50:"[",52:"]",53:"(",54:")",56:".",57:".(",58:".[",59:"..",60:"..(",61:",",62:"{",63:"}",66:"...",69:"ORDER"},productions_:[0,[3,2],[4,2],[4,1],[4,1],[4,0],[6,1],[6,2],[8,2],[8,2],[8,4],[13,1],[11,1],[7,1],[7,3],[7,2],[7,1],[7,3],[7,4],[7,2],[7,2],[7,2],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,5],[16,1],[16,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,3],[42,1],[42,3],[42,4],[42,3],[42,4],[42,2],[42,4],[42,5],[42,3],[42,3],[42,2],[42,4],[42,5],[42,3],[43,4],[43,4],[43,3],[43,5],[43,6],[43,4],[43,4],[43,3],[43,5],[43,6],[43,4],[55,1],[55,3],[48,2],[48,3],[64,1],[64,3],[65,1],[65,1],[65,1],[65,3],[65,3],[65,5],[65,1],[65,2],[67,1],[67,3],[49,2],[49,3],[20,1],[20,3],[68,2],[51,1],[51,2],[51,2],[51,3],[70,1],[70,2]],performAction:function(e,t,r,n,s,a,i){var o=a.length-1;switch(s){case 1:return n.buildResult(a[o-1]);case 2:this.$={type:"Block",definitions:a[o-1],body:a[o],range:this._$.range};break;case 3:this.$={type:"Block",definitions:a[o],body:{type:"Current"},range:this._$.range};break;case 4:this.$={type:"Block",definitions:[],body:a[o],range:this._$.range};break;case 5:this.$={type:"Block",definitions:[],body:{type:"Current"},range:this._$.range},n.suggestRanges.push([this._$,null,["var","path"],"current",this.$]);break;case 6:case 77:case 81:case 91:case 95:this.$=[a[o]];break;case 7:a[o-1].push(a[o]);break;case 8:this.$={type:"Definition",name:null,value:{type:"Current"},range:this._$.range},n.suggestRanges.push([i[o-1],i[o-1],"path","current",this.$]);break;case 9:this.$={type:"Definition",name:a[o-1],value:{type:"GetProperty",value:{type:"Current"},property:a[o-1]},range:this._$.range},n.suggestRanges.push([i[o-1],i[o-1],"path","current",this.$]);break;case 10:this.$={type:"Definition",name:a[o-3],value:a[o-1],range:this._$.range};break;case 11:case 12:this.$={type:"Identifier",name:a[o],range:this._$.range};break;case 13:case 41:case 42:case 49:case 50:break;case 14:this.$={type:"Function",arguments:[],body:a[o-1],range:this._$.range};break;case 15:this.$={type:"Function",arguments:[],body:a[o],range:this._$.range};break;case 16:this.$={type:"SortingFunction",compares:a[o],range:this._$.range};break;case 17:this.$={type:"Pipeline",left:a[o-2],right:a[o],range:this._$.range};break;case 18:this.$={type:"Pipeline",left:a[o-3],right:{type:"Block",definitions:a[o-1],body:a[o]},range:this._$.range};break;case 19:case 20:case 21:this.$={type:"Unary",operator:a[o-1],argument:a[o],range:this._$.range};break;case 22:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range},n.suggestRanges.push([i[o-2],i[o-2],"in-value",a[o]]);break;case 23:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"in-value",a[o-2]]);break;case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 35:case 36:case 37:case 38:case 39:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range};break;case 33:case 34:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"value",a[o-2]]);break;case 40:this.$={type:"Conditional",test:a[o-4],consequent:a[o-2],alternate:a[o],range:this._$.range};break;case 43:this.$={type:"Data",range:this._$.range};break;case 44:this.$={type:"Context",range:this._$.range};break;case 45:this.$={type:"Current",range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$]);break;case 46:this.$={type:"Reference",name:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$]);break;case 47:case 48:this.$={type:"Literal",value:a[o],range:this._$.range};break;case 51:this.$={type:"SliceNotation",value:{type:"Current"},arguments:a[o-1],range:this._$.range};break;case 52:this.$={type:"GetProperty",value:{type:"Current"},property:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$],[i[o],i[o],"path","current",this.$]);break;case 53:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[],range:this._$.range},n.suggestRanges.push([i[o],i[o-1],["var","path"],"current",this.$]);break;case 54:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1],range:this._$.range},n.suggestRanges.push();break;case 55:this.$={type:"Parentheses",body:a[o-1],range:this._$.range};break;case 56:this.$={type:"Parentheses",body:{type:"Block",definitions:a[o-2],body:a[o-1]},range:this._$.range};break;case 57:this.$={type:"GetProperty",value:{type:"Current"},property:a[o],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o],i[o],"path","current",this.$]);break;case 58:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-2],i[o-2],"path","current",this.$],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 59:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-3],i[o-3],"path","current",this.$]);break;case 60:this.$={type:"Map",value:{type:"Current"},query:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$]);break;case 61:this.$={type:"Filter",value:{type:"Current"},query:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$]);break;case 62:this.$={type:"Recursive",value:{type:"Current"},query:{type:"GetProperty",value:{type:"Current"},property:a[o]},range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o],i[o],"path","current",this.$]);break;case 63:this.$={type:"Recursive",value:{type:"Current"},query:{type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[]},range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-2],i[o-2],"path","current",this.$],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 64:this.$={type:"Recursive",value:{type:"Current"},query:{type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1]},range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-3],i[o-3],"path","current",this.$]);break;case 65:this.$={type:"Recursive",value:{type:"Current"},query:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$]);break;case 66:this.$={type:"GetProperty",value:a[o-3],property:a[o-1],range:this._$.range};break;case 67:this.$={type:"SliceNotation",value:a[o-3],arguments:a[o-1],range:this._$.range};break;case 68:this.$={type:"GetProperty",value:a[o-2],property:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"path",a[o-2]]);break;case 69:this.$={type:"MethodCall",value:a[o-4],method:a[o-2],arguments:[],range:this._$.range},n.suggestRanges.push([i[o-2],i[o-2],"path",a[o-4]],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 70:this.$={type:"MethodCall",value:a[o-5],method:a[o-3],arguments:a[o-1],range:this._$.range},n.suggestRanges.push([i[o-3],i[o-3],"path",a[o-5]]);break;case 71:this.$={type:"Map",value:a[o-3],query:a[o-1],range:this._$.range};break;case 72:this.$={type:"Filter",value:a[o-3],query:a[o-1],range:this._$.range};break;case 73:this.$={type:"Recursive",value:a[o-2],query:{type:"GetProperty",value:{type:"Current"},property:a[o]},range:this._$.range},n.suggestRanges.push([i[o],i[o],"path",a[o-2]]);break;case 74:this.$={type:"Recursive",value:a[o-4],query:{type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[]},range:this._$.range},n.suggestRanges.push([i[o-2],i[o-2],"path",a[o-4]],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 75:this.$={type:"Recursive",value:a[o-5],query:{type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1]},range:this._$.range},n.suggestRanges.push([i[o-3],i[o-3],"path",a[o-5]]);break;case 76:this.$={type:"Recursive",value:a[o-3],query:a[o-1],range:this._$.range};break;case 78:case 82:case 92:case 96:a[o-2].push(a[o]);break;case 79:this.$={type:"Object",properties:[],range:this._$.range},n.suggestRanges.push([i[o],i[o-1],["var","path"],"current",this.$]);break;case 80:this.$={type:"Object",properties:a[o-1],range:this._$.range};break;case 83:this.$={type:"Property",key:a[o],value:{type:"GetProperty",value:{type:"Current"},property:a[o]},range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$],[i[o],i[o],"path","current",this.$]);break;case 84:this.$={type:"Property",key:null,value:{type:"Current"},range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$]);break;case 85:this.$={type:"Property",key:a[o],value:{type:"Reference",name:a[o]},range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$]);break;case 86:this.$={type:"Property",key:a[o-2],value:a[o],range:this._$.range};break;case 87:this.$={type:"Property",key:{type:"Literal",value:a[o-2]},value:a[o],range:this._$.range};break;case 88:this.$={type:"Property",key:a[o-3],value:a[o],range:this._$.range};break;case 89:this.$={type:"Spread",query:{type:"Current"},range:this._$.range},n.suggestRanges.push([i[o],null,["var","path"],"current",this.$]);break;case 90:this.$={type:"Spread",query:a[o],range:this._$.range};break;case 93:this.$={type:"Array",elements:[],range:this._$.range},n.suggestRanges.push([i[o],i[o-1],["var","path"],"current",this.$]);break;case 94:this.$={type:"Array",elements:a[o-1],range:this._$.range};break;case 97:this.$={type:"Compare",query:a[o-1],order:a[o],range:this._$.range};break;case 98:this.$=[null,a[o]];break;case 99:this.$=[null,a[o-1],a[o]];break;case 100:this.$=[a[o-1],a[o]];break;case 101:this.$=[a[o-2],a[o-1],a[o]];break;case 102:this.$=null;break;case 103:this.$=a[o]}},table:[{3:1,4:2,5:t,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{1:[3]},{5:[1,35]},e($,[2,3],{16:6,20:9,11:14,42:15,43:16,68:17,48:23,49:24,13:26,7:36,8:37,9:r,14:n,15:s,17:a,19:i,22:o,23:c,24:u,44:h,45:l,46:p,47:y,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_}),e($,[2,4],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(U,[2,6]),e(G,[2,13],{50:z,56:J,57:H,58:Z,59:V,60:Q,69:K}),{4:65,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,18:t,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:66,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e([5,10,12,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,52,54,63],[2,16],{61:[1,69]}),{7:70,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:71,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:72,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e([5,12,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,50,52,54,56,57,58,59,60,61,63,69],X,{10:[1,73]}),e([5,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,50,52,54,56,57,58,59,60,61,63,69],ee,{10:[1,74],12:[1,75]}),e(te,[2,41]),e(te,[2,42]),e(G,[2,95]),e(te,[2,12]),e(te,[2,43]),e(te,[2,44]),e(te,[2,47]),e(te,[2,48]),e(te,[2,49]),e(te,[2,50]),{7:80,9:W,11:68,12:re,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,51:76,52:[1,77],53:f,56:d,57:b,58:m,59:k,60:v,62:_,67:78,68:17,70:79},e(te,[2,52],{53:[1,82]}),{6:84,7:83,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{13:85,14:n},{4:86,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:t,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{4:87,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,52:t,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{13:88,14:n},{4:89,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:t,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{9:ne,11:95,13:93,14:n,15:s,46:se,50:ae,63:[1,90],64:91,65:92,66:ie},e([5,10,12,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,50,52,53,54,56,57,58,59,60,61,63,69],[2,11]),{1:[2,1]},e($,[2,2],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(U,[2,7]),{6:100,7:99,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:101,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:102,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:103,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:104,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:105,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:106,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:107,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:108,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:109,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:110,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:111,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:112,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:113,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:114,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:115,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:116,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:117,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:118,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:119,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:120,9:W,11:68,12:re,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,51:121,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17,70:79},{13:122,14:n},{4:123,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:t,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{4:124,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,52:t,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{13:125,14:n},{4:126,6:3,7:4,8:5,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:t,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(G,[2,97]),{18:[1,127]},e(oe,[2,15],{23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(te,X),e(te,ee),{9:W,11:68,13:26,14:n,15:s,16:129,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:128},e(ce,[2,19],{23:S,24:A,25:R,26:x,27:C,28:w,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y}),e(ue,[2,20],{31:N,32:I,33:T}),e(ue,[2,21],{31:N,32:I,33:T}),e(U,[2,8]),e(U,[2,9]),{7:130,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{52:[1,131]},e(te,[2,93]),{52:[1,132],61:[1,133]},{12:re,52:[2,98],70:134},e(he,[2,91],{70:135,12:re,21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(le,[2,102],{16:6,20:9,42:15,43:16,68:17,48:23,49:24,13:26,11:68,7:136,9:W,14:n,15:s,17:a,19:i,22:o,23:c,24:u,44:h,45:l,46:p,47:y,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_}),{7:139,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:[1,137],55:138,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D,54:[1,140]},{7:141,8:37,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,57],{53:[1,142]}),{54:[1,143]},{52:[1,144]},e(te,[2,62],{53:[1,145]}),{54:[1,146]},e(te,[2,79]),{61:[1,148],63:[1,147]},e(pe,[2,81]),e(pe,[2,83],{12:[1,149]}),e(pe,[2,84]),e(pe,[2,85]),{12:[1,150]},{7:151,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(pe,[2,89],{42:15,43:16,48:23,49:24,13:26,11:68,16:152,9:W,14:n,15:s,44:h,45:l,46:p,47:y,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_}),e(oe,[2,17],{23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),{7:153,8:37,9:r,11:14,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(ye,[2,22],{23:S,24:A,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y}),e(ye,[2,23],{23:S,24:A,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y}),e(ye,[2,24],{23:S,24:A,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y}),e(ye,[2,25],{23:S,24:A,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y}),e(ce,[2,26],{23:S,24:A,25:R,26:x,27:C,28:w,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y}),e([5,10,12,18,21,30,41,52,54,61,63],[2,27],{23:S,24:A,25:R,26:x,27:C,28:w,29:E,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y}),e(ue,[2,28],{31:N,32:I,33:T}),e(ue,[2,29],{31:N,32:I,33:T}),e(G,[2,30]),e(G,[2,31]),e(G,[2,32]),e(ge,[2,33],{23:S,24:A,31:N,32:I,33:T,36:M,37:L,38:F,39:B}),e(ge,[2,34],{23:S,24:A,31:N,32:I,33:T,36:M,37:L,38:F,39:B}),e(fe,[2,35],{23:S,24:A,31:N,32:I,33:T}),e(fe,[2,36],{23:S,24:A,31:N,32:I,33:T}),e(fe,[2,37],{23:S,24:A,31:N,32:I,33:T}),e(fe,[2,38],{23:S,24:A,31:N,32:I,33:T}),e(ge,[2,39],{23:S,24:A,31:N,32:I,33:T,36:M,37:L,38:F,39:B}),{12:[1,154],21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D},{12:re,21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D,52:[1,155],70:135},{52:[1,156]},e(te,[2,68],{53:[1,157]}),{54:[1,158]},{52:[1,159]},e(te,[2,73],{53:[1,160]}),{54:[1,161]},e(G,[2,14]),e(G,[2,96]),{50:z,56:J,57:H,58:Z,59:V,60:Q,69:K},{10:[1,162],21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D},e(te,[2,51]),e(te,[2,94]),{7:163,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{52:[2,99]},{12:re,52:[2,100],70:164},e(le,[2,103],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(te,[2,53]),{54:[1,165],61:de},e(be,[2,77],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(te,[2,55]),{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D,54:[1,167]},{7:139,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:[1,168],55:169,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,60]),e(te,[2,61]),{7:139,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:[1,170],55:171,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,65]),e(te,[2,80]),{9:ne,11:95,13:93,14:n,15:s,46:se,50:ae,65:172,66:ie},{7:173,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{7:174,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D,52:[1,175]},e(pe,[2,90],{50:z,56:J,57:H,58:Z,59:V,60:Q}),e(oe,[2,18],{23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),{7:176,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,66]),e(te,[2,67]),{7:139,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:[1,177],55:178,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,71]),e(te,[2,72]),{7:139,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,54:[1,179],55:180,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,76]),e(U,[2,10]),e(he,[2,92],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),{52:[2,101]},e(te,[2,54]),{7:181,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,56]),e(te,[2,58]),{54:[1,182],61:de},e(te,[2,63]),{54:[1,183],61:de},e(pe,[2,82]),e(pe,[2,86],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(pe,[2,87],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),{12:[1,184]},e(oe,[2,40],{23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(te,[2,69]),{54:[1,185],61:de},e(te,[2,74]),{54:[1,186],61:de},e(be,[2,78],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D}),e(te,[2,59]),e(te,[2,64]),{7:187,9:W,11:68,13:26,14:n,15:s,16:6,17:a,19:i,20:9,22:o,23:c,24:u,42:15,43:16,44:h,45:l,46:p,47:y,48:23,49:24,50:g,53:f,56:d,57:b,58:m,59:k,60:v,62:_,68:17},e(te,[2,70]),e(te,[2,75]),e(pe,[2,88],{21:O,23:S,24:A,25:R,26:x,27:C,28:w,29:E,30:P,31:N,32:I,33:T,34:j,35:q,36:M,37:L,38:F,39:B,40:Y,41:D})],defaultActions:{35:[2,1],134:[2,99],164:[2,101]},parseError:function(e,t){if(!t.recoverable){var r=new Error(e);throw r.hash=t,r}this.trace(e)},parse:function(e){var t=this,r=[0],n=[null],s=[],a=this.table,i="",o=0,c=0,u=2,h=1,l=s.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(e,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var f=p.yylloc;s.push(f);var d=p.options&&p.options.ranges;"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,m,k,v,_,$,O,S,A,R=function(){var e;return"number"!=typeof(e=p.lex()||h)&&(e=t.symbols_[e]||e),e},x={};;){if(k=r[r.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=R()),v=a[k]&&a[k][b]),void 0===v||!v.length||!v[0]){var C="";for($ in A=[],a[k])this.terminals_[$]&&$>u&&A.push("'"+this.terminals_[$]+"'");C=p.showPosition?"Parse error on line "+(o+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(o+1)+": Unexpected "+(b==h?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(C,{text:p.match,token:this.terminals_[b]||b,line:p.yylineno,loc:f,expected:A})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:r.push(b),n.push(p.yytext),s.push(p.yylloc),r.push(v[1]),b=null,m?(b=m,m=null):(c=p.yyleng,i=p.yytext,o=p.yylineno,f=p.yylloc);break;case 2:if(O=this.productions_[v[1]][1],x.$=n[n.length-O],x._$={first_line:s[s.length-(O||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(O||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(O||1)].range[0],s[s.length-1].range[1]]),void 0!==(_=this.performAction.apply(x,[i,c,o,y.yy,v[1],n,s].concat(l))))return _;O&&(r=r.slice(0,-1*O*2),n=n.slice(0,-1*O),s=s.slice(0,-1*O)),r.push(this.productions_[v[1]][0]),n.push(x.$),s.push(x._$),S=a[r[r.length-2]][r[r.length-1]],r.push(S);break;case 3:return!0}}return!0}},ke={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,n,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(n=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var a in s)this[a]=s[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,r,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),a=0;a<s.length;a++)if((r=this._input.match(this.rules[s[a]]))&&(!t||r[0].length>t[0].length)){if(t=r,n=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,s[a])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,s[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{ranges:!0},performAction:function(e,t,r,n){switch(r){case 0:e.commentRanges.push(t.yylloc.range);break;case 1:break;case 2:return this.popState(),"/";case 3:return this.popState(),"<";case 4:this.done=!1,this.popState();break;case 5:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"(";case 6:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),")";case 7:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"[";case 8:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"]";case 9:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"{";case 10:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"}";case 11:return t.yytext=this.toLiteral(t.yytext),"LITERAL";case 12:return"AND";case 13:return"OR";case 14:return"HASNO";case 15:return"HAS";case 16:return"IN";case 17:return"NOTIN";case 18:return"NOT";case 19:return"ORDER";case 20:return this._input&&this.begin("preventPrimitive"),t.yytext=Number(t.yytext),"LITERAL";case 21:case 22:return this._input&&this.begin("preventPrimitive"),t.yytext=this.toStringLiteral(t.yytext),"STRING";case 23:return this._input&&this.begin("preventPrimitive"),t.yytext=this.toRegExp(t.yytext),"LITERAL";case 24:return this._input&&this.begin("preventPrimitive"),"SYMBOL";case 25:return this._input&&this.begin("preventPrimitive"),t.yytext=t.yytext.slice(1),"$SYMBOL";case 26:return this._input&&this.begin("preventPrimitive"),"@";case 27:return this._input&&this.begin("preventPrimitive"),"#";case 28:return this._input&&this.begin("preventPrimitive"),"$";case 29:return"FUNCTION";case 30:return this.fnOpened++,"FUNCTION_START";case 31:return"=";case 32:return"!=";case 33:return"~=";case 34:return">=";case 35:return"<=";case 36:return"<";case 37:return this.fnOpened?(this.fnOpened--,"FUNCTION_END"):">";case 38:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"..(";case 39:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".(";case 40:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".[";case 41:return"...";case 42:return this._input&&this.begin("preventPrimitive"),"..";case 43:return this._input&&this.begin("preventPrimitive"),".";case 44:return"?";case 45:return",";case 46:return":";case 47:return";";case 48:return"-";case 49:return"+";case 50:return"*";case 51:return"/";case 52:return"%";case 53:return"|";case 54:return"EOF"}},rules:[/^(?:(\/\/.*?(\r|\n|$)))/,/^(?:(\s+))/,/^(?:\/)/,/^(?:<(?!=))/,/^(?:)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:(true|false|null|undefined)(\b))/,/^(?:and(\b))/,/^(?:or(\b))/,/^(?:has(\s+)no(\b))/,/^(?:has(\b))/,/^(?:in(\b))/,/^(?:not(\s+)in(\b))/,/^(?:not?(\b))/,/^(?:(asc|desc)(\b))/,/^(?:\d+(?:\.\d+)?([eE][-+]?\d+)?(\b))/,/^(?:"(?:\\.|[^"])*")/,/^(?:'(?:\\.|[^'])*')/,/^(?:(\/(?:\\.|[^/])+\/i?))/,/^(?:([a-zA-Z_][a-zA-Z_$0-9]*))/,/^(?:\$([a-zA-Z_][a-zA-Z_$0-9]*))/,/^(?:@)/,/^(?:#)/,/^(?:\$)/,/^(?:=>)/,/^(?:<(?!=))/,/^(?:=)/,/^(?:!=)/,/^(?:~=)/,/^(?:>=)/,/^(?:<=)/,/^(?:<)/,/^(?:>)/,/^(?:\.\.\()/,/^(?:\.\()/,/^(?:\.\[)/,/^(?:\.\.\.)/,/^(?:\.\.)/,/^(?:\.)/,/^(?:\?)/,/^(?:,)/,/^(?::)/,/^(?:;)/,/^(?:\-)/,/^(?:\+)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:\|)/,/^(?:$)/],conditions:{preventPrimitive:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],inclusive:!0},INITIAL:{rules:[0,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],inclusive:!0}}};function ve(){this.yy={}}return me.lexer=ke,ve.prototype=me,me.Parser=ve,function e(t){function r(e,t){Object.entries(t).forEach(([t,r])=>e[t]=r(e[t]))}function n(e,t){return t>=0&&t<e.length&&/[a-zA-Z_$0-9]/.test(e[t])}function s(e,t){const r=e.charCodeAt(t);return 9===r||10===r||13===r||32===r}function a(e,t,r){for(;t<r;t++)if(!s(e,t))return!1;return!0}function i(e,t,r,n,s){const a=[];for(let r=0;r<n.length;r++){const[s,i]=n[r];if(s>t)break;s<e||(s===e?a.push(e,e):a.push(e,s),e=i)}return e===r.length&&s||a.push(e,t),a}Object.assign(t.lexer,{toLiteral:e=>"null"===e?null:"false"!==e&&("true"===e||void 0),toStringLiteral:e=>JSON.parse("'"===e[0]?e.replace(/\\?"/g,'\\"').replace(/\\([^"uU])/g,"$1").replace(/^\'|\'$/g,'"'):e),toRegExp:e=>new RegExp(e.substr(1,e.lastIndexOf("/")-1),e.substr(e.lastIndexOf("/")+1))}),r(t.lexer,{setInput:e=>(function(t,r){const o=[],c=[];return r.commentRanges=c,r.suggestRanges=o,r.buildResult=e=>({ast:e,commentRanges:c,get suggestRanges(){return function(e,t,r){const o=[],c=r.length&&r[r.length-1][1]===e.length&&!/[\r\n]$/.test(e);for(let u=0;u<t.length;u++){let[h,l,p,y,g]=t[u];if(null===h)h=l.range[0],l=l.range[0];else if(null===l)l=h.range[1],h=h.range[1];else if(h.range[0]>l.range[0]){const e=h;h=l.range[1],l=e.range[0]}else h=h.range[0],l=l.range[1];if(a(e,h,l)){for(;h>=0&&s(e,h-1);)h--;for(;l<e.length&&s(e,l);)l++;if(n(e,h-1)){if(h===l)continue;h++}if(n(e,l)){if(h===l)continue;l--}}Array.isArray(p)||(p=[p]);const f=i(h,l,e,r,c);for(let e=0;e<f.length;e+=2)p.forEach(t=>o.push([f[e],f[e+1],t,y,g||null]))}return o}(t,o,c)}}),this.fnOpened=0,this.fnOpenedStack=[],this.prevToken=null,this.prevYylloc={first_line:1,last_line:1,first_column:0,last_column:0,range:[0,0]},e.call(this,t,r)})});const o=new t.Parser;o.lexer={...t.lexer};const c=["AND","OR","IN","NOTIN","HAS","HASNO"],u=[...c,"NOT","ORDER"],h=["+","-","*","/","%","=","!=","~=",">=","<=","<",">"],l=[null,":",";",",",".","..",...h,...c,"NOT"],p=new Set([",","?",":",";","EOF","]",")","}",...h,...c,"ORDER"]),y=new Map(l.map(e=>[e,p]));return y.set("{",new Set([","])),y.set("[",new Set([","])),y.set("(",new Set([","])),r(o.lexer,{lex:e=>(function t(){this.lex=e;const r=this._input,n=this.lex(this);if(this.lex=t,y.has(this.prevToken)&&y.get(this.prevToken).has(n)){const e={first_line:this.prevYylloc.last_line,last_line:this.yylloc.first_line,first_column:this.prevYylloc.last_column,last_column:this.yylloc.first_column,range:[this.prevYylloc.range[1],this.yylloc.range[0]]};if(this.unput(this.yytext),this.pushState("preventPrimitive"),this.done=!1,this.yytext="_",this.yylloc=this.prevYylloc=e,r!==this._input&&u.includes(n)){const t=r.length-this._input.length-1;switch(r[t]){case" ":case"\t":e.last_column--,e.range[1]--;break;case"\n":{const n=r.lastIndexOf("\n",t-1);e.last_line--,e.last_column=-1===n?e.last_column-1:t-n,e.range[1]--;break}}}return this.prevToken="SYMBOL"}if(this.prevYylloc=this.yylloc,u.includes(n))switch(this._input[0]){case" ":case"\t":this.prevYylloc={...this.prevYylloc,last_column:this.prevYylloc.last_column+1,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]};break;case"\n":this.prevYylloc={...this.prevYylloc,last_line:this.prevYylloc.last_line+1,last_column:0,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]}}return this.prevToken=n})}),Object.assign((function(e,r){return r?o.parse(e):t.parse(e)}),{generateModule:()=>t.generateModule({moduleName:"module.exports"}).replace("new Parser","("+e+")(new Parser)")})}(new ve)}();function n(e){return"GetProperty"===e.type&&("Current"===e.value.type&&"Identifier"===e.property.type)}function s(e,t){return!!n(e)&&e.property.name===t}var a=function(e){function t(e){switch(e.type){case"Data":a("@");break;case"Context":a("#");break;case"Current":a("$");break;case"Literal":a("string"==typeof e.value?JSON.stringify(e.value):String(e.value));break;case"Identifier":a(e.name);break;case"Unary":a(e.operator),"-"!==e.operator&&"+"!==e.operator&&a(" "),t(e.argument);break;case"Binary":t(e.left),/^[a-z]/i.test(e.operator)?(a(" "),a(e.operator),a(" ")):a(e.operator),t(e.right);break;case"Conditional":t(e.test),a("?"),t(e.consequent),a(":"),t(e.alternate);break;case"Object":a("{"),o(e.properties,","),a("}");break;case"Property":if(!e.key||(r=e.value,"Identifier"===(c=e.key).type&&"Reference"===r.type&&"Identifier"===r.name.type&&c.name===r.name.name)){t(e.value);break}"Literal"===e.key.type||"Identifier"===e.key.type?t(e.key):(a("["),t(e.key),a("]")),"Identifier"===e.key.type&&s(e.value,e.key.name)||(a(":"),t(e.value));break;case"Spread":a("..."),i(e.query);break;case"Array":a("["),o(e.elements,","),a("]");break;case"Function":a("<"),t(e.body),a(">");break;case"Compare":t(e.query),a(" "),a(e.order);break;case"SortingFunction":o(e.compares,",");break;case"MethodCall":i(e.value)&&a("."),t(e.method),a("("),o(e.arguments,","),a(")");break;case"Definition":e.name?(a("$"),t(e.name),"Identifier"===e.name.type&&s(e.value,e.name.name)||(a(":"),t(e.value))):t(e.value),a(";");break;case"Parentheses":a("("),t(e.body),a(")");break;case"Block":e.definitions.forEach(t),t(e.body);break;case"Reference":a("$"),t(e.name);break;case"Map":i(e.value),a(".("),t(e.query),a(")");break;case"Filter":i(e.value),a(".["),t(e.query),a("]");break;case"Recursive":i(e.value),a(".."),n(e.query)||function(e){return"MethodCall"===e.type&&"Current"===e.value.type}(e.query)?t(e.query):(a("("),t(e.query),a(")"));break;case"GetProperty":"Identifier"===e.property.type?(i(e.value)&&a("."),t(e.property)):(t(e.value),a("["),t(e.property),a("]"));break;case"SliceNotation":{const[r,n,s]=e.arguments;i(e.value),a("["),r&&t(r),a(":"),n&&t(n),s&&(a(":"),t(s)),a("]");break}case"Pipeline":t(e.left),a("|"),t(e.right);break;default:throw new Error("Unknown node type `"+e.type+"`")}var r,c}const r=[],a=e=>r.push(e),i=e=>{if("Current"!==e.type)return t(e),!0},o=(e,r)=>{e.forEach((e,n)=>{n>0&&a(r),t(e)})};return t(e),r.join("")};const i={"-":"-","+":"+",no:"!",not:"!"},o={in:"in","not in":"in",has:"-","has no":"-",and:"and",or:"or","+":"add","-":"sub","*":"mul","/":"div","%":"mod","=":"eq","!=":"ne","<":"lt","<=":"lte",">":"gt",">=":"gte","~=":"match"};var c=function(e,t=[],r=!1){function n(e,t,r){let n;return"var"===r?n=JSON.stringify(h):(e||(e="v"+b++),n=e),"[]"!==n&&m.push([n,JSON.stringify([t[0],t[1]]),JSON.stringify(r)].join(",")),e}function s(e){return e.reduce((e,t)=>n(e,t,t[2])||e,void 0)}function a(e,t){const r=h,n=p.length;if(h=h.slice(),h.own=[],h.firstCurrent=null,h.captureCurrent=[],e(),h.captureCurrent.length){const e=s(h.captureCurrent);if(e){const r="stat("+e+",current)";h.firstCurrent?p[h.firstCurrent]=r:p[n]=t(p[n],r)}}h=r}function c(e){const t=r&&d.has(e);if(t){const t=s(d.get(e));t&&y("stat("+t+","),d.delete()}switch(r&&f.has(e)&&h.captureCurrent.push(...f.get(e).filter(e=>{if("var"!==e[2])return!0;n(null,e,e[2])})),e.type){case"Data":y("data");break;case"Context":y("context");break;case"Current":null!==h.firstCurrent||h.captureCurrent.disabled||(h.firstCurrent=p.length),y("current");break;case"Literal":y("string"==typeof e.value?JSON.stringify(e.value):String(e.value));break;case"Identifier":y(e.name);break;case"Unary":if(e.operator in i==!1)throw new Error("Unknown operator `"+e.operator+"`");"not"===e.operator||"no"===e.operator?(y("!f.bool("),c(e.argument),y(")")):(y(i[e.operator]),c(e.argument));break;case"Binary":if(e.operator in o==!1)throw new Error("Unknown operator `"+e.operator+"`");switch("not in"!==e.operator&&"has no"!==e.operator||y("!"),e.operator){case"has":case"has no":y("f.in("),c(e.right),y(","),c(e.left),y(")");break;case"or":l=!0,y("f.bool(tmp="),c(e.left),y(")?tmp:"),h.captureCurrent.disabled=!0,c(e.right),h.captureCurrent.disabled=!1;break;case"and":l=!0,y("f.bool(tmp="),c(e.left),y(")?"),h.captureCurrent.disabled=!0,c(e.right),h.captureCurrent.disabled=!1,y(":tmp");break;default:y("f."),y(o[e.operator]),y("("),c(e.left),y(","),c(e.right),y(")")}break;case"Conditional":y("f.bool("),c(e.test),h.captureCurrent.disabled=!0,y(")?"),c(e.consequent),y(":"),c(e.alternate),h.captureCurrent.disabled=!1;break;case"Object":y("{"),g(e.properties,","),y("}");break;case"Property":if(!e.key)break;"Literal"===e.key.type||"Identifier"===e.key.type?c(e.key):(y("["),c(e.key),y("]")),y(":"),c(e.value);break;case"Spread":y("..."),c(e.query);break;case"Array":y("["),g(e.elements,","),y("]");break;case"Function":a(()=>{y("current=>("),c(e.body),y(")")},(e,t)=>e+t+",");break;case"Compare":"desc"===e.order&&y("-"),a(()=>{y("f.cmp((_q=current=>("),c(e.query),y("))(a),_q(b))")},(e,t)=>e+t+",");break;case"SortingFunction":y("(a, b)=>{let _q;return "),g(e.compares,"||"),y("||0}");break;case"MethodCall":y("m."),c(e.method),y("("),c(e.value),e.arguments.length&&(y(","),g(e.arguments,",")),y(")");break;case"Definition":if(!e.name)break;if(h.own.includes(e.name.name))throw new Error(`Identifier '$${e.name.name}' has already been declared`);if(u.includes(e.name.name))throw new Error(`Identifier '$${e.name.name}' is reserved for future use`);y("const $"),c(e.name),y("="),c(e.value),y(";"),h.push(e.name.name),h.own.push(e.name.name);break;case"Parentheses":y("("),c(e.body),y(")");break;case"Block":e.definitions.length?a(()=>{y("(()=>{"),g(e.definitions),y("return "),c(e.body),y("})()")},(e,t)=>e+t+";"):"Object"===e.body.type?(y("("),c(e.body),y(")")):c(e.body);break;case"Reference":h.includes(e.name.name)?(y("$"),c(e.name)):(y("typeof $"),c(e.name),y('!=="undefined"?$'),c(e.name),y(":undefined"));break;case"Map":y("f.map("),c(e.value),a(()=>{y(",current=>"),c(e.query)},(e,t)=>(y(")"),e+"("+t+",")),y(")");break;case"Filter":y("f.filter("),c(e.value),a(()=>{y(",current=>"),c(e.query)},(e,t)=>(y(")"),e+"("+t+",")),y(")");break;case"Recursive":y("f.recursive("),c(e.value),a(()=>{y(",current=>"),c(e.query)},(e,t)=>(y(")"),e+"("+t+",")),y(")");break;case"GetProperty":y("f.map("),c(e.value),y(","),"Identifier"===e.property.type?y(JSON.stringify(e.property.name)):c(e.property),y(")");break;case"SliceNotation":y("f.slice("),c(e.value),e.arguments.slice(0,3).forEach(e=>{y(","),e?c(e):y("undefined")}),y(")");break;case"Pipeline":y("(current=>("),c(e.right),y("))("),c(e.left),y(")")}t&&y(")")}const u=["data","context","ctx","array","idx","index"];let h=[],l=!1;const p=["const current=data;","return "],y=e=>p.push(e),g=(e,t)=>{e.forEach((e,r)=>{r>0&&y(t),c(e)})},f=t.reduce((e,t)=>("current"===t[3]&&(e.has(t[4])?e.get(t[4]).push(t):e.set(t[4],[t])),e),new Map),d=t.reduce((e,t)=>(t[3]&&"current"!==t[3]&&(e.has(t[3])?e.get(t[3]).push(t):e.set(t[3],[t])),e),new Map);let b=0;const m=[];a(()=>c(e),(e,t)=>(y(")"),e+"("+t+",")),l&&p.unshift("let tmp;"),r&&(b>0&&(p.unshift("const "+Array.from(Array(b),(e,t)=>"v"+t+"=new Set()")+";\n"),p.unshift("const stat=(values,v)=>(values.add(v),v);\n")),y("\n,["+m.map(e=>"["+e+"]")+"]"));try{return new Function("f","m","data","context",p.join(""))}catch(e){throw console.error("Query compile error:",p.join("")),e}};const u=Object.prototype.toString;var h={addToSet:function(e,t){return void 0!==t&&(Array.isArray(t)?t.forEach(t=>e.add(t)):e.add(t)),e},getPropertyValue:function(e,t){return e&&hasOwnProperty.call(e,t)?e[t]:void 0},isPlainObject:function(e){return e&&"object"==typeof e&&e.constructor===Object},isRegExp:function(e){return"[object RegExp]"===u.call(e)},isArrayLike:function(e){return e&&hasOwnProperty.call(e,"length")}};const{addToSet:l,getPropertyValue:p,isPlainObject:y,isRegExp:g,isArrayLike:f}=h;var d=Object.freeze({bool:function(e){if(Array.isArray(e))return e.length>0;if(y(e)){for(const t in e)if(hasOwnProperty.call(e,t))return!0;return!1}return Boolean(e)},add:function(e,t){return Array.isArray(e)||Array.isArray(t)?[...new Set([].concat(e,t))]:e+t},sub:function(e,t){if(Array.isArray(e)){const r=new Set(e);return Array.isArray(t)?t.forEach(e=>r.delete(e)):r.delete(t),[...r]}return e-t},mul:function(e,t){return e*t},div:function(e,t){return e/t},mod:function(e,t){return e%t},eq:function(e,t){return e===t},ne:function(e,t){return e!==t},lt:function(e,t){return e<t},lte:function(e,t){return e<=t},gt:function(e,t){return e>t},gte:function(e,t){return e>=t},in:function(e,t){return y(t)?hasOwnProperty.call(t,e):!(!t||"function"!=typeof t.indexOf)&&-1!==t.indexOf(e)},cmp:function(e,t){return e>t?1:e<t?-1:0},match:function(e,t){return"function"==typeof t?this.filter(e,t):g(t)?this.filter(e,t.test.bind(t)):null==t},map:function(e,t){const r="function"==typeof t?t:e=>p(e,t);return Array.isArray(e)?[...e.reduce((e,t)=>l(e,r(t)),new Set)]:void 0!==e?r(e):e},slice:function(e,t=0,r=e&&e.length,n=1){if(!f(e))return[];if(t=parseInt(t,10)||0,r=parseInt(r,10)||e.length,1!==(n=parseInt(n,10)||1)){const s=[];t=t<0?Math.max(0,e.length+t):Math.min(e.length,t),r=r<0?Math.max(0,e.length+r):Math.min(e.length,r);for(let a=n>0?t:r-1;a>=t&&a<r;a+=n)s.push(e[a]);return s}return"string"==typeof e?e.slice(t,r):Array.prototype.slice.call(e,t,r)},recursive:function(e,t){const r=new Set;return l(r,this.map(e,t)),r.forEach(e=>l(r,this.map(e,t))),[...r]},filter:function(e,t){return Array.isArray(e)?e.filter(e=>this.bool(t(e))):this.bool(t(e))?e:void 0}});const{addToSet:b,isPlainObject:m}=h;function k(){}function v(e){return e}function _(e){return{matched:e.slice(),start:e.index,end:e.index+e[0].length,input:e.input,groups:e.groups||null}}var $=Object.freeze({bool:d.bool,filter:d.filter,map:d.map,keys:function(e){return Object.keys(e||{})},values:function(e){const t=new Set;for(const r in e)hasOwnProperty.call(e,r)&&b(t,e[r]);return[...t]},entries:function(e){const t=[];for(const r in e)hasOwnProperty.call(e,r)&&t.push({key:r,value:e[r]});return t},fromEntries:function(e){const t={};return Array.isArray(e)&&e.forEach(e=>{e&&(t[e.key]=e.value)}),t},pick:function(e,t){if(e){if("function"!=typeof t)return Array.isArray(e)?e[t||0]:e[t];if(Array.isArray(e))return e.find(e=>t(e));for(const r in e)if(hasOwnProperty.call(e,r)&&t(e[r]))return{key:r,value:e[r]}}},mapToArray:function(e,t="key",r){const n=[];for(const s in e)hasOwnProperty.call(e,s)&&n.push(r?{[t]:s,[r]:e[s]}:{[t]:s,...e[s]});return n},size:function(e){return m(e)?Object.keys(e).length:e&&e.length||0},sort:function(e,t){let r;return Array.isArray(e)?("function"==typeof t&&(r=2===t.length?t:(e,r)=>{if(e=t(e),r=t(r),Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return e.length<r.length?-1:1;for(let t=0;t<e.length;t++){if(e[t]<r[t])return-1;if(e[t]>r[t])return 1}return 0}return e<r?-1:e>r}),e.slice().sort(r)):e},reverse:function(e){return Array.isArray(e)?e.slice().reverse():e},slice:function(e,t,r){return d.slice(e,t,r)},group:function(e,t,r){"function"!=typeof t&&(t=k),"function"!=typeof r&&(r=v),Array.isArray(e)||(e=[e]);const n=new Map,s=[];return e.forEach(e=>{let s=t(e);Array.isArray(s)||(s=[s]),s.forEach(t=>{n.has(t)?n.get(t).add(r(e)):n.set(t,new Set([r(e)]))})}),n.forEach((e,t)=>s.push({key:t,value:[...e]})),s},split:function(e,t){return String(e).split(t)},join:function(e,t){return Array.isArray(e)?e.join(t):String(e)},match:function(e,t,r){const n=String(e);if(r){const e=[];let r,s=new RegExp(t,t.flags+"g");for(;r=s.exec(n);)e.push(_(r));return e}const s=String(e).match(t);return s&&_(s)}});const{addToSet:O,isPlainObject:S}=h,A={path:"property",value:"value","in-value":"value",var:"variable"};function R(e,t,r,n){const s=[];for(let a=0;a<r.length;a++){const[i,o,c]=r[a];for(let r=0;r<o.length;r+=2){let a=o[r],u=o[r+1];if(t>=a&&t<=u&&(n||i.size||i.length)){let r=e.substring(a,u);/\S/.test(r)||(r="",a=u=t),s.push({context:c,current:r,from:a,to:u,values:i})}}}return s}var x=(e,t)=>({stat(r,n){const s=R(e,r,t,n);return s.forEach(e=>{e.values=[...e.values]}),s.length?s:null},suggestion(r,n){const s=R(e,r,t,n),a=[];return s.forEach(e=>{const{context:t,current:r,from:n,to:s,values:i}=e;a.push(...function(e,t){const r=new Set,n=e=>{switch(typeof e){case"string":r.add(JSON.stringify(e));break;case"number":r.add(String(e))}};switch(e){case"":case"path":t.forEach(e=>{Array.isArray(e)?e.forEach(e=>{S(e)&&O(r,Object.keys(e))}):S(e)&&O(r,Object.keys(e))});break;case"value":t.forEach(e=>{Array.isArray(e)?e.forEach(n):n(e)});break;case"in-value":t.forEach(e=>{Array.isArray(e)?e.forEach(n):S(e)?Object.keys(e).forEach(n):n(e)});break;case"var":t.forEach(e=>{r.add("$"+e)})}return[...r]}(t,i).map(e=>({current:r,type:A[t],value:e,from:n,to:s})))}),a.length?a:null}});var C,w=(C=t)&&C.default||C;const{version:E}=w,P=new Map,N=new Map,I=new Map,T=new Map;function j(e,t){console.log(`[${e}]`),"string"==typeof t?console.log(t):void 0!==t&&console.dir(t,{depth:null}),console.log()}return Object.assign((function(e,t){t=t||{};const n=Boolean(t.stat),s=Boolean(t.tolerant),i=t.methods?{...$,...t.methods}:$,o=n?s?T:N:s?I:P;let u;return e=String(e),o.has(e)?u=o.get(e):(u=function(e,t,n,s){(s="function"==typeof s?s:!!Boolean(s)&&j)&&(s("========================="),s("Compile query from source",e));const i=r(e,n);if(s){const t=e=>JSON.stringify(e).slice(1,-1);s("AST",i.ast),s("Restored source",a(i.ast)),s("Suggest ranges",i.suggestRanges.sort((e,t)=>e[0]-t[0]).map(r=>{const n=t(e.slice(0,r[0])).length,s=t(e.substring(r[0],r[1])).length;return t(e)+"\n"+(" ".repeat(n)+(s?"~".repeat(s):"\\"))+" "+r[0]+":"+r[1]+" ["+r[2]+"] from "+r[3]}).join("\n"))}const o=t?c(i.ast,i.suggestRanges,t):c(i.ast);return s&&s("Function",o.toString()),o}(e,n,s,t.debug),o.set(e,u)),n?(t,r)=>x(e,u(d,i,t,r)):(e,t)=>u(d,i,e,t)}),{version:E,buildin:d,methods:$,syntax:{parse:r,stringify:a,compile:c}})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).jora=t()}(this,(function(){"use strict";var e={version:"1.0.0-beta.1"},t=Object.freeze({__proto__:null,version:"1.0.0-beta.1",default:e}),r=function(){var e=function(e,t,r,n){for(r=r||{},n=e.length;n--;r[e[n]]=t);return r},t=[2,5],r=[1,13],n=[1,38],i=[1,18],a=[1,7],s=[1,8],o=[1,10],l=[1,11],u=[1,12],c=[1,19],p=[1,20],h=[1,21],y=[1,22],g=[1,23],d=[1,24],f=[1,25],m=[1,28],b=[1,31],v=[1,32],k=[1,33],_=[1,34],$=[1,35],O=[1,36],S=[1,37],N=[5,18,55,58],w=[1,42],E=[1,50],A=[1,49],x=[1,43],R=[1,44],I=[1,45],P=[1,46],C=[1,47],T=[1,48],q=[1,51],j=[1,52],M=[1,53],D=[1,54],F=[1,55],L=[1,56],U=[1,57],B=[1,58],G=[1,59],Y=[1,60],z=[1,61],H=[5,9,14,15,17,18,19,22,23,24,44,45,46,47,48,49,50,53,55,57,58,59,60,61,62,63,66],J=[5,10,11,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,55,58,65,67],Z=[1,62],Q=[1,63],V=[1,64],X=[1,65],W=[1,66],K=[1,67],ee=[1,68],te=[1,71],re=[5,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,53,55,58,59,60,61,62,63,65,67,74],ne=[2,46],ie=[2,48],ae=[1,81],se=[5,10,11,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,53,55,58,59,60,61,62,63,65,67,74],oe=[5,10,11,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,53,55,57,58,59,60,61,62,63,65,67,74],le=[1,88],ue=[1,89],ce=[1,90],pe=[1,105],he=[1,107],ye=[1,108],ge=[1,109],de=[1,110],fe=[1,111],me=[5,10,11,18,21,55,58,65,67],be=[5,10,11,18,21,29,30,41,55,58,65,67],ve=[5,10,11,18,21,23,24,25,26,27,28,29,30,34,35,36,37,38,39,40,41,55,58,65,67],ke=[55,65],_e=[2,99],$e=[11,55],Oe=[65,67],Se=[5,10,11,18,21,25,26,27,28,29,30,41,55,58,65,67],Ne=[5,10,11,18,21,25,26,27,28,29,30,34,35,40,41,55,58,65,67],we=[5,10,11,18,21,25,26,27,28,29,30,34,35,36,37,38,39,40,41,55,58,65,67],Ee=[1,183],Ae=[58,65],xe={trace:function(){},yy:{},symbols_:{error:2,root:3,block:4,EOF:5,definitions:6,e:7,def:8,$:9,";":10,":":11,$ident:12,ident:13,IDENT:14,$IDENT:15,query:16,FUNCTION_START:17,FUNCTION_END:18,FUNCTION:19,sortingCompareList:20,"|":21,NOT:22,"-":23,"+":24,IN:25,HAS:26,NOTIN:27,HASNO:28,AND:29,OR:30,"*":31,"/":32,"%":33,"=":34,"!=":35,"<":36,"<=":37,">":38,">=":39,"~=":40,"?":41,queryRoot:42,relativePath:43,"@":44,"#":45,$$:46,STRING:47,NUMBER:48,REGEXP:49,LITERAL:50,object:51,array:52,"[":53,sliceNotation:54,"]":55,"method()":56,"(":57,")":58,".":59,".(":60,".[":61,"..":62,"..(":63,arguments:64,",":65,"{":66,"}":67,properties:68,property:69,"...":70,arrayElements:71,arrayElement:72,sortingCompare:73,ORDER:74,sliceNotationComponent:75,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",9:"$",10:";",11:":",14:"IDENT",15:"$IDENT",17:"FUNCTION_START",18:"FUNCTION_END",19:"FUNCTION",21:"|",22:"NOT",23:"-",24:"+",25:"IN",26:"HAS",27:"NOTIN",28:"HASNO",29:"AND",30:"OR",31:"*",32:"/",33:"%",34:"=",35:"!=",36:"<",37:"<=",38:">",39:">=",40:"~=",41:"?",44:"@",45:"#",46:"$$",47:"STRING",48:"NUMBER",49:"REGEXP",50:"LITERAL",53:"[",55:"]",57:"(",58:")",59:".",60:".(",61:".[",62:"..",63:"..(",65:",",66:"{",67:"}",70:"...",74:"ORDER"},productions_:[0,[3,2],[4,2],[4,1],[4,1],[4,0],[6,1],[6,2],[8,2],[8,4],[8,2],[8,4],[13,1],[12,1],[7,1],[7,3],[7,2],[7,1],[7,3],[7,4],[7,2],[7,2],[7,2],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,3],[7,5],[16,1],[16,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,3],[42,1],[42,1],[42,3],[42,4],[42,2],[42,2],[42,3],[42,3],[42,2],[42,2],[42,3],[43,3],[43,4],[43,4],[43,3],[43,3],[43,4],[43,4],[43,3],[43,3],[43,4],[56,3],[56,4],[56,3],[56,4],[64,1],[64,3],[51,2],[51,3],[68,1],[68,3],[69,1],[69,1],[69,1],[69,3],[69,3],[69,3],[69,3],[69,5],[69,1],[69,2],[71,1],[71,3],[72,1],[72,1],[72,2],[52,2],[52,3],[20,1],[20,3],[73,2],[54,1],[54,2],[54,2],[54,3],[75,1],[75,2]],performAction:function(e,t,r,n,i,a,s){var o=a.length-1;switch(i){case 1:return n.buildResult(a[o-1]);case 2:this.$={type:"Block",definitions:a[o-1],body:a[o],range:this._$.range};break;case 3:this.$={type:"Block",definitions:a[o],body:null,range:this._$.range};break;case 4:this.$={type:"Block",definitions:[],body:a[o],range:this._$.range};break;case 5:this.$={type:"Block",definitions:[],body:null,range:this._$.range};break;case 6:case 81:case 85:case 97:case 104:this.$=[a[o]];break;case 7:a[o-1].push(a[o]);break;case 8:this.$={type:"Definition",declarator:{type:"Declarator",name:null,range:s[o-1].range},value:null,range:this._$.range};break;case 9:this.$={type:"Definition",declarator:{type:"Declarator",name:null,range:s[o-3].range},value:a[o-1],range:this._$.range};break;case 10:this.$={type:"Definition",declarator:{type:"Declarator",name:a[o-1].name,range:s[o-1].range},value:null,range:this._$.range};break;case 11:this.$={type:"Definition",declarator:{type:"Declarator",name:a[o-3].name,range:s[o-3].range},value:a[o-1],range:this._$.range};break;case 12:case 13:this.$={type:"Identifier",name:a[o],range:this._$.range};break;case 14:case 42:case 43:case 53:case 54:case 99:break;case 15:this.$={type:"Function",arguments:[],body:a[o-1],legacy:!0,range:this._$.range};break;case 16:this.$={type:"Function",arguments:[],body:a[o],legacy:!1,range:this._$.range};break;case 17:this.$={type:"SortingFunction",compares:a[o],range:this._$.range};break;case 18:this.$={type:"Pipeline",left:a[o-2],right:a[o],range:this._$.range};break;case 19:this.$={type:"Pipeline",left:a[o-3],right:{type:"Block",definitions:a[o-1],body:a[o]},range:this._$.range};break;case 20:case 21:case 22:this.$={type:"Unary",operator:a[o-1],argument:a[o],range:this._$.range};break;case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range};break;case 41:this.$={type:"Conditional",test:a[o-4],consequent:a[o-2],alternate:a[o],range:this._$.range};break;case 44:this.$={type:"Data",range:this._$.range};break;case 45:this.$={type:"Context",range:this._$.range};break;case 46:this.$={type:"Current",range:this._$.range};break;case 47:this.$={type:"Arg1",range:this._$.range};break;case 48:this.$={type:"Reference",name:a[o],range:this._$.range};break;case 49:case 50:case 51:case 52:this.$={type:"Literal",value:a[o],range:this._$.range};break;case 55:this.$={type:"SliceNotation",value:null,arguments:a[o-1],range:this._$.range};break;case 56:case 60:this.$={type:"GetProperty",value:null,property:a[o],range:this._$.range};break;case 57:case 61:this.$={type:"MethodCall",value:null,method:a[o],range:this._$.range};break;case 58:this.$={type:"Parentheses",body:a[o-1],range:this._$.range};break;case 59:this.$={type:"Parentheses",body:{type:"Block",definitions:a[o-2],body:a[o-1]},range:this._$.range};break;case 62:this.$={type:"Map",value:null,query:a[o-1],range:this._$.range};break;case 63:this.$={type:"Filter",value:null,query:a[o-1],range:this._$.range};break;case 64:this.$={type:"Recursive",value:null,query:{type:"GetProperty",value:null,property:a[o]},range:this._$.range};break;case 65:this.$={type:"Recursive",value:null,query:{type:"MethodCall",value:null,method:a[o]},range:this._$.range};break;case 66:this.$={type:"Recursive",value:null,query:a[o-1],range:this._$.range};break;case 67:this.$={type:"Pick",value:a[o-2],getter:null,range:this._$.range};break;case 68:this.$={type:"Pick",value:a[o-3],getter:a[o-1],range:this._$.range};break;case 69:this.$={type:"SliceNotation",value:a[o-3],arguments:a[o-1],range:this._$.range};break;case 70:this.$={type:"GetProperty",value:a[o-2],property:a[o],range:this._$.range};break;case 71:this.$={type:"MethodCall",value:a[o-2],method:a[o],range:this._$.range};break;case 72:this.$={type:"Map",value:a[o-3],query:a[o-1],range:this._$.range};break;case 73:this.$={type:"Filter",value:a[o-3],query:a[o-1],range:this._$.range};break;case 74:this.$={type:"Recursive",value:a[o-2],query:{type:"GetProperty",value:null,property:a[o]},range:this._$.range};break;case 75:this.$={type:"Recursive",value:a[o-2],query:{type:"MethodCall",value:null,method:a[o]},range:this._$.range};break;case 76:this.$={type:"Recursive",value:a[o-3],query:a[o-1],range:this._$.range};break;case 77:this.$={type:"Method",reference:a[o-2],arguments:[],range:this._$.range};break;case 78:this.$={type:"Method",reference:a[o-3],arguments:a[o-1],range:this._$.range};break;case 79:this.$={type:"Method",reference:{type:"Reference",name:a[o-2]},arguments:[],range:this._$.range};break;case 80:this.$={type:"Method",reference:{type:"Reference",name:a[o-3]},arguments:a[o-1],range:this._$.range};break;case 82:case 86:case 98:case 105:a[o-2].push(a[o]);break;case 83:this.$={type:"Object",properties:[],range:this._$.range};break;case 84:this.$={type:"Object",properties:a[o-1],range:this._$.range};break;case 87:this.$={type:"Property",key:a[o],value:null,range:this._$.range};break;case 88:this.$={type:"Property",key:{type:"Current"},value:null,range:this._$.range};break;case 89:this.$={type:"Property",key:{type:"Reference",name:a[o]},value:null,range:this._$.range};break;case 90:this.$={type:"Property",key:a[o-2],value:a[o],range:this._$.range};break;case 91:case 92:case 93:this.$={type:"Property",key:{type:"Literal",value:a[o-2]},value:a[o],range:this._$.range};break;case 94:this.$={type:"Property",key:a[o-3],value:a[o],range:this._$.range};break;case 95:this.$={type:"Spread",query:null,array:!1,range:this._$.range};break;case 96:this.$={type:"Spread",query:a[o],array:!1,range:this._$.range};break;case 100:this.$={type:"Spread",query:null,array:!0,range:this._$.range};break;case 101:this.$={type:"Spread",query:a[o],array:!0,range:this._$.range};break;case 102:this.$={type:"Array",elements:[],range:this._$.range};break;case 103:this.$={type:"Array",elements:a[o-1],range:this._$.range};break;case 106:this.$={type:"Compare",query:a[o-1],order:a[o],range:this._$.range};break;case 107:this.$=[null,a[o]];break;case 108:this.$=[null,a[o-1],a[o]];break;case 109:this.$=[a[o-1],a[o]];break;case 110:this.$=[a[o-2],a[o-1],a[o]];break;case 111:this.$=null;break;case 112:this.$=a[o]}},table:[{3:1,4:2,5:t,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{1:[3]},{5:[1,39]},e(N,[2,3],{16:6,20:9,12:14,42:15,43:16,73:17,51:26,52:27,13:29,56:30,7:40,8:41,9:r,14:n,15:i,17:a,19:s,22:o,23:l,24:u,44:c,45:p,46:h,47:y,48:g,49:d,50:f,53:m,57:b,59:v,60:k,61:_,62:$,63:O,66:S}),e(N,[2,4],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(H,[2,6]),e(J,[2,14],{53:Z,59:Q,60:V,61:X,62:W,63:K,74:ee}),{4:69,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,18:t,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:70,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e([5,10,11,18,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,55,58,67],[2,17],{65:[1,73]}),{7:74,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:75,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:76,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(re,ne,{10:[1,77],11:[1,78]}),e(re,ie,{10:[1,79],11:[1,80],57:ae}),e(se,[2,42]),e(se,[2,43]),e(J,[2,104]),e(oe,[2,13]),e(se,[2,44]),e(se,[2,45]),e(se,[2,47]),e(se,[2,49]),e(se,[2,50]),e(se,[2,51]),e(se,[2,52]),e(se,[2,53]),e(se,[2,54]),{7:86,9:te,11:le,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,54:82,55:[1,83],56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,70:ue,71:84,72:87,73:17,75:85},e(se,[2,56],{57:ce}),e(se,[2,57]),{6:92,7:91,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{12:95,13:93,14:n,15:i,56:94},{4:96,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,58:t,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{4:97,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,55:t,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{12:95,13:98,14:n,15:i,56:99},{4:100,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,58:t,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{9:pe,12:106,13:104,14:n,15:i,47:he,48:ye,50:ge,53:de,67:[1,101],68:102,69:103,70:fe},e(oe,[2,12]),{1:[2,1]},e(N,[2,2],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(H,[2,7]),{6:113,7:112,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:114,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:115,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:116,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:117,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:118,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:119,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:120,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:121,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:122,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:123,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:124,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:125,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:126,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:127,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:128,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:129,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:130,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:131,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:132,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:134,9:te,11:le,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,54:135,55:[1,133],56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17,75:85},{12:95,13:136,14:n,15:i,56:137},{4:138,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,58:t,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{4:139,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,55:t,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{12:95,13:140,14:n,15:i,56:141},{4:142,6:3,7:4,8:5,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,58:t,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(J,[2,106]),{18:[1,143]},e(me,[2,16],{23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(se,ne),e(se,ie,{57:ae}),{9:te,12:72,13:29,14:n,15:i,16:145,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:144},e(be,[2,20],{23:E,24:A,25:x,26:R,27:I,28:P,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y}),e(ve,[2,21],{31:q,32:j,33:M}),e(ve,[2,22],{31:q,32:j,33:M}),e(H,[2,8]),{7:146,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(H,[2,10]),{7:147,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:150,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,58:[1,148],59:v,60:k,61:_,62:$,63:O,64:149,66:S,73:17},{55:[1,151]},e(se,[2,102]),{55:[1,152],65:[1,153]},{11:le,55:[2,107],75:154},e(ke,_e,{75:155,11:le,21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(ke,[2,97]),e($e,[2,111],{16:6,20:9,42:15,43:16,73:17,51:26,52:27,13:29,56:30,12:72,7:156,9:te,14:n,15:i,17:a,19:s,22:o,23:l,24:u,44:c,45:p,46:h,47:y,48:g,49:d,50:f,53:m,57:b,59:v,60:k,61:_,62:$,63:O,66:S}),e(ke,[2,100],{16:6,20:9,42:15,43:16,73:17,51:26,52:27,13:29,56:30,12:72,7:157,9:te,14:n,15:i,17:a,19:s,22:o,23:l,24:u,44:c,45:p,46:h,47:y,48:g,49:d,50:f,53:m,57:b,59:v,60:k,61:_,62:$,63:O,66:S}),{7:150,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,58:[1,158],59:v,60:k,61:_,62:$,63:O,64:159,66:S,73:17},{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z,58:[1,160]},{7:161,8:41,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(se,[2,60],{57:ce}),e(se,[2,61]),{57:ae},{58:[1,162]},{55:[1,163]},e(se,[2,64],{57:ce}),e(se,[2,65]),{58:[1,164]},e(se,[2,83]),{65:[1,166],67:[1,165]},e(Oe,[2,85]),e(Oe,[2,87],{11:[1,167]}),e(Oe,[2,88]),e(Oe,[2,89]),{11:[1,168]},{11:[1,169]},{11:[1,170]},{7:171,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(Oe,[2,95],{42:15,43:16,51:26,52:27,13:29,56:30,12:72,16:172,9:te,14:n,15:i,44:c,45:p,46:h,47:y,48:g,49:d,50:f,53:m,57:b,59:v,60:k,61:_,62:$,63:O,66:S}),e(me,[2,18],{23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),{7:173,8:41,9:r,12:14,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(Se,[2,23],{23:E,24:A,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y}),e(Se,[2,24],{23:E,24:A,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y}),e(Se,[2,25],{23:E,24:A,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y}),e(Se,[2,26],{23:E,24:A,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y}),e(be,[2,27],{23:E,24:A,25:x,26:R,27:I,28:P,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y}),e([5,10,11,18,21,30,41,55,58,65,67],[2,28],{23:E,24:A,25:x,26:R,27:I,28:P,29:C,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y}),e(ve,[2,29],{31:q,32:j,33:M}),e(ve,[2,30],{31:q,32:j,33:M}),e(J,[2,31]),e(J,[2,32]),e(J,[2,33]),e(Ne,[2,34],{23:E,24:A,31:q,32:j,33:M,36:L,37:U,38:B,39:G}),e(Ne,[2,35],{23:E,24:A,31:q,32:j,33:M,36:L,37:U,38:B,39:G}),e(we,[2,36],{23:E,24:A,31:q,32:j,33:M}),e(we,[2,37],{23:E,24:A,31:q,32:j,33:M}),e(we,[2,38],{23:E,24:A,31:q,32:j,33:M}),e(we,[2,39],{23:E,24:A,31:q,32:j,33:M}),e(Ne,[2,40],{23:E,24:A,31:q,32:j,33:M,36:L,37:U,38:B,39:G}),{11:[1,174],21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z},e(se,[2,67]),{11:le,21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z,55:[1,175],75:155},{55:[1,176]},e(se,[2,70],{57:ce}),e(se,[2,71]),{58:[1,177]},{55:[1,178]},e(se,[2,74],{57:ce}),e(se,[2,75]),{58:[1,179]},e(J,[2,15]),e(J,[2,105]),{53:Z,59:Q,60:V,61:X,62:W,63:K,74:ee},{10:[1,180],21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z},{10:[1,181],21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z},e(se,[2,79]),{58:[1,182],65:Ee},e(Ae,[2,81],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(se,[2,55]),e(se,[2,103]),{7:185,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,70:ue,72:184,73:17},{55:[2,108]},{11:le,55:[2,109],75:186},e($e,[2,112],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(ke,[2,101],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(se,[2,77]),{58:[1,187],65:Ee},e(se,[2,58]),{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z,58:[1,188]},e(se,[2,62]),e(se,[2,63]),e(se,[2,66]),e(se,[2,84]),{9:pe,12:106,13:104,14:n,15:i,47:he,48:ye,50:ge,53:de,69:189,70:fe},{7:190,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:191,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:192,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{7:193,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z,55:[1,194]},e(Oe,[2,96],{53:Z,59:Q,60:V,61:X,62:W,63:K}),e(me,[2,19],{23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),{7:195,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(se,[2,68]),e(se,[2,69]),e(se,[2,72]),e(se,[2,73]),e(se,[2,76]),e(H,[2,9]),e(H,[2,11]),e(se,[2,80]),{7:196,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(ke,[2,98]),e(ke,_e,{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),{55:[2,110]},e(se,[2,78]),e(se,[2,59]),e(Oe,[2,86]),e(Oe,[2,90],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(Oe,[2,91],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(Oe,[2,92],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(Oe,[2,93],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),{11:[1,197]},e(me,[2,41],{23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),e(Ae,[2,82],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z}),{7:198,9:te,12:72,13:29,14:n,15:i,16:6,17:a,19:s,20:9,22:o,23:l,24:u,42:15,43:16,44:c,45:p,46:h,47:y,48:g,49:d,50:f,51:26,52:27,53:m,56:30,57:b,59:v,60:k,61:_,62:$,63:O,66:S,73:17},e(Oe,[2,94],{21:w,23:E,24:A,25:x,26:R,27:I,28:P,29:C,30:T,31:q,32:j,33:M,34:D,35:F,36:L,37:U,38:B,39:G,40:Y,41:z})],defaultActions:{39:[2,1],154:[2,108],186:[2,110]},parseError:function(e,t){if(!t.recoverable){var r=new Error(e);throw r.hash=t,r}this.trace(e)},parse:function(e){var t=this,r=[0],n=[null],i=[],a=this.table,s="",o=0,l=0,u=2,c=1,p=i.slice.call(arguments,1),h=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);h.setInput(e,y.yy),y.yy.lexer=h,y.yy.parser=this,void 0===h.yylloc&&(h.yylloc={});var d=h.yylloc;i.push(d);var f=h.options&&h.options.ranges;"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,v,k,_,$,O,S,N=function(){var e;return"number"!=typeof(e=h.lex()||c)&&(e=t.symbols_[e]||e),e},w={};;){if(b=r[r.length-1],this.defaultActions[b]?v=this.defaultActions[b]:(null==m&&(m=N()),v=a[b]&&a[b][m]),void 0===v||!v.length||!v[0]){var E="";for(_ in S=[],a[b])this.terminals_[_]&&_>u&&S.push("'"+this.terminals_[_]+"'");E=h.showPosition?"Parse error on line "+(o+1)+":\n"+h.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(o+1)+": Unexpected "+(m==c?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(E,{text:h.match,token:this.terminals_[m]||m,line:h.yylineno,loc:d,expected:S})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(v[0]){case 1:r.push(m),n.push(h.yytext),i.push(h.yylloc),r.push(v[1]),m=null,l=h.yyleng,s=h.yytext,o=h.yylineno,d=h.yylloc;break;case 2:if($=this.productions_[v[1]][1],w.$=n[n.length-$],w._$={first_line:i[i.length-($||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-($||1)].first_column,last_column:i[i.length-1].last_column},f&&(w._$.range=[i[i.length-($||1)].range[0],i[i.length-1].range[1]]),void 0!==(k=this.performAction.apply(w,[s,l,o,y.yy,v[1],n,i].concat(p))))return k;$&&(r=r.slice(0,-1*$*2),n=n.slice(0,-1*$),i=i.slice(0,-1*$)),r.push(this.productions_[v[1]][0]),n.push(w.$),i.push(w._$),O=a[r[r.length-2]][r[r.length-1]],r.push(O);break;case 3:return!0}}return!0}},Re={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,n,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(n=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,r,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((r=this._input.match(this.rules[i[a]]))&&(!t||r[0].length>t[0].length)){if(t=r,n=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,i[a])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{ranges:!0},performAction:function(e,t,r,n){switch(r){case 0:e.commentRanges.push(t.yylloc.range);break;case 1:break;case 2:return this.popState(),"/";case 3:return this.popState(),"<";case 4:this.done=!1,this.popState();break;case 5:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"(";case 6:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),")";case 7:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"[";case 8:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"]";case 9:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"{";case 10:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"}";case 11:return t.yytext=this.toLiteral(t.yytext),"LITERAL";case 12:return"AND";case 13:return"OR";case 14:return"HASNO";case 15:return"HAS";case 16:return"IN";case 17:return"NOTIN";case 18:return"NOT";case 19:return"ORDER";case 20:return this._input&&this.begin("preventPrimitive"),t.yytext=Number(t.yytext),"NUMBER";case 21:case 22:return this._input&&this.begin("preventPrimitive"),t.yytext=this.toStringLiteral(t.yytext),"STRING";case 23:return this._input&&this.begin("preventPrimitive"),t.yytext=this.toRegExp(t.yytext),"REGEXP";case 24:return this._input&&this.begin("preventPrimitive"),"IDENT";case 25:return this._input&&this.begin("preventPrimitive"),t.yytext=t.yytext.slice(1),"$IDENT";case 26:return this._input&&this.begin("preventPrimitive"),"@";case 27:return this._input&&this.begin("preventPrimitive"),"#";case 28:return this._input&&this.begin("preventPrimitive"),"$$";case 29:return this._input&&this.begin("preventPrimitive"),"$";case 30:return"FUNCTION";case 31:return this.fnOpened++,"FUNCTION_START";case 32:return"=";case 33:return"!=";case 34:return"~=";case 35:return">=";case 36:return"<=";case 37:return"<";case 38:return this.fnOpened?(this.fnOpened--,"FUNCTION_END"):">";case 39:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"..(";case 40:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".(";case 41:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".[";case 42:return"...";case 43:return this._input&&this.begin("preventPrimitive"),"..";case 44:return this._input&&this.begin("preventPrimitive"),".";case 45:return"?";case 46:return",";case 47:return":";case 48:return";";case 49:return"-";case 50:return"+";case 51:return"*";case 52:return"/";case 53:return"%";case 54:return"|";case 55:return"EOF"}},rules:[/^(?:(\/\/.*?(\r|\n|$)))/,/^(?:(\s+))/,/^(?:\/)/,/^(?:<(?!=))/,/^(?:)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:(true|false|null|undefined)(\b))/,/^(?:and(\b))/,/^(?:or(\b))/,/^(?:has(\s+)no(\b))/,/^(?:has(\b))/,/^(?:in(\b))/,/^(?:not(\s+)in(\b))/,/^(?:not?(\b))/,/^(?:(asc|desc)(\b))/,/^(?:(\d+\.|\.)?\d+([eE][-+]?\d+)?(\b))/,/^(?:"(?:\\.|[^"])*")/,/^(?:'(?:\\.|[^'])*')/,/^(?:(\/(?:\\.|[^/])+\/i?))/,/^(?:([a-zA-Z_][a-zA-Z_$0-9]*))/,/^(?:\$([a-zA-Z_][a-zA-Z_$0-9]*))/,/^(?:@)/,/^(?:#)/,/^(?:\${2})/,/^(?:\$)/,/^(?:=>)/,/^(?:<(?!=))/,/^(?:=)/,/^(?:!=)/,/^(?:~=)/,/^(?:>=)/,/^(?:<=)/,/^(?:<)/,/^(?:>)/,/^(?:\.\.\()/,/^(?:\.\()/,/^(?:\.\[)/,/^(?:\.\.\.)/,/^(?:\.\.)/,/^(?:\.)/,/^(?:\?)/,/^(?:,)/,/^(?::)/,/^(?:;)/,/^(?:\-)/,/^(?:\+)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:\|)/,/^(?:$)/],conditions:{preventPrimitive:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55],inclusive:!0},INITIAL:{rules:[0,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55],inclusive:!0}}};function Ie(){this.yy={}}return xe.lexer=Re,Ie.prototype=xe,xe.Parser=Ie,function e(t){function r(e,t){Object.entries(t).forEach(([t,r])=>e[t]=r(e[t]))}const n=new Map([["EOF",["<end of input>"]],["IDENT",["ident"]],["$IDENT",["$ident"]],["FUNCTION_START",["'<'"]],["FUNCTION_END",["'>'"]],["FUNCTION",["'=>'"]],["NOT",["'not'"]],["IN",["'in'"]],["HAS",["'has'"]],["NOTIN",["'not in'"]],["HASNO",["'has no'"]],["AND",["'and'"]],["OR",["'or'"]],["STRING",["string"]],["NUMBER",["number"]],["REGEXP",["regexp"]],["LITERAL",["'true'","'false'","'null'","'undefined'"]],["ORDER",["'asc'","'desc'"]]]),i=e=>n.get(e)||`'${e}'`,a=function(e,t,r){if(!t.recoverable){const e=r.lexer.yylloc,n=[].concat(...t.expected.map(e=>i(e.slice(1,-1)))),a=new SyntaxError(["Parse error on line "+(e.first_line+1)+":","",r.lexer.showPosition(),"","Expecting "+n.join(", ")+" got "+i(t.token)].join("\n"));throw a.details={text:t.text,token:t.token,expected:n,loc:{range:e.range,start:{line:e.first_line,column:e.first_column,offset:e.range[0]},end:{line:e.last_line,column:e.last_column,offset:e.range[1]}}},a}this.trace(e)};Object.assign(t.lexer,{toLiteral:e=>"null"===e?null:"false"!==e&&("true"===e||void 0),toStringLiteral:e=>JSON.parse("'"===e[0]?e.replace(/\\?"/g,'\\"').replace(/\\([^"uU])/g,"$1").replace(/^\'|\'$/g,'"'):e),toRegExp:e=>new RegExp(e.substr(1,e.lastIndexOf("/")-1),e.substr(e.lastIndexOf("/")+1))}),r(t.lexer,{setInput:e=>function(t,r){const n=[];return r.commentRanges=n,r.buildResult=e=>({ast:e,commentRanges:n}),r.parseError=function(...e){return a.call(this,...e,r)},this.fnOpened=0,this.fnOpenedStack=[],this.prevToken=null,this.prevYylloc={first_line:1,last_line:1,first_column:0,last_column:0,range:[0,0]},e.call(this,t,r)}});const s=new t.Parser;s.lexer={...t.lexer},s.yy={...t.yy};const o=["AND","OR","IN","NOTIN","HAS","HASNO"],l=[...o,"NOT","ORDER"],u=["+","-","*","/","%","=","!=","~=",">=","<=","<",">"],c=[null,":",";",",",".","..","FUNCTION",...u,...o,"NOT"],p=new Set([",","?",":",";","EOF","]",")","}",...u,...o,"ORDER"]),h=new Map(c.map(e=>[e,p]));return h.set("{",new Set([","])),h.set("[",new Set([","])),h.set("(",new Set([","])),r(s.lexer,{lex:e=>function t(){this.lex=e;const r=this._input,n=this.lex(this);if(this.lex=t,h.has(this.prevToken)&&h.get(this.prevToken).has(n)){const e={first_line:this.prevYylloc.last_line,last_line:this.yylloc.first_line,first_column:this.prevYylloc.last_column,last_column:this.yylloc.first_column,range:[this.prevYylloc.range[1],this.yylloc.range[0]]};if(this.unput(this.yytext),this.pushState("preventPrimitive"),this.done=!1,this.yytext="_",this.yylloc=this.prevYylloc=e,r!==this._input&&l.includes(n)){const t=r.length-this._input.length-1;switch(r[t]){case" ":case"\t":e.last_column--,e.range[1]--;break;case"\n":{const n=r.lastIndexOf("\n",t-1);e.last_line--,e.last_column=-1===n?e.last_column-1:t-n,e.range[1]--;break}}}return this.prevToken="IDENT"}if(this.prevYylloc=this.yylloc,l.includes(n))switch(this._input[0]){case" ":case"\t":this.prevYylloc={...this.prevYylloc,last_column:this.prevYylloc.last_column+1,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]};break;case"\n":this.prevYylloc={...this.prevYylloc,last_line:this.prevYylloc.last_line+1,last_column:0,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]}}return this.prevToken=n}}),Object.assign((function(e,r){return r?s.parse(e):t.parse(e)}),{generateModule:()=>t.generateModule({moduleName:"module.exports"}).replace("new Parser","("+e+")(new Parser)")})}(new Ie)}(),n={build:()=>({type:"Arg1"}),compile(e,t){t.put(t.scope.arg1?"arguments[1]":"undefined")},walk(){},stringify(e,t){t.put("$$")}},i={build:e=>({type:"Array",elements:e}),suggest(e,t){0===e.elements.length&&t.queryRoot(e.range[0]+1,e.range[1]-1)},compile(e,t){t.put("["),t.list(e.elements,","),t.put("]")},walk(e,t){t.list(e.elements)},stringify(e,t){t.put("["),t.list(e.elements,","),t.put("]")}};const a={in:"in","not in":"in",has:"-","has no":"-",and:"and",or:"or","+":"add","-":"sub","*":"mul","/":"div","%":"mod","=":"eq","!=":"ne","<":"lt","<=":"lte",">":"gt",">=":"gte","~=":"match"};function s(e,t,r){if("Array"===r.type){0===r.elements.length&&e.range([r.range[0]+1,r.range[1]-1],"value-subset",t,r);for(const{type:n,range:i,value:a}of r.elements)i&&("Literal"===n||"Identifier"===n||"GetProperty"===n&&null===a)&&e.range(i,"value-subset",t,r)}}var o={build:(e,t,r)=>({type:"Binary",operator:e,left:t,right:r}),suggest(e,t){switch(e.operator){case"in":t.range(e.left.range,"in-value",e.right,null),s(t,e.left,e.right);break;case"not in":s(t,e.left,e.right);break;case"has":t.range(e.right.range,"in-value",e.left,null),s(t,e.right,e.left);break;case"has no":s(t,e.right,e.left);break;case"=":case"!=":t.range(e.right.range,"value",e.left,null)}},compile(e,t){if(e.operator in a!=!1)switch("and"!==e.operator&&"not in"!==e.operator&&"has no"!==e.operator||t.put("!"),e.operator){case"or":case"and":{const r=t.allocateVar();t.put(`f.bool(${r}=`),t.node(e.left),t.put(`)?${r}:`),t.scope.captureCurrent.disabled=!0,t.node(e.right),t.scope.captureCurrent.disabled=!1;break}case"has":case"has no":t.put("f.in("),t.node(e.right),t.put(","),t.node(e.left),t.put(")");break;default:t.put("f."),t.put(a[e.operator]),t.put("("),t.node(e.left),t.put(","),t.node(e.right),t.put(")")}else t.error('Unknown operator "'+e.operator+'"',e)},walk(e,t){t.node(e.left),t.node(e.right)},stringify(e,t){t.node(e.left),/^[a-z]/i.test(e.operator)?(t.put(" "),t.put(e.operator),t.put(" ")):t.put(e.operator),t.node(e.right)}},l={build:(e,t)=>({type:"Block",definitions:e,body:t}),suggest(e,t){null===e.body&&t.queryRoot(e.range[1])},compile(e,t){e.definitions.length?t.createScope(()=>{t.put("(()=>{"),t.list(e.definitions),t.put("return "),t.nodeOrCurrent(e.body),t.put("})()")},(e,t)=>e+t+";"):e.body&&"Object"===e.body.type?(t.put("("),t.nodeOrCurrent(e.body),t.put(")")):t.nodeOrCurrent(e.body)},walk(e,t){t.list(e.definitions),t.nodeOrNothing(e.body)},stringify(e,t){t.list(e.definitions),t.nodeOrNothing(e.body)}},u={build:(e,t)=>({type:"Compare",query:e,order:t}),compile(e,t){"desc"===e.order&&t.put("-"),t.createScope(()=>{t.put("f.cmp((_q=current=>("),t.node(e.query),t.put("))(a),_q(b))")},(e,t)=>e+t+",")},walk(e,t){t.node(e.query)},stringify(e,t){t.node(e.query),t.put(" "),t.put(e.order)}},c={build:(e,t,r)=>({type:"Conditional",test:e,consequent:t,alternate:r}),compile(e,t){t.put("f.bool("),t.node(e.test),t.scope.captureCurrent.disabled=!0,t.put(")?"),t.node(e.consequent),t.put(":"),t.node(e.alternate),t.scope.captureCurrent.disabled=!1},walk(e,t){t.node(e.test),t.node(e.consequent),t.node(e.alternate)},stringify(e,t){t.node(e.test),t.put("?"),t.node(e.consequent),t.put(":"),t.node(e.alternate)}},p={build:()=>({type:"Context"}),compile(e,t){t.put("context")},walk(){},stringify(e,t){t.put("#")}},h={build:()=>({type:"Current"}),suggest(e,t){e.range&&t.range(e.range,"var")},compile(e,t){t.put("current")},walk(){},stringify(e,t){t.put("$")}},y={build:()=>({type:"Data"}),compile(e,t){t.put("data")},walk(){},stringify(e,t){t.put("@")}},g={build:e=>({type:"Declarator",name:e}),compile(e,t){e.name&&t.put("$"+e.name)},walk(){},stringify(e,t){t.put(e.name?"$"+e.name:"$")}},d={build:(e,t)=>({type:"GetProperty",value:e,property:t}),suggest(e,t){t.range(e.property.range,"path",e.value||void 0,!e.value),null===e.value&&t.range(e.property.range,"var"),e.range&&null===e.value&&e.property.range[0]!==e.range[0]&&t.queryRoot(e.range[0])},compile(e,t){t.put("f.map("),t.nodeOrCurrent(e.value),t.put(","),"Identifier"===e.property.type?t.put(JSON.stringify(e.property.name)):t.node(e.property),t.put(")")},walk(e,t){t.nodeOrNothing(e.value),t.node(e.property)},stringify(e,t){"Identifier"===e.property.type?(t.nodeOrNothing(e.value)&&t.put("."),t.node(e.property)):(t.node(e.value),t.put("["),t.node(e.property),t.put("]"))}},f={build:e=>({type:"Identifier",name:e}),compile(e,t){t.put(e.name)},walk(){},stringify(e,t){t.put(e.name)}};const m=d.build,b=f.build,v=["data","context","ctx","array","idx","index"];var k={build:(e,t)=>({type:"Definition",declarator:e,value:t}),suggest(e,t){null===e.value&&t.range(e.declarator.range,"path")},compile(e,t){if(null===e.declarator.name)return t.node(e.declarator),t.nodeOrCurrent(e.value),void t.put(";");t.scope.own.includes(e.declarator.name)?t.error(`Identifier "$${e.declarator.name}" has already been declared`,e.declarator):v.includes(e.declarator.name)?t.error(`Identifier "$${e.declarator.name}" is reserved for future use`,e.declarator):(t.put("const "),t.node(e.declarator),t.put("="),t.node(e.value||m(null,b(e.declarator.name))),t.put(";"),t.scope.push(e.declarator.name),t.scope.own.push(e.declarator.name))},walk(e,t){t.node(e.declarator),t.nodeOrNothing(e.value)},stringify(e,t){t.node(e.declarator),null!==e.value&&(t.put(":"),t.node(e.value)),t.put(";")}},_={build:(e,t)=>({type:"Filter",value:e,query:t}),compile(e,t){t.put("f.filter("),t.nodeOrCurrent(e.value),t.createScope(()=>{t.put(",current=>"),t.node(e.query)},(e,r)=>(t.put(")"),e+"("+r+",")),t.put(")")},walk(e,t){t.nodeOrNothing(e.value),t.node(e.query)},stringify(e,t){t.nodeOrNothing(e.value),t.put(".["),t.node(e.query),t.put("]")}},$={build:(e,t,r)=>({type:"Function",arguments:e,body:t,legacy:Boolean(r)}),compile(e,t){t.createScope(()=>{t.scope.arg1=!0,t.put("function(current){return "),t.node(e.body),t.put("}")},(e,t)=>e+t+",")},walk(e,t){t.node(e.body)},stringify(e,t){e.legacy?(t.put("<"),t.node(e.body),t.put(">")):(t.put("=>"),t.node(e.body))}},O={build:e=>({type:"Literal",value:e}),compile(e,t){t.put("string"==typeof e.value?JSON.stringify(e.value):String(e.value))},walk(){},stringify(e,t){t.put("string"==typeof e.value?JSON.stringify(e.value):String(e.value))}},S={build:(e,t)=>({type:"Map",value:e,query:t}),compile(e,t){t.put("f.map("),t.nodeOrCurrent(e.value),t.createScope(()=>{t.put(",current=>"),t.node(e.query)},(e,r)=>(t.put(")"),e+"("+r+",")),t.put(")")},walk(e,t){t.nodeOrNothing(e.value),t.node(e.query)},stringify(e,t){t.nodeOrNothing(e.value),t.put(".("),t.node(e.query),t.put(")")}},N={build:(e,t)=>({type:"Method",reference:e,arguments:t}),suggest(e,t){0===e.arguments.length&&t.queryRoot(e.range[1]-1)},compile(e,t,r){t.tolerant&&t.put("(typeof "),"Identifier"===e.reference.type&&t.put("m."),t.node(e.reference),t.tolerant&&(t.put('==="function"?'),"Identifier"===e.reference.type&&t.put("m."),t.node(e.reference)),t.put("("),t.nodeOrCurrent(r),e.arguments.length&&(t.put(","),t.list(e.arguments,",")),t.put(")"),t.tolerant&&t.put(":undefined)")},walk(e,t){t.node(e.reference),t.list(e.arguments)},stringify(e,t){t.node(e.reference),t.put("("),t.list(e.arguments,","),t.put(")")}},w={build:(e,t)=>({type:"MethodCall",value:e,method:t}),compile(e,t){t.node(e.method,e.value)},walk(e,t){t.nodeOrNothing(e.value),t.node(e.method)},stringify(e,t){t.nodeOrNothing(e.value)&&t.put("."),t.node(e.method)}},E={build:e=>({type:"Object",properties:e}),suggest(e,t){0===e.properties.length&&t.queryRoot(e.range[0]+1,e.range[1]-1)},compile(e,t){t.put("{"),t.list(e.properties,","),t.put("}")},walk(e,t){t.list(e.properties)},stringify(e,t){t.put("{"),t.list(e.properties,","),t.put("}")}},A={build:e=>({type:"Parentheses",body:e}),compile(e,t){t.put("("),t.node(e.body),t.put(")")},walk(e,t){t.node(e.body)},stringify(e,t){t.put("("),t.node(e.body),t.put(")")}},x={build:(e,t)=>({type:"Pick",value:e,getter:t}),suggest(e,t){null===e.getter&&t.queryRoot(e.range[1]-1)},compile(e,t){t.put("f.pick("),t.node(e.value),e.getter&&(t.put(","),t.node(e.getter)),t.put(")")},walk(e,t){t.node(e.value),null!==e.getter&&t.node(e.getter)},stringify(e,t){t.node(e.value),t.put("["),null!==e.getter&&t.node(e.getter),t.put("]")}},R={build:(e,t)=>({type:"Pipeline",left:e,right:t}),compile(e,t){t.put("(current=>("),t.node(e.right),t.put("))("),t.node(e.left),t.put(")")},walk(e,t){t.node(e.left),t.node(e.right)},stringify(e,t){t.node(e.left),t.put("|"),t.node(e.right)}};const I=d.build,P=f.build,C=new Set(["Literal","Identifier","Reference","Current"]);const T={Arg1:n,Array:i,Binary:o,Block:l,Compare:u,Conditional:c,Context:p,Current:h,Data:y,Declarator:g,Definition:k,Filter:_,Function:$,GetProperty:d,Identifier:f,Literal:O,Map:S,Method:N,MethodCall:w,Object:E,Parentheses:A,Pick:x,Pipeline:R,Property:{build:(e,t)=>({type:"Property",key:e,value:t}),suggest(e,t){if(null===e.value)switch(e.key.type){case"Identifier":t.range(e.range,"path"),t.range(e.range,"var");break;case"Current":case"Reference":t.range(e.range,"var")}},compile(e,t){let r=e.value;switch(e.key.type){case"Current":return;case"Literal":t.node(e.key);break;case"Identifier":t.node(e.key),r=r||I(null,P(e.key.name));break;case"Reference":t.node(e.key.name),r=r||e.key;break;default:t.put("["),t.node(e.key),t.put("]")}t.put(":"),t.node(r)},walk(e,t){t.node(e.key),t.nodeOrNothing(e.value)},stringify(e,t){if(C.has(e.key.type)){if(t.node(e.key),null===e.value)return}else t.put("["),t.node(e.key),t.put("]");t.put(":"),t.node(e.value)}},Recursive:{build:(e,t)=>({type:"Recursive",value:e,query:t}),compile(e,t){t.put("f.mapRecursive("),t.nodeOrCurrent(e.value),t.createScope(()=>{t.put(",current=>"),t.node(e.query)},(e,r)=>(t.put(")"),e+"("+r+",")),t.put(")")},walk(e,t){t.nodeOrNothing(e.value),t.node(e.query)},stringify(e,t){t.nodeOrNothing(e.value),t.put(".."),t.isSimpleGetPropertyQuery(e.query)||t.isSimpleMethodCallQuery(e.query)?t.node(e.query):(t.put("("),t.node(e.query),t.put(")"))}},Reference:{build:e=>({type:"Reference",name:e}),suggest(e,t){e.range&&t.range(e.range,"var")},compile(e,t){if(!t.scope.includes(e.name.name)&&t.tolerant)return t.put("(typeof $"),t.node(e.name),t.put('!=="undefined"?$'),t.node(e.name),void t.put(":undefined)");t.put("$"),t.node(e.name)},walk(e,t){t.node(e.name)},stringify(e,t){t.put("$"),t.node(e.name)}},SliceNotation:{build:(e,t)=>({type:"SliceNotation",value:e,arguments:t}),compile(e,t){t.put("f.slice("),t.nodeOrCurrent(e.value),e.arguments.slice(0,3).forEach(e=>{t.put(","),e?t.node(e):t.put("undefined")}),t.put(")")},walk(e,t){t.nodeOrNothing(e.value);for(const r of e.arguments.slice(0,3))r&&t.node(r)},stringify(e,t){const[r,n,i]=e.arguments;t.nodeOrNothing(e.value),t.put("["),r&&t.node(r),t.put(":"),n&&t.node(n),i&&(t.put(":"),t.node(i)),t.put("]")}},SortingFunction:{build:e=>({type:"SortingFunction",compares:e}),compile(e,t){t.put("(a, b)=>{let _q;return "),t.list(e.compares,"||"),t.put("||0}")},walk(e,t){t.list(e.compares)},stringify(e,t){t.list(e.compares,",")}},Spread:{build:(e,t=!1)=>({type:"Spread",query:e,array:t}),suggest(e,t){null===e.query&&t.queryRoot(e.range[1])},compile(e,t){if(e.array)return t.put("...f.ensureArray("),t.nodeOrCurrent(e.query),void t.put(")");t.put("..."),t.nodeOrCurrent(e.query)},walk(e,t){t.nodeOrNothing(e.query)},stringify(e,t){t.put("..."),t.nodeOrNothing(e.query)}},Unary:{build:(e,t)=>({type:"Unary",operator:e,argument:t}),compile(e,t){switch(e.operator){case"no":case"not":t.put("!f.bool("),t.node(e.argument),t.put(")");break;case"+":case"-":t.put(e.operator),t.node(e.argument);break;default:t.error('Unknown operator "'+e.operator+'"',e)}},walk(e,t){t.node(e.argument)},stringify(e,t){t.put(e.operator),"-"!==e.operator&&"+"!==e.operator&&t.put(" "),t.node(e.argument)}}},q=e=>new Map(Object.entries(T).map(([t,r])=>[t,r[e]]).filter(([,e])=>"function"==typeof e));var j={nodes:T,build:Object.fromEntries([...q("build").entries()]),compile:q("compile"),walk:q("walk"),stringify:q("stringify"),suggest:q("suggest")};const M=j.walk;var D=function(e,t){function r(e){if(!M.has(e.type))throw new Error("Unknown node type `"+e.type+"`");i(e),M.get(e.type)(e,n),a(e)}const n={node:r,nodeOrNothing(e){null!==e&&r(e)},list(e){e.forEach(r)}};let i=()=>{},a=()=>{};"function"==typeof t&&(t={enter:t}),t&&("function"==typeof t.enter&&(i=t.enter),"function"==typeof t.leave&&(a=t.leave)),r(e)};const F=j.suggest;function L(e,t){return t>=0&&t<e.length&&/[a-zA-Z_$0-9]/.test(e[t])}function U(e,t){const r=e.charCodeAt(t);return 9===r||10===r||13===r||32===r}function B(e,t,r){for(;t<r;t++)if(!U(e,t))return!1;return!0}function G(e,t,r,n,i){const a=[];for(let r=0;r<n.length;r++){const[i,s]=n[r];if(i>=t)break;i<e||(i===e?a.push(e,e):a.push(e,i),e=s)}return e===r.length&&i||a.push(e,t),a}function Y(e,t,r,n){const i=[];for(let a=0;a<e.length;a++){let[s,o,l,u]=e[a];if(B(t,s,o)){for(;s>=0&&U(t,s-1);)s--;for(;o<t.length&&U(t,o);)o++;if(L(t,s-1)){if(s===o)continue;s++}if(L(t,o)){if(s===o)continue;o--}}const c=G(s,o,t,r,n);for(let e=0;e<c.length;e+=2)i.push([c[e],c[e+1],l,u])}return i}var z=function(e,t,r){const n=function(e){let t=null;const r=new Map,n=(e,t)=>{r.has(e)?r.get(e).push(t):r.set(e,[t])},i={range(e,r,i=t,a=!0){n(i,[...e,r,a]),a&&!0!==a&&n(a,[])},queryRoot(e,r=e){n(t,[e,r,"var",!0]),n(t,[e,r,"path",!0])}};return D(e,e=>{if(F.has(e.type)){const r=t;t=e,F.get(e.type)(e,i),t=r}}),r}(e),i=r.length&&r[r.length-1][1]===t.length&&!/[\r\n]$/.test(t);for(const[e,a]of n)n.set(e,Y(a,t,r,i));return n};const H=j.stringify;function J(e){return"GetProperty"===e.type&&((!e.value||"Current"===e.value.type)&&"Identifier"===e.property.type)}function Z(e){return"MethodCall"===e.type&&(!e.value||"Current"===e.value.type)}function Q(e,t){return"Identifier"===t.type&&("Reference"===e.type&&"Identifier"===e.name.type&&t.name===e.name.name)}function V(e,t){return!!J(e)&&e.property.name===t}var X=function(e){function t(e){if(!H.has(e.type))throw new Error("Unknown node type `"+e.type+"`");H.get(e.type)(e,n)}const r=[],n={isSimpleGetPropertyQuery:J,isSimpleMethodCallQuery:Z,isSameIdentifierAndReference:Q,isGetProperty:V,put(e){r.push(e)},node:t,nodeOrNothing(e){if(null!==e)return t(e),!0},list(e,r){r?e.forEach((e,i)=>{i>0&&n.put(r),t(e)}):e.forEach(t)}};return t(e),r.join("")};const W=j.compile;var K=function(e,t=!1,r=null){function n(e){let t;return l.has(e)?t=l.get(e):(o.push(t="s"+o.length),l.set(e,t)),t}function i(e,t,r,n,i){let a=[e,t,JSON.stringify(r)];if("var"===r){if(!h.scope.length)return;a.push(JSON.stringify(h.scope))}else n||o.push(n="s"+o.length),a.push(n),i&&a.push(i);return c.push(a),n}function a(e,t){const r=h.scope,n=p.length;if(h.scope=h.scope.slice(),h.scope.own=[],h.scope.firstCurrent=null,h.scope.captureCurrent=[],h.scope.arg1=r.arg1||!1,e(),h.scope.captureCurrent.length){const e="stat("+h.scope.captureCurrent.reduce((e,t)=>i(...t,e),void 0)+",current)";h.scope.firstCurrent?p[h.scope.firstCurrent]=e:p[n]=t(p[n],e)}h.scope=r}function s(e,t){let a=!1;if(null!==r){if(r.has(e))for(const[t,s,o,l]of r.get(e))"var"===o?i(t,s,o):!0===l?h.scope.captureCurrent.push([t,s,o]):(a||(a=n(e),p.push("stat("+a+",")),o&&i(t,s,o,a,l&&n(l)));"Current"===e.type&&null===h.scope.firstCurrent&&!0!==h.scope.captureCurrent.disabled&&(h.scope.firstCurrent=p.length)}if(!W.has(e.type))throw new Error("Unknown node type `"+e.type+"`");W.get(e.type)(e,h,t),a&&p.push(")")}const o=[],l=new WeakMap,u=[],c=[],p=["const current=data;",{toString:()=>u.length>0?"let "+u+";\n":""},{toString:()=>0===o.length?"":["const stat=(s,v)=>(s.add(v),v);\n","const "+o.map(e=>e+"=new Set()")+";\n"].join("")},"return "],h={tolerant:t,scope:[],createScope:a,error:(e,r)=>{const n=new SyntaxError(e);if(r&&r.range&&(n.details={loc:{range:r.range}}),!t)throw n},allocateVar(){const e="tmp"+u.length;return u.push(e),e},put:e=>p.push(e),node:s,nodeOrNothing(e,t){e&&s(e,t)},nodeOrCurrent(e,t){s(e||{type:"Current"},t)},list(e,t,r){e.forEach((e,n)=>{n>0&&p.push(t),s(e,r)})}};a(()=>s(e),(e,t)=>(p.push(")"),"("+t+","+e)),null!==r&&p.push("\n,["+c.map(e=>"["+e+"]")+"]");try{return new Function("f","m","data","context",p.join(""))}catch(e){const t=p.join(""),r=function(e,t){const r=Object.create(SyntaxError.prototype),n=new Error;return r.name=e,r.message=t,Object.defineProperty(r,"stack",{get:function(){return(n.stack||"").replace(/^(.+\n){1,3}/,e+": "+t+"\n")}}),r}("SyntaxError","Jora query compilation error");throw r.compiledSource=t,r}};const ee=Object.hasOwnProperty,te=Object.prototype.toString;var re={addToSet:function(e,t){return void 0!==t&&(Array.isArray(t)?t.forEach(t=>e.add(t)):e.add(t)),e},getPropertyValue:function(e,t){return e&&ee.call(e,t)?e[t]:void 0},isPlainObject:function(e){return null!==e&&"object"==typeof e&&e.constructor===Object},isRegExp:function(e){return"[object RegExp]"===te.call(e)},isArrayLike:function(e){return e&&ee.call(e,"length")}};const{addToSet:ne,getPropertyValue:ie,isPlainObject:ae,isRegExp:se,isArrayLike:oe}=re;var le=Object.freeze({ensureArray:e=>Array.isArray(e)?e:[e],bool(e){if(Array.isArray(e))return e.length>0;if(ae(e)){for(const t in e)if(hasOwnProperty.call(e,t))return!0;return!1}return Boolean(e)},add:(e,t)=>Array.isArray(e)||Array.isArray(t)?[...new Set([].concat(e,t))]:e+t,sub(e,t){if(Array.isArray(e)){const r=new Set(e);return Array.isArray(t)?t.forEach(e=>r.delete(e)):r.delete(t),[...r]}return e-t},mul:(e,t)=>e*t,div:(e,t)=>e/t,mod:(e,t)=>e%t,eq:(e,t)=>Object.is(e,t),ne:(e,t)=>!Object.is(e,t),lt:(e,t)=>e<t,lte:(e,t)=>e<=t,gt:(e,t)=>e>t,gte:(e,t)=>e>=t,in:(e,t)=>ae(t)?hasOwnProperty.call(t,e):!(!t||"function"!=typeof t.indexOf)&&-1!==t.indexOf(e),cmp:(e,t)=>e>t?1:e<t?-1:0,match(e,t){return"function"==typeof t?this.some(e,t):se(t)?this.some(e,t.test.bind(t)):null==t},pick(e,t=(()=>!0)){if(e){if("function"!=typeof t)return Array.isArray(e)||"string"==typeof e?isFinite(t)?e[t<0?e.length+Number(t):Number(t)||0]:void 0:hasOwnProperty.call(e,t)?e[t]:void 0;if(Array.isArray(e)||"string"==typeof e)for(let r=0;r<e.length;r++)if(t(e[r],r))return e[r];for(const r in e)if(hasOwnProperty.call(e,r)&&t(e[r],r))return e[r]}},map(e,t){const r="function"==typeof t?t:e=>ie(e,t);return Array.isArray(e)?[...e.reduce((e,t)=>ne(e,r(t)),new Set)]:void 0!==e?r(e):e},mapRecursive(e,t){const r=new Set;return ne(r,this.map(e,t)),r.forEach(e=>ne(r,this.map(e,t))),[...r]},some(e,t){return Array.isArray(e)?e.some(e=>this.bool(t(e))):this.bool(t(e))},filter(e,t){return Array.isArray(e)?e.filter(e=>this.bool(t(e))):this.bool(t(e))?e:void 0},slice(e,t=0,r=e&&e.length,n=1){if(!oe(e))return[];if(t=parseInt(t,10)||0,r=parseInt(r,10)||e.length,1!==(n=parseInt(n,10)||1)){const i=[];t=t<0?Math.max(0,e.length+t):Math.min(e.length,t),r=r<0?Math.max(0,e.length+r):Math.min(e.length,r);for(let a=n>0?t:r-1;a>=t&&a<r;a+=n)i.push(e[a]);return i}return"string"==typeof e?e.slice(t,r):Array.prototype.slice.call(e,t,r)}});const{addToSet:ue,isPlainObject:ce}=re;function pe(){}function he(e){return e}function ye(e){return{matched:e.slice(),start:e.index,end:e.index+e[0].length,input:e.input,groups:e.groups||null}}var ge=Object.freeze({bool:le.bool,filter:le.filter,map:le.map,pick:le.pick,keys:e=>Object.keys(e||{}),values(e){const t=new Set;for(const r in e)hasOwnProperty.call(e,r)&&ue(t,e[r]);return[...t]},entries(e){const t=[];for(const r in e)hasOwnProperty.call(e,r)&&t.push({key:r,value:e[r]});return t},fromEntries(e){const t={};return Array.isArray(e)&&e.forEach(e=>{e&&(t[e.key]=e.value)}),t},size:e=>ce(e)?Object.keys(e).length:e&&e.length||0,sort(e,t){let r;return Array.isArray(e)?("function"==typeof t&&(r=2===t.length?t:(e,r)=>{if(e=t(e),r=t(r),Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return e.length<r.length?-1:1;for(let t=0;t<e.length;t++){if(e[t]<r[t])return-1;if(e[t]>r[t])return 1}return 0}return e<r?-1:e>r}),e.slice().sort(r)):e},reverse:e=>Array.isArray(e)?e.slice().reverse():e,slice:(e,t,r)=>le.slice(e,t,r),group(e,t,r){"function"!=typeof t&&(t=pe),"function"!=typeof r&&(r=he),Array.isArray(e)||(e=[e]);const n=new Map,i=[];return e.forEach(e=>{let i=t(e);Array.isArray(i)||(i=[i]),i.forEach(t=>{n.has(t)?n.get(t).add(r(e)):n.set(t,new Set([r(e)]))})}),n.forEach((e,t)=>i.push({key:t,value:[...e]})),i},split:(e,t)=>String(e).split(t),join:(e,t)=>Array.isArray(e)?e.join(t):String(e),match(e,t,r){const n=String(e);if(r){const e=[];let r,i=new RegExp(t,t.flags+"g");for(;r=i.exec(n);)e.push(ye(r));return e}const i=String(e).match(t);return i&&ye(i)},reduce:(e,t,r)=>Array.isArray(e)?void 0!==r?e.reduce((e,r)=>t(r,e),r):e.reduce((e,r)=>t(r,e)):t(e,r)});const{addToSet:de,isPlainObject:fe}=re,me={path:"property",value:"value","in-value":"value","value-subset":"value",var:"variable"};function be(e,t,r,n){const i=[];for(let[a,s,o,l,u=null]of r)if(t>=a&&t<=s&&(n||l.size||l.length)){let r=e.substring(a,s);/\S/.test(r)||(r="",a=s=t),i.push({context:o,current:r,from:a,to:s,values:l,related:u})}return i}var ve=(e,t)=>({stat(r,n){const i=be(e,r,t,n);return i.forEach(e=>{e.values=[...e.values]}),i.length?i:null},suggestion(r,n){const i=be(e,r,t,n),a=[];return i.forEach(e=>{const{context:t,current:r,from:n,to:i,values:s,related:o}=e;a.push(...function(e,t,r){const n=new Set,i=e=>{switch(typeof e){case"string":n.add(JSON.stringify(e));break;case"number":n.add(String(e))}};switch(e){case"":case"path":t.forEach(e=>{Array.isArray(e)?e.forEach(e=>{fe(e)&&de(n,Object.keys(e))}):fe(e)&&de(n,Object.keys(e))});break;case"value":t.forEach(e=>{Array.isArray(e)?e.forEach(i):i(e)});break;case"in-value":t.forEach(e=>{Array.isArray(e)?e.forEach(i):fe(e)?Object.keys(e).forEach(i):i(e)});break;case"var":t.forEach(e=>{n.add("$"+e)});break;case"value-subset":t.forEach(e=>{Array.isArray(e)?e.forEach(i):i(e)}),r.forEach(e=>{e.forEach(e=>{"string"!=typeof e&&"number"!=typeof e||n.delete(JSON.stringify(e))})})}return[...n]}(t,s,o).map(e=>({current:r,type:me[t],value:e,from:n,to:i})))}),a.length?a:null}});var ke,_e=(ke=t)&&ke.default||ke;const{version:$e}=_e,Oe=new Map,Se=new Map,Ne=new Map,we=new Map;function Ee(e,t){console.log(`[${e}]`),"string"==typeof t?console.log(t):void 0!==t&&console.dir(t,{depth:null}),console.log()}return Object.assign((function(e,t){t=t||{};const n=Boolean(t.stat),i=Boolean(t.tolerant),a=t.methods?{...ge,...t.methods}:ge,s=n?i?we:Se:i?Ne:Oe;let o;return e=String(e),s.has(e)&&!t.debug?o=s.get(e):(o=function(e,t,n,i){(i="function"==typeof i?i:!!Boolean(i)&&Ee)&&(i("========================="),i("Compile query from source",e));const a=r(e,n);i&&(i("AST",a.ast),i("Restored source",X(a.ast)));const s=t?z(a.ast,e,a.commentRanges):null;if(i&&s){const t=e=>JSON.stringify(e).slice(1,-1),r=[].concat(...[...s.entries()].map(([e,t])=>t.map(t=>[e,...t])));let n=[],a=null;i("Suggest ranges",r.sort((e,t)=>e[1]-t[1]).map(([r,...i])=>{const[s,o,l,u]=i;let c;if(l){if(s===n[0]&&o===n[1])c=" ".repeat(a.length);else{const r=t(e.slice(0,s)).length,l=t(e.substring(s,o)).length;n=i,a=" ".repeat(r)+(l?"~".repeat(l):"\\")+" "+s+":"+o,c=t(e)+"\n"+a}return c+" ["+l+"] on "+r.type+(!0===u?" (current)":u?" & "+u.type:"")}}).join("\n"))}const o=K(a.ast,n,s);return i&&i("Compiled code",o.toString()),o}(e,n,i,t.debug),s.set(e,o)),n?(t,r)=>ve(e,o(le,a,t,r)):(e,t)=>o(le,a,e,t)}),{version:$e,buildin:le,methods:ge,syntax:{parse:r,walk:D,stringify:X,compile:K}})}));
{
"name": "jora",
"version": "1.0.0-alpha.13",
"version": "1.0.0-beta.1",
"description": "JavaScript object query engine",

@@ -38,12 +38,12 @@ "author": "Roman Dvornov <rdvornov@gmail.com> (https://github.com/lahmatiy)",

"devDependencies": {
"coveralls": "^3.0.7",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"coveralls": "^3.0.11",
"eslint": "^6.5.1",
"jison": "^0.4.18",
"mocha": "^5.2.0",
"mocha": "^6.2.3",
"nyc": "^14.1.0",
"rollup": "^1.23.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.3"
"rollup": "^1.32.1",
"rollup-plugin-terser": "^5.3.0"
},

@@ -50,0 +50,0 @@ "engines": {

@@ -6,4 +6,4 @@ # Jora

[![Coverage Status](https://coveralls.io/repos/github/discoveryjs/jora/badge.svg?branch=master)](https://coveralls.io/github/discoveryjs/jora?branch=master)
![Minified size](https://badgen.net/bundlephobia/min/jora)
![Minified + gzip size](https://badgen.net/bundlephobia/minzip/jora)
[![Minified size](https://badgen.net/bundlephobia/min/jora)](https://bundlephobia.com/result?p=jora)
[![Minified + gzip size](https://badgen.net/bundlephobia/minzip/jora)](https://bundlephobia.com/result?p=jora)
[![Twitter](https://badgen.net/badge/follow/@js_discovery?icon=twitter)](https://twitter.com/js_discovery)

@@ -13,3 +13,3 @@

> STATUS: A proof of concept. Syntax may change in next releases.
> STATUS: Jora is still very much work in progress. Syntax may change in next releases.

@@ -29,4 +29,4 @@ Features:

- [Jora sandbox](https://discoveryjs.github.io/jora-sandbox/) – A Web interface where you can play with jora syntax or transform some JSON with zero setup
- [Discovery](https://github.com/discoveryjs/discovery) – Hackable JSON discovery tool. Uses jora to query a data for views
- [JsonDiscovery](https://github.com/discoveryjs/browser-extension-json-discovery) – a browser’s extension for viewing JSON built on Discovery, available for [Chrome](https://chrome.google.com/webstore/detail/jsondiscovery/pamhglogfolfbmlpnenhpeholpnlcclo) and [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/jsondiscovery/) (read more in the article [Changing a way we’re viewing JSON in a browser](https://medium.com/@rdvornov/changing-a-way-were-viewing-json-in-a-browser-51eda9103fa2))
- [Discovery](https://github.com/discoveryjs/discovery) – Uses jora to query a data for views
- [JsonDiscovery](https://github.com/discoveryjs/browser-extension-json-discovery) – a browser’s extension for viewing JSON based on Discovery, available for [Chrome](https://chrome.google.com/webstore/detail/jsondiscovery/pamhglogfolfbmlpnenhpeholpnlcclo) and [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/jsondiscovery/) (read more in the article [Changing a way we’re viewing JSON in a browser](https://medium.com/@rdvornov/changing-a-way-were-viewing-json-in-a-browser-51eda9103fa2))

@@ -51,3 +51,3 @@ TODO:

<!-- TOC depthFrom:2 -->
<!-- TOC depthfrom:2 -->

@@ -160,5 +160,6 @@ - [Install](#install)

const depsPathsToMultipleVersionPackages = jora(`
$normalizedDeps: => dependencies.entries().({ name: key, ...value });
$multiVersionPackages:
..(dependencies.mapToArray("name"))
.group(<name>, <version>)
..$normalizedDeps()
.group(=>name, =>version)
.({ name: key, versions: value.sort() })

@@ -170,10 +171,9 @@ .[versions.size() > 1];

version,
otherVersions: $multiVersionPackages.pick(<name=$name>).versions - version,
dependencies: dependencies
.mapToArray("name")
.map($pathToMultiVersionPackages)
otherVersions: $multiVersionPackages[=>name=$name].versions - version,
dependencies: $normalizedDeps()
.$pathToMultiVersionPackages()
.[name in $multiVersionPackages.name or dependencies]
});
map($pathToMultiVersionPackages)
$pathToMultiVersionPackages()
`)(tree);

@@ -214,5 +214,5 @@

/regexp/<br>/regexp/i | A JavaScript regexp, only `i` flag supported
{ } | Object initializer/literal syntax. You can use spread operator `...`, e.g. `{ a: 1, ..., ...foo, ...bar }` (`...` with no expression on right side the same as `...$`)
[ ] | Array initializer/literal syntax
< block ><br>=> e | A function<br>NOTE: Syntax will be changed
{ } | Object initializer/literal syntax. Spread operator (`...`) can be used, e.g. `{ a: 1, ..., ...foo }` (`...` with no expression on right side the same as `...$`)
[ ] | Array initializer/literal syntax. Spread operator (`...`) can be used, e.g. `[1, ..., ...foo]` (`...` with no expression on right side the same as `...$`). Unlike JavaScript, spread operator in jora inlines arrays only and left as is any other values, i.e. `[...[1, 2], ...3, ..."45", { "6": 7 }]` -> `[1, 2, 3, "45", { "6": 7 }]`
=> e<br>< block > (deprecated) | A function<br>NOTE: Syntax `< block >` is deprecated, avoid to use it
query asc<br>query desc<br>query asc, query desc, ... | A sorting function that takes two arguments and compare query result for each in specified order (`asc` – ascending, `desc` – descending)

@@ -304,2 +304,3 @@

$ | A scope input data (current value). On top level scope it's the same as `@`. In most cases it may be omitted. Used implicitly an input for subquery when no other subjects is defined (e.g. `foo()` and `.foo()` are equivalent for `$.foo()`).
$$ | A reference to the second parameter of closest function or undefined when no such
@ | A query input data

@@ -316,9 +317,10 @@ \# | A query context

.ident | Child member operator (example: `foo.bar.baz`, `#.foo['use any symbols for name']`)
..ident<br> ..( block ) | Recursive descendant operator (example: `..deps`, `..(deps + dependants)`)
..ident<br>..( block ) | Recursive descendant operator (example: `..deps`, `..(deps + dependants)`)
.[ block ] | Filter a current data. Equivalent to a `.filter(<block>)`
.( block ) | Map a current data. Equivalent to a `.map(<block>)`
.method()<br> ..method() | Invoke a method to current data, or each element of current data if it is an array
path[e] | Array-like notation to access properties. It works like in JS for everything with exception for arrays, where it equivalents to `array.map(e => e[key])`. Use `pick()` method to get an element by index in array.
method()<br>.method()<br>..$method() | Invoke a method to current value, where `$method` is a reference to definition value (i.e. `$example: => $ * 10; 2.$plural(["example", "examples"])`). Can take arguments (i.e. `$method(one, 2)`).
$method()<br>.$method()<br>..method() | Invoke a method to current value. See [build-in methods below](#build-in-methods)
path[expr] | Array-like notation to access properties. Behaves like `pick()` method. In case you need to fetch a value to each element of array use `.($[expr])` or `map(=>$[expr])`
[from:to]<br>[from:to:step] | [Slice notation](https://github.com/tc39/proposal-slice-notation/blob/master/README.md). Examples: `$str: '<foo>'; str[1:-1]` (result is `'foo'`) or `$ar:[1,2,3,4,5,6]; $ar[-3::-1]` (result is `[6,5,4]`)
e \| [definitions] e \| ... | Pipeline operator. It's useful to make a query value as current value. Approximately this effect can be obtained using variables: `$ar: [1,2,3]; { size: $ar.size(), top2: $ar[0:2] }`. However, with pipeline operator it's a bit simplier and clear: `[1,2,3] | { size: size(), top2: [0:2] }`
expr \| [definitions] expr \| ... | Pipeline operator. It's useful to make a query value as current value. Approximately this effect can be obtained using variables: `$ar: [1,2,3]; { size: $ar.size(), top2: $ar[0:2] }`. However, with pipeline operator it's a bit simplier and clear: `[1,2,3] | { size: size(), top2: [0:2] }`

@@ -334,4 +336,3 @@ ### Build-in methods

fromEntries() | Similar to `Object.fromEntries()` in JS with difference: `{ key, value }` objects are expecting as entries instead of array tuples
mapToArray("key"[, "value"]) | Converts an object to an array, and store object key as "key"
pick("key")<br>pick(fn) | Get a value by a key, an index or a function. Useful for arrays, e.g. since `array[5]` applies `[5]` for each element in an array (equivalent to `array.map(e => e[5])`), `array.pick(5)` should be used instead.
pick("key")<br>pick(index)<br>pick(fn) | Get a value by a key, an index or a function. It returns an element with `e` index for arrays, a char with `e` index for strings, and a value with `e` key (must be own key) for enything else. Negative indecies are supported for arrays and strings. Current value is element for an array, a char for a string or an entry value for object. Arg1 (i.e. `$$`) is an index for arrays and strings, and a key for objects.
size() | Returns count of keys if current data is object, otherwise returns `length` value or `0` when field is absent

@@ -347,2 +348,3 @@ sort(\<fn>) | Sort an array by a value fetched with getter (`<fn>`). Keep in mind, you can use sorting function definition syntax using `asc` and `desc` keywords, qhich is more effective in many ways. In case of sorting function definition usage, `<` and `>` are not needed and you can specify sorting order for each component. Following queries are equivalents:<br>`sort(<foo.bar>)` and `sort(foo.bar asc)`<br>`sort(<foo>).reverse()` and `sort(foo desc)`<br>`sort(<[a, b]>)` and `sort(a asc, b asc)`

match(pattern, matchAll) | Similar to `String#match()`. Since regexp'es in jora doesn't support for `g` flag, use `matchAll` argument to get all matches, i.e. `'abcabc'.match(/ab/, true)` (jora) instead of `'abcabc'.match(/ab/g)` (JS)
reduce(fn\[, initValue]) | The same as `Array#reduce()` in JS. Use `$$` to access to accumulator and `$` to current value, e.g. find the max value `reduce(=>$ > $$ ? $ : $$)`

@@ -349,0 +351,0 @@ ## License

const { version } = require('../package.json');
const parse = require('./lang/parse');
const suggest = require('./lang/suggest');
const walk = require('./lang/walk');
const stringify = require('./lang/stringify');

@@ -35,11 +37,42 @@ const compile = require('./lang/compile');

if (debug) {
const esc = s => JSON.stringify(s).slice(1, -1);
debug('AST', parseResult.ast);
debug('Restored source', stringify(parseResult.ast));
debug('Suggest ranges', parseResult.suggestRanges.sort((a, b) => a[0] - b[0]).map(r => {
const pre = esc(source.slice(0, r[0])).length;
const long = esc(source.substring(r[0], r[1])).length;
}
const suggestions = statMode
? suggest(parseResult.ast, source, parseResult.commentRanges)
: null;
if (debug && suggestions) {
const esc = s => JSON.stringify(s).slice(1, -1);
const ranges = [].concat(...[...suggestions.entries()]
.map(([node, ranges]) => ranges.map(range => [node, ...range]))
);
let prevRange = [];
let prevPrefix = null;
debug('Suggest ranges', ranges.sort((a, b) => a[1] - b[1]).map(([node, ...range]) => {
const [start, end, type, extra] = range;
let prelude;
if (!type) {
return;
}
if (start === prevRange[0] && end === prevRange[1]) {
prelude = ' '.repeat(prevPrefix.length);
} else {
const pre = esc(source.slice(0, start)).length;
const long = esc(source.substring(start, end)).length;
prevRange = range;
prevPrefix =
' '.repeat(pre) + (!long ? '\\' : '~'.repeat(long)) +
' ' + start + ':' + end;
prelude = esc(source) + '\n' + prevPrefix;
}
return (
esc(source) + '\n' +
(' '.repeat(pre) + (!long ? '\\' : '~'.repeat(long)) + ' ' + r[0] + ':' + r[1] + ' [' + r[2] + '] from ' + r[3])
prelude + ' [' + type + '] on ' + node.type +
(extra === true ? ' (current)' : extra ? ' & ' + extra.type : '')
);

@@ -49,8 +82,6 @@ }).join('\n'));

const fn = statMode
? compile(parseResult.ast, parseResult.suggestRanges, statMode)
: compile(parseResult.ast);
const fn = compile(parseResult.ast, tolerantMode, suggestions);
if (debug) {
debug('Function', fn.toString());
debug('Compiled code', fn.toString());
}

@@ -74,3 +105,3 @@

if (cache.has(source)) {
if (cache.has(source) && !options.debug) {
fn = cache.get(source);

@@ -93,2 +124,3 @@ } else {

parse,
walk,
stringify,

@@ -95,0 +127,0 @@ compile

@@ -10,3 +10,6 @@ const {

module.exports = Object.freeze({
bool: function(value) {
ensureArray(value) {
return Array.isArray(value) ? value : [value];
},
bool(value) {
if (Array.isArray(value)) {

@@ -28,3 +31,3 @@ return value.length > 0;

},
add: function(a, b) {
add(a, b) {
if (Array.isArray(a) || Array.isArray(b)) {

@@ -36,3 +39,3 @@ return [...new Set([].concat(a, b))];

},
sub: function(a, b) {
sub(a, b) {
if (Array.isArray(a)) {

@@ -53,30 +56,30 @@ const result = new Set(a);

},
mul: function(a, b) {
mul(a, b) {
return a * b;
},
div: function(a, b) {
div(a, b) {
return a / b;
},
mod: function(a, b) {
mod(a, b) {
return a % b;
},
eq: function(a, b) {
return a === b;
eq(a, b) {
return Object.is(a, b);
},
ne: function(a, b) {
return a !== b;
ne(a, b) {
return !Object.is(a, b);
},
lt: function(a, b) {
lt(a, b) {
return a < b;
},
lte: function(a, b) {
lte(a, b) {
return a <= b;
},
gt: function(a, b) {
gt(a, b) {
return a > b;
},
gte: function(a, b) {
gte(a, b) {
return a >= b;
},
in: function(a, b) {
in(a, b) {
if (isPlainObject(b)) {

@@ -88,12 +91,12 @@ return hasOwnProperty.call(b, a);

},
cmp: function(a, b) {
cmp(a, b) {
return a > b ? 1 : a < b ? -1 : 0;
},
match: function(value, pattern) {
match(value, pattern) {
if (typeof pattern === 'function') {
return this.filter(value, pattern);
return this.some(value, pattern);
}
if (isRegExp(pattern)) {
return this.filter(value, pattern.test.bind(pattern));
return this.some(value, pattern.test.bind(pattern));
}

@@ -107,3 +110,36 @@

},
map: function(value, getter) {
pick(current, ref = () => true) {
if (!current) {
return undefined;
}
if (typeof ref === 'function') {
if (Array.isArray(current) || typeof current === 'string') {
for (let i = 0; i < current.length; i++) {
if (ref(current[i], i)) {
return current[i];
}
}
}
for (const key in current) {
if (hasOwnProperty.call(current, key)) {
if (ref(current[key], key)) {
return current[key];
}
}
}
return undefined;
}
if (Array.isArray(current) || typeof current === 'string') {
return isFinite(ref)
? current[ref < 0 ? current.length + Number(ref) : Number(ref) || 0]
: undefined;
}
return hasOwnProperty.call(current, ref) ? current[ref] : undefined;
},
map(value, getter) {
const fn = typeof getter === 'function'

@@ -124,3 +160,26 @@ ? getter

},
slice: function(value, from = 0, to = value && value.length, step = 1) {
mapRecursive(value, getter) {
const result = new Set();
addToSet(result, this.map(value, getter));
result.forEach(current =>
addToSet(result, this.map(current, getter))
);
return [...result];
},
some(value, fn) {
return Array.isArray(value)
? value.some(current => this.bool(fn(current)))
: this.bool(fn(value));
},
filter(value, fn) {
if (Array.isArray(value)) {
return value.filter(current => this.bool(fn(current)));
}
return this.bool(fn(value)) ? value : undefined;
},
slice(value, from = 0, to = value && value.length, step = 1) {
if (!isArrayLike(value)) {

@@ -156,21 +215,3 @@ return [];

return Array.prototype.slice.call(value, from, to);
},
recursive: function(value, getter) {
const result = new Set();
addToSet(result, this.map(value, getter));
result.forEach(current =>
addToSet(result, this.map(current, getter))
);
return [...result];
},
filter: function(value, fn) {
if (Array.isArray(value)) {
return value.filter(current => this.bool(fn(current)));
}
return this.bool(fn(value)) ? value : undefined;
}
});

@@ -1,473 +0,178 @@

const unary = {
'-': '-',
'+': '+',
'no': '!',
'not': '!'
};
const createError = require('./error');
const nodes = require('./nodes').compile;
const binary = {
'in': 'in',
'not in': 'in',
'has': '-',
'has no': '-',
'and': 'and',
'or': 'or',
'+': 'add',
'-': 'sub',
'*': 'mul',
'/': 'div',
'%': 'mod',
'=': 'eq',
'!=': 'ne',
'<': 'lt',
'<=': 'lte',
'>': 'gt',
'>=': 'gte',
'~=': 'match'
};
module.exports = function compile(ast, tolerant = false, suggestions = null) {
function getNodeSpName(node) {
let spName;
module.exports = function compile(ast, suggestRanges = [], statMode = false) {
function addSuggestPoint(spName, range, type) {
let from;
if (!nodeSpName.has(node)) {
spNames.push(spName = 's' + spNames.length);
nodeSpName.set(node, spName);
} else {
spName = nodeSpName.get(node);
}
return spName;
}
function addSuggestPoint(start, end, type, spName, related) {
let range = [start, end, JSON.stringify(type)];
if (type === 'var') {
from = JSON.stringify(scope);
if (!ctx.scope.length) {
return;
}
range.push(JSON.stringify(ctx.scope));
} else {
if (!spName) {
spName = 'v' + (suggestAcc++);
spNames.push(spName = 's' + spNames.length);
}
from = spName;
}
if (from !== '[]') {
normalizedSuggestRanges.push([from, JSON.stringify([range[0], range[1]]), JSON.stringify(type)].join(','));
range.push(spName);
if (related) {
range.push(related);
}
}
normalizedSuggestRanges.push(range);
return spName;
}
function addSuggestPointsFromRanges(ranges) {
return ranges.reduce((spName, range) => {
return addSuggestPoint(spName, range, range[2]) || spName;
}, undefined);
}
function createScope(fn, defCurrent) {
const prevScope = scope;
const prevScope = ctx.scope;
const scopeStart = buffer.length;
scope = scope.slice();
scope.own = [];
scope.firstCurrent = null;
scope.captureCurrent = [];
ctx.scope = ctx.scope.slice();
ctx.scope.own = [];
ctx.scope.firstCurrent = null;
ctx.scope.captureCurrent = [];
ctx.scope.arg1 = prevScope.arg1 || false;
fn();
if (scope.captureCurrent.length) {
const spName = addSuggestPointsFromRanges(scope.captureCurrent);
if (ctx.scope.captureCurrent.length) {
const spName = ctx.scope.captureCurrent.reduce(
(spName, range) => addSuggestPoint(...range, spName),
undefined
);
const stat = 'stat(' + spName + ',current)';
if (spName) {
const stat = 'stat(' + spName + ',current)';
if (scope.firstCurrent) {
buffer[scope.firstCurrent] = stat;
} else {
buffer[scopeStart] = defCurrent(buffer[scopeStart], stat);
}
if (ctx.scope.firstCurrent) {
buffer[ctx.scope.firstCurrent] = stat;
} else {
buffer[scopeStart] = defCurrent(buffer[scopeStart], stat);
}
}
scope = prevScope;
ctx.scope = prevScope;
}
function walk(node) {
const collectStat = statMode && suggestNodes.has(node);
function walk(node, relatedNode) {
let spName = false;
if (collectStat) {
const ranges = suggestNodes.get(node);
const spName = addSuggestPointsFromRanges(ranges);
if (suggestions !== null) {
if (suggestions.has(node)) {
for (const [start, end, type, related] of suggestions.get(node)) {
if (type === 'var') {
addSuggestPoint(start, end, type);
} else if (related === true) {
ctx.scope.captureCurrent.push([start, end, type]);
} else {
if (!spName) {
spName = getNodeSpName(node);
buffer.push('stat(' + spName + ',');
}
if (spName) {
put('stat(' + spName + ',');
}
suggestNodes.delete();
}
if (statMode && captureCurrent.has(node)) {
scope.captureCurrent.push(...captureCurrent.get(node).filter(range => {
if (range[2] === 'var') {
addSuggestPoint(null, range, range[2]);
} else {
return true;
}
}));
}
switch (node.type) {
case 'Data':
put('data');
break;
case 'Context':
put('context');
break;
case 'Current':
if (scope.firstCurrent === null && !scope.captureCurrent.disabled) {
scope.firstCurrent = buffer.length;
}
put('current');
break;
case 'Literal':
put(typeof node.value === 'string' ? JSON.stringify(node.value) : String(node.value));
break;
case 'Identifier':
put(node.name);
break;
case 'Unary':
if (node.operator in unary === false) {
throw new Error('Unknown operator `' + node.operator + '`');
}
if (node.operator === 'not' || node.operator === 'no') {
put('!f.bool(');
walk(node.argument);
put(')');
} else {
put(unary[node.operator]);
walk(node.argument);
}
break;
case 'Binary':
if (node.operator in binary === false) {
throw new Error('Unknown operator `' + node.operator + '`');
}
if (node.operator === 'not in' || node.operator === 'has no') {
put('!');
}
switch (node.operator) {
case 'has':
case 'has no':
put('f.in(');
walk(node.right);
put(',');
walk(node.left);
put(')');
break;
case 'or':
needTmp = true;
put('f.bool(tmp=');
walk(node.left);
put(')?tmp:');
scope.captureCurrent.disabled = true;
walk(node.right);
scope.captureCurrent.disabled = false;
break;
case 'and':
needTmp = true;
put('f.bool(tmp=');
walk(node.left);
put(')?');
scope.captureCurrent.disabled = true;
walk(node.right);
scope.captureCurrent.disabled = false;
put(':tmp');
break;
default:
put('f.');
put(binary[node.operator]);
put('(');
walk(node.left);
put(',');
walk(node.right);
put(')');
}
break;
case 'Conditional':
put('f.bool(');
walk(node.test);
scope.captureCurrent.disabled = true;
put(')?');
walk(node.consequent);
put(':');
walk(node.alternate);
scope.captureCurrent.disabled = false;
break;
case 'Object':
put('{');
walkList(node.properties, ',');
put('}');
break;
case 'Property':
if (!node.key) {
break;
}
if (node.key.type === 'Literal' || node.key.type === 'Identifier') {
walk(node.key);
} else {
put('[');
walk(node.key);
put(']');
}
put(':');
walk(node.value);
break;
case 'Spread':
put('...');
walk(node.query);
break;
case 'Array':
put('[');
walkList(node.elements, ',');
put(']');
break;
case 'Function':
createScope(
() => {
put('current=>(');
walk(node.body);
put(')');
},
(scopeStart, sp) => {
return scopeStart + sp + ',';
}
);
break;
case 'Compare':
if (node.order === 'desc') {
put('-');
}
createScope(
() => {
put('f.cmp((_q=current=>(');
walk(node.query);
put('))(a),_q(b))');
},
(scopeStart, sp) => {
return scopeStart + sp + ',';
}
);
break;
case 'SortingFunction':
put('(a, b)=>{let _q;return ');
walkList(node.compares, '||');
put('||0}');
break;
case 'MethodCall':
put('m.');
walk(node.method);
put('(');
walk(node.value);
if (node.arguments.length) {
put(',');
walkList(node.arguments, ',');
}
put(')');
break;
case 'Definition':
if (!node.name) {
break;
}
if (scope.own.includes(node.name.name)) {
throw new Error(`Identifier '$${node.name.name}' has already been declared`);
}
if (reservedVars.includes(node.name.name)) {
throw new Error(`Identifier '$${node.name.name}' is reserved for future use`);
}
put('const $');
walk(node.name);
put('=');
walk(node.value);
put(';');
scope.push(node.name.name);
scope.own.push(node.name.name);
break;
case 'Parentheses':
put('(');
walk(node.body);
put(')');
break;
case 'Block':
if (node.definitions.length) {
createScope(
() => {
put('(()=>{');
walkList(node.definitions);
put('return ');
walk(node.body);
put('})()');
},
(scopeStart, sp) => {
return scopeStart + sp + ';';
if (type) {
addSuggestPoint(start, end, type, spName, related && getNodeSpName(related));
}
);
} else if (node.body.type === 'Object') {
put('(');
walk(node.body);
put(')');
} else {
walk(node.body);
}
break;
case 'Reference':
if (scope.includes(node.name.name)) {
put('$');
walk(node.name);
} else {
put('typeof $');
walk(node.name);
put('!=="undefined"?$');
walk(node.name);
put(':undefined');
}
break;
case 'Map':
put('f.map(');
walk(node.value);
createScope(
() => {
put(',current=>');
walk(node.query);
},
(scopeStart, sp) => {
put(')');
return scopeStart + '(' + sp + ',';
}
);
put(')');
break;
case 'Filter':
put('f.filter(');
walk(node.value);
createScope(
() => {
put(',current=>');
walk(node.query);
},
(scopeStart, sp) => {
put(')');
return scopeStart + '(' + sp + ',';
}
);
put(')');
break;
case 'Recursive':
put('f.recursive(');
walk(node.value);
createScope(
() => {
put(',current=>');
walk(node.query);
},
(scopeStart, sp) => {
put(')');
return scopeStart + '(' + sp + ',';
}
);
put(')');
break;
case 'GetProperty':
put('f.map(');
walk(node.value);
put(',');
if (node.property.type === 'Identifier') {
put(JSON.stringify(node.property.name));
} else {
walk(node.property);
}
put(')');
break;
}
case 'SliceNotation':
put('f.slice(');
walk(node.value);
node.arguments.slice(0, 3).forEach(item => {
put(',');
item ? walk(item) : put('undefined');
});
put(')');
break;
if (node.type === 'Current' &&
ctx.scope.firstCurrent === null &&
ctx.scope.captureCurrent.disabled !== true) {
ctx.scope.firstCurrent = buffer.length;
}
}
case 'Pipeline':
put('(current=>(');
walk(node.right);
put('))(');
walk(node.left);
put(')');
break;
if (nodes.has(node.type)) {
nodes.get(node.type)(node, ctx, relatedNode);
} else {
throw new Error('Unknown node type `' + node.type + '`');
}
if (collectStat) {
put(')');
if (spName) {
buffer.push(')');
}
}
const reservedVars = ['data', 'context', 'ctx', 'array', 'idx', 'index'];
let scope = [];
let needTmp = false;
const spNames = [];
const nodeSpName = new WeakMap();
const allocatedVars = [];
const normalizedSuggestRanges = [];
const buffer = [
'const current=data;',
{ toString() {
return allocatedVars.length > 0 ? 'let ' + allocatedVars + ';\n' : '';
} },
{ toString() {
return spNames.length === 0
? ''
: [
'const stat=(s,v)=>(s.add(v),v);\n',
'const ' + spNames.map(name => name + '=new Set()') + ';\n'
].join('');
} },
'return '
];
const put = chunk => buffer.push(chunk);
const walkList = (list, sep) => {
list.forEach((element, idx) => {
if (idx > 0) {
put(sep);
const ctx = {
tolerant,
scope: [],
createScope,
error: (message, node) => {
const error = new SyntaxError(message);
if (node && node.range) {
error.details = {
loc: {
range: node.range
}
};
}
walk(element);
});
};
const captureCurrent = suggestRanges.reduce((map, range) => {
if (range[3] === 'current') {
if (map.has(range[4])) {
map.get(range[4]).push(range);
} else {
map.set(range[4], [range]);
if (!tolerant) {
throw error;
}
}
return map;
}, new Map());
const suggestNodes = suggestRanges.reduce((map, range) => {
if (range[3] && range[3] !== 'current') {
if (map.has(range[3])) {
map.get(range[3]).push(range);
} else {
map.set(range[3], [range]);
},
allocateVar() {
const name = 'tmp' + allocatedVars.length;
allocatedVars.push(name);
return name;
},
put: chunk => buffer.push(chunk),
node: walk,
nodeOrNothing(node, relatedNode) {
if (node) {
walk(node, relatedNode);
}
},
nodeOrCurrent(node, relatedNode) {
walk(node || { type: 'Current' }, relatedNode);
},
list(list, sep, relatedNode) {
list.forEach((node, idx) => {
if (idx > 0) {
buffer.push(sep);
}
walk(node, relatedNode);
});
}
return map;
}, new Map());
let suggestAcc = 0;
const normalizedSuggestRanges = [];
};

@@ -477,25 +182,21 @@ createScope(

(scopeStart, sp) => {
put(')');
return scopeStart + '(' + sp + ',';
buffer.push(')');
return '(' + sp + ',' + scopeStart;
}
);
if (needTmp) {
buffer.unshift('let tmp;');
if (suggestions !== null) {
buffer.push('\n,[' + normalizedSuggestRanges.map(s => '[' + s + ']') + ']');
}
if (statMode) {
if (suggestAcc > 0) {
buffer.unshift('const ' + Array.from(Array(suggestAcc), (_, i) => 'v' + i + '=new Set()') + ';\n');
buffer.unshift('const stat=(values,v)=>(values.add(v),v);\n');
}
put('\n,[' + normalizedSuggestRanges.map(s => '[' + s + ']') + ']');
}
try {
return new Function('f', 'm', 'data', 'context', buffer.join(''));
} catch (e) {
console.error('Query compile error:', buffer.join(''));
throw e;
const compiledSource = buffer.join('');
const error = createError('SyntaxError', 'Jora query compilation error');
error.compiledSource = compiledSource;
throw error;
}
};
const { isPlainObject } = require('../utils');
const {
Arg1,
Array,
Binary,
Block,
Compare,
Conditional,
Context,
Current,
Data,
// Declarator,
Definition,
Filter,
Function,
GetProperty,
Identifier,
Literal,
Map,
Method,
MethodCall,
Object,
Parentheses,
Pick,
Pipeline,
Property,
Recursive,
Reference,
SliceNotation,
SortingFunction,
Spread,
Unary
} = require('./nodes').build;
const isArray = [].constructor.isArray;

@@ -6,2 +38,3 @@ const keys = {}.constructor.keys;

const $1 = { name: '$1' };
const $1name = { name: '$1.name' };
const $2 = { name: '$2' };

@@ -12,3 +45,4 @@ const $3 = { name: '$3' };

const $r0 = { name: '@0.range' };
const refs = new Set([$0, $1, $2, $3, $4, $5, $r0]);
const $r1 = { name: '@1.range' };
const refs = new Set([$0, $1, $1name, $2, $3, $4, $5, $r0, $r1]);
const asis = '';

@@ -47,3 +81,3 @@

function $$(node, ...suggestions) {
function $$(node) {
if (isPlainObject(node)) {

@@ -53,227 +87,15 @@ node.range = $r0;

suggestions = suggestions.length
? '; yy.suggestRanges.push(' + suggestions.filter(Boolean) + ')'
: '';
return '$$ = ' + stringify(node) + suggestions;
return '$$ = ' + stringify(node);
}
function Suggestion(start, end, types, context) {
return `[${[
start ? start.name.replace(/\$/, '@') : 'null',
end ? end.name.replace(/\$/, '@') : 'null',
stringify(types),
stringify(context) || null
].concat(context === 'current' ? '$$' : [])}]`;
}
function SuggestQueryRoot() {
return Suggestion(null, $0, ['var', 'path'], 'current');
}
function SuggestIdent(ref, from) {
return Suggestion(ref, ref, 'path', from);
}
function SuggestMethod() {
// Suggestion(ref, ref, 'method', null);
}
function Data() {
// FIXME: temporary solution, because of `declarator` conflict
// with `queryRule` when declarator specified aside
function Declarator_(name) {
return {
type: 'Data'
};
}
function Context() {
return {
type: 'Context'
};
}
function Current() {
return {
type: 'Current'
};
}
function Literal(value) {
return {
type: 'Literal',
value
};
}
function Unary(operator, argument) {
return {
type: 'Unary',
operator,
argument
};
}
function Binary(operator, left, right) {
return {
type: 'Binary',
operator,
left,
right
};
}
function Conditional(test, consequent, alternate) {
return {
type: 'Conditional',
test,
consequent,
alternate
};
}
function Object(properties) {
return {
type: 'Object',
properties
};
}
function Property(key, value) {
return {
type: 'Property',
key,
value
};
}
function Spread(query) {
return {
type: 'Spread',
query
};
}
function Array(elements) {
return {
type: 'Array',
elements
};
}
function Function(arguments, body) {
return {
type: 'Function',
arguments,
body
};
}
function Compare(query, order) {
return {
type: 'Compare',
query,
order
};
}
function SortingFunction(compares) {
return {
type: 'SortingFunction',
compares
};
}
function MethodCall(value, method, arguments) {
return {
type: 'MethodCall',
value,
method,
arguments
};
}
function Definition(name, value) {
return {
type: 'Definition',
type: 'Declarator',
name,
value
range: $r1
};
}
function Block(definitions, body) {
return {
type: 'Block',
definitions,
body
};
}
function Parentheses(body) {
return {
type: 'Parentheses',
body
};
}
function Reference(name) {
return {
type: 'Reference',
name
};
}
function Identifier(name) {
return {
type: 'Identifier',
name
};
}
function Map(value, query) {
return {
type: 'Map',
value,
query
};
}
function Filter(value, query) {
return {
type: 'Filter',
value,
query
};
}
function Recursive(value, query) {
return {
type: 'Recursive',
value,
query
};
}
function GetProperty(value, property) {
return {
type: 'GetProperty',
value,
property
};
}
function SliceNotation(value, arguments) {
return {
type: 'SliceNotation',
value,
arguments
};
}
function Pipeline(left, right) {
return {
type: 'Pipeline',
left,
right
};
}
function createCommaList(name, element) {

@@ -331,3 +153,3 @@ return [

// keyword operators (should goes before SYMBOL)
// keyword operators (should goes before IDENT)
['and{wb}', 'return "AND";'],

@@ -343,8 +165,8 @@ ['or{wb}' , 'return "OR";'],

// primitives
['\\d+(?:\\.\\d+)?([eE][-+]?\\d+)?{wb}', switchToPreventPrimitiveState + 'yytext = Number(yytext); return "LITERAL";'], // 212.321
['(\\d+\\.|\\.)?\\d+([eE][-+]?\\d+)?{wb}', switchToPreventPrimitiveState + 'yytext = Number(yytext); return "NUMBER";'], // 212.321
['"(?:\\\\.|[^"])*"', switchToPreventPrimitiveState + 'yytext = this.toStringLiteral(yytext); return "STRING";'], // "foo" "with \" escaped"
["'(?:\\\\.|[^'])*'", switchToPreventPrimitiveState + 'yytext = this.toStringLiteral(yytext); return "STRING";'], // 'foo' 'with \' escaped'
['{rx}', switchToPreventPrimitiveState + 'yytext = this.toRegExp(yytext); return "LITERAL";'], // /foo/i
['{ident}', switchToPreventPrimitiveState + 'return "SYMBOL";'], // foo123
['\\${ident}', switchToPreventPrimitiveState + 'yytext = yytext.slice(1); return "$SYMBOL";'], // $foo123
['{rx}', switchToPreventPrimitiveState + 'yytext = this.toRegExp(yytext); return "REGEXP";'], // /foo/i
['{ident}', switchToPreventPrimitiveState + 'return "IDENT";'], // foo123
['\\${ident}', switchToPreventPrimitiveState + 'yytext = yytext.slice(1); return "$IDENT";'], // $foo123

@@ -354,2 +176,3 @@ // special vars

['#', switchToPreventPrimitiveState + 'return "#";'],
['\\${2}', switchToPreventPrimitiveState + 'return "$$";'],
['\\$', switchToPreventPrimitiveState + 'return "$";'],

@@ -428,5 +251,5 @@

['definitions e', $$(Block($1, $2))],
['definitions', $$(Block($1, Current()))],
['definitions', $$(Block($1, null))],
['e', $$(Block([], $1))],
['', $$(Block([], Current()), Suggestion($0, null, ['var', 'path'], 'current'))]
['', $$(Block([], null))]
],

@@ -438,12 +261,19 @@ definitions: [

def: [
['$ ;', $$(Definition(null, Current()), Suggestion($1, $1, 'path', 'current'))], // do nothing, but collect stat (suggestions)
['$ident ;', $$(Definition($1, GetProperty(Current(), $1)), SuggestIdent($1, 'current'))],
['$ident : e ;', $$(Definition($1, $3))]
['$ ;', $$(Definition(Declarator_(null), null))], // declare nothing, but avoid failure and capture stat (suggestions)
['$ : e ;', $$(Definition(Declarator_(null), $3))], // declare nothing, but avoid failure and capture stat (suggestions)
['$ident ;', $$(Definition(Declarator_($1name), null))],
['$ident : e ;', $$(Definition(Declarator_($1name), $3))]
],
// FIXME: temporary solution, because of `declarator` conflict
// with `queryRule` when declarator specified aside
// declarator: [
// ['$', $$(Declarator(null))], // declare nothing, but avoid failure and capture stat (suggestions)
// ['$ident', $$(Declarator($1))]
// ],
ident: [
['SYMBOL', $$(Identifier($1))]
['IDENT', $$(Identifier($1))]
],
$ident: [
['$SYMBOL', $$(Identifier($1))]
['$IDENT', $$(Identifier($1))]
],

@@ -455,3 +285,3 @@

// functions
['FUNCTION_START block FUNCTION_END', $$(Function([], $2))],
['FUNCTION_START block FUNCTION_END', $$(Function([], $2, true))],
['FUNCTION e', $$(Function([], $2))],

@@ -470,4 +300,4 @@ ['sortingCompareList', $$(SortingFunction($1))],

// binary operators
['e IN e', $$(Binary($2, $1, $3), Suggestion($1, $1, 'in-value', $3))],
['e HAS e', $$(Binary($2, $1, $3), Suggestion($3, $3, 'in-value', $1))],
['e IN e', $$(Binary($2, $1, $3))],
['e HAS e', $$(Binary($2, $1, $3))],
['e NOTIN e', $$(Binary($2, $1, $3))],

@@ -482,4 +312,4 @@ ['e HASNO e', $$(Binary($2, $1, $3))],

['e % e', $$(Binary($2, $1, $3))],
['e = e', $$(Binary($2, $1, $3), Suggestion($3, $3, 'value', $1))],
['e != e', $$(Binary($2, $1, $3), Suggestion($3, $3, 'value', $1))],
['e = e', $$(Binary($2, $1, $3))],
['e != e', $$(Binary($2, $1, $3))],
['e < e', $$(Binary($2, $1, $3))],

@@ -502,42 +332,47 @@ ['e <= e', $$(Binary($2, $1, $3))],

['#', $$(Context())],
['$', $$(Current(), Suggestion($1, $1, 'var', 'current')), { prec: 'def' }],
['$ident', $$(Reference($1), Suggestion($1, $1, 'var', 'current')), { prec: 'def' }],
['$', $$(Current()), { prec: 'def' }],
['$$', $$(Arg1())],
['$ident', $$(Reference($1)), { prec: 'def' }],
['STRING', $$(Literal($1))],
['NUMBER', $$(Literal($1))],
['REGEXP', $$(Literal($1))],
['LITERAL', $$(Literal($1))],
['object', asis],
['array', asis],
['[ sliceNotation ]', $$(SliceNotation(Current(), $2))],
['ident', $$(GetProperty(Current(), $1), Suggestion($1, $1, 'var', 'current'), SuggestIdent($1, 'current'))],
['ident ( )', $$(MethodCall(Current(), $1, []), SuggestMethod($1), Suggestion($3, $2, ['var', 'path'], 'current'))],
['ident ( arguments )', $$(MethodCall(Current(), $1, $3), SuggestMethod($1))],
['[ sliceNotation ]', $$(SliceNotation(null, $2))],
['ident', $$(GetProperty(null, $1))],
['method()', $$(MethodCall(null, $1))],
['( e )', $$(Parentheses($2))], // NOTE: using e instead of block for preventing a callback creation
['( definitions e )', $$(Parentheses(Block($2, $3)))],
['. ident', $$(GetProperty(Current(), $2), SuggestQueryRoot(), SuggestIdent($2, 'current'))],
['. ident ( )', $$(MethodCall(Current(), $2, []), SuggestQueryRoot(), SuggestIdent($2, 'current'), SuggestMethod($2), Suggestion($4, $3, ['var', 'path'], 'current'))],
['. ident ( arguments )', $$(MethodCall(Current(), $2, $4), SuggestQueryRoot(), SuggestIdent($2, 'current'), SuggestMethod($2))],
['.( block )', $$(Map(Current(), $2), SuggestQueryRoot())],
['.[ block ]', $$(Filter(Current(), $2), SuggestQueryRoot())],
['.. ident', $$(Recursive(Current(), GetProperty(Current(), $2)), SuggestQueryRoot(), SuggestIdent($2, 'current'))],
['.. ident ( )', $$(Recursive(Current(), MethodCall(Current(), $2, [])), SuggestQueryRoot(), SuggestIdent($2, 'current'), Suggestion($4, $3, ['var', 'path'], 'current'))],
['.. ident ( arguments )', $$(Recursive(Current(), MethodCall(Current(), $2, $4)), SuggestQueryRoot(), SuggestIdent($2, 'current'))],
['..( block )', $$(Recursive(Current(), $2), SuggestQueryRoot())]
['. ident', $$(GetProperty(null, $2))],
['. method()', $$(MethodCall(null, $2))],
['.( block )', $$(Map(null, $2))],
['.[ block ]', $$(Filter(null, $2))],
['.. ident', $$(Recursive(null, GetProperty(null, $2)))],
['.. method()', $$(Recursive(null, MethodCall(null, $2)))],
['..( block )', $$(Recursive(null, $2))]
],
relativePath: [
['query [ e ]', $$(GetProperty($1, $3))],
['query [ ]', $$(Pick($1, null))],
['query [ e ]', $$(Pick($1, $3))],
['query [ sliceNotation ]', $$(SliceNotation($1, $3))],
['query . ident', $$(GetProperty($1, $3), SuggestIdent($3, $1))],
['query . ident ( )', $$(MethodCall($1, $3, []), SuggestIdent($3, $1), SuggestMethod($3), Suggestion($5, $4, ['var', 'path'], 'current'))],
['query . ident ( arguments )', $$(MethodCall($1, $3, $5), SuggestIdent($3, $1), SuggestMethod($3))],
['query . ident', $$(GetProperty($1, $3))],
['query . method()', $$(MethodCall($1, $3))],
['query .( block )', $$(Map($1, $3))],
['query .[ block ]', $$(Filter($1, $3))],
['query .. ident', $$(Recursive($1, GetProperty(Current(), $3)), SuggestIdent($3, $1))],
['query .. ident ( )', $$(Recursive($1, MethodCall(Current(), $3, [])), SuggestIdent($3, $1), SuggestMethod($3), Suggestion($5, $4, ['var', 'path'], 'current'))],
['query .. ident ( arguments )', $$(Recursive($1, MethodCall(Current(), $3, $5)), SuggestIdent($3, $1), SuggestMethod($3))],
['query .. ident', $$(Recursive($1, GetProperty(null, $3)))],
['query .. method()', $$(Recursive($1, MethodCall(null, $3)))],
['query ..( block )', $$(Recursive($1, $3))]
],
'method()': [
['ident ( )', $$(Method($1, []))],
['ident ( arguments )', $$(Method($1, $3))],
['$ident ( )', $$(Method(Reference($1), []))],
['$ident ( arguments )', $$(Method(Reference($1), $3))]
],
arguments: createCommaList('arguments', 'e'),
object: [
['{ }', $$(Object([]), Suggestion($2, $1, ['var', 'path'], 'current'))],
['{ }', $$(Object([]))],
['{ properties }', $$(Object($2))]

@@ -547,16 +382,23 @@ ],

property: [
['ident', $$(Property($1, GetProperty(Current(), $1)), Suggestion($1, $1, 'var', 'current'), SuggestIdent($1, 'current'))],
['$', $$(Property(null, Current()), Suggestion($1, $1, 'var', 'current'))], // do nothing, but collect stat (suggestions)
['$ident', $$(Property($1, Reference($1)), Suggestion($1, $1, 'var', 'current'))],
['ident', $$(Property($1, null))],
['$', $$(Property(Current(), null))], // do nothing, but collect stat (suggestions)
['$ident', $$(Property(Reference($1), null))],
['ident : e', $$(Property($1, $3))],
['STRING : e', $$(Property(Literal($1), $3))], // TODO: make the same for NUMBER
['STRING : e', $$(Property(Literal($1), $3))],
['NUMBER : e', $$(Property(Literal($1), $3))],
['LITERAL : e', $$(Property(Literal($1), $3))],
['[ e ] : e', $$(Property($2, $5))],
['...', $$(Spread(Current()), Suggestion($1, null, ['var', 'path'], 'current'))],
['...', $$(Spread(null))],
['... query', $$(Spread($2))]
],
arrayItems: createCommaList('arrayItems', 'e'),
arrayElements: createCommaList('arrayElements', 'arrayElement'),
arrayElement: [
['e', asis],
['...', $$(Spread(null, true))],
['... e', $$(Spread($2, true))]
],
array: [
['[ ]', $$(Array([]), Suggestion($2, $1, ['var', 'path'], 'current'))],
['[ arrayItems ]', $$(Array($2))]
['[ ]', $$(Array([]))],
['[ arrayElements ]', $$(Array($2))]
],

@@ -573,3 +415,3 @@

['e sliceNotationComponent', $$([$1, $2])],
['e sliceNotationComponent sliceNotationComponent', $$([$1,$2,$3])]
['e sliceNotationComponent sliceNotationComponent', $$([$1, $2, $3])]
],

@@ -576,0 +418,0 @@ sliceNotationComponent: [

@@ -0,1 +1,3 @@

const nodes = require('./nodes').stringify;
function isSimpleGetPropertyQuery(node) {

@@ -6,3 +8,3 @@ if (node.type !== 'GetProperty') {

if (node.value.type !== 'Current') {
if (node.value && node.value.type !== 'Current') {
return false;

@@ -23,3 +25,3 @@ }

if (node.value.type !== 'Current') {
if (node.value && node.value.type !== 'Current') {
return false;

@@ -53,210 +55,6 @@ }

function walk(node) {
switch (node.type) {
case 'Data':
put('@');
break;
case 'Context':
put('#');
break;
case 'Current':
put('$');
break;
case 'Literal':
put(typeof node.value === 'string' ? JSON.stringify(node.value) : String(node.value));
break;
case 'Identifier':
put(node.name);
break;
case 'Unary':
put(node.operator);
if (node.operator !== '-' && node.operator !== '+') {
put(' ');
}
walk(node.argument);
break;
case 'Binary':
walk(node.left);
if (/^[a-z]/i.test(node.operator)) {
put(' ');
put(node.operator);
put(' ');
} else {
put(node.operator);
}
walk(node.right);
break;
case 'Conditional':
walk(node.test);
put('?');
walk(node.consequent);
put(':');
walk(node.alternate);
break;
case 'Object':
put('{');
stringifyList(node.properties, ',');
put('}');
break;
case 'Property':
// $ -> $
// foo: $foo -> $foo
if (!node.key || isSameIdentifierAndReference(node.value, node.key)) {
walk(node.value);
break;
}
if (node.key.type === 'Literal' || node.key.type === 'Identifier') {
walk(node.key);
} else {
put('[');
walk(node.key);
put(']');
}
if (node.key.type !== 'Identifier' || !isGetProperty(node.value, node.key.name)) {
put(':');
walk(node.value);
}
break;
case 'Spread':
put('...');
walkIfNotCurrent(node.query);
break;
case 'Array':
put('[');
stringifyList(node.elements, ',');
put(']');
break;
case 'Function':
put('<');
walk(node.body);
put('>');
break;
case 'Compare':
walk(node.query);
put(' ');
put(node.order);
break;
case 'SortingFunction':
stringifyList(node.compares, ',');
break;
case 'MethodCall':
walkIfNotCurrent(node.value) && put('.');
walk(node.method);
put('(');
stringifyList(node.arguments, ',');
put(')');
break;
case 'Definition':
if (!node.name) {
walk(node.value);
} else {
put('$');
walk(node.name);
if (node.name.type !== 'Identifier' || !isGetProperty(node.value, node.name.name)) {
put(':');
walk(node.value);
}
}
put(';');
break;
case 'Parentheses':
put('(');
walk(node.body);
put(')');
break;
case 'Block':
node.definitions.forEach(walk);
walk(node.body);
break;
case 'Reference':
put('$');
walk(node.name);
break;
case 'Map':
walkIfNotCurrent(node.value);
put('.(');
walk(node.query);
put(')');
break;
case 'Filter':
walkIfNotCurrent(node.value);
put('.[');
walk(node.query);
put(']');
break;
case 'Recursive':
walkIfNotCurrent(node.value);
put('..');
if (isSimpleGetPropertyQuery(node.query) || isSimpleMethodCallQuery(node.query)) {
walk(node.query);
} else {
put('(');
walk(node.query);
put(')');
}
break;
case 'GetProperty':
if (node.property.type === 'Identifier') {
walkIfNotCurrent(node.value) && put('.');
walk(node.property);
} else {
walk(node.value);
put('[');
walk(node.property);
put(']');
}
break;
case 'SliceNotation': {
const [a, b, c] = node.arguments;
walkIfNotCurrent(node.value);
put('[');
if (a) {
walk(a);
}
put(':');
if (b) {
walk(b);
}
if (c) {
put(':');
walk(c);
}
put(']');
break;
}
case 'Pipeline':
walk(node.left);
put('|');
walk(node.right);
break;
default:
throw new Error('Unknown node type `' + node.type + '`');
if (nodes.has(node.type)) {
nodes.get(node.type)(node, ctx);
} else {
throw new Error('Unknown node type `' + node.type + '`');
}

@@ -266,21 +64,35 @@ }

const buffer = [];
const put = chunk => buffer.push(chunk);
const walkIfNotCurrent = node => {
if (node.type !== 'Current') {
walk(node);
return true;
const ctx = {
isSimpleGetPropertyQuery,
isSimpleMethodCallQuery,
isSameIdentifierAndReference,
isGetProperty,
put(chunk) {
buffer.push(chunk);
},
node: walk,
nodeOrNothing(node) {
if (node !== null) {
walk(node);
return true;
}
},
list(list, sep) {
if (!sep) {
list.forEach(walk);
return;
}
list.forEach((element, idx) => {
if (idx > 0) {
ctx.put(sep);
}
walk(element);
});
}
};
const stringifyList = (list, sep) => {
list.forEach((element, idx) => {
if (idx > 0) {
put(sep);
}
walk(element);
});
};
walk(ast);
walk(ast, ctx);
return buffer.join('');
};

@@ -27,6 +27,7 @@ const buildin = require('./lang/compile-buildin');

map: buildin.map,
keys: function(current) {
pick: buildin.pick,
keys(current) {
return Object.keys(current || {});
},
values: function(current) {
values(current) {
const values = new Set();

@@ -42,3 +43,3 @@

},
entries: function(current) {
entries(current) {
const entries = [];

@@ -54,3 +55,3 @@

},
fromEntries: function(current) {
fromEntries(current) {
const result = {};

@@ -68,41 +69,3 @@

},
pick: function(current, ref) {
if (!current) {
return undefined;
}
if (typeof ref === 'function') {
if (Array.isArray(current)) {
return current.find(item => ref(item));
}
for (const key in current) {
if (hasOwnProperty.call(current, key)) {
if (ref(current[key])) {
return { key, value: current[key] };
}
}
}
return;
}
return Array.isArray(current) ? current[ref || 0] : current[ref];
},
mapToArray: function(current, keyProperty = 'key', valueProperty) {
const result = [];
for (const key in current) {
if (hasOwnProperty.call(current, key)) {
result.push(
valueProperty
? { [keyProperty]: key, [valueProperty]: current[key] }
: { [keyProperty]: key, ...current[key] }
);
}
}
return result;
},
size: function(current) {
size(current) {
if (isPlainObject(current)) {

@@ -114,3 +77,3 @@ return Object.keys(current).length;

},
sort: function(current, fn) {
sort(current, fn) {
let sorter;

@@ -149,3 +112,3 @@

},
reverse: function(current) {
reverse(current) {
if (!Array.isArray(current)) {

@@ -157,6 +120,6 @@ return current;

},
slice: function(current, from, to) {
slice(current, from, to) {
return buildin.slice(current, from, to);
},
group: function(current, keyGetter, valueGetter) {
group(current, keyGetter, valueGetter) {
if (typeof keyGetter !== 'function') {

@@ -199,6 +162,6 @@ keyGetter = noop;

},
split: function(current, pattern) {
split(current, pattern) {
return String(current).split(pattern);
},
join: function(current, separator) {
join(current, separator) {
return Array.isArray(current)

@@ -208,3 +171,3 @@ ? current.join(separator)

},
match: function(current, pattern, matchAll) {
match(current, pattern, matchAll) {
const input = String(current);

@@ -226,3 +189,12 @@

return match && matchEntry(match);
},
reduce(current, fn, initValue = undefined) {
if (Array.isArray(current)) {
return initValue !== undefined
? current.reduce((res, current) => fn(current, res), initValue)
: current.reduce((res, current) => fn(current, res));
}
return fn(current, initValue);
}
});

@@ -6,2 +6,3 @@ const { addToSet, isPlainObject } = require('./utils');

'in-value': 'value',
'value-subset': 'value',
'var': 'variable'

@@ -11,3 +12,3 @@ };

function valuesToSuggestions(context, values) {
function valuesToSuggestions(context, values, related) {
const suggestions = new Set();

@@ -68,2 +69,21 @@ const addValue = value => {

break;
case 'value-subset':
values.forEach(value => {
if (Array.isArray(value)) {
value.forEach(addValue);
} else {
addValue(value);
}
});
// delete used
related.forEach(arr => {
arr.forEach(value => {
if (typeof value === 'string' || typeof value === 'number') {
suggestions.delete(JSON.stringify(value));
}
});
});
break;
}

@@ -77,25 +97,19 @@

for (let i = 0; i < points.length; i++) {
const [values, ranges, context] = points[i];
for (let [from, to, context, values, related = null] of points) {
if (pos >= from && pos <= to && (includeEmpty || values.size || values.length)) {
let current = source.substring(from, to);
for (let j = 0; j < ranges.length; j += 2) {
let from = ranges[j];
let to = ranges[j + 1];
if (!/\S/.test(current)) {
current = '';
from = to = pos;
}
if (pos >= from && pos <= to && (includeEmpty || values.size || values.length)) {
let current = source.substring(from, to);
if (!/\S/.test(current)) {
current = '';
from = to = pos;
}
result.push({
context,
current,
from,
to,
values
});
}
result.push({
context,
current,
from,
to,
values,
related
});
}

@@ -122,7 +136,7 @@ }

ranges.forEach(range => {
const { context, current, from, to, values } = range;
const { context, current, from, to, values, related } = range;
// console.log({current, variants:[...suggestions.get(range)], suggestions })
suggestions.push(
...valuesToSuggestions(context, values)
...valuesToSuggestions(context, values, related)
.map(value => ({

@@ -129,0 +143,0 @@ current,

@@ -0,1 +1,2 @@

const hasOwnProperty = Object.hasOwnProperty;
const toString = Object.prototype.toString;

@@ -20,3 +21,3 @@

function isPlainObject(value) {
return value && typeof value === 'object' && value.constructor === Object;
return value !== null && typeof value === 'object' && value.constructor === Object;
}

@@ -23,0 +24,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc