@speclynx/apidom-json-path 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPath=t():e.apidomJsonPath=t()}(self,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{EvaluationJsonPathError:()=>c,MultiEvaluationJsonPathError:()=>h,evaluate:()=>at,evaluateMulti:()=>it});class r extends AggregateError{constructor(e,t,r){super(e,t,r),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const n=r;class s extends Error{static[Symbol.hasInstance](e){return super[Symbol.hasInstance](e)||Function.prototype[Symbol.hasInstance].call(n,e)}constructor(e,t){super(e,t),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const a=s;const i=class extends a{constructor(e,t){if(super(e,t),null!=t&&"object"==typeof t){const{cause:e,...r}=t;Object.assign(this,r)}}};const o=class extends i{};const c=class extends o{path;element;constructor(e,t){super(e,t),void 0!==t&&(this.path=t.path,this.element=t.element)}};const h=class extends o{paths;element;constructor(e,t){super(e,t),void 0!==t&&(this.paths=t.paths,this.element=t.element)}};class l{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+l.version}static addUnaryOp(e){return l.max_unop_len=Math.max(e.length,l.max_unop_len),l.unary_ops[e]=1,l}static addBinaryOp(e,t,r){return l.max_binop_len=Math.max(e.length,l.max_binop_len),l.binary_ops[e]=t,r?l.right_associative.add(e):l.right_associative.delete(e),l}static addIdentifierChar(e){return l.additional_identifier_chars.add(e),l}static addLiteral(e,t){return l.literals[e]=t,l}static removeUnaryOp(e){return delete l.unary_ops[e],e.length===l.max_unop_len&&(l.max_unop_len=l.getMaxKeyLen(l.unary_ops)),l}static removeAllUnaryOps(){return l.unary_ops={},l.max_unop_len=0,l}static removeIdentifierChar(e){return l.additional_identifier_chars.delete(e),l}static removeBinaryOp(e){return delete l.binary_ops[e],e.length===l.max_binop_len&&(l.max_binop_len=l.getMaxKeyLen(l.binary_ops)),l.right_associative.delete(e),l}static removeAllBinaryOps(){return l.binary_ops={},l.max_binop_len=0,l}static removeLiteral(e){return delete l.literals[e],l}static removeAllLiterals(){return l.literals={},l}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new l(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return l.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!l.binary_ops[String.fromCharCode(e)]||l.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return l.isIdentifierStart(e)||l.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(l.hooks[e]){const r={context:this,node:t};return l.hooks.run(e,r),r.node}return t}searchHook(e){if(l.hooks[e]){const t={context:this};return l.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===l.SPACE_CODE||e===l.TAB_CODE||e===l.LF_CODE||e===l.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:l.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,r,n=[];for(;this.index<this.expr.length;)if(t=this.code,t===l.SEMCOL_CODE||t===l.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())n.push(r);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,l.max_binop_len),t=e.length;for(;t>0;){if(l.binary_ops.hasOwnProperty(e)&&(!l.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!l.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,s,a,i,o,c;if(a=this.gobbleToken(),!a)return a;if(t=this.gobbleBinaryOp(),!t)return a;for(s={value:t,prec:l.binaryPrecedence(t),right_a:l.right_associative.has(t)},i=this.gobbleToken(),i||this.throwError("Expected expression after "+t),n=[a,s,i];t=this.gobbleBinaryOp();){if(r=l.binaryPrecedence(t),0===r){this.index-=t.length;break}s={value:t,prec:r,right_a:l.right_associative.has(t)},c=t;const o=e=>s.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&o(n[n.length-2]);)i=n.pop(),t=n.pop().value,a=n.pop(),e={type:l.BINARY_EXP,operator:t,left:a,right:i},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+c),n.push(s,e)}for(o=n.length-1,e=n[o];o>1;)e={type:l.BINARY_EXP,operator:n[o-1].value,left:n[o-2],right:e},o-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(e=this.code,l.isDecimalDigit(e)||e===l.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===l.SQUOTE_CODE||e===l.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===l.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,l.max_unop_len),r=t.length;r>0;){if(l.unary_ops.hasOwnProperty(t)&&(!l.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!l.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:l.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}l.isIdentifierStart(e)?(n=this.gobbleIdentifier(),l.literals.hasOwnProperty(n.name)?n={type:l.LITERAL,value:l.literals[n.name],raw:n.name}:n.name===l.this_str&&(n={type:l.THIS_EXP})):e===l.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===l.PERIOD_CODE||t===l.OBRACK_CODE||t===l.OPAREN_CODE||t===l.QUMARK_CODE;){let r;if(t===l.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==l.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===l.OBRACK_CODE?((e={type:l.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==l.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===l.OPAREN_CODE?e={type:l.CALL_EXP,arguments:this.gobbleArguments(l.CPAREN_CODE),callee:e}:(t===l.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:l.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,r="";for(;l.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(this.code===l.PERIOD_CODE)for(r+=this.expr.charAt(this.index++);l.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(r+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(r+=this.expr.charAt(this.index++));l.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);l.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")")}return t=this.code,l.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+r+this.char+")"):(t===l.PERIOD_CODE||1===r.length&&r.charCodeAt(0)===l.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:l.LITERAL,value:parseFloat(r),raw:r}}gobbleStringLiteral(){let e="";const t=this.index,r=this.expr.charAt(this.index++);let n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:l.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(l.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,l.isIdentifierPart(e));)this.index++;return{type:l.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let s=this.code;if(s===e){r=!0,this.index++,e===l.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(s===l.COMMA_CODE){if(this.index++,n++,n!==t.length)if(e===l.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===l.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==l.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(l.CPAREN_CODE);if(this.code===l.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:l.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:l.ARRAY_EXP,elements:this.gobbleArguments(l.CBRACK_CODE)}}}const u=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}};Object.assign(l,{hooks:u,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(l),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),l.max_unop_len=l.getMaxKeyLen(l.unary_ops),l.max_binop_len=l.getMaxKeyLen(l.binary_ops);const p=e=>new l(e).parse(),f=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(l).filter(e=>!f.includes(e)&&void 0===p[e]).forEach(e=>{p[e]=l[e]}),p.Jsep=l;var d={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const s=this.gobbleExpression();if(s||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:s},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}};p.plugins.register(d);var y={name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){const n=this.expr.slice(r,this.index);let s,a="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;a+=this.char}try{s=new RegExp(n,a)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:s,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}};const m={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];function r(e){m.assignmentOperators.has(e.operator)?(e.type="AssignmentExpression",r(e.left),r(e.right)):e.operator||Object.values(e).forEach(e=>{e&&"object"==typeof e&&r(e)})}m.assignmentOperators.forEach(t=>e.addBinaryOp(t,m.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(e){const r=this.code;m.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&t.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))}),e.hooks.add("after-token",function(e){if(e.node){const r=this.code;m.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:e.node,prefix:!1})}}),e.hooks.add("after-expression",function(e){e.node&&r(e.node)})}};p.plugins.register(y,m),p.addUnaryOp("typeof"),p.addLiteral("null",null),p.addLiteral("undefined",void 0);const g=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),b={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return b.evalBinaryExpression(e,t);case"Compound":return b.evalCompound(e,t);case"ConditionalExpression":return b.evalConditionalExpression(e,t);case"Identifier":return b.evalIdentifier(e,t);case"Literal":return b.evalLiteral(e,t);case"MemberExpression":return b.evalMemberExpression(e,t);case"UnaryExpression":return b.evalUnaryExpression(e,t);case"ArrayExpression":return b.evalArrayExpression(e,t);case"CallExpression":return b.evalCallExpression(e,t);case"AssignmentExpression":return b.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression:(e,t)=>({"||":(e,t)=>e||t(),"&&":(e,t)=>e&&t(),"|":(e,t)=>e|t(),"^":(e,t)=>e^t(),"&":(e,t)=>e&t(),"==":(e,t)=>e==t(),"!=":(e,t)=>e!=t(),"===":(e,t)=>e===t(),"!==":(e,t)=>e!==t(),"<":(e,t)=>e<t(),">":(e,t)=>e>t(),"<=":(e,t)=>e<=t(),">=":(e,t)=>e>=t(),"<<":(e,t)=>e<<t(),">>":(e,t)=>e>>t(),">>>":(e,t)=>e>>>t(),"+":(e,t)=>e+t(),"-":(e,t)=>e-t(),"*":(e,t)=>e*t(),"/":(e,t)=>e/t(),"%":(e,t)=>e%t()}[e.operator](b.evalAst(e.left,t),()=>b.evalAst(e.right,t))),evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){"Identifier"===e.body[n].type&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&"AssignmentExpression"===e.body[n+1].type&&(n+=1);const s=e.body[n];r=b.evalAst(s,t)}return r},evalConditionalExpression:(e,t)=>b.evalAst(e.test,t)?b.evalAst(e.consequent,t):b.evalAst(e.alternate,t),evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral:e=>e.value,evalMemberExpression(e,t){const r=String(e.computed?b.evalAst(e.property):e.property.name),n=b.evalAst(e.object,t);if(null==n)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&g.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const s=n[r];return"function"==typeof s?s.bind(n):s},evalUnaryExpression:(e,t)=>({"-":e=>-b.evalAst(e,t),"!":e=>!b.evalAst(e,t),"~":e=>~b.evalAst(e,t),"+":e=>+b.evalAst(e,t),typeof:e=>typeof b.evalAst(e,t)}[e.operator](e.argument)),evalArrayExpression:(e,t)=>e.elements.map(e=>b.evalAst(e,t)),evalCallExpression(e,t){const r=e.arguments.map(e=>b.evalAst(e,t));return b.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if("Identifier"!==e.left.type)throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=b.evalAst(e.right,t);return t[r]=n,t[r]}};function E(e,t){return(e=e.slice()).push(t),e}function x(e,t){return(t=t.slice()).unshift(e),t}class w extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function v(e,t,r,n,s){if(!(this instanceof v))try{return new v(e,t,r,n,s)}catch(e){if(!e.avoidNew)throw e;return e.value}"string"==typeof e&&(s=n,n=r,r=t,t=e,e=null);const a=e&&"object"==typeof e;if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=!Object.hasOwn(e,"wrap")||e.wrap,this.sandbox=e.sandbox||{},this.eval=void 0===e.eval?"safe":e.eval,this.ignoreEvalErrors=void 0!==e.ignoreEvalErrors&&e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||s||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==e.autostart){const n={path:a?e.path:t};a?"json"in e&&(n.json=e.json):n.json=r;const s=this.evaluate(n);if(!s||"object"!=typeof s)throw new w(s);return s}}v.prototype.evaluate=function(e,t,r,n){let s=this.parent,a=this.parentProperty,{flatten:i,wrap:o}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,(e=e||this.path)&&"object"==typeof e&&!Array.isArray(e)){if(!e.path&&""!==e.path)throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),i=Object.hasOwn(e,"flatten")?e.flatten:i,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,o=Object.hasOwn(e,"wrap")?e.wrap:o,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,s=Object.hasOwn(e,"parent")?e.parent:s,a=Object.hasOwn(e,"parentProperty")?e.parentProperty:a,e=e.path}if(s=s||null,a=a||null,Array.isArray(e)&&(e=v.toPathString(e)),!e&&""!==e||!t)return;const c=v.toPathArray(e);"$"===c[0]&&c.length>1&&c.shift(),this._hasParentSelector=null;const h=this._trace(c,t,["$"],s,a,r).filter(function(e){return e&&!e.isParentSelector});return h.length?o||1!==h.length||h[0].hasArrExpr?h.reduce((e,t)=>{const r=this._getPreferredOutput(t);return i&&Array.isArray(r)?e=e.concat(r):e.push(r),e},[]):this._getPreferredOutput(h[0]):o?[]:void 0},v.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const t=Array.isArray(e.path)?e.path:v.toPathArray(e.path);return e.pointer=v.toPointer(t),e.path="string"==typeof e.path?e.path:v.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return v.toPathString(e[t]);case"pointer":return v.toPointer(e.path);default:throw new TypeError("Unknown result type")}},v.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path="string"==typeof e.path?e.path:v.toPathString(e.path),t(n,r,e)}},v.prototype._trace=function(e,t,r,n,s,a,i,o){let c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:s,hasArrExpr:i},this._handleCallback(c,a,"value"),c;const h=e[0],l=e.slice(1),u=[];function p(e){Array.isArray(e)?e.forEach(e=>{u.push(e)}):u.push(e)}if(("string"!=typeof h||o)&&t&&Object.hasOwn(t,h))p(this._trace(l,t[h],E(r,h),t,h,a,i));else if("*"===h)this._walk(t,e=>{p(this._trace(l,t[e],E(r,e),t,e,a,!0,!0))});else if(".."===h)p(this._trace(l,t,r,n,s,a,i)),this._walk(t,n=>{"object"==typeof t[n]&&p(this._trace(e.slice(),t[n],E(r,n),t,n,a,!0))});else{if("^"===h)return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:l,isParentSelector:!0};if("~"===h)return c={path:E(r,h),value:s,parent:n,parentProperty:null},this._handleCallback(c,a,"property"),c;if("$"===h)p(this._trace(l,t,r,null,null,a,i));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(h))p(this._slice(h,l,t,r,n,s,a));else if(0===h.indexOf("?(")){if(!1===this.currEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const e=h.replace(/^\?\((.*?)\)$/u,"$1"),i=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(e);i?this._walk(t,e=>{const o=[i[2]],c=i[1]?t[e][i[1]]:t[e];this._trace(o,c,r,n,s,a,!0).length>0&&p(this._trace(l,t[e],E(r,e),t,e,a,!0))}):this._walk(t,i=>{this._eval(e,t[i],i,r,n,s)&&p(this._trace(l,t[i],E(r,i),t,i,a,!0))})}else if("("===h[0]){if(!1===this.currEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(x(this._eval(h,t,r.at(-1),r.slice(0,-1),n,s),l),t,r,n,s,a,i))}else if("@"===h[0]){let e=!1;const i=h.slice(1,-2);switch(i){case"scalar":t&&["object","function"].includes(typeof t)||(e=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===i&&(e=!0);break;case"integer":!Number.isFinite(t)||t%1||(e=!0);break;case"number":Number.isFinite(t)&&(e=!0);break;case"nonFinite":"number"!=typeof t||Number.isFinite(t)||(e=!0);break;case"object":t&&typeof t===i&&(e=!0);break;case"array":Array.isArray(t)&&(e=!0);break;case"other":e=this.currOtherTypeCallback(t,r,n,s);break;case"null":null===t&&(e=!0);break;default:throw new TypeError("Unknown value type "+i)}if(e)return c={path:r,value:t,parent:n,parentProperty:s},this._handleCallback(c,a,"value"),c}else if("`"===h[0]&&t&&Object.hasOwn(t,h.slice(1))){const e=h.slice(1);p(this._trace(l,t[e],E(r,e),t,e,a,i,!0))}else if(h.includes(",")){const e=h.split(",");for(const i of e)p(this._trace(x(i,l),t,r,n,s,a,!0))}else!o&&t&&Object.hasOwn(t,h)&&p(this._trace(l,t[h],E(r,h),t,h,a,i,!0))}if(this._hasParentSelector)for(let e=0;e<u.length;e++){const r=u[e];if(r&&r.isParentSelector){const o=this._trace(r.expr,t,r.path,n,s,a,i);if(Array.isArray(o)){u[e]=o[0];const t=o.length;for(let r=1;r<t;r++)e++,u.splice(e,0,o[r])}else u[e]=o}}return u},v.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let e=0;e<r;e++)t(e)}else e&&"object"==typeof e&&Object.keys(e).forEach(e=>{t(e)})},v.prototype._slice=function(e,t,r,n,s,a,i){if(!Array.isArray(r))return;const o=r.length,c=e.split(":"),h=c[2]&&Number.parseInt(c[2])||1;let l=c[0]&&Number.parseInt(c[0])||0,u=c[1]&&Number.parseInt(c[1])||o;l=l<0?Math.max(0,l+o):Math.min(o,l),u=u<0?Math.max(0,u+o):Math.min(o,u);const p=[];for(let e=l;e<u;e+=h){this._trace(x(e,t),r,n,s,a,i,!0).forEach(e=>{p.push(e)})}return p},v.prototype._eval=function(e,t,r,n,s,a){this.currSandbox._$_parentProperty=a,this.currSandbox._$_parent=s,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const i=e.includes("@path");i&&(this.currSandbox._$_path=v.toPathString(n.concat([r])));const o=this.currEval+"Script:"+e;if(!v.cache[o]){let t=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(i&&(t=t.replaceAll("@path","_$_path")),"safe"===this.currEval||!0===this.currEval||void 0===this.currEval)v.cache[o]=new this.safeVm.Script(t);else if("native"===this.currEval)v.cache[o]=new this.vm.Script(t);else if("function"==typeof this.currEval&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const e=this.currEval;v.cache[o]=new e(t)}else{if("function"!=typeof this.currEval)throw new TypeError(`Unknown "eval" property "${this.currEval}"`);v.cache[o]={runInNewContext:e=>this.currEval(t,e)}}}try{return v.cache[o].runInNewContext(this.currSandbox)}catch(t){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+t.message+": "+e)}},v.cache={},v.toPathString=function(e){const t=e,r=t.length;let n="$";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+=/^[0-9*]+$/u.test(t[e])?"["+t[e]+"]":"['"+t[e]+"']");return n},v.toPointer=function(e){const t=e,r=t.length;let n="";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+="/"+t[e].toString().replaceAll("~","~0").replaceAll("/","~1"));return n},v.toPathArray=function(e){const{cache:t}=v;if(t[e])return t[e].concat();const r=[],n=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(e,t){return"[#"+(r.push(t)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(e,t){return"['"+t.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(e,t){return";"+t.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(e){const t=e.match(/#(\d+)/u);return t&&t[1]?r[t[1]]:e});return t[e]=n,t[e].concat()},v.prototype.safeVm={Script:class{constructor(e){this.code=e,this.ast=p(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return b.evalAst(this.ast,t)}}};v.prototype.vm={Script:class{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const r=Object.keys(e),n=[];!function(e,t,r){const n=e.length;for(let s=0;s<n;s++)r(e[s])&&t.push(e.splice(s--,1)[0])}(r,n,t=>"function"==typeof e[t]);const s=r.map(t=>e[t]);t=n.reduce((t,r)=>{let n=e[r].toString();return/function/u.test(n)||(n="function "+n),"var "+r+"="+n+";"+t},"")+t,/(['"])use strict\1/u.test(t)||r.includes("arguments")||(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const a=t.lastIndexOf(";"),i=-1!==a?t.slice(0,a+1)+" return "+t.slice(a+1):" return "+t;return new Function(...r,i)(...s)}}};const A=function(){const e=C,t=k,r=this,n="parser.js: Parser(): ";r.ast=void 0,r.stats=void 0,r.trace=void 0,r.callbacks=[];let s,a,i,o,c,h,l,u=0,p=0,f=0,d=0,y=0,m=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};r.parse=(g,b,x,w)=>{const v=`${n}parse(): `;u=0,p=0,f=0,d=0,y=0,s=void 0,a=void 0,i=void 0,o=void 0,m.refresh(),c=void 0,h=void 0,l=void 0,o=t.stringToChars(x),s=g.rules,a=g.udts;const A=b.toLowerCase();let O;for(const e in s)if(s.hasOwnProperty(e)&&A===s[e].lower){O=s[e].index;break}if(void 0===O)throw new Error(`${v}start rule name '${startRule}' not recognized`);(()=>{const e=`${n}initializeCallbacks(): `;let t,i;for(c=[],h=[],t=0;t<s.length;t+=1)c[t]=void 0;for(t=0;t<a.length;t+=1)h[t]=void 0;const o=[];for(t=0;t<s.length;t+=1)o.push(s[t].lower);for(t=0;t<a.length;t+=1)o.push(a[t].lower);for(const n in r.callbacks)if(r.callbacks.hasOwnProperty(n)){if(t=o.indexOf(n.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${n}' not a rule or udt name`);if(i=r.callbacks[n]?r.callbacks[n]:void 0,"function"!=typeof i&&void 0!==i)throw new Error(`${e}syntax callback[${n}] must be function reference or falsy)`);t<s.length?c[t]=i:h[t-s.length]=i}})(),r.trace&&r.trace.init(s,a,o),r.stats&&r.stats.init(s,a),r.ast&&r.ast.init(s,a,o),l=w,i=[{type:e.RNM,index:O}],E(0,0),i=void 0;let T=!1;switch(m.state){case e.ACTIVE:throw new Error(`${v}final state should never be 'ACTIVE'`);case e.NOMATCH:T=!1;break;case e.EMPTY:case e.MATCH:T=m.phraseLength===o.length;break;default:throw new Error("unrecognized state")}return{success:T,state:m.state,stateName:e.idName(m.state),length:o.length,matched:m.phraseLength,maxMatched:y,maxTreeDepth:f,nodeHits:d}};const g=(t,r,s,a)=>{if(r.phraseLength>s){let e=`${n}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:if(!a)throw new Error(`${n}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:r.phraseLength=0;break;case e.MATCH:0===r.phraseLength&&(r.state=e.EMPTY);break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opRNM(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}},b=(t,c)=>{let p,f,d;const y=i[t],g=a[y.index];m.UdtIndex=g.index,u||(d=r.ast&&r.ast.udtDefined(y.index),d&&(f=s.length+y.index,p=r.ast.getLength(),r.ast.down(f,g.name)));const b=o.length-c;h[y.index](m,o,c,l),((t,r,s)=>{if(r.phraseLength>s){let e=`${n}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:throw new Error(`${n}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.phraseLength=0;break;case e.MATCH:if(0===r.phraseLength){if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.state=e.EMPTY}break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opUDT(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}})(g,m,b),u||d&&(m.state===e.NOMATCH?r.ast.setLength(p):r.ast.up(f,g.name,c,m.phraseLength))},E=(t,a)=>{const h=`${n}opExecute(): `,x=i[t];switch(d+=1,p>f&&(f=p),p+=1,m.refresh(),r.trace&&r.trace.down(x,a),x.type){case e.ALT:((t,r)=>{const n=i[t];for(let t=0;t<n.children.length&&(E(n.children[t],r),m.state===e.NOMATCH);t+=1);})(t,a);break;case e.CAT:((t,n)=>{let s,a,o,c;const h=i[t];r.ast&&(a=r.ast.getLength()),s=!0,o=n,c=0;for(let t=0;t<h.children.length;t+=1){if(E(h.children[t],o),m.state===e.NOMATCH){s=!1;break}o+=m.phraseLength,c+=m.phraseLength}s?(m.state=0===c?e.EMPTY:e.MATCH,m.phraseLength=c):(m.state=e.NOMATCH,m.phraseLength=0,r.ast&&r.ast.setLength(a))})(t,a);break;case e.REP:((t,n)=>{let s,a,c,h;const l=i[t];if(0===l.max)return m.state=e.EMPTY,void(m.phraseLength=0);for(a=n,c=0,h=0,r.ast&&(s=r.ast.getLength());!(a>=o.length)&&(E(t+1,a),m.state!==e.NOMATCH)&&m.state!==e.EMPTY&&(h+=1,c+=m.phraseLength,a+=m.phraseLength,h!==l.max););m.state===e.EMPTY||h>=l.min?(m.state=0===c?e.EMPTY:e.MATCH,m.phraseLength=c):(m.state=e.NOMATCH,m.phraseLength=0,r.ast&&r.ast.setLength(s))})(t,a);break;case e.RNM:((t,n)=>{let a,h,p;const f=i[t],d=s[f.index],y=c[d.index];if(u||(h=r.ast&&r.ast.ruleDefined(f.index),h&&(a=r.ast.getLength(),r.ast.down(f.index,s[f.index].name))),y){const t=o.length-n;y(m,o,n,l),g(d,m,t,!0),m.state===e.ACTIVE&&(p=i,i=d.opcodes,E(0,n),i=p,y(m,o,n,l),g(d,m,t,!1))}else p=i,i=d.opcodes,E(0,n,m),i=p;u||h&&(m.state===e.NOMATCH?r.ast.setLength(a):r.ast.up(f.index,d.name,n,m.phraseLength))})(t,a);break;case e.TRG:((t,r)=>{const n=i[t];m.state=e.NOMATCH,r<o.length&&n.min<=o[r]&&o[r]<=n.max&&(m.state=e.MATCH,m.phraseLength=1)})(t,a);break;case e.TBS:((t,r)=>{const n=i[t],s=n.string.length;if(m.state=e.NOMATCH,r+s<=o.length){for(let e=0;e<s;e+=1)if(o[r+e]!==n.string[e])return;m.state=e.MATCH,m.phraseLength=s}})(t,a);break;case e.TLS:((t,r)=>{let n;const s=i[t];m.state=e.NOMATCH;const a=s.string.length;if(0!==a){if(r+a<=o.length){for(let e=0;e<a;e+=1)if(n=o[r+e],n>=65&&n<=90&&(n+=32),n!==s.string[e])return;m.state=e.MATCH,m.phraseLength=a}}else m.state=e.EMPTY})(t,a);break;case e.UDT:b(t,a);break;case e.AND:((t,r)=>{switch(u+=1,E(t+1,r),u-=1,m.phraseLength=0,m.state){case e.EMPTY:case e.MATCH:m.state=e.EMPTY;break;case e.NOMATCH:m.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${m.state}`)}})(t,a);break;case e.NOT:((t,r)=>{switch(u+=1,E(t+1,r),u-=1,m.phraseLength=0,m.state){case e.EMPTY:case e.MATCH:m.state=e.NOMATCH;break;case e.NOMATCH:m.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${m.state}`)}})(t,a);break;default:throw new Error(`${h}unrecognized operator`)}u||a+m.phraseLength>y&&(y=a+m.phraseLength),r.stats&&r.stats.collect(x,m),r.trace&&r.trace.up(x,m.state,a,m.phraseLength),p-=1}},O=function(){const e=C,t=k,r=this;let n,s,a,i=0;const o=[],c=[],h=[];function l(e){let t="";for(;e-- >0;)t+=" ";return t}r.callbacks=[],r.init=(e,t,l)=>{let u;c.length=0,h.length=0,i=0,n=e,s=t,a=l;const p=[];for(u=0;u<n.length;u+=1)p.push(n[u].lower);for(u=0;u<s.length;u+=1)p.push(s[u].lower);for(i=n.length+s.length,u=0;u<i;u+=1)o[u]=void 0;for(const e in r.callbacks)if(r.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(u=p.indexOf(t),u<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);o[u]=r.callbacks[e]}},r.ruleDefined=e=>!!o[e],r.udtDefined=e=>!!o[n.length+e],r.down=(t,r)=>{const n=h.length;return c.push(n),h.push({name:r,thisIndex:n,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),n},r.up=(t,r,n,s)=>{const a=h.length,i=c.pop();return h.push({name:r,thisIndex:a,thatIndex:i,state:e.SEM_POST,callbackIndex:t,phraseIndex:n,phraseLength:s,stack:c.length}),h[i].thatIndex=a,h[i].phraseIndex=n,h[i].phraseLength=s,a},r.translate=t=>{let r,n;for(let s=0;s<h.length;s+=1)n=h[s],r=o[n.callbackIndex],r&&(n.state===e.SEM_PRE?r(e.SEM_PRE,a,n.phraseIndex,n.phraseLength,t):r&&r(e.SEM_POST,a,n.phraseIndex,n.phraseLength,t))},r.setLength=e=>{h.length=e,c.length=e>0?h[e-1].stack:0},r.getLength=()=>h.length,r.toXml=()=>{let r="",n=0;return r+='<?xml version="1.0" encoding="utf-8"?>\n',r+=`<root nodes="${h.length/2}" characters="${a.length}">\n`,r+="\x3c!-- input string --\x3e\n",r+=l(n+2),r+=t.charsToString(a),r+="\n",h.forEach(s=>{s.state===e.SEM_PRE?(n+=1,r+=l(n),r+=`<node name="${s.name}" index="${s.phraseIndex}" length="${s.phraseLength}">\n`,r+=l(n+2),r+=t.charsToString(a,s.phraseIndex,s.phraseLength),r+="\n"):(r+=l(n),r+=`</node>\x3c!-- name="${s.name}" --\x3e\n`,n-=1)}),r+="</root>\n",r}},T=function(){const e=C,t=k,r="parser.js: Trace(): ";let n,s,a,i="",o=0;const c=this,h=e=>{let t="",r=0;if(e>=0)for(;e--;)r+=1,5===r?(t+="|",r=0):t+=".";return t};c.init=(e,t,r)=>{s=e,a=t,n=r};const l=n=>{let i;switch(n.type){case e.ALT:i="ALT";break;case e.CAT:i="CAT";break;case e.REP:i=n.max===1/0?`REP(${n.min},inf)`:`REP(${n.min},${n.max})`;break;case e.RNM:i=`RNM(${s[n.index].name})`;break;case e.TRG:i=`TRG(${n.min},${n.max})`;break;case e.TBS:i=n.string.length>6?`TBS(${t.charsToString(n.string,0,3)}...)`:`TBS(${t.charsToString(n.string,0,6)})`;break;case e.TLS:i=n.string.length>6?`TLS(${t.charsToString(n.string,0,3)}...)`:`TLS(${t.charsToString(n.string,0,6)})`;break;case e.UDT:i=`UDT(${a[n.index].name})`;break;case e.AND:i="AND";break;case e.NOT:i="NOT";break;default:throw new Error(`${r}Trace: opName: unrecognized opcode`)}return i};c.down=(e,r)=>{const s=h(o),a=Math.min(100,n.length-r);let c=t.charsToString(n,r,a);a<n.length-r&&(c+="..."),c=`${s}|-|[${l(e)}]${c}\n`,i+=c,o+=1},c.up=(s,a,c,u)=>{const p=`${r}trace.up: `;o-=1;const f=h(o);let d,y,m;switch(a){case e.EMPTY:m="|E|",y="''";break;case e.MATCH:m="|M|",d=Math.min(100,u),y=d<u?`'${t.charsToString(n,c,d)}...'`:`'${t.charsToString(n,c,d)}'`;break;case e.NOMATCH:m="|N|",y="";break;default:throw new Error(`${p} unrecognized state`)}y=`${f}${m}[${l(s)}]${y}\n`,i+=y},c.displayTrace=()=>i},_=function(){const e=C;let t,r,n;const s=[],a=[],i=[];this.init=(e,n)=>{t=e,r=n,p()},this.collect=(t,r)=>{f(n,r.state,r.phraseLength),f(s[t.type],r.state,r.phraseLength),t.type===e.RNM&&f(a[t.index],r.state,r.phraseLength),t.type===e.UDT&&f(i[t.index],r.state,r.phraseLength)},this.displayStats=()=>{let t="";const r={match:0,empty:0,nomatch:0,total:0},n=(e,t,n,s,a)=>{r.match+=t,r.empty+=n,r.nomatch+=s,r.total+=a;return`${e} | ${o(t)} | ${o(n)} | ${o(s)} | ${o(a)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=n(" ALT",s[e.ALT].match,s[e.ALT].empty,s[e.ALT].nomatch,s[e.ALT].total),t+=n(" CAT",s[e.CAT].match,s[e.CAT].empty,s[e.CAT].nomatch,s[e.CAT].total),t+=n(" REP",s[e.REP].match,s[e.REP].empty,s[e.REP].nomatch,s[e.REP].total),t+=n(" RNM",s[e.RNM].match,s[e.RNM].empty,s[e.RNM].nomatch,s[e.RNM].total),t+=n(" TRG",s[e.TRG].match,s[e.TRG].empty,s[e.TRG].nomatch,s[e.TRG].total),t+=n(" TBS",s[e.TBS].match,s[e.TBS].empty,s[e.TBS].nomatch,s[e.TBS].total),t+=n(" TLS",s[e.TLS].match,s[e.TLS].empty,s[e.TLS].nomatch,s[e.TLS].total),t+=n(" UDT",s[e.UDT].match,s[e.UDT].empty,s[e.UDT].nomatch,s[e.UDT].total),t+=n(" AND",s[e.AND].match,s[e.AND].empty,s[e.AND].nomatch,s[e.AND].total),t+=n(" NOT",s[e.NOT].match,s[e.NOT].empty,s[e.NOT].nomatch,s[e.NOT].total),t+=n("TOTAL",r.match,r.empty,r.nomatch,r.total),t},this.displayHits=e=>{let t="";const r=(e,t,r,s,a)=>{n.match+=e,n.empty+=t,n.nomatch+=r,n.total+=s;return`| ${o(e)} | ${o(t)} | ${o(r)} | ${o(s)} | ${a}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(a.sort(c),i.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(a.sort(l),i.sort(l),t+=" RULES/UDTS BY INDEX\n"):(a.sort(h),i.sort(h),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<a.length;e+=1){let n=a[e];n.total&&(t+=r(n.match,n.empty,n.nomatch,n.total,n.name))}for(let e=0;e<i.length;e+=1){let n=i[e];n.total&&(t+=r(n.match,n.empty,n.nomatch,n.total,n.name))}return t};const o=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,h=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),l=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,u=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},p=()=>{s.length=0,n=new u,s[e.ALT]=new u,s[e.CAT]=new u,s[e.REP]=new u,s[e.RNM]=new u,s[e.TRG]=new u,s[e.TBS]=new u,s[e.TLS]=new u,s[e.UDT]=new u,s[e.AND]=new u,s[e.NOT]=new u,a.length=0;for(let e=0;e<t.length;e+=1)a.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(r.length>0){i.length=0;for(let e=0;e<r.length;e+=1)i.push({empty:0,match:0,nomatch:0,total:0,name:r[e].name,lower:r[e].lower,index:r[e].index})}},f=(t,r)=>{switch(t.total+=1,r){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${r}`)}}},k={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,r)=>{let n=e;for(;!(void 0===t||t<0);){if(void 0===r){n=e.slice(t);break}if(r<=0)return"";n=e.slice(t,t+r);break}return String.fromCodePoint(...n)}},C={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case C.ALT:return"ALT";case C.CAT:return"CAT";case C.REP:return"REP";case C.RNM:return"RNM";case C.TRG:return"TRG";case C.TBS:return"TBS";case C.TLS:return"TLS";case C.UDT:return"UDT";case C.AND:return"AND";case C.NOT:return"NOT";case C.ACTIVE:return"ACTIVE";case C.EMPTY:return"EMPTY";case C.MATCH:return"MATCH";case C.NOMATCH:return"NOMATCH";case C.SEM_PRE:return"SEM_PRE";case C.SEM_POST:return"SEM_POST";case C.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};function P(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"json-pointer",lower:"json-pointer",index:0,isBkr:!1},this.rules[1]={name:"reference-token",lower:"reference-token",index:1,isBkr:!1},this.rules[2]={name:"unescaped",lower:"unescaped",index:2,isBkr:!1},this.rules[3]={name:"escaped",lower:"escaped",index:3,isBkr:!1},this.rules[4]={name:"array-location",lower:"array-location",index:4,isBkr:!1},this.rules[5]={name:"array-index",lower:"array-index",index:5,isBkr:!1},this.rules[6]={name:"array-dash",lower:"array-dash",index:6,isBkr:!1},this.rules[7]={name:"slash",lower:"slash",index:7,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:2,children:[2,3]},this.rules[0].opcodes[2]={type:4,index:7},this.rules[0].opcodes[3]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:1,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:2},this.rules[1].opcodes[3]={type:4,index:3},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3]},this.rules[2].opcodes[1]={type:5,min:0,max:46},this.rules[2].opcodes[2]={type:5,min:48,max:125},this.rules[2].opcodes[3]={type:5,min:127,max:1114111},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2]},this.rules[3].opcodes[1]={type:7,string:[126]},this.rules[3].opcodes[2]={type:1,children:[3,4]},this.rules[3].opcodes[3]={type:7,string:[48]},this.rules[3].opcodes[4]={type:7,string:[49]},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2]},this.rules[5].opcodes[1]={type:6,string:[48]},this.rules[5].opcodes[2]={type:2,children:[3,4]},this.rules[5].opcodes[3]={type:5,min:49,max:57},this.rules[5].opcodes[4]={type:3,min:0,max:1/0},this.rules[5].opcodes[5]={type:5,min:48,max:57},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:7,string:[45]},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:7,string:[47]},this.toString=function(){let e="";return e+="; JavaScript Object Notation (JSON) Pointer ABNF syntax\n",e+="; https://datatracker.ietf.org/doc/html/rfc6901\n",e+="json-pointer = *( slash reference-token ) ; MODIFICATION: surrogate text rule used\n",e+="reference-token = *( unescaped / escaped )\n",e+="unescaped = %x00-2E / %x30-7D / %x7F-10FFFF\n",e+=" ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'\n",e+='escaped = "~" ( "0" / "1" )\n',e+=" ; representing '~' and '/', respectively\n",e+="\n",e+="; https://datatracker.ietf.org/doc/html/rfc6901#section-4\n",e+="array-location = array-index / array-dash\n",e+="array-index = %x30 / ( %x31-39 *(%x30-39) )\n",e+=' ; "0", or digits without a leading "0"\n',e+='array-dash = "-"\n',e+="\n",e+="; Surrogate named rules\n",e+='slash = "/"\n','; JavaScript Object Notation (JSON) Pointer ABNF syntax\n; https://datatracker.ietf.org/doc/html/rfc6901\njson-pointer = *( slash reference-token ) ; MODIFICATION: surrogate text rule used\nreference-token = *( unescaped / escaped )\nunescaped = %x00-2E / %x30-7D / %x7F-10FFFF\n ; %x2F (\'/\') and %x7E (\'~\') are excluded from \'unescaped\'\nescaped = "~" ( "0" / "1" )\n ; representing \'~\' and \'/\', respectively\n\n; https://datatracker.ietf.org/doc/html/rfc6901#section-4\narray-location = array-index / array-dash\narray-index = %x30 / ( %x31-39 *(%x30-39) )\n ; "0", or digits without a leading "0"\narray-dash = "-"\n\n; Surrogate named rules\nslash = "/"\n'}}class S extends Error{constructor(e,t=void 0){if(super(e,t),this.name=this.constructor.name,"string"==typeof e&&(this.message=e),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,null!=t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"cause")&&!("cause"in this)){const{cause:e}=t;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}if(null!=t&&"object"==typeof t){const{cause:e,...r}=t;Object.assign(this,r)}}}const M=S;const j=class extends M{},L=e=>(t,r,n,s,a)=>{if("object"!=typeof a||null===a||Array.isArray(a))throw new j("parser's user data must be an object");if(t===C.SEM_PRE){const t={type:e,text:k.charsToString(r,n,s),start:n,length:s,children:[]};if(a.stack.length>0){a.stack[a.stack.length-1].children.push(t)}else a.root=t;a.stack.push(t)}t===C.SEM_POST&&a.stack.pop()};const N=class extends O{constructor(){super(),this.callbacks["json-pointer"]=L("json-pointer"),this.callbacks["reference-token"]=L("reference-token"),this.callbacks.slash=L("text")}getTree(){const e={stack:[],root:null};return this.translate(e),delete e.stack,e}},$=e=>{if("string"!=typeof e)throw new TypeError("Reference token must be a string");return e.replace(/~1/g,"/").replace(/~0/g,"~")};const D=class extends N{getTree(){const{root:e}=super.getTree();return e.children.filter(({type:e})=>"reference-token"===e).map(({text:e})=>$(e))}};const R=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const I=class extends T{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let r=-1;for(let n=0;n<e.length;n++){const s=e[n];if(s.includes("M|")){const e=s.match(/]'(.*)'$/);e&&e[1]&&(r=n)}if(n>r){const e=s.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new R(...t)}},U=new P,B=(e,{translator:t=new D,stats:r=!1,trace:n=!1}={})=>{if("string"!=typeof e)throw new TypeError("JSON Pointer must be a string");try{const s=new A;t&&(s.ast=t),r&&(s.stats=new _),n&&(s.trace=new I);const a=s.parse(U,"json-pointer",e);return{result:a,tree:a.success&&t?s.ast.getTree():void 0,stats:s.stats,trace:s.trace}}catch(t){throw new j("Unexpected error during JSON Pointer parsing",{cause:t,jsonPointer:e})}};new P,new A,new P,new A;const V=new P,H=new A,z=e=>{if("string"!=typeof e)return!1;try{return H.parse(V,"array-index",e).success}catch{return!1}},F=new P,Y=new A,K=e=>{if("string"!=typeof e)return!1;try{return Y.parse(F,"array-dash",e).success}catch{return!1}};const J=class{#e;#t;#r;constructor(e,t={}){this.#e=e,this.#e.steps=[],this.#e.failed=!1,this.#e.failedAt=-1,this.#e.message=`JSON Pointer "${t.jsonPointer}" was successfully evaluated against the provided value`,this.#e.context={...t,realm:t.realm.name},this.#t=[],this.#r=t.realm}step({referenceToken:e,input:t,output:r,success:n=!0,reason:s}){const a=this.#t.length;this.#t.push(e);const i={referenceToken:e,referenceTokenPosition:a,input:t,inputType:this.#r.isObject(t)?"object":this.#r.isArray(t)?"array":"unrecognized",output:r,success:n};s&&(i.reason=s),this.#e.steps.push(i),n||(this.#e.failed=!0,this.#e.failedAt=a,this.#e.message=s)}};const q=class{name="";isArray(e){throw new M("Realm.isArray(node) must be implemented in a subclass")}isObject(e){throw new M("Realm.isObject(node) must be implemented in a subclass")}sizeOf(e){throw new M("Realm.sizeOf(node) must be implemented in a subclass")}has(e,t){throw new M("Realm.has(node) must be implemented in a subclass")}evaluate(e,t){throw new M("Realm.evaluate(node) must be implemented in a subclass")}};const X=class extends M{};const G=class extends X{};const Q=class extends q{name="json";isArray(e){return Array.isArray(e)}isObject(e){return"object"==typeof e&&null!==e&&!this.isArray(e)}sizeOf(e){return this.isArray(e)?e.length:this.isObject(e)?Object.keys(e).length:0}has(e,t){if(this.isArray(e)){const r=Number(t),n=r>>>0;if(r!==n)throw new G(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return n<this.sizeOf(e)&&Object.prototype.hasOwnProperty.call(e,r)}return!!this.isObject(e)&&Object.prototype.hasOwnProperty.call(e,t)}evaluate(e,t){return this.isArray(e)?e[Number(t)]:e[t]}};const W=class extends X{};const Z=class extends X{},ee=(e,t,{strictArrays:r=!0,strictObjects:n=!0,realm:s=new Q,trace:a=!0}={})=>{const{result:i,tree:o,trace:c}=B(t,{trace:!!a}),h="object"==typeof a&&null!==a?new J(a,{jsonPointer:t,referenceTokens:o,strictArrays:r,strictObjects:n,realm:s,value:e}):null;try{let a;if(!i.success){let r=`Invalid JSON Pointer: "${t}". Syntax error at position ${i.maxMatched}`;throw r+=c?`, expected ${c.inferExpectations()}`:"",new X(r,{jsonPointer:t,currentValue:e,realm:s.name})}return o.reduce((e,i,c)=>{if(s.isArray(e)){if(K(i)){if(r)throw new G(`Invalid array index "-" at position ${c} in "${t}". The "-" token always refers to a nonexistent element during evaluation`,{jsonPointer:t,referenceTokens:o,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,String(s.sizeOf(e))),null==h||h.step({referenceToken:i,input:e,output:a}),a}if(!z(i))throw new G(`Invalid array index "${i}" at position ${c} in "${t}": index MUST be "0", or digits without a leading "0"`,{jsonPointer:t,referenceTokens:o,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});const n=Number(i);if(!Number.isSafeInteger(n))throw new G(`Invalid array index "${i}" at position ${c} in "${t}": index must be a safe integer`,{jsonPointer:t,referenceTokens:o,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});if(!s.has(e,i)&&r)throw new G(`Invalid array index "${i}" at position ${c} in "${t}": index not found in array`,{jsonPointer:t,referenceTokens:o,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,i),null==h||h.step({referenceToken:i,input:e,output:a}),a}if(s.isObject(e)){if(!s.has(e,i)&&n)throw new Z(`Invalid object key "${i}" at position ${c} in "${t}": key not found in object`,{jsonPointer:t,referenceTokens:o,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,i),null==h||h.step({referenceToken:i,input:e,output:a}),a}throw new W(`Invalid reference token "${i}" at position ${c} in "${t}": cannot be applied to a non-object/non-array value`,{jsonPointer:t,referenceTokens:o,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name})},e)}catch(e){if(null==h||h.step({referenceToken:e.referenceToken,input:e.currentValue,success:!1,reason:e.message}),e instanceof X)throw e;throw new X("Unexpected error during JSON Pointer evaluation",{cause:e,jsonPointer:t,referenceTokens:o})}};function te(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function re(e){return function t(r){return 0===arguments.length||te(r)?t:e.apply(this,arguments)}}function ne(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return te(r)?t:re(function(t){return e(r,t)});default:return te(r)&&te(n)?t:te(r)?re(function(t){return e(t,n)}):te(n)?re(function(t){return e(r,t)}):e(r,n)}}}function se(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function ae(e,t,r){for(var n=0,s=r.length;n<s;){if(e(t,r[n]))return!0;n+=1}return!1}function ie(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const oe="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var ce=Object.prototype.toString;const he=function(){return"[object Arguments]"===ce.call(arguments)?function(e){return"[object Arguments]"===ce.call(e)}:function(e){return ie("callee",e)}}();var le=!{toString:null}.propertyIsEnumerable("toString"),ue=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],pe=function(){return arguments.propertyIsEnumerable("length")}(),fe=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1};const de="function"!=typeof Object.keys||pe?re(function(e){if(Object(e)!==e)return[];var t,r,n=[],s=pe&&he(e);for(t in e)!ie(t,e)||s&&"length"===t||(n[n.length]=t);if(le)for(r=ue.length-1;r>=0;)ie(t=ue[r],e)&&!fe(n,t)&&(n[n.length]=t),r-=1;return n}):re(function(e){return Object(e)!==e?[]:Object.keys(e)});const ye=re(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function me(e,t,r,n){var s=se(e);function a(e,t){return ge(e,t,r.slice(),n.slice())}return!ae(function(e,t){return!ae(a,t,e)},se(t),s)}function ge(e,t,r,n){if(oe(e,t))return!0;var s,a,i=ye(e);if(i!==ye(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(s=e.constructor,null==(a=String(s).match(/^function (\w*)/))?"":a[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!oe(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!oe(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var o=r.length-1;o>=0;){if(r[o]===e)return n[o]===t;o-=1}switch(i){case"Map":return e.size===t.size&&me(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&me(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=de(e);if(c.length!==de(t).length)return!1;var h=r.concat([e]),l=n.concat([t]);for(o=c.length-1;o>=0;){var u=c[o];if(!ie(u,t)||!ge(t[u],e[u],h,l))return!1;o-=1}return!0}const be=ne(function(e,t){return ge(e,t,[],[])});const Ee=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class xe{elements;constructor(e){this.elements=e??[]}toValue(){return this.elements.map(e=>({key:e.key?.toValue(),value:e.value?.toValue()}))}map(e,t){return this.elements.map(r=>{const n=r.value,s=r.key;if(void 0===n||void 0===s)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,n,s,r):e(n,s,r)})}filter(e,t){const r=this.elements.filter(r=>{const n=r.value,s=r.key;return void 0!==n&&void 0!==s&&(void 0!==t?e.call(t,n,s,r):e(n,s,r))});return new xe(r)}reject(e,t){const r=[];for(const n of this.elements){const s=n.value,a=n.key;void 0!==s&&void 0!==a&&(e.call(t,s,a,n)||r.push(n))}return new xe(r)}forEach(e,t){this.elements.forEach((r,n)=>{const s=r.value,a=r.key;void 0!==s&&void 0!==a&&(void 0!==t?e.call(t,s,a,r,n):e(s,a,r,n))})}find(e,t){return this.elements.find(r=>{const n=r.value,s=r.key;return void 0!==n&&void 0!==s&&(void 0!==t?e.call(t,n,s,r):e(n,s,r))})}keys(){return this.elements.map(e=>e.key?.toValue()).filter(e=>void 0!==e)}values(){return this.elements.map(e=>e.value?.toValue()).filter(e=>void 0!==e)}get length(){return this.elements.length}get isEmpty(){return 0===this.length}get first(){return this.elements[0]}get(e){return this.elements[e]}push(e){return this.elements.push(e),this}includesKey(e){return this.elements.some(t=>t.key?.equals(e))}[Symbol.iterator](){return this.elements[Symbol.iterator]()}}const we=xe;class ve{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(e,t,r){void 0!==t&&(this.meta=t),void 0!==r&&(this.attributes=r),void 0!==e&&(this.content=e)}get element(){return this._storedElement}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof ve)this._content=e;else if(null!=e&&"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e&&"symbol"!=typeof e)if(e instanceof Ee)this._content=e;else if(e instanceof we)this._content=e.elements;else if(Array.isArray(e))this._content=e.map(e=>this.refract(e));else{if("object"!=typeof e)throw new Error("Cannot set content to value of type "+typeof e);this._content=Object.entries(e).map(([e,t])=>new this.MemberElement(e,t))}else this._content=e}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof ve?this._meta=e:this.meta.set(e??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof ve?this._attributes=e:this.attributes.set(e??{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get children(){const{_content:e}=this;if(Array.isArray(e))return e;if(e instanceof Ee){const t=[];return e.key&&t.push(e.key),e.value&&t.push(e.value),t}return e instanceof ve?[e]:[]}get isFrozen(){return Object.isFrozen(this)}freeze(){if(!this.isFrozen){this._meta&&(this._meta.parent=this,this._meta.freeze()),this._attributes&&(this._attributes.parent=this,this._attributes.freeze());for(const e of this.children)e.parent=this,e.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:e}=this;return e instanceof ve||e instanceof Ee?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){return be(this.toValue(),e)}primitive(){}set(e){return this.content=e,this}toRef(e){const t=this.id.toValue();if(""===t)throw new Error("Cannot create reference to an element without an ID");const r=new this.RefElement(t);return"string"==typeof e&&(r.path=this.refract(e)),r}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}hasMetaProperty(e){return!this.isMetaEmpty&&this.meta.hasKey(e)}get isMetaEmpty(){return void 0===this._meta||this.meta.isEmpty}getAttributesProperty(e,t){if(!this.hasAttributesProperty(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.attributes.set(e,t)}return this.attributes.get(e)}setAttributesProperty(e,t){this.attributes.set(e,t)}hasAttributesProperty(e){return!this.isAttributesEmpty&&this.attributes.hasKey(e)}get isAttributesEmpty(){return void 0===this._attributes||this.attributes.isEmpty}}const Ae=ve;const Oe=class extends Ae{constructor(e,t,r){super(e,t,r),this.element="string"}primitive(){return"string"}get length(){return this.content?.length??0}};const Te=class extends Ae{constructor(e,t,r){super(e,t,r),this.element="number"}primitive(){return"number"}};const _e=class extends Ae{constructor(e,t,r){super(e??null,t,r),this.element="null"}primitive(){return"null"}set(e){throw new Error("Cannot set the value of null")}};const ke=class extends Ae{constructor(e,t,r){super(e,t,r),this.element="boolean"}primitive(){return"boolean"}};class Ce extends Ae{constructor(e,t,r){super(e||[],t,r)}get length(){return this._content.length}get isEmpty(){return 0===this.length}get first(){return this._content[0]}get second(){return this._content[1]}get last(){return this._content.at(-1)}push(...e){for(const t of e)this._content.push(this.refract(t));return this}shift(){return this._content.shift()}unshift(e){this._content.unshift(this.refract(e))}includes(e){return this._content.some(t=>t.equals(e))}findElements(e,t){const r=t||{},n=!!r.recursive,s=void 0===r.results?[]:r.results;for(let t=0;t<this._content.length;t+=1){const r=this._content[t],a=r;n&&"function"==typeof a.findElements&&a.findElements(e,{results:s,recursive:n}),e(r,t,void 0)&&s.push(r)}return s}find(e){const t=this.findElements(e,{recursive:!0});return new this.ArrayElement(t)}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>{const r=t.classes;return"function"==typeof r.includes&&r.includes(e)})}getById(e){return this.find(t=>t.id.toValue()===e).first}concat(e){return new(0,this.constructor)(this._content.concat(e._content))}[Symbol.iterator](){return this._content[Symbol.iterator]()}}const Pe=Ce;const Se=class extends Pe{constructor(e,t,r){super(e||[],t,r),this.element="array"}primitive(){return"array"}get(e){return this._content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}set(e,t){return"number"==typeof e&&void 0!==t?this._content[e]=this.refract(t):this.content=e,this}remove(e){return this._content.splice(e,1)[0]??null}map(e,t){return this._content.map(e,t)}flatMap(e,t){return this._content.flatMap(e,t)}compactMap(e,t){const r=[];for(const n of this._content){const s=e.call(t,n);s&&r.push(s)}return r}filter(e,t){const r=this._content.filter(e,t);return new this.constructor(r)}reject(e,t){const r=[];for(const n of this._content)e.call(t,n)||r.push(n);return new this.constructor(r)}reduce(e,t){let r,n;void 0!==t?(r=0,n=this.refract(t)):(r=1,n=this.first);for(let t=r;t<this.length;t+=1){const r=e(n,this._content[t],t,this);n=void 0===r?r:this.refract(r)}return n}forEach(e,t){this._content.forEach((r,n)=>{e.call(t,r,n)})}empty(){return new this.constructor([])}};const Me=class extends Ae{constructor(e,t,r,n){super(new Ee,r,n),this.element="member",void 0!==e&&(this.key=e),arguments.length>=2&&(this.value=t)}primitive(){return"member"}get key(){return this._content.key}set key(e){this._content.key=this.refract(e)}get value(){return this._content.value}set value(e){this._content.value=void 0===e?void 0:this.refract(e)}};const je=class extends Pe{constructor(e,t,r){super(e||[],t,r),this.element="object"}primitive(){return"object"}toValue(){return this._content.reduce((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e),{})}get(e){const t=this.getMember(e);if(t)return t.value}getValue(e){const t=this.get(e);if(t)return t.toValue()}getMember(e){if(void 0!==e)return this._content.find(t=>t.key.toValue()===e)}remove(e){let t=null;return this.content=this._content.filter(r=>r.key.toValue()!==e||(t=r,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if("string"==typeof e){const r=this.getMember(e);r?r.value=t:this._content.push(new Me(e,t))}else if("object"==typeof e&&!Array.isArray(e))for(const t of Object.keys(e))this.set(t,e[t]);return this}keys(){return this._content.map(e=>e.key.toValue())}values(){return this._content.map(e=>e.value.toValue())}hasKey(e){return this._content.some(t=>t.key.equals(e))}items(){return this._content.map(e=>[e.key.toValue(),e.value.toValue()])}map(e,t){return this._content.map(r=>e.call(t,r.value,r.key,r))}compactMap(e,t){const r=[];return this.forEach((n,s,a)=>{const i=e.call(t,n,s,a);i&&r.push(i)}),r}filter(e,t){return new we(this._content).filter(e,t)}reject(e,t){const r=[];for(const n of this._content)e.call(t,n.value,n.key,n)||r.push(n);return new we(r)}forEach(e,t){this._content.forEach(r=>e.call(t,r.value,r.key,r))}reduce(e,t){let r,n;void 0!==t?(r=0,n=this.refract(t)):(r=1,n=this._content[0]?.value);for(let t=r;t<this._content.length;t+=1){const r=this._content[t],s=e(n,r.value,r.key,r,this);n=void 0===s?s:this.refract(s)}return n}empty(){return new this.constructor([])}},Le=e=>e instanceof Ae,Ne=e=>e instanceof Oe,$e=e=>e instanceof Te,De=e=>e instanceof _e,Re=e=>e instanceof ke,Ie=e=>e instanceof Se,Ue=e=>e instanceof je;const Be=class extends q{name="apidom";isArray(e){return Ie(e)}isObject(e){return Ue(e)}sizeOf(e){return this.isArray(e)||this.isObject(e)?e.length:0}has(e,t){if(this.isArray(e)){const r=Number(t),n=r>>>0;if(r!==n)throw new G(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return n<this.sizeOf(e)}if(this.isObject(e)){const r=e.keys(),n=new Set(r);if(r.length!==n.size)throw new Z(`Object key "${t}" is not unique — JSON Pointer requires unique member names`,{referenceToken:t,currentValue:e,realm:this.name});return e.hasKey(t)}return!1}evaluate(e,t){return this.isArray(e)?e.get(Number(t)):e.get(t)}},Ve=(e,t,r={})=>ee(e,t,{...r,realm:new Be});class He extends Oe{constructor(e,t,r){super(e,t,r),this.element="sourceMap"}static transfer(e,t){t.startLine=e.startLine,t.startCharacter=e.startCharacter,t.startOffset=e.startOffset,t.endLine=e.endLine,t.endCharacter=e.endCharacter,t.endOffset=e.endOffset}static from(e){const{startLine:t,startCharacter:r,startOffset:n,endLine:s,endCharacter:a,endOffset:i}=e;if("number"!=typeof t||"number"!=typeof r||"number"!=typeof n||"number"!=typeof s||"number"!=typeof a||"number"!=typeof i)return;const o="sm1:"+[t,r,n,s,a,i].map(Fe).join("");const c=new He(o);return c.startLine=t,c.startCharacter=r,c.startOffset=n,c.endLine=s,c.endCharacter=a,c.endOffset=i,c}applyTo(e){this.content&&([e.startLine,e.startCharacter,e.startOffset,e.endLine,e.endCharacter,e.endOffset]=function(e){const t=e.startsWith("sm1:")?e.slice(4):e,r=[];let n=0;for(let e=0;e<6;e++){const e=Ye(t,n);r.push(e.value),n=e.next}return r}(this.content))}}const ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Fe(e){let t=e>>>0,r="";do{let e=31&t;t>>>=5,0!==t&&(e|=32),r+=ze[e]}while(0!==t);return r}function Ye(e,t=0){let r=0,n=0,s=t;for(;;){const t=e[s++],a=ze.indexOf(t);if(-1===a)throw new Error(`Invalid Base64 VLQ char: ${t}`);if(r|=(31&a)<<n,n+=5,!!!(32&a))break}return{value:r>>>0,next:s}}const Ke=He;const Je=class extends i{value;constructor(e,t){super(e,t),void 0!==t&&(this.value=t.value)}};const qe=class extends Je{};const Xe=class extends Je{},Ge=(e,t)=>{const{visited:r=new WeakMap}=t,n={...t,visited:r};if(r.has(e))return r.get(e);const s=et(e);r.set(e,s);const{content:a}=e;return Array.isArray(a)?s.content=a.map(e=>Ge(e,n)):Le(a)?s.content=Ge(a,n):s.content=a instanceof Ee?Qe(a,n):a,s},Qe=(e,t)=>{const{visited:r=new WeakMap}=t,n={...t,visited:r};if(r.has(e))return r.get(e);const{key:s,value:a}=e,i=void 0!==s?Ge(s,n):void 0,o=void 0!==a?Ge(a,n):void 0,c=new Ee(i,o);return r.set(e,c),c},We=(e,t={})=>{if(e instanceof Ee)return Qe(e,t);if(e instanceof we)return((e,t)=>{const{visited:r=new WeakMap}=t,n={...t,visited:r};if(r.has(e))return r.get(e);const s=[...e].map(e=>Ge(e,n)),a=new we(s);return r.set(e,a),a})(e,t);if(Le(e))return Ge(e,t);throw new qe("Value provided to cloneDeep function couldn't be cloned",{value:e})};We.safe=e=>{try{return We(e)}catch{return e}};const Ze=e=>{const{key:t,value:r}=e;return new Ee(t,r)},et=e=>{const t=new(0,e.constructor);t.element=e.element,e.isMetaEmpty||(t.meta=We(e.meta)),e.isAttributesEmpty||(t.attributes=We(e.attributes)),(e=>"number"==typeof e.startLine&&"number"==typeof e.startCharacter&&"number"==typeof e.startOffset&&"number"==typeof e.endLine&&"number"==typeof e.endCharacter&&"number"==typeof e.endOffset)(e)&&Ke.transfer(e,t);const{content:r}=e;return Le(r)?t.content=et(r):Array.isArray(r)?t.content=[...r]:t.content=r instanceof Ee?Ze(r):r,t},tt=e=>{if(e instanceof Ee)return Ze(e);if(e instanceof we)return(e=>{const t=[...e];return new we(t)})(e);if(Le(e))return et(e);throw new Xe("Value provided to cloneShallow function couldn't be cloned",{value:e})};tt.safe=e=>{try{return tt(e)}catch{return e}};const rt=class extends Ae{constructor(e,t,r){super(e||[],t,r),this.element="link"}get relation(){if(this.hasAttributesProperty("relation"))return this.attributes.get("relation")}set relation(e){this.attributes.set("relation",e)}get href(){if(this.hasAttributesProperty("href"))return this.attributes.get("href")}set href(e){this.attributes.set("href",e)}};const nt=class extends Ae{constructor(e,t,r){super(e||[],t,r),this.element="ref",this.path||(this.path="element")}get path(){if(this.hasAttributesProperty("path"))return this.attributes.get("path")}set path(e){this.attributes.set("path",e)}},st=e=>{if(!Le(e))return e;if(Ne(e)||$e(e)||Re(e)||De(e))return e.toValue();const t=new WeakMap,r=e=>{if(!Le(e))return e;if(Ue(e)){if(t.has(e))return t.get(e);const n={};return t.set(e,n),e.forEach((e,t)=>{const s=r(t),a=r(e);"string"==typeof s&&(n[s]=a)}),n}if(Ie(e)){if(t.has(e))return t.get(e);const n=[];return t.set(e,n),e.forEach(e=>n.push(r(e))),n}return(e=>e instanceof nt)(e)?String(e.toValue()):(e=>e instanceof rt)(e)?Ne(e.href)?e.href.toValue():"":e.toValue()};return r(e)},at=(e,t)=>{try{const r=st(t);return v({path:e,json:r,resultType:"pointer"}).map(e=>Ve(t,e))}catch(r){throw new c(`JSON Path evaluation failed while evaluating "${String(e)}".`,{path:e,element:We(t),cause:r})}},it=(e,t)=>{try{const r=st(t),n=[];for(const s of e){const e=v({path:s,json:r,resultType:"pointer"}),a=[];for(const r of e){const e=Ve(t,r);a.push(e)}Array.isArray(s)?n.push([v.toPathString(s),a]):n.push([s,a])}return n}catch(r){throw new h(`JSON Path evaluation failed while multi-evaluating "${String(e)}".`,{paths:e,element:We(t),cause:r})}};return t})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPath=t():e.apidomJsonPath=t()}(self,()=>(()=>{"use strict";var e={d:(t,s)=>{for(var r in s)e.o(s,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:s[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ASTTranslator:()=>M,ApiDOMEvaluationRealm:()=>mt,CSTOptimizedTranslator:()=>x,CSTTranslator:()=>f,EvaluationRealm:()=>ge,Grammar:()=>n,JSONEvaluationRealm:()=>fe,JSONNormalizedPathError:()=>F,JSONPathError:()=>m,JSONPathEvaluateError:()=>xe,JSONPathParseError:()=>y,NormalizedPath:()=>s,XMLTranslator:()=>L,evaluate:()=>gt,functions:()=>r,parse:()=>N,test:()=>D});var s={};e.r(s),e.d(s,{escape:()=>P,from:()=>$,test:()=>B,to:()=>j});var r={};function n(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"jsonpath-query",lower:"jsonpath-query",index:0,isBkr:!1},this.rules[1]={name:"segments",lower:"segments",index:1,isBkr:!1},this.rules[2]={name:"B",lower:"b",index:2,isBkr:!1},this.rules[3]={name:"S",lower:"s",index:3,isBkr:!1},this.rules[4]={name:"root-identifier",lower:"root-identifier",index:4,isBkr:!1},this.rules[5]={name:"selector",lower:"selector",index:5,isBkr:!1},this.rules[6]={name:"name-selector",lower:"name-selector",index:6,isBkr:!1},this.rules[7]={name:"string-literal",lower:"string-literal",index:7,isBkr:!1},this.rules[8]={name:"double-quoted",lower:"double-quoted",index:8,isBkr:!1},this.rules[9]={name:"single-quoted",lower:"single-quoted",index:9,isBkr:!1},this.rules[10]={name:"ESC",lower:"esc",index:10,isBkr:!1},this.rules[11]={name:"unescaped",lower:"unescaped",index:11,isBkr:!1},this.rules[12]={name:"escapable",lower:"escapable",index:12,isBkr:!1},this.rules[13]={name:"hexchar",lower:"hexchar",index:13,isBkr:!1},this.rules[14]={name:"non-surrogate",lower:"non-surrogate",index:14,isBkr:!1},this.rules[15]={name:"high-surrogate",lower:"high-surrogate",index:15,isBkr:!1},this.rules[16]={name:"low-surrogate",lower:"low-surrogate",index:16,isBkr:!1},this.rules[17]={name:"HEXDIG",lower:"hexdig",index:17,isBkr:!1},this.rules[18]={name:"wildcard-selector",lower:"wildcard-selector",index:18,isBkr:!1},this.rules[19]={name:"index-selector",lower:"index-selector",index:19,isBkr:!1},this.rules[20]={name:"int",lower:"int",index:20,isBkr:!1},this.rules[21]={name:"DIGIT1",lower:"digit1",index:21,isBkr:!1},this.rules[22]={name:"slice-selector",lower:"slice-selector",index:22,isBkr:!1},this.rules[23]={name:"start",lower:"start",index:23,isBkr:!1},this.rules[24]={name:"end",lower:"end",index:24,isBkr:!1},this.rules[25]={name:"step",lower:"step",index:25,isBkr:!1},this.rules[26]={name:"filter-selector",lower:"filter-selector",index:26,isBkr:!1},this.rules[27]={name:"logical-expr",lower:"logical-expr",index:27,isBkr:!1},this.rules[28]={name:"logical-or-expr",lower:"logical-or-expr",index:28,isBkr:!1},this.rules[29]={name:"logical-and-expr",lower:"logical-and-expr",index:29,isBkr:!1},this.rules[30]={name:"basic-expr",lower:"basic-expr",index:30,isBkr:!1},this.rules[31]={name:"paren-expr",lower:"paren-expr",index:31,isBkr:!1},this.rules[32]={name:"logical-not-op",lower:"logical-not-op",index:32,isBkr:!1},this.rules[33]={name:"test-expr",lower:"test-expr",index:33,isBkr:!1},this.rules[34]={name:"filter-query",lower:"filter-query",index:34,isBkr:!1},this.rules[35]={name:"rel-query",lower:"rel-query",index:35,isBkr:!1},this.rules[36]={name:"current-node-identifier",lower:"current-node-identifier",index:36,isBkr:!1},this.rules[37]={name:"comparison-expr",lower:"comparison-expr",index:37,isBkr:!1},this.rules[38]={name:"literal",lower:"literal",index:38,isBkr:!1},this.rules[39]={name:"comparable",lower:"comparable",index:39,isBkr:!1},this.rules[40]={name:"comparison-op",lower:"comparison-op",index:40,isBkr:!1},this.rules[41]={name:"singular-query",lower:"singular-query",index:41,isBkr:!1},this.rules[42]={name:"rel-singular-query",lower:"rel-singular-query",index:42,isBkr:!1},this.rules[43]={name:"abs-singular-query",lower:"abs-singular-query",index:43,isBkr:!1},this.rules[44]={name:"singular-query-segments",lower:"singular-query-segments",index:44,isBkr:!1},this.rules[45]={name:"name-segment",lower:"name-segment",index:45,isBkr:!1},this.rules[46]={name:"index-segment",lower:"index-segment",index:46,isBkr:!1},this.rules[47]={name:"number",lower:"number",index:47,isBkr:!1},this.rules[48]={name:"frac",lower:"frac",index:48,isBkr:!1},this.rules[49]={name:"exp",lower:"exp",index:49,isBkr:!1},this.rules[50]={name:"true",lower:"true",index:50,isBkr:!1},this.rules[51]={name:"false",lower:"false",index:51,isBkr:!1},this.rules[52]={name:"null",lower:"null",index:52,isBkr:!1},this.rules[53]={name:"function-name",lower:"function-name",index:53,isBkr:!1},this.rules[54]={name:"function-name-first",lower:"function-name-first",index:54,isBkr:!1},this.rules[55]={name:"function-name-char",lower:"function-name-char",index:55,isBkr:!1},this.rules[56]={name:"LCALPHA",lower:"lcalpha",index:56,isBkr:!1},this.rules[57]={name:"function-expr",lower:"function-expr",index:57,isBkr:!1},this.rules[58]={name:"function-argument",lower:"function-argument",index:58,isBkr:!1},this.rules[59]={name:"segment",lower:"segment",index:59,isBkr:!1},this.rules[60]={name:"child-segment",lower:"child-segment",index:60,isBkr:!1},this.rules[61]={name:"bracketed-selection",lower:"bracketed-selection",index:61,isBkr:!1},this.rules[62]={name:"member-name-shorthand",lower:"member-name-shorthand",index:62,isBkr:!1},this.rules[63]={name:"name-first",lower:"name-first",index:63,isBkr:!1},this.rules[64]={name:"name-char",lower:"name-char",index:64,isBkr:!1},this.rules[65]={name:"DIGIT",lower:"digit",index:65,isBkr:!1},this.rules[66]={name:"ALPHA",lower:"alpha",index:66,isBkr:!1},this.rules[67]={name:"descendant-segment",lower:"descendant-segment",index:67,isBkr:!1},this.rules[68]={name:"normalized-path",lower:"normalized-path",index:68,isBkr:!1},this.rules[69]={name:"normal-index-segment",lower:"normal-index-segment",index:69,isBkr:!1},this.rules[70]={name:"normal-selector",lower:"normal-selector",index:70,isBkr:!1},this.rules[71]={name:"normal-name-selector",lower:"normal-name-selector",index:71,isBkr:!1},this.rules[72]={name:"normal-single-quoted",lower:"normal-single-quoted",index:72,isBkr:!1},this.rules[73]={name:"normal-unescaped",lower:"normal-unescaped",index:73,isBkr:!1},this.rules[74]={name:"normal-escapable",lower:"normal-escapable",index:74,isBkr:!1},this.rules[75]={name:"normal-hexchar",lower:"normal-hexchar",index:75,isBkr:!1},this.rules[76]={name:"normal-HEXDIG",lower:"normal-hexdig",index:76,isBkr:!1},this.rules[77]={name:"normal-index-selector",lower:"normal-index-selector",index:77,isBkr:!1},this.rules[78]={name:"dot-prefix",lower:"dot-prefix",index:78,isBkr:!1},this.rules[79]={name:"double-dot-prefix",lower:"double-dot-prefix",index:79,isBkr:!1},this.rules[80]={name:"left-bracket",lower:"left-bracket",index:80,isBkr:!1},this.rules[81]={name:"right-bracket",lower:"right-bracket",index:81,isBkr:!1},this.rules[82]={name:"left-paren",lower:"left-paren",index:82,isBkr:!1},this.rules[83]={name:"right-paren",lower:"right-paren",index:83,isBkr:!1},this.rules[84]={name:"comma",lower:"comma",index:84,isBkr:!1},this.rules[85]={name:"colon",lower:"colon",index:85,isBkr:!1},this.rules[86]={name:"dquote",lower:"dquote",index:86,isBkr:!1},this.rules[87]={name:"squote",lower:"squote",index:87,isBkr:!1},this.rules[88]={name:"questionmark",lower:"questionmark",index:88,isBkr:!1},this.rules[89]={name:"disjunction",lower:"disjunction",index:89,isBkr:!1},this.rules[90]={name:"conjunction",lower:"conjunction",index:90,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,2]},this.rules[0].opcodes[1]={type:4,index:4},this.rules[0].opcodes[2]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:2,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:3},this.rules[1].opcodes[3]={type:4,index:59},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:6,string:[32]},this.rules[2].opcodes[2]={type:6,string:[9]},this.rules[2].opcodes[3]={type:6,string:[10]},this.rules[2].opcodes[4]={type:6,string:[13]},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:0,max:1/0},this.rules[3].opcodes[1]={type:4,index:2},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:7,string:[36]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[5].opcodes[1]={type:4,index:6},this.rules[5].opcodes[2]={type:4,index:18},this.rules[5].opcodes[3]={type:4,index:22},this.rules[5].opcodes[4]={type:4,index:19},this.rules[5].opcodes[5]={type:4,index:26},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:4,index:7},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,6]},this.rules[7].opcodes[1]={type:2,children:[2,3,5]},this.rules[7].opcodes[2]={type:4,index:86},this.rules[7].opcodes[3]={type:3,min:0,max:1/0},this.rules[7].opcodes[4]={type:4,index:8},this.rules[7].opcodes[5]={type:4,index:86},this.rules[7].opcodes[6]={type:2,children:[7,8,10]},this.rules[7].opcodes[7]={type:4,index:87},this.rules[7].opcodes[8]={type:3,min:0,max:1/0},this.rules[7].opcodes[9]={type:4,index:9},this.rules[7].opcodes[10]={type:4,index:87},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:1,children:[1,2,3,6]},this.rules[8].opcodes[1]={type:4,index:11},this.rules[8].opcodes[2]={type:6,string:[39]},this.rules[8].opcodes[3]={type:2,children:[4,5]},this.rules[8].opcodes[4]={type:4,index:10},this.rules[8].opcodes[5]={type:6,string:[34]},this.rules[8].opcodes[6]={type:2,children:[7,8]},this.rules[8].opcodes[7]={type:4,index:10},this.rules[8].opcodes[8]={type:4,index:12},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2,3,6]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:6,string:[34]},this.rules[9].opcodes[3]={type:2,children:[4,5]},this.rules[9].opcodes[4]={type:4,index:10},this.rules[9].opcodes[5]={type:6,string:[39]},this.rules[9].opcodes[6]={type:2,children:[7,8]},this.rules[9].opcodes[7]={type:4,index:10},this.rules[9].opcodes[8]={type:4,index:12},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[92]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[11].opcodes[1]={type:5,min:32,max:33},this.rules[11].opcodes[2]={type:5,min:35,max:38},this.rules[11].opcodes[3]={type:5,min:40,max:91},this.rules[11].opcodes[4]={type:5,min:93,max:55295},this.rules[11].opcodes[5]={type:5,min:57344,max:1114111},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8]},this.rules[12].opcodes[1]={type:6,string:[98]},this.rules[12].opcodes[2]={type:6,string:[102]},this.rules[12].opcodes[3]={type:6,string:[110]},this.rules[12].opcodes[4]={type:6,string:[114]},this.rules[12].opcodes[5]={type:6,string:[116]},this.rules[12].opcodes[6]={type:7,string:[47]},this.rules[12].opcodes[7]={type:7,string:[92]},this.rules[12].opcodes[8]={type:2,children:[9,10]},this.rules[12].opcodes[9]={type:6,string:[117]},this.rules[12].opcodes[10]={type:4,index:13},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:1,children:[1,2]},this.rules[13].opcodes[1]={type:4,index:14},this.rules[13].opcodes[2]={type:2,children:[3,4,5,6]},this.rules[13].opcodes[3]={type:4,index:15},this.rules[13].opcodes[4]={type:7,string:[92]},this.rules[13].opcodes[5]={type:6,string:[117]},this.rules[13].opcodes[6]={type:4,index:16},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:1,children:[1,11]},this.rules[14].opcodes[1]={type:2,children:[2,9]},this.rules[14].opcodes[2]={type:1,children:[3,4,5,6,7,8]},this.rules[14].opcodes[3]={type:4,index:65},this.rules[14].opcodes[4]={type:7,string:[97]},this.rules[14].opcodes[5]={type:7,string:[98]},this.rules[14].opcodes[6]={type:7,string:[99]},this.rules[14].opcodes[7]={type:7,string:[101]},this.rules[14].opcodes[8]={type:7,string:[102]},this.rules[14].opcodes[9]={type:3,min:3,max:3},this.rules[14].opcodes[10]={type:4,index:17},this.rules[14].opcodes[11]={type:2,children:[12,13,14]},this.rules[14].opcodes[12]={type:7,string:[100]},this.rules[14].opcodes[13]={type:5,min:48,max:55},this.rules[14].opcodes[14]={type:3,min:2,max:2},this.rules[14].opcodes[15]={type:4,index:17},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2,7]},this.rules[15].opcodes[1]={type:7,string:[100]},this.rules[15].opcodes[2]={type:1,children:[3,4,5,6]},this.rules[15].opcodes[3]={type:7,string:[56]},this.rules[15].opcodes[4]={type:7,string:[57]},this.rules[15].opcodes[5]={type:7,string:[97]},this.rules[15].opcodes[6]={type:7,string:[98]},this.rules[15].opcodes[7]={type:3,min:2,max:2},this.rules[15].opcodes[8]={type:4,index:17},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,2,7]},this.rules[16].opcodes[1]={type:7,string:[100]},this.rules[16].opcodes[2]={type:1,children:[3,4,5,6]},this.rules[16].opcodes[3]={type:7,string:[99]},this.rules[16].opcodes[4]={type:7,string:[100]},this.rules[16].opcodes[5]={type:7,string:[101]},this.rules[16].opcodes[6]={type:7,string:[102]},this.rules[16].opcodes[7]={type:3,min:2,max:2},this.rules[16].opcodes[8]={type:4,index:17},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[17].opcodes[1]={type:4,index:65},this.rules[17].opcodes[2]={type:7,string:[97]},this.rules[17].opcodes[3]={type:7,string:[98]},this.rules[17].opcodes[4]={type:7,string:[99]},this.rules[17].opcodes[5]={type:7,string:[100]},this.rules[17].opcodes[6]={type:7,string:[101]},this.rules[17].opcodes[7]={type:7,string:[102]},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:7,string:[42]},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:4,index:20},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:1,children:[1,2]},this.rules[20].opcodes[1]={type:7,string:[48]},this.rules[20].opcodes[2]={type:2,children:[3,5,6]},this.rules[20].opcodes[3]={type:3,min:0,max:1},this.rules[20].opcodes[4]={type:7,string:[45]},this.rules[20].opcodes[5]={type:4,index:21},this.rules[20].opcodes[6]={type:3,min:0,max:1/0},this.rules[20].opcodes[7]={type:4,index:65},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:5,min:49,max:57},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:2,children:[1,5,6,7,11]},this.rules[22].opcodes[1]={type:3,min:0,max:1},this.rules[22].opcodes[2]={type:2,children:[3,4]},this.rules[22].opcodes[3]={type:4,index:23},this.rules[22].opcodes[4]={type:4,index:3},this.rules[22].opcodes[5]={type:4,index:85},this.rules[22].opcodes[6]={type:4,index:3},this.rules[22].opcodes[7]={type:3,min:0,max:1},this.rules[22].opcodes[8]={type:2,children:[9,10]},this.rules[22].opcodes[9]={type:4,index:24},this.rules[22].opcodes[10]={type:4,index:3},this.rules[22].opcodes[11]={type:3,min:0,max:1},this.rules[22].opcodes[12]={type:2,children:[13,14]},this.rules[22].opcodes[13]={type:4,index:85},this.rules[22].opcodes[14]={type:3,min:0,max:1},this.rules[22].opcodes[15]={type:2,children:[16,17]},this.rules[22].opcodes[16]={type:4,index:3},this.rules[22].opcodes[17]={type:4,index:25},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:4,index:20},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:4,index:20},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:4,index:20},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:2,children:[1,2,3]},this.rules[26].opcodes[1]={type:4,index:88},this.rules[26].opcodes[2]={type:4,index:3},this.rules[26].opcodes[3]={type:4,index:27},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:4,index:28},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:29},this.rules[28].opcodes[2]={type:3,min:0,max:1/0},this.rules[28].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[28].opcodes[4]={type:4,index:3},this.rules[28].opcodes[5]={type:4,index:89},this.rules[28].opcodes[6]={type:4,index:3},this.rules[28].opcodes[7]={type:4,index:29},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:2,children:[1,2]},this.rules[29].opcodes[1]={type:4,index:30},this.rules[29].opcodes[2]={type:3,min:0,max:1/0},this.rules[29].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[29].opcodes[4]={type:4,index:3},this.rules[29].opcodes[5]={type:4,index:90},this.rules[29].opcodes[6]={type:4,index:3},this.rules[29].opcodes[7]={type:4,index:30},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:1,children:[1,2,3]},this.rules[30].opcodes[1]={type:4,index:31},this.rules[30].opcodes[2]={type:4,index:37},this.rules[30].opcodes[3]={type:4,index:33},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:2,children:[1,5,6,7,8,9]},this.rules[31].opcodes[1]={type:3,min:0,max:1},this.rules[31].opcodes[2]={type:2,children:[3,4]},this.rules[31].opcodes[3]={type:4,index:32},this.rules[31].opcodes[4]={type:4,index:3},this.rules[31].opcodes[5]={type:4,index:82},this.rules[31].opcodes[6]={type:4,index:3},this.rules[31].opcodes[7]={type:4,index:27},this.rules[31].opcodes[8]={type:4,index:3},this.rules[31].opcodes[9]={type:4,index:83},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:7,string:[33]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:2,children:[1,5]},this.rules[33].opcodes[1]={type:3,min:0,max:1},this.rules[33].opcodes[2]={type:2,children:[3,4]},this.rules[33].opcodes[3]={type:4,index:32},this.rules[33].opcodes[4]={type:4,index:3},this.rules[33].opcodes[5]={type:1,children:[6,7]},this.rules[33].opcodes[6]={type:4,index:34},this.rules[33].opcodes[7]={type:4,index:57},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:1,children:[1,2]},this.rules[34].opcodes[1]={type:4,index:35},this.rules[34].opcodes[2]={type:4,index:0},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:2,children:[1,2]},this.rules[35].opcodes[1]={type:4,index:36},this.rules[35].opcodes[2]={type:4,index:1},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:7,string:[64]},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:2,children:[1,2,3,4,5]},this.rules[37].opcodes[1]={type:4,index:39},this.rules[37].opcodes[2]={type:4,index:3},this.rules[37].opcodes[3]={type:4,index:40},this.rules[37].opcodes[4]={type:4,index:3},this.rules[37].opcodes[5]={type:4,index:39},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[38].opcodes[1]={type:4,index:47},this.rules[38].opcodes[2]={type:4,index:7},this.rules[38].opcodes[3]={type:4,index:50},this.rules[38].opcodes[4]={type:4,index:51},this.rules[38].opcodes[5]={type:4,index:52},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:1,children:[1,2,3]},this.rules[39].opcodes[1]={type:4,index:41},this.rules[39].opcodes[2]={type:4,index:57},this.rules[39].opcodes[3]={type:4,index:38},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2,3,4,5,6]},this.rules[40].opcodes[1]={type:7,string:[61,61]},this.rules[40].opcodes[2]={type:7,string:[33,61]},this.rules[40].opcodes[3]={type:7,string:[60,61]},this.rules[40].opcodes[4]={type:7,string:[62,61]},this.rules[40].opcodes[5]={type:7,string:[60]},this.rules[40].opcodes[6]={type:7,string:[62]},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:1,children:[1,2]},this.rules[41].opcodes[1]={type:4,index:42},this.rules[41].opcodes[2]={type:4,index:43},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:4,index:36},this.rules[42].opcodes[2]={type:4,index:44},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:2,children:[1,2]},this.rules[43].opcodes[1]={type:4,index:4},this.rules[43].opcodes[2]={type:4,index:44},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:3,min:0,max:1/0},this.rules[44].opcodes[1]={type:2,children:[2,3]},this.rules[44].opcodes[2]={type:4,index:3},this.rules[44].opcodes[3]={type:1,children:[4,5]},this.rules[44].opcodes[4]={type:4,index:45},this.rules[44].opcodes[5]={type:4,index:46},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:1,children:[1,5]},this.rules[45].opcodes[1]={type:2,children:[2,3,4]},this.rules[45].opcodes[2]={type:4,index:80},this.rules[45].opcodes[3]={type:4,index:6},this.rules[45].opcodes[4]={type:4,index:81},this.rules[45].opcodes[5]={type:2,children:[6,7]},this.rules[45].opcodes[6]={type:4,index:78},this.rules[45].opcodes[7]={type:4,index:62},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:2,children:[1,2,3]},this.rules[46].opcodes[1]={type:4,index:80},this.rules[46].opcodes[2]={type:4,index:19},this.rules[46].opcodes[3]={type:4,index:81},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:2,children:[1,4,6]},this.rules[47].opcodes[1]={type:1,children:[2,3]},this.rules[47].opcodes[2]={type:4,index:20},this.rules[47].opcodes[3]={type:7,string:[45,48]},this.rules[47].opcodes[4]={type:3,min:0,max:1},this.rules[47].opcodes[5]={type:4,index:48},this.rules[47].opcodes[6]={type:3,min:0,max:1},this.rules[47].opcodes[7]={type:4,index:49},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:2,children:[1,2]},this.rules[48].opcodes[1]={type:7,string:[46]},this.rules[48].opcodes[2]={type:3,min:1,max:1/0},this.rules[48].opcodes[3]={type:4,index:65},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:2,children:[1,2,6]},this.rules[49].opcodes[1]={type:7,string:[101]},this.rules[49].opcodes[2]={type:3,min:0,max:1},this.rules[49].opcodes[3]={type:1,children:[4,5]},this.rules[49].opcodes[4]={type:7,string:[45]},this.rules[49].opcodes[5]={type:7,string:[43]},this.rules[49].opcodes[6]={type:3,min:1,max:1/0},this.rules[49].opcodes[7]={type:4,index:65},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[116,114,117,101]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[102,97,108,115,101]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[110,117,108,108]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:4,index:54},this.rules[53].opcodes[2]={type:3,min:0,max:1/0},this.rules[53].opcodes[3]={type:4,index:55},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:4,index:56},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:1,children:[1,2,3]},this.rules[55].opcodes[1]={type:4,index:54},this.rules[55].opcodes[2]={type:7,string:[95]},this.rules[55].opcodes[3]={type:4,index:65},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:5,min:97,max:122},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:2,children:[1,2,3,4,13,14]},this.rules[57].opcodes[1]={type:4,index:53},this.rules[57].opcodes[2]={type:4,index:82},this.rules[57].opcodes[3]={type:4,index:3},this.rules[57].opcodes[4]={type:3,min:0,max:1},this.rules[57].opcodes[5]={type:2,children:[6,7]},this.rules[57].opcodes[6]={type:4,index:58},this.rules[57].opcodes[7]={type:3,min:0,max:1/0},this.rules[57].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[57].opcodes[9]={type:4,index:3},this.rules[57].opcodes[10]={type:4,index:84},this.rules[57].opcodes[11]={type:4,index:3},this.rules[57].opcodes[12]={type:4,index:58},this.rules[57].opcodes[13]={type:4,index:3},this.rules[57].opcodes[14]={type:4,index:83},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[58].opcodes[1]={type:4,index:27},this.rules[58].opcodes[2]={type:4,index:34},this.rules[58].opcodes[3]={type:4,index:57},this.rules[58].opcodes[4]={type:4,index:38},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:1,children:[1,2]},this.rules[59].opcodes[1]={type:4,index:60},this.rules[59].opcodes[2]={type:4,index:67},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:1,children:[1,2]},this.rules[60].opcodes[1]={type:4,index:61},this.rules[60].opcodes[2]={type:2,children:[3,4]},this.rules[60].opcodes[3]={type:4,index:78},this.rules[60].opcodes[4]={type:1,children:[5,6]},this.rules[60].opcodes[5]={type:4,index:18},this.rules[60].opcodes[6]={type:4,index:62},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3,4,10,11]},this.rules[61].opcodes[1]={type:4,index:80},this.rules[61].opcodes[2]={type:4,index:3},this.rules[61].opcodes[3]={type:4,index:5},this.rules[61].opcodes[4]={type:3,min:0,max:1/0},this.rules[61].opcodes[5]={type:2,children:[6,7,8,9]},this.rules[61].opcodes[6]={type:4,index:3},this.rules[61].opcodes[7]={type:4,index:84},this.rules[61].opcodes[8]={type:4,index:3},this.rules[61].opcodes[9]={type:4,index:5},this.rules[61].opcodes[10]={type:4,index:3},this.rules[61].opcodes[11]={type:4,index:81},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:2,children:[1,2]},this.rules[62].opcodes[1]={type:4,index:63},this.rules[62].opcodes[2]={type:3,min:0,max:1/0},this.rules[62].opcodes[3]={type:4,index:64},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[63].opcodes[1]={type:4,index:66},this.rules[63].opcodes[2]={type:7,string:[95]},this.rules[63].opcodes[3]={type:5,min:128,max:55295},this.rules[63].opcodes[4]={type:5,min:57344,max:1114111},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:1,children:[1,2]},this.rules[64].opcodes[1]={type:4,index:63},this.rules[64].opcodes[2]={type:4,index:65},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:5,min:48,max:57},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:1,children:[1,2]},this.rules[66].opcodes[1]={type:5,min:65,max:90},this.rules[66].opcodes[2]={type:5,min:97,max:122},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:2,children:[1,2]},this.rules[67].opcodes[1]={type:4,index:79},this.rules[67].opcodes[2]={type:1,children:[3,4,5]},this.rules[67].opcodes[3]={type:4,index:61},this.rules[67].opcodes[4]={type:4,index:18},this.rules[67].opcodes[5]={type:4,index:62},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:2,children:[1,2]},this.rules[68].opcodes[1]={type:4,index:4},this.rules[68].opcodes[2]={type:3,min:0,max:1/0},this.rules[68].opcodes[3]={type:4,index:69},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:2,children:[1,2,3]},this.rules[69].opcodes[1]={type:4,index:80},this.rules[69].opcodes[2]={type:4,index:70},this.rules[69].opcodes[3]={type:4,index:81},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:1,children:[1,2]},this.rules[70].opcodes[1]={type:4,index:71},this.rules[70].opcodes[2]={type:4,index:77},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:2,children:[1,2,4]},this.rules[71].opcodes[1]={type:4,index:87},this.rules[71].opcodes[2]={type:3,min:0,max:1/0},this.rules[71].opcodes[3]={type:4,index:72},this.rules[71].opcodes[4]={type:4,index:87},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:1,children:[1,2]},this.rules[72].opcodes[1]={type:4,index:73},this.rules[72].opcodes[2]={type:2,children:[3,4]},this.rules[72].opcodes[3]={type:4,index:10},this.rules[72].opcodes[4]={type:4,index:74},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[73].opcodes[1]={type:5,min:32,max:38},this.rules[73].opcodes[2]={type:5,min:40,max:91},this.rules[73].opcodes[3]={type:5,min:93,max:55295},this.rules[73].opcodes[4]={type:5,min:57344,max:1114111},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8]},this.rules[74].opcodes[1]={type:6,string:[98]},this.rules[74].opcodes[2]={type:6,string:[102]},this.rules[74].opcodes[3]={type:6,string:[110]},this.rules[74].opcodes[4]={type:6,string:[114]},this.rules[74].opcodes[5]={type:6,string:[116]},this.rules[74].opcodes[6]={type:7,string:[39]},this.rules[74].opcodes[7]={type:7,string:[92]},this.rules[74].opcodes[8]={type:2,children:[9,10]},this.rules[74].opcodes[9]={type:6,string:[117]},this.rules[74].opcodes[10]={type:4,index:75},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:2,children:[1,2,3]},this.rules[75].opcodes[1]={type:7,string:[48]},this.rules[75].opcodes[2]={type:7,string:[48]},this.rules[75].opcodes[3]={type:1,children:[4,7,10,13]},this.rules[75].opcodes[4]={type:2,children:[5,6]},this.rules[75].opcodes[5]={type:7,string:[48]},this.rules[75].opcodes[6]={type:5,min:48,max:55},this.rules[75].opcodes[7]={type:2,children:[8,9]},this.rules[75].opcodes[8]={type:7,string:[48]},this.rules[75].opcodes[9]={type:6,string:[98]},this.rules[75].opcodes[10]={type:2,children:[11,12]},this.rules[75].opcodes[11]={type:7,string:[48]},this.rules[75].opcodes[12]={type:5,min:101,max:102},this.rules[75].opcodes[13]={type:2,children:[14,15]},this.rules[75].opcodes[14]={type:7,string:[49]},this.rules[75].opcodes[15]={type:4,index:76},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:4,index:65},this.rules[76].opcodes[2]={type:5,min:97,max:102},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:7,string:[48]},this.rules[77].opcodes[2]={type:2,children:[3,4]},this.rules[77].opcodes[3]={type:4,index:21},this.rules[77].opcodes[4]={type:3,min:0,max:1/0},this.rules[77].opcodes[5]={type:4,index:65},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:7,string:[46]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:7,string:[46,46]},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:7,string:[91]},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:7,string:[93]},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:7,string:[40]},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:7,string:[41]},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:7,string:[44]},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:7,string:[58]},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:6,string:[34]},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:6,string:[39]},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:7,string:[63]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:7,string:[124,124]},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:7,string:[38,38]},this.toString=function(){let e="";return e+="; JSONPath: Query Expressions for JSON\n",e+="; https://www.rfc-editor.org/rfc/rfc9535\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1\n",e+="jsonpath-query = root-identifier segments\n",e+="segments = *(S segment)\n",e+="\n",e+="B = %x20 / ; Space\n",e+=" %x09 / ; Horizontal tab\n",e+=" %x0A / ; Line feed or New line\n",e+=" %x0D ; Carriage return\n",e+="S = *B ; optional blank space\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1\n",e+='root-identifier = "$"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3\n",e+="selector = name-selector /\n",e+=" wildcard-selector /\n",e+=" slice-selector /\n",e+=" index-selector /\n",e+=" filter-selector\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1\n",e+="name-selector = string-literal\n",e+="\n",e+='string-literal = dquote *double-quoted dquote / ; "string", MODIFICATION: surrogate text rule used\n',e+=" squote *single-quoted squote ; 'string', MODIFICATION: surrogate text rule used\n",e+="\n",e+="double-quoted = unescaped /\n",e+=" %x27 / ; '\n",e+=' ESC %x22 / ; \\"\n',e+=" ESC escapable\n",e+="\n",e+="single-quoted = unescaped /\n",e+=' %x22 / ; "\n',e+=" ESC %x27 / ; \\'\n",e+=" ESC escapable\n",e+="\n",e+="ESC = %x5C ; \\ backslash\n",e+="\n",e+="unescaped = %x20-21 / ; see RFC 8259\n",e+=' ; omit 0x22 "\n',e+=" %x23-26 /\n",e+=" ; omit 0x27 '\n",e+=" %x28-5B /\n",e+=" ; omit 0x5C \\\n",e+=" %x5D-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="\n",e+="escapable = %x62 / ; b BS backspace U+0008\n",e+=" %x66 / ; f FF form feed U+000C\n",e+=" %x6E / ; n LF line feed U+000A\n",e+=" %x72 / ; r CR carriage return U+000D\n",e+=" %x74 / ; t HT horizontal tab U+0009\n",e+=' "/" / ; / slash (solidus) U+002F\n',e+=' "\\" / ; \\ backslash (reverse solidus) U+005C\n',e+=" (%x75 hexchar) ; uXXXX U+XXXX\n",e+="\n",e+="hexchar = non-surrogate /\n",e+=' (high-surrogate "\\" %x75 low-surrogate)\n',e+='non-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /\n',e+=' ("D" %x30-37 2HEXDIG )\n',e+='high-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG\n',e+='low-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG\n',e+="\n",e+='HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1\n",e+='wildcard-selector = "*"\n',e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1\n",e+="index-selector = int ; decimal integer\n",e+="\n",e+='int = "0" /\n',e+=' (["-"] DIGIT1 *DIGIT) ; - optional\n',e+="DIGIT1 = %x31-39 ; 1-9 non-zero digit\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1\n",e+="slice-selector = [start S] colon S [end S] [colon [S step ]] ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="start = int ; included in selection\n",e+="end = int ; not included in selection\n",e+="step = int ; default: 1\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1\n",e+="filter-selector = questionmark S logical-expr ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="logical-expr = logical-or-expr\n",e+="logical-or-expr = logical-and-expr *(S disjunction S logical-and-expr) ; MODIFICATION: surrogate text rule used\n",e+=" ; disjunction\n",e+=" ; binds less tightly than conjunction\n",e+="logical-and-expr = basic-expr *(S conjunction S basic-expr) ; MODIFICATION: surrogate text rule used\n",e+=" ; conjunction\n",e+=" ; binds more tightly than disjunction\n",e+="\n",e+="basic-expr = paren-expr /\n",e+=" comparison-expr /\n",e+=" test-expr\n",e+="\n",e+="paren-expr = [logical-not-op S] left-paren S logical-expr S right-paren ; MODIFICATION: surrogate text rule used\n",e+=" ; parenthesized expression\n",e+='logical-not-op = "!" ; logical NOT operator\n',e+="\n",e+="test-expr = [logical-not-op S]\n",e+=" (filter-query / ; existence/non-existence\n",e+=" function-expr) ; LogicalType or NodesType\n",e+="filter-query = rel-query / jsonpath-query\n",e+="rel-query = current-node-identifier segments\n",e+='current-node-identifier = "@"\n',e+="\n",e+="comparison-expr = comparable S comparison-op S comparable\n",e+="literal = number / string-literal /\n",e+=" true / false / null\n",e+="comparable = singular-query / ; singular query value\n",e+=" function-expr / ; ValueType\n",e+=" literal\n",e+=" ; MODIFICATION: https://www.rfc-editor.org/errata/eid8352\n",e+='comparison-op = "==" / "!=" /\n',e+=' "<=" / ">=" /\n',e+=' "<" / ">"\n',e+="\n",e+="singular-query = rel-singular-query / abs-singular-query\n",e+="rel-singular-query = current-node-identifier singular-query-segments\n",e+="abs-singular-query = root-identifier singular-query-segments\n",e+="singular-query-segments = *(S (name-segment / index-segment))\n",e+="name-segment = (left-bracket name-selector right-bracket) / ; MODIFICATION: surrogate text rule used\n",e+=" (dot-prefix member-name-shorthand) ; MODIFICATION: surrogate text rule used\n",e+="index-segment = left-bracket index-selector right-bracket ; MODIFICATION: surrogate text rule used\n",e+="\n",e+='number = (int / "-0") [ frac ] [ exp ] ; decimal number\n',e+='frac = "." 1*DIGIT ; decimal fraction\n',e+='exp = "e" [ "-" / "+" ] 1*DIGIT ; decimal exponent\n',e+="true = %x74.72.75.65 ; true\n",e+="false = %x66.61.6c.73.65 ; false\n",e+="null = %x6e.75.6c.6c ; null\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.4\n",e+="function-name = function-name-first *function-name-char\n",e+="function-name-first = LCALPHA\n",e+='function-name-char = function-name-first / "_" / DIGIT\n',e+='LCALPHA = %x61-7A ; "a".."z"\n',e+="\n",e+="function-expr = function-name left-paren S [function-argument ; MODIFICATION: surrogate text rule used\n",e+=" *(S comma S function-argument)] S right-paren ; MODIFICATION: surrogate text rule used\n",e+="function-argument = logical-expr / ; MODIFICATION: https://www.rfc-editor.org/errata/eid8343\n",e+=" filter-query / ; (includes singular-query)\n",e+=" function-expr /\n",e+=" literal\n",e+="\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5\n",e+="segment = child-segment / descendant-segment\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1\n",e+="child-segment = bracketed-selection /\n",e+=" (dot-prefix ; MODIFICATION: surrogate text rule used\n",e+=" (wildcard-selector /\n",e+=" member-name-shorthand))\n",e+="\n",e+="bracketed-selection = left-bracket S selector *(S comma S selector) S right-bracket\n",e+=" ; MODIFICATION: surrogate text rule used\n",e+="\n",e+="member-name-shorthand = name-first *name-char\n",e+="name-first = ALPHA /\n",e+=' "_" /\n',e+=" %x80-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="name-char = name-first / DIGIT\n",e+="\n",e+="DIGIT = %x30-39 ; 0-9\n",e+="ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1\n",e+="descendant-segment = double-dot-prefix (bracketed-selection / ; MODIFICATION: surrogate text rule used\n",e+=" wildcard-selector /\n",e+=" member-name-shorthand)\n",e+="\n",e+="; https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths\n",e+="normalized-path = root-identifier *(normal-index-segment)\n",e+="normal-index-segment = left-bracket normal-selector right-bracket ; MODIFICATION: surrogate text rule used\n",e+="normal-selector = normal-name-selector / normal-index-selector\n",e+="normal-name-selector = squote *normal-single-quoted squote ; 'string', MODIFICATION: surrogate text rule used\n",e+="normal-single-quoted = normal-unescaped /\n",e+=" ESC normal-escapable\n",e+="normal-unescaped = ; omit %x0-1F control codes\n",e+=" %x20-26 /\n",e+=" ; omit 0x27 '\n",e+=" %x28-5B /\n",e+=" ; omit 0x5C \\\n",e+=" %x5D-D7FF /\n",e+=" ; skip surrogate code points\n",e+=" %xE000-10FFFF\n",e+="\n",e+="normal-escapable = %x62 / ; b BS backspace U+0008\n",e+=" %x66 / ; f FF form feed U+000C\n",e+=" %x6E / ; n LF line feed U+000A\n",e+=" %x72 / ; r CR carriage return U+000D\n",e+=" %x74 / ; t HT horizontal tab U+0009\n",e+=" \"'\" / ; ' apostrophe U+0027\n",e+=' "\\" / ; \\ backslash (reverse solidus) U+005C\n',e+=" (%x75 normal-hexchar)\n",e+=" ; certain values u00xx U+00XX\n",e+='normal-hexchar = "0" "0"\n',e+=" (\n",e+=' ("0" %x30-37) / ; "00"-"07"\n',e+=" ; omit U+0008-U+000A BS HT LF\n",e+=' ("0" %x62) / ; "0b"\n',e+=" ; omit U+000C-U+000D FF CR\n",e+=' ("0" %x65-66) / ; "0e"-"0f"\n',e+=' ("1" normal-HEXDIG)\n',e+=" )\n",e+='normal-HEXDIG = DIGIT / %x61-66 ; "0"-"9", "a"-"f"\n',e+='normal-index-selector = "0" / (DIGIT1 *DIGIT)\n',e+=" ; non-negative decimal integer\n",e+="\n",e+="; Surrogate named rules\n",e+='dot-prefix = "."\n',e+='double-dot-prefix = ".."\n',e+='left-bracket = "["\n',e+='right-bracket = "]"\n',e+='left-paren = "("\n',e+='right-paren = ")"\n',e+='comma = ","\n',e+='colon = ":"\n',e+='dquote = %x22 ; "\n',e+="squote = %x27 ; '\n",e+='questionmark = "?"\n',e+='disjunction = "||"\n',e+='conjunction = "&&"\n','; JSONPath: Query Expressions for JSON\n; https://www.rfc-editor.org/rfc/rfc9535\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1\njsonpath-query = root-identifier segments\nsegments = *(S segment)\n\nB = %x20 / ; Space\n %x09 / ; Horizontal tab\n %x0A / ; Line feed or New line\n %x0D ; Carriage return\nS = *B ; optional blank space\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1\nroot-identifier = "$"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3\nselector = name-selector /\n wildcard-selector /\n slice-selector /\n index-selector /\n filter-selector\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1\nname-selector = string-literal\n\nstring-literal = dquote *double-quoted dquote / ; "string", MODIFICATION: surrogate text rule used\n squote *single-quoted squote ; \'string\', MODIFICATION: surrogate text rule used\n\ndouble-quoted = unescaped /\n %x27 / ; \'\n ESC %x22 / ; \\"\n ESC escapable\n\nsingle-quoted = unescaped /\n %x22 / ; "\n ESC %x27 / ; \\\'\n ESC escapable\n\nESC = %x5C ; \\ backslash\n\nunescaped = %x20-21 / ; see RFC 8259\n ; omit 0x22 "\n %x23-26 /\n ; omit 0x27 \'\n %x28-5B /\n ; omit 0x5C \\\n %x5D-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\n\nescapable = %x62 / ; b BS backspace U+0008\n %x66 / ; f FF form feed U+000C\n %x6E / ; n LF line feed U+000A\n %x72 / ; r CR carriage return U+000D\n %x74 / ; t HT horizontal tab U+0009\n "/" / ; / slash (solidus) U+002F\n "\\" / ; \\ backslash (reverse solidus) U+005C\n (%x75 hexchar) ; uXXXX U+XXXX\n\nhexchar = non-surrogate /\n (high-surrogate "\\" %x75 low-surrogate)\nnon-surrogate = ((DIGIT / "A"/"B"/"C" / "E"/"F") 3HEXDIG) /\n ("D" %x30-37 2HEXDIG )\nhigh-surrogate = "D" ("8"/"9"/"A"/"B") 2HEXDIG\nlow-surrogate = "D" ("C"/"D"/"E"/"F") 2HEXDIG\n\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1\nwildcard-selector = "*"\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1\nindex-selector = int ; decimal integer\n\nint = "0" /\n (["-"] DIGIT1 *DIGIT) ; - optional\nDIGIT1 = %x31-39 ; 1-9 non-zero digit\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1\nslice-selector = [start S] colon S [end S] [colon [S step ]] ; MODIFICATION: surrogate text rule used\n\nstart = int ; included in selection\nend = int ; not included in selection\nstep = int ; default: 1\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1\nfilter-selector = questionmark S logical-expr ; MODIFICATION: surrogate text rule used\n\nlogical-expr = logical-or-expr\nlogical-or-expr = logical-and-expr *(S disjunction S logical-and-expr) ; MODIFICATION: surrogate text rule used\n ; disjunction\n ; binds less tightly than conjunction\nlogical-and-expr = basic-expr *(S conjunction S basic-expr) ; MODIFICATION: surrogate text rule used\n ; conjunction\n ; binds more tightly than disjunction\n\nbasic-expr = paren-expr /\n comparison-expr /\n test-expr\n\nparen-expr = [logical-not-op S] left-paren S logical-expr S right-paren ; MODIFICATION: surrogate text rule used\n ; parenthesized expression\nlogical-not-op = "!" ; logical NOT operator\n\ntest-expr = [logical-not-op S]\n (filter-query / ; existence/non-existence\n function-expr) ; LogicalType or NodesType\nfilter-query = rel-query / jsonpath-query\nrel-query = current-node-identifier segments\ncurrent-node-identifier = "@"\n\ncomparison-expr = comparable S comparison-op S comparable\nliteral = number / string-literal /\n true / false / null\ncomparable = singular-query / ; singular query value\n function-expr / ; ValueType\n literal\n ; MODIFICATION: https://www.rfc-editor.org/errata/eid8352\ncomparison-op = "==" / "!=" /\n "<=" / ">=" /\n "<" / ">"\n\nsingular-query = rel-singular-query / abs-singular-query\nrel-singular-query = current-node-identifier singular-query-segments\nabs-singular-query = root-identifier singular-query-segments\nsingular-query-segments = *(S (name-segment / index-segment))\nname-segment = (left-bracket name-selector right-bracket) / ; MODIFICATION: surrogate text rule used\n (dot-prefix member-name-shorthand) ; MODIFICATION: surrogate text rule used\nindex-segment = left-bracket index-selector right-bracket ; MODIFICATION: surrogate text rule used\n\nnumber = (int / "-0") [ frac ] [ exp ] ; decimal number\nfrac = "." 1*DIGIT ; decimal fraction\nexp = "e" [ "-" / "+" ] 1*DIGIT ; decimal exponent\ntrue = %x74.72.75.65 ; true\nfalse = %x66.61.6c.73.65 ; false\nnull = %x6e.75.6c.6c ; null\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.4\nfunction-name = function-name-first *function-name-char\nfunction-name-first = LCALPHA\nfunction-name-char = function-name-first / "_" / DIGIT\nLCALPHA = %x61-7A ; "a".."z"\n\nfunction-expr = function-name left-paren S [function-argument ; MODIFICATION: surrogate text rule used\n *(S comma S function-argument)] S right-paren ; MODIFICATION: surrogate text rule used\nfunction-argument = logical-expr / ; MODIFICATION: https://www.rfc-editor.org/errata/eid8343\n filter-query / ; (includes singular-query)\n function-expr /\n literal\n\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5\nsegment = child-segment / descendant-segment\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1\nchild-segment = bracketed-selection /\n (dot-prefix ; MODIFICATION: surrogate text rule used\n (wildcard-selector /\n member-name-shorthand))\n\nbracketed-selection = left-bracket S selector *(S comma S selector) S right-bracket\n ; MODIFICATION: surrogate text rule used\n\nmember-name-shorthand = name-first *name-char\nname-first = ALPHA /\n "_" /\n %x80-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\nname-char = name-first / DIGIT\n\nDIGIT = %x30-39 ; 0-9\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n\n; https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1\ndescendant-segment = double-dot-prefix (bracketed-selection / ; MODIFICATION: surrogate text rule used\n wildcard-selector /\n member-name-shorthand)\n\n; https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths\nnormalized-path = root-identifier *(normal-index-segment)\nnormal-index-segment = left-bracket normal-selector right-bracket ; MODIFICATION: surrogate text rule used\nnormal-selector = normal-name-selector / normal-index-selector\nnormal-name-selector = squote *normal-single-quoted squote ; \'string\', MODIFICATION: surrogate text rule used\nnormal-single-quoted = normal-unescaped /\n ESC normal-escapable\nnormal-unescaped = ; omit %x0-1F control codes\n %x20-26 /\n ; omit 0x27 \'\n %x28-5B /\n ; omit 0x5C \\\n %x5D-D7FF /\n ; skip surrogate code points\n %xE000-10FFFF\n\nnormal-escapable = %x62 / ; b BS backspace U+0008\n %x66 / ; f FF form feed U+000C\n %x6E / ; n LF line feed U+000A\n %x72 / ; r CR carriage return U+000D\n %x74 / ; t HT horizontal tab U+0009\n "\'" / ; \' apostrophe U+0027\n "\\" / ; \\ backslash (reverse solidus) U+005C\n (%x75 normal-hexchar)\n ; certain values u00xx U+00XX\nnormal-hexchar = "0" "0"\n (\n ("0" %x30-37) / ; "00"-"07"\n ; omit U+0008-U+000A BS HT LF\n ("0" %x62) / ; "0b"\n ; omit U+000C-U+000D FF CR\n ("0" %x65-66) / ; "0e"-"0f"\n ("1" normal-HEXDIG)\n )\nnormal-HEXDIG = DIGIT / %x61-66 ; "0"-"9", "a"-"f"\nnormal-index-selector = "0" / (DIGIT1 *DIGIT)\n ; non-negative decimal integer\n\n; Surrogate named rules\ndot-prefix = "."\ndouble-dot-prefix = ".."\nleft-bracket = "["\nright-bracket = "]"\nleft-paren = "("\nright-paren = ")"\ncomma = ","\ncolon = ":"\ndquote = %x22 ; "\nsquote = %x27 ; \'\nquestionmark = "?"\ndisjunction = "||"\nconjunction = "&&"\n'}}e.r(r),e.d(r,{count:()=>we,length:()=>be,match:()=>Se,search:()=>Ae,value:()=>ke});const o=function(){const e=u,t=a,s=this,r="parser.js: Parser(): ";s.ast=void 0,s.stats=void 0,s.trace=void 0,s.callbacks=[];let n,o,i,l,c,p,h,d=0,m=0,y=0,g=0,f=0,x=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};s.parse=(a,u,b,w)=>{const T=`${r}parse(): `;d=0,m=0,y=0,g=0,f=0,n=void 0,o=void 0,i=void 0,l=void 0,x.refresh(),c=void 0,p=void 0,h=void 0,l=t.stringToChars(b),n=a.rules,o=a.udts;const E=u.toLowerCase();let S;for(const e in n)if(n.hasOwnProperty(e)&&E===n[e].lower){S=n[e].index;break}if(void 0===S)throw new Error(`${T}start rule name '${startRule}' not recognized`);(()=>{const e=`${r}initializeCallbacks(): `;let t,i;for(c=[],p=[],t=0;t<n.length;t+=1)c[t]=void 0;for(t=0;t<o.length;t+=1)p[t]=void 0;const l=[];for(t=0;t<n.length;t+=1)l.push(n[t].lower);for(t=0;t<o.length;t+=1)l.push(o[t].lower);for(const r in s.callbacks)if(s.callbacks.hasOwnProperty(r)){if(t=l.indexOf(r.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${r}' not a rule or udt name`);if(i=s.callbacks[r]?s.callbacks[r]:void 0,"function"!=typeof i&&void 0!==i)throw new Error(`${e}syntax callback[${r}] must be function reference or falsy)`);t<n.length?c[t]=i:p[t-n.length]=i}})(),s.trace&&s.trace.init(n,o,l),s.stats&&s.stats.init(n,o),s.ast&&s.ast.init(n,o,l),h=w,i=[{type:e.RNM,index:S}],k(0,0),i=void 0;let A=!1;switch(x.state){case e.ACTIVE:throw new Error(`${T}final state should never be 'ACTIVE'`);case e.NOMATCH:A=!1;break;case e.EMPTY:case e.MATCH:A=x.phraseLength===l.length;break;default:throw new Error("unrecognized state")}return{success:A,state:x.state,stateName:e.idName(x.state),length:l.length,matched:x.phraseLength,maxMatched:f,maxTreeDepth:y,nodeHits:g}};const b=(t,s,n,o)=>{if(s.phraseLength>n){let e=`${r}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${s.phraseLength}`,e+=` must be <= remaining chars: ${n}`,new Error(e)}switch(s.state){case e.ACTIVE:if(!o)throw new Error(`${r}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:s.phraseLength=0;break;case e.MATCH:0===s.phraseLength&&(s.state=e.EMPTY);break;case e.NOMATCH:s.phraseLength=0;break;default:throw new Error(`${r}opRNM(${t.name}): callback function return error. Unrecognized return state: ${s.state}`)}},w=(t,c)=>{let a,u,m;const y=i[t],g=o[y.index];x.UdtIndex=g.index,d||(m=s.ast&&s.ast.udtDefined(y.index),m&&(u=n.length+y.index,a=s.ast.getLength(),s.ast.down(u,g.name)));const f=l.length-c;p[y.index](x,l,c,h),((t,s,n)=>{if(s.phraseLength>n){let e=`${r}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${s.phraseLength}`,e+=` must be <= remaining chars: ${n}`,new Error(e)}switch(s.state){case e.ACTIVE:throw new Error(`${r}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);s.phraseLength=0;break;case e.MATCH:if(0===s.phraseLength){if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);s.state=e.EMPTY}break;case e.NOMATCH:s.phraseLength=0;break;default:throw new Error(`${r}opUDT(${t.name}): callback function return error. Unrecognized return state: ${s.state}`)}})(g,x,f),d||m&&(x.state===e.NOMATCH?s.ast.setLength(a):s.ast.up(u,g.name,c,x.phraseLength))},k=(t,o)=>{const a=`${r}opExecute(): `,u=i[t];switch(g+=1,m>y&&(y=m),m+=1,x.refresh(),s.trace&&s.trace.down(u,o),u.type){case e.ALT:((t,s)=>{const r=i[t];for(let t=0;t<r.children.length&&(k(r.children[t],s),x.state===e.NOMATCH);t+=1);})(t,o);break;case e.CAT:((t,r)=>{let n,o,l,c;const a=i[t];s.ast&&(o=s.ast.getLength()),n=!0,l=r,c=0;for(let t=0;t<a.children.length;t+=1){if(k(a.children[t],l),x.state===e.NOMATCH){n=!1;break}l+=x.phraseLength,c+=x.phraseLength}n?(x.state=0===c?e.EMPTY:e.MATCH,x.phraseLength=c):(x.state=e.NOMATCH,x.phraseLength=0,s.ast&&s.ast.setLength(o))})(t,o);break;case e.REP:((t,r)=>{let n,o,c,a;const u=i[t];if(0===u.max)return x.state=e.EMPTY,void(x.phraseLength=0);for(o=r,c=0,a=0,s.ast&&(n=s.ast.getLength());!(o>=l.length)&&(k(t+1,o),x.state!==e.NOMATCH)&&x.state!==e.EMPTY&&(a+=1,c+=x.phraseLength,o+=x.phraseLength,a!==u.max););x.state===e.EMPTY||a>=u.min?(x.state=0===c?e.EMPTY:e.MATCH,x.phraseLength=c):(x.state=e.NOMATCH,x.phraseLength=0,s.ast&&s.ast.setLength(n))})(t,o);break;case e.RNM:((t,r)=>{let o,a,u;const p=i[t],m=n[p.index],y=c[m.index];if(d||(a=s.ast&&s.ast.ruleDefined(p.index),a&&(o=s.ast.getLength(),s.ast.down(p.index,n[p.index].name))),y){const t=l.length-r;y(x,l,r,h),b(m,x,t,!0),x.state===e.ACTIVE&&(u=i,i=m.opcodes,k(0,r),i=u,y(x,l,r,h),b(m,x,t,!1))}else u=i,i=m.opcodes,k(0,r,x),i=u;d||a&&(x.state===e.NOMATCH?s.ast.setLength(o):s.ast.up(p.index,m.name,r,x.phraseLength))})(t,o);break;case e.TRG:((t,s)=>{const r=i[t];x.state=e.NOMATCH,s<l.length&&r.min<=l[s]&&l[s]<=r.max&&(x.state=e.MATCH,x.phraseLength=1)})(t,o);break;case e.TBS:((t,s)=>{const r=i[t],n=r.string.length;if(x.state=e.NOMATCH,s+n<=l.length){for(let e=0;e<n;e+=1)if(l[s+e]!==r.string[e])return;x.state=e.MATCH,x.phraseLength=n}})(t,o);break;case e.TLS:((t,s)=>{let r;const n=i[t];x.state=e.NOMATCH;const o=n.string.length;if(0!==o){if(s+o<=l.length){for(let e=0;e<o;e+=1)if(r=l[s+e],r>=65&&r<=90&&(r+=32),r!==n.string[e])return;x.state=e.MATCH,x.phraseLength=o}}else x.state=e.EMPTY})(t,o);break;case e.UDT:w(t,o);break;case e.AND:((t,s)=>{switch(d+=1,k(t+1,s),d-=1,x.phraseLength=0,x.state){case e.EMPTY:case e.MATCH:x.state=e.EMPTY;break;case e.NOMATCH:x.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${x.state}`)}})(t,o);break;case e.NOT:((t,s)=>{switch(d+=1,k(t+1,s),d-=1,x.phraseLength=0,x.state){case e.EMPTY:case e.MATCH:x.state=e.NOMATCH;break;case e.NOMATCH:x.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${x.state}`)}})(t,o);break;default:throw new Error(`${a}unrecognized operator`)}d||o+x.phraseLength>f&&(f=o+x.phraseLength),s.stats&&s.stats.collect(u,x),s.trace&&s.trace.up(u,x.state,o,x.phraseLength),m-=1}},i=function(){const e=u,t=a,s=this;let r,n,o,i=0;const l=[],c=[],p=[];function h(e){let t="";for(;e-- >0;)t+=" ";return t}s.callbacks=[],s.init=(e,t,a)=>{let u;c.length=0,p.length=0,i=0,r=e,n=t,o=a;const h=[];for(u=0;u<r.length;u+=1)h.push(r[u].lower);for(u=0;u<n.length;u+=1)h.push(n[u].lower);for(i=r.length+n.length,u=0;u<i;u+=1)l[u]=void 0;for(const e in s.callbacks)if(s.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(u=h.indexOf(t),u<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);l[u]=s.callbacks[e]}},s.ruleDefined=e=>!!l[e],s.udtDefined=e=>!!l[r.length+e],s.down=(t,s)=>{const r=p.length;return c.push(r),p.push({name:s,thisIndex:r,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),r},s.up=(t,s,r,n)=>{const o=p.length,i=c.pop();return p.push({name:s,thisIndex:o,thatIndex:i,state:e.SEM_POST,callbackIndex:t,phraseIndex:r,phraseLength:n,stack:c.length}),p[i].thatIndex=o,p[i].phraseIndex=r,p[i].phraseLength=n,o},s.translate=t=>{let s,r;for(let n=0;n<p.length;n+=1)r=p[n],s=l[r.callbackIndex],s&&(r.state===e.SEM_PRE?s(e.SEM_PRE,o,r.phraseIndex,r.phraseLength,t):s&&s(e.SEM_POST,o,r.phraseIndex,r.phraseLength,t))},s.setLength=e=>{p.length=e,c.length=e>0?p[e-1].stack:0},s.getLength=()=>p.length,s.toXml=()=>{let s="",r=0;return s+='<?xml version="1.0" encoding="utf-8"?>\n',s+=`<root nodes="${p.length/2}" characters="${o.length}">\n`,s+="\x3c!-- input string --\x3e\n",s+=h(r+2),s+=t.charsToString(o),s+="\n",p.forEach(n=>{n.state===e.SEM_PRE?(r+=1,s+=h(r),s+=`<node name="${n.name}" index="${n.phraseIndex}" length="${n.phraseLength}">\n`,s+=h(r+2),s+=t.charsToString(o,n.phraseIndex,n.phraseLength),s+="\n"):(s+=h(r),s+=`</node>\x3c!-- name="${n.name}" --\x3e\n`,r-=1)}),s+="</root>\n",s}},l=function(){const e=u,t=a,s="parser.js: Trace(): ";let r,n,o,i="",l=0;const c=this,p=e=>{let t="",s=0;if(e>=0)for(;e--;)s+=1,5===s?(t+="|",s=0):t+=".";return t};c.init=(e,t,s)=>{n=e,o=t,r=s};const h=r=>{let i;switch(r.type){case e.ALT:i="ALT";break;case e.CAT:i="CAT";break;case e.REP:i=r.max===1/0?`REP(${r.min},inf)`:`REP(${r.min},${r.max})`;break;case e.RNM:i=`RNM(${n[r.index].name})`;break;case e.TRG:i=`TRG(${r.min},${r.max})`;break;case e.TBS:i=r.string.length>6?`TBS(${t.charsToString(r.string,0,3)}...)`:`TBS(${t.charsToString(r.string,0,6)})`;break;case e.TLS:i=r.string.length>6?`TLS(${t.charsToString(r.string,0,3)}...)`:`TLS(${t.charsToString(r.string,0,6)})`;break;case e.UDT:i=`UDT(${o[r.index].name})`;break;case e.AND:i="AND";break;case e.NOT:i="NOT";break;default:throw new Error(`${s}Trace: opName: unrecognized opcode`)}return i};c.down=(e,s)=>{const n=p(l),o=Math.min(100,r.length-s);let c=t.charsToString(r,s,o);o<r.length-s&&(c+="..."),c=`${n}|-|[${h(e)}]${c}\n`,i+=c,l+=1},c.up=(n,o,c,a)=>{const u=`${s}trace.up: `;l-=1;const d=p(l);let m,y,g;switch(o){case e.EMPTY:g="|E|",y="''";break;case e.MATCH:g="|M|",m=Math.min(100,a),y=m<a?`'${t.charsToString(r,c,m)}...'`:`'${t.charsToString(r,c,m)}'`;break;case e.NOMATCH:g="|N|",y="";break;default:throw new Error(`${u} unrecognized state`)}y=`${d}${g}[${h(n)}]${y}\n`,i+=y},c.displayTrace=()=>i},c=function(){const e=u;let t,s,r;const n=[],o=[],i=[];this.init=(e,r)=>{t=e,s=r,d()},this.collect=(t,s)=>{m(r,s.state,s.phraseLength),m(n[t.type],s.state,s.phraseLength),t.type===e.RNM&&m(o[t.index],s.state,s.phraseLength),t.type===e.UDT&&m(i[t.index],s.state,s.phraseLength)},this.displayStats=()=>{let t="";const s={match:0,empty:0,nomatch:0,total:0},r=(e,t,r,n,o)=>{s.match+=t,s.empty+=r,s.nomatch+=n,s.total+=o;return`${e} | ${l(t)} | ${l(r)} | ${l(n)} | ${l(o)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=r(" ALT",n[e.ALT].match,n[e.ALT].empty,n[e.ALT].nomatch,n[e.ALT].total),t+=r(" CAT",n[e.CAT].match,n[e.CAT].empty,n[e.CAT].nomatch,n[e.CAT].total),t+=r(" REP",n[e.REP].match,n[e.REP].empty,n[e.REP].nomatch,n[e.REP].total),t+=r(" RNM",n[e.RNM].match,n[e.RNM].empty,n[e.RNM].nomatch,n[e.RNM].total),t+=r(" TRG",n[e.TRG].match,n[e.TRG].empty,n[e.TRG].nomatch,n[e.TRG].total),t+=r(" TBS",n[e.TBS].match,n[e.TBS].empty,n[e.TBS].nomatch,n[e.TBS].total),t+=r(" TLS",n[e.TLS].match,n[e.TLS].empty,n[e.TLS].nomatch,n[e.TLS].total),t+=r(" UDT",n[e.UDT].match,n[e.UDT].empty,n[e.UDT].nomatch,n[e.UDT].total),t+=r(" AND",n[e.AND].match,n[e.AND].empty,n[e.AND].nomatch,n[e.AND].total),t+=r(" NOT",n[e.NOT].match,n[e.NOT].empty,n[e.NOT].nomatch,n[e.NOT].total),t+=r("TOTAL",s.match,s.empty,s.nomatch,s.total),t},this.displayHits=e=>{let t="";const s=(e,t,s,n,o)=>{r.match+=e,r.empty+=t,r.nomatch+=s,r.total+=n;return`| ${l(e)} | ${l(t)} | ${l(s)} | ${l(n)} | ${o}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(o.sort(c),i.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(o.sort(p),i.sort(p),t+=" RULES/UDTS BY INDEX\n"):(o.sort(a),i.sort(a),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<o.length;e+=1){let r=o[e];r.total&&(t+=s(r.match,r.empty,r.nomatch,r.total,r.name))}for(let e=0;e<i.length;e+=1){let r=i[e];r.total&&(t+=s(r.match,r.empty,r.nomatch,r.total,r.name))}return t};const l=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,a=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),p=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,h=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},d=()=>{n.length=0,r=new h,n[e.ALT]=new h,n[e.CAT]=new h,n[e.REP]=new h,n[e.RNM]=new h,n[e.TRG]=new h,n[e.TBS]=new h,n[e.TLS]=new h,n[e.UDT]=new h,n[e.AND]=new h,n[e.NOT]=new h,o.length=0;for(let e=0;e<t.length;e+=1)o.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(s.length>0){i.length=0;for(let e=0;e<s.length;e+=1)i.push({empty:0,match:0,nomatch:0,total:0,name:s[e].name,lower:s[e].lower,index:s[e].index})}},m=(t,s)=>{switch(t.total+=1,s){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${s}`)}}},a={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,s)=>{let r=e;for(;!(void 0===t||t<0);){if(void 0===s){r=e.slice(t);break}if(s<=0)return"";r=e.slice(t,t+s);break}return String.fromCodePoint(...r)}},u={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case u.ALT:return"ALT";case u.CAT:return"CAT";case u.REP:return"REP";case u.RNM:return"RNM";case u.TRG:return"TRG";case u.TBS:return"TBS";case u.TLS:return"TLS";case u.UDT:return"UDT";case u.AND:return"AND";case u.NOT:return"NOT";case u.ACTIVE:return"ACTIVE";case u.EMPTY:return"EMPTY";case u.MATCH:return"MATCH";case u.NOMATCH:return"NOMATCH";case u.SEM_PRE:return"SEM_PRE";case u.SEM_POST:return"SEM_POST";case u.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};const p=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const h=class extends l{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let s=-1;for(let r=0;r<e.length;r++){const n=e[r];if(n.includes("M|")){const e=n.match(/]'(.*)'$/);e&&e[1]&&(s=r)}if(r>s){const e=n.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new p(...t)}};class d extends Error{constructor(e,t=void 0){if(super(e,t),this.name=this.constructor.name,"string"==typeof e&&(this.message=e),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,null!=t&&"object"==typeof t&&Object.hasOwn(t,"cause")&&!("cause"in this)){const{cause:e}=t;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}if(null!=t&&"object"==typeof t){const{cause:e,...s}=t;Object.assign(this,s)}}}const m=d;const y=class extends m{},g=e=>(t,s,r,n,o)=>{if("object"!=typeof o||null===o||Array.isArray(o))throw new y("parser's user data must be an object");if(!o.options?.optimize||0!==n||!o.options?.droppableTypes?.includes(e)){if(t===u.SEM_PRE){const t={type:e,text:a.charsToString(s,r,n),start:r,length:n,children:[]};if(o.stack.length>0){const e=o.stack[o.stack.length-1],s=e.children[e.children.length-1],r="text"===e.type&&"text"===t.type;o.options?.optimize&&o.options?.collapsibleTypes?.includes(t.type)&&s?.type===t.type?(s.text+=t.text,s.length+=t.length):r||e.children.push(t)}else o.root=t;o.stack.push(t)}t===u.SEM_POST&&o.stack.pop()}};const f=class extends i{constructor(){super(),this.callbacks["jsonpath-query"]=g("jsonpath-query"),this.callbacks.segments=g("segments"),this.callbacks.B=g("text"),this.callbacks.S=g("text"),this.callbacks["root-identifier"]=g("root-identifier"),this.callbacks.selector=g("selector"),this.callbacks["name-selector"]=g("name-selector"),this.callbacks["string-literal"]=g("string-literal"),this.callbacks["double-quoted"]=g("double-quoted"),this.callbacks["single-quoted"]=g("single-quoted"),this.callbacks["wildcard-selector"]=g("wildcard-selector"),this.callbacks["index-selector"]=g("index-selector"),this.callbacks["slice-selector"]=g("slice-selector"),this.callbacks.start=g("start"),this.callbacks.end=g("end"),this.callbacks.step=g("step"),this.callbacks["filter-selector"]=g("filter-selector"),this.callbacks["logical-expr"]=g("logical-expr"),this.callbacks["logical-or-expr"]=g("logical-or-expr"),this.callbacks["logical-and-expr"]=g("logical-and-expr"),this.callbacks["basic-expr"]=g("basic-expr"),this.callbacks["paren-expr"]=g("paren-expr"),this.callbacks["logical-not-op"]=g("logical-not-op"),this.callbacks["test-expr"]=g("test-expr"),this.callbacks["filter-query"]=g("filter-query"),this.callbacks["rel-query"]=g("rel-query"),this.callbacks["current-node-identifier"]=g("current-node-identifier"),this.callbacks["comparison-expr"]=g("comparison-expr"),this.callbacks.literal=g("literal"),this.callbacks.comparable=g("comparable"),this.callbacks["comparison-op"]=g("comparison-op"),this.callbacks["singular-query"]=g("singular-query"),this.callbacks["rel-singular-query"]=g("rel-singular-query"),this.callbacks["abs-singular-query"]=g("abs-singular-query"),this.callbacks["singular-query-segments"]=g("singular-query-segments"),this.callbacks["name-segment"]=g("name-segment"),this.callbacks["index-segment"]=g("index-segment"),this.callbacks.number=g("number"),this.callbacks.true=g("true"),this.callbacks.false=g("false"),this.callbacks.null=g("null"),this.callbacks["function-name"]=g("function-name"),this.callbacks["function-expr"]=g("function-expr"),this.callbacks["function-argument"]=g("function-argument"),this.callbacks.segment=g("segment"),this.callbacks["child-segment"]=g("child-segment"),this.callbacks["bracketed-selection"]=g("bracketed-selection"),this.callbacks["member-name-shorthand"]=g("member-name-shorthand"),this.callbacks["descendant-segment"]=g("descendant-segment"),this.callbacks["normalized-path"]=g("normalized-path"),this.callbacks["normal-index-segment"]=g("normal-index-segment"),this.callbacks["normal-selector"]=g("normal-selector"),this.callbacks["normal-name-selector"]=g("normal-name-selector"),this.callbacks["normal-index-selector"]=g("normal-index-selector"),this.callbacks["normal-single-quoted"]=g("normal-single-quoted"),this.callbacks["dot-prefix"]=g("text"),this.callbacks["double-dot-prefix"]=g("text"),this.callbacks["left-bracket"]=g("text"),this.callbacks["right-bracket"]=g("text"),this.callbacks.comma=g("text"),this.callbacks.colon=g("text"),this.callbacks.dquote=g("text"),this.callbacks.squote=g("text"),this.callbacks.questionmark=g("text"),this.callbacks.disjunction=g("text"),this.callbacks.conjunction=g("text"),this.callbacks["left-paren"]=g("text"),this.callbacks["right-paren"]=g("text")}getTree(){const e={stack:[],root:null};return this.translate(e),e.root}};const x=class extends f{collapsibleTypes=["single-quoted","double-quoted","normal-single-quoted"];droppableTypes=["text","segments","singular-query-segments"];constructor({collapsibleTypes:e,droppableTypes:t}={}){super(),Array.isArray(e)&&(this.collapsibleTypes=e),Array.isArray(t)&&(this.droppableTypes=t)}getTree(){const e={stack:[],root:null,options:{optimize:!0,collapsibleTypes:this.collapsibleTypes,droppableTypes:this.droppableTypes}};return this.translate(e),e.root}},b=e=>T(`"${e}"`),w=e=>{let t="";for(let s=0;s<e.length;s++){const r=e[s];if("\\"===r){if(s++,s>=e.length){t+="\\";break}const r=e[s];switch(r){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"/":t+="/";break;case"\\":t+="\\";break;case"'":t+="'";break;case'"':t+='"';break;case"u":{const r=e.slice(s+1,s+5);t+=String.fromCharCode(parseInt(r,16)),s+=4;break}default:t+=r}}else t+=r}return T(JSON.stringify(t))},k=e=>{const t=parseInt(e,10);if(!Number.isSafeInteger(t))throw new RangeError(`Integer value out of safe range [-(2^53)+1, (2^53)-1], got: ${e}`);return t},T=e=>JSON.parse(e),E={count:{params:[{type:"NodesType"}],returns:"ValueType"},length:{params:[{type:"ValueType"}],returns:"ValueType"},value:{params:[{type:"NodesType"}],returns:"ValueType"},match:{params:[{type:"ValueType"},{type:"ValueType"}],returns:"LogicalType"},search:{params:[{type:"ValueType"},{type:"ValueType"}],returns:"LogicalType"}},S=e=>{if("FilterQuery"!==e.type)return!1;const{query:t}=e;if(!t||!t.segments)return!1;for(const e of t.segments){if("ChildSegment"!==e.type)return!1;const{selector:t}=e;if("NameSelector"!==t.type&&"IndexSelector"!==t.type){if("BracketedSelection"!==t.type)return!1;{if(1!==t.selectors.length)return!1;const e=t.selectors[0];if("NameSelector"!==e.type&&"IndexSelector"!==e.type)return!1}}}return!0},A=(e,t,s)=>{if("NodesType"===t){if("Literal"===e.type)throw new RangeError(`Function ${s}() requires NodesType argument, got literal`);if("TestExpr"===e.type&&"FilterQuery"===e.expression?.type)return;if("FilterQuery"===e.type)return;throw new RangeError(`Function ${s}() requires NodesType argument`)}if("ValueType"===t){if("Literal"===e.type)return;if("FunctionExpr"===e.type)return;if("TestExpr"===e.type&&"FunctionExpr"===e.expression?.type)return;if("TestExpr"===e.type&&"FilterQuery"===e.expression?.type){if(!S(e.expression))throw new RangeError(`Function ${s}() requires ValueType argument, got non-singular query`);return}if("FilterQuery"===e.type){if(!S(e))throw new RangeError(`Function ${s}() requires ValueType argument, got non-singular query`);return}throw new RangeError(`Function ${s}() requires ValueType argument`)}},I=e=>{if(!e)return null;if("FunctionExpr"===e.type){const t=E[e.name];return t?t.returns:null}return"Literal"===e.type||"RelSingularQuery"===e.type||"AbsSingularQuery"===e.type?"ValueType":"FilterQuery"===e.type?"NodesType":"LogicalOrExpr"===e.type||"LogicalAndExpr"===e.type||"LogicalNotExpr"===e.type||"ComparisonExpr"===e.type?"LogicalType":"TestExpr"===e.type?I(e.expression):null},O=(e,t,s={parent:null,path:[]})=>{const r=t[e.type];if(!r)throw new y(`No transformer for CST node type: ${e.type}`);return r(e,{parent:e,path:[...s.path,e]})},v={"jsonpath-query"(e,t){const s=e.children.find(e=>"segments"===e.type);return{type:"JsonPathQuery",segments:s?s.children.filter(({type:e})=>"segment"===e).map(e=>O(e,v,t)):[]}},segment(e,t){const s=e.children.find(({type:e})=>["child-segment","descendant-segment"].includes(e));return O(s,v,t)},selector(e,t){const s=e.children.find(({type:e})=>["name-selector","wildcard-selector","slice-selector","index-selector","filter-selector"].includes(e));return O(s,v,t)},"name-selector"(e,t){const s=e.children.find(({type:e})=>"string-literal"===e),r=O(s,v,t);return{type:"NameSelector",value:r.value,format:r.format}},"string-literal"(e){const t=e.children.find(({type:e,text:t})=>"text"===e&&"'"===t),s=e.children.find(({type:e})=>["double-quoted","single-quoted"].includes(e));return{type:"StringLiteral",value:s?(t?w:b)(s.text):"",format:t?"single-quoted":"double-quoted"}},"wildcard-selector":()=>({type:"WildcardSelector"}),"index-selector":e=>({type:"IndexSelector",value:k(e.text)}),"slice-selector"(e){const t=e.children.find(({type:e})=>"start"===e),s=e.children.find(({type:e})=>"end"===e),r=e.children.find(({type:e})=>"step"===e);return{type:"SliceSelector",start:t?k(t.text):null,end:s?k(s.text):null,step:r?k(r.text):null}},"filter-selector"(e,t){const s=e.children.find(({type:e})=>"logical-expr"===e),r=O(s,v,t);if("TestExpr"===r.type){if("ValueType"===I(r.expression)){const e="FunctionExpr"===r.expression.type?r.expression.name:"expression";throw new RangeError(`Function ${e}() returns ValueType which cannot be used as existence test; result must be compared`)}}if("LogicalNotExpr"===r.type&&"TestExpr"===r.expression?.type){const e=r.expression.expression;if("ValueType"===I(e)){const t="FunctionExpr"===e.type?e.name:"expression";throw new RangeError(`Function ${t}() returns ValueType which cannot be used as existence test; result must be compared`)}}return{type:"FilterSelector",expression:r}},"logical-expr"(e,t){const s=e.children.find(({type:e})=>"logical-or-expr"===e);return O(s,v,t)},"logical-or-expr"(e,t){const s=e.children.filter(({type:e})=>"logical-and-expr"===e);if(1===s.length)return O(s[0],v,t);let r=O(s[0],v,t);for(let e=1;e<s.length;e+=1){r={type:"LogicalOrExpr",left:r,right:O(s[e],v,t)}}return r},"logical-and-expr"(e,t){const s=e.children.filter(({type:e})=>"basic-expr"===e);if(1===s.length)return O(s[0],v,t);let r=O(s[0],v,t);for(let e=1;e<s.length;e+=1){r={type:"LogicalAndExpr",left:r,right:O(s[e],v,t)}}return r},"basic-expr"(e,t){const s=e.children.find(({type:e})=>["paren-expr","comparison-expr","test-expr"].includes(e));return O(s,v,t)},"paren-expr"(e,t){const s=e.children.some(e=>"logical-not-op"===e.type),r=e.children.find(e=>"logical-expr"===e.type),n=O(r,v,t);return s?{type:"LogicalNotExpr",expression:n}:n},"test-expr"(e,t){const s=e.children.some(({type:e})=>"logical-not-op"===e),r=e.children.find(({type:e})=>["filter-query","function-expr"].includes(e)),n={type:"TestExpr",expression:O(r,v,t)};return s?{type:"LogicalNotExpr",expression:n}:n},"filter-query"(e,t){const s=e.children.find(({type:e})=>["rel-query","jsonpath-query"].includes(e));return{type:"FilterQuery",query:O(s,v,t)}},"rel-query"(e,t){const s=e.children.find(e=>"segments"===e.type);return{type:"RelQuery",segments:s?s.children.filter(e=>"segment"===e.type).map(e=>O(e,v,t)):[]}},"comparison-expr"(e,t){const s=e.children.filter(({type:e})=>["comparable","comparison-op"].includes(e)),[r,n,o]=s,i=O(r,v,t),l=O(o,v,t),c=I(i),a=I(l);if("LogicalType"===c){const e="FunctionExpr"===i.type?i.name:"expression";throw new RangeError(`Function ${e}() returns LogicalType which cannot be compared`)}if("LogicalType"===a){const e="FunctionExpr"===l.type?l.name:"expression";throw new RangeError(`Function ${e}() returns LogicalType which cannot be compared`)}return{type:"ComparisonExpr",left:i,op:n.text,right:l}},literal(e,t){const s=e.children.find(({type:e})=>["number","string-literal","true","false","null"].includes(e));if("string-literal"===s.type){return{type:"Literal",value:O(s,v,t).value}}return{type:"Literal",value:T(s.text)}},comparable(e,t){const s=e.children.find(({type:e})=>["singular-query","function-expr","literal"].includes(e));return O(s,v,t)},"singular-query"(e,t){const s=e.children.find(({type:e})=>["rel-singular-query","abs-singular-query"].includes(e));return O(s,v,t)},"rel-singular-query"(e,t){const s=e.children.find(({type:e})=>"singular-query-segments"===e),r=s?s.children.filter(({type:e})=>["name-segment","index-segment"].includes(e)).map(e=>({type:"SingularQuerySegment",selector:O(e,v,t)})):[];return{type:"RelSingularQuery",segments:r}},"abs-singular-query"(e,t){const s=e.children.find(({type:e})=>"singular-query-segments"===e),r=s?s.children.filter(({type:e})=>["name-segment","index-segment"].includes(e)).map(e=>({type:"SingularQuerySegment",selector:O(e,v,t)})):[];return{type:"AbsSingularQuery",segments:r}},"name-segment"(e,t){const s=e.children.find(({type:e})=>["name-selector","member-name-shorthand"].includes(e));return O(s,v,t)},"index-segment"(e,t){const s=e.children.find(({type:e})=>"index-selector"===e);return O(s,v,t)},"function-expr"(e,t){const s=e.children.find(({type:e})=>"function-name"===e),r=e.children.filter(({type:e})=>"function-argument"===e),n=r.map(e=>O(e,v,t));return((e,t)=>{const s=E[e];if(!s)return;const r=s.params.length,n=t.length;if(n<r)throw new RangeError(`Function ${e}() requires ${r} argument(s), got ${n}`);if(n>r)throw new RangeError(`Function ${e}() requires ${r} argument(s), got ${n}`);for(let n=0;n<r;n++)A(t[n],s.params[n].type,e)})(s.text,n),{type:"FunctionExpr",name:s.text,arguments:n}},"function-argument"(e,t){const s=e.children.find(({type:e})=>["logical-expr","function-expr","filter-query","literal"].includes(e));return O(s,v,t)},"child-segment"(e,t){const s=e.children.find(({type:e})=>["bracketed-selection","wildcard-selector","member-name-shorthand"].includes(e));return{type:"ChildSegment",selector:O(s,v,t)}},"bracketed-selection":(e,t)=>({type:"BracketedSelection",selectors:e.children.filter(({type:e})=>"selector"===e).map(e=>O(e,v,t))}),"member-name-shorthand":e=>({type:"NameSelector",value:e.text,format:"shorthand"}),"descendant-segment"(e,t){const s=e.children.find(({type:e})=>["bracketed-selection","wildcard-selector","member-name-shorthand"].includes(e));return{type:"DescendantSegment",selector:O(s,v,t)}},"normalized-path":(e,t)=>({type:"JsonPathQuery",segments:e.children.filter(({type:e})=>"normal-index-segment"===e).map(e=>O(e,v,t))}),"normal-index-segment"(e,t){const s=e.children.find(({type:e})=>"normal-selector"===e);return{type:"ChildSegment",selector:O(s,v,t)}},"normal-selector"(e,t){const s=e.children.find(({type:e})=>["normal-name-selector","normal-index-selector"].includes(e));return O(s,v,t)},"normal-name-selector"(e){const t=e.children.find(({type:e})=>"normal-single-quoted"===e);return{type:"NameSelector",value:t?w(t.text):"",format:"single-quoted"}},"normal-index-selector":e=>({type:"IndexSelector",value:k(e.text)})},C=v;const M=class extends x{getTree(){const e=super.getTree();return O(e,C)}},q=new n,N=(e,{normalized:t=!1,stats:s=!1,trace:r=!1,translator:n=new M}={})=>{if("string"!=typeof e)throw new TypeError("JSONPath must be a string");try{const i=new o;n&&(i.ast=n),s&&(i.stats=new c),r&&(i.trace=new h);const l=t?"normalized-path":"jsonpath-query",a=i.parse(q,l,e);return{result:a,tree:a.success&&n?i.ast.getTree():void 0,stats:i.stats,trace:i.trace}}catch(t){const s=t instanceof RangeError?`Invalid JSONPath expression: ${t.message}`:"Unexpected error during JSONPath parsing";throw new y(s,{cause:t,jsonPath:e})}};const L=class extends f{getTree(){return this.toXml()}},D=(e,{normalized:t=!1,wellTyped:s=!0}={})=>{if("string"!=typeof e)return!1;try{const{result:r}=N(e,{normalized:t,stats:!1,trace:!1,translator:s?new M:null});return r.success}catch{return!1}};const F=class extends m{},B=e=>D(e,{normalized:!0}),P=e=>{if("string"!=typeof e)throw new TypeError("Selector must be a string");let t="";for(const s of e){const e=s.codePointAt(0);switch(e){case 8:t+="\\b";break;case 9:t+="\\t";break;case 10:t+="\\n";break;case 12:t+="\\f";break;case 13:t+="\\r";break;case 39:t+="\\'";break;case 92:t+="\\\\";break;default:t+=e<=31?`\\u${e.toString(16).padStart(4,"0")}`:s}}return t},$=e=>{if(!Array.isArray(e))throw new F("Selectors must be an array, got: "+typeof e,{selectors:e});try{return`$${e.map(e=>{if("string"==typeof e)return`['${P(e)}']`;if("number"==typeof e){if(!Number.isSafeInteger(e)||e<0)throw new TypeError(`Index selector must be a non-negative safe integer, got: ${e}`);return`[${e}]`}throw new TypeError("Selector must be a string or non-negative integer, got: "+typeof e)}).join("")}`}catch(t){throw new F("Failed to compile normalized JSONPath",{cause:t,selectors:e})}},j=e=>{if("string"!=typeof e)throw new F("Normalized path must be a string, got: "+typeof e,{normalizedPath:e});const t=N(e,{normalized:!0});if(!t.result.success)throw new F("Invalid normalized path",{normalizedPath:e});const{tree:s}=t;return s.segments.map(e=>e.selector.value)},R=(e,t,s,r)=>{const{realm:n}=e,{value:o}=s;if(n.isObject(t)&&n.hasProperty(t,o)){r(n.getProperty(t,o),o)}},_=(e,t,s,r)=>{const{realm:n}=e,{value:o}=s;if(!n.isArray(t))return;const i=n.getLength(t),l=((e,t)=>e>=0?e:t+e)(o,i);if(l>=0&&l<i){r(n.getElement(t,l),l)}},H=(e,t,s,r)=>{const{realm:n}=e;for(const[e,s]of n.entries(t))r(s,e)},U=(e,t)=>e>=0?Math.min(e,t):Math.max(t+e,0),z=(e,t,s,r)=>{const{realm:n}=e,{start:o,end:i,step:l}=s;if(!n.isArray(t))return;const c=((e,t,s,r)=>{const n=s??1;if(0===n)return null;let o,i;if(n>0){const s=0,n=r,l=null!==e?U(e,r):s,c=null!==t?U(t,r):n;o=Math.max(l,0),i=Math.min(c,r)}else{const s=r-1,n=-r-1,l=null!==e?e>=0?Math.min(e,r-1):Math.max(r+e,-1):s,c=null!==t?t>=0?Math.min(t,r-1):Math.max(r+t,-1):n;i=Math.min(l,r-1),o=Math.max(c,-1)}return{lower:o,upper:i,step:n}})(o,i,l,n.getLength(t));if(null===c)return;const{lower:a,upper:u,step:p}=c;if(p>0)for(let e=a;e<u;e+=p){r(n.getElement(t,e),e)}else for(let e=u;e>a;e+=p){r(n.getElement(t,e),e)}},V=(e,t,s,r)=>r.value,G=(e,t,s)=>{const{realm:r}=e,{selector:n}=s;switch(n.type){case"NameSelector":{const{value:e}=n;return r.isObject(t)&&r.hasProperty(t,e)?r.getProperty(t,e):void 0}case"IndexSelector":{const{value:e}=n;if(!r.isArray(t))return;const s=r.getLength(t),o=e>=0?e:s+e;return o>=0&&o<s?r.getElement(t,o):void 0}default:return}},X=(e,t,s,r)=>{const{selectors:n}=s;for(const s of n)de(e,t,s,r)},Q=(e,t,s)=>{const r=[],n=e=>{r.push(e)},{selector:o}=s;switch(o.type){case"BracketedSelection":X(e,t,o,n);break;case"NameSelector":case"WildcardSelector":case"IndexSelector":case"SliceSelector":case"FilterSelector":de(e,t,o,n)}return r},Y=(e,t,s,r)=>{let n=s;for(const t of r){const s=[];if("DescendantSegment"===t.type){const r=n=>{const{realm:o}=e,i=Q(e,n,t);s.push(...i);for(const[,e]of o.entries(n))r(e)};for(const e of n)r(e)}else for(const r of n){const n=Q(e,r,t);s.push(...n)}n=s}return n},J=(e,t,s,r)=>{const{query:n}=r;let o;switch(n.type){case"RelQuery":o=((e,t,s,r)=>{const{segments:n}=r;return 0===n.length?[s]:Y(e,0,[s],n)})(e,0,s,n);break;case"JsonPathQuery":o=((e,t,s,r)=>{const{segments:n}=r;return 0===n.length?[t]:Y(e,0,[t],n)})(e,t,0,n);break;default:o=[]}return i=o,Object.defineProperty(i,"_isNodelist",{value:!0,enumerable:!1,writable:!1}),i;var i};let K;const W=(e,t,s,r)=>{const{name:n,arguments:o}=r,i=e.functions[n];if("function"!=typeof i)return;const l=o.map(r=>((e,t,s,r)=>{switch(r.type){case"Literal":case"RelSingularQuery":case"AbsSingularQuery":case"FunctionExpr":return Z(e,t,s,r);case"FilterQuery":return J(e,t,s,r);case"TestExpr":return"FilterQuery"===r.expression.type?J(e,t,s,r.expression):"FunctionExpr"===r.expression.type?Z(e,t,s,r.expression):K(e,t,s,r);case"LogicalOrExpr":case"LogicalAndExpr":case"LogicalNotExpr":case"ComparisonExpr":return K(e,t,s,r);default:return}})(e,t,s,r));return i(e.realm,...l)},Z=(e,t,s,r)=>{switch(r.type){case"Literal":return V(e,t,s,r);case"RelSingularQuery":return((e,t,s,r)=>{let n=s;for(const t of r.segments)if(n=G(e,n,t),void 0===n)return;return n})(e,0,s,r);case"AbsSingularQuery":return((e,t,s,r)=>{let n=t;for(const t of r.segments)if(n=G(e,n,t),void 0===n)return;return n})(e,t,0,r);case"FunctionExpr":return W(e,t,s,r);default:return}},ee=(e,t,s,r)=>{const{left:n,op:o,right:i}=r,l=Z(e,t,s,n),c=Z(e,t,s,i);return e.realm.compare(l,o,c)},te=e=>Array.isArray(e),se=e=>{if(!(e=>"object"==typeof e&&null!==e&&!te(e))(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(e)},re=e=>"string"==typeof e,ne=e=>"number"==typeof e&&Number.isFinite(e),oe=e=>"boolean"==typeof e,ie=e=>null===e,le=e=>void 0===e,ce=e=>te(e)&&!0===e._isNodelist,ae=e=>ce(e)?1===e.length?e[0]:void 0:e,ue=(e,t,s,r)=>{switch(r.type){case"LogicalOrExpr":return!!ue(e,t,s,r.left)||ue(e,t,s,r.right);case"LogicalAndExpr":return!!ue(e,t,s,r.left)&&ue(e,t,s,r.right);case"LogicalNotExpr":return!ue(e,t,s,r.expression);case"TestExpr":{const{expression:n}=r;if("FilterQuery"===n.type){return J(e,t,s,n).length>0}if("FunctionExpr"===n.type){const r=W(e,t,s,n);return"boolean"==typeof r?r:void 0!==r&&(te(r)?r.length>0:Boolean(r))}return!1}case"ComparisonExpr":return ee(e,t,s,r);default:return!1}};K=ue;const pe=ue,he=(e,t,s,r)=>{const{realm:n,root:o}=e,{expression:i}=s;for(const[s,l]of n.entries(t)){pe(e,o,l,i)&&r(l,s)}},de=(e,t,s,r)=>{switch(s.type){case"NameSelector":R(e,t,s,r);break;case"IndexSelector":_(e,t,s,r);break;case"WildcardSelector":H(e,t,s,r);break;case"SliceSelector":z(e,t,s,r);break;case"FilterSelector":he(e,t,s,r)}},me=(e,t,s,r)=>{switch(s.type){case"BracketedSelection":X(e,t,s,r);break;case"NameSelector":case"WildcardSelector":case"IndexSelector":case"SliceSelector":case"FilterSelector":de(e,t,s,r)}},ye=(e,t,s,r)=>{switch(s.type){case"ChildSegment":((e,t,s,r)=>{const{selector:n}=s;me(e,t,n,r)})(e,t,s,r);break;case"DescendantSegment":((e,t,s,r)=>{const{selector:n}=s;me(e,t,n,r)})(e,t,s,r)}};const ge=class{name="";isObject(e){throw new m("Realm.isObject(value) must be implemented in a subclass")}isArray(e){throw new m("Realm.isArray(value) must be implemented in a subclass")}isString(e){throw new m("Realm.isString(value) must be implemented in a subclass")}isNumber(e){throw new m("Realm.isNumber(value) must be implemented in a subclass")}isBoolean(e){throw new m("Realm.isBoolean(value) must be implemented in a subclass")}isNull(e){throw new m("Realm.isNull(value) must be implemented in a subclass")}getString(e){throw new m("Realm.getString(value) must be implemented in a subclass")}getProperty(e,t){throw new m("Realm.getProperty(value, key) must be implemented in a subclass")}hasProperty(e,t){throw new m("Realm.hasProperty(value, key) must be implemented in a subclass")}getElement(e,t){throw new m("Realm.getElement(value, index) must be implemented in a subclass")}getKeys(e){throw new m("Realm.getKeys(value) must be implemented in a subclass")}getLength(e){throw new m("Realm.getLength(value) must be implemented in a subclass")}*entries(e){throw new m("Realm.entries(value) must be implemented in a subclass")}compare(e,t,s){throw new m("Realm.compare(left, operator, right) must be implemented in a subclass")}};const fe=class extends ge{name="json";isObject(e){return se(e)}isArray(e){return te(e)}isString(e){return re(e)}isNumber(e){return ne(e)}isBoolean(e){return oe(e)}isNull(e){return ie(e)}getString(e){return re(e)?e:void 0}getProperty(e,t){if(se(e))return Object.hasOwn(e,t)?e[t]:void 0}hasProperty(e,t){return!!se(e)&&Object.hasOwn(e,t)}getElement(e,t){if(te(e)&&!(t<0||t>=e.length))return e[t]}getKeys(e){return se(e)?Object.keys(e):[]}getLength(e){return re(e)?[...e].length:te(e)?e.length:se(e)?Object.keys(e).length:0}*entries(e){if(this.isArray(e))for(let t=0;t<e.length;t+=1)yield[t,e[t]];else if(this.isObject(e))for(const t of Object.keys(e))yield[t,e[t]]}#e(e,t){if(e===t)return!0;if(le(e)&&le(t))return!0;if(le(e)||le(t))return!1;if(ie(e)&&ie(t))return!0;if(ie(e)||ie(t))return!1;if(typeof e!=typeof t)return!1;if(te(e)&&te(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(!this.#e(e[s],t[s]))return!1;return!0}if(se(e)&&se(t)){const s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(const r of s){if(!Object.hasOwn(t,r))return!1;if(!this.#e(e[r],t[r]))return!1}return!0}return!1}compare(e,t,s){switch(t){case"==":return this.#e(e,s);case"!=":return!this.#e(e,s);case"<":return!le(e)&&!le(s)&&((ne(e)&&ne(s)||!(!re(e)||!re(s)))&&e<s);case"<=":return!le(e)&&!le(s)&&(ne(e)&&ne(s)||re(e)&&re(s)?e<=s:this.#e(e,s));case">":return!le(e)&&!le(s)&&((ne(e)&&ne(s)||!(!re(e)||!re(s)))&&e>s);case">=":return!le(e)&&!le(s)&&(ne(e)&&ne(s)||re(e)&&re(s)?e>=s:this.#e(e,s));default:return!1}}};const xe=class extends m{},be=(e,t)=>{const s=ae(t);if(le(s))return;const r=e.getLength(s);return r>0||e.isString(s)||e.isArray(s)||e.isObject(s)?r:void 0},we=(e,t)=>{if(ce(t))return t.length},ke=(e,t)=>{if(ce(t)&&1===t.length)return t[0]},Te=new Map,Ee=(e,t=!1)=>{const s=t?`anchored:${e}`:`unanchored:${e}`;if(Te.has(s))return Te.get(s);const r=(e=>{let t="",s=!1,r=0;for(;r<e.length;){const n=e[r];if("\\"===n&&r+1<e.length){const o=e[r+1];if(o>="1"&&o<="9")return null;if(!s&&("b"===o||"B"===o))return null;t+=n+o,r+=2;continue}if("["!==n||s)if("]"===n&&s)s=!1,t+=n,r+=1;else{if("("===n&&r+2<e.length&&"?"===e[r+1]){const t=e[r+2];if("="===t||"!"===t)return null;if("<"===t&&r+3<e.length){const t=e[r+3];if("="===t||"!"===t)return null;if(/[a-zA-Z]/.test(t))return null}}"."!==n||s?(t+=n,r+=1):(t+="[^\\n\\r]",r+=1)}else s=!0,t+=n,r+=1}return t})(e);if(null===r)return Te.set(s,null),null;try{const e=t?`^(?:${r})$`:r,n=new RegExp(e,"u");return Te.set(s,n),n}catch{return Te.set(s,null),null}},Se=(e,t,s)=>{const r=ae(t),n=ae(s),o=e.getString(r),i=e.getString(n);if(void 0===o||void 0===i)return!1;const l=Ee(i,!0);return null!==l&&l.test(o)},Ae=(e,t,s)=>{const r=ae(t),n=ae(s),o=e.getString(r),i=e.getString(n);if(void 0===o||void 0===i)return!1;const l=Ee(i,!1);return null!==l&&l.test(o)},Ie=(e,t,{callback:s,realm:n=new fe,functions:o=r}={})=>{const i=N(t);if(!i.result.success)throw new xe(`Invalid JSONPath expression: ${t}`,{expression:t});try{const t=i.tree,{segments:r}=t,l=[];if(0===r.length)return l.push(e),"function"==typeof s&&s(e,"$"),l;const c={realm:n,root:e,functions:o},a=[];for(a.push({value:e,path:[],segmentIndex:0});a.length>0;){const e=a.pop(),{value:t,path:o,segmentIndex:i}=e;if(i>=r.length){const e=$(o);l.push(t),"function"==typeof s&&s(t,e);continue}const u=r[i],p=[];if(ye(c,t,u,(e,t)=>{p.push({value:e,pathSegment:t})}),"DescendantSegment"===u.type){const e=[];for(const[s,r]of n.entries(t))e.push({value:r,pathSegment:s});for(let t=e.length-1;t>=0;t-=1){const{value:s,pathSegment:r}=e[t];a.push({value:s,path:[...o,r],segmentIndex:i})}}for(let e=p.length-1;e>=0;e-=1){const{value:t,pathSegment:s}=p[e];a.push({value:t,path:[...o,s],segmentIndex:i+1})}}return l}catch(e){throw new xe("Unexpected error during JSONPath evaluation",{cause:e,expression:t})}};function Oe(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function ve(e){return function t(s){return 0===arguments.length||Oe(s)?t:e.apply(this,arguments)}}function Ce(e){return function t(s,r){switch(arguments.length){case 0:return t;case 1:return Oe(s)?t:ve(function(t){return e(s,t)});default:return Oe(s)&&Oe(r)?t:Oe(s)?ve(function(t){return e(t,r)}):Oe(r)?ve(function(t){return e(s,t)}):e(s,r)}}}function Me(e){for(var t,s=[];!(t=e.next()).done;)s.push(t.value);return s}function qe(e,t,s){for(var r=0,n=s.length;r<n;){if(e(t,s[r]))return!0;r+=1}return!1}function Ne(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const Le="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var De=Object.prototype.toString;const Fe=function(){return"[object Arguments]"===De.call(arguments)?function(e){return"[object Arguments]"===De.call(e)}:function(e){return Ne("callee",e)}}();var Be=!{toString:null}.propertyIsEnumerable("toString"),Pe=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],$e=function(){return arguments.propertyIsEnumerable("length")}(),je=function(e,t){for(var s=0;s<e.length;){if(e[s]===t)return!0;s+=1}return!1};const Re="function"!=typeof Object.keys||$e?ve(function(e){if(Object(e)!==e)return[];var t,s,r=[],n=$e&&Fe(e);for(t in e)!Ne(t,e)||n&&"length"===t||(r[r.length]=t);if(Be)for(s=Pe.length-1;s>=0;)Ne(t=Pe[s],e)&&!je(r,t)&&(r[r.length]=t),s-=1;return r}):ve(function(e){return Object(e)!==e?[]:Object.keys(e)});const _e=ve(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function He(e,t,s,r){var n=Me(e);function o(e,t){return Ue(e,t,s.slice(),r.slice())}return!qe(function(e,t){return!qe(o,t,e)},Me(t),n)}function Ue(e,t,s,r){if(Le(e,t))return!0;var n=_e(e);if(n!==_e(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(n){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!Le(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!Le(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var o=s.length-1;o>=0;){if(s[o]===e)return r[o]===t;o-=1}switch(n){case"Map":return e.size===t.size&&He(e.entries(),t.entries(),s.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&He(e.values(),t.values(),s.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var i=Re(e);if(i.length!==Re(t).length)return!1;var l=s.concat([e]),c=r.concat([t]);for(o=i.length-1;o>=0;){var a=i[o];if(!Ne(a,t)||!Ue(t[a],e[a],l,c))return!1;o-=1}return!0}const ze=Ce(function(e,t){return Ue(e,t,[],[])});const Ve=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class Ge{elements;constructor(e){this.elements=e??[]}toValue(){return this.elements.map(e=>({key:e.key?.toValue(),value:e.value?.toValue()}))}map(e,t){return this.elements.map(s=>{const r=s.value,n=s.key;if(void 0===r||void 0===n)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,r,n,s):e(r,n,s)})}filter(e,t){const s=this.elements.filter(s=>{const r=s.value,n=s.key;return void 0!==r&&void 0!==n&&(void 0!==t?e.call(t,r,n,s):e(r,n,s))});return new Ge(s)}reject(e,t){const s=[];for(const r of this.elements){const n=r.value,o=r.key;void 0!==n&&void 0!==o&&(e.call(t,n,o,r)||s.push(r))}return new Ge(s)}forEach(e,t){this.elements.forEach((s,r)=>{const n=s.value,o=s.key;void 0!==n&&void 0!==o&&(void 0!==t?e.call(t,n,o,s,r):e(n,o,s,r))})}find(e,t){return this.elements.find(s=>{const r=s.value,n=s.key;return void 0!==r&&void 0!==n&&(void 0!==t?e.call(t,r,n,s):e(r,n,s))})}keys(){return this.elements.map(e=>e.key?.toValue()).filter(e=>void 0!==e)}values(){return this.elements.map(e=>e.value?.toValue()).filter(e=>void 0!==e)}get length(){return this.elements.length}get isEmpty(){return 0===this.length}get first(){return this.elements[0]}get(e){return this.elements[e]}push(e){return this.elements.push(e),this}includesKey(e){return this.elements.some(t=>t.key?.equals(e))}[Symbol.iterator](){return this.elements[Symbol.iterator]()}}const Xe=Ge;class Qe{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(e,t,s){void 0!==t&&(this.meta=t),void 0!==s&&(this.attributes=s),void 0!==e&&(this.content=e)}get element(){return this._storedElement}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof Qe)this._content=e;else if(null!=e&&"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e&&"symbol"!=typeof e)if(e instanceof Ve)this._content=e;else if(e instanceof Xe)this._content=e.elements;else if(Array.isArray(e))this._content=e.map(e=>this.refract(e));else{if("object"!=typeof e)throw new Error("Cannot set content to value of type "+typeof e);this._content=Object.entries(e).map(([e,t])=>new this.MemberElement(e,t))}else this._content=e}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof Qe?this._meta=e:this.meta.set(e??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof Qe?this._attributes=e:this.attributes.set(e??{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get children(){const{_content:e}=this;if(Array.isArray(e))return e;if(e instanceof Ve){const t=[];return e.key&&t.push(e.key),e.value&&t.push(e.value),t}return e instanceof Qe?[e]:[]}get isFrozen(){return Object.isFrozen(this)}freeze(){if(!this.isFrozen){this._meta&&(this._meta.parent=this,this._meta.freeze()),this._attributes&&(this._attributes.parent=this,this._attributes.freeze());for(const e of this.children)e.parent=this,e.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:e}=this;return e instanceof Qe||e instanceof Ve?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){const t=e instanceof Qe?e.toValue():e;return ze(this.toValue(),t)}primitive(){}set(e){return this.content=e,this}toRef(e){const t=this.id.toValue();if(""===t)throw new Error("Cannot create reference to an element without an ID");const s=new this.RefElement(t);return"string"==typeof e&&(s.path=this.refract(e)),s}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}hasMetaProperty(e){return!this.isMetaEmpty&&this.meta.hasKey(e)}get isMetaEmpty(){return void 0===this._meta||this.meta.isEmpty}getAttributesProperty(e,t){if(!this.hasAttributesProperty(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.attributes.set(e,t)}return this.attributes.get(e)}setAttributesProperty(e,t){this.attributes.set(e,t)}hasAttributesProperty(e){return!this.isAttributesEmpty&&this.attributes.hasKey(e)}get isAttributesEmpty(){return void 0===this._attributes||this.attributes.isEmpty}}const Ye=Qe;const Je=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="string"}primitive(){return"string"}get length(){return this.content?.length??0}};const Ke=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="number"}primitive(){return"number"}};const We=class extends Ye{constructor(e,t,s){super(e??null,t,s),this.element="null"}primitive(){return"null"}set(e){throw new Error("Cannot set the value of null")}};const Ze=class extends Ye{constructor(e,t,s){super(e,t,s),this.element="boolean"}primitive(){return"boolean"}};class et extends Ye{constructor(e,t,s){super(e||[],t,s)}get length(){return this._content.length}get isEmpty(){return 0===this.length}get first(){return this._content[0]}get second(){return this._content[1]}get last(){return this._content.at(-1)}push(...e){for(const t of e)this._content.push(this.refract(t));return this}shift(){return this._content.shift()}unshift(e){this._content.unshift(this.refract(e))}includes(e){return this._content.some(t=>t.equals(e))}findElements(e,t){const s=t||{},r=!!s.recursive,n=void 0===s.results?[]:s.results;for(let t=0;t<this._content.length;t+=1){const s=this._content[t],o=s;r&&"function"==typeof o.findElements&&o.findElements(e,{results:n,recursive:r}),e(s,t,void 0)&&n.push(s)}return n}find(e){const t=this.findElements(e,{recursive:!0});return new this.ArrayElement(t)}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>{const s=t.classes;return"function"==typeof s.includes&&s.includes(e)})}getById(e){return this.find(t=>t.id.toValue()===e).first}concat(e){return new(0,this.constructor)(this._content.concat(e._content))}[Symbol.iterator](){return this._content[Symbol.iterator]()}}const tt=et;const st=class extends tt{constructor(e,t,s){super(e||[],t,s),this.element="array"}primitive(){return"array"}get(e){return this._content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}set(e,t){return"number"==typeof e&&void 0!==t?this._content[e]=this.refract(t):this.content=e,this}remove(e){return this._content.splice(e,1)[0]??null}map(e,t){return this._content.map(e,t)}flatMap(e,t){return this._content.flatMap(e,t)}compactMap(e,t){const s=[];for(const r of this._content){const n=e.call(t,r);n&&s.push(n)}return s}filter(e,t){const s=this._content.filter(e,t);return new this.constructor(s)}reject(e,t){const s=[];for(const r of this._content)e.call(t,r)||s.push(r);return new this.constructor(s)}reduce(e,t){let s,r;void 0!==t?(s=0,r=this.refract(t)):(s=1,r=this.first);for(let t=s;t<this.length;t+=1){const s=e(r,this._content[t],t,this);r=void 0===s?s:this.refract(s)}return r}forEach(e,t){this._content.forEach((s,r)=>{e.call(t,s,r)})}empty(){return new this.constructor([])}};const rt=class extends Ye{constructor(e,t,s,r){super(new Ve,s,r),this.element="member",void 0!==e&&(this.key=e),arguments.length>=2&&(this.value=t)}primitive(){return"member"}get key(){return this._content.key}set key(e){this._content.key=this.refract(e)}get value(){return this._content.value}set value(e){this._content.value=void 0===e?void 0:this.refract(e)}};const nt=class extends tt{constructor(e,t,s){super(e||[],t,s),this.element="object"}primitive(){return"object"}toValue(){return this._content.reduce((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e),{})}get(e){const t=this.getMember(e);if(t)return t.value}getValue(e){const t=this.get(e);if(t)return t.toValue()}getMember(e){if(void 0!==e)return this._content.find(t=>t.key.toValue()===e)}remove(e){let t=null;return this.content=this._content.filter(s=>s.key.toValue()!==e||(t=s,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if("string"==typeof e){const s=this.getMember(e);s?s.value=t:this._content.push(new rt(e,t))}else if("object"==typeof e&&!Array.isArray(e))for(const t of Object.keys(e))this.set(t,e[t]);return this}keys(){return this._content.map(e=>e.key.toValue())}values(){return this._content.map(e=>e.value.toValue())}hasKey(e){return this._content.some(t=>t.key.equals(e))}items(){return this._content.map(e=>[e.key.toValue(),e.value.toValue()])}map(e,t){return this._content.map(s=>e.call(t,s.value,s.key,s))}compactMap(e,t){const s=[];return this.forEach((r,n,o)=>{const i=e.call(t,r,n,o);i&&s.push(i)}),s}filter(e,t){return new Xe(this._content).filter(e,t)}reject(e,t){const s=[];for(const r of this._content)e.call(t,r.value,r.key,r)||s.push(r);return new Xe(s)}forEach(e,t){this._content.forEach(s=>e.call(t,s.value,s.key,s))}reduce(e,t){let s,r;void 0!==t?(s=0,r=this.refract(t)):(s=1,r=this._content[0]?.value);for(let t=s;t<this._content.length;t+=1){const s=this._content[t],n=e(r,s.value,s.key,s,this);r=void 0===n?n:this.refract(n)}return r}empty(){return new this.constructor([])}},ot=e=>e instanceof Je,it=e=>e instanceof Ke,lt=e=>e instanceof We,ct=e=>e instanceof Ze,at=e=>e instanceof st,ut=e=>e instanceof nt;const pt=class extends Ye{constructor(e,t,s){super(e||[],t,s),this.element="ref",this.path||(this.path="element")}get path(){if(this.hasAttributesProperty("path"))return this.attributes.get("path")}set path(e){this.attributes.set("path",e)}};function ht(e){return void 0===e?new We:dt(e)}function dt(e){if(e instanceof Ye)return e;if("string"==typeof e)return new Je(e);if("number"==typeof e)return new Ke(e);if("boolean"==typeof e)return new Ze(e);if(null===e)return new We;if(Array.isArray(e))return new st(e.map(ht));if("object"==typeof e)return new nt(e);throw new Error("Cannot refract value of type "+typeof e)}Ye.prototype.ObjectElement=nt,Ye.prototype.ArrayElement=st,Ye.prototype.RefElement=pt,Ye.prototype.MemberElement=rt,Ye.prototype.refract=dt;const mt=class extends ge{name="apidom";isObject(e){return ut(e)}isArray(e){return at(e)}isString(e){return ot(e)}isNumber(e){return it(e)}isBoolean(e){return ct(e)}isNull(e){return lt(e)}getString(e){return ot(e)?e.toValue():"string"==typeof e?e:void 0}getProperty(e,t){if(ut(e)&&e.hasKey(t))return e.get(t)}hasProperty(e,t){return!!ut(e)&&e.hasKey(t)}getElement(e,t){if(at(e)&&!(t<0||t>=e.length))return e.get(t)}getKeys(e){return ut(e)?e.keys():[]}getLength(e){return ot(e)?[...e.toValue()].length:at(e)||ut(e)?e.length:"string"==typeof e?[...e].length:Array.isArray(e)?e.length:0}*entries(e){if(at(e)){let t=0;for(const s of e)yield[t,s],t+=1}else if(ut(e))for(const t of e)yield[t.key.toValue(),t.value]}compare(e,t,s){if(void 0===e||void 0===s)return"=="===t?void 0===e&&void 0===s:"!="===t&&!(void 0===e&&void 0===s);const r=it(e)||"number"==typeof e,n=it(s)||"number"==typeof s;if(r&&n){const r=it(e)?e.toValue():e,n=it(s)?s.toValue():s,o=Object.is(r,-0)?0:r,i=Object.is(n,-0)?0:n;switch(t){case"==":return o===i;case"!=":return o!==i;case"<":return o<i;case">":return o>i;case"<=":return o<=i;case">=":return o>=i;default:return!1}}const o=ot(e)||"string"==typeof e,i=ot(s)||"string"==typeof s;if(o&&i){const r=ot(e)?e.toValue():e,n=ot(s)?s.toValue():s;switch(t){case"==":return r===n;case"!=":return r!==n;case"<":return r<n;case">":return r>n;case"<=":return r<=n;case">=":return r>=n;default:return!1}}return"=="===t?dt(e).equals(s):"!="===t&&!dt(e).equals(s)}},yt=new mt,gt=(e,t,s={})=>Ie(e,t,{...s,realm:yt});return t})());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclynx/apidom-json-path",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "description": "Evaluate JSONPath expressions against ApiDOM.",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -39,11 +39,9 @@
39
39
  "license": "Apache-2.0",
40
40
  "dependencies": {
41
41
  "@babel/runtime-corejs3": "^7.28.4",
42
- "@speclynx/apidom-core": "^2.0.1",
43
- "@speclynx/apidom-datamodel": "^2.0.1",
44
- "@speclynx/apidom-error": "^2.0.1",
45
- "@speclynx/apidom-json-pointer": "^2.0.1",
46
- "jsonpath-plus": "^10.3.0"
42
+ "@speclynx/apidom-datamodel": "^2.2.0",
43
+ "@speclynx/apidom-error": "^2.2.0",
44
+ "@swaggerexpert/jsonpath": "^4.0.1"
47
45
  },
48
46
  "files": [
49
47
  "src/**/*.mjs",
@@ -55,5 +53,5 @@
55
53
  "README.md",
56
54
  "CHANGELOG.md"
57
55
  ],
58
- "gitHead": "6a9caf87f445f76ffd69afa760990ffa784bc82d"
56
+ "gitHead": "a3bfd57f83437ee123f2ef3175aedf30dd860b67"
59
57
  }
package/src/index.cjs CHANGED
@@ -2,12 +2,60 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
4
  exports.__esModule = true;
5
- exports.evaluateMulti = exports.evaluate = exports.MultiEvaluationJsonPathError = exports.EvaluationJsonPathError = void 0;
6
- var _EvaluationJsonPathError = _interopRequireDefault(require("./errors/EvaluationJsonPathError.cjs"));
7
- exports.EvaluationJsonPathError = _EvaluationJsonPathError.default;
8
- var _MultiEvaluationJsonPathError = _interopRequireDefault(require("./errors/MultiEvaluationJsonPathError.cjs"));
9
- exports.MultiEvaluationJsonPathError = _MultiEvaluationJsonPathError.default;
10
- var _evaluate = _interopRequireDefault(require("./evaluate.cjs"));
11
- exports.evaluate = _evaluate.default;
12
- var _evaluateMulti = _interopRequireDefault(require("./evaluate-multi.cjs"));
13
- exports.evaluateMulti = _evaluateMulti.default;
5
+ exports.test = exports.parse = exports.functions = exports.evaluate = exports.XMLTranslator = exports.NormalizedPath = exports.JSONPathParseError = exports.JSONPathEvaluateError = exports.JSONPathError = exports.JSONNormalizedPathError = exports.JSONEvaluationRealm = exports.Grammar = exports.EvaluationRealm = exports.CSTTranslator = exports.CSTOptimizedTranslator = exports.ASTTranslator = void 0;
6
+ var _jsonpath = require("@swaggerexpert/jsonpath");
7
+ exports.parse = _jsonpath.parse;
8
+ exports.CSTTranslator = _jsonpath.CSTTranslator;
9
+ exports.CSTOptimizedTranslator = _jsonpath.CSTOptimizedTranslator;
10
+ exports.ASTTranslator = _jsonpath.ASTTranslator;
11
+ exports.XMLTranslator = _jsonpath.XMLTranslator;
12
+ exports.test = _jsonpath.test;
13
+ exports.NormalizedPath = _jsonpath.NormalizedPath;
14
+ exports.functions = _jsonpath.functions;
15
+ exports.EvaluationRealm = _jsonpath.EvaluationRealm;
16
+ exports.JSONEvaluationRealm = _jsonpath.JSONEvaluationRealm;
17
+ exports.Grammar = _jsonpath.Grammar;
18
+ exports.JSONPathError = _jsonpath.JSONPathError;
19
+ exports.JSONPathParseError = _jsonpath.JSONPathParseError;
20
+ exports.JSONNormalizedPathError = _jsonpath.JSONNormalizedPathError;
21
+ exports.JSONPathEvaluateError = _jsonpath.JSONPathEvaluateError;
22
+ var _realm = _interopRequireDefault(require("./realm.cjs"));
23
+ exports.ApiDOMEvaluationRealm = _realm.default;
24
+ const realm = new _realm.default();
25
+
26
+ /**
27
+ * Options for ApiDOM JSONPath evaluation.
28
+ * @public
29
+ */
30
+
31
+ /**
32
+ * Evaluate a JSONPath expression against an ApiDOM element.
33
+ *
34
+ * @param value - ApiDOM element to query
35
+ * @param expression - JSONPath expression
36
+ * @param options - Evaluation options
37
+ * @returns Array of matched values
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * import { ObjectElement } from '@speclynx/apidom-datamodel';
42
+ * import { evaluate } from '@speclynx/apidom-json-path';
43
+ *
44
+ * const element = new ObjectElement({ a: { b: [1, 2, 3] } });
45
+ * const results = evaluate(element, '$.a.b[*]');
46
+ * // => [NumberElement(1), NumberElement(2), NumberElement(3)]
47
+ * ```
48
+ *
49
+ * @public
50
+ */
51
+ const evaluate = (value, expression, options = {}) => {
52
+ return (0, _jsonpath.evaluate)(value, expression, {
53
+ ...options,
54
+ realm
55
+ });
56
+ };
57
+
58
+ /**
59
+ * Re-export all types
60
+ */
61
+ exports.evaluate = evaluate;