UNPKG

setup-cpp

Version:

Install all the tools required for building and testing C++/C projects.

18 lines 57.6 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const path=require("path"),require$$1=require("url"),setupCpp=require("../setup-cpp.js"),fs=require("fs"),require$$0=require("stream"),os=require("os");require("process");require("https");require("perf_hooks");require("http");require("net");require("tls");require("events");require("util");require("string_decoder");require("child_process");require("assert");require("timers");require("buffer");require("constants");require("console");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopNamespaceDefault(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const path__namespace=_interopNamespaceDefault(path),os__namespace=_interopNamespaceDefault(os);var semverExports=setupCpp.requireSemver(),toml={},parse={exports:{}},tomlParser={exports:{}},parser,hasRequiredParser;function requireParser(){if(hasRequiredParser)return parser;hasRequiredParser=1;const e=1114112;class r extends Error{constructor(i,o,h){super("[ParserError] "+i,o,h),this.name="ParserError",this.code="ParserError",Error.captureStackTrace&&Error.captureStackTrace(this,r)}}class n{constructor(i){this.parser=i,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}}class t{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new n(this.parseStart)}parse(i){if(i.length===0||i.length==null)return;this._buf=String(i),this.ii=-1,this.char=-1;let o;for(;o===!1||this.nextChar();)o=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=e;let i;do i=this.state.parser,this.runOne();while(this.state.parser!==i);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(i){if(typeof i!="function")throw new r("Tried to set state to non-existent state: "+JSON.stringify(i));this.state.parser=i}goto(i){return this.next(i),this.runOne()}call(i,o){o&&this.next(o),this.stack.push(this.state),this.state=new n(i)}callNow(i,o){return this.call(i,o),this.runOne()}return(i){if(this.stack.length===0)throw this.error(new r("Stack underflow"));i===void 0&&(i=this.state.buf),this.state=this.stack.pop(),this.state.returned=i}returnNow(i){return this.return(i),this.runOne()}consume(){if(this.char===e)throw this.error(new r("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(i){return i.line=this.line,i.col=this.col,i.pos=this.pos,i}parseStart(){throw new r("Must declare a parseStart method")}}return t.END=e,t.Error=r,parser=t,parser}var createDatetime,hasRequiredCreateDatetime;function requireCreateDatetime(){return hasRequiredCreateDatetime||(hasRequiredCreateDatetime=1,createDatetime=e=>{const r=new Date(e);if(isNaN(r))throw new TypeError("Invalid Datetime");return r}),createDatetime}var formatNum,hasRequiredFormatNum;function requireFormatNum(){return hasRequiredFormatNum||(hasRequiredFormatNum=1,formatNum=(e,r)=>{for(r=String(r);r.length<e;)r="0"+r;return r}),formatNum}var createDatetimeFloat,hasRequiredCreateDatetimeFloat;function requireCreateDatetimeFloat(){if(hasRequiredCreateDatetimeFloat)return createDatetimeFloat;hasRequiredCreateDatetimeFloat=1;const e=requireFormatNum();class r extends Date{constructor(t){super(t+"Z"),this.isFloating=!0}toISOString(){const t=`${this.getUTCFullYear()}-${e(2,this.getUTCMonth()+1)}-${e(2,this.getUTCDate())}`,a=`${e(2,this.getUTCHours())}:${e(2,this.getUTCMinutes())}:${e(2,this.getUTCSeconds())}.${e(3,this.getUTCMilliseconds())}`;return`${t}T${a}`}}return createDatetimeFloat=n=>{const t=new r(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t},createDatetimeFloat}var createDate,hasRequiredCreateDate;function requireCreateDate(){if(hasRequiredCreateDate)return createDate;hasRequiredCreateDate=1;const e=requireFormatNum(),r=setupCpp.commonjsGlobal.Date;class n extends r{constructor(a){super(a),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${e(2,this.getUTCMonth()+1)}-${e(2,this.getUTCDate())}`}}return createDate=t=>{const a=new n(t);if(isNaN(a))throw new TypeError("Invalid Datetime");return a},createDate}var createTime,hasRequiredCreateTime;function requireCreateTime(){if(hasRequiredCreateTime)return createTime;hasRequiredCreateTime=1;const e=requireFormatNum();class r extends Date{constructor(t){super(`0000-01-01T${t}Z`),this.isTime=!0}toISOString(){return`${e(2,this.getUTCHours())}:${e(2,this.getUTCMinutes())}:${e(2,this.getUTCSeconds())}.${e(3,this.getUTCMilliseconds())}`}}return createTime=n=>{const t=new r(n);if(isNaN(t))throw new TypeError("Invalid Datetime");return t},createTime}var hasRequiredTomlParser;function requireTomlParser(){if(hasRequiredTomlParser)return tomlParser.exports;hasRequiredTomlParser=1,tomlParser.exports=makeParserClass(requireParser()),tomlParser.exports.makeParserClass=makeParserClass;class TomlError extends Error{constructor(r){super(r),this.name="TomlError",Error.captureStackTrace&&Error.captureStackTrace(this,TomlError),this.fromTOML=!0,this.wrapped=null}}TomlError.wrap=e=>{const r=new TomlError(e.message);return r.code=e.code,r.wrapped=e,r},tomlParser.exports.TomlError=TomlError;const createDateTime=requireCreateDatetime(),createDateTimeFloat=requireCreateDatetimeFloat(),createDate=requireCreateDate(),createTime=requireCreateTime(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:"\b",[CHAR_t]:" ",[CHAR_n]:` `,[CHAR_f]:"\f",[CHAR_r]:"\r",[CHAR_QUOT]:'"',[CHAR_BSOL]:"\\"};function isDigit(e){return e>=CHAR_0&&e<=CHAR_9}function isHexit(e){return e>=CHAR_A&&e<=CHAR_F||e>=CHAR_a&&e<=CHAR_f||e>=CHAR_0&&e<=CHAR_9}function isBit(e){return e===CHAR_1||e===CHAR_0}function isOctit(e){return e>=CHAR_0&&e<=CHAR_7}function isAlphaNumQuoteHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_APOS||e===CHAR_QUOT||e===CHAR_LOWBAR||e===CHAR_HYPHEN}function isAlphaNumHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_LOWBAR||e===CHAR_HYPHEN}const _type=Symbol("type"),_declared=Symbol("declared"),hasOwnProperty=Object.prototype.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0};function hasKey(e,r){return hasOwnProperty.call(e,r)?!0:(r==="__proto__"&&defineProperty(e,"__proto__",descriptor),!1)}const INLINE_TABLE=Symbol("inline-table");function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(e){return e===null||typeof e!="object"?!1:e[_type]===INLINE_TABLE}const TABLE=Symbol("table");function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(e){return e===null||typeof e!="object"?!1:e[_type]===TABLE}const _contentType=Symbol("content-type"),INLINE_LIST=Symbol("inline-list");function InlineList(e){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:e}})}function isInlineList(e){return e===null||typeof e!="object"?!1:e[_type]===INLINE_LIST}const LIST=Symbol("list");function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(e){return e===null||typeof e!="object"?!1:e[_type]===LIST}let _custom;try{const utilInspect=eval("require('util').inspect");_custom=utilInspect.custom}catch(e){}const _inspect=_custom||"inspect";class BoxedBigInt{constructor(r){try{this.value=setupCpp.commonjsGlobal.BigInt.asIntN(64,r)}catch{this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return this.value===null}toString(){return String(this.value)}[_inspect](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}}const INTEGER=Symbol("integer");function Integer(e){let r=Number(e);return Object.is(r,-0)&&(r=0),setupCpp.commonjsGlobal.BigInt&&!Number.isSafeInteger(r)?new BoxedBigInt(e):Object.defineProperties(new Number(r),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${e}]`}})}function isInteger(e){return e===null||typeof e!="object"?!1:e[_type]===INTEGER}const FLOAT=Symbol("float");function Float(e){return Object.defineProperties(new Number(e),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${e}]`}})}function isFloat(e){return e===null||typeof e!="object"?!1:e[_type]===FLOAT}function tomlType(e){const r=typeof e;if(r==="object"){if(e===null)return"null";if(e instanceof Date)return"datetime";if(_type in e)switch(e[_type]){case INLINE_TABLE:return"inline-table";case INLINE_LIST:return"inline-list";case TABLE:return"table";case LIST:return"list";case FLOAT:return"float";case INTEGER:return"integer"}}return r}function makeParserClass(e){class r extends e{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===e.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===e.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===e.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(t){let a=this.ctx,i=t.key.pop();for(let o of t.key){if(hasKey(a,o)&&!isTable(a[o]))throw this.error(new TomlError("Can't redefine existing key"));a=a[o]=a[o]||Table()}if(hasKey(a,i))throw this.error(new TomlError("Can't redefine existing key"));return a[_declared]=!0,isInteger(t.value)||isFloat(t.value)?a[i]=t.value.valueOf():a[i]=t.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(t){return this.state.resultTable?this.state.resultTable.push(t):this.state.resultTable=[t],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===CHAR_PERIOD)return this.next(this.parseAssignKeywordPostDot);if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError('Invalid character, expected "="'))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(t){return this.returnNow({key:this.state.resultTable,value:t})}parseComment(){do{if(this.char===e.END||this.char===CTRL_J)return this.return();if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharIn("comments")}while(this.nextChar())}parseTableOrList(){if(this.char===CHAR_LSQB)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(t){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,t)&&(!isTable(this.ctx[t])||this.ctx[t][_declared]))throw this.error(new TomlError("Can't redefine existing key"));return this.ctx=this.ctx[t]=this.ctx[t]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,t))this.ctx=this.ctx[t]=Table();else if(isTable(this.ctx[t]))this.ctx=this.ctx[t];else if(isList(this.ctx[t]))this.ctx=this.ctx[t][this.ctx[t].length-1];else throw this.error(new TomlError("Can't redefine existing key"));return this.next(this.parseTableNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(t){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,t)||(this.ctx[t]=List()),isInlineList(this.ctx[t]))throw this.error(new TomlError("Can't extend an inline array"));if(isList(this.ctx[t])){const a=Table();this.ctx[t].push(a),this.ctx=a}else throw this.error(new TomlError("Can't redefine an existing key"));return this.next(this.parseListEnd)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,t))this.ctx=this.ctx[t]=Table();else{if(isInlineList(this.ctx[t]))throw this.error(new TomlError("Can't extend an inline array"));if(isInlineTable(this.ctx[t]))throw this.error(new TomlError("Can't extend an inline table"));if(isList(this.ctx[t]))this.ctx=this.ctx[t][this.ctx[t].length-1];else if(isTable(this.ctx[t]))this.ctx=this.ctx[t];else throw this.error(new TomlError("Can't redefine an existing key"))}return this.next(this.parseListNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseListEnd(t){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseValue(){if(this.char===e.END)throw this.error(new TomlError("Key without value"));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"))}recordValue(t){return this.returnNow(t)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseInf2(){if(this.char===CHAR_f)return this.state.buf==="-"?this.return(-1/0):this.return(1/0);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===e.END)throw this.error(new TomlError("Key ended without value"));if(isAlphaNumHyphen(this.char))this.consume();else{if(this.state.buf.length===0)throw this.error(new TomlError("Empty bare keys are not allowed"));return this.returnNow()}}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===e.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+="'",this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd3):(this.state.buf+="''",this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd3(){return this.char===CHAR_APOS?(this.state.buf+="'",this.next(this.parseLiteralMultiEnd4)):this.returnNow()}parseLiteralMultiEnd4(){return this.char===CHAR_APOS?(this.state.buf+="'",this.return()):this.returnNow()}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}recordEscapeReplacement(t){return this.state.buf+=t,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===e.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}errorControlCharIn(t){let a="\\u00";return this.char<16&&(a+="0"),a+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in ${t}, use ${a} instead`))}recordMultiEscapeReplacement(t){return this.state.buf+=t,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+='"',this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd3):(this.state.buf+='""',this.goto(this.parseMultiStringContent))}parseMultiEnd3(){return this.char===CHAR_QUOT?(this.state.buf+='"',this.next(this.parseMultiEnd4)):this.returnNow()}parseMultiEnd4(){return this.char===CHAR_QUOT?(this.state.buf+='"',this.return()):this.returnNow()}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError("Can't escape whitespace"))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError("Unknown escape character: "+this.char))}parseUnicodeReturn(t){try{const a=parseInt(t,16);if(a>=SURROGATE_FIRST&&a<=SURROGATE_LAST)throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));return this.returnNow(String.fromCodePoint(a))}catch(a){throw this.error(TomlError.wrap(a))}}parseSmallUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=4)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseLargeUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=8)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(isDigit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);{const t=Integer(this.state.buf);if(t.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(t)}}}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNumberFloat(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberFloat);if(isDigit(this.char))this.consume();else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new TomlError("Unexpected character, expected -, + or digit"))}parseNumberExponent(){if(isDigit(this.char))this.consume();else return this.char===CHAR_LOWBAR?this.call(this.parseNoUnder):this.returnNow(Float(this.state.buf))}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberInteger);if(isDigit(this.char))this.consume(),this.state.buf.length>4&&this.next(this.parseNumberInteger);else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_HYPHEN?this.goto(this.parseDateTime):this.char===CHAR_COLON?this.goto(this.parseOnlyTimeHour):this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError("Expected digit while parsing year part of a date"))}else{if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"))}}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(isHexit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const t=Integer(this.state.buf);if(t.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(t)}}}parseIntegerOct(){if(isOctit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const t=Integer(this.state.buf);if(t.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(t)}}}parseIntegerBin(){if(isBit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const t=Integer(this.state.buf);if(t.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(t)}}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(this.state.buf.length<2)throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseDateDay)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(this.state.buf.length<2)throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseStartTimeHour)}else{if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+"-"+this.state.buf));if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result+="T"+this.state.buf,this.state.buf="",this.next(this.parseTimeMin)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeSec);throw this.error(new TomlError("Incomplete datetime"))}}parseTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeZoneOrFraction)}else throw this.error(new TomlError("Incomplete datetime"))}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeMin)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeSec);throw this.error(new TomlError("Incomplete time"))}}parseOnlyTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeFractionMaybe(){if(this.state.result+=":"+this.state.buf,this.char===CHAR_PERIOD)this.state.buf="",this.next(this.parseOnlyTimeFraction);else return this.return(createTime(this.state.result))}parseOnlyTimeFraction(){if(isDigit(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new TomlError("Expected digit in milliseconds"));return this.returnNow(createTime(this.state.result+"."+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else{if(this.state.buf.length===1)throw this.error(new TomlError("Expected digit in milliseconds"));if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}}parseTimeZoneHour(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseTimeZoneSep(){if(this.char===CHAR_COLON)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new TomlError("Unexpected character in datetime, expected colon"))}parseTimeZoneMin(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseBoolean(){if(this.char===CHAR_t)return this.consume(),this.next(this.parseTrue_r);if(this.char===CHAR_f)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===e.END)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(t){return this.state.resultArr||(this.state.resultArr=InlineList(tomlType(t))),isFloat(t)||isInteger(t)?this.state.resultArr.push(t.valueOf()):this.state.resultArr.push(t),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(t){let a=this.state.resultTable,i=t.key.pop();for(let o of t.key){if(hasKey(a,o)&&(!isTable(a[o])||a[o][_declared]))throw this.error(new TomlError("Can't redefine existing key"));a=a[o]=a[o]||Table()}if(hasKey(a,i))throw this.error(new TomlError("Can't redefine existing key"));return isInteger(t.value)||isFloat(t.value)?a[i]=t.value.valueOf():a[i]=t.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTablePostComma);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTablePostComma(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));if(this.char===CHAR_COMMA)throw this.error(new TomlError("Empty elements in inline tables are not permitted"));if(this.char===CHAR_RCUB)throw this.error(new TomlError("Trailing commas in inline tables are not permitted"));return this.goto(this.parseInlineTable)}}return r}return tomlParser.exports}var parsePrettyError,hasRequiredParsePrettyError;function requireParsePrettyError(){if(hasRequiredParsePrettyError)return parsePrettyError;hasRequiredParsePrettyError=1,parsePrettyError=e;function e(r,n){if(r.pos==null||r.line==null)return r;let t=r.message;if(t+=` at row ${r.line+1}, col ${r.col+1}, pos ${r.pos}: `,n&&n.split){const a=n.split(/\n/),i=String(Math.min(a.length,r.line+3)).length;let o=" ";for(;o.length<i;)o+=" ";for(let h=Math.max(0,r.line-1);h<Math.min(a.length,r.line+2);++h){let c=String(h+1);if(c.length<i&&(c=" "+c),r.line===h){t+=c+"> "+a[h]+` `,t+=o+" ";for(let p=0;p<r.col;++p)t+=" ";t+=`^ `}else t+=c+": "+a[h]+` `}}return r.message=t+` `,r}return parsePrettyError}var parseString_1,hasRequiredParseString;function requireParseString(){if(hasRequiredParseString)return parseString_1;hasRequiredParseString=1,parseString_1=n;const e=requireTomlParser(),r=requireParsePrettyError();function n(t){setupCpp.commonjsGlobal.Buffer&&setupCpp.commonjsGlobal.Buffer.isBuffer(t)&&(t=t.toString("utf8"));const a=new e;try{return a.parse(t),a.finish()}catch(i){throw r(i,t)}}return parseString_1}var parseAsync_1,hasRequiredParseAsync;function requireParseAsync(){if(hasRequiredParseAsync)return parseAsync_1;hasRequiredParseAsync=1,parseAsync_1=n;const e=requireTomlParser(),r=requireParsePrettyError();function n(t,a){a||(a={});const i=0,o=a.blocksize||40960,h=new e;return new Promise((p,d)=>{setImmediate(c,i,o,p,d)});function c(p,d,f,_){if(p>=t.length)try{return f(h.finish())}catch(m){return _(r(m,t))}try{h.parse(t.slice(p,p+d)),setImmediate(c,p+d,d,f,_)}catch(m){_(r(m,t))}}}return parseAsync_1}var parseStream_1,hasRequiredParseStream;function requireParseStream(){if(hasRequiredParseStream)return parseStream_1;hasRequiredParseStream=1,parseStream_1=n;const e=require$$0,r=requireTomlParser();function n(i){return i?t(i):a()}function t(i){const o=new r;return i.setEncoding("utf8"),new Promise((h,c)=>{let p,d=!1,f=!1;function _(){if(d=!0,!p)try{h(o.finish())}catch(y){c(y)}}function m(y){f=!0,c(y)}i.once("end",_),i.once("error",m),C();function C(){p=!0;let y;for(;(y=i.read())!==null;)try{o.parse(y)}catch(g){return m(g)}if(p=!1,d)return _();f||i.once("readable",C)}})}function a(){const i=new r;return new e.Transform({objectMode:!0,transform(o,h,c){try{i.parse(o.toString(h))}catch(p){this.emit("error",p)}c()},flush(o){try{this.push(i.finish())}catch(h){this.emit("error",h)}o()}})}return parseStream_1}var hasRequiredParse;function requireParse(){return hasRequiredParse||(hasRequiredParse=1,parse.exports=requireParseString(),parse.exports.async=requireParseAsync(),parse.exports.stream=requireParseStream(),parse.exports.prettyError=requireParsePrettyError()),parse.exports}var stringify={exports:{}},hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify.exports;hasRequiredStringify=1,stringify.exports=e,stringify.exports.value=y;function e(s){if(s===null)throw r("null");if(s===void 0)throw r("undefined");if(typeof s!="object")throw r(typeof s);if(typeof s.toJSON=="function"&&(s=s.toJSON()),s==null)return null;const l=h(s);if(l!=="table")throw r(l);return i("","",s)}function r(s){return new Error("Can only stringify objects, not "+s)}function n(s){return Object.keys(s).filter(l=>o(s[l]))}function t(s){return Object.keys(s).filter(l=>!o(s[l]))}function a(s){let l=Array.isArray(s)?[]:Object.prototype.hasOwnProperty.call(s,"__proto__")?{["__proto__"]:void 0}:{};for(let u of Object.keys(s))s[u]&&typeof s[u].toJSON=="function"&&!("toISOString"in s[u])?l[u]=s[u].toJSON():l[u]=s[u];return l}function i(s,l,u){u=a(u);let R,x;R=n(u),x=t(u);const T=[],E=l||"";R.forEach(A=>{var S=h(u[A]);S!=="undefined"&&S!=="null"&&T.push(E+c(A)+" = "+C(u[A],!0))}),T.length>0&&T.push("");const w=s&&R.length>0?l+" ":"";return x.forEach(A=>{T.push(O(s,w,A,u[A]))}),T.join(` `)}function o(s){switch(h(s)){case"undefined":case"null":case"integer":case"nan":case"float":case"boolean":case"string":case"datetime":return!0;case"array":return s.length===0||h(s[0])!=="table";case"table":return Object.keys(s).length===0;default:return!1}}function h(s){return s===void 0?"undefined":s===null?"null":typeof s=="bigint"||Number.isInteger(s)&&!Object.is(s,-0)?"integer":typeof s=="number"?"float":typeof s=="boolean"?"boolean":typeof s=="string"?"string":"toISOString"in s?isNaN(s)?"undefined":"datetime":Array.isArray(s)?"array":"table"}function c(s){const l=String(s);return/^[-A-Za-z0-9_]+$/.test(l)?l:p(l)}function p(s){return'"'+_(s).replace(/"/g,'\\"')+'"'}function d(s){return"'"+s+"'"}function f(s,l){for(;l.length<s;)l="0"+l;return l}function _(s){return s.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/([\u0000-\u001f\u007f])/,l=>"\\u"+f(4,l.codePointAt(0).toString(16)))}function m(s){let l=s.split(/\n/).map(u=>_(u).replace(/"(?="")/g,'\\"')).join(` `);return l.slice(-1)==='"'&&(l+=`\\ `),`""" `+l+'"""'}function C(s,l){let u=h(s);return u==="string"&&(l&&/\n/.test(s)?u="string-multiline":!/[\b\t\n\f\r']/.test(s)&&/"/.test(s)&&(u="string-literal")),y(s,u)}function y(s,l){switch(l||(l=h(s)),l){case"string-multiline":return m(s);case"string":return p(s);case"string-literal":return d(s);case"integer":return g(s);case"float":return P(s);case"boolean":return N(s);case"datetime":return I(s);case"array":return b(s.filter(u=>h(u)!=="null"&&h(u)!=="undefined"&&h(u)!=="nan"));case"table":return H(s);default:throw r(l)}}function g(s){return String(s).replace(/\B(?=(\d{3})+(?!\d))/g,"_")}function P(s){if(s===1/0)return"inf";if(s===-1/0)return"-inf";if(Object.is(s,NaN))return"nan";if(Object.is(s,-0))return"-0.0";const[l,u]=String(s).split(".");return g(l)+"."+u}function N(s){return String(s)}function I(s){return s.toISOString()}function b(s){s=a(s);let l="[";const u=s.map(R=>y(R));return u.join(", ").length>60||/\n/.test(u)?l+=` `+u.join(`, `)+` `:l+=" "+u.join(", ")+(u.length>0?" ":""),l+"]"}function H(s){s=a(s);const l=[];return Object.keys(s).forEach(u=>{l.push(c(u)+" = "+C(s[u],!1))}),"{ "+l.join(", ")+(l.length>0?" ":"")+"}"}function O(s,l,u,R){const x=h(R);if(x==="array")return L(s,l,u,R);if(x==="table")return D(s,l,u,R);throw r(x)}function L(s,l,u,R){R=a(R);const x=h(R[0]);if(x!=="table")throw r(x);const T=s+c(u);let E="";return R.forEach(w=>{E.length>0&&(E+=` `),E+=l+"[["+T+`]] `,E+=i(T+".",l,w)}),E}function D(s,l,u,R){const x=s+c(u);let T="";return n(R).length>0&&(T+=l+"["+x+`] `),T+i(x+".",l,R)}return stringify.exports}var hasRequiredToml;function requireToml(){return hasRequiredToml||(hasRequiredToml=1,toml.parse=requireParse(),toml.stringify=requireStringify()),toml}requireToml();const IS_WINDOWS=process.platform==="win32",IS_LINUX=process.platform==="linux",IS_MAC=process.platform==="darwin",WINDOWS_ARCHS=["x86","x64"],WINDOWS_PLATFORMS=["win32","win64"],PYPY_VERSION_FILE="PYPY_VERSION";function createSymlinkInFolder(e,r,n,t=!1){const a=path__namespace.join(e,r),i=path__namespace.join(e,n);fs.existsSync(i)||(fs.symlinkSync(a,i),!IS_WINDOWS&&t&&fs.chmodSync(i,"755"))}function validateVersion(e){return isNightlyKeyword(e)||!!semverExports.validRange(e)}function isNightlyKeyword(e){return e==="nightly"}function getPyPyVersionFromPath(e){return path__namespace.basename(path__namespace.dirname(e))}function readExactPyPyVersionFile(e){let r="";const n=path__namespace.join(e,PYPY_VERSION_FILE);return fs.existsSync(n)&&(r=fs.readFileSync(n).toString().trim()),r}function writeExactPyPyVersionFile(e,r){const n=path__namespace.join(e,PYPY_VERSION_FILE);fs.writeFileSync(n,r)}function validatePythonVersionFormatForPyPy(e){return/^\d+\.\d+$/.test(e)}async function getWindowsInfo(){const{stdout:e}=await setupCpp.execExports.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"',void 0,{silent:!0});return{osName:"Windows",osVersion:e.trim().split(" ")[3]}}async function getMacOSInfo(){const{stdout:e}=await setupCpp.execExports.getExecOutput("sw_vers",["-productVersion"],{silent:!0});return{osName:"macOS",osVersion:e.trim()}}async function getLinuxInfo(){const{stdout:e}=await setupCpp.execExports.getExecOutput("lsb_release",["-i","-r","-s"],{silent:!0}),[r,n]=e.trim().split(` `);return setupCpp.coreExports.debug(`OS Name: ${r}, Version: ${n}`),{osName:r,osVersion:n}}async function getOSInfo(){let e;try{IS_WINDOWS?e=await getWindowsInfo():IS_LINUX?e=await getLinuxInfo():IS_MAC&&(e=await getMacOSInfo())}catch(r){const n=r;setupCpp.coreExports.debug(n.message)}finally{return e}}function getBinaryDirectory(e){return IS_WINDOWS?e:path__namespace.join(e,"bin")}function getDownloadFileName(e){const r=process.env.RUNNER_TEMP||".";return IS_WINDOWS?path__namespace.join(r,path__namespace.basename(e)):void 0}async function installPyPy(e,r,n,t,a){let i;if(a=a!=null?a:await getAvailablePyPyVersions(),!a||a.length===0)throw new Error("No release was found in PyPy version.json");let o=findRelease(a,r,e,n,!1);if(!o||!o.foundAsset)throw new Error(`PyPy version ${r} (${e}) with arch ${n} not found`);const{foundAsset:h,resolvedPythonVersion:c,resolvedPyPyVersion:p}=o,d=`${h.download_url}`;setupCpp.coreExports.info(`Downloading PyPy from "${d}" ...`);try{const f=getDownloadFileName(d),_=await setupCpp.toolCacheExports.downloadTool(d,f);setupCpp.coreExports.info("Extracting downloaded archive..."),IS_WINDOWS?i=await setupCpp.toolCacheExports.extractZip(_):i=await setupCpp.toolCacheExports.extractTar(_,void 0,"x");const m=fs.readdirSync(i)[0],C=path__namespace.join(i,m);let y=C;isNightlyKeyword(p)||(y=await setupCpp.toolCacheExports.cacheDir(C,"PyPy",c,n)),writeExactPyPyVersionFile(y,p);const g=getBinaryDirectory(y);return await createPyPySymlink(g,c),await installPip(g),{installDir:y,resolvedPythonVersion:c,resolvedPyPyVersion:p}}catch(f){throw f instanceof Error&&(f instanceof setupCpp.toolCacheExports.HTTPError&&(f.httpStatusCode===403||f.httpStatusCode===429)?setupCpp.coreExports.info(`Received HTTP status code ${f.httpStatusCode}. This usually indicates the rate limit has been exceeded`):setupCpp.coreExports.info(f.message),f.stack!==void 0&&setupCpp.coreExports.debug(f.stack)),f}}async function getAvailablePyPyVersions(){const e="https://downloads.python.org/pypy/versions.json",n=await new setupCpp.HttpClient("tool-cache").getJson(e);if(!n.result)throw new Error(`Unable to retrieve the list of available PyPy versions from '${e}'`);return n.result}async function createPyPySymlink(e,r){const n=semverExports.coerce(r),t=semverExports.major(n),a=semverExports.minor(n),i=t===2?"":"3",o=`${t}.${a}`,h=IS_WINDOWS?".exe":"";setupCpp.coreExports.info("Creating symlinks..."),createSymlinkInFolder(e,`pypy${i}${h}`,`python${t}${h}`,!0),createSymlinkInFolder(e,`pypy${i}${h}`,`python${h}`,!0),createSymlinkInFolder(e,`pypy${i}${h}`,`pypy${o}${h}`,!0)}async function installPip(e){setupCpp.coreExports.info("Installing and updating pip");const r=path__namespace.join(e,"python");await setupCpp.execExports.exec(`${r} -m ensurepip`),await setupCpp.execExports.exec(`${e}/python -m pip install --ignore-installed pip`)}function findRelease(e,r,n,t,a){const i={includePrerelease:a},o=e.filter(d=>{const f=semverExports.satisfies(semverExports.coerce(d.python_version),r),m=isNightlyKeyword(n)&&isNightlyKeyword(d.pypy_version)||semverExports.satisfies(pypyVersionToSemantic(d.pypy_version),n,i),C=d.files&&(IS_WINDOWS?isArchPresentForWindows(d,t):isArchPresentForMacOrLinux(d,t,process.platform));return f&&m&&C});if(o.length===0)return null;const c=o.sort((d,f)=>semverExports.compare(semverExports.coerce(pypyVersionToSemantic(f.pypy_version)),semverExports.coerce(pypyVersionToSemantic(d.pypy_version)))||semverExports.compare(semverExports.coerce(f.python_version),semverExports.coerce(d.python_version)))[0];return{foundAsset:IS_WINDOWS?findAssetForWindows(c,t):findAssetForMacOrLinux(c,t,process.platform),resolvedPythonVersion:c.python_version,resolvedPyPyVersion:c.pypy_version.trim()}}function pypyVersionToSemantic(e){const r=/(\d+\.\d+\.\d+)((?:a|b|rc))(\d*)/g;return e.replace(r,"$1-$2.$3")}function isArchPresentForWindows(e,r){return r=replaceX32toX86(r),e.files.some(n=>WINDOWS_PLATFORMS.includes(n.platform)&&n.arch===r)}function isArchPresentForMacOrLinux(e,r,n){return e.files.some(t=>t.arch===r&&t.platform===n)}function findAssetForWindows(e,r){return r=replaceX32toX86(r),e.files.find(n=>WINDOWS_PLATFORMS.includes(n.platform)&&n.arch===r)}function findAssetForMacOrLinux(e,r,n){return e.files.find(t=>t.arch===r&&t.platform===n)}function replaceX32toX86(e){return e==="x32"&&(e="x86"),e}async function findPyPyVersion(e,r,n,t,a){let i="",o="",h,c;const p=parsePyPyVersion(e);({installDir:h,resolvedPythonVersion:o,resolvedPyPyVersion:i}=findPyPyToolCache(p.pythonVersion,p.pypyVersion,r)),h||({installDir:h,resolvedPythonVersion:o,resolvedPyPyVersion:i}=await installPyPy(p.pypyVersion,p.pythonVersion,r,a,c));const d=IS_WINDOWS?"Scripts":"bin",f=path__namespace.join(h,d),_=IS_WINDOWS?".exe":"",m=path__namespace.join(IS_WINDOWS?h:f,`python${_}`),C=getBinaryDirectory(h);return setupCpp.coreExports.exportVariable("pythonLocation",h),setupCpp.coreExports.exportVariable("Python_ROOT_DIR",h),setupCpp.coreExports.exportVariable("Python2_ROOT_DIR",h),setupCpp.coreExports.exportVariable("Python3_ROOT_DIR",h),setupCpp.coreExports.exportVariable("PKG_CONFIG_PATH",C+"/lib/pkgconfig"),setupCpp.coreExports.addPath(C),setupCpp.coreExports.addPath(f),setupCpp.coreExports.setOutput("python-version","pypy"+i),setupCpp.coreExports.setOutput("python-path",m),{resolvedPyPyVersion:i,resolvedPythonVersion:o}}function findPyPyToolCache(e,r,n){let t="",a="",i=IS_WINDOWS?findPyPyInstallDirForWindows(e):setupCpp.toolCacheExports.find("PyPy",e,n);return i&&(a=getPyPyVersionFromPath(i),t=readExactPyPyVersionFile(i),semverExports.satisfies(t,r)||(i=null,t="",a="")),i||setupCpp.coreExports.info(`PyPy version ${e} (${r}) was not found in the