You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.1 MiB
JavaScript

!function(n,l){"object"==typeof exports&&"object"==typeof module?module.exports=l():"function"==typeof define&&define.amd?define("test",[],l):"object"==typeof exports?exports.test=l():(n.peg=n.peg||{},n.peg.test=l())}("undefined"!=typeof self?self:window,function(){return function(n){var l={};function e(t){if(l[t])return l[t].exports;var u=l[t]={i:t,l:!1,exports:{}};return n[t].call(u.exports,u,u.exports,e),u.l=!0,u.exports}return e.m=n,e.c=l,e.d=function(n,l,t){e.o(n,l)||Object.defineProperty(n,l,{enumerable:!0,get:t})},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,l){if(1&l&&(n=e(n)),8&l)return n;if(4&l&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(e.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&l&&"string"!=typeof n)for(var u in n)e.d(t,u,function(l){return n[l]}.bind(null,u));return t},e.n=function(n){var l=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(l,"a",l),l},e.o=function(n,l){return Object.prototype.hasOwnProperty.call(n,l)},e.p="",e(e.s=52)}([function(n,l,e){"use strict";var t=e(9),u=e(5),r=e(23),o=e(14),i=e(1),a={VERSION:e(13).version,GrammarError:t,ast:u,parser:o,compiler:r,util:i,generate:function(n){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=new r.Session({passes:i.convertPasses(r.passes)});return Array.isArray(l.plugins)&&l.plugins.forEach(function(n){"function"==typeof n.use&&n.use(e,l)}),r.compile(e.parse(n,l.parser||{}),e,l)}};n.exports=a},function(n,l,e){"use strict";var t=e(19),u=e(20),r=e(21),o=e(11),i=function(){function n(n){return Array.isArray(n)?n:r.values(n)}return function(l){return r.map(l,n)}}();n.exports={find:t.find,findIndex:t.findIndex,stringEscape:u.stringEscape,regexpEscape:u.regexpEscape,reservedWords:u.reservedWords,clone:r.clone,each:r.each,extend:r.extend,map:r.map,values:r.values,enforceFastProperties:r.enforceFastProperties,evalModule:o.evalModule,convertPasses:i,processOptions:function(n,l){var e={};return r.extend(e,n),r.extend(e,l),e},noop:function(){}}},function(n,l,e){n.exports=e(6)},function(n,l){n.exports=function(n,l,e){var t=n.__flags||(n.__flags=Object.create(null));if(3!==arguments.length)return t[l];t[l]=e}},function(n,l,e){"use strict";var t=e(84),u=e(0).compiler.Session;n.exports=function(n,l){n.use(t);var e=n.Assertion;function r(n,l,e){var t=l.parse(n);return e.allowedStartRules||(e.allowedStartRules=t.rules.length>0?[t.rules[0].name]:[]),t}e.addMethod("changeAST",function(n,t,o,i){o=void 0!==o?o:{},i=void 0!==i?i:{reportFailures:!0};var a=new u({grammar:n}),s=r(n,a,o);s.rules=s.rules.map(function(n){return Object.assign(n,i)}),l.flag(this,"object")(s,a,o),new e(s).like(t)}),e.addMethod("reportError",function(n,t,o){o=void 0!==o?o:{};var i,a,s=new u({grammar:n}),c=r(n,s,o);try{l.flag(this,"object")(c,s,o),i=!0}catch(n){a=n,i=!1}this.assert(!i,"expected #{this} to report an error but it didn't","expected #{this} to not report an error but #{act} was reported",null,a),i||void 0===t||("string"==typeof t&&(t={message:t}),Object.keys(t).forEach(function(n){new e(a).to.have.property(n).that.is.deep.equal(t[n])}))}),e.addMethod("reportWarning",function(n,e,t){var o=this;e=Array.isArray(e)?e:null==e?[]:[e],t=void 0!==t?t:{};var i=[];var a=new u({grammar:n,warn:function(n){i.push(n)}}),s=r(n,a,t);l.flag(this,"object")(s,a,t);var c=i.length,f=e.length;e.length&&this.assert(c===f,"expected #{this} to report ".concat(f," warnings, but it reported ").concat(c," warnings"),"expected #{this} to not report ".concat(f," warnings"),e,i),e.forEach(function(n){o.assert(-1!==i.indexOf(n),"expected #{this} to report the warning #{exp}, but it didn't","expected #{this} to not report the warning #{exp}",n)})})}},function(n,l,e){"use strict";l.visitor=e(10),l.Node=e(12),l.Grammar=e(22)},function(n,l,e){var t=[];l.version="4.2.0",l.AssertionError=e(43);var u=e(57);l.use=function(n){return~t.indexOf(n)||(n(l,u),t.push(n)),l},l.util=u;var r=e(8);l
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
"use strict";var t=n("base64-js"),u=n("ieee754");e.Buffer=i,e.SlowBuffer=function(n){+n!=n&&(n=0);return i.alloc(+n)},e.INSPECT_MAX_BYTES=50;var r=2147483647;function o(n){if(n>r)throw new RangeError("Invalid typed array length");var l=new Uint8Array(n);return l.__proto__=i.prototype,l}function i(n,l,e){if("number"==typeof n){if("string"==typeof l)throw new Error("If encoding is specified then the first argument must be a string");return c(n)}return a(n,l,e)}function a(n,l,e){if("number"==typeof n)throw new TypeError('"value" argument must not be a number');return I(n)||n&&I(n.buffer)?function(n,l,e){if(l<0||n.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(n.byteLength<l+(e||0))throw new RangeError('"length" is outside of buffer bounds');var t;t=void 0===l&&void 0===e?new Uint8Array(n):void 0===e?new Uint8Array(n,l):new Uint8Array(n,l,e);return t.__proto__=i.prototype,t}(n,l,e):"string"==typeof n?function(n,l){"string"==typeof l&&""!==l||(l="utf8");if(!i.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var e=0|d(n,l),t=o(e),u=t.write(n,l);u!==e&&(t=t.slice(0,u));return t}(n,l):function(n){if(i.isBuffer(n)){var l=0|p(n.length),e=o(l);return 0===e.length?e:(n.copy(e,0,0,l),e)}if(n){if(ArrayBuffer.isView(n)||"length"in n)return"number"!=typeof n.length||q(n.length)?o(0):f(n);if("Buffer"===n.type&&Array.isArray(n.data))return f(n.data)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.")}(n)}function s(n){if("number"!=typeof n)throw new TypeError('"size" argument must be of type number');if(n<0)throw new RangeError('"size" argument must not be negative')}function c(n){return s(n),o(n<0?0:0|p(n))}function f(n){for(var l=n.length<0?0:0|p(n.length),e=o(l),t=0;t<l;t+=1)e[t]=255&n[t];return e}function p(n){if(n>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|n}function d(n,l){if(i.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||I(n))return n.byteLength;"string"!=typeof n&&(n=""+n);var e=n.length;if(0===e)return 0;for(var t=!1;;)switch(l){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return N(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return M(n).length;default:if(t)return N(n).length;l=(""+l).toLowerCase(),t=!0}}function h(n,l,e){var t=n[l];n[l]=n[e],n[e]=t}function g(n,l,e,t,u){if(0===n.length)return-1;if("string"==typeof e?(t=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),q(e=+e)&&(e=u?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(u)return-1;e=n.length-1}else if(e<0){if(!u)return-1;e=0}if("string"==typeof l&&(l=i.from(l,t)),i.isBuffer(l))return 0===l.length?-1:m(n,l,e,t,u);if("number"==typeof l)return l&=255,"function"==typeof Uint8Array.prototype.indexOf?u?Uint8Array.prototype.indexOf.call(n,l,e):Uint8Array.prototype.lastIndexOf.call(n,l,e):m(n,[l],e,t,u);throw new TypeError("val must be string, number or Buffer")}function m(n,l,e,t,u){var r,o=1,i=n.length,a=l.length;if(void 0!==t&&("ucs2"===(t=String(t).toLowerCase())||"ucs-2"===t||"utf16le"===t||"utf-16le"===t)){if(n.length<2||l.length<2)return-1;o=2,i/=2,a/=2,e/=2}function s(n,l){return 1===o?n[l]:n.readUInt16BE(l*o)}if(u){var c=-1;for(r=e;r<i;r++)if(s(n,r)===s(l,-1===c?0:r-c)){if(-1===c&&(c=r),r-c+1===a)return c*o}else-1!==c&&(r-=r-c),c=-1}else for(e+a>i&&(e=i-a),r=e;r>=0;r--){for(var f=!0,p=0;p<a;p++)if(s(n,r+p)!==s(l,p)){f=!1;break}if(f)return r}return-1}function y(n,l,e,t){e=Number(e)||0;var u=n.length-e;t?(t=Number(t))>u&&(t=u):t=u;var r=l.length;t>r/2&&(t=r/2);for(var o=0;o<t;++o){var i=parseInt(l.substr(2*o,2),16);if(q(i))return o;n[e+o]=i}return o}function b(n,l,e,t){return R(N(l,n.length-e),n,e,t)}function v(n,l,e,t){return R(function(n){for(var l=[],e=0;e<n.length;++e)l.push(255&n.charCodeAt(e));return l}(l),n,e,t)}function w(n,l,e,t){return v(n,l,e,t)}function A(n,l,e,t){return R(M(l),n,e,t)}function E(n,l,e,t){return R(function(n,l){for(var e,t,u,r=[],o=0;o<n.leng
/*!
diff v3.5.0
Software License Agreement (BSD License)
Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
All rights reserved.
Redistribution and use of this software in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Kevin Decker nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@license
*/
var u,r;u=this,r=function(){return function(n){var l={};function e(t){if(l[t])return l[t].exports;var u=l[t]={exports:{},id:t,loaded:!1};return n[t].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}return e.m=n,e.c=l,e.p="",e(0)}([function(n,l,e){"use strict";l.__esModule=!0,l.canonicalize=l.convertChangesToXML=l.convertChangesToDMP=l.merge=l.parsePatch=l.applyPatches=l.applyPatch=l.createPatch=l.createTwoFilesPatch=l.structuredPatch=l.diffArrays=l.diffJson=l.diffCss=l.diffSentences=l.diffTrimmedLines=l.diffLines=l.diffWordsWithSpace=l.diffWords=l.diffChars=l.Diff=void 0;var t,u=e(1),r=(t=u)&&t.__esModule?t:{default:t},o=e(2),i=e(3),a=e(5),s=e(6),c=e(7),f=e(8),p=e(9),d=e(10),h=e(11),g=e(13),m=e(14),y=e(16),b=e(17);l.Diff=r.default,l.diffChars=o.diffChars,l.diffWords=i.diffWords,l.diffWordsWithSpace=i.diffWordsWithSpace,l.diffLines=a.diffLines,l.diffTrimmedLines=a.diffTrimmedLines,l.diffSentences=s.diffSentences,l.diffCss=c.diffCss,l.diffJson=f.diffJson,l.diffArrays=p.diffArrays,l.structuredPatch=m.structuredPatch,l.createTwoFilesPatch=m.createTwoFilesPatch,l.createPatch=m.createPatch,l.applyPatch=d.applyPatch,l.applyPatches=d.applyPatches,l.parsePatch=h.parsePatch,l.merge=g.merge,l.convertChangesToDMP=y.convertChangesToDMP,l.convertChangesToXML=b.convertChangesToXML,l.canonicalize=f.canonicalize},function(n,l){"use strict";function e(){}function t(n,l,e,t,u){for(var r=0,o=l.length,i=0,a=0;r<o;r++){var s=l[r];if(s.removed){if(s.value=n.join(t.slice(a,a+s.count)),a+=s.count,r&&l[r-1].added){var c=l[r-1];l[r-1]=l[r],l[r]=c}}else{if(!s.added&&u){var f=e.slice(i,i+s.count);f=f.map(function(n,l){var e=t[a+l];return e.length>n.length?e:n}),s.value=n.join(f)}else s.value=n.join(e.slice(i,i+s.count));i+=s.count,s.added||(a+=s.count)}}var p=l[o-1];return o>1&&"string"==typeof p.value&&(p.added||p.removed)&&n.equals("",p.value)&&(l[o-2].value+=p.value,l.pop()),l}l.__esModule=!0,l.default=e,e.prototype={diff:function(n,l){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=e.callback;"function"==typeof e&&(u=e,e={}),this.options=e;var r=this;function o(n){return u?(setTimeout(function(){u(void 0,n)},0),!0):n}n=this.castInput(n),l=this.castInput(l),n=this.removeEmpty(this.tokenize(n));var i=(l=this.removeEmpty(this.tokenize(l))).length,a=n.length,s=1,c=i+a,f=[{newPos:-1,components:[]}],p=this.extractCommon(f[0],l,n,0);if(f[0].newPos+1>=i&&p+1>=a)return o([{value:this.join(l),count:l.length}]);function d(){for(var e=-1*s;e<=s;e+=2){var u=void 0,c=f[e-1],p=f[e+1],d=(p?p.newPos:0)-e;c&&(f[e-1]=void 0);var h=c&&c.newPos+1<i,g=p&&0<=d&&d<a;if(h||g){if(!h||g&&c.newPos<p.newPos?(u={newPos:(m=p).newPos,components:m.components.slice(0)},r.pushComponent(u.components,void 0,!0)):((u=c).newPos++,r.pushComponent(u.components,!0,void 0)),d=r.extractCommon(u,l,n,e),u.newPos+1>=i&&d+1>=a)return o(t(r,u.components,l,n,r.useLongestToken));f[e]=u}else f[e]=void 0}var m;s++}if(u)!function n(){setTimeout(function(){if(s>c)return u();d()||n()},0)}();else for(;s<=c;){var h=d();if(h)return h}},pushComponent:function(n,l,e){var t=n[n.length-1];t&&t.added===l&&t.removed===e?n[n.length-1]={count:t.count+1,added:l,removed:e}:n.push({count:1,added:l,removed:e})},extractCommon:function(n,l,e,t){for(var u=l.length,r=e.length,o=n.newPos,i=o-t,a=0;o+1<u&&i+1<r&&this.equals(l[o+1],e[i+1]);)o++,i++,a++;return a&&n.components.push({count:a}),n.newPos=o,i},equals:function(n,l){return this.options.comparator?this.options.comparator(n,l):n===l||this.options.ignoreCase&&n.toLowerCase()===l.toLowerCase()},removeEmpty:function(n){for(var l=[],e=0;e<n.length;e++)n[e]&&l.push(n[e]);return l},castInput:function(n){return n},tokenize:function(n){return n.split("")},join:function(n){return n.join("")}}},function(n,l,e){"use strict";l.__esModule=!0,l.characterDiff=void 0,l.diffChars=function(n,l,e){return o.diff(n,l,e)};var t,u=e(1),r=(t=u)&&t.__esModule?t:{default:t};var o=l.characterDiff=new r.default},function(n,l,e){"use strict";l.__esModule=!0,l.wordDiff=void 0,l.diffWords=function(n,l,e){return e=(0,o.generateOptions)(e,{ignoreWhitespace:!0}),s.diff(n,l,e)}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
l.exports=function(n){return null!=n&&(t(n)||function(n){return"function"==typeof n.readFloatLE&&"function"==typeof n.slice&&t(n.slice(0,0))}(n)||!!n._isBuffer)}},{}],52:[function(n,l,e){var t={}.toString;l.exports=Array.isArray||function(n){return"[object Array]"==t.call(n)}},{}],53:[function(n,l,e){(function(e){var u=n("path"),r=n("fs"),o=parseInt("0777",8);function i(n,l,a,s){"function"==typeof l?(a=l,l={}):l&&"object"===t(l)||(l={mode:l});var c=l.mode,f=l.fs||r;void 0===c&&(c=o&~e.umask()),s||(s=null);var p=a||function(){};n=u.resolve(n),f.mkdir(n,c,function(e){if(!e)return p(null,s=s||n);switch(e.code){case"ENOENT":i(u.dirname(n),l,function(e,t){e?p(e,t):i(n,l,p,t)});break;default:f.stat(n,function(n,l){n||!l.isDirectory()?p(e,s):p(null,s)})}})}l.exports=i.mkdirp=i.mkdirP=i,i.sync=function n(l,i,a){i&&"object"===t(i)||(i={mode:i});var s=i.mode,c=i.fs||r;void 0===s&&(s=o&~e.umask()),a||(a=null),l=u.resolve(l);try{c.mkdirSync(l,s),a=a||l}catch(e){switch(e.code){case"ENOENT":a=n(u.dirname(l),i,a),n(l,i,a);break;default:var f;try{f=c.statSync(l)}catch(n){throw e}if(!f.isDirectory())throw e}}return a}}).call(this,n("_process"))},{_process:56,fs:40,path:40}],54:[function(n,l,e){var u=1e3,r=60*u,o=60*r,i=24*o,a=365.25*i;function s(n,l,e){if(!(n<l))return n<1.5*l?Math.floor(n/l)+" "+e:Math.ceil(n/l)+" "+e+"s"}l.exports=function(n,l){l=l||{};var e,c=t(n);if("string"===c&&n.length>0)return function(n){if((n=String(n)).length>100)return;var l=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(n);if(!l)return;var e=parseFloat(l[1]);switch((l[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return e*a;case"days":case"day":case"d":return e*i;case"hours":case"hour":case"hrs":case"hr":case"h":return e*o;case"minutes":case"minute":case"mins":case"min":case"m":return e*r;case"seconds":case"second":case"secs":case"sec":case"s":return e*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}(n);if("number"===c&&!1===isNaN(n))return l.long?s(e=n,i,"day")||s(e,o,"hour")||s(e,r,"minute")||s(e,u,"second")||e+" ms":function(n){if(n>=i)return Math.round(n/i)+"d";if(n>=o)return Math.round(n/o)+"h";if(n>=r)return Math.round(n/r)+"m";if(n>=u)return Math.round(n/u)+"s";return n+"ms"}(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))}},{}],55:[function(n,l,e){(function(n){"use strict";!n.version||0===n.version.indexOf("v0.")||0===n.version.indexOf("v1.")&&0!==n.version.indexOf("v1.8.")?l.exports={nextTick:function(l,e,t,u){if("function"!=typeof l)throw new TypeError('"callback" argument must be a function');var r,o,i=arguments.length;switch(i){case 0:case 1:return n.nextTick(l);case 2:return n.nextTick(function(){l.call(null,e)});case 3:return n.nextTick(function(){l.call(null,e,t)});case 4:return n.nextTick(function(){l.call(null,e,t,u)});default:for(r=new Array(i-1),o=0;o<r.length;)r[o++]=arguments[o];return n.nextTick(function(){l.apply(null,r)})}}}:l.exports=n}).call(this,n("_process"))},{_process:56}],56:[function(n,l,e){var t,u,r=l.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(n){if(t===setTimeout)return setTimeout(n,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(n,0);try{return t(n,0)}catch(l){try{return t.call(null,n,0)}catch(l){return t.call(this,n,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(n){t=o}try{u="function"==typeof clearTimeout?clearTimeout:i}catch(n){u=i}}();var s,c=[],f=!1,p=-1;function d(){f&&s&&(f=!1,s.length?c=s.concat(c):p=-1,c.length&&h())}function h(){if(!f){var n=a(d);f=!0;for(var l=c.length;l;){for(s=c,c=[];++p<l;)s&&s[p].run();p=-1,l=c.length}s=null,f=!1,function(n){if(u===clearTimeout)return clearTimeout(n);if((u===i||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(n);try{u(n)}catch(l){try{return u.call(null,n)}catch(l){return u.call(this,n)}}}(n)}}function g(n,l){this.fun=n,this.array