create-expo-module
Version:
The script to create the Expo module
2 lines • 1.09 MB
JavaScript
#!/usr/bin/env node
(()=>{var t={3073:(t,a,i)=>{var r="3.0.2";var o=0;var p=function xxx(t){var a=["XX"+"X: "+t].concat(Array.prototype.slice.call(arguments,1));console.error.apply(this,a)};var p=function xxx(){};var d;if(typeof process!=="undefined"&&process.versions){if(process.versions.nw){d="nw"}else if(process.versions.node){d="node"}}if(!d&&typeof window!=="undefined"&&window.window===window){d="browser"}if(!d){throw new Error("unknown runtime environment")}var l,u,m;if(d==="browser"){l={hostname:function(){return window.location.host}};u={};m=null}else{l=i(857);u=i(9896);m=null}var h=i(9023);var g=i(2613);var v=i(4434).EventEmitter;var w=i(2203);var b=i(1165);try{var y=i(5246)}catch(t){y=null}function objCopy(t){if(t==null){return t}else if(Array.isArray(t)){return t.slice()}else if(typeof t==="object"){var a={};Object.keys(t).forEach((function(i){a[i]=t[i]}));return a}else{return t}}var _=h.format;var D=h.inspect;function getCaller3Info(){if(this===undefined){return}var t={};var a=Error.stackTraceLimit;var i=Error.prepareStackTrace;Error.stackTraceLimit=3;Error.prepareStackTrace=function(a,i){var r=i[2];if(y){r=y.wrapCallSite(r)}t.file=r.getFileName();t.line=r.getLineNumber();var o=r.getFunctionName();if(o)t.func=o};Error.captureStackTrace(this,getCaller3Info);this.stack;Error.stackTraceLimit=a;Error.prepareStackTrace=i;return t}function _indent(t,a){if(!a)a=" ";var i=t.split(/\r?\n/g);return a+i.join("\n"+a)}function _warn(t,a){g.ok(t);if(a){if(S[a]){return}S[a]=true}process.stderr.write(t+"\n")}function _haveWarned(t){return S[t]}var S={};function ConsoleRawStream(){}ConsoleRawStream.prototype.write=function(t){if(t.level<A){console.log(t)}else if(t.level<x){console.info(t)}else if(t.level<T){console.warn(t)}else{console.error(t)}};var C=10;var E=20;var A=30;var x=40;var T=50;var N=60;var O={trace:C,debug:E,info:A,warn:x,error:T,fatal:N};var B={};Object.keys(O).forEach((function(t){B[O[t]]=t}));var M=undefined;var k=m&&{};function resolveLevel(t){var a;var i=typeof t;if(i==="string"){a=O[t.toLowerCase()];if(!a){throw new Error(_('unknown level name: "%s"',t))}}else if(i!=="number"){throw new TypeError(_("cannot resolve level: invalid arg (%s):",i,t))}else if(t<0||Math.floor(t)!==t){throw new TypeError(_("level is not a positive integer: %s",t))}else{a=t}return a}function isWritable(t){if(t instanceof w.Writable){return true}return typeof t.write==="function"}function Logger(t,a,i){p("Logger start:",t);if(!(this instanceof Logger)){return new Logger(t,a)}var r;if(a!==undefined){r=t;t=a;if(!(r instanceof Logger)){throw new TypeError("invalid Logger creation: do not pass a second arg")}}if(!t){throw new TypeError("options (object) is required")}if(!r){if(!t.name){throw new TypeError("options.name (string) is required")}}else{if(t.name){throw new TypeError("invalid options.name: child cannot set logger name")}}if(t.stream&&t.streams){throw new TypeError('cannot mix "streams" and "stream" options')}if(t.streams&&!Array.isArray(t.streams)){throw new TypeError("invalid options.streams: must be an array")}if(t.serializers&&(typeof t.serializers!=="object"||Array.isArray(t.serializers))){throw new TypeError("invalid options.serializers: must be an object")}v.call(this);if(r&&i){this._isSimpleChild=true;this._level=r._level;this.streams=r.streams;this.serializers=r.serializers;this.src=r.src;var o=this.fields={};var u=Object.keys(r.fields);for(var h=0;h<u.length;h++){var g=u[h];o[g]=r.fields[g]}var w=Object.keys(t);for(var h=0;h<w.length;h++){var g=w[h];o[g]=t[g]}return}var b=this;if(r){this._level=r._level;this.streams=[];for(var h=0;h<r.streams.length;h++){var y=objCopy(r.streams[h]);y.closeOnExit=false;this.streams.push(y)}this.serializers=objCopy(r.serializers);this.src=r.src;this.fields=objCopy(r.fields);if(t.level){this.level(t.level)}}else{this._level=Number.POSITIVE_INFINITY;this.streams=[];this.serializers=null;this.src=false;this.fields={}}if(!M&&m){M=m.createDTraceProvider("bunyan");for(var _ in O){var D;k[O[_]]=D=M.addProbe("log-"+_,"char *");D.dtp=M}M.enable()}if(t.stream){b.addStream({type:"stream",stream:t.stream,closeOnExit:false,level:t.level})}else if(t.streams){t.streams.forEach((function(a){b.addStream(a,t.level)}))}else if(r&&t.level){this.level(t.level)}else if(!r){if(d==="browser"){b.addStream({type:"raw",stream:new ConsoleRawStream,closeOnExit:false,level:t.level})}else{b.addStream({type:"stream",stream:process.stdout,closeOnExit:false,level:t.level})}}if(t.serializers){b.addSerializers(t.serializers)}if(t.src){this.src=true}p("Logger: ",b);var o=objCopy(t);delete o.stream;delete o.level;delete o.streams;delete o.serializers;delete o.src;if(this.serializers){this._applySerializers(o)}if(!o.hostname&&!b.fields.hostname){o.hostname=l.hostname()}if(!o.pid){o.pid=process.pid}Object.keys(o).forEach((function(t){b.fields[t]=o[t]}))}h.inherits(Logger,v);Logger.prototype.addStream=function addStream(t,a){var i=this;if(a===null||a===undefined){a=A}t=objCopy(t);if(!t.type){if(t.stream){t.type="stream"}else if(t.path){t.type="file"}}t.raw=t.type==="raw";if(t.level!==undefined){t.level=resolveLevel(t.level)}else{t.level=resolveLevel(a)}if(t.level<i._level){i._level=t.level}switch(t.type){case"stream":g.ok(isWritable(t.stream),'"stream" stream is not writable: '+h.inspect(t.stream));if(!t.closeOnExit){t.closeOnExit=false}break;case"file":if(t.reemitErrorEvents===undefined){t.reemitErrorEvents=true}if(!t.stream){t.stream=u.createWriteStream(t.path,{flags:"a",encoding:"utf8"});if(!t.closeOnExit){t.closeOnExit=true}}else{if(!t.closeOnExit){t.closeOnExit=false}}break;case"raw":if(!t.closeOnExit){t.closeOnExit=false}break;default:throw new TypeError('unknown stream type "'+t.type+'"')}if(t.reemitErrorEvents&&typeof t.stream.on==="function"){t.stream.on("error",(function onStreamError(a){i.emit("error",a,t)}))}i.streams.push(t);delete i.haveNonRawStreams};Logger.prototype.addSerializers=function addSerializers(t){var a=this;if(!a.serializers){a.serializers={}}Object.keys(t).forEach((function(i){var r=t[i];if(typeof r!=="function"){throw new TypeError(_('invalid serializer for "%s" field: must be a function',i))}else{a.serializers[i]=r}}))};Logger.prototype.child=function(t,a){return new this.constructor(this,t||{},a)};Logger.prototype.reopenFileStreams=function(){var t=this;t.streams.forEach((function(a){if(a.type==="file"){if(a.stream){a.stream.end();a.stream.destroySoon();delete a.stream}a.stream=u.createWriteStream(a.path,{flags:"a",encoding:"utf8"});a.stream.on("error",(function(i){t.emit("error",i,a)}))}}))};Logger.prototype.level=function level(t){if(t===undefined){return this._level}var a=resolveLevel(t);var i=this.streams.length;for(var r=0;r<i;r++){this.streams[r].level=a}this._level=a};Logger.prototype.levels=function levels(t,a){if(t===undefined){g.equal(a,undefined);return this.streams.map((function(t){return t.level}))}var i;if(typeof t==="number"){i=this.streams[t];if(i===undefined){throw new Error("invalid stream index: "+t)}}else{var r=this.streams.length;for(var o=0;o<r;o++){var p=this.streams[o];if(p.name===t){i=p;break}}if(!i){throw new Error(_('no stream with name "%s"',t))}}if(a===undefined){return i.level}else{var d=resolveLevel(a);i.level=d;if(d<this._level){this._level=d}}};Logger.prototype._applySerializers=function(t,a){var i=this;p("_applySerializers: excludeFields",a);Object.keys(this.serializers).forEach((function(r){if(t[r]===undefined||a&&a[r]){return}p('_applySerializers; apply to "%s" key',r);try{t[r]=i.serializers[r](t[r])}catch(a){_warn(_('bunyan: ERROR: Exception thrown from the "%s" '+"Bunyan serializer. This should never happen. This is a bug "+"in that serializer function.\n%s",r,a.stack||a));t[r]=_('(Error in Bunyan log "%s" serializer '+"broke field. See stderr for details.)",r)}}))};Logger.prototype._emit=function(t,a){var i;if(this.haveNonRawStreams===undefined){this.haveNonRawStreams=false;for(i=0;i<this.streams.length;i++){if(!this.streams[i].raw){this.haveNonRawStreams=true;break}}}var r;if(a||this.haveNonRawStreams){r=fastAndSafeJsonStringify(t)+"\n"}if(a)return r;var o=t.level;for(i=0;i<this.streams.length;i++){var d=this.streams[i];if(d.level<=o){p('writing log rec "%s" to "%s" stream (%d <= %d): %j',t.msg,d.type,d.level,o,t);d.stream.write(d.raw?t:r)}}return r};function mkRecord(t,a,i){var r,p,d;if(i[0]instanceof Error){p={err:t.serializers&&t.serializers.err?t.serializers.err(i[0]):Logger.stdSerializers.err(i[0])};r={err:true};if(i.length===1){d=[p.err.message]}else{d=i.slice(1)}}else if(typeof i[0]!=="object"||Array.isArray(i[0])){p=null;d=i.slice()}else if(Buffer.isBuffer(i[0])){p=null;d=i.slice();d[0]=h.inspect(d[0])}else{p=i[0];if(p&&i.length===1&&p.err&&p.err instanceof Error){d=[p.err.message]}else{d=i.slice(1)}}var l=objCopy(t.fields);var u=l.level=a;var m=p?objCopy(p):null;if(m){if(t.serializers){t._applySerializers(m,r)}Object.keys(m).forEach((function(t){l[t]=m[t]}))}l.msg=_.apply(t,d);if(!l.time){l.time=new Date}if(!l.id){l.id=b.v1()}if(t.src&&!l.src){l.src=getCaller3Info()}l.v=o;return l}function mkProbeArgs(t,a,i,r){return[t||a._emit(mkRecord(a,i,r),true)]}function mkLogEmitter(t){return function(){var a=this;var i=null;var r=null;if(!this._emit){var o="unbound";if(!_haveWarned[o]){var p=getCaller3Info();_warn(_("bunyan usage error: %s:%s: attempt to log "+"with an unbound log method: `this` is: %s",p.file,p.line,h.inspect(this)),o)}return}else if(arguments.length===0){return this._level<=t}var d=new Array(arguments.length);for(var l=0;l<d.length;++l){d[l]=arguments[l]}if(this._level<=t){r=mkRecord(a,t,d);i=this._emit(r)}if(k){k[t].fire(mkProbeArgs,i,a,t,d)}}}Logger.prototype.trace=mkLogEmitter(C);Logger.prototype.debug=mkLogEmitter(E);Logger.prototype.info=mkLogEmitter(A);Logger.prototype.warn=mkLogEmitter(x);Logger.prototype.error=mkLogEmitter(T);Logger.prototype.fatal=mkLogEmitter(N);Logger.stdSerializers={};Logger.stdSerializers.req=function(t){if(!t||!t.connection)return t;return{method:t.method,url:t.url,headers:t.headers,remoteAddress:t.connection.remoteAddress,remotePort:t.connection.remotePort}};Logger.stdSerializers.res=function(t){if(!t||!t.statusCode)return t;return{statusCode:t.statusCode,header:t._header}};function getFullErrorStack(t){var a=t.stack||t.toString();if(t.cause&&typeof t.cause==="function"){var i=t.cause();if(i){a+="\nCaused by: "+getFullErrorStack(i)}}return a}var P=Logger.stdSerializers.err=function(t){if(!t||!t.stack)return t;var a={message:t.message,name:t.name,stack:getFullErrorStack(t),code:t.code,signal:t.signal};return a};function safeCyclesSet(){var t=new Set;return function(a,i){if(!i||typeof i!=="object"){return i}if(t.has(i)){return"[Circular]"}t.add(i);return i}}function safeCyclesArray(){var t=[];return function(a,i){if(!i||typeof i!=="object"){return i}if(t.indexOf(i)!==-1){return"[Circular]"}t.push(i);return i}}var I=typeof Set!=="undefined"?safeCyclesSet:safeCyclesArray;function fastAndSafeJsonStringify(t){try{return JSON.stringify(t)}catch(a){try{return JSON.stringify(t,I())}catch(a){return D(t)}}}function RingBuffer(t){this.limit=t&&t.limit?t.limit:100;this.writable=true;this.records=[];v.call(this)}h.inherits(RingBuffer,v);RingBuffer.prototype.write=function(t){if(!this.writable)throw new Error("RingBuffer has been ended already");this.records.push(t);if(this.records.length>this.limit)this.records.shift();return true};RingBuffer.prototype.end=function(){if(arguments.length>0)this.write.apply(this,Array.prototype.slice.call(arguments));this.writable=false};RingBuffer.prototype.destroy=function(){this.writable=false;this.emit("close")};RingBuffer.prototype.destroySoon=function(){this.destroy()};t.exports=Logger;t.exports.TRACE=C;t.exports.DEBUG=E;t.exports.INFO=A;t.exports.WARN=x;t.exports.ERROR=T;t.exports.FATAL=N;t.exports.resolveLevel=resolveLevel;t.exports.levelFromName=O;t.exports.nameFromLevel=B;t.exports.VERSION=r;t.exports.LOG_VERSION=o;t.exports.createLogger=function createLogger(t){return new Logger(t)};t.exports.RingBuffer=RingBuffer;t.exports.safeCycles=I},5187:function(t,a,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(a,"__esModule",{value:true});const o=r(i(3073));const p=r(i(6927));const d=r(i(2613));const l=r(i(7457));const u=r(i(6506));const m=r(i(2417));const h=r(i(7417));const g=i(1165);const v=i(8237).rE;const w=(0,l.default)(m.default);const b=global.setImmediate||process.nextTick.bind(process);class Analytics{constructor(t,a,{enable:i=true,timeout:r=0,flushAt:p=20,flushInterval:l=2e4,maxFlushSizeInBytes:u=1024*1e3*3.9,maxQueueLength:m=1e3,logLevel:g=o.default.FATAL}={}){this.inFlightFlush=null;this.queue=[];this.flushCallbacks=[];this.flushResponses=[];this.finalMessageId=null;this.flushed=false;this.timer=null;this.enable=i;(0,d.default)(t,`The project's write key must be specified`);(0,d.default)(a,`The data plane URL must be specified`);this.writeKey=t;this.host=(0,h.default)(a);this.timeout=r;this.flushAt=Math.max(p,1);this.flushInterval=l;this.maxFlushSizeInBytes=u;this.maxQueueLength=m;this.logger=o.default.createLogger({name:"@expo/rudder-node-sdk",level:g})}identify(t,a){this.validate(t,"identify");this.enqueue("identify",t,a);return this}group(t,a){this.validate(t,"group");this.enqueue("group",t,a);return this}track(t,a){this.validate(t,"track");this.enqueue("track",t,a);return this}page(t,a){this.validate(t,"page");this.enqueue("page",t,a);return this}screen(t,a){this.validate(t,"screen");this.enqueue("screen",t,a);return this}alias(t,a){this.validate(t,"alias");this.enqueue("alias",t,a);return this}validate(t,a){try{(0,p.default)(t,a)}catch(a){if(a.message==="Your message must be < 32kb."){this.logger.warn("Your message must be < 32KiB. This is currently surfaced as a warning. Please update your code.",t);return}throw a}}enqueue(t,a,i=()=>{}){var r,o;if(!this.enable){b(i);return}if(this.queue.length>=this.maxQueueLength){this.logger.error(`Not adding events for processing as queue size ${this.queue.length} exceeds max configuration ${this.maxQueueLength}`);b(i);return}if(t==="identify"){(r=a.traits)!==null&&r!==void 0?r:a.traits={};(o=a.context)!==null&&o!==void 0?o:a.context={};a.context.traits=a.traits}a={...a};a.type=t;a.context={library:{name:"@expo/rudder-sdk-node",version:v},...a.context};a._metadata={nodeVersion:process.versions.node,...a._metadata};if(!a.originalTimestamp){a.originalTimestamp=new Date}if(!a.messageId){a.messageId=`node-${(0,u.default)(JSON.stringify(a))}-${(0,g.v4)()}`}this.queue.push({message:a,callback:i});if(!this.flushed){this.flushed=true;this.flush();return}const p=this.queue.length%this.flushAt===0;if(p){this.logger.debug(`flushAt reached, messageQueueLength is ${this.queue.length}, trying flush...`);this.flush()}else if(this.flushInterval&&!this.timer){this.logger.debug("no existing flush timer, creating new one");this.timer=setTimeout(this.flush.bind(this),this.flushInterval)}}async flush(t=()=>{}){this.logger.debug("in flush");this.finalMessageId=this.queue.length?this.queue[this.queue.length-1].message.messageId:null;this.logger.trace("finalMessageId: "+this.finalMessageId);this.flushCallbacks.push(t);if(this.inFlightFlush){this.logger.debug("skipping flush, there is an in flight flush");return await this.inFlightFlush}this.inFlightFlush=this.executeFlush();const a=await this.inFlightFlush;this.logger.debug("resetting client flush state");this.inFlightFlush=null;this.finalMessageId=null;this.logger.trace("===flushResponse===",a);return a}async executeFlush(t=[]){var a;this.logger.debug("in execute flush");if(!this.enable){this.logger.debug("client not enabled, skipping flush");this.flushResponses.splice(0,this.flushResponses.length);const t=this.nullFlushResponse();this.flushCallbacks.splice(0,this.flushCallbacks.length).map((a=>b(a,t)));return t}if(this.timer){this.logger.debug("cancelling existing timer...");clearTimeout(this.timer);this.timer=null}if(!this.queue.length){this.logger.debug("queue is empty, nothing to flush");this.flushResponses.splice(0,this.flushResponses.length);const t=this.nullFlushResponse();this.flushCallbacks.splice(0,this.flushCallbacks.length).map((a=>b(a,t)));return t}let i=0;let r=0;for(let t=0;t<this.queue.length;t++){const o=this.queue[t];const p=JSON.stringify(o).length;const d=i+p>this.maxFlushSizeInBytes;if(d){break}i+=p;r++;if(((a=o.message.messageId)!==null&&a!==void 0?a:null)===this.finalMessageId||!this.finalMessageId){break}}const o=this.queue.splice(0,r);const p=o.map((t=>t.callback));const d=o.map((t=>{if(typeof t.message=="object"){t.message.sentAt=new Date}return t.message}));const done=t=>{p.forEach((a=>{a(t)}));const a=this.flushResponses.slice(0,this.flushResponses.length);this.flushCallbacks.splice(0,this.flushCallbacks.length).map((t=>b(t,a)))};const l={batch:d,sentAt:new Date};this.logger.debug("batch size is "+o.length);this.logger.trace("===data===",l);const u={method:"POST",headers:{accept:"application/json, text/plain, */*","content-type":"application/json;charset=utf-8","user-agent":`expo-rudder-sdk-node/${v}`,authorization:"Basic "+Buffer.from(`${this.writeKey}:`).toString("base64")},body:JSON.stringify(l),timeout:this.timeout>0?this.timeout:undefined,retryDelay:this.getExponentialDelay.bind(this),retryOn:this.isErrorRetryable.bind(this)};let m=undefined;try{const t=await w(`${this.host}`,u);if(!t.ok){this.logger.error("request failed to send after 3 retries, dropping "+o.length+" events");m=new Error(t.statusText)}}catch(t){this.logger.error("request failed to send after 3 retries, dropping "+o.length+" events");m=t}this.flushResponses.push({error:m,data:l});const h=d[d.length-1].messageId===this.finalMessageId||!this.finalMessageId;if(h){if(m){done(m)}else{done()}return this.flushResponses.splice(0,this.flushResponses.length)}p.forEach((t=>{t(m)}));return await this.executeFlush(t.concat(o))}getExponentialDelay(t){const a=2**t*200;const i=a*.2*Math.random();return a+i}isErrorRetryable(t,a,i){if(t>2){return false}return!!a||i.status===429||i.status>=500&&i.status<=599}nullFlushResponse(){return[{data:{batch:[],sentAt:new Date}}]}}a["default"]=Analytics},3970:function(t,a,i){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const o=i(181);const p=r(i(670));const d=o.constants.MAX_STRING_LENGTH;function spawnAsync(t,a,i={}){const r=new Error;const l=r.stack?r.stack.replace(/^.*/," ..."):null;const{ignoreStdio:u,maxBuffer:m,...h}=i;const g=m!=null;const v=!!u;const w=Math.min(m!==null&&m!==void 0?m:d,o.constants.MAX_STRING_LENGTH);let b=(0,p.default)(t,a,h);let y=new Promise(((i,r)=>{var o,p;const d={buffer:[],maxExceeded:false};const u={buffer:[],maxExceeded:false};function makeHandler(t){let a=0;return i=>{t.buffer.push(i);a+=typeof i==="string"?Buffer.byteLength(i):i.byteLength;while(t.buffer.length>0&&a>w){t.maxExceeded=true;i=t.buffer[0];const r=typeof i==="string"?Buffer.byteLength(i):i.byteLength;if(a-r<w){const r=typeof i==="string"?Buffer.from(i):i;const o=a-w;t.buffer[0]=r.subarray(o);a-=o;break}else{t.buffer.shift();a-=r}}}}function attachResult(i,r,o,p,d){function makeMaxBufferError(){const i=a&&a.length>0?` ${a.join(" ")}`:"";const d=new Error(`${t}${i} exceeded maxBuffer of ${w} bytes`);d.code="ERR_CHILD_PROCESS_STDIO_MAXBUFFER";return attachResult(d,r,o,p,true)}let l;let u;const m={stdout:{enumerable:true,configurable:true,get(){if(!d&&o.maxExceeded){throw makeMaxBufferError()}else if(l===undefined){l=Buffer.concat(o.buffer.map((t=>typeof t==="string"?Buffer.from(t):t))).toString("utf8")}return l}},stderr:{enumerable:true,configurable:true,get(){if(!d&&p.maxExceeded){throw makeMaxBufferError()}else if(u===undefined){u=Buffer.concat(p.buffer.map((t=>typeof t==="string"?Buffer.from(t):t))).toString("utf8")}return u}},output:{enumerable:true,configurable:true,get:()=>[i.stdout,i.stderr]}};for(const t in r){m[t]={value:r[t],enumerable:true,writable:true,configurable:true}}Object.defineProperties(i,m);return i}if(!v){(o=b.stdout)===null||o===void 0?void 0:o.on("data",makeHandler(d));(p=b.stderr)===null||p===void 0?void 0:p.on("data",makeHandler(u))}const m=v||!b.stdout&&!b.stderr?"exit":"close";let completionListener=(o,p)=>{b.removeListener("error",errorListener);const m=a&&a.length>0?` ${a.join(" ")}`:"";let h=null;if(o!==0){h=p?new Error(`${t}${m} exited with signal: ${p}`):new Error(`${t}${m} exited with non-zero code: ${o}`)}const v={pid:b.pid,status:o,signal:p};if(h){if(h.stack&&l)h.stack+=`\n${l}`;r(attachResult(h,v,d,u,true))}else if(g&&(d.maxExceeded||u.maxExceeded)){const a=new Error(`${t}${m} exceeded maxBuffer of ${w} bytes`);a.code="ERR_CHILD_PROCESS_STDIO_MAXBUFFER";r(attachResult(a,v,d,u,true))}else{const t={};i(attachResult(t,v,d,u))}};let errorListener=t=>{b.removeListener(m,completionListener);const a={pid:b.pid,status:null,signal:null};r(attachResult(t,a,d,u))};b.once(m,completionListener);b.once("error",errorListener)}));y.child=b;return y}t.exports=spawnAsync},6927:(t,a,i)=>{var r=i(588);var o=i(9379);var p=i(2613);var d=32<<10;t.exports=looselyValidateEvent;function looselyValidateEvent(t,a){validateGenericEvent(t);a=a||t.type;p(a,"You must pass an event type.");switch(a){case"track":return validateTrackEvent(t);case"group":return validateGroupEvent(t);case"identify":return validateIdentifyEvent(t);case"page":return validatePageEvent(t);case"screen":return validateScreenEvent(t);case"alias":return validateAliasEvent(t);default:p(0,'Invalid event type: "'+a+'"')}}function validateTrackEvent(t){p(t.anonymousId||t.userId,'You must pass either an "anonymousId" or a "userId".');p(t.event,'You must pass an "event".')}function validateGroupEvent(t){p(t.anonymousId||t.userId,'You must pass either an "anonymousId" or a "userId".');p(t.groupId,'You must pass a "groupId".')}function validateIdentifyEvent(t){p(t.anonymousId||t.userId,'You must pass either an "anonymousId" or a "userId".')}function validatePageEvent(t){p(t.anonymousId||t.userId,'You must pass either an "anonymousId" or a "userId".')}function validateScreenEvent(t){p(t.anonymousId||t.userId,'You must pass either an "anonymousId" or a "userId".')}function validateAliasEvent(t){p(t.userId,'You must pass a "userId".');p(t.previousId,'You must pass a "previousId".')}var l={anonymousId:["string","number"],category:"string",context:"object",event:"string",groupId:["string","number"],integrations:"object",name:"string",previousId:["string","number"],timestamp:"date",userId:["string","number"],type:"string"};function validateGenericEvent(t){p(r(t)==="object","You must pass a message object.");var a=JSON.stringify(t);p(Buffer.byteLength(a,"utf8")<d,"Your message must be < 32kb.");for(var i in l){var u=t[i];if(!u)continue;var m=l[i];if(r(m)!=="array"){m=[m]}var h=m[0]==="object"?"an":"a";p(m.some((function(t){return r(u)===t})),'"'+i+'" must be '+h+" "+o(m,"or")+".")}}},2371:t=>{"use strict";t.exports=({onlyFirst:t=false}={})=>{const a=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(a,t?undefined:"g")}},1264:(t,a,i)=>{"use strict";t=i.nmd(t);const wrapAnsi16=(t,a)=>(...i)=>{const r=t(...i);return`[${r+a}m`};const wrapAnsi256=(t,a)=>(...i)=>{const r=t(...i);return`[${38+a};5;${r}m`};const wrapAnsi16m=(t,a)=>(...i)=>{const r=t(...i);return`[${38+a};2;${r[0]};${r[1]};${r[2]}m`};const ansi2ansi=t=>t;const rgb2rgb=(t,a,i)=>[t,a,i];const setLazyProperty=(t,a,i)=>{Object.defineProperty(t,a,{get:()=>{const r=i();Object.defineProperty(t,a,{value:r,enumerable:true,configurable:true});return r},enumerable:true,configurable:true})};let r;const makeDynamicStyles=(t,a,o,p)=>{if(r===undefined){r=i(9734)}const d=p?10:0;const l={};for(const[i,p]of Object.entries(r)){const r=i==="ansi16"?"ansi":i;if(i===a){l[r]=t(o,d)}else if(typeof p==="object"){l[r]=t(p[a],d)}}return l};function assembleStyles(){const t=new Map;const a={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};a.color.gray=a.color.blackBright;a.bgColor.bgGray=a.bgColor.bgBlackBright;a.color.grey=a.color.blackBright;a.bgColor.bgGrey=a.bgColor.bgBlackBright;for(const[i,r]of Object.entries(a)){for(const[i,o]of Object.entries(r)){a[i]={open:`[${o[0]}m`,close:`[${o[1]}m`};r[i]=a[i];t.set(o[0],o[1])}Object.defineProperty(a,i,{value:r,enumerable:false})}Object.defineProperty(a,"codes",{value:t,enumerable:false});a.color.close="[39m";a.bgColor.close="[49m";setLazyProperty(a.color,"ansi",(()=>makeDynamicStyles(wrapAnsi16,"ansi16",ansi2ansi,false)));setLazyProperty(a.color,"ansi256",(()=>makeDynamicStyles(wrapAnsi256,"ansi256",ansi2ansi,false)));setLazyProperty(a.color,"ansi16m",(()=>makeDynamicStyles(wrapAnsi16m,"rgb",rgb2rgb,false)));setLazyProperty(a.bgColor,"ansi",(()=>makeDynamicStyles(wrapAnsi16,"ansi16",ansi2ansi,true)));setLazyProperty(a.bgColor,"ansi256",(()=>makeDynamicStyles(wrapAnsi256,"ansi256",ansi2ansi,true)));setLazyProperty(a.bgColor,"ansi16m",(()=>makeDynamicStyles(wrapAnsi16m,"rgb",rgb2rgb,true)));return a}Object.defineProperty(t,"exports",{enumerable:true,get:assembleStyles})},760:(t,a,i)=>{"use strict";const{Buffer:r}=i(181);const o=Symbol.for("BufferList");function BufferList(t){if(!(this instanceof BufferList)){return new BufferList(t)}BufferList._init.call(this,t)}BufferList._init=function _init(t){Object.defineProperty(this,o,{value:true});this._bufs=[];this.length=0;if(t){this.append(t)}};BufferList.prototype._new=function _new(t){return new BufferList(t)};BufferList.prototype._offset=function _offset(t){if(t===0){return[0,0]}let a=0;for(let i=0;i<this._bufs.length;i++){const r=a+this._bufs[i].length;if(t<r||i===this._bufs.length-1){return[i,t-a]}a=r}};BufferList.prototype._reverseOffset=function(t){const a=t[0];let i=t[1];for(let t=0;t<a;t++){i+=this._bufs[t].length}return i};BufferList.prototype.get=function get(t){if(t>this.length||t<0){return undefined}const a=this._offset(t);return this._bufs[a[0]][a[1]]};BufferList.prototype.slice=function slice(t,a){if(typeof t==="number"&&t<0){t+=this.length}if(typeof a==="number"&&a<0){a+=this.length}return this.copy(null,0,t,a)};BufferList.prototype.copy=function copy(t,a,i,o){if(typeof i!=="number"||i<0){i=0}if(typeof o!=="number"||o>this.length){o=this.length}if(i>=this.length){return t||r.alloc(0)}if(o<=0){return t||r.alloc(0)}const copy=!!t;const p=this._offset(i);const d=o-i;let l=d;let u=copy&&a||0;let m=p[1];if(i===0&&o===this.length){if(!copy){return this._bufs.length===1?this._bufs[0]:r.concat(this._bufs,this.length)}for(let a=0;a<this._bufs.length;a++){this._bufs[a].copy(t,u);u+=this._bufs[a].length}return t}if(l<=this._bufs[p[0]].length-m){return copy?this._bufs[p[0]].copy(t,a,m,m+l):this._bufs[p[0]].slice(m,m+l)}if(!copy){t=r.allocUnsafe(d)}for(let a=p[0];a<this._bufs.length;a++){const i=this._bufs[a].length-m;if(l>i){this._bufs[a].copy(t,u,m);u+=i}else{this._bufs[a].copy(t,u,m,m+l);u+=i;break}l-=i;if(m){m=0}}if(t.length>u)return t.slice(0,u);return t};BufferList.prototype.shallowSlice=function shallowSlice(t,a){t=t||0;a=typeof a!=="number"?this.length:a;if(t<0){t+=this.length}if(a<0){a+=this.length}if(t===a){return this._new()}const i=this._offset(t);const r=this._offset(a);const o=this._bufs.slice(i[0],r[0]+1);if(r[1]===0){o.pop()}else{o[o.length-1]=o[o.length-1].slice(0,r[1])}if(i[1]!==0){o[0]=o[0].slice(i[1])}return this._new(o)};BufferList.prototype.toString=function toString(t,a,i){return this.slice(a,i).toString(t)};BufferList.prototype.consume=function consume(t){t=Math.trunc(t);if(Number.isNaN(t)||t<=0)return this;while(this._bufs.length){if(t>=this._bufs[0].length){t-=this._bufs[0].length;this.length-=this._bufs[0].length;this._bufs.shift()}else{this._bufs[0]=this._bufs[0].slice(t);this.length-=t;break}}return this};BufferList.prototype.duplicate=function duplicate(){const t=this._new();for(let a=0;a<this._bufs.length;a++){t.append(this._bufs[a])}return t};BufferList.prototype.append=function append(t){if(t==null){return this}if(t.buffer){this._appendBuffer(r.from(t.buffer,t.byteOffset,t.byteLength))}else if(Array.isArray(t)){for(let a=0;a<t.length;a++){this.append(t[a])}}else if(this._isBufferList(t)){for(let a=0;a<t._bufs.length;a++){this.append(t._bufs[a])}}else{if(typeof t==="number"){t=t.toString()}this._appendBuffer(r.from(t))}return this};BufferList.prototype._appendBuffer=function appendBuffer(t){this._bufs.push(t);this.length+=t.length};BufferList.prototype.indexOf=function(t,a,i){if(i===undefined&&typeof a==="string"){i=a;a=undefined}if(typeof t==="function"||Array.isArray(t)){throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.')}else if(typeof t==="number"){t=r.from([t])}else if(typeof t==="string"){t=r.from(t,i)}else if(this._isBufferList(t)){t=t.slice()}else if(Array.isArray(t.buffer)){t=r.from(t.buffer,t.byteOffset,t.byteLength)}else if(!r.isBuffer(t)){t=r.from(t)}a=Number(a||0);if(isNaN(a)){a=0}if(a<0){a=this.length+a}if(a<0){a=0}if(t.length===0){return a>this.length?this.length:a}const o=this._offset(a);let p=o[0];let d=o[1];for(;p<this._bufs.length;p++){const a=this._bufs[p];while(d<a.length){const i=a.length-d;if(i>=t.length){const i=a.indexOf(t,d);if(i!==-1){return this._reverseOffset([p,i])}d=a.length-t.length+1}else{const a=this._reverseOffset([p,d]);if(this._match(a,t)){return a}d++}}d=0}return-1};BufferList.prototype._match=function(t,a){if(this.length-t<a.length){return false}for(let i=0;i<a.length;i++){if(this.get(t+i)!==a[i]){return false}}return true};(function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const a in t){(function(a){if(t[a]===null){BufferList.prototype[a]=function(t,i){return this.slice(t,t+i)[a](0,i)}}else{BufferList.prototype[a]=function(i=0){return this.slice(i,i+t[a])[a](0)}}})(a)}})();BufferList.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferList||BufferList.isBufferList(t)};BufferList.isBufferList=function isBufferList(t){return t!=null&&t[o]};t.exports=BufferList},4264:(t,a,i)=>{"use strict";const r=i(436).Duplex;const o=i(8013);const p=i(760);function BufferListStream(t){if(!(this instanceof BufferListStream)){return new BufferListStream(t)}if(typeof t==="function"){this._callback=t;const a=function piper(t){if(this._callback){this._callback(t);this._callback=null}}.bind(this);this.on("pipe",(function onPipe(t){t.on("error",a)}));this.on("unpipe",(function onUnpipe(t){t.removeListener("error",a)}));t=null}p._init.call(this,t);r.call(this)}o(BufferListStream,r);Object.assign(BufferListStream.prototype,p.prototype);BufferListStream.prototype._new=function _new(t){return new BufferListStream(t)};BufferListStream.prototype._write=function _write(t,a,i){this._appendBuffer(t);if(typeof i==="function"){i()}};BufferListStream.prototype._read=function _read(t){if(!this.length){return this.push(null)}t=Math.min(t,this.length);this.push(this.slice(0,t));this.consume(t)};BufferListStream.prototype.end=function end(t){r.prototype.end.call(this,t);if(this._callback){this._callback(null,this.slice());this._callback=null}};BufferListStream.prototype._destroy=function _destroy(t,a){this._bufs.length=0;this.length=0;a(t)};BufferListStream.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferListStream||t instanceof p||BufferListStream.isBufferList(t)};BufferListStream.isBufferList=p.isBufferList;t.exports=BufferListStream;t.exports.BufferListStream=BufferListStream;t.exports.BufferList=p},2283:t=>{var a=Object.prototype.toString;var i=typeof Buffer!=="undefined"&&typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(t){return a.call(t).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(t,a,r){a>>>=0;var o=t.byteLength-a;if(o<0){throw new RangeError("'offset' is out of bounds")}if(r===undefined){r=o}else{r>>>=0;if(r>o){throw new RangeError("'length' is out of bounds")}}return i?Buffer.from(t.slice(a,a+r)):new Buffer(new Uint8Array(t.slice(a,a+r)))}function fromString(t,a){if(typeof a!=="string"||a===""){a="utf8"}if(!Buffer.isEncoding(a)){throw new TypeError('"encoding" must be a valid string encoding')}return i?Buffer.from(t,a):new Buffer(t,a)}function bufferFrom(t,a,r){if(typeof t==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(t)){return fromArrayBuffer(t,a,r)}if(typeof t==="string"){return fromString(t,a)}return i?Buffer.from(t):new Buffer(t)}t.exports=bufferFrom},2314:(t,a,i)=>{"use strict";const r=i(1264);const{stdout:o,stderr:p}=i(6480);const{stringReplaceAll:d,stringEncaseCRLFWithFirstIndex:l}=i(7188);const{isArray:u}=Array;const m=["ansi","ansi","ansi256","ansi16m"];const h=Object.create(null);const applyOptions=(t,a={})=>{if(a.level&&!(Number.isInteger(a.level)&&a.level>=0&&a.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const i=o?o.level:0;t.level=a.level===undefined?i:a.level};class ChalkClass{constructor(t){return chalkFactory(t)}}const chalkFactory=t=>{const a={};applyOptions(a,t);a.template=(...t)=>chalkTag(a.template,...t);Object.setPrototypeOf(a,Chalk.prototype);Object.setPrototypeOf(a.template,a);a.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")};a.template.Instance=ChalkClass;return a.template};function Chalk(t){return chalkFactory(t)}for(const[t,a]of Object.entries(r)){h[t]={get(){const i=createBuilder(this,createStyler(a.open,a.close,this._styler),this._isEmpty);Object.defineProperty(this,t,{value:i});return i}}}h.visible={get(){const t=createBuilder(this,this._styler,true);Object.defineProperty(this,"visible",{value:t});return t}};const g=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const t of g){h[t]={get(){const{level:a}=this;return function(...i){const o=createStyler(r.color[m[a]][t](...i),r.color.close,this._styler);return createBuilder(this,o,this._isEmpty)}}}}for(const t of g){const a="bg"+t[0].toUpperCase()+t.slice(1);h[a]={get(){const{level:a}=this;return function(...i){const o=createStyler(r.bgColor[m[a]][t](...i),r.bgColor.close,this._styler);return createBuilder(this,o,this._isEmpty)}}}}const v=Object.defineProperties((()=>{}),{...h,level:{enumerable:true,get(){return this._generator.level},set(t){this._generator.level=t}}});const createStyler=(t,a,i)=>{let r;let o;if(i===undefined){r=t;o=a}else{r=i.openAll+t;o=a+i.closeAll}return{open:t,close:a,openAll:r,closeAll:o,parent:i}};const createBuilder=(t,a,i)=>{const builder=(...t)=>{if(u(t[0])&&u(t[0].raw)){return applyStyle(builder,chalkTag(builder,...t))}return applyStyle(builder,t.length===1?""+t[0]:t.join(" "))};Object.setPrototypeOf(builder,v);builder._generator=t;builder._styler=a;builder._isEmpty=i;return builder};const applyStyle=(t,a)=>{if(t.level<=0||!a){return t._isEmpty?"":a}let i=t._styler;if(i===undefined){return a}const{openAll:r,closeAll:o}=i;if(a.indexOf("")!==-1){while(i!==undefined){a=d(a,i.close,i.open);i=i.parent}}const p=a.indexOf("\n");if(p!==-1){a=l(a,o,r,p)}return r+a+o};let w;const chalkTag=(t,...a)=>{const[r]=a;if(!u(r)||!u(r.raw)){return a.join(" ")}const o=a.slice(1);const p=[r.raw[0]];for(let t=1;t<r.length;t++){p.push(String(o[t-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[t]))}if(w===undefined){w=i(9121)}return w(t,p.join(""))};Object.defineProperties(Chalk.prototype,h);const b=Chalk();b.supportsColor=o;b.stderr=Chalk({level:p?p.level:0});b.stderr.supportsColor=p;t.exports=b},9121:t=>{"use strict";const a=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;const i=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;const r=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;const o=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;const p=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function unescape(t){const a=t[0]==="u";const i=t[1]==="{";if(a&&!i&&t.length===5||t[0]==="x"&&t.length===3){return String.fromCharCode(parseInt(t.slice(1),16))}if(a&&i){return String.fromCodePoint(parseInt(t.slice(2,-1),16))}return p.get(t)||t}function parseArguments(t,a){const i=[];const p=a.trim().split(/\s*,\s*/g);let d;for(const a of p){const p=Number(a);if(!Number.isNaN(p)){i.push(p)}else if(d=a.match(r)){i.push(d[2].replace(o,((t,a,i)=>a?unescape(a):i)))}else{throw new Error(`Invalid Chalk template style argument: ${a} (in style '${t}')`)}}return i}function parseStyle(t){i.lastIndex=0;const a=[];let r;while((r=i.exec(t))!==null){const t=r[1];if(r[2]){const i=parseArguments(t,r[2]);a.push([t].concat(i))}else{a.push([t])}}return a}function buildStyle(t,a){const i={};for(const t of a){for(const a of t.styles){i[a[0]]=t.inverse?null:a.slice(1)}}let r=t;for(const[t,a]of Object.entries(i)){if(!Array.isArray(a)){continue}if(!(t in r)){throw new Error(`Unknown Chalk style: ${t}`)}r=a.length>0?r[t](...a):r[t]}return r}t.exports=(t,i)=>{const r=[];const o=[];let p=[];i.replace(a,((a,i,d,l,u,m)=>{if(i){p.push(unescape(i))}else if(l){const a=p.join("");p=[];o.push(r.length===0?a:buildStyle(t,r)(a));r.push({inverse:d,styles:parseStyle(l)})}else if(u){if(r.length===0){throw new Error("Found extraneous } in Chalk template literal")}o.push(buildStyle(t,r)(p.join("")));p=[];r.pop()}else{p.push(m)}}));o.push(p.join(""));if(r.length>0){const t=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(t)}return o.join("")}},7188:t=>{"use strict";const stringReplaceAll=(t,a,i)=>{let r=t.indexOf(a);if(r===-1){return t}const o=a.length;let p=0;let d="";do{d+=t.substr(p,r-p)+a+i;p=r+o;r=t.indexOf(a,p)}while(r!==-1);d+=t.substr(p);return d};const stringEncaseCRLFWithFirstIndex=(t,a,i,r)=>{let o=0;let p="";do{const d=t[r-1]==="\r";p+=t.substr(o,(d?r-1:r)-o)+a+(d?"\r\n":"\n")+i;o=r+1;r=t.indexOf("\n",o)}while(r!==-1);p+=t.substr(o);return p};t.exports={stringReplaceAll:stringReplaceAll,stringEncaseCRLFWithFirstIndex:stringEncaseCRLFWithFirstIndex}},253:t=>{var a={utf8:{stringToBytes:function(t){return a.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(a.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var a=[],i=0;i<t.length;i++)a.push(t.charCodeAt(i)&255);return a},bytesToString:function(t){for(var a=[],i=0;i<t.length;i++)a.push(String.fromCharCode(t[i]));return a.join("")}}};t.exports=a},4673:(t,a,i)=>{"use strict";const r=i(8465);let o=false;a.show=(t=process.stderr)=>{if(!t.isTTY){return}o=false;t.write("[?25h")};a.hide=(t=process.stderr)=>{if(!t.isTTY){return}r();o=true;t.write("[?25l")};a.toggle=(t,i)=>{if(t!==undefined){o=t}if(o){a.show(i)}else{a.hide(i)}}},9140:(t,a,i)=>{"use strict";const r=Object.assign({},i(7256));const o=Object.keys(r);Object.defineProperty(r,"random",{get(){const t=Math.floor(Math.random()*o.length);const a=o[t];return r[a]}});t.exports=r},7905:t=>{var a=function(){"use strict";function clone(t,a,i,r){var o;if(typeof a==="object"){i=a.depth;r=a.prototype;o=a.filter;a=a.circular}var p=[];var d=[];var l=typeof Buffer!="undefined";if(typeof a=="undefined")a=true;if(typeof i=="undefined")i=Infinity;function _clone(t,i){if(t===null)return null;if(i==0)return t;var o;var u;if(typeof t!="object"){return t}if(clone.__isArray(t)){o=[]}else if(clone.__isRegExp(t)){o=new RegExp(t.source,__getRegExpFlags(t));if(t.lastIndex)o.lastIndex=t.lastIndex}else if(clone.__isDate(t)){o=new Date(t.getTime())}else if(l&&Buffer.isBuffer(t)){if(Buffer.allocUnsafe){o=Buffer.allocUnsafe(t.length)}else{o=new Buffer(t.length)}t.copy(o);return o}else{if(typeof r=="undefined"){u=Object.getPrototypeOf(t);o=Object.create(u)}else{o=Object.create(r);u=r}}if(a){var m=p.indexOf(t);if(m!=-1){return d[m]}p.push(t);d.push(o)}for(var h in t){var g;if(u){g=Object.getOwnPropertyDescriptor(u,h)}if(g&&g.set==null){continue}o[h]=_clone(t[h],i-1)}return o}return _clone(t,i)}clone.clonePrototype=function clonePrototype(t){if(t===null)return null;var c=function(){};c.prototype=t;return new c};function __objToStr(t){return Object.prototype.toString.call(t)}clone.__objToStr=__objToStr;function __isDate(t){return typeof t==="object"&&__objToStr(t)==="[object Date]"}clone.__isDate=__isDate;function __isArray(t){return typeof t==="object"&&__objToStr(t)==="[object Array]"}clone.__isArray=__isArray;function __isRegExp(t){return typeof t==="object"&&__objToStr(t)==="[object RegExp]"}clone.__isRegExp=__isRegExp;function __getRegExpFlags(t){var a="";if(t.global)a+="g";if(t.ignoreCase)a+="i";if(t.multiline)a+="m";return a}clone.__getRegExpFlags=__getRegExpFlags;return clone}();if(true&&t.exports){t.exports=a}},2979:(t,a,i)=>{const r=i(711);const o={};for(const t of Object.keys(r)){o[r[t]]=t}const p={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};t.exports=p;for(const t of Object.keys(p)){if(!("channels"in p[t])){throw new Error("missing channels property: "+t)}if(!("labels"in p[t])){throw new Error("missing channel labels property: "+t)}if(p[t].labels.length!==p[t].channels){throw new Error("channel and label counts mismatch: "+t)}const{channels:a,labels:i}=p[t];delete p[t].channels;delete p[t].labels;Object.defineProperty(p[t],"channels",{value:a});Object.defineProperty(p[t],"labels",{value:i})}p.rgb.hsl=function(t){const a=t[0]/255;const i=t[1]/255;const r=t[2]/255;const o=Math.min(a,i,r);const p=Math.max(a,i,r);const d=p-o;let l;let u;if(p===o){l=0}else if(a===p){l=(i-r)/d}else if(i===p){l=2+(r-a)/d}else if(r===p){l=4+(a-i)/d}l=Math.min(l*60,360);if(l<0){l+=360}const m=(o+p)/2;if(p===o){u=0}else if(m<=.5){u=d/(p+o)}else{u=d/(2-p-o)}return[l,u*100,m*100]};p.rgb.hsv=function(t){let a;let i;let r;let o;let p;const d=t[0]/255;const l=t[1]/255;const u=t[2]/255;const m=Math.max(d,l,u);const h=m-Math.min(d,l,u);const diffc=function(t){return(m-t)/6/h+1/2};if(h===0){o=0;p=0}else{p=h/m;a=diffc(d);i=diffc(l);r=diffc(u);if(d===m){o=r-i}else if(l===m){o=1/3+a-r}else if(u===m){o=2/3+i-a}if(o<0){o+=1}else if(o>1){o-=1}}return[o*360,p*100,m*100]};p.rgb.hwb=function(t){const a=t[0];const i=t[1];let r=t[2];const o=p.rgb.hsl(t)[0];const d=1/255*Math.min(a,Math.min(i,r));r=1-1/255*Math.max(a,Math.max(i,r));return[o,d*100,r*100]};p.rgb.cmyk=function(t){const a=t[0]/255;const i=t[1]/255;const r=t[2]/255;const o=Math.min(1-a,1-i,1-r);const p=(1-a-o)/(1-o)||0;const d=(1-i-o)/(1-o)||0;const l=(1-r-o)/(1-o)||0;return[p*100,d*100,l*100,o*100]};function comparativeDistance(t,a){return(t[0]-a[0])**2+(t[1]-a[1])**2+(t[2]-a[2])**2}p.rgb.keyword=function(t){const a=o[t];if(a){return a}let i=Infinity;let p;for(const a of Object.keys(r)){const o=r[a];const d=comparativeDistance(t,o);if(d<i){i=d;p=a}}return p};p.keyword.rgb=function(t){return r[t]};p.rgb.xyz=function(t){let a=t[0]/255;let i=t[1]/255;let r=t[2]/255;a=a>.04045?((a+.055)/1.055)**2.4:a/12.92;i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const o=a*.4124+i*.3576+r*.1805;const p=a*.2126+i*.7152+r*.0722;const d=a*.0193+i*.1192+r*.9505;return[o*100,p*100,d*100]};p.rgb.lab=function(t){const a=p.rgb.xyz(t);let i=a[0];let r=a[1];let o=a[2];i/=95.047;r/=100;o/=108.883;i=i>.008856?i**(1/3):7.787*i+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;o=o>.008856?o**(1/3):7.787*o+16/116;const d=116*r-16;const l=500*(i-r);const u=200*(r-o);return[d,l,u]};p.hsl.rgb=function(t){const a=t[0]/360;const i=t[1]/100;const r=t[2]/100;let o;let p;let d;if(i===0){d=r*255;return[d,d,d]}if(r<.5){o=r*(1+i)}else{o=r+i-r*i}const l=2*r-o;const u=[0,0,0];for(let t=0;t<3;t++){p=a+1/3*-(t-1);if(p<0){p++}if(p>1){p--}if(6*p<1){d=l+(o-l)*6*p}else if(2*p<1){d=o}else if(3*p<2){d=l+(o-l)*(2/3-p)*6}else{d=l}u[t]=d*255}return u};p.hsl.hsv=function(t){const a=t[0];let i=t[1]/100;let r=t[2]/100;let o=i;const p=Math.max(r,.01);r*=2;i*=r<=1?r:2-r;o*=p<=1?p:2-p;const d=(r+i)/2;const l=r===0?2*o/(p+o):2*i/(r+i);return[a,l*100,d*100]};p.hsv.rgb=function(t){const a=t[0]/60;const i=t[1]/100;let r=t[2]/100;const o=Math.floor(a)%6;const p=a-Math.floor(a);const d=255*r*(1-i);const l=255*r*(1-i*p);const u=255*r*(1-i*(1-p));r*=255;switch(o){case 0:return[r,u,d];case 1:return[l,r,d];case 2:return[d,r,u];case 3:return[d,l,r];case 4:return[u,d,r];case 5:return[r,d,l]}};p.hsv.hsl=function(t){const a=t[0];const i=t[1]/100;const r=t[2]/100;const o=Math.max(r,.01);let p;let d;d=(2-i)*r;const l=(2-i)*o;p=i*o;p/=l<=1?l:2-l;p=p||0;d/=2;return[a,p*100,d*100]};p.hwb.rgb=function(t){const a=t[0]/360;let i=t[1]/100;let r=t[2]/100;const o=i+r;let p;if(o>1){i/=o;r/=o}const d=Math.floor(6*a);const l=1-r;p=6*a-d;if((d&1)!==0){p=1-p}const u=i+p*(l-i);let m;let h;let g;switch(d){default:case 6:case 0:m=l;h=u;g=i;break;case 1:m=u;h=l;g=i;break;case 2:m=i;h=l;g=u;break;case 3:m=i;h=u;g=l;break;case 4:m=u;h=i;g=l;break;case 5:m=l;h=i;g=u;break}return[m*255,h*255,g*255]};p.cmyk.rgb=function(t){const a=t[0]/100;const i=t[1]/100;const r=t[2]/100;const o=t[3]/100;const p=1-Math.min(1,a*(1-o)+o);const d=1-Math.min(1,i*(1-o)+o);const l=1-Math.min(1,r*(1-o)+o);return[p*255,d*255,l*255]};p.xyz.rgb=function(t){const a=t[0]/100;const i=t[1]/100;const r=t[2]/100;let o;let p;let d;o=a*3.2406+i*-1.5372+r*-.4986;p=a*-.9689+i*1.8758+r*.0415;d=a*.0557+i*-.204+r*1.057;o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92;p=p>.0031308?1.055*p**(1/2.4)-.055:p*12.92;d=d>.0031308?1.055*d**(1/2.4)-.055:d*12.92;o=Math.min(Math.max(0,o),1);p=Math.min(Math.max(0,p),1);d=Math.min(Math.max(0,d),1);return[o*255,p*255,d*255]};p.xyz.lab=function(t){let a=t[0];let i=t[1];let r=t[2];a/=95.047;i/=100;r/=108.883;a=a>.008856?a**(1/3):7.787*a+16/116;i=i>.008856?i**(1/3):7.787*i+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;const o=116*i-16;const p=500*(a-i);const d=200*(i-r);return[o,p,d]};p.lab.xyz=function(t){const a=t[0];const i=t[1];const r=t[2];let o;let p;let d;p=(a+16)/116;o=i/500+p;d=p-r/200;const l=p**3;const u=o**3;const m=d**3;p=l>.008856?l:(p-16/116)/7.787;o=u>.008856?u:(o-16/116)/7.787;d=m>.008856?m:(d-16/116)/7.787;o*=95.047;p*=100;d*=108.883;return[o,p,d]};p.lab.lch=function(t){const a=t[0];const i=t[1];const r=t[2];let o;const p=Math.atan2(r,i);o=p*360/2/Math.PI;if(o<0){o+=360}const d=Math.sqrt(i*i+r*r);return[a,d,o]};p.lch.lab=function(t){const a=t[0];const i=t[1];const r=t[2];const o=r/360*2*Math.PI;const p=i*Math.cos(o);const d=i*Math.sin(o);return[a,p,d]};p.rgb.ansi16=function(t,a=null){const[i,r,o]=t;let d=a===null?p.rgb.hsv(t)[2]:a;d=Math.round(d/50);if(d===0){return 30}let l=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(i/255));if(d===2){l+=60}return l};p.hsv.ansi16=function(t){return p.rgb.ansi16(p.hsv.rgb(t),t[2])};p.rgb.ansi256=function(t){const a=t[0];const i=t[1];const r=t[2];if(a===i&&i===r){if(a<8){return 16}if(a>248){return 231}return Math.round((a-8)/247*24)+232}const o=16+36*Math.round(a/255*5)+6*Math.round(i/255*5)+Math.round(r/255*5);return o};p.ansi16.rgb=function(t){let a=t%10;if(a===0||a===7){if(t>50){a+=3.5}a=a/10.5*255;return[a,a,a]}const i=(~~(t>50)+1)*.5;const r=(a&1)*i*255;const o=(a>>1&1)*i*255;const p=(a>>2&1)*i*255;return[r,o,p]};p.ansi256.rgb=function(t){if(t>=232){const a=(t-232)*10+8;return[a,a,a]}t-=16;let a;const i=Math.floor(t/36)/5*255;const r=Math.floor((a=t%36)/6)/5*255;const o=a%6/5*255;return[i,r,o]};p.rgb.hex=function(t){const a=((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255);const i=a.toString(16).toUpperCase();return"000000".substring(i.length)+i};p.hex.rgb=function(t){const a=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!a){return[0,0,0]}let i=a[0];if(a[0].length===3){i=i.split("").map((t=>t+t)).join("")}const r=parseInt(i,16);const o=r>>16&255;const p=r>>8&255;const d=r&255;return[o,p,d]};p.rgb.hcg=function(t){const a=t[0]/255;const i=t[1]/255;const r=t[2]/255;const o=Math.max(Math.max(a,i),r);const p=Math.min(Math.min(a,i),r);const d=o-p;let l;let u;if(d<1){l=p/(1-d)}else{l=0}if(d<=0){u=0}else if(o===a){u=(i-r)/d%6}else if(o===i){u=2+(r-a)/d}else{u=4+(a-i)/d}u/=6;u%=1;return[u*360,d*100,l*100]};p.hsl.hcg=function(t){const a=t[1]/100;const i=t[2]/100;const r=i<.5?2*a*i:2*a*(1-i);let o=0;if(r<1){o=(i-.5*r)/(1-r)}return[t[0],r*100,o*100]};p.hsv.hcg=function(t){const a=t[1]/100;const i=t[2]/100;const r=a*i;let o=0;if(r<1){o=(i-r)/(1-r)}return[t[0],r*100,o*100]};p.hcg.rgb=function(t){const a=t[0]/360;const i=t[1]/100;const r=t[2]/100;if(i===0){return[r*255,r*255,r*255]}const o=[0,0,0];const p=a%1*6;const d=p%1;const l=1-d;let u=0;switch(Math.floor(p)){case 0:o[0]=1;o[1]=d;o[2]=0;break;case 1:o[0]=l;o[1]=1;o[2]=0;break;case 2:o[0]=0;o[1]=1;o[2]=d;break;case 3:o[0]=0;o[1]=l;o[2]=1;break;case 4:o[0]=d;o[1]=0;o[2]=1;break;default:o[0]