@speclynx/apidom-traverse 1.12.2 → 2.1.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.
- package/CHANGELOG.md +29 -0
- package/LICENSE +202 -0
- package/dist/apidom-traverse.browser.js +6698 -88
- package/dist/apidom-traverse.browser.min.js +1 -1
- package/package.json +8 -5
- package/src/Path.cjs +39 -0
- package/src/Path.mjs +40 -0
- package/types/apidom-traverse.d.ts +22 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apidomTraverse=e():t.apidomTraverse=e()}(self,()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Path:()=>n,cloneNode:()=>ye,filter:()=>Oe,find:()=>Ee,findAtOffset:()=>Ce,forEach:()=>Me,getNodeKeys:()=>ve,getNodePrimitiveType:()=>pe,getNodeType:()=>he,getVisitFn:()=>be,isNode:()=>de,mergeVisitors:()=>we,mergeVisitorsAsync:()=>ke,mutateNode:()=>me,parents:()=>Fe,reject:()=>Pe,some:()=>xe,traverse:()=>Se,traverseAsync:()=>Ae});class n{node;key;index;parent;parentPath;inList;#t=!1;#e=!1;#n=!1;#r=!1;#o;#s=!1;constructor(t,e,n,r,o){this.node=t,this.parent=e,this.parentPath=n,this.key=r,this.index=o&&"number"==typeof r?r:void 0,this.inList=o}get shouldSkip(){return this.#t}get shouldStop(){return this.#e}get removed(){return this.#n}isRoot(){return null===this.parentPath}get depth(){let t=0,e=this.parentPath;for(;null!==e;)t+=1,e=e.parentPath;return t}getAncestry(){const t=[];let e=this.parentPath;for(;null!==e;)t.push(e),e=e.parentPath;return t}getAncestorNodes(){return this.getAncestry().map(t=>t.node)}getPathKeys(){const t=[];let e=this;for(;null!==e&&void 0!==e.key;)t.unshift(e.key),e=e.parentPath;return t}findParent(t){let e=this.parentPath;for(;null!==e;){if(t(e))return e;e=e.parentPath}return null}find(t){return t(this)?this:this.findParent(t)}skip(){this.#t=!0}stop(){this.#e=!0}replaceWith(t){this.#s&&console.warn("Warning: replaceWith() called on a stale Path. This path belongs to a node whose visit has already completed. The replacement will have no effect. To replace a parent node, do so from the parent's own visitor."),this.#r=!0,this.#o=t,this.node=t}remove(){this.#s&&console.warn("Warning: remove() called on a stale Path. This path belongs to a node whose visit has already completed. The removal will have no effect. To remove a parent node, do so from the parent's own visitor."),this.#n=!0}_getReplacementNode(){return this.#o}_wasReplaced(){return this.#r}_reset(){this.#t=!1,this.#e=!1,this.#n=!1,this.#r=!1,this.#o=void 0}_markStale(){this.#s=!0}}class r extends AggregateError{constructor(t,e,n){super(t,e,n),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const o=r;class s extends Error{static[Symbol.hasInstance](t){return super[Symbol.hasInstance](t)||Function.prototype[Symbol.hasInstance].call(o,t)}constructor(t,e){super(t,e),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const i=s;const c=class extends i{constructor(t,e){if(super(t,e),null!=e&&"object"==typeof e){const{cause:t,...n}=e;Object.assign(this,n)}}};function u(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,n){return e.apply(this,arguments)};case 3:return function(t,n,r){return e.apply(this,arguments)};case 4:return function(t,n,r,o){return e.apply(this,arguments)};case 5:return function(t,n,r,o,s){return e.apply(this,arguments)};case 6:return function(t,n,r,o,s,i){return e.apply(this,arguments)};case 7:return function(t,n,r,o,s,i,c){return e.apply(this,arguments)};case 8:return function(t,n,r,o,s,i,c,u){return e.apply(this,arguments)};case 9:return function(t,n,r,o,s,i,c,u,a){return e.apply(this,arguments)};case 10:return function(t,n,r,o,s,i,c,u,a,l){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function a(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function l(t){return function e(n){return 0===arguments.length||a(n)?e:t.apply(this,arguments)}}function f(t){return function e(n,r){switch(arguments.length){case 0:return e;case 1:return a(n)?e:l(function(e){return t(n,e)});default:return a(n)&&a(r)?e:a(n)?l(function(e){return t(e,r)}):a(r)?l(function(e){return t(n,e)}):t(n,r)}}}function h(t,e,n){return function(){for(var r=[],o=0,s=t,i=0,c=!1;i<e.length||o<arguments.length;){var l;i<e.length&&(!a(e[i])||o>=arguments.length)?l=e[i]:(l=arguments[o],o+=1),r[i]=l,a(l)?c=!0:s-=1,i+=1}return!c&&s<=0?n.apply(this,r):u(Math.max(0,s),h(t,r,n))}}const p=f(function(t,e){return 1===t?l(e):u(t,h(t,[],e))});function d(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object AsyncGeneratorFunction]"===e}const y=f(function(t,e){return t&&e});function m(t,e,n){for(var r=0,o=n.length;r<o;)e=t(e,n[r]),r+=1;return e}const v=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)};const g=l(function(t){return!!v(t)||!!t&&("object"==typeof t&&(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)&&(0===t.length||t.length>0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))});var b="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function w(t,e,n){return function(r,o,s){if(g(s))return t(r,o,s);if(null==s)return o;if("function"==typeof s["fantasy-land/reduce"])return e(r,o,s,"fantasy-land/reduce");if(null!=s[b])return n(r,o,s[b]());if("function"==typeof s.next)return n(r,o,s);if("function"==typeof s.reduce)return e(r,o,s,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function k(t,e,n){for(var r=n.next();!r.done;)e=t(e,r.value),r=n.next();return e}function _(t,e,n,r){return n[r](t,e)}const j=w(m,_,k);function S(t,e,n){return function(){if(0===arguments.length)return n();var r=arguments[arguments.length-1];if(!v(r)){for(var o=0;o<t.length;){if("function"==typeof r[t[o]])return r[t[o]].apply(r,Array.prototype.slice.call(arguments,0,-1));o+=1}if(function(t){return null!=t&&"function"==typeof t["@@transducer/step"]}(r))return e.apply(null,Array.prototype.slice.call(arguments,0,-1))(r)}return n.apply(this,arguments)}}function A(t,e){for(var n=0,r=e.length,o=Array(r);n<r;)o[n]=t(e[n]),n+=1;return o}const O=function(){return this.xf["@@transducer/init"]()},E=function(t){return this.xf["@@transducer/result"](t)};var x=function(){function t(t,e){this.xf=e,this.f=t}return t.prototype["@@transducer/init"]=O,t.prototype["@@transducer/result"]=E,t.prototype["@@transducer/step"]=function(t,e){return this.xf["@@transducer/step"](t,this.f(e))},t}();const P=function(t){return function(e){return new x(t,e)}};function M(t,e){return Object.prototype.hasOwnProperty.call(e,t)}var F=Object.prototype.toString;const C=function(){return"[object Arguments]"===F.call(arguments)?function(t){return"[object Arguments]"===F.call(t)}:function(t){return M("callee",t)}}();var T=!{toString:null}.propertyIsEnumerable("toString"),V=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],N=function(){return arguments.propertyIsEnumerable("length")}(),z=function(t,e){for(var n=0;n<t.length;){if(t[n]===e)return!0;n+=1}return!1},L="function"!=typeof Object.keys||N?l(function(t){if(Object(t)!==t)return[];var e,n,r=[],o=N&&C(t);for(e in t)!M(e,t)||o&&"length"===e||(r[r.length]=e);if(T)for(n=V.length-1;n>=0;)M(e=V[n],t)&&!z(r,e)&&(r[r.length]=e),n-=1;return r}):l(function(t){return Object(t)!==t?[]:Object.keys(t)});const W=L;const R=f(S(["fantasy-land/map","map"],P,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return p(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return m(function(n,r){return n[r]=t(e[r]),n},{},W(e));default:return A(t,e)}}));const q=f(function(t,e){return"function"==typeof e["fantasy-land/ap"]?e["fantasy-land/ap"](t):"function"==typeof t.ap?t.ap(e):"function"==typeof t?function(n){return t(n)(e(n))}:j(function(t,n){return function(t,e){var n;e=e||[];var r=(t=t||[]).length,o=e.length,s=[];for(n=0;n<r;)s[s.length]=t[n],n+=1;for(n=0;n<o;)s[s.length]=e[n],n+=1;return s}(t,R(n,e))},[],t)});const I=f(function(t,e){var n=p(t,e);return p(t,function(){return m(q,R(n,arguments[0]),Array.prototype.slice.call(arguments,1))})});const U=l(function(t){return I(t.length,t)});const G=f(function(t,e){return d(t)?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:U(y)(t,e)});function B(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function D(t){return function e(n,r,o){switch(arguments.length){case 0:return e;case 1:return a(n)?e:f(function(e,r){return t(n,e,r)});case 2:return a(n)&&a(r)?e:a(n)?f(function(e,n){return t(e,r,n)}):a(r)?f(function(e,r){return t(n,e,r)}):l(function(e){return t(n,r,e)});default:return a(n)&&a(r)&&a(o)?e:a(n)&&a(r)?f(function(e,n){return t(e,n,o)}):a(n)&&a(o)?f(function(e,n){return t(e,r,n)}):a(r)&&a(o)?f(function(e,r){return t(n,e,r)}):a(n)?l(function(e){return t(e,r,o)}):a(r)?l(function(e){return t(n,e,o)}):a(o)?l(function(e){return t(n,r,e)}):t(n,r,o)}}}function K(t,e,n){for(var r=0,o=n.length;r<o;){if((e=t["@@transducer/step"](e,n[r]))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r+=1}return t["@@transducer/result"](e)}const $=f(function(t,e){return u(t.length,function(){return t.apply(e,arguments)})});function H(t,e,n){for(var r=n.next();!r.done;){if((e=t["@@transducer/step"](e,r.value))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r=n.next()}return t["@@transducer/result"](e)}function Q(t,e,n,r){return t["@@transducer/result"](n[r]($(t["@@transducer/step"],t),e))}const X=w(K,Q,H);var Y=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,e){return this.f(t,e)},t}();const Z=D(function(t,e,n){return X("function"==typeof t?new Y(t):t,e,n)});function J(t,e){return function(){var n=arguments.length;if(0===n)return e();var r=arguments[n-1];return v(r)||"function"!=typeof r[t]?e.apply(this,arguments):r[t].apply(r,Array.prototype.slice.call(arguments,0,n-1))}}const tt=l(J("tail",D(J("slice",function(t,e,n){return Array.prototype.slice.call(n,t,e)}))(1,1/0)));function et(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return u(arguments[0].length,Z(B,arguments[0],tt(arguments)))}function nt(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function rt(t,e,n){for(var r=0,o=n.length;r<o;){if(t(e,n[r]))return!0;r+=1}return!1}const ot="function"==typeof Object.is?Object.is:function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};const st=l(function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)});function it(t,e,n,r){var o=nt(t);function s(t,e){return ct(t,e,n.slice(),r.slice())}return!rt(function(t,e){return!rt(s,e,t)},nt(e),o)}function ct(t,e,n,r){if(ot(t,e))return!0;var o,s,i=st(t);if(i!==st(e))return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof e["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e)&&"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof e.equals)return"function"==typeof t.equals&&t.equals(e)&&"function"==typeof e.equals&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(o=t.constructor,null==(s=String(o).match(/^function (\w*)/))?"":s[1]))return t===e;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof e||!ot(t.valueOf(),e.valueOf()))return!1;break;case"Date":if(!ot(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(t.source!==e.source||t.global!==e.global||t.ignoreCase!==e.ignoreCase||t.multiline!==e.multiline||t.sticky!==e.sticky||t.unicode!==e.unicode)return!1}for(var c=n.length-1;c>=0;){if(n[c]===t)return r[c]===e;c-=1}switch(i){case"Map":return t.size===e.size&&it(t.entries(),e.entries(),n.concat([t]),r.concat([e]));case"Set":return t.size===e.size&&it(t.values(),e.values(),n.concat([t]),r.concat([e]));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 u=W(t);if(u.length!==W(e).length)return!1;var a=n.concat([t]),l=r.concat([e]);for(c=u.length-1;c>=0;){var f=u[c];if(!M(f,e)||!ct(e[f],t[f],a,l))return!1;c-=1}return!0}const ut=f(function(t,e){return ct(t,e,[],[])});function at(t,e){return function(t,e,n){var r,o;if("function"==typeof t.indexOf)switch(typeof e){case"number":if(0===e){for(r=1/e;n<t.length;){if(0===(o=t[n])&&1/o===r)return n;n+=1}return-1}if(e!=e){for(;n<t.length;){if("number"==typeof(o=t[n])&&o!=o)return n;n+=1}return-1}return t.indexOf(e,n);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,n);case"object":if(null===e)return t.indexOf(e,n)}for(;n<t.length;){if(ut(t[n],e))return n;n+=1}return-1}(e,t,0)>=0}function lt(t){return'"'+t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var ft=function(t){return(t<10?"0":"")+t};const ht="function"==typeof Date.prototype.toISOString?function(t){return t.toISOString()}:function(t){return t.getUTCFullYear()+"-"+ft(t.getUTCMonth()+1)+"-"+ft(t.getUTCDate())+"T"+ft(t.getUTCHours())+":"+ft(t.getUTCMinutes())+":"+ft(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};var pt=function(){function t(t,e){this.xf=e,this.f=t}return t.prototype["@@transducer/init"]=O,t.prototype["@@transducer/result"]=E,t.prototype["@@transducer/step"]=function(t,e){return this.f(e)?this.xf["@@transducer/step"](t,e):t},t}();function dt(t){return function(e){return new pt(t,e)}}var yt=f(S(["fantasy-land/filter","filter"],dt,function(t,e){return n=e,"[object Object]"===Object.prototype.toString.call(n)?m(function(n,r){return t(e[r])&&(n[r]=e[r]),n},{},W(e)):function(t){return"[object Map]"===Object.prototype.toString.call(t)}(e)?function(t,e){for(var n=new Map,r=e.entries(),o=r.next();!o.done;)t(o.value[1])&&n.set(o.value[0],o.value[1]),o=r.next();return n}(t,e):function(t,e){for(var n=0,r=e.length,o=[];n<r;)t(e[n])&&(o[o.length]=e[n]),n+=1;return o}(t,e);var n}));const mt=yt;const vt=f(function(t,e){return mt((n=t,function(){return!n.apply(this,arguments)}),e);var n});function gt(t,e){var n=function(n){var r=e.concat([t]);return at(n,r)?"<Circular>":gt(n,r)},r=function(t,e){return A(function(e){return lt(e)+": "+n(t[e])},e.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+A(n,t).join(", ")+"))";case"[object Array]":return"["+A(n,t).concat(r(t,vt(function(t){return/^\d+$/.test(t)},W(t)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof t?"new Boolean("+n(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?n(NaN):lt(ht(t)))+")";case"[object Map]":return"new Map("+n(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof t?"new Number("+n(t.valueOf())+")":1/t==-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+n(Array.from(t).sort())+")";case"[object String]":return"object"==typeof t?"new String("+n(t.valueOf())+")":lt(t);case"[object Undefined]":return"undefined";default:if("function"==typeof t.toString){var o=t.toString();if("[object Object]"!==o)return o}return"{"+r(t,W(t)).join(", ")+"}"}}const bt=l(function(t){return gt(t,[])});const wt=f(function(t,e){return t||e});const kt=f(function(t,e){return d(t)?function(){return t.apply(this,arguments)||e.apply(this,arguments)}:U(wt)(t,e)});const _t=U(l(function(t){return!t}))(ut(null));const jt=f(function(t,e){if(t===e)return e;function n(t,e){if(t>e!=e>t)return e>t?e:t}var r=n(t,e);if(void 0!==r)return r;var o=n(typeof t,typeof e);if(void 0!==o)return o===typeof t?t:e;var s=bt(t),i=n(s,bt(e));return void 0!==i&&i===s?t:e}),St=Number.isInteger||function(t){return(t|0)===t};const At=f(function(t,e){var n,r;if(null!=e)return St(t)?(r=e)[(n=t)<0?r.length+n:n]:e[t]});const Ot=f(function(t,e){return R(At(t),e)});const Et=l(function(t){return p(Z(jt,0,Ot("length",t)),function(){for(var e=0,n=t.length;e<n;){if(t[e].apply(this,arguments))return!0;e+=1}return!1})});var xt=function(t,e){switch(arguments.length){case 0:return xt;case 1:return function e(n){return 0===arguments.length?e:ot(t,n)};default:return ot(t,e)}};const Pt=xt;const Mt=p(1,et(st,Pt("GeneratorFunction")));const Ft=p(1,et(st,Pt("AsyncFunction")));var Ct=Et([et(st,Pt("Function")),Mt,Ft]);function Tt(t){return Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tt(t)}var Vt=p(1,G(_t,kt(function(t){return"object"===Tt(t)},Ct)));const Nt=p(1,G(Vt,et(bt,ut("[object Promise]"))));const zt=class{key;value;constructor(t,e){this.key=t,this.value=e}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class Lt{elements;constructor(t){this.elements=t??[]}toValue(){return this.elements.map(t=>({key:t.key?.toValue(),value:t.value?.toValue()}))}map(t,e){return this.elements.map(n=>{const r=n.value,o=n.key;if(void 0===r||void 0===o)throw new Error("MemberElement must have both key and value");return void 0!==e?t.call(e,r,o,n):t(r,o,n)})}filter(t,e){const n=this.elements.filter(n=>{const r=n.value,o=n.key;return void 0!==r&&void 0!==o&&(void 0!==e?t.call(e,r,o,n):t(r,o,n))});return new Lt(n)}reject(t,e){const n=[];for(const r of this.elements){const o=r.value,s=r.key;void 0!==o&&void 0!==s&&(t.call(e,o,s,r)||n.push(r))}return new Lt(n)}forEach(t,e){this.elements.forEach((n,r)=>{const o=n.value,s=n.key;void 0!==o&&void 0!==s&&(void 0!==e?t.call(e,o,s,n,r):t(o,s,n,r))})}find(t,e){return this.elements.find(n=>{const r=n.value,o=n.key;return void 0!==r&&void 0!==o&&(void 0!==e?t.call(e,r,o,n):t(r,o,n))})}keys(){return this.elements.map(t=>t.key?.toValue()).filter(t=>void 0!==t)}values(){return this.elements.map(t=>t.value?.toValue()).filter(t=>void 0!==t)}get length(){return this.elements.length}get isEmpty(){return 0===this.length}get first(){return this.elements[0]}get(t){return this.elements[t]}push(t){return this.elements.push(t),this}includesKey(t){return this.elements.some(e=>e.key?.equals(t))}[Symbol.iterator](){return this.elements[Symbol.iterator]()}}const Wt=Lt;class Rt{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(t,e,n){void 0!==e&&(this.meta=e),void 0!==n&&(this.attributes=n),void 0!==t&&(this.content=t)}get element(){return this._storedElement}set element(t){this._storedElement=t}get content(){return this._content}set content(t){if(t instanceof Rt)this._content=t;else if(null!=t&&"string"!=typeof t&&"number"!=typeof t&&"boolean"!=typeof t&&"bigint"!=typeof t&&"symbol"!=typeof t)if(t instanceof zt)this._content=t;else if(t instanceof Wt)this._content=t.elements;else if(Array.isArray(t))this._content=t.map(t=>this.refract(t));else{if("object"!=typeof t)throw new Error("Cannot set content to value of type "+typeof t);this._content=Object.entries(t).map(([t,e])=>new this.MemberElement(t,e))}else this._content=t}get meta(){if(!this._meta){if(this.isFrozen){const t=new this.ObjectElement;return t.freeze(),t}this._meta=new this.ObjectElement}return this._meta}set meta(t){t instanceof Rt?this._meta=t:this.meta.set(t??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const t=new this.ObjectElement;return t.freeze(),t}this._attributes=new this.ObjectElement}return this._attributes}set attributes(t){t instanceof Rt?this._attributes=t:this.attributes.set(t??{})}get id(){return this.getMetaProperty("id","")}set id(t){this.setMetaProperty("id",t)}get classes(){return this.getMetaProperty("classes",[])}set classes(t){this.setMetaProperty("classes",t)}get links(){return this.getMetaProperty("links",[])}set links(t){this.setMetaProperty("links",t)}get children(){const{_content:t}=this;if(Array.isArray(t))return t;if(t instanceof zt){const e=[];return t.key&&e.push(t.key),t.value&&e.push(t.value),e}return t instanceof Rt?[t]:[]}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 t of this.children)t.parent=this,t.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:t}=this;return t instanceof Rt||t instanceof zt?t.toValue():Array.isArray(t)?t.map(t=>t.toValue()):t}equals(t){return ut(this.toValue(),t)}primitive(){}set(t){return this.content=t,this}toRef(t){const e=this.id.toValue();if(""===e)throw new Error("Cannot create reference to an element without an ID");const n=new this.RefElement(e);return"string"==typeof t&&(n.path=this.refract(t)),n}getMetaProperty(t,e){if(!this.meta.hasKey(t)){if(this.isFrozen){const t=this.refract(e);return t.freeze(),t}this.meta.set(t,e)}return this.meta.get(t)}setMetaProperty(t,e){this.meta.set(t,e)}hasMetaProperty(t){return!this.isMetaEmpty&&this.meta.hasKey(t)}get isMetaEmpty(){return void 0===this._meta||this.meta.isEmpty}getAttributesProperty(t,e){if(!this.hasAttributesProperty(t)){if(this.isFrozen){const t=this.refract(e);return t.freeze(),t}this.attributes.set(t,e)}return this.attributes.get(t)}setAttributesProperty(t,e){this.attributes.set(t,e)}hasAttributesProperty(t){return!this.isAttributesEmpty&&this.attributes.hasKey(t)}get isAttributesEmpty(){return void 0===this._attributes||this.attributes.isEmpty}}const qt=Rt;class It extends qt{constructor(t,e,n){super(t||[],e,n)}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(...t){for(const e of t)this._content.push(this.refract(e));return this}shift(){return this._content.shift()}unshift(t){this._content.unshift(this.refract(t))}includes(t){return this._content.some(e=>e.equals(t))}findElements(t,e){const n=e||{},r=!!n.recursive,o=void 0===n.results?[]:n.results;for(let e=0;e<this._content.length;e+=1){const n=this._content[e],s=n;r&&"function"==typeof s.findElements&&s.findElements(t,{results:o,recursive:r}),t(n,e,void 0)&&o.push(n)}return o}find(t){const e=this.findElements(t,{recursive:!0});return new this.ArrayElement(e)}findByElement(t){return this.find(e=>e.element===t)}findByClass(t){return this.find(e=>{const n=e.classes;return"function"==typeof n.includes&&n.includes(t)})}getById(t){return this.find(e=>e.id.toValue()===t).first}concat(t){return new(0,this.constructor)(this._content.concat(t._content))}[Symbol.iterator](){return this._content[Symbol.iterator]()}}const Ut=It;const Gt=class extends Ut{constructor(t,e,n){super(t||[],e,n),this.element="array"}primitive(){return"array"}get(t){return this._content[t]}getValue(t){const e=this.get(t);if(e)return e.toValue()}set(t,e){return"number"==typeof t&&void 0!==e?this._content[t]=this.refract(e):this.content=t,this}remove(t){return this._content.splice(t,1)[0]??null}map(t,e){return this._content.map(t,e)}flatMap(t,e){return this._content.flatMap(t,e)}compactMap(t,e){const n=[];for(const r of this._content){const o=t.call(e,r);o&&n.push(o)}return n}filter(t,e){const n=this._content.filter(t,e);return new this.constructor(n)}reject(t,e){const n=[];for(const r of this._content)t.call(e,r)||n.push(r);return new this.constructor(n)}reduce(t,e){let n,r;void 0!==e?(n=0,r=this.refract(e)):(n=1,r=this.first);for(let e=n;e<this.length;e+=1){const n=t(r,this._content[e],e,this);r=void 0===n?n:this.refract(n)}return r}forEach(t,e){this._content.forEach((n,r)=>{t.call(e,n,r)})}empty(){return new this.constructor([])}};const Bt=class extends qt{constructor(t,e,n,r){super(new zt,n,r),this.element="member",void 0!==t&&(this.key=t),arguments.length>=2&&(this.value=e)}primitive(){return"member"}get key(){return this._content.key}set key(t){this._content.key=this.refract(t)}get value(){return this._content.value}set value(t){this._content.value=void 0===t?void 0:this.refract(t)}};const Dt=class extends Ut{constructor(t,e,n){super(t||[],e,n),this.element="object"}primitive(){return"object"}toValue(){return this._content.reduce((t,e)=>(t[e.key.toValue()]=e.value?e.value.toValue():void 0,t),{})}get(t){const e=this.getMember(t);if(e)return e.value}getValue(t){const e=this.get(t);if(e)return e.toValue()}getMember(t){if(void 0!==t)return this._content.find(e=>e.key.toValue()===t)}remove(t){let e=null;return this.content=this._content.filter(n=>n.key.toValue()!==t||(e=n,!1)),e}getKey(t){const e=this.getMember(t);if(e)return e.key}set(t,e){if("string"==typeof t){const n=this.getMember(t);n?n.value=e:this._content.push(new Bt(t,e))}else if("object"==typeof t&&!Array.isArray(t))for(const e of Object.keys(t))this.set(e,t[e]);return this}keys(){return this._content.map(t=>t.key.toValue())}values(){return this._content.map(t=>t.value.toValue())}hasKey(t){return this._content.some(e=>e.key.equals(t))}items(){return this._content.map(t=>[t.key.toValue(),t.value.toValue()])}map(t,e){return this._content.map(n=>t.call(e,n.value,n.key,n))}compactMap(t,e){const n=[];return this.forEach((r,o,s)=>{const i=t.call(e,r,o,s);i&&n.push(i)}),n}filter(t,e){return new Wt(this._content).filter(t,e)}reject(t,e){const n=[];for(const r of this._content)t.call(e,r.value,r.key,r)||n.push(r);return new Wt(n)}forEach(t,e){this._content.forEach(n=>t.call(e,n.value,n.key,n))}reduce(t,e){let n,r;void 0!==e?(n=0,r=this.refract(e)):(n=1,r=this._content[0]?.value);for(let e=n;e<this._content.length;e+=1){const n=this._content[e],o=t(r,n.value,n.key,n,this);r=void 0===o?o:this.refract(o)}return r}empty(){return new this.constructor([])}},Kt=t=>t instanceof qt,$t=t=>t instanceof Gt,Ht=t=>t instanceof Dt,Qt=t=>t instanceof Bt,Xt=t=>"number"==typeof t.startLine&&"number"==typeof t.startCharacter&&"number"==typeof t.startOffset&&"number"==typeof t.endLine&&"number"==typeof t.endCharacter&&"number"==typeof t.endOffset;const Yt=class extends qt{constructor(t,e,n){super(t,e,n),this.element="string"}primitive(){return"string"}get length(){return this.content?.length??0}};class Zt extends Yt{constructor(t,e,n){super(t,e,n),this.element="sourceMap"}static transfer(t,e){e.startLine=t.startLine,e.startCharacter=t.startCharacter,e.startOffset=t.startOffset,e.endLine=t.endLine,e.endCharacter=t.endCharacter,e.endOffset=t.endOffset}static from(t){const{startLine:e,startCharacter:n,startOffset:r,endLine:o,endCharacter:s,endOffset:i}=t;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r||"number"!=typeof o||"number"!=typeof s||"number"!=typeof i)return;const c="sm1:"+[e,n,r,o,s,i].map(te).join("");const u=new Zt(c);return u.startLine=e,u.startCharacter=n,u.startOffset=r,u.endLine=o,u.endCharacter=s,u.endOffset=i,u}applyTo(t){this.content&&([t.startLine,t.startCharacter,t.startOffset,t.endLine,t.endCharacter,t.endOffset]=function(t){const e=t.startsWith("sm1:")?t.slice(4):t,n=[];let r=0;for(let t=0;t<6;t++){const t=ee(e,r);n.push(t.value),r=t.next}return n}(this.content))}}const Jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function te(t){let e=t>>>0,n="";do{let t=31&e;e>>>=5,0!==e&&(t|=32),n+=Jt[t]}while(0!==e);return n}function ee(t,e=0){let n=0,r=0,o=e;for(;;){const e=t[o++],s=Jt.indexOf(e);if(-1===s)throw new Error(`Invalid Base64 VLQ char: ${e}`);if(n|=(31&s)<<r,r+=5,!!!(32&s))break}return{value:n>>>0,next:o}}const ne=Zt;const re=class extends c{value;constructor(t,e){super(t,e),void 0!==e&&(this.value=e.value)}};const oe=class extends re{};const se=class extends re{},ie=(t,e)=>{const{visited:n=new WeakMap}=e,r={...e,visited:n};if(n.has(t))return n.get(t);const o=le(t);n.set(t,o);const{content:s}=t;return Array.isArray(s)?o.content=s.map(t=>ie(t,r)):Kt(s)?o.content=ie(s,r):o.content=s instanceof zt?ce(s,r):s,o},ce=(t,e)=>{const{visited:n=new WeakMap}=e,r={...e,visited:n};if(n.has(t))return n.get(t);const{key:o,value:s}=t,i=void 0!==o?ie(o,r):void 0,c=void 0!==s?ie(s,r):void 0,u=new zt(i,c);return n.set(t,u),u},ue=(t,e={})=>{if(t instanceof zt)return ce(t,e);if(t instanceof Wt)return((t,e)=>{const{visited:n=new WeakMap}=e,r={...e,visited:n};if(n.has(t))return n.get(t);const o=[...t].map(t=>ie(t,r)),s=new Wt(o);return n.set(t,s),s})(t,e);if(Kt(t))return ie(t,e);throw new oe("Value provided to cloneDeep function couldn't be cloned",{value:t})};ue.safe=t=>{try{return ue(t)}catch{return t}};const ae=t=>{const{key:e,value:n}=t;return new zt(e,n)},le=t=>{const e=new(0,t.constructor);e.element=t.element,t.isMetaEmpty||(e.meta=ue(t.meta)),t.isAttributesEmpty||(e.attributes=ue(t.attributes)),Xt(t)&&ne.transfer(t,e);const{content:n}=t;return Kt(n)?e.content=le(n):Array.isArray(n)?e.content=[...n]:e.content=n instanceof zt?ae(n):n,e},fe=t=>{if(t instanceof zt)return ae(t);if(t instanceof Wt)return(t=>{const e=[...t];return new Wt(e)})(t);if(Kt(t))return le(t);throw new se("Value provided to cloneShallow function couldn't be cloned",{value:t})};fe.safe=t=>{try{return fe(t)}catch{return t}};const he=t=>{const e=t?.element;return void 0===e||"element"===e?"Element":`${e.charAt(0).toUpperCase()}${e.slice(1)}Element`},pe=t=>{const e=t.primitive();return void 0===e||"element"===e?"Element":`${e.charAt(0).toUpperCase()}${e.slice(1)}Element`},de=t=>Kt(t),ye=t=>fe(t),me=(t,e,n)=>{Qt(t)?t.value=n:Array.isArray(t)?t[e]=null===n?void 0:n:null===n?delete t[e]:t[e]=n},ve=t=>Qt(t)?["key","value"]:$t(t)||Ht(t)?["content"]:[],ge=(t,e)=>{if(void 0!==t[e])return t[e];const n=e.length;for(const r in t){if(!r.includes("|"))continue;const o=r.indexOf(e);if(-1===o)continue;const s=0===o||"|"===r[o-1],i=o+n===r.length||"|"===r[o+n];if(s&&i)return t[r]}},be=(t,e,n)=>{if(void 0===e)return null;const r=t,o=n?"leave":"enter",s=ge(r,e);if(!n&&"function"==typeof s)return s;if(null!=s){const t=s[o];if("function"==typeof t)return t}const i=r[o];if("function"==typeof i)return i;if(null!=i){const t=ge(i,e);if("function"==typeof t)return t}return null},we=(t,e={})=>{const{visitFnGetter:n=be,nodeTypeGetter:r=he,exposeEdits:o=!1}=e,s=Symbol("internal-skip"),i=Symbol("break"),u=new Array(t.length).fill(s);return{enter(e){let a=e.node,l=!1;for(let f=0;f<t.length;f+=1)if(u[f]===s){const s=n(t[f],r(a),!1);if("function"==typeof s){const n=_e(e,a),r=s.call(t[f],n);if(Nt(r))throw new c("Async visitor not supported in sync mode",{visitor:t[f],visitFn:s});if(n.shouldStop){u[f]=i;break}if(n.shouldSkip&&(u[f]=a),n.removed)return void e.remove();if(n._wasReplaced()){const t=n._getReplacementNode();if(!o)return e.replaceWith(t),t;a=t,l=!0}else if(void 0!==r){if(!o)return e.replaceWith(r),r;a=r,l=!0}}}if(l)return e.replaceWith(a),a},leave(e){const o=e.node;for(let a=0;a<t.length;a+=1)if(u[a]===s){const s=n(t[a],r(o),!0);if("function"==typeof s){const n=_e(e,o),r=s.call(t[a],n);if(Nt(r))throw new c("Async visitor not supported in sync mode",{visitor:t[a],visitFn:s});if(n.shouldStop){u[a]=i;break}if(n.removed)return void e.remove();if(n._wasReplaced()){const t=n._getReplacementNode();return e.replaceWith(t),t}if(void 0!==r)return e.replaceWith(r),r}}else u[a]===o&&(u[a]=s)}}},ke=(t,e={})=>{const{visitFnGetter:n=be,nodeTypeGetter:r=he,exposeEdits:o=!1}=e,s=Symbol("internal-skip"),i=Symbol("break"),c=new Array(t.length).fill(s);return{async enter(e){let u=e.node,a=!1;for(let l=0;l<t.length;l+=1)if(c[l]===s){const s=n(t[l],r(u),!1);if("function"==typeof s){const n=_e(e,u),r=await s.call(t[l],n);if(n.shouldStop){c[l]=i;break}if(n.shouldSkip&&(c[l]=u),n.removed)return void e.remove();if(n._wasReplaced()){const t=n._getReplacementNode();if(!o)return e.replaceWith(t),t;u=t,a=!0}else if(void 0!==r){if(!o)return e.replaceWith(r),r;u=r,a=!0}}}if(a)return e.replaceWith(u),u},async leave(e){const o=e.node;for(let u=0;u<t.length;u+=1)if(c[u]===s){const s=n(t[u],r(o),!0);if("function"==typeof s){const n=_e(e,o),r=await s.call(t[u],n);if(n.shouldStop){c[u]=i;break}if(n.removed)return void e.remove();if(n._wasReplaced()){const t=n._getReplacementNode();return e.replaceWith(t),t}if(void 0!==r)return e.replaceWith(r),r}}else c[u]===o&&(c[u]=s)}}};function _e(t,e){return new n(e,t.parent,t.parentPath,t.key,t.inList)}function*je(t,e,r){const{keyMap:o,state:s,nodeTypeGetter:i,nodePredicate:u,nodeCloneFn:a,detectCycles:l,mutable:f,mutationFn:h}=r,p="function"==typeof o;let d,y,m=Array.isArray(t),v=[t],g=-1,b=[],w=t,k=null,_=null;const j=[];do{g+=1;const t=g===v.length;let r;const S=t&&0!==b.length;if(t){if(r=0===j.length?void 0:k?.key,w=y,y=j.pop(),_=k?.parentPath?.parentPath??null,S)if(f)for(const[t,e]of b)h(w,t,e);else if(m){w=w.slice();let t=0;for(const[e,n]of b){const r=e-t;null===n?(w.splice(r,1),t+=1):w[r]=n}}else{w=a(w);for(const[t,e]of b)w[t]=e}if(void 0!==d){g=d.index,v=d.keys,b=d.edits;const t=d.inArray;if(_=d.parentPath,d=d.prev,S&&!f){const e=t?g:v[g];b.push([e,w])}m=t}}else if(void 0!==y&&(r=m?g:v[g],w=y[r],void 0===w))continue;if(!Array.isArray(w)){if(!u(w))throw new c(`Invalid AST Node: ${String(w)}`,{node:w});if(l&&j.includes(w))continue;k=new n(w,y,_,r,m);const o=be(e,i(w),t);if(o){for(const[t,n]of Object.entries(s))e[t]=n;const n=yield{visitFn:o,path:k,isLeaving:t};if(k.shouldStop)break;if(k.shouldSkip&&!t)continue;if(k.removed){if(b.push([r,null]),!t)continue}else if(k._wasReplaced()){const e=k._getReplacementNode();if(b.push([r,e]),!t){if(!u(e))continue;w=e}}else if(void 0!==n&&(b.push([r,n]),!t)){if(!u(n))continue;w=n}k._markStale()}}if(!t){if(d={inArray:m,index:g,keys:v,edits:b,parentPath:_,prev:d},m=Array.isArray(w),m)v=w;else if(p)v=o(w);else{const t=i(w);v=void 0!==t?o[t]??[]:[]}g=-1,b=[],void 0!==y&&j.push(y),y=w,_=k}}while(void 0!==d);return 0!==b.length?b.at(-1)[1]:t}we[Symbol.for("nodejs.util.promisify.custom")]=ke;const Se=(t,e,n={})=>{const r=je(t,e,{keyMap:n.keyMap??ve,state:n.state??{},nodeTypeGetter:n.nodeTypeGetter??he,nodePredicate:n.nodePredicate??de,nodeCloneFn:n.nodeCloneFn??ye,detectCycles:n.detectCycles??!0,mutable:n.mutable??!1,mutationFn:n.mutationFn??me});let o=r.next();for(;!o.done;){const t=o.value,n=t.visitFn.call(e,t.path);if(Nt(n))throw new c("Async visitor not supported in sync mode",{visitor:e,visitFn:t.visitFn});o=r.next(n)}return o.value},Ae=async(t,e,n={})=>{const r=je(t,e,{keyMap:n.keyMap??ve,state:n.state??{},nodeTypeGetter:n.nodeTypeGetter??he,nodePredicate:n.nodePredicate??de,nodeCloneFn:n.nodeCloneFn??ye,detectCycles:n.detectCycles??!0,mutable:n.mutable??!1,mutationFn:n.mutationFn??me});let o=r.next();for(;!o.done;){const t=o.value,n=await t.visitFn.call(e,t.path);o=r.next(n)}return o.value};Se[Symbol.for("nodejs.util.promisify.custom")]=Ae;const Oe=(t,e)=>{const n=[];return Se(t,{enter(t){e(t.node)&&n.push(t.node)}}),n},Ee=(t,e)=>{let n;return Se(t,{enter(t){e(t.node)&&(n=t.node,t.stop())}}),n},xe=(t,e)=>void 0!==Ee(t,e),Pe=(t,e)=>Oe(t,t=>!e(t)),Me=(t,e)=>{let n,r;"function"==typeof e?(n=e,r=Kt):(n=e.callback??(()=>{}),r=e.predicate??Kt),Se(t,{enter(t){r(t.node)&&n(t.node)}})},Fe=t=>{const e=new WeakMap;return Se(t,{enter(t){e.set(t.node,t.parentPath?.node)}}),e},Ce=(t,e)=>{let n,r;"number"==typeof e?(n=e,r=!1):(n=e.offset??0,r=e.includeRightBound??!1);const o=[];return Se(t,{enter(t){const e=t.node;if(!Xt(e))return;const s=e.startOffset,i=e.endOffset;n>=s&&(n<i||r&&n<=i)?o.push(e):t.skip()}}),o.at(-1)};return n.prototype.traverse=function(t,e){return Se(this.node,t,e)},n.prototype.traverseAsync=function(t,e){return Ae(this.node,t,e)},e})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomTraverse=t():e.apidomTraverse=t()}(self,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},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,{Path:()=>m,cloneNode:()=>Ct,filter:()=>Ut,find:()=>Ht,findAtOffset:()=>Vt,forEach:()=>Rt,getNodeKeys:()=>Mt,getNodePrimitiveType:()=>St,getNodeType:()=>Ot,getVisitFn:()=>Bt,isNode:()=>Et,mergeVisitors:()=>jt,mergeVisitorsAsync:()=>Nt,mutateNode:()=>Ft,parents:()=>zt,reject:()=>$t,some:()=>Gt,traverse:()=>_t,traverseAsync:()=>Lt});const r=function(){const e=n,t=s,r=this,o="parser.js: Parser(): ";r.ast=void 0,r.stats=void 0,r.trace=void 0,r.callbacks=[];let i,c,l,a,u,p,d,h=0,f=0,y=0,m=0,g=0,x=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};r.parse=(s,n,w,b)=>{const v=`${o}parse(): `;h=0,f=0,y=0,m=0,g=0,i=void 0,c=void 0,l=void 0,a=void 0,x.refresh(),u=void 0,p=void 0,d=void 0,a=t.stringToChars(w),i=s.rules,c=s.udts;const T=n.toLowerCase();let A;for(const e in i)if(i.hasOwnProperty(e)&&T===i[e].lower){A=i[e].index;break}if(void 0===A)throw new Error(`${v}start rule name '${startRule}' not recognized`);(()=>{const e=`${o}initializeCallbacks(): `;let t,s;for(u=[],p=[],t=0;t<i.length;t+=1)u[t]=void 0;for(t=0;t<c.length;t+=1)p[t]=void 0;const n=[];for(t=0;t<i.length;t+=1)n.push(i[t].lower);for(t=0;t<c.length;t+=1)n.push(c[t].lower);for(const o in r.callbacks)if(r.callbacks.hasOwnProperty(o)){if(t=n.indexOf(o.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${o}' not a rule or udt name`);if(s=r.callbacks[o]?r.callbacks[o]:void 0,"function"!=typeof s&&void 0!==s)throw new Error(`${e}syntax callback[${o}] must be function reference or falsy)`);t<i.length?u[t]=s:p[t-i.length]=s}})(),r.trace&&r.trace.init(i,c,a),r.stats&&r.stats.init(i,c),r.ast&&r.ast.init(i,c,a),d=b,l=[{type:e.RNM,index:A}],k(0,0),l=void 0;let I=!1;switch(x.state){case e.ACTIVE:throw new Error(`${v}final state should never be 'ACTIVE'`);case e.NOMATCH:I=!1;break;case e.EMPTY:case e.MATCH:I=x.phraseLength===a.length;break;default:throw new Error("unrecognized state")}return{success:I,state:x.state,stateName:e.idName(x.state),length:a.length,matched:x.phraseLength,maxMatched:g,maxTreeDepth:y,nodeHits:m}};const w=(t,r,s,n)=>{if(r.phraseLength>s){let e=`${o}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(!n)throw new Error(`${o}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(`${o}opRNM(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}},b=(t,s)=>{let n,u,f;const y=l[t],m=c[y.index];x.UdtIndex=m.index,h||(f=r.ast&&r.ast.udtDefined(y.index),f&&(u=i.length+y.index,n=r.ast.getLength(),r.ast.down(u,m.name)));const g=a.length-s;p[y.index](x,a,s,d),((t,r,s)=>{if(r.phraseLength>s){let e=`${o}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(`${o}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${o}opUDT(${t.name}) may not return EMPTY.`);r.phraseLength=0;break;case e.MATCH:if(0===r.phraseLength){if(!t.empty)throw new Error(`${o}opUDT(${t.name}) may not return EMPTY.`);r.state=e.EMPTY}break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${o}opUDT(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}})(m,x,g),h||f&&(x.state===e.NOMATCH?r.ast.setLength(n):r.ast.up(u,m.name,s,x.phraseLength))},k=(t,s)=>{const n=`${o}opExecute(): `,c=l[t];switch(m+=1,f>y&&(y=f),f+=1,x.refresh(),r.trace&&r.trace.down(c,s),c.type){case e.ALT:((t,r)=>{const s=l[t];for(let t=0;t<s.children.length&&(k(s.children[t],r),x.state===e.NOMATCH);t+=1);})(t,s);break;case e.CAT:((t,s)=>{let n,o,i,c;const a=l[t];r.ast&&(o=r.ast.getLength()),n=!0,i=s,c=0;for(let t=0;t<a.children.length;t+=1){if(k(a.children[t],i),x.state===e.NOMATCH){n=!1;break}i+=x.phraseLength,c+=x.phraseLength}n?(x.state=0===c?e.EMPTY:e.MATCH,x.phraseLength=c):(x.state=e.NOMATCH,x.phraseLength=0,r.ast&&r.ast.setLength(o))})(t,s);break;case e.REP:((t,s)=>{let n,o,i,c;const u=l[t];if(0===u.max)return x.state=e.EMPTY,void(x.phraseLength=0);for(o=s,i=0,c=0,r.ast&&(n=r.ast.getLength());!(o>=a.length)&&(k(t+1,o),x.state!==e.NOMATCH)&&x.state!==e.EMPTY&&(c+=1,i+=x.phraseLength,o+=x.phraseLength,c!==u.max););x.state===e.EMPTY||c>=u.min?(x.state=0===i?e.EMPTY:e.MATCH,x.phraseLength=i):(x.state=e.NOMATCH,x.phraseLength=0,r.ast&&r.ast.setLength(n))})(t,s);break;case e.RNM:((t,s)=>{let n,o,c;const p=l[t],f=i[p.index],y=u[f.index];if(h||(o=r.ast&&r.ast.ruleDefined(p.index),o&&(n=r.ast.getLength(),r.ast.down(p.index,i[p.index].name))),y){const t=a.length-s;y(x,a,s,d),w(f,x,t,!0),x.state===e.ACTIVE&&(c=l,l=f.opcodes,k(0,s),l=c,y(x,a,s,d),w(f,x,t,!1))}else c=l,l=f.opcodes,k(0,s,x),l=c;h||o&&(x.state===e.NOMATCH?r.ast.setLength(n):r.ast.up(p.index,f.name,s,x.phraseLength))})(t,s);break;case e.TRG:((t,r)=>{const s=l[t];x.state=e.NOMATCH,r<a.length&&s.min<=a[r]&&a[r]<=s.max&&(x.state=e.MATCH,x.phraseLength=1)})(t,s);break;case e.TBS:((t,r)=>{const s=l[t],n=s.string.length;if(x.state=e.NOMATCH,r+n<=a.length){for(let e=0;e<n;e+=1)if(a[r+e]!==s.string[e])return;x.state=e.MATCH,x.phraseLength=n}})(t,s);break;case e.TLS:((t,r)=>{let s;const n=l[t];x.state=e.NOMATCH;const o=n.string.length;if(0!==o){if(r+o<=a.length){for(let e=0;e<o;e+=1)if(s=a[r+e],s>=65&&s<=90&&(s+=32),s!==n.string[e])return;x.state=e.MATCH,x.phraseLength=o}}else x.state=e.EMPTY})(t,s);break;case e.UDT:b(t,s);break;case e.AND:((t,r)=>{switch(h+=1,k(t+1,r),h-=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,s);break;case e.NOT:((t,r)=>{switch(h+=1,k(t+1,r),h-=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,s);break;default:throw new Error(`${n}unrecognized operator`)}h||s+x.phraseLength>g&&(g=s+x.phraseLength),r.stats&&r.stats.collect(c,x),r.trace&&r.trace.up(c,x.state,s,x.phraseLength),f-=1}},s={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,r)=>{let s=e;for(;!(void 0===t||t<0);){if(void 0===r){s=e.slice(t);break}if(r<=0)return"";s=e.slice(t,t+r);break}return String.fromCodePoint(...s)}},n={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 n.ALT:return"ALT";case n.CAT:return"CAT";case n.REP:return"REP";case n.RNM:return"RNM";case n.TRG:return"TRG";case n.TBS:return"TBS";case n.TLS:return"TLS";case n.UDT:return"UDT";case n.AND:return"AND";case n.NOT:return"NOT";case n.ACTIVE:return"ACTIVE";case n.EMPTY:return"EMPTY";case n.MATCH:return"MATCH";case n.NOMATCH:return"NOMATCH";case n.SEM_PRE:return"SEM_PRE";case n.SEM_POST:return"SEM_POST";case n.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};function o(){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 i 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 c=i;new o;new o,new r,new o,new r,new o,new r,new o,new r;const l=e=>{if("string"!=typeof e&&"number"!=typeof e)throw new TypeError("Reference token must be a string or number");return String(e).replace(/~/g,"~0").replace(/\//g,"~1")};const a=class extends c{},u=e=>{if(!Array.isArray(e))throw new TypeError("Reference tokens must be a list of strings or numbers");try{return 0===e.length?"":`/${e.map(e=>{if("string"!=typeof e&&"number"!=typeof e)throw new TypeError("Reference token must be a string or number");return l(String(e))}).join("/")}`}catch(t){throw new a("Unexpected error during JSON Pointer compilation",{cause:t,referenceTokens:e})}};class p 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 d=p;new function(){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'}};const h=e=>{if("string"!=typeof e)throw new TypeError("Selector must be a string");let t="";for(const r of e){const e=r.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")}`:r}}return t};const f=class extends d{},y=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`['${h(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})}};class m{node;key;index;parent;parentPath;inList;#e=!1;#t=!1;#r=!1;#s=!1;#n;#o=!1;constructor(e,t,r,s,n){this.node=e,this.parent=t,this.parentPath=r,this.key=s,this.index=n&&"number"==typeof s?s:void 0,this.inList=n}get shouldSkip(){return this.#e}get shouldStop(){return this.#t}get removed(){return this.#r}isRoot(){return null===this.parentPath}get depth(){let e=0,t=this.parentPath;for(;null!==t;)e+=1,t=t.parentPath;return e}getAncestry(){const e=[];let t=this.parentPath;for(;null!==t;)e.push(t),t=t.parentPath;return e}getAncestorNodes(){return this.getAncestry().map(e=>e.node)}getPathKeys(){const e=[];let t=this;for(;null!==t&&void 0!==t.key;)e.unshift(t.key),t=t.parentPath;return e}formatPath(e="jsonpointer"){const t=this.getPathKeys();return 0===t.length?"jsonpath"===e?"$":"":"jsonpath"===e?y(t):u(t)}findParent(e){let t=this.parentPath;for(;null!==t;){if(e(t))return t;t=t.parentPath}return null}find(e){return e(this)?this:this.findParent(e)}skip(){this.#e=!0}stop(){this.#t=!0}replaceWith(e){this.#o&&console.warn("Warning: replaceWith() called on a stale Path. This path belongs to a node whose visit has already completed. The replacement will have no effect. To replace a parent node, do so from the parent's own visitor."),this.#s=!0,this.#n=e,this.node=e}remove(){this.#o&&console.warn("Warning: remove() called on a stale Path. This path belongs to a node whose visit has already completed. The removal will have no effect. To remove a parent node, do so from the parent's own visitor."),this.#r=!0}_getReplacementNode(){return this.#n}_wasReplaced(){return this.#s}_reset(){this.#e=!1,this.#t=!1,this.#r=!1,this.#s=!1,this.#n=void 0}_markStale(){this.#o=!0}}class g 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 x=g;class w extends Error{static[Symbol.hasInstance](e){return super[Symbol.hasInstance](e)||Function.prototype[Symbol.hasInstance].call(x,e)}constructor(e,t){super(e,t),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const b=w;const k=class extends b{constructor(e,t){if(super(e,t),null!=t&&"object"==typeof t){const{cause:e,...r}=t;Object.assign(this,r)}}};function v(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,r){return t.apply(this,arguments)};case 3:return function(e,r,s){return t.apply(this,arguments)};case 4:return function(e,r,s,n){return t.apply(this,arguments)};case 5:return function(e,r,s,n,o){return t.apply(this,arguments)};case 6:return function(e,r,s,n,o,i){return t.apply(this,arguments)};case 7:return function(e,r,s,n,o,i,c){return t.apply(this,arguments)};case 8:return function(e,r,s,n,o,i,c,l){return t.apply(this,arguments)};case 9:return function(e,r,s,n,o,i,c,l,a){return t.apply(this,arguments)};case 10:return function(e,r,s,n,o,i,c,l,a,u){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function T(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function A(e){return function t(r){return 0===arguments.length||T(r)?t:e.apply(this,arguments)}}function I(e){return function t(r,s){switch(arguments.length){case 0:return t;case 1:return T(r)?t:A(function(t){return e(r,t)});default:return T(r)&&T(s)?t:T(r)?A(function(t){return e(t,s)}):T(s)?A(function(t){return e(r,t)}):e(r,s)}}}function O(e,t,r){return function(){for(var s=[],n=0,o=e,i=0,c=!1;i<t.length||n<arguments.length;){var l;i<t.length&&(!T(t[i])||n>=arguments.length)?l=t[i]:(l=arguments[n],n+=1),s[i]=l,T(l)?c=!0:o-=1,i+=1}return!c&&o<=0?r.apply(this,s):v(Math.max(0,o),O(e,s,r))}}const S=I(function(e,t){return 1===e?A(t):v(e,O(e,[],t))});function E(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t}const C=I(function(e,t){return e&&t});function F(e,t,r){for(var s=0,n=r.length;s<n;)t=e(t,r[s]),s+=1;return t}const M=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};const D=A(function(e){return!!M(e)||!!e&&("object"==typeof e&&(!function(e){return"[object String]"===Object.prototype.toString.call(e)}(e)&&(0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))});var B="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function j(e,t,r){return function(s,n,o){if(D(o))return e(s,n,o);if(null==o)return n;if("function"==typeof o["fantasy-land/reduce"])return t(s,n,o,"fantasy-land/reduce");if(null!=o[B])return r(s,n,o[B]());if("function"==typeof o.next)return r(s,n,o);if("function"==typeof o.reduce)return t(s,n,o,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function N(e,t,r){for(var s=r.next();!s.done;)t=e(t,s.value),s=r.next();return t}function q(e,t,r,s){return r[s](e,t)}const P=j(F,q,N);function _(e,t,r){return function(){if(0===arguments.length)return r();var s=arguments[arguments.length-1];if(!M(s)){for(var n=0;n<e.length;){if("function"==typeof s[e[n]])return s[e[n]].apply(s,Array.prototype.slice.call(arguments,0,-1));n+=1}if(function(e){return null!=e&&"function"==typeof e["@@transducer/step"]}(s))return t.apply(null,Array.prototype.slice.call(arguments,0,-1))(s)}return r.apply(this,arguments)}}function L(e,t){for(var r=0,s=t.length,n=Array(s);r<s;)n[r]=e(t[r]),r+=1;return n}const U=function(){return this.xf["@@transducer/init"]()},H=function(e){return this.xf["@@transducer/result"](e)};var G=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=U,e.prototype["@@transducer/result"]=H,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}();const $=function(e){return function(t){return new G(e,t)}};function R(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var z=Object.prototype.toString;const V=function(){return"[object Arguments]"===z.call(arguments)?function(e){return"[object Arguments]"===z.call(e)}:function(e){return R("callee",e)}}();var X=!{toString:null}.propertyIsEnumerable("toString"),Y=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],W=function(){return arguments.propertyIsEnumerable("length")}(),K=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1},J="function"!=typeof Object.keys||W?A(function(e){if(Object(e)!==e)return[];var t,r,s=[],n=W&&V(e);for(t in e)!R(t,e)||n&&"length"===t||(s[s.length]=t);if(X)for(r=Y.length-1;r>=0;)R(t=Y[r],e)&&!K(s,t)&&(s[s.length]=t),r-=1;return s}):A(function(e){return Object(e)!==e?[]:Object.keys(e)});const Z=J;const Q=I(_(["fantasy-land/map","map"],$,function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return S(t.length,function(){return e.call(this,t.apply(this,arguments))});case"[object Object]":return F(function(r,s){return r[s]=e(t[s]),r},{},Z(t));default:return L(e,t)}}));const ee=I(function(e,t){return"function"==typeof t["fantasy-land/ap"]?t["fantasy-land/ap"](e):"function"==typeof e.ap?e.ap(t):"function"==typeof e?function(r){return e(r)(t(r))}:P(function(e,r){return function(e,t){var r;t=t||[];var s=(e=e||[]).length,n=t.length,o=[];for(r=0;r<s;)o[o.length]=e[r],r+=1;for(r=0;r<n;)o[o.length]=t[r],r+=1;return o}(e,Q(r,t))},[],e)});const te=I(function(e,t){var r=S(e,t);return S(e,function(){return F(ee,Q(r,arguments[0]),Array.prototype.slice.call(arguments,1))})});const re=A(function(e){return te(e.length,e)});const se=I(function(e,t){return E(e)?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:re(C)(e,t)});function ne(e,t){return function(){return t.call(this,e.apply(this,arguments))}}function oe(e){return function t(r,s,n){switch(arguments.length){case 0:return t;case 1:return T(r)?t:I(function(t,s){return e(r,t,s)});case 2:return T(r)&&T(s)?t:T(r)?I(function(t,r){return e(t,s,r)}):T(s)?I(function(t,s){return e(r,t,s)}):A(function(t){return e(r,s,t)});default:return T(r)&&T(s)&&T(n)?t:T(r)&&T(s)?I(function(t,r){return e(t,r,n)}):T(r)&&T(n)?I(function(t,r){return e(t,s,r)}):T(s)&&T(n)?I(function(t,s){return e(r,t,s)}):T(r)?A(function(t){return e(t,s,n)}):T(s)?A(function(t){return e(r,t,n)}):T(n)?A(function(t){return e(r,s,t)}):e(r,s,n)}}}function ie(e,t,r){for(var s=0,n=r.length;s<n;){if((t=e["@@transducer/step"](t,r[s]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}s+=1}return e["@@transducer/result"](t)}const ce=I(function(e,t){return v(e.length,function(){return e.apply(t,arguments)})});function le(e,t,r){for(var s=r.next();!s.done;){if((t=e["@@transducer/step"](t,s.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}s=r.next()}return e["@@transducer/result"](t)}function ae(e,t,r,s){return e["@@transducer/result"](r[s](ce(e["@@transducer/step"],e),t))}const ue=j(ie,ae,le);var pe=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}();const de=oe(function(e,t,r){return ue("function"==typeof e?new pe(e):e,t,r)});function he(e,t){return function(){var r=arguments.length;if(0===r)return t();var s=arguments[r-1];return M(s)||"function"!=typeof s[e]?t.apply(this,arguments):s[e].apply(s,Array.prototype.slice.call(arguments,0,r-1))}}const fe=A(he("tail",oe(he("slice",function(e,t,r){return Array.prototype.slice.call(r,e,t)}))(1,1/0)));function ye(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return v(arguments[0].length,de(ne,arguments[0],fe(arguments)))}function me(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function ge(e,t,r){for(var s=0,n=r.length;s<n;){if(e(t,r[s]))return!0;s+=1}return!1}const xe="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};const we=A(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function be(e,t,r,s){var n=me(e);function o(e,t){return ke(e,t,r.slice(),s.slice())}return!ge(function(e,t){return!ge(o,t,e)},me(t),n)}function ke(e,t,r,s){if(xe(e,t))return!0;var n,o,i=we(e);if(i!==we(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"===(n=e.constructor,null==(o=String(n).match(/^function (\w*)/))?"":o[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!xe(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!xe(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 c=r.length-1;c>=0;){if(r[c]===e)return s[c]===t;c-=1}switch(i){case"Map":return e.size===t.size&&be(e.entries(),t.entries(),r.concat([e]),s.concat([t]));case"Set":return e.size===t.size&&be(e.values(),t.values(),r.concat([e]),s.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 l=Z(e);if(l.length!==Z(t).length)return!1;var a=r.concat([e]),u=s.concat([t]);for(c=l.length-1;c>=0;){var p=l[c];if(!R(p,t)||!ke(t[p],e[p],a,u))return!1;c-=1}return!0}const ve=I(function(e,t){return ke(e,t,[],[])});function Te(e,t){return function(e,t,r){var s,n;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(s=1/t;r<e.length;){if(0===(n=e[r])&&1/n===s)return r;r+=1}return-1}if(t!=t){for(;r<e.length;){if("number"==typeof(n=e[r])&&n!=n)return r;r+=1}return-1}return e.indexOf(t,r);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,r);case"object":if(null===t)return e.indexOf(t,r)}for(;r<e.length;){if(ve(e[r],t))return r;r+=1}return-1}(t,e,0)>=0}function Ae(e){return'"'+e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var Ie=function(e){return(e<10?"0":"")+e};const Oe="function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+Ie(e.getUTCMonth()+1)+"-"+Ie(e.getUTCDate())+"T"+Ie(e.getUTCHours())+":"+Ie(e.getUTCMinutes())+":"+Ie(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};var Se=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=U,e.prototype["@@transducer/result"]=H,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}();function Ee(e){return function(t){return new Se(e,t)}}var Ce=I(_(["fantasy-land/filter","filter"],Ee,function(e,t){return r=t,"[object Object]"===Object.prototype.toString.call(r)?F(function(r,s){return e(t[s])&&(r[s]=t[s]),r},{},Z(t)):function(e){return"[object Map]"===Object.prototype.toString.call(e)}(t)?function(e,t){for(var r=new Map,s=t.entries(),n=s.next();!n.done;)e(n.value[1])&&r.set(n.value[0],n.value[1]),n=s.next();return r}(e,t):function(e,t){for(var r=0,s=t.length,n=[];r<s;)e(t[r])&&(n[n.length]=t[r]),r+=1;return n}(e,t);var r}));const Fe=Ce;const Me=I(function(e,t){return Fe((r=e,function(){return!r.apply(this,arguments)}),t);var r});function De(e,t){var r=function(r){var s=t.concat([e]);return Te(r,s)?"<Circular>":De(r,s)},s=function(e,t){return L(function(t){return Ae(t)+": "+r(e[t])},t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+L(r,e).join(", ")+"))";case"[object Array]":return"["+L(r,e).concat(s(e,Me(function(e){return/^\d+$/.test(e)},Z(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+r(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?r(NaN):Ae(Oe(e)))+")";case"[object Map]":return"new Map("+r(Array.from(e))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+r(e.valueOf())+")":1/e==-1/0?"-0":e.toString(10);case"[object Set]":return"new Set("+r(Array.from(e).sort())+")";case"[object String]":return"object"==typeof e?"new String("+r(e.valueOf())+")":Ae(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var n=e.toString();if("[object Object]"!==n)return n}return"{"+s(e,Z(e)).join(", ")+"}"}}const Be=A(function(e){return De(e,[])});const je=I(function(e,t){return e||t});const Ne=I(function(e,t){return E(e)?function(){return e.apply(this,arguments)||t.apply(this,arguments)}:re(je)(e,t)});const qe=re(A(function(e){return!e}))(ve(null));const Pe=I(function(e,t){if(e===t)return t;function r(e,t){if(e>t!=t>e)return t>e?t:e}var s=r(e,t);if(void 0!==s)return s;var n=r(typeof e,typeof t);if(void 0!==n)return n===typeof e?e:t;var o=Be(e),i=r(o,Be(t));return void 0!==i&&i===o?e:t}),_e=Number.isInteger||function(e){return(e|0)===e};const Le=I(function(e,t){var r,s;if(null!=t)return _e(e)?(s=t)[(r=e)<0?s.length+r:r]:t[e]});const Ue=I(function(e,t){return Q(Le(e),t)});const He=A(function(e){return S(de(Pe,0,Ue("length",e)),function(){for(var t=0,r=e.length;t<r;){if(e[t].apply(this,arguments))return!0;t+=1}return!1})});var Ge=function(e,t){switch(arguments.length){case 0:return Ge;case 1:return function t(r){return 0===arguments.length?t:xe(e,r)};default:return xe(e,t)}};const $e=Ge;const Re=S(1,ye(we,$e("GeneratorFunction")));const ze=S(1,ye(we,$e("AsyncFunction")));var Ve=He([ye(we,$e("Function")),Re,ze]);function Xe(e){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xe(e)}var Ye=S(1,se(qe,Ne(function(e){return"object"===Xe(e)},Ve)));const We=S(1,se(Ye,ye(Be,ve("[object Promise]"))));const Ke=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class Je{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 s=r.value,n=r.key;if(void 0===s||void 0===n)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,s,n,r):e(s,n,r)})}filter(e,t){const r=this.elements.filter(r=>{const s=r.value,n=r.key;return void 0!==s&&void 0!==n&&(void 0!==t?e.call(t,s,n,r):e(s,n,r))});return new Je(r)}reject(e,t){const r=[];for(const s of this.elements){const n=s.value,o=s.key;void 0!==n&&void 0!==o&&(e.call(t,n,o,s)||r.push(s))}return new Je(r)}forEach(e,t){this.elements.forEach((r,s)=>{const n=r.value,o=r.key;void 0!==n&&void 0!==o&&(void 0!==t?e.call(t,n,o,r,s):e(n,o,r,s))})}find(e,t){return this.elements.find(r=>{const s=r.value,n=r.key;return void 0!==s&&void 0!==n&&(void 0!==t?e.call(t,s,n,r):e(s,n,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 Ze=Je;class Qe{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 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 Ke)this._content=e;else if(e instanceof Ze)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 Ke){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 Ke?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){return ve(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 et=Qe;class tt extends et{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||{},s=!!r.recursive,n=void 0===r.results?[]:r.results;for(let t=0;t<this._content.length;t+=1){const r=this._content[t],o=r;s&&"function"==typeof o.findElements&&o.findElements(e,{results:n,recursive:s}),e(r,t,void 0)&&n.push(r)}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 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 rt=tt;const st=class extends rt{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 s of this._content){const n=e.call(t,s);n&&r.push(n)}return r}filter(e,t){const r=this._content.filter(e,t);return new this.constructor(r)}reject(e,t){const r=[];for(const s of this._content)e.call(t,s)||r.push(s);return new this.constructor(r)}reduce(e,t){let r,s;void 0!==t?(r=0,s=this.refract(t)):(r=1,s=this.first);for(let t=r;t<this.length;t+=1){const r=e(s,this._content[t],t,this);s=void 0===r?r:this.refract(r)}return s}forEach(e,t){this._content.forEach((r,s)=>{e.call(t,r,s)})}empty(){return new this.constructor([])}};const nt=class extends et{constructor(e,t,r,s){super(new Ke,r,s),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 ot=class extends rt{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 nt(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((s,n,o)=>{const i=e.call(t,s,n,o);i&&r.push(i)}),r}filter(e,t){return new Ze(this._content).filter(e,t)}reject(e,t){const r=[];for(const s of this._content)e.call(t,s.value,s.key,s)||r.push(s);return new Ze(r)}forEach(e,t){this._content.forEach(r=>e.call(t,r.value,r.key,r))}reduce(e,t){let r,s;void 0!==t?(r=0,s=this.refract(t)):(r=1,s=this._content[0]?.value);for(let t=r;t<this._content.length;t+=1){const r=this._content[t],n=e(s,r.value,r.key,r,this);s=void 0===n?n:this.refract(n)}return s}empty(){return new this.constructor([])}},it=e=>e instanceof et,ct=e=>e instanceof st,lt=e=>e instanceof ot,at=e=>e instanceof nt,ut=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;const pt=class extends et{constructor(e,t,r){super(e,t,r),this.element="string"}primitive(){return"string"}get length(){return this.content?.length??0}};class dt extends pt{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:s,endLine:n,endCharacter:o,endOffset:i}=e;if("number"!=typeof t||"number"!=typeof r||"number"!=typeof s||"number"!=typeof n||"number"!=typeof o||"number"!=typeof i)return;const c="sm1:"+[t,r,s,n,o,i].map(ft).join("");const l=new dt(c);return l.startLine=t,l.startCharacter=r,l.startOffset=s,l.endLine=n,l.endCharacter=o,l.endOffset=i,l}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 s=0;for(let e=0;e<6;e++){const e=yt(t,s);r.push(e.value),s=e.next}return r}(this.content))}}const ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ft(e){let t=e>>>0,r="";do{let e=31&t;t>>>=5,0!==t&&(e|=32),r+=ht[e]}while(0!==t);return r}function yt(e,t=0){let r=0,s=0,n=t;for(;;){const t=e[n++],o=ht.indexOf(t);if(-1===o)throw new Error(`Invalid Base64 VLQ char: ${t}`);if(r|=(31&o)<<s,s+=5,!!!(32&o))break}return{value:r>>>0,next:n}}const mt=dt;const gt=class extends k{value;constructor(e,t){super(e,t),void 0!==t&&(this.value=t.value)}};const xt=class extends gt{};const wt=class extends gt{},bt=(e,t)=>{const{visited:r=new WeakMap}=t,s={...t,visited:r};if(r.has(e))return r.get(e);const n=At(e);r.set(e,n);const{content:o}=e;return Array.isArray(o)?n.content=o.map(e=>bt(e,s)):it(o)?n.content=bt(o,s):n.content=o instanceof Ke?kt(o,s):o,n},kt=(e,t)=>{const{visited:r=new WeakMap}=t,s={...t,visited:r};if(r.has(e))return r.get(e);const{key:n,value:o}=e,i=void 0!==n?bt(n,s):void 0,c=void 0!==o?bt(o,s):void 0,l=new Ke(i,c);return r.set(e,l),l},vt=(e,t={})=>{if(e instanceof Ke)return kt(e,t);if(e instanceof Ze)return((e,t)=>{const{visited:r=new WeakMap}=t,s={...t,visited:r};if(r.has(e))return r.get(e);const n=[...e].map(e=>bt(e,s)),o=new Ze(n);return r.set(e,o),o})(e,t);if(it(e))return bt(e,t);throw new xt("Value provided to cloneDeep function couldn't be cloned",{value:e})};vt.safe=e=>{try{return vt(e)}catch{return e}};const Tt=e=>{const{key:t,value:r}=e;return new Ke(t,r)},At=e=>{const t=new(0,e.constructor);t.element=e.element,e.isMetaEmpty||(t.meta=vt(e.meta)),e.isAttributesEmpty||(t.attributes=vt(e.attributes)),ut(e)&&mt.transfer(e,t);const{content:r}=e;return it(r)?t.content=At(r):Array.isArray(r)?t.content=[...r]:t.content=r instanceof Ke?Tt(r):r,t},It=e=>{if(e instanceof Ke)return Tt(e);if(e instanceof Ze)return(e=>{const t=[...e];return new Ze(t)})(e);if(it(e))return At(e);throw new wt("Value provided to cloneShallow function couldn't be cloned",{value:e})};It.safe=e=>{try{return It(e)}catch{return e}};const Ot=e=>{const t=e?.element;return void 0===t||"element"===t?"Element":`${t.charAt(0).toUpperCase()}${t.slice(1)}Element`},St=e=>{const t=e.primitive();return void 0===t||"element"===t?"Element":`${t.charAt(0).toUpperCase()}${t.slice(1)}Element`},Et=e=>it(e),Ct=e=>It(e),Ft=(e,t,r)=>{at(e)?e.value=r:Array.isArray(e)?e[t]=null===r?void 0:r:null===r?delete e[t]:e[t]=r},Mt=e=>at(e)?["key","value"]:ct(e)||lt(e)?["content"]:[],Dt=(e,t)=>{if(void 0!==e[t])return e[t];const r=t.length;for(const s in e){if(!s.includes("|"))continue;const n=s.indexOf(t);if(-1===n)continue;const o=0===n||"|"===s[n-1],i=n+r===s.length||"|"===s[n+r];if(o&&i)return e[s]}},Bt=(e,t,r)=>{if(void 0===t)return null;const s=e,n=r?"leave":"enter",o=Dt(s,t);if(!r&&"function"==typeof o)return o;if(null!=o){const e=o[n];if("function"==typeof e)return e}const i=s[n];if("function"==typeof i)return i;if(null!=i){const e=Dt(i,t);if("function"==typeof e)return e}return null},jt=(e,t={})=>{const{visitFnGetter:r=Bt,nodeTypeGetter:s=Ot,exposeEdits:n=!1}=t,o=Symbol("internal-skip"),i=Symbol("break"),c=new Array(e.length).fill(o);return{enter(t){let l=t.node,a=!1;for(let u=0;u<e.length;u+=1)if(c[u]===o){const o=r(e[u],s(l),!1);if("function"==typeof o){const r=qt(t,l),s=o.call(e[u],r);if(We(s))throw new k("Async visitor not supported in sync mode",{visitor:e[u],visitFn:o});if(r.shouldStop){c[u]=i;break}if(r.shouldSkip&&(c[u]=l),r.removed)return void t.remove();if(r._wasReplaced()){const e=r._getReplacementNode();if(!n)return t.replaceWith(e),e;l=e,a=!0}else if(void 0!==s){if(!n)return t.replaceWith(s),s;l=s,a=!0}}}if(a)return t.replaceWith(l),l},leave(t){const n=t.node;for(let l=0;l<e.length;l+=1)if(c[l]===o){const o=r(e[l],s(n),!0);if("function"==typeof o){const r=qt(t,n),s=o.call(e[l],r);if(We(s))throw new k("Async visitor not supported in sync mode",{visitor:e[l],visitFn:o});if(r.shouldStop){c[l]=i;break}if(r.removed)return void t.remove();if(r._wasReplaced()){const e=r._getReplacementNode();return t.replaceWith(e),e}if(void 0!==s)return t.replaceWith(s),s}}else c[l]===n&&(c[l]=o)}}},Nt=(e,t={})=>{const{visitFnGetter:r=Bt,nodeTypeGetter:s=Ot,exposeEdits:n=!1}=t,o=Symbol("internal-skip"),i=Symbol("break"),c=new Array(e.length).fill(o);return{async enter(t){let l=t.node,a=!1;for(let u=0;u<e.length;u+=1)if(c[u]===o){const o=r(e[u],s(l),!1);if("function"==typeof o){const r=qt(t,l),s=await o.call(e[u],r);if(r.shouldStop){c[u]=i;break}if(r.shouldSkip&&(c[u]=l),r.removed)return void t.remove();if(r._wasReplaced()){const e=r._getReplacementNode();if(!n)return t.replaceWith(e),e;l=e,a=!0}else if(void 0!==s){if(!n)return t.replaceWith(s),s;l=s,a=!0}}}if(a)return t.replaceWith(l),l},async leave(t){const n=t.node;for(let l=0;l<e.length;l+=1)if(c[l]===o){const o=r(e[l],s(n),!0);if("function"==typeof o){const r=qt(t,n),s=await o.call(e[l],r);if(r.shouldStop){c[l]=i;break}if(r.removed)return void t.remove();if(r._wasReplaced()){const e=r._getReplacementNode();return t.replaceWith(e),e}if(void 0!==s)return t.replaceWith(s),s}}else c[l]===n&&(c[l]=o)}}};function qt(e,t){return new m(t,e.parent,e.parentPath,e.key,e.inList)}function*Pt(e,t,r){const{keyMap:s,state:n,nodeTypeGetter:o,nodePredicate:i,nodeCloneFn:c,detectCycles:l,mutable:a,mutationFn:u}=r,p="function"==typeof s;let d,h,f=Array.isArray(e),y=[e],g=-1,x=[],w=e,b=null,v=null;const T=[];do{g+=1;const e=g===y.length;let r;const A=e&&0!==x.length;if(e){if(r=0===T.length?void 0:b?.key,w=h,h=T.pop(),v=b?.parentPath?.parentPath??null,A)if(a)for(const[e,t]of x)u(w,e,t);else if(f){w=w.slice();let e=0;for(const[t,r]of x){const s=t-e;null===r?(w.splice(s,1),e+=1):w[s]=r}}else{w=c(w);for(const[e,t]of x)w[e]=t}if(void 0!==d){g=d.index,y=d.keys,x=d.edits;const e=d.inArray;if(v=d.parentPath,d=d.prev,A&&!a){const t=e?g:y[g];x.push([t,w])}f=e}}else if(void 0!==h&&(r=f?g:y[g],w=h[r],void 0===w))continue;if(!Array.isArray(w)){if(!i(w))throw new k(`Invalid AST Node: ${String(w)}`,{node:w});if(l&&T.includes(w))continue;b=new m(w,h,v,r,f);const s=Bt(t,o(w),e);if(s){for(const[e,r]of Object.entries(n))t[e]=r;const o=yield{visitFn:s,path:b,isLeaving:e};if(b.shouldStop)break;if(b.shouldSkip&&!e)continue;if(b.removed){if(x.push([r,null]),!e)continue}else if(b._wasReplaced()){const t=b._getReplacementNode();if(x.push([r,t]),!e){if(!i(t))continue;w=t}}else if(void 0!==o&&(x.push([r,o]),!e)){if(!i(o))continue;w=o}b._markStale()}}if(!e){if(d={inArray:f,index:g,keys:y,edits:x,parentPath:v,prev:d},f=Array.isArray(w),f)y=w;else if(p)y=s(w);else{const e=o(w);y=void 0!==e?s[e]??[]:[]}g=-1,x=[],void 0!==h&&T.push(h),h=w,v=b}}while(void 0!==d);return 0!==x.length?x.at(-1)[1]:e}jt[Symbol.for("nodejs.util.promisify.custom")]=Nt;const _t=(e,t,r={})=>{const s=Pt(e,t,{keyMap:r.keyMap??Mt,state:r.state??{},nodeTypeGetter:r.nodeTypeGetter??Ot,nodePredicate:r.nodePredicate??Et,nodeCloneFn:r.nodeCloneFn??Ct,detectCycles:r.detectCycles??!0,mutable:r.mutable??!1,mutationFn:r.mutationFn??Ft});let n=s.next();for(;!n.done;){const e=n.value,r=e.visitFn.call(t,e.path);if(We(r))throw new k("Async visitor not supported in sync mode",{visitor:t,visitFn:e.visitFn});n=s.next(r)}return n.value},Lt=async(e,t,r={})=>{const s=Pt(e,t,{keyMap:r.keyMap??Mt,state:r.state??{},nodeTypeGetter:r.nodeTypeGetter??Ot,nodePredicate:r.nodePredicate??Et,nodeCloneFn:r.nodeCloneFn??Ct,detectCycles:r.detectCycles??!0,mutable:r.mutable??!1,mutationFn:r.mutationFn??Ft});let n=s.next();for(;!n.done;){const e=n.value,r=await e.visitFn.call(t,e.path);n=s.next(r)}return n.value};_t[Symbol.for("nodejs.util.promisify.custom")]=Lt;const Ut=(e,t)=>{const r=[];return _t(e,{enter(e){t(e.node)&&r.push(e.node)}}),r},Ht=(e,t)=>{let r;return _t(e,{enter(e){t(e.node)&&(r=e.node,e.stop())}}),r},Gt=(e,t)=>void 0!==Ht(e,t),$t=(e,t)=>Ut(e,e=>!t(e)),Rt=(e,t)=>{let r,s;"function"==typeof t?(r=t,s=it):(r=t.callback??(()=>{}),s=t.predicate??it),_t(e,{enter(e){s(e.node)&&r(e.node)}})},zt=e=>{const t=new WeakMap;return _t(e,{enter(e){t.set(e.node,e.parentPath?.node)}}),t},Vt=(e,t)=>{let r,s;"number"==typeof t?(r=t,s=!1):(r=t.offset??0,s=t.includeRightBound??!1);const n=[];return _t(e,{enter(e){const t=e.node;if(!ut(t))return;const o=t.startOffset,i=t.endOffset;r>=o&&(r<i||s&&r<=i)?n.push(t):e.skip()}}),n.at(-1)};return m.prototype.traverse=function(e,t){return _t(this.node,e,t)},m.prototype.traverseAsync=function(e,t){return Lt(this.node,e,t)},t})());
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-traverse",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Traversal and visitor utilities for walking and transforming ApiDOM structures.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org",
|
|
8
|
-
"provenance":
|
|
8
|
+
"provenance": true
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"sideEffects": [
|
|
@@ -42,8 +42,10 @@
|
|
|
42
42
|
"license": "Apache-2.0",
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
45
|
-
"@speclynx/apidom-datamodel": "^1.
|
|
46
|
-
"@speclynx/apidom-error": "^1.
|
|
45
|
+
"@speclynx/apidom-datamodel": "^2.1.0",
|
|
46
|
+
"@speclynx/apidom-error": "^2.1.0",
|
|
47
|
+
"@speclynx/apidom-json-pointer": "^2.1.0",
|
|
48
|
+
"@swaggerexpert/jsonpath": "^3.2.5",
|
|
47
49
|
"ramda-adjunct": "^6.0.0"
|
|
48
50
|
},
|
|
49
51
|
"files": [
|
|
@@ -55,5 +57,6 @@
|
|
|
55
57
|
"NOTICE",
|
|
56
58
|
"README.md",
|
|
57
59
|
"CHANGELOG.md"
|
|
58
|
-
]
|
|
60
|
+
],
|
|
61
|
+
"gitHead": "dd02cfbbe82b0a31c6e7c444cec140e740e1c6e9"
|
|
59
62
|
}
|
package/src/Path.cjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.Path = void 0;
|
|
5
|
+
var _apidomJsonPointer = require("@speclynx/apidom-json-pointer");
|
|
6
|
+
var _jsonpath = require("@swaggerexpert/jsonpath");
|
|
5
7
|
/**
|
|
6
8
|
* Possible return values from a visitor function.
|
|
7
9
|
* @public
|
|
@@ -153,6 +155,43 @@ class Path {
|
|
|
153
155
|
return keys;
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Format path as RFC 6901 JSON Pointer or RFC 9535 Normalized JSONPath.
|
|
160
|
+
*
|
|
161
|
+
* @param pathFormat - Output format: "jsonpointer" (default) or "jsonpath"
|
|
162
|
+
* @returns JSONPointer string like "/paths/~1pets/get/responses/200"
|
|
163
|
+
* or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* // JSON Pointer examples:
|
|
167
|
+
* path.formatPath(); // "" (root)
|
|
168
|
+
* path.formatPath(); // "/info"
|
|
169
|
+
* path.formatPath(); // "/paths/~1pets/get"
|
|
170
|
+
* path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* // JSONPath examples:
|
|
174
|
+
* path.formatPath('jsonpath'); // "$" (root)
|
|
175
|
+
* path.formatPath('jsonpath'); // "$['info']"
|
|
176
|
+
* path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
|
|
177
|
+
* path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
|
|
178
|
+
*/
|
|
179
|
+
formatPath(pathFormat = 'jsonpointer') {
|
|
180
|
+
const parts = this.getPathKeys();
|
|
181
|
+
|
|
182
|
+
// Root node
|
|
183
|
+
if (parts.length === 0) {
|
|
184
|
+
return pathFormat === 'jsonpath' ? '$' : '';
|
|
185
|
+
}
|
|
186
|
+
if (pathFormat === 'jsonpath') {
|
|
187
|
+
// RFC 9535 Normalized JSONPath
|
|
188
|
+
return (0, _jsonpath.compile)(parts);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// RFC 6901 JSON Pointer
|
|
192
|
+
return (0, _apidomJsonPointer.compile)(parts);
|
|
193
|
+
}
|
|
194
|
+
|
|
156
195
|
/**
|
|
157
196
|
* Find the closest ancestor path that satisfies the predicate.
|
|
158
197
|
*/
|
package/src/Path.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { compile as compileJSONPointer } from '@speclynx/apidom-json-pointer';
|
|
2
|
+
import { compile as compileJSONPath } from '@swaggerexpert/jsonpath';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Possible return values from a visitor function.
|
|
3
6
|
* @public
|
|
@@ -149,6 +152,43 @@ export class Path {
|
|
|
149
152
|
return keys;
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Format path as RFC 6901 JSON Pointer or RFC 9535 Normalized JSONPath.
|
|
157
|
+
*
|
|
158
|
+
* @param pathFormat - Output format: "jsonpointer" (default) or "jsonpath"
|
|
159
|
+
* @returns JSONPointer string like "/paths/~1pets/get/responses/200"
|
|
160
|
+
* or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* // JSON Pointer examples:
|
|
164
|
+
* path.formatPath(); // "" (root)
|
|
165
|
+
* path.formatPath(); // "/info"
|
|
166
|
+
* path.formatPath(); // "/paths/~1pets/get"
|
|
167
|
+
* path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* // JSONPath examples:
|
|
171
|
+
* path.formatPath('jsonpath'); // "$" (root)
|
|
172
|
+
* path.formatPath('jsonpath'); // "$['info']"
|
|
173
|
+
* path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
|
|
174
|
+
* path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
|
|
175
|
+
*/
|
|
176
|
+
formatPath(pathFormat = 'jsonpointer') {
|
|
177
|
+
const parts = this.getPathKeys();
|
|
178
|
+
|
|
179
|
+
// Root node
|
|
180
|
+
if (parts.length === 0) {
|
|
181
|
+
return pathFormat === 'jsonpath' ? '$' : '';
|
|
182
|
+
}
|
|
183
|
+
if (pathFormat === 'jsonpath') {
|
|
184
|
+
// RFC 9535 Normalized JSONPath
|
|
185
|
+
return compileJSONPath(parts);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// RFC 6901 JSON Pointer
|
|
189
|
+
return compileJSONPointer(parts);
|
|
190
|
+
}
|
|
191
|
+
|
|
152
192
|
/**
|
|
153
193
|
* Find the closest ancestor path that satisfies the predicate.
|
|
154
194
|
*/
|
|
@@ -229,6 +229,28 @@ export declare class Path<TNode = Element_2> {
|
|
|
229
229
|
* Get the path from root as an array of keys.
|
|
230
230
|
*/
|
|
231
231
|
getPathKeys(): PropertyKey[];
|
|
232
|
+
/**
|
|
233
|
+
* Format path as RFC 6901 JSON Pointer or RFC 9535 Normalized JSONPath.
|
|
234
|
+
*
|
|
235
|
+
* @param pathFormat - Output format: "jsonpointer" (default) or "jsonpath"
|
|
236
|
+
* @returns JSONPointer string like "/paths/~1pets/get/responses/200"
|
|
237
|
+
* or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* // JSON Pointer examples:
|
|
241
|
+
* path.formatPath(); // "" (root)
|
|
242
|
+
* path.formatPath(); // "/info"
|
|
243
|
+
* path.formatPath(); // "/paths/~1pets/get"
|
|
244
|
+
* path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* // JSONPath examples:
|
|
248
|
+
* path.formatPath('jsonpath'); // "$" (root)
|
|
249
|
+
* path.formatPath('jsonpath'); // "$['info']"
|
|
250
|
+
* path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
|
|
251
|
+
* path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
|
|
252
|
+
*/
|
|
253
|
+
formatPath(pathFormat?: 'jsonpointer' | 'jsonpath'): string;
|
|
232
254
|
/**
|
|
233
255
|
* Find the closest ancestor path that satisfies the predicate.
|
|
234
256
|
*/
|