asty-astq
Version:
Abstract Syntax Tree With Integrated Query Engine
27 lines (26 loc) • 117 kB
JavaScript
/*
** ASTy-ASTq -- Abstract Syntax Tree With Integrated Query Engine
** Copyright (c) 2014-2023 Dr. Ralf S. Engelschall <rse@engelschall.com>
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ASTYASTQ = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
(function (global){(function (){
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ASTQ=e()}}(function(){return function(){return function e(t,r,n){function o(u,a){if(!r[u]){if(!t[u]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var s=r[u]={exports:{}};t[u][0].call(s.exports,function(e){return o(t[u][1][e]||e)},s,s.exports,e,t,r,n)}return r[u].exports}for(var i="function"==typeof _dereq_&&_dereq_,u=0;u<n.length;u++)o(n[u]);return o}}()({1:[function(e,t,r){(function(n){(function(){!function(e){"object"==typeof r&&void 0!==t?t.exports=e():("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).ASTY=e()}(function(){return function t(r,n,o){function i(a,c){if(!n[a]){if(!r[a]){var l="function"==typeof e&&e;if(!c&&l)return l(a,!0);if(u)return u(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var f=n[a]={exports:{}};r[a][0].call(f.exports,function(e){return i(r[a][1][e]||e)},f,f.exports,t,r,n,o)}return n[a].exports}for(var u="function"==typeof e&&e,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"init",value:function(e,t,r,o){if(arguments.length<2)throw new Error("init: invalid number of arguments");if(this.ctx=e,this.ASTy=!0,this.T=t,this.L={L:0,C:0,O:0},this.A={},this.C=[],this.P=null,"object"===n(r))for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&this.set(i,r[i]);return"object"===n(o)&&o instanceof Array&&this.add(o),this}},{key:"create",value:function(e,t,r){return this.ctx.create(e,t,r)}},{key:"type",value:function(e){if(0===arguments.length)return this.T;if(1===arguments.length)return this.T=e,this;throw new Error("type: invalid number of arguments")}},{key:"pos",value:function(e,t,r){if(0===arguments.length)return{line:this.L.L,column:this.L.C,offset:this.L.O};if(arguments.length<=3)return this.L.L=e||0,this.L.C=t||0,this.L.O=r||0,this;throw new Error("pos: invalid number of arguments")}},{key:"set",value:function(){for(var e=this,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];if(1===r.length&&"object"===n(r[0]))Object.keys(r[0]).forEach(function(t){void 0!==r[0][t]?e.A[t]=r[0][t]:delete e.A[t]});else{if(2!==r.length)throw new Error("set: invalid number of arguments");void 0!==r[1]?this.A[r[0]]=r[1]:delete this.A[r[0]]}return this}},{key:"unset",value:function(){for(var e=this,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];if(1===r.length&&"object"===n(r[0])&&r[0]instanceof Array)r[0].forEach(function(t){delete e.A[t]});else{if(1!==r.length)throw new Error("unset: invalid number of arguments");delete this.A[r[0]]}return this}},{key:"get",value:function(){for(var e=this,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];if(1!==r.length)throw new Error("get: invalid number of arguments");if("object"===n(r[0])&&r[0]instanceof Array)return r[0].map(function(t){if("string"!=typeof t)throw new Error("get: invalid key argument");return e.A[t]});var i=r[0];if("string"!=typeof i)throw new Error("get: invalid key argument");return this.A[i]}},{key:"attrs",value:function(){return Object.keys(this.A)}},{key:"nth",value:function(){if(null===this.P)return 1;var e=this.P.C.indexOf(this);if(e<0)throw new Error("nth: internal error -- node not in childs of its parent");return e}},{key:"ins",value:function(e){for(var t=this,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];if(0===o.length)throw new Error("ins: invalid number of arguments");if(e<0&&(e=this.C.length+1-e),!(e>=0&&e<=this.C.length))throw new Error("ins: invalid position");var u=function(r){if(!t.ctx.isA(r))throw new Error("ins: invalid AST node argument");t.C.splice(e++,0,r),r.P=t};return o.forEach(function(e){"object"===n(e)&&e instanceof Array?e.forEach(function(e){u(e)}):null!==e&&u(e)}),this}},{key:"add",value:function(){for(var e=this,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];if(0===r.length)throw new Error("add: invalid number of arguments");var i=function(t){if(!e.ctx.isA(t))throw new Error("add: invalid AST node argument");e.C.push(t),t.P=e};return r.forEach(function(e){"object"===n(e)&&e instanceof Array?e.forEach(function(e){i(e)}):null!==e&&i(e)}),this}},{key:"del",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(0===r.length)throw new Error("del: invalid number of arguments");return r.forEach(function(t){if(!e.ctx.isA(t))throw new Error("del: invalid AST node argument");for(var r=!1,n=0;n<e.C.length;n++)if(e.C[n]===t){e.C.splice(n,1),t.P=null,r=!0;break}if(!r)throw new Error("del: AST node not found in childs")}),this}},{key:"childs",value:function(){if(arguments.length>2)throw new Error("childs: invalid number of arguments");if(2===arguments.length&&"number"==typeof(arguments.length<=0?void 0:arguments[0])&&"number"==typeof(arguments.length<=1?void 0:arguments[1]))return this.C.slice(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]);if(1===arguments.length&&"number"==typeof(arguments.length<=0?void 0:arguments[0]))return this.C.slice(arguments.length<=0?void 0:arguments[0]);if(0===arguments.length)return this.C;throw new Error("childs: invalid type of arguments")}},{key:"child",value:function(e){if("number"!=typeof e)throw new Error("child: invalid argument");return e<this.C.length?this.C[e]:null}},{key:"parent",value:function(){return this.P}},{key:"serialize",value:function(){return this.ctx.__serialize(this)}}]),e}()},{}],2:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var u={mid:{unicode:String.fromCharCode(9500),ascii:"+"},last:{unicode:String.fromCharCode(9492),ascii:"+"},down:{unicode:String.fromCharCode(9474),ascii:"|"},left:{unicode:String.fromCharCode(9472),ascii:"-"}};r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"dump",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1/0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return t},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o="",i=this;return this.walk(function(a,c){if(!(c>e)){if(c>0){var l=function(e){var t=0,r=0;return null!==e.P&&(t=e.P.C.indexOf(e),r=e.P.C.length-1),{nth:t,max:r}},s=l(a),f=s.nth,p=s.max,d=" ";d=r?"".concat(u.left.unicode).concat(u.left.unicode).concat(d):"".concat(u.left.ascii).concat(u.left.ascii).concat(d),d=f<p?"".concat(r?u.mid.unicode:u.mid.ascii).concat(d):"".concat(r?u.last.unicode:u.last.ascii).concat(d);for(var y=a.P;null!==y&&y!==i;y=y.P)if(null!==y.P){var h=l(y);d=h.nth<h.max?"".concat(r?u.down.unicode:u.down.ascii," ").concat(d):" ".concat(d)}o+=t("tree",d)}o+=t("type",a.T)+" ";var v=Object.keys(a.A).filter(function(e){return!e.match(/^__/)});if(v.length>0){o+=t("parenthesis","(");var b=!0;v.forEach(function(e){b?b=!1:o+=t("comma",",")+" ",o+=t("key",e)+t("colon",":")+" ";var r=a.A[e];switch(n(r)){case"boolean":case"number":o+=t("value",r.toString());break;case"string":var i=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};o+=t("value",'"'+r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+i(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+i(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+i(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+i(e)})+'"');break;case"object":r instanceof RegExp?o+=t("value","/"+r.source+"/"):o+=t("value",JSON.stringify(r));break;default:o+=t("value",JSON.stringify(r))}}),o+=t("parenthesis",")")+" "}o+=t("position",t("bracket","[")+t("line",a.L.L)+t("slash",",")+t("column",a.L.C)+t("bracket","]")),o+="\n"}},"downward"),o}}]),e}()},{}],3:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"merge",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return this;if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(r){var o=e.pos();this.pos(o.line,o.column,o.offset)}e.attrs().forEach(function(r){var o=void 0!==n[r]?n[r]:r;null!==o&&t.set(o,e.get(r))}),e.childs().forEach(function(r){e.del(r),t.add(r)});var i=e.parent();return null!==i&&i.del(e),this}}]),e}()},{}],4:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,0,[{key:"serialize",value:function(e,t){if(!e.isA(t))throw new Error("serialize: not an ASTy node");return JSON.stringify({ASTy:function e(t){var r={T:t.T,L:{L:t.L.L,C:t.L.C,O:t.L.O}},o=Object.keys(t.A);return o.length>0&&(r.A={},o.forEach(function(e){var o=t.A[e];switch(n(o)){case"boolean":case"number":case"string":r.A[e]=o;break;default:r.A[e]=JSON.parse(JSON.stringify(o))}})),t.C.length>0&&(r.C=t.C.map(function(t){return e(t)})),r}(t)})}},{key:"unserialize",value:function(e,t){var r=JSON.parse(t);if("object"!==n(r)||"object"!==n(r.ASTy))throw new Error("unserialize: not an ASTy JSON export");return function t(r){var o=e.create(r.T);return o.pos(r.L.L,r.L.C,r.L.O),"object"===n(r.A)&&Object.keys(r.A).forEach(function(e){var t=r.A[e];switch(n(t)){case"boolean":case"number":case"string":o.set(e,t);break;default:o.set(e,JSON.parse(JSON.stringify(t)))}}),"object"===n(r.C)&&r.C instanceof Array&&o.add(r.C.map(function(e){return t(e)})),o}(r.ASTy)}}]),e}()},{}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default={major:1,minor:8,micro:20,date:20240308}},{}],6:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"walk",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"downward";return function r(n,o,i){"downward"!==t&&"both"!==t||e(n,o,i,"downward"),n.C.forEach(function(e){r(e,o+1,n)}),"upward"!==t&&"both"!==t||e(n,o,i,"upward")}(this,0,null),this}}]),e}()},{}],7:[function(e,t,r){"use strict";var n=l(e("./asty-base.js")),o=l(e("./asty-merge.js")),i=l(e("./asty-walk.js")),u=l(e("./asty-dump.js")),a=l(e("./asty-serialize.js")),c=l(e("./asty-version.js"));function l(e){return e&&e.__esModule?e:{default:e}}function s(e){return(s="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})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function d(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function y(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==s(t)?t:String(t)}var h=function(){function e(){var t=this;return f(this,e),this.ASTYNode=d(function e(){f(this,e)}),[[n.default,"init","create","type","pos","set","unset","get","attrs","nth","ins","add","del","childs","child","parent","serialize"],[o.default,"merge"],[i.default,"walk"],[u.default,"dump"]].forEach(function(e){var r=e[0].prototype;e.slice(1).forEach(function(e){t.ASTYNode.prototype[e]=r[e]})}),this}return d(e,[{key:"version",value:function(){return c.default}},{key:"extend",value:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.ASTYNode.prototype[t]=e[t]);return this}},{key:"create",value:function(e,t,r){return(new this.ASTYNode).init(this,e,t,r)}},{key:"isA",value:function(e){return"object"===s(e)&&e instanceof this.ASTYNode&&"boolean"==typeof e.ASTy&&!0===e.ASTy}},{key:"__serialize",value:function(t){return e.serialize(t)}}],[{key:"serialize",value:function(e){return a.default.serialize(e.ctx,e)}},{key:"unserialize",value:function(e){return a.default.unserialize(new this,e)}}]),e}();t.exports=h},{"./asty-base.js":1,"./asty-dump.js":2,"./asty-merge.js":3,"./asty-serialize.js":4,"./asty-version.js":5,"./asty-walk.js":6}]},{},[1,2,3,4,5,6,7])(7)})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){(function(n){(function(){!function(e){"object"==typeof r&&void 0!==t?t.exports=e():("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).CacheLRU=e()}(function(){return function t(r,n,o){function i(a,c){if(!n[a]){if(!r[a]){var l="function"==typeof e&&e;if(!c&&l)return l(a,!0);if(u)return u(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var f=n[a]={exports:{}};r[a][0].call(f.exports,function(e){return i(r[a][1][e]||e)},f,f.exports,t,r,n,o)}return n[a].exports}for(var u="function"==typeof e&&e,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:String(t)}var u=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._index={},this._LRU={newer:null},this._MRU={older:null},this._LRU.newer=this._MRU,this._MRU.older=this._LRU,this._cur=0,this._max=1/0,this._dispose=function(){},this}return function(e,t,r){t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"limit",value:function(e){var t=this._max;return arguments.length>0&&(this._max=e,this._purge()),t}},{key:"dispose",value:function(e){return this._dispose=e,this}},{key:"length",value:function(){return this._cur}},{key:"keys",value:function(){return this.each(function(e,t){this.push(t)},[])}},{key:"values",value:function(){return this.each(function(e){this.push(e)},[])}},{key:"each",value:function(e,t){arguments<2&&(t=this);for(var r=0,n=this._MRU.older;n!==this._LRU;)e.call(t,n.val,n.key,r++),n=n.older;return t}},{key:"has",value:function(e){var t=this._index[e];return void 0!==t&&t.expires>=Date.now()}},{key:"peek",value:function(e){var t=this._index[e];if(void 0!==t){if(!(t.expires<Date.now()))return t.val;this.del(t.key)}}},{key:"touch",value:function(e){var t=this._index[e];if(void 0===t)throw new Error("touch: no such item");return this._promote(t),this}},{key:"get",value:function(e){var t=this._index[e];if(void 0!==t){if(!(t.expires<Date.now()))return this._promote(t),t.val;this.del(t.key)}}},{key:"set",value:function(e,t,r){arguments.length<3&&(r=1/0),r+=Date.now();var n=this._index[e];if(void 0===n)n={older:null,newer:null,key:e,val:t,expires:r},this._index[e]=n,this._attach(n),this._cur++,this._purge();else{var o=n.val;n.val=t,this._promote(n),this._dispose.call(void 0,n.key,o,"set")}return this}},{key:"del",value:function(e){var t=this._index[e];if(void 0===t)throw new Error("del: no such item");return delete this._index[e],this._detach(t),this._cur--,this._dispose.call(void 0,e,t.val,"del"),this}},{key:"clear",value:function(){for(;this._cur>0;)this.del(this._LRU.newer.key);return this}},{key:"_purge",value:function(){for(;this._cur>this._max;)this.del(this._LRU.newer.key)}},{key:"_promote",value:function(e){this._detach(e),this._attach(e)}},{key:"_detach",value:function(e){e.older.newer=e.newer,e.newer.older=e.older,e.older=null,e.newer=null}},{key:"_attach",value:function(e){e.older=this._MRU.older,e.newer=this._MRU,e.newer.older=e,e.older.newer=e}}]),e}();t.exports=u},{}]},{},[1])(1)})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t,r){(function(e){(function(){var r,n;r=void 0!==e?e:"undefined"!=typeof window?window:this,n=function(){var e={makeAST:function(e,t){return function(){return t.util.__makeAST.call(null,e().start.line,e().start.column,e().start.offset,arguments)}},makeUnroll:function(e,t){return function(r,n,o){if("object"!=typeof n||!(n instanceof Array))throw new t.util.__SyntaxError("unroll: invalid list argument for unrolling",typeof n,"Array",e());if(void 0!==o){"number"==typeof o&&(o=[o]);var i=[];null!==r&&i.push(r);for(var u=0;u<n.length;u++)for(var a=0;a<o.length;a++)i.push(n[u][o[a]]);return i}return null!==r&&n.unshift(r),n}}},t=function(e,t){var r=e.length,n=t-20;n<0&&(n=0);var o=t+20;o>r&&(o=r);var i=function(e){return e.charCodeAt(0).toString(16).toUpperCase()},u=function(e,t,r){return e.substr(t,r).replace(/\\/g,"\\\\").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+i(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+i(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+i(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+i(e)})};return{prolog:u(e,n,t-n),token:u(e,t,1),epilog:u(e,t+1,o-(t+1))}};return e.parse=function(r,n,o){if("object"!=typeof r)throw new Error("invalid parser object (not an object)");if("function"!=typeof r.parse)throw new Error('invalid parser object (no "parse" function)');if("string"!=typeof n)throw new Error("invalid input text (not a string)");if(void 0!==o&&"object"!=typeof o)throw new Error("invalid options (not an object)");void 0===o&&(o={});var i={ast:null,error:null};try{var u;u="function"==typeof o.makeAST?o.makeAST:function(e,t){return{line:e().start.line,column:e().start.column,offset:e().start.offset,args:t}},o.util={makeUnroll:e.makeUnroll,makeAST:e.makeAST,__makeAST:u,__SyntaxError:r.SyntaxError},i.ast=r.parse(n,o),i.error=null}catch(e){if(i.ast=null,e instanceof r.SyntaxError){var a=function(e,t){return void 0!==e?e:t};i.error={line:a(e.location.start.line,0),column:a(e.location.start.column,0),message:e.message,found:a(e.found,""),expected:a(e.expected,""),location:t(n,a(e.location.start.offset,0))}}else i.error={line:0,column:0,message:e.message,found:"",expected:"",location:t("",0)}}return i},e.errorMessage=function(e,t){for(var r=e.location,n="line "+e.line+" (column "+e.column+"): ",o="",i=0;i<n.length+r.prolog.length;i++)o+="-";return n+r.prolog+r.token+r.epilog+"\n"+o+"^\n"+e.message+(t?"":"\n")},e},"object"==typeof t&&"object"==typeof t.exports?t.exports=n():r.PEGUtil=n()}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return"object"===n(e)&&null!==e&&"boolean"==typeof e.ASTy}},{key:"getParentNode",value:function(e){return e.parent()}},{key:"getChildNodes",value:function(e){return e.childs()}},{key:"getNodeType",value:function(e){return e.type()}},{key:"getNodeAttrNames",value:function(e){return e.attrs()}},{key:"getNodeAttrValue",value:function(e,t){return e.get(t)}}]),e}()},{}],5:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return!("object"!==n(e)||null===e||("object"===("undefined"==typeof Element?"undefined":n(Element))&&e instanceof Element||"string"!=typeof e.tagName||""===e.tagName)&&("object"===("undefined"==typeof Document?"undefined":n(Document))&&e instanceof Document||"string"!=typeof e.type||"root"!==e.type))}},{key:"getParentNode",value:function(e){return e.parentNode}},{key:"getChildNodes",value:function(e){return"object"===n(e.childNodes)&&e.childNodes instanceof Array?e.childNodes:[]}},{key:"getNodeType",value:function(e){return e.tagName||"#".concat(e.type||"unknown")}},{key:"getNodeAttrNames",value:function(e){var t=["value"];return"object"===n(e.attribs)&&(t=t.concat(Object.keys(e.attribs))),t}},{key:"getNodeAttrValue",value:function(e,t){var r;return"value"===t?r=e.nodeValue:"object"===n(e.attribs)&&(r=e.attribs[t]),r}}]),e}()},{}],6:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return"object"===n(e)&&null!==e&&"string"==typeof e.kind&&""!==e.kind}},{key:"getParentNode",value:function(e,t){throw new Error("GraphQL AST does not support parent node traversal")}},{key:"getChildNodes",value:function(e,t){var r=this,o=[],i=function(e,t){Object.prototype.hasOwnProperty.call(e,t)&&r.taste(e[t])?o.push(e[t]):Object.prototype.hasOwnProperty.call(e,t)&&"object"===n(e[t])&&e[t]instanceof Array&&e[t].forEach(function(e){r.taste(e)&&o.push(e)})};if("*"===t)for(var u in e)i(e,u);else void 0!==e[t]&&i(e,t);return o}},{key:"getNodeType",value:function(e){return e.kind}},{key:"getNodeAttrNames",value:function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&"object"!==n(e[r])&&"kind"!==r&&"loc"!==r&&t.push(r);return t}},{key:"getNodeAttrValue",value:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&"object"!==n(e[t])&&"kind"!==t&&"loc"!==t?e[t]:void 0}}]),e}()},{}],7:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return"object"===n(e)&&null!==e}},{key:"getParentNode",value:function(e,t){throw new Error("JSON does not support parent node traversal")}},{key:"getChildNodes",value:function(e,t){var r=this,o=[],i=function(e,t){Object.prototype.hasOwnProperty.call(e,t)&&r.taste(e[t])?o.push(e[t]):Object.prototype.hasOwnProperty.call(e,t)&&"object"===n(e[t])&&e[t]instanceof Array&&e[t].forEach(function(e){r.taste(e)&&o.push(e)})};if("*"===t)for(var u in e)i(e,u);else void 0!==e[t]&&i(e,t);return o}},{key:"getNodeType",value:function(e){return null===e?"Null":e instanceof Boolean?"Boolean":e instanceof Number?"Number":e instanceof String?"String":"object"===n(e)?e instanceof Array?"Array":"function"==typeof e.constructor&&"string"==typeof e.constructor.name?e.constructor.name:"Object":"Unknown"}},{key:"getNodeAttrNames",value:function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&"object"!==n(e[r])&&t.push(r);return t}},{key:"getNodeAttrValue",value:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&"object"!==n(e[t])?e[t]:void 0}}]),e}()},{}],8:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return"object"===n(e)&&null!==e&&"string"==typeof e.type&&""!==e.type}},{key:"getParentNode",value:function(e,t){if("*"!==t&&"parent"!==t)throw new Error('no such axis named "'+t+'" for walking to parent nodes');if(void 0!==e.parent)return e.parent;throw new Error("Your Mozilla SpiderMonkey AST does not support parent node traversal")}},{key:"getChildNodes",value:function(e,t){var r=this,o=[],i=function(e,t){Object.prototype.hasOwnProperty.call(e,t)&&r.taste(e[t])?o.push(e[t]):Object.prototype.hasOwnProperty.call(e,t)&&"object"===n(e[t])&&e[t]instanceof Array&&e[t].forEach(function(e){r.taste(e)&&o.push(e)})};if("*"===t)for(var u in e)i(e,u);else void 0!==e[t]&&i(e,t);return o}},{key:"getNodeType",value:function(e){return e.type}},{key:"getNodeAttrNames",value:function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&"object"!==n(e[r])&&"type"!==r&&"loc"!==r&&t.push(r);return t}},{key:"getNodeAttrValue",value:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&"object"!==n(e[t])&&"type"!==t&&"loc"!==t?e[t]:void 0}}]),e}()},{}],9:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return"object"===n(e)&&null!==e&&!("object"===("undefined"==typeof Node?"undefined":n(Node))&&e instanceof Node)&&"string"==typeof e.nodeName&&""!==e.nodeName}},{key:"getParentNode",value:function(e){return e.parentNode}},{key:"getChildNodes",value:function(e){return"object"===n(e.childNodes)&&e.childNodes instanceof Array?e.childNodes:[]}},{key:"getNodeType",value:function(e){return e.nodeName}},{key:"getNodeAttrNames",value:function(e){var t=["value"];return"object"===n(e.attrs)&&e.attrs instanceof Array&&(t=t.concat(e.attrs.map(function(e){return e.name}))),t}},{key:"getNodeAttrValue",value:function(e,t){var r;if("value"===t)r=e.value;else if("object"===n(e.attrs)&&e.attrs instanceof Array){var o=e.attrs.filter(function(e){return e.name===t}).map(function(e){return e.value});1===o.length&&(r=o[0])}return r}}]),e}()},{}],10:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return"object"===n(e)&&null!==e&&"string"==typeof e.type&&""!==e.type}},{key:"getParentNode",value:function(e){if("object"===n(e.parent)&&null!==e.parent)return e.parent;throw new Error("Your UniST AST does not support parent node traversal")}},{key:"getChildNodes",value:function(e){return"object"===n(e.children)&&e.children instanceof Array?e.children:[]}},{key:"getNodeType",value:function(e){return e.type}},{key:"getNodeAttrNames",value:function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&"type"!==r&&"data"!==r&&"position"!==r&&"children"!==r&&"object"!==n(e[r])&&t.push(r);return t}},{key:"getNodeAttrValue",value:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&"type"!==t&&"data"!==t&&"position"!==t&&"children"!==t&&"object"!==n(e[t])?e[t]:void 0}}]),e}()},{}],11:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,null,[{key:"taste",value:function(e){return"object"===("undefined"==typeof Node?"undefined":n(Node))&&null!==e&&e instanceof Node&&"object"===n(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}},{key:"getParentNode",value:function(e){return e.parentNode}},{key:"getChildNodes",value:function(e){return"object"===n(e.childNodes)&&null!==e.childNodes&&e.hasChildNodes()?Array.prototype.slice.call(e.childNodes,0):[]}},{key:"getNodeType",value:function(e){return"string"==typeof e.nodeName?e.nodeName:"unknown"}},{key:"getNodeAttrNames",value:function(e){return"object"===n(e.attributes)&&null!==e.attributes&&e.hasAttributes()?Array.prototype.slice.call(e.attributes,0).map(function(e){return e.nodeName}):[]}},{key:"getNodeAttrValue",value:function(e,t){return"object"===n(e.attributes)&&null!==e.attributes&&e.hasAttributes()?e.getAttribute(t):void 0}}]),e}()},{}],12:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._adapters=[],this}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"register",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._adapters.unshift({adapter:e,force:t}),this}},{key:"unregister",value:function(e){if(void 0===e)this._adapters=[];else{for(var t=[],r=0;r<this._adapters.length;r++)this._adapters[r].adapter!==e&&t.push(this._adapters[r]);this._adapters=t}return this}},{key:"select",value:function(e){for(var t=0;t<this._adapters.length;t++)if(this._adapters[t].force||this._adapters[t].adapter.taste(e))return this._adapters[t].adapter}}]),e}()},{}],13:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=function(e,t){var r=e.getParentNode(t,"*");if(null===r)return 1;for(var n=e.getChildNodes(r,"*"),o=0;o<n.length;o++)if(n[o]===t)return o+1;throw new Error("cannot find myself")},i=function(e,t){for(var r=[];null!==(t=e.getParentNode(t,"*"));)r.push(t);return r},u={type:function(e,t){return e.getNodeType(t)},attrs:function(e,t,r){return void 0===r&&(r=" "),r+e.getNodeAttrNames(t).join(r)+r},depth:function(e,t){for(var r=1,n=t;null!==(n=e.getParentNode(n,"*"));)r++;return r},pos:function(e,t){return o(e,t)},nth:function(e,t,r){r=parseInt(r,10);var n=e.getParentNode(t,"*");if(null!==n){var o=e.getChildNodes(n,"*");r<0&&(r=o.length-(r+1));for(var i=0;i<o.length;i++)if(o[i]===t)return i+1===r;return!1}return 1===r},first:function(e,t){return u.nth(e,t,1)},last:function(e,t){return u.nth(e,t,-1)},count:function(e,t,r){return"object"===n(r)&&r instanceof Array?r.length:"object"===n(r)?Object.keys(r).length:"string"==typeof r?r.length:String(r).length},below:function(e,t,r){if(!e.taste(r))throw new Error('invalid argument to function "below" (node expected)');for(var n=t;null!==(n=e.getParentNode(n,"*"));)if(n===r)return!0;return!1},follows:function(e,t,r){if(!e.taste(r))throw new Error('invalid argument to function "follows" (node expected)');if(t===r)return!1;var n,u=[t].concat(i(e,t)).reverse(),a=[r].concat(i(e,r)).reverse(),c=Math.min(u.length,a.length);for(n=0;n<c&&u[n]===a[n];n++);if(0===n)throw new Error("internal error: root nodes have to be same same");return n===c?a.length<u.length:o(e,u[n])>o(e,a[n])},in:function(e,t,r){if(!("object"===n(r)&&r instanceof Array))throw new Error('invalid argument to function "in" (array expected)');for(var o=0;o<r.length;o++)if(r[o]===t)return!0;return!1},substr:function(e,t,r,n,o){return String(r).substr(n,o)},index:function(e,t,r,n,o){return String(r).indexOf(n,o)},trim:function(e,t,r){return String(r).trim()},lc:function(e,t,r){return String(r).toLowerCase()},uc:function(e,t,r){return String(r).toUpperCase()}};r.default=u},{}],14:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._funcs={},this}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"register",value:function(e,t){this._funcs[e]=t}},{key:"run",value:function(e,t){var r=this._funcs[e];if("function"!=typeof r)throw new Error('invalid function "'+e+'"');return r.apply(null,t)}}]),e}()},{}],15:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=u(e("./astq-util.js")),i=u(e("./astq-query-trace.js"));function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:String(t)}function l(e,t,r){return t=s(t),function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,function(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return function(){return!!e}()}()?Reflect.construct(t,r||[],s(e).constructor):t.apply(e,r))}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&function(e,t){(Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}(e,t)}r.default=function(e){function t(e,r,n,o){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(i=l(this,t)).adapter=e,i.params=r,i.funcs=n,i.trace=o,i}return f(t,i.default),function(e,t,r){t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(t,[{key:"execQuery",value:function(e,t){var r=this;this.traceBegin(e,t);var n=[];return e.childs().forEach(function(e){n=n.concat(r.execPath(e,t))}),this.traceEnd(e,t,n),n}},{key:"execPath",value:function(e,t){var r=this;this.traceBegin(e,t);var n=[t],o=[],i=!1;return e.childs().forEach(function(e){var t=[];n.forEach(function(n){t=t.concat(r.execStep(e,n))}),n=t,e.get("isResult")&&(i=!0,o=o.concat(n))}),this.traceEnd(e,t,n),i?o:n}},{key:"execStep",value:function(e,t){var r=this;this.traceBegin(e,t);var n=e.childs(),o=null,i=null,u=null,a=0;if(a<n.length&&"Axis"===n[a].type()&&(o=n[a++]),a<n.length&&"Match"===n[a].type()&&(i=n[a++]),a<n.length&&"Filter"===n[a].type()&&(u=n[a++]),null===i)throw new Error("no matching part in query step");var c=[],l=i.get("id"),s=function(e){var t=r.adapter.getNod