UNPKG

cumalis-lisp

Version:

A Scheme implementation written in Typescript.

1 lines 127 kB
var e=Object.defineProperty,r=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,i=(r,t,n)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,l=(e,r)=>{for(var t in r||(r={}))a.call(r,t)&&i(e,t,r[t]);if(n)for(var t of n(r))o.call(r,t)&&i(e,t,r[t]);return e},s=(e,n)=>r(e,t(n)),c=("undefined"!=typeof require&&require,(e,r,t)=>(i(e,"symbol"!=typeof r?r+"":r,t),t));const u="cumalis-lisp",m={quote:"'",quasiquote:"`",unquote:",","unquote-splicing":",@"},d=/^(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+$/,p={"":"\\a","\b":"\\b","\t":"\\t","\n":"\\n","\r":"\\r",'"':'\\"',"\\":"\\\\","|":"\\|"},f=e=>{let r="",t="";for(const n of e){const e=n.length>2&&0===n.indexOf('""')?n.replace(/^""/,"").replace(/""$/,""):n;r=r+(""===r||"("===t.slice(-1)||")"===n||Object.values(m).indexOf(t)>=0||/^#\d+=$/.test(t)&&"("===n?"":" ")+e,t=n}return r},b=e=>{const r=e=>{const t=[];for(const n of e)if("string"==typeof n)t.push(n);else if(n instanceof Array)if("string"==typeof n[0]&&Object.values(m).includes(n[0]))t.push(...r(n));else if("#"===n[0]||"#u8"===n[0]){if(2!==n.length||!(n[1]instanceof Array))throw new Error("Illegal token tree: #/#u8 must have only one token array");t.push(`${n[0]}(`),t.push(...r(n[1])),t.push(")")}else if("string"==typeof n[0]&&/^#\d+=/.exec(n[0])){if(2!==n.length)throw new Error("Illegal token tree: datum label must have the content");t.push(n[0],...r(n.splice(1)))}else t.push("("),t.push(...r(n)),t.push(")");return t};return r(e)},y=(e,r)=>{const{extended:t=!1,style:n="write",labels:a="cyclic",maxdepth:o=1/0}=null!=r?r:{},i=new Set,l=new Set,s=(e,r,n)=>{if(V.Object(e),!t&&r>o)return;if(!t&&("cyclic"===a&&n.has(e)||"shared"===a&&i.has(e)))return void l.add(e);i.add(e);const c=new Set(n);c.add(e),L.Pair(e)?(s(e[1],r+1,c),s(e[2],r+1,c)):L.Vector(e)&&e[1].forEach((e=>s(e,r+1,c)))};s(e,0,new Set);const c=new Map,u=(e,r,a=!1)=>{var i;if(V.Object(e),!t&&r>o)return"...";if(!a&&!t&&l.has(e)){if(c.has(e))return`#${c.get(e)}#`;{const t=c.size+1;c.set(e,t);return[`#${t}=`,u(e,r,!0)]}}switch(e[0]){case"<symbol>":return t||d.test(e[1])?e[1]:"|"+e[1].replace(/[\x00-\x1f\x7f"|\\]/g,(e=>{var r,t;return null!=(t=p[e])?t:`\\x${null==(r=e.codePointAt(0))?void 0:r.toString(16)}`}))+"|";case"<null>":return t?null:[];case"<string>":return t?e[1]:"display"!==n?'"'+e[1].replace(/[\x00-\x1f\x7f]"|\\/g,(e=>{var r,t;return null!=(t=p[e])?t:`\\x${null==(r=e.codePointAt(0))?void 0:r.toString(16)}`}))+'"':'""'+e[1]+'""';case"<number>":return t?S(e):`${e[1]}`;case"<boolean>":return t?e[1]:e[1]?"#t":"#f";case"<character>":if(t)return e[1];if("display"!==n){const[r]=null!=(i=Object.entries(de).find((([,r])=>r===e[1])))?i:[];return`#\\${null!=r?r:e[1]}`}return'""'+e[1]+'""';case"<vector>":return["#",[...e[1].map((e=>u(e,r+1)))]];case"<bytevector>":return["#u8",[...e[1].map((e=>`${e}`))]];case"<pair>":const[,a,o]=e;if("<null>"===o[0])return[u(a,r+1)];if("<pair>"!==o[0])return[u(a,r+1),".",u(o,r+1)];if("<symbol>"===a[0]&&m[a[1]]){const e=u(o,r+1);return e instanceof Array&&!L.Object(e)?[m[a[1]],...e]:[m[a[1]],e]}{const e=u(a,r+1),t=u(o,r+1);return t instanceof Array&&!L.Object(t)?[e,...t]:[e,".",t]}case"<js>":return t?["&",e[1]]:`#<$js[${null===e[1]?"null":typeof e[1]}]>`;case"<procedure>":return t?e:"built-in"===e[1]?`#<procedure[built-in/${e[2]}]>`:`#<procedure[${e[1]}]>`;default:return t?e:`#${e[0]}`}};return u(e,0)},h=e=>y(e,{extended:!0}),g=(e,r={})=>{try{const t=y(e,s(l({maxdepth:8},r),{extended:!1})),n=b([t]);return f(n)}catch(t){return"<!!WRITE-ERROR!!>"}},v=(e,r={})=>{const t=y(e,s(l({},r),{extended:!1}));if(!(t instanceof Array&&"begin"===t[0]))throw new Error('fromASTToText error: The top of AST is must be a "begin" expression.');const n=b(t.slice(1));return f(n)},S=e=>"number"==typeof e[1]?e[1]:"+inf.0"===e[1]?1/0:"-inf.0"===e[1]?-1/0:NaN,w=e=>A.Number(Number.isFinite(e)?Number.isNaN(e)?"+nan.0":e:e<0?"-inf.0":"+inf.0"),j=e=>e[2],x=e=>e[1],P=e=>e[2],E=e=>{const r=[];for(let t=e;t;t=P(t))r.push(t);return r},N=e=>e[1],I=e=>["#CALL-STACK#",{depth:0,env:{static:A.StaticNS({},null),dynamic:A.DynamicNS({},null)},expr:e,want:null,oper:null,args:null,before:null,after:null,handler:null,info:L.Pair(e)&&e[4]||null},null],B=(e,r,t={})=>{var n,a,o;const{env:i,handler:l,depth:s,info:c}=N(e);return["#CALL-STACK#",{depth:s+1,env:null!=(n=t.env)?n:i,expr:r,want:null,oper:null,args:null,before:null!=(a=t.before)?a:null,after:null!=(o=t.after)?o:null,handler:l,info:L.Pair(r)&&r[4]||c},e]},O=(e,r,t={})=>{var n,a,o;const{env:i,handler:l,depth:s,info:c,before:u,after:m}=N(e);return["#CALL-STACK#",{depth:s,env:null!=(n=t.env)?n:i,expr:r,want:null!=(a=t.want)?a:null,oper:null!=(o=t.oper)?o:null,args:null,before:void 0===t.before?u:t.before,after:void 0===t.after?m:t.after,handler:void 0!==t.handler?t.handler:l,info:L.Pair(r)&&r[4]||c},P(e)]},C=e=>[e[0],{},e],A={Symbol:(...e)=>["<symbol>",...e],String:(...e)=>["<string>",...e],Number:(...e)=>["<number>",...e],Boolean:(...e)=>["<boolean>",...e],Character:(...e)=>["<character>",...e],Pair:(e,r,t=!1,n)=>n?["<pair>",e,r,t,n]:["<pair>",e,r,t],Null:()=>["<null>"],Vector:(...e)=>["<vector>",...e],ByteVector:(...e)=>["<bytevector>",...e],EndOfFile:(...e)=>["<end-of-file>",...e],Procedure:(...e)=>["<procedure>",...e],Port:(...e)=>["<port>",...e],RecordType:(...e)=>["<record-type>",...e],Record:(...e)=>["<record>",...e],SyntaxRules:(...e)=>["<syntax-rules>",...e],Parameter:(...e)=>["<parameter>",...e],MultiValue:(...e)=>["<multi-value>",...e],Exception:(...e)=>["<exception>",...e],Undefined:(...e)=>["<undefined>",...e],Promise:(...e)=>["<promise>",...e],Error:(e,r,t=[])=>["<error>",e,r,t],Continuation:(...e)=>["<continuation>",...e],EnvironmentSpec:(...e)=>["<environment-spec>",...e],Library:(...e)=>["<library>",...e],JS:(...e)=>["<js>",...e],List:(...e)=>e.reverse().reduce(((e,r)=>["<pair>",r,e,!1]),["<null>"]),Suspend:(...e)=>["#SUSPEND#",...e],JSPromiseContinuation:(...e)=>["#JS-PROMISE-CONTINUATION#",...e],Exit:(...e)=>["#EXIT#",...e],StaticNS:(...e)=>["#STATIC-NS-STACK#",...e],DynamicNS:(...e)=>["#DYNAMIC-NS-STACK#",...e],HandlerStack:(...e)=>["#HANDLER-STACK#",...e]},$={Call:(e,...r)=>A.List(e,...r),CallBuiltIn:(e,...r)=>A.List(A.Procedure("built-in",e),...r),Lambda:(...e)=>L.List(e[0])?$.CallBuiltIn("lambda",...e):$.CallBuiltIn("lambda",H(e[0],e[1]),...e.slice(2)),CallThunk:(...e)=>$.Call($.CallBuiltIn("lambda",["<null>"],...e)),Begin:(...e)=>$.CallBuiltIn("begin",...e),Quote:e=>$.CallBuiltIn("quote",e),Set:(e,r)=>$.CallBuiltIn("set!",e,r),Raise:e=>$.CallBuiltIn("raise",e),RaiseContinuable:e=>$.CallBuiltIn("raise-continuable",e),Let:(e,...r)=>$.CallBuiltIn("let",A.List(...e.map((e=>A.List(...e)))),...r),If:(e,r,t)=>t?$.CallBuiltIn("if",e,r,t):$.CallBuiltIn("if",e,r),And:(...e)=>$.CallBuiltIn("and",...e),Or:(...e)=>$.CallBuiltIn("or",...e),Cond:(e,...r)=>$.CallBuiltIn("cond",e,...r),Case:(e,r)=>$.CallBuiltIn("case",e,A.List(...r.map((e=>A.List(...e))))),Define:(...e)=>$.CallBuiltIn("define",...e),DefineValues:(e,r)=>$.CallBuiltIn("define-values",L.List(e)?e:A.List(...e),r),Append:(...e)=>$.CallBuiltIn("append",...e),Cons:(...e)=>$.CallBuiltIn("cons",...e),Values:(...e)=>$.CallBuiltIn("values",...e),BeginIfMultiple:(...e)=>0===e.length?["<undefined>"]:1===e.length?e[0]:$.Begin(...e)},L={Symbol:e=>e instanceof Array&&"<symbol>"===e[0],String:e=>e instanceof Array&&"<string>"===e[0],Number:e=>e instanceof Array&&"<number>"===e[0],Boolean:e=>e instanceof Array&&"<boolean>"===e[0],Character:e=>e instanceof Array&&"<character>"===e[0],Pair:e=>e instanceof Array&&"<pair>"===e[0],Null:e=>e instanceof Array&&"<null>"===e[0],Vector:e=>e instanceof Array&&"<vector>"===e[0],ByteVector:e=>e instanceof Array&&"<bytevector>"===e[0],EndOfFile:e=>e instanceof Array&&"<end-of-file>"===e[0],Port:e=>e instanceof Array&&"<port>"===e[0],RecordType:e=>e instanceof Array&&"<record-type>"===e[0],Record:e=>e instanceof Array&&"<record>"===e[0],MultiValue:e=>e instanceof Array&&"<multi-value>"===e[0],SyntaxRules:e=>e instanceof Array&&"<syntax-rules>"===e[0],SyntaxRulePattern:e=>e instanceof Array&&"<syntax-rule-pattern>"===e[0],Parameter:e=>e instanceof Array&&"<parameter>"===e[0],EnvironmentSpec:e=>e instanceof Array&&"<environment-spec>"===e[0],Exception:e=>e instanceof Array&&"<exception>"===e[0],Undefined:e=>e instanceof Array&&"<undefined>"===e[0],Promise:e=>e instanceof Array&&"<promise>"===e[0],Error:e=>e instanceof Array&&"<error>"===e[0],Continuation:e=>e instanceof Array&&"<continuation>"===e[0],Library:e=>e instanceof Array&&"<library>"===e[0],JS:e=>e instanceof Array&&"<js>"===e[0],List:e=>L.Pair(e)||L.Null(e),Procedure:e=>e instanceof Array&&("<procedure>"===e[0]||"<continuation>"===e[0]||"<parameter>"===e[0]),Object:e=>e instanceof Array&&"string"==typeof e[0]&&/^<.*>/.test(e[0]),Evaluatable:e=>L.List(e)||L.Symbol(e),False:e=>L.Boolean(e)&&!1===e[1],RealNumber:e=>L.Number(e)&&"number"==typeof e[1],IntegerNumber:e=>L.Number(e)&&"number"==typeof e[1]&&Number.isInteger(e[1]),Objects:e=>e instanceof Array&&e.every((e=>L.Object(e))),Suspend:e=>e instanceof Array&&"#SUSPEND#"===e[0],JSPromiseContinuation:e=>e instanceof Array&&"#JS-PROMISE-CONTINUATION#"===e[0],Exit:e=>e instanceof Array&&"#EXIT#"===e[0],CallStack:e=>e instanceof Array&&"#CALL-STACK#"===e[0],SpecialObject:e=>e instanceof Array&&"string"==typeof e[0]&&/^#.+#$/.test(e[0]),Dictionary:e=>"object"==typeof e&&!!e&&e.constructor===Object,Stack:e=>e instanceof Array&&3===e.length&&"string"==typeof e[0]&&/^#.*-STACK#$/.test(e[0])},k=(e,r)=>(t,n)=>{if(!e(t))throw A.Error("domain-error",null!=n?n:r)},z=(e,r)=>(t,n)=>{if(!(t instanceof Array))throw A.Error("domain-error",null!=n?n:r);for(const a of t)if(!e(a))throw A.Error("domain-error",null!=n?n:r)},V={List:k(L.List,"A <pair> or <null> is expected."),Pair:k(L.Pair,"A <pair> is expected."),Symbol:k(L.Symbol,"A <symbol> is expected."),Number:k(L.Number,"A <number> is expected."),Boolean:k(L.Boolean,"A <boolean> is expected."),Object:k(L.Object,"A Scheme object is expected."),String:k(L.String,"A <string> is expected."),Vector:k(L.Vector,"A <vector> is expected."),ByteVector:k(L.ByteVector,"A <bytevector> is expected."),Character:k(L.Character,"A <character> is expected."),Promise:k(L.Promise,"A <promise> is expected."),Error:k(L.Error,"A <error> is expected."),Procedure:k(L.Procedure,"A <procedure> is expected."),SyntaxRules:k(L.SyntaxRules,"A <syntax-rules> is expected."),Parameter:k(L.Parameter,"A <parameter> is expected."),EnvironmentSpec:k(L.EnvironmentSpec,"A <environment-spec> is expected."),RecordType:k(L.RecordType,"A <record-type> is expected."),Record:k(L.Record,"A <record> is expected."),MultiValue:k(L.MultiValue,"A <multi-value> is expected."),Port:k(L.Port,"A <port> is expected."),Library:k(L.Library,"A <library> is expected."),Lists:z(L.List,"An array of <pair>/<null> is expected."),Pairs:z(L.Pair,"An array of <pair> is expected."),Symbols:z(L.Symbol,"An array of <symbol> is expected."),Numbers:z(L.Number,"An array of <number> is expected."),Booleans:z(L.Boolean,"An array of <boolean> is expected."),Objects:z(L.Object,"An array of Scheme object is expected."),Strings:z(L.String,"An array of <string> is expected."),Vectors:z(L.Vector,"An array of <vector> is expected."),ByteVectors:z(L.ByteVector,"An array of <bytevector> is expected."),Characters:z(L.Character,"An array of <character> is expected."),RealNumber:k(L.RealNumber,"A real <number> (not infinite, not NaN) is expected."),IntegerNumber:k(L.IntegerNumber,"A integer <number> is expected."),RealNumbers:z(L.RealNumber,"An array of real <number> is expected."),IntegerNumbers:z(L.IntegerNumber,"An array of integer <number> is expected.")},M=(e,r)=>{if(null==e)throw A.Error("program-error",null!=r?r:"Required object.")},q=e=>"object"==typeof e&&null!==e&&"Object"===e.constructor.name,T=e=>!!e&&"object"==typeof e&&e.language===u&&!!e.version&&(L.Object(e.content)||L.SpecialObject(e.content)),D=e=>!!e&&"object"==typeof e&&e.language===u&&"0.6.0"===e.version&&(L.Object(e.content)||L.SpecialObject(e.content)),R=e=>T(e)&&L.Suspend(e.content),Q=e=>e.content[2],U=e=>T(e)&&L.JSPromiseContinuation(e.content),F=U,J=e=>e.content[2],_=e=>e.content[3],X=e=>T(e)&&L.Exit(e.content),Z=e=>e.content[1],K=Object.prototype.hasOwnProperty,W=e=>{const r=new Set,t=e=>{if(L.Pair(e)){const[,n,a]=e;if(r.has(a))throw new Error("Circular list detected.");return r.add(a),[n,...t(L.List(a)?a:["<null>"])]}return[]};return t(e)},G=e=>{const r=new Set;return(e=>{const[,t,n]=e;if(L.Pair(n)){if(r.has(n))throw new Error("Circular list detected.");r.add(n);const[e,a]=G(n);return[[t,...e],a]}return[[t],n]})(e)},H=(e,r,t=!1,n)=>e.reverse().reduce(((r,a,o)=>n&&o===e.length-1?A.Pair(a,r,t,n):A.Pair(a,r,t)),r||["<null>"]),Y=(()=>{let e=0,r=0,t=0;return()=>"::"+"T-S-XXXXXXX".replace(/[TSX]/g,(n=>(r=Date.now(),"T"===n?`0000000000000${r.toString(16)}`.slice(-14):"S"===n?`000${(e===r?(e=r,t=0):t++).toString(16)}`.slice(-4):`000${(65536*Math.random()|0).toString(16)}`.slice(-4))))})(),ee=(e,r,t,n=!1,a=!1)=>{if(r.filter((e=>"variadic"===e.type)).length>1)throw new Error("Only one variadic parameter is allowed.");return{name:e,parameters:r,body:t,isMacro:n,hidden:a}},re=(e,r)=>s(l({},r),{name:e}),te=({name:e,parameters:r,body:t,isMacro:n,hidden:a})=>{const o=console;return{name:e,parameters:r,body:(a,i,l)=>{let s;o.log(`-----[Built-in Procedure Call "${e}"]-----\nIs${n?"":" NOT"} a macro procedure.\n-----[Parameters]-----\n`+r.map(((e,r)=>{const t=a[e.name];return L.Object(t)?`${r}:${e.name}: ${g(t,{maxdepth:20})}\n`:t instanceof Array?`${r}:${e.name}:length ${t.length}}\n`+t.map(((e,r)=>` [${r}]: ${g(e,{maxdepth:20})}\n`)).join(""):`${r}:${e.name}: ${t}\n`})).join("")+" --------------------------------------------\nCalling now...\n");try{s=t(a,i,l)}catch(c){throw o.log(`-----[Exception]-----\nException is${L.Object(c)?"":" NOT"} a LISP Object.\n`+(L.Object(c)?g(c,{maxdepth:20}):`${c}`)+"\n-----------------------"),c}return o.log(`-----[Return]-----\nReturn value is ${L.Object(s)?"":"NOT"} a LISP Object.\n`+(L.Object(s)?g(s,{maxdepth:20}):`${s}`)+"\n-----------------------"),s},isMacro:n,hidden:a}},ne=(e,r)=>e.length===r.length&&e.every(((e,t)=>e===r[t])),ae=e=>{var r,t;if(L.List(e)){if(L.Null(e))return[[],null];{const[t,n]=G(e);return V.Symbols(t),L.Null(n)||V.Symbol(n),[t.map((e=>{var r;return{name:null!=(r=e[3])?r:e[1]}})),L.Null(n)?null:{name:null!=(r=n[3])?r:n[1],type:"variadic"}]}}return V.Symbol(e),[[],{name:null!=(t=e[3])?t:e[1],type:"variadic"}]},oe=(e,r)=>{const t=new Set,n=new Set,a=e=>{var o,i;if(e instanceof Array&&e[0]===r){const e=new Error(`ReferenceTag "${r}" is already contained in the value.`);throw e.name="reference-tag",e}if("object"!=typeof e||null===e){if("number"!=typeof e||!Number.isNaN(e)&&Number.isFinite(e)){if(null===e||"boolean"==typeof e||"string"==typeof e||"number"==typeof e)return;throw new Error(`Unserializable object: <${typeof e}>`)}throw new Error("JSON can't contain Infinite/-Infinite/NaN")}{const r=null==(o=e.constructor)?void 0:o.name;if("Object"!==r&&"Array"!==r)throw new Error(`Unserializable object: <${typeof e} ${null==(i=e.constructor)?void 0:i.name}>`);t.has(e)?n.has(e)||n.add(e):(t.add(e),Object.keys(e).forEach((r=>a(e[r]))))}};a(e),t.clear();const o=new Map,i=(e,t=!1)=>!t&&o.has(e)?[r,o.get(e)]:!t&&n.has(e)?(o.set(e,o.size+1),[r,o.get(e),i(e,!0)]):e instanceof Array?e.map((e=>i(e))):"object"==typeof e&&null!==e?Object.keys(e).reduce(((r,t)=>(r[t]=i(e[t]),r)),{}):e,l=i(e);return n.clear(),o.clear(),JSON.stringify(l)},ie=(e,r)=>{const t=JSON.parse(e),n=new Map,a=e=>{e instanceof Array&&e[0]===r&&e.length>=3?(n.set(e[1],e[2]),Object.keys(e[2]).forEach((r=>a(e[2][r])))):"object"==typeof e&&null!==e&&Object.keys(e).forEach((r=>a(e[r])))};a(t);const o=e=>{if(e instanceof Array&&e[0]===r&&n.has(e[1])){if(e.length>=3){const r=e[2];if(r instanceof Array)return r.splice(0,r.length,...r.map((e=>o(e)))),r;{const e=Object.keys(r).reduce(((e,t)=>(e[t]=o(r[t]),e)),{});return Object.assign(r,e)}}return n.get(e[1])}return e instanceof Array?e.map((e=>o(e))):"object"==typeof e&&null!==e?Object.keys(e).reduce(((r,t)=>(r[t]=o(e[t]),r)),{}):e};return o(t)},le={"µ":"μ","ͅ":"ι","ς":"σ","ϐ":"β","ϑ":"θ","ϕ":"φ","ϖ":"π","ϰ":"κ","ϱ":"ρ","ϵ":"ε","ᏸ":"Ᏸ","ᏹ":"Ᏹ","ᏺ":"Ᏺ","ᏻ":"Ᏻ","ᏼ":"Ᏼ","ᏽ":"Ᏽ","ᲀ":"в","ᲁ":"д","ᲂ":"о","ᲃ":"с","ᲄ":"т","ᲅ":"т","ᲆ":"ъ","ᲇ":"ѣ","ᲈ":"ꙋ","ẛ":"ṡ","ι":"ι","ꭰ":"Ꭰ","ꭱ":"Ꭱ","ꭲ":"Ꭲ","ꭳ":"Ꭳ","ꭴ":"Ꭴ","ꭵ":"Ꭵ","ꭶ":"Ꭶ","ꭷ":"Ꭷ","ꭸ":"Ꭸ","ꭹ":"Ꭹ","ꭺ":"Ꭺ","ꭻ":"Ꭻ","ꭼ":"Ꭼ","ꭽ":"Ꭽ","ꭾ":"Ꭾ","ꮀ":"Ꮀ","ꮁ":"Ꮁ","ꮂ":"Ꮂ","ꮃ":"Ꮃ","ꮄ":"Ꮄ","ꮅ":"Ꮅ","ꮆ":"Ꮆ","ꮇ":"Ꮇ","ꮈ":"Ꮈ","ꮉ":"Ꮉ","ꮊ":"Ꮊ","ꮋ":"Ꮋ","ꮌ":"Ꮌ","ꮍ":"Ꮍ","ꮎ":"Ꮎ","ꮐ":"Ꮐ","ꮑ":"Ꮑ","ꮒ":"Ꮒ","ꮓ":"Ꮓ","ꮔ":"Ꮔ","ꮕ":"Ꮕ","ꮖ":"Ꮖ","ꮗ":"Ꮗ","ꮘ":"Ꮘ","ꮙ":"Ꮙ","ꮚ":"Ꮚ","ꮛ":"Ꮛ","ꮜ":"Ꮜ","ꮝ":"Ꮝ","ꮞ":"Ꮞ","ꮠ":"Ꮠ","ꮡ":"Ꮡ","ꮢ":"Ꮢ","ꮣ":"Ꮣ","ꮤ":"Ꮤ","ꮥ":"Ꮥ","ꮦ":"Ꮦ","ꮧ":"Ꮧ","ꮨ":"Ꮨ","ꮩ":"Ꮩ","ꮪ":"Ꮪ","ꮫ":"Ꮫ","ꮬ":"Ꮬ","ꮭ":"Ꮭ","ꮮ":"Ꮮ","ꮰ":"Ꮰ","ꮱ":"Ꮱ","ꮲ":"Ꮲ","ꮳ":"Ꮳ","ꮴ":"Ꮴ","ꮵ":"Ꮵ","ꮶ":"Ꮶ","ꮷ":"Ꮷ","ꮸ":"Ꮸ","ꮹ":"Ꮹ","ꮺ":"Ꮺ","ꮻ":"Ꮻ","ꮼ":"Ꮼ","ꮽ":"Ꮽ","ꮾ":"Ꮾ"},se=new RegExp("["+Object.keys(le).join("")+"]","gu"),ce=e=>e.replace(se,(e=>le[e])).toLowerCase(),ue=new RegExp("(?:"+[/\s+/.source,/;[^\n]*(?:\n|$)/.source,/(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+/.source,/\|(?:[^|\\]|\n|\\(?:.|\n))+\|/.source,/#!(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+/.source,/"(?:[^"\\]|\n|\\(?:.|\n))*"/.source,/(?:[()[\]{}'`]|,(?!@)|,@)/.source,/#(?:t(?:rue)?|f(?:alse)?|\(|u8\(|\d+[#=]|;)/.source,/#[dDbBoOxXeEiI](?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+/.source,/#\\(?:(?:[^A-Za-z]|\n)|[A-Za-z](?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])*)/.source,Array(16).fill(/#\|(?:[^|#]|\|[^#]|#[^|]|\n|(?:NEST))*\|#/.source).reduce(((e,r)=>e.replace("NEST",r)))].join("|")+")","y"),me={a:"",b:"\b",t:"\t",n:"\n",r:"\r"},de={alarm:"",backspace:"\b",delete:"",escape:"",newline:"\n",null:"\0",return:"\r",space:" ",tab:"\t"},pe=(e,r)=>{var t;const n=(e=>{const r=[0],t=/\n/g;for(let n;n=t.exec(e);)r.push(n.index+1);return t=>{var n;const a=r.filter((e=>e<=t)).slice(-1)[0],o=e.slice(a,t);return[r.indexOf(a)+1,o.length+(null!=(n=o.match(/[^\x01-\x7E\xA1-\xDF]/g))?n:[]).length+1]}})(e),a=[];ue.lastIndex=0;let o=!1;for(;ue.lastIndex<e.length;){const i=ue.lastIndex,[l,s]=n(i),c=r?{filename:r,line:l,column:s}:{line:l,column:s};let[u]=null!=(t=ue.exec(e))?t:[];if(null==u){const r=e.slice(i).split(/(\s|\n)+/,2)[0]||e[i],t=r.length>10?r.slice(0,10)+"...":r;throw new Error(`Tokenize failed. Unexpected token is: "${t}": ${JSON.stringify(c)}`)}"#!fold-case"!==u&&"#!no-fold-case"!==u?(o&&(u.match(/^(?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+$/)||u.match(/#\\(?:(?:[^A-Za-z]|\n)|[A-Za-z](?:[A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])*)/))&&(u=ce(u)),a.push([u,c])):o=!u.includes("#!no-")}return a},fe=e=>{const r=e.filter((e=>!e[0].match(/^(\s|;|#\||#!(no-)?fold-case)/))),t=()=>{const e=[];for(let n=r.shift();n;n=r.shift()){const[r,a]=n;if(!r.match(/^(\s|;|#\|)/))if("("===r)e.push(t().concat(a));else if(["#(","#u8("].includes(r))e.push([r.slice(0,-1),t(),a]);else{if(["'","`",",",",@","#;"].includes(r)||r.match(/^#\d+=$/)){const n=t(),o=n.shift();if(null==o)throw`Unexpected end of source after quoting/datum label "${r}": ${JSON.stringify(a)}`;return"#;"!==r&&e.push([r,o]),e.push(...n),e}if(")"===r)return e;e.push(r)}}return e};return[t(),r]},be=(e,r=null,t,n=new Map)=>{var a;if("string"==typeof e){let t;if(t=/^([+-])(nan|inf)\.0$/i.exec(e))return A.Number(t[0].toLowerCase());if(t=/^(?:#d)?[-+]?\d+(?:\.\d*)?(?:e[-+]?\d+)?$/i.exec(e))return w(Number(e.replace(/^(#d)?0*/i,"")));if(t=/^(?:#b[-+]?[01]+|#o[-+]?[0-7]+|#x[-+]?[0-9A-Fa-f]+)/i.exec(e))return w(Number(e.replace(/^#([xob])([+-]?)/i,"0$1"))*(e.includes("-")?-1:1));if(/^#[dboxei]/i.exec(e))throw new Error(`Unsupported type of number literal: ${e}: ${JSON.stringify(r)}`);if(t=/^"((?:.|\n)*)"$/.exec(e)){const e=t[1].replace(/\\(x[0-9a-fA-F]+;|[ \t]*\n[ \t]*|[^x \t\n])/g,(e=>{var r;return"x"===e[1]?String.fromCodePoint(Number(`0x${e.replace(/;$/,"").slice(2)}`)):/\s|\n/.test(e[1])?"":null!=(r=me[e[1]])?r:e[1]}));return A.String(e,!0)}if(t=/^#([tf])/.exec(e))return A.Boolean("t"===t[1]);if(t=/^#\\((.|\n)*)$/.exec(e)){const e=1===t[1].length?t[1]:t[1].match(/^x[0-9A-Fa-f]+$/)?String.fromCodePoint(Number(`0x${t[1].slice(1)}`)):de[t[1]];if(!e)throw new Error(`Illegal character literal: ${e}: ${JSON.stringify(r)}`);return A.Character(e)}if("."!==e&&(t=/^(([A-Za-z0-9]|[^\x00-\x7f]|[!$%&*+\-./:<=>?@^_~])+)$/.exec(e)))return A.Symbol(t[1]);if("."!==e&&(t=/^\|(([^\\]|\n|\\(.|\n))+)\|$/.exec(e))){const e=t[1].replace(/\\(x[0-9a-fA-F]+;|\s*\n\s*|[^x\s\n])/g,(e=>{var r;return"x"===e[1]?String.fromCodePoint(Number(`0x${e.replace(/;$/,"").slice(2)}`)):/\s|\n/.test(e[1])?"":null!=(r=me[e[1]])?r:e[1]}));return A.Symbol(e)}if(t=/^#(\d+)#$/.exec(e)){const a=t[1];if(!n.has(a))throw new Error(`Invalid datum reference (${e}): ${JSON.stringify(r)}`);return n.get(a)}throw new Error(`Parse error: unexpected token: "${e}": ${JSON.stringify(r)}`)}if(e instanceof Array&&"&"!==e[0]){r=null!=(a=e.find((e=>q(e))))?a:r;const o=e.filter((e=>!q(e)));if(0===o.length)return A.Null();if(2===o.length&&"."===o[0])return be(o[1],r,t,n);if("#"===o[0]){if(2!==o.length)throw new Error(`Illegal vector literal. No datum: ${JSON.stringify(r)}`);if(!(o[1]instanceof Array))throw new Error(`Illegal vector literal. Datum is not an array: ${JSON.stringify(r)}`);return A.Vector(o[1].map((e=>be(e,r,t,n))),!0)}if("#u8"===o[0]){if(2!==o.length)throw new Error(`Illegal byte vector literal. No datum: ${JSON.stringify(r)}`);if(!(o[1]instanceof Array))throw new Error(`Illegal byte vector literal. Byte vector must have an array: ${JSON.stringify(r)}`);const e=o[1].map((e=>be(e,r,t,n)));if(!e.every((e=>L.RealNumber(e)&&Number.isInteger(e[1])&&e[1]>=0&&e[1]<=255)))throw new Error(`Illegal byte vector literal. All the contents of a byte vector must be 0-255.: ${JSON.stringify(r)}`);return A.ByteVector(e.map(S),!0)}if("string"==typeof o[0]&&["'","`",",",",@"].includes(o[0])){if(2!==o.length)throw new Error(`Illegal quote "${o[0]}". Quoted item must be a datum: ${JSON.stringify(r)}`);const e={"'":"quote","`":"quasiquote",",":"unquote",",@":"unquote-splicing"}[o[0]];return A.Pair(A.Symbol(e),A.Pair(be(o[1],r,t,n),A.Null(),!0),!0,(null==t?void 0:t.removeLineInfo)?null:r)}if("string"==typeof o[0]&&/^#(\d+)=$/.exec(o[0])){const[,e]=/^#(\d+)=$/.exec(o[0]);if(2!==o.length)throw new Error(`Illegal datum label. No next datum: ${JSON.stringify(r)}`);const a=A.Symbol(o[0]);n.set(e,a);const i=be(o[1],r,t,n);return a.splice(0,a.length,...i),a}if((null==t?void 0:t.extended)&&L.Object(e))return e;if((null==t?void 0:t.extended)&&"&"===e[0]){if(2!=e.length)throw new Error(`Parse error: JS Node must be like ["&", <object>]: ${typeof e} value: ${e}`);return A.JS("inline",e[1])}return A.Pair(be(o[0],r,t,n),be(o.slice(1),r,t,n),!0,(null==t?void 0:t.removeLineInfo)?null:r)}if((null==t?void 0:t.extended)&&null===e)return A.Null();if((null==t?void 0:t.extended)&&"number"==typeof e)return w(e);if((null==t?void 0:t.extended)&&"boolean"==typeof e)return A.Boolean(e);throw new Error(`Parse error: unexpected node type: ${typeof e} value: ${e}`)},ye=(e,r=null,t)=>be(e,r,s(l({},null!=t?t:{}),{extended:!0})),he=(e,r)=>{const t=pe(e,null==r?void 0:r.filename),[n,a]=fe(t);if(a.length>0)throw new Error(`Parse error: extra tokens. (missing right curly?), ${JSON.stringify(a[0][1])}`);return be(["begin",...n],null,r)},ge=ee("not",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.False(e))))),ve=ee("boolean?",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.Boolean(e))))),Se=ee("boolean=?",[{name:"boolean1"},{name:"boolean2"},{name:"booleans",type:"variadic"}],(({boolean1:e,boolean2:r,booleans:t})=>(V.Boolean(e),V.Boolean(r),V.Booleans(t),A.Boolean([r,...t].every((r=>r[1]===e[1])))))),we={not:ge,booleanQ:ve,booleanEQ:Se},je=ee("bytevector?",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.ByteVector(e))))),xe=ee("make-bytevector",[{name:"k"},{name:"byte",type:"optional"}],(({k:e,byte:r})=>(V.IntegerNumber(e),r&&V.IntegerNumber(r),A.ByteVector(Array(e[1]).fill(r?r[1]:0),!1)))),Pe=ee("bytevector",[{name:"bytes",type:"variadic"}],(({bytes:e})=>(V.IntegerNumbers(e),A.ByteVector(e.map((e=>e[1])),!1)))),Ee=ee("bytevector-length",[{name:"bvec"}],(({bvec:e})=>(V.ByteVector(e),A.Number(e[1].length)))),Ne=ee("bytevector-u8-ref",[{name:"bvec"},{name:"k"}],(({bvec:e,k:r})=>{if(V.ByteVector(e),V.IntegerNumber(r),!(r[1]in e[1]))throw A.Error("out-of-range","Index is out of range.");return A.Number(e[1][r[1]])})),Ie=ee("bytevector-u8-set!",[{name:"bvec"},{name:"k"},{name:"byte"}],(({bvec:e,k:r,byte:t})=>{if(V.ByteVector(e),V.IntegerNumber(r),V.IntegerNumber(t),!(r[1]in e[1]))throw A.Error("out-of-range","Index is out of range.");return e[1][r[1]]=t[1],["<undefined>"]})),Be=ee("bytevector-copy",[{name:"bvec"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({bvec:e,start:r,end:t})=>{V.ByteVector(e);const n=e[1];if(0===n.length)return A.ByteVector([],!1);const a=L.Number(r)?r[1]:0,o=L.Number(t)?t[1]:n.length;if("number"!=typeof a||!Number.isInteger(a)||"number"!=typeof o||!Number.isInteger(o))throw A.Error("domain-error","Index must be integer.");return A.ByteVector(n.slice(a,o),!1)})),Oe=ee("bytevector-copy!",[{name:"to"},{name:"at"},{name:"from"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({to:e,at:r,from:t,start:n,end:a})=>{V.ByteVector(e),V.IntegerNumber(r),V.ByteVector(t);const o=L.Number(n)?n[1]:0,i=L.Number(a)?a[1]:t[1].length;if("number"!=typeof o||!Number.isInteger(o)||"number"!=typeof i||!Number.isInteger(i))throw A.Error("domain-error","Index must be integer.");if(!(r[1]in e[1]))throw A.Error("out-of-range","Index is out of range.");if(e[1].length-r[1]<i-o)throw A.Error("out-of-range","Index is out of range.");const l=t[1].slice(o,i);return e[1].splice(r[1],l.length,...l),["<undefined>"]})),Ce=ee("bytevector-append",[{name:"vecs",type:"variadic"}],(({vecs:e})=>(V.ByteVectors(e),A.ByteVector(e.map((e=>e[1])).flat(),!1)))),Ae=ee("utf8->string",[{name:"bvec"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({bvec:e,start:r,end:t})=>{V.ByteVector(e);const n=e[1],a=L.Number(r)?r[1]:0,o=L.Number(t)?t[1]:n.length;if("number"!=typeof a||!Number.isInteger(a)||"number"!=typeof o||!Number.isInteger(o))throw A.Error("domain-error","Index must be integer.");const i=new Uint8Array(n.slice(a,o));return A.String((new TextDecoder).decode(i),!1)})),$e=ee("string->utf8",[{name:"str"},{name:"start",type:"optional"},{name:"end",type:"optional"}],(({str:e,start:r,end:t})=>{V.String(e);const n=Array.from(e[1]),a=L.Number(r)?r[1]:0,o=L.Number(t)?t[1]:n.length;if("number"!=typeof a||!Number.isInteger(a)||"number"!=typeof o||!Number.isInteger(o))throw A.Error("domain-error","Index must be integer.");const i=(new TextEncoder).encode(n.slice(a,o).join(""));return A.ByteVector(Array.from(i),!1)})),Le={bytevectorQ:je,makeBytevector:xe,bytevector:Pe,bytevectorLength:Ee,bytevectorU8Ref:Ne,bytevectorU8SetD:Ie,bytevectorCopy:Be,bytevectorCopyD:Oe,bytevectorAppend:Ce,utf8ToString:Ae,stringToUtf8:$e},ke=ee("char?",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.Character(e))))),ze=ee("char=?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>(V.Character(e),V.Character(r),V.Characters(t),A.Boolean([r,...t].every((r=>r[1]===e[1])))))),Ve=ee("char<?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{V.Character(e),V.Character(r),V.Characters(t);const n=[e,r,...t].map((e=>e[1]));return A.Boolean(n.every(((e,r)=>0===r||n[r-1]<e)))})),Me=ee("char>?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{V.Character(e),V.Character(r),V.Characters(t);const n=[e,r,...t].map((e=>e[1]));return A.Boolean(n.every(((e,r)=>0===r||n[r-1]>e)))})),qe=ee("char<=?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{V.Character(e),V.Character(r),V.Characters(t);const n=[e,r,...t].map((e=>e[1]));return A.Boolean(n.every(((e,r)=>0===r||n[r-1]<=e)))})),Te=ee("char>=?",[{name:"char1"},{name:"char2"},{name:"chars",type:"variadic"}],(({char1:e,char2:r,chars:t})=>{V.Character(e),V.Character(r),V.Characters(t);const n=[e,r,...t].map((e=>e[1]));return A.Boolean(n.every(((e,r)=>0===r||n[r-1]>=e)))})),De=ee("char->integer",[{name:"char"}],(({char:e})=>{V.Character(e);const r=e[1].codePointAt(0);if(void 0===r)throw A.Error("out-of-range","Can't convert character to codepoint.");return A.Number(r)})),Re=ee("integer->char",[{name:"n"}],(({n:e})=>(V.IntegerNumber(e),A.Character(String.fromCodePoint(e[1]))))),Qe={charQ:ke,charEQ:ze,charLtQ:Ve,charGtQ:Me,charLeQ:qe,charGeQ:Te,charToInteger:De,integerToChar:Re},Ue=ee("procedure?",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.Procedure(e)))),!0),Fe=ee("apply",[{name:"proc"},{name:"args",type:"variadic"}],(({proc:e,args:r},t,n)=>{let a;if(V.Procedure(e),V.Objects(r),M(t),M(n),0===r.length)a=[];else{const[e,t]=[r.slice(0,r.length-1),r[r.length-1]];V.List(t),a=[...e,...W(t)]}return $.Call(e,A.MultiValue(a))}),!0),Je=ee("map",[{name:"proc"},{name:"list1"},{name:"lists",type:"variadic"}],(({proc:e,list1:r,lists:t})=>{V.Procedure(e),V.List(r),V.Lists(t);const n=[r,...t];return n.every((e=>L.Pair(e)))?$.Cons($.Call(e,A.MultiValue(n.map((e=>e[1])))),$.CallBuiltIn("map",A.MultiValue([e,...n.map((e=>e[2]))]))):$.Quote(["<null>"])}),!0),_e=ee("string-map",[{name:"proc"},{name:"str1"},{name:"strs",type:"variadic"}],(({proc:e,str1:r,strs:t})=>{V.Procedure(e),V.String(r),V.Strings(t);const n=[Array.from(r[1]),...t.map((e=>Array.from(e[1])))];return n.every((e=>e.length>1))?$.CallBuiltIn("string-append",$.CallBuiltIn("string",$.Call(e,...n.map((e=>A.Character(e[0]))))),$.CallBuiltIn("string-map",e,...n.map((e=>A.String(e.slice(1).join(""),!1))))):n.every((e=>e.length>=1))?$.CallBuiltIn("string",$.Call(e,...n.map((e=>A.Character(e[0]))))):A.String("",!1)}),!0),Xe=ee("vector-map",[{name:"proc"},{name:"vector1"},{name:"vectors",type:"variadic"}],(({proc:e,vector1:r,vectors:t})=>{V.Procedure(e),V.Vector(r),V.Vectors(t);const n=[r,...t];return n.every((e=>e[1].length>1))?$.CallBuiltIn("vector-append",$.CallBuiltIn("vector",$.Call(e,A.MultiValue(n.map((e=>e[1][0]))))),$.CallBuiltIn("vector-map",e,...n.map((e=>A.Vector(e[1].slice(1),!1))))):n.every((e=>e[1].length>=1))?$.CallBuiltIn("vector",$.Call(e,A.MultiValue(n.map((e=>e[1][0]))))):A.Vector([],!1)}),!0),Ze=ee("for-each",[{name:"proc"},{name:"list1"},{name:"lists",type:"variadic"}],(({proc:e,list1:r,lists:t})=>{V.Procedure(e),V.List(r),V.Lists(t);const n=[r,...t];return n.every((e=>L.Pair(e)))?$.Begin($.Call(e,A.MultiValue(n.map((e=>e[1])))),$.CallBuiltIn("for-each",A.MultiValue([e,...n.map((e=>e[2]))]))):["<undefined>"]}),!0),Ke=ee("string-for-each",[{name:"proc"},{name:"str1"},{name:"strs",type:"variadic"}],(({proc:e,str1:r,strs:t})=>{V.Procedure(e),V.String(r),V.Strings(t);const n=[Array.from(r[1]),...t.map((e=>Array.from(e[1])))];return n.every((e=>e.length>1))?$.Begin($.Call(e,...n.map((e=>A.Character(e[0])))),$.CallBuiltIn("string-for-each",e,...n.map((e=>A.String(e.slice(1).join(""),!1))))):n.every((e=>e.length>=1))?$.Call(e,...n.map((e=>A.Character(e[0])))):["<undefined>"]}),!0),We=ee("vector-for-each",[{name:"proc"},{name:"vector1"},{name:"vectors",type:"variadic"}],(({proc:e,vector1:r,vectors:t})=>{V.Procedure(e),V.Vector(r),V.Vectors(t);const n=[r,...t];return n.every((e=>e[1].length>1))?$.Begin($.Call(e,A.MultiValue(n.map((e=>e[1][0])))),$.CallBuiltIn("vector-for-each",e,...n.map((e=>A.Vector(e[1].slice(1),!1))))):n.every((e=>e[1].length>=1))?$.Call(e,A.MultiValue(n.map((e=>e[1][0])))):$.Quote(["<null>"])}),!0),Ge=ee("call-with-current-continuation",[{name:"proc"}],(({proc:e},r,t)=>(V.Procedure(e),M(t),$.Call(e,A.Continuation(P(t))))),!0),He=re("call/cc",Ge),Ye=ee("values",[{name:"objs",type:"variadic"}],(({objs:e})=>(V.Objects(e),1===e.length?e[0]:A.MultiValue(e)))),er=ee("call-with-values",[{name:"producer"},{name:"consumer"}],(({producer:e,consumer:r},t,n)=>{V.Procedure(e),V.Procedure(r),M(n);const a=O(n,A.List(r),{want:"args",oper:r});return B(a,A.List(e))})),rr=ee("dynamic-wind",[{name:"before"},{name:"thunk"},{name:"after"}],(({before:e,thunk:r,after:t},n,a)=>{V.Procedure(e),V.Procedure(r),V.Procedure(t),M(a);const o=A.Continuation(P(a));return B(a,$.Begin($.Call(e),$.Call(o,$.Call(r))),{before:e,after:t})})),tr={procedureQ:Ue,apply:Fe,map:Je,stringMap:_e,vectorMap:Xe,forEach:Ze,stringForEach:Ke,vectorForEach:We,callWithCurrentContinuation:Ge,callCC:He,values:Ye,callWithValues:er,dynamicWind:rr},nr=ee("eqv?",[{name:"obj1"},{name:"obj2"}],(({obj1:e,obj2:r})=>{V.Object(e),V.Object(r);const t=e=>L.String(e)||L.ByteVector(e)||L.Vector(e)?e.slice(0,e.length-1):L.Pair(e)?e.slice(0,3):L.Symbol(e)?e.slice(0,2):e;return A.Boolean(e===r||ne(t(e),t(r)))})),ar=re("eq?",nr),or=ee("equal?",[{name:"obj1"},{name:"obj2"}],(({obj1:e,obj2:r})=>{V.Object(e),V.Object(r);const t=(e,r)=>e===r||(L.Pair(e)&&L.Pair(r)?t(e[1],r[1])&&t(e[2],r[2]):L.Vector(e)&&L.Vector(r)?e[1]===r[1]||e[1].length===r[1].length&&e[1].every(((e,n)=>t(e,r[1][n]))):L.ByteVector(e)&&L.ByteVector(r)?ne(e[1],r[1]):nr.body({obj1:e,obj2:r})[1]);return A.Boolean(t(e,r))})),ir={eqvQ:nr,eqQ:ar,equalQ:or},lr=ee("with-exception-handler",[{name:"handler"},{name:"thunk"}],(({handler:e,thunk:r},t,n)=>(V.Procedure(e),V.Procedure(r),M(n),O(n,$.Call(r),{handler:A.HandlerStack(e,N(n).handler)})))),sr=ee("raise",[{name:"obj"}],(({obj:e},r,t)=>{throw V.Object(e),M(t),A.Exception(t,e,!1)})),cr=ee("raise-continuable",[{name:"obj"}],(({obj:e},r,t)=>{throw V.Object(e),M(t),A.Exception(t,e,!0)})),ur=ee("error",[{name:"message"},{name:"objs",type:"variadic"}],(({message:e,objs:r},t,n)=>{throw V.String(e),V.Objects(r),M(n),A.Exception(n,A.Error("error",e[1],r),!0)})),mr=ee("error-object?",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.Error(e))))),dr=ee("error-object-message",[{name:"err"}],(({err:e})=>{var r;return V.Error(e),A.String(null!=(r=e[2])?r:e[1],!1)})),pr=ee("error-object-irritants",[{name:"err"}],(({err:e})=>(V.Error(e),A.List(...e[3])))),fr=ee("read-error?",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.Error(e)&&"read-error"===e[1])))),br=ee("file-error?",[{name:"obj"}],(({obj:e})=>(V.Object(e),A.Boolean(L.Error(e)&&"file-error"===e[1])))),yr={withExceptionHandler:lr,raise:sr,raiseContinuable:cr,error:ur,errorObjectQ:mr,errorObjectMessage:dr,errorObjectIrritants:pr,readErrorQ:fr,fileErrorQ:br},hr=ee("suspend",[{name:"obj",type:"optional"}],(({obj:e},r,t)=>{throw M(t),e&&V.Object(e),A.Suspend(A.Continuation(P(t)),null!=e?e:A.Undefined())})),gr=ee("read-file",[{name:"filename"},{name:"cli",type:"optional"}],(({filename:e,cli:r},t)=>{if(M(t),V.String(e),r&&V.Boolean(r),!(null==t?void 0:t.fs))throw A.Error("program-error",'No interpreter object or No Node.js "fs" object set on Interpreter.');let n,a;try{n=t.fs.readFileSync(e[1]).toString()}catch{throw A.Error("read-error",`Can't read file from ${e[1]}.`)}try{a=he(r&&r[1]?"#!fold-case "+n:n,{filename:e[1]})}catch(o){throw o instanceof Error?A.Error("read-error",o.message):A.Error("read-error","Error occured while reading.")}return a}),!1,!0),vr={suspend:hr,readFile:gr},Sr=ee("features",[],(()=>A.List(A.Symbol("r7rs"),A.Symbol(u),A.Symbol(u+"-0.6.0")))),wr={features:Sr},jr=ee("quote",[{name:"value",evaluate:!1}],(({value:e})=>(V.Object(e),e))),xr=ee("lambda",[{name:"formals",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({formals:e,body:r},t,n)=>{V.Object(e),V.Objects(r),M(n);const[a,o]=ae(e);return A.Procedure("lambda",o?[...a,o]:a,$.BeginIfMultiple(...r),!1,N(n).env)})),Pr=ee("if",[{name:"test"},{name:"consequent",evaluate:!1},{name:"alternate",type:"optional",evaluate:!1}],(({test:e,consequent:r,alternate:t})=>(V.Object(e),V.Object(r),L.False(e)?t?(V.Object(t),t):["<undefined>"]:r)),!0),Er=ee("set!",[{name:"variable",evaluate:!1},{name:"expr"}],(({variable:e,expr:r},t,n)=>{if(M(t),M(n),V.Symbol(e),V.Object(r),L.Undefined(r))throw A.Error("undefined-variable",`Attempt to set undefined value to a variable "${e[1]}"`);if(!t.setStatic(N(n).env.static,e,r))throw A.Error("unbound-variable",`Attempt to set value to an unbound variable "${e[1]}"`);return["<undefined>"]})),Nr=ee("include",[{name:"str1"},{name:"strs",type:"variadic"}],(({str1:e,strs:r},t,n)=>{M(t),M(n),V.String(e),V.Strings(r);const a=[e,...r].map((e=>gr.body({filename:e},t)));return 1===a.length?a[0]:$.Begin(...a)}),!0),Ir=ee("include-cli",[{name:"str1"},{name:"strs",type:"variadic"}],(({str1:e,strs:r},t,n)=>{M(t),M(n),V.String(e),V.Strings(r);const a=[e,...r].map((e=>gr.body({filename:e,cli:A.Boolean(!0)},t)));return 1===a.length?a[0]:$.Begin(...a)}),!0),Br=ee("cond",[{name:"clause",evaluate:!1},{name:"clauses",type:"variadic",evaluate:!1}],(({clause:e,clauses:r})=>{V.Pair(e),V.Pairs(r);const t=0===r.length?["<undefined>"]:$.Cond(r[0],...r.splice(1)),[n,a,...o]=W(e);if(L.Symbol(n)&&"else"===n[1])return $.BeginIfMultiple(a,...o);if(a){if(L.Symbol(a)&&"=>"===a[1]){if(1!==o.length)throw A.Error("syntax-error","Illegal cond syntax (test => expression).");const e=A.Symbol(Y());return $.Let([[e,n]],$.If(e,$.Call(o[0],e),t))}return $.If(n,$.BeginIfMultiple(a,...o),t)}return $.Or(n,t)}),!0),Or=ee("case",[{name:"key"},{name:"clauses",type:"variadic",evaluate:!1}],(({key:e,clauses:r})=>{V.Object(e),V.Pairs(r);const t=r.find(((t,n)=>{if(L.Symbol(t[1])&&"else"===t[1][1]){if(n!==r.length-1)throw A.Error("syntax-error","Illegal case syntax (else placement).");return!0}return V.Pair(t[1]),W(t[1]).some((r=>nr.body({obj1:r,obj2:e})[1]))}));if(t){const[,r,...n]=W(t);if(r){if(L.Symbol(r)&&"=>"===r[1]){if(1!==n.length)throw A.Error("syntax-error","Illegal cond syntax (test => expression).");return $.Call(n[0],A.MultiValue([e]))}return $.BeginIfMultiple(r,...n)}throw A.Error("syntax-error","Illegal cond syntax (short clause).")}return["<undefined>"]}),!0),Cr=ee("and",[{name:"first",type:"optional"},{name:"rest",type:"variadic",evaluate:!1}],(({first:e,rest:r})=>e?(V.Object(e),V.Objects(r),0===r.length||L.False(e)?$.Quote(e):$.And(...r)):A.Boolean(!0)),!0),Ar=ee("or",[{name:"first",type:"optional"},{name:"rest",type:"variadic",evaluate:!1}],(({first:e,rest:r})=>e?(V.Object(e),V.Objects(r),0!==r.length&&L.False(e)?$.Or(...r):$.Quote(e)):A.Boolean(!1)),!0),$r=ee("when",[{name:"test"},{name:"expr",evaluate:!1},{name:"exprs",type:"variadic",evaluate:!1}],(({test:e,expr:r,exprs:t})=>(V.Object(e),V.Object(r),V.Objects(t),L.False(e)?["<undefined>"]:$.BeginIfMultiple(r,...t))),!0),Lr=ee("unless",[{name:"test"},{name:"expr",evaluate:!1},{name:"exprs",type:"variadic",evaluate:!1}],(({test:e,expr:r,exprs:t})=>(V.Object(e),V.Object(r),V.Objects(t),L.False(e)?$.BeginIfMultiple(r,...t):["<undefined>"])),!0),kr=ee("cond-expand",[{name:"clause1",evaluate:!1},{name:"clauses",type:"variadic",evaluate:!1}],(({clause1:e,clauses:r},t,n)=>{V.Pair(e),V.Pairs(r),M(t),M(n);const a=[e,...r],o=W(Sr.body()),i=e=>{if(L.Symbol(e))return o.some((r=>L.Symbol(r)&&r[1]===e[1]));if(L.Pair(e)){const[,r,a]=e;if(L.Symbol(r)&&L.List(a)){if("and"===r[1])return W(a).every((e=>i(e)));if("or"===r[1])return W(a).some((e=>i(e)));if("not"===r[1]){if(L.Pair(a))return!i(a[1])}else if("library"===r[1]&&L.Pair(a)){const e=g(a[1]);if(t.getBuiltInLibrary(e))return!0;{const r=t.getStatic(N(n).env.static,A.Symbol(e));return L.Library(r)}}}}return!1},l=a.find((e=>i(e[1])));return l?A.Pair(A.Procedure("built-in","begin"),l[2]):A.Undefined()}),!0),zr=ee("let",[{name:"args",type:"variadic",evaluate:!1}],(({args:e},r,t)=>{V.Objects(e);const[n,a,...o]=L.Symbol(e[0])?e:[null,...e];V.List(a),V.Objects(o),M(t);const i=W(a).map((e=>{V.Pair(e),V.Symbol(e[1]),V.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),l=i.map((([e])=>e)),s=i.map((([,e])=>e)),c=$.Lambda(l,null,...o);return n?(V.Symbol(n),$.CallThunk($.Define(n,c),$.Call(n,...s))):$.Call(c,...s)}),!0),Vr=ee("let*",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{if(V.List(e),V.Objects(r),M(n),L.Pair(e)){V.Pair(e[1]),V.Pair(e[1][2]);const[,[,t,[,n]],a]=e;return V.Symbol(t),$.Call($.Lambda([t],null,$.CallBuiltIn("let*",a,...r)),n)}return $.BeginIfMultiple(...r)}),!0),Mr=ee("letrec",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{V.List(e),V.Objects(r),M(t),M(n);const a=W(e).map((e=>{V.Pair(e),V.Symbol(e[1]),V.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),{static:o,dynamic:i}=N(n).env,l=C(o);return a.forEach((([e])=>t.defineStatic(l,e,["<undefined>"]))),$.Call(A.Procedure("lambda",[],$.Begin($.DefineValues(a.map((([e])=>e)),$.Values(...a.map((([,e])=>e)))),...r),!1,{static:l,dynamic:i}))}),!0),qr=ee("letrec*",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{V.List(e),V.Objects(r),M(t),M(n);const a=W(e).map((e=>{V.Pair(e),V.Symbol(e[1]),V.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),{static:o,dynamic:i}=N(n).env,l=C(o);return a.forEach((([e])=>t.defineStatic(l,e,["<undefined>"]))),$.Call(A.Procedure("lambda",[],$.Begin(...a.map((([e,r])=>$.Set(e,r))),...r),!1,{static:l,dynamic:i}))}),!0),Tr=ee("let-values",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>(V.List(e),V.Objects(r),M(n),$.CallThunk(...W(e).map((e=>{V.Pair(e),V.Pair(e[2]);const[,r,[,t]]=e,a=A.Procedure("lambda",[],t,!1,N(n).env);return $.CallBuiltIn("define-values",r,$.Call(a))})),...r))),!0),Dr=ee("let*-values",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{if(V.List(e),V.Objects(r),M(n),L.Pair(e)){V.Pair(e[1]),V.Pair(e[1][2]);const[,[,t,[,n]],a]=e;return $.CallThunk($.CallBuiltIn("define-values",t,n),$.CallBuiltIn("let*-values",a,...r))}return $.BeginIfMultiple(...r)}),!0),Rr=ee("begin",[{name:"exprs",type:"variadic",evaluate:!0},{name:"last",type:"tail",evaluate:!1}],(({exprs:e,last:r},t,n)=>(((e,r)=>{if(!(e instanceof Array))throw A.Error("program-error",null!=r?r:"An array is expected.")})(e),V.Object(r),M(n),0===N(n).depth?B(n,r):r)),!0),Qr=ee("do",[{name:"specs",evaluate:!1},{name:"clause",evaluate:!1},{name:"commands",type:"variadic",evaluate:!1}],(({specs:e,clause:r,commands:t})=>{V.List(e),V.List(r),V.Objects(t);const n=W(e).map((e=>{V.Pair(e),V.Pair(e[2]),V.Symbol(e[1]);const[,r,[,t,n]]=e;return[r,t,L.Pair(n)?n[1]:null]})),[,a,o]=r;return V.Object(a),V.List(o),$.Let(n.map((([e,r])=>[e,r])),$.If(a,L.Null(o)?A.Undefined():$.Begin(...W(o)),$.Begin(...t,$.CallBuiltIn("do",A.List(...n.map((([e,,r])=>A.List(e,null!=r?r:e,null!=r?r:e)))),r,...t))))}),!0),Ur=ee("make-parameter",[{name:"init"},{name:"converter",type:"optional"}],(({init:e,converter:r},t,n)=>{V.Object(e),M(t),M(n);let a=Y();for(;a in N(n).env.dynamic[1];)a=Y();return r&&V.Procedure(r),t.defineDynamic(N(n).env.dynamic,a,e),A.Parameter(a,null!=r?r:null)})),Fr=ee("parameterize",[{name:"assocs",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({assocs:e,body:r},t,n)=>{V.Pair(e),V.Pairs(r),M(t),M(n);const{env:a}=N(n),o=W(e).map((e=>{V.Pair(e),V.Pair(e[2]);const[,r,[,t]]=e;return[r,t]})),i={static:a.static,dynamic:A.DynamicNS({},a.dynamic)},l=$.BeginIfMultiple(...o.map((([e,r])=>$.CallBuiltIn("define-parameter",e,r))),...r);return O(n,l,{env:i})})),Jr=ee("define-parameter",[{name:"param"},{name:"value",evaluate:!1}],(({param:e,value:r},t,n)=>{V.Parameter(e),V.Object(r),M(t),M(n);const[,,a]=e;return $.CallBuiltIn("define-parameter-1",e,a?$.Call(a,r):r)}),!0,!0),_r=ee("define-parameter-1",[{name:"param"},{name:"value"}],(({param:e,value:r},t,n)=>{var a;if(V.Parameter(e),V.Object(r),M(t),M(n),!L.Undefined(null!=(a=x(N(n).env.dynamic)[e[1]])?a:["<undefined>"]))throw A.Error("redefine-variable",null);return t.defineDynamic(N(n).env.dynamic,e[1],r),["<undefined>"]}),!1,!0),Xr=ee("guard",[{name:"arg1",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({arg1:e,body:r},t,n)=>{V.Pair(e),V.Objects(r),V.Symbol(e[1]),V.Pair(e[2]),M(n);const[,a,o]=e,i=A.Continuation(P(n)),l=A.Procedure("lambda",[{name:a[1]}],$.Call(i,$.CallBuiltIn("cond",...W(o),A.List(A.Symbol("else"),$.RaiseContinuable(a)))),!1,N(n).env);return $.CallBuiltIn("with-exception-handler",l,$.Lambda([],null,...r))}),!0),Zr=ee("quasiquote",[{name:"template",evaluate:!1}],(({template:e})=>{V.Object(e);const r=[],t=[],n=(e,a)=>{if(L.Pair(e)){const[,o,i]=e;if(L.Symbol(o)&&"quasiquote"===o[1])return A.Pair(o,n(i,a+1));if(L.Symbol(o)&&"unquote"===o[1]||"unquote-splicing"===o[1]){if(0!==a)return A.Pair(o,n(i,a-1));{const e=A.Symbol("unquote-splicing"===o[1]?"@"+Y():Y());return V.Pair(i),r.push(e),t.push(i[1]),e}}return A.Pair(n(o,a),n(i,a))}return L.Vector(e)?A.Vector(e[1].map((e=>n(e,a))),!1):e},a=n(e,0);return $.CallBuiltIn("quasiquote-1",a,A.List(...r),...t)}),!0),Kr=ee("quasiquote-1",[{name:"template",evaluate:!1},{name:"marks",evaluate:!1},{name:"exprs",type:"variadic"}],(({template:e,marks:r,exprs:t})=>{V.Object(e),V.List(r),V.Objects(t);const n=W(r);V.Symbols(n);const a=new Map;if(n.length!==t.length)throw A.Error("arity-error","quasiquote-1: marks and exprs unmatch.");n.forEach(((e,r)=>a.set(e[1],t[r])));const o=e=>{if(L.Pair(e)){const[,r,t]=e;if(L.Symbol(r)&&"@"===r[1][0]&&a.has(r[1])){const e=a.get(r[1]);if(L.List(e))return L.Null(e)?o(t):H(W(e),o(t));throw A.Error("error","unquote-splicing evaluated as non-list object.")}return A.Pair(o(r),o(t))}return L.Vector(e)?A.Vector(e[1].map((e=>{if(L.Symbol(e)&&"@"===e[1][0]&&a.has(e[1])){const r=a.get(e[1]);if(L.List(r))return L.Null(r)?[]:W(r);throw A.Error("error","unquote-splicing evaluated as non-list object.")}return[o(e)]})).flat(),!1):L.Symbol(e)&&a.has(e[1])&&"@"!==e[1][0]?a.get(e[1]):e};return o(e)}),!1,!0),Wr=ee("let-syntax",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{V.List(e,"aa"),V.Objects(r),M(n);const a=W(e).map((e=>{V.Pair(e),V.Pair(e[2]),V.Symbol(e[1]);const[,r,[,t]]=e;return[r,A.Procedure("lambda",[],t,!1,N(n).env)]}));return $.CallThunk(...a.map((([e,r])=>$.CallBuiltIn("define-syntax",e,$.Call(r)))),...r)}),!0),Gr=ee("letrec-syntax",[{name:"bindings",evaluate:!1},{name:"body",type:"variadic",evaluate:!1}],(({bindings:e,body:r},t,n)=>{V.List(e),V.Objects(r),M(t),M(n);const a=W(e).map((e=>{V.Pair(e),V.Pair(e[2]),V.Symbol(e[1]);const[,r,[,t]]=e;return[r,t]})),{static:o,dynamic:i}=N(n).env,l=C(o);return a.forEach((([e])=>t.defineStatic(l,e,["<undefined>"]))),$.Call(A.Procedure("lambda",[],$.Begin(...a.map((([e,r])=>$.CallBuiltIn("define-syntax",e,r))),...r),!1,{static:l,dynamic:i}))}),!0),Hr=(e,r,t=!0)=>{var n;const[a,o]=G(e),i=a.findIndex((e=>L.Symbol(e)&&e[1]===r)),l=t?i<0?a.slice(1):a.slice(1,i-1):i<0?a:a.slice(0,i-1),s=i<0?[]:a.slice(i+1),c=i<0?null:null!=(n=a[i-1])?n:null;return["<syntax-rule-pattern>",l.map((e=>L.Pair(e)?Hr(e,r,!1):e)),c?L.Pair(c)?Hr(c,r,!1):c:null,s.map((e=>L.Pair(e)?Hr(e,r,!1):e)),L.Null(o)?null:o]},Yr=ee("syntax-rules",[{name:"arg1",evaluate:!1},{name:"arg2",evaluate:!1},{name:"args",type:"variadic",evaluate:!1}],(({arg1:e,arg2:r,args:t},n,a)=>{V.Object(e),V.Object(r),V.Objects(t),M(n),M(a);const[o,i,l]=L.Symbol(e)?[e[1],r,t]:["...",e,[r,...t]];V.List(i);const s=W(i).map((e=>(V.Symbol(e),e[1]))),c=(e,r=new Map)=>{var t;if(L.Pair(e))return A.Pair(c(e[1],r),c(e[2],r));if(L.Symbol(e)){if(n.getStatic(N(a).env.static,e))return A.Symbol(e[1],N(a).env.static,null!=(t=e[3])?t:null);if(s.includes(e[1])||o===e[1]||"_"===e[1])return e;if(r.has(e[1]))return r.get(e[1]);{const t=A.Symbol(e[1],null,Y());return r.set(e[1],t),t}}return e};V.Pairs(l);const u=[];for(const m of l){const e=c(m);V.Pair(e),V.Pair(e[2]);const[,r,[,t]]=e;V.Pair(r);const[n,a]=G(r);if(!L.Null(a)&&n.some((e=>L.Symbol(e)&&e[1]===o)))throw A.Error("syntax-error","The root of a syntax-rules pattern with ellipsis must be a proper list.");u.push([Hr(r,o),t])}return A.SyntaxRules(o,s,u)})),et=(e,r)=>{if(L.SyntaxRulePattern(e)){const[,t,n,a,o]=e;return[...t,...n?[n]:[],...a,...o?[o]:[]].map((e=>et(e,r))).flat()}return L.Symbol(e)&&!r.includes(e[1])?"_"===e[1]?[]:[e[1]]:[]},rt=(e,r,t,n,a,o)=>{if(L.SyntaxRulePattern(e)){if(!L.List(r))return null;const[,i,l,s,c]=e;if(L.Null(r))return 0!==i.length||l||0!==s.length||c?null:new Map;const[u,m]=G(r);if(l||c){if(u.length<i.length+s.length)return null}else if(u.length!==i.length+s.length)return null;let d;if(l){const e=u.length-i.length-s.length;d=[...i,...Array(e).fill(l),...s],c&&(d.push(c),u.push(m))}else d=[...i],c&&(d.push(c),u.push(H(u.slice(i.length),m)));const p=new Map;l&&et(l,o).forEach((e=>p.set(e,[])));for(let e=0;e<d.length;e++){const[r,i]=[d[e],u[e]],s=rt(r,i,t,n,a,o);if(!s)return null;if(r===l)for(const[e,t]of s.entries()){const r=p.get(e);if(!r||L.Object(r))throw A.Error("syntax-error",`Internal error: illegal behavior of syntax-rules. No array prepared for variadic variable "${e}".`);L.Object(t)?p.set(e,[...r,t]):p.set(e,[...r,...t])}else for(const[e,t]of s.entries()){if(p.has(e))throw A.Error("syntax-error","The same pattern variable appeared more than once in a pattern.");p.set(e,t)}}return p}if(L.Symbol(e)&&o.includes(e[1])){if(!L.Symbol(r))return null;const o=t.getStatic(a,e),i=t.getStatic(n,e);return e[1]===r[1]&&o===i?new Map:null}return L.Symbol(e)?"_"===e[1]?new Map:new Map([[e[1],r]]):or.body({obj1:e,obj2:r})[1]?new Map:null},tt=ee("use-syntax-rules",[{name:"spec"},{name:"args"}],(({spec:e,args:r},t,n)=>{V.SyntaxRules(e),V.List(r),M(t),M(n);const[,a,o,i]=e,l=N(P(n)).env.static,s=N(n).env.static;let c,u;{let e,n;for(const a of i)if(e=rt(a[0],r,t,l,s,o)){n=a[1];break}if(!e||!n)throw A.Error("syntax-error","No rules match arguments.");[c,u]=[e,n]}const m=e=>{if(L.Pair(e)){const[,r,t]=e;if(L.Symbol(r)&&c.has(r[1])&&L.Symbol(t[1])&&t[1][1]===a){const e=c.get(r[1]);if(!e||L.Object(e))throw A.Error("syntax-error",`Pattern variable "${r[1]} is not variadic." `);return H(e,m(t[2]))}return L.Pair(r)&&L.Symbol(r[1])&&r[1][1]===a&&L.Pair(