@speclynx/apidom-json-pointer-relative 1.12.1 → 2.0.1
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 +18 -0
- package/NOTICE +16 -7
- package/dist/apidom-json-pointer-relative.browser.js +7894 -12945
- package/dist/apidom-json-pointer-relative.browser.min.js +1 -1
- package/package.json +7 -6
- package/src/evaluate.cjs +33 -32
- package/src/evaluate.mjs +10 -9
- package/types/apidom-json-pointer-relative.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPointerRelative=t():e.apidomJsonPointerRelative=t()}(self,()=>(()=>{var e={88:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).get(e)}},155:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},195:(e,t,n)=>{var r=n(4882),s=n(8121),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return s(e);var t=[];for(var n in Object(e))o.call(e,n)&&"constructor"!=n&&t.push(n);return t}},353:(e,t,n)=>{var r=n(1340),s=n(3934),o=n(8861),i=n(1182),a=n(8486),c=n(3142),u=n(5853),l=n(8666),h="[object Arguments]",f="[object Array]",p="[object Object]",m=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,d,y,g){var b=c(e),v=c(t),w=b?f:a(e),E=v?f:a(t),x=(w=w==h?p:w)==p,T=(E=E==h?p:E)==p,j=w==E;if(j&&u(e)){if(!u(t))return!1;b=!0,x=!1}if(j&&!x)return g||(g=new r),b||l(e)?s(e,t,n,d,y,g):o(e,t,w,n,d,y,g);if(!(1&n)){var A=x&&m.call(e,"__wrapped__"),k=T&&m.call(t,"__wrapped__");if(A||k){var O=A?e.value():e,S=k?t.value():t;return g||(g=new r),y(O,S,n,d,g)}}return!!j&&(g||(g=new r),i(e,t,n,d,y,g))}},358:(e,t,n)=>{var r=n(6137),s=n(3283),o=n(3142),i=n(5853),a=n(9632),c=n(8666),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=o(e),l=!n&&s(e),h=!n&&!l&&i(e),f=!n&&!l&&!h&&c(e),p=n||l||h||f,m=p?r(e.length,String):[],d=m.length;for(var y in e)!t&&!u.call(e,y)||p&&("length"==y||h&&("offset"==y||"parent"==y)||f&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||a(y,d))||m.push(y);return m}},393:(e,t,n)=>{var r=n(8244),s=n(7979),o=n(1211);e.exports=function(e){return r(e,o,s)}},394:e=>{e.exports=class{constructor(e){this.namespace=e||new this.Namespace}serialise(e){if(!(e instanceof this.namespace.elements.Element))throw new TypeError(`Given element \`${e}\` is not an Element instance`);const t={element:e.element};e._meta&&e._meta.length>0&&(t.meta=this.serialiseObject(e.meta)),e._attributes&&e._attributes.length>0&&(t.attributes=this.serialiseObject(e.attributes));const n=this.serialiseContent(e.content);return void 0!==n&&(t.content=n),t}deserialise(e){if(!e.element)throw new Error("Given value is not an object containing an element name");const t=new(this.namespace.getElementClass(e.element));t.element!==e.element&&(t.element=e.element),e.meta&&this.deserialiseObject(e.meta,t.meta),e.attributes&&this.deserialiseObject(e.attributes,t.attributes);const n=this.deserialiseContent(e.content);return void 0===n&&null!==t.content||(t.content=n),t}serialiseContent(e){if(e instanceof this.namespace.elements.Element)return this.serialise(e);if(e instanceof this.namespace.KeyValuePair){const t={key:this.serialise(e.key)};return e.value&&(t.value=this.serialise(e.value)),t}if(e&&e.map){if(0===e.length)return;return e.map(this.serialise,this)}return e}deserialiseContent(e){if(e){if(e.element)return this.deserialise(e);if(e.key){const t=new this.namespace.KeyValuePair(this.deserialise(e.key));return e.value&&(t.value=this.deserialise(e.value)),t}if(e.map)return e.map(this.deserialise,this)}return e}serialiseObject(e){const t={};if(e.forEach((e,n)=>{e&&(t[n.toValue()]=this.serialise(e))}),0!==Object.keys(t).length)return t}deserialiseObject(e,t){Object.keys(e).forEach(n=>{t.set(n,this.deserialise(e[n]))})}}},547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},593:(e,t,n)=>{const r=n(8631);e.exports=class extends r{constructor(e,t,n){super(e||[],t,n),this.element="ref",this.path||(this.path="element")}get path(){return this.attributes.get("path")}set path(e){this.attributes.set("path",e)}}},674:(e,t,n)=>{var r=n(7379),s=n(5387),o=n(547),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&s(e.length)&&!!i[r(e)]}},986:(e,t,n)=>{var r=n(7379),s=n(547);e.exports=function(e){return"number"==typeof e||s(e)&&"[object Number]"==r(e)}},1112:(e,t,n)=>{var r=n(4497),s=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return s.call(t,e)?t[e]:void 0}},1129:e=>{e.exports=function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}},1182:(e,t,n)=>{var r=n(393),s=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,o,i,a){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var h=l;h--;){var f=u[h];if(!(c?f in t:s.call(t,f)))return!1}var p=a.get(e),m=a.get(t);if(p&&m)return p==t&&m==e;var d=!0;a.set(e,t),a.set(t,e);for(var y=c;++h<l;){var g=e[f=u[h]],b=t[f];if(o)var v=c?o(b,g,f,t,e,a):o(g,b,f,e,t,a);if(!(void 0===v?g===b||i(g,b,n,o,a):v)){d=!1;break}y||(y="constructor"==f)}if(d&&!y){var w=e.constructor,E=t.constructor;w==E||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof E&&E instanceof E||(d=!1)}return a.delete(e),a.delete(t),d}},1211:(e,t,n)=>{var r=n(358),s=n(195),o=n(6529);e.exports=function(e){return o(e)?r(e):s(e)}},1340:(e,t,n)=>{var r=n(1386),s=n(4103),o=n(1779),i=n(4162),a=n(7462),c=n(6638);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=s,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=c,e.exports=u},1386:(e,t,n)=>{var r=n(2393),s=n(2049),o=n(7144),i=n(7452),a=n(3964);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=s,c.prototype.get=o,c.prototype.has=i,c.prototype.set=a,e.exports=c},1517:e=>{e.exports=function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}},1580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},1623:(e,t,n)=>{var r=n(8942).Uint8Array;e.exports=r},1779:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},1877:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},1950:(e,t,n)=>{var r=n(8942)["__core-js_shared__"];e.exports=r},2049:(e,t,n)=>{var r=n(7034),s=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():s.call(t,n,1),--this.size,!0)}},2306:(e,t,n)=>{e=n.nmd(e);var r=n(4967),s=t&&!t.nodeType&&t,o=s&&e&&!e.nodeType&&e,i=o&&o.exports===s&&r.process,a=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=a},2322:e=>{class t{constructor(e,t){this.key=e,this.value=t}clone(){const e=new t;return this.key&&(e.key=this.key.clone()),this.value&&(e.value=this.value.clone()),e}}e.exports=t},2393:e=>{e.exports=function(){this.__data__=[],this.size=0}},2536:(e,t,n)=>{const r=n(8631);e.exports=class extends r{constructor(e,t,n){super(e,t,n),this.element="number"}primitive(){return"number"}}},2555:(e,t,n)=>{const r=n(8631);e.exports=class extends r{constructor(e,t,n){super(e,t,n),this.element="boolean"}primitive(){return"boolean"}}},2563:(e,t,n)=>{var r=n(7379),s=n(547);e.exports=function(e){return!0===e||!1===e||s(e)&&"[object Boolean]"==r(e)}},3004:(e,t,n)=>{const r=n(8631);e.exports=class extends r{constructor(e,t,n){super(e||null,t,n),this.element="null"}primitive(){return"null"}set(){return new Error("Cannot set the value of null")}}},3103:(e,t,n)=>{var r=n(4715)(n(8942),"DataView");e.exports=r},3142:e=>{var t=Array.isArray;e.exports=t},3148:(e,t,n)=>{const r=n(394);e.exports=class extends r{serialise(e){if(!(e instanceof this.namespace.elements.Element))throw new TypeError(`Given element \`${e}\` is not an Element instance`);let t;e._attributes&&e.attributes.get("variable")&&(t=e.attributes.get("variable"));const n={element:e.element};e._meta&&e._meta.length>0&&(n.meta=this.serialiseObject(e.meta));const r="enum"===e.element||-1!==e.attributes.keys().indexOf("enumerations");if(r){const t=this.enumSerialiseAttributes(e);t&&(n.attributes=t)}else if(e._attributes&&e._attributes.length>0){let{attributes:r}=e;r.get("metadata")&&(r=r.clone(),r.set("meta",r.get("metadata")),r.remove("metadata")),"member"===e.element&&t&&(r=r.clone(),r.remove("variable")),r.length>0&&(n.attributes=this.serialiseObject(r))}if(r)n.content=this.enumSerialiseContent(e,n);else if(this[`${e.element}SerialiseContent`])n.content=this[`${e.element}SerialiseContent`](e,n);else if(void 0!==e.content){let r;t&&e.content.key?(r=e.content.clone(),r.key.attributes.set("variable",t),r=this.serialiseContent(r)):r=this.serialiseContent(e.content),this.shouldSerialiseContent(e,r)&&(n.content=r)}else this.shouldSerialiseContent(e,e.content)&&e instanceof this.namespace.elements.Array&&(n.content=[]);return n}shouldSerialiseContent(e,t){return"parseResult"===e.element||"httpRequest"===e.element||"httpResponse"===e.element||"category"===e.element||"link"===e.element||void 0!==t&&(!Array.isArray(t)||0!==t.length)}refSerialiseContent(e,t){return delete t.attributes,{href:e.toValue(),path:e.path.toValue()}}sourceMapSerialiseContent(e){return e.toValue()}dataStructureSerialiseContent(e){return[this.serialiseContent(e.content)]}enumSerialiseAttributes(e){const t=e.attributes.clone(),n=t.remove("enumerations")||new this.namespace.elements.Array([]),r=t.get("default");let s=t.get("samples")||new this.namespace.elements.Array([]);if(r&&r.content&&(r.content.attributes&&r.content.attributes.remove("typeAttributes"),t.set("default",new this.namespace.elements.Array([r.content]))),s.forEach(e=>{e.content&&e.content.element&&e.content.attributes.remove("typeAttributes")}),e.content&&0!==n.length&&s.unshift(e.content),s=s.map(e=>e instanceof this.namespace.elements.Array?[e]:new this.namespace.elements.Array([e.content])),s.length&&t.set("samples",s),t.length>0)return this.serialiseObject(t)}enumSerialiseContent(e){if(e._attributes){const t=e.attributes.get("enumerations");if(t&&t.length>0)return t.content.map(e=>{const t=e.clone();return t.attributes.remove("typeAttributes"),this.serialise(t)})}if(e.content){const t=e.content.clone();return t.attributes.remove("typeAttributes"),[this.serialise(t)]}return[]}deserialise(e){if("string"==typeof e)return new this.namespace.elements.String(e);if("number"==typeof e)return new this.namespace.elements.Number(e);if("boolean"==typeof e)return new this.namespace.elements.Boolean(e);if(null===e)return new this.namespace.elements.Null;if(Array.isArray(e))return new this.namespace.elements.Array(e.map(this.deserialise,this));const t=this.namespace.getElementClass(e.element),n=new t;n.element!==e.element&&(n.element=e.element),e.meta&&this.deserialiseObject(e.meta,n.meta),e.attributes&&this.deserialiseObject(e.attributes,n.attributes);const r=this.deserialiseContent(e.content);if(void 0===r&&null!==n.content||(n.content=r),"enum"===n.element){n.content&&n.attributes.set("enumerations",n.content);let e=n.attributes.get("samples");if(n.attributes.remove("samples"),e){const r=e;e=new this.namespace.elements.Array,r.forEach(r=>{r.forEach(r=>{const s=new t(r);s.element=n.element,e.push(s)})});const s=e.shift();n.content=s?s.content:void 0,n.attributes.set("samples",e)}else n.content=void 0;let r=n.attributes.get("default");if(r&&r.length>0){r=r.get(0);const e=new t(r);e.element=n.element,n.attributes.set("default",e)}}else if("dataStructure"===n.element&&Array.isArray(n.content))[n.content]=n.content;else if("category"===n.element){const e=n.attributes.get("meta");e&&(n.attributes.set("metadata",e),n.attributes.remove("meta"))}else"member"===n.element&&n.key&&n.key._attributes&&n.key._attributes.getValue("variable")&&(n.attributes.set("variable",n.key.attributes.get("variable")),n.key.attributes.remove("variable"));return n}serialiseContent(e){if(e instanceof this.namespace.elements.Element)return this.serialise(e);if(e instanceof this.namespace.KeyValuePair){const t={key:this.serialise(e.key)};return e.value&&(t.value=this.serialise(e.value)),t}return e&&e.map?e.map(this.serialise,this):e}deserialiseContent(e){if(e){if(e.element)return this.deserialise(e);if(e.key){const t=new this.namespace.KeyValuePair(this.deserialise(e.key));return e.value&&(t.value=this.deserialise(e.value)),t}if(e.map)return e.map(this.deserialise,this)}return e}shouldRefract(e){return!!(e._attributes&&e.attributes.keys().length||e._meta&&e.meta.keys().length)||"enum"!==e.element&&(e.element!==e.primitive()||"member"===e.element)}convertKeyToRefract(e,t){return this.shouldRefract(t)?this.serialise(t):"enum"===t.element?this.serialiseEnum(t):"array"===t.element?t.map(t=>this.shouldRefract(t)||"default"===e?this.serialise(t):"array"===t.element||"object"===t.element||"enum"===t.element?t.children.map(e=>this.serialise(e)):t.toValue()):"object"===t.element?(t.content||[]).map(this.serialise,this):t.toValue()}serialiseEnum(e){return e.children.map(e=>this.serialise(e))}serialiseObject(e){const t={};return e.forEach((e,n)=>{if(e){const r=n.toValue();t[r]=this.convertKeyToRefract(r,e)}}),t}deserialiseObject(e,t){Object.keys(e).forEach(n=>{t.set(n,this.deserialise(e[n]))})}}},3212:(e,t,n)=>{var r=n(8250),s=n(1877),o=n(8006);function i(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}i.prototype.add=i.prototype.push=s,i.prototype.has=o,e.exports=i},3283:(e,t,n)=>{var r=n(6027),s=n(547),o=Object.prototype,i=o.hasOwnProperty,a=o.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return s(e)&&i.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},3305:(e,t,n)=>{var r=n(4497);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},3311:(e,t,n)=>{const r=n(1517),s=n(4123);class o extends s{map(e,t){return this.elements.map(n=>e.bind(t)(n.value,n.key,n))}filter(e,t){return new o(this.elements.filter(n=>e.bind(t)(n.value,n.key,n)))}reject(e,t){return this.filter(r(e.bind(t)))}forEach(e,t){return this.elements.forEach((n,r)=>{e.bind(t)(n.value,n.key,n,r)})}keys(){return this.map((e,t)=>t.toValue())}values(){return this.map(e=>e.toValue())}}e.exports=o},3655:(e,t,n)=>{var r=n(7379),s=n(1580);e.exports=function(e){if(!s(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},3766:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},3934:(e,t,n)=>{var r=n(3212),s=n(6465),o=n(5568);e.exports=function(e,t,n,i,a,c){var u=1&n,l=e.length,h=t.length;if(l!=h&&!(u&&h>l))return!1;var f=c.get(e),p=c.get(t);if(f&&p)return f==t&&p==e;var m=-1,d=!0,y=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++m<l;){var g=e[m],b=t[m];if(i)var v=u?i(b,g,m,t,e,c):i(g,b,m,e,t,c);if(void 0!==v){if(v)continue;d=!1;break}if(y){if(!s(t,function(e,t){if(!o(y,t)&&(g===e||a(g,e,n,i,c)))return y.push(t)})){d=!1;break}}else if(g!==b&&!a(g,b,n,i,c)){d=!1;break}}return c.delete(e),c.delete(t),d}},3964:(e,t,n)=>{var r=n(7034);e.exports=function(e,t){var n=this.__data__,s=r(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}},4066:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},4103:(e,t,n)=>{var r=n(1386);e.exports=function(){this.__data__=new r,this.size=0}},4123:(e,t,n)=>{const r=n(1517);function s(e){return"string"==typeof e?t=>t.element===e:e.constructor&&e.extend?t=>t instanceof e:e}class o{constructor(e){this.elements=e||[]}toValue(){return this.elements.map(e=>e.toValue())}map(e,t){return this.elements.map(e,t)}flatMap(e,t){return this.map(e,t).reduce((e,t)=>e.concat(t),[])}compactMap(e,t){const n=[];return this.forEach(r=>{const s=e.bind(t)(r);s&&n.push(s)}),n}filter(e,t){return e=s(e),new o(this.elements.filter(e,t))}reject(e,t){return e=s(e),new o(this.elements.filter(r(e),t))}find(e,t){return e=s(e),this.elements.find(e,t)}forEach(e,t){this.elements.forEach(e,t)}reduce(e,t){return this.elements.reduce(e,t)}includes(e){return this.elements.some(t=>t.equals(e))}shift(){return this.elements.shift()}unshift(e){this.elements.unshift(this.refract(e))}push(e){return this.elements.push(this.refract(e)),this}add(e){this.push(e)}get(e){return this.elements[e]}getValue(e){const t=this.elements[e];if(t)return t.toValue()}get length(){return this.elements.length}get isEmpty(){return 0===this.elements.length}get first(){return this.elements[0]}}"undefined"!=typeof Symbol&&(o.prototype[Symbol.iterator]=function(){return this.elements[Symbol.iterator]()}),e.exports=o},4162:e=>{e.exports=function(e){return this.__data__.get(e)}},4497:(e,t,n)=>{var r=n(4715)(Object,"create");e.exports=r},4512:(e,t,n)=>{var r=n(4715)(n(8942),"Set");e.exports=r},4687:(e,t,n)=>{var r=n(353),s=n(547);e.exports=function e(t,n,o,i,a){return t===n||(null==t||null==n||!s(t)&&!s(n)?t!=t&&n!=n:r(t,n,o,i,e,a))}},4700:(e,t,n)=>{var r=n(9067);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},4715:(e,t,n)=>{var r=n(9624),s=n(155);e.exports=function(e,t){var n=s(e,t);return r(n)?n:void 0}},4732:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).has(e)}},4759:(e,t,n)=>{var r,s=n(1950),o=(r=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!o&&o in e}},4772:e=>{e.exports=function(){return!1}},4882:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},4967:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},5071:(e,t,n)=>{var r=n(4497);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},5098:(e,t,n)=>{var r=n(3305),s=n(9361),o=n(1112),i=n(5276),a=n(5071);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=s,c.prototype.get=o,c.prototype.has=i,c.prototype.set=a,e.exports=c},5276:(e,t,n)=>{var r=n(4497),s=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:s.call(t,e)}},5387:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},5568:e=>{e.exports=function(e,t){return e.has(t)}},5642:(e,t,n)=>{const r=n(1517),s=n(1580),o=n(9796),i=n(7309),a=n(3311);e.exports=class extends o{constructor(e,t,n){super(e||[],t,n),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}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(n=>n.key.toValue()!==e||(t=n,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if(s(e))return Object.keys(e).forEach(t=>{this.set(t,e[t])}),this;const n=e,r=this.getMember(n);return r?r.value=t:this.content.push(new i(n,t)),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(n=>e.bind(t)(n.value,n.key,n))}compactMap(e,t){const n=[];return this.forEach((r,s,o)=>{const i=e.bind(t)(r,s,o);i&&n.push(i)}),n}filter(e,t){return new a(this.content).filter(e,t)}reject(e,t){return this.filter(r(e),t)}forEach(e,t){return this.content.forEach(n=>e.bind(t)(n.value,n.key,n))}}},5650:(e,t,n)=>{var r=n(8942).Symbol;e.exports=r},5681:(e,t,n)=>{var r=n(4700);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},5735:(e,t,n)=>{const r=n(9310),s=n(8138),o=n(986),i=n(2563),a=n(1580),c=n(394),u=n(7547);class l{constructor(e){this.elementMap={},this.elementDetection=[],this.Element=u.Element,this.KeyValuePair=u.KeyValuePair,e&&e.noDefault||this.useDefault(),this._attributeElementKeys=[],this._attributeElementArrayKeys=[]}use(e){return e.namespace&&e.namespace({base:this}),e.load&&e.load({base:this}),this}useDefault(){return this.register("null",u.NullElement).register("string",u.StringElement).register("number",u.NumberElement).register("boolean",u.BooleanElement).register("array",u.ArrayElement).register("object",u.ObjectElement).register("member",u.MemberElement).register("ref",u.RefElement).register("link",u.LinkElement),this.detect(r,u.NullElement,!1).detect(s,u.StringElement,!1).detect(o,u.NumberElement,!1).detect(i,u.BooleanElement,!1).detect(Array.isArray,u.ArrayElement,!1).detect(a,u.ObjectElement,!1),this}register(e,t){return this._elements=void 0,this.elementMap[e]=t,this}unregister(e){return this._elements=void 0,delete this.elementMap[e],this}detect(e,t,n){return void 0===n||n?this.elementDetection.unshift([e,t]):this.elementDetection.push([e,t]),this}toElement(e){if(e instanceof this.Element)return e;let t;for(let n=0;n<this.elementDetection.length;n+=1){const r=this.elementDetection[n][0],s=this.elementDetection[n][1];if(r(e)){t=new s(e);break}}return t}getElementClass(e){const t=this.elementMap[e];return void 0===t?this.Element:t}fromRefract(e){return this.serialiser.deserialise(e)}toRefract(e){return this.serialiser.serialise(e)}get elements(){return void 0===this._elements&&(this._elements={Element:this.Element},Object.keys(this.elementMap).forEach(e=>{const t=e[0].toUpperCase()+e.substr(1);this._elements[t]=this.elementMap[e]})),this._elements}get serialiser(){return new c(this)}}c.prototype.Namespace=l,e.exports=l},5853:(e,t,n)=>{e=n.nmd(e);var r=n(8942),s=n(4772),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||s;e.exports=c},5894:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}},6027:(e,t,n)=>{var r=n(7379),s=n(547);e.exports=function(e){return s(e)&&"[object Arguments]"==r(e)}},6137:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},6285:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},6343:(e,t,n)=>{var r=n(4687);e.exports=function(e,t){return r(e,t)}},6465:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},6529:(e,t,n)=>{var r=n(3655),s=n(5387);e.exports=function(e){return null!=e&&s(e.length)&&!r(e)}},6638:(e,t,n)=>{var r=n(1386),s=n(9770),o=n(8250);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var i=n.__data__;if(!s||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new o(i)}return n.set(e,t),this.size=n.size,this}},7034:(e,t,n)=>{var r=n(6285);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},7144:(e,t,n)=>{var r=n(7034);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},7309:(e,t,n)=>{const r=n(2322),s=n(8631);e.exports=class extends s{constructor(e,t,n,s){super(new r,n,s),this.element="member",this.key=e,this.value=t}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=this.refract(e)}}},7379:(e,t,n)=>{var r=n(5650),s=n(8870),o=n(9005),i=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?s(e):o(e)}},7452:(e,t,n)=>{var r=n(7034);e.exports=function(e){return r(this.__data__,e)>-1}},7462:e=>{e.exports=function(e){return this.__data__.has(e)}},7547:(e,t,n)=>{const r=n(8631),s=n(3004),o=n(8712),i=n(2536),a=n(2555),c=n(9796),u=n(7309),l=n(5642),h=n(9620),f=n(593),p=n(4123),m=n(3311),d=n(2322);function y(e){if(e instanceof r)return e;if("string"==typeof e)return new o(e);if("number"==typeof e)return new i(e);if("boolean"==typeof e)return new a(e);if(null===e)return new s;if(Array.isArray(e))return new c(e.map(y));if("object"==typeof e){return new l(e)}return e}r.prototype.ObjectElement=l,r.prototype.RefElement=f,r.prototype.MemberElement=u,r.prototype.refract=y,p.prototype.refract=y,e.exports={Element:r,NullElement:s,StringElement:o,NumberElement:i,BooleanElement:a,ArrayElement:c,MemberElement:u,ObjectElement:l,LinkElement:h,RefElement:f,refract:y,ArraySlice:p,ObjectSlice:m,KeyValuePair:d}},7979:(e,t,n)=>{var r=n(9847),s=n(9306),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(e){return null==e?[]:(e=Object(e),r(i(e),function(t){return o.call(e,t)}))}:s;e.exports=a},8006:e=>{e.exports=function(e){return this.__data__.has(e)}},8121:(e,t,n)=>{var r=n(3766)(Object.keys,Object);e.exports=r},8138:(e,t,n)=>{var r=n(7379),s=n(3142),o=n(547);e.exports=function(e){return"string"==typeof e||!s(e)&&o(e)&&"[object String]"==r(e)}},8244:(e,t,n)=>{var r=n(1129),s=n(3142);e.exports=function(e,t,n){var o=t(e);return s(e)?o:r(o,n(e))}},8250:(e,t,n)=>{var r=n(9753),s=n(5681),o=n(88),i=n(4732),a=n(9068);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=s,c.prototype.get=o,c.prototype.has=i,c.prototype.set=a,e.exports=c},8326:(e,t,n)=>{const r=n(5735),s=n(7547);t.g$=r,t.KeyValuePair=n(2322),t.G6=s.ArraySlice,t.ot=s.ObjectSlice,t.Hg=s.Element,t.Om=s.StringElement,t.kT=s.NumberElement,t.bd=s.BooleanElement,t.Os=s.NullElement,t.wE=s.ArrayElement,t.Sh=s.ObjectElement,t.Pr=s.MemberElement,t.sI=s.RefElement,t.Ft=s.LinkElement,s.refract,n(394),n(3148)},8486:(e,t,n)=>{var r=n(3103),s=n(9770),o=n(9413),i=n(4512),a=n(9270),c=n(7379),u=n(4066),l="[object Map]",h="[object Promise]",f="[object Set]",p="[object WeakMap]",m="[object DataView]",d=u(r),y=u(s),g=u(o),b=u(i),v=u(a),w=c;(r&&w(new r(new ArrayBuffer(1)))!=m||s&&w(new s)!=l||o&&w(o.resolve())!=h||i&&w(new i)!=f||a&&w(new a)!=p)&&(w=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case d:return m;case y:return l;case g:return h;case b:return f;case v:return p}return t}),e.exports=w},8631:(e,t,n)=>{const r=n(6343),s=n(2322),o=n(4123);class i{constructor(e,t,n){t&&(this.meta=t),n&&(this.attributes=n),this.content=e}freeze(){Object.isFrozen(this)||(this._meta&&(this.meta.parent=this,this.meta.freeze()),this._attributes&&(this.attributes.parent=this,this.attributes.freeze()),this.children.forEach(e=>{e.parent=this,e.freeze()},this),this.content&&Array.isArray(this.content)&&Object.freeze(this.content),Object.freeze(this))}primitive(){}clone(){const e=new this.constructor;return e.element=this.element,this.meta.length&&(e._meta=this.meta.clone()),this.attributes.length&&(e._attributes=this.attributes.clone()),this.content?this.content.clone?e.content=this.content.clone():Array.isArray(this.content)?e.content=this.content.map(e=>e.clone()):e.content=this.content:e.content=this.content,e}toValue(){return this.content instanceof i?this.content.toValue():this.content instanceof s?{key:this.content.key.toValue(),value:this.content.value?this.content.value.toValue():void 0}:this.content&&this.content.map?this.content.map(e=>e.toValue(),this):this.content}toRef(e){if(""===this.id.toValue())throw Error("Cannot create reference to an element that does not contain an ID");const t=new this.RefElement(this.id.toValue());return e&&(t.path=e),t}findRecursive(...e){if(arguments.length>1&&!this.isFrozen)throw new Error("Cannot find recursive with multiple element names without first freezing the element. Call `element.freeze()`");const t=e.pop();let n=new o;const r=(e,t)=>(e.push(t),e),i=(e,n)=>{n.element===t&&e.push(n);const o=n.findRecursive(t);return o&&o.reduce(r,e),n.content instanceof s&&(n.content.key&&i(e,n.content.key),n.content.value&&i(e,n.content.value)),e};return this.content&&(this.content.element&&i(n,this.content),Array.isArray(this.content)&&this.content.reduce(i,n)),e.isEmpty||(n=n.filter(t=>{let n=t.parents.map(e=>e.element);for(const t in e){const r=e[t],s=n.indexOf(r);if(-1===s)return!1;n=n.splice(0,s)}return!0})),n}set(e){return this.content=e,this}equals(e){return r(this.toValue(),e)}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)}get element(){return this._storedElement||"element"}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof i)this._content=e;else if(e instanceof o)this.content=e.elements;else if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||"null"===e||null==e)this._content=e;else if(e instanceof s)this._content=e;else if(Array.isArray(e))this._content=e.map(this.refract);else{if("object"!=typeof e)throw new Error("Cannot set content to given value");this._content=Object.keys(e).map(t=>new this.MemberElement(t,e[t]))}}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 this.ObjectElement?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 this.ObjectElement?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 title(){return this.getMetaProperty("title","")}set title(e){this.setMetaProperty("title",e)}get description(){return this.getMetaProperty("description","")}set description(e){this.setMetaProperty("description",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get isFrozen(){return Object.isFrozen(this)}get parents(){let{parent:e}=this;const t=new o;for(;e;)t.push(e),e=e.parent;return t}get children(){if(Array.isArray(this.content))return new o(this.content);if(this.content instanceof s){const e=new o([this.content.key]);return this.content.value&&e.push(this.content.value),e}return this.content instanceof i?new o([this.content]):new o}get recursiveChildren(){const e=new o;return this.children.forEach(t=>{e.push(t),t.recursiveChildren.forEach(t=>{e.push(t)})}),e}}e.exports=i},8666:(e,t,n)=>{var r=n(674),s=n(9460),o=n(2306),i=o&&o.isTypedArray,a=i?s(i):r;e.exports=a},8712:(e,t,n)=>{const r=n(8631);e.exports=class extends r{constructor(e,t,n){super(e,t,n),this.element="string"}primitive(){return"string"}get length(){return this.content.length}}},8861:(e,t,n)=>{var r=n(5650),s=n(1623),o=n(6285),i=n(3934),a=n(5894),c=n(9828),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,h,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!h(new s(e),new s(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var p=a;case"[object Set]":var m=1&r;if(p||(p=c),e.size!=t.size&&!m)return!1;var d=f.get(e);if(d)return d==t;r|=2,f.set(e,t);var y=i(p(e),p(t),r,u,h,f);return f.delete(e),y;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},8870:(e,t,n)=>{var r=n(5650),s=Object.prototype,o=s.hasOwnProperty,i=s.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var s=i.call(e);return r&&(t?e[a]=n:delete e[a]),s}},8942:(e,t,n)=>{var r=n(4967),s="object"==typeof self&&self&&self.Object===Object&&self,o=r||s||Function("return this")();e.exports=o},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9067:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},9068:(e,t,n)=>{var r=n(4700);e.exports=function(e,t){var n=r(this,e),s=n.size;return n.set(e,t),this.size+=n.size==s?0:1,this}},9270:(e,t,n)=>{var r=n(4715)(n(8942),"WeakMap");e.exports=r},9306:e=>{e.exports=function(){return[]}},9310:e=>{e.exports=function(e){return null===e}},9361:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},9413:(e,t,n)=>{var r=n(4715)(n(8942),"Promise");e.exports=r},9460:e=>{e.exports=function(e){return function(t){return e(t)}}},9620:(e,t,n)=>{const r=n(8631);e.exports=class extends r{constructor(e,t,n){super(e||[],t,n),this.element="link"}get relation(){return this.attributes.get("relation")}set relation(e){this.attributes.set("relation",e)}get href(){return this.attributes.get("href")}set href(e){this.attributes.set("href",e)}}},9624:(e,t,n)=>{var r=n(3655),s=n(4759),o=n(1580),i=n(4066),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,h=u.hasOwnProperty,f=RegExp("^"+l.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||s(e))&&(r(e)?f:a).test(i(e))}},9632:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n}},9753:(e,t,n)=>{var r=n(5098),s=n(1386),o=n(9770);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||s),string:new r}}},9770:(e,t,n)=>{var r=n(4715)(n(8942),"Map");e.exports=r},9796:(e,t,n)=>{const r=n(1517),s=n(8631),o=n(4123);class i extends s{constructor(e,t,n){super(e||[],t,n),this.element="array"}primitive(){return"array"}get(e){return this.content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}getIndex(e){return this.content[e]}set(e,t){return this.content[e]=this.refract(t),this}remove(e){const t=this.content.splice(e,1);return t.length?t[0]:null}map(e,t){return this.content.map(e,t)}flatMap(e,t){return this.map(e,t).reduce((e,t)=>e.concat(t),[])}compactMap(e,t){const n=[];return this.forEach(r=>{const s=e.bind(t)(r);s&&n.push(s)}),n}filter(e,t){return new o(this.content.filter(e,t))}reject(e,t){return this.filter(r(e),t)}reduce(e,t){let n,r;void 0!==t?(n=0,r=this.refract(t)):(n=1,r="object"===this.primitive()?this.first.value:this.first);for(let t=n;t<this.length;t+=1){const n=this.content[t];r="object"===this.primitive()?this.refract(e(r,n.value,n.key,n,this)):this.refract(e(r,n,t,this))}return r}forEach(e,t){this.content.forEach((n,r)=>{e.bind(t)(n,this.refract(r))})}shift(){return this.content.shift()}unshift(e){this.content.unshift(this.refract(e))}push(e){return this.content.push(this.refract(e)),this}add(e){this.push(e)}findElements(e,t){const n=t||{},r=!!n.recursive,s=void 0===n.results?[]:n.results;return this.forEach((t,n,o)=>{r&&void 0!==t.findElements&&t.findElements(e,{results:s,recursive:r}),e(t,n,o)&&s.push(t)}),s}find(e){return new o(this.findElements(e,{recursive:!0}))}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>t.classes.includes(e))}getById(e){return this.find(t=>t.id.toValue()===e).first}includes(e){return this.content.some(t=>t.equals(e))}contains(e){return this.includes(e)}empty(){return new this.constructor([])}"fantasy-land/empty"(){return this.empty()}concat(e){return new this.constructor(this.content.concat(e.content))}"fantasy-land/concat"(e){return this.concat(e)}"fantasy-land/map"(e){return new this.constructor(this.map(e))}"fantasy-land/chain"(e){return this.map(t=>e(t),this).reduce((e,t)=>e.concat(t),this.empty())}"fantasy-land/filter"(e){return new this.constructor(this.content.filter(e))}"fantasy-land/reduce"(e,t){return this.content.reduce(e,t)}get length(){return this.content.length}get isEmpty(){return 0===this.content.length}get first(){return this.getIndex(0)}get second(){return this.getIndex(1)}get last(){return this.getIndex(this.length-1)}}i.empty=function(){return new this},i["fantasy-land/empty"]=i.empty,"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.content[Symbol.iterator]()}),e.exports=i},9828:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}},9847:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,s=0,o=[];++n<r;){var i=e[n];t(i,n,e)&&(o[s++]=i)}return o}}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r](o,o.exports,n),o.loaded=!0,o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};return(()=>{"use strict";n.r(r),n.d(r,{CompilationRelativeJsonPointerError:()=>h,EvaluationRelativeJsonPointerError:()=>l,InvalidRelativeJsonPointerError:()=>u,RelativeJsonPointerError:()=>c,compile:()=>W,evaluate:()=>er,isRelativeJsonPointer:()=>Y,parse:()=>K});var e={};n.r(e),n.d(e,{hasElementSourceMap:()=>$t,includesClasses:()=>Lt,includesSymbols:()=>Rt,isAnnotationElement:()=>Pt,isArrayElement:()=>At,isBooleanElement:()=>Tt,isCommentElement:()=>Mt,isElement:()=>vt,isLinkElement:()=>Ot,isMemberElement:()=>kt,isNullElement:()=>xt,isNumberElement:()=>Et,isObjectElement:()=>jt,isParseResultElement:()=>_t,isPrimitiveElement:()=>Ct,isRefElement:()=>St,isSourceMapElement:()=>Nt,isStringElement:()=>wt});class t extends AggregateError{constructor(e,t,n){super(e,t,n),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const s=t;class o extends Error{static[Symbol.hasInstance](e){return super[Symbol.hasInstance](e)||Function.prototype[Symbol.hasInstance].call(s,e)}constructor(e,t){super(e,t),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const i=o;const a=class extends i{constructor(e,t){if(super(e,t),null!=t&&"object"==typeof t){const{cause:e,...n}=t;Object.assign(this,n)}}};const c=class extends a{};class u extends c{relativePointer;constructor(e,t){super(e,t),void 0!==t&&(this.relativePointer=t.relativePointer)}}const l=class extends c{relativePointer;currentElement;rootElement;cursorElement;constructor(e,t){super(e,t),void 0!==t&&(this.relativePointer=t.relativePointer,this.currentElement=t.currentElement,this.rootElement=t.rootElement,this.cursorElement=t.cursorElement)}};const h=class extends c{nonNegativeIntegerPrefix;indexManipulation;jsonPointerTokens;hashCharacter;constructor(e,t){super(e,t),void 0!==t&&(this.nonNegativeIntegerPrefix=t.relativePointer.nonNegativeIntegerPrefix,this.indexManipulation=t.relativePointer.indexManipulation,this.hashCharacter=t.relativePointer.hashCharacter,Array.isArray(t.relativePointer.jsonPointerTokens)&&(this.jsonPointerTokens=[...t.relativePointer.jsonPointerTokens]))}},f=function(){const e=g,t=y,n=this,r="parser.js: Parser(): ";n.ast=void 0,n.stats=void 0,n.trace=void 0,n.callbacks=[];let s,o,i,a,c,u,l,h=0,f=0,p=0,m=0,d=0,b=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};n.parse=(y,g,v,w)=>{const x=`${r}parse(): `;h=0,f=0,p=0,m=0,d=0,s=void 0,o=void 0,i=void 0,a=void 0,b.refresh(),c=void 0,u=void 0,l=void 0,a=t.stringToChars(v),s=y.rules,o=y.udts;const T=g.toLowerCase();let j;for(const e in s)if(s.hasOwnProperty(e)&&T===s[e].lower){j=s[e].index;break}if(void 0===j)throw new Error(`${x}start rule name '${startRule}' not recognized`);(()=>{const e=`${r}initializeCallbacks(): `;let t,i;for(c=[],u=[],t=0;t<s.length;t+=1)c[t]=void 0;for(t=0;t<o.length;t+=1)u[t]=void 0;const a=[];for(t=0;t<s.length;t+=1)a.push(s[t].lower);for(t=0;t<o.length;t+=1)a.push(o[t].lower);for(const r in n.callbacks)if(n.callbacks.hasOwnProperty(r)){if(t=a.indexOf(r.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${r}' not a rule or udt name`);if(i=n.callbacks[r]?n.callbacks[r]:void 0,"function"!=typeof i&&void 0!==i)throw new Error(`${e}syntax callback[${r}] must be function reference or falsy)`);t<s.length?c[t]=i:u[t-s.length]=i}})(),n.trace&&n.trace.init(s,o,a),n.stats&&n.stats.init(s,o),n.ast&&n.ast.init(s,o,a),l=w,i=[{type:e.RNM,index:j}],E(0,0),i=void 0;let A=!1;switch(b.state){case e.ACTIVE:throw new Error(`${x}final state should never be 'ACTIVE'`);case e.NOMATCH:A=!1;break;case e.EMPTY:case e.MATCH:A=b.phraseLength===a.length;break;default:throw new Error("unrecognized state")}return{success:A,state:b.state,stateName:e.idName(b.state),length:a.length,matched:b.phraseLength,maxMatched:d,maxTreeDepth:p,nodeHits:m}};const v=(t,n,s,o)=>{if(n.phraseLength>s){let e=`${r}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${n.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(n.state){case e.ACTIVE:if(!o)throw new Error(`${r}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:n.phraseLength=0;break;case e.MATCH:0===n.phraseLength&&(n.state=e.EMPTY);break;case e.NOMATCH:n.phraseLength=0;break;default:throw new Error(`${r}opRNM(${t.name}): callback function return error. Unrecognized return state: ${n.state}`)}},w=(t,c)=>{let f,p,m;const d=i[t],y=o[d.index];b.UdtIndex=y.index,h||(m=n.ast&&n.ast.udtDefined(d.index),m&&(p=s.length+d.index,f=n.ast.getLength(),n.ast.down(p,y.name)));const g=a.length-c;u[d.index](b,a,c,l),((t,n,s)=>{if(n.phraseLength>s){let e=`${r}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${n.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(n.state){case e.ACTIVE:throw new Error(`${r}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);n.phraseLength=0;break;case e.MATCH:if(0===n.phraseLength){if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);n.state=e.EMPTY}break;case e.NOMATCH:n.phraseLength=0;break;default:throw new Error(`${r}opUDT(${t.name}): callback function return error. Unrecognized return state: ${n.state}`)}})(y,b,g),h||m&&(b.state===e.NOMATCH?n.ast.setLength(f):n.ast.up(p,y.name,c,b.phraseLength))},E=(t,o)=>{const u=`${r}opExecute(): `,y=i[t];switch(m+=1,f>p&&(p=f),f+=1,b.refresh(),n.trace&&n.trace.down(y,o),y.type){case e.ALT:((t,n)=>{const r=i[t];for(let t=0;t<r.children.length&&(E(r.children[t],n),b.state===e.NOMATCH);t+=1);})(t,o);break;case e.CAT:((t,r)=>{let s,o,a,c;const u=i[t];n.ast&&(o=n.ast.getLength()),s=!0,a=r,c=0;for(let t=0;t<u.children.length;t+=1){if(E(u.children[t],a),b.state===e.NOMATCH){s=!1;break}a+=b.phraseLength,c+=b.phraseLength}s?(b.state=0===c?e.EMPTY:e.MATCH,b.phraseLength=c):(b.state=e.NOMATCH,b.phraseLength=0,n.ast&&n.ast.setLength(o))})(t,o);break;case e.REP:((t,r)=>{let s,o,c,u;const l=i[t];if(0===l.max)return b.state=e.EMPTY,void(b.phraseLength=0);for(o=r,c=0,u=0,n.ast&&(s=n.ast.getLength());!(o>=a.length)&&(E(t+1,o),b.state!==e.NOMATCH)&&b.state!==e.EMPTY&&(u+=1,c+=b.phraseLength,o+=b.phraseLength,u!==l.max););b.state===e.EMPTY||u>=l.min?(b.state=0===c?e.EMPTY:e.MATCH,b.phraseLength=c):(b.state=e.NOMATCH,b.phraseLength=0,n.ast&&n.ast.setLength(s))})(t,o);break;case e.RNM:((t,r)=>{let o,u,f;const p=i[t],m=s[p.index],d=c[m.index];if(h||(u=n.ast&&n.ast.ruleDefined(p.index),u&&(o=n.ast.getLength(),n.ast.down(p.index,s[p.index].name))),d){const t=a.length-r;d(b,a,r,l),v(m,b,t,!0),b.state===e.ACTIVE&&(f=i,i=m.opcodes,E(0,r),i=f,d(b,a,r,l),v(m,b,t,!1))}else f=i,i=m.opcodes,E(0,r,b),i=f;h||u&&(b.state===e.NOMATCH?n.ast.setLength(o):n.ast.up(p.index,m.name,r,b.phraseLength))})(t,o);break;case e.TRG:((t,n)=>{const r=i[t];b.state=e.NOMATCH,n<a.length&&r.min<=a[n]&&a[n]<=r.max&&(b.state=e.MATCH,b.phraseLength=1)})(t,o);break;case e.TBS:((t,n)=>{const r=i[t],s=r.string.length;if(b.state=e.NOMATCH,n+s<=a.length){for(let e=0;e<s;e+=1)if(a[n+e]!==r.string[e])return;b.state=e.MATCH,b.phraseLength=s}})(t,o);break;case e.TLS:((t,n)=>{let r;const s=i[t];b.state=e.NOMATCH;const o=s.string.length;if(0!==o){if(n+o<=a.length){for(let e=0;e<o;e+=1)if(r=a[n+e],r>=65&&r<=90&&(r+=32),r!==s.string[e])return;b.state=e.MATCH,b.phraseLength=o}}else b.state=e.EMPTY})(t,o);break;case e.UDT:w(t,o);break;case e.AND:((t,n)=>{switch(h+=1,E(t+1,n),h-=1,b.phraseLength=0,b.state){case e.EMPTY:case e.MATCH:b.state=e.EMPTY;break;case e.NOMATCH:b.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${b.state}`)}})(t,o);break;case e.NOT:((t,n)=>{switch(h+=1,E(t+1,n),h-=1,b.phraseLength=0,b.state){case e.EMPTY:case e.MATCH:b.state=e.NOMATCH;break;case e.NOMATCH:b.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${b.state}`)}})(t,o);break;default:throw new Error(`${u}unrecognized operator`)}h||o+b.phraseLength>d&&(d=o+b.phraseLength),n.stats&&n.stats.collect(y,b),n.trace&&n.trace.up(y,b.state,o,b.phraseLength),f-=1}},p=function(){const e=g,t=y,n=this;let r,s,o,i=0;const a=[],c=[],u=[];function l(e){let t="";for(;e-- >0;)t+=" ";return t}n.callbacks=[],n.init=(e,t,l)=>{let h;c.length=0,u.length=0,i=0,r=e,s=t,o=l;const f=[];for(h=0;h<r.length;h+=1)f.push(r[h].lower);for(h=0;h<s.length;h+=1)f.push(s[h].lower);for(i=r.length+s.length,h=0;h<i;h+=1)a[h]=void 0;for(const e in n.callbacks)if(n.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(h=f.indexOf(t),h<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);a[h]=n.callbacks[e]}},n.ruleDefined=e=>!!a[e],n.udtDefined=e=>!!a[r.length+e],n.down=(t,n)=>{const r=u.length;return c.push(r),u.push({name:n,thisIndex:r,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),r},n.up=(t,n,r,s)=>{const o=u.length,i=c.pop();return u.push({name:n,thisIndex:o,thatIndex:i,state:e.SEM_POST,callbackIndex:t,phraseIndex:r,phraseLength:s,stack:c.length}),u[i].thatIndex=o,u[i].phraseIndex=r,u[i].phraseLength=s,o},n.translate=t=>{let n,r;for(let s=0;s<u.length;s+=1)r=u[s],n=a[r.callbackIndex],n&&(r.state===e.SEM_PRE?n(e.SEM_PRE,o,r.phraseIndex,r.phraseLength,t):n&&n(e.SEM_POST,o,r.phraseIndex,r.phraseLength,t))},n.setLength=e=>{u.length=e,c.length=e>0?u[e-1].stack:0},n.getLength=()=>u.length,n.toXml=()=>{let n="",r=0;return n+='<?xml version="1.0" encoding="utf-8"?>\n',n+=`<root nodes="${u.length/2}" characters="${o.length}">\n`,n+="\x3c!-- input string --\x3e\n",n+=l(r+2),n+=t.charsToString(o),n+="\n",u.forEach(s=>{s.state===e.SEM_PRE?(r+=1,n+=l(r),n+=`<node name="${s.name}" index="${s.phraseIndex}" length="${s.phraseLength}">\n`,n+=l(r+2),n+=t.charsToString(o,s.phraseIndex,s.phraseLength),n+="\n"):(n+=l(r),n+=`</node>\x3c!-- name="${s.name}" --\x3e\n`,r-=1)}),n+="</root>\n",n}},m=function(){const e=g,t=y,n="parser.js: Trace(): ";let r,s,o,i="",a=0;const c=this,u=e=>{let t="",n=0;if(e>=0)for(;e--;)n+=1,5===n?(t+="|",n=0):t+=".";return t};c.init=(e,t,n)=>{s=e,o=t,r=n};const l=r=>{let i;switch(r.type){case e.ALT:i="ALT";break;case e.CAT:i="CAT";break;case e.REP:i=r.max===1/0?`REP(${r.min},inf)`:`REP(${r.min},${r.max})`;break;case e.RNM:i=`RNM(${s[r.index].name})`;break;case e.TRG:i=`TRG(${r.min},${r.max})`;break;case e.TBS:i=r.string.length>6?`TBS(${t.charsToString(r.string,0,3)}...)`:`TBS(${t.charsToString(r.string,0,6)})`;break;case e.TLS:i=r.string.length>6?`TLS(${t.charsToString(r.string,0,3)}...)`:`TLS(${t.charsToString(r.string,0,6)})`;break;case e.UDT:i=`UDT(${o[r.index].name})`;break;case e.AND:i="AND";break;case e.NOT:i="NOT";break;default:throw new Error(`${n}Trace: opName: unrecognized opcode`)}return i};c.down=(e,n)=>{const s=u(a),o=Math.min(100,r.length-n);let c=t.charsToString(r,n,o);o<r.length-n&&(c+="..."),c=`${s}|-|[${l(e)}]${c}\n`,i+=c,a+=1},c.up=(s,o,c,h)=>{const f=`${n}trace.up: `;a-=1;const p=u(a);let m,d,y;switch(o){case e.EMPTY:y="|E|",d="''";break;case e.MATCH:y="|M|",m=Math.min(100,h),d=m<h?`'${t.charsToString(r,c,m)}...'`:`'${t.charsToString(r,c,m)}'`;break;case e.NOMATCH:y="|N|",d="";break;default:throw new Error(`${f} unrecognized state`)}d=`${p}${y}[${l(s)}]${d}\n`,i+=d},c.displayTrace=()=>i},d=function(){const e=g;let t,n,r;const s=[],o=[],i=[];this.init=(e,r)=>{t=e,n=r,f()},this.collect=(t,n)=>{p(r,n.state,n.phraseLength),p(s[t.type],n.state,n.phraseLength),t.type===e.RNM&&p(o[t.index],n.state,n.phraseLength),t.type===e.UDT&&p(i[t.index],n.state,n.phraseLength)},this.displayStats=()=>{let t="";const n={match:0,empty:0,nomatch:0,total:0},r=(e,t,r,s,o)=>{n.match+=t,n.empty+=r,n.nomatch+=s,n.total+=o;return`${e} | ${a(t)} | ${a(r)} | ${a(s)} | ${a(o)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=r(" ALT",s[e.ALT].match,s[e.ALT].empty,s[e.ALT].nomatch,s[e.ALT].total),t+=r(" CAT",s[e.CAT].match,s[e.CAT].empty,s[e.CAT].nomatch,s[e.CAT].total),t+=r(" REP",s[e.REP].match,s[e.REP].empty,s[e.REP].nomatch,s[e.REP].total),t+=r(" RNM",s[e.RNM].match,s[e.RNM].empty,s[e.RNM].nomatch,s[e.RNM].total),t+=r(" TRG",s[e.TRG].match,s[e.TRG].empty,s[e.TRG].nomatch,s[e.TRG].total),t+=r(" TBS",s[e.TBS].match,s[e.TBS].empty,s[e.TBS].nomatch,s[e.TBS].total),t+=r(" TLS",s[e.TLS].match,s[e.TLS].empty,s[e.TLS].nomatch,s[e.TLS].total),t+=r(" UDT",s[e.UDT].match,s[e.UDT].empty,s[e.UDT].nomatch,s[e.UDT].total),t+=r(" AND",s[e.AND].match,s[e.AND].empty,s[e.AND].nomatch,s[e.AND].total),t+=r(" NOT",s[e.NOT].match,s[e.NOT].empty,s[e.NOT].nomatch,s[e.NOT].total),t+=r("TOTAL",n.match,n.empty,n.nomatch,n.total),t},this.displayHits=e=>{let t="";const n=(e,t,n,s,o)=>{r.match+=e,r.empty+=t,r.nomatch+=n,r.total+=s;return`| ${a(e)} | ${a(t)} | ${a(n)} | ${a(s)} | ${o}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(o.sort(c),i.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(o.sort(l),i.sort(l),t+=" RULES/UDTS BY INDEX\n"):(o.sort(u),i.sort(u),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<o.length;e+=1){let r=o[e];r.total&&(t+=n(r.match,r.empty,r.nomatch,r.total,r.name))}for(let e=0;e<i.length;e+=1){let r=i[e];r.total&&(t+=n(r.match,r.empty,r.nomatch,r.total,r.name))}return t};const a=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,u=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),l=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,h=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},f=()=>{s.length=0,r=new h,s[e.ALT]=new h,s[e.CAT]=new h,s[e.REP]=new h,s[e.RNM]=new h,s[e.TRG]=new h,s[e.TBS]=new h,s[e.TLS]=new h,s[e.UDT]=new h,s[e.AND]=new h,s[e.NOT]=new h,o.length=0;for(let e=0;e<t.length;e+=1)o.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(n.length>0){i.length=0;for(let e=0;e<n.length;e+=1)i.push({empty:0,match:0,nomatch:0,total:0,name:n[e].name,lower:n[e].lower,index:n[e].index})}},p=(t,n)=>{switch(t.total+=1,n){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${n}`)}}},y={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,n)=>{let r=e;for(;!(void 0===t||t<0);){if(void 0===n){r=e.slice(t);break}if(n<=0)return"";r=e.slice(t,t+n);break}return String.fromCodePoint(...r)}},g={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 g.ALT:return"ALT";case g.CAT:return"CAT";case g.REP:return"REP";case g.RNM:return"RNM";case g.TRG:return"TRG";case g.TBS:return"TBS";case g.TLS:return"TLS";case g.UDT:return"UDT";case g.AND:return"AND";case g.NOT:return"NOT";case g.ACTIVE:return"ACTIVE";case g.EMPTY:return"EMPTY";case g.MATCH:return"MATCH";case g.NOMATCH:return"NOMATCH";case g.SEM_PRE:return"SEM_PRE";case g.SEM_POST:return"SEM_POST";case g.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};function b(){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 v 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,...n}=t;Object.assign(this,n)}}}const w=v;const E=class extends w{},x=e=>(t,n,r,s,o)=>{if("object"!=typeof o||null===o||Array.isArray(o))throw new E("parser's user data must be an object");if(t===g.SEM_PRE){const t={type:e,text:y.charsToString(n,r,s),start:r,length:s,children:[]};if(o.stack.length>0){o.stack[o.stack.length-1].children.push(t)}else o.root=t;o.stack.push(t)}t===g.SEM_POST&&o.stack.pop()};const T=class extends p{constructor(){super(),this.callbacks["json-pointer"]=x("json-pointer"),this.callbacks["reference-token"]=x("reference-token"),this.callbacks.slash=x("text")}getTree(){const e={stack:[],root:null};return this.translate(e),delete e.stack,e}},j=e=>{if("string"!=typeof e)throw new TypeError("Reference token must be a string");return e.replace(/~1/g,"/").replace(/~0/g,"~")};const A=class extends T{getTree(){const{root:e}=super.getTree();return e.children.filter(({type:e})=>"reference-token"===e).map(({text:e})=>j(e))}};const k=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const O=class extends m{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let n=-1;for(let r=0;r<e.length;r++){const s=e[r];if(s.includes("M|")){const e=s.match(/]'(.*)'$/);e&&e[1]&&(n=r)}if(r>n){const e=s.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new k(...t)}},S=new b,P=(e,{translator:t=new A,stats:n=!1,trace:r=!1}={})=>{if("string"!=typeof e)throw new TypeError("JSON Pointer must be a string");try{const s=new f;t&&(s.ast=t),n&&(s.stats=new d),r&&(s.trace=new O);const o=s.parse(S,"json-pointer",e);return{result:o,tree:o.success&&t?s.ast.getTree():void 0,stats:s.stats,trace:s.trace}}catch(t){throw new E("Unexpected error during JSON Pointer parsing",{cause:t,jsonPointer:e})}};new b,new f,new b,new f;const M=new b,_=new f,N=e=>{if("string"!=typeof e)return!1;try{return _.parse(M,"array-index",e).success}catch{return!1}},C=new b,$=new f,R=e=>{if("string"!=typeof e)return!1;try{return $.parse(C,"array-dash",e).success}catch{return!1}},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 I=class extends w{},V=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 I("Unexpected error during JSON Pointer compilation",{cause:t,referenceTokens:e})}};const D=class{#e;#t;#n;constructor(e,t={}){this.#e=e,this.#e.steps=[],this.#e.failed=!1,this.#e.failedAt=-1,this.#e.message=`JSON Pointer "${t.jsonPointer}" was successfully evaluated against the provided value`,this.#e.context={...t,realm:t.realm.name},this.#t=[],this.#n=t.realm}step({referenceToken:e,input:t,output:n,success:r=!0,reason:s}){const o=this.#t.length;this.#t.push(e);const i={referenceToken:e,referenceTokenPosition:o,input:t,inputType:this.#n.isObject(t)?"object":this.#n.isArray(t)?"array":"unrecognized",output:n,success:r};s&&(i.reason=s),this.#e.steps.push(i),r||(this.#e.failed=!0,this.#e.failedAt=o,this.#e.message=s)}};const B=class{name="";isArray(e){throw new w("Realm.isArray(node) must be implemented in a subclass")}isObject(e){throw new w("Realm.isObject(node) must be implemented in a subclass")}sizeOf(e){throw new w("Realm.sizeOf(node) must be implemented in a subclass")}has(e,t){throw new w("Realm.has(node) must be implemented in a subclass")}evaluate(e,t){throw new w("Realm.evaluate(node) must be implemented in a subclass")}};const z=class extends w{};const F=class extends z{};const U=class extends B{name="json";isArray(e){return Array.isArray(e)}isObject(e){return"object"==typeof e&&null!==e&&!this.isArray(e)}sizeOf(e){return this.isArray(e)?e.length:this.isObject(e)?Object.keys(e).length:0}has(e,t){if(this.isArray(e)){const n=Number(t),r=n>>>0;if(n!==r)throw new F(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return r<this.sizeOf(e)&&Object.prototype.hasOwnProperty.call(e,n)}return!!this.isObject(e)&&Object.prototype.hasOwnProperty.call(e,t)}evaluate(e,t){return this.isArray(e)?e[Number(t)]:e[t]}};const H=class extends z{};const q=class extends z{},G=(e,t,{strictArrays:n=!0,strictObjects:r=!0,realm:s=new U,trace:o=!0}={})=>{const{result:i,tree:a,trace:c}=P(t,{trace:!!o}),u="object"==typeof o&&null!==o?new D(o,{jsonPointer:t,referenceTokens:a,strictArrays:n,strictObjects:r,realm:s,value:e}):null;try{let o;if(!i.success){let n=`Invalid JSON Pointer: "${t}". Syntax error at position ${i.maxMatched}`;throw n+=c?`, expected ${c.inferExpectations()}`:"",new z(n,{jsonPointer:t,currentValue:e,realm:s.name})}return a.reduce((e,i,c)=>{if(s.isArray(e)){if(R(i)){if(n)throw new F(`Invalid array index "-" at position ${c} in "${t}". The "-" token always refers to a nonexistent element during evaluation`,{jsonPointer:t,referenceTokens:a,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});return o=s.evaluate(e,String(s.sizeOf(e))),null==u||u.step({referenceToken:i,input:e,output:o}),o}if(!N(i))throw new F(`Invalid array index "${i}" at position ${c} in "${t}": index MUST be "0", or digits without a leading "0"`,{jsonPointer:t,referenceTokens:a,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});const r=Number(i);if(!Number.isSafeInteger(r))throw new F(`Invalid array index "${i}" at position ${c} in "${t}": index must be a safe integer`,{jsonPointer:t,referenceTokens:a,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});if(!s.has(e,i)&&n)throw new F(`Invalid array index "${i}" at position ${c} in "${t}": index not found in array`,{jsonPointer:t,referenceTokens:a,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});return o=s.evaluate(e,i),null==u||u.step({referenceToken:i,input:e,output:o}),o}if(s.isObject(e)){if(!s.has(e,i)&&r)throw new q(`Invalid object key "${i}" at position ${c} in "${t}": key not found in object`,{jsonPointer:t,referenceTokens:a,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name});return o=s.evaluate(e,i),null==u||u.step({referenceToken:i,input:e,output:o}),o}throw new H(`Invalid reference token "${i}" at position ${c} in "${t}": cannot be applied to a non-object/non-array value`,{jsonPointer:t,referenceTokens:a,referenceToken:i,referenceTokenPosition:c,currentValue:e,realm:s.name})},e)}catch(e){if(null==u||u.step({referenceToken:e.referenceToken,input:e.currentValue,success:!1,reason:e.message}),e instanceof z)throw e;throw new z("Unexpected error during JSON Pointer evaluation",{cause:e,jsonPointer:t,referenceTokens:a})}};const J=new RegExp("^(?<nonNegativeIntegerPrefix>[1-9]\\d*|0)(?<indexManipulation>[+-][1-9]\\d*|0)?((?<hashCharacter>#)|(?<jsonPointer>\\/.*))?$"),Y=e=>"string"==typeof e&&J.test(e),K=e=>{const t=e.match(J);if(null===t||void 0===t.groups)throw new u(`Invalid Relative JSON Pointer "${e}".`,{relativePointer:e});try{const e=parseInt(t.groups.nonNegativeIntegerPrefix,10),n="string"==typeof t.groups.indexManipulation?parseInt(t.groups.indexManipulation,10):void 0,r="string"==typeof t.groups.jsonPointer?P(t.groups.jsonPointer).tree:void 0;return{nonNegativeIntegerPrefix:e,indexManipulation:n,jsonPointerTokens:r,hashCharacter:"string"==typeof t.groups.hashCharacter}}catch(t){throw new u(`Relative JSON Pointer parsing of "${e}" encountered an error.`,{relativePointer:e,cause:t})}},W=e=>{try{let t="";return t+=String(e.nonNegativeIntegerPrefix),"number"==typeof e.indexManipulation&&(t+=String(e.indexManipulation)),Array.isArray(e.jsonPointerTokens)?t+=V(e.jsonPointerTokens):e.hashCharacter&&(t+="#"),t}catch(t){throw new h("Relative JSON Pointer compilation encountered an error.",{relativePointer:e,cause:t})}};function X(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,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,s){return t.apply(this,arguments)};case 5:return function(e,n,r,s,o){return t.apply(this,arguments)};case 6:return function(e,n,r,s,o,i){return t.apply(this,arguments)};case 7:return function(e,n,r,s,o,i,a){return t.apply(this,arguments)};case 8:return function(e,n,r,s,o,i,a,c){return t.apply(this,arguments)};case 9:return function(e,n,r,s,o,i,a,c,u){return t.apply(this,arguments)};case 10:return function(e,n,r,s,o,i,a,c,u,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function Z(e,t){return function(){return t.call(this,e.apply(this,arguments))}}function Q(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function ee(e){return function t(n){return 0===arguments.length||Q(n)?t:e.apply(this,arguments)}}function te(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return Q(n)?t:ee(function(t){return e(n,t)});default:return Q(n)&&Q(r)?t:Q(n)?ee(function(t){return e(t,r)}):Q(r)?ee(function(t){return e(n,t)}):e(n,r)}}}function ne(e){return function t(n,r,s){switch(arguments.length){case 0:return t;case 1:return Q(n)?t:te(function(t,r){return e(n,t,r)});case 2:return Q(n)&&Q(r)?t:Q(n)?te(function(t,n){return e(t,r,n)}):Q(r)?te(function(t,r){return e(n,t,r)}):ee(function(t){return e(n,r,t)});default:return Q(n)&&Q(r)&&Q(s)?t:Q(n)&&Q(r)?te(function(t,n){return e(t,n,s)}):Q(n)&&Q(s)?te(function(t,n){return e(t,r,n)}):Q(r)&&Q(s)?te(function(t,r){return e(n,t,r)}):Q(n)?ee(function(t){return e(t,r,s)}):Q(r)?ee(function(t){return e(n,t,s)}):Q(s)?ee(function(t){return e(n,r,t)}):e(n,r,s)}}}const re=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};function se(e){return"[object String]"===Object.prototype.toString.call(e)}const oe=ee(function(e){return!!re(e)||!!e&&("object"==typeof e&&(!se(e)&&(0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))});var ie="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function ae(e,t,n){return function(r,s,o){if(oe(o))return e(r,s,o);if(null==o)return s;if("function"==typeof o["fantasy-land/reduce"])return t(r,s,o,"fantasy-land/reduce");if(null!=o[ie])return n(r,s,o[ie]());if("function"==typeof o.next)return n(r,s,o);if("function"==typeof o.reduce)return t(r,s,o,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function ce(e,t,n){for(var r=0,s=n.length;r<s;){if((t=e["@@transducer/step"](t,n[r]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r+=1}return e["@@transducer/result"](t)}const ue=te(function(e,t){return X(e.length,function(){return e.apply(t,arguments)})});function le(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function he(e,t,n,r){return e["@@transducer/result"](n[r](ue(e["@@transducer/step"],e),t))}const fe=ae(ce,he,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 me=ne(function(e,t,n){return fe("function"==typeof e?new pe(e):e,t,n)});function de(e,t){return function(){var n=arguments.length;if(0===n)return t();var r=arguments[n-1];return re(r)||"function"!=typeof r[e]?t.apply(this,arguments):r[e].apply(r,Array.prototype.slice.call(arguments,0,n-1))}}const ye=ne(de("slice",function(e,t,n){return Array.prototype.slice.call(n,e,t)}));const ge=ee(de("tail",ye(1,1/0)));function be(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return X(arguments[0].length,me(Z,arguments[0],ge(arguments)))}function ve(e,t,n){return function(){for(var r=[],s=0,o=e,i=0,a=!1;i<t.length||s<arguments.length;){var c;i<t.length&&(!Q(t[i])||s>=arguments.length)?c=t[i]:(c=arguments[s],s+=1),r[i]=c,Q(c)?a=!0:o-=1,i+=1}return!a&&o<=0?n.apply(this,r):X(Math.max(0,o),ve(e,r,n))}}const we=te(function(e,t){return 1===e?ee(t):X(e,ve(e,[],t))});const Ee=ee(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-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};var Te=function(e,t){switch(arguments.length){case 0:return Te;case 1:return function t(n){return 0===arguments.length?t:xe(e,n)};default:return xe(e,t)}};const je=Te;const Ae=we(1,be(Ee,je("String"))),ke=(e,t,n)=>{const r=e[t];if(null!=r){if(!n&&"function"==typeof r)return r;const e=n?r.leave:r.enter;if("function"==typeof e)return e}else{const r=n?e.leave:e.enter;if(null!=r){if("function"==typeof r)return r;const e=r[t];if("function"==typeof e)return e}}return null},Oe={},Se=e=>e?.type,Pe=e=>"string"==typeof Se(e),Me=e=>Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e)),_e=(e,{visitFnGetter:t=ke,nodeTypeGetter:n=Se,breakSymbol:r=Oe,deleteNodeSymbol:s=null,skipVisitingNodeSymbol:o=!1,exposeEdits:i=!1}={})=>{const c=Symbol("skip"),u=new Array(e.length).fill(c);return{enter(l,h,f,p,m,d){let y=l,g=!1;const b={...d,replaceWith(e,t){d.replaceWith(e,t),y=e}};for(let l=0;l<e.length;l+=1)if(u[l]===c){const c=t(e[l],n(y),!1);if("function"==typeof c){const t=c.call(e[l],y,h,f,p,m,b);if("function"==typeof t?.then)throw new a("Async visitor not supported in sync mode",{visitor:e[l],visitFn:c});if(t===o)u[l]=y;else if(t===r)u[l]=r;else{if(t===s)return t;if(void 0!==t){if(!i)return t;y=t,g=!0}}}}return g?y:void 0},leave(s,i,l,h,f,p){let m=s;const d={...p,replaceWith(e,t){p.replaceWith(e,t),m=e}};for(let s=0;s<e.length;s+=1)if(u[s]===c){const c=t(e[s],n(m),!0);if("function"==typeof c){const t=c.call(e[s],m,i,l,h,f,d);if("function"==typeof t?.then)throw new a("Async visitor not supported in sync mode",{visitor:e[s],visitFn:c});if(t===r)u[s]=r;else if(void 0!==t&&t!==o)return t}}else u[s]===m&&(u[s]=c)}}};_e[Symbol.for("nodejs.util.promisify.custom")]=(e,{visitFnGetter:t=ke,nodeTypeGetter:n=Se,breakSymbol:r=Oe,deleteNodeSymbol:s=null,skipVisitingNodeSymbol:o=!1,exposeEdits:i=!1}={})=>{const a=Symbol("skip"),c=new Array(e.length).fill(a);return{async enter(u,l,h,f,p,m){let d=u,y=!1;const g={...m,replaceWith(e,t){m.replaceWith(e,t),d=e}};for(let u=0;u<e.length;u+=1)if(c[u]===a){const a=t(e[u],n(d),!1);if("function"==typeof a){const t=await a.call(e[u],d,l,h,f,p,g);if(t===o)c[u]=d;else if(t===r)c[u]=r;else{if(t===s)return t;if(void 0!==t){if(!i)return t;d=t,y=!0}}}}return y?d:void 0},async leave(s,i,u,l,h,f){let p=s;const m={...f,replaceWith(e,t){f.replaceWith(e,t),p=e}};for(let s=0;s<e.length;s+=1)if(c[s]===a){const a=t(e[s],n(p),!0);if("function"==typeof a){const t=await a.call(e[s],p,i,u,l,h,m);if(t===r)c[s]=r;else if(void 0!==t&&t!==o)return t}}else c[s]===p&&(c[s]=a)}}};const Ne=(e,t,{keyMap:n=null,state:r={},breakSymbol:s=Oe,deleteNodeSymbol:o=null,skipVisitingNodeSymbol:i=!1,visitFnGetter:c=ke,nodeTypeGetter:u=Se,nodePredicate:l=Pe,nodeCloneFn:h=Me,detectCycles:f=!0}={})=>{const p=n||{};let m,d,y=Array.isArray(e),g=[e],b=-1,v=[],w=e;const E=[],x=[];do{b+=1;const e=b===g.length;let n;const T=e&&0!==v.length;if(e){if(n=0===x.length?void 0:E.pop(),w=d,d=x.pop(),T)if(y){w=w.slice();let e=0;for(const[t,n]of v){const r=t-e;n===o?(w.splice(r,1),e+=1):w[r]=n}}else{w=h(w);for(const[e,t]of v)w[e]=t}b=m.index,g=m.keys,v=m.edits,y=m.inArray,m=m.prev}else if(d!==o&&void 0!==d){if(n=y?b:g[b],w=d[n],w===o||void 0===w)continue;E.push(n)}let j;if(!Array.isArray(w)){if(!l(w))throw new a(`Invalid AST Node: ${String(w)}`,{node:w});if(f&&x.includes(w)){E.pop();continue}const o=c(t,u(w),e);if(o){for(const[e,n]of Object.entries(r))t[e]=n;const s={replaceWith(t,r){"function"==typeof r?r(t,w,n,d,E,x):d&&(d[n]=t),e||(w=t)}};j=o.call(t,w,n,d,E,x,s)}if("function"==typeof j?.then)throw new a("Async visitor not supported in sync mode",{visitor:t,visitFn:o});if(j===s)break;if(j===i){if(!e){E.pop();continue}}else if(void 0!==j&&(v.push([n,j]),!e)){if(!l(j)){E.pop();continue}w=j}}void 0===j&&T&&v.push([n,w]),e||(m={inArray:y,index:b,keys:g,edits:v,prev:m},y=Array.isArray(w),g=y?w:p[u(w)]??[],b=-1,v=[],d!==o&&void 0!==d&&x.push(d),d=w)}while(void 0!==m);return 0!==v.length?v.at(-1)[1]:e};Ne[Symbol.for("nodejs.util.promisify.custom")]=async(e,t,{keyMap:n=null,state:r={},breakSymbol:s=Oe,deleteNodeSymbol:o=null,skipVisitingNodeSymbol:i=!1,visitFnGetter:c=ke,nodeTypeGetter:u=Se,nodePredicate:l=Pe,nodeCloneFn:h=Me,detectCycles:f=!0}={})=>{const p=n||{};let m,d,y=Array.isArray(e),g=[e],b=-1,v=[],w=e;const E=[],x=[];do{b+=1;const e=b===g.length;let n;const T=e&&0!==v.length;if(e){if(n=0===x.length?void 0:E.pop(),w=d,d=x.pop(),T)if(y){w=w.slice();let e=0;for(const[t,n]of v){const r=t-e;n===o?(w.splice(r,1),e+=1):w[r]=n}}else{w=h(w);for(const[e,t]of v)w[e]=t}b=m.index,g=m.keys,v=m.edits,y=m.inArray,m=m.prev}else if(d!==o&&void 0!==d){if(n=y?b:g[b],w=d[n],w===o||void 0===w)continue;E.push(n)}let j;if(!Array.isArray(w)){if(!l(w))throw new a(`Invalid AST Node: ${String(w)}`,{node:w});if(f&&x.includes(w)){E.pop();continue}const o=c(t,u(w),e);if(o){for(const[e,n]of Object.entries(r))t[e]=n;const s={replaceWith(t,r){"function"==typeof r?r(t,w,n,d,E,x):d&&(d[n]=t),e||(w=t)}};j=await o.call(t,w,n,d,E,x,s)}if(j===s)break;if(j===i){if(!e){E.pop();continue}}else if(void 0!==j&&(v.push([n,j]),!e)){if(!l(j)){E.pop();continue}w=j}}void 0===j&&T&&v.push([n,w]),e||(m={inArray:y,index:b,keys:g,edits:v,prev:m},y=Array.isArray(w),g=y?w:p[u(w)]??[],b=-1,v=[],d!==o&&void 0!==d&&x.push(d),d=w)}while(void 0!==m);return 0!==v.length?v.at(-1)[1]:e};var Ce=n(8326);function $e(e,t,n){return function(){if(0===arguments.length)return n();var r=arguments[arguments.length-1];if(!re(r)){for(var s=0;s<e.length;){if("function"==typeof r[e[s]])return r[e[s]].apply(r,Array.prototype.slice.call(arguments,0,-1));s+=1}if(function(e){return null!=e&&"function"==typeof e["@@transducer/step"]}(r))return t.apply(null,Array.prototype.slice.call(arguments,0,-1))(r)}return n.apply(this,arguments)}}const Re=function(){return this.xf["@@transducer/init"]()},Le=function(e){return this.xf["@@transducer/result"](e)};var Ie=function(){function e(e,t){this.xf=t,this.f=e,this.all=!0}return e.prototype["@@transducer/init"]=Re,e.prototype["@@transducer/result"]=function(e){return this.all&&(e=this.xf["@@transducer/step"](e,!0)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){var n;return this.f(t)||(this.all=!1,e=(n=this.xf["@@transducer/step"](e,!1))&&n["@@transducer/reduced"]?n:{"@@transducer/value":n,"@@transducer/reduced":!0}),e},e}();function Ve(e){return function(t){return new Ie(e,t)}}const De=te($e(["all"],Ve,function(e,t){for(var n=0;n<t.length;){if(!e(t[n]))return!1;n+=1}return!0}));const Be=ee(function(e){return we(e.length,function(t,n){var r=Array.prototype.slice.call(arguments,0);return r[0]=n,r[1]=t,e.apply(this,r)})});function ze(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function Fe(e,t,n){for(var r=0,s=n.length;r<s;){if(e(t,n[r]))return!0;r+=1}return!1}function Ue(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var He=Object.prototype.toString;const qe=function(){return"[object Arguments]"===He.call(arguments)?function(e){return"[object Arguments]"===He.call(e)}:function(e){return Ue("callee",e)}}();var Ge=!{toString:null}.propertyIsEnumerable("toString"),Je=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Ye=function(){return arguments.propertyIsEnumerable("length")}(),Ke=function(e,t){for(var n=0;n<e.length;){if(e[n]===t)return!0;n+=1}return!1},We="function"!=typeof Object.keys||Ye?ee(function(e){if(Object(e)!==e)return[];var t,n,r=[],s=Ye&&qe(e);for(t in e)!Ue(t,e)||s&&"length"===t||(r[r.length]=t);if(Ge)for(n=Je.length-1;n>=0;)Ue(t=Je[n],e)&&!Ke(r,t)&&(r[r.length]=t),n-=1;return r}):ee(function(e){return Object(e)!==e?[]:Object.keys(e)});const Xe=We;function Ze(e,t,n,r){var s=ze(e);function o(e,t){return Qe(e,t,n.slice(),r.slice())}return!Fe(function(e,t){return!Fe(o,t,e)},ze(t),s)}function Qe(e,t,n,r){if(xe(e,t))return!0;var s,o,i=Ee(e);if(i!==Ee(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(s=e.constructor,null==(o=String(s).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 a=n.length-1;a>=0;){if(n[a]===e)return r[a]===t;a-=1}switch(i){case"Map":return e.size===t.size&&Ze(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&Ze(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=Xe(e);if(c.length!==Xe(t).length)return!1;var u=n.concat([e]),l=r.concat([t]);for(a=c.length-1;a>=0;){var h=c[a];if(!Ue(h,t)||!Qe(t[h],e[h],u,l))return!1;a-=1}return!0}const et=te(function(e,t){return Qe(e,t,[],[])});function tt(e,t){return function(e,t,n){var r,s;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(r=1/t;n<e.length;){if(0===(s=e[n])&&1/s===r)return n;n+=1}return-1}if(t!=t){for(;n<e.length;){if("number"==typeof(s=e[n])&&s!=s)return n;n+=1}return-1}return e.indexOf(t,n);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,n);case"object":if(null===t)return e.indexOf(t,n)}for(;n<e.length;){if(et(e[n],t))return n;n+=1}return-1}(t,e,0)>=0}const nt=Be(te(tt));class rt extends Ce.Om{constructor(e,t,n){super(e,t,n),this.element="annotation"}get code(){return this.attributes.get("code")}set code(e){this.attributes.set("code",e)}}const st=rt;class ot extends Ce.Om{constructor(e,t,n){super(e,t,n),this.element="comment"}}const it=ot;var at=ee(function(e){return function(){return e}})(void 0);const ct=et(at());class ut extends Ce.wE{constructor(e,t,n){super(e,t,n),this.element="parseResult"}get api(){return this.children.filter(e=>e.classes.contains("api")).first}get results(){return this.children.filter(e=>e.classes.contains("result"))}get result(){return this.results.first}get annotations(){return this.children.filter(e=>"annotation"===e.element)}get warnings(){return this.children.filter(e=>"annotation"===e.element&&e.classes.contains("warning"))}get errors(){return this.children.filter(e=>"annotation"===e.element&&e.classes.contains("error"))}get isEmpty(){return this.children.reject(e=>"annotation"===e.element).isEmpty}replaceResult(e){const{result:t}=this;if(ct(t))return!1;const n=this.content.findIndex(e=>e===t);return-1!==n&&(this.content[n]=e,!0)}}const lt=ut;class ht extends Ce.wE{constructor(e,t,n){super(e,t,n),this.element="sourceMap"}get positionStart(){return this.children.filter(e=>e.classes.contains("position")).get(0)}get positionEnd(){return this.children.filter(e=>e.classes.contains("position")).get(1)}set position(e){if(void 0===e)return;const t=new Ce.wE([e.start.row,e.start.column,e.start.char]),n=new Ce.wE([e.end.row,e.end.column,e.end.char]);t.classes.push("position"),n.classes.push("position"),this.push(t).push(n)}}const ft=ht,pt=(e,t)=>"object"==typeof t&&null!==t&&e in t&&"function"==typeof t[e],mt=e=>"object"==typeof e&&null!=e&&"_storedElement"in e&&"string"==typeof e._storedElement&&"_content"in e,dt=(e,t)=>"object"==typeof t&&null!==t&&"primitive"in t&&("function"==typeof t.primitive&&t.primitive()===e),yt=(e,t)=>"object"==typeof t&&null!==t&&"classes"in t&&(Array.isArray(t.classes)||t.classes instanceof Ce.wE)&&t.classes.includes(e),gt=(e,t)=>"object"==typeof t&&null!==t&&"element"in t&&t.element===e,bt=e=>e({hasMethod:pt,hasBasicElementProps:mt,primitiveEq:dt,isElementType:gt,hasClass:yt}),vt=bt(({hasBasicElementProps:e,primitiveEq:t})=>n=>n instanceof Ce.Hg||e(n)&&t(void 0,n)),wt=bt(({hasBasicElementProps:e,primitiveEq:t})=>n=>n instanceof Ce.Om||e(n)&&t("string",n)),Et=bt(({hasBasicElementProps:e,primitiveEq:t})=>n=>n instanceof Ce.kT||e(n)&&t("number",n)),xt=bt(({hasBasicElementProps:e,primitiveEq:t})=>n=>n instanceof Ce.Os||e(n)&&t("null",n)),Tt=bt(({hasBasicElementProps:e,primitiveEq:t})=>n=>n instanceof Ce.bd||e(n)&&t("boolean",n)),jt=bt(({hasBasicElementProps:e,primitiveEq:t,hasMethod:n})=>r=>r instanceof Ce.Sh||e(r)&&t("object",r)&&n("keys",r)&&n("values",r)&&n("items",r)),At=bt(({hasBasicElementProps:e,primitiveEq:t,hasMethod:n})=>r=>r instanceof Ce.wE&&!(r instanceof Ce.Sh)||e(r)&&t("array",r)&&n("push",r)&&n("unshift",r)&&n("map",r)&&n("reduce",r)),kt=bt(({hasBasicElementProps:e,isElementType:t,primitiveEq:n})=>r=>r instanceof Ce.Pr||e(r)&&t("member",r)&&n(void 0,r)),Ot=bt(({hasBasicElementProps:e,isElementType:t,primitiveEq:n})=>r=>r instanceof Ce.Ft||e(r)&&t("link",r)&&n(void 0,r)),St=bt(({hasBasicElementProps:e,isElementType:t,primitiveEq:n})=>r=>r instanceof Ce.sI||e(r)&&t("ref",r)&&n(void 0,r)),Pt=bt(({hasBasicElementProps:e,isElementType:t,primitiveEq:n})=>r=>r instanceof st||e(r)&&t("annotation",r)&&n("array",r)),Mt=bt(({hasBasicElementProps:e,isElementType:t,primitiveEq:n})=>r=>r instanceof it||e(r)&&t("comment",r)&&n("string",r)),_t=bt(({hasBasicElementProps:e,isElementType:t,primitiveEq:n})=>r=>r instanceof lt||e(r)&&t("parseResult",r)&&n("array",r)),Nt=bt(({hasBasicElementProps:e,isElementType:t,primitiveEq:n})=>r=>r instanceof ft||e(r)&&t("sourceMap",r)&&n("array",r)),Ct=e=>gt("object",e)||gt("array",e)||gt("boolean",e)||gt("number",e)||gt("string",e)||gt("null",e)||gt("member",e),$t=e=>Nt(e.meta.get("sourceMap")),Rt=(e,t)=>{if(0===e.length)return!0;const n=t.attributes.get("symbols");return!!At(n)&&De(nt(n.toValue()),e)},Lt=(e,t)=>0===e.length||De(nt(t.classes.toValue()),e);const It=class extends a{value;constructor(e,t){super(e,t),void 0!==t&&(this.value=t.value)}};const Vt=class extends It{};const Dt=class extends It{},Bt=(e,t={})=>{const{visited:n=new WeakMap}=t,r={...t,visited:n};if(n.has(e))return n.get(e);if(e instanceof Ce.KeyValuePair){const{key:t,value:s}=e,o=vt(t)?Bt(t,r):t,i=vt(s)?Bt(s,r):s,a=new Ce.KeyValuePair(o,i);return n.set(e,a),a}if(e instanceof Ce.ot){const t=e=>Bt(e,r),s=[...e].map(t),o=new Ce.ot(s);return n.set(e,o),o}if(e instanceof Ce.G6){const t=e=>Bt(e,r),s=[...e].map(t),o=new Ce.G6(s);return n.set(e,o),o}if(vt(e)){const t=Ut(e);if(n.set(e,t),e.content)if(vt(e.content))t.content=Bt(e.content,r);else if(e.content instanceof Ce.KeyValuePair)t.content=Bt(e.content,r);else if(Array.isArray(e.content)){const n=e=>Bt(e,r);t.content=e.content.map(n)}else t.content=e.content;else t.content=e.content;return t}throw new Vt("Value provided to cloneDeep function couldn't be cloned",{value:e})};Bt.safe=e=>{try{return Bt(e)}catch{return e}};const zt=e=>{const{key:t,value:n}=e;return new Ce.KeyValuePair(t,n)},Ft=e=>{const t=new e.constructor;if(t.element=e.element,e.meta.length>0&&(t._meta=Bt(e.meta)),e.attributes.length>0&&(t._attributes=Bt(e.attributes)),vt(e.content)){const n=e.content;t.content=Ft(n)}else Array.isArray(e.content)?t.content=[...e.content]:e.content instanceof Ce.KeyValuePair?t.content=zt(e.content):t.content=e.content;return t},Ut=e=>{if(e instanceof Ce.KeyValuePair)return zt(e);if(e instanceof Ce.ot)return(e=>{const t=[...e];return new Ce.ot(t)})(e);if(e instanceof Ce.G6)return(e=>{const t=[...e];return new Ce.G6(t)})(e);if(vt(e))return Ft(e);throw new Dt("Value provided to cloneShallow function couldn't be cloned",{value:e})};Ut.safe=e=>{try{return Ut(e)}catch{return e}};const Ht=e=>jt(e)?"ObjectElement":At(e)?"ArrayElement":kt(e)?"MemberElement":wt(e)?"StringElement":Tt(e)?"BooleanElement":Et(e)?"NumberElement":xt(e)?"NullElement":Ot(e)?"LinkElement":St(e)?"RefElement":void 0,qt=e=>vt(e)?Ut(e):Me(e),Gt=be(Ht,Ae),Jt={ObjectElement:["content"],ArrayElement:["content"],MemberElement:["key","value"],StringElement:[],BooleanElement:[],NumberElement:[],NullElement:[],RefElement:[],LinkElement:[],Annotation:[],Comment:[],ParseResultElement:["content"],SourceMap:["content"]};const Yt=(e,t,{keyMap:n=Jt,...r}={})=>Ne(e,t,{keyMap:n,nodeTypeGetter:Ht,nodePredicate:Gt,nodeCloneFn:qt,...r});function Kt(e){return"[object Object]"===Object.prototype.toString.call(e)}Yt[Symbol.for("nodejs.util.promisify.custom")]=async(e,t,{keyMap:n=Jt,...r}={})=>Ne[Symbol.for("nodejs.util.promisify.custom")](e,t,{keyMap:n,nodeTypeGetter:Ht,nodePredicate:Gt,nodeCloneFn:qt,...r});const Wt=ne(function(e,t,n){var r,s={};for(r in n=n||{},t=t||{})Ue(r,t)&&(s[r]=Ue(r,n)?e(r,t[r],n[r]):t[r]);for(r in n)Ue(r,n)&&!Ue(r,s)&&(s[r]=n[r]);return s});const Xt=ne(function e(t,n,r){return Wt(function(n,r,s){return Kt(r)&&Kt(s)?e(t,r,s):t(n,r,s)},n,r)});const Zt=te(function(e,t){return Xt(function(e,t,n){return n},e,t)});const Qt=te(function(e,t){return null==t||t!=t?e:t}),en=Number.isInteger||function(e){return(e|0)===e};function tn(e,t){return t[e<0?t.length+e:e]}const nn=te(function(e,t){if(null!=t)return en(e)?tn(e,t):t[e]});const rn=ne(function(e,t,n){return Qt(e,nn(t,n))});function sn(e,t){for(var n=t,r=0;r<e.length;r+=1){if(null==n)return;var s=e[r];n=en(s)?tn(s,n):n[s]}return n}const on=te(sn);const an=ye(0,-1);const cn=te(function(e,t){return e.apply(this,t)});function un(e,t,n){for(var r=0,s=n.length;r<s;)t=e(t,n[r]),r+=1;return t}function ln(e,t,n){for(var r=n.next();!r.done;)t=e(t,r.value),r=n.next();return t}function hn(e,t,n,r){return n[r](e,t)}const fn=ae(un,hn,ln);function pn(e,t){for(var n=0,r=t.length,s=Array(r);n<r;)s[n]=e(t[n]),n+=1;return s}var mn=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=Re,e.prototype["@@transducer/result"]=Le,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}();const dn=te($e(["fantasy-land/map","map"],function(e){return function(t){return new mn(e,t)}},function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return we(t.length,function(){return e.call(this,t.apply(this,arguments))});case"[object Object]":return un(function(n,r){return n[r]=e(t[r]),n},{},Xe(t));default:return pn(e,t)}}));const yn=te(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(n){return e(n)(t(n))}:fn(function(e,n){return function(e,t){var n;t=t||[];var r=(e=e||[]).length,s=t.length,o=[];for(n=0;n<r;)o[o.length]=e[n],n+=1;for(n=0;n<s;)o[o.length]=t[n],n+=1;return o}(e,dn(n,t))},[],e)});const gn=te(function(e,t){var n=we(e,t);return we(e,function(){return un(yn,dn(n,arguments[0]),Array.prototype.slice.call(arguments,1))})});const bn=ee(function(e){return gn(e.length,e)});const vn=bn(ee(function(e){return!e}));function wn(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 En=function(e){return(e<10?"0":"")+e};const xn="function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+En(e.getUTCMonth()+1)+"-"+En(e.getUTCDate())+"T"+En(e.getUTCHours())+":"+En(e.getUTCMinutes())+":"+En(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};var Tn=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=Re,e.prototype["@@transducer/result"]=Le,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}();function jn(e){return function(t){return new Tn(e,t)}}var An=te($e(["fantasy-land/filter","filter"],jn,function(e,t){return Kt(t)?un(function(n,r){return e(t[r])&&(n[r]=t[r]),n},{},Xe(t)):(n=t,"[object Map]"===Object.prototype.toString.call(n)?function(e,t){for(var n=new Map,r=t.entries(),s=r.next();!s.done;)e(s.value[1])&&n.set(s.value[0],s.value[1]),s=r.next();return n}(e,t):function(e,t){for(var n=0,r=t.length,s=[];n<r;)e(t[n])&&(s[s.length]=t[n]),n+=1;return s}(e,t));var n}));const kn=An;const On=te(function(e,t){return kn((n=e,function(){return!n.apply(this,arguments)}),t);var n});function Sn(e,t){var n=function(n){var r=t.concat([e]);return tt(n,r)?"<Circular>":Sn(n,r)},r=function(e,t){return pn(function(t){return wn(t)+": "+n(e[t])},t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+pn(n,e).join(", ")+"))";case"[object Array]":return"["+pn(n,e).concat(r(e,On(function(e){return/^\d+$/.test(e)},Xe(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+n(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?n(NaN):wn(xn(e)))+")";case"[object Map]":return"new Map("+n(Array.from(e))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+n(e.valueOf())+")":1/e==-1/0?"-0":e.toString(10);case"[object Set]":return"new Set("+n(Array.from(e).sort())+")";case"[object String]":return"object"==typeof e?"new String("+n(e.valueOf())+")":wn(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var s=e.toString();if("[object Object]"!==s)return s}return"{"+r(e,Xe(e)).join(", ")+"}"}}const Pn=ee(function(e){return Sn(e,[])});const Mn=te(function(e,t){if(e===t)return t;function n(e,t){if(e>t!=t>e)return t>e?t:e}var r=n(e,t);if(void 0!==r)return r;var s=n(typeof e,typeof t);if(void 0!==s)return s===typeof e?e:t;var o=Pn(e),i=n(o,Pn(t));return void 0!==i&&i===o?e:t});const _n=te(function(e,t){return dn(nn(e),t)});const Nn=ee(function(e){return we(me(Mn,0,_n("length",e)),function(){for(var t=0,n=e.length;t<n;){if(e[t].apply(this,arguments))return!0;t+=1}return!1})});const Cn=we(1,be(Ee,je("GeneratorFunction")));const $n=we(1,be(Ee,je("AsyncFunction")));const Rn=Nn([be(Ee,je("Function")),Cn,$n]);const Ln=vn(Rn);const In=te(function(e,t){return e&&t});var Vn=te(function(e,t){return function(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t}(e)?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:bn(In)(e,t)});const Dn=Vn;var Bn=ee(function(e){return null!=e&&"function"==typeof e["fantasy-land/empty"]?e["fantasy-land/empty"]():null!=e&&null!=e.constructor&&"function"==typeof e.constructor["fantasy-land/empty"]?e.constructor["fantasy-land/empty"]():null!=e&&"function"==typeof e.empty?e.empty():null!=e&&null!=e.constructor&&"function"==typeof e.constructor.empty?e.constructor.empty():e==Set||e instanceof Set?new Set:e==Map||e instanceof Map?new Map:re(e)?[]:se(e)?"":Kt(e)?{}:qe(e)?function(){return arguments}():function(e){var t=Object.prototype.toString.call(e);return"[object Uint8ClampedArray]"===t||"[object Int8Array]"===t||"[object Uint8Array]"===t||"[object Int16Array]"===t||"[object Uint16Array]"===t||"[object Int32Array]"===t||"[object Uint32Array]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object BigInt64Array]"===t||"[object BigUint64Array]"===t}(e)?e.constructor.from(""):void 0});const zn=Bn;const Fn=ee(function(e){return null!=e&&et(e,zn(e))});const Un=Dn(we(1,Rn(Array.isArray)?Array.isArray:be(Ee,je("Array"))),Fn);const Hn=we(3,function(e,t,n){var r=on(e,n),s=on(an(e),n);if(!Ln(r)&&!Un(e)){var o=ue(r,s);return cn(o,t)}});class qn extends Ce.g${constructor(){super(),this.register("annotation",st),this.register("comment",it),this.register("parseResult",lt),this.register("sourceMap",ft)}}const Gn=new qn,Jn=()=>({predicates:{...e},namespace:Gn}),Yn={toolboxCreator:Jn,visitorOptions:{nodeTypeGetter:Ht,exposeEdits:!0}},Kn=(e,t,n={})=>{if(0===t.length)return e;const r=Zt(Yn,n),{toolboxCreator:s,visitorOptions:o}=r,i=s(),a=t.map(e=>e(i)),c=_e(a.map(rn({},"visitor")),{...o});a.forEach(Hn(["pre"],[]));const u=Yt(e,c,o);return a.forEach(Hn(["post"],[])),u};Kn[Symbol.for("nodejs.util.promisify.custom")]=async(e,t,n={})=>{if(0===t.length)return e;const r=Zt(Yn,n),{toolboxCreator:s,visitorOptions:o}=r,i=s(),a=t.map(e=>e(i)),c=_e[Symbol.for("nodejs.util.promisify.custom")],u=Yt[Symbol.for("nodejs.util.promisify.custom")],l=c(a.map(rn({},"visitor")),{...o});await Promise.allSettled(a.map(Hn(["pre"],[])));const h=await u(e,l,o);return await Promise.allSettled(a.map(Hn(["post"],[]))),h};const Wn=(e,{Type:t,plugins:n=[]})=>{const r=new t(e);return vt(e)&&(e.meta.length>0&&(r.meta=Bt(e.meta)),e.attributes.length>0&&(r.attributes=Bt(e.attributes))),Kn(r,n,{toolboxCreator:Jn,visitorOptions:{nodeTypeGetter:Ht}})},Xn=e=>(t,n={})=>Wn(t,{...n,Type:e});Ce.Sh.refract=Xn(Ce.Sh),Ce.wE.refract=Xn(Ce.wE),Ce.Om.refract=Xn(Ce.Om),Ce.bd.refract=Xn(Ce.bd),Ce.Os.refract=Xn(Ce.Os),Ce.kT.refract=Xn(Ce.kT),Ce.Ft.refract=Xn(Ce.Ft),Ce.sI.refract=Xn(Ce.sI),st.refract=Xn(st),it.refract=Xn(it),lt.refract=Xn(lt),ft.refract=Xn(ft);class Zn extends B{name="apidom";isArray(e){return At(e)}isObject(e){return jt(e)}sizeOf(e){return this.isArray(e)||this.isObject(e)?e.length:0}has(e,t){if(this.isArray(e)){const n=Number(t),r=n>>>0;if(n!==r)throw new F(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return r<this.sizeOf(e)}if(this.isObject(e)){const n=e.keys(),r=new Set(n);if(n.length!==r.size)throw new q(`Object key "${t}" is not unique — JSON Pointer requires unique member names`,{referenceToken:t,currentValue:e,realm:this.name});return e.hasKey(t)}return!1}evaluate(e,t){return this.isArray(e)?e.get(Number(t)):this.isObject(e)?e.get(t):void 0}}const Qn=ee(function(e){return tn(-1,e)}),er=(e,t,n)=>{let r,s=[],o=t;if(Yt(n,{enter(e,n,r,o,i){if(e===t)return s=[...i,r].filter(vt),Oe}}),0===s.length)throw new l("Relative JSON Pointer evaluation failed. Current element not found inside the root element",{relativePointer:e,currentElement:Bt(t),rootElement:Bt(n),cursorElement:Bt.safe(o)});if(Qn(s)===n)throw new l("Relative JSON Pointer evaluation failed. Current element cannot be the root element",{relativePointer:e,currentElement:t,rootElement:n,cursorElement:o});try{r=K(e)}catch(n){throw new l("Relative JSON Pointer evaluation failed while parsing the pointer.",{relativePointer:e,currentElement:Bt(t),rootElement:Bt(t),cursorElement:Bt.safe(o),cause:n})}if(r.nonNegativeIntegerPrefix>0){const i=[...s];for(let{nonNegativeIntegerPrefix:e}=r;e>0;e-=1)o=i.pop(),kt(o)&&(o=i.pop());if(void 0===o)throw new l(`Relative JSON Pointer evaluation failed on non-negative-integer prefix of "${r.nonNegativeIntegerPrefix}"`,{relativePointer:e,currentElement:Bt(t),rootElement:Bt(n),cursorElement:Bt.safe(o)});s=i}if("number"==typeof r.indexManipulation){const i=Qn(s);if(void 0===i||!At(i))throw new l(`Relative JSON Pointer evaluation failed failed on index-manipulation "${r.indexManipulation}"`,{relativePointer:e,currentElement:Bt(t),rootElement:Bt(n),cursorElement:Bt.safe(o)});const a=i.content.indexOf(o)+r.indexManipulation;if(o=i.content[a],void 0===o)throw new l(`Relative JSON Pointer evaluation failed on index-manipulation "${r.indexManipulation}"`,{relativePointer:e,currentElement:Bt(t),rootElement:Bt(n),cursorElement:Bt.safe(o)})}if(Array.isArray(r.jsonPointerTokens)){o=((e,t,n={})=>G(e,t,{...n,realm:new Zn}))(o,V(r.jsonPointerTokens))}else if(r.hashCharacter){if(o===n)throw new l('Relative JSON Pointer evaluation failed. Current element cannot be the root element to apply "#"',{relativePointer:e,currentElement:Bt(t),rootElement:Bt(n),cursorElement:Bt.safe(o)});const r=Qn(s);void 0!==r&&(kt(r)?o=r.key:At(r)&&(o=new Ce.kT(r.content.indexOf(o))))}return o}})(),r})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPointerRelative=t():e.apidomJsonPointerRelative=t()}(self,()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{CompilationRelativeJsonPointerError:()=>l,EvaluationRelativeJsonPointerError:()=>u,InvalidRelativeJsonPointerError:()=>c,RelativeJsonPointerError:()=>i,compile:()=>W,evaluate:()=>mn,isRelativeJsonPointer:()=>G,parse:()=>q});class n extends AggregateError{constructor(e,t,n){super(e,t,n),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const r=n;class s extends Error{static[Symbol.hasInstance](e){return super[Symbol.hasInstance](e)||Function.prototype[Symbol.hasInstance].call(r,e)}constructor(e,t){super(e,t),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const o=s;const a=class extends o{constructor(e,t){if(super(e,t),null!=t&&"object"==typeof t){const{cause:e,...n}=t;Object.assign(this,n)}}};const i=class extends a{};class c extends i{relativePointer;constructor(e,t){super(e,t),void 0!==t&&(this.relativePointer=t.relativePointer)}}const u=class extends i{relativePointer;currentElement;rootElement;cursorElement;constructor(e,t){super(e,t),void 0!==t&&(this.relativePointer=t.relativePointer,this.currentElement=t.currentElement,this.rootElement=t.rootElement,this.cursorElement=t.cursorElement)}};const l=class extends i{nonNegativeIntegerPrefix;indexManipulation;jsonPointerTokens;hashCharacter;constructor(e,t){super(e,t),void 0!==t&&(this.nonNegativeIntegerPrefix=t.relativePointer.nonNegativeIntegerPrefix,this.indexManipulation=t.relativePointer.indexManipulation,this.hashCharacter=t.relativePointer.hashCharacter,Array.isArray(t.relativePointer.jsonPointerTokens)&&(this.jsonPointerTokens=[...t.relativePointer.jsonPointerTokens]))}},h=function(){const e=y,t=m,n=this,r="parser.js: Parser(): ";n.ast=void 0,n.stats=void 0,n.trace=void 0,n.callbacks=[];let s,o,a,i,c,u,l,h=0,f=0,p=0,d=0,g=0,v=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};n.parse=(m,y,b,w)=>{const k=`${r}parse(): `;h=0,f=0,p=0,d=0,g=0,s=void 0,o=void 0,a=void 0,i=void 0,v.refresh(),c=void 0,u=void 0,l=void 0,i=t.stringToChars(b),s=m.rules,o=m.udts;const x=y.toLowerCase();let E;for(const e in s)if(s.hasOwnProperty(e)&&x===s[e].lower){E=s[e].index;break}if(void 0===E)throw new Error(`${k}start rule name '${startRule}' not recognized`);(()=>{const e=`${r}initializeCallbacks(): `;let t,a;for(c=[],u=[],t=0;t<s.length;t+=1)c[t]=void 0;for(t=0;t<o.length;t+=1)u[t]=void 0;const i=[];for(t=0;t<s.length;t+=1)i.push(s[t].lower);for(t=0;t<o.length;t+=1)i.push(o[t].lower);for(const r in n.callbacks)if(n.callbacks.hasOwnProperty(r)){if(t=i.indexOf(r.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${r}' not a rule or udt name`);if(a=n.callbacks[r]?n.callbacks[r]:void 0,"function"!=typeof a&&void 0!==a)throw new Error(`${e}syntax callback[${r}] must be function reference or falsy)`);t<s.length?c[t]=a:u[t-s.length]=a}})(),n.trace&&n.trace.init(s,o,i),n.stats&&n.stats.init(s,o),n.ast&&n.ast.init(s,o,i),l=w,a=[{type:e.RNM,index:E}],T(0,0),a=void 0;let A=!1;switch(v.state){case e.ACTIVE:throw new Error(`${k}final state should never be 'ACTIVE'`);case e.NOMATCH:A=!1;break;case e.EMPTY:case e.MATCH:A=v.phraseLength===i.length;break;default:throw new Error("unrecognized state")}return{success:A,state:v.state,stateName:e.idName(v.state),length:i.length,matched:v.phraseLength,maxMatched:g,maxTreeDepth:p,nodeHits:d}};const b=(t,n,s,o)=>{if(n.phraseLength>s){let e=`${r}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${n.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(n.state){case e.ACTIVE:if(!o)throw new Error(`${r}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:n.phraseLength=0;break;case e.MATCH:0===n.phraseLength&&(n.state=e.EMPTY);break;case e.NOMATCH:n.phraseLength=0;break;default:throw new Error(`${r}opRNM(${t.name}): callback function return error. Unrecognized return state: ${n.state}`)}},w=(t,c)=>{let f,p,d;const m=a[t],y=o[m.index];v.UdtIndex=y.index,h||(d=n.ast&&n.ast.udtDefined(m.index),d&&(p=s.length+m.index,f=n.ast.getLength(),n.ast.down(p,y.name)));const g=i.length-c;u[m.index](v,i,c,l),((t,n,s)=>{if(n.phraseLength>s){let e=`${r}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${n.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(n.state){case e.ACTIVE:throw new Error(`${r}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);n.phraseLength=0;break;case e.MATCH:if(0===n.phraseLength){if(!t.empty)throw new Error(`${r}opUDT(${t.name}) may not return EMPTY.`);n.state=e.EMPTY}break;case e.NOMATCH:n.phraseLength=0;break;default:throw new Error(`${r}opUDT(${t.name}): callback function return error. Unrecognized return state: ${n.state}`)}})(y,v,g),h||d&&(v.state===e.NOMATCH?n.ast.setLength(f):n.ast.up(p,y.name,c,v.phraseLength))},T=(t,o)=>{const u=`${r}opExecute(): `,m=a[t];switch(d+=1,f>p&&(p=f),f+=1,v.refresh(),n.trace&&n.trace.down(m,o),m.type){case e.ALT:((t,n)=>{const r=a[t];for(let t=0;t<r.children.length&&(T(r.children[t],n),v.state===e.NOMATCH);t+=1);})(t,o);break;case e.CAT:((t,r)=>{let s,o,i,c;const u=a[t];n.ast&&(o=n.ast.getLength()),s=!0,i=r,c=0;for(let t=0;t<u.children.length;t+=1){if(T(u.children[t],i),v.state===e.NOMATCH){s=!1;break}i+=v.phraseLength,c+=v.phraseLength}s?(v.state=0===c?e.EMPTY:e.MATCH,v.phraseLength=c):(v.state=e.NOMATCH,v.phraseLength=0,n.ast&&n.ast.setLength(o))})(t,o);break;case e.REP:((t,r)=>{let s,o,c,u;const l=a[t];if(0===l.max)return v.state=e.EMPTY,void(v.phraseLength=0);for(o=r,c=0,u=0,n.ast&&(s=n.ast.getLength());!(o>=i.length)&&(T(t+1,o),v.state!==e.NOMATCH)&&v.state!==e.EMPTY&&(u+=1,c+=v.phraseLength,o+=v.phraseLength,u!==l.max););v.state===e.EMPTY||u>=l.min?(v.state=0===c?e.EMPTY:e.MATCH,v.phraseLength=c):(v.state=e.NOMATCH,v.phraseLength=0,n.ast&&n.ast.setLength(s))})(t,o);break;case e.RNM:((t,r)=>{let o,u,f;const p=a[t],d=s[p.index],m=c[d.index];if(h||(u=n.ast&&n.ast.ruleDefined(p.index),u&&(o=n.ast.getLength(),n.ast.down(p.index,s[p.index].name))),m){const t=i.length-r;m(v,i,r,l),b(d,v,t,!0),v.state===e.ACTIVE&&(f=a,a=d.opcodes,T(0,r),a=f,m(v,i,r,l),b(d,v,t,!1))}else f=a,a=d.opcodes,T(0,r,v),a=f;h||u&&(v.state===e.NOMATCH?n.ast.setLength(o):n.ast.up(p.index,d.name,r,v.phraseLength))})(t,o);break;case e.TRG:((t,n)=>{const r=a[t];v.state=e.NOMATCH,n<i.length&&r.min<=i[n]&&i[n]<=r.max&&(v.state=e.MATCH,v.phraseLength=1)})(t,o);break;case e.TBS:((t,n)=>{const r=a[t],s=r.string.length;if(v.state=e.NOMATCH,n+s<=i.length){for(let e=0;e<s;e+=1)if(i[n+e]!==r.string[e])return;v.state=e.MATCH,v.phraseLength=s}})(t,o);break;case e.TLS:((t,n)=>{let r;const s=a[t];v.state=e.NOMATCH;const o=s.string.length;if(0!==o){if(n+o<=i.length){for(let e=0;e<o;e+=1)if(r=i[n+e],r>=65&&r<=90&&(r+=32),r!==s.string[e])return;v.state=e.MATCH,v.phraseLength=o}}else v.state=e.EMPTY})(t,o);break;case e.UDT:w(t,o);break;case e.AND:((t,n)=>{switch(h+=1,T(t+1,n),h-=1,v.phraseLength=0,v.state){case e.EMPTY:case e.MATCH:v.state=e.EMPTY;break;case e.NOMATCH:v.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${v.state}`)}})(t,o);break;case e.NOT:((t,n)=>{switch(h+=1,T(t+1,n),h-=1,v.phraseLength=0,v.state){case e.EMPTY:case e.MATCH:v.state=e.NOMATCH;break;case e.NOMATCH:v.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${v.state}`)}})(t,o);break;default:throw new Error(`${u}unrecognized operator`)}h||o+v.phraseLength>g&&(g=o+v.phraseLength),n.stats&&n.stats.collect(m,v),n.trace&&n.trace.up(m,v.state,o,v.phraseLength),f-=1}},f=function(){const e=y,t=m,n=this;let r,s,o,a=0;const i=[],c=[],u=[];function l(e){let t="";for(;e-- >0;)t+=" ";return t}n.callbacks=[],n.init=(e,t,l)=>{let h;c.length=0,u.length=0,a=0,r=e,s=t,o=l;const f=[];for(h=0;h<r.length;h+=1)f.push(r[h].lower);for(h=0;h<s.length;h+=1)f.push(s[h].lower);for(a=r.length+s.length,h=0;h<a;h+=1)i[h]=void 0;for(const e in n.callbacks)if(n.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(h=f.indexOf(t),h<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);i[h]=n.callbacks[e]}},n.ruleDefined=e=>!!i[e],n.udtDefined=e=>!!i[r.length+e],n.down=(t,n)=>{const r=u.length;return c.push(r),u.push({name:n,thisIndex:r,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),r},n.up=(t,n,r,s)=>{const o=u.length,a=c.pop();return u.push({name:n,thisIndex:o,thatIndex:a,state:e.SEM_POST,callbackIndex:t,phraseIndex:r,phraseLength:s,stack:c.length}),u[a].thatIndex=o,u[a].phraseIndex=r,u[a].phraseLength=s,o},n.translate=t=>{let n,r;for(let s=0;s<u.length;s+=1)r=u[s],n=i[r.callbackIndex],n&&(r.state===e.SEM_PRE?n(e.SEM_PRE,o,r.phraseIndex,r.phraseLength,t):n&&n(e.SEM_POST,o,r.phraseIndex,r.phraseLength,t))},n.setLength=e=>{u.length=e,c.length=e>0?u[e-1].stack:0},n.getLength=()=>u.length,n.toXml=()=>{let n="",r=0;return n+='<?xml version="1.0" encoding="utf-8"?>\n',n+=`<root nodes="${u.length/2}" characters="${o.length}">\n`,n+="\x3c!-- input string --\x3e\n",n+=l(r+2),n+=t.charsToString(o),n+="\n",u.forEach(s=>{s.state===e.SEM_PRE?(r+=1,n+=l(r),n+=`<node name="${s.name}" index="${s.phraseIndex}" length="${s.phraseLength}">\n`,n+=l(r+2),n+=t.charsToString(o,s.phraseIndex,s.phraseLength),n+="\n"):(n+=l(r),n+=`</node>\x3c!-- name="${s.name}" --\x3e\n`,r-=1)}),n+="</root>\n",n}},p=function(){const e=y,t=m,n="parser.js: Trace(): ";let r,s,o,a="",i=0;const c=this,u=e=>{let t="",n=0;if(e>=0)for(;e--;)n+=1,5===n?(t+="|",n=0):t+=".";return t};c.init=(e,t,n)=>{s=e,o=t,r=n};const l=r=>{let a;switch(r.type){case e.ALT:a="ALT";break;case e.CAT:a="CAT";break;case e.REP:a=r.max===1/0?`REP(${r.min},inf)`:`REP(${r.min},${r.max})`;break;case e.RNM:a=`RNM(${s[r.index].name})`;break;case e.TRG:a=`TRG(${r.min},${r.max})`;break;case e.TBS:a=r.string.length>6?`TBS(${t.charsToString(r.string,0,3)}...)`:`TBS(${t.charsToString(r.string,0,6)})`;break;case e.TLS:a=r.string.length>6?`TLS(${t.charsToString(r.string,0,3)}...)`:`TLS(${t.charsToString(r.string,0,6)})`;break;case e.UDT:a=`UDT(${o[r.index].name})`;break;case e.AND:a="AND";break;case e.NOT:a="NOT";break;default:throw new Error(`${n}Trace: opName: unrecognized opcode`)}return a};c.down=(e,n)=>{const s=u(i),o=Math.min(100,r.length-n);let c=t.charsToString(r,n,o);o<r.length-n&&(c+="..."),c=`${s}|-|[${l(e)}]${c}\n`,a+=c,i+=1},c.up=(s,o,c,h)=>{const f=`${n}trace.up: `;i-=1;const p=u(i);let d,m,y;switch(o){case e.EMPTY:y="|E|",m="''";break;case e.MATCH:y="|M|",d=Math.min(100,h),m=d<h?`'${t.charsToString(r,c,d)}...'`:`'${t.charsToString(r,c,d)}'`;break;case e.NOMATCH:y="|N|",m="";break;default:throw new Error(`${f} unrecognized state`)}m=`${p}${y}[${l(s)}]${m}\n`,a+=m},c.displayTrace=()=>a},d=function(){const e=y;let t,n,r;const s=[],o=[],a=[];this.init=(e,r)=>{t=e,n=r,f()},this.collect=(t,n)=>{p(r,n.state,n.phraseLength),p(s[t.type],n.state,n.phraseLength),t.type===e.RNM&&p(o[t.index],n.state,n.phraseLength),t.type===e.UDT&&p(a[t.index],n.state,n.phraseLength)},this.displayStats=()=>{let t="";const n={match:0,empty:0,nomatch:0,total:0},r=(e,t,r,s,o)=>{n.match+=t,n.empty+=r,n.nomatch+=s,n.total+=o;return`${e} | ${i(t)} | ${i(r)} | ${i(s)} | ${i(o)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=r(" ALT",s[e.ALT].match,s[e.ALT].empty,s[e.ALT].nomatch,s[e.ALT].total),t+=r(" CAT",s[e.CAT].match,s[e.CAT].empty,s[e.CAT].nomatch,s[e.CAT].total),t+=r(" REP",s[e.REP].match,s[e.REP].empty,s[e.REP].nomatch,s[e.REP].total),t+=r(" RNM",s[e.RNM].match,s[e.RNM].empty,s[e.RNM].nomatch,s[e.RNM].total),t+=r(" TRG",s[e.TRG].match,s[e.TRG].empty,s[e.TRG].nomatch,s[e.TRG].total),t+=r(" TBS",s[e.TBS].match,s[e.TBS].empty,s[e.TBS].nomatch,s[e.TBS].total),t+=r(" TLS",s[e.TLS].match,s[e.TLS].empty,s[e.TLS].nomatch,s[e.TLS].total),t+=r(" UDT",s[e.UDT].match,s[e.UDT].empty,s[e.UDT].nomatch,s[e.UDT].total),t+=r(" AND",s[e.AND].match,s[e.AND].empty,s[e.AND].nomatch,s[e.AND].total),t+=r(" NOT",s[e.NOT].match,s[e.NOT].empty,s[e.NOT].nomatch,s[e.NOT].total),t+=r("TOTAL",n.match,n.empty,n.nomatch,n.total),t},this.displayHits=e=>{let t="";const n=(e,t,n,s,o)=>{r.match+=e,r.empty+=t,r.nomatch+=n,r.total+=s;return`| ${i(e)} | ${i(t)} | ${i(n)} | ${i(s)} | ${o}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(o.sort(c),a.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(o.sort(l),a.sort(l),t+=" RULES/UDTS BY INDEX\n"):(o.sort(u),a.sort(u),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<o.length;e+=1){let r=o[e];r.total&&(t+=n(r.match,r.empty,r.nomatch,r.total,r.name))}for(let e=0;e<a.length;e+=1){let r=a[e];r.total&&(t+=n(r.match,r.empty,r.nomatch,r.total,r.name))}return t};const i=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,u=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),l=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,h=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},f=()=>{s.length=0,r=new h,s[e.ALT]=new h,s[e.CAT]=new h,s[e.REP]=new h,s[e.RNM]=new h,s[e.TRG]=new h,s[e.TBS]=new h,s[e.TLS]=new h,s[e.UDT]=new h,s[e.AND]=new h,s[e.NOT]=new h,o.length=0;for(let e=0;e<t.length;e+=1)o.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(n.length>0){a.length=0;for(let e=0;e<n.length;e+=1)a.push({empty:0,match:0,nomatch:0,total:0,name:n[e].name,lower:n[e].lower,index:n[e].index})}},p=(t,n)=>{switch(t.total+=1,n){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${n}`)}}},m={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,n)=>{let r=e;for(;!(void 0===t||t<0);){if(void 0===n){r=e.slice(t);break}if(n<=0)return"";r=e.slice(t,t+n);break}return String.fromCodePoint(...r)}},y={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 y.ALT:return"ALT";case y.CAT:return"CAT";case y.REP:return"REP";case y.RNM:return"RNM";case y.TRG:return"TRG";case y.TBS:return"TBS";case y.TLS:return"TLS";case y.UDT:return"UDT";case y.AND:return"AND";case y.NOT:return"NOT";case y.ACTIVE:return"ACTIVE";case y.EMPTY:return"EMPTY";case y.MATCH:return"MATCH";case y.NOMATCH:return"NOMATCH";case y.SEM_PRE:return"SEM_PRE";case y.SEM_POST:return"SEM_POST";case y.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};function g(){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 v 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,...n}=t;Object.assign(this,n)}}}const b=v;const w=class extends b{},T=e=>(t,n,r,s,o)=>{if("object"!=typeof o||null===o||Array.isArray(o))throw new w("parser's user data must be an object");if(t===y.SEM_PRE){const t={type:e,text:m.charsToString(n,r,s),start:r,length:s,children:[]};if(o.stack.length>0){o.stack[o.stack.length-1].children.push(t)}else o.root=t;o.stack.push(t)}t===y.SEM_POST&&o.stack.pop()};const k=class extends f{constructor(){super(),this.callbacks["json-pointer"]=T("json-pointer"),this.callbacks["reference-token"]=T("reference-token"),this.callbacks.slash=T("text")}getTree(){const e={stack:[],root:null};return this.translate(e),delete e.stack,e}},x=e=>{if("string"!=typeof e)throw new TypeError("Reference token must be a string");return e.replace(/~1/g,"/").replace(/~0/g,"~")};const E=class extends k{getTree(){const{root:e}=super.getTree();return e.children.filter(({type:e})=>"reference-token"===e).map(({text:e})=>x(e))}};const A=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const P=class extends p{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let n=-1;for(let r=0;r<e.length;r++){const s=e[r];if(s.includes("M|")){const e=s.match(/]'(.*)'$/);e&&e[1]&&(n=r)}if(r>n){const e=s.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new A(...t)}},S=new g,O=(e,{translator:t=new E,stats:n=!1,trace:r=!1}={})=>{if("string"!=typeof e)throw new TypeError("JSON Pointer must be a string");try{const s=new h;t&&(s.ast=t),n&&(s.stats=new d),r&&(s.trace=new P);const o=s.parse(S,"json-pointer",e);return{result:o,tree:o.success&&t?s.ast.getTree():void 0,stats:s.stats,trace:s.trace}}catch(t){throw new w("Unexpected error during JSON Pointer parsing",{cause:t,jsonPointer:e})}};new g,new h,new g,new h;const M=new g,j=new h,N=e=>{if("string"!=typeof e)return!1;try{return j.parse(M,"array-index",e).success}catch{return!1}},C=new g,$=new h,L=e=>{if("string"!=typeof e)return!1;try{return $.parse(C,"array-dash",e).success}catch{return!1}},_=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 R=class extends b{},I=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 _(String(e))}).join("/")}`}catch(t){throw new R("Unexpected error during JSON Pointer compilation",{cause:t,referenceTokens:e})}};const F=class{#e;#t;#n;constructor(e,t={}){this.#e=e,this.#e.steps=[],this.#e.failed=!1,this.#e.failedAt=-1,this.#e.message=`JSON Pointer "${t.jsonPointer}" was successfully evaluated against the provided value`,this.#e.context={...t,realm:t.realm.name},this.#t=[],this.#n=t.realm}step({referenceToken:e,input:t,output:n,success:r=!0,reason:s}){const o=this.#t.length;this.#t.push(e);const a={referenceToken:e,referenceTokenPosition:o,input:t,inputType:this.#n.isObject(t)?"object":this.#n.isArray(t)?"array":"unrecognized",output:n,success:r};s&&(a.reason=s),this.#e.steps.push(a),r||(this.#e.failed=!0,this.#e.failedAt=o,this.#e.message=s)}};const D=class{name="";isArray(e){throw new b("Realm.isArray(node) must be implemented in a subclass")}isObject(e){throw new b("Realm.isObject(node) must be implemented in a subclass")}sizeOf(e){throw new b("Realm.sizeOf(node) must be implemented in a subclass")}has(e,t){throw new b("Realm.has(node) must be implemented in a subclass")}evaluate(e,t){throw new b("Realm.evaluate(node) must be implemented in a subclass")}};const V=class extends b{};const U=class extends V{};const H=class extends D{name="json";isArray(e){return Array.isArray(e)}isObject(e){return"object"==typeof e&&null!==e&&!this.isArray(e)}sizeOf(e){return this.isArray(e)?e.length:this.isObject(e)?Object.keys(e).length:0}has(e,t){if(this.isArray(e)){const n=Number(t),r=n>>>0;if(n!==r)throw new U(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return r<this.sizeOf(e)&&Object.prototype.hasOwnProperty.call(e,n)}return!!this.isObject(e)&&Object.prototype.hasOwnProperty.call(e,t)}evaluate(e,t){return this.isArray(e)?e[Number(t)]:e[t]}};const z=class extends V{};const B=class extends V{},J=(e,t,{strictArrays:n=!0,strictObjects:r=!0,realm:s=new H,trace:o=!0}={})=>{const{result:a,tree:i,trace:c}=O(t,{trace:!!o}),u="object"==typeof o&&null!==o?new F(o,{jsonPointer:t,referenceTokens:i,strictArrays:n,strictObjects:r,realm:s,value:e}):null;try{let o;if(!a.success){let n=`Invalid JSON Pointer: "${t}". Syntax error at position ${a.maxMatched}`;throw n+=c?`, expected ${c.inferExpectations()}`:"",new V(n,{jsonPointer:t,currentValue:e,realm:s.name})}return i.reduce((e,a,c)=>{if(s.isArray(e)){if(L(a)){if(n)throw new U(`Invalid array index "-" at position ${c} in "${t}". The "-" token always refers to a nonexistent element during evaluation`,{jsonPointer:t,referenceTokens:i,referenceToken:a,referenceTokenPosition:c,currentValue:e,realm:s.name});return o=s.evaluate(e,String(s.sizeOf(e))),null==u||u.step({referenceToken:a,input:e,output:o}),o}if(!N(a))throw new U(`Invalid array index "${a}" at position ${c} in "${t}": index MUST be "0", or digits without a leading "0"`,{jsonPointer:t,referenceTokens:i,referenceToken:a,referenceTokenPosition:c,currentValue:e,realm:s.name});const r=Number(a);if(!Number.isSafeInteger(r))throw new U(`Invalid array index "${a}" at position ${c} in "${t}": index must be a safe integer`,{jsonPointer:t,referenceTokens:i,referenceToken:a,referenceTokenPosition:c,currentValue:e,realm:s.name});if(!s.has(e,a)&&n)throw new U(`Invalid array index "${a}" at position ${c} in "${t}": index not found in array`,{jsonPointer:t,referenceTokens:i,referenceToken:a,referenceTokenPosition:c,currentValue:e,realm:s.name});return o=s.evaluate(e,a),null==u||u.step({referenceToken:a,input:e,output:o}),o}if(s.isObject(e)){if(!s.has(e,a)&&r)throw new B(`Invalid object key "${a}" at position ${c} in "${t}": key not found in object`,{jsonPointer:t,referenceTokens:i,referenceToken:a,referenceTokenPosition:c,currentValue:e,realm:s.name});return o=s.evaluate(e,a),null==u||u.step({referenceToken:a,input:e,output:o}),o}throw new z(`Invalid reference token "${a}" at position ${c} in "${t}": cannot be applied to a non-object/non-array value`,{jsonPointer:t,referenceTokens:i,referenceToken:a,referenceTokenPosition:c,currentValue:e,realm:s.name})},e)}catch(e){if(null==u||u.step({referenceToken:e.referenceToken,input:e.currentValue,success:!1,reason:e.message}),e instanceof V)throw e;throw new V("Unexpected error during JSON Pointer evaluation",{cause:e,jsonPointer:t,referenceTokens:i})}};const Y=new RegExp("^(?<nonNegativeIntegerPrefix>[1-9]\\d*|0)(?<indexManipulation>[+-][1-9]\\d*|0)?((?<hashCharacter>#)|(?<jsonPointer>\\/.*))?$"),G=e=>"string"==typeof e&&Y.test(e),q=e=>{const t=e.match(Y);if(null===t||void 0===t.groups)throw new c(`Invalid Relative JSON Pointer "${e}".`,{relativePointer:e});try{const e=parseInt(t.groups.nonNegativeIntegerPrefix,10),n="string"==typeof t.groups.indexManipulation?parseInt(t.groups.indexManipulation,10):void 0,r="string"==typeof t.groups.jsonPointer?O(t.groups.jsonPointer).tree:void 0;return{nonNegativeIntegerPrefix:e,indexManipulation:n,jsonPointerTokens:r,hashCharacter:"string"==typeof t.groups.hashCharacter}}catch(t){throw new c(`Relative JSON Pointer parsing of "${e}" encountered an error.`,{relativePointer:e,cause:t})}},W=e=>{try{let t="";return t+=String(e.nonNegativeIntegerPrefix),"number"==typeof e.indexManipulation&&(t+=String(e.indexManipulation)),Array.isArray(e.jsonPointerTokens)?t+=I(e.jsonPointerTokens):e.hashCharacter&&(t+="#"),t}catch(t){throw new l("Relative JSON Pointer compilation encountered an error.",{relativePointer:e,cause:t})}};function K(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function X(e){return function t(n){return 0===arguments.length||K(n)?t:e.apply(this,arguments)}}function Z(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return K(n)?t:X(function(t){return e(n,t)});default:return K(n)&&K(r)?t:K(n)?X(function(t){return e(t,r)}):K(r)?X(function(t){return e(n,t)}):e(n,r)}}}function Q(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function ee(e,t,n){for(var r=0,s=n.length;r<s;){if(e(t,n[r]))return!0;r+=1}return!1}function te(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const ne="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var re=Object.prototype.toString;const se=function(){return"[object Arguments]"===re.call(arguments)?function(e){return"[object Arguments]"===re.call(e)}:function(e){return te("callee",e)}}();var oe=!{toString:null}.propertyIsEnumerable("toString"),ae=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],ie=function(){return arguments.propertyIsEnumerable("length")}(),ce=function(e,t){for(var n=0;n<e.length;){if(e[n]===t)return!0;n+=1}return!1},ue="function"!=typeof Object.keys||ie?X(function(e){if(Object(e)!==e)return[];var t,n,r=[],s=ie&&se(e);for(t in e)!te(t,e)||s&&"length"===t||(r[r.length]=t);if(oe)for(n=ae.length-1;n>=0;)te(t=ae[n],e)&&!ce(r,t)&&(r[r.length]=t),n-=1;return r}):X(function(e){return Object(e)!==e?[]:Object.keys(e)});const le=ue;const he=X(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function fe(e,t,n,r){var s=Q(e);function o(e,t){return pe(e,t,n.slice(),r.slice())}return!ee(function(e,t){return!ee(o,t,e)},Q(t),s)}function pe(e,t,n,r){if(ne(e,t))return!0;var s,o,a=he(e);if(a!==he(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(a){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(s=e.constructor,null==(o=String(s).match(/^function (\w*)/))?"":o[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!ne(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!ne(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 i=n.length-1;i>=0;){if(n[i]===e)return r[i]===t;i-=1}switch(a){case"Map":return e.size===t.size&&fe(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&fe(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=le(e);if(c.length!==le(t).length)return!1;var u=n.concat([e]),l=r.concat([t]);for(i=c.length-1;i>=0;){var h=c[i];if(!te(h,t)||!pe(t[h],e[h],u,l))return!1;i-=1}return!0}const de=Z(function(e,t){return pe(e,t,[],[])});const me=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class ye{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(n=>{const r=n.value,s=n.key;if(void 0===r||void 0===s)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,r,s,n):e(r,s,n)})}filter(e,t){const n=this.elements.filter(n=>{const r=n.value,s=n.key;return void 0!==r&&void 0!==s&&(void 0!==t?e.call(t,r,s,n):e(r,s,n))});return new ye(n)}reject(e,t){const n=[];for(const r of this.elements){const s=r.value,o=r.key;void 0!==s&&void 0!==o&&(e.call(t,s,o,r)||n.push(r))}return new ye(n)}forEach(e,t){this.elements.forEach((n,r)=>{const s=n.value,o=n.key;void 0!==s&&void 0!==o&&(void 0!==t?e.call(t,s,o,n,r):e(s,o,n,r))})}find(e,t){return this.elements.find(n=>{const r=n.value,s=n.key;return void 0!==r&&void 0!==s&&(void 0!==t?e.call(t,r,s,n):e(r,s,n))})}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 ge=ye;class ve{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(e,t,n){void 0!==t&&(this.meta=t),void 0!==n&&(this.attributes=n),void 0!==e&&(this.content=e)}get element(){return this._storedElement}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof ve)this._content=e;else if(null!=e&&"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e&&"symbol"!=typeof e)if(e instanceof me)this._content=e;else if(e instanceof ge)this._content=e.elements;else if(Array.isArray(e))this._content=e.map(e=>this.refract(e));else{if("object"!=typeof e)throw new Error("Cannot set content to value of type "+typeof e);this._content=Object.entries(e).map(([e,t])=>new this.MemberElement(e,t))}else this._content=e}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof ve?this._meta=e:this.meta.set(e??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof ve?this._attributes=e:this.attributes.set(e??{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get children(){const{_content:e}=this;if(Array.isArray(e))return e;if(e instanceof me){const t=[];return e.key&&t.push(e.key),e.value&&t.push(e.value),t}return e instanceof ve?[e]:[]}get isFrozen(){return Object.isFrozen(this)}freeze(){if(!this.isFrozen){this._meta&&(this._meta.parent=this,this._meta.freeze()),this._attributes&&(this._attributes.parent=this,this._attributes.freeze());for(const e of this.children)e.parent=this,e.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:e}=this;return e instanceof ve||e instanceof me?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){return de(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 n=new this.RefElement(t);return"string"==typeof e&&(n.path=this.refract(e)),n}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 be=ve;class we extends be{constructor(e,t,n){super(e||[],t,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(...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 n=t||{},r=!!n.recursive,s=void 0===n.results?[]:n.results;for(let t=0;t<this._content.length;t+=1){const n=this._content[t],o=n;r&&"function"==typeof o.findElements&&o.findElements(e,{results:s,recursive:r}),e(n,t,void 0)&&s.push(n)}return s}find(e){const t=this.findElements(e,{recursive:!0});return new this.ArrayElement(t)}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>{const n=t.classes;return"function"==typeof n.includes&&n.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 Te=we;const ke=class extends Te{constructor(e,t,n){super(e||[],t,n),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 n=[];for(const r of this._content){const s=e.call(t,r);s&&n.push(s)}return n}filter(e,t){const n=this._content.filter(e,t);return new this.constructor(n)}reject(e,t){const n=[];for(const r of this._content)e.call(t,r)||n.push(r);return new this.constructor(n)}reduce(e,t){let n,r;void 0!==t?(n=0,r=this.refract(t)):(n=1,r=this.first);for(let t=n;t<this.length;t+=1){const n=e(r,this._content[t],t,this);r=void 0===n?n:this.refract(n)}return r}forEach(e,t){this._content.forEach((n,r)=>{e.call(t,n,r)})}empty(){return new this.constructor([])}};const xe=class extends be{constructor(e,t,n,r){super(new me,n,r),this.element="member",void 0!==e&&(this.key=e),arguments.length>=2&&(this.value=t)}primitive(){return"member"}get key(){return this._content.key}set key(e){this._content.key=this.refract(e)}get value(){return this._content.value}set value(e){this._content.value=void 0===e?void 0:this.refract(e)}};const Ee=class extends Te{constructor(e,t,n){super(e||[],t,n),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(n=>n.key.toValue()!==e||(t=n,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if("string"==typeof e){const n=this.getMember(e);n?n.value=t:this._content.push(new xe(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(n=>e.call(t,n.value,n.key,n))}compactMap(e,t){const n=[];return this.forEach((r,s,o)=>{const a=e.call(t,r,s,o);a&&n.push(a)}),n}filter(e,t){return new ge(this._content).filter(e,t)}reject(e,t){const n=[];for(const r of this._content)e.call(t,r.value,r.key,r)||n.push(r);return new ge(n)}forEach(e,t){this._content.forEach(n=>e.call(t,n.value,n.key,n))}reduce(e,t){let n,r;void 0!==t?(n=0,r=this.refract(t)):(n=1,r=this._content[0]?.value);for(let t=n;t<this._content.length;t+=1){const n=this._content[t],s=e(r,n.value,n.key,n,this);r=void 0===s?s:this.refract(s)}return r}empty(){return new this.constructor([])}},Ae=e=>e instanceof be,Pe=e=>e instanceof ke,Se=e=>e instanceof Ee,Oe=e=>e instanceof xe;const Me=class extends be{constructor(e,t,n){super(e,t,n),this.element="string"}primitive(){return"string"}get length(){return this.content?.length??0}};class je extends Me{constructor(e,t,n){super(e,t,n),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:n,startOffset:r,endLine:s,endCharacter:o,endOffset:a}=e;if("number"!=typeof t||"number"!=typeof n||"number"!=typeof r||"number"!=typeof s||"number"!=typeof o||"number"!=typeof a)return;const i="sm1:"+[t,n,r,s,o,a].map(Ce).join("");const c=new je(i);return c.startLine=t,c.startCharacter=n,c.startOffset=r,c.endLine=s,c.endCharacter=o,c.endOffset=a,c}applyTo(e){this.content&&([e.startLine,e.startCharacter,e.startOffset,e.endLine,e.endCharacter,e.endOffset]=function(e){const t=e.startsWith("sm1:")?e.slice(4):e,n=[];let r=0;for(let e=0;e<6;e++){const e=$e(t,r);n.push(e.value),r=e.next}return n}(this.content))}}const Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ce(e){let t=e>>>0,n="";do{let e=31&t;t>>>=5,0!==t&&(e|=32),n+=Ne[e]}while(0!==t);return n}function $e(e,t=0){let n=0,r=0,s=t;for(;;){const t=e[s++],o=Ne.indexOf(t);if(-1===o)throw new Error(`Invalid Base64 VLQ char: ${t}`);if(n|=(31&o)<<r,r+=5,!!!(32&o))break}return{value:n>>>0,next:s}}const Le=je;const _e=class extends a{value;constructor(e,t){super(e,t),void 0!==t&&(this.value=t.value)}};const Re=class extends _e{};const Ie=class extends _e{},Fe=(e,t)=>{const{visited:n=new WeakMap}=t,r={...t,visited:n};if(n.has(e))return n.get(e);const s=He(e);n.set(e,s);const{content:o}=e;return Array.isArray(o)?s.content=o.map(e=>Fe(e,r)):Ae(o)?s.content=Fe(o,r):s.content=o instanceof me?De(o,r):o,s},De=(e,t)=>{const{visited:n=new WeakMap}=t,r={...t,visited:n};if(n.has(e))return n.get(e);const{key:s,value:o}=e,a=void 0!==s?Fe(s,r):void 0,i=void 0!==o?Fe(o,r):void 0,c=new me(a,i);return n.set(e,c),c},Ve=(e,t={})=>{if(e instanceof me)return De(e,t);if(e instanceof ge)return((e,t)=>{const{visited:n=new WeakMap}=t,r={...t,visited:n};if(n.has(e))return n.get(e);const s=[...e].map(e=>Fe(e,r)),o=new ge(s);return n.set(e,o),o})(e,t);if(Ae(e))return Fe(e,t);throw new Re("Value provided to cloneDeep function couldn't be cloned",{value:e})};Ve.safe=e=>{try{return Ve(e)}catch{return e}};const Ue=e=>{const{key:t,value:n}=e;return new me(t,n)},He=e=>{const t=new(0,e.constructor);t.element=e.element,e.isMetaEmpty||(t.meta=Ve(e.meta)),e.isAttributesEmpty||(t.attributes=Ve(e.attributes)),(e=>"number"==typeof e.startLine&&"number"==typeof e.startCharacter&&"number"==typeof e.startOffset&&"number"==typeof e.endLine&&"number"==typeof e.endCharacter&&"number"==typeof e.endOffset)(e)&&Le.transfer(e,t);const{content:n}=e;return Ae(n)?t.content=He(n):Array.isArray(n)?t.content=[...n]:t.content=n instanceof me?Ue(n):n,t},ze=e=>{if(e instanceof me)return Ue(e);if(e instanceof ge)return(e=>{const t=[...e];return new ge(t)})(e);if(Ae(e))return He(e);throw new Ie("Value provided to cloneShallow function couldn't be cloned",{value:e})};ze.safe=e=>{try{return ze(e)}catch{return e}};const Be=class extends be{constructor(e,t,n){super(e,t,n),this.element="number"}primitive(){return"number"}};class Je{node;key;index;parent;parentPath;inList;#r=!1;#s=!1;#o=!1;#a=!1;#i;#c=!1;constructor(e,t,n,r,s){this.node=e,this.parent=t,this.parentPath=n,this.key=r,this.index=s&&"number"==typeof r?r:void 0,this.inList=s}get shouldSkip(){return this.#r}get shouldStop(){return this.#s}get removed(){return this.#o}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}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.#r=!0}stop(){this.#s=!0}replaceWith(e){this.#c&&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.#a=!0,this.#i=e,this.node=e}remove(){this.#c&&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.#o=!0}_getReplacementNode(){return this.#i}_wasReplaced(){return this.#a}_reset(){this.#r=!1,this.#s=!1,this.#o=!1,this.#a=!1,this.#i=void 0}_markStale(){this.#c=!0}}function Ye(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,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,s){return t.apply(this,arguments)};case 5:return function(e,n,r,s,o){return t.apply(this,arguments)};case 6:return function(e,n,r,s,o,a){return t.apply(this,arguments)};case 7:return function(e,n,r,s,o,a,i){return t.apply(this,arguments)};case 8:return function(e,n,r,s,o,a,i,c){return t.apply(this,arguments)};case 9:return function(e,n,r,s,o,a,i,c,u){return t.apply(this,arguments)};case 10:return function(e,n,r,s,o,a,i,c,u,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function Ge(e,t,n){return function(){for(var r=[],s=0,o=e,a=0,i=!1;a<t.length||s<arguments.length;){var c;a<t.length&&(!K(t[a])||s>=arguments.length)?c=t[a]:(c=arguments[s],s+=1),r[a]=c,K(c)?i=!0:o-=1,a+=1}return!i&&o<=0?n.apply(this,r):Ye(Math.max(0,o),Ge(e,r,n))}}const qe=Z(function(e,t){return 1===e?X(t):Ye(e,Ge(e,[],t))});function We(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t}const Ke=Z(function(e,t){return e&&t});function Xe(e,t,n){for(var r=0,s=n.length;r<s;)t=e(t,n[r]),r+=1;return t}const Ze=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};const Qe=X(function(e){return!!Ze(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 et="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function tt(e,t,n){return function(r,s,o){if(Qe(o))return e(r,s,o);if(null==o)return s;if("function"==typeof o["fantasy-land/reduce"])return t(r,s,o,"fantasy-land/reduce");if(null!=o[et])return n(r,s,o[et]());if("function"==typeof o.next)return n(r,s,o);if("function"==typeof o.reduce)return t(r,s,o,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function nt(e,t,n){for(var r=n.next();!r.done;)t=e(t,r.value),r=n.next();return t}function rt(e,t,n,r){return n[r](e,t)}const st=tt(Xe,rt,nt);function ot(e,t,n){return function(){if(0===arguments.length)return n();var r=arguments[arguments.length-1];if(!Ze(r)){for(var s=0;s<e.length;){if("function"==typeof r[e[s]])return r[e[s]].apply(r,Array.prototype.slice.call(arguments,0,-1));s+=1}if(function(e){return null!=e&&"function"==typeof e["@@transducer/step"]}(r))return t.apply(null,Array.prototype.slice.call(arguments,0,-1))(r)}return n.apply(this,arguments)}}function at(e,t){for(var n=0,r=t.length,s=Array(r);n<r;)s[n]=e(t[n]),n+=1;return s}const it=function(){return this.xf["@@transducer/init"]()},ct=function(e){return this.xf["@@transducer/result"](e)};var ut=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=it,e.prototype["@@transducer/result"]=ct,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}();const lt=Z(ot(["fantasy-land/map","map"],function(e){return function(t){return new ut(e,t)}},function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return qe(t.length,function(){return e.call(this,t.apply(this,arguments))});case"[object Object]":return Xe(function(n,r){return n[r]=e(t[r]),n},{},le(t));default:return at(e,t)}}));const ht=Z(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(n){return e(n)(t(n))}:st(function(e,n){return function(e,t){var n;t=t||[];var r=(e=e||[]).length,s=t.length,o=[];for(n=0;n<r;)o[o.length]=e[n],n+=1;for(n=0;n<s;)o[o.length]=t[n],n+=1;return o}(e,lt(n,t))},[],e)});const ft=Z(function(e,t){var n=qe(e,t);return qe(e,function(){return Xe(ht,lt(n,arguments[0]),Array.prototype.slice.call(arguments,1))})});const pt=X(function(e){return ft(e.length,e)});const dt=Z(function(e,t){return We(e)?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:pt(Ke)(e,t)});function mt(e,t){return function(){return t.call(this,e.apply(this,arguments))}}function yt(e){return function t(n,r,s){switch(arguments.length){case 0:return t;case 1:return K(n)?t:Z(function(t,r){return e(n,t,r)});case 2:return K(n)&&K(r)?t:K(n)?Z(function(t,n){return e(t,r,n)}):K(r)?Z(function(t,r){return e(n,t,r)}):X(function(t){return e(n,r,t)});default:return K(n)&&K(r)&&K(s)?t:K(n)&&K(r)?Z(function(t,n){return e(t,n,s)}):K(n)&&K(s)?Z(function(t,n){return e(t,r,n)}):K(r)&&K(s)?Z(function(t,r){return e(n,t,r)}):K(n)?X(function(t){return e(t,r,s)}):K(r)?X(function(t){return e(n,t,s)}):K(s)?X(function(t){return e(n,r,t)}):e(n,r,s)}}}function gt(e,t,n){for(var r=0,s=n.length;r<s;){if((t=e["@@transducer/step"](t,n[r]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r+=1}return e["@@transducer/result"](t)}const vt=Z(function(e,t){return Ye(e.length,function(){return e.apply(t,arguments)})});function bt(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function wt(e,t,n,r){return e["@@transducer/result"](n[r](vt(e["@@transducer/step"],e),t))}const Tt=tt(gt,wt,bt);var kt=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 xt=yt(function(e,t,n){return Tt("function"==typeof e?new kt(e):e,t,n)});function Et(e,t){return function(){var n=arguments.length;if(0===n)return t();var r=arguments[n-1];return Ze(r)||"function"!=typeof r[e]?t.apply(this,arguments):r[e].apply(r,Array.prototype.slice.call(arguments,0,n-1))}}const At=X(Et("tail",yt(Et("slice",function(e,t,n){return Array.prototype.slice.call(n,e,t)}))(1,1/0)));function Pt(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return Ye(arguments[0].length,xt(mt,arguments[0],At(arguments)))}function St(e,t){return function(e,t,n){var r,s;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(r=1/t;n<e.length;){if(0===(s=e[n])&&1/s===r)return n;n+=1}return-1}if(t!=t){for(;n<e.length;){if("number"==typeof(s=e[n])&&s!=s)return n;n+=1}return-1}return e.indexOf(t,n);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,n);case"object":if(null===t)return e.indexOf(t,n)}for(;n<e.length;){if(de(e[n],t))return n;n+=1}return-1}(t,e,0)>=0}function Ot(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 Mt=function(e){return(e<10?"0":"")+e};const jt="function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+Mt(e.getUTCMonth()+1)+"-"+Mt(e.getUTCDate())+"T"+Mt(e.getUTCHours())+":"+Mt(e.getUTCMinutes())+":"+Mt(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};var Nt=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=it,e.prototype["@@transducer/result"]=ct,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}();function Ct(e){return function(t){return new Nt(e,t)}}var $t=Z(ot(["fantasy-land/filter","filter"],Ct,function(e,t){return n=t,"[object Object]"===Object.prototype.toString.call(n)?Xe(function(n,r){return e(t[r])&&(n[r]=t[r]),n},{},le(t)):function(e){return"[object Map]"===Object.prototype.toString.call(e)}(t)?function(e,t){for(var n=new Map,r=t.entries(),s=r.next();!s.done;)e(s.value[1])&&n.set(s.value[0],s.value[1]),s=r.next();return n}(e,t):function(e,t){for(var n=0,r=t.length,s=[];n<r;)e(t[n])&&(s[s.length]=t[n]),n+=1;return s}(e,t);var n}));const Lt=$t;const _t=Z(function(e,t){return Lt((n=e,function(){return!n.apply(this,arguments)}),t);var n});function Rt(e,t){var n=function(n){var r=t.concat([e]);return St(n,r)?"<Circular>":Rt(n,r)},r=function(e,t){return at(function(t){return Ot(t)+": "+n(e[t])},t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+at(n,e).join(", ")+"))";case"[object Array]":return"["+at(n,e).concat(r(e,_t(function(e){return/^\d+$/.test(e)},le(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+n(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?n(NaN):Ot(jt(e)))+")";case"[object Map]":return"new Map("+n(Array.from(e))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+n(e.valueOf())+")":1/e==-1/0?"-0":e.toString(10);case"[object Set]":return"new Set("+n(Array.from(e).sort())+")";case"[object String]":return"object"==typeof e?"new String("+n(e.valueOf())+")":Ot(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var s=e.toString();if("[object Object]"!==s)return s}return"{"+r(e,le(e)).join(", ")+"}"}}const It=X(function(e){return Rt(e,[])});const Ft=Z(function(e,t){return e||t});const Dt=Z(function(e,t){return We(e)?function(){return e.apply(this,arguments)||t.apply(this,arguments)}:pt(Ft)(e,t)});const Vt=pt(X(function(e){return!e}))(de(null));const Ut=Z(function(e,t){if(e===t)return t;function n(e,t){if(e>t!=t>e)return t>e?t:e}var r=n(e,t);if(void 0!==r)return r;var s=n(typeof e,typeof t);if(void 0!==s)return s===typeof e?e:t;var o=It(e),a=n(o,It(t));return void 0!==a&&a===o?e:t}),Ht=Number.isInteger||function(e){return(e|0)===e};function zt(e,t){return t[e<0?t.length+e:e]}const Bt=Z(function(e,t){if(null!=t)return Ht(e)?zt(e,t):t[e]});const Jt=Z(function(e,t){return lt(Bt(e),t)});const Yt=X(function(e){return qe(xt(Ut,0,Jt("length",e)),function(){for(var t=0,n=e.length;t<n;){if(e[t].apply(this,arguments))return!0;t+=1}return!1})});var Gt=function(e,t){switch(arguments.length){case 0:return Gt;case 1:return function t(n){return 0===arguments.length?t:ne(e,n)};default:return ne(e,t)}};const qt=Gt;const Wt=qe(1,Pt(he,qt("GeneratorFunction")));const Kt=qe(1,Pt(he,qt("AsyncFunction")));var Xt=Yt([Pt(he,qt("Function")),Wt,Kt]);function Zt(e){return Zt="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},Zt(e)}var Qt=qe(1,dt(Vt,Dt(function(e){return"object"===Zt(e)},Xt)));const en=qe(1,dt(Qt,Pt(It,de("[object Promise]")))),tn=e=>{const t=e?.element;return void 0===t||"element"===t?"Element":`${t.charAt(0).toUpperCase()}${t.slice(1)}Element`},nn=e=>Ae(e),rn=e=>ze(e),sn=(e,t,n)=>{Oe(e)?e.value=n:Array.isArray(e)?e[t]=null===n?void 0:n:null===n?delete e[t]:e[t]=n},on=e=>Oe(e)?["key","value"]:Pe(e)||Se(e)?["content"]:[],an=(e,t)=>{if(void 0!==e[t])return e[t];const n=t.length;for(const r in e){if(!r.includes("|"))continue;const s=r.indexOf(t);if(-1===s)continue;const o=0===s||"|"===r[s-1],a=s+n===r.length||"|"===r[s+n];if(o&&a)return e[r]}},cn=(e,t,n)=>{if(void 0===t)return null;const r=e,s=n?"leave":"enter",o=an(r,t);if(!n&&"function"==typeof o)return o;if(null!=o){const e=o[s];if("function"==typeof e)return e}const a=r[s];if("function"==typeof a)return a;if(null!=a){const e=an(a,t);if("function"==typeof e)return e}return null};function un(e,t){return new Je(t,e.parent,e.parentPath,e.key,e.inList)}function*ln(e,t,n){const{keyMap:r,state:s,nodeTypeGetter:o,nodePredicate:i,nodeCloneFn:c,detectCycles:u,mutable:l,mutationFn:h}=n,f="function"==typeof r;let p,d,m=Array.isArray(e),y=[e],g=-1,v=[],b=e,w=null,T=null;const k=[];do{g+=1;const e=g===y.length;let n;const x=e&&0!==v.length;if(e){if(n=0===k.length?void 0:w?.key,b=d,d=k.pop(),T=w?.parentPath?.parentPath??null,x)if(l)for(const[e,t]of v)h(b,e,t);else if(m){b=b.slice();let e=0;for(const[t,n]of v){const r=t-e;null===n?(b.splice(r,1),e+=1):b[r]=n}}else{b=c(b);for(const[e,t]of v)b[e]=t}if(void 0!==p){g=p.index,y=p.keys,v=p.edits;const e=p.inArray;if(T=p.parentPath,p=p.prev,x&&!l){const t=e?g:y[g];v.push([t,b])}m=e}}else if(void 0!==d&&(n=m?g:y[g],b=d[n],void 0===b))continue;if(!Array.isArray(b)){if(!i(b))throw new a(`Invalid AST Node: ${String(b)}`,{node:b});if(u&&k.includes(b))continue;w=new Je(b,d,T,n,m);const r=cn(t,o(b),e);if(r){for(const[e,n]of Object.entries(s))t[e]=n;const o=yield{visitFn:r,path:w,isLeaving:e};if(w.shouldStop)break;if(w.shouldSkip&&!e)continue;if(w.removed){if(v.push([n,null]),!e)continue}else if(w._wasReplaced()){const t=w._getReplacementNode();if(v.push([n,t]),!e){if(!i(t))continue;b=t}}else if(void 0!==o&&(v.push([n,o]),!e)){if(!i(o))continue;b=o}w._markStale()}}if(!e){if(p={inArray:m,index:g,keys:y,edits:v,parentPath:T,prev:p},m=Array.isArray(b),m)y=b;else if(f)y=r(b);else{const e=o(b);y=void 0!==e?r[e]??[]:[]}g=-1,v=[],void 0!==d&&k.push(d),d=b,T=w}}while(void 0!==p);return 0!==v.length?v.at(-1)[1]:e}((e,t={})=>{const{visitFnGetter:n=cn,nodeTypeGetter:r=tn,exposeEdits:s=!1}=t,o=Symbol("internal-skip"),i=Symbol("break"),c=new Array(e.length).fill(o);return{enter(t){let u=t.node,l=!1;for(let h=0;h<e.length;h+=1)if(c[h]===o){const o=n(e[h],r(u),!1);if("function"==typeof o){const n=un(t,u),r=o.call(e[h],n);if(en(r))throw new a("Async visitor not supported in sync mode",{visitor:e[h],visitFn:o});if(n.shouldStop){c[h]=i;break}if(n.shouldSkip&&(c[h]=u),n.removed)return void t.remove();if(n._wasReplaced()){const e=n._getReplacementNode();if(!s)return t.replaceWith(e),e;u=e,l=!0}else if(void 0!==r){if(!s)return t.replaceWith(r),r;u=r,l=!0}}}if(l)return t.replaceWith(u),u},leave(t){const s=t.node;for(let u=0;u<e.length;u+=1)if(c[u]===o){const o=n(e[u],r(s),!0);if("function"==typeof o){const n=un(t,s),r=o.call(e[u],n);if(en(r))throw new a("Async visitor not supported in sync mode",{visitor:e[u],visitFn:o});if(n.shouldStop){c[u]=i;break}if(n.removed)return void t.remove();if(n._wasReplaced()){const e=n._getReplacementNode();return t.replaceWith(e),e}if(void 0!==r)return t.replaceWith(r),r}}else c[u]===s&&(c[u]=o)}}})[Symbol.for("nodejs.util.promisify.custom")]=(e,t={})=>{const{visitFnGetter:n=cn,nodeTypeGetter:r=tn,exposeEdits:s=!1}=t,o=Symbol("internal-skip"),a=Symbol("break"),i=new Array(e.length).fill(o);return{async enter(t){let c=t.node,u=!1;for(let l=0;l<e.length;l+=1)if(i[l]===o){const o=n(e[l],r(c),!1);if("function"==typeof o){const n=un(t,c),r=await o.call(e[l],n);if(n.shouldStop){i[l]=a;break}if(n.shouldSkip&&(i[l]=c),n.removed)return void t.remove();if(n._wasReplaced()){const e=n._getReplacementNode();if(!s)return t.replaceWith(e),e;c=e,u=!0}else if(void 0!==r){if(!s)return t.replaceWith(r),r;c=r,u=!0}}}if(u)return t.replaceWith(c),c},async leave(t){const s=t.node;for(let c=0;c<e.length;c+=1)if(i[c]===o){const o=n(e[c],r(s),!0);if("function"==typeof o){const n=un(t,s),r=await o.call(e[c],n);if(n.shouldStop){i[c]=a;break}if(n.removed)return void t.remove();if(n._wasReplaced()){const e=n._getReplacementNode();return t.replaceWith(e),e}if(void 0!==r)return t.replaceWith(r),r}}else i[c]===s&&(i[c]=o)}}};const hn=(e,t,n={})=>{const r=ln(e,t,{keyMap:n.keyMap??on,state:n.state??{},nodeTypeGetter:n.nodeTypeGetter??tn,nodePredicate:n.nodePredicate??nn,nodeCloneFn:n.nodeCloneFn??rn,detectCycles:n.detectCycles??!0,mutable:n.mutable??!1,mutationFn:n.mutationFn??sn});let s=r.next();for(;!s.done;){const e=s.value,n=e.visitFn.call(t,e.path);if(en(n))throw new a("Async visitor not supported in sync mode",{visitor:t,visitFn:e.visitFn});s=r.next(n)}return s.value},fn=async(e,t,n={})=>{const r=ln(e,t,{keyMap:n.keyMap??on,state:n.state??{},nodeTypeGetter:n.nodeTypeGetter??tn,nodePredicate:n.nodePredicate??nn,nodeCloneFn:n.nodeCloneFn??rn,detectCycles:n.detectCycles??!0,mutable:n.mutable??!1,mutationFn:n.mutationFn??sn});let s=r.next();for(;!s.done;){const e=s.value,n=await e.visitFn.call(t,e.path);s=r.next(n)}return s.value};hn[Symbol.for("nodejs.util.promisify.custom")]=fn,Je.prototype.traverse=function(e,t){return hn(this.node,e,t)},Je.prototype.traverseAsync=function(e,t){return fn(this.node,e,t)};const pn=class extends D{name="apidom";isArray(e){return Pe(e)}isObject(e){return Se(e)}sizeOf(e){return this.isArray(e)||this.isObject(e)?e.length:0}has(e,t){if(this.isArray(e)){const n=Number(t),r=n>>>0;if(n!==r)throw new U(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return r<this.sizeOf(e)}if(this.isObject(e)){const n=e.keys(),r=new Set(n);if(n.length!==r.size)throw new B(`Object key "${t}" is not unique — JSON Pointer requires unique member names`,{referenceToken:t,currentValue:e,realm:this.name});return e.hasKey(t)}return!1}evaluate(e,t){return this.isArray(e)?e.get(Number(t)):e.get(t)}};const dn=X(function(e){return zt(-1,e)}),mn=(e,t,n)=>{let r,s=[],o=t;if(hn(n,{enter(e){e.node===t&&(s=e.getAncestorNodes().reverse().filter(Ae),e.stop())}}),0===s.length)throw new u("Relative JSON Pointer evaluation failed. Current element not found inside the root element",{relativePointer:e,currentElement:Ve(t),rootElement:Ve(n),cursorElement:Ve.safe(o)});if(dn(s)===n)throw new u("Relative JSON Pointer evaluation failed. Current element cannot be the root element",{relativePointer:e,currentElement:t,rootElement:n,cursorElement:o});try{r=q(e)}catch(n){throw new u("Relative JSON Pointer evaluation failed while parsing the pointer.",{relativePointer:e,currentElement:Ve(t),rootElement:Ve(t),cursorElement:Ve.safe(o),cause:n})}if(r.nonNegativeIntegerPrefix>0){const a=[...s];for(let{nonNegativeIntegerPrefix:e}=r;e>0;e-=1)o=a.pop(),Oe(o)&&(o=a.pop());if(void 0===o)throw new u(`Relative JSON Pointer evaluation failed on non-negative-integer prefix of "${r.nonNegativeIntegerPrefix}"`,{relativePointer:e,currentElement:Ve(t),rootElement:Ve(n),cursorElement:Ve.safe(o)});s=a}if("number"==typeof r.indexManipulation){const a=dn(s);if(void 0===a||!Pe(a))throw new u(`Relative JSON Pointer evaluation failed failed on index-manipulation "${r.indexManipulation}"`,{relativePointer:e,currentElement:Ve(t),rootElement:Ve(n),cursorElement:Ve.safe(o)});const i=a.content,c=i.indexOf(o);if(o=i[c+r.indexManipulation],void 0===o)throw new u(`Relative JSON Pointer evaluation failed on index-manipulation "${r.indexManipulation}"`,{relativePointer:e,currentElement:Ve(t),rootElement:Ve(n),cursorElement:Ve.safe(o)})}if(Array.isArray(r.jsonPointerTokens)){o=((e,t,n={})=>J(e,t,{...n,realm:new pn}))(o,I(r.jsonPointerTokens))}else if(r.hashCharacter){if(o===n)throw new u('Relative JSON Pointer evaluation failed. Current element cannot be the root element to apply "#"',{relativePointer:e,currentElement:Ve(t),rootElement:Ve(n),cursorElement:Ve.safe(o)});const r=dn(s);void 0!==r&&(Oe(r)?o=r.key:Pe(r)&&(o=new Be(r.content.indexOf(o))))}return o};return t})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-json-pointer-relative",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Evaluate Relative JSON Pointer expressions against ApiDOM.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -39,10 +39,11 @@
|
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
42
|
-
"@speclynx/apidom-core": "^
|
|
43
|
-
"@speclynx/apidom-
|
|
44
|
-
"@speclynx/apidom-
|
|
45
|
-
"@
|
|
42
|
+
"@speclynx/apidom-core": "^2.0.1",
|
|
43
|
+
"@speclynx/apidom-datamodel": "^2.0.1",
|
|
44
|
+
"@speclynx/apidom-error": "^2.0.1",
|
|
45
|
+
"@speclynx/apidom-json-pointer": "^2.0.1",
|
|
46
|
+
"@speclynx/apidom-traverse": "^2.0.1",
|
|
46
47
|
"ramda": "~0.32.0",
|
|
47
48
|
"ramda-adjunct": "^6.0.0"
|
|
48
49
|
},
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"README.md",
|
|
57
58
|
"CHANGELOG.md"
|
|
58
59
|
],
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "6a9caf87f445f76ffd69afa760990ffa784bc82d"
|
|
60
61
|
}
|
package/src/evaluate.cjs
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var
|
|
6
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
|
+
var _apidomTraverse = require("@speclynx/apidom-traverse");
|
|
7
8
|
var _apidomJsonPointer = require("@speclynx/apidom-json-pointer");
|
|
8
9
|
var _ramda = require("ramda");
|
|
9
10
|
var _EvaluationRelativeJsonPointerError = _interopRequireDefault(require("./errors/EvaluationRelativeJsonPointerError.cjs"));
|
|
@@ -15,21 +16,20 @@ var _parse = _interopRequireDefault(require("./parse.cjs"));
|
|
|
15
16
|
const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
16
17
|
let ancestorLineage = [];
|
|
17
18
|
let cursor = currentElement;
|
|
18
|
-
(0,
|
|
19
|
-
enter(
|
|
20
|
-
if (
|
|
21
|
-
ancestorLineage =
|
|
22
|
-
|
|
19
|
+
(0, _apidomTraverse.traverse)(rootElement, {
|
|
20
|
+
enter(path) {
|
|
21
|
+
if (path.node === currentElement) {
|
|
22
|
+
ancestorLineage = path.getAncestorNodes().reverse().filter(_apidomDatamodel.isElement);
|
|
23
|
+
path.stop();
|
|
23
24
|
}
|
|
24
|
-
return undefined;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
if (ancestorLineage.length === 0) {
|
|
28
28
|
throw new _EvaluationRelativeJsonPointerError.default('Relative JSON Pointer evaluation failed. Current element not found inside the root element', {
|
|
29
29
|
relativePointer,
|
|
30
|
-
currentElement: (0,
|
|
31
|
-
rootElement: (0,
|
|
32
|
-
cursorElement:
|
|
30
|
+
currentElement: (0, _apidomDatamodel.cloneDeep)(currentElement),
|
|
31
|
+
rootElement: (0, _apidomDatamodel.cloneDeep)(rootElement),
|
|
32
|
+
cursorElement: _apidomDatamodel.cloneDeep.safe(cursor)
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
if ((0, _ramda.last)(ancestorLineage) === rootElement) {
|
|
@@ -46,9 +46,9 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
46
46
|
} catch (error) {
|
|
47
47
|
throw new _EvaluationRelativeJsonPointerError.default('Relative JSON Pointer evaluation failed while parsing the pointer.', {
|
|
48
48
|
relativePointer,
|
|
49
|
-
currentElement: (0,
|
|
50
|
-
rootElement: (0,
|
|
51
|
-
cursorElement:
|
|
49
|
+
currentElement: (0, _apidomDatamodel.cloneDeep)(currentElement),
|
|
50
|
+
rootElement: (0, _apidomDatamodel.cloneDeep)(currentElement),
|
|
51
|
+
cursorElement: _apidomDatamodel.cloneDeep.safe(cursor),
|
|
52
52
|
cause: error
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -60,16 +60,16 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
60
60
|
nonNegativeIntegerPrefix
|
|
61
61
|
} = relativeJsonPointer; nonNegativeIntegerPrefix > 0; nonNegativeIntegerPrefix -= 1) {
|
|
62
62
|
cursor = ancestorLineageCopy.pop();
|
|
63
|
-
if ((0,
|
|
63
|
+
if ((0, _apidomDatamodel.isMemberElement)(cursor)) {
|
|
64
64
|
cursor = ancestorLineageCopy.pop();
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
if (typeof cursor === 'undefined') {
|
|
68
68
|
throw new _EvaluationRelativeJsonPointerError.default(`Relative JSON Pointer evaluation failed on non-negative-integer prefix of "${relativeJsonPointer.nonNegativeIntegerPrefix}"`, {
|
|
69
69
|
relativePointer,
|
|
70
|
-
currentElement: (0,
|
|
71
|
-
rootElement: (0,
|
|
72
|
-
cursorElement:
|
|
70
|
+
currentElement: (0, _apidomDatamodel.cloneDeep)(currentElement),
|
|
71
|
+
rootElement: (0, _apidomDatamodel.cloneDeep)(rootElement),
|
|
72
|
+
cursorElement: _apidomDatamodel.cloneDeep.safe(cursor)
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
ancestorLineage = ancestorLineageCopy;
|
|
@@ -78,23 +78,24 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
78
78
|
// index-manipulation
|
|
79
79
|
if (typeof relativeJsonPointer.indexManipulation === 'number') {
|
|
80
80
|
const containedArray = (0, _ramda.last)(ancestorLineage);
|
|
81
|
-
if (typeof containedArray === 'undefined' || !(0,
|
|
81
|
+
if (typeof containedArray === 'undefined' || !(0, _apidomDatamodel.isArrayElement)(containedArray)) {
|
|
82
82
|
throw new _EvaluationRelativeJsonPointerError.default(`Relative JSON Pointer evaluation failed failed on index-manipulation "${relativeJsonPointer.indexManipulation}"`, {
|
|
83
83
|
relativePointer,
|
|
84
|
-
currentElement: (0,
|
|
85
|
-
rootElement: (0,
|
|
86
|
-
cursorElement:
|
|
84
|
+
currentElement: (0, _apidomDatamodel.cloneDeep)(currentElement),
|
|
85
|
+
rootElement: (0, _apidomDatamodel.cloneDeep)(rootElement),
|
|
86
|
+
cursorElement: _apidomDatamodel.cloneDeep.safe(cursor)
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const arrayContent = containedArray.content;
|
|
90
|
+
const currentCursorIndex = arrayContent.indexOf(cursor);
|
|
90
91
|
const newCursorIndex = currentCursorIndex + relativeJsonPointer.indexManipulation;
|
|
91
|
-
cursor =
|
|
92
|
+
cursor = arrayContent[newCursorIndex];
|
|
92
93
|
if (typeof cursor === 'undefined') {
|
|
93
94
|
throw new _EvaluationRelativeJsonPointerError.default(`Relative JSON Pointer evaluation failed on index-manipulation "${relativeJsonPointer.indexManipulation}"`, {
|
|
94
95
|
relativePointer,
|
|
95
|
-
currentElement: (0,
|
|
96
|
-
rootElement: (0,
|
|
97
|
-
cursorElement:
|
|
96
|
+
currentElement: (0, _apidomDatamodel.cloneDeep)(currentElement),
|
|
97
|
+
rootElement: (0, _apidomDatamodel.cloneDeep)(rootElement),
|
|
98
|
+
cursorElement: _apidomDatamodel.cloneDeep.safe(cursor)
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
}
|
|
@@ -107,17 +108,17 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
107
108
|
if (cursor === rootElement) {
|
|
108
109
|
throw new _EvaluationRelativeJsonPointerError.default('Relative JSON Pointer evaluation failed. Current element cannot be the root element to apply "#"', {
|
|
109
110
|
relativePointer,
|
|
110
|
-
currentElement: (0,
|
|
111
|
-
rootElement: (0,
|
|
112
|
-
cursorElement:
|
|
111
|
+
currentElement: (0, _apidomDatamodel.cloneDeep)(currentElement),
|
|
112
|
+
rootElement: (0, _apidomDatamodel.cloneDeep)(rootElement),
|
|
113
|
+
cursorElement: _apidomDatamodel.cloneDeep.safe(cursor)
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
116
|
const parentElement = (0, _ramda.last)(ancestorLineage);
|
|
116
117
|
if (typeof parentElement !== 'undefined') {
|
|
117
|
-
if ((0,
|
|
118
|
+
if ((0, _apidomDatamodel.isMemberElement)(parentElement)) {
|
|
118
119
|
cursor = parentElement.key;
|
|
119
|
-
} else if ((0,
|
|
120
|
-
cursor = new
|
|
120
|
+
} else if ((0, _apidomDatamodel.isArrayElement)(parentElement)) {
|
|
121
|
+
cursor = new _apidomDatamodel.NumberElement(parentElement.content.indexOf(cursor));
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
}
|