From b6776d91f0cdaff483d362efad395fcc02df9b6d Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Thu, 2 Apr 2020 08:45:03 +0200 Subject: [PATCH] node-gtk example --- bin/lips.js | 3 + dist/lips.js | 25 +- dist/lips.min.js | 6 +- node-gtk/package-lock.json | 1107 ++++++++++++++++++++++++++++++++++++ node-gtk/package.json | 15 + node-gtk/run.js | 17 + node-gtk/run.scm | 21 + src/lips.js | 7 + 8 files changed, 1193 insertions(+), 8 deletions(-) create mode 100644 node-gtk/package-lock.json create mode 100644 node-gtk/package.json create mode 100755 node-gtk/run.js create mode 100755 node-gtk/run.scm diff --git a/bin/lips.js b/bin/lips.js index bee27d5b..d4e3a7c08 100755 --- a/bin/lips.js +++ b/bin/lips.js @@ -93,11 +93,14 @@ function boostrap() { var path; try { path = require.resolve(`./${name}`); + console.log('A'); } catch (e) { try { path = require.resolve(`../${name}`); + console.log('B'); } catch (e) { path = require.resolve(`@jcubic/lips/../${name}`); + console.log('C'); } } var data = fs.readFileSync(path); diff --git a/dist/lips.js b/dist/lips.js index 330d28dc..92d8db73 100644 --- a/dist/lips.js +++ b/dist/lips.js @@ -1,5 +1,5 @@ /**@license - * LIPS is Pretty Simple - simple scheme like lisp in JavaScript - v. DEV + * LIPS is Pretty Simple - simple scheme like lisp in JavaScript - v. 0.20.1 * * Copyright (c) 2018-2019 Jakub T. Jankiewicz * Released under the MIT license @@ -24,7 +24,7 @@ * Copyright (c) 2014-present, Facebook, Inc. * released under MIT license * - * build: Wed, 01 Apr 2020 23:12:19 +0000 + * build: Thu, 02 Apr 2020 06:52:35 +0000 */ (function () { 'use strict'; @@ -1150,7 +1150,7 @@ var _build = "".concat(_year, "-").concat(_format(_date.getMonth() + 1), "-").concat(_format(_date.getDate())); - var banner = "\n __ __\n / / _ _ ___ ___ \\ \\\n| | | | | || . \\/ __> | |\n| | | |_ | || _/\\__ \\ | |\n| | |___||_||_| <___/ | |\n \\_\\ /_/\n\nLIPS Interpreter DEV (".concat(_build, ")\nCopyright (c) 2018-").concat(_year, " Jakub T. Jankiewicz \n\nType (env) to see environment with functions macros and variables.\nYou can also use (help name) to display help for specic function or macro.\n").replace(/^.*\n/, ''); + var banner = "\n __ __\n / / _ _ ___ ___ \\ \\\n| | | | | || . \\/ __> | |\n| | | |_ | || _/\\__ \\ | |\n| | |___||_||_| <___/ | |\n \\_\\ /_/\n\nLIPS Interpreter 0.20.1 (".concat(_build, ")\nCopyright (c) 2018-").concat(_year, " Jakub T. Jankiewicz \n\nType (env) to see environment with functions macros and variables.\nYou can also use (help name) to display help for specic function or macro.\n").replace(/^.*\n/, ''); return banner; }(); // parse_argument based on function from jQuery Terminal @@ -6029,10 +6029,19 @@ return result; }, "(env obj)\n\n Function return list values (functions and variables) inside environment."), 'new': doc(function (obj) { + if (typeof obj === 'function') { + obj = unbind(obj); + } + for (var _len17 = arguments.length, args = new Array(_len17 > 1 ? _len17 - 1 : 0), _key17 = 1; _key17 < _len17; _key17++) { args[_key17 - 1] = arguments[_key17]; } + console.log({ + obj: obj, + args: args + }); + var instance = construct(unbind(obj), args); Object.defineProperty(instance, '__instance__', { @@ -7222,6 +7231,12 @@ var scope = (dynamic_scope || env).newFrame(value, _args); var result = resolvePromises(value.apply(scope, args)); return unpromise(result, function (result) { + if (LSymbol.is(first, 'new')) { + console.log({ + result: result + }); + } + if (result instanceof Pair) { result.markCycles(); return quote(result); @@ -7461,9 +7476,9 @@ InputStringPort.__className = 'input-string-port'; // ------------------------------------------------------------------------- var lips = { - version: 'DEV', + version: '0.20.1', banner: banner, - date: 'Wed, 01 Apr 2020 23:12:19 +0000', + date: 'Thu, 02 Apr 2020 06:52:35 +0000', exec: exec, parse: parse, tokenize: tokenize, diff --git a/dist/lips.min.js b/dist/lips.min.js index 52e0239e..17589c81 100644 --- a/dist/lips.min.js +++ b/dist/lips.min.js @@ -1,5 +1,5 @@ /**@license - * LIPS is Pretty Simple - simple scheme like lisp in JavaScript - v. DEV + * LIPS is Pretty Simple - simple scheme like lisp in JavaScript - v. 0.20.1 * * Copyright (c) 2018-2019 Jakub T. Jankiewicz * Released under the MIT license @@ -24,6 +24,6 @@ * Copyright (c) 2014-present, Facebook, Inc. * released under MIT license * - * build: Wed, 01 Apr 2020 23:12:19 +0000 + * build: Thu, 02 Apr 2020 06:52:35 +0000 */ -(function(){"use strict";function e(e,n){return n={exports:{}},e(n,n.exports),n.exports}var u=e(function(t){function r(e,n){t.exports=r=Object.setPrototypeOf||function e(n,t){n.__proto__=t;return n};return r(e,n)}t.exports=r});var Pn=e(function(r){function i(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(e){return false}}function o(e,n,t){if(i()){r.exports=o=Reflect.construct}else{r.exports=o=function e(n,t,r){var i=[null];i.push.apply(i,t);var o=Function.bind.apply(n,i);var a=new o;if(r)u(a,r.prototype);return a}}return o.apply(null,arguments)}r.exports=o});var n=e(function(e){var n=function(o){var e=Object.prototype;var s=e.hasOwnProperty;var c;var n=typeof Symbol==="function"?Symbol:{};var i=n.iterator||"@@iterator";var t=n.asyncIterator||"@@asyncIterator";var r=n.toStringTag||"@@toStringTag";function a(e,n,t,r){var i=n&&n.prototype instanceof u?n:u;var o=Object.create(i.prototype);var a=new E(r||[]);o._invoke=O(e,t,a);return o}o.wrap=a;function f(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}var l="suspendedStart";var p="suspendedYield";var h="executing";var d="completed";var v={};function u(){}function m(){}function y(){}var g={};g[i]=function(){return this};var b=Object.getPrototypeOf;var w=b&&b(b(A([])));if(w&&w!==e&&s.call(w,i)){g=w}var _=y.prototype=u.prototype=Object.create(g);m.prototype=_.constructor=y;y.constructor=m;y[r]=m.displayName="GeneratorFunction";function x(e){["next","throw","return"].forEach(function(n){e[n]=function(e){return this._invoke(n,e)}})}o.isGeneratorFunction=function(e){var n=typeof e==="function"&&e.constructor;return n?n===m||(n.displayName||n.name)==="GeneratorFunction":false};o.mark=function(e){if(Object.setPrototypeOf){Object.setPrototypeOf(e,y)}else{e.__proto__=y;if(!(r in e)){e[r]="GeneratorFunction"}}e.prototype=Object.create(_);return e};o.awrap=function(e){return{__await:e}};function k(u){function c(e,n,t,r){var i=f(u[e],u,n);if(i.type==="throw"){r(i.arg)}else{var o=i.arg;var a=o.value;if(a&&typeof a==="object"&&s.call(a,"__await")){return Promise.resolve(a.__await).then(function(e){c("next",e,t,r)},function(e){c("throw",e,t,r)})}return Promise.resolve(a).then(function(e){o.value=e;t(o)},function(e){return c("throw",e,t,r)})}}var n;function e(t,r){function e(){return new Promise(function(e,n){c(t,r,e,n)})}return n=n?n.then(e,e):e()}this._invoke=e}x(k.prototype);k.prototype[t]=function(){return this};o.AsyncIterator=k;o.async=function(e,n,t,r){var i=new k(a(e,n,t,r));return o.isGeneratorFunction(n)?i:i.next().then(function(e){return e.done?e.value:i.next()})};function O(a,u,c){var s=l;return function e(n,t){if(s===h){throw new Error("Generator is already running")}if(s===d){if(n==="throw"){throw t}return N()}c.method=n;c.arg=t;while(true){var r=c.delegate;if(r){var i=j(r,c);if(i){if(i===v)continue;return i}}if(c.method==="next"){c.sent=c._sent=c.arg}else if(c.method==="throw"){if(s===l){s=d;throw c.arg}c.dispatchException(c.arg)}else if(c.method==="return"){c.abrupt("return",c.arg)}s=h;var o=f(a,u,c);if(o.type==="normal"){s=c.done?d:p;if(o.arg===v){continue}return{value:o.arg,done:c.done}}else if(o.type==="throw"){s=d;c.method="throw";c.arg=o.arg}}}}function j(e,n){var t=e.iterator[n.method];if(t===c){n.delegate=null;if(n.method==="throw"){if(e.iterator["return"]){n.method="return";n.arg=c;j(e,n);if(n.method==="throw"){return v}}n.method="throw";n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var r=f(t,e.iterator,n.arg);if(r.type==="throw"){n.method="throw";n.arg=r.arg;n.delegate=null;return v}var i=r.arg;if(!i){n.method="throw";n.arg=new TypeError("iterator result is not an object");n.delegate=null;return v}if(i.done){n[e.resultName]=i.value;n.next=e.nextLoc;if(n.method!=="return"){n.method="next";n.arg=c}}else{return i}n.delegate=null;return v}x(_);_[r]="Generator";_[i]=function(){return this};_.toString=function(){return"[object Generator]"};function S(e){var n={tryLoc:e[0]};if(1 in e){n.catchLoc=e[1]}if(2 in e){n.finallyLoc=e[2];n.afterLoc=e[3]}this.tryEntries.push(n)}function F(e){var n=e.completion||{};n.type="normal";delete n.arg;e.completion=n}function E(e){this.tryEntries=[{tryLoc:"root"}];e.forEach(S,this);this.reset(true)}o.keys=function(t){var r=[];for(var e in t){r.push(e)}r.reverse();return function e(){while(r.length){var n=r.pop();if(n in t){e.value=n;e.done=false;return e}}e.done=true;return e}};function A(n){if(n){var e=n[i];if(e){return e.call(n)}if(typeof n.next==="function"){return n}if(!isNaN(n.length)){var t=-1,r=function e(){while(++t=0;--n){var i=this.tryEntries[n];var o=i.completion;if(i.tryLoc==="root"){return e("end")}if(i.tryLoc<=this.prev){var a=s.call(i,"catchLoc");var u=s.call(i,"finallyLoc");if(a&&u){if(this.prev=0;--t){var r=this.tryEntries[t];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e){this.complete(t.completion,t.afterLoc);F(t);return v}}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var r=t.completion;if(r.type==="throw"){var i=r.arg;F(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){this.delegate={iterator:A(e),resultName:n,nextLoc:t};if(this.method==="next"){this.arg=c}return v}};return o}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}});var Cn=n;function c(e,n,t,r,i,o,a){try{var u=e[o](a);var c=u.value}catch(e){t(e);return}if(u.done){n(c)}else{Promise.resolve(c).then(r,i)}}function t(u){return function(){var e=this,a=arguments;return new Promise(function(n,t){var r=u.apply(e,a);function i(e){c(r,n,t,i,o,"next",e)}function o(e){c(r,n,t,i,o,"throw",e)}i(undefined)})}}var Mn=t;function r(e){if(Array.isArray(e))return e}var i=r;function o(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}var a=o;function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var f=s;function l(e){return i(e)||a(e)||f()}var Rn=l;function p(e){if(Array.isArray(e)){for(var n=0,t=new Array(e.length);n=0)continue;t[i]=e[i]}return t}var k=x;function O(e,n){if(e==null)return{};var t=k(e,n);var r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;t[r]=e[r]}}return t}var $n=O;var Dn=e(function(n){function t(e){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){t=function e(n){return typeof n}}else{t=function e(n){return n&&typeof Symbol==="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n}}return t(e)}function r(e){if(typeof Symbol==="function"&&t(Symbol.iterator)==="symbol"){n.exports=r=function e(n){return t(n)}}else{n.exports=r=function e(n){return n&&typeof Symbol==="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":t(n)}}return r(e)}n.exports=r});function j(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);if(e)r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable});t.push.apply(t,r)}return t}function Jn(n){for(var e=1;e\n\nType (env) to see environment with functions macros and variables.\nYou can also use (help name) to display help for specic function or macro.\n").replace(/^.*\n/,"");return i}();var t=/^\/((?:\\\/|[^/]|\[[^\]]*\/[^\]]*\])+)\/([gimy]*)$/;var i=/^(?:#x[-+]?[0-9a-f]+|#o[-+]?[0-7]+|#b[-+]?[01]+|[-+]?[0-9]+)$/i;var o=/^([-+]?([0-9]+([eE][-+]?[0-9]+)|(\.[0-9]+|[0-9]+\.[0-9]+)([eE][-+]?[0-9]+)?)|[0-9]+\.)$/;var a=/^#\\(?:newline|space|.)$/i;var u=/^((?:(?:[-+]?[0-9]+(?:[eE][-+]?[0-9]+)?)|(?:[-+]?(?:(?:\.[0-9]+|[0-9]+\.[0-9]+)(?:[eE][-+]?[0-9]+)?)|[0-9]+\.))(?=[+-]|i))?((?:[-+]?[0-9]+(?:[eE][-+]?[0-9]+)?)|(?:[-+]?(?:(?:\.[0-9]+|[0-9]+\.[0-9]+)(?:[eE][-+]?[0-9]+)?)|[0-9]+\.))i|-i$/;var c=/^[-+]?[0-9]+\/[0-9]+$/;function s(e){var n=e.split("/");return Ze({num:parseInt(n[0],10),denom:parseInt(n[1],10)})}function l(e){var n=e.match(/^(?:#([xbo]))?([+-]?[0-9a-f]+)$/i);var t;if(n&&n[1]){switch(n[1]){case"x":t=16;break;case"o":t=8;break;case"b":t=2;break}}else{t=10}return Ge(parseInt(n[2],t))}function p(e){var n=e.match(/#\\(.*)$/);if(n){return Ce(n[1])}}function h(e){if(e==="-i"){return{im:-1,re:0}}var n=e.match(u);var t,r;if(n.length===2){t=Ve(0);r=Ve(parseFloat(n[1]))}else{t=Ve(n[1]?parseFloat(n[1]):0);r=Ve(parseFloat(n[2]))}return ze({im:r,re:t})}function d(e){return Me(JSON.parse(e.replace(/\n/g,"\\n")))}function y(e){var n=e.match(t);if(n){return new RegExp(n[1],n[2])}else if(e.match(/^"/)){return d(e)}else if(e.match(a)){return p(e)}else if(e.match(c)){return s(e)}else if(e.match(u)){return h(e)}else if(e.match(i)){return l(e)}else if(e.match(o)){return Ve(parseFloat(e))}else if(e==="nil"){return z}else if(e==="true"){return true}else if(e==="false"){return false}else{return new U(e)}}function v(e){return!(["(",")"].includes(e)||e.match(t)||e.match(/['"]/)||e.match(i)||e.match(o)||["nil","true","false"].includes(e))}var m=/("(?:\\[\S\s]|[^"])*"|\/(?! )[^\n\/\\]*(?:\\[\S\s][^\n\/\\]*)*\/[gimy]*(?=\s|\(|\)|$)|;.*)/g;var b=/"(?:\\[\S\s]|[^"])*"/g;function w(){var e=Object.keys(S).map(x).join("|");return new RegExp('("(?:\\\\[\\S\\s]|[^"])*"|#\\\\(?:newline|space|.)|#f|#t|#[xbo][0-9a-f]+(?=[\\s()]|$)|[0-9]+/[0-9]+|\\/(?! )[^\\n\\/\\\\]*(?:\\\\[\\S\\s][^\\n\\/\\\\]*)*\\/[gimy]*(?=\\s|\\(|\\)|$)|\\(|\\)|\'|"(?:\\\\[\\S\\s]|[^"])+|\\n|(?:\\\\[\\S\\s]|[^"])*"|;.*|(?:(?:[-+]?(?:(?:\\.[0-9]+|[0-9]+\\.[0-9]+)(?:[eE][-+]?[0-9]+)?)|[0-9]+\\.)[0-9]i)|\\.{2,}|'.concat(e,"|[^(\\s)]+)"),"gim")}function _(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:1;return e[e.length-n]}function x(e){if(typeof e==="string"){var n=/([-\\^$[\]()+{}?*.|])/g;return e.replace(n,"\\$1")}}function k(e){var i=w();e=e.replace(/\n\r|\r/g,"\n");var o=0;var a=0;var u=[];var c=[];var s=0;e.split(m).filter(Boolean).forEach(function(e){if(e.match(m)){s=0;if(c.length){var n=_(c);if(n.token.match(/\n/)){var t=n.token.split("\n").pop();s+=t.length}else{s+=n.token.length}s+=n.col}var r={col:s,line:a,token:e,offset:o};u.push(r);c.push(r);o+=e.length;s+=e.length;a+=(e.match("\n")||[]).length;return}e.split(i).filter(Boolean).forEach(function(e){var n={col:s,line:a,token:e,offset:o};s+=e.length;o+=e.length;u.push(n);c.push(n);if(e==="\n"){++a;c=[];s=0}})});return u}function O(e){var n=e.token,t=$n(e,["token"]);if(n.match(/^"[\s\S]+"$/)&&n.match(/\n/)){var r=new RegExp("^ {1,"+(e.col+1)+"}","mg");n=n.replace(r,"")}return Jn({token:n},t)}function j(e,n){var t=arguments.length>2&&arguments[2]!==g?arguments[2]:O;if(n){return k(e).map(t)}else{return k(e).map(function(e){var n=t(e);if(!n||typeof n.token!=="string"){throw new Error("[tokenize] Invalid formatter wrong return object")}return n.token.trim()}).filter(function(e){return e&&!e.match(/^;/)})}}var S={"'":new U("quote"),"`":new U("quasiquote"),",@":new U("unquote-splicing"),",":new U("unquote")};function F(e){if(typeof e==="string"){e=j(e)}var a=[];var u=[];var c=null;var s=Object.keys(S);var f=s.map(function(e){return S[e].name});var l=0;var p=false;var h=[];var d=[];var v=0;function m(){var e=a[a.length-1];if(e instanceof Array&&e[0]instanceof U&&f.includes(e[0].name)&&a.length>1&&!e[0].literal){a.pop();if(a[a.length-1].length===1&&a[a.length-1][0]instanceof U){a[a.length-1].push(e)}else if(a[a.length-1]instanceof V){if(a[a.length-1].cdr instanceof V){a[a.length-1]=new V(a[a.length-1],V.fromArray(e))}else{a[a.length-1].cdr=V.fromArray(e)}}else{a[a.length-1].push(e)}}}e.forEach(function(e){var n=a[a.length-1];if(s.indexOf(e)!==-1){v++;c=e;a.push([S[c]]);if(!c){d=[]}d.push(c)}else{if(c){h.push(d);d=[]}if(e==="("){p=true;l++;a.push([]);c=null;v=0}else if(e==="."&&!p){a[a.length-1]=V.fromArray(n)}else if(e===")"){l--;if(!a.length){throw new Error("Unbalanced parenthesis")}if(a.length===1){var t=a.pop();if(t instanceof Array&&t.length===0){t=z}u.push(t)}else if(a.length>1){var r=a.pop();n=a[a.length-1];if(n instanceof Array){if(r.length===0){n.push(z)}else{n.push(r)}}else if(n instanceof V){if(r.length===0){n.append(z)}else{n.append(V.fromArray(r))}}if(h.length){d=h.pop();while(d.length){m();d.pop()}}else{m()}}if(l===0&&a.length){u.push(a.pop())}}else{p=false;var i=y(e);if(c){while(v--){a[a.length-1].push(i);i=a.pop()}h.pop();v=0;c=false}else if(i instanceof U&&f.includes(i.name)){i.literal=true}n=a[a.length-1];if(n instanceof V){var o=n;while(true){if(o.cdr===z){if(i instanceof Array){o.cdr=V.fromArray(i)}else{o.cdr=i}break}else{o=o.cdr}}}else if(!a.length){u.push(i)}else{n.push(i)}}}});if(!e.filter(function(e){return e.match(/^[()]$/)}).length&&a.length){u=u.concat(a);a=[]}if(a.length){throw new Error("Unbalanced parenthesis 2")}return u.map(function(e){if(e instanceof Array){return V.fromArray(e)}return e})}function E(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:function(e){return e};var t=arguments.length>2&&arguments[2]!==g?arguments[2]:null;if(e instanceof Array){var r=e.filter(ce);if(r.length){return E(Promise.all(r),n,t)}return n(e)}if(ce(e)){var i=e.then(n);if(t===null){return i}else{return i["catch"](t)}}return n(e)}function A(e,n){if(n instanceof RegExp){return function(e){return String(e).match(n)}}else if(typeof n!=="function"){throw new Error("".concat(e," argument need to be a function or RegExp"))}else{return n}}function N(e,n,t){if(n){if(t){e.__doc__=n}else{e.__doc__=q(n)}}return e}function q(e){return e.split("\n").map(function(e){return e.trim()}).join("\n")}function I(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:1;var t=e.length;if(n<=0){throw Error("previousSexp: Invlaid argument sexp = ".concat(n))}e:while(n--&&t>=0){var r=1;while(r>0){var i=e[--t];if(!i){break e}if(i==="("||i.token==="("){r--}else if(i===")"||i.token===")"){r++}}t--}return e.slice(t+1)}function L(e){if(!e||!e.length){return 0}var n=e.length;if(e[n-1].token==="\n"){return 0}while(--n){if(e[n].token==="\n"){var t=(e[n+1]||{}).token;if(t){return t.length}}}return 0}function P(e,n){return s(e,n)===n.length;function s(e,n){function t(){return i>0&&a>0&&e[i-1]===n[a-1]&&e[i+1]===n[a]}function r(){return e[i]===Symbol["for"]("symbol")&&!v(n[a])}var i=0;var o={};for(var a=0;a0){continue}}else if(r()){return-1}}else if(e[i]instanceof Array){var c=s(e[i],n.slice(a));if(c===-1||c+a>n.length){return-1}a+=c-1;i++;continue}else{return-1}i++}if(e.length!==i){return-1}return n.length}}function C(e){this._code=e.replace(/\r/g,"")}C.defaults={offset:0,indent:2,specials:[/^define/,"lambda","let","let*"]};C.match=P;C.prototype._options=function e(n){var t=C.defaults;if(typeof n==="undefined"){return Object.assign({},t)}var r=n&&n.specials||[];return Object.assign({},t,n,{specials:t.specials.concat(r)})};C.prototype.indent=function e(n){var t=j(this._code,true);return this._indent(t,n)};C.matchSpecial=function(e,n){var t=n.specials;if(t.indexOf(e)!==-1){return true}else{var r=t.filter(function(e){return e instanceof RegExp});var i=true;var o=false;var a=g;try{for(var u=r[Symbol.iterator](),c;!(i=(c=u.next()).done);i=true){var s=c.value;if(e.match(s)){return true}}}catch(e){o=true;a=e}finally{try{if(!i&&u["return"]!=null){u["return"]()}}finally{if(o){throw a}}}}return false};C.prototype._indent=function e(n,t){var r=this._options(t);var i=L(n);var o=I(n);if(o&&o.length){if(o[0].line>0){r.offset=0}if(o.toString()===n.toString()&&Nn(o)){return r.offset+o[0].col}else if(o.length===1){return r.offset+o[0].col+1}else if(C.matchSpecial(o[1].token,r)){return r.offset+o[0].col+r.indent}else if(o[0].line3&&o[1].line===o[3].line){if(o[1].token==="("){return r.offset+o[1].col}return r.offset+o[3].col}else if(o[0].line===o[1].line){return r.offset+r.indent+o[0].col}else{var a=o.slice(2);for(var u=0;u1&&arguments[1]!==g?arguments[1]:true;if(e instanceof V){return e}if(n===false){var t=z;for(var r=e.length;r--;){t=new V(e[r],t)}return t}if(e.length&&!(e instanceof Array)){e=Bn(e)}if(e.length===0){return Q()}else{var i;if(e[0]instanceof Array){i=V.fromArray(e[0])}else{i=e[0]}if(typeof i==="string"){i=Me(i)}if(e.length===1){return new V(i,z)}else{return new V(i,V.fromArray(e.slice(1)))}}};V.prototype.toObject=function(){var e=this;var n={};while(true){if(e instanceof V&&e.car instanceof V){var t=e.car;var r=t.car;if(r instanceof U){r=r.name}if(r instanceof String){r=r.valueOf()}var i=t.cdr;if(i instanceof V){i=i.toObject()}if(i instanceof Ge||i instanceof Me){i=i.valueOf()}n[r]=i;e=e.cdr}else{break}}return n};V.fromPairs=function(e){return e.reduce(function(e,n){return new V(new V(new U(n[0]),n[1]),e)},z)};V.fromObject=function(n){var e=Object.keys(n).map(function(e){return[e,n[e]]});return V.fromPairs(e)};V.prototype.reduce=function(e){var n=this;var t=z;while(true){if(n!==z){t=e(t,n.car);n=n.cdr}else{break}}return t};V.prototype.reverse=function(){if(this.haveCycles()){throw new Error("You can't reverse list that have cycles")}var e=this;var n=z;while(e!==z){var t=e.cdr;e.cdr=n;n=e;e=t}return n};V.prototype.transform=function(r){function i(e){if(e instanceof V){if(e.replace){delete e.replace;return e}var n=r(e.car);if(n instanceof V){n=i(n)}var t=r(e.cdr);if(t instanceof V){t=i(t)}return new V(n,t)}return e}return i(this)};V.prototype.map=function(e){if(typeof this.car!=="undefined"){return new V(e(this.car),re(this.cdr)?z:this.cdr.map(e))}else{return z}};function X(e){if(typeof e==="function"){return"<#function "+(e.name||"anonymous")+">"}else if(typeof e==="string"||e instanceof Me){return JSON.stringify(e.valueOf()).replace(/\\n/g,"\n")}else if(ce(e)){return"<#Promise>"}else if(e instanceof U||e instanceof Ge||e instanceof RegExp||e instanceof V||e instanceof Ce||e===z){return e.toString()}else if(e instanceof Array){return e.map(X)}else if(Dn(e)==="object"){if(e===null){return"null"}var n=e.constructor.name;if(n==="Object"){return JSON.stringify(e)}return"<#object("+e.constructor.name+")>"}else if(typeof e!=="undefined"){return e}}V.prototype.markCycles=function(){K(this);return this};V.prototype.haveCycles=function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:null;if(!e){return this.haveCycles("car")||this.haveCycles("cdr")}return!!(this.cycles&&this.cycles[e])};function K(e){var i=[];var n=[];function o(e){if(e instanceof V){if(i.includes(e)){if(!n.includes(e)){n.push(e)}return"#".concat(n.length-1,"#")}}}function a(e){if(e instanceof V){i.push(e);var n={};var t=o(e.car);var r=o(e.cdr);if(t){n["car"]=t}else{a(e.car)}if(r){n["cdr"]=r}else{a(e.cdr)}if(t||r){e.cycles=n}else if(e.cycles){delete e.cycles}}}a(e)}V.prototype.toString=function(){var e=["("];if(this.car!==g){var n;if(this.cycles&&this.cycles.car){n=this.cycles.car}else{n=X(this.car)}if(n!==g){e.push(n)}if(this.cdr instanceof V){if(this.cycles&&this.cycles.cdr){e.push(" . ");e.push(this.cycles.cdr)}else{var t;if(this.cycles&&this.cycles.cdr){t=this.cycles.cdr}var r=this.cdr.toString(t).replace(/^\(|\)$/g,"");e.push(" ");e.push(r)}}else if(typeof this.cdr!=="undefined"&&this.cdr!==z){e=e.concat([" . ",X(this.cdr)])}}e.push(")");return e.join("")};V.prototype.set=function(e,n){this[e]=n;if(n instanceof V){this.markCycles()}};V.prototype.append=function(e){if(e instanceof Array){return this.append(V.fromArray(e))}var n=this;if(n.car===g){if(e instanceof V){this.car=e.car;this.cdr=e.cdr}else{this.car=e}}else if(e!==z){while(true){if(n instanceof V&&n.cdr!==z){n=n.cdr}else{break}}n.cdr=e}return this};function Z(e){return e<0?-e:e}function ee(e,n){var t=Rn(n),r=t[0],i=t.slice(1);while(i.length>0){var o=i,a=Tn(o,1),u=a[0];if(!e(r,u)){return false}var c=i;var s=Rn(c);r=s[0];i=s.slice(1)}return true}function ne(e,n){if(e instanceof Ge&&n instanceof Ge){return e.cmp(n)===0}else if(typeof e==="number"||typeof n==="number"){return Ge(e).cmp(Ge(n))===0}else if(e instanceof Ce&&n instanceof Ce){return e["char"]===n["char"]}else if(e instanceof Me&&n instanceof Me){return e.valueOf()===n.valueOf()}else if(e instanceof U&&n instanceof U){return e.name===n.name}else{return e===n}}var te=function(){if(Math.trunc){return Math.trunc}else{return function(e){if(e<0){return Math.ceil(e)}else{return Math.floor(e)}}}}();function re(e){return e instanceof V&&e.isEmptyList()||e===z}function ie(e,n,t,r){if(typeof this!=="undefined"&&this.constructor!==ie||typeof this==="undefined"){return new ie(e,n)}bn("Macro",e,"string",1);bn("Macro",n,"function",2);if(t){if(r){this.__doc__=t}else{this.__doc__=q(t)}}this.name=e;this.fn=n}ie.defmacro=function(e,n,t,r){var i=new ie(e,n,t,r);i.defmacro=true;return i};ie.prototype.invoke=function(e,n,t){var r=n.env,i=n.dynamic_scope,o=n.error;var a={dynamic_scope:i,error:o,macro_expand:t};var u=this.fn.call(r,e,a,this.name);return t?hn(u):u};ie.prototype.toString=function(){return"#"};var oe="define-macro";function ae(o){return function(){var t=Mn(Cn.mark(function e(t,c){var s,f,r,i;return Cn.wrap(function e(n){while(1){switch(n.prev=n.next){case 0:r=function e(){r=Mn(Cn.mark(function e(t){var r,i,o,a,u;return Cn.wrap(function e(n){while(1){switch(n.prev=n.next){case 0:if(!(t instanceof V&&t.car instanceof U)){n.next=13;break}n.prev=1;r=s.get(t.car);if(!(r instanceof ie&&r.defmacro)){n.next=9;break}n.next=6;return r.invoke(t.cdr,c,true);case 6:i=n.sent;if(!(i instanceof V)){n.next=9;break}return n.abrupt("return",i);case 9:n.next=13;break;case 11:n.prev=11;n.t0=n["catch"](1);case 13:o=t.car;if(!(o instanceof V)){n.next=18;break}n.next=17;return f(o);case 17:o=n.sent;case 18:a=t.cdr;if(!(a instanceof V)){n.next=23;break}n.next=22;return f(a);case 22:a=n.sent;case 23:u=new V(o,a);return n.abrupt("return",u);case 25:case"end":return n.stop()}}},e,null,[[1,11]])}));return r.apply(this,arguments)};f=function e(n){return r.apply(this,arguments)};s=c["env"]=this;i=t;if(!o){n.next=12;break}n.t0=hn;n.next=8;return f(t);case 8:n.t1=n.sent.car;return n.abrupt("return",(0,n.t0)(n.t1));case 12:n.next=15;return f(t);case 15:i=n.sent;if(!(t.toString()===i.toString())){n.next=18;break}return n.abrupt("break",21);case 18:t=i;n.next=12;break;case 21:return n.abrupt("return",hn(i.car));case 22:case"end":return n.stop()}}},e,this)}));return function(e,n){return t.apply(this,arguments)}}()}function ue(e){return typeof e==="undefined"||e===z||e===null}function ce(e){return e instanceof Promise||e&&typeof e!=="undefined"&&typeof e.then==="function"}function se(e){switch(Dn(e)){case"string":return Me(e);case"number":return Ge(e)}return e}function fe(e){return e.valueOf()}function le(e,n){if(e instanceof V){e.markCycles();return hn(e)}if(typeof e==="function"){if(n){return he(e,n)}}return se(e)}function pe(e){if(de(e)){return e[ve]}return e}function he(n,e){if(n[Symbol["for"]("__bound__")]){return n}var t=n.bind(e);var r=Object.getOwnPropertyNames(n).filter(ye);r.forEach(function(e){t[e]=n[e]});ge(t,"__fn__",n);ge(t,"__bound__",true);if(we(n)){ge(t,"__native__",true)}t.valueOf=function(){return n};return t}function de(e){return typeof e==="function"&&e[ve]}var ve=Symbol["for"]("__fn__");var me=["name","length","caller","callee","arguments","prototype"];function ye(e){return!me.includes(e)}function ge(e,n,t){Object.defineProperty(e,Symbol["for"](n),{get:function e(){return t},set:function e(){},configurable:false,enumerable:false})}function be(n,t){try{Object.defineProperty(n,"length",{get:function e(){return t}});return n}catch(e){var r=new Array(t).fill(0).map(function(e,n){return"a"+n}).join(",");var i=new Function("f","return function(".concat(r,") {\n return f.apply(this, arguments);\n };"));return i(n)}}function we(e){var n=Symbol["for"]("__native__");return typeof e==="function"&&e.toString().match(/\{\s*\[native code\]\s*\}/)&&(e.name.match(/^bound /)&&e[n]===true||!e.name.match(/^bound /)&&!e[n])}function _e(e){var h;switch(e){case Symbol["for"]("letrec"):h="letrec";break;case Symbol["for"]("let"):h="let";break;case Symbol["for"]("let*"):h="let*";break;default:throw new Error("Invlild let_macro value")}return ie.defmacro(h,function(o,e){var a=e.dynamic_scope,u=e.error,n=e.macro_expand;var c;if(o.car instanceof U){if(!(o.cdr.car instanceof V)){throw new Error("let require list of pairs")}var t=o.cdr.car.map(function(e){return e.car});c=o.cdr.car.map(function(e){return e.cdr.car});return V.fromArray([U("letrec"),[[o.car,V(U("lambda"),V(t,o.cdr.cdr))]],V(o.car,c)])}else if(n){return}var s=this;c=this.get("list->array")(o.car);var f=s.inherit("let");var l;if(h==="let*"){l=f}var p=0;return function e(){var n=c[p++];function t(e){if(ce(e)){return e.then(t)}else if(typeof e==="undefined"){f.set(n.car,z)}else{f.set(n.car,e)}}if(a){a=h==="let*"?f:s}if(!n){var r=new V(new U("begin"),o.cdr);return jn(r,{env:f,dynamic_scope:a,error:u})}else{if(h==="let"){l=s}else if(h==="letrec"){l=f}var i=jn(n.cdr.car,{env:l,dynamic_scope:a,error:u});if(h==="let*"){l=f=l.inherit("letrect["+p+"]")}return E(t(i),e)}}()})}function xe(e,c){return new ie(e,function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{},t=n.dynamic_scope,r=n.error;var i=this;if(t){t=this}var o=e;var a=[];while(o instanceof V&&!re(o)){a.push(jn(o.car,{env:i,dynamic_scope:t,error:r}));o=o.cdr}var u=a.filter(ce).length;if(u){return Promise.all(a).then(c.bind(this))}else{return c.call(this,a)}})}function ke(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r2?r-2:0),o=2;o1?e-1:0),t=1;t=a){return o.apply(this,r)}else{return i}}return i.apply(this,arguments)}}function Ie(r,i){bn("limit",i,"function",2);return function(){for(var e=arguments.length,n=new Array(e),t=0;t1?r-1:0),o=1;o0){t.push(this._string.substring(0,e))}t.push(n);if(e0&&arguments[0]!==g?arguments[0]:null;if(e===null){return Qe(this.value.valueOf())}return We(e.valueOf())(this.value.valueOf())};var Qe=We(1e-10);function We(r){return function(e){var n=function e(r,n,t){var i=function e(n,t){return t0){i=Ke(r,t)}else if(r.cmp(t)<=0){i=t}else if(t.cmp(0)>0){i=Ke(t,r)}else if(n.cmp(0)<0){i=Ge(Ke(r.sub(),t.sub())).sub()}else{i=Ge(0)}if(Ge.isFloat(n)||Ge.isFloat(e)){return Ve(i)}return i}function Ke(e,n){var t=Ge(e).floor();var r=Ge(n).floor();if(e.cmp(t)<1){return t}else if(t.cmp(r)===0){var i=Ge(1).div(n.sub(r));var o=Ge(1).div(e.sub(t));return t.add(Ge(1).div(Ke(i,o)))}else{return t.add(Ge(1))}}function Ze(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:false;if(typeof this!=="undefined"&&!(this instanceof Ze)||typeof this==="undefined"){return new Ze(e,n)}if(!Ge.isRational(e)){throw new Error("Invalid constructor call for LBigInteger")}if(e.num%e.denom===0&&!n){return Ge(e.num/e.denom)}this.num=Ge(e.num);this.denom=Ge(e.denom);this.type="rational"}Ze.prototype=Object.create(Ge.prototype);Ze.prototype.constructor=Ze;Ze.prototype.pow=function(e){var n=e.cmp(0);if(n===0){return Ge(1)}if(n===-1){e=e.sub();var t=this.denom.pow(e);var r=this.num.pow(e);return Ze({num:t,denom:r})}var i=this;e=e.valueOf();while(e>1){i=i.mul(this);e--}return i};Ze.prototype.abs=function(){var e=this.num;var n=this.denom;if(e.cmp(0)===-1){e=e.sub()}if(n.cmp(0)!==1){n=n.sub()}return Ze({num:e,denom:n})};Ze.prototype.cmp=function(e){return Ge(this.valueOf()).cmp(e)};Ze.prototype.toString=function(){var e=vn.get("gdc")(this.num,this.denom);if(e!==1){e=Ge(e);return this.num.div(e)+"/"+this.denom.div(e)}return this.num+"/"+this.denom};Ze.prototype.valueOf=function(){return Ve(this.num.valueOf()).div(this.denom.valueOf())};Ze.prototype.mul=function(e){if(Ge.isRational(e)){var n=this.num.mul(e.num);var t=this.denom.mul(e.denom);return Ze({num:n,denom:t})}return Ge(this.valueOf()).mul(e)};Ze.prototype.div=function(e){if(Ge.isRational(e)){var n=this.num.mul(e.denom);var t=this.denom.mul(e.num);return Ze({num:n,denom:t})}return Ge(this.valueOf()).div(e)};Ze.prototype.op=function(e,n){return this[tn[e]](n)};Ze.prototype.sub=function(e){if(Ge.isRational(e)){var n=e.num.sub();var t=e.denom;return this.add(Ze({num:n,denom:t}))}if(!(e instanceof Ge)){e=Ge(e).sub()}else{e=e.sub()}if(Ge.isFloat(e)){return Ve(this.valueOf()).add(e)}return this.add(e)};Ze.prototype.add=function(e){if(Ge.isRational(e)){var n=this.denom;var t=e.denom;var r=this.num;var i=e.num;var o,a;if(n!==t){a=t.mul(r).add(i.mul(n));o=n.mul(t)}else{a=r.add(i);o=n}return Ze({num:a,denom:o})}if(Ge.isFloat(e)){return Ve(this.valueOf()).add(e)}return Ge(this.valueOf()).add(e)};function en(e,n){if(typeof this!=="undefined"&&!(this instanceof en)||typeof this==="undefined"){return new en(e,n)}if(e instanceof en){return en(e.value,e._native)}if(!Ge.isBigInteger(e)){throw new Error("Invalid constructor call for LBigInteger")}this.value=e;this._native=n;this.type="bigint"}en.prototype=Object.create(Ge.prototype);en.prototype.constructor=en;en.prototype.op=function(e,n){if(Ge.isBN(this.value)&&Ge.isBN(n.value)){var t={"+":"iadd","-":"isub","*":"imul","/":"idiv","%":"imod","|":"ior","&":"iand","~":"inot","<<":"ishrn",">>":"ishln"};e=t[e];return en(this.value.clone()[e](n),false)}if(n instanceof Ze){return Ze({num:this,denom:1},true)[tn[e]](n)}if(e==="/"){return Ze({num:this,denom:n})}return en(Ge._ops[e](this.value,n&&n.value),true)};en.prototype.sqrt=function(){var e;var n=this.cmp(0)<0;if(Ge.isNative(this.value)){e=Math.sqrt(n?-this.valueOf():this.valueOf())}else if(Ge.isBN(this.value)){e=n?this.value.neg().sqrt():this.value.sqrt()}if(n){return ze({re:0,im:e})}return e};Ge.isFloat=function e(n){return n instanceof Ve||Number(n)===n&&n%1!==0};Ge.isNumber=function(e){return e instanceof Ge||!Number.isNaN(e)&&Ge.isNative(e)||Ge.isBN(e)};Ge.isComplex=function(e){return e instanceof ze||Ge.isNumber(e.im)&&Ge.isNumber(e.re)};Ge.isRational=function(e){return e instanceof Ze||Ge.isNumber(e.num)&&Ge.isNumber(e.denom)};Ge.isNative=function(e){return typeof e==="bigint"||typeof e==="number"};Ge.isBigInteger=function(e){return e instanceof en||typeof e==="bigint"||Ge.isBN(e)};Ge.isBN=function(e){return typeof r!=="undefined"&&e instanceof r};Ge.getArgsType=function(e,n){if(e instanceof Ve||n instanceof Ve){return Ve}if(e instanceof en||n instanceof en){return en}return Ge};Ge.prototype.toString=Ge.prototype.toJSON=function(e){return this.value.toString(e)};Ge.prototype.isBigNumber=function(){return typeof this.value==="bigint"||typeof r!=="undefined"&&!(this.value instanceof r)};["floor","ceil","round"].forEach(function(e){Ge.prototype[e]=function(){if(this["float"]||Ge.isFloat(this.value)){return Ge(Math[e](this.value))}else{return Ge(Math[e](this.valueOf()))}}});Ge.prototype.valueOf=function(){if(Ge.isNative(this.value)){return Number(this.value)}else if(Ge.isBN(this.value)){return this.value.toNumber()}};Ge.prototype.coerce=function(e){if(e===null){e=0}var n;if(e instanceof Ge){n=e.value}else{n=e}if(this instanceof Ve){return Ve(e.valueOf())}if(this instanceof ze){return ze({re:n,im:0})}if(this instanceof Ze&&!Ge.isRational(e)){return Ge(n)}if(Ge.isComplex(e)){return ze(e)}else if(Ge.isRational(e)){return Ze(e)}else if(Ge.isFloat(n)||this instanceof Ve){return Ve(n)}else if(typeof this.value==="bigint"&&typeof n!=="bigint"){return en(BigInt(n))}else if(typeof r!=="undefined"&&this.value instanceof r&&!n instanceof r){return en(new r(n))}return Ge(n)};Ge.getType=function(e){if(e instanceof Ge){return e.type}if(Ge.isFloat(e)){return"float"}if(Ge.isComplex(e)){return"complex"}if(Ge.isRational(e)){return"rational"}if(typeof e==="number"){return"integer"}if(typeof BigInt!=="undefined"&&typeof e!=="bigint"||typeof r!=="undefined"&&!(e instanceof r)){return"bigint"}};Ge.prototype.isFloat=function(){return!!(Ge.isFloat(this.value)||this["float"])};Ge.prototype.add=function(e){return Ge(this.valueOf()+e.valueOf())};Ge.prototype.sub=function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:null;if(e===null){return Ge(-this.valueOf())}return Ge(this.valueOf()-e.valueOf())};Ge.prototype.mul=function(e){if(e instanceof ze){return ze(this).mul(e)}return Ge(this.valueOf()*e.valueOf())};Ge.prototype.div=function(e){if(e instanceof ze){return ze(this).mul(e)}return Ge(this.valueOf()/e.valueOf())};Ge.prototype.rem=function(e){return Ge(this.valueOf()%e.valueOf())};Ge.prototype.mod=function(e){return Ge(this.valueOf()%e.valueOf())};Ge.prototype.or=function(e){return Ge(this.ValueOf()|e.valueOf())};Ge.prototype.and=function(e){return Ge(this.valueOf()&e.valueOf())};Ge.prototype.neg=function(){return Ge(~this.valueOf())};Ge.prototype.shl=function(e){return Ge(this.valueOf()>>e.valueOf())};Ge.prototype.shr=function(e){return this.op(e)};var nn={add:"+",sub:"-",mul:"*",div:"/",rem:"%",or:"|",and:"&",neg:"~",shl:">>",shr:"<<"};var tn={};Object.keys(nn).forEach(function(n){tn[nn[n]]=n;Ge.prototype[n]=function(e){return this.op(nn[n],e)}});Ge._ops={"*":function e(n,t){return n*t},"+":function e(n,t){return n+t},"-":function e(n,t){if(typeof t==="undefined"){return-n}return n-t},"/":function e(n,t){return n/t},"%":function e(n,t){return n%t},"|":function e(n,t){return n|t},"&":function e(n,t){return n&t},"~":function e(n){return~n},">>":function e(n,t){return n>>t},"<<":function e(n,t){return n<"};function an(n){var t=this;if(typeof this!=="undefined"&&!(this instanceof an)||typeof this==="undefined"){return new an(n)}bn("OutputStringPort",n,"function");this._buffer=[];this.write=function(e){if(!Me.isString(e)){e=n(e)}else{e=e.valueOf()}t._buffer.push(e)}}an.prototype=Object.create(on.prototype);an.prototype.getString=function(){return this._buffer.map(function(e){return e.valueOf()}).join("")};an.prototype.constructor=an;function un(e){var n=this;if(typeof this!=="undefined"&&!(this instanceof un)||typeof this==="undefined"){return new un(e)}bn("InputStringPort",e,"string");this._tokens=j(e);this._index=0;this._in_char=0;this.read=function(){return n.getNextTokens()}}un.prototype=Object.create(rn.prototype);un.prototype.constructor=un;un.prototype.getNextTokens=function(){if(this.peekChar()===cn){return cn}var e=0;var n=[];var t=["(",")"];if(!t.includes(this._tokens[this._index])){return this._tokens[this._index++]}do{var r=this._tokens[this._index];n.push(this._tokens[this._index]);if(r===")"){e--}else if(r==="("){e++}this._index++}while(e!==0);return n};un.prototype.peekChar=function(){if(this._index>this._tokens.length-1){return cn}if(this._index===this._tokens.length-1&&this.in_char>this._tokens[this._index].length){return cn}return this._tokens[this._index][this.in_char]};var cn=new sn;function sn(){}sn.prototype.toString=function(){return"<#eof>"};function fn(e){this.message=e}fn.prototype=Object.create(Error.prototype);function ln(e,n,t){if(arguments.length===1){if(Dn(arguments[0])==="object"){e=arguments[0];this.parent=null}else if(typeof arguments[0]==="string"){e={};n={};t=arguments[0]}}this.env=e;this.parent=n;this.name=t||"anonymous"}ln.prototype.inherit=function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{};if(Dn(e)==="object"){n=e}if(!e||Dn(e)==="object"){e="child of "+(this.name||"unknown")}return new ln(n||{},this,e)};ln.prototype.newFrame=function(e,n){var t=this.inherit("__frame__");t.set("parent.frame",function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:1;if(e===0){return t}if(!(t.parent instanceof ln)){return z}var n=t.parent.get("parent.frame",{throwError:false});if(typeof n==="function"){return n(e-1)}return z});n.callee=e;t.set("arguments",n);return t};ln.prototype._lookup=function(e){if(e instanceof U){e=e.name}if(e instanceof Me){e=e.valueOf()}if(e in this.env){return pn(this.env[e])}if(this.parent){return this.parent._lookup(e)}};ln.prototype.toString=function(){return"<#env:"+this.name+">"};function pn(e){if(typeof this!=="undefined"&&!(this instanceof pn)||typeof this==="undefined"){return new pn(e)}this.value=e}pn.isUndefined=function(e){return e instanceof pn&&typeof e.value==="undefined"};pn.prototype.valueOf=function(){return this.value};ln.prototype.get=function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{};var t=n.throwError,r=t===void 0?true:t;var i=e;if(i instanceof U||i instanceof Me){i=i.valueOf()}var o=this._lookup(i);if(o instanceof pn){if(pn.isUndefined(o)){return g}return le(o.valueOf())}var a=i.split(".").filter(Boolean);if(a.length>0){var u=Rn(a),c=u[0],s=u.slice(1);o=this._lookup(c);if(s.length){if(o instanceof pn){o=o.valueOf();return Pe.apply(void 0,[o].concat(Bn(s)))}else{return Pe.apply(void 0,[f].concat(Bn(a)))}}else if(o instanceof pn){return le(o.valueOf())}}o=Pe(f,i);if(typeof o!=="undefined"){return o}if(r){throw new Error("Unbound variable `"+i+"'")}};ln.prototype.set=function(e,n){if(Ge.isNumber(n)){n=Ge(n)}if(e instanceof U){e=e.name}else if(e instanceof Me){e=e.valueOf()}this.env[e]=n};ln.prototype.has=function(e){return typeof this.env[e]!=="undefined"};ln.prototype.ref=function(e){var n=this;while(true){if(!n){break}if(n.has(e)){return n}n=n.parent}};ln.prototype.parents=function(){var e=this;var n=[];while(e){n.unshift(e);e=e.parent}return n};function hn(e){if(ce(e)){return e.then(hn)}if(e instanceof V||e instanceof U){e.data=true}return e}var dn=function(){var n=0;return function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:null;if(e!==null){return new U(Symbol("#:".concat(e)))}n++;return new U(Symbol("#:g".concat(n)))}}();var vn=new ln({nil:z,undefined:g,true:true,false:false,NaN:NaN,stdout:new on(function(){var e;(e=console).log.apply(e,arguments)}),stdin:rn(function(){return new Promise(function(e){e(prompt(""))})}),"current-input-port":N(function(){return this.get("stdin")},"(current-input-port)\n\n Function return default stdin port."),"current-output-port":N(function(){return this.get("stdout")},"(current-output-port)\n\n Function return default stdout port."),"open-input-string":N(function(e){bn("open-input-string",e,"string");return un(e)},"(open-input-string string)\n\n Function create new string port as input that can be used to\n read S-exressions from this port using `read` function."),"output-port?":N(function(e){return e instanceof on},"(output-port? arg)\n\n Function return true if argument is output port."),"input-port?":N(function(e){return e instanceof rn},"(input-port? arg)\n\n Function return true if argument is input port."),"open-output-string":N(function(){return an(this.get("repr"))},"(open-output-string)\n\n Function create new output port that can used to write string into\n and after finish get the whole string using `get-output-string`"),"get-output-string":N(function(e){bn("get-output-string",e,"output-string-port");return e.getString()},"(get-output-string port)\n\n Function get full string from string port. If nothing was wrote\n to given port it will return empty string."),"eof-object?":N(function(e){return e===cn},"(eof-object? arg)\n\n Function check if value is eof object, returned from input string\n port when there are no more data to read."),"peek-char":N(function(e){bn("peek-char",e,["input-port","input-string-port"]);return e.peekChar()},"(peek-char port)\n\n Function get character from string port or EOF object if no more\n data in string port."),read:N(function n(e){var t=this;if(typeof e==="string"){return F(j(e))[0]}if(e instanceof un){var r=e.read();if(r===cn){return cn}return F(r)[0]}var i;if(e instanceof rn){i=e}else{i=this.get("stdin")}return i.read().then(function(e){return n.call(t,e)})},"(read [string])\n\n Function if used with string will parse the string and return\n list structure of LIPS code. If called without an argument it\n will read string from standard input (using browser prompt or\n user defined way) and call itself with that string (parse is)\n function can be used together with eval to evaluate code from\n string"),pprint:N(function(e){if(e instanceof V){e=new Ln.Formatter(e.toString())["break"]().format();this.get("stdout").write.call(this,e)}else{this.get("display").call(this,e)}},"(pprint expression)\n\n Pretty print list expression, if called with non-pair it just call\n print function with passed argument."),print:N(function(){var e,n=this;for(var t=arguments.length,r=new Array(t),i=0;i1&&arguments[1]!==g?arguments[1]:null;if(n===null){n=this.get("stdout")}n.write.call(this,this.get("repr")(e))},"(display arg [port])\n\n Function send string to standard output or provied port."),error:N(function(){for(var e=arguments.length,n=new Array(e),t=0;t1&&arguments[1]!==g?arguments[1]:{},t=e.dynamic_scope,r=e.error;if(t){t=this}var i=jn(n.cdr.car,{env:this,dynamic_scope:t,error:r});i=xn(i);var o;function a(n,t){if(ce(n)){return n.then(function(e){return a(e,t)})}if(ce(t)){return t.then(function(e){return a(n,e)})}s[n]=t;return t}if(n.car instanceof V&&U.is(n.car.car,".")){var u=n.car.cdr.car;var c=n.car.cdr.cdr.car;var s=jn(u,{env:this,dynamic_scope:t,error:r});var f=jn(c,{env:this,dynamic_scope:t,error:r});return a(f,i)}if(!(n.car instanceof U)){throw new Error("set! first argument need to be a symbol or "+"dot accessor that evaluate to object.")}o=this.ref(n.car.name);if(!o){o=this}return E(i,function(e){o.set(n.car,e)})}),"(set! name value)\n\n Macro that can be used to set the value of the variable (mutate)\n it search the scope chain until it finds first non emtpy slot and set it."),"set-car!":N(function(e,n){bn("set-car!",e,"pair");e.car=n},"(set-car! obj value)\n\n Function that set car (head) of the list/pair to specified value.\n It can destroy the list. Old value is lost."),"set-cdr!":N(function(e,n){bn("set-cdr!",e,"pair");e.cdr=n},"(set-cdr! obj value)\n\n Function that set cdr (tail) of the list/pair to specified value.\n It can destroy the list. Old value is lost."),"empty?":N(function(e){return typeof e==="undefined"||re(e)},"(empty? object)\n\n Function return true if value is undfined empty list."),assoc:N(function(e,n){if(e instanceof V&&!(n instanceof V)){throw new Error("First argument to assoc ned to be a key")}bn("assoc",n,"pair");var t=n;while(true){if(!(t instanceof V)||this.get("empty?")(t)){break}var r=t.car.car;if(ne(r,e)){return t.car}else if(!t.haveCycles("cdr")){t=t.cdr}}return z},"(assoc key alist)\n\n Function search Alist (list of pairs) until it find the one that\n have head set equal to key, and return found pair."),gensym:N(dn,"(gensym)\n\n Function generate unique symbol, to use with macros as meta name."),load:N(function(e){bn("load",e,"string");var i=this;if(i.name==="__frame__"){i=i.parent}if(typeof this.get("global",{throwError:false})!=="undefined"){return new Promise(function(t,r){require("fs").readFile(e.valueOf(),function(e,n){if(e){r(e)}else{Sn(n.toString(),i).then(function(){t()})}})})}return f.fetch(e).then(function(e){return e.text()}).then(function(e){return Sn(e,i)}).then(function(){})},"(load filename)\n\n Function fetch the file and evaluate its content as LIPS code."),while:N(new ie("while",function(r,e){var i=e.dynamic_scope,o=e.error;var a=this;var u=new V(new U("begin"),r.cdr);var c;if(i){i=a}return function n(){var e=jn(r.car,{env:a,dynamic_scope:i,error:o});function t(e){if(e&&!ue(e)&&!re(e)){c=jn(u,{env:a,dynamic_scope:i,error:o});if(ce(c)){return c.then(function(e){c=e;return n()})}else{return n()}}else{return c}}return E(e,t)}()}),"(while cond . body)\n\n Macro that create a loop, it exectue body untill cond expression is false"),if:N(new ie("if",function(t,e){var r=e.dynamic_scope,i=e.error;if(r){r=this}var o=this;var n=function e(n){if(n){return jn(t.cdr.car,{env:o,dynamic_scope:r,error:i})}else{return jn(t.cdr.cdr.car,{env:o,dynamic_scope:r,error:i})}};var a=jn(t.car,{env:o,dynamic_scope:r,error:i});return E(a,n)}),"(if cond true-expr false-expr)\n\n Macro evaluate condition expression and if the value is true, it\n evaluate and return true expression if not it evaluate and return\n false expression"),letrec:N(_e(Symbol["for"]("letrec")),"(letrec ((a value-a) (b value-b)) body)\n\n Macro that creates new environment, then evaluate and assign values to\n names and then evaluate the body in context of that environment.\n Values are evaluated sequentialy and next value can access to\n previous values/names."),"let*":N(_e(Symbol["for"]("let*")),"(let* ((a value-a) (b value-b)) body)\n\n Macro similar to `let` but next argument get environment\n from previous let variable, so they you can define one variable,\n and use in next argument."),let:N(_e(Symbol["for"]("let")),"(let ((a value-a) (b value-b)) body)\n\n Macro that creates new environment, then evaluate and assign values to\n names and then evaluate the body in context of that environment.\n Values are evaluated sequentialy but you can't access\n previous values/names when next are evaluated. You can only get them\n from body of let expression."),"begin*":N(xe("begin*",function(e){return e.pop()}),"(begin* . expr)\n\n This macro is parallel version of begin. It evaluate each expression and\n if it's a promise it will evaluate it in parallel and return value\n of last expression."),begin:N(new ie("begin",function(e,n){var r=Object.assign({},n);var i=this.get("list->array")(e);if(r.dynamic_scope){r.dynamic_scope=this}r.env=this;var o;return function n(){if(i.length){var e=i.shift();var t=jn(e,r);return E(t,function(e){o=e;return n()})}else{return o}}()}),"(begin . args)\n\n Macro runs list of expression and return valuate of the list one.\n It can be used in place where you can only have single exression,\n like if expression."),ignore:new ie("ignore",function(e,n){var t=n.dynamic_scope,r=n.error;var i={env:this,error:r};if(t){i.dynamic_scope=this}jn(new V(new U("begin"),e),i)},"(ignore expression)\n\n Macro that will evaluate expression and swallow any promises that may\n be created. It wil run and ignore any value that may be returned by\n expression. The code should have side effects and/or when it's promise\n it should resolve to undefined."),define:N(ie.defmacro("define",function(n,e){var t=this;if(n.car instanceof V&&n.car.car instanceof U){var r=new V(new U("define"),new V(n.car.car,new V(new V(new U("lambda"),new V(n.car.cdr,n.cdr)))));return r}else if(e.macro_expand){return}if(e.dynamic_scope){e.dynamic_scope=this}e.env=t;var i=n.cdr.car;if(i instanceof V){i=jn(i,e)}else if(i instanceof U){i=t.get(i)}if(n.car instanceof U){E(i,function(e){t.set(n.car,e)})}}),"(define name expression)\n (define (function-name . args) body)\n\n Macro for defining values. It can be used to define variables,\n or function. If first argument is list it will create function\n with name beeing first element of the list. The macro evalute\n code `(define function (lambda args body))`"),"set-obj!":N(function(e,n,t){var r=Dn(e);if(ue(e)||r!=="object"&&r!=="function"){var i=gn("set-obj!",_n(e),["object","function"]);throw new Error(i)}pe(e)[n]=t.valueOf()},"(set-obj! obj key value)\n\n Function set property of JavaScript object"),"current-environment":N(function(){if(this.name==="__frame__"){return this.parent}return this},"(current-environment)\n\n Function return current environement."),eval:N(function(e,t){var r=this;bn("eval",e,["symbol","pair","array"]);t=t||this;if(e instanceof U){return t.get(e)}if(e instanceof V){return jn(e,{env:t,error:function e(n){r.get("error")(n.message);if(n.code){var t=n.code.map(function(e,n){return"[".concat(n+1,"]: ").concat(e)}).join("\n");r.get("error")(t)}}})}if(e instanceof Array){var i=this.get("eval");return e.reduce(function(e,n){return i(n,t)})}},"(eval list)\n\n Function evalute LIPS code as list structure."),lambda:new ie("lambda",function(f){var e=arguments.length>1&&arguments[1]!==g?arguments[1]:{},l=e.dynamic_scope,p=e.error;var h=this;var d;if(f.cdr instanceof V&&Me.isString(f.cdr.car)){d=f.cdr.car.valueOf()}function v(){var e;if(l){if(!(this instanceof ln)){e=h}else{e=this}}else{e=h}e=e.inherit("lambda");var n=f.car;var t=0;var r;if(typeof this!=="undefined"){e.set("this",this)}for(var i=arguments.length,o=new Array(i),a=0;a2&&arguments[2]!==g?arguments[2]:u;if(e instanceof V&&!re(e)){var r=e.car;var i=e.cdr;if(t(r)){r=n(r)}if(t(i)){i=n(i)}if(ce(r)||ce(i)){return Promise.all([r,i]).then(function(e){var n=Tn(e,2),t=n[0],r=n[1];return new V(t,r)})}else{return new V(r,i)}}return e}function s(e,n){if(e instanceof V){if(re(e)&&n===z){return z}e.append(n)}else{e=new V(e,n)}return e}function f(r,e,n){if(er){throw new Error("You can't call `unquote` outside "+"of quasiquote")}if(t.cdr instanceof V){if(t.cdr.cdr!==z){if(t.cdr.car instanceof V){return E(p(t.cdr.cdr,n,r),function(e){var n=jn(t.cdr.car,{env:a,dynamic_scope:i,error:o});return new V(n,e)})}else{return t.cdr}}else{return jn(t.cdr.car,{env:a,dynamic_scope:i,error:o})}}else{return t.cdr}}return c(t,function(e){return p(e,n,r)})}return t}function t(e){if(e instanceof V){delete e.data;if(!e.haveCycles("car")){t(e.car)}if(!e.haveCycles("cdr")){t(e.cdr)}}}var r=p(e.car,0,1);return E(r,function(e){t(e);return hn(e)})},"(quasiquote list ,value ,@value)\n\n Similar macro to `quote` but inside it you can use special\n expressions unquote abbreviated to , that will evaluate expresion inside\n and return its value or unquote-splicing abbreviated to ,@ that will\n evaluate expression but return value without parenthesis (it will join)\n the list with its value. Best used with macros but it can be used outside"),clone:N(function(e){bn("clone",e,"pair");return e.clone()},"(clone list)\n\n Function return clone of the list."),append:N(function(e,n){bn("append",e,"pair");return this.get("append!")(e.clone(),n)},"(append list item)\n\n Function will create new list with value appended to the end. It return\n New list."),"append!":N(function(e,n){bn("append!",e,"pair");if(ue(n)||re(n)){return e}return e.append(n)},"(append! name expression)\n\n Destructive version of append, it modify the list in place. It return\n original list."),reverse:N(function(e){bn("reverse",e,["array","pair"]);if(e instanceof V){var n=this.get("list->array")(e).reverse();return this.get("array->list")(n)}else if(!(e instanceof Array)){throw new Error(gn("reverse",_n(e),"array or pair"))}else{return e.reverse()}},"(reverse list)\n\n Function will reverse the list or array. If value is not a list\n or array it will throw exception."),nth:N(function(e,n){bn("nth",e,"number");bn("nth",n,["array","pair"]);if(n instanceof V){var t=n;var r=0;while(rarray")(n).join(e)},"(join separator list)\n\n Function return string by joining elements of the list"),split:N(function(e,n){bn("split",e,["regex","string"]);bn("split",n,"string");return this.get("array->list")(n.split(e))},"(split separator string)\n\n Function create list by splitting string by separatar that can\n be a string or regular expression."),replace:N(function(e,n,t){bn("replace",e,["regex","string"]);bn("replace",n,["string","function"]);bn("replace",t,"string");return t.replace(e,n)},"(replace pattern replacement string)\n\n Function change pattern to replacement inside string. Pattern can be string\n or regex and replacement can be function or string."),match:N(function(e,n){bn("match",e,["regex","string"]);bn("match",n,"string");var t=n.match(e);return t?this.get("array->list")(t):z},"(match pattern string)\n\n function return match object from JavaScript as list."),search:N(function(e,n){bn("search",e,["regex","string"]);bn("search",n,"string");return n.search(e)},"(search pattern string)\n\n Function return first found index of the pattern inside a string"),repr:N(function n(e,t){if(typeof jQuery!=="undefined"&&e instanceof jQuery.fn.init){return"<#jQuery("+e.length+")>"}if(e===true){return"#t"}if(e===false){return"#f"}if(e instanceof Ge){return e.toString()}if(typeof e==="undefined"){return"<#undefined>"}var r=[RegExp,G,U,V,Ce];for(var i=0,o=r;i"}return"<#function>"}if(e instanceof Array){return"#("+e.map(function(e){return n(e,true)}).join(" ")+")"}if(e instanceof Me){e=e.toString()}if(e===null||typeof e==="string"&&t){return JSON.stringify(e).replace(/\\n/g,"\n")}if(f.HTMLElement&&e instanceof f.HTMLElement){return"<#HTMLElement(".concat(e.tagName.toLowerCase(),")>")}if(Dn(e)==="object"){var u=e.constructor;var c;if(typeof u.__className==="string"){c=u.__className}else if(_n(e)==="instance"){c="instance"}else{c=u.name}if(c!==""){return"<#"+c+">"}return"<#Object>"}if(typeof e!=="string"){return e.toString()}return e},"(repr obj)\n\n Function return string LIPS representation of an object as string."),env:N(function(e){e=e||this;var n=Object.keys(e.env);var t;if(n.length){t=V.fromArray(n)}else{t=z}if(e.parent!==g){return this.get("env").call(this,e.parent).append(t)}return t},"(env obj)\n\n Function return list values (functions and variables) inside environment."),new:N(function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;rlist":N(function(e){bn("array->list",e,"array");return V.fromArray(e)},"(array->list array)\n\n Function convert JavaScript array to LIPS list."),"tree->array":N(W("tree->array",true),"(tree->array list)\n\n Function convert LIPS list structure into JavaScript array."),"list->array":N(W("list->array"),"(list->array list)\n\n Function convert LIPS list into JavaScript array."),apply:N(function(e,n){bn("apply",e,"function",1);bn("apply",n,"pair",2);return e.apply(void 0,Bn(this.get("list->array")(n)))},"(apply fn list)\n\n Function that call function with list of arguments."),length:N(function(e){if(!e){return Ge(0)}if(e instanceof V){return Ge(e.length())}if("length"in e){return Ge(e.length)}},"(length expression)\n\n Function return length of the object, the object can be list\n or any object that have length property."),"string->number":N(function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:10;bn("string->number",e,"string",1);bn("string->number",n,"number",2);if(e.match(i)){return Ge(parseInt(e,n))}else if(e.match(o)){return Ge(parseFloat(e))}return Ge(parseInt(e,n))},"(string->number number [radix])\n\n Function convert string to number."),try:N(new ie("try",function(o,e){var a=this;var u=e.dynamic_scope,c=e.error;return new Promise(function(i){var e={env:a,error:function e(n){if(n instanceof fn){throw new fn(n.message)}var t=a.inherit("try");t.set(o.cdr.car.cdr.car.car,n);var r={env:t,error:c};if(u){r.dynamic_scope=a}E(jn(new V(new U("begin"),o.cdr.car.cdr.cdr),r),function(e){i(e)});throw new fn(n.message)}};if(u){e.dynamic_scope=a}var n=jn(o.car,e);if(ce(n)){n["catch"](e.error).then(i)}else{i(n)}})}),"(try expr (catch (e) code)"),throw:N(function(e){throw new Error(e)},"(throw string)\n\n Throw new expection."),find:N(function n(t,r){bn("find",t,["regex","function"]);bn("find",r,"pair");if(ue(r)){return z}var e=A("find",t);return E(e(r.car),function(e){if(e&&e!==z){return r.car}return n(t,r.cdr)})},"(find fn list)\n (find regex list)\n\n Higher order Function find first value for which function return true.\n If called with regex it will create matcher function."),"for-each":N(function(e){var n;bn("for-each",e,"function");for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?n-1:0),o=1;o3?r-3:0),o=3;o3?i-3:0),a=3;aarray")(n);var o=[];var a=A("filter",e);return function n(t){function e(e){if(e&&e!==z){o.push(r)}return n(++t)}if(t===i.length){return V.fromArray(o)}var r=i[t];return E(a(r,t),e)}(0)},"(filter fn list)\n (filter regex list)\n\n Higher order function that call `fn` for each element of the list\n and return list for only those elements for which funtion return\n true value. If called with regex it will create matcher function."),range:N(function(e){bn("range",e,"number");if(e instanceof Ge){e=e.valueOf()}return V.fromArray(new Array(e).fill(0).map(function(e,n){return Ge(n)}))},"(range n)\n\n Function return list of n numbers from 0 to n - 1"),compose:N(je,"(compose . fns)\n\n Higher order function and create new function that apply all functions\n From right to left and return it's value. Reverse of compose.\n e.g.:\n ((compose (curry + 2) (curry * 3)) 3)\n 11\n "),pipe:N(Oe,"(pipe . fns)\n\n Higher order function and create new function that apply all functions\n From left to right and return it's value. Reverse of compose.\n e.g.:\n ((pipe (curry + 2) (curry * 3)) 3)\n 15"),curry:N(qe,"(curry fn . args)\n\n Higher order function that create curried version of the function.\n The result function will have parially applied arguments and it\n will keep returning functions until all arguments are added\n\n e.g.:\n (define (add a b c d) (+ a b c d))\n (define add1 (curry add 1))\n (define add12 (add 2))\n (display (add12 3 4))"),gdc:N(function e(){for(var n=arguments.length,t=new Array(n),r=0;ro?u%=o:o%=u}u+=o}return Ge(u)},"(gdc n1 n2 ...)\n\n Function return the greatest common divisor of their arguments."),lcm:N(function(){var e=arguments.length,n=Z(arguments.length<=0?g:arguments[0]);for(var t=1;tr?n%=r:r%=n}n=Z(i*(t<0||arguments.length<=t?g:arguments[t]))/(n+r)}return Ge(n)},"(lcm n1 n2 ...)\n\n Function return the least common multiple of their arguments."),odd:N(Ee(function(e){return Ge(e).isOdd()}),"(odd number)\n Function check if number os odd."),even:N(Ee(function(e){return Ge(e).isEvent()}),"(even number)\n\n Function check if number is even."),"*":N(Ne(function(e,n){return Ge(e).mul(n)}),"(* . numbers)\n\n Multiplicate all numbers passed as arguments. If single value is passed\n it will return that value."),"+":N(Ne(function(e,n){return Ge(e).add(n)}),"(+ . numbers)\n\n Sum all numbers passed as arguments. If single value is passed it will\n return that value."),"-":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t x1 x2 x3 ...)\n\n Function compare its numerical arguments and check if they are\n monotonically increasing"),"<":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t=":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t= x1 x2 x3 ...)\n\n Function compare its numerical arguments and check if they are\n monotonically nondecreasing"),"eq?":N(ne,"(eq? a b)\n\n Function compare two values if they are identical."),or:N(new ie("or",function(e,n){var i=n.dynamic_scope,o=n.error;var a=this.get("list->array")(e);var u=this;if(i){i=u}var c;return function n(){function e(e){c=e;if(c){return c}else{return n()}}var t=a.shift();if(typeof t==="undefined"){if(c){return c}else{return false}}else{var r=jn(t,{env:u,dynamic_scope:i,error:o});return E(r,e)}}()}),"(or . expressions)\n\n Macro execute the values one by one and return the one that is truthy value.\n If there are no expression that evaluate to true it return false."),and:N(new ie("and",function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{},i=n.dynamic_scope,o=n.error;var a=this.get("list->array")(e);var u=this;if(i){i=u}if(!a.length){return true}var c;return function n(){function e(e){c=e;if(!c){return false}else{return n()}}var t=a.shift();if(typeof t==="undefined"){if(c){return c}else{return false}}else{var r=jn(t,{env:u,dynamic_scope:i,error:o});return E(r,e)}}()}),"(and . expressions)\n\n Macro evalute each expression in sequence if any value return false it will\n return false. If each value return true it will return the last value.\n If it's called without arguments it will return true."),"|":N(function(e,n){return Ge(e).or(n)},"(& a b)\n\n Function calculate or bit operation."),"&":N(function(e,n){return Ge(e).and(n)},"(& a b)\n\n Function calculate and bit operation."),"~":N(function(e){return Ge(e).neg()},"(~ number)\n\n Function negate the value."),">>":N(function(e,n){return Ge(e).shr(n)},"(>> a b)\n\n Function right shit the value a by value b."),"<<":N(function(e,n){return Ge(e).shl(n)},"(<< a b)\n\n Function left shit the value a by value b."),not:N(function(e){if(re(e)){return true}return!e},"(not object)\n\n Function return negation of the argument."),"->":N(function(e,n){for(var t=arguments.length,r=new Array(t>2?t-2:0),i=2;i obj name . args)\n\n Function get function from object and call it with arguments.")},g,"global");(function(){var e={ceil:"ceiling"};["floor","round","ceil"].forEach(function(n){var t=e[n]?e[n]:n;vn.set(t,N(function(e){bn(t,e,"number");if(e instanceof Ge){return e[n]()}},"(".concat(t," number)\n\n Function calculate ").concat(t," of a number.")))})})();function mn(e){if(e.length===1){return e[0]}else{var n=[];var t=mn(e.slice(1));for(var r=0;r3&&arguments[3]!==g?arguments[3]:null;var i=e?" in function `".concat(e,"`"):"";if(r!==null){i+=" argument ".concat(r)}if(t instanceof Array){var o=t[t.length-1];t=t.slice(0,-1).join(", ")+" or "+o}return"Expecting ".concat(t," got ").concat(n).concat(i)}function bn(e,n,t){var r=arguments.length>3&&arguments[3]!==g?arguments[3]:null;var i=_n(n).toLowerCase();var o=false;if(t instanceof Array){t=t.map(function(e){return e.valueOf().toLowerCase()});if(t.includes(i)){o=true}}else{t=t.valueOf().toLowerCase()}if(!o&&i!==t){throw new Error(gn(e,i,t,r))}}function wn(e){var n=Dn(e);return["string","function"].includes(n)||e instanceof U||e instanceof Ge||e instanceof RegExp}function _n(e){var n={pair:V,symbol:U,macro:ie,string:Me,array:Array,"native-symbol":Symbol};if(e===z){return"nil"}if(e===null){return"null"}for(var t=0,r=Object.entries(n);t1&&arguments[1]!==g?arguments[1]:{},i=e.env,o=e.dynamic_scope,t=e.error,a=t===void 0?function(){}:t;try{if(o===true){i=o=i||vn}else if(i===true){i=o=vn}else{i=i||vn}var r={env:i,dynamic_scope:o,error:a};var u;if(ue(n)){return n}if(re(n)){return Q()}if(n instanceof U){return i.get(n)}var c=n.car;var s=n.cdr;if(c instanceof V){u=xn(jn(c,r));if(ce(u)){return u.then(function(e){return jn(new V(e,n.cdr),r)})}else if(typeof u!=="function"){throw new Error(_n(u)+" "+i.get("repr")(u)+" is not a function while evaluating "+n.toString())}}if(c instanceof U){u=i.get(c);if(u instanceof ie){var f=On(u,s,r);return E(f,function(e){if(e instanceof V){e.markCycles();return e}return e})}else if(typeof u!=="function"){if(u){var l="".concat(_n(u)," `").concat(u,"' is not a function");throw new Error(l)}throw new Error("Unknown function `".concat(c.name,"'"))}}else if(typeof c==="function"){u=c}if(typeof u==="function"){var p=kn(s,r);return E(p,function(e){if(de(u)){e=e.map(fe)}if(u.__lambda__){u=pe(u)}var n=e.slice();var t=(o||i).newFrame(u,n);var r=xn(u.apply(t,e));return E(r,function(e){if(e instanceof V){e.markCycles();return hn(e)}if(typeof e==="number"){return Ge(e)}if(typeof e==="string"){return Me(e)}return e},a)})}else if(n instanceof U){u=i.get(n);if(u==="undefined"){throw new Error("Unbound variable `"+n.name+"'")}return u}else if(n instanceof V){u=c&&c.toString();throw new Error("".concat(_n(c)," ").concat(u," is not a function"))}else{return n}}catch(e){a&&a(e,n)}}function Sn(e,n,t){return Fn.apply(this,arguments)}function Fn(){Fn=Mn(Cn.mark(function e(t,r,i){var o,a,u,c;return Cn.wrap(function e(n){while(1){switch(n.prev=n.next){case 0:if(i===true){r=i=r||vn}else if(r===true){r=i=vn}else{r=r||vn}o=F(t);a=[];case 3:u=o.shift();if(u){n.next=9;break}return n.abrupt("return",a);case 9:n.next=11;return jn(u,{env:r,dynamic_scope:i,error:function e(n,t){if(t){if(!(n.code instanceof Array)){n.code=[]}n.code.push(t.toString())}throw n}});case 11:c=n.sent;a.push(c);case 13:n.next=3;break;case 15:case"end":return n.stop()}}},e)}));return Fn.apply(this,arguments)}function En(n){return function(e){if(!e){return false}return(typeof e==="string"?e:e.token).match(n)}}var An=En(/[()]/);function Nn(e){var n=typeof e==="string"?j(e):e;var t=n.filter(An);var r=t.filter(function(e){return(e.token||e)===")"});var i=t.filter(function(e){return(e.token||e)==="("});return r.length===i.length}V.unDry=function(e){return new V(e.car,e.cdr)};V.prototype.toDry=function(){return{value:{car:this.car,cdr:this.cdr}}};G.prototype.toDry=function(){return{value:null}};G.unDry=function(){return z};U.prototype.toDry=function(){return{value:{name:this.name}}};U.unDry=function(e){return new U(e.name)};function qn(e){console.error(e.message||e);if(e.code){console.error(e.code.map(function(e,n){return"[".concat(n+1,"]: ").concat(e)}))}}function In(){var i=["text/x-lips","text/x-scheme"];if(window.document){var o=Array.from(document.querySelectorAll("script"));return function n(){var e=o.shift();if(e){var t=e.getAttribute("type");if(i.includes(t)){var r=e.getAttribute("src");if(r){return f.fetch(r).then(function(e){return e.text()}).then(Sn).then(n)["catch"](function(e){qn(e);n()})}else{return Sn(e.innerHTML).then(n)["catch"](function(e){qn(e);n()})}}else if(t&&t.match(/lips|lisp/)){console.warn("Expecting "+i.join(" or ")+" found "+t)}return n()}}()}}if(typeof window!=="undefined"){e(window,In)}M.__className="ahead";R.__className="pattern";C.__className="formatter";ie.__className="macro";ln.__className="environment";rn.__className="input-port";on.__className="output-port";an.__className="output-string-port";un.__className="input-string-port";var Ln={version:"DEV",banner:n,date:"Wed, 01 Apr 2020 23:12:19 +0000",exec:Sn,parse:F,tokenize:j,evaluate:jn,Environment:ln,global_environment:vn,globalEnvironment:vn,env:vn,balanced_parenthesis:Nn,balancedParenthesis:Nn,Macro:ie,quote:hn,Pair:V,InputPort:rn,OutputPort:on,InputStringPort:un,OutputStringPort:an,Formatter:C,specials:S,nil:z,resolvePromises:xn,LSymbol:U,LNumber:Ge,LFloat:Ve,LComplex:ze,LRational:Ze,LBigInteger:en,Character:Ce,LString:Me,rationalize:Xe};vn.set("lips",Ln);return Ln})})(); \ No newline at end of file +(function(){"use strict";function e(e,n){return n={exports:{}},e(n,n.exports),n.exports}var u=e(function(t){function r(e,n){t.exports=r=Object.setPrototypeOf||function e(n,t){n.__proto__=t;return n};return r(e,n)}t.exports=r});var Pn=e(function(r){function i(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(e){return false}}function o(e,n,t){if(i()){r.exports=o=Reflect.construct}else{r.exports=o=function e(n,t,r){var i=[null];i.push.apply(i,t);var o=Function.bind.apply(n,i);var a=new o;if(r)u(a,r.prototype);return a}}return o.apply(null,arguments)}r.exports=o});var n=e(function(e){var n=function(o){var e=Object.prototype;var s=e.hasOwnProperty;var c;var n=typeof Symbol==="function"?Symbol:{};var i=n.iterator||"@@iterator";var t=n.asyncIterator||"@@asyncIterator";var r=n.toStringTag||"@@toStringTag";function a(e,n,t,r){var i=n&&n.prototype instanceof u?n:u;var o=Object.create(i.prototype);var a=new E(r||[]);o._invoke=O(e,t,a);return o}o.wrap=a;function f(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}var l="suspendedStart";var p="suspendedYield";var h="executing";var d="completed";var v={};function u(){}function m(){}function y(){}var g={};g[i]=function(){return this};var b=Object.getPrototypeOf;var w=b&&b(b(A([])));if(w&&w!==e&&s.call(w,i)){g=w}var _=y.prototype=u.prototype=Object.create(g);m.prototype=_.constructor=y;y.constructor=m;y[r]=m.displayName="GeneratorFunction";function x(e){["next","throw","return"].forEach(function(n){e[n]=function(e){return this._invoke(n,e)}})}o.isGeneratorFunction=function(e){var n=typeof e==="function"&&e.constructor;return n?n===m||(n.displayName||n.name)==="GeneratorFunction":false};o.mark=function(e){if(Object.setPrototypeOf){Object.setPrototypeOf(e,y)}else{e.__proto__=y;if(!(r in e)){e[r]="GeneratorFunction"}}e.prototype=Object.create(_);return e};o.awrap=function(e){return{__await:e}};function k(u){function c(e,n,t,r){var i=f(u[e],u,n);if(i.type==="throw"){r(i.arg)}else{var o=i.arg;var a=o.value;if(a&&typeof a==="object"&&s.call(a,"__await")){return Promise.resolve(a.__await).then(function(e){c("next",e,t,r)},function(e){c("throw",e,t,r)})}return Promise.resolve(a).then(function(e){o.value=e;t(o)},function(e){return c("throw",e,t,r)})}}var n;function e(t,r){function e(){return new Promise(function(e,n){c(t,r,e,n)})}return n=n?n.then(e,e):e()}this._invoke=e}x(k.prototype);k.prototype[t]=function(){return this};o.AsyncIterator=k;o.async=function(e,n,t,r){var i=new k(a(e,n,t,r));return o.isGeneratorFunction(n)?i:i.next().then(function(e){return e.done?e.value:i.next()})};function O(a,u,c){var s=l;return function e(n,t){if(s===h){throw new Error("Generator is already running")}if(s===d){if(n==="throw"){throw t}return N()}c.method=n;c.arg=t;while(true){var r=c.delegate;if(r){var i=j(r,c);if(i){if(i===v)continue;return i}}if(c.method==="next"){c.sent=c._sent=c.arg}else if(c.method==="throw"){if(s===l){s=d;throw c.arg}c.dispatchException(c.arg)}else if(c.method==="return"){c.abrupt("return",c.arg)}s=h;var o=f(a,u,c);if(o.type==="normal"){s=c.done?d:p;if(o.arg===v){continue}return{value:o.arg,done:c.done}}else if(o.type==="throw"){s=d;c.method="throw";c.arg=o.arg}}}}function j(e,n){var t=e.iterator[n.method];if(t===c){n.delegate=null;if(n.method==="throw"){if(e.iterator["return"]){n.method="return";n.arg=c;j(e,n);if(n.method==="throw"){return v}}n.method="throw";n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var r=f(t,e.iterator,n.arg);if(r.type==="throw"){n.method="throw";n.arg=r.arg;n.delegate=null;return v}var i=r.arg;if(!i){n.method="throw";n.arg=new TypeError("iterator result is not an object");n.delegate=null;return v}if(i.done){n[e.resultName]=i.value;n.next=e.nextLoc;if(n.method!=="return"){n.method="next";n.arg=c}}else{return i}n.delegate=null;return v}x(_);_[r]="Generator";_[i]=function(){return this};_.toString=function(){return"[object Generator]"};function S(e){var n={tryLoc:e[0]};if(1 in e){n.catchLoc=e[1]}if(2 in e){n.finallyLoc=e[2];n.afterLoc=e[3]}this.tryEntries.push(n)}function F(e){var n=e.completion||{};n.type="normal";delete n.arg;e.completion=n}function E(e){this.tryEntries=[{tryLoc:"root"}];e.forEach(S,this);this.reset(true)}o.keys=function(t){var r=[];for(var e in t){r.push(e)}r.reverse();return function e(){while(r.length){var n=r.pop();if(n in t){e.value=n;e.done=false;return e}}e.done=true;return e}};function A(n){if(n){var e=n[i];if(e){return e.call(n)}if(typeof n.next==="function"){return n}if(!isNaN(n.length)){var t=-1,r=function e(){while(++t=0;--n){var i=this.tryEntries[n];var o=i.completion;if(i.tryLoc==="root"){return e("end")}if(i.tryLoc<=this.prev){var a=s.call(i,"catchLoc");var u=s.call(i,"finallyLoc");if(a&&u){if(this.prev=0;--t){var r=this.tryEntries[t];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e){this.complete(t.completion,t.afterLoc);F(t);return v}}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var r=t.completion;if(r.type==="throw"){var i=r.arg;F(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){this.delegate={iterator:A(e),resultName:n,nextLoc:t};if(this.method==="next"){this.arg=c}return v}};return o}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}});var Cn=n;function c(e,n,t,r,i,o,a){try{var u=e[o](a);var c=u.value}catch(e){t(e);return}if(u.done){n(c)}else{Promise.resolve(c).then(r,i)}}function t(u){return function(){var e=this,a=arguments;return new Promise(function(n,t){var r=u.apply(e,a);function i(e){c(r,n,t,i,o,"next",e)}function o(e){c(r,n,t,i,o,"throw",e)}i(undefined)})}}var Mn=t;function r(e){if(Array.isArray(e))return e}var i=r;function o(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}var a=o;function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var f=s;function l(e){return i(e)||a(e)||f()}var Rn=l;function p(e){if(Array.isArray(e)){for(var n=0,t=new Array(e.length);n=0)continue;t[i]=e[i]}return t}var k=x;function O(e,n){if(e==null)return{};var t=k(e,n);var r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;t[r]=e[r]}}return t}var $n=O;var Dn=e(function(n){function t(e){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){t=function e(n){return typeof n}}else{t=function e(n){return n&&typeof Symbol==="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n}}return t(e)}function r(e){if(typeof Symbol==="function"&&t(Symbol.iterator)==="symbol"){n.exports=r=function e(n){return t(n)}}else{n.exports=r=function e(n){return n&&typeof Symbol==="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":t(n)}}return r(e)}n.exports=r});function j(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);if(e)r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable});t.push.apply(t,r)}return t}function Jn(n){for(var e=1;e\n\nType (env) to see environment with functions macros and variables.\nYou can also use (help name) to display help for specic function or macro.\n").replace(/^.*\n/,"");return i}();var t=/^\/((?:\\\/|[^/]|\[[^\]]*\/[^\]]*\])+)\/([gimy]*)$/;var i=/^(?:#x[-+]?[0-9a-f]+|#o[-+]?[0-7]+|#b[-+]?[01]+|[-+]?[0-9]+)$/i;var o=/^([-+]?([0-9]+([eE][-+]?[0-9]+)|(\.[0-9]+|[0-9]+\.[0-9]+)([eE][-+]?[0-9]+)?)|[0-9]+\.)$/;var a=/^#\\(?:newline|space|.)$/i;var u=/^((?:(?:[-+]?[0-9]+(?:[eE][-+]?[0-9]+)?)|(?:[-+]?(?:(?:\.[0-9]+|[0-9]+\.[0-9]+)(?:[eE][-+]?[0-9]+)?)|[0-9]+\.))(?=[+-]|i))?((?:[-+]?[0-9]+(?:[eE][-+]?[0-9]+)?)|(?:[-+]?(?:(?:\.[0-9]+|[0-9]+\.[0-9]+)(?:[eE][-+]?[0-9]+)?)|[0-9]+\.))i|-i$/;var c=/^[-+]?[0-9]+\/[0-9]+$/;function s(e){var n=e.split("/");return Ze({num:parseInt(n[0],10),denom:parseInt(n[1],10)})}function l(e){var n=e.match(/^(?:#([xbo]))?([+-]?[0-9a-f]+)$/i);var t;if(n&&n[1]){switch(n[1]){case"x":t=16;break;case"o":t=8;break;case"b":t=2;break}}else{t=10}return Ge(parseInt(n[2],t))}function p(e){var n=e.match(/#\\(.*)$/);if(n){return Ce(n[1])}}function h(e){if(e==="-i"){return{im:-1,re:0}}var n=e.match(u);var t,r;if(n.length===2){t=Qe(0);r=Qe(parseFloat(n[1]))}else{t=Qe(n[1]?parseFloat(n[1]):0);r=Qe(parseFloat(n[2]))}return ze({im:r,re:t})}function d(e){return Me(JSON.parse(e.replace(/\n/g,"\\n")))}function y(e){var n=e.match(t);if(n){return new RegExp(n[1],n[2])}else if(e.match(/^"/)){return d(e)}else if(e.match(a)){return p(e)}else if(e.match(c)){return s(e)}else if(e.match(u)){return h(e)}else if(e.match(i)){return l(e)}else if(e.match(o)){return Qe(parseFloat(e))}else if(e==="nil"){return z}else if(e==="true"){return true}else if(e==="false"){return false}else{return new U(e)}}function v(e){return!(["(",")"].includes(e)||e.match(t)||e.match(/['"]/)||e.match(i)||e.match(o)||["nil","true","false"].includes(e))}var m=/("(?:\\[\S\s]|[^"])*"|\/(?! )[^\n\/\\]*(?:\\[\S\s][^\n\/\\]*)*\/[gimy]*(?=\s|\(|\)|$)|;.*)/g;var b=/"(?:\\[\S\s]|[^"])*"/g;function w(){var e=Object.keys(S).map(x).join("|");return new RegExp('("(?:\\\\[\\S\\s]|[^"])*"|#\\\\(?:newline|space|.)|#f|#t|#[xbo][0-9a-f]+(?=[\\s()]|$)|[0-9]+/[0-9]+|\\/(?! )[^\\n\\/\\\\]*(?:\\\\[\\S\\s][^\\n\\/\\\\]*)*\\/[gimy]*(?=\\s|\\(|\\)|$)|\\(|\\)|\'|"(?:\\\\[\\S\\s]|[^"])+|\\n|(?:\\\\[\\S\\s]|[^"])*"|;.*|(?:(?:[-+]?(?:(?:\\.[0-9]+|[0-9]+\\.[0-9]+)(?:[eE][-+]?[0-9]+)?)|[0-9]+\\.)[0-9]i)|\\.{2,}|'.concat(e,"|[^(\\s)]+)"),"gim")}function _(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:1;return e[e.length-n]}function x(e){if(typeof e==="string"){var n=/([-\\^$[\]()+{}?*.|])/g;return e.replace(n,"\\$1")}}function k(e){var i=w();e=e.replace(/\n\r|\r/g,"\n");var o=0;var a=0;var u=[];var c=[];var s=0;e.split(m).filter(Boolean).forEach(function(e){if(e.match(m)){s=0;if(c.length){var n=_(c);if(n.token.match(/\n/)){var t=n.token.split("\n").pop();s+=t.length}else{s+=n.token.length}s+=n.col}var r={col:s,line:a,token:e,offset:o};u.push(r);c.push(r);o+=e.length;s+=e.length;a+=(e.match("\n")||[]).length;return}e.split(i).filter(Boolean).forEach(function(e){var n={col:s,line:a,token:e,offset:o};s+=e.length;o+=e.length;u.push(n);c.push(n);if(e==="\n"){++a;c=[];s=0}})});return u}function O(e){var n=e.token,t=$n(e,["token"]);if(n.match(/^"[\s\S]+"$/)&&n.match(/\n/)){var r=new RegExp("^ {1,"+(e.col+1)+"}","mg");n=n.replace(r,"")}return Jn({token:n},t)}function j(e,n){var t=arguments.length>2&&arguments[2]!==g?arguments[2]:O;if(n){return k(e).map(t)}else{return k(e).map(function(e){var n=t(e);if(!n||typeof n.token!=="string"){throw new Error("[tokenize] Invalid formatter wrong return object")}return n.token.trim()}).filter(function(e){return e&&!e.match(/^;/)})}}var S={"'":new U("quote"),"`":new U("quasiquote"),",@":new U("unquote-splicing"),",":new U("unquote")};function F(e){if(typeof e==="string"){e=j(e)}var a=[];var u=[];var c=null;var s=Object.keys(S);var f=s.map(function(e){return S[e].name});var l=0;var p=false;var h=[];var d=[];var v=0;function m(){var e=a[a.length-1];if(e instanceof Array&&e[0]instanceof U&&f.includes(e[0].name)&&a.length>1&&!e[0].literal){a.pop();if(a[a.length-1].length===1&&a[a.length-1][0]instanceof U){a[a.length-1].push(e)}else if(a[a.length-1]instanceof Q){if(a[a.length-1].cdr instanceof Q){a[a.length-1]=new Q(a[a.length-1],Q.fromArray(e))}else{a[a.length-1].cdr=Q.fromArray(e)}}else{a[a.length-1].push(e)}}}e.forEach(function(e){var n=a[a.length-1];if(s.indexOf(e)!==-1){v++;c=e;a.push([S[c]]);if(!c){d=[]}d.push(c)}else{if(c){h.push(d);d=[]}if(e==="("){p=true;l++;a.push([]);c=null;v=0}else if(e==="."&&!p){a[a.length-1]=Q.fromArray(n)}else if(e===")"){l--;if(!a.length){throw new Error("Unbalanced parenthesis")}if(a.length===1){var t=a.pop();if(t instanceof Array&&t.length===0){t=z}u.push(t)}else if(a.length>1){var r=a.pop();n=a[a.length-1];if(n instanceof Array){if(r.length===0){n.push(z)}else{n.push(r)}}else if(n instanceof Q){if(r.length===0){n.append(z)}else{n.append(Q.fromArray(r))}}if(h.length){d=h.pop();while(d.length){m();d.pop()}}else{m()}}if(l===0&&a.length){u.push(a.pop())}}else{p=false;var i=y(e);if(c){while(v--){a[a.length-1].push(i);i=a.pop()}h.pop();v=0;c=false}else if(i instanceof U&&f.includes(i.name)){i.literal=true}n=a[a.length-1];if(n instanceof Q){var o=n;while(true){if(o.cdr===z){if(i instanceof Array){o.cdr=Q.fromArray(i)}else{o.cdr=i}break}else{o=o.cdr}}}else if(!a.length){u.push(i)}else{n.push(i)}}}});if(!e.filter(function(e){return e.match(/^[()]$/)}).length&&a.length){u=u.concat(a);a=[]}if(a.length){throw new Error("Unbalanced parenthesis 2")}return u.map(function(e){if(e instanceof Array){return Q.fromArray(e)}return e})}function E(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:function(e){return e};var t=arguments.length>2&&arguments[2]!==g?arguments[2]:null;if(e instanceof Array){var r=e.filter(ce);if(r.length){return E(Promise.all(r),n,t)}return n(e)}if(ce(e)){var i=e.then(n);if(t===null){return i}else{return i["catch"](t)}}return n(e)}function A(e,n){if(n instanceof RegExp){return function(e){return String(e).match(n)}}else if(typeof n!=="function"){throw new Error("".concat(e," argument need to be a function or RegExp"))}else{return n}}function N(e,n,t){if(n){if(t){e.__doc__=n}else{e.__doc__=q(n)}}return e}function q(e){return e.split("\n").map(function(e){return e.trim()}).join("\n")}function I(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:1;var t=e.length;if(n<=0){throw Error("previousSexp: Invlaid argument sexp = ".concat(n))}e:while(n--&&t>=0){var r=1;while(r>0){var i=e[--t];if(!i){break e}if(i==="("||i.token==="("){r--}else if(i===")"||i.token===")"){r++}}t--}return e.slice(t+1)}function L(e){if(!e||!e.length){return 0}var n=e.length;if(e[n-1].token==="\n"){return 0}while(--n){if(e[n].token==="\n"){var t=(e[n+1]||{}).token;if(t){return t.length}}}return 0}function P(e,n){return s(e,n)===n.length;function s(e,n){function t(){return i>0&&a>0&&e[i-1]===n[a-1]&&e[i+1]===n[a]}function r(){return e[i]===Symbol["for"]("symbol")&&!v(n[a])}var i=0;var o={};for(var a=0;a0){continue}}else if(r()){return-1}}else if(e[i]instanceof Array){var c=s(e[i],n.slice(a));if(c===-1||c+a>n.length){return-1}a+=c-1;i++;continue}else{return-1}i++}if(e.length!==i){return-1}return n.length}}function C(e){this._code=e.replace(/\r/g,"")}C.defaults={offset:0,indent:2,specials:[/^define/,"lambda","let","let*"]};C.match=P;C.prototype._options=function e(n){var t=C.defaults;if(typeof n==="undefined"){return Object.assign({},t)}var r=n&&n.specials||[];return Object.assign({},t,n,{specials:t.specials.concat(r)})};C.prototype.indent=function e(n){var t=j(this._code,true);return this._indent(t,n)};C.matchSpecial=function(e,n){var t=n.specials;if(t.indexOf(e)!==-1){return true}else{var r=t.filter(function(e){return e instanceof RegExp});var i=true;var o=false;var a=g;try{for(var u=r[Symbol.iterator](),c;!(i=(c=u.next()).done);i=true){var s=c.value;if(e.match(s)){return true}}}catch(e){o=true;a=e}finally{try{if(!i&&u["return"]!=null){u["return"]()}}finally{if(o){throw a}}}}return false};C.prototype._indent=function e(n,t){var r=this._options(t);var i=L(n);var o=I(n);if(o&&o.length){if(o[0].line>0){r.offset=0}if(o.toString()===n.toString()&&Nn(o)){return r.offset+o[0].col}else if(o.length===1){return r.offset+o[0].col+1}else if(C.matchSpecial(o[1].token,r)){return r.offset+o[0].col+r.indent}else if(o[0].line3&&o[1].line===o[3].line){if(o[1].token==="("){return r.offset+o[1].col}return r.offset+o[3].col}else if(o[0].line===o[1].line){return r.offset+r.indent+o[0].col}else{var a=o.slice(2);for(var u=0;u1&&arguments[1]!==g?arguments[1]:true;if(e instanceof Q){return e}if(n===false){var t=z;for(var r=e.length;r--;){t=new Q(e[r],t)}return t}if(e.length&&!(e instanceof Array)){e=Tn(e)}if(e.length===0){return V()}else{var i;if(e[0]instanceof Array){i=Q.fromArray(e[0])}else{i=e[0]}if(typeof i==="string"){i=Me(i)}if(e.length===1){return new Q(i,z)}else{return new Q(i,Q.fromArray(e.slice(1)))}}};Q.prototype.toObject=function(){var e=this;var n={};while(true){if(e instanceof Q&&e.car instanceof Q){var t=e.car;var r=t.car;if(r instanceof U){r=r.name}if(r instanceof String){r=r.valueOf()}var i=t.cdr;if(i instanceof Q){i=i.toObject()}if(i instanceof Ge||i instanceof Me){i=i.valueOf()}n[r]=i;e=e.cdr}else{break}}return n};Q.fromPairs=function(e){return e.reduce(function(e,n){return new Q(new Q(new U(n[0]),n[1]),e)},z)};Q.fromObject=function(n){var e=Object.keys(n).map(function(e){return[e,n[e]]});return Q.fromPairs(e)};Q.prototype.reduce=function(e){var n=this;var t=z;while(true){if(n!==z){t=e(t,n.car);n=n.cdr}else{break}}return t};Q.prototype.reverse=function(){if(this.haveCycles()){throw new Error("You can't reverse list that have cycles")}var e=this;var n=z;while(e!==z){var t=e.cdr;e.cdr=n;n=e;e=t}return n};Q.prototype.transform=function(r){function i(e){if(e instanceof Q){if(e.replace){delete e.replace;return e}var n=r(e.car);if(n instanceof Q){n=i(n)}var t=r(e.cdr);if(t instanceof Q){t=i(t)}return new Q(n,t)}return e}return i(this)};Q.prototype.map=function(e){if(typeof this.car!=="undefined"){return new Q(e(this.car),re(this.cdr)?z:this.cdr.map(e))}else{return z}};function K(e){if(typeof e==="function"){return"<#function "+(e.name||"anonymous")+">"}else if(typeof e==="string"||e instanceof Me){return JSON.stringify(e.valueOf()).replace(/\\n/g,"\n")}else if(ce(e)){return"<#Promise>"}else if(e instanceof U||e instanceof Ge||e instanceof RegExp||e instanceof Q||e instanceof Ce||e===z){return e.toString()}else if(e instanceof Array){return e.map(K)}else if(Dn(e)==="object"){if(e===null){return"null"}var n=e.constructor.name;if(n==="Object"){return JSON.stringify(e)}return"<#object("+e.constructor.name+")>"}else if(typeof e!=="undefined"){return e}}Q.prototype.markCycles=function(){W(this);return this};Q.prototype.haveCycles=function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:null;if(!e){return this.haveCycles("car")||this.haveCycles("cdr")}return!!(this.cycles&&this.cycles[e])};function W(e){var i=[];var n=[];function o(e){if(e instanceof Q){if(i.includes(e)){if(!n.includes(e)){n.push(e)}return"#".concat(n.length-1,"#")}}}function a(e){if(e instanceof Q){i.push(e);var n={};var t=o(e.car);var r=o(e.cdr);if(t){n["car"]=t}else{a(e.car)}if(r){n["cdr"]=r}else{a(e.cdr)}if(t||r){e.cycles=n}else if(e.cycles){delete e.cycles}}}a(e)}Q.prototype.toString=function(){var e=["("];if(this.car!==g){var n;if(this.cycles&&this.cycles.car){n=this.cycles.car}else{n=K(this.car)}if(n!==g){e.push(n)}if(this.cdr instanceof Q){if(this.cycles&&this.cycles.cdr){e.push(" . ");e.push(this.cycles.cdr)}else{var t;if(this.cycles&&this.cycles.cdr){t=this.cycles.cdr}var r=this.cdr.toString(t).replace(/^\(|\)$/g,"");e.push(" ");e.push(r)}}else if(typeof this.cdr!=="undefined"&&this.cdr!==z){e=e.concat([" . ",K(this.cdr)])}}e.push(")");return e.join("")};Q.prototype.set=function(e,n){this[e]=n;if(n instanceof Q){this.markCycles()}};Q.prototype.append=function(e){if(e instanceof Array){return this.append(Q.fromArray(e))}var n=this;if(n.car===g){if(e instanceof Q){this.car=e.car;this.cdr=e.cdr}else{this.car=e}}else if(e!==z){while(true){if(n instanceof Q&&n.cdr!==z){n=n.cdr}else{break}}n.cdr=e}return this};function Z(e){return e<0?-e:e}function ee(e,n){var t=Rn(n),r=t[0],i=t.slice(1);while(i.length>0){var o=i,a=Bn(o,1),u=a[0];if(!e(r,u)){return false}var c=i;var s=Rn(c);r=s[0];i=s.slice(1)}return true}function ne(e,n){if(e instanceof Ge&&n instanceof Ge){return e.cmp(n)===0}else if(typeof e==="number"||typeof n==="number"){return Ge(e).cmp(Ge(n))===0}else if(e instanceof Ce&&n instanceof Ce){return e["char"]===n["char"]}else if(e instanceof Me&&n instanceof Me){return e.valueOf()===n.valueOf()}else if(e instanceof U&&n instanceof U){return e.name===n.name}else{return e===n}}var te=function(){if(Math.trunc){return Math.trunc}else{return function(e){if(e<0){return Math.ceil(e)}else{return Math.floor(e)}}}}();function re(e){return e instanceof Q&&e.isEmptyList()||e===z}function ie(e,n,t,r){if(typeof this!=="undefined"&&this.constructor!==ie||typeof this==="undefined"){return new ie(e,n)}bn("Macro",e,"string",1);bn("Macro",n,"function",2);if(t){if(r){this.__doc__=t}else{this.__doc__=q(t)}}this.name=e;this.fn=n}ie.defmacro=function(e,n,t,r){var i=new ie(e,n,t,r);i.defmacro=true;return i};ie.prototype.invoke=function(e,n,t){var r=n.env,i=n.dynamic_scope,o=n.error;var a={dynamic_scope:i,error:o,macro_expand:t};var u=this.fn.call(r,e,a,this.name);return t?hn(u):u};ie.prototype.toString=function(){return"#"};var oe="define-macro";function ae(o){return function(){var t=Mn(Cn.mark(function e(t,c){var s,f,r,i;return Cn.wrap(function e(n){while(1){switch(n.prev=n.next){case 0:r=function e(){r=Mn(Cn.mark(function e(t){var r,i,o,a,u;return Cn.wrap(function e(n){while(1){switch(n.prev=n.next){case 0:if(!(t instanceof Q&&t.car instanceof U)){n.next=13;break}n.prev=1;r=s.get(t.car);if(!(r instanceof ie&&r.defmacro)){n.next=9;break}n.next=6;return r.invoke(t.cdr,c,true);case 6:i=n.sent;if(!(i instanceof Q)){n.next=9;break}return n.abrupt("return",i);case 9:n.next=13;break;case 11:n.prev=11;n.t0=n["catch"](1);case 13:o=t.car;if(!(o instanceof Q)){n.next=18;break}n.next=17;return f(o);case 17:o=n.sent;case 18:a=t.cdr;if(!(a instanceof Q)){n.next=23;break}n.next=22;return f(a);case 22:a=n.sent;case 23:u=new Q(o,a);return n.abrupt("return",u);case 25:case"end":return n.stop()}}},e,null,[[1,11]])}));return r.apply(this,arguments)};f=function e(n){return r.apply(this,arguments)};s=c["env"]=this;i=t;if(!o){n.next=12;break}n.t0=hn;n.next=8;return f(t);case 8:n.t1=n.sent.car;return n.abrupt("return",(0,n.t0)(n.t1));case 12:n.next=15;return f(t);case 15:i=n.sent;if(!(t.toString()===i.toString())){n.next=18;break}return n.abrupt("break",21);case 18:t=i;n.next=12;break;case 21:return n.abrupt("return",hn(i.car));case 22:case"end":return n.stop()}}},e,this)}));return function(e,n){return t.apply(this,arguments)}}()}function ue(e){return typeof e==="undefined"||e===z||e===null}function ce(e){return e instanceof Promise||e&&typeof e!=="undefined"&&typeof e.then==="function"}function se(e){switch(Dn(e)){case"string":return Me(e);case"number":return Ge(e)}return e}function fe(e){return e.valueOf()}function le(e,n){if(e instanceof Q){e.markCycles();return hn(e)}if(typeof e==="function"){if(n){return he(e,n)}}return se(e)}function pe(e){if(de(e)){return e[ve]}return e}function he(n,e){if(n[Symbol["for"]("__bound__")]){return n}var t=n.bind(e);var r=Object.getOwnPropertyNames(n).filter(ye);r.forEach(function(e){t[e]=n[e]});ge(t,"__fn__",n);ge(t,"__bound__",true);if(we(n)){ge(t,"__native__",true)}t.valueOf=function(){return n};return t}function de(e){return typeof e==="function"&&e[ve]}var ve=Symbol["for"]("__fn__");var me=["name","length","caller","callee","arguments","prototype"];function ye(e){return!me.includes(e)}function ge(e,n,t){Object.defineProperty(e,Symbol["for"](n),{get:function e(){return t},set:function e(){},configurable:false,enumerable:false})}function be(n,t){try{Object.defineProperty(n,"length",{get:function e(){return t}});return n}catch(e){var r=new Array(t).fill(0).map(function(e,n){return"a"+n}).join(",");var i=new Function("f","return function(".concat(r,") {\n return f.apply(this, arguments);\n };"));return i(n)}}function we(e){var n=Symbol["for"]("__native__");return typeof e==="function"&&e.toString().match(/\{\s*\[native code\]\s*\}/)&&(e.name.match(/^bound /)&&e[n]===true||!e.name.match(/^bound /)&&!e[n])}function _e(e){var h;switch(e){case Symbol["for"]("letrec"):h="letrec";break;case Symbol["for"]("let"):h="let";break;case Symbol["for"]("let*"):h="let*";break;default:throw new Error("Invlild let_macro value")}return ie.defmacro(h,function(o,e){var a=e.dynamic_scope,u=e.error,n=e.macro_expand;var c;if(o.car instanceof U){if(!(o.cdr.car instanceof Q)){throw new Error("let require list of pairs")}var t=o.cdr.car.map(function(e){return e.car});c=o.cdr.car.map(function(e){return e.cdr.car});return Q.fromArray([U("letrec"),[[o.car,Q(U("lambda"),Q(t,o.cdr.cdr))]],Q(o.car,c)])}else if(n){return}var s=this;c=this.get("list->array")(o.car);var f=s.inherit("let");var l;if(h==="let*"){l=f}var p=0;return function e(){var n=c[p++];function t(e){if(ce(e)){return e.then(t)}else if(typeof e==="undefined"){f.set(n.car,z)}else{f.set(n.car,e)}}if(a){a=h==="let*"?f:s}if(!n){var r=new Q(new U("begin"),o.cdr);return jn(r,{env:f,dynamic_scope:a,error:u})}else{if(h==="let"){l=s}else if(h==="letrec"){l=f}var i=jn(n.cdr.car,{env:l,dynamic_scope:a,error:u});if(h==="let*"){l=f=l.inherit("letrect["+p+"]")}return E(t(i),e)}}()})}function xe(e,c){return new ie(e,function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{},t=n.dynamic_scope,r=n.error;var i=this;if(t){t=this}var o=e;var a=[];while(o instanceof Q&&!re(o)){a.push(jn(o.car,{env:i,dynamic_scope:t,error:r}));o=o.cdr}var u=a.filter(ce).length;if(u){return Promise.all(a).then(c.bind(this))}else{return c.call(this,a)}})}function ke(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r2?r-2:0),o=2;o1?e-1:0),t=1;t=a){return o.apply(this,r)}else{return i}}return i.apply(this,arguments)}}function Ie(r,i){bn("limit",i,"function",2);return function(){for(var e=arguments.length,n=new Array(e),t=0;t1?r-1:0),o=1;o0){t.push(this._string.substring(0,e))}t.push(n);if(e0&&arguments[0]!==g?arguments[0]:null;if(e===null){return Ve(this.value.valueOf())}return Xe(e.valueOf())(this.value.valueOf())};var Ve=Xe(1e-10);function Xe(r){return function(e){var n=function e(r,n,t){var i=function e(n,t){return t0){i=We(r,t)}else if(r.cmp(t)<=0){i=t}else if(t.cmp(0)>0){i=We(t,r)}else if(n.cmp(0)<0){i=Ge(We(r.sub(),t.sub())).sub()}else{i=Ge(0)}if(Ge.isFloat(n)||Ge.isFloat(e)){return Qe(i)}return i}function We(e,n){var t=Ge(e).floor();var r=Ge(n).floor();if(e.cmp(t)<1){return t}else if(t.cmp(r)===0){var i=Ge(1).div(n.sub(r));var o=Ge(1).div(e.sub(t));return t.add(Ge(1).div(We(i,o)))}else{return t.add(Ge(1))}}function Ze(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:false;if(typeof this!=="undefined"&&!(this instanceof Ze)||typeof this==="undefined"){return new Ze(e,n)}if(!Ge.isRational(e)){throw new Error("Invalid constructor call for LBigInteger")}if(e.num%e.denom===0&&!n){return Ge(e.num/e.denom)}this.num=Ge(e.num);this.denom=Ge(e.denom);this.type="rational"}Ze.prototype=Object.create(Ge.prototype);Ze.prototype.constructor=Ze;Ze.prototype.pow=function(e){var n=e.cmp(0);if(n===0){return Ge(1)}if(n===-1){e=e.sub();var t=this.denom.pow(e);var r=this.num.pow(e);return Ze({num:t,denom:r})}var i=this;e=e.valueOf();while(e>1){i=i.mul(this);e--}return i};Ze.prototype.abs=function(){var e=this.num;var n=this.denom;if(e.cmp(0)===-1){e=e.sub()}if(n.cmp(0)!==1){n=n.sub()}return Ze({num:e,denom:n})};Ze.prototype.cmp=function(e){return Ge(this.valueOf()).cmp(e)};Ze.prototype.toString=function(){var e=vn.get("gdc")(this.num,this.denom);if(e!==1){e=Ge(e);return this.num.div(e)+"/"+this.denom.div(e)}return this.num+"/"+this.denom};Ze.prototype.valueOf=function(){return Qe(this.num.valueOf()).div(this.denom.valueOf())};Ze.prototype.mul=function(e){if(Ge.isRational(e)){var n=this.num.mul(e.num);var t=this.denom.mul(e.denom);return Ze({num:n,denom:t})}return Ge(this.valueOf()).mul(e)};Ze.prototype.div=function(e){if(Ge.isRational(e)){var n=this.num.mul(e.denom);var t=this.denom.mul(e.num);return Ze({num:n,denom:t})}return Ge(this.valueOf()).div(e)};Ze.prototype.op=function(e,n){return this[tn[e]](n)};Ze.prototype.sub=function(e){if(Ge.isRational(e)){var n=e.num.sub();var t=e.denom;return this.add(Ze({num:n,denom:t}))}if(!(e instanceof Ge)){e=Ge(e).sub()}else{e=e.sub()}if(Ge.isFloat(e)){return Qe(this.valueOf()).add(e)}return this.add(e)};Ze.prototype.add=function(e){if(Ge.isRational(e)){var n=this.denom;var t=e.denom;var r=this.num;var i=e.num;var o,a;if(n!==t){a=t.mul(r).add(i.mul(n));o=n.mul(t)}else{a=r.add(i);o=n}return Ze({num:a,denom:o})}if(Ge.isFloat(e)){return Qe(this.valueOf()).add(e)}return Ge(this.valueOf()).add(e)};function en(e,n){if(typeof this!=="undefined"&&!(this instanceof en)||typeof this==="undefined"){return new en(e,n)}if(e instanceof en){return en(e.value,e._native)}if(!Ge.isBigInteger(e)){throw new Error("Invalid constructor call for LBigInteger")}this.value=e;this._native=n;this.type="bigint"}en.prototype=Object.create(Ge.prototype);en.prototype.constructor=en;en.prototype.op=function(e,n){if(Ge.isBN(this.value)&&Ge.isBN(n.value)){var t={"+":"iadd","-":"isub","*":"imul","/":"idiv","%":"imod","|":"ior","&":"iand","~":"inot","<<":"ishrn",">>":"ishln"};e=t[e];return en(this.value.clone()[e](n),false)}if(n instanceof Ze){return Ze({num:this,denom:1},true)[tn[e]](n)}if(e==="/"){return Ze({num:this,denom:n})}return en(Ge._ops[e](this.value,n&&n.value),true)};en.prototype.sqrt=function(){var e;var n=this.cmp(0)<0;if(Ge.isNative(this.value)){e=Math.sqrt(n?-this.valueOf():this.valueOf())}else if(Ge.isBN(this.value)){e=n?this.value.neg().sqrt():this.value.sqrt()}if(n){return ze({re:0,im:e})}return e};Ge.isFloat=function e(n){return n instanceof Qe||Number(n)===n&&n%1!==0};Ge.isNumber=function(e){return e instanceof Ge||!Number.isNaN(e)&&Ge.isNative(e)||Ge.isBN(e)};Ge.isComplex=function(e){return e instanceof ze||Ge.isNumber(e.im)&&Ge.isNumber(e.re)};Ge.isRational=function(e){return e instanceof Ze||Ge.isNumber(e.num)&&Ge.isNumber(e.denom)};Ge.isNative=function(e){return typeof e==="bigint"||typeof e==="number"};Ge.isBigInteger=function(e){return e instanceof en||typeof e==="bigint"||Ge.isBN(e)};Ge.isBN=function(e){return typeof r!=="undefined"&&e instanceof r};Ge.getArgsType=function(e,n){if(e instanceof Qe||n instanceof Qe){return Qe}if(e instanceof en||n instanceof en){return en}return Ge};Ge.prototype.toString=Ge.prototype.toJSON=function(e){return this.value.toString(e)};Ge.prototype.isBigNumber=function(){return typeof this.value==="bigint"||typeof r!=="undefined"&&!(this.value instanceof r)};["floor","ceil","round"].forEach(function(e){Ge.prototype[e]=function(){if(this["float"]||Ge.isFloat(this.value)){return Ge(Math[e](this.value))}else{return Ge(Math[e](this.valueOf()))}}});Ge.prototype.valueOf=function(){if(Ge.isNative(this.value)){return Number(this.value)}else if(Ge.isBN(this.value)){return this.value.toNumber()}};Ge.prototype.coerce=function(e){if(e===null){e=0}var n;if(e instanceof Ge){n=e.value}else{n=e}if(this instanceof Qe){return Qe(e.valueOf())}if(this instanceof ze){return ze({re:n,im:0})}if(this instanceof Ze&&!Ge.isRational(e)){return Ge(n)}if(Ge.isComplex(e)){return ze(e)}else if(Ge.isRational(e)){return Ze(e)}else if(Ge.isFloat(n)||this instanceof Qe){return Qe(n)}else if(typeof this.value==="bigint"&&typeof n!=="bigint"){return en(BigInt(n))}else if(typeof r!=="undefined"&&this.value instanceof r&&!n instanceof r){return en(new r(n))}return Ge(n)};Ge.getType=function(e){if(e instanceof Ge){return e.type}if(Ge.isFloat(e)){return"float"}if(Ge.isComplex(e)){return"complex"}if(Ge.isRational(e)){return"rational"}if(typeof e==="number"){return"integer"}if(typeof BigInt!=="undefined"&&typeof e!=="bigint"||typeof r!=="undefined"&&!(e instanceof r)){return"bigint"}};Ge.prototype.isFloat=function(){return!!(Ge.isFloat(this.value)||this["float"])};Ge.prototype.add=function(e){return Ge(this.valueOf()+e.valueOf())};Ge.prototype.sub=function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:null;if(e===null){return Ge(-this.valueOf())}return Ge(this.valueOf()-e.valueOf())};Ge.prototype.mul=function(e){if(e instanceof ze){return ze(this).mul(e)}return Ge(this.valueOf()*e.valueOf())};Ge.prototype.div=function(e){if(e instanceof ze){return ze(this).mul(e)}return Ge(this.valueOf()/e.valueOf())};Ge.prototype.rem=function(e){return Ge(this.valueOf()%e.valueOf())};Ge.prototype.mod=function(e){return Ge(this.valueOf()%e.valueOf())};Ge.prototype.or=function(e){return Ge(this.ValueOf()|e.valueOf())};Ge.prototype.and=function(e){return Ge(this.valueOf()&e.valueOf())};Ge.prototype.neg=function(){return Ge(~this.valueOf())};Ge.prototype.shl=function(e){return Ge(this.valueOf()>>e.valueOf())};Ge.prototype.shr=function(e){return this.op(e)};var nn={add:"+",sub:"-",mul:"*",div:"/",rem:"%",or:"|",and:"&",neg:"~",shl:">>",shr:"<<"};var tn={};Object.keys(nn).forEach(function(n){tn[nn[n]]=n;Ge.prototype[n]=function(e){return this.op(nn[n],e)}});Ge._ops={"*":function e(n,t){return n*t},"+":function e(n,t){return n+t},"-":function e(n,t){if(typeof t==="undefined"){return-n}return n-t},"/":function e(n,t){return n/t},"%":function e(n,t){return n%t},"|":function e(n,t){return n|t},"&":function e(n,t){return n&t},"~":function e(n){return~n},">>":function e(n,t){return n>>t},"<<":function e(n,t){return n<"};function an(n){var t=this;if(typeof this!=="undefined"&&!(this instanceof an)||typeof this==="undefined"){return new an(n)}bn("OutputStringPort",n,"function");this._buffer=[];this.write=function(e){if(!Me.isString(e)){e=n(e)}else{e=e.valueOf()}t._buffer.push(e)}}an.prototype=Object.create(on.prototype);an.prototype.getString=function(){return this._buffer.map(function(e){return e.valueOf()}).join("")};an.prototype.constructor=an;function un(e){var n=this;if(typeof this!=="undefined"&&!(this instanceof un)||typeof this==="undefined"){return new un(e)}bn("InputStringPort",e,"string");this._tokens=j(e);this._index=0;this._in_char=0;this.read=function(){return n.getNextTokens()}}un.prototype=Object.create(rn.prototype);un.prototype.constructor=un;un.prototype.getNextTokens=function(){if(this.peekChar()===cn){return cn}var e=0;var n=[];var t=["(",")"];if(!t.includes(this._tokens[this._index])){return this._tokens[this._index++]}do{var r=this._tokens[this._index];n.push(this._tokens[this._index]);if(r===")"){e--}else if(r==="("){e++}this._index++}while(e!==0);return n};un.prototype.peekChar=function(){if(this._index>this._tokens.length-1){return cn}if(this._index===this._tokens.length-1&&this.in_char>this._tokens[this._index].length){return cn}return this._tokens[this._index][this.in_char]};var cn=new sn;function sn(){}sn.prototype.toString=function(){return"<#eof>"};function fn(e){this.message=e}fn.prototype=Object.create(Error.prototype);function ln(e,n,t){if(arguments.length===1){if(Dn(arguments[0])==="object"){e=arguments[0];this.parent=null}else if(typeof arguments[0]==="string"){e={};n={};t=arguments[0]}}this.env=e;this.parent=n;this.name=t||"anonymous"}ln.prototype.inherit=function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{};if(Dn(e)==="object"){n=e}if(!e||Dn(e)==="object"){e="child of "+(this.name||"unknown")}return new ln(n||{},this,e)};ln.prototype.newFrame=function(e,n){var t=this.inherit("__frame__");t.set("parent.frame",function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:1;if(e===0){return t}if(!(t.parent instanceof ln)){return z}var n=t.parent.get("parent.frame",{throwError:false});if(typeof n==="function"){return n(e-1)}return z});n.callee=e;t.set("arguments",n);return t};ln.prototype._lookup=function(e){if(e instanceof U){e=e.name}if(e instanceof Me){e=e.valueOf()}if(e in this.env){return pn(this.env[e])}if(this.parent){return this.parent._lookup(e)}};ln.prototype.toString=function(){return"<#env:"+this.name+">"};function pn(e){if(typeof this!=="undefined"&&!(this instanceof pn)||typeof this==="undefined"){return new pn(e)}this.value=e}pn.isUndefined=function(e){return e instanceof pn&&typeof e.value==="undefined"};pn.prototype.valueOf=function(){return this.value};ln.prototype.get=function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{};var t=n.throwError,r=t===void 0?true:t;var i=e;if(i instanceof U||i instanceof Me){i=i.valueOf()}var o=this._lookup(i);if(o instanceof pn){if(pn.isUndefined(o)){return g}return le(o.valueOf())}var a=i.split(".").filter(Boolean);if(a.length>0){var u=Rn(a),c=u[0],s=u.slice(1);o=this._lookup(c);if(s.length){if(o instanceof pn){o=o.valueOf();return Pe.apply(void 0,[o].concat(Tn(s)))}else{return Pe.apply(void 0,[f].concat(Tn(a)))}}else if(o instanceof pn){return le(o.valueOf())}}o=Pe(f,i);if(typeof o!=="undefined"){return o}if(r){throw new Error("Unbound variable `"+i+"'")}};ln.prototype.set=function(e,n){if(Ge.isNumber(n)){n=Ge(n)}if(e instanceof U){e=e.name}else if(e instanceof Me){e=e.valueOf()}this.env[e]=n};ln.prototype.has=function(e){return typeof this.env[e]!=="undefined"};ln.prototype.ref=function(e){var n=this;while(true){if(!n){break}if(n.has(e)){return n}n=n.parent}};ln.prototype.parents=function(){var e=this;var n=[];while(e){n.unshift(e);e=e.parent}return n};function hn(e){if(ce(e)){return e.then(hn)}if(e instanceof Q||e instanceof U){e.data=true}return e}var dn=function(){var n=0;return function(){var e=arguments.length>0&&arguments[0]!==g?arguments[0]:null;if(e!==null){return new U(Symbol("#:".concat(e)))}n++;return new U(Symbol("#:g".concat(n)))}}();var vn=new ln({nil:z,undefined:g,true:true,false:false,NaN:NaN,stdout:new on(function(){var e;(e=console).log.apply(e,arguments)}),stdin:rn(function(){return new Promise(function(e){e(prompt(""))})}),"current-input-port":N(function(){return this.get("stdin")},"(current-input-port)\n\n Function return default stdin port."),"current-output-port":N(function(){return this.get("stdout")},"(current-output-port)\n\n Function return default stdout port."),"open-input-string":N(function(e){bn("open-input-string",e,"string");return un(e)},"(open-input-string string)\n\n Function create new string port as input that can be used to\n read S-exressions from this port using `read` function."),"output-port?":N(function(e){return e instanceof on},"(output-port? arg)\n\n Function return true if argument is output port."),"input-port?":N(function(e){return e instanceof rn},"(input-port? arg)\n\n Function return true if argument is input port."),"open-output-string":N(function(){return an(this.get("repr"))},"(open-output-string)\n\n Function create new output port that can used to write string into\n and after finish get the whole string using `get-output-string`"),"get-output-string":N(function(e){bn("get-output-string",e,"output-string-port");return e.getString()},"(get-output-string port)\n\n Function get full string from string port. If nothing was wrote\n to given port it will return empty string."),"eof-object?":N(function(e){return e===cn},"(eof-object? arg)\n\n Function check if value is eof object, returned from input string\n port when there are no more data to read."),"peek-char":N(function(e){bn("peek-char",e,["input-port","input-string-port"]);return e.peekChar()},"(peek-char port)\n\n Function get character from string port or EOF object if no more\n data in string port."),read:N(function n(e){var t=this;if(typeof e==="string"){return F(j(e))[0]}if(e instanceof un){var r=e.read();if(r===cn){return cn}return F(r)[0]}var i;if(e instanceof rn){i=e}else{i=this.get("stdin")}return i.read().then(function(e){return n.call(t,e)})},"(read [string])\n\n Function if used with string will parse the string and return\n list structure of LIPS code. If called without an argument it\n will read string from standard input (using browser prompt or\n user defined way) and call itself with that string (parse is)\n function can be used together with eval to evaluate code from\n string"),pprint:N(function(e){if(e instanceof Q){e=new Ln.Formatter(e.toString())["break"]().format();this.get("stdout").write.call(this,e)}else{this.get("display").call(this,e)}},"(pprint expression)\n\n Pretty print list expression, if called with non-pair it just call\n print function with passed argument."),print:N(function(){var e,n=this;for(var t=arguments.length,r=new Array(t),i=0;i1&&arguments[1]!==g?arguments[1]:null;if(n===null){n=this.get("stdout")}n.write.call(this,this.get("repr")(e))},"(display arg [port])\n\n Function send string to standard output or provied port."),error:N(function(){for(var e=arguments.length,n=new Array(e),t=0;t1&&arguments[1]!==g?arguments[1]:{},t=e.dynamic_scope,r=e.error;if(t){t=this}var i=jn(n.cdr.car,{env:this,dynamic_scope:t,error:r});i=xn(i);var o;function a(n,t){if(ce(n)){return n.then(function(e){return a(e,t)})}if(ce(t)){return t.then(function(e){return a(n,e)})}s[n]=t;return t}if(n.car instanceof Q&&U.is(n.car.car,".")){var u=n.car.cdr.car;var c=n.car.cdr.cdr.car;var s=jn(u,{env:this,dynamic_scope:t,error:r});var f=jn(c,{env:this,dynamic_scope:t,error:r});return a(f,i)}if(!(n.car instanceof U)){throw new Error("set! first argument need to be a symbol or "+"dot accessor that evaluate to object.")}o=this.ref(n.car.name);if(!o){o=this}return E(i,function(e){o.set(n.car,e)})}),"(set! name value)\n\n Macro that can be used to set the value of the variable (mutate)\n it search the scope chain until it finds first non emtpy slot and set it."),"set-car!":N(function(e,n){bn("set-car!",e,"pair");e.car=n},"(set-car! obj value)\n\n Function that set car (head) of the list/pair to specified value.\n It can destroy the list. Old value is lost."),"set-cdr!":N(function(e,n){bn("set-cdr!",e,"pair");e.cdr=n},"(set-cdr! obj value)\n\n Function that set cdr (tail) of the list/pair to specified value.\n It can destroy the list. Old value is lost."),"empty?":N(function(e){return typeof e==="undefined"||re(e)},"(empty? object)\n\n Function return true if value is undfined empty list."),assoc:N(function(e,n){if(e instanceof Q&&!(n instanceof Q)){throw new Error("First argument to assoc ned to be a key")}bn("assoc",n,"pair");var t=n;while(true){if(!(t instanceof Q)||this.get("empty?")(t)){break}var r=t.car.car;if(ne(r,e)){return t.car}else if(!t.haveCycles("cdr")){t=t.cdr}}return z},"(assoc key alist)\n\n Function search Alist (list of pairs) until it find the one that\n have head set equal to key, and return found pair."),gensym:N(dn,"(gensym)\n\n Function generate unique symbol, to use with macros as meta name."),load:N(function(e){bn("load",e,"string");var i=this;if(i.name==="__frame__"){i=i.parent}if(typeof this.get("global",{throwError:false})!=="undefined"){return new Promise(function(t,r){require("fs").readFile(e.valueOf(),function(e,n){if(e){r(e)}else{Sn(n.toString(),i).then(function(){t()})}})})}return f.fetch(e).then(function(e){return e.text()}).then(function(e){return Sn(e,i)}).then(function(){})},"(load filename)\n\n Function fetch the file and evaluate its content as LIPS code."),while:N(new ie("while",function(r,e){var i=e.dynamic_scope,o=e.error;var a=this;var u=new Q(new U("begin"),r.cdr);var c;if(i){i=a}return function n(){var e=jn(r.car,{env:a,dynamic_scope:i,error:o});function t(e){if(e&&!ue(e)&&!re(e)){c=jn(u,{env:a,dynamic_scope:i,error:o});if(ce(c)){return c.then(function(e){c=e;return n()})}else{return n()}}else{return c}}return E(e,t)}()}),"(while cond . body)\n\n Macro that create a loop, it exectue body untill cond expression is false"),if:N(new ie("if",function(t,e){var r=e.dynamic_scope,i=e.error;if(r){r=this}var o=this;var n=function e(n){if(n){return jn(t.cdr.car,{env:o,dynamic_scope:r,error:i})}else{return jn(t.cdr.cdr.car,{env:o,dynamic_scope:r,error:i})}};var a=jn(t.car,{env:o,dynamic_scope:r,error:i});return E(a,n)}),"(if cond true-expr false-expr)\n\n Macro evaluate condition expression and if the value is true, it\n evaluate and return true expression if not it evaluate and return\n false expression"),letrec:N(_e(Symbol["for"]("letrec")),"(letrec ((a value-a) (b value-b)) body)\n\n Macro that creates new environment, then evaluate and assign values to\n names and then evaluate the body in context of that environment.\n Values are evaluated sequentialy and next value can access to\n previous values/names."),"let*":N(_e(Symbol["for"]("let*")),"(let* ((a value-a) (b value-b)) body)\n\n Macro similar to `let` but next argument get environment\n from previous let variable, so they you can define one variable,\n and use in next argument."),let:N(_e(Symbol["for"]("let")),"(let ((a value-a) (b value-b)) body)\n\n Macro that creates new environment, then evaluate and assign values to\n names and then evaluate the body in context of that environment.\n Values are evaluated sequentialy but you can't access\n previous values/names when next are evaluated. You can only get them\n from body of let expression."),"begin*":N(xe("begin*",function(e){return e.pop()}),"(begin* . expr)\n\n This macro is parallel version of begin. It evaluate each expression and\n if it's a promise it will evaluate it in parallel and return value\n of last expression."),begin:N(new ie("begin",function(e,n){var r=Object.assign({},n);var i=this.get("list->array")(e);if(r.dynamic_scope){r.dynamic_scope=this}r.env=this;var o;return function n(){if(i.length){var e=i.shift();var t=jn(e,r);return E(t,function(e){o=e;return n()})}else{return o}}()}),"(begin . args)\n\n Macro runs list of expression and return valuate of the list one.\n It can be used in place where you can only have single exression,\n like if expression."),ignore:new ie("ignore",function(e,n){var t=n.dynamic_scope,r=n.error;var i={env:this,error:r};if(t){i.dynamic_scope=this}jn(new Q(new U("begin"),e),i)},"(ignore expression)\n\n Macro that will evaluate expression and swallow any promises that may\n be created. It wil run and ignore any value that may be returned by\n expression. The code should have side effects and/or when it's promise\n it should resolve to undefined."),define:N(ie.defmacro("define",function(n,e){var t=this;if(n.car instanceof Q&&n.car.car instanceof U){var r=new Q(new U("define"),new Q(n.car.car,new Q(new Q(new U("lambda"),new Q(n.car.cdr,n.cdr)))));return r}else if(e.macro_expand){return}if(e.dynamic_scope){e.dynamic_scope=this}e.env=t;var i=n.cdr.car;if(i instanceof Q){i=jn(i,e)}else if(i instanceof U){i=t.get(i)}if(n.car instanceof U){E(i,function(e){t.set(n.car,e)})}}),"(define name expression)\n (define (function-name . args) body)\n\n Macro for defining values. It can be used to define variables,\n or function. If first argument is list it will create function\n with name beeing first element of the list. The macro evalute\n code `(define function (lambda args body))`"),"set-obj!":N(function(e,n,t){var r=Dn(e);if(ue(e)||r!=="object"&&r!=="function"){var i=gn("set-obj!",_n(e),["object","function"]);throw new Error(i)}pe(e)[n]=t.valueOf()},"(set-obj! obj key value)\n\n Function set property of JavaScript object"),"current-environment":N(function(){if(this.name==="__frame__"){return this.parent}return this},"(current-environment)\n\n Function return current environement."),eval:N(function(e,t){var r=this;bn("eval",e,["symbol","pair","array"]);t=t||this;if(e instanceof U){return t.get(e)}if(e instanceof Q){return jn(e,{env:t,error:function e(n){r.get("error")(n.message);if(n.code){var t=n.code.map(function(e,n){return"[".concat(n+1,"]: ").concat(e)}).join("\n");r.get("error")(t)}}})}if(e instanceof Array){var i=this.get("eval");return e.reduce(function(e,n){return i(n,t)})}},"(eval list)\n\n Function evalute LIPS code as list structure."),lambda:new ie("lambda",function(f){var e=arguments.length>1&&arguments[1]!==g?arguments[1]:{},l=e.dynamic_scope,p=e.error;var h=this;var d;if(f.cdr instanceof Q&&Me.isString(f.cdr.car)){d=f.cdr.car.valueOf()}function v(){var e;if(l){if(!(this instanceof ln)){e=h}else{e=this}}else{e=h}e=e.inherit("lambda");var n=f.car;var t=0;var r;if(typeof this!=="undefined"){e.set("this",this)}for(var i=arguments.length,o=new Array(i),a=0;a2&&arguments[2]!==g?arguments[2]:u;if(e instanceof Q&&!re(e)){var r=e.car;var i=e.cdr;if(t(r)){r=n(r)}if(t(i)){i=n(i)}if(ce(r)||ce(i)){return Promise.all([r,i]).then(function(e){var n=Bn(e,2),t=n[0],r=n[1];return new Q(t,r)})}else{return new Q(r,i)}}return e}function s(e,n){if(e instanceof Q){if(re(e)&&n===z){return z}e.append(n)}else{e=new Q(e,n)}return e}function f(r,e,n){if(er){throw new Error("You can't call `unquote` outside "+"of quasiquote")}if(t.cdr instanceof Q){if(t.cdr.cdr!==z){if(t.cdr.car instanceof Q){return E(p(t.cdr.cdr,n,r),function(e){var n=jn(t.cdr.car,{env:a,dynamic_scope:i,error:o});return new Q(n,e)})}else{return t.cdr}}else{return jn(t.cdr.car,{env:a,dynamic_scope:i,error:o})}}else{return t.cdr}}return c(t,function(e){return p(e,n,r)})}return t}function t(e){if(e instanceof Q){delete e.data;if(!e.haveCycles("car")){t(e.car)}if(!e.haveCycles("cdr")){t(e.cdr)}}}var r=p(e.car,0,1);return E(r,function(e){t(e);return hn(e)})},"(quasiquote list ,value ,@value)\n\n Similar macro to `quote` but inside it you can use special\n expressions unquote abbreviated to , that will evaluate expresion inside\n and return its value or unquote-splicing abbreviated to ,@ that will\n evaluate expression but return value without parenthesis (it will join)\n the list with its value. Best used with macros but it can be used outside"),clone:N(function(e){bn("clone",e,"pair");return e.clone()},"(clone list)\n\n Function return clone of the list."),append:N(function(e,n){bn("append",e,"pair");return this.get("append!")(e.clone(),n)},"(append list item)\n\n Function will create new list with value appended to the end. It return\n New list."),"append!":N(function(e,n){bn("append!",e,"pair");if(ue(n)||re(n)){return e}return e.append(n)},"(append! name expression)\n\n Destructive version of append, it modify the list in place. It return\n original list."),reverse:N(function(e){bn("reverse",e,["array","pair"]);if(e instanceof Q){var n=this.get("list->array")(e).reverse();return this.get("array->list")(n)}else if(!(e instanceof Array)){throw new Error(gn("reverse",_n(e),"array or pair"))}else{return e.reverse()}},"(reverse list)\n\n Function will reverse the list or array. If value is not a list\n or array it will throw exception."),nth:N(function(e,n){bn("nth",e,"number");bn("nth",n,["array","pair"]);if(n instanceof Q){var t=n;var r=0;while(rarray")(n).join(e)},"(join separator list)\n\n Function return string by joining elements of the list"),split:N(function(e,n){bn("split",e,["regex","string"]);bn("split",n,"string");return this.get("array->list")(n.split(e))},"(split separator string)\n\n Function create list by splitting string by separatar that can\n be a string or regular expression."),replace:N(function(e,n,t){bn("replace",e,["regex","string"]);bn("replace",n,["string","function"]);bn("replace",t,"string");return t.replace(e,n)},"(replace pattern replacement string)\n\n Function change pattern to replacement inside string. Pattern can be string\n or regex and replacement can be function or string."),match:N(function(e,n){bn("match",e,["regex","string"]);bn("match",n,"string");var t=n.match(e);return t?this.get("array->list")(t):z},"(match pattern string)\n\n function return match object from JavaScript as list."),search:N(function(e,n){bn("search",e,["regex","string"]);bn("search",n,"string");return n.search(e)},"(search pattern string)\n\n Function return first found index of the pattern inside a string"),repr:N(function n(e,t){if(typeof jQuery!=="undefined"&&e instanceof jQuery.fn.init){return"<#jQuery("+e.length+")>"}if(e===true){return"#t"}if(e===false){return"#f"}if(e instanceof Ge){return e.toString()}if(typeof e==="undefined"){return"<#undefined>"}var r=[RegExp,G,U,Q,Ce];for(var i=0,o=r;i"}return"<#function>"}if(e instanceof Array){return"#("+e.map(function(e){return n(e,true)}).join(" ")+")"}if(e instanceof Me){e=e.toString()}if(e===null||typeof e==="string"&&t){return JSON.stringify(e).replace(/\\n/g,"\n")}if(f.HTMLElement&&e instanceof f.HTMLElement){return"<#HTMLElement(".concat(e.tagName.toLowerCase(),")>")}if(Dn(e)==="object"){var u=e.constructor;var c;if(typeof u.__className==="string"){c=u.__className}else if(_n(e)==="instance"){c="instance"}else{c=u.name}if(c!==""){return"<#"+c+">"}return"<#Object>"}if(typeof e!=="string"){return e.toString()}return e},"(repr obj)\n\n Function return string LIPS representation of an object as string."),env:N(function(e){e=e||this;var n=Object.keys(e.env);var t;if(n.length){t=Q.fromArray(n)}else{t=z}if(e.parent!==g){return this.get("env").call(this,e.parent).append(t)}return t},"(env obj)\n\n Function return list values (functions and variables) inside environment."),new:N(function(e){if(typeof e==="function"){e=pe(e)}for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;rlist":N(function(e){bn("array->list",e,"array");return Q.fromArray(e)},"(array->list array)\n\n Function convert JavaScript array to LIPS list."),"tree->array":N(X("tree->array",true),"(tree->array list)\n\n Function convert LIPS list structure into JavaScript array."),"list->array":N(X("list->array"),"(list->array list)\n\n Function convert LIPS list into JavaScript array."),apply:N(function(e,n){bn("apply",e,"function",1);bn("apply",n,"pair",2);return e.apply(void 0,Tn(this.get("list->array")(n)))},"(apply fn list)\n\n Function that call function with list of arguments."),length:N(function(e){if(!e){return Ge(0)}if(e instanceof Q){return Ge(e.length())}if("length"in e){return Ge(e.length)}},"(length expression)\n\n Function return length of the object, the object can be list\n or any object that have length property."),"string->number":N(function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:10;bn("string->number",e,"string",1);bn("string->number",n,"number",2);if(e.match(i)){return Ge(parseInt(e,n))}else if(e.match(o)){return Ge(parseFloat(e))}return Ge(parseInt(e,n))},"(string->number number [radix])\n\n Function convert string to number."),try:N(new ie("try",function(o,e){var a=this;var u=e.dynamic_scope,c=e.error;return new Promise(function(i){var e={env:a,error:function e(n){if(n instanceof fn){throw new fn(n.message)}var t=a.inherit("try");t.set(o.cdr.car.cdr.car.car,n);var r={env:t,error:c};if(u){r.dynamic_scope=a}E(jn(new Q(new U("begin"),o.cdr.car.cdr.cdr),r),function(e){i(e)});throw new fn(n.message)}};if(u){e.dynamic_scope=a}var n=jn(o.car,e);if(ce(n)){n["catch"](e.error).then(i)}else{i(n)}})}),"(try expr (catch (e) code)"),throw:N(function(e){throw new Error(e)},"(throw string)\n\n Throw new expection."),find:N(function n(t,r){bn("find",t,["regex","function"]);bn("find",r,"pair");if(ue(r)){return z}var e=A("find",t);return E(e(r.car),function(e){if(e&&e!==z){return r.car}return n(t,r.cdr)})},"(find fn list)\n (find regex list)\n\n Higher order Function find first value for which function return true.\n If called with regex it will create matcher function."),"for-each":N(function(e){var n;bn("for-each",e,"function");for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?n-1:0),o=1;o3?r-3:0),o=3;o3?i-3:0),a=3;aarray")(n);var o=[];var a=A("filter",e);return function n(t){function e(e){if(e&&e!==z){o.push(r)}return n(++t)}if(t===i.length){return Q.fromArray(o)}var r=i[t];return E(a(r,t),e)}(0)},"(filter fn list)\n (filter regex list)\n\n Higher order function that call `fn` for each element of the list\n and return list for only those elements for which funtion return\n true value. If called with regex it will create matcher function."),range:N(function(e){bn("range",e,"number");if(e instanceof Ge){e=e.valueOf()}return Q.fromArray(new Array(e).fill(0).map(function(e,n){return Ge(n)}))},"(range n)\n\n Function return list of n numbers from 0 to n - 1"),compose:N(je,"(compose . fns)\n\n Higher order function and create new function that apply all functions\n From right to left and return it's value. Reverse of compose.\n e.g.:\n ((compose (curry + 2) (curry * 3)) 3)\n 11\n "),pipe:N(Oe,"(pipe . fns)\n\n Higher order function and create new function that apply all functions\n From left to right and return it's value. Reverse of compose.\n e.g.:\n ((pipe (curry + 2) (curry * 3)) 3)\n 15"),curry:N(qe,"(curry fn . args)\n\n Higher order function that create curried version of the function.\n The result function will have parially applied arguments and it\n will keep returning functions until all arguments are added\n\n e.g.:\n (define (add a b c d) (+ a b c d))\n (define add1 (curry add 1))\n (define add12 (add 2))\n (display (add12 3 4))"),gdc:N(function e(){for(var n=arguments.length,t=new Array(n),r=0;ro?u%=o:o%=u}u+=o}return Ge(u)},"(gdc n1 n2 ...)\n\n Function return the greatest common divisor of their arguments."),lcm:N(function(){var e=arguments.length,n=Z(arguments.length<=0?g:arguments[0]);for(var t=1;tr?n%=r:r%=n}n=Z(i*(t<0||arguments.length<=t?g:arguments[t]))/(n+r)}return Ge(n)},"(lcm n1 n2 ...)\n\n Function return the least common multiple of their arguments."),odd:N(Ee(function(e){return Ge(e).isOdd()}),"(odd number)\n Function check if number os odd."),even:N(Ee(function(e){return Ge(e).isEvent()}),"(even number)\n\n Function check if number is even."),"*":N(Ne(function(e,n){return Ge(e).mul(n)}),"(* . numbers)\n\n Multiplicate all numbers passed as arguments. If single value is passed\n it will return that value."),"+":N(Ne(function(e,n){return Ge(e).add(n)}),"(+ . numbers)\n\n Sum all numbers passed as arguments. If single value is passed it will\n return that value."),"-":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t x1 x2 x3 ...)\n\n Function compare its numerical arguments and check if they are\n monotonically increasing"),"<":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t=":N(function(){for(var e=arguments.length,n=new Array(e),t=0;t= x1 x2 x3 ...)\n\n Function compare its numerical arguments and check if they are\n monotonically nondecreasing"),"eq?":N(ne,"(eq? a b)\n\n Function compare two values if they are identical."),or:N(new ie("or",function(e,n){var i=n.dynamic_scope,o=n.error;var a=this.get("list->array")(e);var u=this;if(i){i=u}var c;return function n(){function e(e){c=e;if(c){return c}else{return n()}}var t=a.shift();if(typeof t==="undefined"){if(c){return c}else{return false}}else{var r=jn(t,{env:u,dynamic_scope:i,error:o});return E(r,e)}}()}),"(or . expressions)\n\n Macro execute the values one by one and return the one that is truthy value.\n If there are no expression that evaluate to true it return false."),and:N(new ie("and",function(e){var n=arguments.length>1&&arguments[1]!==g?arguments[1]:{},i=n.dynamic_scope,o=n.error;var a=this.get("list->array")(e);var u=this;if(i){i=u}if(!a.length){return true}var c;return function n(){function e(e){c=e;if(!c){return false}else{return n()}}var t=a.shift();if(typeof t==="undefined"){if(c){return c}else{return false}}else{var r=jn(t,{env:u,dynamic_scope:i,error:o});return E(r,e)}}()}),"(and . expressions)\n\n Macro evalute each expression in sequence if any value return false it will\n return false. If each value return true it will return the last value.\n If it's called without arguments it will return true."),"|":N(function(e,n){return Ge(e).or(n)},"(& a b)\n\n Function calculate or bit operation."),"&":N(function(e,n){return Ge(e).and(n)},"(& a b)\n\n Function calculate and bit operation."),"~":N(function(e){return Ge(e).neg()},"(~ number)\n\n Function negate the value."),">>":N(function(e,n){return Ge(e).shr(n)},"(>> a b)\n\n Function right shit the value a by value b."),"<<":N(function(e,n){return Ge(e).shl(n)},"(<< a b)\n\n Function left shit the value a by value b."),not:N(function(e){if(re(e)){return true}return!e},"(not object)\n\n Function return negation of the argument."),"->":N(function(e,n){for(var t=arguments.length,r=new Array(t>2?t-2:0),i=2;i obj name . args)\n\n Function get function from object and call it with arguments.")},g,"global");(function(){var e={ceil:"ceiling"};["floor","round","ceil"].forEach(function(n){var t=e[n]?e[n]:n;vn.set(t,N(function(e){bn(t,e,"number");if(e instanceof Ge){return e[n]()}},"(".concat(t," number)\n\n Function calculate ").concat(t," of a number.")))})})();function mn(e){if(e.length===1){return e[0]}else{var n=[];var t=mn(e.slice(1));for(var r=0;r3&&arguments[3]!==g?arguments[3]:null;var i=e?" in function `".concat(e,"`"):"";if(r!==null){i+=" argument ".concat(r)}if(t instanceof Array){var o=t[t.length-1];t=t.slice(0,-1).join(", ")+" or "+o}return"Expecting ".concat(t," got ").concat(n).concat(i)}function bn(e,n,t){var r=arguments.length>3&&arguments[3]!==g?arguments[3]:null;var i=_n(n).toLowerCase();var o=false;if(t instanceof Array){t=t.map(function(e){return e.valueOf().toLowerCase()});if(t.includes(i)){o=true}}else{t=t.valueOf().toLowerCase()}if(!o&&i!==t){throw new Error(gn(e,i,t,r))}}function wn(e){var n=Dn(e);return["string","function"].includes(n)||e instanceof U||e instanceof Ge||e instanceof RegExp}function _n(e){var n={pair:Q,symbol:U,macro:ie,string:Me,array:Array,"native-symbol":Symbol};if(e===z){return"nil"}if(e===null){return"null"}for(var t=0,r=Object.entries(n);t1&&arguments[1]!==g?arguments[1]:{},i=e.env,o=e.dynamic_scope,t=e.error,a=t===void 0?function(){}:t;try{if(o===true){i=o=i||vn}else if(i===true){i=o=vn}else{i=i||vn}var r={env:i,dynamic_scope:o,error:a};var u;if(ue(n)){return n}if(re(n)){return V()}if(n instanceof U){return i.get(n)}var c=n.car;var s=n.cdr;if(c instanceof Q){u=xn(jn(c,r));if(ce(u)){return u.then(function(e){return jn(new Q(e,n.cdr),r)})}else if(typeof u!=="function"){throw new Error(_n(u)+" "+i.get("repr")(u)+" is not a function while evaluating "+n.toString())}}if(c instanceof U){u=i.get(c);if(u instanceof ie){var f=On(u,s,r);return E(f,function(e){if(e instanceof Q){e.markCycles();return e}return e})}else if(typeof u!=="function"){if(u){var l="".concat(_n(u)," `").concat(u,"' is not a function");throw new Error(l)}throw new Error("Unknown function `".concat(c.name,"'"))}}else if(typeof c==="function"){u=c}if(typeof u==="function"){var p=kn(s,r);return E(p,function(e){if(de(u)){e=e.map(fe)}if(u.__lambda__){u=pe(u)}var n=e.slice();var t=(o||i).newFrame(u,n);var r=xn(u.apply(t,e));return E(r,function(e){if(U.is(c,"new")){console.log({result:e})}if(e instanceof Q){e.markCycles();return hn(e)}if(typeof e==="number"){return Ge(e)}if(typeof e==="string"){return Me(e)}return e},a)})}else if(n instanceof U){u=i.get(n);if(u==="undefined"){throw new Error("Unbound variable `"+n.name+"'")}return u}else if(n instanceof Q){u=c&&c.toString();throw new Error("".concat(_n(c)," ").concat(u," is not a function"))}else{return n}}catch(e){a&&a(e,n)}}function Sn(e,n,t){return Fn.apply(this,arguments)}function Fn(){Fn=Mn(Cn.mark(function e(t,r,i){var o,a,u,c;return Cn.wrap(function e(n){while(1){switch(n.prev=n.next){case 0:if(i===true){r=i=r||vn}else if(r===true){r=i=vn}else{r=r||vn}o=F(t);a=[];case 3:u=o.shift();if(u){n.next=9;break}return n.abrupt("return",a);case 9:n.next=11;return jn(u,{env:r,dynamic_scope:i,error:function e(n,t){if(t){if(!(n.code instanceof Array)){n.code=[]}n.code.push(t.toString())}throw n}});case 11:c=n.sent;a.push(c);case 13:n.next=3;break;case 15:case"end":return n.stop()}}},e)}));return Fn.apply(this,arguments)}function En(n){return function(e){if(!e){return false}return(typeof e==="string"?e:e.token).match(n)}}var An=En(/[()]/);function Nn(e){var n=typeof e==="string"?j(e):e;var t=n.filter(An);var r=t.filter(function(e){return(e.token||e)===")"});var i=t.filter(function(e){return(e.token||e)==="("});return r.length===i.length}Q.unDry=function(e){return new Q(e.car,e.cdr)};Q.prototype.toDry=function(){return{value:{car:this.car,cdr:this.cdr}}};G.prototype.toDry=function(){return{value:null}};G.unDry=function(){return z};U.prototype.toDry=function(){return{value:{name:this.name}}};U.unDry=function(e){return new U(e.name)};function qn(e){console.error(e.message||e);if(e.code){console.error(e.code.map(function(e,n){return"[".concat(n+1,"]: ").concat(e)}))}}function In(){var i=["text/x-lips","text/x-scheme"];if(window.document){var o=Array.from(document.querySelectorAll("script"));return function n(){var e=o.shift();if(e){var t=e.getAttribute("type");if(i.includes(t)){var r=e.getAttribute("src");if(r){return f.fetch(r).then(function(e){return e.text()}).then(Sn).then(n)["catch"](function(e){qn(e);n()})}else{return Sn(e.innerHTML).then(n)["catch"](function(e){qn(e);n()})}}else if(t&&t.match(/lips|lisp/)){console.warn("Expecting "+i.join(" or ")+" found "+t)}return n()}}()}}if(typeof window!=="undefined"){e(window,In)}M.__className="ahead";R.__className="pattern";C.__className="formatter";ie.__className="macro";ln.__className="environment";rn.__className="input-port";on.__className="output-port";an.__className="output-string-port";un.__className="input-string-port";var Ln={version:"0.20.1",banner:n,date:"Thu, 02 Apr 2020 06:52:35 +0000",exec:Sn,parse:F,tokenize:j,evaluate:jn,Environment:ln,global_environment:vn,globalEnvironment:vn,env:vn,balanced_parenthesis:Nn,balancedParenthesis:Nn,Macro:ie,quote:hn,Pair:Q,InputPort:rn,OutputPort:on,InputStringPort:un,OutputStringPort:an,Formatter:C,specials:S,nil:z,resolvePromises:xn,LSymbol:U,LNumber:Ge,LFloat:Qe,LComplex:ze,LRational:Ze,LBigInteger:en,Character:Ce,LString:Me,rationalize:Ke};vn.set("lips",Ln);return Ln})})(); \ No newline at end of file diff --git a/node-gtk/package-lock.json b/node-gtk/package-lock.json new file mode 100644 index 00000000..609a5c49 --- /dev/null +++ b/node-gtk/package-lock.json @@ -0,0 +1,1107 @@ +{ + "name": "gtk-lips", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@octokit/rest": { + "version": "15.18.3", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-15.18.3.tgz", + "integrity": "sha512-oHABAvvC83tPIuvUfWRaw9eLThFrCxBgywl+KvEwfTFjoCrMOfEaMh0r39+Ub/EEbV345GJiMzN+zPZ4kqOvbA==", + "requires": { + "before-after-hook": "^1.1.0", + "btoa-lite": "^1.0.0", + "debug": "^3.1.0", + "http-proxy-agent": "^2.1.0", + "https-proxy-agent": "^2.2.0", + "lodash": "^4.17.4", + "node-fetch": "^2.1.1", + "universal-user-agent": "^2.0.0", + "url-template": "^2.0.8" + } + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "ajv": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "before-after-hook": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-1.4.0.tgz", + "integrity": "sha512-l5r9ir56nda3qu14nAXIlyq1MmUSs0meCIaFAh8HwkFwP1F8eToOuS3ah2VAHHcY04jaYD7FpJC5JTXHYRbkzg==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "requires": { + "es6-promise": "^4.0.3" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "requires": { + "minipass": "^2.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, + "http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "requires": { + "agent-base": "4", + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-proxy-agent": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" + }, + "macos-release": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz", + "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==" + }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "requires": { + "mime-db": "1.43.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "requires": { + "minimist": "^1.2.5" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + }, + "needle": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.3.tgz", + "integrity": "sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw==", + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "node-gtk": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/node-gtk/-/node-gtk-0.3.0.tgz", + "integrity": "sha512-eHy4C/5oAgJXQctz57s4DUqs1NhrQHKQVGU8d/EY2ySOEAOJ4cJkp6OeItz3hbgVdggo+PIitKTWA0CxOAM7UQ==", + "requires": { + "lodash.camelcase": "4.3.0", + "nan": "2.14.0", + "node-gyp": "^4.0.0", + "node-pre-gyp": "^0.13.0", + "node-pre-gyp-github": "^1.4.3" + } + }, + "node-gyp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-4.0.0.tgz", + "integrity": "sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA==", + "requires": { + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^4.4.8", + "which": "1" + } + }, + "node-pre-gyp": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.13.0.tgz", + "integrity": "sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==", + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + }, + "dependencies": { + "nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + } + } + }, + "node-pre-gyp-github": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/node-pre-gyp-github/-/node-pre-gyp-github-1.4.3.tgz", + "integrity": "sha512-tnJ0iZgzIZnZl7VBgebPYdzOe98dxMnQeDs6+yX1WVdt6IiWu0l4EYes3IY7ZIokRbtJ4iJjqwgGIyQrdfDJSg==", + "requires": { + "@octokit/rest": "^15.9.5", + "commander": "^2.17.0", + "mime-types": "^2.1.19" + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "requires": { + "abbrev": "1" + } + }, + "npm-bundled": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==" + }, + "npm-packlist": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "os-name": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", + "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", + "requires": { + "macos-release": "^2.2.0", + "windows-release": "^3.1.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "tar": { + "version": "4.4.13", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "universal-user-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.1.0.tgz", + "integrity": "sha512-8itiX7G05Tu3mGDTdNY2fB4KJ8MgZLS54RdG6PkkfwMAavrXu1mV/lls/GABx9O3Rw4PnTtasxrvbMQoBYY92Q==", + "requires": { + "os-name": "^3.0.0" + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "windows-release": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz", + "integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==", + "requires": { + "execa": "^1.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } + } +} diff --git a/node-gtk/package.json b/node-gtk/package.json new file mode 100644 index 00000000..3fc53b0e --- /dev/null +++ b/node-gtk/package.json @@ -0,0 +1,15 @@ +{ + "name": "gtk-lips", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "Jakub T. Jankiewicz (https://jcubic.pl/jakub-jankiewicz/)", + "license": "ISC", + "dependencies": { + "node-gtk": "^0.3.0" + } +} diff --git a/node-gtk/run.js b/node-gtk/run.js new file mode 100755 index 00000000..02c288ff --- /dev/null +++ b/node-gtk/run.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node + +const gi = require('node-gtk') +Gtk = gi.require('Gtk', '3.0') + +gi.startLoop() +Gtk.init() + +const win = new Gtk.Window(); +win.on('destroy', () => Gtk.mainQuit()) +win.on('delete-event', () => false) + +win.setDefaultSize.call(win, 200, 80) +win.add.call(win, new Gtk.Label({ label: 'Hello Gtk+' })) + +win.showAll(); +Gtk.main(); diff --git a/node-gtk/run.scm b/node-gtk/run.scm new file mode 100755 index 00000000..0e99bc59 --- /dev/null +++ b/node-gtk/run.scm @@ -0,0 +1,21 @@ +#!/home/kuba/projects/jcubic/lips/bin/lips.js + +(define gi (require "node-gtk")) + +(define Gtk (gi.require "Gtk" "3.0")) + +(gi.startLoop) +(Gtk.init) + +(define win (new Gtk.Window)) +(win.on "destroy" (lambda () (Gtk.mainQuit))) +(win.on "delete-event" (lambda () false)) +(win.setDefaultSize 400 200) + +(define label (new Gtk.Label (make-object :label "Hello Scheme GTK+"))) + +(win.add label) +(display label.label) + +(win.showAll) +(Gtk.main) diff --git a/src/lips.js b/src/lips.js index 6594fa4f..7e83cfee 100644 --- a/src/lips.js +++ b/src/lips.js @@ -4225,6 +4225,10 @@ You can also use (help name) to display help for specic function or macro. Function return list values (functions and variables) inside environment.`), 'new': doc(function(obj, ...args) { + if (typeof obj === 'function') { + obj = unbind(obj); + } + console.log({ obj, args }); var instance = new (unbind(obj))(...args); Object.defineProperty(instance, '__instance__', { enumerable: false, @@ -5334,6 +5338,9 @@ You can also use (help name) to display help for specic function or macro. var scope = (dynamic_scope || env).newFrame(value, _args); var result = resolvePromises(value.apply(scope, args)); return unpromise(result, (result) => { + if (LSymbol.is(first, 'new')) { + console.log({ result }); + } if (result instanceof Pair) { result.markCycles(); return quote(result);