@modern-js/utils
Version:
A Progressive React Framework for modern web development.
1 lines • 30.2 kB
JavaScript
(()=>{var e={305:(e,t,r)=>{"use strict";var n=r(837);var i=r(589);var s=function errorEx(e,t){if(!e||e.constructor!==String){t=e||{};e=Error.name}var r=function ErrorEXError(n){if(!this){return new ErrorEXError(n)}n=n instanceof Error?n.message:n||this.message;Error.call(this,n);Error.captureStackTrace(this,r);this.name=e;Object.defineProperty(this,"message",{configurable:true,enumerable:false,get:function(){var e=n.split(/\r?\n/g);for(var r in t){if(!t.hasOwnProperty(r)){continue}var s=t[r];if("message"in s){e=s.message(this[r],e)||e;if(!i(e)){e=[e]}}}return e.join("\n")},set:function(e){n=e}});var s=null;var o=Object.getOwnPropertyDescriptor(this,"stack");var c=o.get;var a=o.value;delete o.value;delete o.writable;o.set=function(e){s=e};o.get=function(){var e=(s||(c?c.call(this):a)).split(/\r?\n+/g);if(!s){e[0]=this.name+": "+this.message}var r=1;for(var n in t){if(!t.hasOwnProperty(n)){continue}var i=t[n];if("line"in i){var o=i.line(this[n]);if(o){e.splice(r++,0," "+o)}}if("stack"in i){i.stack(this[n],e)}}return e.join("\n")};Object.defineProperty(this,"stack",o)};if(Object.setPrototypeOf){Object.setPrototypeOf(r.prototype,Error.prototype);Object.setPrototypeOf(r,Error)}else{n.inherits(r,Error)}return r};s.append=function(e,t){return{message:function(r,n){r=r||t;if(r){n[0]+=" "+e.replace("%s",r.toString())}return n}}};s.line=function(e,t){return{line:function(r){r=r||t;if(r){return e.replace("%s",r.toString())}return null}}};e.exports=s},434:e=>{"use strict";var t=/[|\\{}()[\]^$+*?.]/g;e.exports=function(e){if(typeof e!=="string"){throw new TypeError("Expected a string")}return e.replace(t,"\\$&")}},877:(e,t,r)=>{"use strict";const n=r(434);const i=process.platform;const s={tick:"✔",cross:"✖",star:"★",square:"▇",squareSmall:"◻",squareSmallFilled:"◼",play:"▶",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",circleQuestionMark:"?⃝",bullet:"●",dot:"․",line:"─",ellipsis:"…",pointer:"❯",pointerSmall:"›",info:"ℹ",warning:"⚠",hamburger:"☰",smiley:"㋡",mustache:"෴",heart:"♥",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",questionMarkPrefix:"?⃝",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneSeventh:"⅐",oneEighth:"⅛",oneNinth:"⅑",oneTenth:"⅒",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞"};const o={tick:"√",cross:"×",star:"*",square:"█",squareSmall:"[ ]",squareSmallFilled:"[█]",play:"►",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",circleQuestionMark:"(?)",bullet:"*",dot:".",line:"─",ellipsis:"...",pointer:">",pointerSmall:"»",info:"i",warning:"‼",hamburger:"≡",smiley:"☺",mustache:"┌─┐",heart:s.heart,arrowUp:s.arrowUp,arrowDown:s.arrowDown,arrowLeft:s.arrowLeft,arrowRight:s.arrowRight,radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",questionMarkPrefix:"?",oneHalf:"1/2",oneThird:"1/3",oneQuarter:"1/4",oneFifth:"1/5",oneSixth:"1/6",oneSeventh:"1/7",oneEighth:"1/8",oneNinth:"1/9",oneTenth:"1/10",twoThirds:"2/3",twoFifths:"2/5",threeQuarters:"3/4",threeFifths:"3/5",threeEighths:"3/8",fourFifths:"4/5",fiveSixths:"5/6",fiveEighths:"5/8",sevenEighths:"7/8"};if(i==="linux"){s.questionMarkPrefix="?"}const c=i==="win32"?o:s;const fn=e=>{if(c===s){return e}Object.keys(s).forEach((t=>{if(s[t]===c[t]){return}e=e.replace(new RegExp(n(s[t]),"g"),c[t])}));return e};e.exports=Object.assign(fn,c)},834:(e,t,r)=>{"use strict";const n=r(17);const i=r(69);e.exports=(e,t)=>{t=t||{};const r=n.resolve(t.cwd||"");const s=n.parse(r).root;const o=[].concat(e);return new Promise((e=>{(function find(t){i(o,{cwd:t}).then((r=>{if(r){e(n.join(t,r))}else if(t===s){e(null)}else{find(n.dirname(t))}}))})(r)}))};e.exports.sync=(e,t)=>{t=t||{};let r=n.resolve(t.cwd||"");const s=n.parse(r).root;const o=[].concat(e);while(true){const e=i.sync(o,{cwd:r});if(e){return n.join(r,e)}else if(r===s){return null}r=n.dirname(r)}}},132:e=>{"use strict";e.exports=clone;var t=Object.getPrototypeOf||function(e){return e.__proto__};function clone(e){if(e===null||typeof e!=="object")return e;if(e instanceof Object)var r={__proto__:t(e)};else var r=Object.create(null);Object.getOwnPropertyNames(e).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}));return r}},127:(e,t,r)=>{var n=r(147);var i=r(738);var s=r(876);var o=r(132);var c=r(837);var a;var l;if(typeof Symbol==="function"&&typeof Symbol.for==="function"){a=Symbol.for("graceful-fs.queue");l=Symbol.for("graceful-fs.previous")}else{a="___graceful-fs.queue";l="___graceful-fs.previous"}function noop(){}function publishQueue(e,t){Object.defineProperty(e,a,{get:function(){return t}})}var f=noop;if(c.debuglog)f=c.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))f=function(){var e=c.format.apply(c,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: ");console.error(e)};if(!n[a]){var u=global[a]||[];publishQueue(n,u);n.close=function(e){function close(t,r){return e.call(n,t,(function(e){if(!e){resetQueue()}if(typeof r==="function")r.apply(this,arguments)}))}Object.defineProperty(close,l,{value:e});return close}(n.close);n.closeSync=function(e){function closeSync(t){e.apply(n,arguments);resetQueue()}Object.defineProperty(closeSync,l,{value:e});return closeSync}(n.closeSync);if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")){process.on("exit",(function(){f(n[a]);r(491).equal(n[a].length,0)}))}}if(!global[a]){publishQueue(global,n[a])}e.exports=patch(o(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,i){return t(e,r,(function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))enqueue([go$readFile,[e,r,n],t,i||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}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,s){return r(e,t,n,(function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))enqueue([go$writeFile,[e,t,n,i],r,s||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}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,s){return n(e,t,r,(function(n){if(n&&(n.code==="EMFILE"||n.code==="ENFILE"))enqueue([go$appendFile,[e,t,r,i],n,s||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}var o=e.copyFile;if(o)e.copyFile=copyFile;function copyFile(e,t,r,n){if(typeof r==="function"){n=r;r=0}return go$copyFile(e,t,r,n);function go$copyFile(e,t,r,n,i){return o(e,t,r,(function(s){if(s&&(s.code==="EMFILE"||s.code==="ENFILE"))enqueue([go$copyFile,[e,t,r,n],s,i||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}var c=e.readdir;e.readdir=readdir;var a=/^v[0-5]\./;function readdir(e,t,r){if(typeof t==="function")r=t,t=null;var n=a.test(process.version)?function go$readdir(e,t,r,n){return c(e,fs$readdirCallback(e,t,r,n))}:function go$readdir(e,t,r,n){return c(e,t,fs$readdirCallback(e,t,r,n))};return n(e,t,r);function fs$readdirCallback(e,t,r,i){return function(s,o){if(s&&(s.code==="EMFILE"||s.code==="ENFILE"))enqueue([n,[e,t,r],s,i||Date.now(),Date.now()]);else{if(o&&o.sort)o.sort();if(typeof r==="function")r.call(this,s,o)}}}}if(process.version.substr(0,4)==="v0.8"){var l=s(e);ReadStream=l.ReadStream;WriteStream=l.WriteStream}var f=e.ReadStream;if(f){ReadStream.prototype=Object.create(f.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 h=ReadStream;Object.defineProperty(e,"FileReadStream",{get:function(){return h},set:function(e){h=e},enumerable:true,configurable:true});var p=WriteStream;Object.defineProperty(e,"FileWriteStream",{get:function(){return p},set:function(e){p=e},enumerable:true,configurable:true});function ReadStream(e,t){if(this instanceof ReadStream)return f.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 d=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,i){return d(e,t,r,(function(s,o){if(s&&(s.code==="EMFILE"||s.code==="ENFILE"))enqueue([go$open,[e,t,r,n],s,i||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}return e}function enqueue(e){f("ENQUEUE",e[0].name,e[1]);n[a].push(e);retry()}var h;function resetQueue(){var e=Date.now();for(var t=0;t<n[a].length;++t){if(n[a][t].length>2){n[a][t][3]=e;n[a][t][4]=e}}retry()}function retry(){clearTimeout(h);h=undefined;if(n[a].length===0)return;var e=n[a].shift();var t=e[0];var r=e[1];var i=e[2];var s=e[3];var o=e[4];if(s===undefined){f("RETRY",t.name,r);t.apply(null,r)}else if(Date.now()-s>=6e4){f("TIMEOUT",t.name,r);var c=r.pop();if(typeof c==="function")c.call(null,i)}else{var l=Date.now()-o;var u=Math.max(o-s,1);var p=Math.min(u*1.2,100);if(l>=p){f("RETRY",t.name,r);t.apply(null,r.concat([s]))}else{n[a].push(e)}}if(h===undefined){h=setTimeout(retry,0)}}},876:(e,t,r)=>{var n=r(781).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 s=Object.keys(r);for(var o=0,c=s.length;o<c;o++){var a=s[o];this[a]=r[a]}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 s=0,o=i.length;s<o;s++){var c=i[s];this[c]=r[c]}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()}}}},738:(e,t,r)=>{var n=r(57);var i=process.cwd;var s=null;var o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!s)s=i.call(process);return s};try{process.cwd()}catch(e){}if(typeof process.chdir==="function"){var c=process.chdir;process.chdir=function(e){s=null;c.call(process,e)};if(Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,c)}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.chmod&&!e.lchmod){e.lchmod=function(e,t,r){if(r)process.nextTick(r)};e.lchmodSync=function(){}}if(e.chown&&!e.lchown){e.lchown=function(e,t,r,n){if(n)process.nextTick(n)};e.lchownSync=function(){}}if(o==="win32"){e.rename=typeof e.rename!=="function"?e.rename:function(t){function rename(r,n,i){var s=Date.now();var o=0;t(r,n,(function CB(c){if(c&&(c.code==="EACCES"||c.code==="EPERM")&&Date.now()-s<6e4){setTimeout((function(){e.stat(n,(function(e,s){if(e&&e.code==="ENOENT")t(r,n,CB);else i(c)}))}),o);if(o<100)o+=10;return}if(i)i(c)}))}if(Object.setPrototypeOf)Object.setPrototypeOf(rename,t);return rename}(e.rename)}e.read=typeof e.read!=="function"?e.read:function(t){function read(r,n,i,s,o,c){var a;if(c&&typeof c==="function"){var l=0;a=function(f,u,h){if(f&&f.code==="EAGAIN"&&l<10){l++;return t.call(e,r,n,i,s,o,a)}c.apply(this,arguments)}}return t.call(e,r,n,i,s,o,a)}if(Object.setPrototypeOf)Object.setPrototypeOf(read,t);return read}(e.read);e.readSync=typeof e.readSync!=="function"?e.readSync:function(t){return function(r,n,i,s,o){var c=0;while(true){try{return t.call(e,r,n,i,s,o)}catch(e){if(e.code==="EAGAIN"&&c<10){c++;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 s=true;var o;try{o=e.fchmodSync(i,r);s=false}finally{if(s){try{e.closeSync(i)}catch(e){}}else{e.closeSync(i)}}return o}}function patchLutimes(e){if(n.hasOwnProperty("O_SYMLINK")&&e.futimes){e.lutimes=function(t,r,i,s){e.open(t,n.O_SYMLINK,(function(t,n){if(t){if(s)s(t);return}e.futimes(n,r,i,(function(t){e.close(n,(function(e){if(s)s(t||e)}))}))}))};e.lutimesSync=function(t,r,i){var s=e.openSync(t,n.O_SYMLINK);var o;var c=true;try{o=e.futimesSync(s,r,i);c=false}finally{if(c){try{e.closeSync(s)}catch(e){}}else{e.closeSync(s)}}return o}}else if(e.futimes){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,s){return t.call(e,r,n,i,(function(e){if(chownErOk(e))e=null;if(s)s.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){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}}},589:e=>{"use strict";e.exports=function isArrayish(e){if(!e){return false}return e instanceof Array||Array.isArray(e)||e.length>=0&&e.splice instanceof Function}},9:e=>{"use strict";e.exports=parseJson;function parseJson(e,t,r){r=r||20;try{return JSON.parse(e,t)}catch(t){if(typeof e!=="string"){const t=Array.isArray(e)&&e.length===0;const r="Cannot parse "+(t?"an empty array":String(e));throw new TypeError(r)}const n=t.message.match(/^Unexpected token.*position\s+(\d+)/i);const i=n?+n[1]:t.message.match(/^Unexpected end of JSON.*/i)?e.length-1:null;if(i!=null){const n=i<=r?0:i-r;const s=i+r>=e.length?e.length:i+r;t.message+=` while parsing near '${n===0?"":"..."}${e.slice(n,s)}${s===e.length?"":"..."}'`}else{t.message+=` while parsing '${e.slice(0,r*2)}'`}throw t}}},324:(e,t,r)=>{"use strict";const n=r(17);const i=r(127);const s=r(308);const o=r(264);const c=r(119);const parse=(e,t)=>o(s(e),n.relative(".",t));e.exports=e=>c(i.readFile)(e,"utf8").then((t=>parse(t,e)));e.exports.sync=e=>parse(i.readFileSync(e,"utf8"),e)},69:(e,t,r)=>{"use strict";const n=r(17);const i=r(383);const s=r(367);e.exports=(e,t)=>{t=Object.assign({cwd:process.cwd()},t);return s(e,(e=>i(n.resolve(t.cwd,e))),t)};e.exports.sync=(e,t)=>{t=Object.assign({cwd:process.cwd()},t);for(const r of e){if(i.sync(n.resolve(t.cwd,r))){return r}}}},273:(e,t,r)=>{"use strict";const n=r(965);e.exports=e=>{if(e<1){throw new TypeError("Expected `concurrency` to be a number from 1 and up")}const t=[];let r=0;const next=()=>{r--;if(t.length>0){t.shift()()}};return i=>new Promise(((s,o)=>{const run=()=>{r++;n(i).then((e=>{s(e);next()}),(e=>{o(e);next()}))};if(r<e){run()}else{t.push(run)}}))}},367:(e,t,r)=>{"use strict";const n=r(273);class EndError extends Error{constructor(e){super();this.value=e}}const finder=e=>Promise.all(e).then((e=>e[1]===true&&Promise.reject(new EndError(e[0]))));e.exports=(e,t,r)=>{r=Object.assign({concurrency:Infinity,preserveOrder:true},r);const i=n(r.concurrency);const s=Array.from(e).map((e=>[e,i((()=>Promise.resolve(e).then(t)))]));const o=n(r.preserveOrder?1:Infinity);return Promise.all(s.map((e=>o((()=>finder(e)))))).then((()=>{})).catch((e=>e instanceof EndError?e.value:Promise.reject(e)))}},965:e=>{"use strict";e.exports=e=>new Promise((t=>{t(e())}))},264:(e,t,r)=>{"use strict";const n=r(305);const i=r(9);const s=n("JSONError",{fileName:n.append("in %s")});e.exports=(e,t,r)=>{if(typeof t==="string"){r=t;t=null}try{try{return JSON.parse(e,t)}catch(r){i(e,t);throw r}}catch(e){e.message=e.message.replace(/\n/g,"");const t=new s(e);if(r){t.fileName=r}throw t}}},383:(e,t,r)=>{"use strict";const n=r(147);e.exports=e=>new Promise((t=>{n.access(e,(e=>{t(!e)}))}));e.exports.sync=e=>{try{n.accessSync(e);return true}catch(e){return false}}},119:e=>{"use strict";const processFn=(e,t)=>function(){const r=t.promiseModule;const n=new Array(arguments.length);for(let e=0;e<arguments.length;e++){n[e]=arguments[e]}return new r(((r,i)=>{if(t.errorFirst){n.push((function(e,n){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e<arguments.length;e++){t[e-1]=arguments[e]}if(e){t.unshift(e);i(t)}else{r(t)}}else if(e){i(e)}else{r(n)}}))}else{n.push((function(e){if(t.multiArgs){const e=new Array(arguments.length-1);for(let t=0;t<arguments.length;t++){e[t]=arguments[t]}r(e)}else{r(e)}}))}e.apply(this,n)}))};e.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:true,promiseModule:Promise},t);const filter=e=>{const match=t=>typeof t==="string"?e===t:t.test(e);return t.include?t.include.some(match):!t.exclude.some(match)};let r;if(typeof e==="function"){r=function(){if(t.excludeMain){return e.apply(this,arguments)}return processFn(e,t).apply(this,arguments)}}else{r=Object.create(Object.getPrototypeOf(e))}for(const n in e){const i=e[n];r[n]=typeof i==="function"&&filter(n)?processFn(i,t):i}return r}},817:(e,t,r)=>{"use strict";const n=r(17);const i=r(834);const s=r(324);const o=new WeakMap;const filepath=e=>o.get(e);const findNextCwd=e=>n.resolve(n.dirname(e),"..");const addFp=(e,t)=>{o.set(e,t);return e};const pkgConf=(e,t)=>{if(!e){return Promise.reject(new TypeError("Expected a namespace"))}t=t||{};return i("package.json",t.cwd?{cwd:t.cwd}:{}).then((r=>{if(!r){return addFp(Object.assign({},t.defaults),r)}return s(r).then((n=>{if(t.skipOnFalse&&n[e]===false){const n=Object.assign({},t,{cwd:findNextCwd(r)});return pkgConf(e,n)}return addFp(Object.assign({},t.defaults,n[e]),r)}))}))};const sync=(e,t)=>{if(!e){throw new TypeError("Expected a namespace")}t=t||{};const r=i.sync("package.json",t.cwd?{cwd:t.cwd}:{});if(!r){return addFp(Object.assign({},t.defaults),r)}const n=s.sync(r);if(t.skipOnFalse&&n[e]===false){const n=Object.assign({},t,{cwd:findNextCwd(r)});return sync(e,n)}return addFp(Object.assign({},t.defaults,n[e]),r)};e.exports=pkgConf;e.exports.filepath=filepath;e.exports.sync=sync},567:(e,t,r)=>{"use strict";const n=r(852);e.exports=Object.assign(new n,{Signale:n})},852:(e,t,r)=>{"use strict";const n=r(837);const i=r(17);const s=r(521);const o=r(234);const c=r(877);const a=r(817);const l=r(684);const f=r(616);const{green:u,grey:h,red:p,underline:d,yellow:g}=o;let m=false;const y=l.options.default;const b=l.name;class Signale{constructor(e={}){this._interactive=e.interactive||false;this._config=Object.assign(this.packageConfiguration,e.config);this._customTypes=Object.assign({},e.types);this._disabled=e.disabled||false;this._scopeName=e.scope||"";this._timers=e.timers||new Map;this._types=this._mergeTypes(f,this._customTypes);this._stream=e.stream||process.stdout;this._longestLabel=this._getLongestLabel();this._secrets=e.secrets||[];this._generalLogLevel=this._validateLogLevel(e.logLevel);Object.keys(this._types).forEach((e=>{this[e]=this._logger.bind(this,e)}))}get _now(){return Date.now()}get scopeName(){return this._scopeName}get currentOptions(){return Object.assign({},{config:this._config,disabled:this._disabled,types:this._customTypes,interactive:this._interactive,timers:this._timers,stream:this._stream,secrets:this._secrets,logLevel:this._generalLogLevel})}get date(){return(new Date).toLocaleDateString()}get timestamp(){return(new Date).toLocaleTimeString()}get filename(){const e=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const{stack:t}=new Error;Error.prepareStackTrace=e;const r=t.map((e=>e.getFileName()));const n=r.find((e=>e!==r[0]));return n?i.basename(n):"anonymous"}get packageConfiguration(){return a.sync(b,{defaults:y})}get _longestUnderlinedLabel(){return d(this._longestLabel)}get _logLevels(){return{info:0,timer:1,debug:2,warn:3,error:4}}set configuration(e){this._config=Object.assign(this.packageConfiguration,e)}_arrayify(e){return Array.isArray(e)?e:[e]}_timeSpan(e){return this._now-e}_getLongestLabel(){const{_types:e}=this;const t=Object.keys(e).map((t=>e[t].label));return t.reduce(((e,t)=>e.length>t.length?e:t))}_validateLogLevel(e){return Object.keys(this._logLevels).includes(e)?e:"info"}_mergeTypes(e,t){const r=Object.assign({},e);Object.keys(t).forEach((e=>{r[e]=Object.assign({},r[e],t[e])}));return r}_filterSecrets(e){const{_secrets:t}=this;if(t.length===0){return e}let r=e;t.forEach((e=>{r=r.replace(new RegExp(e,"g"),"[secure]")}));return r}_formatStream(e){return this._arrayify(e)}_formatDate(){return`[${this.date}]`}_formatFilename(){return`[${this.filename}]`}_formatScopeName(){if(Array.isArray(this._scopeName)){const e=this._scopeName.filter((e=>e.length!==0));return`${e.map((e=>`[${e.trim()}]`)).join(" ")}`}return`[${this._scopeName}]`}_formatTimestamp(){return`[${this.timestamp}]`}_formatMessage(e){return n.format(...this._arrayify(e))}_meta(){const e=[];if(this._config.displayDate){e.push(this._formatDate())}if(this._config.displayTimestamp){e.push(this._formatTimestamp())}if(this._config.displayFilename){e.push(this._formatFilename())}if(this._scopeName.length!==0&&this._config.displayScope){e.push(this._formatScopeName())}if(e.length!==0){e.push(`${c.pointerSmall}`);return e.map((e=>h(e)))}return e}_hasAdditional({suffix:e,prefix:t},r){return e||t?"":this._formatMessage(r)}_buildSignale(e,...t){let[r,n]=[{},{}];if(t.length===1&&typeof t[0]==="object"&&t[0]!==null){if(t[0]instanceof Error){[r]=t}else{const[{prefix:e,message:i,suffix:s}]=t;n=Object.assign({},{suffix:s,prefix:e});r=i?this._formatMessage(i):this._hasAdditional(n,t)}}else{r=this._formatMessage(t)}const i=this._meta();if(n.prefix){if(this._config.underlinePrefix){i.push(d(n.prefix))}else{i.push(n.prefix)}}if(this._config.displayBadge&&e.badge){i.push(o[e.color](this._padEnd(e.badge,e.badge.length+1)))}if(this._config.displayLabel&&e.label){const t=this._config.uppercaseLabel?e.label.toUpperCase():e.label;if(this._config.underlineLabel){i.push(o[e.color](this._padEnd(d(t),this._longestUnderlinedLabel.length+1)))}else{i.push(o[e.color](this._padEnd(t,this._longestLabel.length+1)))}}if(r instanceof Error&&r.stack){const[e,...t]=r.stack.split("\n");if(this._config.underlineMessage){i.push(d(e))}else{i.push(e)}i.push(h(t.map((e=>e.replace(/^/,"\n"))).join("")));return i.join(" ")}if(this._config.underlineMessage){i.push(d(r))}else{i.push(r)}if(n.suffix){if(this._config.underlineSuffix){i.push(d(n.suffix))}else{i.push(n.suffix)}}return i.join(" ")}_write(e,t){if(this._interactive&&e.isTTY&&m){s.moveCursor(e,0,-1);s.clearLine(e);s.cursorTo(e,0)}e.write(t+"\n");m=this._interactive}_log(e,t=this._stream,r){if(this.isEnabled()&&this._logLevels[r]>=this._logLevels[this._generalLogLevel]){this._formatStream(t).forEach((t=>{this._write(t,e)}))}}_logger(e,...t){const{stream:r,logLevel:n}=this._types[e];const i=this._buildSignale(this._types[e],...t);this._log(this._filterSecrets(i),r,this._validateLogLevel(n))}_padEnd(e,t){e=String(e);t=parseInt(t,10)||0;if(e.length>=t){return e}if(String.prototype.padEnd){return e.padEnd(t)}t-=e.length;return e+" ".repeat(t)}addSecrets(e){if(!Array.isArray(e)){throw new TypeError("Argument must be an array.")}this._secrets.push(...e)}clearSecrets(){this._secrets=[]}config(e){this.configuration=e}disable(){this._disabled=true}enable(){this._disabled=false}isEnabled(){return!this._disabled}scope(...e){if(e.length===0){throw new Error("No scope name was defined.")}return new Signale(Object.assign(this.currentOptions,{scope:e}))}unscope(){this._scopeName=""}time(e){if(!e){e=`timer_${this._timers.size}`}this._timers.set(e,this._now);const t=this._meta();t.push(u(this._padEnd(this._types.start.badge,2)));if(this._config.underlineLabel){t.push(u(this._padEnd(d(e),this._longestUnderlinedLabel.length+1)))}else{t.push(u(this._padEnd(e,this._longestLabel.length+1)))}t.push("Initialized timer...");this._log(t.join(" "),this._stream,"timer");return e}timeEnd(e){if(!e&&this._timers.size){const is=e=>e.includes("timer_");e=[...this._timers.keys()].reduceRight(((e,t)=>is(e)?e:is(t)?t:null))}if(this._timers.has(e)){const t=this._timeSpan(this._timers.get(e));this._timers.delete(e);const r=this._meta();r.push(p(this._padEnd(this._types.pause.badge,2)));if(this._config.underlineLabel){r.push(p(this._padEnd(d(e),this._longestUnderlinedLabel.length+1)))}else{r.push(p(this._padEnd(e,this._longestLabel.length+1)))}r.push("Timer run for:");r.push(g(t<1e3?t+"ms":(t/1e3).toFixed(2)+"s"));this._log(r.join(" "),this._stream,"timer");return{label:e,span:t}}}}e.exports=Signale},616:(e,t,r)=>{"use strict";const n=r(877);e.exports={error:{badge:n.cross,color:"red",label:"error",logLevel:"error"},fatal:{badge:n.cross,color:"red",label:"fatal",logLevel:"error"},fav:{badge:n("❤"),color:"magenta",label:"favorite",logLevel:"info"},info:{badge:n.info,color:"blue",label:"info",logLevel:"info"},star:{badge:n.star,color:"yellow",label:"star",logLevel:"info"},success:{badge:n.tick,color:"green",label:"success",logLevel:"info"},wait:{badge:n.ellipsis,color:"blue",label:"waiting",logLevel:"info"},warn:{badge:n.warning,color:"yellow",label:"warning",logLevel:"warn"},complete:{badge:n.checkboxOn,color:"cyan",label:"complete",logLevel:"info"},pending:{badge:n.checkboxOff,color:"magenta",label:"pending",logLevel:"info"},note:{badge:n.bullet,color:"blue",label:"note",logLevel:"info"},start:{badge:n.play,color:"green",label:"start",logLevel:"info"},pause:{badge:n.squareSmallFilled,color:"yellow",label:"pause",logLevel:"info"},debug:{badge:n("⬤"),color:"red",label:"debug",logLevel:"debug"},await:{badge:n.ellipsis,color:"blue",label:"awaiting",logLevel:"info"},watch:{badge:n.ellipsis,color:"yellow",label:"watching",logLevel:"info"},log:{badge:"",color:"",label:"",logLevel:"info"}}},308:e=>{"use strict";e.exports=e=>{if(typeof e!=="string"){throw new TypeError("Expected a string, got "+typeof e)}if(e.charCodeAt(0)===65279){return e.slice(1)}return e}},234:e=>{"use strict";e.exports=require("../chalk")},684:e=>{"use strict";e.exports=require("./package.json")},491:e=>{"use strict";e.exports=require("assert")},57:e=>{"use strict";e.exports=require("constants")},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")},521:e=>{"use strict";e.exports=require("readline")},781:e=>{"use strict";e.exports=require("stream")},837: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 s=true;try{e[r](i,i.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(567);module.exports=r})();