@capgo/cli 8.65.0 → 8.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +359 -359
- package/dist/notify-app-ready-worker.js +3 -3
- package/dist/onboarding-worker.js +3 -3
- package/dist/package.json +1 -1
- package/dist/src/analytics/org-resolver.d.ts +3 -1
- package/dist/src/build/onboarding/telemetry.d.ts +1 -1
- package/dist/src/sdk.js +4 -4
- package/dist/updater-installed-worker.js +3 -3
- package/package.json +1 -1
|
@@ -86,7 +86,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
86
86
|
`)}),$.__defineSetter__("stack",function(U){return[U].concat($.stack).join(`
|
|
87
87
|
|
|
88
88
|
`)}),$}});var wE=T((dMD,ME)=>{var V6=DD("constants"),ja=process.cwd,HU=null,Ta=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!HU)HU=ja.call(process);return HU};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(LU=process.chdir,process.chdir=function(D){HU=null,LU.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,LU)}var LU;ME.exports=Sa;function Sa(D){if(V6.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))$(D);if(!D.lutimes)U(D);if(D.chown=F(D.chown),D.fchown=F(D.fchown),D.lchown=F(D.lchown),D.chmod=Q(D.chmod),D.fchmod=Q(D.fchmod),D.lchmod=Q(D.lchmod),D.chownSync=Y(D.chownSync),D.fchownSync=Y(D.fchownSync),D.lchownSync=Y(D.lchownSync),D.chmodSync=X(D.chmodSync),D.fchmodSync=X(D.fchmodSync),D.lchmodSync=X(D.lchmodSync),D.stat=J(D.stat),D.fstat=J(D.fstat),D.lstat=J(D.lstat),D.statSync=I(D.statSync),D.fstatSync=I(D.fstatSync),D.lstatSync=I(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(W,B,G){if(G)process.nextTick(G)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(W,B,G,Z){if(Z)process.nextTick(Z)},D.lchownSync=function(){};if(Ta==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(W){function B(G,Z,z){var K=Date.now(),H=0;W(G,Z,function M(N){if(N&&(N.code==="EACCES"||N.code==="EPERM"||N.code==="EBUSY")&&Date.now()-K<60000){if(setTimeout(function(){D.stat(Z,function(L,O){if(L&&L.code==="ENOENT")W(G,Z,M);else z(N)})},H),H<100)H+=10;return}if(z)z(N)})}if(Object.setPrototypeOf)Object.setPrototypeOf(B,W);return B}(D.rename);D.read=typeof D.read!=="function"?D.read:function(W){function B(G,Z,z,K,H,M){var N;if(M&&typeof M==="function"){var L=0;N=function(O,j,E){if(O&&O.code==="EAGAIN"&&L<10)return L++,W.call(D,G,Z,z,K,H,N);M.apply(this,arguments)}}return W.call(D,G,Z,z,K,H,N)}if(Object.setPrototypeOf)Object.setPrototypeOf(B,W);return B}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(W){return function(B,G,Z,z,K){var H=0;while(!0)try{return W.call(D,B,G,Z,z,K)}catch(M){if(M.code==="EAGAIN"&&H<10){H++;continue}throw M}}}(D.readSync);function $(W){W.lchmod=function(B,G,Z){W.open(B,V6.O_WRONLY|V6.O_SYMLINK,G,function(z,K){if(z){if(Z)Z(z);return}W.fchmod(K,G,function(H){W.close(K,function(M){if(Z)Z(H||M)})})})},W.lchmodSync=function(B,G){var Z=W.openSync(B,V6.O_WRONLY|V6.O_SYMLINK,G),z=!0,K;try{K=W.fchmodSync(Z,G),z=!1}finally{if(z)try{W.closeSync(Z)}catch(H){}else W.closeSync(Z)}return K}}function U(W){if(V6.hasOwnProperty("O_SYMLINK")&&W.futimes)W.lutimes=function(B,G,Z,z){W.open(B,V6.O_SYMLINK,function(K,H){if(K){if(z)z(K);return}W.futimes(H,G,Z,function(M){W.close(H,function(N){if(z)z(M||N)})})})},W.lutimesSync=function(B,G,Z){var z=W.openSync(B,V6.O_SYMLINK),K,H=!0;try{K=W.futimesSync(z,G,Z),H=!1}finally{if(H)try{W.closeSync(z)}catch(M){}else W.closeSync(z)}return K};else if(W.futimes)W.lutimes=function(B,G,Z,z){if(z)process.nextTick(z)},W.lutimesSync=function(){}}function Q(W){if(!W)return W;return function(B,G,Z){return W.call(D,B,G,function(z){if(q(z))z=null;if(Z)Z.apply(this,arguments)})}}function X(W){if(!W)return W;return function(B,G){try{return W.call(D,B,G)}catch(Z){if(!q(Z))throw Z}}}function F(W){if(!W)return W;return function(B,G,Z,z){return W.call(D,B,G,Z,function(K){if(q(K))K=null;if(z)z.apply(this,arguments)})}}function Y(W){if(!W)return W;return function(B,G,Z){try{return W.call(D,B,G,Z)}catch(z){if(!q(z))throw z}}}function J(W){if(!W)return W;return function(B,G,Z){if(typeof G==="function")Z=G,G=null;function z(K,H){if(H){if(H.uid<0)H.uid+=4294967296;if(H.gid<0)H.gid+=4294967296}if(Z)Z.apply(this,arguments)}return G?W.call(D,B,G,z):W.call(D,B,z)}}function I(W){if(!W)return W;return function(B,G){var Z=G?W.call(D,B,G):W.call(D,B);if(Z){if(Z.uid<0)Z.uid+=4294967296;if(Z.gid<0)Z.gid+=4294967296}return Z}}function q(W){if(!W)return!0;if(W.code==="ENOSYS")return!0;var B=!process.getuid||process.getuid()!==0;if(B){if(W.code==="EINVAL"||W.code==="EPERM")return!0}return!1}}});var RE=T((lMD,VE)=>{var OE=DD("stream").Stream;VE.exports=Pa;function Pa(D){return{ReadStream:$,WriteStream:U};function $(Q,X){if(!(this instanceof $))return new $(Q,X);OE.call(this);var F=this;this.path=Q,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,X=X||{};var Y=Object.keys(X);for(var J=0,I=Y.length;J<I;J++){var q=Y[J];this[q]=X[q]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){F._read()});return}D.open(this.path,this.flags,this.mode,function(W,B){if(W){F.emit("error",W),F.readable=!1;return}F.fd=B,F.emit("open",B),F._read()})}function U(Q,X){if(!(this instanceof U))return new U(Q,X);OE.call(this),this.path=Q,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,X=X||{};var F=Object.keys(X);for(var Y=0,J=F.length;Y<J;Y++){var I=F[Y];this[I]=X[I]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var EE=T((nMD,AE)=>{AE.exports=ba;var Ca=Object.getPrototypeOf||function(D){return D.__proto__};function ba(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var $={__proto__:Ca(D)};else var $=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(U){Object.defineProperty($,U,Object.getOwnPropertyDescriptor(D,U))}),$}});var R6=T((iMD,qI)=>{var cD=DD("fs"),va=wE(),_a=RE(),ka=EE(),NU=DD("util"),z0,wU;if(typeof Symbol==="function"&&typeof Symbol.for==="function")z0=Symbol.for("graceful-fs.queue"),wU=Symbol.for("graceful-fs.previous");else z0="___graceful-fs.queue",wU="___graceful-fs.previous";function xa(){}function TE(D,$){Object.defineProperty(D,z0,{get:function(){return $}})}var S1=xa;if(NU.debuglog)S1=NU.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))S1=function(){var D=NU.format.apply(NU,arguments);D="GFS4: "+D.split(/\n/).join(`
|
|
89
|
-
GFS4: `),console.error(D)};if(!cD[z0]){if(YI=global[z0]||[],TE(cD,YI),cD.close=function(D){function $(U,Q){return D.call(cD,U,function(X){if(!X)jE();if(typeof Q==="function")Q.apply(this,arguments)})}return Object.defineProperty($,wU,{value:D}),$}(cD.close),cD.closeSync=function(D){function $(U){D.apply(cD,arguments),jE()}return Object.defineProperty($,wU,{value:D}),$}(cD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){S1(cD[z0]),DD("assert").equal(cD[z0].length,0)})}var YI;if(!global[z0])TE(global,cD[z0]);qI.exports=JI(ka(cD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!cD.__patched)qI.exports=JI(cD),cD.__patched=!0;function JI(D){va(D),D.gracefulify=JI,D.createReadStream=j,D.createWriteStream=E;var $=D.readFile;D.readFile=U;function U(b,R,P){if(typeof R==="function")P=R,R=null;return h(b,R,P);function h(i,v,k,A){return $(i,v,function(w){if(w&&(w.code==="EMFILE"||w.code==="ENFILE"))W8([h,[i,v,k],w,A||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var Q=D.writeFile;D.writeFile=X;function X(b,R,P,h){if(typeof P==="function")h=P,P=null;return i(b,R,P,h);function i(v,k,A,w,V){return Q(v,k,A,function(_){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Y;function Y(b,R,P,h){if(typeof P==="function")h=P,P=null;return i(b,R,P,h);function i(v,k,A,w,V){return F(v,k,A,function(_){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}var J=D.copyFile;if(J)D.copyFile=I;function I(b,R,P,h){if(typeof P==="function")h=P,P=0;return i(b,R,P,h);function i(v,k,A,w,V){return J(v,k,A,function(_){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}var q=D.readdir;D.readdir=B;var W=/^v[0-5]\./;function B(b,R,P){if(typeof R==="function")P=R,R=null;var h=W.test(process.version)?function(k,A,w,V){return q(k,i(k,A,w,V))}:function(k,A,w,V){return q(k,A,i(k,A,w,V))};return h(b,R,P);function i(v,k,A,w){return function(V,_){if(V&&(V.code==="EMFILE"||V.code==="ENFILE"))W8([h,[v,k,A],V,w||Date.now(),Date.now()]);else{if(_&&_.sort)_.sort();if(typeof A==="function")A.call(this,V,_)}}}}if(process.version.substr(0,4)==="v0.8"){var G=_a(D);M=G.ReadStream,L=G.WriteStream}var Z=D.ReadStream;if(Z)M.prototype=Object.create(Z.prototype),M.prototype.open=N;var z=D.WriteStream;if(z)L.prototype=Object.create(z.prototype),L.prototype.open=O;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(b){M=b},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return L},set:function(b){L=b},enumerable:!0,configurable:!0});var K=M;Object.defineProperty(D,"FileReadStream",{get:function(){return K},set:function(b){K=b},enumerable:!0,configurable:!0});var H=L;Object.defineProperty(D,"FileWriteStream",{get:function(){return H},set:function(b){H=b},enumerable:!0,configurable:!0});function M(b,R){if(this instanceof M)return Z.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function N(){var b=this;S(b.path,b.flags,b.mode,function(R,P){if(R){if(b.autoClose)b.destroy();b.emit("error",R)}else b.fd=P,b.emit("open",P),b.read()})}function L(b,R){if(this instanceof L)return z.apply(this,arguments),this;else return L.apply(Object.create(L.prototype),arguments)}function O(){var b=this;S(b.path,b.flags,b.mode,function(R,P){if(R)b.destroy(),b.emit("error",R);else b.fd=P,b.emit("open",P)})}function j(b,R){return new D.ReadStream(b,R)}function E(b,R){return new D.WriteStream(b,R)}var C=D.open;D.open=S;function S(b,R,P,h){if(typeof P==="function")h=P,P=null;return i(b,R,P,h);function i(v,k,A,w,V){return C(v,k,A,function(_,m){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}return D}function W8(D){S1("ENQUEUE",D[0].name,D[1]),cD[z0].push(D),II()}var MU;function jE(){var D=Date.now();for(var $=0;$<cD[z0].length;++$)if(cD[z0][$].length>2)cD[z0][$][3]=D,cD[z0][$][4]=D;II()}function II(){if(clearTimeout(MU),MU=void 0,cD[z0].length===0)return;var D=cD[z0].shift(),$=D[0],U=D[1],Q=D[2],X=D[3],F=D[4];if(X===void 0)S1("RETRY",$.name,U),$.apply(null,U);else if(Date.now()-X>=60000){S1("TIMEOUT",$.name,U);var Y=U.pop();if(typeof Y==="function")Y.call(null,Q)}else{var J=Date.now()-F,I=Math.max(F-X,1),q=Math.min(I*1.2,100);if(J>=q)S1("RETRY",$.name,U),$.apply(null,U.concat([X]));else cD[z0].push(D)}if(MU===void 0)MU=setTimeout(II,0)}});var PE=T((cMD,SE)=>{function Y$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}SE.exports=Y$;Y$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Y$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};Y$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var U=this._timeouts.shift();if(U===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),U=this._timeouts.shift();else return!1;var Q=this,X=setTimeout(function(){if(Q._attempts++,Q._operationTimeoutCb){if(Q._timeout=setTimeout(function(){Q._operationTimeoutCb(Q._attempts)},Q._operationTimeout),Q._options.unref)Q._timeout.unref()}Q._fn(Q._attempts)},U);if(this._options.unref)X.unref();return!0};Y$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var U=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){U._operationTimeoutCb()},U._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};Y$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};Y$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};Y$.prototype.start=Y$.prototype.try;Y$.prototype.errors=function(){return this._errors};Y$.prototype.attempts=function(){return this._attempts};Y$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,U=0;for(var Q=0;Q<this._errors.length;Q++){var X=this._errors[Q],F=X.message,Y=(D[F]||0)+1;if(D[F]=Y,Y>=U)$=X,U=Y}return $}});var bE=T((ua)=>{var ga=PE();ua.operation=function(D){var $=ua.timeouts(D);return new ga($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};ua.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var U in D)$[U]=D[U];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Q=[];for(var X=0;X<$.retries;X++)Q.push(this.createTimeout(X,$));if(D&&D.forever&&!Q.length)Q.push(this.createTimeout(X,$));return Q.sort(function(F,Y){return F-Y}),Q};ua.createTimeout=function(D,$){var U=$.randomize?Math.random()+1:1,Q=Math.round(U*$.minTimeout*Math.pow($.factor,D));return Q=Math.min(Q,$.maxTimeout),Q};ua.wrap=function(D,$,U){if($ instanceof Array)U=$,$=null;if(!U){U=[];for(var Q in D)if(typeof D[Q]==="function")U.push(Q)}for(var X=0;X<U.length;X++){var F=U[X],Y=D[F];D[F]=function(I){var q=ua.operation($),W=Array.prototype.slice.call(arguments,1),B=W.pop();W.push(function(G){if(q.retry(G))return;if(G)arguments[0]=q.mainError();B.apply(this,arguments)}),q.attempt(function(){I.apply(D,W)})}.bind(D,Y),D[F].options=$}}});var vE=T((rMD,OU)=>{OU.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")OU.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")OU.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var ZI=T((oMD,G8)=>{var dD=global.process,P1=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!P1(dD))G8.exports=function(){return function(){}};else{if(WI=DD("assert"),C1=vE(),BI=/^win/i.test(dD.platform),B8=DD("events"),typeof B8!=="function")B8=B8.EventEmitter;if(dD.__signal_exit_emitter__)Q0=dD.__signal_exit_emitter__;else Q0=dD.__signal_exit_emitter__=new B8,Q0.count=0,Q0.emitted={};if(!Q0.infinite)Q0.setMaxListeners(1/0),Q0.infinite=!0;G8.exports=function(D,$){if(!P1(global.process))return function(){};if(WI.equal(typeof D,"function","a callback must be provided for exit handler"),b1===!1)VU();var U="exit";if($&&$.alwaysLast)U="afterexit";var Q=function(){if(Q0.removeListener(U,D),Q0.listeners("exit").length===0&&Q0.listeners("afterexit").length===0)h9()};return Q0.on(U,D),Q},h9=function(){if(!b1||!P1(global.process))return;b1=!1,C1.forEach(function($){try{dD.removeListener($,d9[$])}catch(U){}}),dD.emit=l9,dD.reallyExit=RU,Q0.count-=1},G8.exports.unload=h9,A6=function($,U,Q){if(Q0.emitted[$])return;Q0.emitted[$]=!0,Q0.emit($,U,Q)},d9={},C1.forEach(function(D){d9[D]=function(){if(!P1(global.process))return;var U=dD.listeners(D);if(U.length===Q0.count){if(h9(),A6("exit",null,D),A6("afterexit",null,D),BI&&D==="SIGHUP")D="SIGINT";dD.kill(dD.pid,D)}}}),G8.exports.signals=function(){return C1},b1=!1,VU=function(){if(b1||!P1(global.process))return;b1=!0,Q0.count+=1,C1=C1.filter(function($){try{return dD.on($,d9[$]),!0}catch(U){return!1}}),dD.emit=zI,dD.reallyExit=GI},G8.exports.load=VU,RU=dD.reallyExit,GI=function($){if(!P1(global.process))return;dD.exitCode=$||0,A6("exit",dD.exitCode,null),A6("afterexit",dD.exitCode,null),RU.call(dD,dD.exitCode)},l9=dD.emit,zI=function($,U){if($==="exit"&&P1(global.process)){if(U!==void 0)dD.exitCode=U;var Q=l9.apply(this,arguments);return A6("exit",dD.exitCode,null),A6("afterexit",dD.exitCode,null),Q}else return l9.apply(this,arguments)}}var WI,C1,BI,B8,Q0,h9,A6,d9,b1,VU,RU,GI,l9,zI});var kE=T((la,KI)=>{var _E=Symbol();function ha(D,$,U){let Q=$[_E];if(Q)return $.stat(D,(F,Y)=>{if(F)return U(F);U(null,Y.mtime,Q)});let X=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,X,X,(F)=>{if(F)return U(F);$.stat(D,(Y,J)=>{if(Y)return U(Y);let I=J.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,_E,{value:I}),U(null,J.mtime,I)})})}function da(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}la.probe=ha;la.getMtime=da});var yE=T((sa,i9)=>{var ca=DD("path"),NI=R6(),pa=bE(),ra=ZI(),xE=kE(),e$={};function n9(D,$){return $.lockfilePath||`${D}.lock`}function MI(D,$,U){if(!$.realpath)return U(null,ca.resolve(D));$.fs.realpath(D,U)}function LI(D,$,U){let Q=n9(D,$);$.fs.mkdir(Q,(X)=>{if(!X)return xE.probe(Q,$.fs,(F,Y,J)=>{if(F)return $.fs.rmdir(Q,()=>{}),U(F);U(null,Y,J)});if(X.code!=="EEXIST")return U(X);if($.stale<=0)return U(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(Q,(F,Y)=>{if(F){if(F.code==="ENOENT")return LI(D,{...$,stale:0},U);return U(F)}if(!gE(Y,$))return U(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));uE(D,$,(J)=>{if(J)return U(J);LI(D,{...$,stale:0},U)})})})}function gE(D,$){return D.mtime.getTime()<Date.now()-$.stale}function uE(D,$,U){$.fs.rmdir(n9(D,$),(Q)=>{if(Q&&Q.code!=="ENOENT")return U(Q);U()})}function AU(D,$){let U=e$[D];if(U.updateTimeout)return;if(U.updateDelay=U.updateDelay||$.update,U.updateTimeout=setTimeout(()=>{U.updateTimeout=null,$.fs.stat(U.lockfilePath,(Q,X)=>{let F=U.lastUpdate+$.stale<Date.now();if(Q){if(Q.code==="ENOENT"||F)return HI(D,U,Object.assign(Q,{code:"ECOMPROMISED"}));return U.updateDelay=1000,AU(D,$)}if(U.mtime.getTime()!==X.mtime.getTime())return HI(D,U,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let J=xE.getMtime(U.mtimePrecision);$.fs.utimes(U.lockfilePath,J,J,(I)=>{let q=U.lastUpdate+$.stale<Date.now();if(U.released)return;if(I){if(I.code==="ENOENT"||q)return HI(D,U,Object.assign(I,{code:"ECOMPROMISED"}));return U.updateDelay=1000,AU(D,$)}U.mtime=J,U.lastUpdate=Date.now(),U.updateDelay=null,AU(D,$)})})},U.updateDelay),U.updateTimeout.unref)U.updateTimeout.unref()}function HI(D,$,U){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(e$[D]===$)delete e$[D];$.options.onCompromised(U)}function oa(D,$,U){$={stale:1e4,update:null,realpath:!0,retries:0,fs:NI,onCompromised:(Q)=>{throw Q},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),MI(D,$,(Q,X)=>{if(Q)return U(Q);let F=pa.operation($.retries);F.attempt(()=>{LI(X,$,(Y,J,I)=>{if(F.retry(Y))return;if(Y)return U(F.mainError());let q=e$[X]={lockfilePath:n9(X,$),mtime:J,mtimePrecision:I,options:$,lastUpdate:Date.now()};AU(X,$),U(null,(W)=>{if(q.released)return W&&W(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));fE(X,{...$,realpath:!1},W)})})})})}function fE(D,$,U){$={fs:NI,realpath:!0,...$},MI(D,$,(Q,X)=>{if(Q)return U(Q);let F=e$[X];if(!F)return U(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete e$[X],uE(X,$,U)})}function aa(D,$,U){$={stale:1e4,realpath:!0,fs:NI,...$},$.stale=Math.max($.stale||0,2000),MI(D,$,(Q,X)=>{if(Q)return U(Q);$.fs.stat(n9(X,$),(F,Y)=>{if(F)return F.code==="ENOENT"?U(null,!1):U(F);return U(null,!gE(Y,$))})})}function ta(){return e$}ra(()=>{for(let D in e$){let $=e$[D].options;try{$.fs.rmdirSync(n9(D,$))}catch(U){}}});sa.lock=oa;sa.unlock=fE;sa.check=aa;sa.getLocks=ta});var hE=T((aMD,mE)=>{var Xt=R6();function Qt(D){let $=["mkdir","realpath","stat","rmdir","utimes"],U={...D};return $.forEach((Q)=>{U[Q]=(...X)=>{let F=X.pop(),Y;try{Y=D[`${Q}Sync`](...X)}catch(J){return F(J)}F(null,Y)}}),U}function Ft(D){return(...$)=>new Promise((U,Q)=>{$.push((X,F)=>{if(X)Q(X);else U(F)}),D(...$)})}function Yt(D){return(...$)=>{let U,Q;if($.push((X,F)=>{U=X,Q=F}),D(...$),U)throw U;return Q}}function Jt(D){if(D={...D},D.fs=Qt(D.fs||Xt),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}mE.exports={toPromise:Ft,toSync:Yt,toSyncOptions:Jt}});var lE=T((tMD,E6)=>{var z8=yE(),{toPromise:EU,toSync:jU,toSyncOptions:wI}=hE();async function dE(D,$){let U=await EU(z8.lock)(D,$);return EU(U)}function It(D,$){let U=jU(z8.lock)(D,wI($));return jU(U)}function qt(D,$){return EU(z8.unlock)(D,$)}function Wt(D,$){return jU(z8.unlock)(D,wI($))}function Bt(D,$){return EU(z8.check)(D,$)}function Gt(D,$){return jU(z8.check)(D,wI($))}E6.exports=dE;E6.exports.lock=dE;E6.exports.unlock=qt;E6.exports.lockSync=It;E6.exports.unlockSync=Wt;E6.exports.check=Bt;E6.exports.checkSync=Gt});var aE=T((rE)=>{Object.defineProperty(rE,"__esModule",{value:!0});rE.canStoreURLs=rE.FileUrlStorage=void 0;var nE=DD("fs"),zt=Kt(NE()),iE=Zt(lE());function pE(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,U=new WeakMap;return(pE=function(Q){return Q?U:$})(D)}function Zt(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var U=pE($);if(U&&U.has(D))return U.get(D);var Q={__proto__:null},X=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Y=X?Object.getOwnPropertyDescriptor(D,F):null;Y&&(Y.get||Y.set)?Object.defineProperty(Q,F,Y):Q[F]=D[F]}return Q.default=D,U&&U.set(D,Q),Q}function Kt(D){return D&&D.__esModule?D:{default:D}}function c9(D){return c9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},c9(D)}function Ht(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function cE(D,$){for(var U=0;U<$.length;U++){var Q=$[U];if(Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q)Q.writable=!0;Object.defineProperty(D,Nt(Q.key),Q)}}function Lt(D,$,U){if($)cE(D.prototype,$);if(U)cE(D,U);return Object.defineProperty(D,"prototype",{writable:!1}),D}function Nt(D){var $=Mt(D,"string");return c9($)=="symbol"?$:$+""}function Mt(D,$){if(c9(D)!="object"||!D)return D;var U=D[Symbol.toPrimitive];if(U!==void 0){var Q=U.call(D,$||"default");if(c9(Q)!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var sMD=rE.canStoreURLs=!0,eMD=rE.FileUrlStorage=function(){function D($){Ht(this,D),this.path=$}return Lt(D,[{key:"findAllUploads",value:function(){var U=this;return new Promise(function(Q,X){U._getItems("tus::",function(F,Y){if(F)X(F);else Q(Y)})})}},{key:"findUploadsByFingerprint",value:function(U){var Q=this;return new Promise(function(X,F){Q._getItems("tus::".concat(U),function(Y,J){if(Y)F(Y);else X(J)})})}},{key:"removeUpload",value:function(U){var Q=this;return new Promise(function(X,F){Q._removeItem(U,function(Y){if(Y)F(Y);else X()})})}},{key:"addUpload",value:function(U,Q){var X=this,F=Math.round(Math.random()*1000000000000),Y="tus::".concat(U,"::").concat(F);return new Promise(function(J,I){X._setItem(Y,Q,function(q){if(q)I(q);else J(Y)})})}},{key:"_setItem",value:function(U,Q,X){var F=this;iE.lock(this.path,this._lockfileOptions()).then(function(Y){X=F._releaseAndCb(Y,X),F._getData(function(J,I){if(J){X(J);return}I[U]=Q,F._writeData(I,function(q){return X(q)})})}).catch(X)}},{key:"_getItems",value:function(U,Q){this._getData(function(X,F){if(X){Q(X);return}var Y=Object.keys(F).filter(function(J){return J.startsWith(U)}).map(function(J){var I=F[J];return I.urlStorageKey=J,I});Q(null,Y)})}},{key:"_removeItem",value:function(U,Q){var X=this;iE.lock(this.path,this._lockfileOptions()).then(function(F){Q=X._releaseAndCb(F,Q),X._getData(function(Y,J){if(Y){Q(Y);return}delete J[U],X._writeData(J,function(I){return Q(I)})})}).catch(Q)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(U,Q){return function(X){if(X){U().then(function(){return Q(X)}).catch(function(F){return Q((0,zt.default)([X,F]))});return}U().then(Q).catch(Q)}}},{key:"_writeData",value:function(U,Q){var X={encoding:"utf8",mode:432,flag:"w"};(0,nE.writeFile)(this.path,JSON.stringify(U),X,function(F){return Q(F)})}},{key:"_getData",value:function(U){(0,nE.readFile)(this.path,"utf8",function(Q,X){if(Q){if(Q.code==="ENOENT")U(null,{});else U(Q);return}try{X=!X.trim().length?{}:JSON.parse(X)}catch(F){U(F);return}U(null,X)})}}])}()});var Jj=T((j6)=>{Object.defineProperty(j6,"__esModule",{value:!0});Object.defineProperty(j6,"DefaultHttpStack",{enumerable:!0,get:function(){return Dj.default}});Object.defineProperty(j6,"DetailedError",{enumerable:!0,get:function(){return Ot.default}});Object.defineProperty(j6,"FileUrlStorage",{enumerable:!0,get:function(){return $j.FileUrlStorage}});Object.defineProperty(j6,"StreamSource",{enumerable:!0,get:function(){return jt.default}});j6.Upload=void 0;Object.defineProperty(j6,"canStoreURLs",{enumerable:!0,get:function(){return $j.canStoreURLs}});j6.defaultOptions=void 0;Object.defineProperty(j6,"enableDebugLog",{enumerable:!0,get:function(){return Vt.enableDebugLog}});j6.isSupported=void 0;var Ot=v1(MJ()),Vt=wJ(),Rt=v1(lV()),OI=v1(VR()),At=v1(dR()),Et=v1(pR()),Dj=v1(qA()),jt=v1(bJ()),$j=aE();function v1(D){return D&&D.__esModule?D:{default:D}}function K8(D){return K8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},K8(D)}function Tt(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function tE(D,$){for(var U=0;U<$.length;U++){var Q=$[U];if(Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q)Q.writable=!0;Object.defineProperty(D,Xj(Q.key),Q)}}function St(D,$,U){if($)tE(D.prototype,$);if(U)tE(D,U);return Object.defineProperty(D,"prototype",{writable:!1}),D}function Pt(D,$,U){return $=TU($),Ct(D,Uj()?Reflect.construct($,U||[],TU(D).constructor):$.apply(D,U))}function Ct(D,$){if($&&(K8($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return bt(D)}function bt(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function Uj(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(Uj=function(){return!!D})()}function TU(D){return TU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},TU(D)}function vt(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)VI(D,$)}function VI(D,$){return VI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Q,X){return Q.__proto__=X,Q},VI(D,$)}function sE(D,$){var U=Object.keys(D);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(D);$&&(Q=Q.filter(function(X){return Object.getOwnPropertyDescriptor(D,X).enumerable})),U.push.apply(U,Q)}return U}function Z8(D){for(var $=1;$<arguments.length;$++){var U=arguments[$]!=null?arguments[$]:{};$%2?sE(Object(U),!0).forEach(function(Q){_t(D,Q,U[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(U)):sE(Object(U)).forEach(function(Q){Object.defineProperty(D,Q,Object.getOwnPropertyDescriptor(U,Q))})}return D}function _t(D,$,U){if($=Xj($),$ in D)Object.defineProperty(D,$,{value:U,enumerable:!0,configurable:!0,writable:!0});else D[$]=U;return D}function Xj(D){var $=kt(D,"string");return K8($)=="symbol"?$:$+""}function kt(D,$){if(K8(D)!="object"||!D)return D;var U=D[Symbol.toPrimitive];if(U!==void 0){var Q=U.call(D,$||"default");if(K8(Q)!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var eE=j6.defaultOptions=Z8(Z8({},OI.default.defaultOptions),{},{httpStack:new Dj.default,fileReader:new At.default,urlStorage:new Rt.default,fingerprint:Et.default}),$wD=j6.Upload=function(D){function $(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Tt(this,$),Q=Z8(Z8({},eE),Q),Pt(this,$,[U,Q])}return vt($,D),St($,null,[{key:"terminate",value:function(Q){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return X=Z8(Z8({},eE),X),OI.default.terminate(Q,X)}}])}(OI.default),UwD=j6.isSupported=!0});var N$;var H8=u(()=>{N$={name:"@capgo/cli",type:"module",version:"8.65.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});var AD;var _1=u(()=>{AD=class AD extends Error{context;constructor(D,$){super(D);this.name="CliUserError",this.context=$}}});import{platform as gt}from"node:os";import{version as ut}from"node:process";function WwD(D){qj=D}function yt(D){for(let $=0;$<D.length;$++)if(D.charCodeAt($)>255)return!1;return!0}function Ij(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function mt(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(D.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function AI(D,$){if($===void 0||$===null){if(RI.has(D.toLowerCase()))throw new AD(Ij(D));throw new AD(`HTTP header "${D}" is missing or invalid.`)}if(typeof $!=="string"){if(RI.has(D.toLowerCase()))throw new AD(Ij(D));throw new AD(`HTTP header "${D}" is missing or invalid.`)}if(!yt($)){if(RI.has(D.toLowerCase()))throw new AD(mt(D));throw new AD(`HTTP header "${D}" contains invalid characters (only ASCII is allowed).`)}return $}function T6(D){let $={capgo_api:ft,"x-cli-version":N$.version,"x-cli-command":qj,"x-cli-node":ut,"x-cli-os":gt()};if(D)for(let[U,Q]of Object.entries(D))$[U]=AI(U,Q);return $}var ft="2025-10-01",qj="",RI;var EI=u(()=>{H8();_1();RI=new Set(["authorization","capgkey","x-capgo-log-token"])});import{execFileSync as it}from"child_process";import ct from"path";function lt(D,$){if($===void 0)return!0;if(typeof $==="string")return D===$;if($ instanceof RegExp)return $.test(D);return $(D)}function nt(D,$,U){return{agent:{id:D.id,name:D.name},strategy:"environment",signal:$.name,value:U}}function ot(D,$){let U=[],Q=Bj($.command);for(let X of D)for(let F of X.process??[]){if(!F.pattern.test(Q))continue;U.push(at(X,F,{...$,command:Q}))}return U}function at(D,$,U){return{agent:{id:D.id,name:D.name},strategy:"process-tree",signal:$.pattern.toString(),value:`${U.pid}:${U.command}`}}function Wj(D,$){try{return it("ps",["-o",`${$}=`,"-p",String(D)],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return""}}function Bj(D){return ct.basename(D.trim()).replace(/^-+/,"")}function Gj(D={}){let $=D.agents??ht,U=D.strategies??tt(D.experimentalProcessTree),Q={env:D.env??process.env,pid:D.pid??process.pid,agents:$,maxProcessDepth:D.maxProcessDepth??20},X=U.flatMap((Y)=>Y.detect(Q)),F=st($,X,Q.env);if(F===void 0)return{detected:!1};return{detected:!0,agent:F}}function tt(D=!1){let $=[new dt];if(D)$.push(new rt);return $}function st(D,$,U){let Q=new Set($.map((X)=>X.agent.id));for(let X of D){if(!Q.has(X.id))continue;return{id:X.id,name:X.name,...et(X,U)}}return}function et(D,$){for(let U of D.sessionEnv??[]){let Q=$[U];if(Q!==void 0&&Q.length>0)return{sessionId:Q}}return{}}var ht,dt=class{name="environment";detect(D){let $=[];for(let U of D.agents)for(let Q of U.env??[]){let X=D.env[Q.name];if(X===void 0||!lt(X,Q.value))continue;$.push(nt(U,Q,X))}return $}},pt=class{read(D){let $=Wj(D,"comm"),U=Number.parseInt(Wj(D,"ppid"),10);if(!$||!Number.isInteger(U))return;return{pid:D,ppid:U,command:Bj($)}}},rt=class{constructor(D=new pt){this.reader=D}reader;name="process-tree";detect(D){let $=[],U=D.pid;for(let Q=0;Q<D.maxProcessDepth;Q+=1){let X=this.reader.read(U);if(X===void 0)break;if($.push(...ot(D.agents,X)),X.ppid===void 0||X.ppid<=1||X.ppid===U)break;U=X.ppid}return $}};var zj=u(()=>{ht=[{id:"codex",name:"Codex",env:[{name:"CODEX_CI",value:"1"},{name:"CODEX_SHELL",value:"1"},{name:"CODEX_THREAD_ID"}],process:[{pattern:/^codex$/i}],sessionEnv:["CODEX_THREAD_ID"]},{id:"cursor",name:"Cursor",env:[{name:"CURSOR_AGENT",value:"1"},{name:"CURSOR_CONVERSATION_ID"}],process:[{pattern:/^cursor$/i}],sessionEnv:["CURSOR_CONVERSATION_ID"]},{id:"claude-code",name:"Claude Code",env:[{name:"CLAUDECODE",value:"1"},{name:"CLAUDE_CODE_SESSION_ID"}],process:[{pattern:/^claude$/i}],sessionEnv:["CLAUDE_CODE_SESSION_ID"]},{id:"opencode",name:"OpenCode",env:[{name:"OPENCODE",value:"1"},{name:"OPENCODE_PID"}],process:[{pattern:/^opencode$/i}]},{id:"devin",name:"Devin",process:[{pattern:/devin/i}]},{id:"gemini",name:"Gemini CLI",env:[{name:"GEMINI_CLI",value:"1"}],process:[{pattern:/^gemini$/i}]},{id:"antigravity",name:"Antigravity",env:[{name:"ANTIGRAVITY_AGENT",value:"1"},{name:"ANTIGRAVITY_TRAJECTORY_ID"}],process:[{pattern:/^antigravity$/i}],sessionEnv:["ANTIGRAVITY_TRAJECTORY_ID"]},{id:"bolt",name:"Bolt",env:[{name:"BOLT_ENV"},{name:"BOLT_ORIGIN"},{name:"BOLT_SERVER_URL"}]},{id:"pi",name:"Pi",env:[{name:"PI_CODING_AGENT",value:"true"}]},{id:"replit",name:"Replit",env:[{name:"REPLIT_SESSION"}],sessionEnv:["REPLIT_SESSION"]},{id:"rork",name:"Rork",env:[{name:"RORK_API_URL"}]},{id:"kiro",name:"Kiro",env:[{name:"KIRO_SESSION_ID"}],process:[{pattern:/kiro/i}],sessionEnv:["KIRO_SESSION_ID"]},{id:"muse",name:"Muse Code",env:[{name:"MUSE_RELEASE_INFO"}]},{id:"cline",name:"Cline",env:[{name:"CLINE_WRAPPER_PATH"}],process:[{pattern:/^cline$/i}]},{id:"kilocode",name:"Kilo Code",env:[{name:"KILO",value:"1"},{name:"KILOCODE_VERSION"},{name:"KILO_RUN_ID"}],process:[{pattern:/^(kilo|kilocode)$/i}],sessionEnv:["KILO_RUN_ID"]},{id:"copilot",name:"GitHub Copilot CLI",env:[{name:"COPILOT_CLI",value:"1"},{name:"COPILOT_AGENT_SESSION_ID"},{name:"COPILOT_RUN_APP",value:"1"}],process:[{pattern:/^(github-copilot-cli|copilot)$/i}],sessionEnv:["COPILOT_AGENT_SESSION_ID"]}]});import{platform as Ds,release as $s}from"node:os";import{arch as Us,env as Xs,version as Qs}from"node:process";function VwD(D){jI=D}function RwD(){return jI}function Zj(D=Xs){let $=Gj({env:D}),U={cli_version:N$.version,node_version:Qs,os_platform:Ds(),os_arch:Us,os_release:$s(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"undefined",is_ci:p9.isCI,is_tty:Boolean(process.stdout.isTTY),invocation_source:jI,agent_invoker:$.detected};if($.detected&&$.agent)U.agent_identity=$.agent;if(p9.name)U.ci_provider=p9.name;return U}var p9,jI="cli";var Kj=u(()=>{zj();H8();p9=g0(GJ(),1)});import{AsyncLocalStorage as Fs}from"node:async_hooks";function jwD(D,$){return Lj.run(D,()=>Promise.resolve($()))}function Ys(){return Lj.getStore()}function TwD(){Nj=!0}function Mj(){return Nj}function SwD(D){wj=D}function Hj(D){try{wj?.(D)}catch{}}function CwD(D,$){let U;try{U=new URL(D).pathname}catch{U=D.split("?")[0]}let Q="/functions/v1/",X=U.indexOf(Q);if(X>=0){let q=U.slice(X+Q.length),W=0,B=q.length;while(W<B&&q[W]==="/")W+=1;while(B>W&&q[B-1]==="/")B-=1;let G=q.slice(W,B);return G?`${$} functions:${G}`:`${$} functions`}let F="/rest/v1/",Y=U.indexOf(F),J=Y>=0?U.slice(Y+F.length):U.replace(/^\//,"");if(J.startsWith("rpc/"))return`rpc:${J.slice(4).split("/")[0]}`;let I=J.split("/")[0]||U;return`${$} ${I}`}function Js(D){let $=D?.headers;if(!$)return;let U=$.get;if(typeof U==="function")return U.call($,"capgkey")??void 0;if(Array.isArray($))return $.find(([Q])=>Q.toLowerCase()==="capgkey")?.[1];return $.capgkey}function Oj(){return async($,U)=>{let Q=(U?.method??"GET").toUpperCase(),X=typeof $==="string"?$:$ instanceof URL?$.href:$.url,F=Ys(),Y=Js(U),J=Date.now();try{let I=await globalThis.fetch($,U);return Hj({url:X,method:Q,status:I.status,ok:I.ok,durationMs:Date.now()-J,source:F,apikey:Y}),I}catch(I){throw Hj({url:X,method:Q,status:0,ok:!1,durationMs:Date.now()-J,source:F,apikey:Y,error:I}),I}}}var Lj,Nj=!1,wj,PwD=5000;var Vj=u(()=>{Lj=new Fs});function Is(D,$){if(!J9(D)||!J9($))return!1;return B1(K$(D),K$($))}function qs(D,$,U){let Q=U?.trim()?`
|
|
89
|
+
GFS4: `),console.error(D)};if(!cD[z0]){if(YI=global[z0]||[],TE(cD,YI),cD.close=function(D){function $(U,Q){return D.call(cD,U,function(X){if(!X)jE();if(typeof Q==="function")Q.apply(this,arguments)})}return Object.defineProperty($,wU,{value:D}),$}(cD.close),cD.closeSync=function(D){function $(U){D.apply(cD,arguments),jE()}return Object.defineProperty($,wU,{value:D}),$}(cD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){S1(cD[z0]),DD("assert").equal(cD[z0].length,0)})}var YI;if(!global[z0])TE(global,cD[z0]);qI.exports=JI(ka(cD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!cD.__patched)qI.exports=JI(cD),cD.__patched=!0;function JI(D){va(D),D.gracefulify=JI,D.createReadStream=j,D.createWriteStream=E;var $=D.readFile;D.readFile=U;function U(b,R,P){if(typeof R==="function")P=R,R=null;return h(b,R,P);function h(i,v,k,A){return $(i,v,function(w){if(w&&(w.code==="EMFILE"||w.code==="ENFILE"))W8([h,[i,v,k],w,A||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var Q=D.writeFile;D.writeFile=X;function X(b,R,P,h){if(typeof P==="function")h=P,P=null;return i(b,R,P,h);function i(v,k,A,w,V){return Q(v,k,A,function(_){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Y;function Y(b,R,P,h){if(typeof P==="function")h=P,P=null;return i(b,R,P,h);function i(v,k,A,w,V){return F(v,k,A,function(_){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}var J=D.copyFile;if(J)D.copyFile=I;function I(b,R,P,h){if(typeof P==="function")h=P,P=0;return i(b,R,P,h);function i(v,k,A,w,V){return J(v,k,A,function(_){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}var q=D.readdir;D.readdir=B;var W=/^v[0-5]\./;function B(b,R,P){if(typeof R==="function")P=R,R=null;var h=W.test(process.version)?function(k,A,w,V){return q(k,i(k,A,w,V))}:function(k,A,w,V){return q(k,A,i(k,A,w,V))};return h(b,R,P);function i(v,k,A,w){return function(V,_){if(V&&(V.code==="EMFILE"||V.code==="ENFILE"))W8([h,[v,k,A],V,w||Date.now(),Date.now()]);else{if(_&&_.sort)_.sort();if(typeof A==="function")A.call(this,V,_)}}}}if(process.version.substr(0,4)==="v0.8"){var G=_a(D);M=G.ReadStream,L=G.WriteStream}var Z=D.ReadStream;if(Z)M.prototype=Object.create(Z.prototype),M.prototype.open=N;var z=D.WriteStream;if(z)L.prototype=Object.create(z.prototype),L.prototype.open=O;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(b){M=b},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return L},set:function(b){L=b},enumerable:!0,configurable:!0});var K=M;Object.defineProperty(D,"FileReadStream",{get:function(){return K},set:function(b){K=b},enumerable:!0,configurable:!0});var H=L;Object.defineProperty(D,"FileWriteStream",{get:function(){return H},set:function(b){H=b},enumerable:!0,configurable:!0});function M(b,R){if(this instanceof M)return Z.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function N(){var b=this;S(b.path,b.flags,b.mode,function(R,P){if(R){if(b.autoClose)b.destroy();b.emit("error",R)}else b.fd=P,b.emit("open",P),b.read()})}function L(b,R){if(this instanceof L)return z.apply(this,arguments),this;else return L.apply(Object.create(L.prototype),arguments)}function O(){var b=this;S(b.path,b.flags,b.mode,function(R,P){if(R)b.destroy(),b.emit("error",R);else b.fd=P,b.emit("open",P)})}function j(b,R){return new D.ReadStream(b,R)}function E(b,R){return new D.WriteStream(b,R)}var C=D.open;D.open=S;function S(b,R,P,h){if(typeof P==="function")h=P,P=null;return i(b,R,P,h);function i(v,k,A,w,V){return C(v,k,A,function(_,m){if(_&&(_.code==="EMFILE"||_.code==="ENFILE"))W8([i,[v,k,A,w],_,V||Date.now(),Date.now()]);else if(typeof w==="function")w.apply(this,arguments)})}}return D}function W8(D){S1("ENQUEUE",D[0].name,D[1]),cD[z0].push(D),II()}var MU;function jE(){var D=Date.now();for(var $=0;$<cD[z0].length;++$)if(cD[z0][$].length>2)cD[z0][$][3]=D,cD[z0][$][4]=D;II()}function II(){if(clearTimeout(MU),MU=void 0,cD[z0].length===0)return;var D=cD[z0].shift(),$=D[0],U=D[1],Q=D[2],X=D[3],F=D[4];if(X===void 0)S1("RETRY",$.name,U),$.apply(null,U);else if(Date.now()-X>=60000){S1("TIMEOUT",$.name,U);var Y=U.pop();if(typeof Y==="function")Y.call(null,Q)}else{var J=Date.now()-F,I=Math.max(F-X,1),q=Math.min(I*1.2,100);if(J>=q)S1("RETRY",$.name,U),$.apply(null,U.concat([X]));else cD[z0].push(D)}if(MU===void 0)MU=setTimeout(II,0)}});var PE=T((cMD,SE)=>{function Y$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}SE.exports=Y$;Y$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Y$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};Y$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var U=this._timeouts.shift();if(U===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),U=this._timeouts.shift();else return!1;var Q=this,X=setTimeout(function(){if(Q._attempts++,Q._operationTimeoutCb){if(Q._timeout=setTimeout(function(){Q._operationTimeoutCb(Q._attempts)},Q._operationTimeout),Q._options.unref)Q._timeout.unref()}Q._fn(Q._attempts)},U);if(this._options.unref)X.unref();return!0};Y$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var U=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){U._operationTimeoutCb()},U._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};Y$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};Y$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};Y$.prototype.start=Y$.prototype.try;Y$.prototype.errors=function(){return this._errors};Y$.prototype.attempts=function(){return this._attempts};Y$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,U=0;for(var Q=0;Q<this._errors.length;Q++){var X=this._errors[Q],F=X.message,Y=(D[F]||0)+1;if(D[F]=Y,Y>=U)$=X,U=Y}return $}});var bE=T((ua)=>{var ga=PE();ua.operation=function(D){var $=ua.timeouts(D);return new ga($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};ua.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var U in D)$[U]=D[U];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Q=[];for(var X=0;X<$.retries;X++)Q.push(this.createTimeout(X,$));if(D&&D.forever&&!Q.length)Q.push(this.createTimeout(X,$));return Q.sort(function(F,Y){return F-Y}),Q};ua.createTimeout=function(D,$){var U=$.randomize?Math.random()+1:1,Q=Math.round(U*$.minTimeout*Math.pow($.factor,D));return Q=Math.min(Q,$.maxTimeout),Q};ua.wrap=function(D,$,U){if($ instanceof Array)U=$,$=null;if(!U){U=[];for(var Q in D)if(typeof D[Q]==="function")U.push(Q)}for(var X=0;X<U.length;X++){var F=U[X],Y=D[F];D[F]=function(I){var q=ua.operation($),W=Array.prototype.slice.call(arguments,1),B=W.pop();W.push(function(G){if(q.retry(G))return;if(G)arguments[0]=q.mainError();B.apply(this,arguments)}),q.attempt(function(){I.apply(D,W)})}.bind(D,Y),D[F].options=$}}});var vE=T((rMD,OU)=>{OU.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")OU.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")OU.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var ZI=T((oMD,G8)=>{var dD=global.process,P1=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!P1(dD))G8.exports=function(){return function(){}};else{if(WI=DD("assert"),C1=vE(),BI=/^win/i.test(dD.platform),B8=DD("events"),typeof B8!=="function")B8=B8.EventEmitter;if(dD.__signal_exit_emitter__)Q0=dD.__signal_exit_emitter__;else Q0=dD.__signal_exit_emitter__=new B8,Q0.count=0,Q0.emitted={};if(!Q0.infinite)Q0.setMaxListeners(1/0),Q0.infinite=!0;G8.exports=function(D,$){if(!P1(global.process))return function(){};if(WI.equal(typeof D,"function","a callback must be provided for exit handler"),b1===!1)VU();var U="exit";if($&&$.alwaysLast)U="afterexit";var Q=function(){if(Q0.removeListener(U,D),Q0.listeners("exit").length===0&&Q0.listeners("afterexit").length===0)h9()};return Q0.on(U,D),Q},h9=function(){if(!b1||!P1(global.process))return;b1=!1,C1.forEach(function($){try{dD.removeListener($,d9[$])}catch(U){}}),dD.emit=l9,dD.reallyExit=RU,Q0.count-=1},G8.exports.unload=h9,A6=function($,U,Q){if(Q0.emitted[$])return;Q0.emitted[$]=!0,Q0.emit($,U,Q)},d9={},C1.forEach(function(D){d9[D]=function(){if(!P1(global.process))return;var U=dD.listeners(D);if(U.length===Q0.count){if(h9(),A6("exit",null,D),A6("afterexit",null,D),BI&&D==="SIGHUP")D="SIGINT";dD.kill(dD.pid,D)}}}),G8.exports.signals=function(){return C1},b1=!1,VU=function(){if(b1||!P1(global.process))return;b1=!0,Q0.count+=1,C1=C1.filter(function($){try{return dD.on($,d9[$]),!0}catch(U){return!1}}),dD.emit=zI,dD.reallyExit=GI},G8.exports.load=VU,RU=dD.reallyExit,GI=function($){if(!P1(global.process))return;dD.exitCode=$||0,A6("exit",dD.exitCode,null),A6("afterexit",dD.exitCode,null),RU.call(dD,dD.exitCode)},l9=dD.emit,zI=function($,U){if($==="exit"&&P1(global.process)){if(U!==void 0)dD.exitCode=U;var Q=l9.apply(this,arguments);return A6("exit",dD.exitCode,null),A6("afterexit",dD.exitCode,null),Q}else return l9.apply(this,arguments)}}var WI,C1,BI,B8,Q0,h9,A6,d9,b1,VU,RU,GI,l9,zI});var kE=T((la,KI)=>{var _E=Symbol();function ha(D,$,U){let Q=$[_E];if(Q)return $.stat(D,(F,Y)=>{if(F)return U(F);U(null,Y.mtime,Q)});let X=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,X,X,(F)=>{if(F)return U(F);$.stat(D,(Y,J)=>{if(Y)return U(Y);let I=J.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,_E,{value:I}),U(null,J.mtime,I)})})}function da(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}la.probe=ha;la.getMtime=da});var yE=T((sa,i9)=>{var ca=DD("path"),NI=R6(),pa=bE(),ra=ZI(),xE=kE(),e$={};function n9(D,$){return $.lockfilePath||`${D}.lock`}function MI(D,$,U){if(!$.realpath)return U(null,ca.resolve(D));$.fs.realpath(D,U)}function LI(D,$,U){let Q=n9(D,$);$.fs.mkdir(Q,(X)=>{if(!X)return xE.probe(Q,$.fs,(F,Y,J)=>{if(F)return $.fs.rmdir(Q,()=>{}),U(F);U(null,Y,J)});if(X.code!=="EEXIST")return U(X);if($.stale<=0)return U(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(Q,(F,Y)=>{if(F){if(F.code==="ENOENT")return LI(D,{...$,stale:0},U);return U(F)}if(!gE(Y,$))return U(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));uE(D,$,(J)=>{if(J)return U(J);LI(D,{...$,stale:0},U)})})})}function gE(D,$){return D.mtime.getTime()<Date.now()-$.stale}function uE(D,$,U){$.fs.rmdir(n9(D,$),(Q)=>{if(Q&&Q.code!=="ENOENT")return U(Q);U()})}function AU(D,$){let U=e$[D];if(U.updateTimeout)return;if(U.updateDelay=U.updateDelay||$.update,U.updateTimeout=setTimeout(()=>{U.updateTimeout=null,$.fs.stat(U.lockfilePath,(Q,X)=>{let F=U.lastUpdate+$.stale<Date.now();if(Q){if(Q.code==="ENOENT"||F)return HI(D,U,Object.assign(Q,{code:"ECOMPROMISED"}));return U.updateDelay=1000,AU(D,$)}if(U.mtime.getTime()!==X.mtime.getTime())return HI(D,U,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let J=xE.getMtime(U.mtimePrecision);$.fs.utimes(U.lockfilePath,J,J,(I)=>{let q=U.lastUpdate+$.stale<Date.now();if(U.released)return;if(I){if(I.code==="ENOENT"||q)return HI(D,U,Object.assign(I,{code:"ECOMPROMISED"}));return U.updateDelay=1000,AU(D,$)}U.mtime=J,U.lastUpdate=Date.now(),U.updateDelay=null,AU(D,$)})})},U.updateDelay),U.updateTimeout.unref)U.updateTimeout.unref()}function HI(D,$,U){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(e$[D]===$)delete e$[D];$.options.onCompromised(U)}function oa(D,$,U){$={stale:1e4,update:null,realpath:!0,retries:0,fs:NI,onCompromised:(Q)=>{throw Q},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),MI(D,$,(Q,X)=>{if(Q)return U(Q);let F=pa.operation($.retries);F.attempt(()=>{LI(X,$,(Y,J,I)=>{if(F.retry(Y))return;if(Y)return U(F.mainError());let q=e$[X]={lockfilePath:n9(X,$),mtime:J,mtimePrecision:I,options:$,lastUpdate:Date.now()};AU(X,$),U(null,(W)=>{if(q.released)return W&&W(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));fE(X,{...$,realpath:!1},W)})})})})}function fE(D,$,U){$={fs:NI,realpath:!0,...$},MI(D,$,(Q,X)=>{if(Q)return U(Q);let F=e$[X];if(!F)return U(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete e$[X],uE(X,$,U)})}function aa(D,$,U){$={stale:1e4,realpath:!0,fs:NI,...$},$.stale=Math.max($.stale||0,2000),MI(D,$,(Q,X)=>{if(Q)return U(Q);$.fs.stat(n9(X,$),(F,Y)=>{if(F)return F.code==="ENOENT"?U(null,!1):U(F);return U(null,!gE(Y,$))})})}function ta(){return e$}ra(()=>{for(let D in e$){let $=e$[D].options;try{$.fs.rmdirSync(n9(D,$))}catch(U){}}});sa.lock=oa;sa.unlock=fE;sa.check=aa;sa.getLocks=ta});var hE=T((aMD,mE)=>{var Xt=R6();function Qt(D){let $=["mkdir","realpath","stat","rmdir","utimes"],U={...D};return $.forEach((Q)=>{U[Q]=(...X)=>{let F=X.pop(),Y;try{Y=D[`${Q}Sync`](...X)}catch(J){return F(J)}F(null,Y)}}),U}function Ft(D){return(...$)=>new Promise((U,Q)=>{$.push((X,F)=>{if(X)Q(X);else U(F)}),D(...$)})}function Yt(D){return(...$)=>{let U,Q;if($.push((X,F)=>{U=X,Q=F}),D(...$),U)throw U;return Q}}function Jt(D){if(D={...D},D.fs=Qt(D.fs||Xt),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}mE.exports={toPromise:Ft,toSync:Yt,toSyncOptions:Jt}});var lE=T((tMD,E6)=>{var z8=yE(),{toPromise:EU,toSync:jU,toSyncOptions:wI}=hE();async function dE(D,$){let U=await EU(z8.lock)(D,$);return EU(U)}function It(D,$){let U=jU(z8.lock)(D,wI($));return jU(U)}function qt(D,$){return EU(z8.unlock)(D,$)}function Wt(D,$){return jU(z8.unlock)(D,wI($))}function Bt(D,$){return EU(z8.check)(D,$)}function Gt(D,$){return jU(z8.check)(D,wI($))}E6.exports=dE;E6.exports.lock=dE;E6.exports.unlock=qt;E6.exports.lockSync=It;E6.exports.unlockSync=Wt;E6.exports.check=Bt;E6.exports.checkSync=Gt});var aE=T((rE)=>{Object.defineProperty(rE,"__esModule",{value:!0});rE.canStoreURLs=rE.FileUrlStorage=void 0;var nE=DD("fs"),zt=Kt(NE()),iE=Zt(lE());function pE(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,U=new WeakMap;return(pE=function(Q){return Q?U:$})(D)}function Zt(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var U=pE($);if(U&&U.has(D))return U.get(D);var Q={__proto__:null},X=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Y=X?Object.getOwnPropertyDescriptor(D,F):null;Y&&(Y.get||Y.set)?Object.defineProperty(Q,F,Y):Q[F]=D[F]}return Q.default=D,U&&U.set(D,Q),Q}function Kt(D){return D&&D.__esModule?D:{default:D}}function c9(D){return c9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},c9(D)}function Ht(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function cE(D,$){for(var U=0;U<$.length;U++){var Q=$[U];if(Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q)Q.writable=!0;Object.defineProperty(D,Nt(Q.key),Q)}}function Lt(D,$,U){if($)cE(D.prototype,$);if(U)cE(D,U);return Object.defineProperty(D,"prototype",{writable:!1}),D}function Nt(D){var $=Mt(D,"string");return c9($)=="symbol"?$:$+""}function Mt(D,$){if(c9(D)!="object"||!D)return D;var U=D[Symbol.toPrimitive];if(U!==void 0){var Q=U.call(D,$||"default");if(c9(Q)!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var sMD=rE.canStoreURLs=!0,eMD=rE.FileUrlStorage=function(){function D($){Ht(this,D),this.path=$}return Lt(D,[{key:"findAllUploads",value:function(){var U=this;return new Promise(function(Q,X){U._getItems("tus::",function(F,Y){if(F)X(F);else Q(Y)})})}},{key:"findUploadsByFingerprint",value:function(U){var Q=this;return new Promise(function(X,F){Q._getItems("tus::".concat(U),function(Y,J){if(Y)F(Y);else X(J)})})}},{key:"removeUpload",value:function(U){var Q=this;return new Promise(function(X,F){Q._removeItem(U,function(Y){if(Y)F(Y);else X()})})}},{key:"addUpload",value:function(U,Q){var X=this,F=Math.round(Math.random()*1000000000000),Y="tus::".concat(U,"::").concat(F);return new Promise(function(J,I){X._setItem(Y,Q,function(q){if(q)I(q);else J(Y)})})}},{key:"_setItem",value:function(U,Q,X){var F=this;iE.lock(this.path,this._lockfileOptions()).then(function(Y){X=F._releaseAndCb(Y,X),F._getData(function(J,I){if(J){X(J);return}I[U]=Q,F._writeData(I,function(q){return X(q)})})}).catch(X)}},{key:"_getItems",value:function(U,Q){this._getData(function(X,F){if(X){Q(X);return}var Y=Object.keys(F).filter(function(J){return J.startsWith(U)}).map(function(J){var I=F[J];return I.urlStorageKey=J,I});Q(null,Y)})}},{key:"_removeItem",value:function(U,Q){var X=this;iE.lock(this.path,this._lockfileOptions()).then(function(F){Q=X._releaseAndCb(F,Q),X._getData(function(Y,J){if(Y){Q(Y);return}delete J[U],X._writeData(J,function(I){return Q(I)})})}).catch(Q)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(U,Q){return function(X){if(X){U().then(function(){return Q(X)}).catch(function(F){return Q((0,zt.default)([X,F]))});return}U().then(Q).catch(Q)}}},{key:"_writeData",value:function(U,Q){var X={encoding:"utf8",mode:432,flag:"w"};(0,nE.writeFile)(this.path,JSON.stringify(U),X,function(F){return Q(F)})}},{key:"_getData",value:function(U){(0,nE.readFile)(this.path,"utf8",function(Q,X){if(Q){if(Q.code==="ENOENT")U(null,{});else U(Q);return}try{X=!X.trim().length?{}:JSON.parse(X)}catch(F){U(F);return}U(null,X)})}}])}()});var Jj=T((j6)=>{Object.defineProperty(j6,"__esModule",{value:!0});Object.defineProperty(j6,"DefaultHttpStack",{enumerable:!0,get:function(){return Dj.default}});Object.defineProperty(j6,"DetailedError",{enumerable:!0,get:function(){return Ot.default}});Object.defineProperty(j6,"FileUrlStorage",{enumerable:!0,get:function(){return $j.FileUrlStorage}});Object.defineProperty(j6,"StreamSource",{enumerable:!0,get:function(){return jt.default}});j6.Upload=void 0;Object.defineProperty(j6,"canStoreURLs",{enumerable:!0,get:function(){return $j.canStoreURLs}});j6.defaultOptions=void 0;Object.defineProperty(j6,"enableDebugLog",{enumerable:!0,get:function(){return Vt.enableDebugLog}});j6.isSupported=void 0;var Ot=v1(MJ()),Vt=wJ(),Rt=v1(lV()),OI=v1(VR()),At=v1(dR()),Et=v1(pR()),Dj=v1(qA()),jt=v1(bJ()),$j=aE();function v1(D){return D&&D.__esModule?D:{default:D}}function K8(D){return K8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},K8(D)}function Tt(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function tE(D,$){for(var U=0;U<$.length;U++){var Q=$[U];if(Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q)Q.writable=!0;Object.defineProperty(D,Xj(Q.key),Q)}}function St(D,$,U){if($)tE(D.prototype,$);if(U)tE(D,U);return Object.defineProperty(D,"prototype",{writable:!1}),D}function Pt(D,$,U){return $=TU($),Ct(D,Uj()?Reflect.construct($,U||[],TU(D).constructor):$.apply(D,U))}function Ct(D,$){if($&&(K8($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return bt(D)}function bt(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function Uj(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(Uj=function(){return!!D})()}function TU(D){return TU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},TU(D)}function vt(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)VI(D,$)}function VI(D,$){return VI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Q,X){return Q.__proto__=X,Q},VI(D,$)}function sE(D,$){var U=Object.keys(D);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(D);$&&(Q=Q.filter(function(X){return Object.getOwnPropertyDescriptor(D,X).enumerable})),U.push.apply(U,Q)}return U}function Z8(D){for(var $=1;$<arguments.length;$++){var U=arguments[$]!=null?arguments[$]:{};$%2?sE(Object(U),!0).forEach(function(Q){_t(D,Q,U[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(U)):sE(Object(U)).forEach(function(Q){Object.defineProperty(D,Q,Object.getOwnPropertyDescriptor(U,Q))})}return D}function _t(D,$,U){if($=Xj($),$ in D)Object.defineProperty(D,$,{value:U,enumerable:!0,configurable:!0,writable:!0});else D[$]=U;return D}function Xj(D){var $=kt(D,"string");return K8($)=="symbol"?$:$+""}function kt(D,$){if(K8(D)!="object"||!D)return D;var U=D[Symbol.toPrimitive];if(U!==void 0){var Q=U.call(D,$||"default");if(K8(Q)!="object")return Q;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var eE=j6.defaultOptions=Z8(Z8({},OI.default.defaultOptions),{},{httpStack:new Dj.default,fileReader:new At.default,urlStorage:new Rt.default,fingerprint:Et.default}),$wD=j6.Upload=function(D){function $(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Tt(this,$),Q=Z8(Z8({},eE),Q),Pt(this,$,[U,Q])}return vt($,D),St($,null,[{key:"terminate",value:function(Q){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return X=Z8(Z8({},eE),X),OI.default.terminate(Q,X)}}])}(OI.default),UwD=j6.isSupported=!0});var N$;var H8=u(()=>{N$={name:"@capgo/cli",type:"module",version:"8.66.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"https://github.com/Cap-go/capgo.app",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs && bun test/test-android-select-guard.mjs","test:android-keystore-action":"bun test/test-android-keystore-action.mjs","test:android-google-play-action":"bun test/test-android-google-play-action.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:bundle-pages":"bun test test/test-bundle-pages.test.ts","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:builder-app-id-config":"bun test/test-builder-app-id-config.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:cordova-upload-mode":"bun test/test-cordova-upload-mode.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:builder-app-id-config && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:project-type-detection":"bun test/test-project-type-detection.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:apple-api-verify-key":"bun test/test-apple-api-verify-key.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-certificate-action":"bun test/test-ios-certificate-action.mjs","test:ios-credential-action":"bun test/test-ios-credential-action.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:cordova-upload-mode && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:android-keystore-action && bun run test:android-google-play-action && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:bundle-pages && bun run test:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && bun run test:builder-app-selection && bun run test:builder-login-gate && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:apple-api-verify-key && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:cicd-failure-help && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-upload-prompt && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-certificate-action && bun run test:ios-credential-action && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:builder-app-selection":"bun test/test-builder-app-selection.mjs","test:builder-login-gate":"bun test/test-builder-login-gate.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.5.4"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});var AD;var _1=u(()=>{AD=class AD extends Error{context;constructor(D,$){super(D);this.name="CliUserError",this.context=$}}});import{platform as gt}from"node:os";import{version as ut}from"node:process";function WwD(D){qj=D}function yt(D){for(let $=0;$<D.length;$++)if(D.charCodeAt($)>255)return!1;return!0}function Ij(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function mt(D){if(D.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(D.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function AI(D,$){if($===void 0||$===null){if(RI.has(D.toLowerCase()))throw new AD(Ij(D));throw new AD(`HTTP header "${D}" is missing or invalid.`)}if(typeof $!=="string"){if(RI.has(D.toLowerCase()))throw new AD(Ij(D));throw new AD(`HTTP header "${D}" is missing or invalid.`)}if(!yt($)){if(RI.has(D.toLowerCase()))throw new AD(mt(D));throw new AD(`HTTP header "${D}" contains invalid characters (only ASCII is allowed).`)}return $}function T6(D){let $={capgo_api:ft,"x-cli-version":N$.version,"x-cli-command":qj,"x-cli-node":ut,"x-cli-os":gt()};if(D)for(let[U,Q]of Object.entries(D))$[U]=AI(U,Q);return $}var ft="2025-10-01",qj="",RI;var EI=u(()=>{H8();_1();RI=new Set(["authorization","capgkey","x-capgo-log-token"])});import{execFileSync as it}from"child_process";import ct from"path";function lt(D,$){if($===void 0)return!0;if(typeof $==="string")return D===$;if($ instanceof RegExp)return $.test(D);return $(D)}function nt(D,$,U){return{agent:{id:D.id,name:D.name},strategy:"environment",signal:$.name,value:U}}function ot(D,$){let U=[],Q=Bj($.command);for(let X of D)for(let F of X.process??[]){if(!F.pattern.test(Q))continue;U.push(at(X,F,{...$,command:Q}))}return U}function at(D,$,U){return{agent:{id:D.id,name:D.name},strategy:"process-tree",signal:$.pattern.toString(),value:`${U.pid}:${U.command}`}}function Wj(D,$){try{return it("ps",["-o",`${$}=`,"-p",String(D)],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return""}}function Bj(D){return ct.basename(D.trim()).replace(/^-+/,"")}function Gj(D={}){let $=D.agents??ht,U=D.strategies??tt(D.experimentalProcessTree),Q={env:D.env??process.env,pid:D.pid??process.pid,agents:$,maxProcessDepth:D.maxProcessDepth??20},X=U.flatMap((Y)=>Y.detect(Q)),F=st($,X,Q.env);if(F===void 0)return{detected:!1};return{detected:!0,agent:F}}function tt(D=!1){let $=[new dt];if(D)$.push(new rt);return $}function st(D,$,U){let Q=new Set($.map((X)=>X.agent.id));for(let X of D){if(!Q.has(X.id))continue;return{id:X.id,name:X.name,...et(X,U)}}return}function et(D,$){for(let U of D.sessionEnv??[]){let Q=$[U];if(Q!==void 0&&Q.length>0)return{sessionId:Q}}return{}}var ht,dt=class{name="environment";detect(D){let $=[];for(let U of D.agents)for(let Q of U.env??[]){let X=D.env[Q.name];if(X===void 0||!lt(X,Q.value))continue;$.push(nt(U,Q,X))}return $}},pt=class{read(D){let $=Wj(D,"comm"),U=Number.parseInt(Wj(D,"ppid"),10);if(!$||!Number.isInteger(U))return;return{pid:D,ppid:U,command:Bj($)}}},rt=class{constructor(D=new pt){this.reader=D}reader;name="process-tree";detect(D){let $=[],U=D.pid;for(let Q=0;Q<D.maxProcessDepth;Q+=1){let X=this.reader.read(U);if(X===void 0)break;if($.push(...ot(D.agents,X)),X.ppid===void 0||X.ppid<=1||X.ppid===U)break;U=X.ppid}return $}};var zj=u(()=>{ht=[{id:"codex",name:"Codex",env:[{name:"CODEX_CI",value:"1"},{name:"CODEX_SHELL",value:"1"},{name:"CODEX_THREAD_ID"}],process:[{pattern:/^codex$/i}],sessionEnv:["CODEX_THREAD_ID"]},{id:"cursor",name:"Cursor",env:[{name:"CURSOR_AGENT",value:"1"},{name:"CURSOR_CONVERSATION_ID"}],process:[{pattern:/^cursor$/i}],sessionEnv:["CURSOR_CONVERSATION_ID"]},{id:"claude-code",name:"Claude Code",env:[{name:"CLAUDECODE",value:"1"},{name:"CLAUDE_CODE_SESSION_ID"}],process:[{pattern:/^claude$/i}],sessionEnv:["CLAUDE_CODE_SESSION_ID"]},{id:"opencode",name:"OpenCode",env:[{name:"OPENCODE",value:"1"},{name:"OPENCODE_PID"}],process:[{pattern:/^opencode$/i}]},{id:"devin",name:"Devin",process:[{pattern:/devin/i}]},{id:"gemini",name:"Gemini CLI",env:[{name:"GEMINI_CLI",value:"1"}],process:[{pattern:/^gemini$/i}]},{id:"antigravity",name:"Antigravity",env:[{name:"ANTIGRAVITY_AGENT",value:"1"},{name:"ANTIGRAVITY_TRAJECTORY_ID"}],process:[{pattern:/^antigravity$/i}],sessionEnv:["ANTIGRAVITY_TRAJECTORY_ID"]},{id:"bolt",name:"Bolt",env:[{name:"BOLT_ENV"},{name:"BOLT_ORIGIN"},{name:"BOLT_SERVER_URL"}]},{id:"pi",name:"Pi",env:[{name:"PI_CODING_AGENT",value:"true"}]},{id:"replit",name:"Replit",env:[{name:"REPLIT_SESSION"}],sessionEnv:["REPLIT_SESSION"]},{id:"rork",name:"Rork",env:[{name:"RORK_API_URL"}]},{id:"kiro",name:"Kiro",env:[{name:"KIRO_SESSION_ID"}],process:[{pattern:/kiro/i}],sessionEnv:["KIRO_SESSION_ID"]},{id:"muse",name:"Muse Code",env:[{name:"MUSE_RELEASE_INFO"}]},{id:"cline",name:"Cline",env:[{name:"CLINE_WRAPPER_PATH"}],process:[{pattern:/^cline$/i}]},{id:"kilocode",name:"Kilo Code",env:[{name:"KILO",value:"1"},{name:"KILOCODE_VERSION"},{name:"KILO_RUN_ID"}],process:[{pattern:/^(kilo|kilocode)$/i}],sessionEnv:["KILO_RUN_ID"]},{id:"copilot",name:"GitHub Copilot CLI",env:[{name:"COPILOT_CLI",value:"1"},{name:"COPILOT_AGENT_SESSION_ID"},{name:"COPILOT_RUN_APP",value:"1"}],process:[{pattern:/^(github-copilot-cli|copilot)$/i}],sessionEnv:["COPILOT_AGENT_SESSION_ID"]}]});import{platform as Ds,release as $s}from"node:os";import{arch as Us,env as Xs,version as Qs}from"node:process";function VwD(D){jI=D}function RwD(){return jI}function Zj(D=Xs){let $=Gj({env:D}),U={cli_version:N$.version,node_version:Qs,os_platform:Ds(),os_arch:Us,os_release:$s(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"undefined",is_ci:p9.isCI,is_tty:Boolean(process.stdout.isTTY),invocation_source:jI,agent_invoker:$.detected};if($.detected&&$.agent)U.agent_identity=$.agent;if(p9.name)U.ci_provider=p9.name;return U}var p9,jI="cli";var Kj=u(()=>{zj();H8();p9=g0(GJ(),1)});import{AsyncLocalStorage as Fs}from"node:async_hooks";function jwD(D,$){return Lj.run(D,()=>Promise.resolve($()))}function Ys(){return Lj.getStore()}function TwD(){Nj=!0}function Mj(){return Nj}function SwD(D){wj=D}function Hj(D){try{wj?.(D)}catch{}}function CwD(D,$){let U;try{U=new URL(D).pathname}catch{U=D.split("?")[0]}let Q="/functions/v1/",X=U.indexOf(Q);if(X>=0){let q=U.slice(X+Q.length),W=0,B=q.length;while(W<B&&q[W]==="/")W+=1;while(B>W&&q[B-1]==="/")B-=1;let G=q.slice(W,B);return G?`${$} functions:${G}`:`${$} functions`}let F="/rest/v1/",Y=U.indexOf(F),J=Y>=0?U.slice(Y+F.length):U.replace(/^\//,"");if(J.startsWith("rpc/"))return`rpc:${J.slice(4).split("/")[0]}`;let I=J.split("/")[0]||U;return`${$} ${I}`}function Js(D){let $=D?.headers;if(!$)return;let U=$.get;if(typeof U==="function")return U.call($,"capgkey")??void 0;if(Array.isArray($))return $.find(([Q])=>Q.toLowerCase()==="capgkey")?.[1];return $.capgkey}function Oj(){return async($,U)=>{let Q=(U?.method??"GET").toUpperCase(),X=typeof $==="string"?$:$ instanceof URL?$.href:$.url,F=Ys(),Y=Js(U),J=Date.now();try{let I=await globalThis.fetch($,U);return Hj({url:X,method:Q,status:I.status,ok:I.ok,durationMs:Date.now()-J,source:F,apikey:Y}),I}catch(I){throw Hj({url:X,method:Q,status:0,ok:!1,durationMs:Date.now()-J,source:F,apikey:Y,error:I}),I}}}var Lj,Nj=!1,wj,PwD=5000;var Vj=u(()=>{Lj=new Fs});function Is(D,$){if(!J9(D)||!J9($))return!1;return B1(K$(D),K$($))}function qs(D,$,U){let Q=U?.trim()?`
|
|
90
90
|
${U.trim()}`:"";return`This Capgo API requires @capgo/cli@${$} or newer. You are using @capgo/cli@${D}.${Q}
|
|
91
91
|
Please update: npx @capgo/cli@latest`}function Rj(D,$,U=!1){let Q=$||N$.version,X=D.minCliVersion?.trim();if(!X||!Is(Q,X))return;let F=qs(Q,X,D.minCliVersionReason);if(!U)SD.error(F);throw new AD(F,{minCliVersion:X,currentVersion:Q})}var Aj=u(()=>{L6();oY();H8();_1()});function Ej(D,$){let Q=["normal","bold","dim","italic","underline","strikethrough"].indexOf(D),X="\x1B[";return"\x1B["+Q+"m"+$+"\x1B[0m"}var r9;var jj=u(()=>{r9=class r9{title=null;headers=[];rows=[];static narrowTheme={top:["╔","═","╤","╗"],row:["║"," ","│","║"],div:["╟","─","┼","╢"],bot:["╚","═","╧","╝"]};static wideTheme={top:["╔═","═","═╤═","═╗"],row:["║ "," "," │ "," ║"],div:["╟─","─","─┼─","─╢"],bot:["╚═","═","═╧═","═╝"]};static roundTheme={top:["╭─","─","─┬─","─╮"],row:["│ "," "," │ "," │"],div:["├─","─","─┼─","─┤"],bot:["╰─","─","─┴─","─╯"]};theme=r9.wideTheme;columnWidth(){let D=[this.headers,...this.rows].filter((U)=>U.length>0),$=D[0].map((U)=>this.cast(U).length);for(let U of D.slice(1))for(let Q=0;Q<$.length;Q++){let X=this.cast(U[Q]).length;if(X>$[Q])$[Q]=X}return $}cast(D){if(typeof D==="object")return"obj";if(D!==void 0&&typeof D.toString==="function")return D.toString();else return""}renderTitle(){return"[ "+this.title+" ]"}renderLine(D){let $=this.columnWidth();return D[0]+$.map((U)=>D[1].repeat(U)).join(D[2])+D[3]}renderCell(D,$,U=!1){let Q=this.cast(D),X=U?Ej("bold",Q):Q,F=$-Q.length,Y=this.theme.row[1];switch(typeof D){case"number":return Y.repeat(F)+X;case"string":return X+Y.repeat(F);case"boolean":case"object":return Y.repeat(Math.ceil(F/2))+Ej("italic",Q)+Y.repeat(Math.floor(F/2));default:return Y.repeat(F)}}renderRow(D,$=!1){let U=this.theme.row,Q=this.columnWidth();return U[0]+D.map((X,F)=>this.renderCell(X,Q[F],$)).join(U[2])+U[3]}toString(){let D=this.theme,$=this.headers.length>0,U=this.rows.length>0;return[this.title?this.renderTitle():"",$||U?this.renderLine(D.top):"",$?this.renderRow(this.headers,!0):"",$&&U?this.renderLine(D.div):"",...this.rows.map((Q)=>this.renderRow(Q)),$||U?this.renderLine(D.bot):""].filter((Q)=>Q.length>0).join(`
|
|
92
92
|
`)}}});var Tj=u(()=>{jj()});async function Sj(D){try{let U=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,Q=await fetch(U,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!Q.ok)return null;return(await Q.json())["dist-tags"]?.latest||null}catch{return null}}async function Ws(){let D=await Sj("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:N$.version,latestVersion:D,isOutdated:!!D&&D!==N$.version,majorVersion:$}}async function Pj(D={warn:($)=>SD.warning($)}){let{isOutdated:$,currentVersion:U,latestVersion:Q,majorVersion:X}=await Ws();if($)D.warn(`\uD83D\uDEA8 You are using @capgo/cli@${U} it's not the latest version.
|
|
@@ -246,8 +246,8 @@ Please generate a new API key with a shorter expiration:
|
|
|
246
246
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var Lg=u(()=>{Hg()});import{promisify as m7D}from"node:util";import{execFile as h7D}from"node:child_process";async function aH(D=d7D){let{stdout:$}=await D("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),U=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec($);if(!U)throw new Ng(`Cannot find Windows browser in stdout: ${JSON.stringify($)}`);let{id:Q}=U.groups,X=Q.lastIndexOf("."),F=Q.lastIndexOf("-"),Y=X===-1?void 0:Q.slice(0,X),J=F===-1?void 0:Q.slice(0,F);return BF[Q]??BF[Y]??BF[J]??{name:Q,id:Q}}var d7D,BF,GF,Ng;var tH=u(()=>{d7D=m7D(h7D),BF={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},GF=new Map(Object.entries(BF));Ng=class Ng extends Error{}});import{promisify as l7D}from"node:util";import sH from"node:process";import{execFile as n7D}from"node:child_process";async function eH(){if(sH.platform==="darwin"){let D=await rH();return{name:await oH(D),id:D}}if(sH.platform==="linux"){let{stdout:D}=await i7D("xdg-mime",["query","default","x-scheme-handler/http"]),$=D.trim();return{name:c7D($.replace(/.desktop$/,"").replace("-"," ")),id:$}}if(sH.platform==="win32")return aH();throw Error("Only macOS, Linux, and Windows are supported")}var i7D,c7D=(D)=>D.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,($)=>$.toUpperCase());var Mg=u(()=>{Zg();Lg();tH();tH();i7D=l7D(n7D)});import DL from"node:process";var p7D,wg;var Og=u(()=>{p7D=Boolean(DL.env.SSH_CONNECTION||DL.env.SSH_CLIENT||DL.env.SSH_TTY),wg=p7D});var Tg={};N0(Tg,{openApp:()=>e7D,default:()=>DUD,apps:()=>z4});import $L from"node:process";import jg from"node:path";import{fileURLToPath as r7D}from"node:url";import o7D from"node:child_process";import a7D,{constants as t7D}from"node:fs/promises";function Eg(D){if(typeof D==="string"||Array.isArray(D))return D;let{[Rg]:$}=D;if(!$)throw Error(`${Rg} is not supported`);return $}function N5({[R2]:D},{wsl:$}={}){if($&&Y6)return Eg($);if(!D)throw Error(`${R2} is not supported`);return Eg(D)}var zF,UL,Vg,R2,Rg,Ag=async(D,$)=>{if(D.length===0)return;let U=[];for(let Q of D)try{return await $(Q)}catch(X){U.push(X)}throw AggregateError(U,"Failed to open in all supported apps")},L5=async(D)=>{D={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...D};let $=D[zF]===!0;if(delete D[zF],Array.isArray(D.app))return Ag(D.app,(q)=>L5({...D,app:q,[zF]:!0}));let{name:U,arguments:Q=[]}=D.app??{};if(Q=[...Q],Array.isArray(U))return Ag(U,(q)=>L5({...D,app:{name:q,arguments:Q},[zF]:!0}));if(U==="browser"||U==="browserPrivate"){let q={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},W={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},B;if(Y6){let G=await Bg();B=GF.get(G)??{}}else B=await eH();if(B.id in q){let G=q[B.id.toLowerCase()];if(U==="browserPrivate"){if(G==="safari")throw Error("Safari doesn't support opening in private mode via command line");Q.push(W[G])}return L5({...D,app:{name:z4[G],arguments:Q}})}throw Error(`${B.name} is not supported as a default browser`)}let X,F=[],Y={},J=!1;if(Y6&&!B4()&&!wg&&!U)J=await Wg();if(R2==="darwin"){if(X="open",D.wait)F.push("--wait-apps");if(D.background)F.push("--background");if(D.newInstance)F.push("--new");if(U)F.push("-a",U)}else if(R2==="win32"||J){if(X=await WF(),F.push(...D$.argumentsPrefix),!Y6)Y.windowsVerbatimArguments=!0;if(Y6&&D.target)D.target=await Gg(D.target);let q=["$ProgressPreference = 'SilentlyContinue';","Start"];if(D.wait)q.push("-Wait");if(U){if(q.push(D$.escapeArgument(U)),D.target)Q.push(D.target)}else if(D.target)q.push(D$.escapeArgument(D.target));if(Q.length>0)Q=Q.map((W)=>D$.escapeArgument(W)),q.push("-ArgumentList",Q.join(","));if(D.target=D$.encodeCommand(q.join(" ")),!D.wait)Y.stdio="ignore"}else{if(U)X=U;else{let q=!UL||UL==="/",W=!1;try{await a7D.access(Vg,t7D.X_OK),W=!0}catch{}X=$L.versions.electron??(R2==="android"||q||!W)?"xdg-open":Vg}if(Q.length>0)F.push(...Q);if(!D.wait)Y.stdio="ignore",Y.detached=!0}if(R2==="darwin"&&Q.length>0)F.push("--args",...Q);if(D.target)F.push(D.target);let I=o7D.spawn(X,F,Y);if(D.wait)return new Promise((q,W)=>{I.once("error",W),I.once("close",(B)=>{if(!D.allowNonzeroExitCode&&B!==0){W(Error(`Exited with code ${B}`));return}q(I)})});if($)return new Promise((q,W)=>{I.once("error",W),I.once("spawn",()=>{I.once("close",(B)=>{if(I.off("error",W),B!==0){W(Error(`Exited with code ${B}`));return}I.unref(),q(I)})})});return I.unref(),new Promise((q,W)=>{I.once("error",W),I.once("spawn",()=>{I.off("error",W),q(I)})})},s7D=(D,$)=>{if(typeof D!=="string")throw TypeError("Expected a `target`");return L5({...$,target:D})},e7D=(D,$)=>{if(typeof D!=="string"&&!Array.isArray(D))throw TypeError("Expected a valid `name`");let{arguments:U=[]}=$??{};if(U!==void 0&&U!==null&&!Array.isArray(U))throw TypeError("Expected `appArguments` as Array type");return L5({...$,app:{name:D,arguments:U}})},z4,DUD;var Sg=u(()=>{zg();cH();Mg();dH();Og();zF=Symbol("fallbackAttempt"),UL=import.meta.url?jg.dirname(r7D(import.meta.url)):"",Vg=jg.join(UL,"xdg-open"),{platform:R2,arch:Rg}=$L;z4={browser:"browser",browserPrivate:"browserPrivate"};G4(z4,"chrome",()=>N5({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));G4(z4,"brave",()=>N5({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));G4(z4,"firefox",()=>N5({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));G4(z4,"edge",()=>N5({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));G4(z4,"safari",()=>N5({darwin:"Safari"}));DUD=s7D});import{spawn as $UD}from"node:child_process";import{existsSync as BD,readdirSync as E2,readFileSync as sD,statSync as UUD}from"node:fs";import{homedir as xg,platform as gg}from"node:os";import L4,{dirname as J6,join as KD,relative as ug,resolve as hD,sep as fg}from"node:path";import{cwd as G0,env as K4,stdin as yg,stdout as mg}from"node:process";function ZF(D,$){let U=hj();if(U)U[D]($);else SD[D]($)}function dg(D=""){if(!D)return NF;return`${NF}${D.startsWith("/")?D:`/${D}`}`}function nSD(D){let $=qUD.toLocaleString("en-US");return[`Delta updates cannot upload this bundle: it has ${D.toLocaleString("en-US")} files, and Capgo allows at most ${$} files per delta (manifest) upload.`,"Delta mode tracks and uploads each file individually so devices can download only what changed. Very large file counts are not supported on that path.","What you can do:","1. Upload a full zip instead: npx @capgo/cli@latest bundle upload --no-delta","2. Or reduce files in your web build output (remove unused assets, avoid copying large trees into dist).","See https://capgo.app/docs/faq/#are-there-delta-update-file-path-limitations"].join(`
|
|
247
247
|
`)}function cSD(D){return[`Bundle upload timed out after ${Math.round(D/1000)}s.`,"The standard upload has to finish the whole transfer within this window and does not retry, so a large bundle or a slow connection can trip it.","What you can do:","1. Retry with the resumable upload, which uploads in chunks and retries automatically: npx @capgo/cli@latest bundle upload --tus","2. Or raise the limit for the standard upload: npx @capgo/cli@latest bundle upload --timeout <milliseconds>"].join(`
|
|
248
248
|
`)}function w0(D){if(!D)return"Unknown error";if(fH(D).isSecurityPolicyError)return Dg(D);let U=D;if(typeof D==="string")return D;if(D instanceof Error){let Q=U.message||U.cause?.message||U.stack||D.name,X=U.cause?.name,F=Q.toLowerCase();if(F.includes("fetch failed")||F.includes("failed to fetch")||F.includes("connect timeout")||F.includes("network")||X?.startsWith("UND_ERR"))return`Network error: ${Q}${U.code?` (code ${U.code})`:""}. Check your network connection and API endpoint availability.`;let Y=U.status||U.statusCode;return[Q,U.code?`Code: ${U.code}`:void 0,Y?`Status: ${Y}`:void 0].filter(Boolean).join(" | ")||D.name}if(U.message){let Q=[U.message,U.code?`Code: ${U.code}`:void 0,U.status||U.statusCode?`Status: ${U.status||U.statusCode}`:void 0].filter(Boolean).join(" | "),X=U.message.toLowerCase();if(X.includes("fetch failed")||X.includes("failed to fetch")||U.error==="Failed to fetch")return`Network error: ${Q}. Check your network connection and API endpoint availability.`;if(U.details||U.hint||U.error)return`${Q}${Q?" | ":""}${U.error?typeof U.error==="string"?U.error:U.error.message??"":""}${U.details?`Details: ${U.details}`:""}${U.hint?`Hint: ${U.hint}`:""}`.trim();return Q}if(typeof U.error==="string"&&U.error.length>0)return U.error;if(U.error&&typeof U.error==="object"&&typeof U.error.message==="string"&&U.error.message.length>0)return U.error.message;return`
|
|
249
|
-
${hg.default.render(D)}`}async function rSD(D,$,U=!1){let{data:Q,error:X}=await ox(()=>D.rpc("reject_access_due_to_2fa_for_org",{org_id:$}));if(X){if(!U&&!V2(X))r.error(`Cannot check 2FA compliance: ${X.message}`);if(V2(X)){await ax({silent:U,telemetryFunctionName:"check2FAAccessForOrg"});return}tx(X)}if(Q){if(!U)r.error(`\uD83D\uDD10 Access Denied: 2FA Required. Enable 2FA at ${dg("/settings/account")}`);throw Error("2FA required for this organization")}}function oSD({silent:D=!1,stdinIsTTY:$=!!yg.isTTY,stdoutIsTTY:U=!!mg.isTTY,ci:Q=qL.isCI}={}){return!D&&$&&U&&!Q}function WUD(D={}){let $=D.ci??qL.isCI,U=D.stdinIsTTY??!!yg.isTTY,Q=D.stdoutIsTTY??!!mg.isTTY,X=D.platform??gg(),F="display"in D?D.display:K4.DISPLAY;if($||!U||!Q)return!1;if(X==="linux"&&!F)return!1;return!0}async function BUD(D){if(!WUD())return;try{await(await Promise.resolve().then(() => (Sg(),Tg))).default(D)}catch($){if($?.code==="ENOENT")return}}function aSD(D){return Pq(D)||Cq(D)}function I6(D){if(Pq(D))return Zb(D);else if(Cq(D))return Kb(D);return D}function lg(D=I6(G0()),$=void 0){let U=$?.split(",")[0],Q=U??KD(D,i0);if(!BD(Q)){let F=U?`Package.json at ${Q} does not exist`:`No package.json found at ${Q}. Run this command from your project root (the folder that contains package.json), or pass --package-json <path> to point at it (for example in a monorepo).`;throw r.error(F),Error(F)}let X=sD(Q);return JSON.parse(X)}function tSD(D=I6(G0()),$=void 0){return lg(D,$).scripts}function sSD(D=I6(G0()),$=void 0){return lg(D,$).version??""}function GUD(D){let $=D.replace("^","").replace("~","");if(J9($))try{let U=K$($);return nY(U)}catch{return $}return $}async function eSD(D,$=G0(),U){let Q=U?U.split(",").map((Y)=>Y.trim()).filter(Boolean):[],X=[],F=(Y)=>{let J=hD(Y);if(!X.includes(J))X.push(J)};for(let Y of Q){let J=hD($,Y);if(BD(J))F(J6(J))}F(hD($)),F(G0());for(let Y of X)try{let J=`${D}/package.json`,{createRequire:I}=await import("node:module"),W=I(KD(Y,"package.json")).resolve(J),B=JSON.parse(sD(W,"utf-8"));if(B.version)return B.version}catch{}for(let Y of X){let J=Y,I=L4.parse(J).root;while(J!==I){let q=KD(J,"node_modules",D,i0);if(BD(q))try{let B=JSON.parse(sD(q,"utf-8"));if(B.version)return B.version}catch{}let W=J6(J);if(W===J)break;J=W}}if(D==="@capgo/capacitor-updater"){let Y=null,J=KD($,"ios","App","Podfile");if(BD(J))try{let q=sD(J,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);if(q?.[1])Y=hD(KD($,"ios","App",q[1]))}catch{}if(!Y){let I=KD($,"android","capacitor.settings.gradle");if(BD(I))try{let W=sD(I,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);if(W?.[1])Y=hD(KD($,"android",W[1])).replace(/\/android$/,"")}catch{}}if(Y){let I=KD(Y,i0);if(BD(I))try{let q=JSON.parse(sD(I,"utf-8"));if(q.version)return q.version}catch{}}}try{let Y=U?U.split(",").map((q)=>q.trim()).filter(Boolean).join(","):U,I=(await OF($,Y)).get(D);if(I)return I}catch{}return null}async function OF(D=I6(G0()),$=void 0){let U=$?.split(",").map((F)=>F.trim()).filter(Boolean);if(U??=[KD(D,i0)],U){for(let F of U)if(!BD(F)){let Y=`Package.json at ${F} does not exist`;throw r.error(Y),Error(Y)}}let Q=new Map,{createRequire:X}=await import("node:module");for(let F of U){let Y=sD(F),J=JSON.parse(Y),I=J6(F),q=(W,B)=>{try{let K=X(KD(I,"package.json")).resolve(`${W}/package.json`),H=JSON.parse(sD(K,"utf-8"));if(H.version)return H.version}catch{}let G=I,Z=L4.parse(G).root;while(G!==Z){let z=KD(G,"node_modules",W,i0);if(BD(z))try{let H=JSON.parse(sD(z,"utf-8"));if(H.version)return H.version}catch{}let K=J6(G);if(K===G)break;G=K}return GUD(B)};for(let W in J.dependencies)Q.set(W,q(W,J.dependencies[W]));for(let W in J.devDependencies)Q.set(W,q(W,J.devDependencies[W]))}return Q}async function zUD(D=I6(G0()),$=void 0){let U=$?.split(",").map((X)=>X.trim()).filter(Boolean);if(U??=[KD(D,i0)],U){for(let X of U)if(!BD(X)){let F=`Package.json at ${X} does not exist`;throw r.error(F),Error(F)}}let Q=new Map;for(let X of U){let F=sD(X),Y=JSON.parse(F);for(let J in Y.dependencies??{})if(typeof Y.dependencies[J]==="string")Q.set(J,Y.dependencies[J]);for(let J in Y.devDependencies??{})if(typeof Y.devDependencies[J]==="string")Q.set(J,Y.devDependencies[J])}return Q}function ZUD(D){if(!D)return!1;if(D.config&&Object.keys(D.config).length>0)return!0;return!!D.path&&BD(D.path)}async function ng(D,$=!1){let U=KUD;try{let Q=await D();if(!ZUD(Q)){if(!$)r.error(U);throw new AD(U)}return Q}catch(Q){if(Q instanceof AD)throw Q;let X=w0(Q);if(!$)r.error(`${U}: ${X}`);throw new AD(U,{cause:X})}}function SI(D=!1){return ng(fq,D)}function HUD(D=!1){return ng(yq,D)}async function LUD(D,$){let U=await HUD();if(U?.config)U.config.plugins??={},U.config.plugins.extConfig??={},U.config.plugins[D]??={},U.config.plugins[D]={...U.config.plugins[D],...$},await mq(D,U);return U}async function DPD(D){return LUD("CapacitorUpdater",D)}async function k1(D=!1){try{let $=await SI(D),U={host:$?.config?.plugins?.CapacitorUpdater?.localHost||Pg,hostWeb:$?.config?.plugins?.CapacitorUpdater?.localWebHost||NF,hostFilesApi:$?.config?.plugins?.CapacitorUpdater?.localApiFiles||Cg,hostApi:$?.config?.plugins?.CapacitorUpdater?.localApi||t6};if($?.config?.plugins?.CapacitorUpdater?.localSupa&&$?.config?.plugins?.CapacitorUpdater?.localSupaAnon){if(!D)r.info("Using custom supabase instance from capacitor.config.json");U.supaKey=$?.config?.plugins?.CapacitorUpdater?.localSupaAnon,U.supaHost=$?.config?.plugins?.CapacitorUpdater?.localSupa}return U}catch{return{host:Pg,hostWeb:NF,hostFilesApi:Cg,hostApi:t6}}}function vg(D){return typeof D==="object"&&D!==null}function NUD(D){if(!vg(D))return!1;let $=D.capacitor;if(vg($)&&($.ios!==void 0||$.android!==void 0))return!0;return!1}function MUD(D){if(BD(KD(D,"plugin.xml")))return!0;let $=KD(D,i0);if(!BD($))return!1;try{return NUD(JSON.parse(sD($,"utf-8")))}catch{return!1}}async function M5(D=!1,$){let U=(X)=>{let F={...X};return Rj(F,void 0,D),F};if(!$&&XL)return U(XL);if(!$&&KF)return KF.then(U);let Q=(async()=>{let X=await k1(D);try{let F=RF(),Y=await fetch(`${X.hostApi}/private/config`,{...$?{signal:$}:{},headers:T6(F?{capgkey:F}:void 0)});if(!Y.ok)throw Error(`HTTP error! status: ${Y.status}`);let I={...await Y.json(),...X};if(!$)XL=I;return{...I}}catch{if(!D)r.info(`Local config ${w0(X)}`);return{...X}}finally{if(!$)KF=null}})();if(!$)KF=Q;return Q.then(U)}async function $PD(){let D=await k1();try{let $=RF(),U=await fetch(`${D.hostFilesApi}/files/config`,{headers:T6($?{capgkey:$}:void 0)});if(!U.ok)throw Error(`HTTP error! status: ${U.status}`);return await U.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:YUD,maxChunkSize:JUD,alertUploadSize:FUD}}}function s6(D){let $=new URL(D);if(!["http:","https:"].includes($.protocol))throw Error("Invalid Supabase host protocol");if($.username||$.password)throw Error("Supabase host must not include credentials");if($.search||$.hash)throw Error("Supabase host must not include query parameters or fragments");let
|
|
250
|
-
`)[0].trim()}async function UPD(D){let $=await cg(D);if($?.error==="channel_zip_required"||$?.error==="channel_delta_required")return $.message||$.error;let U=D instanceof Error?D.message:String(D??"");if(U.includes("CHANNEL_ZIP_REQUIRED"))return _g(U,"CHANNEL_ZIP_REQUIRED");if(U.includes("CHANNEL_DELTA_REQUIRED"))return _g(U,"CHANNEL_DELTA_REQUIRED");return null}function H4(D){if(!D)return!1;try{let $=new URL(s6(D)).hostname.toLowerCase();return $==="sb.capgo.app"||$==="xvwzpoazmxkqosrdewyv.supabase.co"||$==="ibwjdnhknbkcqfbabwei.supabase.co"||$==="aucsybvnhavogdmzwtcw.supabase.co"}catch{return!1}}function WL(D){if(D.supaHost&&D.supaKey&&D.hostApi===t6&&!H4(D.supaHost))return`${s6(D.supaHost)}/functions/v1`;return D.hostApi}function XPD(D){let $=D?.context;return typeof $?.status==="number"?$.status:void 0}async function cg(D){let $=D?.context;if(!$||typeof $.clone!=="function")return null;try{let U=await $.clone().text();try{return JSON.parse(U)}catch{return U?{message:U}:null}}catch{return null}}async function QPD(D){let $=await cg(D);if($){let U=wUD($);if(U)return U}return w0(D)}async function VF(D,$){let U=($.method??"POST").toUpperCase(),Q,X=$.supaAnon;if($.supaHost&&$.supaAnon&&!H4($.supaHost))Q=`${s6($.supaHost)}/functions/v1`;else{let J=await M5(!0);if(X=$.supaAnon??J.supaKey,J.supaHost&&J.supaKey&&J.hostApi===t6&&!H4(J.supaHost)&&!($.supaHost&&H4($.supaHost)))Q=`${s6(J.supaHost)}/functions/v1`;else if($.useFilesHost)Q=J.hostFilesApi;else Q=J.hostApi}let F=Q.includes("/functions/v1"),Y=`${k8(Q)}/${D.replace(/^\//,"")}`;try{let J=await fetch(Y,{method:U,headers:T6({"Content-Type":"application/json",Authorization:F&&X?`Bearer ${X}`:$.apikey,capgkey:$.apikey}),body:U==="GET"||U==="HEAD"?void 0:typeof $.body==="string"?$.body:JSON.stringify($.body??{}),signal:$.signal});if(!J.ok)return{data:null,error:new Q$.FunctionsHttpError(J)};return{data:(J.headers.get("content-type")??"").includes("application/json")?await J.json().catch(()=>null):await J.text().catch(()=>null),error:null}}catch(J){return{data:null,error:J instanceof Error?J:Error(String(J))}}}async function FPD(D,$=!0){if(D?.supaHost&&D?.supaAnon){if(H4(D.supaHost))return(await k1($)).hostApi;return`${s6(D.supaHost)}/functions/v1`}let U=await k1($);if(U.supaHost&&U.supaKey)return WL(U);return(await M5($)).hostApi}async function YPD(D,$,U,Q=!1,X=!0,F){let Y=await M5(Q,F);if($&&U){if(!Q)r.info("Using custom supabase instance from provided options");Y.supaHost=$,Y.supaKey=U}if(!Y.supaHost||!Y.supaKey){if(!Q)r.error(bg);throw new AD(bg,{missingSupaHost:!Y.supaHost,missingSupaKey:!Y.supaKey})}let J=s6(Y.supaHost);return NO(J,Y.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:AI("capgkey",D)},...Mj()&&X?{fetch:Oj()}:{}}})}async function OUD(D,$){let{data:U}=await D.rpc("is_paying_org",{orgid:$}).single();return U||!1}async function VUD(D,$){let{data:U}=await D.rpc("is_trial_org",{orgid:$}).single();return U||0}async function RUD(D,$,U){let{data:Q}=await D.rpc("has_usage_credits_org",U?{orgid:$,appid:U}:{orgid:$}).single();return Q||!1}function AUD(D){let{trialDays:$,isPaying:U,hasCredits:Q,warning:X=!0}=D;return!!X&&$>0&&!U&&!Q}async function EUD(D,$){let{data:U,error:Q}=await D.rpc("is_allowed_action_org",{orgid:$}).single();if(Q)throw Error(`Cannot validate plan: ${w0(Q)}`);return U===!0}async function QL(D,$,U,Q){let{data:X,error:F}=Q?await D.rpc("is_allowed_action_org_action",{orgid:$,actions:U,appid:Q}):await D.rpc("is_allowed_action_org_action",{orgid:$,actions:U});if(F){if(Q&&F.code==="PGRST202")return EUD(D,$);throw Error(`Cannot validate plan: ${w0(F)}`)}return X===!0}async function jUD(D,$,U,Q){if(Q){if(await QL(D,$,U,Q))return"allowed";if(await QL(D,$,U))return"permission_denied";return"billing_denied"}return await QL(D,$,U)?"allowed":"billing_denied"}async function TUD(D,$){throw r.error(`You need to upgrade your plan to continue to use capgo.
|
|
249
|
+
${hg.default.render(D)}`}async function rSD(D,$,U=!1){let{data:Q,error:X}=await ox(()=>D.rpc("reject_access_due_to_2fa_for_org",{org_id:$}));if(X){if(!U&&!V2(X))r.error(`Cannot check 2FA compliance: ${X.message}`);if(V2(X)){await ax({silent:U,telemetryFunctionName:"check2FAAccessForOrg"});return}tx(X)}if(Q){if(!U)r.error(`\uD83D\uDD10 Access Denied: 2FA Required. Enable 2FA at ${dg("/settings/account")}`);throw Error("2FA required for this organization")}}function oSD({silent:D=!1,stdinIsTTY:$=!!yg.isTTY,stdoutIsTTY:U=!!mg.isTTY,ci:Q=qL.isCI}={}){return!D&&$&&U&&!Q}function WUD(D={}){let $=D.ci??qL.isCI,U=D.stdinIsTTY??!!yg.isTTY,Q=D.stdoutIsTTY??!!mg.isTTY,X=D.platform??gg(),F="display"in D?D.display:K4.DISPLAY;if($||!U||!Q)return!1;if(X==="linux"&&!F)return!1;return!0}async function BUD(D){if(!WUD())return;try{await(await Promise.resolve().then(() => (Sg(),Tg))).default(D)}catch($){if($?.code==="ENOENT")return}}function aSD(D){return Pq(D)||Cq(D)}function I6(D){if(Pq(D))return Zb(D);else if(Cq(D))return Kb(D);return D}function lg(D=I6(G0()),$=void 0){let U=$?.split(",")[0],Q=U??KD(D,i0);if(!BD(Q)){let F=U?`Package.json at ${Q} does not exist`:`No package.json found at ${Q}. Run this command from your project root (the folder that contains package.json), or pass --package-json <path> to point at it (for example in a monorepo).`;throw r.error(F),Error(F)}let X=sD(Q);return JSON.parse(X)}function tSD(D=I6(G0()),$=void 0){return lg(D,$).scripts}function sSD(D=I6(G0()),$=void 0){return lg(D,$).version??""}function GUD(D){let $=D.replace("^","").replace("~","");if(J9($))try{let U=K$($);return nY(U)}catch{return $}return $}async function eSD(D,$=G0(),U){let Q=U?U.split(",").map((Y)=>Y.trim()).filter(Boolean):[],X=[],F=(Y)=>{let J=hD(Y);if(!X.includes(J))X.push(J)};for(let Y of Q){let J=hD($,Y);if(BD(J))F(J6(J))}F(hD($)),F(G0());for(let Y of X)try{let J=`${D}/package.json`,{createRequire:I}=await import("node:module"),W=I(KD(Y,"package.json")).resolve(J),B=JSON.parse(sD(W,"utf-8"));if(B.version)return B.version}catch{}for(let Y of X){let J=Y,I=L4.parse(J).root;while(J!==I){let q=KD(J,"node_modules",D,i0);if(BD(q))try{let B=JSON.parse(sD(q,"utf-8"));if(B.version)return B.version}catch{}let W=J6(J);if(W===J)break;J=W}}if(D==="@capgo/capacitor-updater"){let Y=null,J=KD($,"ios","App","Podfile");if(BD(J))try{let q=sD(J,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);if(q?.[1])Y=hD(KD($,"ios","App",q[1]))}catch{}if(!Y){let I=KD($,"android","capacitor.settings.gradle");if(BD(I))try{let W=sD(I,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);if(W?.[1])Y=hD(KD($,"android",W[1])).replace(/\/android$/,"")}catch{}}if(Y){let I=KD(Y,i0);if(BD(I))try{let q=JSON.parse(sD(I,"utf-8"));if(q.version)return q.version}catch{}}}try{let Y=U?U.split(",").map((q)=>q.trim()).filter(Boolean).join(","):U,I=(await OF($,Y)).get(D);if(I)return I}catch{}return null}async function OF(D=I6(G0()),$=void 0){let U=$?.split(",").map((F)=>F.trim()).filter(Boolean);if(U??=[KD(D,i0)],U){for(let F of U)if(!BD(F)){let Y=`Package.json at ${F} does not exist`;throw r.error(Y),Error(Y)}}let Q=new Map,{createRequire:X}=await import("node:module");for(let F of U){let Y=sD(F),J=JSON.parse(Y),I=J6(F),q=(W,B)=>{try{let K=X(KD(I,"package.json")).resolve(`${W}/package.json`),H=JSON.parse(sD(K,"utf-8"));if(H.version)return H.version}catch{}let G=I,Z=L4.parse(G).root;while(G!==Z){let z=KD(G,"node_modules",W,i0);if(BD(z))try{let H=JSON.parse(sD(z,"utf-8"));if(H.version)return H.version}catch{}let K=J6(G);if(K===G)break;G=K}return GUD(B)};for(let W in J.dependencies)Q.set(W,q(W,J.dependencies[W]));for(let W in J.devDependencies)Q.set(W,q(W,J.devDependencies[W]))}return Q}async function zUD(D=I6(G0()),$=void 0){let U=$?.split(",").map((X)=>X.trim()).filter(Boolean);if(U??=[KD(D,i0)],U){for(let X of U)if(!BD(X)){let F=`Package.json at ${X} does not exist`;throw r.error(F),Error(F)}}let Q=new Map;for(let X of U){let F=sD(X),Y=JSON.parse(F);for(let J in Y.dependencies??{})if(typeof Y.dependencies[J]==="string")Q.set(J,Y.dependencies[J]);for(let J in Y.devDependencies??{})if(typeof Y.devDependencies[J]==="string")Q.set(J,Y.devDependencies[J])}return Q}function ZUD(D){if(!D)return!1;if(D.config&&Object.keys(D.config).length>0)return!0;return!!D.path&&BD(D.path)}async function ng(D,$=!1){let U=KUD;try{let Q=await D();if(!ZUD(Q)){if(!$)r.error(U);throw new AD(U)}return Q}catch(Q){if(Q instanceof AD)throw Q;let X=w0(Q);if(!$)r.error(`${U}: ${X}`);throw new AD(U,{cause:X})}}function SI(D=!1){return ng(fq,D)}function HUD(D=!1){return ng(yq,D)}async function LUD(D,$){let U=await HUD();if(U?.config)U.config.plugins??={},U.config.plugins.extConfig??={},U.config.plugins[D]??={},U.config.plugins[D]={...U.config.plugins[D],...$},await mq(D,U);return U}async function DPD(D){return LUD("CapacitorUpdater",D)}async function k1(D=!1){try{let $=await SI(D),U={host:$?.config?.plugins?.CapacitorUpdater?.localHost||Pg,hostWeb:$?.config?.plugins?.CapacitorUpdater?.localWebHost||NF,hostFilesApi:$?.config?.plugins?.CapacitorUpdater?.localApiFiles||Cg,hostApi:$?.config?.plugins?.CapacitorUpdater?.localApi||t6};if($?.config?.plugins?.CapacitorUpdater?.localSupa&&$?.config?.plugins?.CapacitorUpdater?.localSupaAnon){if(!D)r.info("Using custom supabase instance from capacitor.config.json");U.supaKey=$?.config?.plugins?.CapacitorUpdater?.localSupaAnon,U.supaHost=$?.config?.plugins?.CapacitorUpdater?.localSupa}return U}catch{return{host:Pg,hostWeb:NF,hostFilesApi:Cg,hostApi:t6}}}function vg(D){return typeof D==="object"&&D!==null}function NUD(D){if(!vg(D))return!1;let $=D.capacitor;if(vg($)&&($.ios!==void 0||$.android!==void 0))return!0;return!1}function MUD(D){if(BD(KD(D,"plugin.xml")))return!0;let $=KD(D,i0);if(!BD($))return!1;try{return NUD(JSON.parse(sD($,"utf-8")))}catch{return!1}}async function M5(D=!1,$){let U=(X)=>{let F={...X};return Rj(F,void 0,D),F};if(!$&&XL)return U(XL);if(!$&&KF)return KF.then(U);let Q=(async()=>{let X=await k1(D);try{let F=RF(),Y=await fetch(`${X.hostApi}/private/config`,{...$?{signal:$}:{},headers:T6(F?{capgkey:F}:void 0)});if(!Y.ok)throw Error(`HTTP error! status: ${Y.status}`);let I={...await Y.json(),...X};if(!$)XL=I;return{...I}}catch{if(!D)r.info(`Local config ${w0(X)}`);return{...X}}finally{if(!$)KF=null}})();if(!$)KF=Q;return Q.then(U)}async function $PD(){let D=await k1();try{let $=RF(),U=await fetch(`${D.hostFilesApi}/files/config`,{headers:T6($?{capgkey:$}:void 0)});if(!U.ok)throw Error(`HTTP error! status: ${U.status}`);return await U.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:YUD,maxChunkSize:JUD,alertUploadSize:FUD}}}function s6(D){let $=new URL(D);if(!["http:","https:"].includes($.protocol))throw Error("Invalid Supabase host protocol");let U=$.hostname==="localhost"||$.hostname==="127.0.0.1"||$.hostname==="[::1]";if($.protocol==="http:"&&!U)throw Error("Supabase host must use HTTPS (HTTP is only allowed for localhost)");if($.username||$.password)throw Error("Supabase host must not include credentials");if($.search||$.hash)throw Error("Supabase host must not include query parameters or fragments");let Q=k8($.pathname);return`${$.origin}${Q}`}function wUD(D){if(!D||typeof D!=="object")return"";let $=D;return[$.error,$.message,$.status].filter(Boolean).join(" | ")}function _g(D,$){let U=D.indexOf($);if(U<0)return D;return D.slice(U+$.length).replace(/^:\s*/,"").split(`
|
|
250
|
+
`)[0].trim()}async function UPD(D){let $=await cg(D);if($?.error==="channel_zip_required"||$?.error==="channel_delta_required")return $.message||$.error;let U=D instanceof Error?D.message:String(D??"");if(U.includes("CHANNEL_ZIP_REQUIRED"))return _g(U,"CHANNEL_ZIP_REQUIRED");if(U.includes("CHANNEL_DELTA_REQUIRED"))return _g(U,"CHANNEL_DELTA_REQUIRED");return null}function H4(D){if(!D)return!1;try{let $=new URL(s6(D)).hostname.toLowerCase();return $==="sb.capgo.app"||$==="xvwzpoazmxkqosrdewyv.supabase.co"||$==="ibwjdnhknbkcqfbabwei.supabase.co"||$==="aucsybvnhavogdmzwtcw.supabase.co"}catch{return!1}}function WL(D){if(D.supaHost&&D.supaKey&&D.hostApi===t6&&!H4(D.supaHost))return`${s6(D.supaHost)}/functions/v1`;return D.hostApi}function XPD(D){let $=D?.context;return typeof $?.status==="number"?$.status:void 0}async function cg(D){let $=D?.context;if(!$||typeof $.clone!=="function")return null;try{let U=await $.clone().text();try{return JSON.parse(U)}catch{return U?{message:U}:null}}catch{return null}}async function QPD(D){let $=await cg(D);if($){let U=wUD($);if(U)return U}return w0(D)}async function VF(D,$){let U=($.method??"POST").toUpperCase(),Q,X=$.supaAnon;if($.supaHost&&$.supaAnon&&!H4($.supaHost))Q=`${s6($.supaHost)}/functions/v1`;else{let J=await M5(!0);if(X=$.supaAnon??J.supaKey,J.supaHost&&J.supaKey&&J.hostApi===t6&&!H4(J.supaHost)&&!($.supaHost&&H4($.supaHost)))Q=`${s6(J.supaHost)}/functions/v1`;else if($.useFilesHost)Q=J.hostFilesApi;else Q=J.hostApi}let F=Q.includes("/functions/v1"),Y=`${k8(Q)}/${D.replace(/^\//,"")}`;try{let J=await fetch(Y,{method:U,redirect:"error",headers:T6({"Content-Type":"application/json",Authorization:F&&X?`Bearer ${X}`:$.apikey,capgkey:$.apikey}),body:U==="GET"||U==="HEAD"?void 0:typeof $.body==="string"?$.body:JSON.stringify($.body??{}),signal:$.signal});if(!J.ok)return{data:null,error:new Q$.FunctionsHttpError(J)};return{data:(J.headers.get("content-type")??"").includes("application/json")?await J.json().catch(()=>null):await J.text().catch(()=>null),error:null}}catch(J){return{data:null,error:J instanceof Error?J:Error(String(J))}}}async function FPD(D,$=!0){if(D?.supaHost&&D?.supaAnon){if(H4(D.supaHost))return(await k1($)).hostApi;return`${s6(D.supaHost)}/functions/v1`}let U=await k1($);if(U.supaHost&&U.supaKey)return WL(U);return(await M5($)).hostApi}async function YPD(D,$,U,Q=!1,X=!0,F){let Y=await M5(Q,F);if($&&U){if(!Q)r.info("Using custom supabase instance from provided options");Y.supaHost=$,Y.supaKey=U}if(!Y.supaHost||!Y.supaKey){if(!Q)r.error(bg);throw new AD(bg,{missingSupaHost:!Y.supaHost,missingSupaKey:!Y.supaKey})}let J=s6(Y.supaHost);return NO(J,Y.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:AI("capgkey",D)},...Mj()&&X?{fetch:Oj()}:{}}})}async function OUD(D,$){let{data:U}=await D.rpc("is_paying_org",{orgid:$}).single();return U||!1}async function VUD(D,$){let{data:U}=await D.rpc("is_trial_org",{orgid:$}).single();return U||0}async function RUD(D,$,U){let{data:Q}=await D.rpc("has_usage_credits_org",U?{orgid:$,appid:U}:{orgid:$}).single();return Q||!1}function AUD(D){let{trialDays:$,isPaying:U,hasCredits:Q,warning:X=!0}=D;return!!X&&$>0&&!U&&!Q}async function EUD(D,$){let{data:U,error:Q}=await D.rpc("is_allowed_action_org",{orgid:$}).single();if(Q)throw Error(`Cannot validate plan: ${w0(Q)}`);return U===!0}async function QL(D,$,U,Q){let{data:X,error:F}=Q?await D.rpc("is_allowed_action_org_action",{orgid:$,actions:U,appid:Q}):await D.rpc("is_allowed_action_org_action",{orgid:$,actions:U});if(F){if(Q&&F.code==="PGRST202")return EUD(D,$);throw Error(`Cannot validate plan: ${w0(F)}`)}return X===!0}async function jUD(D,$,U,Q){if(Q){if(await QL(D,$,U,Q))return"allowed";if(await QL(D,$,U))return"permission_denied";return"billing_denied"}return await QL(D,$,U)?"allowed":"billing_denied"}async function TUD(D,$){throw r.error(`You need to upgrade your plan to continue to use capgo.
|
|
251
251
|
Upgrade here: ${D}
|
|
252
252
|
`),await BUD(D),new AD($)}async function SUD(){throw r.error("Cannot validate plan usage for this app. The API key may lack permission to read app billing details."),new AD("Plan validation permission denied")}async function JPD(D,$,U){let{data:Q,error:X}=await D.rpc("get_organization_cli_warnings",{orgid:$,cli_version:U});if(X){r.error(`Cannot get cli warnings: ${w0(X)}`);return}if(Q.length>0){r.warn(`Found ${Q.length} cli warnings for your organization.`);let F=null;for(let Y of Q){if(typeof Y!=="object"||typeof Y.message!=="string"||typeof Y.fatal!=="boolean"){r.error(`Invalid cli warning: ${Y}`);continue}let J=Y;if(J.fatal)r.error(`${J.message.replaceAll("\\n",`
|
|
253
253
|
`)}`),F=Error(J.message);else r.warn(`${J.message.replaceAll("\\n",`
|
package/dist/package.json
CHANGED
|
@@ -4,10 +4,12 @@ export interface OrgResolverDeps {
|
|
|
4
4
|
createClient?: typeof createSupabaseClient;
|
|
5
5
|
/** Injectable for tests; defaults to GET app via invokeCapgoCliApi. */
|
|
6
6
|
fetchOwnerOrg?: (apikey: string, appId: string, signal?: AbortSignal) => Promise<string | undefined>;
|
|
7
|
+
supaHost?: string;
|
|
8
|
+
supaAnon?: string;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* Resolves an app's owner organization id (`apps.owner_org`), promise-cached
|
|
10
|
-
* per `(apikey, appId)`. Returns undefined on any error — never throws.
|
|
12
|
+
* per `(supaHost, apikey, appId)`. Returns undefined on any error — never throws.
|
|
11
13
|
* Extracted so the analytics layer and onboarding analytics share one path.
|
|
12
14
|
*/
|
|
13
15
|
export declare function resolveOwnerOrgId(apikey: string, appId: string, deps?: OrgResolverDeps, signal?: AbortSignal): Promise<string | undefined>;
|
|
@@ -33,7 +33,7 @@ export interface TrackBuilderOnboardingStepInput {
|
|
|
33
33
|
errorCategory?: OnboardingErrorCategory | AndroidOnboardingErrorCategory;
|
|
34
34
|
replaySessionId?: string;
|
|
35
35
|
}
|
|
36
|
-
export type BuilderOnboardingAction = 'resume_prompt_decision' | 'question_shown' | 'question_answered' | 'question_skipped' | 'android_sa_method_selected' | 'android_sa_validation_recovery_selected' | 'android_sa_validation_result' | 'credential_verified' | 'credential_verification_failed' | 'certificate_prepared' | 'certificate_preparation_failed' | 'keystore_prepared' | 'keystore_preparation_failed' | 'google_play_connected' | 'google_play_connection_failed' | 'google_play_connection_unverified';
|
|
36
|
+
export type BuilderOnboardingAction = 'start_setup' | 'resume_prompt_decision' | 'question_shown' | 'question_answered' | 'question_skipped' | 'android_sa_method_selected' | 'android_sa_validation_recovery_selected' | 'android_sa_validation_result' | 'credential_verified' | 'credential_verification_failed' | 'certificate_prepared' | 'certificate_preparation_failed' | 'keystore_prepared' | 'keystore_preparation_failed' | 'google_play_connected' | 'google_play_connection_failed' | 'google_play_connection_unverified';
|
|
37
37
|
export interface TrackBuilderOnboardingActionInput {
|
|
38
38
|
apikey: string;
|
|
39
39
|
appId: string;
|