UNPKG

buffer-apg-js

Version:

JavaScript APG, an ABNF Parser Generator

17 lines 218 kB
!function e(t,n,r){function s(o,a){if(!n[o]){if(!t[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var h=n[o]={exports:{}};t[o][0].call(h.exports,(function(e){return s(t[o][1][e]||e)}),h,h.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(e,t,n){"use strict";n.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},n.toByteArray=function(e){var t,n,r=c(e),o=r[0],a=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),h=0,u=a>0?o-4:o;for(n=0;n<u;n+=4)t=s[e.charCodeAt(n)]<<18|s[e.charCodeAt(n+1)]<<12|s[e.charCodeAt(n+2)]<<6|s[e.charCodeAt(n+3)],l[h++]=t>>16&255,l[h++]=t>>8&255,l[h++]=255&t;2===a&&(t=s[e.charCodeAt(n)]<<2|s[e.charCodeAt(n+1)]>>4,l[h++]=255&t);1===a&&(t=s[e.charCodeAt(n)]<<10|s[e.charCodeAt(n+1)]<<4|s[e.charCodeAt(n+2)]>>2,l[h++]=t>>8&255,l[h++]=255&t);return l},n.fromByteArray=function(e){for(var t,n=e.length,s=n%3,i=[],o=16383,a=0,l=n-s;a<l;a+=o)i.push(h(e,a,a+o>l?l:a+o));1===s?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===s&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],s=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a<l;++a)r[a]=o[a],s[o.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function h(e,t,n){for(var s,i,o=[],a=t;a<n;a+=3)s=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[(i=s)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){(function(t){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ "use strict";var t=e("base64-js"),r=e("ieee754");n.Buffer=o,n.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},n.INSPECT_MAX_BYTES=50;var s=2147483647;function i(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=o.prototype,t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|p(e,t),r=i(n),s=r.write(e,t);s!==n&&(r=r.slice(0,s));return r}(e,t);if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return function(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n);return r.__proto__=o.prototype,r}(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);var s=function(e){if(o.isBuffer(e)){var t=0|u(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||U(e.length)?i(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),i(e<0?0:0|u(e))}function h(e){for(var t=e.length<0?0:0|u(e.length),n=i(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function u(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function p(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return P(e).length;default:if(s)return r?-1:H(e).length;t=(""+t).toLowerCase(),s=!0}}function d(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return S(this,t,n);case"latin1":case"binary":return $(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function f(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,s){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),U(n=+n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,s){var i,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(s){var h=-1;for(i=n;i<a;i++)if(c(e,i)===c(t,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===l)return h*o}else-1!==h&&(i-=i-h),h=-1}else for(n+l>a&&(n=a-l),i=n;i>=0;i--){for(var u=!0,p=0;p<l;p++)if(c(e,i+p)!==c(t,p)){u=!1;break}if(u)return i}return-1}function b(e,t,n,r){n=Number(n)||0;var s=e.length-n;r?(r=Number(r))>s&&(r=s):r=s;var i=t.length;r>i/2&&(r=i/2);for(var o=0;o<r;++o){var a=parseInt(t.substr(2*o,2),16);if(U(a))return o;e[n+o]=a}return o}function y(e,t,n,r){return I(H(t,e.length-n),e,n,r)}function x(e,t,n,r){return I(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function T(e,t,n,r){return x(e,t,n,r)}function w(e,t,n,r){return I(P(t),e,n,r)}function E(e,t,n,r){return I(function(e,t){for(var n,r,s,i=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,s=n%256,i.push(s),i.push(r);return i}(t,e.length-n),e,n,r)}function A(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);for(var r=[],s=t;s<n;){var i,o,a,l,c=e[s],h=null,u=c>239?4:c>223?3:c>191?2:1;if(s+u<=n)switch(u){case 1:c<128&&(h=c);break;case 2:128==(192&(i=e[s+1]))&&(l=(31&c)<<6|63&i)>127&&(h=l);break;case 3:i=e[s+1],o=e[s+2],128==(192&i)&&128==(192&o)&&(l=(15&c)<<12|(63&i)<<6|63&o)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:i=e[s+1],o=e[s+2],a=e[s+3],128==(192&i)&&128==(192&o)&&128==(192&a)&&(l=(15&c)<<18|(63&i)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(h=l)}null===h?(h=65533,u=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),s+=u}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=C));return n}(r)}n.kMaxLength=s,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),o.poolSize=8192,o.from=function(e,t,n){return a(e,t,n)},o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,o.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(F(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,s=0,i=Math.min(n,r);s<i;++s)if(e[s]!==t[s]){n=e[s],r=t[s];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=o.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var i=e[n];if(F(i,Uint8Array)&&(i=o.from(i)),!o.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,s),s+=i.length}return r},o.byteLength=p,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?k(this,0,e):d.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},o.prototype.compare=function(e,t,n,r,s){if(F(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(s>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),l=Math.min(i,a),c=this.slice(r,s),h=e.slice(t,n),u=0;u<l;++u)if(c[u]!==h[u]){i=c[u],a=h[u];break}return i<a?-1:a<i?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var s=this.length-t;if((void 0===n||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return y(this,e,t,n);case"ascii":return x(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function S(e,t,n){var r="";n=Math.min(e.length,n);for(var s=t;s<n;++s)r+=String.fromCharCode(127&e[s]);return r}function $(e,t,n){var r="";n=Math.min(e.length,n);for(var s=t;s<n;++s)r+=String.fromCharCode(e[s]);return r}function M(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var s="",i=t;i<n;++i)s+=D(e[i]);return s}function O(e,t,n){for(var r=e.slice(t,n),s="",i=0;i<r.length;i+=2)s+=String.fromCharCode(r[i]+256*r[i+1]);return s}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,s,i){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function R(e,t,n,r,s,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,s,i){return t=+t,n>>>=0,i||R(e,0,n,4),r.write(e,t,n,s,23,4),n+4}function v(e,t,n,s,i){return t=+t,n>>>=0,i||R(e,0,n,8),r.write(e,t,n,s,52,8),n+8}o.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return r.__proto__=o.prototype,r},o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e],s=1,i=0;++i<t&&(s*=256);)r+=this[e+i]*s;return r},o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e+--t],s=1;t>0&&(s*=256);)r+=this[e+--t]*s;return r},o.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e],s=1,i=0;++i<t&&(s*=256);)r+=this[e+i]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=t,s=1,i=this[e+--r];r>0&&(s*=256);)i+=this[e+--r]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||B(this,e,t,n,Math.pow(2,8*n)-1,0);var s=1,i=0;for(this[t]=255&e;++i<n&&(s*=256);)this[t+i]=e/s&255;return t+n},o.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||B(this,e,t,n,Math.pow(2,8*n)-1,0);var s=n-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var s=Math.pow(2,8*n-1);B(this,e,t,n,s-1,-s)}var i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var s=Math.pow(2,8*n-1);B(this,e,t,n,s-1,-s)}var i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return v(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return v(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var s=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var i=s-1;i>=0;--i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return s},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var s=e.charCodeAt(0);("utf8"===r&&s<128||"latin1"===r)&&(e=s)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var a=o.isBuffer(e)?e:o.from(e,r),l=a.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%l]}return this};var _=/[^+/0-9A-Za-z-_]/g;function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var n;t=t||1/0;for(var r=e.length,s=null,i=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!s){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}s=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),s=n;continue}n=65536+(s-55296<<10|n-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function P(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(_,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,n,r){for(var s=0;s<r&&!(s+n>=t.length||s>=e.length);++s)t[s+n]=e[s];return s}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function U(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:2,ieee754:3}],3:[function(e,t,n){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ n.read=function(e,t,n,r,s){var i,o,a=8*s-r-1,l=(1<<a)-1,c=l>>1,h=-7,u=n?s-1:0,p=n?-1:1,d=e[t+u];for(u+=p,i=d&(1<<-h)-1,d>>=-h,h+=a;h>0;i=256*i+e[t+u],u+=p,h-=8);for(o=i&(1<<-h)-1,i>>=-h,h+=r;h>0;o=256*o+e[t+u],u+=p,h-=8);if(0===i)i=1-c;else{if(i===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),i-=c}return(d?-1:1)*o*Math.pow(2,i-r)},n.write=function(e,t,n,r,s,i){var o,a,l,c=8*i-s-1,h=(1<<c)-1,u=h>>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,f=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*l-1)*Math.pow(2,s),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;e[n+d]=255&a,d+=f,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[n+d]=255&o,d+=f,o/=256,c-=8);e[n+d-f]|=128*g}},{}],4:[function(e,t,n){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ t.exports=function(e){return null!=e&&(r(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&r(e.slice(0,0))}(e)||!!e._isBuffer)}},{}],5:[function(e,t,n){(function(n){(function(){t.exports=function(t){const r=this,s=e("../apg-lib/node-exports"),i=e("../apg-conv-api/converter"),o=e("./scanner"),a=new(e("./parser")),{attributes:l,showAttributes:c,showAttributeErrors:h,showRuleDependencies:u}=e("./attributes"),p=e("./show-rules"),d=function(e,t,n){const r=`<span class="${s.style.CLASS_CTRLCHAR}">`,i="</span>",o=`<span class="${s.style.CLASS_NOMATCH}">`,a="</span>";let l,c="";for(;Array.isArray(e)&&0!==e.length;){if("number"!=typeof t)throw new Error("abnfToHtml: beg must be type number");if(t>=e.length)break;l="number"!=typeof n||t+n>=e.length?e.length:t+n;let h=0;for(let n=t;n<l;n+=1){const t=e[n];if(t>=32&&t<=126)switch(1===h?(c+=i,h=0):2===h&&(c+=a,h=0),t){case 32:c+="&nbsp;";break;case 60:c+="&lt;";break;case 62:c+="&gt;";break;case 38:c+="&amp;";break;case 34:c+="&quot;";break;case 39:c+="&#039;";break;case 92:c+="&#092;";break;default:c+=String.fromCharCode(t)}else 9===t||10===t||13===t?(0===h?(c+=r,h=1):2===h&&(c+=a+r,h=1),9===t&&(c+="TAB"),10===t&&(c+="LF"),13===t&&(c+="CR")):(0===h?(c+=o,h=2):1===h&&(c+=i+o,h=2),c+=`\\x${s.utils.charToHex(t)}`)}2===h&&(c+=a),1===h&&(c+=i);break}return c},f=function(e,t,n){let r="";for(let s=t;s<t+n;s+=1){const t=e[s];if(t>=32&&t<=126)r+=String.fromCharCode(t);else switch(t){case 9:r+="\\t";break;case 10:r+="\\n";break;case 13:r+="\\r";break;default:r+="\\unknown"}}return r};let g,m=!1,b=!1,y=!1,x=!1,T=0;if(this.errors=[],n.isBuffer(t))this.chars=i.decode("BINARY",t);else if(Array.isArray(t))this.chars=t.slice();else{if("string"!=typeof t)throw new Error("api.js: input source is not a string, byte Buffer or character array");this.chars=i.decode("STRING",t)}this.sabnf=i.encode("STRING",this.chars),this.scan=function(e,t){this.lines=o(this.chars,this.errors,e,t),m=!0},this.parse=function(e,t){if(!m)throw new Error("api.js: grammar not scanned");a.syntax(this.chars,this.lines,this.errors,e,t),b=!0},this.translate=function(){if(!b)throw new Error("api.js: grammar not scanned and parsed");const e=a.semantic(this.chars,this.lines,this.errors);0===this.errors.length&&(this.rules=e.rules,this.udts=e.udts,g=e.lineMap,y=!0)},this.attributes=function(){if(!y)throw new Error("api.js: grammar not scanned, parsed and translated");return T=l(this.rules,this.udts,g,this.errors),x=!0,T},this.generate=function(e){if(this.lines=o(this.chars,this.errors,e),this.errors.length)return;if(a.syntax(this.chars,this.lines,this.errors,e),this.errors.length)return;const t=a.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=t.rules,this.udts=t.udts,g=t.lineMap,T=l(this.rules,this.udts,g,this.errors),x=!0)},this.displayRules=function(e="index"){if(!y)throw new Error("api.js: grammar not scanned, parsed and translated");return p(this.rules,this.udts,e)},this.displayRuleDependencies=function(e="index"){if(!x)throw new Error("api.js: no attributes - must be preceeded by call to attributes()");return u(e)},this.displayAttributes=function(e="index"){if(!x)throw new Error("api.js: no attributes - must be preceeded by call to attributes()");return T&&h(e),c(e)},this.displayAttributeErrors=function(){if(!x)throw new Error("api.js: no attributes - must be preceeded by call to attributes()");return h()},this.toSource=function(e){if(!x)throw new Error("api.js: can't generate parser source - must be preceeded by call to attributes()");if(T)throw new Error(`api.js: can't generate parser source - attributes have ${T} errors`);return a.generateSource(this.chars,this.lines,this.rules,this.udts,e)},this.toObject=function(){if(!x)throw new Error("api.js: can't generate parser source - must be preceeded by call to attributes()");if(T)throw new Error(`api.js: can't generate parser source - attributes have ${T} errors`);return a.generateObject(this.sabnf,this.rules,this.udts)},this.errorsToAscii=function(){return function(e,t,n){let r,s,i,o;return r="",e.forEach((e=>{s=t[e.line],r+=`${s.lineNo}: `,r+=`${s.beginChar}: `,r+=e.char-s.beginChar+": ",i=s.beginChar,o=e.char-s.beginChar,r+=f(n,i,o),r+=" >> ",i=e.char,o=s.beginChar+s.length-e.char,r+=f(n,i,o),r+="\n",r+=`${s.lineNo}: `,r+=`${s.beginChar}: `,r+=e.char-s.beginChar+": ",r+="error: ",r+=e.msg,r+="\n"})),r}(this.errors,this.lines,this.chars)},this.errorsToHtml=function(e){return function(e,t,n,r){const[i]=s;let o="";const a=`<span class="${i.CLASS_NOMATCH}">&raquo;</span>`;return o+=`<p><table class="${i.CLASS_GRAMMAR}">\n`,r&&"string"==typeof r&&(o+=`<caption>${r}</caption>\n`),o+="<tr><th>line<br>no.</th><th>line<br>offset</th><th>error<br>offset</th><th><br>text</th></tr>\n",e.forEach((e=>{let r,i,l,c,h,u="",p="";0===t.length?(h=a,i=0):(r=t[e.line],l=r.beginChar,e.char>l&&(u=d(n,l,e.char-l)),l=e.char,c=r.beginChar+r.length,l<c&&(p=d(n,l,c-l)),h=u+a+p,i=e.char-r.beginChar,o+="<tr>",o+=`<td>${e.line}</td><td>${r.beginChar}</td><td>${i}</td><td>${h}</td>`,o+="</tr>\n",o+="<tr>",o+=`<td colspan="3"></td><td>&uarr;:&nbsp;${s.utils.stringToAsciiHtml(e.msg)}</td>`,o+="</tr>\n")})),o+="</table></p>\n",o}(this.errors,this.lines,this.chars,e)},this.linesToAscii=function(){return function(e){let t="Annotated Input Grammar";return e.forEach((e=>{t+="\n",t+=`line no: ${e.lineNo}`,t+=` : char index: ${e.beginChar}`,t+=` : length: ${e.length}`,t+=` : abnf: ${f(r.chars,e.beginChar,e.length)}`})),t+="\n",t}(this.lines)},this.linesToHtml=function(){return function(e){let t="";return t+=`<table class="${s.style.CLASS_GRAMMAR}">\n`,t+="<caption>Annotated Input Grammar</caption>\n",t+="<tr>",t+="<th>line<br>no.</th><th>first<br>char</th><th><br>length</th><th><br>text</th>",t+="</tr>\n",e.forEach((e=>{t+="<tr>",t+=`<td>${e.lineNo}`,t+=`</td><td>${e.beginChar}`,t+=`</td><td>${e.length}`,t+=`</td><td>${d(r.chars,e.beginChar,e.length)}`,t+="</td>",t+="</tr>\n"})),t+="</table>\n",t}(this.lines)}}}).call(this)}).call(this,{isBuffer:e("../../../../.nvm/versions/node/v15.11.0/lib/node_modules/browserify/node_modules/is-buffer/index.js")})},{"../../../../.nvm/versions/node/v15.11.0/lib/node_modules/browserify/node_modules/is-buffer/index.js":4,"../apg-conv-api/converter":17,"../apg-lib/node-exports":34,"./attributes":6,"./parser":7,"./scanner":13,"./show-rules":15}],6:[function(e,t,n){t.exports=function(){const t=e("../apg-lib/identifiers"),{ruleAttributes:n,showAttributes:r,showAttributeErrors:s}=e("./rule-attributes"),{ruleDependencies:i,showRuleDependencies:o}=e("./rule-dependencies");class a{constructor(e,t){this.rules=e,this.udts=t,this.ruleCount=e.length,this.udtCount=t.length,this.startRule=0,this.dependenciesComplete=!1,this.attributesComplete=!1,this.isMutuallyRecursive=!1,this.ruleIndexes=this.indexArray(this.ruleCount),this.ruleAlphaIndexes=this.indexArray(this.ruleCount),this.ruleTypeIndexes=this.indexArray(this.ruleCount),this.udtIndexes=this.indexArray(this.udtCount),this.udtAlphaIndexes=this.indexArray(this.udtCount),this.attrsErrorCount=0,this.attrs=[],this.attrsErrors=[],this.attrsWorking=[],this.ruleDeps=[];for(let t=0;t<this.ruleCount;t+=1)this.attrs.push(this.attrGen(this.rules[t])),this.attrsWorking.push(this.attrGen(this.rules[t])),this.ruleDeps.push(this.rdGen(e[t],this.ruleCount,this.udtCount));this.compRulesAlpha=this.compRulesAlpha.bind(this),this.compUdtsAlpha=this.compUdtsAlpha.bind(this),this.compRulesType=this.compRulesType.bind(this),this.compRulesGroup=this.compRulesGroup.bind(this)}attrGen(e){return{left:!1,nested:!1,right:!1,empty:!1,finite:!1,cyclic:!1,leaf:!1,isOpen:!1,isComplete:!1,rule:e}}attrInit(e){e.left=!1,e.nested=!1,e.right=!1,e.empty=!1,e.finite=!1,e.cyclic=!1,e.leaf=!1,e.isOpen=!1,e.isComplete=!1}attrCopy(e,t){e.left=t.left,e.nested=t.nested,e.right=t.right,e.empty=t.empty,e.finite=t.finite,e.cyclic=t.cyclic,e.leaf=t.leaf,e.isOpen=t.isOpen,e.isComplete=t.isComplete,e.rule=t.rule}rdGen(e,n,r){return{rule:e,recursiveType:t.ATTR_N,groupNumber:-1,refersTo:this.falseArray(n),refersToUdt:this.falseArray(r),referencedBy:this.falseArray(n)}}typeToString(e){switch(e){case t.ATTR_N:return" N";case t.ATTR_R:return" R";case t.ATTR_MR:return"MR";default:return"UNKNOWN"}}falseArray(e){const t=[];if(e>0)for(let n=0;n<e;n+=1)t.push(!1);return t}falsifyArray(e){for(let t=0;t<e.length;t+=1)e[t]=!1}indexArray(e){const t=[];if(e>0)for(let n=0;n<e;n+=1)t.push(n);return t}compRulesAlpha(e,t){return this.rules[e].lower<this.rules[t].lower?-1:this.rules[e].lower>this.rules[t].lower?1:0}compUdtsAlpha(e,t){return this.udts[e].lower<this.udts[t].lower?-1:this.udts[e].lower>this.udts[t].lower?1:0}compRulesType(e,t){return this.ruleDeps[e].recursiveType<this.ruleDeps[t].recursiveType?-1:this.ruleDeps[e].recursiveType>this.ruleDeps[t].recursiveType?1:0}compRulesGroup(e,n){if(this.ruleDeps[e].recursiveType===t.ATTR_MR&&this.ruleDeps[n].recursiveType===t.ATTR_MR){if(this.ruleDeps[e].groupNumber<this.ruleDeps[n].groupNumber)return-1;if(this.ruleDeps[e].groupNumber>this.ruleDeps[n].groupNumber)return 1}return 0}}return{attributes:function(e=[],t=[],r=[],s=[]){const o=new a(e,t);return i(o),n(o),o.attrsErrorCount&&s.push({line:0,char:0,msg:`${o.attrsErrorCount} attribute errors`}),o.attrsErrorCount},showAttributes:r,showAttributeErrors:s,showRuleDependencies:o}}()},{"../apg-lib/identifiers":33,"./rule-attributes":8,"./rule-dependencies":9}],7:[function(e,t,n){t.exports=function(){const t=e("../apg-lib/node-exports"),n=t.ids,r=new(e("./syntax-callbacks")),s=new(e("./semantic-callbacks")),i=new(e("./sabnf-grammar")),o=new t.parser;o.ast=new t.ast,o.callbacks=r.callbacks,o.ast.callbacks=s.callbacks;const a=function(e,t,n){if(t<0||t>=n)return-1;for(let n=0;n<e.length;n+=1)if(t>=e[n].beginChar&&t<e[n].beginChar+e[n].length)return n;return-1},l=function(e,t){let n=-1;if(t<e.length)for(let r=t;r<e.length;r+=1)if(null!==e[r]){n=e[r];break}return n};this.syntax=function(e,t,n,r,s){if(s){if("traceObject"!==s.traceObject)throw new TypeError("parser: trace argument is not a trace object");o.trace=s}const l={};l.errors=n,l.strict=!!r,l.lines=t,l.findLine=a,l.charsLength=e.length,l.ruleCount=0;o.parse(i,"file",e,l).success||n.push({line:0,char:0,msg:"syntax analysis of input grammar failed"})},this.semantic=function(e,t,r){const s={};return s.errors=r,s.lines=t,s.findLine=a,s.charsLength=e.length,o.ast.translate(s),r.length?null:(s.rules.forEach((e=>{const t=[],r=[];let s=0;e.opcodes.forEach((e=>{e.type===n.ALT&&1===e.children.length||e.type===n.CAT&&1===e.children.length||e.type===n.REP&&1===e.min&&1===e.max?r.push(null):(r.push(s),t.push(e),s+=1)})),r.push(s),t.forEach((e=>{if(e.type===n.ALT||e.type===n.CAT)for(let t=0;t<e.children.length;t+=1)e.children[t]=l(r,e.children[t])})),e.opcodes=t})),{rules:s.rules,udts:s.udts,lineMap:s.rulesLineMap})},this.generateSource=function(e,t,r,s,i){let o,a,l,c="",h=0,u=1/0,p=0;const d=[],f=[];let g=0,m=0,b=0,y=0,x=0,T=0,w=0,E=0,A=0,k=0,C=0,S=0,$=0,M=0,O=0;r.forEach((e=>{d.push(e.lower),h+=e.opcodes.length,e.opcodes.forEach((e=>{switch(e.type){case n.ALT:g+=1;break;case n.CAT:m+=1;break;case n.RNM:b+=1;break;case n.UDT:y+=1;break;case n.REP:x+=1;break;case n.AND:T+=1;break;case n.NOT:w+=1;break;case n.BKA:S+=1;break;case n.BKN:$+=1;break;case n.BKR:C+=1;break;case n.ABG:M+=1;break;case n.AEN:O+=1;break;case n.TLS:for(E+=1,o=0;o<e.string.length;o+=1)e.string[o]<u&&(u=e.string[o]),e.string[o]>p&&(p=e.string[o]);break;case n.TBS:for(A+=1,o=0;o<e.string.length;o+=1)e.string[o]<u&&(u=e.string[o]),e.string[o]>p&&(p=e.string[o]);break;case n.TRG:k+=1,e.min<u&&(u=e.min),e.max>p&&(p=e.max);break;default:throw new Error("generateSource: unrecognized opcode")}}))})),d.sort(),s.length>0&&(s.forEach((e=>{f.push(e.lower)})),f.sort());let L,B="module.exports";return i&&"string"==typeof i&&(B=`let ${i}`),c+="// copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved<br>\n",c+="// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>\n",c+="//\n",c+="// Generated by apg-js, Version 4.0.0 [apg-js](https://github.com/ldthomas/apg-js)\n",c+=`${B} = function grammar(){\n`,c+=" // ```\n",c+=" // SUMMARY\n",c+=` // rules = ${r.length}\n`,c+=` // udts = ${s.length}\n`,c+=` // opcodes = ${h}\n`,c+=" // --- ABNF original opcodes\n",c+=` // ALT = ${g}\n`,c+=` // CAT = ${m}\n`,c+=` // REP = ${x}\n`,c+=` // RNM = ${b}\n`,c+=` // TLS = ${E}\n`,c+=` // TBS = ${A}\n`,c+=` // TRG = ${k}\n`,c+=" // --- SABNF superset opcodes\n",c+=` // UDT = ${y}\n`,c+=` // AND = ${T}\n`,c+=` // NOT = ${w}\n`,c+=` // BKA = ${S}\n`,c+=` // BKN = ${$}\n`,c+=` // BKR = ${C}\n`,c+=` // ABG = ${M}\n`,c+=` // AEN = ${O}\n`,c+=" // characters = [",c+=E+A+k===0?" none defined ]":`${u} - ${p}]`,y>0&&(c+=" + user defined"),c+="\n",c+=" // ```\n",c+=" /* OBJECT IDENTIFIER (for internal parser use) */\n",c+=" this.grammarObject = 'grammarObject';\n",c+="\n",c+=" /* RULES */\n",c+=" this.rules = [];\n",r.forEach(((e,t)=>{let n=" this.rules[";n+=t,n+="] = {name: '",n+=e.name,n+="', lower: '",n+=e.lower,n+="', index: ",n+=e.index,n+=", isBkr: ",n+=e.isBkr,n+="};\n",c+=n})),c+="\n",c+=" /* UDTS */\n",c+=" this.udts = [];\n",s.length>0&&s.forEach(((e,t)=>{let n=" this.udts[";n+=t,n+="] = {name: '",n+=e.name,n+="', lower: '",n+=e.lower,n+="', index: ",n+=e.index,n+=", empty: ",n+=e.empty,n+=", isBkr: ",n+=e.isBkr,n+="};\n",c+=n})),c+="\n",c+=" /* OPCODES */\n",r.forEach(((e,t)=>{t>0&&(c+="\n"),c+=` /* ${e.name} */\n`,c+=` this.rules[${t}].opcodes = [];\n`,e.opcodes.forEach(((e,i)=>{let o;switch(e.type){case n.ALT:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, children: [${e.children.toString()}]};// ALT\n`;break;case n.CAT:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, children: [${e.children.toString()}]};// CAT\n`;break;case n.RNM:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, index: ${e.index}};// RNM(${r[e.index].name})\n`;break;case n.BKR:e.index>=r.length?(a=s[e.index-r.length].name,l=s[e.index-r.length].lower):(a=r[e.index].name,l=r[e.index].lower),o="%i",e.bkrCase===n.BKR_MODE_CS&&(o="%s"),e.bkrMode===n.BKR_MODE_UM?o+="%u":o+="%p",a=o+a,c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, index: ${e.index}, lower: '${l}', bkrCase: ${e.bkrCase}, bkrMode: ${e.bkrMode}};// BKR(\\${a})\n`;break;case n.UDT:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, empty: ${e.empty}, index: ${e.index}};// UDT(${s[e.index].name})\n`;break;case n.REP:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, min: ${e.min}, max: ${e.max}};// REP\n`;break;case n.AND:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}};// AND\n`;break;case n.NOT:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}};// NOT\n`;break;case n.ABG:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}};// ABG(%^)\n`;break;case n.AEN:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}};// AEN(%$)\n`;break;case n.BKA:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}};// BKA\n`;break;case n.BKN:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}};// BKN\n`;break;case n.TLS:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, string: [${e.string.toString()}]};// TLS\n`;break;case n.TBS:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, string: [${e.string.toString()}]};// TBS\n`;break;case n.TRG:c+=` this.rules[${t}].opcodes[${i}] = {type: ${e.type}, min: ${e.min}, max: ${e.max}};// TRG\n`;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}}))})),c+="\n",c+=" // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n",c+=" this.toString = function toString(){\n",c+=' let str = "";\n',t.forEach((t=>{const n=t.beginChar+t.length;L="",c+=' str += "';for(let r=t.beginChar;r<n;r+=1){switch(e[r]){case 9:L=" ";break;case 10:L="\\n";break;case 13:L="\\r";break;case 34:L='\\"';break;case 92:L="\\\\";break;default:L=String.fromCharCode(e[r])}c+=L}c+='";\n'})),c+=" return str;\n",c+=" }\n",c+="}\n",c},this.generateObject=function(e,t,n){const r={},s=[],i=[],o=e.slice(0);return r.grammarObject="grammarObject",t.forEach((e=>{s.push(e.lower)})),s.sort(),n.length>0&&(n.forEach((e=>{i.push(e.lower)})),i.sort()),r.callbacks=[],s.forEach((e=>{r.callbacks[e]=!1})),n.length>0&&i.forEach((e=>{r.callbacks[e]=!1})),r.rules=t,r.udts=n,r.toString=function(){return o},r}}},{"../apg-lib/node-exports":34,"./sabnf-grammar":10,"./semantic-callbacks":14,"./syntax-callbacks":16}],8:[function(e,t,n){t.exports=function(){const t=e("../apg-lib/identifiers");let n=null;function r(e){return!(e.left||e.nested||e.right||e.cyclic)&&e.empty}function s(e){return!!(e.left||e.nested||e.right||e.cyclic)}function i(e,t,n,i){let a=0;const l=t[n],c=l.children.length,h=[];for(a=0;a<c;a+=1)h.push(e.attrGen());for(a=0;a<c;a+=1)o(e,t,l.children[a],h[a]);i.left=function(e,t){for(let n=0;n<t;n+=1){if(e[n].left)return!0;if(!e[n].empty)return!1}return!1}(h,c),i.right=function(e,t){for(let n=t-1;n>=0;n-=1){if(e[n].right)return!0;if(!e[n].empty)return!1}return!1}(h,c),i.nested=function(e,t){let n=0,i=0,o=0;for(n=0;n<t;n+=1)if(e[n].nested)return!0;for(n=0;n<t;n+=1)if(e[n].right&&!e[n].leaf)for(i=n+1;i<t;i+=1)if(!r(e[i]))return!0;for(n=t-1;n>=0;n-=1)if(e[n].left&&!e[n].leaf)for(i=n-1;i>=0;i-=1)if(!r(e[i]))return!0;for(n=0;n<t;n+=1)if(!e[n].empty&&!s(e[n]))for(i=n+1;i<t;i+=1)if(s(e[i]))for(o=i+1;o<t;o+=1)if(!e[o].empty&&!s(e[o]))return!0;return!1}(h,c),i.empty=function(e,t){for(let n=0;n<t;n+=1)if(!e[n].empty)return!1;return!0}(h,c),i.finite=function(e,t){for(let n=0;n<t;n+=1)if(!e[n].finite)return!1;return!0}(h,c),i.cyclic=function(e,t){for(let n=0;n<t;n+=1)if(!e[n].cyclic)return!1;return!0}(h,c)}function o(e,n,r,s){e.attrInit(s);const l=n[r];switch(l.type){case t.ALT:!function(e,t,n,r){let s=0;const i=t[n],a=i.children.length,l=[];for(s=0;s<a;s+=1)l.push(e.attrGen());for(s=0;s<a;s+=1)o(e,t,i.children[s],l[s]);for(r.left=!1,r.right=!1,r.nested=!1,r.empty=!1,r.finite=!1,r.cyclic=!1,s=0;s<a;s+=1)l[s].left&&(r.left=!0),l[s].nested&&(r.nested=!0),l[s].right&&(r.right=!0),l[s].empty&&(r.empty=!0),l[s].finite&&(r.finite=!0),l[s].cyclic&&(r.cyclic=!0)}(e,n,r,s);break;case t.CAT:i(e,n,r,s);break;case t.REP:o(e,n,r+1,s),0===l.min&&(s.empty=!0,s.finite=!0);break;case t.RNM:a(e,n[r].index,s);break;case t.BKR:!function(e,t,n,r){const s=t[n];s.index>=e.ruleCount?(r.empty=e.udts[s.index-e.ruleCount].empty,r.finite=!0):(a(e,s.index,r),r.left=!1,r.nested=!1,r.right=!1,r.cyclic=!1)}(e,n,r,s);break;case t.AND:case t.NOT:case t.BKA:case t.BKN:o(e,n,r+1,s),s.empty=!0;break;case t.TLS:s.empty=!n[r].string.length,s.finite=!0,s.cyclic=!1;break;case t.TBS:case t.TRG:s.empty=!1,s.finite=!0,s.cyclic=!1;break;case t.UDT:s.empty=l.empty,s.finite=!0,s.cyclic=!1;break;case t.ABG:case t.AEN:s.empty=!0,s.finite=!0,s.cyclic=!1;break;default:throw new Error(`unknown opcode type: ${l}`)}}function a(e,t,n){const r=e.attrsWorking[t];r.isComplete?e.attrCopy(n,r):r.isOpen?t===e.startRule?t===e.startRule&&(n.left=!0,n.right=!0,n.cyclic=!0,n.leaf=!0):n.finite=!0:(r.isOpen=!0,o(e,r.rule.opcodes,0,n),r.left=n.left,r.right=n.right,r.nested=n.nested,r.empty=n.empty,r.finite=n.finite,r.cyclic=n.cyclic,r.leaf=!1,r.isOpen=!1,r.isComplete=!0)}const l=e=>e?"t":"f",c=e=>e?"e":"f",h=(e,r,s,i)=>{let o=`${e}:${r}:`;return o+=`${c(s.left)} `,o+=`${l(s.nested)} `,o+=`${l(s.right)} `,o+=`${c(s.cyclic)} `,o+=(s.finite?"t":"e")+" ",o+=`${l(s.empty)}:`,o+=`${n.typeToString(i.recursiveType)}:`,o+=i.recursiveType===t.ATTR_MR?i.groupNumber:"-",o+=`:${s.rule.name}\n`,o},u=()=>{let e="LEGEND - t=true, f=false, e=error\n";return e+="sequence:rule index:left nested right cyclic finite empty:type:group number:rule name\n","LEGEND - t=true, f=false, e=error\nsequence:rule index:left nested right cyclic finite empty:type:group number:rule name\n"},p=e=>{let t=0,r=0,s=null,i=null,o="",{ruleIndexes:a}=n;for(97===e?a=n.ruleAlphaIndexes:116===e&&(a=n.ruleTypeIndexes),t=0;t<n.ruleCount;t+=1)r=a[t],s=n.attrs[r],i=n.ruleDeps[r],o+=h(t,r,s,i);return o};return{ruleAttributes:e=>{n=e;let t=0,r=0;const s=n.attrGen();for(t=0;t<n.ruleCount;t+=1){for(r=0;r<n.ruleCount;r+=1)n.attrInit(n.attrsWorking[r]);n.startRule=t,a(n,t,s),n.attrCopy(n.attrs[t],n.attrsWorking[t])}n.attributesComplete=!0;let i=null;for(t=0;t<n.ruleCount;t+=1)if(i=n.attrs[t],i.left||!i.finite||i.cyclic){const e=n.attrGen(i.rule);n.attrCopy(e,i),n.attrsErrors.push(e),n.attrsErrorCount+=1}},showAttributes:(e="index")=>{if(!n.attributesComplete)throw new Error("rule-attributes.js:showAttributes: attributes not available");let t="";const r="RULE ATTRIBUTES\n";return 97===e.charCodeAt(0)?(t+="alphabetical by rule name\n",t+=r,t+=u(),t+=p(97)):116===e.charCodeAt(0)?(t+="ordered by rule type\n",t+=r,t+=u(),t+=p(116)):(t+="ordered by rule index\n",t+=r,t+=u(),t+=p()),t},showAttributeErrors:()=>{let e=null,t=null,r="";if(r+="RULE ATTRIBUTES WITH ERRORS\n",r+=u(),n.attrsErrorCount)for(let s=0;s<n.attrsErrorCount;s+=1)e=n.attrsErrors[s],t=n.ruleDeps[e.rule.index],r+=h(s,e.rule.index,e,t);else r+="<none>\n";return r}}}()},{"../apg-lib/identifiers":33}],9:[function(e,t,n){t.exports=(()=>{const t=e("../apg-lib/identifiers");let n=null;const r=(e,n,s,i)=>{let o=0,a=0;const l=n[s];i[s]=!0;const c=l.rule.opcodes;for(o=0;o<c.length;o+=1){const s=c[o];if(s.type===t.RNM)for(l.refersTo[s.index]=!0,i[s.index]||r(e,n,s.index,i),a=0;a<e;a+=1)n[s.index].refersTo[a]&&(l.refersTo[a]=!0);else s.type===t.UDT?l.refersToUdt[s.index]=!0:s.type===t.BKR&&(s.index<e?(l.refersTo[s.index]=!0,i[s.index]||r(e,n,s.index,i)):l.refersToUdt[e-s.index]=!0)}},s=(e=null)=>{let t=0,r=0,s=0,i=0;const o=n.ruleCount-1,a=n.udtCount-1;let l="",c="";const h="=> ";let u=!1,p=null,{ruleIndexes:d}=n,{udtIndexes:f}=n;for(97===e?(d=n.ruleAlphaIndexes,f=n.udtAlphaIndexes):116===e&&(d=n.ruleTypeIndexes,f=n.udtAlphaIndexes),t=0;t<n.ruleCount;t+=1){for(p=n.ruleDeps[d[t]],c=`${d[t]}:${n.typeToString(p.recursiveType)}:`,n.isMutuallyRecursive&&(c+=p.groupNumber>-1?p.groupNumber:"-",c+=":"),c+=" ",l+=`${c+n.rules[d[t]].name}\n`,u=!0,s=0,i=l.length,l+=c,r=0;r<n.ruleCount;r+=1)p.refersTo[d[r]]&&(u?(l+=h,u=!1,l+=n.ruleDeps[d[r]].rule.name):l+=`, ${n.ruleDeps[d[r]].rule.name}`,s+=1),l.length-i>100&&r!==o&&(l+=`\n${c}=> `,i=l.length);if(n.udtCount)for(r=0;r<n.udtCount;r+=1)p.refersToUdt[f[r]]&&(u?(l+=h,u=!1,l+=n.udts[f[r]].name):l+=`, ${n.udts[f[r]].name}`,s+=1),l.length-i>100&&r!==a&&(l+=`\n${c}=> `,i=l.length);for(0===s&&(l+="=> <none>\n"),!1===u&&(l+="\n"),u=!0,s=0,i=l.length,l+=c,r=0;r<n.ruleCount;r+=1)p.referencedBy[d[r]]&&(u?(l+="<= ",u=!1,l+=n.ruleDeps[d[r]].rule.name):l+=`, ${n.ruleDeps[d[r]].rule.name}`,s+=1),l.length-i>100&&r!==o&&(l+=`\n${c}=> `,i=l.length);0===s&&(l+="<= <none>\n"),!1===u&&(l+="\n"),l+="\n"}return l};return{ruleDependencies:e=>{n=e;let s=0,i=0,o=0,a=null,l=null,c=!1;n.dependenciesComplete=!1;const h=n.falseArray(n.ruleCount);for(s=0;s<n.ruleCount;s+=1)n.falsifyArray(h),r(n.ruleCount,n.ruleDeps,s,h);for(s=0;s<n.ruleCount;s+=1)for(i=0;i<n.ruleCount;i+=1)s!==i&&n.ruleDeps[i].refersTo[s]&&(n.ruleDeps[s].referencedBy[i]=!0);for(s=0;s<n.ruleCount;s+=1)n.ruleDeps[s].recursiveType=t.ATTR_N,n.ruleDeps[s].refersTo[s]&&(n.ruleDeps[s].recursiveType=t.ATTR_R);for(o=-1,s=0;s<n.ruleCount;s+=1)if(a=n.ruleDeps[s],a.recursiveType===t.ATTR_R)for(c=!0,i=0;i<n.ruleCount;i+=1)s!==i&&(l=n.ruleDeps[i],l.recursiveType===t.ATTR_R&&a.refersTo[i]&&l.refersTo[s]&&(c&&(o+=1,a.recursiveType=t.ATTR_MR,a.groupNumber=o,c=!1),l.recursiveType=t.ATTR_MR,l.groupNumber=o));n.isMutuallyRecursive=o>-1,n.ruleAlphaIndexes.sort(n.compRulesAlpha),n.ruleTypeIndexes.sort(n.compRulesAlpha),n.ruleTypeIndexes.sort(n.compRulesType),n.isMutuallyRecursive&&n.ruleTypeIndexes.sort(n.compRulesGroup),n.udtCount&&n.udtAlphaIndexes.sort(n.compUdtsAlpha),n.dependenciesComplete=!0},showRuleDependencies:(e="index")=>{let t="RULE DEPENDENCIES(index:type:[group number:])\n";return t+="=> refers to rule names\n",t+="<= referenced by rule names\n",n.dependenciesComplete?(97===e.charCodeAt(0)?(t+="alphabetical by rule name\n",t+=s(97)):116===e.charCodeAt(0)?(t+="ordered by rule type\n",t+=s(116)):(t+="ordered by rule index\n",t+=s(null)),t):t}}})()},{"../apg-lib/identifiers":33}],10:[function(e,t,n){t.exports=function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"File",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"BlankLine",lower:"blankline",index:1,isBkr:!1},this.rules[2]={name:"Rule",lower:"rule",index:2,isBkr:!1},this.rules[3]={name:"RuleLookup",lower:"rulelookup",index:3,isBkr:!1},this.rules[4]={name:"RuleNameTest",lower:"rulenametest",index:4,isBkr:!1},this.rules[5]={name:"RuleName",lower:"rulename",index:5,isBkr:!1},this.rules[6]={name:"RuleNameError",lower:"rulenameerror",index:6,isBkr:!1},this.rules[7]={name:"DefinedAsTest",lower:"definedastest",index:7,isBkr:!1},this.rules[8]={name:"DefinedAsError",lower:"definedaserror",index:8,isBkr:!1},this.rules[9]={name:"DefinedAs",lower:"definedas",index:9,isBkr:!1},this.rules[10]={name:"Defined",lower:"defined",index:10,isBkr:!1},this.rules[11]={name:"IncAlt",lower:"incalt",index:11,isBkr:!1},this.rules[12]={name:"RuleError",lower:"ruleerror",index:12,isBkr:!1},this.rules[13]={name:"LineEndError",lower:"lineenderror",index:13,isBkr:!1},this.rules[14]={name:"Alternation",lower:"alternation",index:14,isBkr:!1},this.rules[15]={name:"Concatenation",lower:"concatenation",index:15,isBkr:!1},this.rules[16]={name:"Repetition",lower:"repetition",index:16,isBkr:!1},this.rules[17]={name:"Modifier",lower:"modifier",index:17,isBkr:!1},this.rules[18]={name:"Predicate",lower:"predicate",index:18,isBkr:!1},this.rules[19]={name:"BasicElement",lower:"basicelement",index:19,isBkr:!1},this.rules[20]={name:"BasicElementErr",lower:"basicelementerr",index:20,isBkr:!1},this.rules[21]={name:"Group",lower:"group",index:21,isBkr:!1},this.rules[22]={name:"GroupError",lower:"grouperror",index:22,isBkr:!1},this.rules[23]={name:"GroupOpen",lower:"groupopen",index:23,isBkr:!1},this.rules[24]={name:"GroupClose",lower:"groupclose",index:24,isBkr:!1},this.rules[25]={name:"Option",lower:"option",index:25,isBkr:!1},this.rules[26]={name:"OptionError",lower:"optionerror",index:26,isBkr:!1},this.rules[27]={name:"OptionOpen",lower:"optionopen",index:27,isBkr:!1},this.rules[28]={name:"OptionClose",lower:"optionclose",index:28,isBkr:!1},this.rules[29]={name:"RnmOp",lower:"rnmop