Action-SpigotMC/dist/index.js

3 lines
115 KiB
JavaScript

require('./sourcemap-register.js');(()=>{var e={7351:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);i(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issue=t.issueCommand=void 0;const s=a(r(2087));const o=r(5278);function issueCommand(e,t,r){const n=new Command(e,t,r);process.stdout.write(n.toString()+s.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const c="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=c+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const n=this.properties[r];if(n){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(n)}`}}}}e+=`${c}${escapeData(this.message)}`;return e}}function escapeData(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},2186:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);i(t,e);return t};var s=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function fulfilled(e){try{step(n.next(e))}catch(e){i(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){i(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:true});t.getState=t.saveState=t.group=t.endGroup=t.startGroup=t.info=t.warning=t.error=t.debug=t.isDebug=t.setFailed=t.setCommandEcho=t.setOutput=t.getBooleanInput=t.getMultilineInput=t.getInput=t.addPath=t.setSecret=t.exportVariable=t.ExitCode=void 0;const o=r(7351);const c=r(717);const u=r(5278);const l=a(r(2087));const f=a(r(5622));var p;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(p=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const r=u.toCommandValue(t);process.env[e]=r;const n=process.env["GITHUB_ENV"]||"";if(n){const t="_GitHubActionsFileCommandDelimeter_";const n=`${e}<<${t}${l.EOL}${r}${l.EOL}${t}`;c.issueCommand("ENV",n)}else{o.issueCommand("set-env",{name:e},r)}}t.exportVariable=exportVariable;function setSecret(e){o.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){c.issueCommand("PATH",e)}else{o.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${f.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r){throw new Error(`Input required and not supplied: ${e}`)}if(t&&t.trimWhitespace===false){return r}return r.trim()}t.getInput=getInput;function getMultilineInput(e,t){const r=getInput(e,t).split("\n").filter((e=>e!==""));return r}t.getMultilineInput=getMultilineInput;function getBooleanInput(e,t){const r=["true","True","TRUE"];const n=["false","False","FALSE"];const i=getInput(e,t);if(r.includes(i))return true;if(n.includes(i))return false;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e}\n`+`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}t.getBooleanInput=getBooleanInput;function setOutput(e,t){process.stdout.write(l.EOL);o.issueCommand("set-output",{name:e},t)}t.setOutput=setOutput;function setCommandEcho(e){o.issue("echo",e?"on":"off")}t.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=p.Failure;error(e)}t.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}t.isDebug=isDebug;function debug(e){o.issueCommand("debug",{},e)}t.debug=debug;function error(e){o.issue("error",e instanceof Error?e.toString():e)}t.error=error;function warning(e){o.issue("warning",e instanceof Error?e.toString():e)}t.warning=warning;function info(e){process.stdout.write(e+l.EOL)}t.info=info;function startGroup(e){o.issue("group",e)}t.startGroup=startGroup;function endGroup(){o.issue("endgroup")}t.endGroup=endGroup;function group(e,t){return s(this,void 0,void 0,(function*(){startGroup(e);let r;try{r=yield t()}finally{endGroup()}return r}))}t.group=group;function saveState(e,t){o.issueCommand("save-state",{name:e},t)}t.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}t.getState=getState},717:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);i(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issueCommand=void 0;const s=a(r(5747));const o=a(r(2087));const c=r(5278);function issueCommand(e,t){const r=process.env[`GITHUB_${e}`];if(!r){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!s.existsSync(r)){throw new Error(`Missing file at path: ${r}`)}s.appendFileSync(r,`${c.toCommandValue(t)}${o.EOL}`,{encoding:"utf8"})}t.issueCommand=issueCommand},5278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.toCommandValue=void 0;function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}t.toCommandValue=toCommandValue},7888:function(e,t){(function(e,r){true?r(t):0})(this,(function(e){"use strict";function apply(e,...t){return(...r)=>e(...t,...r)}function initialParams(e){return function(...t){var r=t.pop();return e.call(this,t,r)}}var t=typeof setImmediate==="function"&&setImmediate;var r=typeof process==="object"&&typeof process.nextTick==="function";function fallback(e){setTimeout(e,0)}function wrap(e){return(t,...r)=>e((()=>t(...r)))}var n;if(t){n=setImmediate}else if(r){n=process.nextTick}else{n=fallback}var i=wrap(n);function asyncify(e){if(isAsync(e)){return function(...t){const r=t.pop();const n=e.apply(this,t);return handlePromise(n,r)}}return initialParams((function(t,r){var n;try{n=e.apply(this,t)}catch(e){return r(e)}if(n&&typeof n.then==="function"){return handlePromise(n,r)}else{r(null,n)}}))}function handlePromise(e,t){return e.then((e=>{invokeCallback(t,null,e)}),(e=>{invokeCallback(t,e&&e.message?e:new Error(e))}))}function invokeCallback(e,t,r){try{e(t,r)}catch(e){i((e=>{throw e}),e)}}function isAsync(e){return e[Symbol.toStringTag]==="AsyncFunction"}function isAsyncGenerator(e){return e[Symbol.toStringTag]==="AsyncGenerator"}function isAsyncIterable(e){return typeof e[Symbol.asyncIterator]==="function"}function wrapAsync(e){if(typeof e!=="function")throw new Error("expected a function");return isAsync(e)?asyncify(e):e}function awaitify(e,t=e.length){if(!t)throw new Error("arity is undefined");function awaitable(...r){if(typeof r[t-1]==="function"){return e.apply(this,r)}return new Promise(((n,i)=>{r[t-1]=(e,...t)=>{if(e)return i(e);n(t.length>1?t:t[0])};e.apply(this,r)}))}return awaitable}function applyEach(e){return function applyEach(t,...r){const n=awaitify((function(n){var i=this;return e(t,((e,t)=>{wrapAsync(e).apply(i,r.concat(t))}),n)}));return n}}function _asyncMap(e,t,r,n){t=t||[];var i=[];var a=0;var s=wrapAsync(r);return e(t,((e,t,r)=>{var n=a++;s(e,((e,t)=>{i[n]=t;r(e)}))}),(e=>{n(e,i)}))}function isArrayLike(e){return e&&typeof e.length==="number"&&e.length>=0&&e.length%1===0}const a={};function once(e){function wrapper(...t){if(e===null)return;var r=e;e=null;r.apply(this,t)}Object.assign(wrapper,e);return wrapper}function getIterator(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}function createArrayIterator(e){var t=-1;var r=e.length;return function next(){return++t<r?{value:e[t],key:t}:null}}function createES2015Iterator(e){var t=-1;return function next(){var r=e.next();if(r.done)return null;t++;return{value:r.value,key:t}}}function createObjectIterator(e){var t=e?Object.keys(e):[];var r=-1;var n=t.length;return function next(){var i=t[++r];return r<n?{value:e[i],key:i}:null}}function createIterator(e){if(isArrayLike(e)){return createArrayIterator(e)}var t=getIterator(e);return t?createES2015Iterator(t):createObjectIterator(e)}function onlyOnce(e){return function(...t){if(e===null)throw new Error("Callback was already called.");var r=e;e=null;r.apply(this,t)}}function asyncEachOfLimit(e,t,r,n){let i=false;let s=false;let o=false;let c=0;let u=0;function replenish(){if(c>=t||o||i)return;o=true;e.next().then((({value:e,done:t})=>{if(s||i)return;o=false;if(t){i=true;if(c<=0){n(null)}return}c++;r(e,u,iterateeCallback);u++;replenish()})).catch(handleError)}function iterateeCallback(e,t){c-=1;if(s)return;if(e)return handleError(e);if(e===false){i=true;s=true;return}if(t===a||i&&c<=0){i=true;return n(null)}replenish()}function handleError(e){if(s)return;o=false;i=true;n(e)}replenish()}var eachOfLimit=e=>(t,r,n)=>{n=once(n);if(e<=0){throw new RangeError("concurrency limit cannot be less than 1")}if(!t){return n(null)}if(isAsyncGenerator(t)){return asyncEachOfLimit(t,e,r,n)}if(isAsyncIterable(t)){return asyncEachOfLimit(t[Symbol.asyncIterator](),e,r,n)}var i=createIterator(t);var s=false;var o=false;var c=0;var u=false;function iterateeCallback(e,t){if(o)return;c-=1;if(e){s=true;n(e)}else if(e===false){s=true;o=true}else if(t===a||s&&c<=0){s=true;return n(null)}else if(!u){replenish()}}function replenish(){u=true;while(c<e&&!s){var t=i();if(t===null){s=true;if(c<=0){n(null)}return}c+=1;r(t.value,t.key,onlyOnce(iterateeCallback))}u=false}replenish()};function eachOfLimit$1(e,t,r,n){return eachOfLimit(t)(e,wrapAsync(r),n)}var s=awaitify(eachOfLimit$1,4);function eachOfArrayLike(e,t,r){r=once(r);var n=0,i=0,{length:s}=e,o=false;if(s===0){r(null)}function iteratorCallback(e,t){if(e===false){o=true}if(o===true)return;if(e){r(e)}else if(++i===s||t===a){r(null)}}for(;n<s;n++){t(e[n],n,onlyOnce(iteratorCallback))}}function eachOfGeneric(e,t,r){return s(e,Infinity,t,r)}function eachOf(e,t,r){var n=isArrayLike(e)?eachOfArrayLike:eachOfGeneric;return n(e,wrapAsync(t),r)}var o=awaitify(eachOf,3);function map(e,t,r){return _asyncMap(o,e,t,r)}var c=awaitify(map,3);var u=applyEach(c);function eachOfSeries(e,t,r){return s(e,1,t,r)}var l=awaitify(eachOfSeries,3);function mapSeries(e,t,r){return _asyncMap(l,e,t,r)}var f=awaitify(mapSeries,3);var p=applyEach(f);const m=Symbol("promiseCallback");function promiseCallback(){let e,t;function callback(r,...n){if(r)return t(r);e(n.length>1?n:n[0])}callback[m]=new Promise(((r,n)=>{e=r,t=n}));return callback}function auto(e,t,r){if(typeof t!=="number"){r=t;t=null}r=once(r||promiseCallback());var n=Object.keys(e).length;if(!n){return r(null)}if(!t){t=n}var i={};var a=0;var s=false;var o=false;var c=Object.create(null);var u=[];var l=[];var f={};Object.keys(e).forEach((t=>{var r=e[t];if(!Array.isArray(r)){enqueueTask(t,[r]);l.push(t);return}var n=r.slice(0,r.length-1);var i=n.length;if(i===0){enqueueTask(t,r);l.push(t);return}f[t]=i;n.forEach((a=>{if(!e[a]){throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+a+"` in "+n.join(", "))}addListener(a,(()=>{i--;if(i===0){enqueueTask(t,r)}}))}))}));checkForDeadlocks();processQueue();function enqueueTask(e,t){u.push((()=>runTask(e,t)))}function processQueue(){if(s)return;if(u.length===0&&a===0){return r(null,i)}while(u.length&&a<t){var e=u.shift();e()}}function addListener(e,t){var r=c[e];if(!r){r=c[e]=[]}r.push(t)}function taskComplete(e){var t=c[e]||[];t.forEach((e=>e()));processQueue()}function runTask(e,t){if(o)return;var n=onlyOnce(((t,...n)=>{a--;if(t===false){s=true;return}if(n.length<2){[n]=n}if(t){var u={};Object.keys(i).forEach((e=>{u[e]=i[e]}));u[e]=n;o=true;c=Object.create(null);if(s)return;r(t,u)}else{i[e]=n;taskComplete(e)}}));a++;var u=wrapAsync(t[t.length-1]);if(t.length>1){u(i,n)}else{u(n)}}function checkForDeadlocks(){var e;var t=0;while(l.length){e=l.pop();t++;getDependents(e).forEach((e=>{if(--f[e]===0){l.push(e)}}))}if(t!==n){throw new Error("async.auto cannot execute tasks due to a recursive dependency")}}function getDependents(t){var r=[];Object.keys(e).forEach((n=>{const i=e[n];if(Array.isArray(i)&&i.indexOf(t)>=0){r.push(n)}}));return r}return r[m]}var y=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;var d=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;var h=/,/;var g=/(=.+)?(\s*)$/;var v=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function parseParams(e){const t=e.toString().replace(v,"");let r=t.match(y);if(!r){r=t.match(d)}if(!r)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,n]=r;return n.replace(/\s/g,"").split(h).map((e=>e.replace(g,"").trim()))}function autoInject(e,t){var r={};Object.keys(e).forEach((t=>{var n=e[t];var i;var a=isAsync(n);var s=!a&&n.length===1||a&&n.length===0;if(Array.isArray(n)){i=[...n];n=i.pop();r[t]=i.concat(i.length>0?newTask:n)}else if(s){r[t]=n}else{i=parseParams(n);if(n.length===0&&!a&&i.length===0){throw new Error("autoInject task functions require explicit parameters.")}if(!a)i.pop();r[t]=i.concat(newTask)}function newTask(e,t){var r=i.map((t=>e[t]));r.push(t);wrapAsync(n)(...r)}}));return auto(r,t)}class DLL{constructor(){this.head=this.tail=null;this.length=0}removeLink(e){if(e.prev)e.prev.next=e.next;else this.head=e.next;if(e.next)e.next.prev=e.prev;else this.tail=e.prev;e.prev=e.next=null;this.length-=1;return e}empty(){while(this.head)this.shift();return this}insertAfter(e,t){t.prev=e;t.next=e.next;if(e.next)e.next.prev=t;else this.tail=t;e.next=t;this.length+=1}insertBefore(e,t){t.prev=e.prev;t.next=e;if(e.prev)e.prev.next=t;else this.head=t;e.prev=t;this.length+=1}unshift(e){if(this.head)this.insertBefore(this.head,e);else setInitial(this,e)}push(e){if(this.tail)this.insertAfter(this.tail,e);else setInitial(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var e=this.head;while(e){yield e.data;e=e.next}}remove(e){var t=this.head;while(t){var{next:r}=t;if(e(t)){this.removeLink(t)}t=r}return this}}function setInitial(e,t){e.length=1;e.head=e.tail=t}function queue(e,t,r){if(t==null){t=1}else if(t===0){throw new RangeError("Concurrency must not be zero")}var n=wrapAsync(e);var a=0;var s=[];const o={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function on(e,t){o[e].push(t)}function once(e,t){const handleAndRemove=(...r)=>{off(e,handleAndRemove);t(...r)};o[e].push(handleAndRemove)}function off(e,t){if(!e)return Object.keys(o).forEach((e=>o[e]=[]));if(!t)return o[e]=[];o[e]=o[e].filter((e=>e!==t))}function trigger(e,...t){o[e].forEach((e=>e(...t)))}var c=false;function _insert(e,t,r,n){if(n!=null&&typeof n!=="function"){throw new Error("task callback must be a function")}l.started=true;var a,s;function promiseCallback(e,...t){if(e)return r?s(e):a();if(t.length<=1)return a(t[0]);a(t)}var o={data:e,callback:r?promiseCallback:n||promiseCallback};if(t){l._tasks.unshift(o)}else{l._tasks.push(o)}if(!c){c=true;i((()=>{c=false;l.process()}))}if(r||!n){return new Promise(((e,t)=>{a=e;s=t}))}}function _createCB(e){return function(t,...r){a-=1;for(var n=0,i=e.length;n<i;n++){var o=e[n];var c=s.indexOf(o);if(c===0){s.shift()}else if(c>0){s.splice(c,1)}o.callback(t,...r);if(t!=null){trigger("error",t,o.data)}}if(a<=l.concurrency-l.buffer){trigger("unsaturated")}if(l.idle()){trigger("drain")}l.process()}}function _maybeDrain(e){if(e.length===0&&l.idle()){i((()=>trigger("drain")));return true}return false}const eventMethod=e=>t=>{if(!t){return new Promise(((t,r)=>{once(e,((e,n)=>{if(e)return r(e);t(n)}))}))}off(e);on(e,t)};var u=false;var l={_tasks:new DLL,*[Symbol.iterator](){yield*l._tasks[Symbol.iterator]()},concurrency:t,payload:r,buffer:t/4,started:false,paused:false,push(e,t){if(Array.isArray(e)){if(_maybeDrain(e))return;return e.map((e=>_insert(e,false,false,t)))}return _insert(e,false,false,t)},pushAsync(e,t){if(Array.isArray(e)){if(_maybeDrain(e))return;return e.map((e=>_insert(e,false,true,t)))}return _insert(e,false,true,t)},kill(){off();l._tasks.empty()},unshift(e,t){if(Array.isArray(e)){if(_maybeDrain(e))return;return e.map((e=>_insert(e,true,false,t)))}return _insert(e,true,false,t)},unshiftAsync(e,t){if(Array.isArray(e)){if(_maybeDrain(e))return;return e.map((e=>_insert(e,true,true,t)))}return _insert(e,true,true,t)},remove(e){l._tasks.remove(e)},process(){if(u){return}u=true;while(!l.paused&&a<l.concurrency&&l._tasks.length){var e=[],t=[];var r=l._tasks.length;if(l.payload)r=Math.min(r,l.payload);for(var i=0;i<r;i++){var o=l._tasks.shift();e.push(o);s.push(o);t.push(o.data)}a+=1;if(l._tasks.length===0){trigger("empty")}if(a===l.concurrency){trigger("saturated")}var c=onlyOnce(_createCB(e));n(t,c)}u=false},length(){return l._tasks.length},running(){return a},workersList(){return s},idle(){return l._tasks.length+a===0},pause(){l.paused=true},resume(){if(l.paused===false){return}l.paused=false;i(l.process)}};Object.defineProperties(l,{saturated:{writable:false,value:eventMethod("saturated")},unsaturated:{writable:false,value:eventMethod("unsaturated")},empty:{writable:false,value:eventMethod("empty")},drain:{writable:false,value:eventMethod("drain")},error:{writable:false,value:eventMethod("error")}});return l}function cargo(e,t){return queue(e,1,t)}function cargo$1(e,t,r){return queue(e,t,r)}function reduce(e,t,r,n){n=once(n);var i=wrapAsync(r);return l(e,((e,r,n)=>{i(t,e,((e,r)=>{t=r;n(e)}))}),(e=>n(e,t)))}var S=awaitify(reduce,4);function seq(...e){var t=e.map(wrapAsync);return function(...e){var r=this;var n=e[e.length-1];if(typeof n=="function"){e.pop()}else{n=promiseCallback()}S(t,e,((e,t,n)=>{t.apply(r,e.concat(((e,...t)=>{n(e,t)})))}),((e,t)=>n(e,...t)));return n[m]}}function compose(...e){return seq(...e.reverse())}function mapLimit(e,t,r,n){return _asyncMap(eachOfLimit(t),e,r,n)}var E=awaitify(mapLimit,4);function concatLimit(e,t,r,n){var i=wrapAsync(r);return E(e,t,((e,t)=>{i(e,((e,...r)=>{if(e)return t(e);return t(e,r)}))}),((e,t)=>{var r=[];for(var i=0;i<t.length;i++){if(t[i]){r=r.concat(...t[i])}}return n(e,r)}))}var w=awaitify(concatLimit,4);function concat(e,t,r){return w(e,Infinity,t,r)}var b=awaitify(concat,3);function concatSeries(e,t,r){return w(e,1,t,r)}var T=awaitify(concatSeries,3);function constant(...e){return function(...t){var r=t.pop();return r(null,...e)}}function _createTester(e,t){return(r,n,i,s)=>{var o=false;var c;const u=wrapAsync(i);r(n,((r,n,i)=>{u(r,((n,s)=>{if(n||n===false)return i(n);if(e(s)&&!c){o=true;c=t(true,r);return i(null,a)}i()}))}),(e=>{if(e)return s(e);s(null,o?c:t(false))}))}}function detect(e,t,r){return _createTester((e=>e),((e,t)=>t))(o,e,t,r)}var _=awaitify(detect,3);function detectLimit(e,t,r,n){return _createTester((e=>e),((e,t)=>t))(eachOfLimit(t),e,r,n)}var k=awaitify(detectLimit,4);function detectSeries(e,t,r){return _createTester((e=>e),((e,t)=>t))(eachOfLimit(1),e,t,r)}var x=awaitify(detectSeries,3);function consoleFunc(e){return(t,...r)=>wrapAsync(t)(...r,((t,...r)=>{if(typeof console==="object"){if(t){if(console.error){console.error(t)}}else if(console[e]){r.forEach((t=>console[e](t)))}}}))}var A=consoleFunc("dir");function doWhilst(e,t,r){r=onlyOnce(r);var n=wrapAsync(e);var i=wrapAsync(t);var a;function next(e,...t){if(e)return r(e);if(e===false)return;a=t;i(...t,check)}function check(e,t){if(e)return r(e);if(e===false)return;if(!t)return r(null,...a);n(next)}return check(null,true)}var C=awaitify(doWhilst,3);function doUntil(e,t,r){const n=wrapAsync(t);return C(e,((...e)=>{const t=e.pop();n(...e,((e,r)=>t(e,!r)))}),r)}function _withoutIndex(e){return(t,r,n)=>e(t,n)}function eachLimit(e,t,r){return o(e,_withoutIndex(wrapAsync(t)),r)}var N=awaitify(eachLimit,3);function eachLimit$1(e,t,r,n){return eachOfLimit(t)(e,_withoutIndex(wrapAsync(r)),n)}var O=awaitify(eachLimit$1,4);function eachSeries(e,t,r){return O(e,1,t,r)}var I=awaitify(eachSeries,3);function ensureAsync(e){if(isAsync(e))return e;return function(...t){var r=t.pop();var n=true;t.push(((...e)=>{if(n){i((()=>r(...e)))}else{r(...e)}}));e.apply(this,t);n=false}}function every(e,t,r){return _createTester((e=>!e),(e=>!e))(o,e,t,r)}var D=awaitify(every,3);function everyLimit(e,t,r,n){return _createTester((e=>!e),(e=>!e))(eachOfLimit(t),e,r,n)}var L=awaitify(everyLimit,4);function everySeries(e,t,r){return _createTester((e=>!e),(e=>!e))(l,e,t,r)}var P=awaitify(everySeries,3);function filterArray(e,t,r,n){var i=new Array(t.length);e(t,((e,t,n)=>{r(e,((e,r)=>{i[t]=!!r;n(e)}))}),(e=>{if(e)return n(e);var r=[];for(var a=0;a<t.length;a++){if(i[a])r.push(t[a])}n(null,r)}))}function filterGeneric(e,t,r,n){var i=[];e(t,((e,t,n)=>{r(e,((r,a)=>{if(r)return n(r);if(a){i.push({index:t,value:e})}n(r)}))}),(e=>{if(e)return n(e);n(null,i.sort(((e,t)=>e.index-t.index)).map((e=>e.value)))}))}function _filter(e,t,r,n){var i=isArrayLike(t)?filterArray:filterGeneric;return i(e,t,wrapAsync(r),n)}function filter(e,t,r){return _filter(o,e,t,r)}var j=awaitify(filter,3);function filterLimit(e,t,r,n){return _filter(eachOfLimit(t),e,r,n)}var M=awaitify(filterLimit,4);function filterSeries(e,t,r){return _filter(l,e,t,r)}var R=awaitify(filterSeries,3);function forever(e,t){var r=onlyOnce(t);var n=wrapAsync(ensureAsync(e));function next(e){if(e)return r(e);if(e===false)return;n(next)}return next()}var B=awaitify(forever,2);function groupByLimit(e,t,r,n){var i=wrapAsync(r);return E(e,t,((e,t)=>{i(e,((r,n)=>{if(r)return t(r);return t(r,{key:n,val:e})}))}),((e,t)=>{var r={};var{hasOwnProperty:i}=Object.prototype;for(var a=0;a<t.length;a++){if(t[a]){var{key:s}=t[a];var{val:o}=t[a];if(i.call(r,s)){r[s].push(o)}else{r[s]=[o]}}}return n(e,r)}))}var K=awaitify(groupByLimit,4);function groupBy(e,t,r){return K(e,Infinity,t,r)}function groupBySeries(e,t,r){return K(e,1,t,r)}var $=consoleFunc("log");function mapValuesLimit(e,t,r,n){n=once(n);var i={};var a=wrapAsync(r);return eachOfLimit(t)(e,((e,t,r)=>{a(e,t,((e,n)=>{if(e)return r(e);i[t]=n;r(e)}))}),(e=>n(e,i)))}var q=awaitify(mapValuesLimit,4);function mapValues(e,t,r){return q(e,Infinity,t,r)}function mapValuesSeries(e,t,r){return q(e,1,t,r)}function memoize(e,t=(e=>e)){var r=Object.create(null);var n=Object.create(null);var a=wrapAsync(e);var s=initialParams(((e,s)=>{var o=t(...e);if(o in r){i((()=>s(null,...r[o])))}else if(o in n){n[o].push(s)}else{n[o]=[s];a(...e,((e,...t)=>{if(!e){r[o]=t}var i=n[o];delete n[o];for(var a=0,s=i.length;a<s;a++){i[a](e,...t)}}))}}));s.memo=r;s.unmemoized=e;return s}var U;if(r){U=process.nextTick}else if(t){U=setImmediate}else{U=fallback}var W=wrap(U);var V=awaitify(((e,t,r)=>{var n=isArrayLike(t)?[]:{};e(t,((e,t,r)=>{wrapAsync(e)(((e,...i)=>{if(i.length<2){[i]=i}n[t]=i;r(e)}))}),(e=>r(e,n)))}),3);function parallel$1(e,t){return V(o,e,t)}function parallelLimit(e,t,r){return V(eachOfLimit(t),e,r)}function queue$1(e,t){var r=wrapAsync(e);return queue(((e,t)=>{r(e[0],t)}),t,1)}class Heap{constructor(){this.heap=[];this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){this.heap=[];return this}percUp(e){let t;while(e>0&&smaller(this.heap[e],this.heap[t=parent(e)])){let r=this.heap[e];this.heap[e]=this.heap[t];this.heap[t]=r;e=t}}percDown(e){let t;while((t=leftChi(e))<this.heap.length){if(t+1<this.heap.length&&smaller(this.heap[t+1],this.heap[t])){t=t+1}if(smaller(this.heap[e],this.heap[t])){break}let r=this.heap[e];this.heap[e]=this.heap[t];this.heap[t]=r;e=t}}push(e){e.pushCount=++this.pushCount;this.heap.push(e);this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;this.heap[0]=this.heap[this.heap.length-1];this.heap.pop();this.percDown(0);return e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++){yield this.heap[e].data}}remove(e){let t=0;for(let r=0;r<this.heap.length;r++){if(!e(this.heap[r])){this.heap[t]=this.heap[r];t++}}this.heap.splice(t);for(let e=parent(this.heap.length-1);e>=0;e--){this.percDown(e)}return this}}function leftChi(e){return(e<<1)+1}function parent(e){return(e+1>>1)-1}function smaller(e,t){if(e.priority!==t.priority){return e.priority<t.priority}else{return e.pushCount<t.pushCount}}function priorityQueue(e,t){var r=queue$1(e,t);r._tasks=new Heap;r.push=function(e,t=0,n=(()=>{})){if(typeof n!=="function"){throw new Error("task callback must be a function")}r.started=true;if(!Array.isArray(e)){e=[e]}if(e.length===0&&r.idle()){return i((()=>r.drain()))}for(var a=0,s=e.length;a<s;a++){var o={data:e[a],priority:t,callback:n};r._tasks.push(o)}i(r.process)};delete r.unshift;return r}function race(e,t){t=once(t);if(!Array.isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var r=0,n=e.length;r<n;r++){wrapAsync(e[r])(t)}}var G=awaitify(race,2);function reduceRight(e,t,r,n){var i=[...e].reverse();return S(i,t,r,n)}function reflect(e){var t=wrapAsync(e);return initialParams((function reflectOn(e,r){e.push(((e,...t)=>{let n={};if(e){n.error=e}if(t.length>0){var i=t;if(t.length<=1){[i]=t}n.value=i}r(null,n)}));return t.apply(this,e)}))}function reflectAll(e){var t;if(Array.isArray(e)){t=e.map(reflect)}else{t={};Object.keys(e).forEach((r=>{t[r]=reflect.call(this,e[r])}))}return t}function reject(e,t,r,n){const i=wrapAsync(r);return _filter(e,t,((e,t)=>{i(e,((e,r)=>{t(e,!r)}))}),n)}function reject$1(e,t,r){return reject(o,e,t,r)}var X=awaitify(reject$1,3);function rejectLimit(e,t,r,n){return reject(eachOfLimit(t),e,r,n)}var Y=awaitify(rejectLimit,4);function rejectSeries(e,t,r){return reject(l,e,t,r)}var Q=awaitify(rejectSeries,3);function constant$1(e){return function(){return e}}const H=5;const J=0;function retry(e,t,r){var n={times:H,intervalFunc:constant$1(J)};if(arguments.length<3&&typeof e==="function"){r=t||promiseCallback();t=e}else{parseTimes(n,e);r=r||promiseCallback()}if(typeof t!=="function"){throw new Error("Invalid arguments for async.retry")}var i=wrapAsync(t);var a=1;function retryAttempt(){i(((e,...t)=>{if(e===false)return;if(e&&a++<n.times&&(typeof n.errorFilter!="function"||n.errorFilter(e))){setTimeout(retryAttempt,n.intervalFunc(a-1))}else{r(e,...t)}}))}retryAttempt();return r[m]}function parseTimes(e,t){if(typeof t==="object"){e.times=+t.times||H;e.intervalFunc=typeof t.interval==="function"?t.interval:constant$1(+t.interval||J);e.errorFilter=t.errorFilter}else if(typeof t==="number"||typeof t==="string"){e.times=+t||H}else{throw new Error("Invalid arguments for async.retry")}}function retryable(e,t){if(!t){t=e;e=null}let r=e&&e.arity||t.length;if(isAsync(t)){r+=1}var n=wrapAsync(t);return initialParams(((t,i)=>{if(t.length<r-1||i==null){t.push(i);i=promiseCallback()}function taskFn(e){n(...t,e)}if(e)retry(e,taskFn,i);else retry(taskFn,i);return i[m]}))}function series(e,t){return V(l,e,t)}function some(e,t,r){return _createTester(Boolean,(e=>e))(o,e,t,r)}var z=awaitify(some,3);function someLimit(e,t,r,n){return _createTester(Boolean,(e=>e))(eachOfLimit(t),e,r,n)}var Z=awaitify(someLimit,4);function someSeries(e,t,r){return _createTester(Boolean,(e=>e))(l,e,t,r)}var ee=awaitify(someSeries,3);function sortBy(e,t,r){var n=wrapAsync(t);return c(e,((e,t)=>{n(e,((r,n)=>{if(r)return t(r);t(r,{value:e,criteria:n})}))}),((e,t)=>{if(e)return r(e);r(null,t.sort(comparator).map((e=>e.value)))}));function comparator(e,t){var r=e.criteria,n=t.criteria;return r<n?-1:r>n?1:0}}var te=awaitify(sortBy,3);function timeout(e,t,r){var n=wrapAsync(e);return initialParams(((i,a)=>{var s=false;var o;function timeoutCallback(){var t=e.name||"anonymous";var n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT";if(r){n.info=r}s=true;a(n)}i.push(((...e)=>{if(!s){a(...e);clearTimeout(o)}}));o=setTimeout(timeoutCallback,t);n(...i)}))}function range(e){var t=Array(e);while(e--){t[e]=e}return t}function timesLimit(e,t,r,n){var i=wrapAsync(r);return E(range(e),t,i,n)}function times(e,t,r){return timesLimit(e,Infinity,t,r)}function timesSeries(e,t,r){return timesLimit(e,1,t,r)}function transform(e,t,r,n){if(arguments.length<=3&&typeof t==="function"){n=r;r=t;t=Array.isArray(e)?[]:{}}n=once(n||promiseCallback());var i=wrapAsync(r);o(e,((e,r,n)=>{i(t,e,r,n)}),(e=>n(e,t)));return n[m]}function tryEach(e,t){var r=null;var n;return I(e,((e,t)=>{wrapAsync(e)(((e,...i)=>{if(e===false)return t(e);if(i.length<2){[n]=i}else{n=i}r=e;t(e?null:{})}))}),(()=>t(r,n)))}var re=awaitify(tryEach);function unmemoize(e){return(...t)=>(e.unmemoized||e)(...t)}function whilst(e,t,r){r=onlyOnce(r);var n=wrapAsync(t);var i=wrapAsync(e);var a=[];function next(e,...t){if(e)return r(e);a=t;if(e===false)return;i(check)}function check(e,t){if(e)return r(e);if(e===false)return;if(!t)return r(null,...a);n(next)}return i(check)}var ne=awaitify(whilst,3);function until(e,t,r){const n=wrapAsync(e);return ne((e=>n(((t,r)=>e(t,!r)))),t,r)}function waterfall(e,t){t=once(t);if(!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function nextTask(t){var n=wrapAsync(e[r++]);n(...t,onlyOnce(next))}function next(n,...i){if(n===false)return;if(n||r===e.length){return t(n,...i)}nextTask(i)}nextTask([])}var ie=awaitify(waterfall);var ae={apply:apply,applyEach:u,applyEachSeries:p,asyncify:asyncify,auto:auto,autoInject:autoInject,cargo:cargo,cargoQueue:cargo$1,compose:compose,concat:b,concatLimit:w,concatSeries:T,constant:constant,detect:_,detectLimit:k,detectSeries:x,dir:A,doUntil:doUntil,doWhilst:C,each:N,eachLimit:O,eachOf:o,eachOfLimit:s,eachOfSeries:l,eachSeries:I,ensureAsync:ensureAsync,every:D,everyLimit:L,everySeries:P,filter:j,filterLimit:M,filterSeries:R,forever:B,groupBy:groupBy,groupByLimit:K,groupBySeries:groupBySeries,log:$,map:c,mapLimit:E,mapSeries:f,mapValues:mapValues,mapValuesLimit:q,mapValuesSeries:mapValuesSeries,memoize:memoize,nextTick:W,parallel:parallel$1,parallelLimit:parallelLimit,priorityQueue:priorityQueue,queue:queue$1,race:G,reduce:S,reduceRight:reduceRight,reflect:reflect,reflectAll:reflectAll,reject:X,rejectLimit:Y,rejectSeries:Q,retry:retry,retryable:retryable,seq:seq,series:series,setImmediate:i,some:z,someLimit:Z,someSeries:ee,sortBy:te,timeout:timeout,times:times,timesLimit:timesLimit,timesSeries:timesSeries,transform:transform,tryEach:re,unmemoize:unmemoize,until:until,waterfall:ie,whilst:ne,all:D,allLimit:L,allSeries:P,any:z,anyLimit:Z,anySeries:ee,find:_,findLimit:k,findSeries:x,flatMap:b,flatMapLimit:w,flatMapSeries:T,forEach:N,forEachSeries:I,forEachLimit:O,forEachOf:o,forEachOfSeries:l,forEachOfLimit:s,inject:S,foldl:S,foldr:reduceRight,select:j,selectLimit:M,selectSeries:R,wrapSync:asyncify,during:ne,doDuring:C};e.default=ae;e.apply=apply;e.applyEach=u;e.applyEachSeries=p;e.asyncify=asyncify;e.auto=auto;e.autoInject=autoInject;e.cargo=cargo;e.cargoQueue=cargo$1;e.compose=compose;e.concat=b;e.concatLimit=w;e.concatSeries=T;e.constant=constant;e.detect=_;e.detectLimit=k;e.detectSeries=x;e.dir=A;e.doUntil=doUntil;e.doWhilst=C;e.each=N;e.eachLimit=O;e.eachOf=o;e.eachOfLimit=s;e.eachOfSeries=l;e.eachSeries=I;e.ensureAsync=ensureAsync;e.every=D;e.everyLimit=L;e.everySeries=P;e.filter=j;e.filterLimit=M;e.filterSeries=R;e.forever=B;e.groupBy=groupBy;e.groupByLimit=K;e.groupBySeries=groupBySeries;e.log=$;e.map=c;e.mapLimit=E;e.mapSeries=f;e.mapValues=mapValues;e.mapValuesLimit=q;e.mapValuesSeries=mapValuesSeries;e.memoize=memoize;e.nextTick=W;e.parallel=parallel$1;e.parallelLimit=parallelLimit;e.priorityQueue=priorityQueue;e.queue=queue$1;e.race=G;e.reduce=S;e.reduceRight=reduceRight;e.reflect=reflect;e.reflectAll=reflectAll;e.reject=X;e.rejectLimit=Y;e.rejectSeries=Q;e.retry=retry;e.retryable=retryable;e.seq=seq;e.series=series;e.setImmediate=i;e.some=z;e.someLimit=Z;e.someSeries=ee;e.sortBy=te;e.timeout=timeout;e.times=times;e.timesLimit=timesLimit;e.timesSeries=timesSeries;e.transform=transform;e.tryEach=re;e.unmemoize=unmemoize;e.until=until;e.waterfall=ie;e.whilst=ne;e.all=D;e.allLimit=L;e.allSeries=P;e.any=z;e.anyLimit=Z;e.anySeries=ee;e.find=_;e.findLimit=k;e.findSeries=x;e.flatMap=b;e.flatMapLimit=w;e.flatMapSeries=T;e.forEach=N;e.forEachSeries=I;e.forEachLimit=O;e.forEachOf=o;e.forEachOfSeries=l;e.forEachOfLimit=s;e.inject=S;e.foldl=S;e.foldr=reduceRight;e.select=j;e.selectLimit=M;e.selectSeries=R;e.wrapSync=asyncify;e.during=ne;e.doDuring=C;Object.defineProperty(e,"__esModule",{value:true})}))},3338:(e,t,r)=>{"use strict";const n=r(7758);const i=r(5622);const a=r(8605).mkdirsSync;const s=r(2548).utimesMillisSync;const o=r(3901);function copySync(e,t,r){if(typeof r==="function"){r={filter:r}}r=r||{};r.clobber="clobber"in r?!!r.clobber:true;r.overwrite="overwrite"in r?!!r.overwrite:r.clobber;if(r.preserveTimestamps&&process.arch==="ia32"){console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269`)}const{srcStat:n,destStat:i}=o.checkPathsSync(e,t,"copy",r);o.checkParentPathsSync(e,n,t,"copy");return handleFilterAndCopy(i,e,t,r)}function handleFilterAndCopy(e,t,r,s){if(s.filter&&!s.filter(t,r))return;const o=i.dirname(r);if(!n.existsSync(o))a(o);return getStats(e,t,r,s)}function startCopy(e,t,r,n){if(n.filter&&!n.filter(t,r))return;return getStats(e,t,r,n)}function getStats(e,t,r,i){const a=i.dereference?n.statSync:n.lstatSync;const s=a(t);if(s.isDirectory())return onDir(s,e,t,r,i);else if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return onFile(s,e,t,r,i);else if(s.isSymbolicLink())return onLink(e,t,r,i);else if(s.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);else if(s.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function onFile(e,t,r,n,i){if(!t)return copyFile(e,r,n,i);return mayCopyFile(e,r,n,i)}function mayCopyFile(e,t,r,i){if(i.overwrite){n.unlinkSync(r);return copyFile(e,t,r,i)}else if(i.errorOnExist){throw new Error(`'${r}' already exists`)}}function copyFile(e,t,r,i){n.copyFileSync(t,r);if(i.preserveTimestamps)handleTimestamps(e.mode,t,r);return setDestMode(r,e.mode)}function handleTimestamps(e,t,r){if(fileIsNotWritable(e))makeFileWritable(r,e);return setDestTimestamps(t,r)}function fileIsNotWritable(e){return(e&128)===0}function makeFileWritable(e,t){return setDestMode(e,t|128)}function setDestMode(e,t){return n.chmodSync(e,t)}function setDestTimestamps(e,t){const r=n.statSync(e);return s(t,r.atime,r.mtime)}function onDir(e,t,r,n,i){if(!t)return mkDirAndCopy(e.mode,r,n,i);return copyDir(r,n,i)}function mkDirAndCopy(e,t,r,i){n.mkdirSync(r);copyDir(t,r,i);return setDestMode(r,e)}function copyDir(e,t,r){n.readdirSync(e).forEach((n=>copyDirItem(n,e,t,r)))}function copyDirItem(e,t,r,n){const a=i.join(t,e);const s=i.join(r,e);const{destStat:c}=o.checkPathsSync(a,s,"copy",n);return startCopy(c,a,s,n)}function onLink(e,t,r,a){let s=n.readlinkSync(t);if(a.dereference){s=i.resolve(process.cwd(),s)}if(!e){return n.symlinkSync(s,r)}else{let e;try{e=n.readlinkSync(r)}catch(e){if(e.code==="EINVAL"||e.code==="UNKNOWN")return n.symlinkSync(s,r);throw e}if(a.dereference){e=i.resolve(process.cwd(),e)}if(o.isSrcSubdir(s,e)){throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${e}'.`)}if(n.statSync(r).isDirectory()&&o.isSrcSubdir(e,s)){throw new Error(`Cannot overwrite '${e}' with '${s}'.`)}return copyLink(s,r)}}function copyLink(e,t){n.unlinkSync(t);return n.symlinkSync(e,t)}e.exports=copySync},1135:(e,t,r)=>{"use strict";e.exports={copySync:r(3338)}},8834:(e,t,r)=>{"use strict";const n=r(7758);const i=r(5622);const a=r(8605).mkdirs;const s=r(3835).pathExists;const o=r(2548).utimesMillis;const c=r(3901);function copy(e,t,r,n){if(typeof r==="function"&&!n){n=r;r={}}else if(typeof r==="function"){r={filter:r}}n=n||function(){};r=r||{};r.clobber="clobber"in r?!!r.clobber:true;r.overwrite="overwrite"in r?!!r.overwrite:r.clobber;if(r.preserveTimestamps&&process.arch==="ia32"){console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269`)}c.checkPaths(e,t,"copy",r,((i,a)=>{if(i)return n(i);const{srcStat:s,destStat:o}=a;c.checkParentPaths(e,s,t,"copy",(i=>{if(i)return n(i);if(r.filter)return handleFilter(checkParentDir,o,e,t,r,n);return checkParentDir(o,e,t,r,n)}))}))}function checkParentDir(e,t,r,n,o){const c=i.dirname(r);s(c,((i,s)=>{if(i)return o(i);if(s)return getStats(e,t,r,n,o);a(c,(i=>{if(i)return o(i);return getStats(e,t,r,n,o)}))}))}function handleFilter(e,t,r,n,i,a){Promise.resolve(i.filter(r,n)).then((s=>{if(s)return e(t,r,n,i,a);return a()}),(e=>a(e)))}function startCopy(e,t,r,n,i){if(n.filter)return handleFilter(getStats,e,t,r,n,i);return getStats(e,t,r,n,i)}function getStats(e,t,r,i,a){const s=i.dereference?n.stat:n.lstat;s(t,((n,s)=>{if(n)return a(n);if(s.isDirectory())return onDir(s,e,t,r,i,a);else if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return onFile(s,e,t,r,i,a);else if(s.isSymbolicLink())return onLink(e,t,r,i,a);else if(s.isSocket())return a(new Error(`Cannot copy a socket file: ${t}`));else if(s.isFIFO())return a(new Error(`Cannot copy a FIFO pipe: ${t}`));return a(new Error(`Unknown file: ${t}`))}))}function onFile(e,t,r,n,i,a){if(!t)return copyFile(e,r,n,i,a);return mayCopyFile(e,r,n,i,a)}function mayCopyFile(e,t,r,i,a){if(i.overwrite){n.unlink(r,(n=>{if(n)return a(n);return copyFile(e,t,r,i,a)}))}else if(i.errorOnExist){return a(new Error(`'${r}' already exists`))}else return a()}function copyFile(e,t,r,i,a){n.copyFile(t,r,(n=>{if(n)return a(n);if(i.preserveTimestamps)return handleTimestampsAndMode(e.mode,t,r,a);return setDestMode(r,e.mode,a)}))}function handleTimestampsAndMode(e,t,r,n){if(fileIsNotWritable(e)){return makeFileWritable(r,e,(i=>{if(i)return n(i);return setDestTimestampsAndMode(e,t,r,n)}))}return setDestTimestampsAndMode(e,t,r,n)}function fileIsNotWritable(e){return(e&128)===0}function makeFileWritable(e,t,r){return setDestMode(e,t|128,r)}function setDestTimestampsAndMode(e,t,r,n){setDestTimestamps(t,r,(t=>{if(t)return n(t);return setDestMode(r,e,n)}))}function setDestMode(e,t,r){return n.chmod(e,t,r)}function setDestTimestamps(e,t,r){n.stat(e,((e,n)=>{if(e)return r(e);return o(t,n.atime,n.mtime,r)}))}function onDir(e,t,r,n,i,a){if(!t)return mkDirAndCopy(e.mode,r,n,i,a);return copyDir(r,n,i,a)}function mkDirAndCopy(e,t,r,i,a){n.mkdir(r,(n=>{if(n)return a(n);copyDir(t,r,i,(t=>{if(t)return a(t);return setDestMode(r,e,a)}))}))}function copyDir(e,t,r,i){n.readdir(e,((n,a)=>{if(n)return i(n);return copyDirItems(a,e,t,r,i)}))}function copyDirItems(e,t,r,n,i){const a=e.pop();if(!a)return i();return copyDirItem(e,a,t,r,n,i)}function copyDirItem(e,t,r,n,a,s){const o=i.join(r,t);const u=i.join(n,t);c.checkPaths(o,u,"copy",a,((t,i)=>{if(t)return s(t);const{destStat:c}=i;startCopy(c,o,u,a,(t=>{if(t)return s(t);return copyDirItems(e,r,n,a,s)}))}))}function onLink(e,t,r,a,s){n.readlink(t,((t,o)=>{if(t)return s(t);if(a.dereference){o=i.resolve(process.cwd(),o)}if(!e){return n.symlink(o,r,s)}else{n.readlink(r,((t,u)=>{if(t){if(t.code==="EINVAL"||t.code==="UNKNOWN")return n.symlink(o,r,s);return s(t)}if(a.dereference){u=i.resolve(process.cwd(),u)}if(c.isSrcSubdir(o,u)){return s(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`))}if(e.isDirectory()&&c.isSrcSubdir(u,o)){return s(new Error(`Cannot overwrite '${u}' with '${o}'.`))}return copyLink(o,r,s)}))}}))}function copyLink(e,t,r){n.unlink(t,(i=>{if(i)return r(i);return n.symlink(e,t,r)}))}e.exports=copy},1335:(e,t,r)=>{"use strict";const n=r(9046).fromCallback;e.exports={copy:n(r(8834))}},6970:(e,t,r)=>{"use strict";const n=r(9046).fromPromise;const i=r(1176);const a=r(5622);const s=r(8605);const o=r(7357);const c=n((async function emptyDir(e){let t;try{t=await i.readdir(e)}catch{return s.mkdirs(e)}return Promise.all(t.map((t=>o.remove(a.join(e,t)))))}));function emptyDirSync(e){let t;try{t=i.readdirSync(e)}catch{return s.mkdirsSync(e)}t.forEach((t=>{t=a.join(e,t);o.removeSync(t)}))}e.exports={emptyDirSync:emptyDirSync,emptydirSync:emptyDirSync,emptyDir:c,emptydir:c}},2164:(e,t,r)=>{"use strict";const n=r(9046).fromCallback;const i=r(5622);const a=r(7758);const s=r(8605);function createFile(e,t){function makeFile(){a.writeFile(e,"",(e=>{if(e)return t(e);t()}))}a.stat(e,((r,n)=>{if(!r&&n.isFile())return t();const o=i.dirname(e);a.stat(o,((e,r)=>{if(e){if(e.code==="ENOENT"){return s.mkdirs(o,(e=>{if(e)return t(e);makeFile()}))}return t(e)}if(r.isDirectory())makeFile();else{a.readdir(o,(e=>{if(e)return t(e)}))}}))}))}function createFileSync(e){let t;try{t=a.statSync(e)}catch{}if(t&&t.isFile())return;const r=i.dirname(e);try{if(!a.statSync(r).isDirectory()){a.readdirSync(r)}}catch(e){if(e&&e.code==="ENOENT")s.mkdirsSync(r);else throw e}a.writeFileSync(e,"")}e.exports={createFile:n(createFile),createFileSync:createFileSync}},55:(e,t,r)=>{"use strict";const n=r(2164);const i=r(3797);const a=r(2549);e.exports={createFile:n.createFile,createFileSync:n.createFileSync,ensureFile:n.createFile,ensureFileSync:n.createFileSync,createLink:i.createLink,createLinkSync:i.createLinkSync,ensureLink:i.createLink,ensureLinkSync:i.createLinkSync,createSymlink:a.createSymlink,createSymlinkSync:a.createSymlinkSync,ensureSymlink:a.createSymlink,ensureSymlinkSync:a.createSymlinkSync}},3797:(e,t,r)=>{"use strict";const n=r(9046).fromCallback;const i=r(5622);const a=r(7758);const s=r(8605);const o=r(3835).pathExists;const{areIdentical:c}=r(3901);function createLink(e,t,r){function makeLink(e,t){a.link(e,t,(e=>{if(e)return r(e);r(null)}))}a.lstat(t,((n,u)=>{a.lstat(e,((n,a)=>{if(n){n.message=n.message.replace("lstat","ensureLink");return r(n)}if(u&&c(a,u))return r(null);const l=i.dirname(t);o(l,((n,i)=>{if(n)return r(n);if(i)return makeLink(e,t);s.mkdirs(l,(n=>{if(n)return r(n);makeLink(e,t)}))}))}))}))}function createLinkSync(e,t){let r;try{r=a.lstatSync(t)}catch{}try{const t=a.lstatSync(e);if(r&&c(t,r))return}catch(e){e.message=e.message.replace("lstat","ensureLink");throw e}const n=i.dirname(t);const o=a.existsSync(n);if(o)return a.linkSync(e,t);s.mkdirsSync(n);return a.linkSync(e,t)}e.exports={createLink:n(createLink),createLinkSync:createLinkSync}},3727:(e,t,r)=>{"use strict";const n=r(5622);const i=r(7758);const a=r(3835).pathExists;function symlinkPaths(e,t,r){if(n.isAbsolute(e)){return i.lstat(e,(t=>{if(t){t.message=t.message.replace("lstat","ensureSymlink");return r(t)}return r(null,{toCwd:e,toDst:e})}))}else{const s=n.dirname(t);const o=n.join(s,e);return a(o,((t,a)=>{if(t)return r(t);if(a){return r(null,{toCwd:o,toDst:e})}else{return i.lstat(e,(t=>{if(t){t.message=t.message.replace("lstat","ensureSymlink");return r(t)}return r(null,{toCwd:e,toDst:n.relative(s,e)})}))}}))}}function symlinkPathsSync(e,t){let r;if(n.isAbsolute(e)){r=i.existsSync(e);if(!r)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{const a=n.dirname(t);const s=n.join(a,e);r=i.existsSync(s);if(r){return{toCwd:s,toDst:e}}else{r=i.existsSync(e);if(!r)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:n.relative(a,e)}}}}e.exports={symlinkPaths:symlinkPaths,symlinkPathsSync:symlinkPathsSync}},8254:(e,t,r)=>{"use strict";const n=r(7758);function symlinkType(e,t,r){r=typeof t==="function"?t:r;t=typeof t==="function"?false:t;if(t)return r(null,t);n.lstat(e,((e,n)=>{if(e)return r(null,"file");t=n&&n.isDirectory()?"dir":"file";r(null,t)}))}function symlinkTypeSync(e,t){let r;if(t)return t;try{r=n.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}e.exports={symlinkType:symlinkType,symlinkTypeSync:symlinkTypeSync}},2549:(e,t,r)=>{"use strict";const n=r(9046).fromCallback;const i=r(5622);const a=r(1176);const s=r(8605);const o=s.mkdirs;const c=s.mkdirsSync;const u=r(3727);const l=u.symlinkPaths;const f=u.symlinkPathsSync;const p=r(8254);const m=p.symlinkType;const y=p.symlinkTypeSync;const d=r(3835).pathExists;const{areIdentical:h}=r(3901);function createSymlink(e,t,r,n){n=typeof r==="function"?r:n;r=typeof r==="function"?false:r;a.lstat(t,((i,s)=>{if(!i&&s.isSymbolicLink()){Promise.all([a.stat(e),a.stat(t)]).then((([i,a])=>{if(h(i,a))return n(null);_createSymlink(e,t,r,n)}))}else _createSymlink(e,t,r,n)}))}function _createSymlink(e,t,r,n){l(e,t,((s,c)=>{if(s)return n(s);e=c.toDst;m(c.toCwd,r,((r,s)=>{if(r)return n(r);const c=i.dirname(t);d(c,((r,i)=>{if(r)return n(r);if(i)return a.symlink(e,t,s,n);o(c,(r=>{if(r)return n(r);a.symlink(e,t,s,n)}))}))}))}))}function createSymlinkSync(e,t,r){let n;try{n=a.lstatSync(t)}catch{}if(n&&n.isSymbolicLink()){const r=a.statSync(e);const n=a.statSync(t);if(h(r,n))return}const s=f(e,t);e=s.toDst;r=y(s.toCwd,r);const o=i.dirname(t);const u=a.existsSync(o);if(u)return a.symlinkSync(e,t,r);c(o);return a.symlinkSync(e,t,r)}e.exports={createSymlink:n(createSymlink),createSymlinkSync:createSymlinkSync}},1176:(e,t,r)=>{"use strict";const n=r(9046).fromCallback;const i=r(7758);const a=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>typeof i[e]==="function"));Object.assign(t,i);a.forEach((e=>{t[e]=n(i[e])}));t.realpath.native=n(i.realpath.native);t.exists=function(e,t){if(typeof t==="function"){return i.exists(e,t)}return new Promise((t=>i.exists(e,t)))};t.read=function(e,t,r,n,a,s){if(typeof s==="function"){return i.read(e,t,r,n,a,s)}return new Promise(((s,o)=>{i.read(e,t,r,n,a,((e,t,r)=>{if(e)return o(e);s({bytesRead:t,buffer:r})}))}))};t.write=function(e,t,...r){if(typeof r[r.length-1]==="function"){return i.write(e,t,...r)}return new Promise(((n,a)=>{i.write(e,t,...r,((e,t,r)=>{if(e)return a(e);n({bytesWritten:t,buffer:r})}))}))};if(typeof i.writev==="function"){t.writev=function(e,t,...r){if(typeof r[r.length-1]==="function"){return i.writev(e,t,...r)}return new Promise(((n,a)=>{i.writev(e,t,...r,((e,t,r)=>{if(e)return a(e);n({bytesWritten:t,buffers:r})}))}))}}},5630:(e,t,r)=>{"use strict";e.exports={...r(1176),...r(1135),...r(1335),...r(6970),...r(55),...r(213),...r(8605),...r(9665),...r(1497),...r(6570),...r(3835),...r(7357)}},213:(e,t,r)=>{"use strict";const n=r(9046).fromPromise;const i=r(8970);i.outputJson=n(r(531));i.outputJsonSync=r(9421);i.outputJSON=i.outputJson;i.outputJSONSync=i.outputJsonSync;i.writeJSON=i.writeJson;i.writeJSONSync=i.writeJsonSync;i.readJSON=i.readJson;i.readJSONSync=i.readJsonSync;e.exports=i},8970:(e,t,r)=>{"use strict";const n=r(6160);e.exports={readJson:n.readFile,readJsonSync:n.readFileSync,writeJson:n.writeFile,writeJsonSync:n.writeFileSync}},9421:(e,t,r)=>{"use strict";const{stringify:n}=r(5902);const{outputFileSync:i}=r(6570);function outputJsonSync(e,t,r){const a=n(t,r);i(e,a,r)}e.exports=outputJsonSync},531:(e,t,r)=>{"use strict";const{stringify:n}=r(5902);const{outputFile:i}=r(6570);async function outputJson(e,t,r={}){const a=n(t,r);await i(e,a,r)}e.exports=outputJson},8605:(e,t,r)=>{"use strict";const n=r(9046).fromPromise;const{makeDir:i,makeDirSync:a}=r(2751);const s=n(i);e.exports={mkdirs:s,mkdirsSync:a,mkdirp:s,mkdirpSync:a,ensureDir:s,ensureDirSync:a}},2751:(e,t,r)=>{"use strict";const n=r(1176);const{checkPath:i}=r(9907);const getMode=e=>{const t={mode:511};if(typeof e==="number")return e;return{...t,...e}.mode};e.exports.makeDir=async(e,t)=>{i(e);return n.mkdir(e,{mode:getMode(t),recursive:true})};e.exports.makeDirSync=(e,t)=>{i(e);return n.mkdirSync(e,{mode:getMode(t),recursive:true})}},9907:(e,t,r)=>{"use strict";const n=r(5622);e.exports.checkPath=function checkPath(e){if(process.platform==="win32"){const t=/[<>:"|?*]/.test(e.replace(n.parse(e).root,""));if(t){const t=new Error(`Path contains invalid characters: ${e}`);t.code="EINVAL";throw t}}}},9665:(e,t,r)=>{"use strict";e.exports={moveSync:r(6445)}},6445:(e,t,r)=>{"use strict";const n=r(7758);const i=r(5622);const a=r(1135).copySync;const s=r(7357).removeSync;const o=r(8605).mkdirpSync;const c=r(3901);function moveSync(e,t,r){r=r||{};const n=r.overwrite||r.clobber||false;const{srcStat:a,isChangingCase:s=false}=c.checkPathsSync(e,t,"move",r);c.checkParentPathsSync(e,a,t,"move");if(!isParentRoot(t))o(i.dirname(t));return doRename(e,t,n,s)}function isParentRoot(e){const t=i.dirname(e);const r=i.parse(t);return r.root===t}function doRename(e,t,r,i){if(i)return rename(e,t,r);if(r){s(t);return rename(e,t,r)}if(n.existsSync(t))throw new Error("dest already exists.");return rename(e,t,r)}function rename(e,t,r){try{n.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return moveAcrossDevice(e,t,r)}}function moveAcrossDevice(e,t,r){const n={overwrite:r,errorOnExist:true};a(e,t,n);return s(e)}e.exports=moveSync},1497:(e,t,r)=>{"use strict";const n=r(9046).fromCallback;e.exports={move:n(r(2231))}},2231:(e,t,r)=>{"use strict";const n=r(7758);const i=r(5622);const a=r(1335).copy;const s=r(7357).remove;const o=r(8605).mkdirp;const c=r(3835).pathExists;const u=r(3901);function move(e,t,r,n){if(typeof r==="function"){n=r;r={}}const a=r.overwrite||r.clobber||false;u.checkPaths(e,t,"move",r,((r,s)=>{if(r)return n(r);const{srcStat:c,isChangingCase:l=false}=s;u.checkParentPaths(e,c,t,"move",(r=>{if(r)return n(r);if(isParentRoot(t))return doRename(e,t,a,l,n);o(i.dirname(t),(r=>{if(r)return n(r);return doRename(e,t,a,l,n)}))}))}))}function isParentRoot(e){const t=i.dirname(e);const r=i.parse(t);return r.root===t}function doRename(e,t,r,n,i){if(n)return rename(e,t,r,i);if(r){return s(t,(n=>{if(n)return i(n);return rename(e,t,r,i)}))}c(t,((n,a)=>{if(n)return i(n);if(a)return i(new Error("dest already exists."));return rename(e,t,r,i)}))}function rename(e,t,r,i){n.rename(e,t,(n=>{if(!n)return i();if(n.code!=="EXDEV")return i(n);return moveAcrossDevice(e,t,r,i)}))}function moveAcrossDevice(e,t,r,n){const i={overwrite:r,errorOnExist:true};a(e,t,i,(t=>{if(t)return n(t);return s(e,n)}))}e.exports=move},6570:(e,t,r)=>{"use strict";const n=r(9046).fromCallback;const i=r(7758);const a=r(5622);const s=r(8605);const o=r(3835).pathExists;function outputFile(e,t,r,n){if(typeof r==="function"){n=r;r="utf8"}const c=a.dirname(e);o(c,((a,o)=>{if(a)return n(a);if(o)return i.writeFile(e,t,r,n);s.mkdirs(c,(a=>{if(a)return n(a);i.writeFile(e,t,r,n)}))}))}function outputFileSync(e,...t){const r=a.dirname(e);if(i.existsSync(r)){return i.writeFileSync(e,...t)}s.mkdirsSync(r);i.writeFileSync(e,...t)}e.exports={outputFile:n(outputFile),outputFileSync:outputFileSync}},3835:(e,t,r)=>{"use strict";const n=r(9046).fromPromise;const i=r(1176);function pathExists(e){return i.access(e).then((()=>true)).catch((()=>false))}e.exports={pathExists:n(pathExists),pathExistsSync:i.existsSync}},7357:(e,t,r)=>{"use strict";const n=r(7758);const i=r(9046).fromCallback;const a=r(8761);function remove(e,t){if(n.rm)return n.rm(e,{recursive:true,force:true},t);a(e,t)}function removeSync(e){if(n.rmSync)return n.rmSync(e,{recursive:true,force:true});a.sync(e)}e.exports={remove:i(remove),removeSync:removeSync}},8761:(e,t,r)=>{"use strict";const n=r(7758);const i=r(5622);const a=r(2357);const s=process.platform==="win32";function defaults(e){const t=["unlink","chmod","stat","lstat","rmdir","readdir"];t.forEach((t=>{e[t]=e[t]||n[t];t=t+"Sync";e[t]=e[t]||n[t]}));e.maxBusyTries=e.maxBusyTries||3}function rimraf(e,t,r){let n=0;if(typeof t==="function"){r=t;t={}}a(e,"rimraf: missing path");a.strictEqual(typeof e,"string","rimraf: path should be a string");a.strictEqual(typeof r,"function","rimraf: callback function required");a(t,"rimraf: invalid options argument provided");a.strictEqual(typeof t,"object","rimraf: options should be object");defaults(t);rimraf_(e,t,(function CB(i){if(i){if((i.code==="EBUSY"||i.code==="ENOTEMPTY"||i.code==="EPERM")&&n<t.maxBusyTries){n++;const r=n*100;return setTimeout((()=>rimraf_(e,t,CB)),r)}if(i.code==="ENOENT")i=null}r(i)}))}function rimraf_(e,t,r){a(e);a(t);a(typeof r==="function");t.lstat(e,((n,i)=>{if(n&&n.code==="ENOENT"){return r(null)}if(n&&n.code==="EPERM"&&s){return fixWinEPERM(e,t,n,r)}if(i&&i.isDirectory()){return rmdir(e,t,n,r)}t.unlink(e,(n=>{if(n){if(n.code==="ENOENT"){return r(null)}if(n.code==="EPERM"){return s?fixWinEPERM(e,t,n,r):rmdir(e,t,n,r)}if(n.code==="EISDIR"){return rmdir(e,t,n,r)}}return r(n)}))}))}function fixWinEPERM(e,t,r,n){a(e);a(t);a(typeof n==="function");t.chmod(e,438,(i=>{if(i){n(i.code==="ENOENT"?null:r)}else{t.stat(e,((i,a)=>{if(i){n(i.code==="ENOENT"?null:r)}else if(a.isDirectory()){rmdir(e,t,r,n)}else{t.unlink(e,n)}}))}}))}function fixWinEPERMSync(e,t,r){let n;a(e);a(t);try{t.chmodSync(e,438)}catch(e){if(e.code==="ENOENT"){return}else{throw r}}try{n=t.statSync(e)}catch(e){if(e.code==="ENOENT"){return}else{throw r}}if(n.isDirectory()){rmdirSync(e,t,r)}else{t.unlinkSync(e)}}function rmdir(e,t,r,n){a(e);a(t);a(typeof n==="function");t.rmdir(e,(i=>{if(i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")){rmkids(e,t,n)}else if(i&&i.code==="ENOTDIR"){n(r)}else{n(i)}}))}function rmkids(e,t,r){a(e);a(t);a(typeof r==="function");t.readdir(e,((n,a)=>{if(n)return r(n);let s=a.length;let o;if(s===0)return t.rmdir(e,r);a.forEach((n=>{rimraf(i.join(e,n),t,(n=>{if(o){return}if(n)return r(o=n);if(--s===0){t.rmdir(e,r)}}))}))}))}function rimrafSync(e,t){let r;t=t||{};defaults(t);a(e,"rimraf: missing path");a.strictEqual(typeof e,"string","rimraf: path should be a string");a(t,"rimraf: missing options");a.strictEqual(typeof t,"object","rimraf: options should be object");try{r=t.lstatSync(e)}catch(r){if(r.code==="ENOENT"){return}if(r.code==="EPERM"&&s){fixWinEPERMSync(e,t,r)}}try{if(r&&r.isDirectory()){rmdirSync(e,t,null)}else{t.unlinkSync(e)}}catch(r){if(r.code==="ENOENT"){return}else if(r.code==="EPERM"){return s?fixWinEPERMSync(e,t,r):rmdirSync(e,t,r)}else if(r.code!=="EISDIR"){throw r}rmdirSync(e,t,r)}}function rmdirSync(e,t,r){a(e);a(t);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOTDIR"){throw r}else if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM"){rmkidsSync(e,t)}else if(n.code!=="ENOENT"){throw n}}}function rmkidsSync(e,t){a(e);a(t);t.readdirSync(e).forEach((r=>rimrafSync(i.join(e,r),t)));if(s){const r=Date.now();do{try{const r=t.rmdirSync(e,t);return r}catch{}}while(Date.now()-r<500)}else{const r=t.rmdirSync(e,t);return r}}e.exports=rimraf;rimraf.sync=rimrafSync},3901:(e,t,r)=>{"use strict";const n=r(1176);const i=r(5622);const a=r(1669);function getStats(e,t,r){const i=r.dereference?e=>n.stat(e,{bigint:true}):e=>n.lstat(e,{bigint:true});return Promise.all([i(e),i(t).catch((e=>{if(e.code==="ENOENT")return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function getStatsSync(e,t,r){let i;const a=r.dereference?e=>n.statSync(e,{bigint:true}):e=>n.lstatSync(e,{bigint:true});const s=a(e);try{i=a(t)}catch(e){if(e.code==="ENOENT")return{srcStat:s,destStat:null};throw e}return{srcStat:s,destStat:i}}function checkPaths(e,t,r,n,s){a.callbackify(getStats)(e,t,n,((n,a)=>{if(n)return s(n);const{srcStat:o,destStat:c}=a;if(c){if(areIdentical(o,c)){const n=i.basename(e);const a=i.basename(t);if(r==="move"&&n!==a&&n.toLowerCase()===a.toLowerCase()){return s(null,{srcStat:o,destStat:c,isChangingCase:true})}return s(new Error("Source and destination must not be the same."))}if(o.isDirectory()&&!c.isDirectory()){return s(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`))}if(!o.isDirectory()&&c.isDirectory()){return s(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}}if(o.isDirectory()&&isSrcSubdir(e,t)){return s(new Error(errMsg(e,t,r)))}return s(null,{srcStat:o,destStat:c})}))}function checkPathsSync(e,t,r,n){const{srcStat:a,destStat:s}=getStatsSync(e,t,n);if(s){if(areIdentical(a,s)){const n=i.basename(e);const o=i.basename(t);if(r==="move"&&n!==o&&n.toLowerCase()===o.toLowerCase()){return{srcStat:a,destStat:s,isChangingCase:true}}throw new Error("Source and destination must not be the same.")}if(a.isDirectory()&&!s.isDirectory()){throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`)}if(!a.isDirectory()&&s.isDirectory()){throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}}if(a.isDirectory()&&isSrcSubdir(e,t)){throw new Error(errMsg(e,t,r))}return{srcStat:a,destStat:s}}function checkParentPaths(e,t,r,a,s){const o=i.resolve(i.dirname(e));const c=i.resolve(i.dirname(r));if(c===o||c===i.parse(c).root)return s();n.stat(c,{bigint:true},((n,i)=>{if(n){if(n.code==="ENOENT")return s();return s(n)}if(areIdentical(t,i)){return s(new Error(errMsg(e,r,a)))}return checkParentPaths(e,t,c,a,s)}))}function checkParentPathsSync(e,t,r,a){const s=i.resolve(i.dirname(e));const o=i.resolve(i.dirname(r));if(o===s||o===i.parse(o).root)return;let c;try{c=n.statSync(o,{bigint:true})}catch(e){if(e.code==="ENOENT")return;throw e}if(areIdentical(t,c)){throw new Error(errMsg(e,r,a))}return checkParentPathsSync(e,t,o,a)}function areIdentical(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function isSrcSubdir(e,t){const r=i.resolve(e).split(i.sep).filter((e=>e));const n=i.resolve(t).split(i.sep).filter((e=>e));return r.reduce(((e,t,r)=>e&&n[r]===t),true)}function errMsg(e,t,r){return`Cannot ${r} '${e}' to a subdirectory of itself, '${t}'.`}e.exports={checkPaths:checkPaths,checkPathsSync:checkPathsSync,checkParentPaths:checkParentPaths,checkParentPathsSync:checkParentPathsSync,isSrcSubdir:isSrcSubdir,areIdentical:areIdentical}},2548:(e,t,r)=>{"use strict";const n=r(7758);function utimesMillis(e,t,r,i){n.open(e,"r+",((e,a)=>{if(e)return i(e);n.futimes(a,t,r,(e=>{n.close(a,(t=>{if(i)i(e||t)}))}))}))}function utimesMillisSync(e,t,r){const i=n.openSync(e,"r+");n.futimesSync(i,t,r);return n.closeSync(i)}e.exports={utimesMillis:utimesMillis,utimesMillisSync:utimesMillisSync}},7356:e=>{"use strict";e.exports=clone;function clone(e){if(e===null||typeof e!=="object")return e;if(e instanceof Object)var t={__proto__:e.__proto__};else var t=Object.create(null);Object.getOwnPropertyNames(e).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}));return t}},7758:(e,t,r)=>{var n=r(5747);var i=r(263);var a=r(3086);var s=r(7356);var o=r(1669);var c;var u;if(typeof Symbol==="function"&&typeof Symbol.for==="function"){c=Symbol.for("graceful-fs.queue");u=Symbol.for("graceful-fs.previous")}else{c="___graceful-fs.queue";u="___graceful-fs.previous"}function noop(){}function publishQueue(e,t){Object.defineProperty(e,c,{get:function(){return t}})}var l=noop;if(o.debuglog)l=o.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))l=function(){var e=o.format.apply(o,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: ");console.error(e)};if(!n[c]){var f=global[c]||[];publishQueue(n,f);n.close=function(e){function close(t,r){return e.call(n,t,(function(e){if(!e){retry()}if(typeof r==="function")r.apply(this,arguments)}))}Object.defineProperty(close,u,{value:e});return close}(n.close);n.closeSync=function(e){function closeSync(t){e.apply(n,arguments);retry()}Object.defineProperty(closeSync,u,{value:e});return closeSync}(n.closeSync);if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")){process.on("exit",(function(){l(n[c]);r(2357).equal(n[c].length,0)}))}}if(!global[c]){publishQueue(global,n[c])}e.exports=patch(s(n));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!n.__patched){e.exports=patch(n);n.__patched=true}function patch(e){i(e);e.gracefulify=patch;e.createReadStream=createReadStream;e.createWriteStream=createWriteStream;var t=e.readFile;e.readFile=readFile;function readFile(e,r,n){if(typeof r==="function")n=r,r=null;return go$readFile(e,r,n);function go$readFile(e,r,n){return t(e,r,(function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))enqueue([go$readFile,[e,r,n]]);else{if(typeof n==="function")n.apply(this,arguments);retry()}}))}}var r=e.writeFile;e.writeFile=writeFile;function writeFile(e,t,n,i){if(typeof n==="function")i=n,n=null;return go$writeFile(e,t,n,i);function go$writeFile(e,t,n,i){return r(e,t,n,(function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))enqueue([go$writeFile,[e,t,n,i]]);else{if(typeof i==="function")i.apply(this,arguments);retry()}}))}}var n=e.appendFile;if(n)e.appendFile=appendFile;function appendFile(e,t,r,i){if(typeof r==="function")i=r,r=null;return go$appendFile(e,t,r,i);function go$appendFile(e,t,r,i){return n(e,t,r,(function(n){if(n&&(n.code==="EMFILE"||n.code==="ENFILE"))enqueue([go$appendFile,[e,t,r,i]]);else{if(typeof i==="function")i.apply(this,arguments);retry()}}))}}var s=e.readdir;e.readdir=readdir;function readdir(e,t,r){var n=[e];if(typeof t!=="function"){n.push(t)}else{r=t}n.push(go$readdir$cb);return go$readdir(n);function go$readdir$cb(e,t){if(t&&t.sort)t.sort();if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))enqueue([go$readdir,[n]]);else{if(typeof r==="function")r.apply(this,arguments);retry()}}}function go$readdir(t){return s.apply(e,t)}if(process.version.substr(0,4)==="v0.8"){var o=a(e);ReadStream=o.ReadStream;WriteStream=o.WriteStream}var c=e.ReadStream;if(c){ReadStream.prototype=Object.create(c.prototype);ReadStream.prototype.open=ReadStream$open}var u=e.WriteStream;if(u){WriteStream.prototype=Object.create(u.prototype);WriteStream.prototype.open=WriteStream$open}Object.defineProperty(e,"ReadStream",{get:function(){return ReadStream},set:function(e){ReadStream=e},enumerable:true,configurable:true});Object.defineProperty(e,"WriteStream",{get:function(){return WriteStream},set:function(e){WriteStream=e},enumerable:true,configurable:true});var l=ReadStream;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:true,configurable:true});var f=WriteStream;Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:true,configurable:true});function ReadStream(e,t){if(this instanceof ReadStream)return c.apply(this,arguments),this;else return ReadStream.apply(Object.create(ReadStream.prototype),arguments)}function ReadStream$open(){var e=this;open(e.path,e.flags,e.mode,(function(t,r){if(t){if(e.autoClose)e.destroy();e.emit("error",t)}else{e.fd=r;e.emit("open",r);e.read()}}))}function WriteStream(e,t){if(this instanceof WriteStream)return u.apply(this,arguments),this;else return WriteStream.apply(Object.create(WriteStream.prototype),arguments)}function WriteStream$open(){var e=this;open(e.path,e.flags,e.mode,(function(t,r){if(t){e.destroy();e.emit("error",t)}else{e.fd=r;e.emit("open",r)}}))}function createReadStream(t,r){return new e.ReadStream(t,r)}function createWriteStream(t,r){return new e.WriteStream(t,r)}var p=e.open;e.open=open;function open(e,t,r,n){if(typeof r==="function")n=r,r=null;return go$open(e,t,r,n);function go$open(e,t,r,n){return p(e,t,r,(function(i,a){if(i&&(i.code==="EMFILE"||i.code==="ENFILE"))enqueue([go$open,[e,t,r,n]]);else{if(typeof n==="function")n.apply(this,arguments);retry()}}))}}return e}function enqueue(e){l("ENQUEUE",e[0].name,e[1]);n[c].push(e)}function retry(){var e=n[c].shift();if(e){l("RETRY",e[0].name,e[1]);e[0].apply(null,e[1])}}},3086:(e,t,r)=>{var n=r(2413).Stream;e.exports=legacy;function legacy(e){return{ReadStream:ReadStream,WriteStream:WriteStream};function ReadStream(t,r){if(!(this instanceof ReadStream))return new ReadStream(t,r);n.call(this);var i=this;this.path=t;this.fd=null;this.readable=true;this.paused=false;this.flags="r";this.mode=438;this.bufferSize=64*1024;r=r||{};var a=Object.keys(r);for(var s=0,o=a.length;s<o;s++){var c=a[s];this[c]=r[c]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==undefined){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.end===undefined){this.end=Infinity}else if("number"!==typeof this.end){throw TypeError("end must be a Number")}if(this.start>this.end){throw new Error("start must be <= end")}this.pos=this.start}if(this.fd!==null){process.nextTick((function(){i._read()}));return}e.open(this.path,this.flags,this.mode,(function(e,t){if(e){i.emit("error",e);i.readable=false;return}i.fd=t;i.emit("open",t);i._read()}))}function WriteStream(t,r){if(!(this instanceof WriteStream))return new WriteStream(t,r);n.call(this);this.path=t;this.fd=null;this.writable=true;this.flags="w";this.encoding="binary";this.mode=438;this.bytesWritten=0;r=r||{};var i=Object.keys(r);for(var a=0,s=i.length;a<s;a++){var o=i[a];this[o]=r[o]}if(this.start!==undefined){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.start<0){throw new Error("start must be >= zero")}this.pos=this.start}this.busy=false;this._queue=[];if(this.fd===null){this._open=e.open;this._queue.push([this._open,this.path,this.flags,this.mode,undefined]);this.flush()}}}},263:(e,t,r)=>{var n=r(7619);var i=process.cwd;var a=null;var s=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!a)a=i.call(process);return a};try{process.cwd()}catch(e){}var o=process.chdir;process.chdir=function(e){a=null;o.call(process,e)};e.exports=patch;function patch(e){if(n.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)){patchLchmod(e)}if(!e.lutimes){patchLutimes(e)}e.chown=chownFix(e.chown);e.fchown=chownFix(e.fchown);e.lchown=chownFix(e.lchown);e.chmod=chmodFix(e.chmod);e.fchmod=chmodFix(e.fchmod);e.lchmod=chmodFix(e.lchmod);e.chownSync=chownFixSync(e.chownSync);e.fchownSync=chownFixSync(e.fchownSync);e.lchownSync=chownFixSync(e.lchownSync);e.chmodSync=chmodFixSync(e.chmodSync);e.fchmodSync=chmodFixSync(e.fchmodSync);e.lchmodSync=chmodFixSync(e.lchmodSync);e.stat=statFix(e.stat);e.fstat=statFix(e.fstat);e.lstat=statFix(e.lstat);e.statSync=statFixSync(e.statSync);e.fstatSync=statFixSync(e.fstatSync);e.lstatSync=statFixSync(e.lstatSync);if(!e.lchmod){e.lchmod=function(e,t,r){if(r)process.nextTick(r)};e.lchmodSync=function(){}}if(!e.lchown){e.lchown=function(e,t,r,n){if(n)process.nextTick(n)};e.lchownSync=function(){}}if(s==="win32"){e.rename=function(t){return function(r,n,i){var a=Date.now();var s=0;t(r,n,(function CB(o){if(o&&(o.code==="EACCES"||o.code==="EPERM")&&Date.now()-a<6e4){setTimeout((function(){e.stat(n,(function(e,a){if(e&&e.code==="ENOENT")t(r,n,CB);else i(o)}))}),s);if(s<100)s+=10;return}if(i)i(o)}))}}(e.rename)}e.read=function(t){function read(r,n,i,a,s,o){var c;if(o&&typeof o==="function"){var u=0;c=function(l,f,p){if(l&&l.code==="EAGAIN"&&u<10){u++;return t.call(e,r,n,i,a,s,c)}o.apply(this,arguments)}}return t.call(e,r,n,i,a,s,c)}read.__proto__=t;return read}(e.read);e.readSync=function(t){return function(r,n,i,a,s){var o=0;while(true){try{return t.call(e,r,n,i,a,s)}catch(e){if(e.code==="EAGAIN"&&o<10){o++;continue}throw e}}}}(e.readSync);function patchLchmod(e){e.lchmod=function(t,r,i){e.open(t,n.O_WRONLY|n.O_SYMLINK,r,(function(t,n){if(t){if(i)i(t);return}e.fchmod(n,r,(function(t){e.close(n,(function(e){if(i)i(t||e)}))}))}))};e.lchmodSync=function(t,r){var i=e.openSync(t,n.O_WRONLY|n.O_SYMLINK,r);var a=true;var s;try{s=e.fchmodSync(i,r);a=false}finally{if(a){try{e.closeSync(i)}catch(e){}}else{e.closeSync(i)}}return s}}function patchLutimes(e){if(n.hasOwnProperty("O_SYMLINK")){e.lutimes=function(t,r,i,a){e.open(t,n.O_SYMLINK,(function(t,n){if(t){if(a)a(t);return}e.futimes(n,r,i,(function(t){e.close(n,(function(e){if(a)a(t||e)}))}))}))};e.lutimesSync=function(t,r,i){var a=e.openSync(t,n.O_SYMLINK);var s;var o=true;try{s=e.futimesSync(a,r,i);o=false}finally{if(o){try{e.closeSync(a)}catch(e){}}else{e.closeSync(a)}}return s}}else{e.lutimes=function(e,t,r,n){if(n)process.nextTick(n)};e.lutimesSync=function(){}}}function chmodFix(t){if(!t)return t;return function(r,n,i){return t.call(e,r,n,(function(e){if(chownErOk(e))e=null;if(i)i.apply(this,arguments)}))}}function chmodFixSync(t){if(!t)return t;return function(r,n){try{return t.call(e,r,n)}catch(e){if(!chownErOk(e))throw e}}}function chownFix(t){if(!t)return t;return function(r,n,i,a){return t.call(e,r,n,i,(function(e){if(chownErOk(e))e=null;if(a)a.apply(this,arguments)}))}}function chownFixSync(t){if(!t)return t;return function(r,n,i){try{return t.call(e,r,n,i)}catch(e){if(!chownErOk(e))throw e}}}function statFix(t){if(!t)return t;return function(r,n,i){if(typeof n==="function"){i=n;n=null}function callback(e,t){if(t){if(t.uid<0)t.uid+=4294967296;if(t.gid<0)t.gid+=4294967296}if(i)i.apply(this,arguments)}return n?t.call(e,r,n,callback):t.call(e,r,callback)}}function statFixSync(t){if(!t)return t;return function(r,n){var i=n?t.call(e,r,n):t.call(e,r);if(i.uid<0)i.uid+=4294967296;if(i.gid<0)i.gid+=4294967296;return i}}function chownErOk(e){if(!e)return true;if(e.code==="ENOSYS")return true;var t=!process.getuid||process.getuid()!==0;if(t){if(e.code==="EINVAL"||e.code==="EPERM")return true}return false}}},6160:(e,t,r)=>{let n;try{n=r(7758)}catch(e){n=r(5747)}const i=r(9046);const{stringify:a,stripBom:s}=r(5902);async function _readFile(e,t={}){if(typeof t==="string"){t={encoding:t}}const r=t.fs||n;const a="throws"in t?t.throws:true;let o=await i.fromCallback(r.readFile)(e,t);o=s(o);let c;try{c=JSON.parse(o,t?t.reviver:null)}catch(t){if(a){t.message=`${e}: ${t.message}`;throw t}else{return null}}return c}const o=i.fromPromise(_readFile);function readFileSync(e,t={}){if(typeof t==="string"){t={encoding:t}}const r=t.fs||n;const i="throws"in t?t.throws:true;try{let n=r.readFileSync(e,t);n=s(n);return JSON.parse(n,t.reviver)}catch(t){if(i){t.message=`${e}: ${t.message}`;throw t}else{return null}}}async function _writeFile(e,t,r={}){const s=r.fs||n;const o=a(t,r);await i.fromCallback(s.writeFile)(e,o,r)}const c=i.fromPromise(_writeFile);function writeFileSync(e,t,r={}){const i=r.fs||n;const s=a(t,r);return i.writeFileSync(e,s,r)}const u={readFile:o,readFileSync:readFileSync,writeFile:c,writeFileSync:writeFileSync};e.exports=u},5902:e=>{function stringify(e,{EOL:t="\n",finalEOL:r=true,replacer:n=null,spaces:i}={}){const a=r?t:"";const s=JSON.stringify(e,n,i);return s.replace(/\n/g,t)+a}function stripBom(e){if(Buffer.isBuffer(e))e=e.toString("utf8");return e.replace(/^\uFEFF/,"")}e.exports={stringify:stringify,stripBom:stripBom}},6235:(e,t,r)=>{"use strict";const n=r(5747);class LineByLine{constructor(e,t){t=t||{};if(!t.readChunk)t.readChunk=1024;if(!t.newLineCharacter){t.newLineCharacter=10}else{t.newLineCharacter=t.newLineCharacter.charCodeAt(0)}if(typeof e==="number"){this.fd=e}else{this.fd=n.openSync(e,"r")}this.options=t;this.newLineCharacter=t.newLineCharacter;this.reset()}_searchInBuffer(e,t){let r=-1;for(let n=0;n<=e.length;n++){let i=e[n];if(i===t){r=n;break}}return r}reset(){this.eofReached=false;this.linesCache=[];this.fdPosition=0}close(){n.closeSync(this.fd);this.fd=null}_extractLines(e){let t;const r=[];let n=0;let i=0;while(true){let a=e[n++];if(a===this.newLineCharacter){t=e.slice(i,n);r.push(t);i=n}else if(a===undefined){break}}let a=e.slice(i,n);if(a.length){r.push(a)}return r}_readChunk(e){let t=0;let r;const i=[];do{const e=new Buffer(this.options.readChunk);r=n.readSync(this.fd,e,0,this.options.readChunk,this.fdPosition);t=t+r;this.fdPosition=this.fdPosition+r;i.push(e)}while(r&&this._searchInBuffer(i[i.length-1],this.options.newLineCharacter)===-1);let a=Buffer.concat(i);if(r<this.options.readChunk){this.eofReached=true;a=a.slice(0,t)}if(t){this.linesCache=this._extractLines(a);if(e){this.linesCache[0]=Buffer.concat([e,this.linesCache[0]])}}return t}next(){if(!this.fd)return false;let e=false;if(this.eofReached&&this.linesCache.length===0){return e}let t;if(!this.linesCache.length){t=this._readChunk()}if(this.linesCache.length){e=this.linesCache.shift();const r=e[e.length-1];if(r!==this.newLineCharacter){t=this._readChunk(e);if(t){e=this.linesCache.shift()}}}if(this.eofReached&&this.linesCache.length===0){this.close()}if(e&&e[e.length-1]===this.newLineCharacter){e=e.slice(0,e.length-1)}return e}}e.exports=LineByLine},2043:(e,t,r)=>{(function(e){e.parser=function(e,t){return new SAXParser(e,t)};e.SAXParser=SAXParser;e.SAXStream=SAXStream;e.createStream=createStream;e.MAX_BUFFER_LENGTH=64*1024;var t=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function SAXParser(t,r){if(!(this instanceof SAXParser)){return new SAXParser(t,r)}var n=this;clearBuffers(n);n.q=n.c="";n.bufferCheckPosition=e.MAX_BUFFER_LENGTH;n.opt=r||{};n.opt.lowercase=n.opt.lowercase||n.opt.lowercasetags;n.looseCase=n.opt.lowercase?"toLowerCase":"toUpperCase";n.tags=[];n.closed=n.closedRoot=n.sawRoot=false;n.tag=n.error=null;n.strict=!!t;n.noscript=!!(t||n.opt.noscript);n.state=y.BEGIN;n.strictEntities=n.opt.strictEntities;n.ENTITIES=n.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES);n.attribList=[];if(n.opt.xmlns){n.ns=Object.create(u)}n.trackPosition=n.opt.position!==false;if(n.trackPosition){n.position=n.line=n.column=0}emit(n,"onready")}if(!Object.create){Object.create=function(e){function F(){}F.prototype=e;var t=new F;return t}}if(!Object.keys){Object.keys=function(e){var t=[];for(var r in e)if(e.hasOwnProperty(r))t.push(r);return t}}function checkBufferLength(r){var n=Math.max(e.MAX_BUFFER_LENGTH,10);var i=0;for(var a=0,s=t.length;a<s;a++){var o=r[t[a]].length;if(o>n){switch(t[a]){case"textNode":closeText(r);break;case"cdata":emitNode(r,"oncdata",r.cdata);r.cdata="";break;case"script":emitNode(r,"onscript",r.script);r.script="";break;default:error(r,"Max buffer length exceeded: "+t[a])}}i=Math.max(i,o)}var c=e.MAX_BUFFER_LENGTH-i;r.bufferCheckPosition=c+r.position}function clearBuffers(e){for(var r=0,n=t.length;r<n;r++){e[t[r]]=""}}function flushBuffers(e){closeText(e);if(e.cdata!==""){emitNode(e,"oncdata",e.cdata);e.cdata=""}if(e.script!==""){emitNode(e,"onscript",e.script);e.script=""}}SAXParser.prototype={end:function(){end(this)},write:write,resume:function(){this.error=null;return this},close:function(){return this.write(null)},flush:function(){flushBuffers(this)}};var n;try{n=r(2413).Stream}catch(e){n=function(){}}var i=e.EVENTS.filter((function(e){return e!=="error"&&e!=="end"}));function createStream(e,t){return new SAXStream(e,t)}function SAXStream(e,t){if(!(this instanceof SAXStream)){return new SAXStream(e,t)}n.apply(this);this._parser=new SAXParser(e,t);this.writable=true;this.readable=true;var r=this;this._parser.onend=function(){r.emit("end")};this._parser.onerror=function(e){r.emit("error",e);r._parser.error=null};this._decoder=null;i.forEach((function(e){Object.defineProperty(r,"on"+e,{get:function(){return r._parser["on"+e]},set:function(t){if(!t){r.removeAllListeners(e);r._parser["on"+e]=t;return t}r.on(e,t)},enumerable:true,configurable:false})}))}SAXStream.prototype=Object.create(n.prototype,{constructor:{value:SAXStream}});SAXStream.prototype.write=function(e){if(typeof Buffer==="function"&&typeof Buffer.isBuffer==="function"&&Buffer.isBuffer(e)){if(!this._decoder){var t=r(4304).StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}this._parser.write(e.toString());this.emit("data",e);return true};SAXStream.prototype.end=function(e){if(e&&e.length){this.write(e)}this._parser.end();return true};SAXStream.prototype.on=function(e,t){var r=this;if(!r._parser["on"+e]&&i.indexOf(e)!==-1){r._parser["on"+e]=function(){var t=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e);r.emit.apply(r,t)}}return n.prototype.on.call(r,e,t)};var a="[CDATA[";var s="DOCTYPE";var o="http://www.w3.org/XML/1998/namespace";var c="http://www.w3.org/2000/xmlns/";var u={xml:o,xmlns:c};var l=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var f=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;var p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function isWhitespace(e){return e===" "||e==="\n"||e==="\r"||e==="\t"}function isQuote(e){return e==='"'||e==="'"}function isAttribEnd(e){return e===">"||isWhitespace(e)}function isMatch(e,t){return e.test(t)}function notMatch(e,t){return!isMatch(e,t)}var y=0;e.STATE={BEGIN:y++,BEGIN_WHITESPACE:y++,TEXT:y++,TEXT_ENTITY:y++,OPEN_WAKA:y++,SGML_DECL:y++,SGML_DECL_QUOTED:y++,DOCTYPE:y++,DOCTYPE_QUOTED:y++,DOCTYPE_DTD:y++,DOCTYPE_DTD_QUOTED:y++,COMMENT_STARTING:y++,COMMENT:y++,COMMENT_ENDING:y++,COMMENT_ENDED:y++,CDATA:y++,CDATA_ENDING:y++,CDATA_ENDING_2:y++,PROC_INST:y++,PROC_INST_BODY:y++,PROC_INST_ENDING:y++,OPEN_TAG:y++,OPEN_TAG_SLASH:y++,ATTRIB:y++,ATTRIB_NAME:y++,ATTRIB_NAME_SAW_WHITE:y++,ATTRIB_VALUE:y++,ATTRIB_VALUE_QUOTED:y++,ATTRIB_VALUE_CLOSED:y++,ATTRIB_VALUE_UNQUOTED:y++,ATTRIB_VALUE_ENTITY_Q:y++,ATTRIB_VALUE_ENTITY_U:y++,CLOSE_TAG:y++,CLOSE_TAG_SAW_WHITE:y++,SCRIPT:y++,SCRIPT_ENDING:y++};e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"};e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};Object.keys(e.ENTITIES).forEach((function(t){var r=e.ENTITIES[t];var n=typeof r==="number"?String.fromCharCode(r):r;e.ENTITIES[t]=n}));for(var d in e.STATE){e.STATE[e.STATE[d]]=d}y=e.STATE;function emit(e,t,r){e[t]&&e[t](r)}function emitNode(e,t,r){if(e.textNode)closeText(e);emit(e,t,r)}function closeText(e){e.textNode=textopts(e.opt,e.textNode);if(e.textNode)emit(e,"ontext",e.textNode);e.textNode=""}function textopts(e,t){if(e.trim)t=t.trim();if(e.normalize)t=t.replace(/\s+/g," ");return t}function error(e,t){closeText(e);if(e.trackPosition){t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c}t=new Error(t);e.error=t;emit(e,"onerror",t);return e}function end(e){if(e.sawRoot&&!e.closedRoot)strictFail(e,"Unclosed root tag");if(e.state!==y.BEGIN&&e.state!==y.BEGIN_WHITESPACE&&e.state!==y.TEXT){error(e,"Unexpected end")}closeText(e);e.c="";e.closed=true;emit(e,"onend");SAXParser.call(e,e.strict,e.opt);return e}function strictFail(e,t){if(typeof e!=="object"||!(e instanceof SAXParser)){throw new Error("bad call to strictFail")}if(e.strict){error(e,t)}}function newTag(e){if(!e.strict)e.tagName=e.tagName[e.looseCase]();var t=e.tags[e.tags.length-1]||e;var r=e.tag={name:e.tagName,attributes:{}};if(e.opt.xmlns){r.ns=t.ns}e.attribList.length=0;emitNode(e,"onopentagstart",r)}function qname(e,t){var r=e.indexOf(":");var n=r<0?["",e]:e.split(":");var i=n[0];var a=n[1];if(t&&e==="xmlns"){i="xmlns";a=""}return{prefix:i,local:a}}function attrib(e){if(!e.strict){e.attribName=e.attribName[e.looseCase]()}if(e.attribList.indexOf(e.attribName)!==-1||e.tag.attributes.hasOwnProperty(e.attribName)){e.attribName=e.attribValue="";return}if(e.opt.xmlns){var t=qname(e.attribName,true);var r=t.prefix;var n=t.local;if(r==="xmlns"){if(n==="xml"&&e.attribValue!==o){strictFail(e,"xml: prefix must be bound to "+o+"\n"+"Actual: "+e.attribValue)}else if(n==="xmlns"&&e.attribValue!==c){strictFail(e,"xmlns: prefix must be bound to "+c+"\n"+"Actual: "+e.attribValue)}else{var i=e.tag;var a=e.tags[e.tags.length-1]||e;if(i.ns===a.ns){i.ns=Object.create(a.ns)}i.ns[n]=e.attribValue}}e.attribList.push([e.attribName,e.attribValue])}else{e.tag.attributes[e.attribName]=e.attribValue;emitNode(e,"onattribute",{name:e.attribName,value:e.attribValue})}e.attribName=e.attribValue=""}function openTag(e,t){if(e.opt.xmlns){var r=e.tag;var n=qname(e.tagName);r.prefix=n.prefix;r.local=n.local;r.uri=r.ns[n.prefix]||"";if(r.prefix&&!r.uri){strictFail(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName));r.uri=n.prefix}var i=e.tags[e.tags.length-1]||e;if(r.ns&&i.ns!==r.ns){Object.keys(r.ns).forEach((function(t){emitNode(e,"onopennamespace",{prefix:t,uri:r.ns[t]})}))}for(var a=0,s=e.attribList.length;a<s;a++){var o=e.attribList[a];var c=o[0];var u=o[1];var l=qname(c,true);var f=l.prefix;var p=l.local;var m=f===""?"":r.ns[f]||"";var d={name:c,value:u,prefix:f,local:p,uri:m};if(f&&f!=="xmlns"&&!m){strictFail(e,"Unbound namespace prefix: "+JSON.stringify(f));d.uri=f}e.tag.attributes[c]=d;emitNode(e,"onattribute",d)}e.attribList.length=0}e.tag.isSelfClosing=!!t;e.sawRoot=true;e.tags.push(e.tag);emitNode(e,"onopentag",e.tag);if(!t){if(!e.noscript&&e.tagName.toLowerCase()==="script"){e.state=y.SCRIPT}else{e.state=y.TEXT}e.tag=null;e.tagName=""}e.attribName=e.attribValue="";e.attribList.length=0}function closeTag(e){if(!e.tagName){strictFail(e,"Weird empty close tag.");e.textNode+="</>";e.state=y.TEXT;return}if(e.script){if(e.tagName!=="script"){e.script+="</"+e.tagName+">";e.tagName="";e.state=y.SCRIPT;return}emitNode(e,"onscript",e.script);e.script=""}var t=e.tags.length;var r=e.tagName;if(!e.strict){r=r[e.looseCase]()}var n=r;while(t--){var i=e.tags[t];if(i.name!==n){strictFail(e,"Unexpected close tag")}else{break}}if(t<0){strictFail(e,"Unmatched closing tag: "+e.tagName);e.textNode+="</"+e.tagName+">";e.state=y.TEXT;return}e.tagName=r;var a=e.tags.length;while(a-- >t){var s=e.tag=e.tags.pop();e.tagName=e.tag.name;emitNode(e,"onclosetag",e.tagName);var o={};for(var c in s.ns){o[c]=s.ns[c]}var u=e.tags[e.tags.length-1]||e;if(e.opt.xmlns&&s.ns!==u.ns){Object.keys(s.ns).forEach((function(t){var r=s.ns[t];emitNode(e,"onclosenamespace",{prefix:t,uri:r})}))}}if(t===0)e.closedRoot=true;e.tagName=e.attribValue=e.attribName="";e.attribList.length=0;e.state=y.TEXT}function parseEntity(e){var t=e.entity;var r=t.toLowerCase();var n;var i="";if(e.ENTITIES[t]){return e.ENTITIES[t]}if(e.ENTITIES[r]){return e.ENTITIES[r]}t=r;if(t.charAt(0)==="#"){if(t.charAt(1)==="x"){t=t.slice(2);n=parseInt(t,16);i=n.toString(16)}else{t=t.slice(1);n=parseInt(t,10);i=n.toString(10)}}t=t.replace(/^0+/,"");if(isNaN(n)||i.toLowerCase()!==t){strictFail(e,"Invalid character entity");return"&"+e.entity+";"}return String.fromCodePoint(n)}function beginWhiteSpace(e,t){if(t==="<"){e.state=y.OPEN_WAKA;e.startTagPosition=e.position}else if(!isWhitespace(t)){strictFail(e,"Non-whitespace before first tag.");e.textNode=t;e.state=y.TEXT}}function charAt(e,t){var r="";if(t<e.length){r=e.charAt(t)}return r}function write(e){var t=this;if(this.error){throw this.error}if(t.closed){return error(t,"Cannot write after close. Assign an onready handler.")}if(e===null){return end(t)}if(typeof e==="object"){e=e.toString()}var r=0;var n="";while(true){n=charAt(e,r++);t.c=n;if(!n){break}if(t.trackPosition){t.position++;if(n==="\n"){t.line++;t.column=0}else{t.column++}}switch(t.state){case y.BEGIN:t.state=y.BEGIN_WHITESPACE;if(n==="\ufeff"){continue}beginWhiteSpace(t,n);continue;case y.BEGIN_WHITESPACE:beginWhiteSpace(t,n);continue;case y.TEXT:if(t.sawRoot&&!t.closedRoot){var i=r-1;while(n&&n!=="<"&&n!=="&"){n=charAt(e,r++);if(n&&t.trackPosition){t.position++;if(n==="\n"){t.line++;t.column=0}else{t.column++}}}t.textNode+=e.substring(i,r-1)}if(n==="<"&&!(t.sawRoot&&t.closedRoot&&!t.strict)){t.state=y.OPEN_WAKA;t.startTagPosition=t.position}else{if(!isWhitespace(n)&&(!t.sawRoot||t.closedRoot)){strictFail(t,"Text data outside of root node.")}if(n==="&"){t.state=y.TEXT_ENTITY}else{t.textNode+=n}}continue;case y.SCRIPT:if(n==="<"){t.state=y.SCRIPT_ENDING}else{t.script+=n}continue;case y.SCRIPT_ENDING:if(n==="/"){t.state=y.CLOSE_TAG}else{t.script+="<"+n;t.state=y.SCRIPT}continue;case y.OPEN_WAKA:if(n==="!"){t.state=y.SGML_DECL;t.sgmlDecl=""}else if(isWhitespace(n)){}else if(isMatch(l,n)){t.state=y.OPEN_TAG;t.tagName=n}else if(n==="/"){t.state=y.CLOSE_TAG;t.tagName=""}else if(n==="?"){t.state=y.PROC_INST;t.procInstName=t.procInstBody=""}else{strictFail(t,"Unencoded <");if(t.startTagPosition+1<t.position){var o=t.position-t.startTagPosition;n=new Array(o).join(" ")+n}t.textNode+="<"+n;t.state=y.TEXT}continue;case y.SGML_DECL:if((t.sgmlDecl+n).toUpperCase()===a){emitNode(t,"onopencdata");t.state=y.CDATA;t.sgmlDecl="";t.cdata=""}else if(t.sgmlDecl+n==="--"){t.state=y.COMMENT;t.comment="";t.sgmlDecl=""}else if((t.sgmlDecl+n).toUpperCase()===s){t.state=y.DOCTYPE;if(t.doctype||t.sawRoot){strictFail(t,"Inappropriately located doctype declaration")}t.doctype="";t.sgmlDecl=""}else if(n===">"){emitNode(t,"onsgmldeclaration",t.sgmlDecl);t.sgmlDecl="";t.state=y.TEXT}else if(isQuote(n)){t.state=y.SGML_DECL_QUOTED;t.sgmlDecl+=n}else{t.sgmlDecl+=n}continue;case y.SGML_DECL_QUOTED:if(n===t.q){t.state=y.SGML_DECL;t.q=""}t.sgmlDecl+=n;continue;case y.DOCTYPE:if(n===">"){t.state=y.TEXT;emitNode(t,"ondoctype",t.doctype);t.doctype=true}else{t.doctype+=n;if(n==="["){t.state=y.DOCTYPE_DTD}else if(isQuote(n)){t.state=y.DOCTYPE_QUOTED;t.q=n}}continue;case y.DOCTYPE_QUOTED:t.doctype+=n;if(n===t.q){t.q="";t.state=y.DOCTYPE}continue;case y.DOCTYPE_DTD:t.doctype+=n;if(n==="]"){t.state=y.DOCTYPE}else if(isQuote(n)){t.state=y.DOCTYPE_DTD_QUOTED;t.q=n}continue;case y.DOCTYPE_DTD_QUOTED:t.doctype+=n;if(n===t.q){t.state=y.DOCTYPE_DTD;t.q=""}continue;case y.COMMENT:if(n==="-"){t.state=y.COMMENT_ENDING}else{t.comment+=n}continue;case y.COMMENT_ENDING:if(n==="-"){t.state=y.COMMENT_ENDED;t.comment=textopts(t.opt,t.comment);if(t.comment){emitNode(t,"oncomment",t.comment)}t.comment=""}else{t.comment+="-"+n;t.state=y.COMMENT}continue;case y.COMMENT_ENDED:if(n!==">"){strictFail(t,"Malformed comment");t.comment+="--"+n;t.state=y.COMMENT}else{t.state=y.TEXT}continue;case y.CDATA:if(n==="]"){t.state=y.CDATA_ENDING}else{t.cdata+=n}continue;case y.CDATA_ENDING:if(n==="]"){t.state=y.CDATA_ENDING_2}else{t.cdata+="]"+n;t.state=y.CDATA}continue;case y.CDATA_ENDING_2:if(n===">"){if(t.cdata){emitNode(t,"oncdata",t.cdata)}emitNode(t,"onclosecdata");t.cdata="";t.state=y.TEXT}else if(n==="]"){t.cdata+="]"}else{t.cdata+="]]"+n;t.state=y.CDATA}continue;case y.PROC_INST:if(n==="?"){t.state=y.PROC_INST_ENDING}else if(isWhitespace(n)){t.state=y.PROC_INST_BODY}else{t.procInstName+=n}continue;case y.PROC_INST_BODY:if(!t.procInstBody&&isWhitespace(n)){continue}else if(n==="?"){t.state=y.PROC_INST_ENDING}else{t.procInstBody+=n}continue;case y.PROC_INST_ENDING:if(n===">"){emitNode(t,"onprocessinginstruction",{name:t.procInstName,body:t.procInstBody});t.procInstName=t.procInstBody="";t.state=y.TEXT}else{t.procInstBody+="?"+n;t.state=y.PROC_INST_BODY}continue;case y.OPEN_TAG:if(isMatch(f,n)){t.tagName+=n}else{newTag(t);if(n===">"){openTag(t)}else if(n==="/"){t.state=y.OPEN_TAG_SLASH}else{if(!isWhitespace(n)){strictFail(t,"Invalid character in tag name")}t.state=y.ATTRIB}}continue;case y.OPEN_TAG_SLASH:if(n===">"){openTag(t,true);closeTag(t)}else{strictFail(t,"Forward-slash in opening tag not followed by >");t.state=y.ATTRIB}continue;case y.ATTRIB:if(isWhitespace(n)){continue}else if(n===">"){openTag(t)}else if(n==="/"){t.state=y.OPEN_TAG_SLASH}else if(isMatch(l,n)){t.attribName=n;t.attribValue="";t.state=y.ATTRIB_NAME}else{strictFail(t,"Invalid attribute name")}continue;case y.ATTRIB_NAME:if(n==="="){t.state=y.ATTRIB_VALUE}else if(n===">"){strictFail(t,"Attribute without value");t.attribValue=t.attribName;attrib(t);openTag(t)}else if(isWhitespace(n)){t.state=y.ATTRIB_NAME_SAW_WHITE}else if(isMatch(f,n)){t.attribName+=n}else{strictFail(t,"Invalid attribute name")}continue;case y.ATTRIB_NAME_SAW_WHITE:if(n==="="){t.state=y.ATTRIB_VALUE}else if(isWhitespace(n)){continue}else{strictFail(t,"Attribute without value");t.tag.attributes[t.attribName]="";t.attribValue="";emitNode(t,"onattribute",{name:t.attribName,value:""});t.attribName="";if(n===">"){openTag(t)}else if(isMatch(l,n)){t.attribName=n;t.state=y.ATTRIB_NAME}else{strictFail(t,"Invalid attribute name");t.state=y.ATTRIB}}continue;case y.ATTRIB_VALUE:if(isWhitespace(n)){continue}else if(isQuote(n)){t.q=n;t.state=y.ATTRIB_VALUE_QUOTED}else{strictFail(t,"Unquoted attribute value");t.state=y.ATTRIB_VALUE_UNQUOTED;t.attribValue=n}continue;case y.ATTRIB_VALUE_QUOTED:if(n!==t.q){if(n==="&"){t.state=y.ATTRIB_VALUE_ENTITY_Q}else{t.attribValue+=n}continue}attrib(t);t.q="";t.state=y.ATTRIB_VALUE_CLOSED;continue;case y.ATTRIB_VALUE_CLOSED:if(isWhitespace(n)){t.state=y.ATTRIB}else if(n===">"){openTag(t)}else if(n==="/"){t.state=y.OPEN_TAG_SLASH}else if(isMatch(l,n)){strictFail(t,"No whitespace between attributes");t.attribName=n;t.attribValue="";t.state=y.ATTRIB_NAME}else{strictFail(t,"Invalid attribute name")}continue;case y.ATTRIB_VALUE_UNQUOTED:if(!isAttribEnd(n)){if(n==="&"){t.state=y.ATTRIB_VALUE_ENTITY_U}else{t.attribValue+=n}continue}attrib(t);if(n===">"){openTag(t)}else{t.state=y.ATTRIB}continue;case y.CLOSE_TAG:if(!t.tagName){if(isWhitespace(n)){continue}else if(notMatch(l,n)){if(t.script){t.script+="</"+n;t.state=y.SCRIPT}else{strictFail(t,"Invalid tagname in closing tag.")}}else{t.tagName=n}}else if(n===">"){closeTag(t)}else if(isMatch(f,n)){t.tagName+=n}else if(t.script){t.script+="</"+t.tagName;t.tagName="";t.state=y.SCRIPT}else{if(!isWhitespace(n)){strictFail(t,"Invalid tagname in closing tag")}t.state=y.CLOSE_TAG_SAW_WHITE}continue;case y.CLOSE_TAG_SAW_WHITE:if(isWhitespace(n)){continue}if(n===">"){closeTag(t)}else{strictFail(t,"Invalid characters in closing tag")}continue;case y.TEXT_ENTITY:case y.ATTRIB_VALUE_ENTITY_Q:case y.ATTRIB_VALUE_ENTITY_U:var c;var u;switch(t.state){case y.TEXT_ENTITY:c=y.TEXT;u="textNode";break;case y.ATTRIB_VALUE_ENTITY_Q:c=y.ATTRIB_VALUE_QUOTED;u="attribValue";break;case y.ATTRIB_VALUE_ENTITY_U:c=y.ATTRIB_VALUE_UNQUOTED;u="attribValue";break}if(n===";"){t[u]+=parseEntity(t);t.entity="";t.state=c}else if(isMatch(t.entity.length?m:p,n)){t.entity+=n}else{strictFail(t,"Invalid character in entity name");t[u]+="&"+t.entity+n;t.entity="";t.state=c}continue;default:throw new Error(t,"Unknown state: "+t.state)}}if(t.position>=t.bufferCheckPosition){checkBufferLength(t)}return t}
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint){(function(){var e=String.fromCharCode;var t=Math.floor;var fromCodePoint=function(){var r=16384;var n=[];var i;var a;var s=-1;var o=arguments.length;if(!o){return""}var c="";while(++s<o){var u=Number(arguments[s]);if(!isFinite(u)||u<0||u>1114111||t(u)!==u){throw RangeError("Invalid code point: "+u)}if(u<=65535){n.push(u)}else{u-=65536;i=(u>>10)+55296;a=u%1024+56320;n.push(i,a)}if(s+1===o||n.length>r){c+=e.apply(null,n);n.length=0}}return c};if(Object.defineProperty){Object.defineProperty(String,"fromCodePoint",{value:fromCodePoint,configurable:true,writable:true})}else{String.fromCodePoint=fromCodePoint}})()}})(false?0:t)},9046:(e,t)=>{"use strict";t.fromCallback=function(e){return Object.defineProperty((function(...t){if(typeof t[t.length-1]==="function")e.apply(this,t);else{return new Promise(((r,n)=>{e.call(this,...t,((e,t)=>e!=null?n(e):r(t)))}))}}),"name",{value:e.name})};t.fromPromise=function(e){return Object.defineProperty((function(...t){const r=t[t.length-1];if(typeof r!=="function")return e.apply(this,t);else e.apply(this,t.slice(0,-1)).then((e=>r(null,e)),r)}),"name",{value:e.name})}},1709:e=>{e.exports={isArray:function(e){if(Array.isArray){return Array.isArray(e)}return Object.prototype.toString.call(e)==="[object Array]"}}},8821:(e,t,r)=>{var n=r(2903);var i=r(8919);var a=r(4453);var s=r(1900);e.exports={xml2js:n,xml2json:i,js2xml:a,json2xml:s}},4453:(e,t,r)=>{var n=r(6717);var i=r(1709).isArray;var a,s;function validateOptions(e){var t=n.copyOptions(e);n.ensureFlagExists("ignoreDeclaration",t);n.ensureFlagExists("ignoreInstruction",t);n.ensureFlagExists("ignoreAttributes",t);n.ensureFlagExists("ignoreText",t);n.ensureFlagExists("ignoreComment",t);n.ensureFlagExists("ignoreCdata",t);n.ensureFlagExists("ignoreDoctype",t);n.ensureFlagExists("compact",t);n.ensureFlagExists("indentText",t);n.ensureFlagExists("indentCdata",t);n.ensureFlagExists("indentAttributes",t);n.ensureFlagExists("indentInstruction",t);n.ensureFlagExists("fullTagEmptyElement",t);n.ensureFlagExists("noQuotesForNativeAttributes",t);n.ensureSpacesExists(t);if(typeof t.spaces==="number"){t.spaces=Array(t.spaces+1).join(" ")}n.ensureKeyExists("declaration",t);n.ensureKeyExists("instruction",t);n.ensureKeyExists("attributes",t);n.ensureKeyExists("text",t);n.ensureKeyExists("comment",t);n.ensureKeyExists("cdata",t);n.ensureKeyExists("doctype",t);n.ensureKeyExists("type",t);n.ensureKeyExists("name",t);n.ensureKeyExists("elements",t);n.checkFnExists("doctype",t);n.checkFnExists("instruction",t);n.checkFnExists("cdata",t);n.checkFnExists("comment",t);n.checkFnExists("text",t);n.checkFnExists("instructionName",t);n.checkFnExists("elementName",t);n.checkFnExists("attributeName",t);n.checkFnExists("attributeValue",t);n.checkFnExists("attributes",t);n.checkFnExists("fullTagEmptyElement",t);return t}function writeIndentation(e,t,r){return(!r&&e.spaces?"\n":"")+Array(t+1).join(e.spaces)}function writeAttributes(e,t,r){if(t.ignoreAttributes){return""}if("attributesFn"in t){e=t.attributesFn(e,s,a)}var n,i,o,c,u=[];for(n in e){if(e.hasOwnProperty(n)&&e[n]!==null&&e[n]!==undefined){c=t.noQuotesForNativeAttributes&&typeof e[n]!=="string"?"":'"';i=""+e[n];i=i.replace(/"/g,"&quot;");o="attributeNameFn"in t?t.attributeNameFn(n,i,s,a):n;u.push(t.spaces&&t.indentAttributes?writeIndentation(t,r+1,false):" ");u.push(o+"="+c+("attributeValueFn"in t?t.attributeValueFn(i,n,s,a):i)+c)}}if(e&&Object.keys(e).length&&t.spaces&&t.indentAttributes){u.push(writeIndentation(t,r,false))}return u.join("")}function writeDeclaration(e,t,r){a=e;s="xml";return t.ignoreDeclaration?"":"<?"+"xml"+writeAttributes(e[t.attributesKey],t,r)+"?>"}function writeInstruction(e,t,r){if(t.ignoreInstruction){return""}var n;for(n in e){if(e.hasOwnProperty(n)){break}}var i="instructionNameFn"in t?t.instructionNameFn(n,e[n],s,a):n;if(typeof e[n]==="object"){a=e;s=i;return"<?"+i+writeAttributes(e[n][t.attributesKey],t,r)+"?>"}else{var o=e[n]?e[n]:"";if("instructionFn"in t)o=t.instructionFn(o,n,s,a);return"<?"+i+(o?" "+o:"")+"?>"}}function writeComment(e,t){return t.ignoreComment?"":"\x3c!--"+("commentFn"in t?t.commentFn(e,s,a):e)+"--\x3e"}function writeCdata(e,t){return t.ignoreCdata?"":"<![CDATA["+("cdataFn"in t?t.cdataFn(e,s,a):e.replace("]]>","]]]]><![CDATA[>"))+"]]>"}function writeDoctype(e,t){return t.ignoreDoctype?"":"<!DOCTYPE "+("doctypeFn"in t?t.doctypeFn(e,s,a):e)+">"}function writeText(e,t){if(t.ignoreText)return"";e=""+e;e=e.replace(/&amp;/g,"&");e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return"textFn"in t?t.textFn(e,s,a):e}function hasContent(e,t){var r;if(e.elements&&e.elements.length){for(r=0;r<e.elements.length;++r){switch(e.elements[r][t.typeKey]){case"text":if(t.indentText){return true}break;case"cdata":if(t.indentCdata){return true}break;case"instruction":if(t.indentInstruction){return true}break;case"doctype":case"comment":case"element":return true;default:return true}}}return false}function writeElement(e,t,r){a=e;s=e.name;var n=[],i="elementNameFn"in t?t.elementNameFn(e.name,e):e.name;n.push("<"+i);if(e[t.attributesKey]){n.push(writeAttributes(e[t.attributesKey],t,r))}var o=e[t.elementsKey]&&e[t.elementsKey].length||e[t.attributesKey]&&e[t.attributesKey]["xml:space"]==="preserve";if(!o){if("fullTagEmptyElementFn"in t){o=t.fullTagEmptyElementFn(e.name,e)}else{o=t.fullTagEmptyElement}}if(o){n.push(">");if(e[t.elementsKey]&&e[t.elementsKey].length){n.push(writeElements(e[t.elementsKey],t,r+1));a=e;s=e.name}n.push(t.spaces&&hasContent(e,t)?"\n"+Array(r+1).join(t.spaces):"");n.push("</"+i+">")}else{n.push("/>")}return n.join("")}function writeElements(e,t,r,n){return e.reduce((function(e,i){var a=writeIndentation(t,r,n&&!e);switch(i.type){case"element":return e+a+writeElement(i,t,r);case"comment":return e+a+writeComment(i[t.commentKey],t);case"doctype":return e+a+writeDoctype(i[t.doctypeKey],t);case"cdata":return e+(t.indentCdata?a:"")+writeCdata(i[t.cdataKey],t);case"text":return e+(t.indentText?a:"")+writeText(i[t.textKey],t);case"instruction":var s={};s[i[t.nameKey]]=i[t.attributesKey]?i:i[t.instructionKey];return e+(t.indentInstruction?a:"")+writeInstruction(s,t,r)}}),"")}function hasContentCompact(e,t,r){var n;for(n in e){if(e.hasOwnProperty(n)){switch(n){case t.parentKey:case t.attributesKey:break;case t.textKey:if(t.indentText||r){return true}break;case t.cdataKey:if(t.indentCdata||r){return true}break;case t.instructionKey:if(t.indentInstruction||r){return true}break;case t.doctypeKey:case t.commentKey:return true;default:return true}}}return false}function writeElementCompact(e,t,r,n,i){a=e;s=t;var o="elementNameFn"in r?r.elementNameFn(t,e):t;if(typeof e==="undefined"||e===null||e===""){return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(t,e)||r.fullTagEmptyElement?"<"+o+"></"+o+">":"<"+o+"/>"}var c=[];if(t){c.push("<"+o);if(typeof e!=="object"){c.push(">"+writeText(e,r)+"</"+o+">");return c.join("")}if(e[r.attributesKey]){c.push(writeAttributes(e[r.attributesKey],r,n))}var u=hasContentCompact(e,r,true)||e[r.attributesKey]&&e[r.attributesKey]["xml:space"]==="preserve";if(!u){if("fullTagEmptyElementFn"in r){u=r.fullTagEmptyElementFn(t,e)}else{u=r.fullTagEmptyElement}}if(u){c.push(">")}else{c.push("/>");return c.join("")}}c.push(writeElementsCompact(e,r,n+1,false));a=e;s=t;if(t){c.push((i?writeIndentation(r,n,false):"")+"</"+o+">")}return c.join("")}function writeElementsCompact(e,t,r,n){var a,s,o,c=[];for(s in e){if(e.hasOwnProperty(s)){o=i(e[s])?e[s]:[e[s]];for(a=0;a<o.length;++a){switch(s){case t.declarationKey:c.push(writeDeclaration(o[a],t,r));break;case t.instructionKey:c.push((t.indentInstruction?writeIndentation(t,r,n):"")+writeInstruction(o[a],t,r));break;case t.attributesKey:case t.parentKey:break;case t.textKey:c.push((t.indentText?writeIndentation(t,r,n):"")+writeText(o[a],t));break;case t.cdataKey:c.push((t.indentCdata?writeIndentation(t,r,n):"")+writeCdata(o[a],t));break;case t.doctypeKey:c.push(writeIndentation(t,r,n)+writeDoctype(o[a],t));break;case t.commentKey:c.push(writeIndentation(t,r,n)+writeComment(o[a],t));break;default:c.push(writeIndentation(t,r,n)+writeElementCompact(o[a],s,t,r,hasContentCompact(o[a],t)))}n=n&&!c.length}}}return c.join("")}e.exports=function(e,t){t=validateOptions(t);var r=[];a=e;s="_root_";if(t.compact){r.push(writeElementsCompact(e,t,0,true))}else{if(e[t.declarationKey]){r.push(writeDeclaration(e[t.declarationKey],t,0))}if(e[t.elementsKey]&&e[t.elementsKey].length){r.push(writeElements(e[t.elementsKey],t,0,!r.length))}}return r.join("")}},1900:(e,t,r)=>{var n=r(4453);e.exports=function(e,t){if(e instanceof Buffer){e=e.toString()}var r=null;if(typeof e==="string"){try{r=JSON.parse(e)}catch(e){throw new Error("The JSON structure is invalid")}}else{r=e}return n(r,t)}},6717:(e,t,r)=>{var n=r(1709).isArray;e.exports={copyOptions:function(e){var t,r={};for(t in e){if(e.hasOwnProperty(t)){r[t]=e[t]}}return r},ensureFlagExists:function(e,t){if(!(e in t)||typeof t[e]!=="boolean"){t[e]=false}},ensureSpacesExists:function(e){if(!("spaces"in e)||typeof e.spaces!=="number"&&typeof e.spaces!=="string"){e.spaces=0}},ensureAlwaysArrayExists:function(e){if(!("alwaysArray"in e)||typeof e.alwaysArray!=="boolean"&&!n(e.alwaysArray)){e.alwaysArray=false}},ensureKeyExists:function(e,t){if(!(e+"Key"in t)||typeof t[e+"Key"]!=="string"){t[e+"Key"]=t.compact?"_"+e:e}},checkFnExists:function(e,t){return e+"Fn"in t}}},2903:(e,t,r)=>{var n=r(2043);var i={on:function(){},parse:function(){}};var a=r(6717);var s=r(1709).isArray;var o;var c=true;var u;function validateOptions(e){o=a.copyOptions(e);a.ensureFlagExists("ignoreDeclaration",o);a.ensureFlagExists("ignoreInstruction",o);a.ensureFlagExists("ignoreAttributes",o);a.ensureFlagExists("ignoreText",o);a.ensureFlagExists("ignoreComment",o);a.ensureFlagExists("ignoreCdata",o);a.ensureFlagExists("ignoreDoctype",o);a.ensureFlagExists("compact",o);a.ensureFlagExists("alwaysChildren",o);a.ensureFlagExists("addParent",o);a.ensureFlagExists("trim",o);a.ensureFlagExists("nativeType",o);a.ensureFlagExists("nativeTypeAttributes",o);a.ensureFlagExists("sanitize",o);a.ensureFlagExists("instructionHasAttributes",o);a.ensureFlagExists("captureSpacesBetweenElements",o);a.ensureAlwaysArrayExists(o);a.ensureKeyExists("declaration",o);a.ensureKeyExists("instruction",o);a.ensureKeyExists("attributes",o);a.ensureKeyExists("text",o);a.ensureKeyExists("comment",o);a.ensureKeyExists("cdata",o);a.ensureKeyExists("doctype",o);a.ensureKeyExists("type",o);a.ensureKeyExists("name",o);a.ensureKeyExists("elements",o);a.ensureKeyExists("parent",o);a.checkFnExists("doctype",o);a.checkFnExists("instruction",o);a.checkFnExists("cdata",o);a.checkFnExists("comment",o);a.checkFnExists("text",o);a.checkFnExists("instructionName",o);a.checkFnExists("elementName",o);a.checkFnExists("attributeName",o);a.checkFnExists("attributeValue",o);a.checkFnExists("attributes",o);return o}function nativeType(e){var t=Number(e);if(!isNaN(t)){return t}var r=e.toLowerCase();if(r==="true"){return true}else if(r==="false"){return false}return e}function addField(e,t){var r;if(o.compact){if(!u[o[e+"Key"]]&&(s(o.alwaysArray)?o.alwaysArray.indexOf(o[e+"Key"])!==-1:o.alwaysArray)){u[o[e+"Key"]]=[]}if(u[o[e+"Key"]]&&!s(u[o[e+"Key"]])){u[o[e+"Key"]]=[u[o[e+"Key"]]]}if(e+"Fn"in o&&typeof t==="string"){t=o[e+"Fn"](t,u)}if(e==="instruction"&&("instructionFn"in o||"instructionNameFn"in o)){for(r in t){if(t.hasOwnProperty(r)){if("instructionFn"in o){t[r]=o.instructionFn(t[r],r,u)}else{var n=t[r];delete t[r];t[o.instructionNameFn(r,n,u)]=n}}}}if(s(u[o[e+"Key"]])){u[o[e+"Key"]].push(t)}else{u[o[e+"Key"]]=t}}else{if(!u[o.elementsKey]){u[o.elementsKey]=[]}var i={};i[o.typeKey]=e;if(e==="instruction"){for(r in t){if(t.hasOwnProperty(r)){break}}i[o.nameKey]="instructionNameFn"in o?o.instructionNameFn(r,t,u):r;if(o.instructionHasAttributes){i[o.attributesKey]=t[r][o.attributesKey];if("instructionFn"in o){i[o.attributesKey]=o.instructionFn(i[o.attributesKey],r,u)}}else{if("instructionFn"in o){t[r]=o.instructionFn(t[r],r,u)}i[o.instructionKey]=t[r]}}else{if(e+"Fn"in o){t=o[e+"Fn"](t,u)}i[o[e+"Key"]]=t}if(o.addParent){i[o.parentKey]=u}u[o.elementsKey].push(i)}}function manipulateAttributes(e){if("attributesFn"in o&&e){e=o.attributesFn(e,u)}if((o.trim||"attributeValueFn"in o||"attributeNameFn"in o||o.nativeTypeAttributes)&&e){var t;for(t in e){if(e.hasOwnProperty(t)){if(o.trim)e[t]=e[t].trim();if(o.nativeTypeAttributes){e[t]=nativeType(e[t])}if("attributeValueFn"in o)e[t]=o.attributeValueFn(e[t],t,u);if("attributeNameFn"in o){var r=e[t];delete e[t];e[o.attributeNameFn(t,e[t],u)]=r}}}}return e}function onInstruction(e){var t={};if(e.body&&(e.name.toLowerCase()==="xml"||o.instructionHasAttributes)){var r=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;var n;while((n=r.exec(e.body))!==null){t[n[1]]=n[2]||n[3]||n[4]}t=manipulateAttributes(t)}if(e.name.toLowerCase()==="xml"){if(o.ignoreDeclaration){return}u[o.declarationKey]={};if(Object.keys(t).length){u[o.declarationKey][o.attributesKey]=t}if(o.addParent){u[o.declarationKey][o.parentKey]=u}}else{if(o.ignoreInstruction){return}if(o.trim){e.body=e.body.trim()}var i={};if(o.instructionHasAttributes&&Object.keys(t).length){i[e.name]={};i[e.name][o.attributesKey]=t}else{i[e.name]=e.body}addField("instruction",i)}}function onStartElement(e,t){var r;if(typeof e==="object"){t=e.attributes;e=e.name}t=manipulateAttributes(t);if("elementNameFn"in o){e=o.elementNameFn(e,u)}if(o.compact){r={};if(!o.ignoreAttributes&&t&&Object.keys(t).length){r[o.attributesKey]={};var n;for(n in t){if(t.hasOwnProperty(n)){r[o.attributesKey][n]=t[n]}}}if(!(e in u)&&(s(o.alwaysArray)?o.alwaysArray.indexOf(e)!==-1:o.alwaysArray)){u[e]=[]}if(u[e]&&!s(u[e])){u[e]=[u[e]]}if(s(u[e])){u[e].push(r)}else{u[e]=r}}else{if(!u[o.elementsKey]){u[o.elementsKey]=[]}r={};r[o.typeKey]="element";r[o.nameKey]=e;if(!o.ignoreAttributes&&t&&Object.keys(t).length){r[o.attributesKey]=t}if(o.alwaysChildren){r[o.elementsKey]=[]}u[o.elementsKey].push(r)}r[o.parentKey]=u;u=r}function onText(e){if(o.ignoreText){return}if(!e.trim()&&!o.captureSpacesBetweenElements){return}if(o.trim){e=e.trim()}if(o.nativeType){e=nativeType(e)}if(o.sanitize){e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}addField("text",e)}function onComment(e){if(o.ignoreComment){return}if(o.trim){e=e.trim()}addField("comment",e)}function onEndElement(e){var t=u[o.parentKey];if(!o.addParent){delete u[o.parentKey]}u=t}function onCdata(e){if(o.ignoreCdata){return}if(o.trim){e=e.trim()}addField("cdata",e)}function onDoctype(e){if(o.ignoreDoctype){return}e=e.replace(/^ /,"");if(o.trim){e=e.trim()}addField("doctype",e)}function onError(e){e.note=e}e.exports=function(e,t){var r=c?n.parser(true,{}):r=new i.Parser("UTF-8");var a={};u=a;o=validateOptions(t);if(c){r.opt={strictEntities:true};r.onopentag=onStartElement;r.ontext=onText;r.oncomment=onComment;r.onclosetag=onEndElement;r.onerror=onError;r.oncdata=onCdata;r.ondoctype=onDoctype;r.onprocessinginstruction=onInstruction}else{r.on("startElement",onStartElement);r.on("text",onText);r.on("comment",onComment);r.on("endElement",onEndElement);r.on("error",onError)}if(c){r.write(e).close()}else{if(!r.parse(e)){throw new Error("XML parsing error: "+r.getError())}}if(a[o.elementsKey]){var s=a[o.elementsKey];delete a[o.elementsKey];a[o.elementsKey]=s;delete a.text}return a}},8919:(e,t,r)=>{var n=r(6717);var i=r(2903);function validateOptions(e){var t=n.copyOptions(e);n.ensureSpacesExists(t);return t}e.exports=function(e,t){var r,n,a,s;r=validateOptions(t);n=i(e,r);s="compact"in r&&r.compact?"_parent":"parent";if("addParent"in r&&r.addParent){a=JSON.stringify(n,(function(e,t){return e===s?"_":t}),r.spaces)}else{a=JSON.stringify(n,null,r.spaces)}return a.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}},2357:e=>{"use strict";e.exports=require("assert")},7619:e=>{"use strict";e.exports=require("constants")},5747:e=>{"use strict";e.exports=require("fs")},2087:e=>{"use strict";e.exports=require("os")},5622:e=>{"use strict";e.exports=require("path")},2413:e=>{"use strict";e.exports=require("stream")},4304:e=>{"use strict";e.exports=require("string_decoder")},1669:e=>{"use strict";e.exports=require("util")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var i=t[r]={exports:{}};var a=true;try{e[r].call(i.exports,i,i.exports,__nccwpck_require__);a=false}finally{if(a)delete t[r]}return i.exports}(()=>{__nccwpck_require__.n=e=>{var t=e&&e.__esModule?()=>e["default"]:()=>e;__nccwpck_require__.d(t,{a:t});return t}})();(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{"use strict";__nccwpck_require__.r(r);__nccwpck_require__.d(r,{logError:()=>logError,logInfo:()=>logInfo});var e=__nccwpck_require__(2186);var t=__nccwpck_require__(7888);var n=__nccwpck_require__(5747);var i=__nccwpck_require__(5630);var a=__nccwpck_require__(5622);var s=__nccwpck_require__(8821);const o=require("child_process");const c=require("http");const u=require("https");var l=__nccwpck_require__(6235);var f=__nccwpck_require__.n(l);var p=__nccwpck_require__(2087);const m=JSON.parse((0,n.readFileSync)(__nccwpck_require__.ab+"package.json","utf-8"));const y=`${m.name||"Action-SpigotMC"}/${m.version||"UNKNOWN_VERSION"} (+${m.homepage||"https://github.com/SpraxDev/Action-SpigotMC"})`;const d=(0,p.cpus)().length;const h=(0,p.homedir)();function fixArgArr(e){const t=[];for(const r of e){const e=r.trim();if(e&&!t.includes(e)){t.push(e)}}return t}function isNumeric(e){return/^[0-9]+$/.test(e)}async function runCmd(e,t,r,i,a=false){return new Promise(((s,c)=>{const u=typeof i=="string";const l=typeof i!="string"?i:(0,n.createWriteStream)(i,{encoding:"utf-8",flags:"a"});const f=(0,o.spawn)(e,t,{shell:true,cwd:r,env:process.env});f.stdout.on("data",(e=>{l.write(e);if(!a){process.stdout.write(e)}}));f.stderr.on("data",(e=>{l.write(e);if(!a){process.stderr.write(e)}}));f.on("close",(t=>{if(u){l.close()}if(t!=0){return c({err:new Error(`process exited with code ${t}`),cmd:e,workingDir:r})}s()}))}))}async function downloadFile(e,t,r=0){const i=e.toLowerCase().startsWith("http://")?c.get:u.get;return new Promise(((a,s)=>{let o=null;const done=function(e){if(o){o.close();o=null;if(e&&t!=null){(0,n.rmdirSync)(t,{recursive:true})}}};i(e,{headers:{"User-Agent":y}},(e=>{if(e.statusCode!=200){const n=e.headers.location;if(r<12&&n&&(e.statusCode==301||e.statusCode==302||e.statusCode==303||e.statusCode==307||e.statusCode==308)){done(false);if(!/https?:\/\//g.test(n)){return s(new Error(`Server responded with ${e.statusCode} and a relative Location-Header value (${n})`))}return downloadFile(n,t,++r).then(a).catch(s)}else{done(true);return s(new Error(`Server responded with ${e.statusCode}`))}}if(t!=null){o=(0,n.createWriteStream)(t,{encoding:"binary"}).on("finish",(()=>{done(false);return a()})).on("error",(e=>{done(true);return s(e)}));e.pipe(o)}else{const t=[];e.on("data",(e=>{t.push(Buffer.from(e,"binary"))}));e.on("end",(()=>{a(Buffer.concat(t))}))}})).on("error",(e=>{done(true);return s(e)}))}))}function readLastLines(e,t,r="utf-8"){const n=[];const i=new(f())(e);let a;while(a=i.next()){n.push(a.toString(r));if(n.length>t){n.shift()}}return n}function resetWorkingDir(){const e=(0,a.join)((0,p.tmpdir)(),"SpraxDev-Action-SpigotMC");const t=(0,a.join)(e,"cache");const r=(0,a.join)(e,"logs");(0,n.rmdirSync)(e,{recursive:true});(0,n.mkdirSync)(t,{recursive:true});(0,n.mkdirSync)(r);return{base:e,cache:t,logs:r}}function exit(e,t){if(t){if(typeof t=="string"){logInfo(t)}else{logError(t)}}return process.exit(e)}const g={spraxdev:{url:"https://github.com/SpraxDev/Spigot-BuildTools/releases/latest/download/BuildTools.jar",prepareArgs:["--exit-after-fetch"]},spigotmc:{url:"https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar",prepareArgs:["--compile","None","--rev","1.16.5"]}};const v=(e.getInput("buildToolProvider")||"SpigotMC").toLowerCase();let S=fixArgArr((e.getInput("versions")||"latest").toLowerCase().split(","));const E=e.getInput("generateSrc")=="true";const w=e.getInput("generateDoc")=="true";const b=e.getInput("disableJavaCheck")=="true";const T=e.getInput("forceRun")=="true";const _=isNumeric(e.getInput("threads"))?parseInt(e.getInput("threads")):d;const k=resetWorkingDir();const x=(0,a.join)(k.logs,"SpraxDev_Actions-SpigotMC.log");const A=(0,n.createWriteStream)(x,{encoding:"utf-8",flags:"a"});async function run(){return new Promise((async(r,s)=>{try{if(S.length==0)return r({code:0,msg:"No version(s) provided to build"});if(!Object.keys(g).includes(v)){return s(new Error(`'${v}' is not a valid BuildTool-Provider (${Object.keys(g).join(", ")})`))}else if(v=="spraxdev"){logError(`SpraxDev's BuildTool has known issues causing builds to fail, please use 'SpigotMC' if you encounter any problems`)}if(!T){S=await removeExistingVersions(S,((e,t)=>{logInfo(`Skipping version '${e}' because it has been found in the local maven repository: ${t}`)}));if(S.length==0)return r({code:0,msg:"No new versions to build"})}const o=g[v];logInfo("Installed Java-Version:");await runCmd("java",["-version"],k.base,A);logInfo(`\nDownloading '${o.url}'...`);await downloadFile(o.url,(0,a.join)(k.cache,"BuildTools.jar"));const c=S.length!=1;if(c){logInfo("Prepare for future tasks by running BuildTools...");await e.group("Prepare BuildTools",(async()=>{try{return runCmd("java",["-jar","BuildTools.jar",b?"--disable-java-check":"",...o.prepareArgs],k.cache,A)}catch(e){logError(e);logError(`\nPrinting last 30 lines from '${(0,a.resolve)(x)}':`);for(const e of readLastLines(x,30)){logError(e)}return exit(1)}}))}const u=["-jar","BuildTools.jar","--compile","Spigot"];if(E){u.push("--generate-source")}if(w){u.push("--generate-docs")}if(b){u.push("--disable-java-check")}const l=[];for(const e of S){l.push((async()=>new Promise((async(t,r)=>{const s=Date.now();const o=(0,a.join)(k.logs,`${e}.log`);logInfo(`Building version '${e}'...`);const l=c?(0,a.join)(k.base,`${e}`):k.cache;if(c){await(0,i.copy)(k.cache,l)}try{await runCmd("java",[...u,"--rev",e],l,o,true);if(c){(0,n.rmdirSync)(l,{recursive:true})}const r=Date.now();logInfo(`Finished '${e}' in ${((r-s)/6e4).toFixed(2)} minutes`);t()}catch(t){logInfo(`An error occurred while building '${e}'`);logError(t);logError(`\nPrinting last 30 lines from '${(0,a.resolve)(o)}':`);for(const e of readLastLines(o,30)){logError(e)}r(t)}}))))}(0,t.parallelLimit)(l,_,(e=>{if(e)return s(e);r({code:0})}))}catch(e){s(e)}}))}async function removeExistingVersions(e,t){return new Promise((async(r,i)=>{var o,c,u;const l=[];for(const r of e){let e=false;let i=r!="latest"?r:null;try{const e=await downloadFile(`https://hub.spigotmc.org/versions/${r}.json`,null);const t=e instanceof Buffer?JSON.parse(e.toString("utf-8")):null;const n=(o=t===null||t===void 0?void 0:t.refs)===null||o===void 0?void 0:o.Bukkit;if(n){const e=await downloadFile(`https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/raw/pom.xml?at=${n}`,null);if(e instanceof Buffer){const t=(0,s.xml2js)(e.toString("utf-8"),{compact:true,ignoreComment:true,ignoreAttributes:true});i=(u=(c=t.project)===null||c===void 0?void 0:c.version)===null||u===void 0?void 0:u._text}}}catch(e){logError(e)}const f=(0,a.resolve)((0,a.join)(h,`/.m2/repository/org/spigotmc/spigot/${i}/spigot-${i}.jar`));if(i){e=(0,n.existsSync)(f)}if(e){t(r,f)}else{l.push(r)}}r(l)}))}function logInfo(e){console.log(e);A.write(e+"\n")}function logError(e){if(typeof e!="string"){e=JSON.stringify(e,null,2)}console.error(e);A.write(e+"\n")}run().then((e=>exit(e.code,e.msg))).catch((e=>exit(1,e)))})();module.exports=r})();
//# sourceMappingURL=index.js.map