@capgo/cli 4.13.23 → 4.13.25

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ Expecting one of '${i.join("', '")}'`);let n=`${t}Help`;return this.on(n,s=>{let
26
26
  `+Object.keys(i).map(n=>`${n}: ${i[n]}`).join(`\r
27
27
  `)+`\r
28
28
  \r
29
- `+r)}function ml(e,t,r,i,n){if(e.listenerCount("wsClientError")){let s=new Error(n);Error.captureStackTrace(s,ml),e.emit("wsClientError",s,r,t)}else R1(r,i,n)}});var fP=m((zot,pP)=>{"use strict";var Ia=Jv();Ia.createWebSocketStream=rP();Ia.Server=dP();Ia.Receiver=Uv();Ia.Sender=Hv();Ia.WebSocket=Ia;Ia.WebSocketServer=Ia.Server;pP.exports=Ia});var mP=m(is=>{"use strict";var k9e=is&&is.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R9e=is&&is.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),hP=is&&is.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&k9e(t,e,r);return R9e(t,e),t},t7=is&&is.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(is,"__esModule",{value:!0});var Vr=c6(),P9e=t7(uR()),I9e=t7(bv()),L9e=d6(),B9e=t7(Nv()),q9e=()=>{},j9e=typeof WebSocket<"u",Qv=class{constructor(t,r){var i;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=Vr.DEFAULT_HEADERS,this.params={},this.timeout=Vr.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=q9e,this.conn=null,this.sendBuffer=[],this.serializer=new P9e.default,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=s=>{let a;return s?a=s:typeof fetch>"u"?a=(...o)=>Promise.resolve().then(()=>hP(Ko())).then(({default:u})=>u(...o)):a=fetch,(...o)=>a(...o)},this.endPoint=`${t}/${Vr.TRANSPORTS.websocket}`,this.httpEndpoint=(0,L9e.httpEndpointURL)(t),r?.transport?this.transport=r.transport:this.transport=null,r?.params&&(this.params=r.params),r?.headers&&(this.headers=Object.assign(Object.assign({},this.headers),r.headers)),r?.timeout&&(this.timeout=r.timeout),r?.logger&&(this.logger=r.logger),r?.heartbeatIntervalMs&&(this.heartbeatIntervalMs=r.heartbeatIntervalMs);let n=(i=r?.params)===null||i===void 0?void 0:i.apikey;n&&(this.accessToken=n,this.apiKey=n),this.reconnectAfterMs=r?.reconnectAfterMs?r.reconnectAfterMs:s=>[1e3,2e3,5e3,1e4][s-1]||1e4,this.encode=r?.encode?r.encode:(s,a)=>a(JSON.stringify(s)),this.decode=r?.decode?r.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new I9e.default(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(j9e){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new e7(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),Promise.resolve().then(()=>hP(fP())).then(({default:t})=>{this.conn=new t(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(t,r){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,r??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(t){let r=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.disconnect(),t}log(t,r,i){this.logger(t,r,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Vr.SOCKET_STATES.connecting:return Vr.CONNECTION_STATE.Connecting;case Vr.SOCKET_STATES.open:return Vr.CONNECTION_STATE.Open;case Vr.SOCKET_STATES.closing:return Vr.CONNECTION_STATE.Closing;default:return Vr.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===Vr.CONNECTION_STATE.Open}channel(t,r={config:{}}){let i=new B9e.default(`realtime:${t}`,r,this);return this.channels.push(i),i}push(t){let{topic:r,event:i,payload:n,ref:s}=t,a=()=>{this.encode(t,o=>{var u;(u=this.conn)===null||u===void 0||u.send(o)})};this.log("push",`${r} ${i} (${s})`,n),this.isConnected()?a():this.sendBuffer.push(a)}setAuth(t){this.accessToken=t,this.channels.forEach(r=>{t&&r.updateJoinPayload({access_token:t}),r.joinedOnce&&r._isJoined()&&r._push(Vr.CHANNEL_EVENTS.access_token,{access_token:t})})}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let r=this.channels.find(i=>i.topic===t&&(i._isJoined()||i._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r._joinRef()!==t._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Vr.VSN}))}_onConnMessage(t){this.decode(t.data,r=>{let{topic:i,event:n,payload:s,ref:a}=r;(a&&a===this.pendingHeartbeatRef||n===s?.type)&&(this.pendingHeartbeatRef=null),this.log("receive",`${s.status||""} ${i} ${n} ${a&&"("+a+")"||""}`,s),this.channels.filter(o=>o._isMember(i)).forEach(o=>o._trigger(n,s,a)),this.stateChangeCallbacks.message.forEach(o=>o(r))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(t=>t())}_onConnClose(t){this.log("transport","close",t),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(r=>r(t))}_onConnError(t){this.log("transport",t.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(r=>r(t))}_triggerChanError(){this.channels.forEach(t=>t._trigger(Vr.CHANNEL_EVENTS.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;let i=t.match(/\?/)?"&":"?",n=new URLSearchParams(r);return`${t}${i}${n}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_sendHeartbeat(){var t;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(t=this.conn)===null||t===void 0||t.close(Vr.WS_CLOSE_NORMAL,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}};is.default=Qv;var e7=class{constructor(t,r,i){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Vr.SOCKET_STATES.connecting,this.send=()=>{},this.url=null,this.url=t,this.close=i.close}}});var r7=m(Ye=>{"use strict";var $9e=Ye&&Ye.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),M9e=Ye&&Ye.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gP=Ye&&Ye.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$9e(t,e,r);return M9e(t,e),t},U9e=Ye&&Ye.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.REALTIME_CHANNEL_STATES=Ye.REALTIME_SUBSCRIBE_STATES=Ye.REALTIME_PRESENCE_LISTEN_EVENTS=Ye.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Ye.REALTIME_LISTEN_TYPES=Ye.RealtimeClient=Ye.RealtimeChannel=Ye.RealtimePresence=void 0;var V9e=U9e(mP());Ye.RealtimeClient=V9e.default;var P1=gP(Nv());Ye.RealtimeChannel=P1.default;Object.defineProperty(Ye,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return P1.REALTIME_LISTEN_TYPES}});Object.defineProperty(Ye,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return P1.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Ye,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return P1.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Ye,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return P1.REALTIME_CHANNEL_STATES}});var yP=gP(Av());Ye.RealtimePresence=yP.default;Object.defineProperty(Ye,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return yP.REALTIME_PRESENCE_LISTEN_EVENTS}})});var L1=m(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.StorageUnknownError=Ns.StorageApiError=Ns.isStorageError=Ns.StorageError=void 0;var I1=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};Ns.StorageError=I1;function H9e(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}Ns.isStorageError=H9e;var i7=class extends I1{constructor(t,r){super(t),this.name="StorageApiError",this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}};Ns.StorageApiError=i7;var n7=class extends I1{constructor(t,r){super(t),this.name="StorageUnknownError",this.originalError=r}};Ns.StorageUnknownError=n7});var x6=m(xi=>{"use strict";var z9e=xi&&xi.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),G9e=xi&&xi.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vP=xi&&xi.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&z9e(t,e,r);return G9e(t,e),t},W9e=xi&&xi.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(xi,"__esModule",{value:!0});xi.resolveResponse=xi.resolveFetch=void 0;var X9e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>vP(Ko())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};xi.resolveFetch=X9e;var Y9e=()=>W9e(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>vP(Ko()))).Response:Response});xi.resolveResponse=Y9e});var o7=m(_n=>{"use strict";var hd=_n&&_n.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(_n,"__esModule",{value:!0});_n.remove=_n.put=_n.post=_n.get=void 0;var s7=L1(),K9e=x6(),a7=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),J9e=(e,t)=>hd(void 0,void 0,void 0,function*(){let r=yield(0,K9e.resolveResponse)();e instanceof r?e.json().then(i=>{t(new s7.StorageApiError(a7(i),e.status||500))}).catch(i=>{t(new s7.StorageUnknownError(a7(i),i))}):t(new s7.StorageUnknownError(a7(e),e))}),Z9e=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json"},t?.headers),n.body=JSON.stringify(i),Object.assign(Object.assign({},n),r))};function S6(e,t,r,i,n,s){return hd(this,void 0,void 0,function*(){return new Promise((a,o)=>{e(r,Z9e(t,i,n,s)).then(u=>{if(!u.ok)throw u;return i?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>J9e(u,o))})})}function Q9e(e,t,r,i){return hd(this,void 0,void 0,function*(){return S6(e,"GET",t,r,i)})}_n.get=Q9e;function eye(e,t,r,i,n){return hd(this,void 0,void 0,function*(){return S6(e,"POST",t,i,n,r)})}_n.post=eye;function tye(e,t,r,i,n){return hd(this,void 0,void 0,function*(){return S6(e,"PUT",t,i,n,r)})}_n.put=tye;function rye(e,t,r,i,n){return hd(this,void 0,void 0,function*(){return S6(e,"DELETE",t,i,n,r)})}_n.remove=rye});var _P=m(B1=>{"use strict";var Dn=B1&&B1.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(B1,"__esModule",{value:!0});var ns=L1(),eu=o7(),iye=x6(),nye={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},wP={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},u7=class{constructor(t,r={},i,n){this.url=t,this.headers=r,this.bucketId=i,this.fetch=(0,iye.resolveFetch)(n)}uploadOrUpdate(t,r,i,n){return Dn(this,void 0,void 0,function*(){try{let s,a=Object.assign(Object.assign({},wP),n),o=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(a.upsert)});typeof Blob<"u"&&i instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),s.append("",i)):typeof FormData<"u"&&i instanceof FormData?(s=i,s.append("cacheControl",a.cacheControl)):(s=i,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType);let u=this._removeEmptyFolders(r),l=this._getFinalPath(u),c=yield this.fetch(`${this.url}/object/${l}`,Object.assign({method:t,body:s,headers:o},a?.duplex?{duplex:a.duplex}:{})),d=yield c.json();return c.ok?{data:{path:u,id:d.Id,fullPath:d.Key},error:null}:{data:null,error:d}}catch(s){if((0,ns.isStorageError)(s))return{data:null,error:s};throw s}})}upload(t,r,i){return Dn(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,r,i)})}uploadToSignedUrl(t,r,i,n){return Dn(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(t),a=this._getFinalPath(s),o=new URL(this.url+`/object/upload/sign/${a}`);o.searchParams.set("token",r);try{let u,l=Object.assign({upsert:wP.upsert},n),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(l.upsert)});typeof Blob<"u"&&i instanceof Blob?(u=new FormData,u.append("cacheControl",l.cacheControl),u.append("",i)):typeof FormData<"u"&&i instanceof FormData?(u=i,u.append("cacheControl",l.cacheControl)):(u=i,c["cache-control"]=`max-age=${l.cacheControl}`,c["content-type"]=l.contentType);let d=yield this.fetch(o.toString(),{method:"PUT",body:u,headers:c}),p=yield d.json();return d.ok?{data:{path:s,fullPath:p.Key},error:null}:{data:null,error:p}}catch(u){if((0,ns.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(t,r){return Dn(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),n=Object.assign({},this.headers);r?.upsert&&(n["x-upsert"]="true");let s=yield(0,eu.post)(this.fetch,`${this.url}/object/upload/sign/${i}`,{},{headers:n}),a=new URL(this.url+s.url),o=a.searchParams.get("token");if(!o)throw new ns.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:t,token:o},error:null}}catch(i){if((0,ns.isStorageError)(i))return{data:null,error:i};throw i}})}update(t,r,i){return Dn(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,r,i)})}move(t,r,i){return Dn(this,void 0,void 0,function*(){try{return{data:yield(0,eu.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers}),error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}copy(t,r,i){return Dn(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,eu.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrl(t,r,i){return Dn(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t),s=yield(0,eu.post)(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:r},i?.transform?{transform:i.transform}:{}),{headers:this.headers}),a=i?.download?`&download=${i.download===!0?"":i.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${a}`)},{data:s,error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrls(t,r,i){return Dn(this,void 0,void 0,function*(){try{let n=yield(0,eu.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:t},{headers:this.headers}),s=i?.download?`&download=${i.download===!0?"":i.download}`:"";return{data:n.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${s}`):null})),error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}download(t,r){return Dn(this,void 0,void 0,function*(){let n=typeof r?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(r?.transform||{}),a=s?`?${s}`:"";try{let o=this._getFinalPath(t);return{data:yield(yield(0,eu.get)(this.fetch,`${this.url}/${n}/${o}${a}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(o){if((0,ns.isStorageError)(o))return{data:null,error:o};throw o}})}getPublicUrl(t,r){let i=this._getFinalPath(t),n=[],s=r?.download?`download=${r.download===!0?"":r.download}`:"";s!==""&&n.push(s);let o=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&n.push(u);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${i}${l}`)}}}remove(t){return Dn(this,void 0,void 0,function*(){try{return{data:yield(0,eu.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(r){if((0,ns.isStorageError)(r))return{data:null,error:r};throw r}})}list(t,r,i){return Dn(this,void 0,void 0,function*(){try{let n=Object.assign(Object.assign(Object.assign({},nye),r),{prefix:t||""});return{data:yield(0,eu.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},i),error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let r=[];return t.width&&r.push(`width=${t.width}`),t.height&&r.push(`height=${t.height}`),t.resize&&r.push(`resize=${t.resize}`),t.format&&r.push(`format=${t.format}`),t.quality&&r.push(`quality=${t.quality}`),r.join("&")}};B1.default=u7});var DP=m(C6=>{"use strict";Object.defineProperty(C6,"__esModule",{value:!0});C6.version=void 0;C6.version="2.6.0"});var bP=m(A6=>{"use strict";Object.defineProperty(A6,"__esModule",{value:!0});A6.DEFAULT_HEADERS=void 0;var sye=DP();A6.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${sye.version}`}});var EP=m(q1=>{"use strict";var md=q1&&q1.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(q1,"__esModule",{value:!0});var aye=bP(),gd=L1(),yd=o7(),oye=x6(),l7=class{constructor(t,r={},i){this.url=t,this.headers=Object.assign(Object.assign({},aye.DEFAULT_HEADERS),r),this.fetch=(0,oye.resolveFetch)(i)}listBuckets(){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.get)(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if((0,gd.isStorageError)(t))return{data:null,error:t};throw t}})}getBucket(t){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.get)(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(r){if((0,gd.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(t,r={public:!1}){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.post)(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,gd.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(t,r){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.put)(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,gd.isStorageError)(i))return{data:null,error:i};throw i}})}emptyBucket(t){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.post)(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(r){if((0,gd.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(t){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.remove)(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if((0,gd.isStorageError)(r))return{data:null,error:r};throw r}})}};q1.default=l7});var SP=m(vd=>{"use strict";var xP=vd&&vd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vd,"__esModule",{value:!0});vd.StorageClient=void 0;var uye=xP(_P()),lye=xP(EP()),c7=class extends lye.default{constructor(t,r={},i){super(t,r,i)}from(t){return new uye.default(this.url,this.headers,t,this.fetch)}};vd.StorageClient=c7});var AP=m(CP=>{"use strict";Object.defineProperty(CP,"__esModule",{value:!0})});var OP=m(ks=>{"use strict";var cye=ks&&ks.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),TP=ks&&ks.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&cye(t,e,r)};Object.defineProperty(ks,"__esModule",{value:!0});ks.StorageClient=void 0;var dye=SP();Object.defineProperty(ks,"StorageClient",{enumerable:!0,get:function(){return dye.StorageClient}});TP(AP(),ks);TP(L1(),ks)});var FP=m(T6=>{"use strict";Object.defineProperty(T6,"__esModule",{value:!0});T6.version=void 0;T6.version="2.44.4"});var NP=m(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.DEFAULT_REALTIME_OPTIONS=Ki.DEFAULT_AUTH_OPTIONS=Ki.DEFAULT_DB_OPTIONS=Ki.DEFAULT_GLOBAL_OPTIONS=Ki.DEFAULT_HEADERS=void 0;var pye=FP(),j1="";typeof Deno<"u"?j1="deno":typeof document<"u"?j1="web":typeof navigator<"u"&&navigator.product==="ReactNative"?j1="react-native":j1="node";Ki.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${j1}/${pye.version}`};Ki.DEFAULT_GLOBAL_OPTIONS={headers:Ki.DEFAULT_HEADERS};Ki.DEFAULT_DB_OPTIONS={schema:"public"};Ki.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Ki.DEFAULT_REALTIME_OPTIONS={}});var RP=m(pr=>{"use strict";var fye=pr&&pr.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),hye=pr&&pr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mye=pr&&pr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&fye(t,e,r);return hye(t,e),t},gye=pr&&pr.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(pr,"__esModule",{value:!0});pr.fetchWithAuth=pr.resolveHeadersConstructor=pr.resolveFetch=void 0;var kP=mye(Ko()),yye=e=>{let t;return e?t=e:typeof fetch>"u"?t=kP.default:t=fetch,(...r)=>t(...r)};pr.resolveFetch=yye;var vye=()=>typeof Headers>"u"?kP.Headers:Headers;pr.resolveHeadersConstructor=vye;var wye=(e,t,r)=>{let i=(0,pr.resolveFetch)(r),n=(0,pr.resolveHeadersConstructor)();return(s,a)=>gye(void 0,void 0,void 0,function*(){var o;let u=(o=yield t())!==null&&o!==void 0?o:e,l=new n(a?.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${u}`),i(s,Object.assign(Object.assign({},a),{headers:l}))})};pr.fetchWithAuth=wye});var PP=m(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.applySettingDefaults=Rs.isBrowser=Rs.stripTrailingSlash=Rs.uuid=void 0;function _ye(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e=="x"?t:t&3|8;return r.toString(16)})}Rs.uuid=_ye;function Dye(e){return e.replace(/\/$/,"")}Rs.stripTrailingSlash=Dye;var bye=()=>typeof window<"u";Rs.isBrowser=bye;function Eye(e,t){let{db:r,auth:i,realtime:n,global:s}=e,{db:a,auth:o,realtime:u,global:l}=t;return{db:Object.assign(Object.assign({},a),r),auth:Object.assign(Object.assign({},o),i),realtime:Object.assign(Object.assign({},u),n),global:Object.assign(Object.assign({},l),s)}}Rs.applySettingDefaults=Eye});var d7=m(O6=>{"use strict";Object.defineProperty(O6,"__esModule",{value:!0});O6.version=void 0;O6.version="2.64.4"});var F6=m(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.API_VERSIONS=fr.API_VERSION_HEADER_NAME=fr.NETWORK_FAILURE=fr.EXPIRY_MARGIN=fr.DEFAULT_HEADERS=fr.AUDIENCE=fr.STORAGE_KEY=fr.GOTRUE_URL=void 0;var xye=d7();fr.GOTRUE_URL="http://localhost:9999";fr.STORAGE_KEY="supabase.auth.token";fr.AUDIENCE="";fr.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${xye.version}`};fr.EXPIRY_MARGIN=10;fr.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};fr.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";fr.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}}});var wd=m(ue=>{"use strict";var Sye=ue&&ue.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),Cye=ue&&ue.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Aye=ue&&ue.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Sye(t,e,r);return Cye(t,e),t};Object.defineProperty(ue,"__esModule",{value:!0});ue.parseResponseAPIVersion=ue.getCodeChallengeAndMethod=ue.generatePKCEChallenge=ue.generatePKCEVerifier=ue.retryable=ue.sleep=ue.decodeJWTPayload=ue.Deferred=ue.decodeBase64URL=ue.removeItemAsync=ue.getItemAsync=ue.setItemAsync=ue.looksLikeFetchResponse=ue.resolveFetch=ue.parseParametersFromURL=ue.supportsLocalStorage=ue.isBrowser=ue.uuid=ue.expiresAt=void 0;var Tye=F6();function Oye(e){return Math.round(Date.now()/1e3)+e}ue.expiresAt=Oye;function Fye(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}ue.uuid=Fye;var Nye=()=>typeof document<"u";ue.isBrowser=Nye;var gl={tested:!1,writable:!1},kye=()=>{if(!(0,ue.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(gl.tested)return gl.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),gl.tested=!0,gl.writable=!0}catch{gl.tested=!0,gl.writable=!1}return gl.writable};ue.supportsLocalStorage=kye;function Rye(e){let t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((n,s)=>{t[s]=n})}catch{}return r.searchParams.forEach((i,n)=>{t[n]=i}),t}ue.parseParametersFromURL=Rye;var Pye=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>Aye(Ko())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};ue.resolveFetch=Pye;var Iye=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function";ue.looksLikeFetchResponse=Iye;var Lye=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))};ue.setItemAsync=Lye;var Bye=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}};ue.getItemAsync=Bye;var qye=async(e,t)=>{await e.removeItem(t)};ue.removeItemAsync=qye;function IP(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="",i,n,s,a,o,u,l,c=0;for(e=e.replace("-","+").replace("_","/");c<e.length;)a=t.indexOf(e.charAt(c++)),o=t.indexOf(e.charAt(c++)),u=t.indexOf(e.charAt(c++)),l=t.indexOf(e.charAt(c++)),i=a<<2|o>>4,n=(o&15)<<4|u>>2,s=(u&3)<<6|l,r=r+String.fromCharCode(i),u!=64&&n!=0&&(r=r+String.fromCharCode(n)),l!=64&&s!=0&&(r=r+String.fromCharCode(s));return r}ue.decodeBase64URL=IP;var N6=class e{constructor(){this.promise=new e.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}};ue.Deferred=N6;N6.promiseConstructor=Promise;function jye(e){let t=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,r=e.split(".");if(r.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!t.test(r[1]))throw new Error("JWT is not valid: payload is not in base64url format");let i=r[1];return JSON.parse(IP(i))}ue.decodeJWTPayload=jye;async function $ye(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}ue.sleep=$ye;function Mye(e,t){return new Promise((i,n)=>{(async()=>{for(let s=0;s<1/0;s++)try{let a=await e(s);if(!t(s,null,a)){i(a);return}}catch(a){if(!t(s,a)){n(a);return}}})()})}ue.retryable=Mye;function Uye(e){return("0"+e.toString(16)).substr(-2)}function LP(){let t=new Uint32Array(56);if(typeof crypto>"u"){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=r.length,n="";for(let s=0;s<56;s++)n+=r.charAt(Math.floor(Math.random()*i));return n}return crypto.getRandomValues(t),Array.from(t,Uye).join("")}ue.generatePKCEVerifier=LP;async function Vye(e){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(i);return Array.from(n).map(s=>String.fromCharCode(s)).join("")}function Hye(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function BP(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;let r=await Vye(e);return Hye(r)}ue.generatePKCEChallenge=BP;async function zye(e,t,r=!1){let i=LP(),n=i;r&&(n+="/PASSWORD_RECOVERY"),await(0,ue.setItemAsync)(e,`${t}-code-verifier`,n);let s=await BP(i);return[s,i===s?"plain":"s256"]}ue.getCodeChallengeAndMethod=zye;var Gye=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Wye(e){let t=e.headers.get(Tye.API_VERSION_HEADER_NAME);if(!t||!t.match(Gye))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}ue.parseResponseAPIVersion=Wye});var $1=m(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.isAuthWeakPasswordError=Fe.AuthWeakPasswordError=Fe.isAuthRetryableFetchError=Fe.AuthRetryableFetchError=Fe.AuthPKCEGrantCodeExchangeError=Fe.AuthImplicitGrantRedirectError=Fe.AuthInvalidCredentialsError=Fe.AuthInvalidTokenResponseError=Fe.AuthSessionMissingError=Fe.CustomAuthError=Fe.AuthUnknownError=Fe.isAuthApiError=Fe.AuthApiError=Fe.isAuthError=Fe.AuthError=void 0;var _d=class extends Error{constructor(t,r,i){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=i}};Fe.AuthError=_d;function k6(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}Fe.isAuthError=k6;var p7=class extends _d{constructor(t,r,i){super(t,r,i),this.name="AuthApiError",this.status=r,this.code=i}};Fe.AuthApiError=p7;function Xye(e){return k6(e)&&e.name==="AuthApiError"}Fe.isAuthApiError=Xye;var f7=class extends _d{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}};Fe.AuthUnknownError=f7;var Ps=class extends _d{constructor(t,r,i,n){super(t,i,n),this.name=r,this.status=i}};Fe.CustomAuthError=Ps;var h7=class extends Ps{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Fe.AuthSessionMissingError=h7;var m7=class extends Ps{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Fe.AuthInvalidTokenResponseError=m7;var g7=class extends Ps{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}};Fe.AuthInvalidCredentialsError=g7;var y7=class extends Ps{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Fe.AuthImplicitGrantRedirectError=y7;var v7=class extends Ps{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Fe.AuthPKCEGrantCodeExchangeError=v7;var w7=class extends Ps{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}};Fe.AuthRetryableFetchError=w7;function Yye(e){return k6(e)&&e.name==="AuthRetryableFetchError"}Fe.isAuthRetryableFetchError=Yye;var _7=class extends Ps{constructor(t,r,i){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=i}};Fe.AuthWeakPasswordError=_7;function Kye(e){return k6(e)&&e.name==="AuthWeakPasswordError"}Fe.isAuthWeakPasswordError=Kye});var E7=m(Gt=>{"use strict";var Jye=Gt&&Gt.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(Gt,"__esModule",{value:!0});Gt._noResolveJsonResponse=Gt._generateLinkResponse=Gt._ssoResponse=Gt._userResponse=Gt._sessionResponsePassword=Gt._sessionResponse=Gt._request=Gt.handleError=void 0;var R6=F6(),D7=wd(),yl=$1(),vl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Zye=[502,503,504];async function b7(e){var t;if(!(0,D7.looksLikeFetchResponse)(e))throw new yl.AuthRetryableFetchError(vl(e),0);if(Zye.includes(e.status))throw new yl.AuthRetryableFetchError(vl(e),e.status);let r;try{r=await e.json()}catch(s){throw new yl.AuthUnknownError(vl(s),s)}let i,n=(0,D7.parseResponseAPIVersion)(e);if(n&&n.getTime()>=R6.API_VERSIONS["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?i=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(i=r.error_code),i){if(i==="weak_password")throw new yl.AuthWeakPasswordError(vl(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[])}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((s,a)=>s&&typeof a=="string",!0))throw new yl.AuthWeakPasswordError(vl(r),e.status,r.weak_password.reasons);throw new yl.AuthApiError(vl(r),e.status||500,i)}Gt.handleError=b7;var Qye=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),n.body=JSON.stringify(i),Object.assign(Object.assign({},n),r))};async function e5e(e,t,r,i){var n;let s=Object.assign({},i?.headers);s[R6.API_VERSION_HEADER_NAME]||(s[R6.API_VERSION_HEADER_NAME]=R6.API_VERSIONS["2024-01-01"].name),i?.jwt&&(s.Authorization=`Bearer ${i.jwt}`);let a=(n=i?.query)!==null&&n!==void 0?n:{};i?.redirectTo&&(a.redirect_to=i.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await t5e(e,t,r+o,{headers:s,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(u):{data:Object.assign({},u),error:null}}Gt._request=e5e;async function t5e(e,t,r,i,n,s){let a=Qye(t,i,n,s),o;try{o=await e(r,Object.assign({},a))}catch(u){throw console.error(u),new yl.AuthRetryableFetchError(vl(u),0)}if(o.ok||await b7(o),i?.noResolveJson)return o;try{return await o.json()}catch(u){await b7(u)}}function qP(e){var t;let r=null;o5e(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=(0,D7.expiresAt)(e.expires_in)));let i=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:i},error:null}}Gt._sessionResponse=qP;function r5e(e){let t=qP(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,i)=>r&&typeof i=="string",!0)&&(t.data.weak_password=e.weak_password),t}Gt._sessionResponsePassword=r5e;function i5e(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}Gt._userResponse=i5e;function n5e(e){return{data:e,error:null}}Gt._ssoResponse=n5e;function s5e(e){let{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:s}=e,a=Jye(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:s},u=Object.assign({},a);return{data:{properties:o,user:u},error:null}}Gt._generateLinkResponse=s5e;function a5e(e){return e}Gt._noResolveJsonResponse=a5e;function o5e(e){return e.access_token&&e.refresh_token&&e.expires_in}});var P6=m(M1=>{"use strict";var u5e=M1&&M1.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(M1,"__esModule",{value:!0});var Ar=E7(),l5e=wd(),Is=$1(),x7=class{constructor({url:t="",headers:r={},fetch:i}){this.url=t,this.headers=r,this.fetch=(0,l5e.resolveFetch)(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(t,r="global"){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(i){if((0,Is.isAuthError)(i))return{data:null,error:i};throw i}}async inviteUserByEmail(t,r={}){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ar._userResponse})}catch(i){if((0,Is.isAuthError)(i))return{data:{user:null},error:i};throw i}}async generateLink(t){try{let{options:r}=t,i=u5e(t,["options"]),n=Object.assign(Object.assign({},i),r);return"newEmail"in i&&(n.new_email=i?.newEmail,delete n.newEmail),await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:Ar._generateLinkResponse,redirectTo:r?.redirectTo})}catch(r){if((0,Is.isAuthError)(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Is.isAuthError)(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,i,n,s,a,o,u;try{let l={nextPage:null,lastPage:0,total:0},c=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(r=t?.page)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:"",per_page:(s=(n=t?.perPage)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:""},xform:Ar._noResolveJsonResponse});if(c.error)throw c.error;let d=await c.json(),p=(a=c.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(u=(o=c.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(h=>{let g=parseInt(h.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(h.split(";")[1].split("=")[1]);l[`${v}Page`]=g}),l.total=parseInt(p)),{data:Object.assign(Object.assign({},d),l),error:null}}catch(l){if((0,Is.isAuthError)(l))return{data:{users:[]},error:l};throw l}}async getUserById(t){try{return await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Is.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){try{return await(0,Ar._request)(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Ar._userResponse})}catch(i){if((0,Is.isAuthError)(i))return{data:{user:null},error:i};throw i}}async deleteUser(t,r=!1){try{return await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ar._userResponse})}catch(i){if((0,Is.isAuthError)(i))return{data:{user:null},error:i};throw i}}async _listFactors(t){try{let{data:r,error:i}=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:r,error:i}}catch(r){if((0,Is.isAuthError)(r))return{data:null,error:r};throw r}}async _deleteFactor(t){try{return{data:await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if((0,Is.isAuthError)(r))return{data:null,error:r};throw r}}};M1.default=x7});var jP=m(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});Dd.memoryLocalStorageAdapter=Dd.localStorageAdapter=void 0;var S7=wd();Dd.localStorageAdapter={getItem:e=>(0,S7.supportsLocalStorage)()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{(0,S7.supportsLocalStorage)()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{(0,S7.supportsLocalStorage)()&&globalThis.localStorage.removeItem(e)}};function c5e(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}Dd.memoryLocalStorageAdapter=c5e});var $P=m(I6=>{"use strict";Object.defineProperty(I6,"__esModule",{value:!0});I6.polyfillGlobalThis=void 0;function d5e(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}I6.polyfillGlobalThis=d5e});var C7=m(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.navigatorLock=Hr.NavigatorLockAcquireTimeoutError=Hr.LockAcquireTimeoutError=Hr.internals=void 0;var p5e=wd();Hr.internals={debug:!!(globalThis&&(0,p5e.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var L6=class extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}};Hr.LockAcquireTimeoutError=L6;var B6=class extends L6{};Hr.NavigatorLockAcquireTimeoutError=B6;async function f5e(e,t,r){Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let i=new globalThis.AbortController;return t>0&&setTimeout(()=>{i.abort(),Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async n=>{if(n){Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name);try{return await r()}finally{Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name)}}else{if(t===0)throw Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new B6(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Hr.internals.debug)try{let s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}})}Hr.navigatorLock=f5e});var T7=m(H1=>{"use strict";var h5e=H1&&H1.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(H1,"__esModule",{value:!0});var m5e=h5e(P6()),V1=F6(),ae=$1(),we=E7(),Se=wd(),A7=jP(),g5e=$P(),y5e=d7(),MP=C7();(0,g5e.polyfillGlobalThis)();var v5e={url:V1.GOTRUE_URL,storageKey:V1.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:V1.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},U1=30*1e3,UP=3;async function VP(e,t,r){return await r()}var q6=class e{constructor(t){var r,i;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=e.nextInstanceID,e.nextInstanceID+=1,this.instanceID>0&&(0,Se.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let n=Object.assign(Object.assign({},v5e),t);if(this.logDebugMessages=!!n.debug,typeof n.debug=="function"&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new m5e.default({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=(0,Se.resolveFetch)(n.fetch),this.lock=n.lock||VP,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:(0,Se.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=MP.navigatorLock:this.lock=VP,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?n.storage?this.storage=n.storage:(0,Se.supportsLocalStorage)()?this.storage=A7.localStorageAdapter:(this.memoryStorage={},this.storage=(0,A7.memoryLocalStorageAdapter)(this.memoryStorage)):(this.memoryStorage={},this.storage=(0,A7.memoryLocalStorageAdapter)(this.memoryStorage)),(0,Se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${y5e.version}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{let t=(0,Se.isBrowser)()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",t),t||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:r,error:i}=await this._getSessionFromURL(t);if(i)return this._debug("#_initialize()","error detecting session from URL",i),i?.message==="Identity is already linked"||i?.message==="Identity is already linked to another user"?{error:i}:(await this._removeSession(),{error:i});let{session:n,redirectType:s}=r;return this._debug("#_initialize()","detected session in URL",n,"redirect type",s),await this._saveSession(n),setTimeout(async()=>{s==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return(0,ae.isAuthError)(t)?{error:t}:{error:new ae.AuthUnknownError("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,i,n;try{let s=await(0,we._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(r=t?.options)===null||r===void 0?void 0:r.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}},xform:we._sessionResponse}),{data:a,error:o}=s;if(o||!a)return{data:{user:null,session:null},error:o};let u=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(s){if((0,ae.isAuthError)(s))return{data:{user:null,session:null},error:s};throw s}}async signUp(t){var r,i,n;try{let s;if("email"in t){let{email:c,password:d,options:p}=t,f=null,h=null;this.flowType==="pkce"&&([f,h]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,we._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:p?.emailRedirectTo,body:{email:c,password:d,data:(r=p?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:f,code_challenge_method:h},xform:we._sessionResponse})}else if("phone"in t){let{phone:c,password:d,options:p}=t;s=await(0,we._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:d,data:(i=p?.data)!==null&&i!==void 0?i:{},channel:(n=p?.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:p?.captchaToken}},xform:we._sessionResponse})}else throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:a,error:o}=s;if(o||!a)return{data:{user:null,session:null},error:o};let u=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(s){if((0,ae.isAuthError)(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithPassword(t){try{let r;if("email"in t){let{email:s,password:a,options:o}=t;r=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:we._sessionResponsePassword})}else if("phone"in t){let{phone:s,password:a,options:o}=t;r=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:we._sessionResponsePassword})}else throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:i,error:n}=r;return n?{data:{user:null,session:null},error:n}:!i||!i.session||!i.user?{data:{user:null,session:null},error:new ae.AuthInvalidTokenResponseError}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:n})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOAuth(t){var r,i,n,s;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(i=t.options)===null||i===void 0?void 0:i.scopes,queryParams:(n=t.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(s=t.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async _exchangeCodeForSession(t){let r=await(0,Se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[i,n]=(r??"").split("/"),{data:s,error:a}=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:i},xform:we._sessionResponse});return await(0,Se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),a?{data:{user:null,session:null,redirectType:null},error:a}:!s||!s.session||!s.user?{data:{user:null,session:null,redirectType:null},error:new ae.AuthInvalidTokenResponseError}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign(Object.assign({},s),{redirectType:n??null}),error:a})}async signInWithIdToken(t){try{let{options:r,provider:i,token:n,access_token:s,nonce:a}=t,o=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:n,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:we._sessionResponse}),{data:u,error:l}=o;return l?{data:{user:null,session:null},error:l}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new ae.AuthInvalidTokenResponseError}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:l})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOtp(t){var r,i,n,s,a;try{if("email"in t){let{email:o,options:u}=t,l=null,c=null;this.flowType==="pkce"&&([l,c]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:d}=await(0,we._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(i=u?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:l,code_challenge_method:c},redirectTo:u?.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in t){let{phone:o,options:u}=t,{data:l,error:c}=await(0,we._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(n=u?.data)!==null&&n!==void 0?n:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(a=u?.channel)!==null&&a!==void 0?a:"sms"}});return{data:{user:null,session:null,messageId:l?.message_id},error:c}}throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(o){if((0,ae.isAuthError)(o))return{data:{user:null,session:null},error:o};throw o}}async verifyOtp(t){var r,i;try{let n,s;"options"in t&&(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo,s=(i=t.options)===null||i===void 0?void 0:i.captchaToken);let{data:a,error:o}=await(0,we._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:we._sessionResponse});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");let u=a.session,l=a.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(n){if((0,ae.isAuthError)(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(t){var r,i,n;try{let s=null,a=null;return this.flowType==="pkce"&&([s,a]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),await(0,we._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(i=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&i!==void 0?i:void 0}),!((n=t?.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:a}),headers:this.headers,xform:we._ssoResponse})}catch(s){if((0,ae.isAuthError)(s))return{data:null,error:s};throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{let{data:{session:r},error:i}=t;if(i)throw i;if(!r)throw new ae.AuthSessionMissingError;let{error:n}=await(0,we._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return{data:{user:null,session:null},error:n}})}catch(t){if((0,ae.isAuthError)(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{let r=`${this.url}/resend`;if("email"in t){let{email:i,type:n,options:s}=t,{error:a}=await(0,we._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:i,type:n,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return{data:{user:null,session:null},error:a}}else if("phone"in t){let{phone:i,type:n,options:s}=t,{data:a,error:o}=await(0,we._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:i,type:n,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return{data:{user:null,session:null,messageId:a?.message_id},error:o}}throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){let i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await i,await r()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let i=r();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){let n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await t(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null,r=await(0,Se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};let i=t.expires_at?t.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",t.expires_at),!i){if(this.storage.isServer){let a=this.suppressGetSessionWarning;t=new Proxy(t,{get:(u,l,c)=>(!a&&l==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),a=!0,this.suppressGetSessionWarning=!0),Reflect.get(u,l,c))})}return{data:{session:t},error:null}}let{session:n,error:s}=await this._callRefreshToken(t.refresh_token);return s?{data:{session:null},error:s}:{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await(0,we._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:we._userResponse}):await this._useSession(async r=>{var i,n,s;let{data:a,error:o}=r;if(o)throw o;return!(!((i=a.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ae.AuthSessionMissingError}:await(0,we._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0,xform:we._userResponse})})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async i=>{let{data:n,error:s}=i;if(s)throw s;if(!n.session)throw new ae.AuthSessionMissingError;let a=n.session,o=null,u=null;this.flowType==="pkce"&&t.email!=null&&([o,u]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:l,error:c}=await(0,we._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:u}),jwt:a.access_token,xform:we._userResponse});if(c)throw c;return a.user=l.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),{data:{user:a.user},error:null}})}catch(i){if((0,ae.isAuthError)(i))return{data:{user:null},error:i};throw i}}_decodeJWT(t){return(0,Se.decodeJWTPayload)(t)}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new ae.AuthSessionMissingError;let r=Date.now()/1e3,i=r,n=!0,s=null,a=(0,Se.decodeJWTPayload)(t.access_token);if(a.exp&&(i=a.exp,n=i<=r),n){let{session:o,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!o)return{data:{user:null,session:null},error:null};s=o}else{let{data:o,error:u}=await this._getUser(t.access_token);if(u)throw u;s={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:i-r,expires_at:i},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return{data:{user:s.user,session:s},error:null}}catch(r){if((0,ae.isAuthError)(r))return{data:{session:null,user:null},error:r};throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var i;if(!t){let{data:a,error:o}=r;if(o)throw o;t=(i=a.session)!==null&&i!==void 0?i:void 0}if(!t?.refresh_token)throw new ae.AuthSessionMissingError;let{session:n,error:s}=await this._callRefreshToken(t.refresh_token);return s?{data:{user:null,session:null},error:s}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async _getSessionFromURL(t){try{if(!(0,Se.isBrowser)())throw new ae.AuthImplicitGrantRedirectError("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new ae.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!t)throw new ae.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");let r=(0,Se.parseParametersFromURL)(window.location.href);if(t){if(!r.code)throw new ae.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:x,error:D}=await this._exchangeCodeForSession(r.code);if(D)throw D;let w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:x.session,redirectType:null},error:null}}if(r.error||r.error_description||r.error_code)throw new ae.AuthImplicitGrantRedirectError(r.error_description||"Error in URL with unspecified error_description",{error:r.error||"unspecified_error",code:r.error_code||"unspecified_code"});let{provider_token:i,provider_refresh_token:n,access_token:s,refresh_token:a,expires_in:o,expires_at:u,token_type:l}=r;if(!s||!o||!a||!l)throw new ae.AuthImplicitGrantRedirectError("No session defined in URL");let c=Math.round(Date.now()/1e3),d=parseInt(o),p=c+d;u&&(p=parseInt(u));let f=p-c;f*1e3<=U1&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${d}s`);let h=p-d;c-h>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",h,p,c):c-h<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",h,p,c);let{data:g,error:v}=await this._getUser(s);if(v)throw v;let y={provider_token:i,provider_refresh_token:n,access_token:s,expires_in:d,expires_at:p,refresh_token:a,token_type:l,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:r.type},error:null}}catch(r){if((0,ae.isAuthError)(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantFlow(){let t=(0,Se.parseParametersFromURL)(window.location.href);return!!((0,Se.isBrowser)()&&(t.access_token||t.error_description))}async _isPKCEFlow(){let t=(0,Se.parseParametersFromURL)(window.location.href),r=await(0,Se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var i;let{data:n,error:s}=r;if(s)return{error:s};let a=(i=n.session)===null||i===void 0?void 0:i.access_token;if(a){let{error:o}=await this.admin.signOut(a,t);if(o&&!((0,ae.isAuthApiError)(o)&&(o.status===404||o.status===401||o.status===403)))return{error:o}}return t!=="others"&&(await this._removeSession(),await(0,Se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(t){let r=(0,Se.uuid)(),i={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,i),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:i}}}async _emitInitialSession(t){return await this._useSession(async r=>{var i,n;try{let{data:{session:s},error:a}=r;if(a)throw a;await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",t,"session",s)}catch(s){await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",s),console.error(s)}})}async resetPasswordForEmail(t,r={}){let i=null,n=null;this.flowType==="pkce"&&([i,n]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,we._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:i,code_challenge_method:n,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,ae.isAuthError)(s))return{data:null,error:s};throw s}}async getUserIdentities(){var t;try{let{data:r,error:i}=await this.getUser();if(i)throw i;return{data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async linkIdentity(t){var r;try{let{data:i,error:n}=await this._useSession(async s=>{var a,o,u,l,c;let{data:d,error:p}=s;if(p)throw p;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,we._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})});if(n)throw n;return(0,Se.isBrowser)()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(i?.url),{data:{provider:t.provider,url:i?.url},error:null}}catch(i){if((0,ae.isAuthError)(i))return{data:{provider:t.provider,url:null},error:i};throw i}}async unlinkIdentity(t){try{return await this._useSession(async r=>{var i,n;let{data:s,error:a}=r;if(a)throw a;return await(0,we._request)(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(n=(i=s.session)===null||i===void 0?void 0:i.access_token)!==null&&n!==void 0?n:void 0})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async _refreshAccessToken(t){let r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{let i=Date.now();return await(0,Se.retryable)(async n=>(n>0&&await(0,Se.sleep)(200*Math.pow(2,n-1)),this._debug(r,"refreshing attempt",n),await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:we._sessionResponse})),(n,s)=>{let a=200*Math.pow(2,n);return s&&(0,ae.isAuthRetryableFetchError)(s)&&Date.now()+a-i<U1})}catch(i){if(this._debug(r,"error",i),(0,ae.isAuthError)(i))return{data:{session:null,user:null},error:i};throw i}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){let i=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",i),(0,Se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(i),{data:{provider:t,url:i},error:null}}async _recoverAndRefresh(){var t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let i=await(0,Se.getItemAsync)(this.storage,this.storageKey);if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}let n=Math.round(Date.now()/1e3),s=((t=i.expires_at)!==null&&t!==void 0?t:1/0)<n+V1.EXPIRY_MARGIN;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${V1.EXPIRY_MARGIN}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:a}=await this._callRefreshToken(i.refresh_token);a&&(console.error(a),(0,ae.isAuthRetryableFetchError)(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var r,i;if(!t)throw new ae.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Se.Deferred;let{data:s,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!s.session)throw new ae.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let o={session:s.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(s){if(this._debug(n,"error",s),(0,ae.isAuthError)(s)){let a={session:null,error:s};return(0,ae.isAuthRetryableFetchError)(s)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(s),s}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(t,r,i=!0){let n=`#_notifyAllSubscribers(${t})`;this._debug(n,"begin",r,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:t,session:r});let s=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,r)}catch(u){s.push(u)}});if(await Promise.all(a),s.length>0){for(let o=0;o<s.length;o+=1)console.error(s[o]);throw s[0]}}finally{this._debug(n,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await(0,Se.setItemAsync)(this.storage,this.storageKey,t)}async _removeSession(){this._debug("#_removeSession()"),await(0,Se.removeItemAsync)(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&(0,Se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let t=setInterval(()=>this._autoRefreshTokenTick(),U1);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let t=Date.now();try{return await this._useSession(async r=>{let{data:{session:i}}=r;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let n=Math.floor((i.expires_at*1e3-t)/U1);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${U1}ms, refresh threshold is ${UP} ticks`),n<=UP&&await this._callRefreshToken(i.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof MP.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,Se.isBrowser)()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){let r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,r,i){let n=[`provider=${encodeURIComponent(r)}`];if(i?.redirectTo&&n.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&n.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){let[s,a]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});n.push(o.toString())}if(i?.queryParams){let s=new URLSearchParams(i.queryParams);n.push(s.toString())}return i?.skipBrowserRedirect&&n.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${t}?${n.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var i;let{data:n,error:s}=r;return s?{data:null,error:s}:await(0,we._request)(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async _enroll(t){try{return await this._useSession(async r=>{var i,n;let{data:s,error:a}=r;if(a)return{data:null,error:a};let{data:o,error:u}=await(0,we._request)(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:t.friendlyName,factor_type:t.factorType,issuer:t.issuer},headers:this.headers,jwt:(i=s?.session)===null||i===void 0?void 0:i.access_token});return u?{data:null,error:u}:(!((n=o?.totp)===null||n===void 0)&&n.qr_code&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:s}=r;if(s)return{data:null,error:s};let{data:a,error:o}=await(0,we._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:o})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:s}=r;return s?{data:null,error:s}:await(0,we._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}})}async _challengeAndVerify(t){let{data:r,error:i}=await this._challenge({factorId:t.factorId});return i?{data:null,error:i}:await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let i=t?.factors||[],n=i.filter(s=>s.factor_type==="totp"&&s.status==="verified");return{data:{all:i,totp:n},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var r,i;let{data:{session:n},error:s}=t;if(s)return{data:null,error:s};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let a=this._decodeJWT(n.access_token),o=null;a.aal&&(o=a.aal);let u=o;((i=(r=n.user.factors)===null||r===void 0?void 0:r.filter(d=>d.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");let c=a.amr||[];return{data:{currentLevel:o,nextLevel:u,currentAuthenticationMethods:c},error:null}}))}};H1.default=q6;q6.nextInstanceID=0});var HP=m(z1=>{"use strict";var w5e=z1&&z1.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(z1,"__esModule",{value:!0});var _5e=w5e(P6()),D5e=_5e.default;z1.default=D5e});var zP=m(G1=>{"use strict";var b5e=G1&&G1.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(G1,"__esModule",{value:!0});var E5e=b5e(T7()),x5e=E5e.default;G1.default=x5e});var WP=m(GP=>{"use strict";Object.defineProperty(GP,"__esModule",{value:!0})});var F7=m(ft=>{"use strict";var S5e=ft&&ft.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),XP=ft&&ft.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&S5e(t,e,r)},j6=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ft,"__esModule",{value:!0});ft.lockInternals=ft.NavigatorLockAcquireTimeoutError=ft.navigatorLock=ft.AuthClient=ft.AuthAdminApi=ft.GoTrueClient=ft.GoTrueAdminApi=void 0;var C5e=j6(P6());ft.GoTrueAdminApi=C5e.default;var A5e=j6(T7());ft.GoTrueClient=A5e.default;var T5e=j6(HP());ft.AuthAdminApi=T5e.default;var O5e=j6(zP());ft.AuthClient=O5e.default;XP(WP(),ft);XP($1(),ft);var O7=C7();Object.defineProperty(ft,"navigatorLock",{enumerable:!0,get:function(){return O7.navigatorLock}});Object.defineProperty(ft,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return O7.NavigatorLockAcquireTimeoutError}});Object.defineProperty(ft,"lockInternals",{enumerable:!0,get:function(){return O7.internals}})});var YP=m($6=>{"use strict";Object.defineProperty($6,"__esModule",{value:!0});$6.SupabaseAuthClient=void 0;var F5e=F7(),N7=class extends F5e.AuthClient{constructor(t){super(t)}};$6.SupabaseAuthClient=N7});var R7=m(W1=>{"use strict";var N5e=W1&&W1.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(W1,"__esModule",{value:!0});var k5e=ov(),R5e=aR(),P5e=r7(),I5e=OP(),M6=NP(),L5e=RP(),KP=PP(),B5e=YP(),k7=class{constructor(t,r,i){var n,s,a;if(this.supabaseUrl=t,this.supabaseKey=r,!t)throw new Error("supabaseUrl is required.");if(!r)throw new Error("supabaseKey is required.");let o=(0,KP.stripTrailingSlash)(t);this.realtimeUrl=`${o}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${o}/auth/v1`,this.storageUrl=`${o}/storage/v1`,this.functionsUrl=`${o}/functions/v1`;let u=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,l={db:M6.DEFAULT_DB_OPTIONS,realtime:M6.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},M6.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:M6.DEFAULT_GLOBAL_OPTIONS},c=(0,KP.applySettingDefaults)(i??{},l);this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},this.auth=this._initSupabaseAuthClient((a=c.auth)!==null&&a!==void 0?a:{},this.headers,c.global.fetch),this.fetch=(0,L5e.fetchWithAuth)(r,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},c.realtime)),this.rest=new R5e.PostgrestClient(`${o}/rest/v1`,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new k5e.FunctionsClient(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new I5e.StorageClient(this.storageUrl,this.headers,this.fetch)}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,r={},i={}){return this.rest.rpc(t,r,i)}channel(t,r={config:{}}){return this.realtime.channel(t,r)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,r;return N5e(this,void 0,void 0,function*(){let{data:i}=yield this.auth.getSession();return(r=(t=i.session)===null||t===void 0?void 0:t.access_token)!==null&&r!==void 0?r:null})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,storageKey:s,flowType:a,debug:o},u,l){var c;let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new B5e.SupabaseAuthClient({url:this.authUrl,headers:Object.assign(Object.assign({},d),u),storageKey:s,autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,flowType:a,debug:o,fetch:l,hasCustomAuthorizationHeader:(c="Authorization"in this.headers)!==null&&c!==void 0?c:!1})}_initRealtimeClient(t){return new P5e.RealtimeClient(this.realtimeUrl,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,i)=>{this._handleTokenChanged(r,"CLIENT",i?.access_token)})}_handleTokenChanged(t,r,i){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==i?(this.realtime.setAuth(i??null),this.changedAccessToken=i):t==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};W1.default=k7});var QP=m(ht=>{"use strict";var q5e=ht&&ht.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),JP=ht&&ht.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&q5e(t,e,r)},ZP=ht&&ht.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ht,"__esModule",{value:!0});ht.createClient=ht.SupabaseClient=ht.FunctionRegion=ht.FunctionsError=ht.FunctionsRelayError=ht.FunctionsFetchError=ht.FunctionsHttpError=void 0;var j5e=ZP(R7());JP(F7(),ht);var X1=ov();Object.defineProperty(ht,"FunctionsHttpError",{enumerable:!0,get:function(){return X1.FunctionsHttpError}});Object.defineProperty(ht,"FunctionsFetchError",{enumerable:!0,get:function(){return X1.FunctionsFetchError}});Object.defineProperty(ht,"FunctionsRelayError",{enumerable:!0,get:function(){return X1.FunctionsRelayError}});Object.defineProperty(ht,"FunctionsError",{enumerable:!0,get:function(){return X1.FunctionsError}});Object.defineProperty(ht,"FunctionRegion",{enumerable:!0,get:function(){return X1.FunctionRegion}});JP(r7(),ht);var $5e=R7();Object.defineProperty(ht,"SupabaseClient",{enumerable:!0,get:function(){return ZP($5e).default}});var M5e=(e,t,r)=>new j5e.default(e,t,r);ht.createClient=M5e});var iI=m((Sut,rI)=>{var tI={};rI.exports=tI;var eI={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(eI).forEach(function(e){var t=eI[e],r=tI[e]=[];r.open="\x1B["+t[0]+"m",r.close="\x1B["+t[1]+"m"})});var sI=m((Cut,nI)=>{"use strict";nI.exports=function(e,t){t=t||process.argv;var r=t.indexOf("--"),i=/^-{1,2}/.test(e)?"":"--",n=t.indexOf(i+e);return n!==-1&&(r===-1?!0:n<r)}});var oI=m((Aut,aI)=>{"use strict";var U5e=require("os"),ss=sI(),si=process.env,bd=void 0;ss("no-color")||ss("no-colors")||ss("color=false")?bd=!1:(ss("color")||ss("colors")||ss("color=true")||ss("color=always"))&&(bd=!0);"FORCE_COLOR"in si&&(bd=si.FORCE_COLOR.length===0||parseInt(si.FORCE_COLOR,10)!==0);function V5e(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function H5e(e){if(bd===!1)return 0;if(ss("color=16m")||ss("color=full")||ss("color=truecolor"))return 3;if(ss("color=256"))return 2;if(e&&!e.isTTY&&bd!==!0)return 0;var t=bd?1:0;if(process.platform==="win32"){var r=U5e.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in si)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(n){return n in si})||si.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in si)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(si.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in si){var i=parseInt((si.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(si.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(si.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(si.TERM)||"COLORTERM"in si?1:(si.TERM==="dumb",t)}function P7(e){var t=H5e(e);return V5e(t)}aI.exports={supportsColor:P7,stdout:P7(process.stdout),stderr:P7(process.stderr)}});var lI=m((Tut,uI)=>{uI.exports=function(t,r){var i="";t=t||"Run the trap, drop the bass",t=t.split("");var n={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return t.forEach(function(s){s=s.toLowerCase();var a=n[s]||[" "],o=Math.floor(Math.random()*a.length);typeof n[s]<"u"?i+=n[s][o]:i+=s}),i}});var dI=m((Out,cI)=>{cI.exports=function(t,r){t=t||" he is here ";var i={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},n=[].concat(i.up,i.down,i.mid);function s(u){var l=Math.floor(Math.random()*u);return l}function a(u){var l=!1;return n.filter(function(c){l=c===u}),l}function o(u,l){var c="",d,p;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",u=u.split("");for(p in u)if(!a(p)){switch(c=c+u[p],d={up:0,down:0,mid:0},l.size){case"mini":d.up=s(8),d.mid=s(2),d.down=s(8);break;case"maxi":d.up=s(16)+3,d.mid=s(4)+1,d.down=s(64)+3;break;default:d.up=s(8)+1,d.mid=s(6)/2,d.down=s(8)+1;break}var f=["up","mid","down"];for(var h in f)for(var g=f[h],v=0;v<=d[g];v++)l[g]&&(c=c+i[g][s(i[g].length)])}return c}return o(t,r)}});var fI=m((Fut,pI)=>{pI.exports=function(e){return function(t,r,i){if(t===" ")return t;switch(r%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}});var mI=m((Nut,hI)=>{hI.exports=function(e){return function(t,r,i){return r%2===0?t:e.inverse(t)}}});var yI=m((kut,gI)=>{gI.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(r,i,n){return r===" "?r:e[t[i++%t.length]](r)}}});var wI=m((Rut,vI)=>{vI.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,i,n){return r===" "?r:e[t[Math.round(Math.random()*(t.length-2))]](r)}}});var SI=m((Iut,xI)=>{var be={};xI.exports=be;be.themes={};var z5e=require("util"),wl=be.styles=iI(),DI=Object.defineProperties,G5e=new RegExp(/[\r\n]+/g);be.supportsColor=oI().supportsColor;typeof be.enabled>"u"&&(be.enabled=be.supportsColor()!==!1);be.enable=function(){be.enabled=!0};be.disable=function(){be.enabled=!1};be.stripColors=be.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")};var Put=be.stylize=function(t,r){if(!be.enabled)return t+"";var i=wl[r];return!i&&r in be?be[r](t):i.open+t+i.close},W5e=/[|\\{}()[\]^$+*?.]/g,X5e=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(W5e,"\\$&")};function bI(e){var t=function r(){return K5e.apply(r,arguments)};return t._styles=e,t.__proto__=Y5e,t}var EI=function(){var e={};return wl.grey=wl.gray,Object.keys(wl).forEach(function(t){wl[t].closeRe=new RegExp(X5e(wl[t].close),"g"),e[t]={get:function(){return bI(this._styles.concat(t))}}}),e}(),Y5e=DI(function(){},EI);function K5e(){var e=Array.prototype.slice.call(arguments),t=e.map(function(a){return a!=null&&a.constructor===String?a:z5e.inspect(a)}).join(" ");if(!be.enabled||!t)return t;for(var r=t.indexOf(`
29
+ `+r)}function ml(e,t,r,i,n){if(e.listenerCount("wsClientError")){let s=new Error(n);Error.captureStackTrace(s,ml),e.emit("wsClientError",s,r,t)}else R1(r,i,n)}});var fP=m((zot,pP)=>{"use strict";var Ia=Jv();Ia.createWebSocketStream=rP();Ia.Server=dP();Ia.Receiver=Uv();Ia.Sender=Hv();Ia.WebSocket=Ia;Ia.WebSocketServer=Ia.Server;pP.exports=Ia});var mP=m(is=>{"use strict";var k9e=is&&is.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R9e=is&&is.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),hP=is&&is.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&k9e(t,e,r);return R9e(t,e),t},t7=is&&is.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(is,"__esModule",{value:!0});var Vr=c6(),P9e=t7(uR()),I9e=t7(bv()),L9e=d6(),B9e=t7(Nv()),q9e=()=>{},j9e=typeof WebSocket<"u",Qv=class{constructor(t,r){var i;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=Vr.DEFAULT_HEADERS,this.params={},this.timeout=Vr.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=q9e,this.conn=null,this.sendBuffer=[],this.serializer=new P9e.default,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=s=>{let a;return s?a=s:typeof fetch>"u"?a=(...o)=>Promise.resolve().then(()=>hP(Ko())).then(({default:u})=>u(...o)):a=fetch,(...o)=>a(...o)},this.endPoint=`${t}/${Vr.TRANSPORTS.websocket}`,this.httpEndpoint=(0,L9e.httpEndpointURL)(t),r?.transport?this.transport=r.transport:this.transport=null,r?.params&&(this.params=r.params),r?.headers&&(this.headers=Object.assign(Object.assign({},this.headers),r.headers)),r?.timeout&&(this.timeout=r.timeout),r?.logger&&(this.logger=r.logger),r?.heartbeatIntervalMs&&(this.heartbeatIntervalMs=r.heartbeatIntervalMs);let n=(i=r?.params)===null||i===void 0?void 0:i.apikey;n&&(this.accessToken=n,this.apiKey=n),this.reconnectAfterMs=r?.reconnectAfterMs?r.reconnectAfterMs:s=>[1e3,2e3,5e3,1e4][s-1]||1e4,this.encode=r?.encode?r.encode:(s,a)=>a(JSON.stringify(s)),this.decode=r?.decode?r.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new I9e.default(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(j9e){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new e7(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),Promise.resolve().then(()=>hP(fP())).then(({default:t})=>{this.conn=new t(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(t,r){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,r??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(t){let r=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.disconnect(),t}log(t,r,i){this.logger(t,r,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Vr.SOCKET_STATES.connecting:return Vr.CONNECTION_STATE.Connecting;case Vr.SOCKET_STATES.open:return Vr.CONNECTION_STATE.Open;case Vr.SOCKET_STATES.closing:return Vr.CONNECTION_STATE.Closing;default:return Vr.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===Vr.CONNECTION_STATE.Open}channel(t,r={config:{}}){let i=new B9e.default(`realtime:${t}`,r,this);return this.channels.push(i),i}push(t){let{topic:r,event:i,payload:n,ref:s}=t,a=()=>{this.encode(t,o=>{var u;(u=this.conn)===null||u===void 0||u.send(o)})};this.log("push",`${r} ${i} (${s})`,n),this.isConnected()?a():this.sendBuffer.push(a)}setAuth(t){this.accessToken=t,this.channels.forEach(r=>{t&&r.updateJoinPayload({access_token:t}),r.joinedOnce&&r._isJoined()&&r._push(Vr.CHANNEL_EVENTS.access_token,{access_token:t})})}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let r=this.channels.find(i=>i.topic===t&&(i._isJoined()||i._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r._joinRef()!==t._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Vr.VSN}))}_onConnMessage(t){this.decode(t.data,r=>{let{topic:i,event:n,payload:s,ref:a}=r;(a&&a===this.pendingHeartbeatRef||n===s?.type)&&(this.pendingHeartbeatRef=null),this.log("receive",`${s.status||""} ${i} ${n} ${a&&"("+a+")"||""}`,s),this.channels.filter(o=>o._isMember(i)).forEach(o=>o._trigger(n,s,a)),this.stateChangeCallbacks.message.forEach(o=>o(r))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(t=>t())}_onConnClose(t){this.log("transport","close",t),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(r=>r(t))}_onConnError(t){this.log("transport",t.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(r=>r(t))}_triggerChanError(){this.channels.forEach(t=>t._trigger(Vr.CHANNEL_EVENTS.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;let i=t.match(/\?/)?"&":"?",n=new URLSearchParams(r);return`${t}${i}${n}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_sendHeartbeat(){var t;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(t=this.conn)===null||t===void 0||t.close(Vr.WS_CLOSE_NORMAL,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}};is.default=Qv;var e7=class{constructor(t,r,i){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Vr.SOCKET_STATES.connecting,this.send=()=>{},this.url=null,this.url=t,this.close=i.close}}});var r7=m(Ye=>{"use strict";var $9e=Ye&&Ye.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),M9e=Ye&&Ye.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gP=Ye&&Ye.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$9e(t,e,r);return M9e(t,e),t},U9e=Ye&&Ye.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.REALTIME_CHANNEL_STATES=Ye.REALTIME_SUBSCRIBE_STATES=Ye.REALTIME_PRESENCE_LISTEN_EVENTS=Ye.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Ye.REALTIME_LISTEN_TYPES=Ye.RealtimeClient=Ye.RealtimeChannel=Ye.RealtimePresence=void 0;var V9e=U9e(mP());Ye.RealtimeClient=V9e.default;var P1=gP(Nv());Ye.RealtimeChannel=P1.default;Object.defineProperty(Ye,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return P1.REALTIME_LISTEN_TYPES}});Object.defineProperty(Ye,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return P1.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Ye,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return P1.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Ye,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return P1.REALTIME_CHANNEL_STATES}});var yP=gP(Av());Ye.RealtimePresence=yP.default;Object.defineProperty(Ye,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return yP.REALTIME_PRESENCE_LISTEN_EVENTS}})});var L1=m(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.StorageUnknownError=Ns.StorageApiError=Ns.isStorageError=Ns.StorageError=void 0;var I1=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};Ns.StorageError=I1;function H9e(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}Ns.isStorageError=H9e;var i7=class extends I1{constructor(t,r){super(t),this.name="StorageApiError",this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}};Ns.StorageApiError=i7;var n7=class extends I1{constructor(t,r){super(t),this.name="StorageUnknownError",this.originalError=r}};Ns.StorageUnknownError=n7});var x6=m(xi=>{"use strict";var z9e=xi&&xi.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),G9e=xi&&xi.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vP=xi&&xi.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&z9e(t,e,r);return G9e(t,e),t},W9e=xi&&xi.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(xi,"__esModule",{value:!0});xi.resolveResponse=xi.resolveFetch=void 0;var X9e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>vP(Ko())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};xi.resolveFetch=X9e;var Y9e=()=>W9e(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>vP(Ko()))).Response:Response});xi.resolveResponse=Y9e});var o7=m(_n=>{"use strict";var hd=_n&&_n.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(_n,"__esModule",{value:!0});_n.remove=_n.put=_n.post=_n.get=void 0;var s7=L1(),K9e=x6(),a7=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),J9e=(e,t)=>hd(void 0,void 0,void 0,function*(){let r=yield(0,K9e.resolveResponse)();e instanceof r?e.json().then(i=>{t(new s7.StorageApiError(a7(i),e.status||500))}).catch(i=>{t(new s7.StorageUnknownError(a7(i),i))}):t(new s7.StorageUnknownError(a7(e),e))}),Z9e=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json"},t?.headers),n.body=JSON.stringify(i),Object.assign(Object.assign({},n),r))};function S6(e,t,r,i,n,s){return hd(this,void 0,void 0,function*(){return new Promise((a,o)=>{e(r,Z9e(t,i,n,s)).then(u=>{if(!u.ok)throw u;return i?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>J9e(u,o))})})}function Q9e(e,t,r,i){return hd(this,void 0,void 0,function*(){return S6(e,"GET",t,r,i)})}_n.get=Q9e;function eye(e,t,r,i,n){return hd(this,void 0,void 0,function*(){return S6(e,"POST",t,i,n,r)})}_n.post=eye;function tye(e,t,r,i,n){return hd(this,void 0,void 0,function*(){return S6(e,"PUT",t,i,n,r)})}_n.put=tye;function rye(e,t,r,i,n){return hd(this,void 0,void 0,function*(){return S6(e,"DELETE",t,i,n,r)})}_n.remove=rye});var _P=m(B1=>{"use strict";var Dn=B1&&B1.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(B1,"__esModule",{value:!0});var ns=L1(),eu=o7(),iye=x6(),nye={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},wP={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},u7=class{constructor(t,r={},i,n){this.url=t,this.headers=r,this.bucketId=i,this.fetch=(0,iye.resolveFetch)(n)}uploadOrUpdate(t,r,i,n){return Dn(this,void 0,void 0,function*(){try{let s,a=Object.assign(Object.assign({},wP),n),o=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(a.upsert)});typeof Blob<"u"&&i instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),s.append("",i)):typeof FormData<"u"&&i instanceof FormData?(s=i,s.append("cacheControl",a.cacheControl)):(s=i,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType);let u=this._removeEmptyFolders(r),l=this._getFinalPath(u),c=yield this.fetch(`${this.url}/object/${l}`,Object.assign({method:t,body:s,headers:o},a?.duplex?{duplex:a.duplex}:{})),d=yield c.json();return c.ok?{data:{path:u,id:d.Id,fullPath:d.Key},error:null}:{data:null,error:d}}catch(s){if((0,ns.isStorageError)(s))return{data:null,error:s};throw s}})}upload(t,r,i){return Dn(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,r,i)})}uploadToSignedUrl(t,r,i,n){return Dn(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(t),a=this._getFinalPath(s),o=new URL(this.url+`/object/upload/sign/${a}`);o.searchParams.set("token",r);try{let u,l=Object.assign({upsert:wP.upsert},n),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(l.upsert)});typeof Blob<"u"&&i instanceof Blob?(u=new FormData,u.append("cacheControl",l.cacheControl),u.append("",i)):typeof FormData<"u"&&i instanceof FormData?(u=i,u.append("cacheControl",l.cacheControl)):(u=i,c["cache-control"]=`max-age=${l.cacheControl}`,c["content-type"]=l.contentType);let d=yield this.fetch(o.toString(),{method:"PUT",body:u,headers:c}),p=yield d.json();return d.ok?{data:{path:s,fullPath:p.Key},error:null}:{data:null,error:p}}catch(u){if((0,ns.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(t,r){return Dn(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),n=Object.assign({},this.headers);r?.upsert&&(n["x-upsert"]="true");let s=yield(0,eu.post)(this.fetch,`${this.url}/object/upload/sign/${i}`,{},{headers:n}),a=new URL(this.url+s.url),o=a.searchParams.get("token");if(!o)throw new ns.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:t,token:o},error:null}}catch(i){if((0,ns.isStorageError)(i))return{data:null,error:i};throw i}})}update(t,r,i){return Dn(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,r,i)})}move(t,r,i){return Dn(this,void 0,void 0,function*(){try{return{data:yield(0,eu.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers}),error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}copy(t,r,i){return Dn(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,eu.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrl(t,r,i){return Dn(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t),s=yield(0,eu.post)(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:r},i?.transform?{transform:i.transform}:{}),{headers:this.headers}),a=i?.download?`&download=${i.download===!0?"":i.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${a}`)},{data:s,error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrls(t,r,i){return Dn(this,void 0,void 0,function*(){try{let n=yield(0,eu.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:t},{headers:this.headers}),s=i?.download?`&download=${i.download===!0?"":i.download}`:"";return{data:n.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${s}`):null})),error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}download(t,r){return Dn(this,void 0,void 0,function*(){let n=typeof r?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(r?.transform||{}),a=s?`?${s}`:"";try{let o=this._getFinalPath(t);return{data:yield(yield(0,eu.get)(this.fetch,`${this.url}/${n}/${o}${a}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(o){if((0,ns.isStorageError)(o))return{data:null,error:o};throw o}})}getPublicUrl(t,r){let i=this._getFinalPath(t),n=[],s=r?.download?`download=${r.download===!0?"":r.download}`:"";s!==""&&n.push(s);let o=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&n.push(u);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${i}${l}`)}}}remove(t){return Dn(this,void 0,void 0,function*(){try{return{data:yield(0,eu.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(r){if((0,ns.isStorageError)(r))return{data:null,error:r};throw r}})}list(t,r,i){return Dn(this,void 0,void 0,function*(){try{let n=Object.assign(Object.assign(Object.assign({},nye),r),{prefix:t||""});return{data:yield(0,eu.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},i),error:null}}catch(n){if((0,ns.isStorageError)(n))return{data:null,error:n};throw n}})}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let r=[];return t.width&&r.push(`width=${t.width}`),t.height&&r.push(`height=${t.height}`),t.resize&&r.push(`resize=${t.resize}`),t.format&&r.push(`format=${t.format}`),t.quality&&r.push(`quality=${t.quality}`),r.join("&")}};B1.default=u7});var DP=m(C6=>{"use strict";Object.defineProperty(C6,"__esModule",{value:!0});C6.version=void 0;C6.version="2.6.0"});var bP=m(A6=>{"use strict";Object.defineProperty(A6,"__esModule",{value:!0});A6.DEFAULT_HEADERS=void 0;var sye=DP();A6.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${sye.version}`}});var EP=m(q1=>{"use strict";var md=q1&&q1.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(q1,"__esModule",{value:!0});var aye=bP(),gd=L1(),yd=o7(),oye=x6(),l7=class{constructor(t,r={},i){this.url=t,this.headers=Object.assign(Object.assign({},aye.DEFAULT_HEADERS),r),this.fetch=(0,oye.resolveFetch)(i)}listBuckets(){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.get)(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if((0,gd.isStorageError)(t))return{data:null,error:t};throw t}})}getBucket(t){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.get)(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(r){if((0,gd.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(t,r={public:!1}){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.post)(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,gd.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(t,r){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.put)(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,gd.isStorageError)(i))return{data:null,error:i};throw i}})}emptyBucket(t){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.post)(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(r){if((0,gd.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(t){return md(this,void 0,void 0,function*(){try{return{data:yield(0,yd.remove)(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if((0,gd.isStorageError)(r))return{data:null,error:r};throw r}})}};q1.default=l7});var SP=m(vd=>{"use strict";var xP=vd&&vd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vd,"__esModule",{value:!0});vd.StorageClient=void 0;var uye=xP(_P()),lye=xP(EP()),c7=class extends lye.default{constructor(t,r={},i){super(t,r,i)}from(t){return new uye.default(this.url,this.headers,t,this.fetch)}};vd.StorageClient=c7});var AP=m(CP=>{"use strict";Object.defineProperty(CP,"__esModule",{value:!0})});var OP=m(ks=>{"use strict";var cye=ks&&ks.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),TP=ks&&ks.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&cye(t,e,r)};Object.defineProperty(ks,"__esModule",{value:!0});ks.StorageClient=void 0;var dye=SP();Object.defineProperty(ks,"StorageClient",{enumerable:!0,get:function(){return dye.StorageClient}});TP(AP(),ks);TP(L1(),ks)});var FP=m(T6=>{"use strict";Object.defineProperty(T6,"__esModule",{value:!0});T6.version=void 0;T6.version="2.44.4"});var NP=m(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.DEFAULT_REALTIME_OPTIONS=Ki.DEFAULT_AUTH_OPTIONS=Ki.DEFAULT_DB_OPTIONS=Ki.DEFAULT_GLOBAL_OPTIONS=Ki.DEFAULT_HEADERS=void 0;var pye=FP(),j1="";typeof Deno<"u"?j1="deno":typeof document<"u"?j1="web":typeof navigator<"u"&&navigator.product==="ReactNative"?j1="react-native":j1="node";Ki.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${j1}/${pye.version}`};Ki.DEFAULT_GLOBAL_OPTIONS={headers:Ki.DEFAULT_HEADERS};Ki.DEFAULT_DB_OPTIONS={schema:"public"};Ki.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Ki.DEFAULT_REALTIME_OPTIONS={}});var RP=m(pr=>{"use strict";var fye=pr&&pr.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),hye=pr&&pr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mye=pr&&pr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&fye(t,e,r);return hye(t,e),t},gye=pr&&pr.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(pr,"__esModule",{value:!0});pr.fetchWithAuth=pr.resolveHeadersConstructor=pr.resolveFetch=void 0;var kP=mye(Ko()),yye=e=>{let t;return e?t=e:typeof fetch>"u"?t=kP.default:t=fetch,(...r)=>t(...r)};pr.resolveFetch=yye;var vye=()=>typeof Headers>"u"?kP.Headers:Headers;pr.resolveHeadersConstructor=vye;var wye=(e,t,r)=>{let i=(0,pr.resolveFetch)(r),n=(0,pr.resolveHeadersConstructor)();return(s,a)=>gye(void 0,void 0,void 0,function*(){var o;let u=(o=yield t())!==null&&o!==void 0?o:e,l=new n(a?.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${u}`),i(s,Object.assign(Object.assign({},a),{headers:l}))})};pr.fetchWithAuth=wye});var PP=m(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.applySettingDefaults=Rs.isBrowser=Rs.stripTrailingSlash=Rs.uuid=void 0;function _ye(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e=="x"?t:t&3|8;return r.toString(16)})}Rs.uuid=_ye;function Dye(e){return e.replace(/\/$/,"")}Rs.stripTrailingSlash=Dye;var bye=()=>typeof window<"u";Rs.isBrowser=bye;function Eye(e,t){let{db:r,auth:i,realtime:n,global:s}=e,{db:a,auth:o,realtime:u,global:l}=t;return{db:Object.assign(Object.assign({},a),r),auth:Object.assign(Object.assign({},o),i),realtime:Object.assign(Object.assign({},u),n),global:Object.assign(Object.assign({},l),s)}}Rs.applySettingDefaults=Eye});var d7=m(O6=>{"use strict";Object.defineProperty(O6,"__esModule",{value:!0});O6.version=void 0;O6.version="2.64.4"});var F6=m(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.API_VERSIONS=fr.API_VERSION_HEADER_NAME=fr.NETWORK_FAILURE=fr.EXPIRY_MARGIN=fr.DEFAULT_HEADERS=fr.AUDIENCE=fr.STORAGE_KEY=fr.GOTRUE_URL=void 0;var xye=d7();fr.GOTRUE_URL="http://localhost:9999";fr.STORAGE_KEY="supabase.auth.token";fr.AUDIENCE="";fr.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${xye.version}`};fr.EXPIRY_MARGIN=10;fr.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};fr.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";fr.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}}});var wd=m(oe=>{"use strict";var Sye=oe&&oe.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),Cye=oe&&oe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Aye=oe&&oe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Sye(t,e,r);return Cye(t,e),t};Object.defineProperty(oe,"__esModule",{value:!0});oe.parseResponseAPIVersion=oe.getCodeChallengeAndMethod=oe.generatePKCEChallenge=oe.generatePKCEVerifier=oe.retryable=oe.sleep=oe.decodeJWTPayload=oe.Deferred=oe.decodeBase64URL=oe.removeItemAsync=oe.getItemAsync=oe.setItemAsync=oe.looksLikeFetchResponse=oe.resolveFetch=oe.parseParametersFromURL=oe.supportsLocalStorage=oe.isBrowser=oe.uuid=oe.expiresAt=void 0;var Tye=F6();function Oye(e){return Math.round(Date.now()/1e3)+e}oe.expiresAt=Oye;function Fye(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}oe.uuid=Fye;var Nye=()=>typeof document<"u";oe.isBrowser=Nye;var gl={tested:!1,writable:!1},kye=()=>{if(!(0,oe.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(gl.tested)return gl.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),gl.tested=!0,gl.writable=!0}catch{gl.tested=!0,gl.writable=!1}return gl.writable};oe.supportsLocalStorage=kye;function Rye(e){let t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((n,s)=>{t[s]=n})}catch{}return r.searchParams.forEach((i,n)=>{t[n]=i}),t}oe.parseParametersFromURL=Rye;var Pye=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>Aye(Ko())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};oe.resolveFetch=Pye;var Iye=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function";oe.looksLikeFetchResponse=Iye;var Lye=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))};oe.setItemAsync=Lye;var Bye=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}};oe.getItemAsync=Bye;var qye=async(e,t)=>{await e.removeItem(t)};oe.removeItemAsync=qye;function IP(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="",i,n,s,a,o,u,l,c=0;for(e=e.replace("-","+").replace("_","/");c<e.length;)a=t.indexOf(e.charAt(c++)),o=t.indexOf(e.charAt(c++)),u=t.indexOf(e.charAt(c++)),l=t.indexOf(e.charAt(c++)),i=a<<2|o>>4,n=(o&15)<<4|u>>2,s=(u&3)<<6|l,r=r+String.fromCharCode(i),u!=64&&n!=0&&(r=r+String.fromCharCode(n)),l!=64&&s!=0&&(r=r+String.fromCharCode(s));return r}oe.decodeBase64URL=IP;var N6=class e{constructor(){this.promise=new e.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}};oe.Deferred=N6;N6.promiseConstructor=Promise;function jye(e){let t=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,r=e.split(".");if(r.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!t.test(r[1]))throw new Error("JWT is not valid: payload is not in base64url format");let i=r[1];return JSON.parse(IP(i))}oe.decodeJWTPayload=jye;async function $ye(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}oe.sleep=$ye;function Mye(e,t){return new Promise((i,n)=>{(async()=>{for(let s=0;s<1/0;s++)try{let a=await e(s);if(!t(s,null,a)){i(a);return}}catch(a){if(!t(s,a)){n(a);return}}})()})}oe.retryable=Mye;function Uye(e){return("0"+e.toString(16)).substr(-2)}function LP(){let t=new Uint32Array(56);if(typeof crypto>"u"){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=r.length,n="";for(let s=0;s<56;s++)n+=r.charAt(Math.floor(Math.random()*i));return n}return crypto.getRandomValues(t),Array.from(t,Uye).join("")}oe.generatePKCEVerifier=LP;async function Vye(e){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(i);return Array.from(n).map(s=>String.fromCharCode(s)).join("")}function Hye(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function BP(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;let r=await Vye(e);return Hye(r)}oe.generatePKCEChallenge=BP;async function zye(e,t,r=!1){let i=LP(),n=i;r&&(n+="/PASSWORD_RECOVERY"),await(0,oe.setItemAsync)(e,`${t}-code-verifier`,n);let s=await BP(i);return[s,i===s?"plain":"s256"]}oe.getCodeChallengeAndMethod=zye;var Gye=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Wye(e){let t=e.headers.get(Tye.API_VERSION_HEADER_NAME);if(!t||!t.match(Gye))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}oe.parseResponseAPIVersion=Wye});var $1=m(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.isAuthWeakPasswordError=Fe.AuthWeakPasswordError=Fe.isAuthRetryableFetchError=Fe.AuthRetryableFetchError=Fe.AuthPKCEGrantCodeExchangeError=Fe.AuthImplicitGrantRedirectError=Fe.AuthInvalidCredentialsError=Fe.AuthInvalidTokenResponseError=Fe.AuthSessionMissingError=Fe.CustomAuthError=Fe.AuthUnknownError=Fe.isAuthApiError=Fe.AuthApiError=Fe.isAuthError=Fe.AuthError=void 0;var _d=class extends Error{constructor(t,r,i){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=i}};Fe.AuthError=_d;function k6(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}Fe.isAuthError=k6;var p7=class extends _d{constructor(t,r,i){super(t,r,i),this.name="AuthApiError",this.status=r,this.code=i}};Fe.AuthApiError=p7;function Xye(e){return k6(e)&&e.name==="AuthApiError"}Fe.isAuthApiError=Xye;var f7=class extends _d{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}};Fe.AuthUnknownError=f7;var Ps=class extends _d{constructor(t,r,i,n){super(t,i,n),this.name=r,this.status=i}};Fe.CustomAuthError=Ps;var h7=class extends Ps{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Fe.AuthSessionMissingError=h7;var m7=class extends Ps{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Fe.AuthInvalidTokenResponseError=m7;var g7=class extends Ps{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}};Fe.AuthInvalidCredentialsError=g7;var y7=class extends Ps{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Fe.AuthImplicitGrantRedirectError=y7;var v7=class extends Ps{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Fe.AuthPKCEGrantCodeExchangeError=v7;var w7=class extends Ps{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}};Fe.AuthRetryableFetchError=w7;function Yye(e){return k6(e)&&e.name==="AuthRetryableFetchError"}Fe.isAuthRetryableFetchError=Yye;var _7=class extends Ps{constructor(t,r,i){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=i}};Fe.AuthWeakPasswordError=_7;function Kye(e){return k6(e)&&e.name==="AuthWeakPasswordError"}Fe.isAuthWeakPasswordError=Kye});var E7=m(Gt=>{"use strict";var Jye=Gt&&Gt.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(Gt,"__esModule",{value:!0});Gt._noResolveJsonResponse=Gt._generateLinkResponse=Gt._ssoResponse=Gt._userResponse=Gt._sessionResponsePassword=Gt._sessionResponse=Gt._request=Gt.handleError=void 0;var R6=F6(),D7=wd(),yl=$1(),vl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Zye=[502,503,504];async function b7(e){var t;if(!(0,D7.looksLikeFetchResponse)(e))throw new yl.AuthRetryableFetchError(vl(e),0);if(Zye.includes(e.status))throw new yl.AuthRetryableFetchError(vl(e),e.status);let r;try{r=await e.json()}catch(s){throw new yl.AuthUnknownError(vl(s),s)}let i,n=(0,D7.parseResponseAPIVersion)(e);if(n&&n.getTime()>=R6.API_VERSIONS["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?i=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(i=r.error_code),i){if(i==="weak_password")throw new yl.AuthWeakPasswordError(vl(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[])}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((s,a)=>s&&typeof a=="string",!0))throw new yl.AuthWeakPasswordError(vl(r),e.status,r.weak_password.reasons);throw new yl.AuthApiError(vl(r),e.status||500,i)}Gt.handleError=b7;var Qye=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),n.body=JSON.stringify(i),Object.assign(Object.assign({},n),r))};async function e5e(e,t,r,i){var n;let s=Object.assign({},i?.headers);s[R6.API_VERSION_HEADER_NAME]||(s[R6.API_VERSION_HEADER_NAME]=R6.API_VERSIONS["2024-01-01"].name),i?.jwt&&(s.Authorization=`Bearer ${i.jwt}`);let a=(n=i?.query)!==null&&n!==void 0?n:{};i?.redirectTo&&(a.redirect_to=i.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await t5e(e,t,r+o,{headers:s,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(u):{data:Object.assign({},u),error:null}}Gt._request=e5e;async function t5e(e,t,r,i,n,s){let a=Qye(t,i,n,s),o;try{o=await e(r,Object.assign({},a))}catch(u){throw console.error(u),new yl.AuthRetryableFetchError(vl(u),0)}if(o.ok||await b7(o),i?.noResolveJson)return o;try{return await o.json()}catch(u){await b7(u)}}function qP(e){var t;let r=null;o5e(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=(0,D7.expiresAt)(e.expires_in)));let i=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:i},error:null}}Gt._sessionResponse=qP;function r5e(e){let t=qP(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,i)=>r&&typeof i=="string",!0)&&(t.data.weak_password=e.weak_password),t}Gt._sessionResponsePassword=r5e;function i5e(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}Gt._userResponse=i5e;function n5e(e){return{data:e,error:null}}Gt._ssoResponse=n5e;function s5e(e){let{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:s}=e,a=Jye(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:s},u=Object.assign({},a);return{data:{properties:o,user:u},error:null}}Gt._generateLinkResponse=s5e;function a5e(e){return e}Gt._noResolveJsonResponse=a5e;function o5e(e){return e.access_token&&e.refresh_token&&e.expires_in}});var P6=m(M1=>{"use strict";var u5e=M1&&M1.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(M1,"__esModule",{value:!0});var Ar=E7(),l5e=wd(),Is=$1(),x7=class{constructor({url:t="",headers:r={},fetch:i}){this.url=t,this.headers=r,this.fetch=(0,l5e.resolveFetch)(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(t,r="global"){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(i){if((0,Is.isAuthError)(i))return{data:null,error:i};throw i}}async inviteUserByEmail(t,r={}){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ar._userResponse})}catch(i){if((0,Is.isAuthError)(i))return{data:{user:null},error:i};throw i}}async generateLink(t){try{let{options:r}=t,i=u5e(t,["options"]),n=Object.assign(Object.assign({},i),r);return"newEmail"in i&&(n.new_email=i?.newEmail,delete n.newEmail),await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:Ar._generateLinkResponse,redirectTo:r?.redirectTo})}catch(r){if((0,Is.isAuthError)(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Is.isAuthError)(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,i,n,s,a,o,u;try{let l={nextPage:null,lastPage:0,total:0},c=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(r=t?.page)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:"",per_page:(s=(n=t?.perPage)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:""},xform:Ar._noResolveJsonResponse});if(c.error)throw c.error;let d=await c.json(),p=(a=c.headers.get("x-total-count"))!==null&&a!==void 0?a:0,f=(u=(o=c.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(h=>{let g=parseInt(h.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(h.split(";")[1].split("=")[1]);l[`${v}Page`]=g}),l.total=parseInt(p)),{data:Object.assign(Object.assign({},d),l),error:null}}catch(l){if((0,Is.isAuthError)(l))return{data:{users:[]},error:l};throw l}}async getUserById(t){try{return await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Is.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){try{return await(0,Ar._request)(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Ar._userResponse})}catch(i){if((0,Is.isAuthError)(i))return{data:{user:null},error:i};throw i}}async deleteUser(t,r=!1){try{return await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ar._userResponse})}catch(i){if((0,Is.isAuthError)(i))return{data:{user:null},error:i};throw i}}async _listFactors(t){try{let{data:r,error:i}=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:r,error:i}}catch(r){if((0,Is.isAuthError)(r))return{data:null,error:r};throw r}}async _deleteFactor(t){try{return{data:await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if((0,Is.isAuthError)(r))return{data:null,error:r};throw r}}};M1.default=x7});var jP=m(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});Dd.memoryLocalStorageAdapter=Dd.localStorageAdapter=void 0;var S7=wd();Dd.localStorageAdapter={getItem:e=>(0,S7.supportsLocalStorage)()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{(0,S7.supportsLocalStorage)()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{(0,S7.supportsLocalStorage)()&&globalThis.localStorage.removeItem(e)}};function c5e(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}Dd.memoryLocalStorageAdapter=c5e});var $P=m(I6=>{"use strict";Object.defineProperty(I6,"__esModule",{value:!0});I6.polyfillGlobalThis=void 0;function d5e(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}I6.polyfillGlobalThis=d5e});var C7=m(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.navigatorLock=Hr.NavigatorLockAcquireTimeoutError=Hr.LockAcquireTimeoutError=Hr.internals=void 0;var p5e=wd();Hr.internals={debug:!!(globalThis&&(0,p5e.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var L6=class extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}};Hr.LockAcquireTimeoutError=L6;var B6=class extends L6{};Hr.NavigatorLockAcquireTimeoutError=B6;async function f5e(e,t,r){Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let i=new globalThis.AbortController;return t>0&&setTimeout(()=>{i.abort(),Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async n=>{if(n){Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name);try{return await r()}finally{Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name)}}else{if(t===0)throw Hr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new B6(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Hr.internals.debug)try{let s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}})}Hr.navigatorLock=f5e});var T7=m(H1=>{"use strict";var h5e=H1&&H1.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(H1,"__esModule",{value:!0});var m5e=h5e(P6()),V1=F6(),ae=$1(),we=E7(),Se=wd(),A7=jP(),g5e=$P(),y5e=d7(),MP=C7();(0,g5e.polyfillGlobalThis)();var v5e={url:V1.GOTRUE_URL,storageKey:V1.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:V1.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},U1=30*1e3,UP=3;async function VP(e,t,r){return await r()}var q6=class e{constructor(t){var r,i;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=e.nextInstanceID,e.nextInstanceID+=1,this.instanceID>0&&(0,Se.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let n=Object.assign(Object.assign({},v5e),t);if(this.logDebugMessages=!!n.debug,typeof n.debug=="function"&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new m5e.default({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=(0,Se.resolveFetch)(n.fetch),this.lock=n.lock||VP,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:(0,Se.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=MP.navigatorLock:this.lock=VP,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?n.storage?this.storage=n.storage:(0,Se.supportsLocalStorage)()?this.storage=A7.localStorageAdapter:(this.memoryStorage={},this.storage=(0,A7.memoryLocalStorageAdapter)(this.memoryStorage)):(this.memoryStorage={},this.storage=(0,A7.memoryLocalStorageAdapter)(this.memoryStorage)),(0,Se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${y5e.version}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{let t=(0,Se.isBrowser)()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",t),t||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:r,error:i}=await this._getSessionFromURL(t);if(i)return this._debug("#_initialize()","error detecting session from URL",i),i?.message==="Identity is already linked"||i?.message==="Identity is already linked to another user"?{error:i}:(await this._removeSession(),{error:i});let{session:n,redirectType:s}=r;return this._debug("#_initialize()","detected session in URL",n,"redirect type",s),await this._saveSession(n),setTimeout(async()=>{s==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return(0,ae.isAuthError)(t)?{error:t}:{error:new ae.AuthUnknownError("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,i,n;try{let s=await(0,we._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(r=t?.options)===null||r===void 0?void 0:r.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}},xform:we._sessionResponse}),{data:a,error:o}=s;if(o||!a)return{data:{user:null,session:null},error:o};let u=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(s){if((0,ae.isAuthError)(s))return{data:{user:null,session:null},error:s};throw s}}async signUp(t){var r,i,n;try{let s;if("email"in t){let{email:c,password:d,options:p}=t,f=null,h=null;this.flowType==="pkce"&&([f,h]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,we._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:p?.emailRedirectTo,body:{email:c,password:d,data:(r=p?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:f,code_challenge_method:h},xform:we._sessionResponse})}else if("phone"in t){let{phone:c,password:d,options:p}=t;s=await(0,we._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:d,data:(i=p?.data)!==null&&i!==void 0?i:{},channel:(n=p?.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:p?.captchaToken}},xform:we._sessionResponse})}else throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:a,error:o}=s;if(o||!a)return{data:{user:null,session:null},error:o};let u=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(s){if((0,ae.isAuthError)(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithPassword(t){try{let r;if("email"in t){let{email:s,password:a,options:o}=t;r=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:we._sessionResponsePassword})}else if("phone"in t){let{phone:s,password:a,options:o}=t;r=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:we._sessionResponsePassword})}else throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:i,error:n}=r;return n?{data:{user:null,session:null},error:n}:!i||!i.session||!i.user?{data:{user:null,session:null},error:new ae.AuthInvalidTokenResponseError}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:n})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOAuth(t){var r,i,n,s;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(i=t.options)===null||i===void 0?void 0:i.scopes,queryParams:(n=t.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(s=t.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async _exchangeCodeForSession(t){let r=await(0,Se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[i,n]=(r??"").split("/"),{data:s,error:a}=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:i},xform:we._sessionResponse});return await(0,Se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),a?{data:{user:null,session:null,redirectType:null},error:a}:!s||!s.session||!s.user?{data:{user:null,session:null,redirectType:null},error:new ae.AuthInvalidTokenResponseError}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign(Object.assign({},s),{redirectType:n??null}),error:a})}async signInWithIdToken(t){try{let{options:r,provider:i,token:n,access_token:s,nonce:a}=t,o=await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:n,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:we._sessionResponse}),{data:u,error:l}=o;return l?{data:{user:null,session:null},error:l}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new ae.AuthInvalidTokenResponseError}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:l})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOtp(t){var r,i,n,s,a;try{if("email"in t){let{email:o,options:u}=t,l=null,c=null;this.flowType==="pkce"&&([l,c]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:d}=await(0,we._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(i=u?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:l,code_challenge_method:c},redirectTo:u?.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in t){let{phone:o,options:u}=t,{data:l,error:c}=await(0,we._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(n=u?.data)!==null&&n!==void 0?n:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(a=u?.channel)!==null&&a!==void 0?a:"sms"}});return{data:{user:null,session:null,messageId:l?.message_id},error:c}}throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(o){if((0,ae.isAuthError)(o))return{data:{user:null,session:null},error:o};throw o}}async verifyOtp(t){var r,i;try{let n,s;"options"in t&&(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo,s=(i=t.options)===null||i===void 0?void 0:i.captchaToken);let{data:a,error:o}=await(0,we._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:we._sessionResponse});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");let u=a.session,l=a.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(n){if((0,ae.isAuthError)(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(t){var r,i,n;try{let s=null,a=null;return this.flowType==="pkce"&&([s,a]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),await(0,we._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(i=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&i!==void 0?i:void 0}),!((n=t?.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:a}),headers:this.headers,xform:we._ssoResponse})}catch(s){if((0,ae.isAuthError)(s))return{data:null,error:s};throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{let{data:{session:r},error:i}=t;if(i)throw i;if(!r)throw new ae.AuthSessionMissingError;let{error:n}=await(0,we._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return{data:{user:null,session:null},error:n}})}catch(t){if((0,ae.isAuthError)(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{let r=`${this.url}/resend`;if("email"in t){let{email:i,type:n,options:s}=t,{error:a}=await(0,we._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:i,type:n,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return{data:{user:null,session:null},error:a}}else if("phone"in t){let{phone:i,type:n,options:s}=t,{data:a,error:o}=await(0,we._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:i,type:n,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return{data:{user:null,session:null,messageId:a?.message_id},error:o}}throw new ae.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){let i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await i,await r()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let i=r();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){let n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await t(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null,r=await(0,Se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};let i=t.expires_at?t.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",t.expires_at),!i){if(this.storage.isServer){let a=this.suppressGetSessionWarning;t=new Proxy(t,{get:(u,l,c)=>(!a&&l==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),a=!0,this.suppressGetSessionWarning=!0),Reflect.get(u,l,c))})}return{data:{session:t},error:null}}let{session:n,error:s}=await this._callRefreshToken(t.refresh_token);return s?{data:{session:null},error:s}:{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await(0,we._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:we._userResponse}):await this._useSession(async r=>{var i,n,s;let{data:a,error:o}=r;if(o)throw o;return!(!((i=a.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ae.AuthSessionMissingError}:await(0,we._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0,xform:we._userResponse})})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async i=>{let{data:n,error:s}=i;if(s)throw s;if(!n.session)throw new ae.AuthSessionMissingError;let a=n.session,o=null,u=null;this.flowType==="pkce"&&t.email!=null&&([o,u]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:l,error:c}=await(0,we._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:u}),jwt:a.access_token,xform:we._userResponse});if(c)throw c;return a.user=l.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),{data:{user:a.user},error:null}})}catch(i){if((0,ae.isAuthError)(i))return{data:{user:null},error:i};throw i}}_decodeJWT(t){return(0,Se.decodeJWTPayload)(t)}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new ae.AuthSessionMissingError;let r=Date.now()/1e3,i=r,n=!0,s=null,a=(0,Se.decodeJWTPayload)(t.access_token);if(a.exp&&(i=a.exp,n=i<=r),n){let{session:o,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!o)return{data:{user:null,session:null},error:null};s=o}else{let{data:o,error:u}=await this._getUser(t.access_token);if(u)throw u;s={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:i-r,expires_at:i},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return{data:{user:s.user,session:s},error:null}}catch(r){if((0,ae.isAuthError)(r))return{data:{session:null,user:null},error:r};throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var i;if(!t){let{data:a,error:o}=r;if(o)throw o;t=(i=a.session)!==null&&i!==void 0?i:void 0}if(!t?.refresh_token)throw new ae.AuthSessionMissingError;let{session:n,error:s}=await this._callRefreshToken(t.refresh_token);return s?{data:{user:null,session:null},error:s}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(r){if((0,ae.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async _getSessionFromURL(t){try{if(!(0,Se.isBrowser)())throw new ae.AuthImplicitGrantRedirectError("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new ae.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!t)throw new ae.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");let r=(0,Se.parseParametersFromURL)(window.location.href);if(t){if(!r.code)throw new ae.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:x,error:D}=await this._exchangeCodeForSession(r.code);if(D)throw D;let w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:x.session,redirectType:null},error:null}}if(r.error||r.error_description||r.error_code)throw new ae.AuthImplicitGrantRedirectError(r.error_description||"Error in URL with unspecified error_description",{error:r.error||"unspecified_error",code:r.error_code||"unspecified_code"});let{provider_token:i,provider_refresh_token:n,access_token:s,refresh_token:a,expires_in:o,expires_at:u,token_type:l}=r;if(!s||!o||!a||!l)throw new ae.AuthImplicitGrantRedirectError("No session defined in URL");let c=Math.round(Date.now()/1e3),d=parseInt(o),p=c+d;u&&(p=parseInt(u));let f=p-c;f*1e3<=U1&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${d}s`);let h=p-d;c-h>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",h,p,c):c-h<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",h,p,c);let{data:g,error:v}=await this._getUser(s);if(v)throw v;let y={provider_token:i,provider_refresh_token:n,access_token:s,expires_in:d,expires_at:p,refresh_token:a,token_type:l,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:r.type},error:null}}catch(r){if((0,ae.isAuthError)(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantFlow(){let t=(0,Se.parseParametersFromURL)(window.location.href);return!!((0,Se.isBrowser)()&&(t.access_token||t.error_description))}async _isPKCEFlow(){let t=(0,Se.parseParametersFromURL)(window.location.href),r=await(0,Se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var i;let{data:n,error:s}=r;if(s)return{error:s};let a=(i=n.session)===null||i===void 0?void 0:i.access_token;if(a){let{error:o}=await this.admin.signOut(a,t);if(o&&!((0,ae.isAuthApiError)(o)&&(o.status===404||o.status===401||o.status===403)))return{error:o}}return t!=="others"&&(await this._removeSession(),await(0,Se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(t){let r=(0,Se.uuid)(),i={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,i),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:i}}}async _emitInitialSession(t){return await this._useSession(async r=>{var i,n;try{let{data:{session:s},error:a}=r;if(a)throw a;await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",t,"session",s)}catch(s){await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",s),console.error(s)}})}async resetPasswordForEmail(t,r={}){let i=null,n=null;this.flowType==="pkce"&&([i,n]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,we._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:i,code_challenge_method:n,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,ae.isAuthError)(s))return{data:null,error:s};throw s}}async getUserIdentities(){var t;try{let{data:r,error:i}=await this.getUser();if(i)throw i;return{data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async linkIdentity(t){var r;try{let{data:i,error:n}=await this._useSession(async s=>{var a,o,u,l,c;let{data:d,error:p}=s;if(p)throw p;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,we._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})});if(n)throw n;return(0,Se.isBrowser)()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(i?.url),{data:{provider:t.provider,url:i?.url},error:null}}catch(i){if((0,ae.isAuthError)(i))return{data:{provider:t.provider,url:null},error:i};throw i}}async unlinkIdentity(t){try{return await this._useSession(async r=>{var i,n;let{data:s,error:a}=r;if(a)throw a;return await(0,we._request)(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(n=(i=s.session)===null||i===void 0?void 0:i.access_token)!==null&&n!==void 0?n:void 0})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async _refreshAccessToken(t){let r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{let i=Date.now();return await(0,Se.retryable)(async n=>(n>0&&await(0,Se.sleep)(200*Math.pow(2,n-1)),this._debug(r,"refreshing attempt",n),await(0,we._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:we._sessionResponse})),(n,s)=>{let a=200*Math.pow(2,n);return s&&(0,ae.isAuthRetryableFetchError)(s)&&Date.now()+a-i<U1})}catch(i){if(this._debug(r,"error",i),(0,ae.isAuthError)(i))return{data:{session:null,user:null},error:i};throw i}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){let i=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",i),(0,Se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(i),{data:{provider:t,url:i},error:null}}async _recoverAndRefresh(){var t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let i=await(0,Se.getItemAsync)(this.storage,this.storageKey);if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}let n=Math.round(Date.now()/1e3),s=((t=i.expires_at)!==null&&t!==void 0?t:1/0)<n+V1.EXPIRY_MARGIN;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${V1.EXPIRY_MARGIN}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:a}=await this._callRefreshToken(i.refresh_token);a&&(console.error(a),(0,ae.isAuthRetryableFetchError)(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var r,i;if(!t)throw new ae.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Se.Deferred;let{data:s,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!s.session)throw new ae.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let o={session:s.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(s){if(this._debug(n,"error",s),(0,ae.isAuthError)(s)){let a={session:null,error:s};return(0,ae.isAuthRetryableFetchError)(s)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(s),s}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(t,r,i=!0){let n=`#_notifyAllSubscribers(${t})`;this._debug(n,"begin",r,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:t,session:r});let s=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,r)}catch(u){s.push(u)}});if(await Promise.all(a),s.length>0){for(let o=0;o<s.length;o+=1)console.error(s[o]);throw s[0]}}finally{this._debug(n,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await(0,Se.setItemAsync)(this.storage,this.storageKey,t)}async _removeSession(){this._debug("#_removeSession()"),await(0,Se.removeItemAsync)(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&(0,Se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let t=setInterval(()=>this._autoRefreshTokenTick(),U1);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let t=Date.now();try{return await this._useSession(async r=>{let{data:{session:i}}=r;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let n=Math.floor((i.expires_at*1e3-t)/U1);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${U1}ms, refresh threshold is ${UP} ticks`),n<=UP&&await this._callRefreshToken(i.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof MP.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,Se.isBrowser)()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){let r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,r,i){let n=[`provider=${encodeURIComponent(r)}`];if(i?.redirectTo&&n.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&n.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){let[s,a]=await(0,Se.getCodeChallengeAndMethod)(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});n.push(o.toString())}if(i?.queryParams){let s=new URLSearchParams(i.queryParams);n.push(s.toString())}return i?.skipBrowserRedirect&&n.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${t}?${n.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var i;let{data:n,error:s}=r;return s?{data:null,error:s}:await(0,we._request)(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async _enroll(t){try{return await this._useSession(async r=>{var i,n;let{data:s,error:a}=r;if(a)return{data:null,error:a};let{data:o,error:u}=await(0,we._request)(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:t.friendlyName,factor_type:t.factorType,issuer:t.issuer},headers:this.headers,jwt:(i=s?.session)===null||i===void 0?void 0:i.access_token});return u?{data:null,error:u}:(!((n=o?.totp)===null||n===void 0)&&n.qr_code&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:s}=r;if(s)return{data:null,error:s};let{data:a,error:o}=await(0,we._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:o})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:s}=r;return s?{data:null,error:s}:await(0,we._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,ae.isAuthError)(r))return{data:null,error:r};throw r}})}async _challengeAndVerify(t){let{data:r,error:i}=await this._challenge({factorId:t.factorId});return i?{data:null,error:i}:await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let i=t?.factors||[],n=i.filter(s=>s.factor_type==="totp"&&s.status==="verified");return{data:{all:i,totp:n},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var r,i;let{data:{session:n},error:s}=t;if(s)return{data:null,error:s};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let a=this._decodeJWT(n.access_token),o=null;a.aal&&(o=a.aal);let u=o;((i=(r=n.user.factors)===null||r===void 0?void 0:r.filter(d=>d.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");let c=a.amr||[];return{data:{currentLevel:o,nextLevel:u,currentAuthenticationMethods:c},error:null}}))}};H1.default=q6;q6.nextInstanceID=0});var HP=m(z1=>{"use strict";var w5e=z1&&z1.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(z1,"__esModule",{value:!0});var _5e=w5e(P6()),D5e=_5e.default;z1.default=D5e});var zP=m(G1=>{"use strict";var b5e=G1&&G1.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(G1,"__esModule",{value:!0});var E5e=b5e(T7()),x5e=E5e.default;G1.default=x5e});var WP=m(GP=>{"use strict";Object.defineProperty(GP,"__esModule",{value:!0})});var F7=m(ft=>{"use strict";var S5e=ft&&ft.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),XP=ft&&ft.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&S5e(t,e,r)},j6=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ft,"__esModule",{value:!0});ft.lockInternals=ft.NavigatorLockAcquireTimeoutError=ft.navigatorLock=ft.AuthClient=ft.AuthAdminApi=ft.GoTrueClient=ft.GoTrueAdminApi=void 0;var C5e=j6(P6());ft.GoTrueAdminApi=C5e.default;var A5e=j6(T7());ft.GoTrueClient=A5e.default;var T5e=j6(HP());ft.AuthAdminApi=T5e.default;var O5e=j6(zP());ft.AuthClient=O5e.default;XP(WP(),ft);XP($1(),ft);var O7=C7();Object.defineProperty(ft,"navigatorLock",{enumerable:!0,get:function(){return O7.navigatorLock}});Object.defineProperty(ft,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return O7.NavigatorLockAcquireTimeoutError}});Object.defineProperty(ft,"lockInternals",{enumerable:!0,get:function(){return O7.internals}})});var YP=m($6=>{"use strict";Object.defineProperty($6,"__esModule",{value:!0});$6.SupabaseAuthClient=void 0;var F5e=F7(),N7=class extends F5e.AuthClient{constructor(t){super(t)}};$6.SupabaseAuthClient=N7});var R7=m(W1=>{"use strict";var N5e=W1&&W1.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{l(i.next(c))}catch(d){a(d)}}function u(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(W1,"__esModule",{value:!0});var k5e=ov(),R5e=aR(),P5e=r7(),I5e=OP(),M6=NP(),L5e=RP(),KP=PP(),B5e=YP(),k7=class{constructor(t,r,i){var n,s,a;if(this.supabaseUrl=t,this.supabaseKey=r,!t)throw new Error("supabaseUrl is required.");if(!r)throw new Error("supabaseKey is required.");let o=(0,KP.stripTrailingSlash)(t);this.realtimeUrl=`${o}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${o}/auth/v1`,this.storageUrl=`${o}/storage/v1`,this.functionsUrl=`${o}/functions/v1`;let u=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,l={db:M6.DEFAULT_DB_OPTIONS,realtime:M6.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},M6.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:M6.DEFAULT_GLOBAL_OPTIONS},c=(0,KP.applySettingDefaults)(i??{},l);this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},this.auth=this._initSupabaseAuthClient((a=c.auth)!==null&&a!==void 0?a:{},this.headers,c.global.fetch),this.fetch=(0,L5e.fetchWithAuth)(r,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},c.realtime)),this.rest=new R5e.PostgrestClient(`${o}/rest/v1`,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new k5e.FunctionsClient(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new I5e.StorageClient(this.storageUrl,this.headers,this.fetch)}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,r={},i={}){return this.rest.rpc(t,r,i)}channel(t,r={config:{}}){return this.realtime.channel(t,r)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,r;return N5e(this,void 0,void 0,function*(){let{data:i}=yield this.auth.getSession();return(r=(t=i.session)===null||t===void 0?void 0:t.access_token)!==null&&r!==void 0?r:null})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,storageKey:s,flowType:a,debug:o},u,l){var c;let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new B5e.SupabaseAuthClient({url:this.authUrl,headers:Object.assign(Object.assign({},d),u),storageKey:s,autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,flowType:a,debug:o,fetch:l,hasCustomAuthorizationHeader:(c="Authorization"in this.headers)!==null&&c!==void 0?c:!1})}_initRealtimeClient(t){return new P5e.RealtimeClient(this.realtimeUrl,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,i)=>{this._handleTokenChanged(r,"CLIENT",i?.access_token)})}_handleTokenChanged(t,r,i){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==i?(this.realtime.setAuth(i??null),this.changedAccessToken=i):t==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};W1.default=k7});var QP=m(ht=>{"use strict";var q5e=ht&&ht.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),JP=ht&&ht.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&q5e(t,e,r)},ZP=ht&&ht.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ht,"__esModule",{value:!0});ht.createClient=ht.SupabaseClient=ht.FunctionRegion=ht.FunctionsError=ht.FunctionsRelayError=ht.FunctionsFetchError=ht.FunctionsHttpError=void 0;var j5e=ZP(R7());JP(F7(),ht);var X1=ov();Object.defineProperty(ht,"FunctionsHttpError",{enumerable:!0,get:function(){return X1.FunctionsHttpError}});Object.defineProperty(ht,"FunctionsFetchError",{enumerable:!0,get:function(){return X1.FunctionsFetchError}});Object.defineProperty(ht,"FunctionsRelayError",{enumerable:!0,get:function(){return X1.FunctionsRelayError}});Object.defineProperty(ht,"FunctionsError",{enumerable:!0,get:function(){return X1.FunctionsError}});Object.defineProperty(ht,"FunctionRegion",{enumerable:!0,get:function(){return X1.FunctionRegion}});JP(r7(),ht);var $5e=R7();Object.defineProperty(ht,"SupabaseClient",{enumerable:!0,get:function(){return ZP($5e).default}});var M5e=(e,t,r)=>new j5e.default(e,t,r);ht.createClient=M5e});var iI=m((Sut,rI)=>{var tI={};rI.exports=tI;var eI={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(eI).forEach(function(e){var t=eI[e],r=tI[e]=[];r.open="\x1B["+t[0]+"m",r.close="\x1B["+t[1]+"m"})});var sI=m((Cut,nI)=>{"use strict";nI.exports=function(e,t){t=t||process.argv;var r=t.indexOf("--"),i=/^-{1,2}/.test(e)?"":"--",n=t.indexOf(i+e);return n!==-1&&(r===-1?!0:n<r)}});var oI=m((Aut,aI)=>{"use strict";var U5e=require("os"),ss=sI(),si=process.env,bd=void 0;ss("no-color")||ss("no-colors")||ss("color=false")?bd=!1:(ss("color")||ss("colors")||ss("color=true")||ss("color=always"))&&(bd=!0);"FORCE_COLOR"in si&&(bd=si.FORCE_COLOR.length===0||parseInt(si.FORCE_COLOR,10)!==0);function V5e(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function H5e(e){if(bd===!1)return 0;if(ss("color=16m")||ss("color=full")||ss("color=truecolor"))return 3;if(ss("color=256"))return 2;if(e&&!e.isTTY&&bd!==!0)return 0;var t=bd?1:0;if(process.platform==="win32"){var r=U5e.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in si)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(n){return n in si})||si.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in si)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(si.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in si){var i=parseInt((si.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(si.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(si.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(si.TERM)||"COLORTERM"in si?1:(si.TERM==="dumb",t)}function P7(e){var t=H5e(e);return V5e(t)}aI.exports={supportsColor:P7,stdout:P7(process.stdout),stderr:P7(process.stderr)}});var lI=m((Tut,uI)=>{uI.exports=function(t,r){var i="";t=t||"Run the trap, drop the bass",t=t.split("");var n={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return t.forEach(function(s){s=s.toLowerCase();var a=n[s]||[" "],o=Math.floor(Math.random()*a.length);typeof n[s]<"u"?i+=n[s][o]:i+=s}),i}});var dI=m((Out,cI)=>{cI.exports=function(t,r){t=t||" he is here ";var i={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},n=[].concat(i.up,i.down,i.mid);function s(u){var l=Math.floor(Math.random()*u);return l}function a(u){var l=!1;return n.filter(function(c){l=c===u}),l}function o(u,l){var c="",d,p;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",u=u.split("");for(p in u)if(!a(p)){switch(c=c+u[p],d={up:0,down:0,mid:0},l.size){case"mini":d.up=s(8),d.mid=s(2),d.down=s(8);break;case"maxi":d.up=s(16)+3,d.mid=s(4)+1,d.down=s(64)+3;break;default:d.up=s(8)+1,d.mid=s(6)/2,d.down=s(8)+1;break}var f=["up","mid","down"];for(var h in f)for(var g=f[h],v=0;v<=d[g];v++)l[g]&&(c=c+i[g][s(i[g].length)])}return c}return o(t,r)}});var fI=m((Fut,pI)=>{pI.exports=function(e){return function(t,r,i){if(t===" ")return t;switch(r%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}});var mI=m((Nut,hI)=>{hI.exports=function(e){return function(t,r,i){return r%2===0?t:e.inverse(t)}}});var yI=m((kut,gI)=>{gI.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(r,i,n){return r===" "?r:e[t[i++%t.length]](r)}}});var wI=m((Rut,vI)=>{vI.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,i,n){return r===" "?r:e[t[Math.round(Math.random()*(t.length-2))]](r)}}});var SI=m((Iut,xI)=>{var be={};xI.exports=be;be.themes={};var z5e=require("util"),wl=be.styles=iI(),DI=Object.defineProperties,G5e=new RegExp(/[\r\n]+/g);be.supportsColor=oI().supportsColor;typeof be.enabled>"u"&&(be.enabled=be.supportsColor()!==!1);be.enable=function(){be.enabled=!0};be.disable=function(){be.enabled=!1};be.stripColors=be.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")};var Put=be.stylize=function(t,r){if(!be.enabled)return t+"";var i=wl[r];return!i&&r in be?be[r](t):i.open+t+i.close},W5e=/[|\\{}()[\]^$+*?.]/g,X5e=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(W5e,"\\$&")};function bI(e){var t=function r(){return K5e.apply(r,arguments)};return t._styles=e,t.__proto__=Y5e,t}var EI=function(){var e={};return wl.grey=wl.gray,Object.keys(wl).forEach(function(t){wl[t].closeRe=new RegExp(X5e(wl[t].close),"g"),e[t]={get:function(){return bI(this._styles.concat(t))}}}),e}(),Y5e=DI(function(){},EI);function K5e(){var e=Array.prototype.slice.call(arguments),t=e.map(function(a){return a!=null&&a.constructor===String?a:z5e.inspect(a)}).join(" ");if(!be.enabled||!t)return t;for(var r=t.indexOf(`
30
30
  `)!=-1,i=this._styles,n=i.length;n--;){var s=wl[i[n]];t=s.open+t.replace(s.closeRe,s.open)+s.close,r&&(t=t.replace(G5e,function(a){return s.close+a+s.open}))}return t}be.setTheme=function(e){if(typeof e=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var t in e)(function(r){be[r]=function(i){if(typeof e[r]=="object"){var n=i;for(var s in e[r])n=be[e[r][s]](n);return n}return be[e[r]](i)}})(t)};function J5e(){var e={};return Object.keys(EI).forEach(function(t){e[t]={get:function(){return bI([t])}}}),e}var Z5e=function(t,r){var i=r.split("");return i=i.map(t),i.join("")};be.trap=lI();be.zalgo=dI();be.maps={};be.maps.america=fI()(be);be.maps.zebra=mI()(be);be.maps.rainbow=yI()(be);be.maps.random=wI()(be);for(_I in be.maps)(function(e){be[e]=function(t){return Z5e(be.maps[e],t)}})(_I);var _I;DI(be,J5e())});var AI=m((Lut,CI)=>{var Q5e=SI();CI.exports=Q5e});var TI=m(I7=>{"use strict";I7.indent=function(t){return new Array(t+1).join(" ")};I7.getMaxIndexLength=function(e){var t=0;return Object.getOwnPropertyNames(e).forEach(function(r){e[r]!==void 0&&(t=Math.max(t,r.length))}),t}});var OI=m((qut,eve)=>{eve.exports={author:"Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",name:"prettyjson",description:"Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",version:"1.2.5",homepage:"http://rafeca.com/prettyjson",keywords:["json","cli","formatting","colors"],repository:{type:"git",url:"https://github.com/rafeca/prettyjson.git"},bugs:{url:"https://github.com/rafeca/prettyjson/issues"},main:"./lib/prettyjson",files:["bin/prettyjson","lib/*.js"],license:"MIT",scripts:{test:"npm run jshint && mocha --reporter spec",testwin:"node ./node_modules/mocha/bin/mocha --reporter spec",jshint:"jshint lib/*.js test/*.js",coverage:"istanbul cover _mocha --report lcovonly -- -R spec",coveralls:"npm run coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",changelog:"git log $(git describe --tags --abbrev=0)..HEAD --pretty='* %s' --first-parent"},bin:{prettyjson:"./bin/prettyjson"},dependencies:{colors:"1.4.0",minimist:"^1.2.0"},devDependencies:{coveralls:"^2.11.15",istanbul:"^0.4.5",jshint:"^2.9.4",mocha:"^3.1.2","mocha-lcov-reporter":"^1.2.0",should:"^11.1.1"}}});var FI=m(Y1=>{"use strict";var Ls=AI(),tu=TI(),tve=/[^\w\s\n\r\v\t\.,]/i;Y1.version=OI().version;var L7=function(e,t){return e!==void 0||t.renderUndefined},U6=function(e,t,r){return!!(typeof e=="boolean"||typeof e=="number"||typeof e=="function"||e===null||e===void 0||e instanceof Date||typeof e=="string"&&e.indexOf(`
31
31
  `)===-1||r.inlineArrays&&!t&&Array.isArray(e)&&U6(e[0],!0,r))},rve=function(e,t){if(t.noColor)return e;if(typeof e=="string")return t.stringColor?Ls[t.stringColor](e):e;var r=e+"";return e===!0?Ls.green(r):e===!1?Ls.red(r):e==null?Ls.grey(r):typeof e=="number"?e>=0?Ls[t.positiveNumberColor](r):Ls[t.negativeNumberColor](r):typeof e=="function"?"function() {}":Array.isArray(e)?e.join(", "):r},B7=function(e,t){return e.multilineStringColor===null||e.noColor?t:Ls[e.multilineStringColor](t)},ive=function(e,t,r){var i=e.split(`
32
32
  `);return i=i.map(function(n){return tu.indent(t)+B7(r,n)}),i.join(`
@@ -280,7 +280,7 @@ GFS4: `),console.error(e)});Ct[$r]||(Che=global[$r]||[],The(Ct,Che),Ct.close=fun
280
280
  `;function Ihe(e,t){var r=[],i="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||{},t.whitespace=t.whitespace===!0);var n=t.whitespace?" = ":"=";return Object.keys(e).forEach(function(s,a,o){var u=e[s];u&&Array.isArray(u)?u.forEach(function(l){i+=Uf(s+"[]")+n+Uf(l)+`
281
281
  `}):u&&typeof u=="object"?r.push(s):i+=Uf(s)+n+Uf(u)+oF}),t.section&&i.length&&(i="["+Uf(t.section)+"]"+oF+i),r.forEach(function(s,a,o){var u=Lhe(s).join("\\."),l=(t.section?t.section+".":"")+u,c=Ihe(e[s],{section:l,whitespace:t.whitespace});i.length&&c.length&&(i+=oF),i+=c}),i}function Lhe(e){return e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(t){return t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function oet(e){var t={},r=t,i=null,n=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,s=e.split(/[\r\n]+/g);return s.forEach(function(a,o,u){if(!(!a||a.match(/^\s*[;#]/))){var l=a.match(n);if(l){if(l[1]!==void 0){if(i=by(l[1]),i==="__proto__"){r={};return}r=t[i]=t[i]||{};return}var c=by(l[2]);if(c!=="__proto__"){var d=l[3]?by(l[4]):!0;switch(d){case"true":case"false":case"null":d=JSON.parse(d)}if(c.length>2&&c.slice(-2)==="[]"){if(c=c.substring(0,c.length-2),c==="__proto__")return;r[c]?Array.isArray(r[c])||(r[c]=[r[c]]):r[c]=[]}Array.isArray(r[c])?r[c].push(d):r[c]=d}}}}),Object.keys(t).filter(function(a,o,u){if(!t[a]||typeof t[a]!="object"||Array.isArray(t[a]))return!1;var l=Lhe(a),c=t,d=l.pop(),p=d.replace(/\\\./g,".");return l.forEach(function(f,h,g){f!=="__proto__"&&((!c[f]||typeof c[f]!="object")&&(c[f]={}),c=c[f])}),c===t&&p===d?!1:(c[p]=t[a],!0)}).forEach(function(a,o,u){delete t[a]}),t}function Bhe(e){return e.charAt(0)==='"'&&e.slice(-1)==='"'||e.charAt(0)==="'"&&e.slice(-1)==="'"}function Uf(e){return typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&Bhe(e)||e!==e.trim()?JSON.stringify(e):e.replace(/;/g,"\\;").replace(/#/g,"\\#")}function by(e,t){if(e=(e||"").trim(),Bhe(e)){e.charAt(0)==="'"&&(e=e.substr(1,e.length-2));try{e=JSON.parse(e)}catch{}}else{for(var r=!1,i="",n=0,s=e.length;n<s;n++){var a=e.charAt(n);if(r)"\\;#".indexOf(a)!==-1?i+=a:i+="\\"+a,r=!1;else{if(";#".indexOf(a)!==-1)break;a==="\\"?r=!0:i+=a}}return r&&(i+="\\"),i.trim()}return e}});var Uhe=m((Fo,Mhe)=>{var jhe=Phe(),m2=require("path"),Ey=require("fs"),uF=qhe(),lF=require("events").EventEmitter,uet=require("url"),cet=require("http"),Fo=Mhe.exports=function(){for(var e=[].slice.call(arguments),t=new ti;e.length;){var r=e.shift();r&&t.push(typeof r=="string"?pet(r):r)}return t},cgt=Fo.find=function(){var e=m2.join.apply(null,[].slice.call(arguments));function t(r,i){var n=m2.join(r,i);try{return Ey.statSync(n),n}catch{if(m2.dirname(r)!==r)return t(m2.dirname(r),i)}}return t(__dirname,e)},det=Fo.parse=function(e,t,r){if(e=""+e,r)if(r==="json")if(this.emit)try{return JSON.parse(e)}catch(i){this.emit("error",i)}else return JSON.parse(e);else return uF.parse(e);else try{return JSON.parse(e)}catch{return uF.parse(e)}},pet=Fo.json=function(){var e=[].slice.call(arguments).filter(function(i){return i!=null}),t=m2.join.apply(null,e),r;try{r=Ey.readFileSync(t,"utf-8")}catch{return}return det(r,t,"json")},dgt=Fo.env=function(e,t){t=t||process.env;var r={},i=e.length;for(var n in t)n.indexOf(e)===0&&(r[n.substring(i)]=t[n]);return r};Fo.ConfigChain=ti;function ti(){lF.apply(this),jhe.apply(this,arguments),this._awaiting=0,this._saving=0,this.sources={}}var $he={constructor:{value:ti}};Object.keys(lF.prototype).forEach(function(e){$he[e]=Object.getOwnPropertyDescriptor(lF.prototype,e)});ti.prototype=Object.create(jhe.prototype,$he);ti.prototype.del=function(e,t){if(t){var r=this.sources[t];if(r=r&&r.data,!r)return this.emit("error",new Error("not found "+t));delete r[e]}else for(var i=0,n=this.list.length;i<n;i++)delete this.list[i][e];return this};ti.prototype.set=function(e,t,r){var i;if(r){if(i=this.sources[r],i=i&&i.data,!i)return this.emit("error",new Error("not found "+r))}else if(i=this.list[0],!i)return this.emit("error",new Error("cannot set, no confs!"));return i[e]=t,this};ti.prototype.get=function(e,t){return t?(t=this.sources[t],t&&(t=t.data),t&&Object.hasOwnProperty.call(t,e)?t[e]:void 0):this.list[0][e]};ti.prototype.save=function(e,s,r){typeof s=="function"&&(r=s,s=null);var i=this.sources[e];if(!i||!(i.path||i.source)||!i.data)return this.emit("error",new Error("bad save target: "+e));if(i.source){var n=i.prefix||"";return Object.keys(i.data).forEach(function(o){i.source[n+o]=i.data[o]}),this}var s=s||i.type,a=i.data;return i.type==="json"?a=JSON.stringify(a):a=uF.stringify(a),this._saving++,Ey.writeFile(i.path,a,"utf8",function(o){if(this._saving--,o)return r?r(o):this.emit("error",o);this._saving===0&&(r&&r(),this.emit("save"))}.bind(this)),this};ti.prototype.addFile=function(e,t,r){r=r||e;var i={__source__:r};return this.sources[r]={path:e,type:t},this.push(i),this._await(),Ey.readFile(e,"utf8",function(n,s){n&&this.emit("error",n),this.addString(s,e,t,i)}.bind(this)),this};ti.prototype.addEnv=function(e,t,r){r=r||"env";var i=Fo.env(e,t);return this.sources[r]={data:i,source:t,prefix:e},this.add(i,r)};ti.prototype.addUrl=function(e,t,r){this._await();var i=uet.format(e);r=r||i;var n={__source__:r};return this.sources[r]={href:i,type:t},this.push(n),cet.request(e,function(s){var a=[],o=s.headers["content-type"];t||(t=o.indexOf("json")!==-1?"json":o.indexOf("ini")!==-1?"ini":i.match(/\.json$/)?"json":i.match(/\.ini$/)?"ini":null,n.type=t),s.on("data",a.push.bind(a)).on("end",function(){this.addString(Buffer.concat(a),i,t,n)}.bind(this)).on("error",this.emit.bind(this,"error"))}.bind(this)).on("error",this.emit.bind(this,"error")).end(),this};ti.prototype.addString=function(e,t,r,i){return e=this.parse(e,t,r),this.add(e,i),this};ti.prototype.add=function(e,t){if(t&&typeof t=="object"){var r=this.list.indexOf(t);if(r===-1)return this.emit("error",new Error("bad marker"));this.splice(r,1,e),t=t.__source__,this.sources[t]=this.sources[t]||{},this.sources[t].data=e,this._resolve()}else typeof t=="string"&&(this.sources[t]=this.sources[t]||{},this.sources[t].data=e),this._await(),this.push(e),process.nextTick(this._resolve.bind(this));return this};ti.prototype.parse=Fo.parse;ti.prototype._await=function(){this._awaiting++};ti.prototype._resolve=function(){this._awaiting--,this._awaiting===0&&this.emit("load",this)}});var Hhe=m((pgt,Vhe)=>{Vhe.exports=function(e){let t=e.indexOf(":");if(t===-1)return cF(e);let r=e.substr(0,t),i=e.substr(t+1);return`${cF(r)}:${cF(i)}`};function cF(e){if(e=e.toLowerCase(),e==="_authtoken")return"_authToken";let t=e[0];for(let r=1;r<e.length;r++)t+=e[r]==="_"?"-":e[r];return t}});var zhe=m(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:!0});xy.envReplace=void 0;var fet=/(?<!\\)(\\*)\$\{([^${}]+)\}/g;function het(e,t){return e.replace(fet,met.bind(null,t))}xy.envReplace=het;function met(e,t,r,i){if(r.length%2)return t.slice((r.length+1)/2);let n=yet(e,i);if(n===void 0)throw new Error(`Failed to replace env in config: ${t}`);return`${r.slice(r.length/2)}${n}`}var get=/([^:-]+)(:?)-(.+)/;function yet(e,t){let r=t.match(get);if(!r)return e[t];let[,i,n,s]=r;return Object.prototype.hasOwnProperty.call(e,i)?!e[i]&&n?s:e[i]:s}});var Ghe=m(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:!0});Sy.envReplace=void 0;var vet=zhe();Object.defineProperty(Sy,"envReplace",{enumerable:!0,get:function(){return vet.envReplace}})});var Xhe=m(Cy=>{"use strict";var wet=require("fs"),$c=require("path"),{envReplace:Whe}=Ghe(),_et=(e,t,r)=>{if(typeof t!="string")return t;let i=[].concat(e[r]),n=i.indexOf($c)!==-1,s=i.indexOf(Boolean)!==-1,a=i.indexOf(String)!==-1,o=i.indexOf(Number)!==-1;if(t=`${t}`.trim(),/^".*"$/.test(t))try{t=JSON.parse(t)}catch{throw new Error(`Failed parsing JSON config key ${r}: ${t}`)}if(s&&!a&&t==="")return!0;switch(t){case"true":return!0;case"false":return!1;case"null":return null;case"undefined":return}return t=Whe(t,process.env),n&&((process.platform==="win32"?/^~(\/|\\)/:/^~\//).test(t)&&process.env.HOME&&(t=$c.resolve(process.env.HOME,t.substr(2))),t=$c.resolve(t)),o&&!isNaN(t)&&(t=Number(t)),t},Det=e=>{e=$c.resolve(e);let t=!1;for(;$c.basename(e)==="node_modules";)e=$c.dirname(e),t=!0;if(t)return e;let r=(i,n)=>{let s=/^[a-zA-Z]:(\\|\/)?$/;if(i==="/"||process.platform==="win32"&&s.test(i))return n;try{let a=wet.readdirSync(i);if(a.includes("node_modules")||a.includes("package.json")||a.includes("package.json5")||a.includes("package.yaml")||a.includes("pnpm-workspace.yaml"))return i;let o=$c.dirname(i);return o===i?n:r(o,n)}catch(a){if(i===n){if(a.code==="ENOENT")return n;throw a}return n}};return r(e,e)};Cy.envReplace=Whe;Cy.findPrefix=Det;Cy.parseField=_et});var Jhe=m(Khe=>{"use strict";var Mc=require("path"),bet=require("stream").Stream,Ay=require("url"),Eet=()=>{},xet=()=>[],Yhe=()=>{};Khe.types={access:[null,"restricted","public"],"allow-same-version":Boolean,"always-auth":Boolean,also:[null,"dev","development"],audit:Boolean,"auth-type":["legacy","sso","saml","oauth"],"bin-links":Boolean,browser:[null,String],ca:[null,String,Array],cafile:Mc,cache:Mc,"cache-lock-stale":Number,"cache-lock-retries":Number,"cache-lock-wait":Number,"cache-max":Number,"cache-min":Number,cert:[null,String],cidr:[null,String,Array],color:["always",Boolean],depth:Number,description:Boolean,dev:Boolean,"dry-run":Boolean,editor:String,"engine-strict":Boolean,force:Boolean,"fetch-retries":Number,"fetch-retry-factor":Number,"fetch-retry-mintimeout":Number,"fetch-retry-maxtimeout":Number,git:String,"git-tag-version":Boolean,"commit-hooks":Boolean,global:Boolean,globalconfig:Mc,"global-style":Boolean,group:[Number,String],"https-proxy":[null,Ay],"user-agent":String,"ham-it-up":Boolean,heading:String,"if-present":Boolean,"ignore-prepublish":Boolean,"ignore-scripts":Boolean,"init-module":Mc,"init-author-name":String,"init-author-email":String,"init-author-url":["",Ay],"init-license":String,"init-version":Yhe,json:Boolean,key:[null,String],"legacy-bundling":Boolean,link:Boolean,"local-address":xet(),loglevel:["silent","error","warn","notice","http","timing","info","verbose","silly"],logstream:bet,"logs-max":Number,long:Boolean,maxsockets:Number,message:String,"metrics-registry":[null,String],"node-options":[null,String],"node-version":[null,Yhe],"no-proxy":[null,String,Array],offline:Boolean,"onload-script":[null,String],only:[null,"dev","development","prod","production"],optional:Boolean,"package-lock":Boolean,otp:[null,String],"package-lock-only":Boolean,parseable:Boolean,"prefer-offline":Boolean,"prefer-online":Boolean,prefix:Mc,production:Boolean,progress:Boolean,proxy:[null,!1,Ay],provenance:Boolean,"read-only":Boolean,"rebuild-bundle":Boolean,registry:[null,Ay],rollback:Boolean,save:Boolean,"save-bundle":Boolean,"save-dev":Boolean,"save-exact":Boolean,"save-optional":Boolean,"save-prefix":String,"save-prod":Boolean,scope:String,"script-shell":[null,String],"scripts-prepend-node-path":[!1,!0,"auto","warn-only"],searchopts:String,searchexclude:[null,String],searchlimit:Number,searchstaleness:Number,"send-metrics":Boolean,shell:String,shrinkwrap:Boolean,"sign-git-tag":Boolean,"sso-poll-frequency":Number,"sso-type":[null,"oauth","saml"],"strict-ssl":Boolean,tag:String,timing:Boolean,tmp:Mc,unicode:Boolean,"unsafe-perm":Boolean,usage:Boolean,user:[Number,String],userconfig:Mc,umask:Eet,version:Boolean,"tag-version-prefix":String,versions:Boolean,viewer:String,_exit:Boolean}});var t0e=m((ygt,e0e)=>{"use strict";var{readCAFileSync:Cet}=Nhe(),Zhe=require("fs"),dF=require("path"),{ConfigChain:Aet}=Uhe(),Tet=Hhe(),Qhe=Xhe(),pF=class extends Aet{constructor(t,r){super(t),this.root=t,this._parseField=Qhe.parseField.bind(null,r||Jhe())}add(t,r){try{for(let i of Object.keys(t))t[i]=this._parseField(t[i],i)}catch(i){throw i}return super.add(t,r)}addFile(t,r){r=r||t;let i={__source__:r};this.sources[r]={path:t,type:"ini"},this.push(i),this._await();try{let n=Zhe.readFileSync(t,"utf8");this.addString(n,t,"ini",i)}catch(n){if(n.code==="ENOENT")this.add({},i);else return`Issue while reading "${t}". ${n.message}`}}addEnv(t){t=t||process.env;let r={};return Object.keys(t).filter(i=>/^npm_config_/i.test(i)).forEach(i=>{t[i]&&(r[Tet(i.substr(11))]=t[i])}),super.addEnv("",r,"env")}loadPrefix(){let t=this.list[0];Object.defineProperty(this,"prefix",{enumerable:!0,set:i=>{let n=this.get("global");this[n?"globalPrefix":"localPrefix"]=i},get:()=>this.get("global")?this.globalPrefix:this.localPrefix}),Object.defineProperty(this,"globalPrefix",{enumerable:!0,set:i=>{this.set("prefix",i)},get:()=>dF.resolve(this.get("prefix"))});let r;if(Object.defineProperty(this,"localPrefix",{enumerable:!0,set:i=>{r=i},get:()=>r}),Object.prototype.hasOwnProperty.call(t,"prefix"))r=dF.resolve(t.prefix);else try{r=Qhe.findPrefix(process.cwd())}catch(i){throw i}return r}loadCAFile(t){if(!t)return;let r=Cet(t);r&&this.set("ca",r)}loadUser(){let t=this.root;if(this.get("global"))return;if(process.env.SUDO_UID){t.user=Number(process.env.SUDO_UID);return}let r=dF.resolve(this.get("prefix"));try{let i=Zhe.statSync(r);t.user=i.uid}catch(i){if(i.code==="ENOENT")return;throw i}}};e0e.exports=pF});var o0e=m(a0e=>{"use strict";var n0e=require("os"),No=require("path"),s0e=n0e.tmpdir(),Oet=process.getuid?process.getuid():process.pid,Fet=()=>!0,r0e=process.platform==="win32",i0e={editor:()=>process.env.EDITOR||process.env.VISUAL||(r0e?"notepad.exe":"vi"),shell:()=>r0e?process.env.COMSPEC||"cmd.exe":process.env.SHELL||"/bin/bash"},Net={fromString:()=>process.umask()},Vf=n0e.homedir();Vf?process.env.HOME=Vf:Vf=No.resolve(s0e,"npm-"+Oet);var ket=process.platform==="win32"?"npm-cache":".npm",Ret=process.platform==="win32"&&process.env.APPDATA||Vf,Pet=No.resolve(Ret,ket),Ty,Uc;Object.defineProperty(a0e,"defaults",{get:function(){return Ty||(process.env.PREFIX?Uc=process.env.PREFIX:process.platform==="win32"?Uc=No.dirname(process.execPath):(Uc=No.dirname(No.dirname(process.execPath)),process.env.DESTDIR&&(Uc=No.join(process.env.DESTDIR,Uc))),Ty={access:null,"allow-same-version":!1,"always-auth":!1,also:null,audit:!0,"auth-type":"legacy","bin-links":!0,browser:null,ca:null,cafile:null,cache:Pet,"cache-lock-stale":6e4,"cache-lock-retries":10,"cache-lock-wait":1e4,"cache-max":1/0,"cache-min":10,cert:null,cidr:null,color:process.env.NO_COLOR==null,depth:1/0,description:!0,dev:!1,"dry-run":!1,editor:i0e.editor(),"engine-strict":!1,force:!1,"fetch-retries":2,"fetch-retry-factor":10,"fetch-retry-mintimeout":1e4,"fetch-retry-maxtimeout":6e4,git:"git","git-tag-version":!0,"commit-hooks":!0,global:!1,globalconfig:No.resolve(Uc,"etc","npmrc"),"global-style":!1,group:process.platform==="win32"?0:process.env.SUDO_GID||process.getgid&&process.getgid(),"ham-it-up":!1,heading:"npm","if-present":!1,"ignore-prepublish":!1,"ignore-scripts":!1,"init-module":No.resolve(Vf,".npm-init.js"),"init-author-name":"","init-author-email":"","init-author-url":"","init-version":"1.0.0","init-license":"ISC",json:!1,key:null,"legacy-bundling":!1,link:!1,"local-address":void 0,loglevel:"notice",logstream:process.stderr,"logs-max":10,long:!1,maxsockets:50,message:"%s","metrics-registry":null,"node-options":null,offline:!1,"onload-script":!1,only:null,optional:!0,otp:null,"package-lock":!0,"package-lock-only":!1,parseable:!1,"prefer-offline":!1,"prefer-online":!1,prefix:Uc,production:process.env.NODE_ENV==="production",progress:!process.env.TRAVIS&&!process.env.CI,provenance:!1,proxy:null,"https-proxy":null,"no-proxy":null,"user-agent":"npm/{npm-version} node/{node-version} {platform} {arch}","read-only":!1,"rebuild-bundle":!0,registry:"https://registry.npmjs.org/",rollback:!0,save:!0,"save-bundle":!1,"save-dev":!1,"save-exact":!1,"save-optional":!1,"save-prefix":"^","save-prod":!1,scope:"","script-shell":null,"scripts-prepend-node-path":"warn-only",searchopts:"",searchexclude:null,searchlimit:20,searchstaleness:15*60,"send-metrics":!1,shell:i0e.shell(),shrinkwrap:!0,"sign-git-tag":!1,"sso-poll-frequency":500,"sso-type":"oauth","strict-ssl":!0,tag:"latest","tag-version-prefix":"v",timing:!1,tmp:s0e,unicode:Fet(),"unsafe-perm":process.platform==="win32"||process.platform==="cygwin"||!(process.getuid&&process.setuid&&process.getgid&&process.setgid)||process.getuid()!==0,usage:!1,user:process.platform==="win32"?0:"nobody",userconfig:No.resolve(Vf,".npmrc"),umask:process.umask?process.umask():Net.fromString("022"),version:!1,versions:!1,viewer:process.platform==="win32"?"browser":"man",_exit:!0},Ty)}})});var l0e=m((wgt,fF)=>{"use strict";var Vc=require("path"),Iet=t0e(),u0e=o0e();fF.exports=(e,t,r)=>{let i=new Iet(Object.assign({},u0e.defaults,r),t);i.add(Object.assign({},e),"cli");let n=[],s=!1;if(require.resolve.paths){let l=require.resolve.paths("npm"),c;try{c=require.resolve("npm",{paths:l.slice(-1)})}catch{s=!0}c&&n.push(i.addFile(Vc.resolve(Vc.dirname(c),"..","npmrc"),"builtin"))}i.addEnv(),i.loadPrefix();let a=Vc.resolve(i.localPrefix,".npmrc"),o=i.get("userconfig");if(!i.get("global")&&a!==o?n.push(i.addFile(a,"project")):i.add({},"project"),i.get("workspace-prefix")&&i.get("workspace-prefix")!==a){let l=Vc.resolve(i.get("workspace-prefix"),".npmrc");n.push(i.addFile(l,"workspace"))}if(n.push(i.addFile(i.get("userconfig"),"user")),i.get("prefix")){let l=Vc.resolve(i.get("prefix"),"etc");i.root.globalconfig=Vc.resolve(l,"npmrc"),i.root.globalignorefile=Vc.resolve(l,"npmignore")}n.push(i.addFile(i.get("globalconfig"),"global")),i.loadUser();let u=i.get("cafile");return u&&i.loadCAFile(u),{config:i,warnings:n.filter(Boolean),failedToLoadBuiltInConfig:s}};Object.defineProperty(fF.exports,"defaults",{get(){return u0e.defaults},enumerable:!0})});var y0e=m((_gt,g0e)=>{var hF=require("url"),c0e=l0e(),d0e=":_authToken",p0e=":_auth",f0e=":username",h0e=":_password";g0e.exports=function(){let t,r;arguments.length>=2?(t=arguments[0],r=Object.assign({},arguments[1])):typeof arguments[0]=="string"?t=arguments[0]:r=Object.assign({},arguments[0]),r=r||{};let i=r.npmrc;return r.npmrc=(r.npmrc?{config:{get:n=>i[n]}}:c0e()).config,t=t||r.npmrc.get("registry")||c0e.defaults.registry,m0e(t,r)||Let(r.npmrc)};function m0e(e,t){let r=hF.parse(e,!1,!0),i;for(;i!=="/"&&r.pathname!==i;){i=r.pathname||"/";let n="//"+r.host+i.replace(/\/$/,""),s=qet(n,t.npmrc);if(s)return s;if(!t.recursive)return/\/$/.test(e)?void 0:m0e(hF.resolve(e,"."),t);r.pathname=hF.resolve(Bet(i),"..")||"/"}}function Let(e){return e.get("_auth")?{token:Oy(e.get("_auth")),type:"Basic"}:void 0}function Bet(e){return e[e.length-1]==="/"?e:e+"/"}function qet(e,t){let r=jet(t.get(e+d0e)||t.get(e+"/"+d0e));if(r)return r;let i=t.get(e+f0e)||t.get(e+"/"+f0e),n=t.get(e+h0e)||t.get(e+"/"+h0e),s=$et(i,n);if(s)return s;let a=Met(t.get(e+p0e)||t.get(e+"/"+p0e));if(a)return a}function Oy(e){return e.replace(/^\$\{?([^}]*)\}?$/,function(t,r){return process.env[r]})}function jet(e){return e?{token:Oy(e),type:"Bearer"}:void 0}function $et(e,t){if(!e||!t)return;let r=Buffer.from(Oy(t),"base64").toString("utf8");return{token:Buffer.from(e+":"+r,"utf8").toString("base64"),type:"Basic",password:r,username:e}}function Met(e){return e?{token:Oy(e),type:"Basic"}:void 0}});var g2=m((Dgt,v0e)=>{var Uet="2.0.0",Vet=Number.MAX_SAFE_INTEGER||9007199254740991,Het=16,zet=250,Get=["major","premajor","minor","preminor","patch","prepatch","prerelease"];v0e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Het,MAX_SAFE_BUILD_LENGTH:zet,MAX_SAFE_INTEGER:Vet,RELEASE_TYPES:Get,SEMVER_SPEC_VERSION:Uet,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var y2=m((bgt,w0e)=>{var Wet=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};w0e.exports=Wet});var Hf=m((ko,_0e)=>{var{MAX_SAFE_COMPONENT_LENGTH:mF,MAX_SAFE_BUILD_LENGTH:Xet,MAX_LENGTH:Yet}=g2(),Ket=y2();ko=_0e.exports={};var Jet=ko.re=[],Zet=ko.safeRe=[],X=ko.src=[],Y=ko.t={},Qet=0,gF="[a-zA-Z0-9-]",ett=[["\\s",1],["\\d",Yet],[gF,Xet]],ttt=e=>{for(let[t,r]of ett)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},ye=(e,t,r)=>{let i=ttt(t),n=Qet++;Ket(e,n,t),Y[e]=n,X[n]=t,Jet[n]=new RegExp(t,r?"g":void 0),Zet[n]=new RegExp(i,r?"g":void 0)};ye("NUMERICIDENTIFIER","0|[1-9]\\d*");ye("NUMERICIDENTIFIERLOOSE","\\d+");ye("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${gF}*`);ye("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);ye("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);ye("PRERELEASEIDENTIFIER",`(?:${X[Y.NUMERICIDENTIFIER]}|${X[Y.NONNUMERICIDENTIFIER]})`);ye("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NUMERICIDENTIFIERLOOSE]}|${X[Y.NONNUMERICIDENTIFIER]})`);ye("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);ye("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);ye("BUILDIDENTIFIER",`${gF}+`);ye("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);ye("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);ye("FULL",`^${X[Y.FULLPLAIN]}$`);ye("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);ye("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);ye("GTLT","((?:<|>)?=?)");ye("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ye("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);ye("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);ye("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);ye("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);ye("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);ye("COERCE",`(^|[^\\d])(\\d{1,${mF}})(?:\\.(\\d{1,${mF}}))?(?:\\.(\\d{1,${mF}}))?(?:$|[^\\d])`);ye("COERCERTL",X[Y.COERCE],!0);ye("LONETILDE","(?:~>?)");ye("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);ko.tildeTrimReplace="$1~";ye("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);ye("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);ye("LONECARET","(?:\\^)");ye("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);ko.caretTrimReplace="$1^";ye("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);ye("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);ye("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);ye("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);ye("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);ko.comparatorTrimReplace="$1$2$3";ye("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);ye("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);ye("STAR","(<|>)?=?\\s*\\*");ye("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ye("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Fy=m((Egt,D0e)=>{var rtt=Object.freeze({loose:!0}),itt=Object.freeze({}),ntt=e=>e?typeof e!="object"?rtt:e:itt;D0e.exports=ntt});var yF=m((xgt,x0e)=>{var b0e=/^[0-9]+$/,E0e=(e,t)=>{let r=b0e.test(e),i=b0e.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1},stt=(e,t)=>E0e(t,e);x0e.exports={compareIdentifiers:E0e,rcompareIdentifiers:stt}});var ri=m((Sgt,T0e)=>{var Ny=y2(),{MAX_LENGTH:S0e,MAX_SAFE_INTEGER:ky}=g2(),{safeRe:C0e,t:A0e}=Hf(),att=Fy(),{compareIdentifiers:zf}=yF(),vF=class e{constructor(t,r){if(r=att(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>S0e)throw new TypeError(`version is longer than ${S0e} characters`);Ny("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let i=t.trim().match(r.loose?C0e[A0e.LOOSE]:C0e[A0e.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>ky||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ky||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ky||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<ky)return s}return n}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Ny("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),zf(this.major,t.major)||zf(this.minor,t.minor)||zf(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let i=this.prerelease[r],n=t.prerelease[r];if(Ny("prerelease compare",r,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return zf(i,n)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let i=this.build[r],n=t.build[r];if(Ny("prerelease compare",r,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return zf(i,n)}while(++r)}inc(t,r,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,i),this.inc("pre",r,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,i),this.inc("pre",r,i);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(i)?1:0;if(!r&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let s=[r,n];i===!1&&(s=[r]),zf(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};T0e.exports=vF});var Hc=m((Cgt,F0e)=>{var O0e=ri(),ott=(e,t,r=!1)=>{if(e instanceof O0e)return e;try{return new O0e(e,t)}catch(i){if(!r)return null;throw i}};F0e.exports=ott});var k0e=m((Agt,N0e)=>{var utt=Hc(),ltt=(e,t)=>{let r=utt(e,t);return r?r.version:null};N0e.exports=ltt});var P0e=m((Tgt,R0e)=>{var ctt=Hc(),dtt=(e,t)=>{let r=ctt(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};R0e.exports=dtt});var B0e=m((Ogt,L0e)=>{var I0e=ri(),ptt=(e,t,r,i,n)=>{typeof r=="string"&&(n=i,i=r,r=void 0);try{return new I0e(e instanceof I0e?e.version:e,r).inc(t,i,n).version}catch{return null}};L0e.exports=ptt});var $0e=m((Fgt,j0e)=>{var q0e=Hc(),ftt=(e,t)=>{let r=q0e(e,null,!0),i=q0e(t,null,!0),n=r.compare(i);if(n===0)return null;let s=n>0,a=s?r:i,o=s?i:r,u=!!a.prerelease.length;if(!!o.prerelease.length&&!u)return!o.patch&&!o.minor?"major":a.patch?"patch":a.minor?"minor":"major";let c=u?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"};j0e.exports=ftt});var U0e=m((Ngt,M0e)=>{var htt=ri(),mtt=(e,t)=>new htt(e,t).major;M0e.exports=mtt});var H0e=m((kgt,V0e)=>{var gtt=ri(),ytt=(e,t)=>new gtt(e,t).minor;V0e.exports=ytt});var G0e=m((Rgt,z0e)=>{var vtt=ri(),wtt=(e,t)=>new vtt(e,t).patch;z0e.exports=wtt});var X0e=m((Pgt,W0e)=>{var _tt=Hc(),Dtt=(e,t)=>{let r=_tt(e,t);return r&&r.prerelease.length?r.prerelease:null};W0e.exports=Dtt});var Xn=m((Igt,K0e)=>{var Y0e=ri(),btt=(e,t,r)=>new Y0e(e,r).compare(new Y0e(t,r));K0e.exports=btt});var Z0e=m((Lgt,J0e)=>{var Ett=Xn(),xtt=(e,t,r)=>Ett(t,e,r);J0e.exports=xtt});var eme=m((Bgt,Q0e)=>{var Stt=Xn(),Ctt=(e,t)=>Stt(e,t,!0);Q0e.exports=Ctt});var Ry=m((qgt,rme)=>{var tme=ri(),Att=(e,t,r)=>{let i=new tme(e,r),n=new tme(t,r);return i.compare(n)||i.compareBuild(n)};rme.exports=Att});var nme=m((jgt,ime)=>{var Ttt=Ry(),Ott=(e,t)=>e.sort((r,i)=>Ttt(r,i,t));ime.exports=Ott});var ame=m(($gt,sme)=>{var Ftt=Ry(),Ntt=(e,t)=>e.sort((r,i)=>Ftt(i,r,t));sme.exports=Ntt});var v2=m((Mgt,ome)=>{var ktt=Xn(),Rtt=(e,t,r)=>ktt(e,t,r)>0;ome.exports=Rtt});var Py=m((Ugt,ume)=>{var Ptt=Xn(),Itt=(e,t,r)=>Ptt(e,t,r)<0;ume.exports=Itt});var wF=m((Vgt,lme)=>{var Ltt=Xn(),Btt=(e,t,r)=>Ltt(e,t,r)===0;lme.exports=Btt});var _F=m((Hgt,cme)=>{var qtt=Xn(),jtt=(e,t,r)=>qtt(e,t,r)!==0;cme.exports=jtt});var Iy=m((zgt,dme)=>{var $tt=Xn(),Mtt=(e,t,r)=>$tt(e,t,r)>=0;dme.exports=Mtt});var Ly=m((Ggt,pme)=>{var Utt=Xn(),Vtt=(e,t,r)=>Utt(e,t,r)<=0;pme.exports=Vtt});var DF=m((Wgt,fme)=>{var Htt=wF(),ztt=_F(),Gtt=v2(),Wtt=Iy(),Xtt=Py(),Ytt=Ly(),Ktt=(e,t,r,i)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Htt(e,r,i);case"!=":return ztt(e,r,i);case">":return Gtt(e,r,i);case">=":return Wtt(e,r,i);case"<":return Xtt(e,r,i);case"<=":return Ytt(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};fme.exports=Ktt});var mme=m((Xgt,hme)=>{var Jtt=ri(),Ztt=Hc(),{safeRe:By,t:qy}=Hf(),Qtt=(e,t)=>{if(e instanceof Jtt)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(By[qy.COERCE]);else{let i;for(;(i=By[qy.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||i.index+i[0].length!==r.index+r[0].length)&&(r=i),By[qy.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;By[qy.COERCERTL].lastIndex=-1}return r===null?null:Ztt(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};hme.exports=Qtt});var yme=m((Ygt,gme)=>{"use strict";gme.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var wme=m((Kgt,vme)=>{"use strict";vme.exports=ke;ke.Node=zc;ke.create=ke;function ke(e){var t=this;if(t instanceof ke||(t=new ke),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(n){t.push(n)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}ke.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t};ke.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}};ke.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}};ke.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)trt(this,arguments[e]);return this.length};ke.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)rrt(this,arguments[e]);return this.length};ke.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}};ke.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}};ke.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;r!==null;i++)e.call(t,r.value,i,this),r=r.next};ke.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;r!==null;i--)e.call(t,r.value,i,this),r=r.prev};ke.prototype.get=function(e){for(var t=0,r=this.head;r!==null&&t<e;t++)r=r.next;if(t===e&&r!==null)return r.value};ke.prototype.getReverse=function(e){for(var t=0,r=this.tail;r!==null&&t<e;t++)r=r.prev;if(t===e&&r!==null)return r.value};ke.prototype.map=function(e,t){t=t||this;for(var r=new ke,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r};ke.prototype.mapReverse=function(e,t){t=t||this;for(var r=new ke,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r};ke.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else if(this.head)i=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;i!==null;n++)r=e(r,i.value,n),i=i.next;return r};ke.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else if(this.tail)i=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;i!==null;n--)r=e(r,i.value,n),i=i.prev;return r};ke.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;r!==null;t++)e[t]=r.value,r=r.next;return e};ke.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;r!==null;t++)e[t]=r.value,r=r.prev;return e};ke.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new ke;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,n=this.head;n!==null&&i<e;i++)n=n.next;for(;n!==null&&i<t;i++,n=n.next)r.push(n.value);return r};ke.prototype.sliceReverse=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new ke;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,n=this.tail;n!==null&&i>t;i--)n=n.prev;for(;n!==null&&i>e;i--,n=n.prev)r.push(n.value);return r};ke.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,n=this.head;n!==null&&i<e;i++)n=n.next;for(var s=[],i=0;n&&i<t;i++)s.push(n.value),n=this.removeNode(n);n===null&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(var i=0;i<r.length;i++)n=ert(this,n,r[i]);return s};ke.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;r!==null;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};function ert(e,t,r){var i=t===e.head?new zc(r,null,t,e):new zc(r,t,t.next,e);return i.next===null&&(e.tail=i),i.prev===null&&(e.head=i),e.length++,i}function trt(e,t){e.tail=new zc(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function rrt(e,t){e.head=new zc(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function zc(e,t,r,i){if(!(this instanceof zc))return new zc(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}try{yme()(ke)}catch{}});var xme=m((Jgt,Eme)=>{"use strict";var irt=wme(),Gc=Symbol("max"),Po=Symbol("length"),Gf=Symbol("lengthCalculator"),_2=Symbol("allowStale"),Wc=Symbol("maxAge"),Ro=Symbol("dispose"),_me=Symbol("noDisposeOnSet"),xr=Symbol("lruList"),bs=Symbol("cache"),bme=Symbol("updateAgeOnGet"),bF=()=>1,xF=class{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");let r=this[Gc]=t.max||1/0,i=t.length||bF;if(this[Gf]=typeof i!="function"?bF:i,this[_2]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[Wc]=t.maxAge||0,this[Ro]=t.dispose,this[_me]=t.noDisposeOnSet||!1,this[bme]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[Gc]=t||1/0,w2(this)}get max(){return this[Gc]}set allowStale(t){this[_2]=!!t}get allowStale(){return this[_2]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[Wc]=t,w2(this)}get maxAge(){return this[Wc]}set lengthCalculator(t){typeof t!="function"&&(t=bF),t!==this[Gf]&&(this[Gf]=t,this[Po]=0,this[xr].forEach(r=>{r.length=this[Gf](r.value,r.key),this[Po]+=r.length})),w2(this)}get lengthCalculator(){return this[Gf]}get length(){return this[Po]}get itemCount(){return this[xr].length}rforEach(t,r){r=r||this;for(let i=this[xr].tail;i!==null;){let n=i.prev;Dme(this,t,i,r),i=n}}forEach(t,r){r=r||this;for(let i=this[xr].head;i!==null;){let n=i.next;Dme(this,t,i,r),i=n}}keys(){return this[xr].toArray().map(t=>t.key)}values(){return this[xr].toArray().map(t=>t.value)}reset(){this[Ro]&&this[xr]&&this[xr].length&&this[xr].forEach(t=>this[Ro](t.key,t.value)),this[bs]=new Map,this[xr]=new irt,this[Po]=0}dump(){return this[xr].map(t=>jy(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[xr]}set(t,r,i){if(i=i||this[Wc],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let n=i?Date.now():0,s=this[Gf](r,t);if(this[bs].has(t)){if(s>this[Gc])return Wf(this,this[bs].get(t)),!1;let u=this[bs].get(t).value;return this[Ro]&&(this[_me]||this[Ro](t,u.value)),u.now=n,u.maxAge=i,u.value=r,this[Po]+=s-u.length,u.length=s,this.get(t),w2(this),!0}let a=new SF(t,r,s,n,i);return a.length>this[Gc]?(this[Ro]&&this[Ro](t,r),!1):(this[Po]+=a.length,this[xr].unshift(a),this[bs].set(t,this[xr].head),w2(this),!0)}has(t){if(!this[bs].has(t))return!1;let r=this[bs].get(t).value;return!jy(this,r)}get(t){return EF(this,t,!0)}peek(t){return EF(this,t,!1)}pop(){let t=this[xr].tail;return t?(Wf(this,t),t.value):null}del(t){Wf(this,this[bs].get(t))}load(t){this.reset();let r=Date.now();for(let i=t.length-1;i>=0;i--){let n=t[i],s=n.e||0;if(s===0)this.set(n.k,n.v);else{let a=s-r;a>0&&this.set(n.k,n.v,a)}}}prune(){this[bs].forEach((t,r)=>EF(this,r,!1))}},EF=(e,t,r)=>{let i=e[bs].get(t);if(i){let n=i.value;if(jy(e,n)){if(Wf(e,i),!e[_2])return}else r&&(e[bme]&&(i.value.now=Date.now()),e[xr].unshiftNode(i));return n.value}},jy=(e,t)=>{if(!t||!t.maxAge&&!e[Wc])return!1;let r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[Wc]&&r>e[Wc]},w2=e=>{if(e[Po]>e[Gc])for(let t=e[xr].tail;e[Po]>e[Gc]&&t!==null;){let r=t.prev;Wf(e,t),t=r}},Wf=(e,t)=>{if(t){let r=t.value;e[Ro]&&e[Ro](r.key,r.value),e[Po]-=r.length,e[bs].delete(r.key),e[xr].removeNode(t)}},SF=class{constructor(t,r,i,n,s){this.key=t,this.value=r,this.length=i,this.now=n,this.maxAge=s||0}},Dme=(e,t,r,i)=>{let n=r.value;jy(e,n)&&(Wf(e,r),e[_2]||(n=void 0)),n&&t.call(i,n.value,n.key,e)};Eme.exports=xF});var Yn=m((Zgt,Tme)=>{var CF=class e{constructor(t,r){if(r=srt(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof AF)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(n=>!Cme(n[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&prt(n[0])){this.set=[n];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&crt)|(this.options.loose&&drt))+":"+t,n=Sme.get(i);if(n)return n;let s=this.options.loose,a=s?Hi[wi.HYPHENRANGELOOSE]:Hi[wi.HYPHENRANGE];t=t.replace(a,brt(this.options.includePrerelease)),lt("hyphen replace",t),t=t.replace(Hi[wi.COMPARATORTRIM],ort),lt("comparator trim",t),t=t.replace(Hi[wi.TILDETRIM],urt),lt("tilde trim",t),t=t.replace(Hi[wi.CARETTRIM],lrt),lt("caret trim",t);let o=t.split(" ").map(d=>frt(d,this.options)).join(" ").split(/\s+/).map(d=>Drt(d,this.options));s&&(o=o.filter(d=>(lt("loose invalid filter",d,this.options),!!d.match(Hi[wi.COMPARATORLOOSE])))),lt("range list",o);let u=new Map,l=o.map(d=>new AF(d,this.options));for(let d of l){if(Cme(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return Sme.set(i,c),c}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(i=>Ame(i,r)&&t.set.some(n=>Ame(n,r)&&i.every(s=>n.every(a=>s.intersects(a,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new art(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Ert(this.set[r],t,this.options))return!0;return!1}};Tme.exports=CF;var nrt=xme(),Sme=new nrt({max:1e3}),srt=Fy(),AF=D2(),lt=y2(),art=ri(),{safeRe:Hi,t:wi,comparatorTrimReplace:ort,tildeTrimReplace:urt,caretTrimReplace:lrt}=Hf(),{FLAG_INCLUDE_PRERELEASE:crt,FLAG_LOOSE:drt}=g2(),Cme=e=>e.value==="<0.0.0-0",prt=e=>e.value==="",Ame=(e,t)=>{let r=!0,i=e.slice(),n=i.pop();for(;r&&i.length;)r=i.every(s=>n.intersects(s,t)),n=i.pop();return r},frt=(e,t)=>(lt("comp",e,t),e=grt(e,t),lt("caret",e),e=hrt(e,t),lt("tildes",e),e=vrt(e,t),lt("xrange",e),e=_rt(e,t),lt("stars",e),e),_i=e=>!e||e.toLowerCase()==="x"||e==="*",hrt=(e,t)=>e.trim().split(/\s+/).map(r=>mrt(r,t)).join(" "),mrt=(e,t)=>{let r=t.loose?Hi[wi.TILDELOOSE]:Hi[wi.TILDE];return e.replace(r,(i,n,s,a,o)=>{lt("tilde",e,i,n,s,a,o);let u;return _i(n)?u="":_i(s)?u=`>=${n}.0.0 <${+n+1}.0.0-0`:_i(a)?u=`>=${n}.${s}.0 <${n}.${+s+1}.0-0`:o?(lt("replaceTilde pr",o),u=`>=${n}.${s}.${a}-${o} <${n}.${+s+1}.0-0`):u=`>=${n}.${s}.${a} <${n}.${+s+1}.0-0`,lt("tilde return",u),u})},grt=(e,t)=>e.trim().split(/\s+/).map(r=>yrt(r,t)).join(" "),yrt=(e,t)=>{lt("caret",e,t);let r=t.loose?Hi[wi.CARETLOOSE]:Hi[wi.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,(n,s,a,o,u)=>{lt("caret",e,n,s,a,o,u);let l;return _i(s)?l="":_i(a)?l=`>=${s}.0.0${i} <${+s+1}.0.0-0`:_i(o)?s==="0"?l=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:u?(lt("replaceCaret pr",u),s==="0"?a==="0"?l=`>=${s}.${a}.${o}-${u} <${s}.${a}.${+o+1}-0`:l=`>=${s}.${a}.${o}-${u} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.${o}-${u} <${+s+1}.0.0-0`):(lt("no pr"),s==="0"?a==="0"?l=`>=${s}.${a}.${o}${i} <${s}.${a}.${+o+1}-0`:l=`>=${s}.${a}.${o}${i} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.${o} <${+s+1}.0.0-0`),lt("caret return",l),l})},vrt=(e,t)=>(lt("replaceXRanges",e,t),e.split(/\s+/).map(r=>wrt(r,t)).join(" ")),wrt=(e,t)=>{e=e.trim();let r=t.loose?Hi[wi.XRANGELOOSE]:Hi[wi.XRANGE];return e.replace(r,(i,n,s,a,o,u)=>{lt("xRange",e,i,n,s,a,o,u);let l=_i(s),c=l||_i(a),d=c||_i(o),p=d;return n==="="&&p&&(n=""),u=t.includePrerelease?"-0":"",l?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&p?(c&&(a=0),o=0,n===">"?(n=">=",c?(s=+s+1,a=0,o=0):(a=+a+1,o=0)):n==="<="&&(n="<",c?s=+s+1:a=+a+1),n==="<"&&(u="-0"),i=`${n+s}.${a}.${o}${u}`):c?i=`>=${s}.0.0${u} <${+s+1}.0.0-0`:d&&(i=`>=${s}.${a}.0${u} <${s}.${+a+1}.0-0`),lt("xRange return",i),i})},_rt=(e,t)=>(lt("replaceStars",e,t),e.trim().replace(Hi[wi.STAR],"")),Drt=(e,t)=>(lt("replaceGTE0",e,t),e.trim().replace(Hi[t.includePrerelease?wi.GTE0PRE:wi.GTE0],"")),brt=e=>(t,r,i,n,s,a,o,u,l,c,d,p,f)=>(_i(i)?r="":_i(n)?r=`>=${i}.0.0${e?"-0":""}`:_i(s)?r=`>=${i}.${n}.0${e?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,_i(l)?u="":_i(c)?u=`<${+l+1}.0.0-0`:_i(d)?u=`<${l}.${+c+1}.0-0`:p?u=`<=${l}.${c}.${d}-${p}`:e?u=`<${l}.${c}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Ert=(e,t,r)=>{for(let i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let i=0;i<e.length;i++)if(lt(e[i].semver),e[i].semver!==AF.ANY&&e[i].semver.prerelease.length>0){let n=e[i].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}});var D2=m((Qgt,Pme)=>{var b2=Symbol("SemVer ANY"),FF=class e{static get ANY(){return b2}constructor(t,r){if(r=Ome(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),OF("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===b2?this.value="":this.value=this.operator+this.semver.version,OF("comp",this)}parse(t){let r=this.options.loose?Fme[Nme.COMPARATORLOOSE]:Fme[Nme.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new kme(i[2],this.options.loose):this.semver=b2}toString(){return this.value}test(t){if(OF("Comparator.test",t,this.options.loose),this.semver===b2||t===b2)return!0;if(typeof t=="string")try{t=new kme(t,this.options)}catch{return!1}return TF(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Rme(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new Rme(this.value,r).test(t.semver):(r=Ome(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||TF(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||TF(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Pme.exports=FF;var Ome=Fy(),{safeRe:Fme,t:Nme}=Hf(),TF=DF(),OF=y2(),kme=ri(),Rme=Yn()});var E2=m((e8t,Ime)=>{var xrt=Yn(),Srt=(e,t,r)=>{try{t=new xrt(t,r)}catch{return!1}return t.test(e)};Ime.exports=Srt});var Bme=m((t8t,Lme)=>{var Crt=Yn(),Art=(e,t)=>new Crt(e,t).set.map(r=>r.map(i=>i.value).join(" ").trim().split(" "));Lme.exports=Art});var jme=m((r8t,qme)=>{var Trt=ri(),Ort=Yn(),Frt=(e,t,r)=>{let i=null,n=null,s=null;try{s=new Ort(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!i||n.compare(a)===-1)&&(i=a,n=new Trt(i,r))}),i};qme.exports=Frt});var Mme=m((i8t,$me)=>{var Nrt=ri(),krt=Yn(),Rrt=(e,t,r)=>{let i=null,n=null,s=null;try{s=new krt(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!i||n.compare(a)===1)&&(i=a,n=new Nrt(i,r))}),i};$me.exports=Rrt});var Hme=m((n8t,Vme)=>{var NF=ri(),Prt=Yn(),Ume=v2(),Irt=(e,t)=>{e=new Prt(e,t);let r=new NF("0.0.0");if(e.test(r)||(r=new NF("0.0.0-0"),e.test(r)))return r;r=null;for(let i=0;i<e.set.length;++i){let n=e.set[i],s=null;n.forEach(a=>{let o=new NF(a.semver.version);switch(a.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!s||Ume(o,s))&&(s=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!r||Ume(r,s))&&(r=s)}return r&&e.test(r)?r:null};Vme.exports=Irt});var Gme=m((s8t,zme)=>{var Lrt=Yn(),Brt=(e,t)=>{try{return new Lrt(e,t).range||"*"}catch{return null}};zme.exports=Brt});var $y=m((a8t,Kme)=>{var qrt=ri(),Yme=D2(),{ANY:jrt}=Yme,$rt=Yn(),Mrt=E2(),Wme=v2(),Xme=Py(),Urt=Ly(),Vrt=Iy(),Hrt=(e,t,r,i)=>{e=new qrt(e,i),t=new $rt(t,i);let n,s,a,o,u;switch(r){case">":n=Wme,s=Urt,a=Xme,o=">",u=">=";break;case"<":n=Xme,s=Vrt,a=Wme,o="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Mrt(e,t,i))return!1;for(let l=0;l<t.set.length;++l){let c=t.set[l],d=null,p=null;if(c.forEach(f=>{f.semver===jrt&&(f=new Yme(">=0.0.0")),d=d||f,p=p||f,n(f.semver,d.semver,i)?d=f:a(f.semver,p.semver,i)&&(p=f)}),d.operator===o||d.operator===u||(!p.operator||p.operator===o)&&s(e,p.semver))return!1;if(p.operator===u&&a(e,p.semver))return!1}return!0};Kme.exports=Hrt});var Zme=m((o8t,Jme)=>{var zrt=$y(),Grt=(e,t,r)=>zrt(e,t,">",r);Jme.exports=Grt});var e2e=m((u8t,Qme)=>{var Wrt=$y(),Xrt=(e,t,r)=>Wrt(e,t,"<",r);Qme.exports=Xrt});var i2e=m((l8t,r2e)=>{var t2e=Yn(),Yrt=(e,t,r)=>(e=new t2e(e,r),t=new t2e(t,r),e.intersects(t,r));r2e.exports=Yrt});var s2e=m((c8t,n2e)=>{var Krt=E2(),Jrt=Xn();n2e.exports=(e,t,r)=>{let i=[],n=null,s=null,a=e.sort((c,d)=>Jrt(c,d,r));for(let c of a)Krt(c,t,r)?(s=c,n||(n=c)):(s&&i.push([n,s]),s=null,n=null);n&&i.push([n,null]);let o=[];for(let[c,d]of i)c===d?o.push(c):!d&&c===a[0]?o.push("*"):d?c===a[0]?o.push(`<=${d}`):o.push(`${c} - ${d}`):o.push(`>=${c}`);let u=o.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return u.length<l.length?u:t}});var d2e=m((d8t,c2e)=>{var a2e=Yn(),RF=D2(),{ANY:kF}=RF,x2=E2(),PF=Xn(),Zrt=(e,t,r={})=>{if(e===t)return!0;e=new a2e(e,r),t=new a2e(t,r);let i=!1;e:for(let n of e.set){for(let s of t.set){let a=eit(n,s,r);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},Qrt=[new RF(">=0.0.0-0")],o2e=[new RF(">=0.0.0")],eit=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===kF){if(t.length===1&&t[0].semver===kF)return!0;r.includePrerelease?e=Qrt:e=o2e}if(t.length===1&&t[0].semver===kF){if(r.includePrerelease)return!0;t=o2e}let i=new Set,n,s;for(let f of e)f.operator===">"||f.operator===">="?n=u2e(n,f,r):f.operator==="<"||f.operator==="<="?s=l2e(s,f,r):i.add(f.semver);if(i.size>1)return null;let a;if(n&&s){if(a=PF(n.semver,s.semver,r),a>0)return null;if(a===0&&(n.operator!==">="||s.operator!=="<="))return null}for(let f of i){if(n&&!x2(f,String(n),r)||s&&!x2(f,String(s),r))return null;for(let h of t)if(!x2(f,String(h),r))return!1;return!0}let o,u,l,c,d=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,p=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;d&&d.prerelease.length===1&&s.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let f of t){if(c=c||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",n){if(p&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch&&(p=!1),f.operator===">"||f.operator===">="){if(o=u2e(n,f,r),o===f&&o!==n)return!1}else if(n.operator===">="&&!x2(n.semver,String(f),r))return!1}if(s){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator==="<"||f.operator==="<="){if(u=l2e(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!x2(s.semver,String(f),r))return!1}if(!f.operator&&(s||n)&&a!==0)return!1}return!(n&&l&&!s&&a!==0||s&&c&&!n&&a!==0||p||d)},u2e=(e,t,r)=>{if(!e)return t;let i=PF(e.semver,t.semver,r);return i>0?e:i<0||t.operator===">"&&e.operator===">="?t:e},l2e=(e,t,r)=>{if(!e)return t;let i=PF(e.semver,t.semver,r);return i<0?e:i>0||t.operator==="<"&&e.operator==="<="?t:e};c2e.exports=Zrt});var m2e=m((p8t,h2e)=>{var IF=Hf(),p2e=g2(),tit=ri(),f2e=yF(),rit=Hc(),iit=k0e(),nit=P0e(),sit=B0e(),ait=$0e(),oit=U0e(),uit=H0e(),lit=G0e(),cit=X0e(),dit=Xn(),pit=Z0e(),fit=eme(),hit=Ry(),mit=nme(),git=ame(),yit=v2(),vit=Py(),wit=wF(),_it=_F(),Dit=Iy(),bit=Ly(),Eit=DF(),xit=mme(),Sit=D2(),Cit=Yn(),Ait=E2(),Tit=Bme(),Oit=jme(),Fit=Mme(),Nit=Hme(),kit=Gme(),Rit=$y(),Pit=Zme(),Iit=e2e(),Lit=i2e(),Bit=s2e(),qit=d2e();h2e.exports={parse:rit,valid:iit,clean:nit,inc:sit,diff:ait,major:oit,minor:uit,patch:lit,prerelease:cit,compare:dit,rcompare:pit,compareLoose:fit,compareBuild:hit,sort:mit,rsort:git,gt:yit,lt:vit,eq:wit,neq:_it,gte:Dit,lte:bit,cmp:Eit,coerce:xit,Comparator:Sit,Range:Cit,satisfies:Ait,toComparators:Tit,maxSatisfying:Oit,minSatisfying:Fit,minVersion:Nit,validRange:kit,outside:Rit,gtr:Pit,ltr:Iit,intersects:Lit,simplifyRange:Bit,subset:qit,SemVer:tit,re:IF.re,src:IF.src,tokens:IF.t,SEMVER_SPEC_VERSION:p2e.SEMVER_SPEC_VERSION,RELEASE_TYPES:p2e.RELEASE_TYPES,compareIdentifiers:f2e.compareIdentifiers,rcompareIdentifiers:f2e.rcompareIdentifiers}});var LF=m((f8t,w2e)=>{var jit=require("url"),{getIt:$it}=T1e(),{debug:Mit,retry:g2e,promise:Uit,httpErrors:Vit,jsonResponse:Hit}=W1e(),zit=vhe(),Git=y0e(),Wit=m2e(),Xit=e=>/(application\/json|\+json)/.test(e||"");function Yit(e,t,r){let i=e.response||{statusCode:500,headers:{}};return g2e.shouldRetry(e,t,r)||i&&i.statusCode>=500||i.statusCode<300&&!Xit(i.headers["content-type"])}function Kit(e,t){if(t.registryUrl)return t.registryUrl;let r=e.split("/")[0];return zit(r)}var y2e=$it([Hit({force:!0}),Vit(),Mit({namespace:"get-latest-version"}),Uit(),g2e({shouldRetry:Yit})]);async function v2e(e,t){let r=typeof t=="string"?{range:t,auth:!0}:Object.assign({range:"latest",auth:!0},t),i=Kit(e,r),n=jit.resolve(i,encodeURIComponent(e).replace(/^%40/,"@")),s=r.auth&&Git(i,{recursive:!0}),a=r.request||y2e,o={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};s&&(o.authorization=`${s.type} ${s.token}`);let u;try{u=await a({url:n,headers:o})}catch(h){throw h.response&&h.response.statusCode===404?new Error(`Package \`${e}\` doesn't exist`):h}let l=u.body,c=r.range,d=l["dist-tags"].latest;if(l["dist-tags"][c])return r.includeLatest?{latest:d,inRange:l["dist-tags"][c]}:l["dist-tags"][c];if(l.versions[c])return r.includeLatest?{latest:d,inRange:c}:c;let p=Object.keys(l.versions),f=Wit.maxSatisfying(p,c);return f?r.includeLatest?{latest:d,inRange:f}:f:r.includeLatest?{latest:d,inRange:void 0}:void 0}v2e.request=y2e;w2e.exports=v2e});var M2e=m((x8t,Io)=>{var er=require("fs"),MF=require("os"),cn=require("path"),C2e=require("crypto"),_a={fs:er.constants,os:MF.constants},A2e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",O2e=/XXXXXX/,Qit=3,F2e=(_a.O_CREAT||_a.fs.O_CREAT)|(_a.O_EXCL||_a.fs.O_EXCL)|(_a.O_RDWR||_a.fs.O_RDWR),ent=MF.platform()==="win32",tnt=_a.EBADF||_a.os.errno.EBADF,rnt=_a.ENOENT||_a.os.errno.ENOENT,N2e=448,k2e=384,int="exit",Xf=[],R2e=er.rmdirSync.bind(er),P2e=!1;function nnt(e,t){return er.rm(e,{recursive:!0},t)}function I2e(e){return er.rmSync(e,{recursive:!0})}function UF(e,t){let r=Yf(e,t),i=r[0],n=r[1];try{q2e(i)}catch(a){return n(a)}let s=i.tries;(function a(){try{let o=B2e(i);er.stat(o,function(u){if(!u)return s-- >0?a():n(new Error("Could not get a unique tmp filename, max tries reached "+o));n(null,o)})}catch(o){n(o)}})()}function VF(e){let t=Yf(e),r=t[0];q2e(r);let i=r.tries;do{let n=B2e(r);try{er.statSync(n)}catch{return n}}while(i-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function snt(e,t){let r=Yf(e,t),i=r[0],n=r[1];UF(i,function(a,o){if(a)return n(a);er.open(o,F2e,i.mode||k2e,function(l,c){if(l)return n(l);if(i.discardDescriptor)return er.close(c,function(p){return n(p,o,void 0,qF(o,-1,i,!1))});{let d=i.discardDescriptor||i.detachDescriptor;n(null,o,c,qF(o,d?-1:c,i,!1))}})})}function ant(e){let t=Yf(e),r=t[0],i=r.discardDescriptor||r.detachDescriptor,n=VF(r);var s=er.openSync(n,F2e,r.mode||k2e);return r.discardDescriptor&&(er.closeSync(s),s=void 0),{name:n,fd:s,removeCallback:qF(n,i?-1:s,r,!0)}}function ont(e,t){let r=Yf(e,t),i=r[0],n=r[1];UF(i,function(a,o){if(a)return n(a);er.mkdir(o,i.mode||N2e,function(l){if(l)return n(l);n(null,o,L2e(o,i,!1))})})}function unt(e){let t=Yf(e),r=t[0],i=VF(r);return er.mkdirSync(i,r.mode||N2e),{name:i,removeCallback:L2e(i,r,!0)}}function lnt(e,t){let r=function(i){if(i&&!$F(i))return t(i);t()};0<=e[0]?er.close(e[0],function(){er.unlink(e[1],r)}):er.unlink(e[1],r)}function cnt(e){let t=null;try{0<=e[0]&&er.closeSync(e[0])}catch(r){if(!fnt(r)&&!$F(r))throw r}finally{try{er.unlinkSync(e[1])}catch(r){$F(r)||(t=r)}}if(t!==null)throw t}function qF(e,t,r,i){let n=My(cnt,[t,e],i),s=My(lnt,[t,e],i,n);return r.keep||Xf.unshift(n),i?n:s}function L2e(e,t,r){let i=t.unsafeCleanup?nnt:er.rmdir.bind(er),n=t.unsafeCleanup?I2e:R2e,s=My(n,e,r),a=My(i,e,r,s);return t.keep||Xf.unshift(s),r?s:a}function My(e,t,r,i){let n=!1;return function s(a){if(!n){let o=i||s,u=Xf.indexOf(o);return u>=0&&Xf.splice(u,1),n=!0,r||e===R2e||e===I2e?e(t):e(t,a||function(){})}}}function dnt(){if(P2e)for(;Xf.length;)try{Xf[0]()}catch{}}function T2e(e){let t=[],r=null;try{r=C2e.randomBytes(e)}catch{r=C2e.pseudoRandomBytes(e)}for(var i=0;i<e;i++)t.push(A2e[r[i]%A2e.length]);return t.join("")}function pnt(e){return e===null||zi(e)||!e.trim()}function zi(e){return typeof e>"u"}function Yf(e,t){if(typeof e=="function")return[{},e];if(zi(e))return[{},t];let r={};for(let i of Object.getOwnPropertyNames(e))r[i]=e[i];return[r,t]}function B2e(e){let t=e.tmpdir;if(!zi(e.name))return cn.join(t,e.dir,e.name);if(!zi(e.template))return cn.join(t,e.dir,e.template).replace(O2e,T2e(6));let r=[e.prefix?e.prefix:"tmp","-",process.pid,"-",T2e(12),e.postfix?"-"+e.postfix:""].join("");return cn.join(t,e.dir,r)}function q2e(e){e.tmpdir=$2e(e);let t=e.tmpdir;if(zi(e.name)||BF(e.name,"name",t),zi(e.dir)||BF(e.dir,"dir",t),!zi(e.template)&&(BF(e.template,"template",t),!e.template.match(O2e)))throw new Error(`Invalid template, found "${e.template}".`);if(!zi(e.tries)&&isNaN(e.tries)||e.tries<0)throw new Error(`Invalid tries, found "${e.tries}".`);e.tries=zi(e.name)?e.tries||Qit:1,e.keep=!!e.keep,e.detachDescriptor=!!e.detachDescriptor,e.discardDescriptor=!!e.discardDescriptor,e.unsafeCleanup=!!e.unsafeCleanup,e.dir=zi(e.dir)?"":cn.relative(t,jF(e.dir,t)),e.template=zi(e.template)?void 0:cn.relative(t,jF(e.template,t)),e.template=pnt(e.template)?void 0:cn.relative(e.dir,e.template),e.name=zi(e.name)?void 0:e.name,e.prefix=zi(e.prefix)?"":e.prefix,e.postfix=zi(e.postfix)?"":e.postfix}function jF(e,t){return e.startsWith(t)?cn.resolve(e):cn.resolve(cn.join(t,e))}function BF(e,t,r){if(t==="name"){if(cn.isAbsolute(e))throw new Error(`${t} option must not contain an absolute path, found "${e}".`);let i=cn.basename(e);if(i===".."||i==="."||i!==e)throw new Error(`${t} option must not contain a path, found "${e}".`)}else{if(cn.isAbsolute(e)&&!e.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${e}".`);let i=jF(e,r);if(!i.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${i}".`)}}function fnt(e){return j2e(e,-tnt,"EBADF")}function $F(e){return j2e(e,-rnt,"ENOENT")}function j2e(e,t,r){return ent?e.code===r:e.code===r&&e.errno===t}function hnt(){P2e=!0}function $2e(e){return cn.resolve(e&&e.tmpdir||MF.tmpdir())}process.addListener(int,dnt);Object.defineProperty(Io.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return $2e()}});Io.exports.dir=ont;Io.exports.dirSync=unt;Io.exports.file=snt;Io.exports.fileSync=ant;Io.exports.tmpName=UF;Io.exports.tmpNameSync=VF;Io.exports.setGracefulCleanup=hnt});var XF=m(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.DEFAULT_COLOR_MAP=void 0;Kf.DEFAULT_COLOR_MAP={red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",white_bold:"\x1B[01m",reset:"\x1B[0m"};var WF=class{constructor(t=Kf.DEFAULT_COLOR_MAP){this.text="",this.colorMap=t}addCharsWithColor(t,r){let i=this.colorMap[t];this.text+=i!==void 0?`${i}${r}${this.colorMap.reset}`:r}renderConsole(){return this.text}};Kf.default=WF});var O2=m(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.DEFAULT_HEADER_ALIGNMENT=tr.DEFAULT_ROW_ALIGNMENT=tr.DEFAULT_HEADER_FONT_COLOR=tr.DEFAULT_ROW_FONT_COLOR=tr.COLORS=tr.ALIGNMENTS=tr.DEFAULT_TABLE_STYLE=tr.DEFAULT_ROW_SEPARATOR=tr.DEFAULT_COLUMN_LEN=void 0;tr.DEFAULT_COLUMN_LEN=20;tr.DEFAULT_ROW_SEPARATOR=!1;tr.DEFAULT_TABLE_STYLE={headerTop:{left:"\u250C",mid:"\u252C",right:"\u2510",other:"\u2500"},headerBottom:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"},tableBottom:{left:"\u2514",mid:"\u2534",right:"\u2518",other:"\u2500"},vertical:"\u2502",rowSeparator:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"}};tr.ALIGNMENTS=["right","left","center"];tr.COLORS=["red","green","yellow","white","blue","magenta","cyan","white_bold","reset"];tr.DEFAULT_ROW_FONT_COLOR="white";tr.DEFAULT_HEADER_FONT_COLOR="white_bold";tr.DEFAULT_ROW_ALIGNMENT="right";tr.DEFAULT_HEADER_ALIGNMENT="center"});var YF=m(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.rawColumnToInternalColumn=Bo.objIfExists=void 0;var _nt=O2(),Dnt=(e,t)=>t?{[e]:t}:{};Bo.objIfExists=Dnt;var bnt=e=>{var t;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(t=e.title)!==null&&t!==void 0?t:e.name},(0,Bo.objIfExists)("color",e.color)),(0,Bo.objIfExists)("maxLen",e.maxLen)),(0,Bo.objIfExists)("minLen",e.minLen)),{alignment:e.alignment||_nt.DEFAULT_ROW_ALIGNMENT})};Bo.rawColumnToInternalColumn=bnt});var J2e=m(KF=>{"use strict";Object.defineProperty(KF,"__esModule",{value:!0});var Ent=[{first:768,last:879},{first:1155,last:1158},{first:1160,last:1161},{first:1425,last:1469},{first:1471,last:1471},{first:1473,last:1474},{first:1476,last:1477},{first:1479,last:1479},{first:1536,last:1539},{first:1552,last:1557},{first:1611,last:1630},{first:1648,last:1648},{first:1750,last:1764},{first:1767,last:1768},{first:1770,last:1773},{first:1807,last:1807},{first:1809,last:1809},{first:1840,last:1866},{first:1958,last:1968},{first:2027,last:2035},{first:2305,last:2306},{first:2364,last:2364},{first:2369,last:2376},{first:2381,last:2381},{first:2385,last:2388},{first:2402,last:2403},{first:2433,last:2433},{first:2492,last:2492},{first:2497,last:2500},{first:2509,last:2509},{first:2530,last:2531},{first:2561,last:2562},{first:2620,last:2620},{first:2625,last:2626},{first:2631,last:2632},{first:2635,last:2637},{first:2672,last:2673},{first:2689,last:2690},{first:2748,last:2748},{first:2753,last:2757},{first:2759,last:2760},{first:2765,last:2765},{first:2786,last:2787},{first:2817,last:2817},{first:2876,last:2876},{first:2879,last:2879},{first:2881,last:2883},{first:2893,last:2893},{first:2902,last:2902},{first:2946,last:2946},{first:3008,last:3008},{first:3021,last:3021},{first:3134,last:3136},{first:3142,last:3144},{first:3146,last:3149},{first:3157,last:3158},{first:3260,last:3260},{first:3263,last:3263},{first:3270,last:3270},{first:3276,last:3277},{first:3298,last:3299},{first:3393,last:3395},{first:3405,last:3405},{first:3530,last:3530},{first:3538,last:3540},{first:3542,last:3542},{first:3633,last:3633},{first:3636,last:3642},{first:3655,last:3662},{first:3761,last:3761},{first:3764,last:3769},{first:3771,last:3772},{first:3784,last:3789},{first:3864,last:3865},{first:3893,last:3893},{first:3895,last:3895},{first:3897,last:3897},{first:3953,last:3966},{first:3968,last:3972},{first:3974,last:3975},{first:3984,last:3991},{first:3993,last:4028},{first:4038,last:4038},{first:4141,last:4144},{first:4146,last:4146},{first:4150,last:4151},{first:4153,last:4153},{first:4184,last:4185},{first:4448,last:4607},{first:4959,last:4959},{first:5906,last:5908},{first:5938,last:5940},{first:5970,last:5971},{first:6002,last:6003},{first:6068,last:6069},{first:6071,last:6077},{first:6086,last:6086},{first:6089,last:6099},{first:6109,last:6109},{first:6155,last:6157},{first:6313,last:6313},{first:6432,last:6434},{first:6439,last:6440},{first:6450,last:6450},{first:6457,last:6459},{first:6679,last:6680},{first:6912,last:6915},{first:6964,last:6964},{first:6966,last:6970},{first:6972,last:6972},{first:6978,last:6978},{first:7019,last:7027},{first:7616,last:7626},{first:7678,last:7679},{first:8203,last:8207},{first:8234,last:8238},{first:8288,last:8291},{first:8298,last:8303},{first:8400,last:8431},{first:12330,last:12335},{first:12441,last:12442},{first:43014,last:43014},{first:43019,last:43019},{first:43045,last:43046},{first:64286,last:64286},{first:65024,last:65039},{first:65056,last:65059},{first:65279,last:65279},{first:65529,last:65531},{first:68097,last:68099},{first:68101,last:68102},{first:68108,last:68111},{first:68152,last:68154},{first:68159,last:68159},{first:119143,last:119145},{first:119155,last:119170},{first:119173,last:119179},{first:119210,last:119213},{first:119362,last:119364},{first:917505,last:917505},{first:917536,last:917631},{first:917760,last:917999}];KF.default=Ent});var Z2e=m(JF=>{"use strict";Object.defineProperty(JF,"__esModule",{value:!0});var xnt=(e,t,r)=>{let i=0,n,s=r;if(e<t[0].first||e>t[s].last)return 0;for(;s>=i;)if(n=Math.floor((i+s)/2),e>t[n].last)i=n+1;else if(e<t[n].first)s=n-1;else return 1;return 0};JF.default=xnt});var ZF=m(F2=>{"use strict";var e6e=F2&&F2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(F2,"__esModule",{value:!0});var Q2e=e6e(J2e()),Snt=e6e(Z2e()),Cnt=e=>e===0?0:e<32||e>=127&&e<160?-1:Snt.default(e,Q2e.default,Q2e.default.length-1)?0:1+ +(e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141));F2.default=Cnt});var t6e=m(N2=>{"use strict";var Ant=N2&&N2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(N2,"__esModule",{value:!0});var Tnt=Ant(ZF()),Ont=e=>{let t=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r),n=Tnt.default(i);if(n<0)return-1;t+=n}return t};N2.default=Ont});var i6e=m(sl=>{"use strict";var r6e=sl&&sl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sl,"__esModule",{value:!0});sl.wcswidth=sl.wcwidth=void 0;var Fnt=r6e(t6e());sl.wcswidth=Fnt.default;var Nnt=r6e(ZF());sl.wcwidth=Nnt.default});var QF=m(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.findWidthInConsole=Xc.stripAnsi=void 0;var knt=i6e(),Rnt=/\x1b\[\d{1,3}(;\d{1,3})*m/g,Pnt=e=>e.replace(Rnt,"");Xc.stripAnsi=Pnt;var Int=(e,t)=>{let r=0;return e=(0,Xc.stripAnsi)(e),t&&Object.entries(t).forEach(([i,n])=>{let s=new RegExp(i,"g");r+=(e.match(s)||[]).length*n,e=e.replace(i,"")}),r+=(0,knt.wcswidth)(e),r};Xc.findWidthInConsole=Int});var tN=m(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.biggestWordInSentence=ba.textWithPadding=ba.splitTextIntoTextsOfMinLen=void 0;var eN=QF(),Lnt=(e,t,r)=>{let i=[];return e.split(/[\n\r]/).forEach(s=>{let a=s.split(" "),o=[],u=0;a.forEach(l=>{let c=(0,eN.findWidthInConsole)(l,r);u+c<=t?(u+=c+1,o.push(l)):(o.length>0&&i.push(o.join(" ")),o=[l],u=c+1)}),i.push(o.join(" "))}),i};ba.splitTextIntoTextsOfMinLen=Lnt;var Bnt=(e,t,r,i)=>{let n=(0,eN.findWidthInConsole)(e,i),s=Math.floor((r-n)/2),a=r-s-n;if(r<n){let o=(0,ba.splitTextIntoTextsOfMinLen)(e,r);return o.length===1?e:o.map(u=>(0,ba.textWithPadding)(u,t,r,i)).join(`
282
282
  `)}switch(t){case"left":return e.concat(" ".repeat(r-n));case"center":return" ".repeat(s).concat(e).concat(" ".repeat(a));case"right":default:return" ".repeat(r-n).concat(e)}};ba.textWithPadding=Bnt;var qnt=(e,t)=>e.split(" ").reduce((r,i)=>Math.max(r,(0,eN.findWidthInConsole)(i,t)),0);ba.biggestWordInSentence=qnt});var k2=m(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.getWidthLimitedColumnsArray=rt.createHeaderAsRow=rt.renderTableHorizontalBorders=rt.findLenOfColumn=rt.createRow=rt.createColumFromComputedColumn=rt.createColumFromOnlyName=rt.createTableHorizontalBorders=rt.convertRawRowOptionsToStandard=rt.cellText=void 0;var rN=YF(),n6e=QF(),iN=tN(),Hy=O2(),Jf=(e,t)=>Math.max(e,t),jnt=e=>e==null?"":`${e}`;rt.cellText=jnt;var $nt=e=>{if(e)return{color:e.color,separator:e.separator||Hy.DEFAULT_ROW_SEPARATOR}};rt.convertRawRowOptionsToStandard=$nt;var Mnt=({left:e,mid:t,right:r,other:i},n)=>{let s=e;return n.forEach(a=>{s+=i.repeat(a+2),s+=t}),s=s.slice(0,-t.length),s+=r,s};rt.createTableHorizontalBorders=Mnt;var Unt=e=>({name:e,title:e});rt.createColumFromOnlyName=Unt;var Vnt=e=>{var t;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(t=e.title)!==null&&t!==void 0?t:e.name},(0,rN.objIfExists)("color",e.color)),(0,rN.objIfExists)("maxLen",e.maxLen)),(0,rN.objIfExists)("minLen",e.minLen)),{alignment:e.alignment||Hy.DEFAULT_ROW_ALIGNMENT})};rt.createColumFromComputedColumn=Vnt;var Hnt=(e,t,r)=>({color:e,separator:r,text:t});rt.createRow=Hnt;var znt=(e,t,r)=>{let i=e.name,n=e.title,s=Jf(0,e?.minLen||0);return e.maxLen?(s=Jf(s,Jf(e.maxLen,(0,iN.biggestWordInSentence)(n,r))),s=t.reduce((a,o)=>Jf(a,(0,iN.biggestWordInSentence)((0,rt.cellText)(o.text[i]),r)),s),s):(s=Jf(s,(0,n6e.findWidthInConsole)(n,r)),t.forEach(a=>{s=Jf(s,(0,n6e.findWidthInConsole)((0,rt.cellText)(a.text[i]),r))}),s)};rt.findLenOfColumn=znt;var Gnt=(e,t)=>(0,rt.createTableHorizontalBorders)(e,t);rt.renderTableHorizontalBorders=Gnt;var Wnt=(e,t)=>{let r=Hy.DEFAULT_HEADER_FONT_COLOR,i=e(r,{},!1);return t.forEach(n=>{i.text[n.name]=n.title}),i};rt.createHeaderAsRow=Wnt;var Xnt=(e,t,r)=>{let i={};return e.forEach(n=>{i[n.name]=(0,iN.splitTextIntoTextsOfMinLen)((0,rt.cellText)(t.text[n.name]),n.length||Hy.DEFAULT_COLUMN_LEN,r)}),i};rt.getWidthLimitedColumnsArray=Xnt});var s6e=m(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.preProcessRows=Zf.preProcessColumns=void 0;var Ynt=k2(),Knt=e=>{e.computedColumns.length&&e.computedColumns.forEach(t=>{e.addColumn(t),e.rows.forEach(r=>{r.text[t.name]=t.function(r.text)})})},Jnt=e=>{e.enabledColumns.length&&(e.columns=e.columns.filter(t=>e.enabledColumns.includes(t.name)))},Znt=e=>{e.disabledColumns.length&&(e.columns=e.columns.filter(t=>!e.disabledColumns.includes(t.name)))},Qnt=e=>{e.columns.forEach(t=>{t.length=(0,Ynt.findLenOfColumn)(t,e.rows,e.charLength)})},est=e=>{Knt(e),Znt(e),Jnt(e),Qnt(e)};Zf.preProcessColumns=est;var tst=e=>{let t=e.rows.filter(r=>e.filterFunction(r.text)).sort((r,i)=>e.sortFunction(r.text,i.text));e.rows=t};Zf.preProcessRows=tst});var nN=m(Jn=>{"use strict";var o6e=Jn&&Jn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.printSimpleTable=Jn.renderSimpleTable=Jn.renderTable=void 0;var u6e=o6e(XF()),l6e=tN(),Es=O2(),al=k2(),rst=o6e(sN()),a6e=s6e(),ist=(e,t,r,i,n,s,a,o)=>{let u=new u6e.default(a);return u.addCharsWithColor("",e.vertical),t.forEach(l=>{let d=r<i[l.name].length?(0,al.cellText)(i[l.name][r]):"";u.addCharsWithColor(Es.DEFAULT_ROW_FONT_COLOR," "),u.addCharsWithColor(n&&Es.DEFAULT_HEADER_FONT_COLOR||l.color||s.color,(0,l6e.textWithPadding)(d,l.alignment||Es.DEFAULT_ROW_ALIGNMENT,l.length||Es.DEFAULT_COLUMN_LEN,o)),u.addCharsWithColor("",` ${e.vertical}`)}),u.renderConsole()},c6e=(e,t,r,i,n,s)=>{let a=(0,al.getWidthLimitedColumnsArray)(t,r,s),o=Object.values(a).reduce((l,c)=>Math.max(l,c.length),0),u=[];for(let l=0;l<o;l+=1){let c=ist(e,t,l,a,n,r,i,s);u.push(c)}return u},nst=(e,t)=>{let r=[];return r=r.concat(c6e(e.tableStyle,e.columns,t,e.colorMap,void 0,e.charLength)),r},sst=e=>{let t=[];if(e.title===void 0)return t;let r=()=>{let s=(a,o)=>a+o+2+1;return e.columns.map(a=>a.length||Es.DEFAULT_COLUMN_LEN).reduce(s,1)},i=(0,l6e.textWithPadding)(e.title,Es.DEFAULT_HEADER_ALIGNMENT,r()),n=new u6e.default(e.colorMap);return n.addCharsWithColor(Es.DEFAULT_HEADER_FONT_COLOR,i),t.push(n.renderConsole()),t},ast=e=>{let t=[];t.push((0,al.renderTableHorizontalBorders)(e.tableStyle.headerTop,e.columns.map(i=>i.length||Es.DEFAULT_COLUMN_LEN)));let r=(0,al.createHeaderAsRow)(al.createRow,e.columns);return t=t.concat(c6e(e.tableStyle,e.columns,r,e.colorMap,!0)),t.push((0,al.renderTableHorizontalBorders)(e.tableStyle.headerBottom,e.columns.map(i=>i.length||Es.DEFAULT_COLUMN_LEN))),t},ost=e=>{let t=[];return t.push((0,al.renderTableHorizontalBorders)(e.tableStyle.tableBottom,e.columns.map(r=>r.length||Es.DEFAULT_COLUMN_LEN))),t},ust=(e,t)=>{let r=[],i=e.rows.length-1;return e.rows.indexOf(t)!==i&&t.separator&&r.push((0,al.renderTableHorizontalBorders)(e.tableStyle.rowSeparator,e.columns.map(s=>s.length||Es.DEFAULT_COLUMN_LEN))),r},lst=e=>{(0,a6e.preProcessColumns)(e),(0,a6e.preProcessRows)(e);let t=[];return sst(e).forEach(r=>t.push(r)),ast(e).forEach(r=>t.push(r)),e.rows.forEach(r=>{nst(e,r).forEach(i=>t.push(i)),ust(e,r).forEach(i=>t.push(i))}),ost(e).forEach(r=>t.push(r)),t.join(`
283
- `)};Jn.renderTable=lst;var cst=e=>{let t=new rst.default;return t.addRows(e),(0,Jn.renderTable)(t)};Jn.renderSimpleTable=cst;var dst=e=>{console.log((0,Jn.renderSimpleTable)(e))};Jn.printSimpleTable=dst});var sN=m(oN=>{"use strict";Object.defineProperty(oN,"__esModule",{value:!0});var pst=XF(),zy=O2(),Gy=k2(),fst=YF(),hst=nN(),mst=()=>0,gst=()=>!0,aN=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:zy.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=t?.style||this.tableStyle,this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(fst.rawColumnToInternalColumn))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=zy.DEFAULT_TABLE_STYLE,this.filterFunction=gst,this.sortFunction=mst,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=zy.DEFAULT_ROW_SEPARATOR,this.colorMap=pst.DEFAULT_COLOR_MAP,this.charLength={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,Gy.createColumFromOnlyName)(i))})}addColumn(t){typeof t=="string"?this.columns.push((0,Gy.createColumFromOnlyName)(t)):this.columns.push((0,Gy.createColumFromComputedColumn)(t))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,Gy.createRow)(r?.color||zy.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,hst.renderTable)(this)}};oN.default=aN});var p6e=m(R2=>{"use strict";var yst=R2&&R2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R2,"__esModule",{value:!0});var vst=yst(sN()),d6e=k2(),uN=class{constructor(t){this.table=new vst.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,d6e.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,d6e.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};R2.default=uN});var P2=m(Ea=>{"use strict";var wst=Ea&&Ea.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.renderTable=Ea.printTable=Ea.Table=void 0;var _st=wst(p6e());Ea.Table=_st.default;var f6e=nN();Object.defineProperty(Ea,"printTable",{enumerable:!0,get:function(){return f6e.printSimpleTable}});Object.defineProperty(Ea,"renderTable",{enumerable:!0,get:function(){return f6e.renderSimpleTable}})});var E6e=m((g3t,Dst)=>{Dst.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var dN=m(dn=>{"use strict";var S6e=E6e(),lr=process.env;Object.defineProperty(dn,"_vendors",{value:S6e.map(function(e){return e.constant})});dn.name=null;dn.isPR=null;S6e.forEach(function(e){let r=(Array.isArray(e.env)?e.env:[e.env]).every(function(i){return x6e(i)});if(dn[e.constant]=r,!!r)switch(dn.name=e.name,typeof e.pr){case"string":dn.isPR=!!lr[e.pr];break;case"object":"env"in e.pr?dn.isPR=e.pr.env in lr&&lr[e.pr.env]!==e.pr.ne:"any"in e.pr?dn.isPR=e.pr.any.some(function(i){return!!lr[i]}):dn.isPR=x6e(e.pr);break;default:dn.isPR=null}});dn.isCI=!!(lr.CI!=="false"&&(lr.BUILD_ID||lr.BUILD_NUMBER||lr.CI||lr.CI_APP_ID||lr.CI_BUILD_ID||lr.CI_BUILD_NUMBER||lr.CI_NAME||lr.CONTINUOUS_INTEGRATION||lr.RUN_ID||dn.name));function x6e(e){return typeof e=="string"?!!lr[e]:"env"in e?lr[e.env]&&lr[e.env].includes(e.includes):"any"in e?e.any.some(function(t){return!!lr[t]}):Object.keys(e).every(function(t){return lr[t]===e[t]})}});var A4e=m((xyt,C4e)=>{C4e.exports=I9()});var VN=me(UN(),1),{program:B,createCommand:bat,createArgument:Eat,createOption:xat,CommanderError:Sat,InvalidArgumentError:Cat,InvalidOptionArgumentError:Aat,Command:Tat,Argument:Oat,Option:Fat,Help:Nat}=VN.default;var Vo={name:"@capgo/cli",version:"4.13.23",description:"A CLI to upload to capgo servers",author:"github.com/riderx",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLIl#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli"],main:"dist/index.js",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=18.0.0"},scripts:{build:"node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js",test:"npx --yes ts-node -T src/index.ts","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",test_rls:"ts-node ./test/test_headers_rls.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js"},devDependencies:{"@antfu/eslint-config":"^2.23.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client","@capacitor/cli":"^6.1.1","@capgo/find-package-manager":"^0.0.17","@clack/prompts":"^0.7.0","@manypkg/find-root":"^2.2.1","@supabase/supabase-js":"^2.44.4","@tomasklaen/checksum":"^1.1.0","@types/adm-zip":"0.5.5","@types/mime":"^4.0.0","@types/node":"^20.14.11","@types/npmcli__ci-detect":"^2.0.3","@types/prettyjson":"^0.0.33","@types/prompt-sync":"^4.2.3","@types/semver":"^7.5.8","@types/tmp":"^0.2.6","@typescript-eslint/eslint-plugin":"^7.16.1","@typescript-eslint/parser":"^7.16.1","@vercel/ncc":"^0.38.1","adm-zip":"^0.5.14","ci-info":"^4.0.0",commander:"12.1.0","console-table-printer":"^2.12.1",esbuild:"^0.23.0",eslint:"9.8.0","get-latest-version":"^5.1.0","git-format-staged":"3.1.1",husky:"^9.1.1","is-wsl":"^3.1.0",jszip:"^3.10.1",ky:"^1.4.0",logsnag:"1.0.0",mime:"^4.0.4",open:"^10.1.0",pkg:"5.8.1",prettyjson:"^1.2.5",semver:"^7.6.2",tmp:"^0.2.3","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"4.2.0",typescript:"5.5.4","node-dir":"^0.1.17"}};var ii=me(it(),1),ed=require("node:process"),Ho=me(require("node:readline"),1),N5=me(require("node:readline"),1),ZN=require("node:tty");function pge({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function QN(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(pge(),"")}var k5={},fge={get exports(){return k5},set exports(e){k5=e}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(i){var n=i.charCodeAt(0),s=i.length==2?i.charCodeAt(1):0,a=n;return 55296<=n&&n<=56319&&56320<=s&&s<=57343&&(n&=1023,s&=1023,a=n<<10|s,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},t.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function r(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(i){for(var n=r(i),s=0,a=0;a<n.length;a++)s=s+this.characterLength(n[a]);return s},t.slice=function(i,n,s){textLen=t.length(i),n=n||0,s=s||1,n<0&&(n=textLen+n),s<0&&(s=textLen+s);for(var a="",o=0,u=r(i),l=0;l<u.length;l++){var c=u[l],d=t.length(c);if(o>=n-(d==2?1:0))if(o+d<=s)a+=c;else break;o+=d}return a}})(fge);var hge=k5,mge=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};function o1(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=QN(e),e.length===0))return 0;e=e.replace(mge()," ");let r=t.ambiguousIsNarrow?1:2,i=0;for(let n of e){let s=n.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(hge.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=r;break;default:i+=1}}return i}var O5=10,zN=(e=0)=>t=>`\x1B[${t+e}m`,GN=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,WN=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,dt={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(dt.modifier);var gge=Object.keys(dt.color),yge=Object.keys(dt.bgColor);[...gge,...yge];function vge(){let e=new Map;for(let[t,r]of Object.entries(dt)){for(let[i,n]of Object.entries(r))dt[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[i]=dt[i],e.set(n[0],n[1]);Object.defineProperty(dt,t,{value:r,enumerable:!1})}return Object.defineProperty(dt,"codes",{value:e,enumerable:!1}),dt.color.close="\x1B[39m",dt.bgColor.close="\x1B[49m",dt.color.ansi=zN(),dt.color.ansi256=GN(),dt.color.ansi16m=WN(),dt.bgColor.ansi=zN(O5),dt.bgColor.ansi256=GN(O5),dt.bgColor.ansi16m=WN(O5),Object.defineProperties(dt,{rgbToAnsi256:{value:(t,r,i)=>t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(s=>s+s).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>dt.rgbToAnsi256(...dt.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,n;if(t>=232)r=((t-232)*10+8)/255,i=r,n=r;else{t-=16;let o=t%36;r=Math.floor(t/36)/5,i=Math.floor(o/6)/5,n=o%6/5}let s=Math.max(r,i,n)*2;if(s===0)return 30;let a=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(r));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>dt.ansi256ToAnsi(dt.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>dt.ansi256ToAnsi(dt.hexToAnsi256(t)),enumerable:!1}}),dt}var wge=vge(),Q2=new Set(["\x1B","\x9B"]),_ge=39,R5="\x07",ek="[",Dge="]",tk="m",P5=`${Dge}8;;`,XN=e=>`${Q2.values().next().value}${ek}${e}${tk}`,YN=e=>`${Q2.values().next().value}${P5}${e}${R5}`,bge=e=>e.split(" ").map(t=>o1(t)),F5=(e,t,r)=>{let i=[...t],n=!1,s=!1,a=o1(QN(e[e.length-1]));for(let[o,u]of i.entries()){let l=o1(u);if(a+l<=r?e[e.length-1]+=u:(e.push(u),a=0),Q2.has(u)&&(n=!0,s=i.slice(o+1).join("").startsWith(P5)),n){s?u===R5&&(n=!1,s=!1):u===tk&&(n=!1);continue}a+=l,a===r&&o<i.length-1&&(e.push(""),a=0)}!a&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Ege=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(o1(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},xge=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,s,a=bge(e),o=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let d=o1(o[o.length-1]);if(l!==0&&(d>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),d=0),(d>0||r.trim===!1)&&(o[o.length-1]+=" ",d++)),r.hard&&a[l]>t){let p=t-d,f=1+Math.floor((a[l]-p-1)/t);Math.floor((a[l]-1)/t)<f&&o.push(""),F5(o,c,t);continue}if(d+a[l]>t&&d>0&&a[l]>0){if(r.wordWrap===!1&&d<t){F5(o,c,t);continue}o.push("")}if(d+a[l]>t&&r.wordWrap===!1){F5(o,c,t);continue}o[o.length-1]+=c}r.trim!==!1&&(o=o.map(l=>Ege(l)));let u=[...o.join(`
283
+ `)};Jn.renderTable=lst;var cst=e=>{let t=new rst.default;return t.addRows(e),(0,Jn.renderTable)(t)};Jn.renderSimpleTable=cst;var dst=e=>{console.log((0,Jn.renderSimpleTable)(e))};Jn.printSimpleTable=dst});var sN=m(oN=>{"use strict";Object.defineProperty(oN,"__esModule",{value:!0});var pst=XF(),zy=O2(),Gy=k2(),fst=YF(),hst=nN(),mst=()=>0,gst=()=>!0,aN=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:zy.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=t?.style||this.tableStyle,this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(fst.rawColumnToInternalColumn))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=zy.DEFAULT_TABLE_STYLE,this.filterFunction=gst,this.sortFunction=mst,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=zy.DEFAULT_ROW_SEPARATOR,this.colorMap=pst.DEFAULT_COLOR_MAP,this.charLength={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,Gy.createColumFromOnlyName)(i))})}addColumn(t){typeof t=="string"?this.columns.push((0,Gy.createColumFromOnlyName)(t)):this.columns.push((0,Gy.createColumFromComputedColumn)(t))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,Gy.createRow)(r?.color||zy.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,hst.renderTable)(this)}};oN.default=aN});var p6e=m(R2=>{"use strict";var yst=R2&&R2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R2,"__esModule",{value:!0});var vst=yst(sN()),d6e=k2(),uN=class{constructor(t){this.table=new vst.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,d6e.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,d6e.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};R2.default=uN});var P2=m(Ea=>{"use strict";var wst=Ea&&Ea.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.renderTable=Ea.printTable=Ea.Table=void 0;var _st=wst(p6e());Ea.Table=_st.default;var f6e=nN();Object.defineProperty(Ea,"printTable",{enumerable:!0,get:function(){return f6e.printSimpleTable}});Object.defineProperty(Ea,"renderTable",{enumerable:!0,get:function(){return f6e.renderSimpleTable}})});var E6e=m((g3t,Dst)=>{Dst.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var dN=m(dn=>{"use strict";var S6e=E6e(),lr=process.env;Object.defineProperty(dn,"_vendors",{value:S6e.map(function(e){return e.constant})});dn.name=null;dn.isPR=null;S6e.forEach(function(e){let r=(Array.isArray(e.env)?e.env:[e.env]).every(function(i){return x6e(i)});if(dn[e.constant]=r,!!r)switch(dn.name=e.name,typeof e.pr){case"string":dn.isPR=!!lr[e.pr];break;case"object":"env"in e.pr?dn.isPR=e.pr.env in lr&&lr[e.pr.env]!==e.pr.ne:"any"in e.pr?dn.isPR=e.pr.any.some(function(i){return!!lr[i]}):dn.isPR=x6e(e.pr);break;default:dn.isPR=null}});dn.isCI=!!(lr.CI!=="false"&&(lr.BUILD_ID||lr.BUILD_NUMBER||lr.CI||lr.CI_APP_ID||lr.CI_BUILD_ID||lr.CI_BUILD_NUMBER||lr.CI_NAME||lr.CONTINUOUS_INTEGRATION||lr.RUN_ID||dn.name));function x6e(e){return typeof e=="string"?!!lr[e]:"env"in e?lr[e.env]&&lr[e.env].includes(e.includes):"any"in e?e.any.some(function(t){return!!lr[t]}):Object.keys(e).every(function(t){return lr[t]===e[t]})}});var A4e=m((xyt,C4e)=>{C4e.exports=I9()});var VN=me(UN(),1),{program:B,createCommand:bat,createArgument:Eat,createOption:xat,CommanderError:Sat,InvalidArgumentError:Cat,InvalidOptionArgumentError:Aat,Command:Tat,Argument:Oat,Option:Fat,Help:Nat}=VN.default;var Vo={name:"@capgo/cli",version:"4.13.25",description:"A CLI to upload to capgo servers",author:"github.com/riderx",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLIl#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli"],main:"dist/index.js",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=18.0.0"},scripts:{build:"node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js",test:"npx --yes ts-node -T src/index.ts","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",test_rls:"ts-node ./test/test_headers_rls.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js"},devDependencies:{"@antfu/eslint-config":"^2.23.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client","@capacitor/cli":"^6.1.1","@capgo/find-package-manager":"^0.0.17","@clack/prompts":"^0.7.0","@manypkg/find-root":"^2.2.1","@supabase/supabase-js":"^2.44.4","@tomasklaen/checksum":"^1.1.0","@types/adm-zip":"0.5.5","@types/mime":"^4.0.0","@types/node":"^20.14.11","@types/npmcli__ci-detect":"^2.0.3","@types/prettyjson":"^0.0.33","@types/prompt-sync":"^4.2.3","@types/semver":"^7.5.8","@types/tmp":"^0.2.6","@typescript-eslint/eslint-plugin":"^7.16.1","@typescript-eslint/parser":"^7.16.1","@vercel/ncc":"^0.38.1","adm-zip":"^0.5.14","ci-info":"^4.0.0",commander:"12.1.0","console-table-printer":"^2.12.1",esbuild:"^0.23.0",eslint:"9.8.0","get-latest-version":"^5.1.0","git-format-staged":"3.1.1",husky:"^9.1.1","is-wsl":"^3.1.0",jszip:"^3.10.1",ky:"^1.4.0",logsnag:"1.0.0",mime:"^4.0.4",open:"^10.1.0",pkg:"5.8.1",prettyjson:"^1.2.5",semver:"^7.6.2",tmp:"^0.2.3","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"4.2.0",typescript:"5.5.4","node-dir":"^0.1.17"}};var ii=me(it(),1),ed=require("node:process"),Ho=me(require("node:readline"),1),N5=me(require("node:readline"),1),ZN=require("node:tty");function pge({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function QN(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(pge(),"")}var k5={},fge={get exports(){return k5},set exports(e){k5=e}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(i){var n=i.charCodeAt(0),s=i.length==2?i.charCodeAt(1):0,a=n;return 55296<=n&&n<=56319&&56320<=s&&s<=57343&&(n&=1023,s&=1023,a=n<<10|s,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},t.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function r(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(i){for(var n=r(i),s=0,a=0;a<n.length;a++)s=s+this.characterLength(n[a]);return s},t.slice=function(i,n,s){textLen=t.length(i),n=n||0,s=s||1,n<0&&(n=textLen+n),s<0&&(s=textLen+s);for(var a="",o=0,u=r(i),l=0;l<u.length;l++){var c=u[l],d=t.length(c);if(o>=n-(d==2?1:0))if(o+d<=s)a+=c;else break;o+=d}return a}})(fge);var hge=k5,mge=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};function o1(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=QN(e),e.length===0))return 0;e=e.replace(mge()," ");let r=t.ambiguousIsNarrow?1:2,i=0;for(let n of e){let s=n.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(hge.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=r;break;default:i+=1}}return i}var O5=10,zN=(e=0)=>t=>`\x1B[${t+e}m`,GN=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,WN=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,dt={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(dt.modifier);var gge=Object.keys(dt.color),yge=Object.keys(dt.bgColor);[...gge,...yge];function vge(){let e=new Map;for(let[t,r]of Object.entries(dt)){for(let[i,n]of Object.entries(r))dt[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[i]=dt[i],e.set(n[0],n[1]);Object.defineProperty(dt,t,{value:r,enumerable:!1})}return Object.defineProperty(dt,"codes",{value:e,enumerable:!1}),dt.color.close="\x1B[39m",dt.bgColor.close="\x1B[49m",dt.color.ansi=zN(),dt.color.ansi256=GN(),dt.color.ansi16m=WN(),dt.bgColor.ansi=zN(O5),dt.bgColor.ansi256=GN(O5),dt.bgColor.ansi16m=WN(O5),Object.defineProperties(dt,{rgbToAnsi256:{value:(t,r,i)=>t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(s=>s+s).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>dt.rgbToAnsi256(...dt.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,n;if(t>=232)r=((t-232)*10+8)/255,i=r,n=r;else{t-=16;let o=t%36;r=Math.floor(t/36)/5,i=Math.floor(o/6)/5,n=o%6/5}let s=Math.max(r,i,n)*2;if(s===0)return 30;let a=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(r));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>dt.ansi256ToAnsi(dt.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>dt.ansi256ToAnsi(dt.hexToAnsi256(t)),enumerable:!1}}),dt}var wge=vge(),Q2=new Set(["\x1B","\x9B"]),_ge=39,R5="\x07",ek="[",Dge="]",tk="m",P5=`${Dge}8;;`,XN=e=>`${Q2.values().next().value}${ek}${e}${tk}`,YN=e=>`${Q2.values().next().value}${P5}${e}${R5}`,bge=e=>e.split(" ").map(t=>o1(t)),F5=(e,t,r)=>{let i=[...t],n=!1,s=!1,a=o1(QN(e[e.length-1]));for(let[o,u]of i.entries()){let l=o1(u);if(a+l<=r?e[e.length-1]+=u:(e.push(u),a=0),Q2.has(u)&&(n=!0,s=i.slice(o+1).join("").startsWith(P5)),n){s?u===R5&&(n=!1,s=!1):u===tk&&(n=!1);continue}a+=l,a===r&&o<i.length-1&&(e.push(""),a=0)}!a&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Ege=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(o1(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},xge=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,s,a=bge(e),o=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let d=o1(o[o.length-1]);if(l!==0&&(d>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),d=0),(d>0||r.trim===!1)&&(o[o.length-1]+=" ",d++)),r.hard&&a[l]>t){let p=t-d,f=1+Math.floor((a[l]-p-1)/t);Math.floor((a[l]-1)/t)<f&&o.push(""),F5(o,c,t);continue}if(d+a[l]>t&&d>0&&a[l]>0){if(r.wordWrap===!1&&d<t){F5(o,c,t);continue}o.push("")}if(d+a[l]>t&&r.wordWrap===!1){F5(o,c,t);continue}o[o.length-1]+=c}r.trim!==!1&&(o=o.map(l=>Ege(l)));let u=[...o.join(`
284
284
  `)];for(let[l,c]of u.entries()){if(i+=c,Q2.has(c)){let{groups:p}=new RegExp(`(?:\\${ek}(?<code>\\d+)m|\\${P5}(?<uri>.*)${R5})`).exec(u.slice(l).join(""))||{groups:{}};if(p.code!==void 0){let f=Number.parseFloat(p.code);n=f===_ge?void 0:f}else p.uri!==void 0&&(s=p.uri.length===0?void 0:p.uri)}let d=wge.codes.get(Number(n));u[l+1]===`
285
285
  `?(s&&(i+=YN("")),n&&d&&(i+=XN(d))):c===`
286
286
  `&&(n&&d&&(i+=XN(n)),s&&(i+=YN(s)))}return i};function KN(e,t,r){return String(e).normalize().replace(/\r\n/g,`
@@ -313,21 +313,21 @@ ${Q.default.gray($5)} ${e}
313
313
  `)}
314
314
  `)},info:e=>{O.message(e,{symbol:Q.default.blue(kge)})},success:e=>{O.message(e,{symbol:Q.default.green(Rge)})},step:e=>{O.message(e,{symbol:Q.default.green(j5)})},warn:e=>{O.message(e,{symbol:Q.default.yellow(Pge)})},warning:e=>{O.warn(e)},error:e=>{O.message(e,{symbol:Q.default.red(Ige)})}},$e=()=>{let e=L5?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=L5?80:120,r,i,n=!1,s="",a=(c="")=>{n=!0,r=ik(),s=c.replace(/\.+$/,""),process.stdout.write(`${Q.default.gray(Mr)}
315
315
  `);let d=0,p=0;i=setInterval(()=>{let f=Q.default.magenta(e[d]),h=".".repeat(Math.floor(p)).slice(0,3);process.stdout.write(td.cursor.move(-999,0)),process.stdout.write(td.erase.down(1)),process.stdout.write(`${f} ${s}${h}`),d=d+1<e.length?d+1:0,p=p<e.length?p+.125:0},t)},o=(c="",d=0)=>{s=c??s,n=!1,clearInterval(i);let p=d===0?Q.default.green(j5):d===1?Q.default.red(ok):Q.default.red(uk);process.stdout.write(td.cursor.move(-999,0)),process.stdout.write(td.erase.down(1)),process.stdout.write(`${p} ${s}
316
- `),r()},u=(c="")=>{s=c??s},l=c=>{let d=c>1?"Something went wrong":"Canceled";n&&o(d,c)};return process.on("uncaughtExceptionMonitor",()=>l(2)),process.on("unhandledRejection",()=>l(2)),process.on("SIGINT",()=>l(1)),process.on("SIGTERM",()=>l(1)),process.on("exit",l),{start:a,stop:o,message:u}};var ur=require("node:fs"),H9=require("node:os"),yi=require("node:path"),ei=require("node:process"),Qde=require("node:crypto");var epe=me(QP()),tpe=me(FI()),rpe=me(VL());var Ma=class extends Error{constructor(t,r,i){let n=t.status||t.status===0?t.status:"",s=t.statusText||"",a=`${n} ${s}`.trim(),o=a?`status code ${a}`:"an unknown error";super(`Request failed with ${o}: ${r.method} ${r.url}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var kd=class extends Error{constructor(t){super(`Request timed out: ${t.method} ${t.url}`),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}};var ah=e=>e!==null&&typeof e=="object";var oh=(...e)=>{for(let t of e)if((!ah(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return c4({},...e)},Rw=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[s,a]of n.entries())i&&a==="undefined"||a===void 0?r.delete(s):r.set(s,a);return r},c4=(...e)=>{let t={},r={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(ah(i)){for(let[n,s]of Object.entries(i))ah(s)&&n in t&&(s=c4(t[n],s)),t={...t,[n]:s};ah(i.headers)&&(r=Rw(r,i.headers),t.headers=r)}return t};var HL=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),zL=typeof globalThis.AbortController=="function",GL=typeof globalThis.ReadableStream=="function",WL=typeof globalThis.FormData=="function",d4=["get","post","put","patch","head","delete"],jve=()=>{};jve();var XL={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},p4=2147483647,f4=Symbol("stop"),YL={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},KL={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var ZL=e=>d4.includes(e)?e.toUpperCase():e,$ve=["get","put","head","delete","options","trace"],Mve=[408,413,429,500,502,503,504],QL=[413,429,503],JL={limit:2,methods:$ve,statusCodes:Mve,afterStatusCodes:QL,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},eB=(e={})=>{if(typeof e=="number")return{...JL,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...JL,...e,afterStatusCodes:QL}};async function Pw(e,t,r,i){return new Promise((n,s)=>{let a=setTimeout(()=>{r&&r.abort(),s(new kd(e))},i.timeout);i.fetch(e,t).then(n).catch(s).then(()=>{clearTimeout(a)})})}async function Iw(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(s),i(t.reason)}let s=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var tB=(e,t)=>{let r={};for(let i in t)!(i in KL)&&!(i in YL)&&!(i in e)&&(r[i]=t[i]);return r};var uh=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>p4)throw new RangeError(`The \`timeout\` option cannot be greater than ${p4}`);await Promise.resolve();let o=await i._fetch();for(let u of i._options.hooks.afterResponse){let l=await u(i.request,i._options,i._decorateResponse(o.clone()));l instanceof globalThis.Response&&(o=l)}if(i._decorateResponse(o),!o.ok&&i._options.throwHttpErrors){let u=new Ma(o,i.request,i._options);for(let l of i._options.hooks.beforeError)u=await l(u);throw u}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!GL)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(o.clone(),i._options.onDownloadProgress)}return o},a=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[o,u]of Object.entries(XL))a[o]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||u);let c=(await a).clone();if(o==="json"){if(c.status===204||(await c.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await c.text())}return c[o]()};return a}constructor(t,r={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t;let i=this._input instanceof Request&&"credentials"in Request.prototype?this._input.credentials:void 0;if(this._options={...i&&{credentials:i},...r,headers:Rw(this._input.headers,r.headers),hooks:c4({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:ZL(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:eB(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(zL){if(this.abortController=new globalThis.AbortController,this._options.signal){let n=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(n.reason)})}this._options.signal=this.abortController.signal}if(HL&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let s="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,s);(WL&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(t instanceof kd)){if(t instanceof Ma){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;let i=t.response.headers.get("Retry-After");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)&&(n=Date.parse(i)-Date.now());let s=this._options.retry.maxRetryAfter??n;return n<s?n:s}if(t.response.status===413)return 0}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}return 0}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),p4);if(i!==0&&this._retryCount>0){await Iw(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===f4)return;return this._retry(t)}throw r}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=tB(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Pw(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(s){let a=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function o(){let{done:u,value:l}=await a.read();if(u){s.close();return}if(r){n+=l.byteLength;let c=i===0?0:n/i;r({percent:c,transferredBytes:n,totalBytes:i},l)}s.enqueue(l),await o()}await o()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var Lw=e=>{let t=(r,i)=>uh.create(r,oh(e,i));for(let r of d4)t[r]=(i,n)=>uh.create(i,oh(e,n,{method:r}));return t.create=r=>Lw(oh(r)),t.extend=r=>Lw(oh(e,r)),t.stop=f4,t},Uve=Lw(),Ua=Uve;var HT=me(Sz());var Za=require("fs"),t0=(e=".",t="unknown")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,s=`${e}/package-lock.json`;return(0,Za.existsSync)(r)?"bun":(0,Za.existsSync)(i)?"pnpm":(0,Za.existsSync)(n)?"yarn":(0,Za.existsSync)(s)?"npm":t},Ag=(e=t0(),t=!1)=>{switch(e){case"bun":return t?"bun install":"install";case"pnpm":return t?"pnpm install":"install";case"yarn":return t?"yarn install":"install";case"npm":return t?"npm install":"install";case"unknown":return t?"unknown unknown":"unknown";default:return t?"npm install":"install"}},Cz=(e=".",t="npx")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,s=`${e}/package-lock.json`;return(0,Za.existsSync)(r)?"bunx":(0,Za.existsSync)(i)?"pnpm exec":(0,Za.existsSync)(n)?"yarn dlx":(0,Za.existsSync)(s)?"npx":t};var ipe=me(rG()),npe=me(fK());var spe=me(zK());var Hm=me(mde());async function gde(){let e=await(0,Hm.loadConfig)();return{config:e.app.extConfig,path:e.app.extConfigFilePath}}async function TT(e){let t=await(0,Hm.loadConfig)(),{extConfig:r}=t.app;r&&(r.plugins||(r.plugins={extConfig:{},CapacitorUpdater:{}}),r.plugins.CapacitorUpdater||(r.plugins.CapacitorUpdater={}),r.plugins.CapacitorUpdater=e.config.plugins?.CapacitorUpdater,(0,Hm.writeConfig)(r,t.app.extConfigFilePath))}var Ao=".capgo_key",ha=`${Ao}.pub`,Xde="https://capgo.app",zT="https://api.capgo.app",Yde="https://web.capgo.app",FXe="package.json",xf=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,oe=e=>e?`
317
- ${tpe.default.render(e)}`:"";function Kde(e){return new Promise(t=>{setTimeout(t,e)})}async function Ui(){let e=(0,ur.readFileSync)((0,yi.join)((0,ei.cwd)(),FXe));return JSON.parse(e)}async function ge(){try{let e=await gde();return e||(O.error("No capacitor config file found, run `cap init` first"),B.error("")),e}catch(e){O.error(`No capacitor config file found, run \`cap init\` first ${oe(e)}`),B.error("")}}async function Sc(){try{let e=await ge(),t={host:e?.config?.plugins?.CapacitorUpdater?.localHost||Xde,hostWeb:e?.config?.plugins?.CapacitorUpdater?.localWebHost||Yde};return e?.config?.plugins?.CapacitorUpdater?.localSupa&&e?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(O.info("Using custom supabase instance from capacitor.config.json"),t.supaKey=e?.config?.plugins?.CapacitorUpdater?.localSupaAnon,t.supaHost=e?.config?.plugins?.CapacitorUpdater?.localSupa),t}catch{return{host:Xde,hostWeb:Yde}}}var NXe=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function ape(){let e=await Sc();return Ua.get(`${zT}/private/config`).then(t=>t.json()).then(t=>({...t,...e})).catch(()=>(O.info(`Local config ${oe(e)}`),e))}async function Ee(e){let t=await ape();return(!t.supaHost||!t.supaKey)&&(O.error("Cannot connect to server please try again later"),B.error("")),(0,epe.createClient)(t.supaHost,t.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:e}}})}async function kXe(e,t,r){let{data:i}=await e.rpc("is_allowed_capgkey",{apikey:t,keymode:r}).single();if(!i){O.error("Invalid API key or insufficient permissions.");let n=r.map((s,a)=>a===r.length-1?`or ${s}`:`${s}, `).join("");O.error(`Your key should be: ${n} mode.`),B.error("")}}async function RXe(e,t){let{data:r}=await e.rpc("is_paying_org",{orgid:t}).single();return r||!1}async function PXe(e,t){let{data:r}=await e.rpc("is_trial_org",{orgid:t}).single();return r||0}async function IXe(e,t){let{data:r}=await e.rpc("is_allowed_action_org",{orgid:t}).single();return!!r}async function LXe(e,t,r){let{data:i}=await e.rpc("is_allowed_action",{apikey:r,appid:t}).single();return!!i}var qr=(a=>(a[a.none=0]="none",a[a.read=1]="read",a[a.upload=2]="upload",a[a.write=3]="write",a[a.admin=4]="admin",a[a.super_admin=5]="super_admin",a))(qr||{}),GT=(e,t)=>e>=t;async function ope(e,t,r){let{data:i,error:n}=await e.rpc("get_org_perm_for_apikey",{apikey:t,app_id:r}).single();if(n&&(O.error("Cannot get permissions for organization!"),console.error(n),(0,ei.exit)(1)),i.includes("perm")){let o=null;switch(i){case"perm_none":{o=0;break}case"perm_read":{o=1;break}case"perm_upload":{o=2;break}case"perm_write":{o=3;break}case"perm_admin":{o=4;break}case"perm_owner":{o=5;break}default:i.includes("invite")&&(O.info("Please accept/deny the organization invitation before trying to access the app"),(0,ei.exit)(1)),O.error(`Invalid output when fetching organization permission. Response: ${i}`),(0,ei.exit)(1)}return{okay:!0,data:o}}let a=null;switch(i){case"INVALID_APIKEY":{a="INVALID_APIKEY";break}case"NO_APP":{a="NO_APP";break}case"NO_ORG":{a="NO_ORG";break}default:O.error(`Invalid error when fetching organization permission. Response: ${i}`),(0,ei.exit)(1)}return{okay:!1,error:a}}async function Sf(e,t,r,i,n=!0){let s=await ape();await(i?LXe(e,i,r):IXe(e,t))||(O.error(`You need to upgrade your plan to continue to use capgo.
316
+ `),r()},u=(c="")=>{s=c??s},l=c=>{let d=c>1?"Something went wrong":"Canceled";n&&o(d,c)};return process.on("uncaughtExceptionMonitor",()=>l(2)),process.on("unhandledRejection",()=>l(2)),process.on("SIGINT",()=>l(1)),process.on("SIGTERM",()=>l(1)),process.on("exit",l),{start:a,stop:o,message:u}};var ur=require("node:fs"),H9=require("node:os"),yi=require("node:path"),ei=require("node:process"),Qde=require("node:crypto");var epe=me(QP()),tpe=me(FI()),rpe=me(VL());var Ma=class extends Error{constructor(t,r,i){let n=t.status||t.status===0?t.status:"",s=t.statusText||"",a=`${n} ${s}`.trim(),o=a?`status code ${a}`:"an unknown error";super(`Request failed with ${o}: ${r.method} ${r.url}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var kd=class extends Error{constructor(t){super(`Request timed out: ${t.method} ${t.url}`),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}};var ah=e=>e!==null&&typeof e=="object";var oh=(...e)=>{for(let t of e)if((!ah(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return c4({},...e)},Rw=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[s,a]of n.entries())i&&a==="undefined"||a===void 0?r.delete(s):r.set(s,a);return r},c4=(...e)=>{let t={},r={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(ah(i)){for(let[n,s]of Object.entries(i))ah(s)&&n in t&&(s=c4(t[n],s)),t={...t,[n]:s};ah(i.headers)&&(r=Rw(r,i.headers),t.headers=r)}return t};var HL=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),zL=typeof globalThis.AbortController=="function",GL=typeof globalThis.ReadableStream=="function",WL=typeof globalThis.FormData=="function",d4=["get","post","put","patch","head","delete"],jve=()=>{};jve();var XL={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},p4=2147483647,f4=Symbol("stop"),YL={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},KL={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var ZL=e=>d4.includes(e)?e.toUpperCase():e,$ve=["get","put","head","delete","options","trace"],Mve=[408,413,429,500,502,503,504],QL=[413,429,503],JL={limit:2,methods:$ve,statusCodes:Mve,afterStatusCodes:QL,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},eB=(e={})=>{if(typeof e=="number")return{...JL,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...JL,...e,afterStatusCodes:QL}};async function Pw(e,t,r,i){return new Promise((n,s)=>{let a=setTimeout(()=>{r&&r.abort(),s(new kd(e))},i.timeout);i.fetch(e,t).then(n).catch(s).then(()=>{clearTimeout(a)})})}async function Iw(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(s),i(t.reason)}let s=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var tB=(e,t)=>{let r={};for(let i in t)!(i in KL)&&!(i in YL)&&!(i in e)&&(r[i]=t[i]);return r};var uh=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>p4)throw new RangeError(`The \`timeout\` option cannot be greater than ${p4}`);await Promise.resolve();let o=await i._fetch();for(let u of i._options.hooks.afterResponse){let l=await u(i.request,i._options,i._decorateResponse(o.clone()));l instanceof globalThis.Response&&(o=l)}if(i._decorateResponse(o),!o.ok&&i._options.throwHttpErrors){let u=new Ma(o,i.request,i._options);for(let l of i._options.hooks.beforeError)u=await l(u);throw u}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!GL)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(o.clone(),i._options.onDownloadProgress)}return o},a=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[o,u]of Object.entries(XL))a[o]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||u);let c=(await a).clone();if(o==="json"){if(c.status===204||(await c.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await c.text())}return c[o]()};return a}constructor(t,r={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t;let i=this._input instanceof Request&&"credentials"in Request.prototype?this._input.credentials:void 0;if(this._options={...i&&{credentials:i},...r,headers:Rw(this._input.headers,r.headers),hooks:c4({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:ZL(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:eB(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(zL){if(this.abortController=new globalThis.AbortController,this._options.signal){let n=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(n.reason)})}this._options.signal=this.abortController.signal}if(HL&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let s="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,s);(WL&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(t instanceof kd)){if(t instanceof Ma){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;let i=t.response.headers.get("Retry-After");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)&&(n=Date.parse(i)-Date.now());let s=this._options.retry.maxRetryAfter??n;return n<s?n:s}if(t.response.status===413)return 0}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}return 0}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),p4);if(i!==0&&this._retryCount>0){await Iw(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===f4)return;return this._retry(t)}throw r}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=tB(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Pw(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(s){let a=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function o(){let{done:u,value:l}=await a.read();if(u){s.close();return}if(r){n+=l.byteLength;let c=i===0?0:n/i;r({percent:c,transferredBytes:n,totalBytes:i},l)}s.enqueue(l),await o()}await o()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var Lw=e=>{let t=(r,i)=>uh.create(r,oh(e,i));for(let r of d4)t[r]=(i,n)=>uh.create(i,oh(e,n,{method:r}));return t.create=r=>Lw(oh(r)),t.extend=r=>Lw(oh(e,r)),t.stop=f4,t},Uve=Lw(),Ua=Uve;var HT=me(Sz());var Za=require("fs"),t0=(e=".",t="unknown")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,s=`${e}/package-lock.json`;return(0,Za.existsSync)(r)?"bun":(0,Za.existsSync)(i)?"pnpm":(0,Za.existsSync)(n)?"yarn":(0,Za.existsSync)(s)?"npm":t},Ag=(e=t0(),t=!1)=>{switch(e){case"bun":return t?"bun install":"install";case"pnpm":return t?"pnpm install":"install";case"yarn":return t?"yarn install":"install";case"npm":return t?"npm install":"install";case"unknown":return t?"unknown unknown":"unknown";default:return t?"npm install":"install"}},Cz=(e=".",t="npx")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,s=`${e}/package-lock.json`;return(0,Za.existsSync)(r)?"bunx":(0,Za.existsSync)(i)?"pnpm exec":(0,Za.existsSync)(n)?"yarn dlx":(0,Za.existsSync)(s)?"npx":t};var ipe=me(rG()),npe=me(fK());var spe=me(zK());var Hm=me(mde());async function gde(){let e=await(0,Hm.loadConfig)();return{config:e.app.extConfig,path:e.app.extConfigFilePath}}async function TT(e){let t=await(0,Hm.loadConfig)(),{extConfig:r}=t.app;r&&(r.plugins||(r.plugins={extConfig:{},CapacitorUpdater:{}}),r.plugins.CapacitorUpdater||(r.plugins.CapacitorUpdater={}),r.plugins.CapacitorUpdater=e.config.plugins?.CapacitorUpdater,(0,Hm.writeConfig)(r,t.app.extConfigFilePath))}var Ao=".capgo_key",ha=`${Ao}.pub`,Xde="https://capgo.app",zT="https://api.capgo.app",Yde="https://web.capgo.app",FXe="package.json",xf=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,ue=e=>e?`
317
+ ${tpe.default.render(e)}`:"";function Kde(e){return new Promise(t=>{setTimeout(t,e)})}async function Ui(){let e=(0,ur.readFileSync)((0,yi.join)((0,ei.cwd)(),FXe));return JSON.parse(e)}async function ge(){try{let e=await gde();return e||(O.error("No capacitor config file found, run `cap init` first"),B.error("")),e}catch(e){O.error(`No capacitor config file found, run \`cap init\` first ${ue(e)}`),B.error("")}}async function Sc(){try{let e=await ge(),t={host:e?.config?.plugins?.CapacitorUpdater?.localHost||Xde,hostWeb:e?.config?.plugins?.CapacitorUpdater?.localWebHost||Yde};return e?.config?.plugins?.CapacitorUpdater?.localSupa&&e?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(O.info("Using custom supabase instance from capacitor.config.json"),t.supaKey=e?.config?.plugins?.CapacitorUpdater?.localSupaAnon,t.supaHost=e?.config?.plugins?.CapacitorUpdater?.localSupa),t}catch{return{host:Xde,hostWeb:Yde}}}var NXe=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function ape(){let e=await Sc();return Ua.get(`${zT}/private/config`).then(t=>t.json()).then(t=>({...t,...e})).catch(()=>(O.info(`Local config ${ue(e)}`),e))}async function Ee(e){let t=await ape();return(!t.supaHost||!t.supaKey)&&(O.error("Cannot connect to server please try again later"),B.error("")),(0,epe.createClient)(t.supaHost,t.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:e}}})}async function kXe(e,t,r){let{data:i}=await e.rpc("is_allowed_capgkey",{apikey:t,keymode:r}).single();if(!i){O.error("Invalid API key or insufficient permissions.");let n=r.map((s,a)=>a===r.length-1?`or ${s}`:`${s}, `).join("");O.error(`Your key should be: ${n} mode.`),B.error("")}}async function RXe(e,t){let{data:r}=await e.rpc("is_paying_org",{orgid:t}).single();return r||!1}async function PXe(e,t){let{data:r}=await e.rpc("is_trial_org",{orgid:t}).single();return r||0}async function IXe(e,t){let{data:r}=await e.rpc("is_allowed_action_org",{orgid:t}).single();return!!r}async function LXe(e,t,r){let{data:i}=await e.rpc("is_allowed_action",{apikey:r,appid:t}).single();return!!i}var qr=(a=>(a[a.none=0]="none",a[a.read=1]="read",a[a.upload=2]="upload",a[a.write=3]="write",a[a.admin=4]="admin",a[a.super_admin=5]="super_admin",a))(qr||{}),GT=(e,t)=>e>=t;async function ope(e,t,r){let{data:i,error:n}=await e.rpc("get_org_perm_for_apikey",{apikey:t,app_id:r}).single();if(n&&(O.error("Cannot get permissions for organization!"),console.error(n),(0,ei.exit)(1)),i.includes("perm")){let o=null;switch(i){case"perm_none":{o=0;break}case"perm_read":{o=1;break}case"perm_upload":{o=2;break}case"perm_write":{o=3;break}case"perm_admin":{o=4;break}case"perm_owner":{o=5;break}default:i.includes("invite")&&(O.info("Please accept/deny the organization invitation before trying to access the app"),(0,ei.exit)(1)),O.error(`Invalid output when fetching organization permission. Response: ${i}`),(0,ei.exit)(1)}return{okay:!0,data:o}}let a=null;switch(i){case"INVALID_APIKEY":{a="INVALID_APIKEY";break}case"NO_APP":{a="NO_APP";break}case"NO_ORG":{a="NO_ORG";break}default:O.error(`Invalid error when fetching organization permission. Response: ${i}`),(0,ei.exit)(1)}return{okay:!1,error:a}}async function Sf(e,t,r,i,n=!0){let s=await ape();await(i?LXe(e,i,r):IXe(e,t))||(O.error(`You need to upgrade your plan to continue to use capgo.
318
318
  Upgrade here: ${s.hostWeb}/dashboard/settings/plans
319
319
  `),Kde(100),Promise.resolve().then(()=>(Wde(),Gde)).then(l=>{l.default(`${s.hostWeb}/dashboard/settings/plans`)}),Kde(500),B.error(""));let[o,u]=await Promise.all([PXe(e,t),RXe(e,t)]);o>0&&n&&!u&&O.warn(`WARNING !!
320
320
  Trial expires in ${o} days, upgrade here: ${s.hostWeb}/dashboard/settings/plans
321
- `)}function Ae(e=!1){let t=(0,H9.homedir)(),r,i=`${t}/.capgo`;return(0,ur.existsSync)(i)&&(e||O.info(`Use global apy key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),i=".capgo",!r&&(0,ur.existsSync)(i)&&(e||O.info(`Use local apy key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),r||(O.error(`Cannot find API key in local folder or global, please login first with ${vi().runner} @capacitor/cli login`),B.error("")),r}async function*WT(e){let t=await(0,ur.readdirSync)(e,{withFileTypes:!0});for(let r of t){let i=(0,yi.resolve)(e,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*WT(i):yield i}}async function XT(){let e=(0,ei.cwd)(),t=!1,r=(0,yi.resolve)(e,"tsconfig.json");(0,ur.existsSync)(r)&&(t=!0);for await(let i of WT(e)){if(i.includes("angular.json"))return O.info("Found angular project"),t?"angular-ts":"angular-js";if(i.includes("nuxt.config.js"))return O.info("Found nuxtjs project"),t?"nuxtjs-ts":"nuxtjs-js";if(i.includes("next.config.js")||i.includes("next.config.mjs"))return O.info("Found nextjs project"),t?"nextjs-ts":"nextjs-js";if(i.includes("svelte.config.js"))return O.info("Found sveltekit project"),t?"sveltekit-ts":"sveltekit-js";if(i.includes("rolluconfig.js"))return O.info("Found svelte project"),t?"svelte-ts":"svelte-js";if(i.includes("vue.config.js"))return O.info("Found vue project"),t?"vue-ts":"vue-js";if(i.includes("package.json")){let n=await Ui();if(n.dependencies){if(n.dependencies.react)return O.info("Found react project test"),t?"react-ts":"react-js";if(n.dependencies.vue)return O.info("Found vue project"),t?"vue-ts":"vue-js"}}}return"unknown"}function upe(e,t){return e==="angular-js"||e==="angular-ts"?t?"src/main.ts":"src/main.js":e==="nextjs-js"||e==="nextjs-ts"?t?"src/app/layout.tsx":"src/app/layout.js":e==="svelte-js"||e==="svelte-ts"||e==="vue-js"||e==="vue-ts"?t?"src/main.ts":"src/main.js":e==="react-js"||e==="react-ts"?t?"src/index.tsx":"src/index.js":null}async function lpe(e){return e==="angular"?(O.info("Angular project detected"),"build"):e==="nuxtjs"?(O.info("Nuxtjs project detected"),"generate"):e==="nextjs"?(O.info("Nextjs project detected"),O.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),O.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),await Xe({message:"Do you want to continue?"})||(O.error("Aborted"),B.error("")),"build"):(e==="sveltekit"&&(O.info("Sveltekit project detected"),O.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),O.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),await Xe({message:"Do you want to continue?"})||(O.error("Aborted"),B.error(""))),"build")}async function cpe(){let e=/(main|index)\.(ts|tsx|js|jsx)$/,t="",r=(0,ei.cwd)(),i=r.split("/").length;for await(let n of WT(r))if(n.split("/").length-i<=2&&e.test(n)){t=n,O.info(`Found main file here ${n}`);break}return t}async function YT(e,t){return e.from("app_versions").upsert(t,{onConflict:"name,app_id"}).eq("app_id",t.app_id).eq("name",t.name)}async function dpe(e,t,r){let i={app_id:t,name:r,version:0};try{return(await e.functions.invoke("private/upload_link",{body:JSON.stringify(i)})).data.url}catch(n){O.error(`Cannot get upload url ${oe(n)}`)}return""}async function ppe(e){return(await(0,spe.promiseFiles)(e)).map(r=>{let i=(0,ur.readFileSync)(r),n=(0,Qde.createHash)("sha-256").update(i).digest("hex"),s=r.replace(e,"");return s.startsWith("/")&&(s=s.substring(1,s.length)),{file:s,hash:n}})}async function fpe(e,t,r,i){let n={app_id:t,name:r,version:2,manifest:i};try{O.info(`Generating the update manifest ${oe(n)}`);let a=await e.functions.invoke("private/upload_link",{body:JSON.stringify(n)});return a.data?a.data:(O.error(`Cannot get uploads url ${oe(a.error)}`),B.error(""),[])}catch(s){O.error(`Cannot get uploads url ${oe(s)}`)}return[]}async function BXe(e,t,r){let i={app_id:t,name:r,version:1};try{return(await e.functions.invoke("private/upload_link",{body:JSON.stringify(i)})).data}catch(n){return O.error(`Cannot get upload url ${oe(n)}`),null}}async function z9(e){return(0,H9.platform)()==="win32"?jXe(e):qXe(e)}function qXe(e){let t=new ipe.default;return t.addLocalFolder(e),t.toBuffer()}async function jXe(e){O.info("Zipping file windows mode");let t=new npe.default,r=async(n,s)=>{let a=(0,ur.readdirSync)(n);for(let o of a){let u=(0,yi.join)(n,o),l=(0,ur.statSync)(u);if(l.isFile()){let c=await(0,ur.readFileSync)(u);t.file((0,yi.join)(s,o).split(yi.sep).join("/"),c)}else l.isDirectory()&&await r(u,(0,yi.join)(s,o))}};return await r(e,""),await t.generateAsync({type:"nodebuffer",platform:"UNIX",compression:"DEFLATE",compressionOptions:{level:6}})}async function $Xe(e,t,r,i){let n={action:"mpu-complete",uploadId:t,key:e};await Ua.post(r,{json:{parts:i},searchParams:new URLSearchParams({body:btoa(JSON.stringify(n))})})}var Jde=10*1024*1024;async function hpe(e,t,r,i,n){try{let s=Ht();await s.track({channel:"app",event:"App Multipart Prepare",icon:"\u23EB",user_id:n,tags:{"app-id":t},notify:!1}).catch();let a=await BXe(e,t,r);if(!a)return!1;let o=i.length,u=Math.ceil(o/Jde),l=Array.from({length:u},(d,p)=>MXe(i,Jde,a.url,a.key,a.uploadId,p)),c=await Promise.all(l);return await $Xe(a.key,a.uploadId,a.url,c),await s.track({channel:"app",event:"App Multipart done",icon:"\u23EB",user_id:n,tags:{"app-id":t},notify:!1}).catch(),!0}catch(s){return O.error(`Could not upload via multipart ${oe(s)}`),!1}}async function mpe(e,t,r){let i={app_id:t,name:r};try{return(await e.functions.invoke("private/delete_failed_version",{body:JSON.stringify(i),method:"DELETE"})).data.status}catch(n){return O.error(`Cannot delete failed version ${oe(n)}`),Promise.reject(new Error("Cannot delete failed version"))}}async function MXe(e,t,r,i,n,s){let a=e.subarray(t*s,t*(s+1)),o={action:"mpu-uploadpart",uploadId:n,partNumber:s+1,key:i};return await(await Ua.put(r,{body:a,searchParams:new URLSearchParams({body:btoa(JSON.stringify(o))})})).json()}async function G9(e,t){if(!t.app_id||!t.name||!t.created_by)return O.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:i}=await e.from("channels").select("enable_progressive_deploy, secondary_version_percentage, second_version").eq("app_id",t.app_id).eq("name",t.name).single();if(r&&!i){if(r.enable_progressive_deploy){if(O.info("Progressive deploy is enabled"),r.secondary_version_percentage!==1&&O.warn("Latest progressive deploy has not finished"),t.second_version=t.version,!r.second_version)return O.error("missing secondVersion"),Promise.reject(new Error("missing secondVersion"));t.version=r.second_version,t.secondary_version_percentage=.1,O.info("Started new progressive upload!")}return e.from("channels").update(t).eq("app_id",t.app_id).eq("name",t.name).select().single()}return e.from("channels").insert(t).select().single()}function Ht(){return new rpe.LogSnag({token:ei.env.CAPGO_LOGSNAG??"c124f5e9d0ce5bdd14bbb48f815d5583",project:ei.env.CAPGO_LOGSNAG_PROJECT??"capgo"})}async function Cf(e,t){let{error:r,data:i}=await e.rpc("get_orgs_v5");r&&(O.error("Cannot get the list of organizations - exiting"),O.error(`Error ${JSON.stringify(r)}`),B.error(""));let n=i.filter(u=>!!t.find(l=>l===u.role));n.length===0&&(O.error(`Could not get organization with roles: ${t.join(" or ")} because the user does not have any org`),B.error(""));let s=n.length>1?await rd({message:"Please pick the organization that you want to insert to",options:n.map(u=>({value:u.gid,label:u.name}))}):n[0].gid;Gi(s)&&(O.error("Canceled organization selection, exiting"),B.error(""));let a=s,o=i.find(u=>u.gid===a);return O.info(`Using the organization "${o.name}" as the app owner`),o}var Af=e=>e.replace(/\./g,"--");async function xe(e,t,r=["all"]){await kXe(e,t,r);let{data:i,error:n}=await e.rpc("get_user_id",{apikey:t}).single(),s=(i||"").toString();return(!s||n)&&(O.error("Cannot auth user with apikey"),B.error("")),s}async function zn(e,t){let{data:r,error:i}=await e.from("apps").select("owner_org").eq("app_id",t).single();return(!r||i)&&(O.error(`Cannot get organization id for app id ${t}`),oe(i),B.error("")),r.owner_org}function Tf(e){return new Date(e||"").toLocaleString()}var Zde=!1,Ef="npm",Xm="install",VT="npx";function vi(){if(Zde)return{pm:Ef,command:Xm,installCommand:`${Ef} ${Xm}`,runner:VT};let e=(0,HT.findRootSync)((0,ei.cwd)());return Ef=t0(e.rootDir,"npm"),Xm=Ag(Ef),Zde=!0,VT=Cz(e.rootDir),{pm:Ef,command:Xm,installCommand:`${Ef} ${Xm}`,runner:VT}}function gpe(e){return(0,ur.readdirSync)(e,{withFileTypes:!0}).flatMap(i=>{let n=(0,yi.join)(e,i.name);return i.isDirectory()?gpe(n):n.split(`node_modules${yi.sep}`)[1]||n})}async function KT(){let e=(0,HT.findRootSync)((0,ei.cwd)()),t=(0,yi.join)((0,ei.cwd)(),"package.json");(0,ur.existsSync)(t)||(O.error("Missing package.json, you need to be in a capacitor project"),B.error(""));let r;try{r=await Ui()}catch(o){O.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",o),B.error("")}let{dependencies:i}=r;i||(O.error("Missing dependencies section in package.json"),B.error(""));for(let[o,u]of Object.entries(i))typeof u!="string"&&(O.error(`Invalid dependency ${o}: ${u}, expected string, got ${typeof u}`),B.error(""));let n=(0,yi.join)((0,ei.cwd)(),"node_modules");if(!(0,ur.existsSync)(n)){let o=t0(e.rootDir,"npm"),u=Ag(o);O.error(`Missing node_modules folder, please run ${o} ${u}`),B.error("")}let s=!1,a=await Promise.all(Object.entries(i).map(async([o,u])=>{let l=(0,yi.join)(n,o);if(!(0,ur.existsSync)(l)){s=!0;let p=t0(e.rootDir,"npm"),f=Ag(p);return O.error(`Missing dependency ${o}, please run ${p} ${f}`),{name:o,version:u}}let d=!1;try{d=gpe(l).some(f=>NXe.test(f))}catch(p){O.error(`Error reading node_modules files for ${o} package`),console.error(p),B.error("")}return{name:o,version:u,native:d}})).catch(()=>[]);return(s||a.find(o=>o.native===void 0))&&B.error(""),a}async function UXe(e,t,r){let{data:i,error:n}=await e.from("channels").select("version(checksum)").eq("name",r).eq("app_id",t).single(),s=i;return n||s===null||!s.version||!s.version.checksum?null:s.version.checksum}async function VXe(e,t,r){let{data:i,error:n}=await e.from("channels").select(`version (
321
+ `)}function Ae(e=!1){let t=(0,H9.homedir)(),r,i=`${t}/.capgo`;return(0,ur.existsSync)(i)&&(e||O.info(`Use global apy key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),i=".capgo",!r&&(0,ur.existsSync)(i)&&(e||O.info(`Use local apy key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),r||(O.error(`Cannot find API key in local folder or global, please login first with ${vi().runner} @capacitor/cli login`),B.error("")),r}async function*WT(e){let t=await(0,ur.readdirSync)(e,{withFileTypes:!0});for(let r of t){let i=(0,yi.resolve)(e,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*WT(i):yield i}}async function XT(){let e=(0,ei.cwd)(),t=!1,r=(0,yi.resolve)(e,"tsconfig.json");(0,ur.existsSync)(r)&&(t=!0);for await(let i of WT(e)){if(i.includes("angular.json"))return O.info("Found angular project"),t?"angular-ts":"angular-js";if(i.includes("nuxt.config.js"))return O.info("Found nuxtjs project"),t?"nuxtjs-ts":"nuxtjs-js";if(i.includes("next.config.js")||i.includes("next.config.mjs"))return O.info("Found nextjs project"),t?"nextjs-ts":"nextjs-js";if(i.includes("svelte.config.js"))return O.info("Found sveltekit project"),t?"sveltekit-ts":"sveltekit-js";if(i.includes("rolluconfig.js"))return O.info("Found svelte project"),t?"svelte-ts":"svelte-js";if(i.includes("vue.config.js"))return O.info("Found vue project"),t?"vue-ts":"vue-js";if(i.includes("package.json")){let n=await Ui();if(n.dependencies){if(n.dependencies.react)return O.info("Found react project test"),t?"react-ts":"react-js";if(n.dependencies.vue)return O.info("Found vue project"),t?"vue-ts":"vue-js"}}}return"unknown"}function upe(e,t){return e==="angular-js"||e==="angular-ts"?t?"src/main.ts":"src/main.js":e==="nextjs-js"||e==="nextjs-ts"?t?"src/app/layout.tsx":"src/app/layout.js":e==="svelte-js"||e==="svelte-ts"||e==="vue-js"||e==="vue-ts"?t?"src/main.ts":"src/main.js":e==="react-js"||e==="react-ts"?t?"src/index.tsx":"src/index.js":null}async function lpe(e){return e==="angular"?(O.info("Angular project detected"),"build"):e==="nuxtjs"?(O.info("Nuxtjs project detected"),"generate"):e==="nextjs"?(O.info("Nextjs project detected"),O.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),O.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),await Xe({message:"Do you want to continue?"})||(O.error("Aborted"),B.error("")),"build"):(e==="sveltekit"&&(O.info("Sveltekit project detected"),O.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),O.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),await Xe({message:"Do you want to continue?"})||(O.error("Aborted"),B.error(""))),"build")}async function cpe(){let e=/(main|index)\.(ts|tsx|js|jsx)$/,t="",r=(0,ei.cwd)(),i=r.split("/").length;for await(let n of WT(r))if(n.split("/").length-i<=2&&e.test(n)){t=n,O.info(`Found main file here ${n}`);break}return t}async function YT(e,t){return e.from("app_versions").upsert(t,{onConflict:"name,app_id"}).eq("app_id",t.app_id).eq("name",t.name)}async function dpe(e,t,r){let i={app_id:t,name:r,version:0};try{return(await e.functions.invoke("private/upload_link",{body:JSON.stringify(i)})).data.url}catch(n){O.error(`Cannot get upload url ${ue(n)}`)}return""}async function ppe(e){return(await(0,spe.promiseFiles)(e)).map(r=>{let i=(0,ur.readFileSync)(r),n=(0,Qde.createHash)("sha-256").update(i).digest("hex"),s=r.replace(e,"");return s.startsWith("/")&&(s=s.substring(1,s.length)),{file:s,hash:n}})}async function fpe(e,t,r,i){let n={app_id:t,name:r,version:2,manifest:i};try{let a=await e.functions.invoke("private/upload_link",{body:JSON.stringify(n)});return a.data?a.data:(O.error(`Cannot get uploads url ${ue(a.error)}`),B.error(""),[])}catch(s){O.error(`Cannot get uploads url ${ue(s)}`)}return[]}async function BXe(e,t,r){let i={app_id:t,name:r,version:1};try{return(await e.functions.invoke("private/upload_link",{body:JSON.stringify(i)})).data}catch(n){return O.error(`Cannot get upload url ${ue(n)}`),null}}async function z9(e){return(0,H9.platform)()==="win32"?jXe(e):qXe(e)}function qXe(e){let t=new ipe.default;return t.addLocalFolder(e),t.toBuffer()}async function jXe(e){O.info("Zipping file windows mode");let t=new npe.default,r=async(n,s)=>{let a=(0,ur.readdirSync)(n);for(let o of a){let u=(0,yi.join)(n,o),l=(0,ur.statSync)(u);if(l.isFile()){let c=await(0,ur.readFileSync)(u);t.file((0,yi.join)(s,o).split(yi.sep).join("/"),c)}else l.isDirectory()&&await r(u,(0,yi.join)(s,o))}};return await r(e,""),await t.generateAsync({type:"nodebuffer",platform:"UNIX",compression:"DEFLATE",compressionOptions:{level:6}})}async function $Xe(e,t,r,i){let n={action:"mpu-complete",uploadId:t,key:e};await Ua.post(r,{json:{parts:i},searchParams:new URLSearchParams({body:btoa(JSON.stringify(n))})})}var Jde=10*1024*1024;async function hpe(e,t,r,i,n){try{let s=Ht();await s.track({channel:"app",event:"App Multipart Prepare",icon:"\u23EB",user_id:n,tags:{"app-id":t},notify:!1}).catch();let a=await BXe(e,t,r);if(!a)return!1;let o=i.length,u=Math.ceil(o/Jde),l=Array.from({length:u},(d,p)=>MXe(i,Jde,a.url,a.key,a.uploadId,p)),c=await Promise.all(l);return await $Xe(a.key,a.uploadId,a.url,c),await s.track({channel:"app",event:"App Multipart done",icon:"\u23EB",user_id:n,tags:{"app-id":t},notify:!1}).catch(),!0}catch(s){return O.error(`Could not upload via multipart ${ue(s)}`),!1}}async function mpe(e,t,r){let i={app_id:t,name:r};try{return(await e.functions.invoke("private/delete_failed_version",{body:JSON.stringify(i),method:"DELETE"})).data.status}catch(n){return O.error(`Cannot delete failed version ${ue(n)}`),Promise.reject(new Error("Cannot delete failed version"))}}async function MXe(e,t,r,i,n,s){let a=e.subarray(t*s,t*(s+1)),o={action:"mpu-uploadpart",uploadId:n,partNumber:s+1,key:i};return await(await Ua.put(r,{body:a,searchParams:new URLSearchParams({body:btoa(JSON.stringify(o))})})).json()}async function G9(e,t){if(!t.app_id||!t.name||!t.created_by)return O.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:i}=await e.from("channels").select("enable_progressive_deploy, secondary_version_percentage, second_version").eq("app_id",t.app_id).eq("name",t.name).single();if(r&&!i){if(r.enable_progressive_deploy){if(O.info("Progressive deploy is enabled"),r.secondary_version_percentage!==1&&O.warn("Latest progressive deploy has not finished"),t.second_version=t.version,!r.second_version)return O.error("missing secondVersion"),Promise.reject(new Error("missing secondVersion"));t.version=r.second_version,t.secondary_version_percentage=.1,O.info("Started new progressive upload!")}return e.from("channels").update(t).eq("app_id",t.app_id).eq("name",t.name).select().single()}return e.from("channels").insert(t).select().single()}function Ht(){return new rpe.LogSnag({token:ei.env.CAPGO_LOGSNAG??"c124f5e9d0ce5bdd14bbb48f815d5583",project:ei.env.CAPGO_LOGSNAG_PROJECT??"capgo"})}async function Cf(e,t){let{error:r,data:i}=await e.rpc("get_orgs_v5");r&&(O.error("Cannot get the list of organizations - exiting"),O.error(`Error ${JSON.stringify(r)}`),B.error(""));let n=i.filter(u=>!!t.find(l=>l===u.role));n.length===0&&(O.error(`Could not get organization with roles: ${t.join(" or ")} because the user does not have any org`),B.error(""));let s=n.length>1?await rd({message:"Please pick the organization that you want to insert to",options:n.map(u=>({value:u.gid,label:u.name}))}):n[0].gid;Gi(s)&&(O.error("Canceled organization selection, exiting"),B.error(""));let a=s,o=i.find(u=>u.gid===a);return O.info(`Using the organization "${o.name}" as the app owner`),o}var Af=e=>e.replace(/\./g,"--");async function xe(e,t,r=["all"]){await kXe(e,t,r);let{data:i,error:n}=await e.rpc("get_user_id",{apikey:t}).single(),s=(i||"").toString();return(!s||n)&&(O.error("Cannot auth user with apikey"),B.error("")),s}async function zn(e,t){let{data:r,error:i}=await e.from("apps").select("owner_org").eq("app_id",t).single();return(!r||i)&&(O.error(`Cannot get organization id for app id ${t}`),ue(i),B.error("")),r.owner_org}function Tf(e){return new Date(e||"").toLocaleString()}var Zde=!1,Ef="npm",Xm="install",VT="npx";function vi(){if(Zde)return{pm:Ef,command:Xm,installCommand:`${Ef} ${Xm}`,runner:VT};let e=(0,HT.findRootSync)((0,ei.cwd)());return Ef=t0(e.rootDir,"npm"),Xm=Ag(Ef),Zde=!0,VT=Cz(e.rootDir),{pm:Ef,command:Xm,installCommand:`${Ef} ${Xm}`,runner:VT}}function gpe(e){return(0,ur.readdirSync)(e,{withFileTypes:!0}).flatMap(i=>{let n=(0,yi.join)(e,i.name);return i.isDirectory()?gpe(n):n.split(`node_modules${yi.sep}`)[1]||n})}async function KT(){let e=(0,HT.findRootSync)((0,ei.cwd)()),t=(0,yi.join)((0,ei.cwd)(),"package.json");(0,ur.existsSync)(t)||(O.error("Missing package.json, you need to be in a capacitor project"),B.error(""));let r;try{r=await Ui()}catch(o){O.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",o),B.error("")}let{dependencies:i}=r;i||(O.error("Missing dependencies section in package.json"),B.error(""));for(let[o,u]of Object.entries(i))typeof u!="string"&&(O.error(`Invalid dependency ${o}: ${u}, expected string, got ${typeof u}`),B.error(""));let n=(0,yi.join)((0,ei.cwd)(),"node_modules");if(!(0,ur.existsSync)(n)){let o=t0(e.rootDir,"npm"),u=Ag(o);O.error(`Missing node_modules folder, please run ${o} ${u}`),B.error("")}let s=!1,a=await Promise.all(Object.entries(i).map(async([o,u])=>{let l=(0,yi.join)(n,o);if(!(0,ur.existsSync)(l)){s=!0;let p=t0(e.rootDir,"npm"),f=Ag(p);return O.error(`Missing dependency ${o}, please run ${p} ${f}`),{name:o,version:u}}let d=!1;try{d=gpe(l).some(f=>NXe.test(f))}catch(p){O.error(`Error reading node_modules files for ${o} package`),console.error(p),B.error("")}return{name:o,version:u,native:d}})).catch(()=>[]);return(s||a.find(o=>o.native===void 0))&&B.error(""),a}async function UXe(e,t,r){let{data:i,error:n}=await e.from("channels").select("version(checksum)").eq("name",r).eq("app_id",t).single(),s=i;return n||s===null||!s.version||!s.version.checksum?null:s.version.checksum}async function VXe(e,t,r){let{data:i,error:n}=await e.from("channels").select(`version (
322
322
  native_packages
323
323
  )`).eq("name",r).eq("app_id",t).single();n&&(O.error(`Error fetching native packages: ${n.message}`),B.error(""));let s;try{s=i.version.native_packages}catch{O.error("Error parsing native packages"),B.error("")}return s||(O.error("Error parsing native packages, perhaps the metadata does not exist?"),B.error("")),s.forEach(o=>{typeof o!="object"&&(O.error(`Invalid remote native package data: ${o}, expected object, got ${typeof o}`),B.error(""));let{name:u,version:l}=o;(!u||typeof u!="string")&&(O.error(`Invalid remote native package name: ${u}, expected string, got ${typeof u}`),B.error("")),(!l||typeof l!="string")&&(O.error(`Invalid remote native package version: ${l}, expected string, got ${typeof l}`),B.error(""))}),new Map(s.map(o=>[o.name,o]))}async function ype(e,t,r,i){let n=$e();n.start(`Checking bundle checksum compatibility with channel ${r}`);let s=await UXe(e,t,r);s&&s===i&&(O.error(`Cannot upload the same bundle content.
324
324
  Current bundle checksum matches remote bundle for channel ${r}
325
325
  Did you builded your app before uploading?
326
326
  PS: You can ignore this check with "--ignore-checksum-check"`),B.error("")),n.stop(`Checksum compatible with ${r} channel`)}async function W9(e,t,r){let i=await KT(),n=await VXe(e,t,r),s=i.filter(o=>!!o.native).map(o=>{let u=n.get(o.name);return u?{name:o.name,localVersion:o.version,remoteVersion:u.version}:{name:o.name,localVersion:o.version,remoteVersion:void 0}}),a=[...n].filter(([o])=>i.find(u=>u.name===o)===void 0).map(([o,u])=>({name:o,localVersion:void 0,remoteVersion:u.version}));return s.push(...a),{finalCompatibility:s,localDependencies:i}}async function vpe(e){se("Getting user id"),e.apikey=e.apikey||Ae();let t=await Ee(e.apikey),r=await xe(t,e.apikey,["read"]);ee(`Done \u2705: ${r}`)}var D2e=require("node:crypto"),b2e=require("node:fs"),E2e=require("node:process");var x2e=me(TO());var _2e=me(LF());async function ct(){let e=await(0,_2e.default)("@capgo/cli"),t=e?.split(".")[0];e!==Vo.version&&O.warning(`\u{1F6A8} You are using @capgo/cli@${Vo.version} it's not the latest version.
327
- Please use @capgo/cli@${e}" or @capgo/cli@${t} to keep up to date with the latest features and bug fixes.`)}var nl=require("node:fs"),S2=require("node:path");function Jit(e,t){return(0,nl.readFileSync)(e,"utf8").includes(t)}function C2(e,t){let r=(0,nl.readdirSync)(e);for(let i of r){let n=(0,S2.join)(e,i),s=(0,nl.statSync)(n);if(s.isDirectory()){if(C2(n,t))return!0}else if(s.isFile()&&(0,S2.extname)(n)===".js"&&Jit(n,t))return!0}return!1}function A2(e){let t=(0,nl.readdirSync)(e);if(t.length===1){let i=(0,S2.join)(e,t[0]);if((0,nl.statSync)(i).isDirectory())return A2(i)}return t.indexOf("index.html")>-1}var Zit=20;async function S2e(e,t){try{let{bundle:r,path:i}=t,{json:n}=t,s=Ht();n||await ct();let a=await ge();e=e||a?.config?.appId;let o=(0,D2e.randomUUID)().split("-")[0],u=await Ui();r=r||u?.version||`0.0.1-beta.${o}`,n||se(`Zipping ${e}@${r}`),r&&!xf.test(r)&&(n?console.error(oe({error:"invalid_semver"})):O.error(`Your bundle name ${r}, is not valid it should follow semver convention : https://semver.org/`),B.error("")),i=i||a?.config?.webDir,(!e||!r||!i)&&(n?console.error(oe({error:"missing_argument"})):O.error("Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project"),B.error("")),n||O.info(`Started from path "${i}"`);let l=t.codeCheck;(typeof l>"u"||l)&&(C2(i,"notifyAppReady")||(n?console.error(oe({error:"notifyAppReady_not_in_source_code"})):O.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),B.error("")),A2(i)||(n?console.error(oe({error:"index_html_not_found"})):O.error("index.html is missing in the root folder or in the only folder in the root folder"),B.error("")));let c=await z9(i);n||O.info(`Zipped ${c.byteLength} bytes`);let d=$e();n||d.start("Calculating checksum");let p=await(0,x2e.checksum)(c,"crc32");n||d.stop(`Checksum: ${p}`);let f=Math.floor(c.byteLength/1024/1024);f>Zit&&!n&&(O.warn(`WARNING !!
327
+ Please use @capgo/cli@${e}" or @capgo/cli@${t} to keep up to date with the latest features and bug fixes.`)}var nl=require("node:fs"),S2=require("node:path");function Jit(e,t){return(0,nl.readFileSync)(e,"utf8").includes(t)}function C2(e,t){let r=(0,nl.readdirSync)(e);for(let i of r){let n=(0,S2.join)(e,i),s=(0,nl.statSync)(n);if(s.isDirectory()){if(C2(n,t))return!0}else if(s.isFile()&&(0,S2.extname)(n)===".js"&&Jit(n,t))return!0}return!1}function A2(e){let t=(0,nl.readdirSync)(e);if(t.length===1){let i=(0,S2.join)(e,t[0]);if((0,nl.statSync)(i).isDirectory())return A2(i)}return t.indexOf("index.html")>-1}var Zit=20;async function S2e(e,t){try{let{bundle:r,path:i}=t,{json:n}=t,s=Ht();n||await ct();let a=await ge();e=e||a?.config?.appId;let o=(0,D2e.randomUUID)().split("-")[0],u=await Ui();r=r||u?.version||`0.0.1-beta.${o}`,n||se(`Zipping ${e}@${r}`),r&&!xf.test(r)&&(n?console.error(ue({error:"invalid_semver"})):O.error(`Your bundle name ${r}, is not valid it should follow semver convention : https://semver.org/`),B.error("")),i=i||a?.config?.webDir,(!e||!r||!i)&&(n?console.error(ue({error:"missing_argument"})):O.error("Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project"),B.error("")),n||O.info(`Started from path "${i}"`);let l=t.codeCheck;(typeof l>"u"||l)&&(C2(i,"notifyAppReady")||(n?console.error(ue({error:"notifyAppReady_not_in_source_code"})):O.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),B.error("")),A2(i)||(n?console.error(ue({error:"index_html_not_found"})):O.error("index.html is missing in the root folder or in the only folder in the root folder"),B.error("")));let c=await z9(i);n||O.info(`Zipped ${c.byteLength} bytes`);let d=$e();n||d.start("Calculating checksum");let p=await(0,x2e.checksum)(c,"crc32");n||d.stop(`Checksum: ${p}`);let f=Math.floor(c.byteLength/1024/1024);f>Zit&&!n&&(O.warn(`WARNING !!
328
328
  The app size is ${f} Mb, this may take a while to download for users
329
329
  `),O.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
330
- `),await s.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",tags:{"app-id":e},notify:!1}).catch());let h=$e(),g=t.name||`${e}_${r}.zip`;n||h.start(`Saving to ${g}`),(0,b2e.writeFileSync)(g,c),n||h.stop(`Saved to ${g}`),await s.track({channel:"app",event:"App zip",icon:"\u23EB",tags:{"app-id":e},notify:!1}).catch(),n||ee("Done \u2705"),n&&console.log(JSON.stringify({bundle:r,filename:g,checksum:p},null,2)),(0,E2e.exit)()}catch(r){O.error(oe(r)),B.error("")}}var Sr=require("node:fs"),U2=require("node:child_process"),pn=require("node:process"),i5=require("node:path");var SN=me(I9()),n5=me(M2e());var HF=require("node:process");async function U2e(e,t){let{data:r}=await e.rpc("exist_app_v2",{appid:t}).single();return!!r}async function tt(e,t,r,i){let n=vi(),s=await ope(e,t,r);if(!s.okay)switch(s.error){case"INVALID_APIKEY":{O.error("Invalid apikey, such apikey does not exists!"),B.error("");break}case"NO_APP":{O.error(`App ${r} does not exist, run first \`${n.runner} @capgo/cli app add ${r}\` to create it`),B.error("");break}case"NO_ORG":{O.error("Could not find organization, please contact support to resolve this!"),B.error("");break}}let a=s.data;return i>a&&(O.error(`Insuficcent permissions for app ${r}. Current permission: ${qr[s.data]}, required for this action: ${qr[i]}.`),B.error("")),s.data}var Kn="assets/icon.png";function mnt(e){return new Promise(t=>{setTimeout(t,e)})}async function Lo(e,t,r,i,n="\u2705"){await r.track({channel:e,event:i,icon:n,user_id:t,notify:!1}).catch()}async function gnt(e,t,r,i){Gi(t)&&(await Lo(e,r,i,"canceled","\u{1F937}"),(0,HF.exit)())}async function ynt(e,t,r){try{let i=await Ua.post(`${zT}/private/stats`,{headers:{"Content-Type":"application/json",capgkey:e},body:JSON.stringify(t)}).then(n=>n.json()).catch(n=>(console.error("Cannot get devices",n),[]));if(i?.length>0&&(r===null||r!==i[0].created_at))return i}catch(i){O.error(`Cannot get stats ${oe(i)}`)}return[]}async function vnt(e,t,r,i,n){if(O.info(`Log from Device: ${e.device_id}`),e.action==="get")O.info("Update Sent your your device, wait until event download complete"),await Lo(t,r,i,"done");else if(e.action.startsWith("download_")){let s=e.action.split("_")[1];s==="complete"?(O.info("Your bundle has been downloaded on your device, background the app now and open it again to see the update"),await Lo(t,r,i,"downloaded")):s==="fail"?(O.error("Your bundle has failed to download on your device."),O.error("Please check if you have network connection and try again")):O.info(`Your bundle is downloading ${s}% ...`)}else{if(e.action==="set")return O.info("Your bundle has been set on your device \u2764\uFE0F"),await Lo(t,r,i,"set"),!1;e.action==="NoChannelOrOverride"?O.error(`No default channel or override (channel/device) found, please create it here ${n}`):e.action==="needPlanUpgrade"?O.error("Your are out of quota, please upgrade your plan here https://web.capgo.app/dashboard/settings/plans"):e.action==="missingBundle"?O.error("Your bundle is missing, please check how you build your app"):e.action==="noNew"?(O.error(`The version number you uploaded to your default channel in Capgo, is the same as the present in the device ${e.device_id}.`),O.error(`To fix it, ensure the variable:
330
+ `),await s.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",tags:{"app-id":e},notify:!1}).catch());let h=$e(),g=t.name||`${e}_${r}.zip`;n||h.start(`Saving to ${g}`),(0,b2e.writeFileSync)(g,c),n||h.stop(`Saved to ${g}`),await s.track({channel:"app",event:"App zip",icon:"\u23EB",tags:{"app-id":e},notify:!1}).catch(),n||ee("Done \u2705"),n&&console.log(JSON.stringify({bundle:r,filename:g,checksum:p},null,2)),(0,E2e.exit)()}catch(r){O.error(ue(r)),B.error("")}}var Sr=require("node:fs"),U2=require("node:child_process"),pn=require("node:process"),i5=require("node:path");var SN=me(I9()),n5=me(M2e());var HF=require("node:process");async function U2e(e,t){let{data:r}=await e.rpc("exist_app_v2",{appid:t}).single();return!!r}async function tt(e,t,r,i){let n=vi(),s=await ope(e,t,r);if(!s.okay)switch(s.error){case"INVALID_APIKEY":{O.error("Invalid apikey, such apikey does not exists!"),B.error("");break}case"NO_APP":{O.error(`App ${r} does not exist, run first \`${n.runner} @capgo/cli app add ${r}\` to create it`),B.error("");break}case"NO_ORG":{O.error("Could not find organization, please contact support to resolve this!"),B.error("");break}}let a=s.data;return i>a&&(O.error(`Insuficcent permissions for app ${r}. Current permission: ${qr[s.data]}, required for this action: ${qr[i]}.`),B.error("")),s.data}var Kn="assets/icon.png";function mnt(e){return new Promise(t=>{setTimeout(t,e)})}async function Lo(e,t,r,i,n="\u2705"){await r.track({channel:e,event:i,icon:n,user_id:t,notify:!1}).catch()}async function gnt(e,t,r,i){Gi(t)&&(await Lo(e,r,i,"canceled","\u{1F937}"),(0,HF.exit)())}async function ynt(e,t,r){try{let i=await Ua.post(`${zT}/private/stats`,{headers:{"Content-Type":"application/json",capgkey:e},body:JSON.stringify(t)}).then(n=>n.json()).catch(n=>(console.error("Cannot get devices",n),[]));if(i?.length>0&&(r===null||r!==i[0].created_at))return i}catch(i){O.error(`Cannot get stats ${ue(i)}`)}return[]}async function vnt(e,t,r,i,n){if(O.info(`Log from Device: ${e.device_id}`),e.action==="get")O.info("Update Sent your your device, wait until event download complete"),await Lo(t,r,i,"done");else if(e.action.startsWith("download_")){let s=e.action.split("_")[1];s==="complete"?(O.info("Your bundle has been downloaded on your device, background the app now and open it again to see the update"),await Lo(t,r,i,"downloaded")):s==="fail"?(O.error("Your bundle has failed to download on your device."),O.error("Please check if you have network connection and try again")):O.info(`Your bundle is downloading ${s}% ...`)}else{if(e.action==="set")return O.info("Your bundle has been set on your device \u2764\uFE0F"),await Lo(t,r,i,"set"),!1;e.action==="NoChannelOrOverride"?O.error(`No default channel or override (channel/device) found, please create it here ${n}`):e.action==="needPlanUpgrade"?O.error("Your are out of quota, please upgrade your plan here https://web.capgo.app/dashboard/settings/plans"):e.action==="missingBundle"?O.error("Your bundle is missing, please check how you build your app"):e.action==="noNew"?(O.error(`The version number you uploaded to your default channel in Capgo, is the same as the present in the device ${e.device_id}.`),O.error(`To fix it, ensure the variable:
331
331
  - iOS: keyCFBundleShortVersionString or MARKETING_VERSION
332
332
  - Android: versionName
333
333
  Are lower than the version number you uploaded to Capgo.`),O.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disablePlatformIos"?O.error(`iOS is disabled in the default channel and your device ${e.device_id} is an iOS device ${n}`):e.action==="disablePlatformAndroid"?O.error(`Android is disabled in the default channel and your device ${e.device_id} is an Android device ${n}`):e.action==="disableAutoUpdateToMajor"?(O.error(`The version number you uploaded to your default channel in Capgo, is a major version higher (ex: 1.0.0 in device to 2.0.0 in Capgo) than the present in the device ${e.device_id}.`),O.error("Capgo is set by default to protect you from this, and avoid sending breaking changes incompatible with the native code present in the device."),O.error(`To fix it, ensure the variable:
@@ -336,8 +336,8 @@ The app size is ${f} Mb, this may take a while to download for users
336
336
  Are lower than the version number you uploaded to Capgo.`),O.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disableAutoUpdateUnderNative"?(O.error(`The version number you uploaded to your default channel in Capgo, is lower than the present in the device ${e.device_id}.`),O.error(`To fix it, ensure the variable:
337
337
  - iOS: keyCFBundleShortVersionString or MARKETING_VERSION
338
338
  - Android: versionName
339
- Are lower than the version number you uploaded to Capgo.`),O.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disableDevBuild"?(O.error(`Dev build is disabled in the default channel. ${n}`),O.error("Set your channel to allow it if you wanna test your app")):e.action==="disableEmulator"?(O.error(`Emulator is disabled in the default channel. ${n}`),O.error("Set your channel to allow it if you wanna test your app")):e.action==="cannotGetBundle"?(O.error(`We cannot get your bundle from the default channel. ${n}`),O.error("Are you sure your default channel has a bundle set?")):e.action==="set_fail"?O.error(`Your bundle seems to be corrupted, try to download from ${n} to identify the issue`):e.action==="reset"?O.error("Your device has been reset to the builtin bundle, did notifyAppReady() is present in the code builded and uploaded to Capgo ?"):e.action==="update_fail"?(O.error("Your bundle has been installed but failed to call notifyAppReady()"),O.error("Please check if you have network connection and try again")):e.action==="checksum_fail"?O.error("Your bundle has failed to validate checksum, please check your code and send it again to Capgo"):O.error(`Log from Capgo ${e.action}`)}return!0}async function zF(e,t,r,i,n,s){let a=!0,o=Af(r),l=`${(await Sc()).hostWeb}/app/p/${o}`;await Lo(e,n,i,"Use waitlog");let c={appId:r,devicesId:s?[s]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},d=null,p=$e();for(p.start("Waiting for logs (Expect delay of 30 sec)");a;){await mnt(5e3);let f=await ynt(t,c,d);if(f.length>0){d=f[0].created_at;for(let h of f)if(a=await vnt(h,e,n,i,l),!a)break}}return p.stop("Stop watching logs"),Promise.resolve()}async function V2e(e,t){se("Debug Live update in Capgo"),await ct(),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let i=t.device;t.apikey||(O.error("Missing API key, you need to provide an API key to delete your app"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey),s=Ht(),a=await xe(n,t.apikey);O.info("Getting active bundle in Capgo"),await tt(n,t.apikey,e,4);let o=await zn(n,e),u=await Xe({message:"Automatic check if update working in device ?"});await gnt("debug",u,a,s),u?(O.info(`Wait logs sent to Capgo from ${e} device, Please open your app \u{1F4AA}`),await zF("debug",t.apikey,e,s,o,i),ee("Done \u2705")):ee("Canceled \u274C"),ee("Done \u2705"),(0,HF.exit)()}var Da=require("node:fs");var Di=require("node:crypto"),T2=require("node:buffer"),H2e="aes-128-cbc",z2e="sha256",Uy="base64",G2e=Di.constants.RSA_PKCS1_OAEP_PADDING;function W2e(e,t,r){let[i,n]=t.split(":"),s=(0,Di.privateDecrypt)({key:r,padding:G2e,oaepHash:z2e},T2.Buffer.from(n,Uy)),a=T2.Buffer.from(i,Uy),o=(0,Di.createDecipheriv)(H2e,s,a);return o.setAutoPadding(!0),T2.Buffer.concat([o.update(e),o.final()])}function Vy(e,t){let r=(0,Di.randomBytes)(16),i=(0,Di.randomBytes)(16),n=(0,Di.createCipheriv)(H2e,i,r);n.setAutoPadding(!0);let s=r.toString(Uy),a=(0,Di.publicEncrypt)({key:t,padding:G2e,oaepHash:z2e},i).toString(Uy),o=`${s}:${a}`;return{encryptedData:T2.Buffer.concat([n.update(e),n.final()]),ivSessionKey:o}}function X2e(){let{publicKey:e,privateKey:t}=(0,Di.generateKeyPairSync)("rsa",{modulusLength:2048});return{publicKey:e.export({type:"pkcs1",format:"pem"}),privateKey:t.export({type:"pkcs1",format:"pem"})}}async function wnt(e,t=!0){t&&se("Save keys \u{1F511}");let r=await ge(),i=e.key||Ao,n=e.keyData||"";if(!(0,Da.existsSync)(i)&&!n)if(t)O.error(`Cannot find public key ${i} or as keyData option or in ${r.path}`),B.error("");else return!1;else(0,Da.existsSync)(i)&&(n=(0,Da.readFileSync)(i).toString());return r?.config&&(r.config.plugins||(r.config.plugins={extConfig:{},CapacitorUpdater:{}}),r.config.plugins.CapacitorUpdater||(r.config.plugins.CapacitorUpdater={}),r.config.plugins.CapacitorUpdater.privateKey=n,await TT(r)),O&&(O.success(`private key saved into ${r.path} file in local directory`),O.success("your app will decode the zip archive with this key")),!0}async function Y2e(e){se("Save keys \u{1F511}"),await ct(),await wnt(e)}async function GF(e,t=!0){t&&se("Create keys \u{1F511}");let{publicKey:r,privateKey:i}=X2e();if((0,Da.existsSync)(ha)&&!e.force)if(O.error("Public Key already exists, use --force to overwrite"),t)B.error("");else return!1;if((0,Da.writeFileSync)(ha,r),(0,Da.existsSync)(Ao)&&!e.force)if(O.error("Private Key already exists, use --force to overwrite"),t)B.error("");else return!1;(0,Da.writeFileSync)(Ao,i);let n=await ge();if(n?.config){n.config.plugins||(n.config.plugins={extConfig:{},CapacitorUpdater:{}}),n.config.plugins.CapacitorUpdater||(n.config.plugins.CapacitorUpdater={});let s=i.replace(/\\n/g,"\\n");n.config.plugins.CapacitorUpdater.privateKey=s,TT(n)}return t&&(O.success("Your RSA key has been generated"),O.success(`Public key saved in ${ha}`),O.success("This key will be use to encrypt your bundle before sending it to Capgo"),O.success("Keep it safe"),O.success("Than make it unreadable by Capgo and unmodifiable by anyone"),O.success(`Private key saved in ${n.path}`),O.success("Your app will be the only one having it"),O.success("Only your users can decrypt your update"),O.success("Only you can send them an update"),ee("Done \u2705")),!0}async function K2e(e){await ct(),await GF(e)}var D6e=require("node:process");var h6e=require("node:process");var m6e=me(P2());async function g6e(e,t,r){let{data:i,error:n}=await e.from("channels").select().eq("app_id",t).eq("version",r.id);if(n&&(O.error(`Cannot check Version ${t}@${r.name}`),B.error("")),i&&i.length>0){if(se(`\u274C Version ${t}@${r.name} is used in ${i.length} channel`),await Xe({message:"unlink it?"}))for(let s of i){let a=$e();a.start(`Unlinking channel ${s.name}`);let{error:o}=await e.from("channels").update({version:(await lN(e,t))?.id}).eq("id",s.id);o&&(a.stop(`Cannot update channel ${s.name} ${oe(o)}`),(0,h6e.exit)(1)),a.stop(`\u2705 Channel ${s.name} unlinked`)}else O.error("Unlink it first"),B.error("");ee(`Version unlinked from ${i.length} channel`)}}function lN(e,t){return e.from("app_versions").select("id").eq("app_id",t).eq("name","unknown").throwOnError().single().then(({data:r,error:i})=>(i&&(O.error(`Cannot call findUnknownVersion as it returned an error.
340
- ${oe(i)}`),B.error("")),r))}function y6e(e,t){return e.from("channels").insert(t).select().single()}function v6e(e,t,r,i){return e.from("channels").delete().eq("name",t).eq("app_id",r).single()}function w6e(e){let t=new m6e.Table({title:"Channels",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Name:r.name,...r.version?{Version:r.version.name}:void 0,Public:r.public?"\u2705":"\u274C",iOS:r.ios?"\u2705":"\u274C",Android:r.android?"\u2705":"\u274C","\u2B06\uFE0F limit":r.disable_auto_update,"\u2B07\uFE0F under native":r.disable_auto_update_under_native?"\u274C":"\u2705","Self assign":r.allow_device_self_set?"\u2705":"\u274C",Progressive:r.enable_progressive_deploy?"\u2705":"\u274C",...r.enable_progressive_deploy&&r.second_version?{"Next version":r.second_version.name}:void 0,...r.enable_progressive_deploy&&r.second_version?{"Next %":r.secondary_version_percentage}:void 0,"AB Testing":r.enable_ab_testing?"\u2705":"\u274C",...r.enable_ab_testing&&r.second_version?{"Version B":r.second_version.name}:void 0,...r.enable_ab_testing&&r.second_version?{"A/B %":`${(1-r.secondary_version_percentage)*100}% / ${r.secondary_version_percentage*100}%`}:void 0,Emulator:r.allow_emulator?"\u2705":"\u274C","Dev \u{1F4F1}":r.allow_dev?"\u2705":"\u274C"})}),O.success(t.render())}async function _6e(e,t){let{data:r,error:i}=await e.from("channels").select(`
339
+ Are lower than the version number you uploaded to Capgo.`),O.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disableDevBuild"?(O.error(`Dev build is disabled in the default channel. ${n}`),O.error("Set your channel to allow it if you wanna test your app")):e.action==="disableEmulator"?(O.error(`Emulator is disabled in the default channel. ${n}`),O.error("Set your channel to allow it if you wanna test your app")):e.action==="cannotGetBundle"?(O.error(`We cannot get your bundle from the default channel. ${n}`),O.error("Are you sure your default channel has a bundle set?")):e.action==="set_fail"?O.error(`Your bundle seems to be corrupted, try to download from ${n} to identify the issue`):e.action==="reset"?O.error("Your device has been reset to the builtin bundle, did notifyAppReady() is present in the code builded and uploaded to Capgo ?"):e.action==="update_fail"?(O.error("Your bundle has been installed but failed to call notifyAppReady()"),O.error("Please check if you have network connection and try again")):e.action==="checksum_fail"?O.error("Your bundle has failed to validate checksum, please check your code and send it again to Capgo"):O.error(`Log from Capgo ${e.action}`)}return!0}async function zF(e,t,r,i,n,s){let a=!0,o=Af(r),l=`${(await Sc()).hostWeb}/app/p/${o}`;await Lo(e,n,i,"Use waitlog");let c={appId:r,devicesId:s?[s]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},d=null,p=$e();for(p.start("Waiting for logs (Expect delay of 30 sec)");a;){await mnt(5e3);let f=await ynt(t,c,d);if(f.length>0){d=f[0].created_at;for(let h of f)if(a=await vnt(h,e,n,i,l),!a)break}}return p.stop("Stop watching logs"),Promise.resolve()}async function V2e(e,t){se("Debug Live update in Capgo"),await ct(),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let i=t.device;t.apikey||(O.error("Missing API key, you need to provide an API key to delete your app"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey),s=Ht(),a=await xe(n,t.apikey);O.info("Getting active bundle in Capgo"),await tt(n,t.apikey,e,4);let o=await zn(n,e),u=await Xe({message:"Automatic check if update working in device ?"});await gnt("debug",u,a,s),u?(O.info(`Wait logs sent to Capgo from ${e} device, Please open your app \u{1F4AA}`),await zF("debug",t.apikey,e,s,o,i),ee("Done \u2705")):ee("Canceled \u274C"),ee("Done \u2705"),(0,HF.exit)()}var Da=require("node:fs");var Di=require("node:crypto"),T2=require("node:buffer"),H2e="aes-128-cbc",z2e="sha256",Uy="base64",G2e=Di.constants.RSA_PKCS1_OAEP_PADDING;function W2e(e,t,r){let[i,n]=t.split(":"),s=(0,Di.privateDecrypt)({key:r,padding:G2e,oaepHash:z2e},T2.Buffer.from(n,Uy)),a=T2.Buffer.from(i,Uy),o=(0,Di.createDecipheriv)(H2e,s,a);return o.setAutoPadding(!0),T2.Buffer.concat([o.update(e),o.final()])}function Vy(e,t){let r=(0,Di.randomBytes)(16),i=(0,Di.randomBytes)(16),n=(0,Di.createCipheriv)(H2e,i,r);n.setAutoPadding(!0);let s=r.toString(Uy),a=(0,Di.publicEncrypt)({key:t,padding:G2e,oaepHash:z2e},i).toString(Uy),o=`${s}:${a}`;return{encryptedData:T2.Buffer.concat([n.update(e),n.final()]),ivSessionKey:o}}function X2e(){let{publicKey:e,privateKey:t}=(0,Di.generateKeyPairSync)("rsa",{modulusLength:2048});return{publicKey:e.export({type:"pkcs1",format:"pem"}),privateKey:t.export({type:"pkcs1",format:"pem"})}}async function wnt(e,t=!0){t&&se("Save keys \u{1F511}");let r=await ge(),i=e.key||Ao,n=e.keyData||"";if(!(0,Da.existsSync)(i)&&!n)if(t)O.error(`Cannot find public key ${i} or as keyData option or in ${r.path}`),B.error("");else return!1;else(0,Da.existsSync)(i)&&(n=(0,Da.readFileSync)(i).toString());return r?.config&&(r.config.plugins||(r.config.plugins={extConfig:{},CapacitorUpdater:{}}),r.config.plugins.CapacitorUpdater||(r.config.plugins.CapacitorUpdater={}),r.config.plugins.CapacitorUpdater.privateKey=n,await TT(r)),O&&(O.success(`private key saved into ${r.path} file in local directory`),O.success("your app will decode the zip archive with this key")),!0}async function Y2e(e){se("Save keys \u{1F511}"),await ct(),await wnt(e)}async function GF(e,t=!0){t&&se("Create keys \u{1F511}");let{publicKey:r,privateKey:i}=X2e();if((0,Da.existsSync)(ha)&&!e.force)if(O.error("Public Key already exists, use --force to overwrite"),t)B.error("");else return!1;if((0,Da.writeFileSync)(ha,r),(0,Da.existsSync)(Ao)&&!e.force)if(O.error("Private Key already exists, use --force to overwrite"),t)B.error("");else return!1;(0,Da.writeFileSync)(Ao,i);let n=await ge();if(n?.config){n.config.plugins||(n.config.plugins={extConfig:{},CapacitorUpdater:{}}),n.config.plugins.CapacitorUpdater||(n.config.plugins.CapacitorUpdater={});let s=i.replace(/\\n/g,"\\n");n.config.plugins.CapacitorUpdater.privateKey=s,TT(n)}return t&&(O.success("Your RSA key has been generated"),O.success(`Public key saved in ${ha}`),O.success("This key will be use to encrypt your bundle before sending it to Capgo"),O.success("Keep it safe"),O.success("Than make it unreadable by Capgo and unmodifiable by anyone"),O.success(`Private key saved in ${n.path}`),O.success("Your app will be the only one having it"),O.success("Only your users can decrypt your update"),O.success("Only you can send them an update"),ee("Done \u2705")),!0}async function K2e(e){await ct(),await GF(e)}var D6e=require("node:process");var h6e=require("node:process");var m6e=me(P2());async function g6e(e,t,r){let{data:i,error:n}=await e.from("channels").select().eq("app_id",t).eq("version",r.id);if(n&&(O.error(`Cannot check Version ${t}@${r.name}`),B.error("")),i&&i.length>0){if(se(`\u274C Version ${t}@${r.name} is used in ${i.length} channel`),await Xe({message:"unlink it?"}))for(let s of i){let a=$e();a.start(`Unlinking channel ${s.name}`);let{error:o}=await e.from("channels").update({version:(await lN(e,t))?.id}).eq("id",s.id);o&&(a.stop(`Cannot update channel ${s.name} ${ue(o)}`),(0,h6e.exit)(1)),a.stop(`\u2705 Channel ${s.name} unlinked`)}else O.error("Unlink it first"),B.error("");ee(`Version unlinked from ${i.length} channel`)}}function lN(e,t){return e.from("app_versions").select("id").eq("app_id",t).eq("name","unknown").throwOnError().single().then(({data:r,error:i})=>(i&&(O.error(`Cannot call findUnknownVersion as it returned an error.
340
+ ${ue(i)}`),B.error("")),r))}function y6e(e,t){return e.from("channels").insert(t).select().single()}function v6e(e,t,r,i){return e.from("channels").delete().eq("name",t).eq("app_id",r).single()}function w6e(e){let t=new m6e.Table({title:"Channels",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Name:r.name,...r.version?{Version:r.version.name}:void 0,Public:r.public?"\u2705":"\u274C",iOS:r.ios?"\u2705":"\u274C",Android:r.android?"\u2705":"\u274C","\u2B06\uFE0F limit":r.disable_auto_update,"\u2B07\uFE0F under native":r.disable_auto_update_under_native?"\u274C":"\u2705","Self assign":r.allow_device_self_set?"\u2705":"\u274C",Progressive:r.enable_progressive_deploy?"\u2705":"\u274C",...r.enable_progressive_deploy&&r.second_version?{"Next version":r.second_version.name}:void 0,...r.enable_progressive_deploy&&r.second_version?{"Next %":r.secondary_version_percentage}:void 0,"AB Testing":r.enable_ab_testing?"\u2705":"\u274C",...r.enable_ab_testing&&r.second_version?{"Version B":r.second_version.name}:void 0,...r.enable_ab_testing&&r.second_version?{"A/B %":`${(1-r.secondary_version_percentage)*100}% / ${r.secondary_version_percentage*100}%`}:void 0,Emulator:r.allow_emulator?"\u2705":"\u274C","Dev \u{1F4F1}":r.allow_dev?"\u2705":"\u274C"})}),O.success(t.render())}async function _6e(e,t){let{data:r,error:i}=await e.from("channels").select(`
341
341
  id,
342
342
  name,
343
343
  public,
@@ -357,7 +357,7 @@ ${oe(i)}`),B.error("")),r))}function y6e(e,t){return e.from("channels").insert(t
357
357
  app_id,
358
358
  version (id, name)
359
359
  `).eq("app_id",t).order("created_at",{ascending:!1});return i&&(O.error(`App ${t} not found in database`),B.error("")),r}async function cN(e,t,r,i=!0){se("Create channel"),r.apikey=r.apikey||Ae();let n=await ge();t=t||n?.config?.appId;let s=Ht();r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let a=await Ee(r.apikey);await xe(a,r.apikey,["write","all"]),await tt(a,r.apikey,t,4),O.info(`Creating channel ${t}#${e} to Capgo`);try{let o=await lN(a,t),u=await zn(a,t);o||(O.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),B.error(""));let l=await y6e(a,{name:e,app_id:t,version:o.id,owner_org:u});l.error&&(O.error(`Cannot create Channel \u{1F640}
360
- ${oe(l.error)}`),B.error("")),O.success("Channel created \u2705"),await s.track({channel:"channel",event:"Create channel",icon:"\u2705",user_id:u,tags:{"app-id":t,channel:e},notify:!1}).catch()}catch{return O.error("Cannot create Channel \u{1F640}"),!1}return i&&(ee("Done \u2705"),(0,D6e.exit)()),!0}async function b6e(e,t,r){cN(e,t,r,!0)}var L6e=require("node:crypto"),$o=require("node:fs"),B6e=require("node:process"),q6e=require("node:zlib"),j6e=require("node:stream/consumers");var $6e=me(TO()),M6e=me(dN());function I2(e,t,r=0){r=Math.max(0,Math.min(r,t.byteLength));let i=t.byteLength-r;return e.byteLength>i&&(e=e.subarray(0,i)),t.set(e,r),e.byteLength}var Wy=32*1024,pN=2**32-2,Xy=class{#e;#t=0;constructor(t){this.#e=t===void 0?new Uint8Array(0):new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this.#e.subarray(this.#t):this.#e.slice(this.#t)}empty(){return this.#e.byteLength<=this.#t}get length(){return this.#e.byteLength-this.#t}get capacity(){return this.#e.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this.#r(this.#t+t)}reset(){this.#r(0),this.#t=0}#n(t){let r=this.#e.byteLength;return t<=this.capacity-r?(this.#r(r+t),r):-1}#r(t){if(t>this.#e.buffer.byteLength)throw new RangeError("Length is greater than buffer capacity");this.#e=new Uint8Array(this.#e.buffer,0,t)}readSync(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;let r=I2(this.#e.subarray(this.#t),t);return this.#t+=r,r}read(t){let r=this.readSync(t);return Promise.resolve(r)}writeSync(t){let r=this.#i(t.byteLength);return I2(t,this.#e,r)}write(t){let r=this.writeSync(t);return Promise.resolve(r)}#i(t){let r=this.length;r===0&&this.#t!==0&&this.reset();let i=this.#n(t);if(i>=0)return i;let n=this.capacity;if(t<=Math.floor(n/2)-r)I2(this.#e.subarray(this.#t),this.#e);else{if(n+t>pN)throw new Error("The buffer cannot be grown beyond the maximum size.");{let s=new Uint8Array(Math.min(2*n+t,pN));I2(this.#e.subarray(this.#t),s),this.#e=s}}return this.#t=0,this.#r(Math.min(r+t,pN)),r}grow(t){if(t<0)throw Error("Buffer.grow: negative count");let r=this.#i(t);this.#r(r)}async readFrom(t){let r=0,i=new Uint8Array(Wy);for(;;){let n=this.capacity-this.length<Wy,s=n?i:new Uint8Array(this.#e.buffer,this.length),a=await t.read(s);if(a===null)return r;n?this.writeSync(s.subarray(0,a)):this.#r(this.length+a),r+=a}}readFromSync(t){let r=0,i=new Uint8Array(Wy);for(;;){let n=this.capacity-this.length<Wy,s=n?i:new Uint8Array(this.#e.buffer,this.length),a=t.readSync(s);if(a===null)return r;n?this.writeSync(s.subarray(0,a)):this.#r(this.length+a),r+=a}}};var Yy=class extends TransformStream{constructor(t){let r=new Xy;r.grow(t),super({start(){},async transform(i,n){for(r.write(i);r.length>=t;){let s=new Uint8Array(t),a=await r.read(s);if(a!==t)throw new Error(`Unexpectedly read ${a} bytes from transform buffer when trying to read ${t} bytes.`);n.enqueue(s)}},flush(i){r.length&&i.enqueue(r.bytes())}})}};function ol(e){return e=e.trim(),e=e.replace(/<!--[\s\S]*?-->/g,""),t();function t(){return{declaration:r(),root:i()}}function r(){if(!u(/^<\?xml\s*/))return;let p={attributes:{}};for(;!(l()||c("?>"));){let f=s();if(!f)return p;p.attributes[f.name]=f.value}return u(/\?>\s*/),p}function i(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(l()||c(">")||c("?>")||c("/>"));){let h=s();if(!h)return p;p.attributes[h.name]=h.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=n();let f;for(;f=i();)p.children.push(f);return u(/^<\/[\w-:.]+>\s*/),p}function n(){let d=u(/^([^<]*)/);return d?o(d[1]):""}function s(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:o(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function o(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let p=e.match(d);if(p)return e=e.slice(p[0].length),p}function l(){return e.length==0}function c(d){return e.indexOf(d)==0}}var xa=class extends Error{constructor(t){super(t)}};var Zn=class extends xa{},Ky=class extends xa{},Jy=class extends xa{},qo=class extends xa{},Yc=class extends xa{},L2=class extends xa{},B2=class extends xa{},jo=class extends xa{statusCode;code;key;bucketName;resource;region;constructor(t,r,i,n={}){super(i),this.statusCode=t,this.code=r,this.key=n.key,this.bucketName=n.bucketName,this.resource=n.resource,this.region=n.region}};async function C6e(e){try{let r=ol(await e.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let i=r.children.find(l=>l.name==="Code")?.content??"UnknownErrorCode",n=r.children.find(l=>l.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(l=>l.name==="Key")?.content,a=r.children.find(l=>l.name==="BucketName")?.content,o=r.children.find(l=>l.name==="Resource")?.content,u=r.children.find(l=>l.name==="Region")?.content;return new jo(e.status,i,n,{key:s,bucketName:a,resource:o,region:u})}catch{return new jo(e.status,"UnrecognizedError",`Error: Unexpected response code ${e.status} ${e.statusText}. Unable to parse response as XML.`)}}function A6e(e){return typeof e!="number"||isNaN(e)||e<=0?!1:e>=1&&e<=65535}function T6e(e){return typeof e!="string"||e.length<3||e.length>63||e.indexOf("..")>-1||e.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!e.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function Kc(e){return!(!bst(e)||e.length===0)}function bst(e){return!(typeof e!="string"||e.length>1024)}function Zy(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Jc(e=""){let t={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return e.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>t[r])}function hN(e){return e.get("x-amz-version-id")??null}function q2(e){e=e||new Date;let t=e.toISOString();return t.substr(0,4)+t.substr(5,2)+t.substr(8,5)+t.substr(14,2)+t.substr(17,2)+"Z"}function mN(e){e=e||new Date;let t=e.toISOString();return t.substr(0,4)+t.substr(5,2)+t.substr(8,2)}function gN(e,t){return`${mN(t)}/${e}/s3/aws4_request`}async function Qy(e){return e instanceof Uint8Array||(e=new TextEncoder().encode(e)),Zy(new Uint8Array(await crypto.subtle.digest("SHA-256",e)))}var Est=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],e5=class extends WritableStream{getResult;constructor({client:t,bucketName:r,objectName:i,partSize:n,metadata:s}){let a,o=1,u,l=[],c=[];super({start(){},async write(d,p){let f="PUT",h=o++;try{if(h==1&&d.length<n){let y=await t.makeRequest({method:f,headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:i,payload:d});a={etag:Jc(y.headers.get("etag")??void 0),versionId:hN(y.headers)};return}h===1&&(u=(await xst({client:t,bucketName:r,objectName:i,metadata:s})).uploadId);let g={"Content-Length":String(d.length)};for(let y of Est){let x=s[y];x&&(g[y]=x)}let v=t.makeRequest({method:f,query:{partNumber:h.toString(),uploadId:u},headers:new Headers(g),bucketName:r,objectName:i,payload:d});v.then(y=>{let x=y.headers.get("etag")??"";x&&(x=x.replace(/^"/,"").replace(/"$/,"")),l.push({part:h,etag:x})}),c.push(v)}catch(g){throw g}},async close(){if(!a)if(u)await Promise.all(c),l.sort((d,p)=>d.part>p.part?1:-1),a=await Sst({client:t,bucketName:r,objectName:i,uploadId:u,etags:l});else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function xst(e){let t="POST",r=new Headers(e.metadata),s=await(await e.client.makeRequest({method:t,bucketName:e.bucketName,objectName:e.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=ol(s).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let o=a.children.find(u=>u.name==="UploadId")?.content;if(!o)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:o}}async function Sst({client:e,bucketName:t,objectName:r,uploadId:i,etags:n}){let s=`
360
+ ${ue(l.error)}`),B.error("")),O.success("Channel created \u2705"),await s.track({channel:"channel",event:"Create channel",icon:"\u2705",user_id:u,tags:{"app-id":t,channel:e},notify:!1}).catch()}catch{return O.error("Cannot create Channel \u{1F640}"),!1}return i&&(ee("Done \u2705"),(0,D6e.exit)()),!0}async function b6e(e,t,r){cN(e,t,r,!0)}var L6e=require("node:crypto"),$o=require("node:fs"),B6e=require("node:process"),q6e=require("node:zlib"),j6e=require("node:stream/consumers");var $6e=me(TO()),M6e=me(dN());function I2(e,t,r=0){r=Math.max(0,Math.min(r,t.byteLength));let i=t.byteLength-r;return e.byteLength>i&&(e=e.subarray(0,i)),t.set(e,r),e.byteLength}var Wy=32*1024,pN=2**32-2,Xy=class{#e;#t=0;constructor(t){this.#e=t===void 0?new Uint8Array(0):new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this.#e.subarray(this.#t):this.#e.slice(this.#t)}empty(){return this.#e.byteLength<=this.#t}get length(){return this.#e.byteLength-this.#t}get capacity(){return this.#e.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this.#r(this.#t+t)}reset(){this.#r(0),this.#t=0}#n(t){let r=this.#e.byteLength;return t<=this.capacity-r?(this.#r(r+t),r):-1}#r(t){if(t>this.#e.buffer.byteLength)throw new RangeError("Length is greater than buffer capacity");this.#e=new Uint8Array(this.#e.buffer,0,t)}readSync(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;let r=I2(this.#e.subarray(this.#t),t);return this.#t+=r,r}read(t){let r=this.readSync(t);return Promise.resolve(r)}writeSync(t){let r=this.#i(t.byteLength);return I2(t,this.#e,r)}write(t){let r=this.writeSync(t);return Promise.resolve(r)}#i(t){let r=this.length;r===0&&this.#t!==0&&this.reset();let i=this.#n(t);if(i>=0)return i;let n=this.capacity;if(t<=Math.floor(n/2)-r)I2(this.#e.subarray(this.#t),this.#e);else{if(n+t>pN)throw new Error("The buffer cannot be grown beyond the maximum size.");{let s=new Uint8Array(Math.min(2*n+t,pN));I2(this.#e.subarray(this.#t),s),this.#e=s}}return this.#t=0,this.#r(Math.min(r+t,pN)),r}grow(t){if(t<0)throw Error("Buffer.grow: negative count");let r=this.#i(t);this.#r(r)}async readFrom(t){let r=0,i=new Uint8Array(Wy);for(;;){let n=this.capacity-this.length<Wy,s=n?i:new Uint8Array(this.#e.buffer,this.length),a=await t.read(s);if(a===null)return r;n?this.writeSync(s.subarray(0,a)):this.#r(this.length+a),r+=a}}readFromSync(t){let r=0,i=new Uint8Array(Wy);for(;;){let n=this.capacity-this.length<Wy,s=n?i:new Uint8Array(this.#e.buffer,this.length),a=t.readSync(s);if(a===null)return r;n?this.writeSync(s.subarray(0,a)):this.#r(this.length+a),r+=a}}};var Yy=class extends TransformStream{constructor(t){let r=new Xy;r.grow(t),super({start(){},async transform(i,n){for(r.write(i);r.length>=t;){let s=new Uint8Array(t),a=await r.read(s);if(a!==t)throw new Error(`Unexpectedly read ${a} bytes from transform buffer when trying to read ${t} bytes.`);n.enqueue(s)}},flush(i){r.length&&i.enqueue(r.bytes())}})}};function ol(e){return e=e.trim(),e=e.replace(/<!--[\s\S]*?-->/g,""),t();function t(){return{declaration:r(),root:i()}}function r(){if(!u(/^<\?xml\s*/))return;let p={attributes:{}};for(;!(l()||c("?>"));){let f=s();if(!f)return p;p.attributes[f.name]=f.value}return u(/\?>\s*/),p}function i(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(l()||c(">")||c("?>")||c("/>"));){let h=s();if(!h)return p;p.attributes[h.name]=h.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=n();let f;for(;f=i();)p.children.push(f);return u(/^<\/[\w-:.]+>\s*/),p}function n(){let d=u(/^([^<]*)/);return d?o(d[1]):""}function s(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:o(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function o(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let p=e.match(d);if(p)return e=e.slice(p[0].length),p}function l(){return e.length==0}function c(d){return e.indexOf(d)==0}}var xa=class extends Error{constructor(t){super(t)}};var Zn=class extends xa{},Ky=class extends xa{},Jy=class extends xa{},qo=class extends xa{},Yc=class extends xa{},L2=class extends xa{},B2=class extends xa{},jo=class extends xa{statusCode;code;key;bucketName;resource;region;constructor(t,r,i,n={}){super(i),this.statusCode=t,this.code=r,this.key=n.key,this.bucketName=n.bucketName,this.resource=n.resource,this.region=n.region}};async function C6e(e){try{let r=ol(await e.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let i=r.children.find(l=>l.name==="Code")?.content??"UnknownErrorCode",n=r.children.find(l=>l.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(l=>l.name==="Key")?.content,a=r.children.find(l=>l.name==="BucketName")?.content,o=r.children.find(l=>l.name==="Resource")?.content,u=r.children.find(l=>l.name==="Region")?.content;return new jo(e.status,i,n,{key:s,bucketName:a,resource:o,region:u})}catch{return new jo(e.status,"UnrecognizedError",`Error: Unexpected response code ${e.status} ${e.statusText}. Unable to parse response as XML.`)}}function A6e(e){return typeof e!="number"||isNaN(e)||e<=0?!1:e>=1&&e<=65535}function T6e(e){return typeof e!="string"||e.length<3||e.length>63||e.indexOf("..")>-1||e.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!e.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function Kc(e){return!(!bst(e)||e.length===0)}function bst(e){return!(typeof e!="string"||e.length>1024)}function Zy(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Jc(e=""){let t={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return e.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>t[r])}function hN(e){return e.get("x-amz-version-id")??null}function q2(e){e=e||new Date;let t=e.toISOString();return t.substr(0,4)+t.substr(5,2)+t.substr(8,5)+t.substr(14,2)+t.substr(17,2)+"Z"}function mN(e){e=e||new Date;let t=e.toISOString();return t.substr(0,4)+t.substr(5,2)+t.substr(8,2)}function gN(e,t){return`${mN(t)}/${e}/s3/aws4_request`}async function Qy(e){return e instanceof Uint8Array||(e=new TextEncoder().encode(e)),Zy(new Uint8Array(await crypto.subtle.digest("SHA-256",e)))}var Est=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],e5=class extends WritableStream{getResult;constructor({client:t,bucketName:r,objectName:i,partSize:n,metadata:s}){let a,o=1,u,l=[],c=[];super({start(){},async write(d,p){let f="PUT",h=o++;try{if(h==1&&d.length<n){let y=await t.makeRequest({method:f,headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:i,payload:d});a={etag:Jc(y.headers.get("etag")??void 0),versionId:hN(y.headers)};return}h===1&&(u=(await xst({client:t,bucketName:r,objectName:i,metadata:s})).uploadId);let g={"Content-Length":String(d.length)};for(let y of Est){let x=s[y];x&&(g[y]=x)}let v=t.makeRequest({method:f,query:{partNumber:h.toString(),uploadId:u},headers:new Headers(g),bucketName:r,objectName:i,payload:d});v.then(y=>{let x=y.headers.get("etag")??"";x&&(x=x.replace(/^"/,"").replace(/"$/,"")),l.push({part:h,etag:x})}),c.push(v)}catch(g){throw g}},async close(){if(!a)if(u)await Promise.all(c),l.sort((d,p)=>d.part>p.part?1:-1),a=await Sst({client:t,bucketName:r,objectName:i,uploadId:u,etags:l});else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function xst(e){let t="POST",r=new Headers(e.metadata),s=await(await e.client.makeRequest({method:t,bucketName:e.bucketName,objectName:e.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=ol(s).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let o=a.children.find(u=>u.name==="UploadId")?.content;if(!o)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:o}}async function Sst({client:e,bucketName:t,objectName:r,uploadId:i,etags:n}){let s=`
361
361
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
362
362
  ${n.map(d=>` <Part><PartNumber>${d.part}</PartNumber><ETag>${d.etag}</ETag></Part>`).join(`
363
363
  `)}
@@ -367,16 +367,16 @@ ${oe(l.error)}`),B.error("")),O.success("Channel created \u2705"),await s.track(
367
367
  `),u.push(i.join(";").toLowerCase()),u.push(n),u.join(`
368
368
  `)}async function R6e(e,t,r){let i=await Qy(e),n=gN(r,t),s=[];return s.push(yN),s.push(q2(t)),s.push(n),s.push(i),s.join(`
369
369
  `)}async function P6e(e,t,r){let i=mN(e),n=await Qf("AWS4"+r,i),s=await Qf(n,t),a=await Qf(s,"s3");return await Qf(a,"aws4_request")}function I6e(e,t,r){return`${e}/${gN(t,r)}`}async function Qf(e,t){let r=new TextEncoder,i=await crypto.subtle.importKey("raw",e instanceof Uint8Array?e:r.encode(e),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await crypto.subtle.sign("HMAC",i,t instanceof Uint8Array?t:r.encode(t));return new Uint8Array(n)}var Tst=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],Ost=5*1024*1024,Fst=5*1024*1024*1024,vN=5*1024*1024*1024*1024,j2=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;constructor(t){if(t.useSSL===void 0&&(t.useSSL=!0),typeof t.endPoint!="string"||t.endPoint.length===0||t.endPoint.indexOf("/")!==-1)throw new Ky(`Invalid endPoint : ${t.endPoint}`);if(t.port!==void 0&&!A6e(t.port))throw new Zn(`Invalid port : ${t.port}`);if(t.accessKey&&!t.secretKey)throw new Zn("If specifying access key, secret key must also be provided.");if(t.accessKey&&t.accessKey.startsWith("ASIA")&&!t.sessionToken)throw new Zn("If specifying temporary access key, session token must also be provided.");let r=t.useSSL?443:80;this.port=t.port??r,this.host=t.endPoint.toLowerCase()+(this.port!==r?`:${t.port}`:""),this.protocol=t.useSSL?"https:":"http:",this.accessKey=t.accessKey,this.#e=t.secretKey??"",this.sessionToken=t.sessionToken,this.pathStyle=t.pathStyle??!0,this.defaultBucket=t.bucket,this.region=t.region}getBucketName(t){let r=t?.bucketName??this.defaultBucket;if(r===void 0||!T6e(r))throw new Jy(`Invalid bucket name: ${r}`);return r}buildRequestOptions(t){let r=this.getBucketName(t),i=this.pathStyle?this.host:`${r}.${this.host}`,n=t.headers??new Headers;n.set("host",i);let s=typeof t.query=="object"?new URLSearchParams(t.query).toString().replace("+","%20"):t.query,a=(this.pathStyle?`/${r}/${t.objectName}`:`/${t.objectName}`)+(s?`?${s}`:"");return{headers:n,host:i,path:a}}async makeRequest({method:t,payload:r,...i}){let n=new Date,{headers:s,host:a,path:o}=this.buildRequestOptions(i),u=i.statusCode??200;if(t==="POST"||t==="PUT"||t==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),s.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${t} request.`);let l=await Qy(r??new Uint8Array);s.set("x-amz-date",q2(n)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await O6e({headers:s,method:t,path:o,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:n})));let c=`${this.protocol}//${a}${o}`,d=await fetch(c,{method:t,headers:s,body:r});if(d.status!==u)throw d.status>=400?await C6e(d):d.status===301?new jo(d.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new jo(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${u}, got ${d.status} ${d.statusText}).`);return i.returnBody||await d.body?.getReader().read(),d}async deleteObject(t,r={}){let i=this.getBucketName(r);if(!Kc(t))throw new qo(`Invalid object name: ${t}`);let n=r.versionId?{versionId:r.versionId}:{},s=new Headers;r.governanceBypass&&s.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:i,objectName:t,headers:s,query:n,statusCode:204})}async exists(t,r){try{return await this.statObject(t,r),!0}catch(i){if(i instanceof jo&&i.statusCode===404)return!1;throw i}}getObject(t,r){return this.getPartialObject(t,{...r,offset:0,length:0})}async getPartialObject(t,{offset:r,length:i,...n}){let s=this.getBucketName(n);if(!Kc(t))throw new qo(`Invalid object name: ${t}`);let a=new Headers(Object.entries(n.metadata??{})),o=200;if(r||i){let l="";r?l=`bytes=${+r}-`:(l="bytes=0-",r=0),i&&(l+=`${+i+r-1}`),a.set("Range",l),o=206}let u={...n.responseParams,...n.versionId?{versionId:n.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:s,objectName:t,headers:a,query:u,statusCode:o,returnBody:!0})}getPresignedUrl(t,r,i={}){if(!this.accessKey)throw new Yc(`Presigned ${t} URLs cannot be generated for anonymous requests. Specify an accessKey and secretKey.`);if(!Kc(r))throw new qo(`Invalid object name: ${r}`);let{headers:n,path:s}=this.buildRequestOptions({objectName:r,bucketName:i.bucketName,query:i.parameters}),a=i.requestDate??new Date,o=i.expirySeconds??24*60*60*7;return F6e({protocol:this.protocol,headers:n,method:t,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:a,expirySeconds:o})}presignedGetObject(t,r={}){let{versionId:i,responseParams:n,...s}=r,a={...n,...i?{versionId:i}:{}};return this.getPresignedUrl("GET",t,{parameters:a,...s})}async*listObjects(t={}){for await(let r of this.listObjectsGrouped({...t,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(t){let r=this.getBucketName(t),i="",n=t.pageSize??1e3;if(n<1||n>1e3)throw new Zn("pageSize must be between 1 and 1,000.");let s=0;for(;;){let a=t.maxResults?Math.min(n,t.maxResults-s):n;if(a===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:t.prefix??"",delimiter:t.delimiter,"max-keys":String(a),...i?{"continuation-token":i}:{}},returnBody:!0})).text(),l=ol(u).root;if(!l||l.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let c=l.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),d=[];for(let f of c)d.push({type:"CommonPrefix",prefix:f.content??""}),s++;for(let f of l.children.filter(h=>h.name==="Contents"))d.push({type:"Object",key:f.children.find(h=>h.name==="Key")?.content??"",etag:Jc(f.children.find(h=>h.name==="ETag")?.content??""),size:parseInt(f.children.find(h=>h.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(h=>h.name==="LastModified")?.content??"invalid")}),s++;d.sort((f,h)=>{let g=f.type==="Object"?f.key:f.prefix,v=h.type==="Object"?h.key:h.prefix;return g>v?1:g<v?-1:0});for(let f of d)yield f;if(l.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=l.children.find(h=>h.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");i=f}else return}}async putObject(t,r,i){let n=this.getBucketName(i);if(!Kc(t))throw new qo(`Invalid object name: ${t}`);let s,a;if(typeof r=="string"){let c=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([c]):a=new ReadableStream({start(d){d.enqueue(c),d.close()}}),s=c.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(c){c.enqueue(r),c.close()}}),s=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new Zn("Invalid stream/data type provided.");if(i?.size!==void 0){if(s!==void 0&&i?.size!==s)throw new Zn(`size was specified (${i.size}) but doesn't match auto-detected size (${s}).`);if(typeof i.size!="number"||i.size<0||isNaN(i.size))throw new Zn(`invalid size specified: ${i.size}`);s=i.size}let o=i?.partSize??this.calculatePartSize(s);if(o<Ost)throw new Zn("Part size should be greater than 5MB");if(o>Fst)throw new Zn("Part size should be less than 6MB");let u=new Yy(o),l=new e5({client:this,bucketName:n,objectName:t,partSize:o,metadata:i?.metadata??{}});return await a.pipeThrough(u).pipeTo(l),l.getResult()}calculatePartSize(t){if(t===void 0&&(t=vN),t>vN)throw new TypeError(`size should not be more than ${vN}`);let r=64*1024*1024;for(;;){if(r*1e4>t)return r;r+=16*1024*1024}}async statObject(t,r){let i=this.getBucketName(r);if(!Kc(t))throw new qo(`Invalid object name: ${t}`);let n={};r?.versionId&&(n.versionId=r.versionId);let s=await this.makeRequest({method:"HEAD",bucketName:i,objectName:t,query:n}),a={};for(let o of Tst)s.headers.has(o)&&(a[o]=s.headers.get(o));return s.headers.forEach((o,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=s.headers.get(u))}),{type:"Object",key:t,size:parseInt(s.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(s.headers.get("Last-Modified")??"error: missing last modified"),versionId:s.headers.get("x-amz-version-id")||null,etag:Jc(s.headers.get("ETag")??"")}}async copyObject(t,r,i){let n=this.getBucketName(i),s=t.sourceBucketName??n;if(!Kc(r))throw new qo(`Invalid object name: ${r}`);let a=`${s}/${t.sourceKey}`;t.sourceVersionId&&(a+=`?versionId=${t.sourceVersionId}`);let o=new Headers(i?.metadata);i?.metadata!==void 0&&o.set("x-amz-metadata-directive","REPLACE"),o.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:n,objectName:r,headers:o,returnBody:!0}),l=await u.text(),c=ol(l).root;if(!c||c.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${l}`);let d=c.children.find(f=>f.name==="ETag")?.content??"",p=c.children.find(f=>f.name==="LastModified")?.content;if(p===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Jc(d),lastModified:new Date(p),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(t){try{return await this.listObjects({bucketName:t}).next(),!0}catch(r){if(r instanceof jo&&r.statusCode===404)return!1;throw r}}async makeBucket(t){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:t}),objectName:"",statusCode:200})}async removeBucket(t){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:t}),objectName:"",statusCode:204})}};var Nst=20,U6e=12e4;async function kst(e,t){let r=await Ui(),i=t.bundle||e?.plugins?.CapacitorUpdater?.version||r?.version||`0.0.1-beta.${(0,L6e.randomUUID)().split("-")[0]}`;return xf.test(i)||(O.error(`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`),B.error("")),i}function Rst(e){let t=e.apikey||Ae();return t||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t}function Pst(e,t,r){let i=e||r?.appId,n=t.path||r?.webDir;return(!i||!n)&&(O.error("Missing argument, you need to provide a appid and a path (--path), or be in a capacitor project"),B.error("")),(0,$o.existsSync)(n)||(O.error(`Path ${n} does not exist, build your app first, or provide a valid path`),B.error("")),{appid:i,path:n}}function Ist(e,t){let r=e.codeCheck;(typeof r>"u"||r)&&(C2(t,"notifyAppReady")||(O.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),B.error("")),A2(t)||(O.error("index.html is missing in the root folder or in the only folder in the root folder"),B.error("")))}async function Lst(e,t,r,i,n,s){let a=r.ignoreMetadataCheck,o=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:l,error:c}=await e.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",i).eq("app_id",n).single(),d=!!l&&l.disable_auto_update==="version_number",p,f;if(!c&&l&&l.version&&l.version.native_packages&&!a){let v=$e();v.start(`Checking bundle compatibility with channel ${i}`);let{finalCompatibility:y,localDependencies:x}=await W9(e,n,i);if(f=y,p=x,f.find(D=>D.localVersion!==D.remoteVersion))v.stop(`Bundle NOT compatible with ${i} channel`),O.warn(`You can check compatibility with "${t.runner} @capgo/cli bundle compatibility"`),o&&(u=s,O.info(`Auto set min-update-version to ${u}`));else if(o)try{let{minUpdateVersion:D}=l.version;(!D||!xf.test(D))&&(O.error("Invalid remote min update version, skipping auto setting compatibility"),B.error("")),u=D,v.stop(`Auto set min-update-version to ${u}`)}catch{O.error(`Cannot auto set compatibility, invalid data ${l}`),B.error("")}else v.stop(`Bundle compatible with ${i} channel`)}else a||(O.warn(`Channel ${i} is new or it's your first upload with compatibility check, it will be ignored this time`),p=await KT(),o&&(u=s,O.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&(O.error("You need to provide a min-update-version to upload a bundle to this channel"),B.error("")),u&&(xf.test(u)||(O.error(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`),B.error("")));let h=p?new Map(p.filter(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:h.size>0||!r.ignoreMetadataCheck?Array.from(h,([v,y])=>({name:v,version:y.version})):void 0,minUpdateVersion:u}}async function Bst(e,t,r){let{data:i,error:n}=await e.rpc("is_trial_org",{orgid:t}).single();(i&&i>0||n)&&(O.warn(`WARNING !!
370
- Trial expires in ${i} days`),O.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${t}`))}async function qst(e,t,r){let{data:i,error:n}=await e.rpc("exist_app_versions",{appid:t,apikey:"",name_version:r}).single();(i||n)&&(O.error(`Version already exists ${oe(n)}`),B.error(""))}async function jst(e,t,r,i){let n=$e();n.start("Generating the update manifest");let s=await ppe(e);return n.stop("Manifest generated successfully"),await t.track({channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":i},notify:!1}).catch(),s}async function $st(e,t,r,i,n,s){let a=await fpe(e,n,s,t);if(a.length===0||a.length!==t.length)return O.error("Cannot upload manifest, please try again later"),[];for(let o of a){let u=`${r}/${o.path}`,l=(0,$o.createReadStream)(u).pipe((0,q6e.createGzip)({level:9})),c=await(0,j6e.buffer)(l);try{await Ua.put(o.uploadLink,{timeout:i.timeout||U6e,retry:5,body:c})}catch(d){if(d instanceof Ma){let p=await d.response.text();O.error(`Response: ${oe(p)}`)}else console.error(d)}}return O.info("Uploaded all files successfully"),a.map(o=>({file_name:o.path,s3_path:o.finalPath,file_hash:o.hash}))}async function Mst(e,t,r,i,n,s){let a,o="",u=null,l=t.key;u=await z9(e);let c=$e();if(c.start("Calculating checksum"),o=await(0,$6e.checksum)(u,"crc32"),c.stop(`Checksum: ${o}`),!l&&!(0,$o.existsSync)(ha))O.info("Encryption ignored");else if(l||(0,$o.existsSync)(ha)){let p=typeof l=="string"?l:ha,f=t.keyData||"";!f&&!(0,$o.existsSync)(p)&&(O.error(`Cannot find public key ${p}`),M6e.default.isCI&&(O.error("Cannot ask if user wants to use capgo public key on the cli"),B.error("")),await Xe({message:"Do you want to use our public key ?"})||(O.error("Error: Missing public key"),B.error("")),f=r.signKey||""),await i.track({channel:"app",event:"App encryption",icon:"\u{1F511}",user_id:n,tags:{"app-id":s},notify:!1}).catch(),f||(f=(0,$o.readFileSync)(p).toString()),O.info("Encrypting your bundle");let h=Vy(u,f);a=h.ivSessionKey,t.displayIvSession&&O.info(`Your Iv Session key is ${a},
370
+ Trial expires in ${i} days`),O.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${t}`))}async function qst(e,t,r){let{data:i,error:n}=await e.rpc("exist_app_versions",{appid:t,apikey:"",name_version:r}).single();(i||n)&&(O.error(`Version already exists ${ue(n)}`),B.error(""))}async function jst(e,t,r,i){let n=$e();n.start("Generating the update manifest");let s=await ppe(e);return n.stop("Manifest generated successfully"),await t.track({channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":i},notify:!1}).catch(),s}async function $st(e,t,r,i,n,s){let a=await fpe(e,n,s,t);if(a.length===0||a.length!==t.length)return O.error("Cannot upload manifest, please try again later"),[];for(let o of a){let u=`${r}/${o.path}`,l=(0,$o.createReadStream)(u).pipe((0,q6e.createGzip)({level:9})),c=await(0,j6e.buffer)(l);try{await Ua.put(o.uploadLink,{timeout:i.timeout||U6e,retry:5,body:c})}catch(d){if(d instanceof Ma){let p=await d.response.text();O.error(`Response: ${ue(p)}`)}else console.error(d)}}return O.info("Uploaded all files successfully"),a.map(o=>({file_name:o.path,s3_path:o.finalPath,file_hash:o.hash}))}async function Mst(e,t,r,i,n,s){let a,o="",u=null,l=t.key;u=await z9(e);let c=$e();if(c.start("Calculating checksum"),o=await(0,$6e.checksum)(u,"crc32"),c.stop(`Checksum: ${o}`),!l&&!(0,$o.existsSync)(ha))O.info("Encryption ignored");else if(l||(0,$o.existsSync)(ha)){let p=typeof l=="string"?l:ha,f=t.keyData||"";!f&&!(0,$o.existsSync)(p)&&(O.error(`Cannot find public key ${p}`),M6e.default.isCI&&(O.error("Cannot ask if user wants to use capgo public key on the cli"),B.error("")),await Xe({message:"Do you want to use our public key ?"})||(O.error("Error: Missing public key"),B.error("")),f=r.signKey||""),await i.track({channel:"app",event:"App encryption",icon:"\u{1F511}",user_id:n,tags:{"app-id":s},notify:!1}).catch(),f||(f=(0,$o.readFileSync)(p).toString()),O.info("Encrypting your bundle");let h=Vy(u,f);a=h.ivSessionKey,t.displayIvSession&&O.info(`Your Iv Session key is ${a},
371
371
  keep it safe, you will need it to decrypt your bundle.
372
372
  It will be also visible in your dashboard
373
373
  `),u=h.encryptedData}let d=Math.floor((u?.byteLength??0)/1024/1024);return d>Nst&&(O.warn(`WARNING !!
374
374
  The app size is ${d} Mb, this may take a while to download for users
375
375
  `),O.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
376
- `),await i.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":s},notify:!1}).catch()),{zipped:u,sessionKey:a,checksum:o}}async function Ust(e,t,r,i,n,s){let a=$e();a.start("Uploading Bundle");let o=performance.now();try{if(s.multipart!==void 0&&s.multipart)O.info("Uploading bundle as multipart"),await hpe(e,t,r,n,i);else{let c=await dpe(e,t,r);c||(O.error("Cannot get upload url"),B.error("")),await Ua.put(c,{timeout:s.timeout||U6e,retry:5,body:n})}}catch(c){let p=((performance.now()-o)/1e3).toFixed(2);if(a.stop(`Failed to upload bundle ( after ${p} seconds)`),O.error(`Cannot upload bundle ( try again with --multipart option) ${oe(c)}`),c instanceof Ma){let f=await c.response.text();O.error(`Response: ${oe(f)}`)}await mpe(e,t,r),B.error("")}let l=((performance.now()-o)/1e3).toFixed(2);a.stop(`Bundle Uploaded \u{1F4AA} (${l} seconds)`)}async function Vst(e,t,r,i,n,s,a,o,u,l){let{data:c}=await e.rpc("get_app_versions",{apikey:t,name_version:i,appid:o}).single();if(c&&GT(l,3)){let{error:d,data:p}=await G9(e,{name:n,app_id:o,created_by:s,version:c,owner_org:a});d&&(O.error(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${oe(d)}`),B.error(""));let f=Af(o),h=`${u.hostWeb}/app/p/${f}/channel/${p.id}`;p?.public?O.info("Your update is now available in your public channel \u{1F389}"):p?.id&&O.info(`Link device to this bundle to try it: ${h}`),r?O.info(`Bundle url: ${h}`):c?GT(l,3)||O.warn("Cannot set channel as a upload organization member"):(O.warn("Cannot set bundle with upload key, use key with more rights for that"),B.error(""))}}async function t5(e,t,r=!0){se("Uploading");let i=vi();await ct();let{s3Region:n,s3Apikey:s,s3Apisecret:a,s3BucketName:o,s3Endpoint:u,s3Port:l,s3SSL:c}=t,d=Rst(t),p=await ge(),{appid:f,path:h}=Pst(e,t,p.config),g=await kst(p.config,t),v=t.channel||"dev",y=Ht();Ist(t,h),O.info(`Upload ${f}@${g} started from path "${h}" to Capgo cloud`);let x=await Sc(),D=await Ee(d),w=await xe(D,d,["write","all","upload"]),_=await tt(D,d,f,2),A=await zn(D,f);await Sf(D,A,d,f,!0),await Bst(D,A,x);let{nativePackages:C,minUpdateVersion:S}=await Lst(D,i,t,v,f,g);await qst(D,f,g),t.external&&!t.external.startsWith("https://")&&(O.error(`External link should should start with "https://" current is "${external}"`),B.error(""));let T={name:g,app_id:f,session_key:void 0,external_url:t.external,storage_provider:t.external?"external":"r2-direct",min_update_version:S,native_packages:C,owner_org:A,user_id:w,checksum:void 0},E=null;if(t.external)await y.track({channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:A,tags:{"app-id":f},notify:!1}).catch(),T.session_key=t.ivSessionKey;else{let{zipped:L,sessionKey:q,checksum:I}=await Mst(h,t,x,y,A,f);T.session_key=q,T.checksum=I,E=L,t.ignoreChecksumCheck||await ype(D,f,v,I)}let b=await jst(h,y,A,f),{error:k}=await YT(D,T);if(k&&(O.error(`Cannot add bundle ${oe(k)}`),B.error("")),E&&(o||u||n||s||a||l||c)){(!o||!u||!n||!s||!a||!l)&&(O.error("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),B.error("")),O.info("Uploading to S3");let L=new j2({endPoint:u,region:n,port:l,useSSL:c,bucket:o,credentials:{accessKeyId:s,secretAccessKey:a}}),q=`${f}-${g}`,I=encodeURIComponent(q);await L.putObject(q,E),T.external_url=`https://${u}/${I}`,T.storage_provider="external"}else if(E){await Ust(D,f,g,A,E,t);let L=null;try{L=await $st(D,b,h,t,f,g)}catch(I){O.error(`Failed to upload partial files to capgo cloud. Error: ${oe(I)}`)}T.storage_provider="r2",T.manifest=L;let{error:q}=await YT(D,T);q&&(O.error(`Cannot update bundle ${oe(q)}`),B.error(""))}return await Vst(D,d,!!t.bundleUrl,g,v,w,A,f,x,_),await y.track({channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:A,tags:{"app-id":f},notify:!1}).catch(),r&&(ee("Time to share your update to the world \u{1F30D}"),(0,B6e.exit)()),!0}async function V6e(e,t){try{await t5(e,t,!0)}catch(r){O.error(oe(r)),B.error("")}}async function H6e(e,t){let r=vi();O.warn(`\u26A0\uFE0F This command is deprecated, use "${r.runner} @capgo/cli bundle upload" instead \u26A0\uFE0F`);try{await t5(e,t,!0)}catch(i){O.error(oe(i)),B.error("")}}var Mo=require("node:fs"),_N=require("node:os"),wN=require("node:process");async function z6e(){let e=(0,_N.homedir)();return(0,Mo.existsSync)(`${e}/.capgo`)||(0,Mo.existsSync)(".capgo")}async function DN(e,t,r=!0){if(r&&se("Login to Capgo"),!e)return r&&(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),!1;await ct();try{let{local:i}=t,n=Ht();if(i)(0,Mo.existsSync)(".git")||(O.error("To use local you should be in a git repository"),B.error("")),(0,Mo.writeFileSync)(".capgo",`${e}
376
+ `),await i.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":s},notify:!1}).catch()),{zipped:u,sessionKey:a,checksum:o}}async function Ust(e,t,r,i,n,s){let a=$e();a.start("Uploading Bundle");let o=performance.now();try{if(s.multipart!==void 0&&s.multipart)O.info("Uploading bundle as multipart"),await hpe(e,t,r,n,i);else{let c=await dpe(e,t,r);c||(O.error("Cannot get upload url"),B.error("")),await Ua.put(c,{timeout:s.timeout||U6e,retry:5,body:n})}}catch(c){let p=((performance.now()-o)/1e3).toFixed(2);if(a.stop(`Failed to upload bundle ( after ${p} seconds)`),O.error(`Cannot upload bundle ( try again with --multipart option) ${ue(c)}`),c instanceof Ma){let f=await c.response.text();O.error(`Response: ${ue(f)}`)}await mpe(e,t,r),B.error("")}let l=((performance.now()-o)/1e3).toFixed(2);a.stop(`Bundle Uploaded \u{1F4AA} (${l} seconds)`)}async function Vst(e,t,r,i,n,s,a,o,u,l){let{data:c}=await e.rpc("get_app_versions",{apikey:t,name_version:i,appid:o}).single();if(c&&GT(l,3)){let{error:d,data:p}=await G9(e,{name:n,app_id:o,created_by:s,version:c,owner_org:a});d&&(O.error(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${ue(d)}`),B.error(""));let f=Af(o),h=`${u.hostWeb}/app/p/${f}/channel/${p.id}`;p?.public?O.info("Your update is now available in your public channel \u{1F389}"):p?.id&&O.info(`Link device to this bundle to try it: ${h}`),r?O.info(`Bundle url: ${h}`):c?GT(l,3)||O.warn("Cannot set channel as a upload organization member"):(O.warn("Cannot set bundle with upload key, use key with more rights for that"),B.error(""))}}async function t5(e,t,r=!0){se("Uploading");let i=vi();await ct();let{s3Region:n,s3Apikey:s,s3Apisecret:a,s3BucketName:o,s3Endpoint:u,s3Port:l,s3SSL:c}=t,d=Rst(t),p=await ge(),{appid:f,path:h}=Pst(e,t,p.config),g=await kst(p.config,t),v=t.channel||"dev",y=Ht();Ist(t,h),O.info(`Upload ${f}@${g} started from path "${h}" to Capgo cloud`);let x=await Sc(),D=await Ee(d),w=await xe(D,d,["write","all","upload"]),_=await tt(D,d,f,2),A=await zn(D,f);await Sf(D,A,d,f,!0),await Bst(D,A,x);let{nativePackages:C,minUpdateVersion:S}=await Lst(D,i,t,v,f,g);await qst(D,f,g),t.external&&!t.external.startsWith("https://")&&(O.error(`External link should should start with "https://" current is "${external}"`),B.error(""));let T={name:g,app_id:f,session_key:void 0,external_url:t.external,storage_provider:t.external?"external":"r2-direct",min_update_version:S,native_packages:C,owner_org:A,user_id:w,checksum:void 0},E=null;if(t.external)await y.track({channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:A,tags:{"app-id":f},notify:!1}).catch(),T.session_key=t.ivSessionKey;else{let{zipped:L,sessionKey:q,checksum:I}=await Mst(h,t,x,y,A,f);T.session_key=q,T.checksum=I,E=L,t.ignoreChecksumCheck||await ype(D,f,v,I)}let b=t.ignorePartial?null:await jst(h,y,A,f),{error:k}=await YT(D,T);if(k&&(O.error(`Cannot add bundle ${ue(k)}`),B.error("")),E&&(o||u||n||s||a||l||c)){(!o||!u||!n||!s||!a||!l)&&(O.error("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),B.error("")),O.info("Uploading to S3");let L=new j2({endPoint:u,region:n,port:l,useSSL:c,bucket:o,credentials:{accessKeyId:s,secretAccessKey:a}}),q=`${f}-${g}`,I=encodeURIComponent(q);await L.putObject(q,E),T.external_url=`https://${u}/${I}`,T.storage_provider="external"}else if(E){await Ust(D,f,g,A,E,t);let L=null;try{L=t.ignorePartial?null:await $st(D,b,h,t,f,g)}catch(I){O.error(`Failed to upload partial files to capgo cloud. Error: ${ue(I)}`)}T.storage_provider="r2",T.manifest=L;let{error:q}=await YT(D,T);q&&(O.error(`Cannot update bundle ${ue(q)}`),B.error(""))}return await Vst(D,d,!!t.bundleUrl,g,v,w,A,f,x,_),await y.track({channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:A,tags:{"app-id":f},notify:!1}).catch(),r&&(ee("Time to share your update to the world \u{1F30D}"),(0,B6e.exit)()),!0}async function V6e(e,t){try{await t5(e,t,!0)}catch(r){O.error(ue(r)),B.error("")}}async function H6e(e,t){let r=vi();O.warn(`\u26A0\uFE0F This command is deprecated, use "${r.runner} @capgo/cli bundle upload" instead \u26A0\uFE0F`);try{await t5(e,t,!0)}catch(i){O.error(ue(i)),B.error("")}}var Mo=require("node:fs"),_N=require("node:os"),wN=require("node:process");async function z6e(){let e=(0,_N.homedir)();return(0,Mo.existsSync)(`${e}/.capgo`)||(0,Mo.existsSync)(".capgo")}async function DN(e,t,r=!0){if(r&&se("Login to Capgo"),!e)return r&&(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),!1;await ct();try{let{local:i}=t,n=Ht();if(i)(0,Mo.existsSync)(".git")||(O.error("To use local you should be in a git repository"),B.error("")),(0,Mo.writeFileSync)(".capgo",`${e}
377
377
  `),(0,Mo.appendFileSync)(".gitignore",`.capgo
378
378
  `);else{let o=(0,_N.homedir)();(0,Mo.writeFileSync)(`${o}/.capgo`,`${e}
379
- `)}let s=await Ee(e),a=await xe(s,e,["write","all","upload"]);await n.track({channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:a,notify:!1}).catch(),O.success(`login saved into .capgo file in ${i?"local":"home"} directory`)}catch{O.error("Error while saving login"),(0,wN.exit)(1)}return r&&(ee("Done \u2705"),(0,wN.exit)()),!0}async function G6e(e,t){DN(e,t,!0)}var r1=require("node:fs"),J6e=require("node:process");var W6e={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(W6e);var X6e=W6e;var Y6e={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(Y6e);var K6e=Y6e;var Qn=function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)},e1,$2,Qc,bN=class{constructor(...t){e1.set(this,new Map),$2.set(this,new Map),Qc.set(this,new Map);for(let r of t)this.define(r)}define(t,r=!1){for(let[i,n]of Object.entries(t)){i=i.toLowerCase(),n=n.map(o=>o.toLowerCase()),Qn(this,Qc,"f").has(i)||Qn(this,Qc,"f").set(i,new Set);let s=Qn(this,Qc,"f").get(i),a=!0;for(let o of n){let u=o.startsWith("*");if(o=u?o.slice(1):o,s?.add(o),a&&Qn(this,$2,"f").set(i,o),a=!1,u)continue;let l=Qn(this,e1,"f").get(o);if(l&&l!=i&&!r)throw new Error(`"${i} -> ${o}" conflicts with "${l} -> ${o}". Pass \`force=true\` to override this definition.`);Qn(this,e1,"f").set(o,i)}}return this}getType(t){if(typeof t!="string")return null;let r=t.replace(/^.*[/\\]/,"").toLowerCase(),i=r.replace(/^.*\./,"").toLowerCase(),n=r.length<t.length;return!(i.length<r.length-1)&&n?null:Qn(this,e1,"f").get(i)??null}getExtension(t){return typeof t!="string"?null:(t=t?.split?.(";")[0],(t&&Qn(this,$2,"f").get(t.trim().toLowerCase()))??null)}getAllExtensions(t){return typeof t!="string"?null:Qn(this,Qc,"f").get(t.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let t of Qn(this,Qc,"f").values())Object.freeze(t);return this}_getTestState(){return{types:Qn(this,e1,"f"),extensions:Qn(this,$2,"f")}}};e1=new WeakMap,$2=new WeakMap,Qc=new WeakMap;var EN=bN;var t1=new EN(K6e,X6e)._freeze();async function Hst(e,t,r=!0){await xN(e,t,void 0,r)}async function xN(e,t,r,i=!0){i&&se("Adding"),await ct(),t.apikey=t.apikey||Ae();let n=await ge();e=e||n?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error("")),e.includes("--")&&(O.error('The app id includes illegal symbols. You cannot use "--" in the app id'),B.error(""));let s=await Ee(t.apikey);await xe(s,t.apikey,["write","all"]),await U2e(s,e)&&(O.error(`App ${e} already exist`),B.error("")),r||(r=await Cf(s,["admin","super_admin"]));let o=r.gid;await Sf(s,o,t.apikey,void 0,!1);let{name:u,icon:l}=t;u=u||n.config?.appName||"Unknown",l=l||"resources/icon.png",(!l||!u)&&(O.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),B.error("")),i&&O.info(`Adding ${e} to Capgo`);let c,d;l&&(0,r1.existsSync)(l)?(c=(0,r1.readFileSync)(l),d=t1.getType(l)||"image/png",O.warn(`Found app icon ${l}`)):(0,r1.existsSync)(Kn)?(c=(0,r1.readFileSync)(Kn),d=t1.getType(Kn)||"image/png",O.warn(`Found app icon ${Kn}`)):O.warn(`Cannot find app icon in any of the following locations: ${l}, ${Kn}`);let p="icon",f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&d){let{error:v}=await s.storage.from(`images/org/${o}/${e}`).upload(p,c,{contentType:d});v&&(console.error(v),O.error(`Could not add app ${oe(v)}`),B.error(""));let{data:y}=await s.storage.from(`images/org/${o}/${e}`).getPublicUrl(p);f=y?.publicUrl||f}let{error:h}=await s.from("apps").insert({icon_url:f,owner_org:o,name:u,app_id:e});h&&(O.error(`Could not add app ${oe(h)}`),B.error(""));let{error:g}=await s.from("app_versions").insert([{owner_org:o,deleted:!0,name:"unknown",app_id:e},{owner_org:o,deleted:!0,name:"builtin",app_id:e}]);return g&&(O.error(`Could not add app ${oe(g)}`),B.error("")),O.success(`App ${e} added to Capgo. ${i?"You can upload a bundle now":""}`),i&&(ee("Done \u2705"),(0,J6e.exit)()),!0}async function Z6e(e,t){Hst(e,t,!0)}var Q6e="import { CapacitorUpdater } from '@capgo/capacitor-updater'",r5="CapacitorUpdater.notifyAppReady()",zst=/import.*from.*/g,M2="production",e4e={stdio:"pipe"},i1;function t4e(){i1||(i1=(0,Sr.readdirSync)(n5.default.tmpdir).map(e=>({name:e,full:`${n5.default.tmpdir}/${e}`})).find(e=>e.name.startsWith("capgocli"))?.full??n5.default.fileSync({prefix:"capgocli"}).name)}function ul(e){try{t4e(),(0,Sr.writeFileSync)(i1,JSON.stringify({step_done:e}))}catch(t){O.error(`Cannot mark step as done in the CLI, error:
379
+ `)}let s=await Ee(e),a=await xe(s,e,["write","all","upload"]);await n.track({channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:a,notify:!1}).catch(),O.success(`login saved into .capgo file in ${i?"local":"home"} directory`)}catch{O.error("Error while saving login"),(0,wN.exit)(1)}return r&&(ee("Done \u2705"),(0,wN.exit)()),!0}async function G6e(e,t){DN(e,t,!0)}var r1=require("node:fs"),J6e=require("node:process");var W6e={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(W6e);var X6e=W6e;var Y6e={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(Y6e);var K6e=Y6e;var Qn=function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)},e1,$2,Qc,bN=class{constructor(...t){e1.set(this,new Map),$2.set(this,new Map),Qc.set(this,new Map);for(let r of t)this.define(r)}define(t,r=!1){for(let[i,n]of Object.entries(t)){i=i.toLowerCase(),n=n.map(o=>o.toLowerCase()),Qn(this,Qc,"f").has(i)||Qn(this,Qc,"f").set(i,new Set);let s=Qn(this,Qc,"f").get(i),a=!0;for(let o of n){let u=o.startsWith("*");if(o=u?o.slice(1):o,s?.add(o),a&&Qn(this,$2,"f").set(i,o),a=!1,u)continue;let l=Qn(this,e1,"f").get(o);if(l&&l!=i&&!r)throw new Error(`"${i} -> ${o}" conflicts with "${l} -> ${o}". Pass \`force=true\` to override this definition.`);Qn(this,e1,"f").set(o,i)}}return this}getType(t){if(typeof t!="string")return null;let r=t.replace(/^.*[/\\]/,"").toLowerCase(),i=r.replace(/^.*\./,"").toLowerCase(),n=r.length<t.length;return!(i.length<r.length-1)&&n?null:Qn(this,e1,"f").get(i)??null}getExtension(t){return typeof t!="string"?null:(t=t?.split?.(";")[0],(t&&Qn(this,$2,"f").get(t.trim().toLowerCase()))??null)}getAllExtensions(t){return typeof t!="string"?null:Qn(this,Qc,"f").get(t.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let t of Qn(this,Qc,"f").values())Object.freeze(t);return this}_getTestState(){return{types:Qn(this,e1,"f"),extensions:Qn(this,$2,"f")}}};e1=new WeakMap,$2=new WeakMap,Qc=new WeakMap;var EN=bN;var t1=new EN(K6e,X6e)._freeze();async function Hst(e,t,r=!0){await xN(e,t,void 0,r)}async function xN(e,t,r,i=!0){i&&se("Adding"),await ct(),t.apikey=t.apikey||Ae();let n=await ge();e=e||n?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error("")),e.includes("--")&&(O.error('The app id includes illegal symbols. You cannot use "--" in the app id'),B.error(""));let s=await Ee(t.apikey);await xe(s,t.apikey,["write","all"]),await U2e(s,e)&&(O.error(`App ${e} already exist`),B.error("")),r||(r=await Cf(s,["admin","super_admin"]));let o=r.gid;await Sf(s,o,t.apikey,void 0,!1);let{name:u,icon:l}=t;u=u||n.config?.appName||"Unknown",l=l||"resources/icon.png",(!l||!u)&&(O.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),B.error("")),i&&O.info(`Adding ${e} to Capgo`);let c,d;l&&(0,r1.existsSync)(l)?(c=(0,r1.readFileSync)(l),d=t1.getType(l)||"image/png",O.warn(`Found app icon ${l}`)):(0,r1.existsSync)(Kn)?(c=(0,r1.readFileSync)(Kn),d=t1.getType(Kn)||"image/png",O.warn(`Found app icon ${Kn}`)):O.warn(`Cannot find app icon in any of the following locations: ${l}, ${Kn}`);let p="icon",f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&d){let{error:v}=await s.storage.from(`images/org/${o}/${e}`).upload(p,c,{contentType:d});v&&(console.error(v),O.error(`Could not add app ${ue(v)}`),B.error(""));let{data:y}=await s.storage.from(`images/org/${o}/${e}`).getPublicUrl(p);f=y?.publicUrl||f}let{error:h}=await s.from("apps").insert({icon_url:f,owner_org:o,name:u,app_id:e});h&&(O.error(`Could not add app ${ue(h)}`),B.error(""));let{error:g}=await s.from("app_versions").insert([{owner_org:o,deleted:!0,name:"unknown",app_id:e},{owner_org:o,deleted:!0,name:"builtin",app_id:e}]);return g&&(O.error(`Could not add app ${ue(g)}`),B.error("")),O.success(`App ${e} added to Capgo. ${i?"You can upload a bundle now":""}`),i&&(ee("Done \u2705"),(0,J6e.exit)()),!0}async function Z6e(e,t){Hst(e,t,!0)}var Q6e="import { CapacitorUpdater } from '@capgo/capacitor-updater'",r5="CapacitorUpdater.notifyAppReady()",zst=/import.*from.*/g,M2="production",e4e={stdio:"pipe"},i1;function t4e(){i1||(i1=(0,Sr.readdirSync)(n5.default.tmpdir).map(e=>({name:e,full:`${n5.default.tmpdir}/${e}`})).find(e=>e.name.startsWith("capgocli"))?.full??n5.default.fileSync({prefix:"capgocli"}).name)}function ul(e){try{t4e(),(0,Sr.writeFileSync)(i1,JSON.stringify({step_done:e}))}catch(t){O.error(`Cannot mark step as done in the CLI, error:
380
380
  ${t}`),O.warn("Onboarding will continue but please report it to the capgo team!")}}async function Gst(e,t){try{t4e();let r=(0,Sr.readFileSync)(i1,"utf-8");if(!r||r.length===0)return;let{step_done:i}=JSON.parse(r);O.info(`You have already got to the step ${i}/10 in the previous session`);let n=await Xe({message:"Would you like to continue from where you left off?"});return await Sa(n,e,t),n?i:void 0}catch(r){O.error(`Cannot read which steps have been compleated, error:
381
381
  ${r}`),O.warn("Onboarding will continue but please report it to the capgo team!");return}}function Wst(){if(i1)try{(0,Sr.rmSync)(i1)}catch(e){O.error(`Cannot delete the tmp steps file.
382
382
  Error: ${e}`)}}async function Sa(e,t,r){Gi(e)&&(await Lo("onboarding-v2",t,r,"canceled","\u{1F937}"),(0,pn.exit)())}async function xs(e,t,r){return Lo("onboarding-v2",e,t,`onboarding-step-${r}`)}async function Xst(e,t,r,i){let n=vi(),s=await Xe({message:`Add ${r} in Capgo?`});if(await Sa(s,e.gid,t),s){let a=$e();a.start(`Running: ${n.runner} @capgo/cli@latest app add ${r}`),await xN(r,i,e,!1)?a.stop("App add Done \u2705"):a.stop("App already add \u2705")}else O.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest app add ${r}"`);await xs(e.gid,t,2)}async function Yst(e,t,r,i){let n=vi(),s=await Xe({message:`Create default channel ${M2} for ${i} in Capgo?`});if(await Sa(s,e,t),s){let a=$e();a.start(`Running: ${n.runner} @capgo/cli@latest channel add ${M2} ${i} --default`),await cN(M2,i,{default:!0,apikey:r},!1)?a.stop("Channel add Done \u2705"):a.stop("Channel already added \u2705")}else O.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${M2} ${i} --default"`);await xs(e,t,3)}var Kst="https://capacitorjs.com/docs/updating/6-0",Jst="https://capacitorjs.com/docs/updating/5-0";async function Zst(e,t,r,i){let n=vi(),s=await Xe({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${i}?`});if(await Sa(s,e,t),s){let a=$e();a.start("Checking if @capgo/capacitor-updater is installed");let o="latest",u=await Ui(),l=u.dependencies["@capacitor/core"]||u.devDependencies["@capacitor/core"];l=l?.replace("^","").replace("~",""),l?SN.default.lt(l,"5.0.0")?(a.stop("Error"),O.warn(`@capacitor/core version is ${l}, please update to Capacitor v5 first: ${Jst}`),ee("Bye \u{1F44B}"),(0,pn.exit)()):SN.default.lt(l,"6.0.0")&&(a.stop(`@capacitor/core version is ${l}, please update to Capacitor v6: ${Kst} to access the best features of Capgo`),o="^5.0.0"):(a.stop("Error"),O.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),ee("Bye \u{1F44B}"),(0,pn.exit)()),n.pm==="unknown"&&(a.stop("Error"),O.warn("Cannot reconize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),ee("Bye \u{1F44B}"),(0,pn.exit)()),u.dependencies["@capgo/capacitor-updater"]?a.stop("Capgo already installed \u2705"):(await(0,U2.execSync)(`${n.installCommand} @capgo/capacitor-updater@${o}`,e4e),a.stop("Install Done \u2705"))}else O.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);await xs(e,t,4)}async function Qst(e,t,r,i){let n=await Xe({message:`Automatic Add "${r5}" code and import in ${i}?`});if(await Sa(n,e,t),n){let s=$e();s.start("Adding @capacitor-updater to your main file");let a=await XT();if(a==="nuxtjs-js"||a==="nuxtjs-ts"){let o=(0,i5.join)("plugins");(0,Sr.existsSync)(o)||(0,Sr.mkdirSync)(o,{recursive:!0});let u;a==="nuxtjs-ts"?u=(0,i5.join)(o,"capacitorUpdater.client.ts"):u=(0,i5.join)(o,"capacitorUpdater.client.js");let l=`
@@ -394,7 +394,7 @@ ${r5};
394
394
  ${Q6e};
395
395
 
396
396
  ${r5};
397
- `)}async function eat(e,t,r,i){let n=vi(),s=await Xe({message:`Automatic configure end-to-end encryption in ${i} updates?`});if(await Sa(s,e,t),s){let a=$e();a.start(`Running: ${n.runner} @capgo/cli@latest key create`),await GF({force:!0},!1)?a.stop("key created \u{1F511}"):(a.stop("Error"),O.warn("Cannot create key \u274C"),ee("Bye \u{1F44B}"),(0,pn.exit)(1)),Lo("onboarding-v2",e,t,"Use encryption")}await xs(e,t,6)}async function tat(e,t,r,i){let n=vi(),s=await Xe({message:`Automatic build ${i} with "${n.pm} run build" ?`});if(await Sa(s,e,t),s){let a=$e(),o=await XT(),u=await lpe(o);a.start(`Running: ${n.pm} run ${u} && ${n.runner} cap sync`),(await Ui()).scripts[u]||(a.stop("Error"),O.warn(`Cannot find ${u} script in package.json, please add it and run \`capgo init\` again`),ee("Bye \u{1F44B}"),(0,pn.exit)()),(0,U2.execSync)(`${n.pm} run ${u} && ${n.runner} cap sync`,e4e),a.stop("Build & Sync Done \u2705")}else O.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await xs(e,t,7)}async function rat(e,t,r,i){let n=vi(),s=await Xe({message:`Automatic upload ${i} bundle to Capgo?`});if(await Sa(s,e,t),s){let a=$e();a.start(`Running: ${n.runner} @capgo/cli@latest bundle upload`),await t5(i,{channel:M2,apikey:r},!1)?a.stop("Upload Done \u2705"):(a.stop("Error"),O.warn("Upload failed \u274C"),ee("Bye \u{1F44B}"),(0,pn.exit)())}else O.info(`Upload yourself with command: ${n.runner} @capgo/cli@latest bundle upload`);await xs(e,t,8)}async function iat(e,t){let r=vi(),i=await Xe({message:"Run in device now ?"});if(await Sa(i,e,t),i){let n=await rd({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});Gi(n)&&(ee("Bye \u{1F44B}"),(0,pn.exit)());let s=n,a=$e();a.start(`Running: ${r.runner} cap run ${s}`),await(0,U2.spawnSync)(r.runner,["cap","run",s],{stdio:"inherit"}),a.stop("Started Done \u2705")}else O.info(`If you change your mind, run it for yourself with: ${r.runner} cap run <ios|android>`);await xs(e,t,9)}async function nat(e,t,r,i){let n=await Xe({message:"Automatic check if update working in device ?"});if(await Sa(n,e,t),n)O.info(`Wait logs sent to Capgo from ${i} device, Please open your app \u{1F4AA}`),await zF("onboarding-v2",r,i,t,e);else{let s=Af(i);O.info(`Check logs in https://web.capgo.app/app/p/${s}/logs to see if update works.`)}await xs(e,t,10)}async function r4e(e,t,r){let i=vi();se("Capgo onboarding \u{1F6EB}"),await ct();let n=Ht(),s=await ge();t=t||s?.config?.appId;let a=e||Ae(),o=$e();(!z6e()||e)&&(o.start(`Running: ${i.runner} @capgo/cli@latest login ***`),await DN(a,r,!1),o.stop("Login Done \u2705"));let u=await Ee(a);await xe(u,a,["upload","all","read","write"]);let l=await Cf(u,["admin","super_admin"]),c=l.gid,d=await Gst(c,n)??0;try{d<1&&await xs(c,n,1),d<2&&(await Xst(l,n,t,r),ul(2)),d<3&&(await Yst(c,n,a,t),ul(3)),d<4&&(await Zst(c,n,a,t),ul(4)),d<5&&(await Qst(c,n,a,t),ul(5)),d<6&&(await eat(c,n,a,t),ul(6)),d<7&&(await tat(c,n,a,t),ul(7)),d<8&&(await rat(c,n,a,t),ul(8)),d<9&&(await iat(c,n),ul(9)),await nat(c,n,a,t),await xs(c,n,0),Wst()}catch(p){console.error(p),O.error("Error during onboarding, please try again later"),(0,pn.exit)(1)}O.info("Welcome onboard \u2708\uFE0F!"),O.info("Your Capgo update system is setup"),O.info(`Next time use \`${i.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),O.info(`If you have any issue try to use the debug command \`${i.runner} @capgo/cli@latest app debug\``),ee("Bye \u{1F44B}"),(0,pn.exit)()}var u4e=require("node:process");var s4e=require("node:process");var a4e=me(P2());var i4e=require("node:process");async function n4e(e,t,r){let{data:i,error:n}=await e.from("devices_override").select().eq("app_id",t).eq("version",r.id);if(n&&(O.error(`Cannot check Device override ${t}@${r.name}`),B.error("")),i&&i.length>0)if(se(`\u274C Version ${t}@${r.name} is used in ${i.length} device override`),await Xe({message:"unlink it?"}))for(let s of i){let a=$e();a.start(`Unlinking device ${s.device_id}`);let{error:o}=await e.from("devices_override").delete().eq("device_id",s.device_id);o&&(a.stop(`Cannot unlink device ${s.device_id} ${oe(o)}`),(0,i4e.exit)(1)),a.stop(`\u2705 Device ${s.device_id} unlinked`)}else O.error("Unlink it first"),B.error("")}async function sat(e,t,r){let{error:i}=await e.from("app_versions").update({deleted:!0}).eq("app_id",t).eq("deleted",!1).eq("name",r);i&&(O.error(`App Version ${t}@${r} not found in database`),B.error(""))}async function s5(e,t,r){let i=await aat(e,t,r);await g6e(e,t,i),await n4e(e,t,i),await sat(e,t,r)}function a5(e){e.length||(O.error("No bundle found"),(0,s4e.exit)(1));let t=new a4e.Table({title:"Bundles",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Version:r.name,Created:Tf(r.created_at),...r.keep!=null?{Keep:r.keep}:{}})}),O.success(t.render())}async function o5(e,t){let{data:r,error:i}=await e.from("app_versions").select().eq("app_id",t).eq("deleted",!1).order("created_at",{ascending:!1});return i&&(O.error(`App ${t} not found in database`),B.error("")),r}async function o4e(e,t){let{data:r,error:i}=await e.from("channels").select("version").eq("app_id",t);return i&&(O.error(`App ${t} not found in database`),B.error("")),r.map(n=>n.version)}async function aat(e,t,r){let{data:i,error:n}=await e.from("app_versions").select().eq("app_id",t).eq("name",r).eq("deleted",!1).single();return(!i||n)&&(O.error(`App Version ${t}@${r} doesn't exist`),B.error("")),i}async function l4e(e,t){se("List bundles"),await ct(),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appid, or be in a capacitor project"),B.error(""));let i=await Ee(t.apikey);await xe(i,t.apikey,["write","all","read","upload"]),O.info(`Querying available versions of: ${e} in Capgo`),await tt(i,t.apikey,e,1);let n=await o5(i,e);O.info(`Active versions in Capgo: ${n?.length}`),a5(n),ee("Done \u2705"),(0,u4e.exit)()}var Ca=require("node:fs"),c4e=require("node:process");async function d4e(e,t,r){se("Decrypt zip file"),await ct(),(0,Ca.existsSync)(e)||(O.error(`Zip not found at the path ${e}`),B.error(""));let i=await ge();!r.key&&!(0,Ca.existsSync)(Ao)&&!i.config.plugins?.CapacitorUpdater?.privateKey&&(O.error(`Private Key not found at the path ${Ao} or in ${i.path}`),B.error(""));let n=r.key||Ao,s=i.config.plugins?.CapacitorUpdater?.privateKey;!(0,Ca.existsSync)(n)&&!s?(O.error(`Cannot find public key ${n} or as keyData option or in ${i.path}`),B.error("")):(0,Ca.existsSync)(n)&&(s=(0,Ca.readFileSync)(n).toString());let a=(0,Ca.readFileSync)(e),o=W2e(a,t,r.keyData??s??"");(0,Ca.writeFileSync)(`${e}_decrypted.zip`,o),ee(`Decrypted zip file at ${e}_decrypted.zip`),(0,c4e.exit)()}var Uo=require("node:fs"),p4e=require("node:process");var f4e=me(dN());async function h4e(e,t){se("Encryption"),await ct();let r=await Sc();(0,Uo.existsSync)(e)||(O.error(`Error: Zip not found at the path ${e}`),B.error(""));let i=t.key||ha,n=t.keyData||"";!(0,Uo.existsSync)(i)&&!n?(O.warning(`Cannot find public key ${i} or as keyData option`),f4e.default.isCI&&(O.error("Error: Missing public key"),B.error("")),await Xe({message:"Do you want to use our public key ?"})||(O.error("Error: Missing public key"),B.error("")),n=r.signKey||""):(0,Uo.existsSync)(i)&&(n=(0,Uo.readFileSync)(i).toString());let s=(0,Uo.readFileSync)(e),a=Vy(s,n);O.success(`ivSessionKey: ${a.ivSessionKey}`),(0,Uo.writeFileSync)(`${e}_encrypted.zip`,a.encryptedData),O.success(`Encrypted zip saved at ${e}_encrypted.zip`),ee("Done \u2705"),(0,p4e.exit)()}var n1=require("node:process"),u5=require("node:os"),m4e=me(LF());async function oat(e){let t={},r=[];for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.push((0,m4e.default)(i));return await Promise.all(r).then(i=>{let n=Object.keys(e);for(let s=0;s<i.length;s+=1){let a=i[s];a&&(t[n[s]]=a)}}),t}async function uat(){let{dependencies:e}=await Ui(),t={"@capgo/cli":Vo.version};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r.startsWith("@capgo/")&&r.startsWith("@capawesome/")&&r.startsWith("capacitor")){let i=e[r].replace("^","").replace("~","");t[r]=i}return t}async function g4e(){O.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let e=await ge(),t=await Ui(),r=e?.config?.plugins?.CapacitorUpdater?.version||t?.version,i=e?.config?.appName||"";O.info(` App Name: ${i}`);let n=e?.config?.appId||"";O.info(` App ID: ${n}`),O.info(` App Version: ${r}`);let s=e?.config?.webDir||"";O.info(` Web Dir: ${s}`),O.info(` OS: ${(0,u5.platform)()} ${(0,u5.version)()}`),O.info(` Node: ${n1.version}`),O.info(" Installed Dependencies:");let a=await uat();Object.keys(a).length===0&&(O.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),(0,n1.exit)(1));for(let l in a)if(Object.prototype.hasOwnProperty.call(a,l)){let c=a[l];O.info(` ${l}: ${c}`)}let o=$e();o.start("Running: Loading latest dependencies");let u=await oat(a);o.stop("Latest Dependencies:");for(let l in u)if(Object.prototype.hasOwnProperty.call(u,l)){let c=u[l];O.info(` ${l}: ${c}`)}JSON.stringify(a)!==JSON.stringify(u)&&(O.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),(0,n1.exit)(1)),O.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),(0,n1.exit)()}var y4e=require("node:process");async function v4e(e,t,r){se("Delete bundle"),r.apikey=r.apikey||Ae();let i=await ge();t=t||i?.config?.appId,r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(r.apikey);await xe(n,r.apikey,["write","all"]),await tt(n,r.apikey,t,3),r.apikey||(O.error("Missing API key, you need to provide an API key to delete your app"),B.error("")),e||(O.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error("")),O.info(`Deleting bundle ${t}@${e} from Capgo`),await s5(n,t,e),O.success(`Bundle ${t}@${e} deleted in Capgo`),ee("Done"),(0,y4e.exit)()}var _4e=require("node:process");var w4e=["major","minor","metadata","patch","none"];async function D4e(e,t,r){se("Set channel"),r.apikey=r.apikey||Ae();let i=await ge();t=t||i?.config?.appId;let n=Ht();r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let s=await Ee(r.apikey),a=await xe(s,r.apikey,["write","all"]);await tt(s,r.apikey,t,4);let o=await zn(s,t),{bundle:u,state:l,downgrade:c,latest:d,upgrade:p,ios:f,android:h,selfAssign:g,disableAutoUpdate:v,dev:y,emulator:x}=r;e||(O.error("Missing argument, you need to provide a channel"),B.error("")),d&&u&&(O.error("Cannot set latest and bundle at the same time"),B.error("")),u==null&&l==null&&d==null&&c==null&&p==null&&f==null&&h==null&&g==null&&y==null&&x==null&&v==null&&(O.error("Missing argument, you need to provide a option to set"),B.error(""));try{await Sf(s,o,r.apikey,t);let D={created_by:a,app_id:t,name:e,owner_org:o,version:void 0},w=await Ui(),_=d?w?.version:u;if(_!=null){let{data:A,error:C}=await s.from("app_versions").select().eq("app_id",t).eq("name",_).eq("user_id",a).eq("deleted",!1).single();(C||!A)&&(O.error(`Cannot find version ${_}`),B.error("")),O.info(`Set ${t} channel: ${e} to @${_}`),D.version=A.id}if(l!=null&&((l==="public"||l==="private")&&O.info(`Set ${t} channel: ${e} to public or private is deprecated, use default or normal instead`),O.info(`Set ${t} channel: ${e} to ${l==="public"||l==="default"?"default":"normal"}`),D.public=l==="public"||l==="default"),c!=null&&(O.info(`Set ${t} channel: ${e} to ${c?"allow":"disallow"} downgrade`),D.disable_auto_update_under_native=!c),f!=null&&(O.info(`Set ${t} channel: ${e} to ${f?"allow":"disallow"} ios update`),D.ios=!!f),h!=null&&(O.info(`Set ${t} channel: ${e} to ${h?"allow":"disallow"} android update`),D.android=!!h),g!=null&&(O.info(`Set ${t} channel: ${e} to ${g?"allow":"disallow"} self assign to this channel`),D.allow_device_self_set=!!g),v!=null){let A=v.toLocaleLowerCase();w4e.includes(A)||(O.error(`Channel strategy ${A} is not known. The possible values are: ${w4e.join(", ")}.`),B.error("")),A==="metadata"&&(A="version_number"),D.disable_auto_update=A,O.info(`Set ${t} channel: ${e} to ${A} disable update strategy to this channel`)}try{let{error:A}=await G9(s,D);A&&(O.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),B.error(""))}catch{O.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),B.error("")}await n.track({channel:"channel",event:"Set channel",icon:"\u2705",user_id:o,tags:{"app-id":t},notify:!1}).catch()}catch(D){O.error(`Unknow error ${oe(D)}`),B.error("")}ee("Done \u2705"),(0,_4e.exit)()}var b4e=require("node:process");async function E4e(e,t,r){let{quiet:i}=r;i||se("List current bundle"),r.apikey=r.apikey||Ae(i);let n=await ge();t=t||n?.config?.appId,r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let s=await Ee(r.apikey),a=await xe(s,r.apikey,["write","all","read"]);await tt(s,r.apikey,t,1),e||(O.error("Please provide a channel to get the bundle from."),B.error(""));let{data:o,error:u}=await s.from("channels").select("version ( name )").eq("name",e).eq("app_id",t).limit(1);(u||o.length===0)&&(O.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),B.error(""));let{version:l}=o[0];l||(O.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),B.error("")),i?O.info(l.name):O.info(`Current bundle for channel ${e} is ${l.name}`),(0,b4e.exit)()}var CN=require("node:process");var x4e=me(P2());function lat(e){e.length||(O.error("No apps found"),(0,CN.exit)(1));let t=new x4e.Table({title:"Apps",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Name:r.name,id:r.app_id,Created:Tf(r.created_at)})}),O.success(t.render())}async function cat(e){let{data:t,error:r}=await e.from("apps").select().order("created_at",{ascending:!1});return r&&(O.error("Apps not found"),B.error("")),t}async function S4e(e){se("List apps in Capgo"),await ct(),e.apikey=e.apikey||Ae();let t=await Ee(e.apikey);await xe(t,e.apikey,["write","all","read","upload"]),O.info("Getting active bundle in Capgo");let r=await cat(t);O.info(`Active app in Capgo: ${r?.length}`),lat(r),ee("Done \u2705"),(0,CN.exit)()}var AN=require("node:process");var l5=me(A4e());async function dat(e,t,r){for await(let i of e)O.warn(`Removing ${i.name} created on ${Tf(i.created_at)}`),await s5(t,r,i.name)}function pat(e,t,r){let i=[];return e?.forEach(n=>{l5.default.gte(n.name,t)&&l5.default.lt(n.name,`${r}`)&&i.push(n)}),i}async function T4e(e,t){se("Cleanup versions in Capgo"),await ct(),t.apikey=t.apikey||Ae();let{bundle:r,keep:i=4}=t,n=t.force||!1,s=await ge();e=e||s?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide an API key to delete your app"),B.error("")),e||(O.error("Missing argument, you need to provide a appid, or be in a capacitor project"),B.error(""));let a=await Ee(t.apikey);await xe(a,t.apikey,["write","all"]),await tt(a,t.apikey,e,3),O.info("Querying all available versions in Capgo");let o=await o5(a,e),u=await o4e(a,e);if(O.info(`Total active versions in Capgo: ${o?.length}`),o?.length===0){O.error("No versions found, aborting cleanup");return}if(r){let d=`${l5.default.inc(r,"major")}`;O.info(`Querying available versions in Capgo between ${r} and ${d}`),o=pat(o,r,d),O.info(`Active versions in Capgo between ${r} and ${d}: ${o?.length}`)}let l=[],c=0;if(o.forEach(d=>{let p=u.find(f=>f===d.id);c<i||p?(p?d.keep="\u2705 (Linked to channel)":d.keep="\u2705",c+=1):(d.keep="\u274C",l.push(d))}),l.length===0){O.warn("Nothing to be removed, aborting removal...");return}if(a5(o),!n){let d=await Xe({message:"Do you want to continue removing the versions specified?"});(Gi(d)||!d)&&(O.warn("Not confirmed, aborting removal..."),(0,AN.exit)())}O.success("You have confirmed removal, removing versions now"),await dat(l,a,e),ee("Done \u2705"),(0,AN.exit)()}var O4e=require("node:process");async function F4e(e,t,r){se("Delete channel"),r.apikey=r.apikey||Ae();let i=await ge();t=t||i?.config?.appId;let n=Ht();r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let s=await Ee(r.apikey),a=await xe(s,r.apikey,["write","all"]);await tt(s,r.apikey,t,4),O.info(`Deleting channel ${t}#${e} from Capgo`);try{let o=await v6e(s,e,t,a);o.error&&(O.error(`Cannot delete Channel \u{1F640} ${oe(o.error)}`),B.error(""));let u=await zn(s,t);O.success("Channel deleted"),await n.track({channel:"channel",event:"Delete channel",icon:"\u2705",user_id:u,tags:{"user-id":a,"app-id":t,channel:e},notify:!1}).catch()}catch{O.error("Cannot delete Channel \u{1F640}")}ee("Done \u2705"),(0,O4e.exit)()}var N4e=require("node:process");async function k4e(e,t){se("List channels"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let i=Ht();t.apikey||O.error("Missing API key, you need to provide a API key to upload your bundle"),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey),s=await xe(n,t.apikey,["write","all","read","upload"]);await tt(n,t.apikey,e,1),O.info("Querying available channels in Capgo");let a=await _6e(n,e);O.info(`Active channels in Capgo: ${a?.length}`),w6e(a),await i.track({channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(),ee("Done \u2705"),(0,N4e.exit)()}var R4e=require("node:crypto"),s1=require("node:fs"),P4e=require("node:process");async function I4e(e,t){se("Set app"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let i=await Ee(t.apikey),s=(await Cf(i,["admin","super_admin"])).gid,a=await xe(i,t.apikey,["write","all"]);await tt(i,t.apikey,e,4);let{name:o,icon:u,retention:l}=t;l&&Number.isNaN(Number(l))?(O.error("retention value must be a number"),B.error("")):l&&l<0&&(O.error("retention value cannot be less than 0"),B.error(""));let c,d,p=`icon_${(0,R4e.randomUUID)()}`,f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(u&&(0,s1.existsSync)(u)?(c=(0,s1.readFileSync)(u),d=t1.getType(u)||"image/png",O.warn(`Found app icon ${u}`)):(0,s1.existsSync)(Kn)?(c=(0,s1.readFileSync)(Kn),d=t1.getType(Kn)||"image/png",O.warn(`Found app icon ${Kn}`)):O.warn(`Cannot find app icon in any of the following locations: ${u}, ${Kn}`),c&&d){let{error:g}=await i.storage.from(`images/org/${s}/${e}`).upload(p,c,{contentType:d});g&&(O.error(`Could not set app ${oe(g)}`),B.error(""));let{data:v}=await i.storage.from(`images/org/${s}/${e}`).getPublicUrl(p);f=v?.publicUrl||f}let{error:h}=await i.from("apps").update({icon_url:f,name:o,retention:l?l*24*60*60:void 0}).eq("app_id",e).eq("user_id",a);h&&(O.error(`Could not set app ${oe(h)}`),B.error("")),ee("Done \u2705"),(0,P4e.exit)()}var L4e=require("node:process");async function B4e(e,t){se("Deleting"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let i=Ht();t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey),s=await xe(n,t.apikey,["write","all"]);await tt(n,t.apikey,e,5);let{data:a,error:o}=await n.from("apps").select("owner_org ( created_by, id )").eq("app_id",e).single(),u=a;if(!o&&(u?.owner_org.created_by??"")!==s){O.warn("Deleting the app is not recomended for users that are not the organization owner"),O.warn("You are invited as a super_admin but your are not the owner"),O.warn("It's strongly recomended that you do not continue!");let f=await rd({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});(Gi(f)||f==="no")&&(O.error("Canceled deleting the app, exiting"),B.error(""))}else o&&O.warn(`Cannot get the app owner ${oe(o)}`);let{error:l}=await n.storage.from("images").remove([`org/${u?.owner_org.id}/${e}/icon`]);l&&(console.error(l,`images/org/${u?.owner_org.id}/${e}`),O.error("Could not delete app logo"));let{error:c}=await n.storage.from(`apps/${e}/${s}`).remove(["versions"]);c&&O.error("Could not delete app version");let{error:d}=await n.from("apps").delete().eq("app_id",e);d&&(O.error("Could not delete app"),B.error(""));let p=await zn(n,e);await i.track({channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:p,tags:{"app-id":e},notify:!1}).catch(),O.success("App deleted in Capgo"),ee("Done \u2705"),(0,L4e.exit)()}var q4e=me(P2());async function j4e(e,t){se("Check compatibility"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let{channel:i}=t;i||(O.error("Missing argument, you need to provide a channel"),B.error("")),t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey);await xe(n,t.apikey,["write","all","read","upload"]),await tt(n,t.apikey,e,1);let{finalCompatibility:s}=await W9(n,e,i),a=new q4e.Table({title:"Compatibility",charLength:{"\u274C":2,"\u2705":2}}),o=t.text?"Yes":"\u2705",u=t.text?"No":"\u274C";s.forEach(l=>{let{name:c,localVersion:d,remoteVersion:p}=l;a.addRow({Package:c,"Local version":d??"None","Remote version":p??"None",Compatible:p===d?o:u})}),O.success(a.render())}B.name(Vo.name).description("Manage packages and bundle versions in Capgo Cloud").version(Vo.version);B.command("login [apikey]").alias("l").description("Save apikey to your machine or folder").action(G6e).option("--local","Only save in local folder");B.command("doctor").description("Get info about your Capgo app install").action(g4e);B.command("init [apikey] [appId]").description("Init a new app").action(r4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");var V2=B.command("app").description("Manage app");V2.command("add [appId]").alias("a").description("Add a new app in Capgo Cloud").action(Z6e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");V2.command("delete [appId]").description("Delete an app in Capgo Cloud").action(B4e).option("-a, --apikey <apikey>","apikey to link to your account");V2.command("list").alias("l").description("list apps in Capgo Cloud").action(S4e).option("-a, --apikey <apikey>","apikey to link to your account");V2.command("debug [appId]").description("Listen for live updates event in Capgo Cloud to debug your app").option("-a, --apikey <apikey>","apikey to link to your account").option("-d, --device <device>","the specific device to debug").action(V2e);V2.command("set [appId]").alias("s").description("Set an app in Capgo Cloud").action(I4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account").option("-r, --retention <retention>","retention period of app bundle in days");var ll=B.command("bundle").description("Manage bundle");ll.command("upload [appId]").alias("u").description("Upload a new bundle in Capgo Cloud").action(V6e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the iv and session key for bundle url external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","Apikey for your S3 endpoint").option("--s3-apisecret <apisecret>","Api secret for your S3 endpoint").option("--s3-endoint <s3Endpoint>","Url of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","base64 public signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the bundle to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","Uses multipart protocol to upload data to S3");ll.command("compatibility [appId]").action(j4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-c, --channel <channel>","channel to check the compatibility with").option("--text","output text instead of emojis");ll.command("delete [bundleId] [appId]").alias("d").description("Delete a bundle in Capgo Cloud").action(v4e).option("-a, --apikey <apikey>","apikey to link to your account");ll.command("list [appId]").alias("l").description("List bundle in Capgo Cloud").action(l4e).option("-a, --apikey <apikey>","apikey to link to your account");ll.command("cleanup [appId]").alias("c").action(T4e).description("Cleanup bundle in Capgo Cloud").option("-b, --bundle <bundle>","bundle version number of the app to delete").option("-a, --apikey <apikey>","apikey to link to your account").option("-k, --keep <keep>","number of version to keep").option("-f, --force","force removal");ll.command("decrypt [zipPath] [sessionKey]").description("Decrypt a signed zip bundle").action(d4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","base64 private signing key");ll.command("encrypt [zipPath]").description("Encrypt a zip bundle").action(h4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","base64 private signing key");ll.command("zip [appId]").description("Zip a bundle").action(S2e).option("-p, --path <path>","path of the folder to upload").option("-b, --bundle <bundle>","bundle version number to name the zip file").option("-n, --name <name>","name of the zip file").option("-j, --json","output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder");var H2=B.command("channel").description("Manage channel");H2.command("add [channelId] [appId]").alias("a").description("Create channel").action(b6e).option("-d, --default","set the channel as default").option("-a, --apikey <apikey>","apikey to link to your account");H2.command("delete [channelId] [appId]").alias("d").description("Delete channel").action(F4e).option("-a, --apikey <apikey>","apikey to link to your account");H2.command("list [appId]").alias("l").description("List channel").action(k4e).option("-a, --apikey <apikey>","apikey to link to your account");H2.command("currentBundle [channel] [appId]").description("Get current bundle for specific channel in Capgo Cloud").action(E4e).option("-c, --channel <channel>","channel to get the current bundle from").option("-a, --apikey <apikey>","apikey to link to your account").option("--quiet","only print the bundle version");H2.command("set [channelId] [appId]").alias("s").description("Set channel").action(D4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-b, --bundle <bundle>","bundle version number of the file to set").option("-s, --state <state>","set the state of the channel, default or normal").option("--latest","get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--upgrade","Allow to upgrade to version above native one").option("--no-upgrade","Disable upgrade to version above native one").option("--ios","Allow sending update to ios devices").option("--no-ios","Disable sending update to ios devices").option("--android","Allow sending update to android devices").option("--no-android","Disable sending update to android devices").option("--self-assign","Allow to device to self assign to this channel").option("--no-self-assign","Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices");var $4e=B.command("key").description("Manage key");$4e.command("save").description("Save base64 signing key in capacitor config, usefull for CI").action(Y2e).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");$4e.command("create").description("Create a new signing key").action(K2e).option("-f, --force","force generate a new one");B.command("upload [appId]").alias("u").description("(Deprecated) Upload a new bundle to Capgo Cloud").action(H6e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","base64 public signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the file to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel");var fat=B.command("account").description("Manage account");fat.command("id").description("Get your account ID").action(vpe).option("-a, --apikey <apikey>","apikey to link to your account");B.parseAsync();
397
+ `)}async function eat(e,t,r,i){let n=vi(),s=await Xe({message:`Automatic configure end-to-end encryption in ${i} updates?`});if(await Sa(s,e,t),s){let a=$e();a.start(`Running: ${n.runner} @capgo/cli@latest key create`),await GF({force:!0},!1)?a.stop("key created \u{1F511}"):(a.stop("Error"),O.warn("Cannot create key \u274C"),ee("Bye \u{1F44B}"),(0,pn.exit)(1)),Lo("onboarding-v2",e,t,"Use encryption")}await xs(e,t,6)}async function tat(e,t,r,i){let n=vi(),s=await Xe({message:`Automatic build ${i} with "${n.pm} run build" ?`});if(await Sa(s,e,t),s){let a=$e(),o=await XT(),u=await lpe(o);a.start(`Running: ${n.pm} run ${u} && ${n.runner} cap sync`),(await Ui()).scripts[u]||(a.stop("Error"),O.warn(`Cannot find ${u} script in package.json, please add it and run \`capgo init\` again`),ee("Bye \u{1F44B}"),(0,pn.exit)()),(0,U2.execSync)(`${n.pm} run ${u} && ${n.runner} cap sync`,e4e),a.stop("Build & Sync Done \u2705")}else O.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await xs(e,t,7)}async function rat(e,t,r,i){let n=vi(),s=await Xe({message:`Automatic upload ${i} bundle to Capgo?`});if(await Sa(s,e,t),s){let a=$e();a.start(`Running: ${n.runner} @capgo/cli@latest bundle upload`),await t5(i,{channel:M2,apikey:r},!1)?a.stop("Upload Done \u2705"):(a.stop("Error"),O.warn("Upload failed \u274C"),ee("Bye \u{1F44B}"),(0,pn.exit)())}else O.info(`Upload yourself with command: ${n.runner} @capgo/cli@latest bundle upload`);await xs(e,t,8)}async function iat(e,t){let r=vi(),i=await Xe({message:"Run in device now ?"});if(await Sa(i,e,t),i){let n=await rd({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});Gi(n)&&(ee("Bye \u{1F44B}"),(0,pn.exit)());let s=n,a=$e();a.start(`Running: ${r.runner} cap run ${s}`),await(0,U2.spawnSync)(r.runner,["cap","run",s],{stdio:"inherit"}),a.stop("Started Done \u2705")}else O.info(`If you change your mind, run it for yourself with: ${r.runner} cap run <ios|android>`);await xs(e,t,9)}async function nat(e,t,r,i){let n=await Xe({message:"Automatic check if update working in device ?"});if(await Sa(n,e,t),n)O.info(`Wait logs sent to Capgo from ${i} device, Please open your app \u{1F4AA}`),await zF("onboarding-v2",r,i,t,e);else{let s=Af(i);O.info(`Check logs in https://web.capgo.app/app/p/${s}/logs to see if update works.`)}await xs(e,t,10)}async function r4e(e,t,r){let i=vi();se("Capgo onboarding \u{1F6EB}"),await ct();let n=Ht(),s=await ge();t=t||s?.config?.appId;let a=e||Ae(),o=$e();(!z6e()||e)&&(o.start(`Running: ${i.runner} @capgo/cli@latest login ***`),await DN(a,r,!1),o.stop("Login Done \u2705"));let u=await Ee(a);await xe(u,a,["upload","all","read","write"]);let l=await Cf(u,["admin","super_admin"]),c=l.gid,d=await Gst(c,n)??0;try{d<1&&await xs(c,n,1),d<2&&(await Xst(l,n,t,r),ul(2)),d<3&&(await Yst(c,n,a,t),ul(3)),d<4&&(await Zst(c,n,a,t),ul(4)),d<5&&(await Qst(c,n,a,t),ul(5)),d<6&&(await eat(c,n,a,t),ul(6)),d<7&&(await tat(c,n,a,t),ul(7)),d<8&&(await rat(c,n,a,t),ul(8)),d<9&&(await iat(c,n),ul(9)),await nat(c,n,a,t),await xs(c,n,0),Wst()}catch(p){console.error(p),O.error("Error during onboarding, please try again later"),(0,pn.exit)(1)}O.info("Welcome onboard \u2708\uFE0F!"),O.info("Your Capgo update system is setup"),O.info(`Next time use \`${i.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),O.info(`If you have any issue try to use the debug command \`${i.runner} @capgo/cli@latest app debug\``),ee("Bye \u{1F44B}"),(0,pn.exit)()}var u4e=require("node:process");var s4e=require("node:process");var a4e=me(P2());var i4e=require("node:process");async function n4e(e,t,r){let{data:i,error:n}=await e.from("devices_override").select().eq("app_id",t).eq("version",r.id);if(n&&(O.error(`Cannot check Device override ${t}@${r.name}`),B.error("")),i&&i.length>0)if(se(`\u274C Version ${t}@${r.name} is used in ${i.length} device override`),await Xe({message:"unlink it?"}))for(let s of i){let a=$e();a.start(`Unlinking device ${s.device_id}`);let{error:o}=await e.from("devices_override").delete().eq("device_id",s.device_id);o&&(a.stop(`Cannot unlink device ${s.device_id} ${ue(o)}`),(0,i4e.exit)(1)),a.stop(`\u2705 Device ${s.device_id} unlinked`)}else O.error("Unlink it first"),B.error("")}async function sat(e,t,r){let{error:i}=await e.from("app_versions").update({deleted:!0}).eq("app_id",t).eq("deleted",!1).eq("name",r);i&&(O.error(`App Version ${t}@${r} not found in database`),B.error(""))}async function s5(e,t,r){let i=await aat(e,t,r);await g6e(e,t,i),await n4e(e,t,i),await sat(e,t,r)}function a5(e){e.length||(O.error("No bundle found"),(0,s4e.exit)(1));let t=new a4e.Table({title:"Bundles",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Version:r.name,Created:Tf(r.created_at),...r.keep!=null?{Keep:r.keep}:{}})}),O.success(t.render())}async function o5(e,t){let{data:r,error:i}=await e.from("app_versions").select().eq("app_id",t).eq("deleted",!1).order("created_at",{ascending:!1});return i&&(O.error(`App ${t} not found in database`),B.error("")),r}async function o4e(e,t){let{data:r,error:i}=await e.from("channels").select("version").eq("app_id",t);return i&&(O.error(`App ${t} not found in database`),B.error("")),r.map(n=>n.version)}async function aat(e,t,r){let{data:i,error:n}=await e.from("app_versions").select().eq("app_id",t).eq("name",r).eq("deleted",!1).single();return(!i||n)&&(O.error(`App Version ${t}@${r} doesn't exist`),B.error("")),i}async function l4e(e,t){se("List bundles"),await ct(),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appid, or be in a capacitor project"),B.error(""));let i=await Ee(t.apikey);await xe(i,t.apikey,["write","all","read","upload"]),O.info(`Querying available versions of: ${e} in Capgo`),await tt(i,t.apikey,e,1);let n=await o5(i,e);O.info(`Active versions in Capgo: ${n?.length}`),a5(n),ee("Done \u2705"),(0,u4e.exit)()}var Ca=require("node:fs"),c4e=require("node:process");async function d4e(e,t,r){se("Decrypt zip file"),await ct(),(0,Ca.existsSync)(e)||(O.error(`Zip not found at the path ${e}`),B.error(""));let i=await ge();!r.key&&!(0,Ca.existsSync)(Ao)&&!i.config.plugins?.CapacitorUpdater?.privateKey&&(O.error(`Private Key not found at the path ${Ao} or in ${i.path}`),B.error(""));let n=r.key||Ao,s=i.config.plugins?.CapacitorUpdater?.privateKey;!(0,Ca.existsSync)(n)&&!s?(O.error(`Cannot find public key ${n} or as keyData option or in ${i.path}`),B.error("")):(0,Ca.existsSync)(n)&&(s=(0,Ca.readFileSync)(n).toString());let a=(0,Ca.readFileSync)(e),o=W2e(a,t,r.keyData??s??"");(0,Ca.writeFileSync)(`${e}_decrypted.zip`,o),ee(`Decrypted zip file at ${e}_decrypted.zip`),(0,c4e.exit)()}var Uo=require("node:fs"),p4e=require("node:process");var f4e=me(dN());async function h4e(e,t){se("Encryption"),await ct();let r=await Sc();(0,Uo.existsSync)(e)||(O.error(`Error: Zip not found at the path ${e}`),B.error(""));let i=t.key||ha,n=t.keyData||"";!(0,Uo.existsSync)(i)&&!n?(O.warning(`Cannot find public key ${i} or as keyData option`),f4e.default.isCI&&(O.error("Error: Missing public key"),B.error("")),await Xe({message:"Do you want to use our public key ?"})||(O.error("Error: Missing public key"),B.error("")),n=r.signKey||""):(0,Uo.existsSync)(i)&&(n=(0,Uo.readFileSync)(i).toString());let s=(0,Uo.readFileSync)(e),a=Vy(s,n);O.success(`ivSessionKey: ${a.ivSessionKey}`),(0,Uo.writeFileSync)(`${e}_encrypted.zip`,a.encryptedData),O.success(`Encrypted zip saved at ${e}_encrypted.zip`),ee("Done \u2705"),(0,p4e.exit)()}var n1=require("node:process"),u5=require("node:os"),m4e=me(LF());async function oat(e){let t={},r=[];for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.push((0,m4e.default)(i));return await Promise.all(r).then(i=>{let n=Object.keys(e);for(let s=0;s<i.length;s+=1){let a=i[s];a&&(t[n[s]]=a)}}),t}async function uat(){let{dependencies:e}=await Ui(),t={"@capgo/cli":Vo.version};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r.startsWith("@capgo/")&&r.startsWith("@capawesome/")&&r.startsWith("capacitor")){let i=e[r].replace("^","").replace("~","");t[r]=i}return t}async function g4e(){O.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let e=await ge(),t=await Ui(),r=e?.config?.plugins?.CapacitorUpdater?.version||t?.version,i=e?.config?.appName||"";O.info(` App Name: ${i}`);let n=e?.config?.appId||"";O.info(` App ID: ${n}`),O.info(` App Version: ${r}`);let s=e?.config?.webDir||"";O.info(` Web Dir: ${s}`),O.info(` OS: ${(0,u5.platform)()} ${(0,u5.version)()}`),O.info(` Node: ${n1.version}`),O.info(" Installed Dependencies:");let a=await uat();Object.keys(a).length===0&&(O.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),(0,n1.exit)(1));for(let l in a)if(Object.prototype.hasOwnProperty.call(a,l)){let c=a[l];O.info(` ${l}: ${c}`)}let o=$e();o.start("Running: Loading latest dependencies");let u=await oat(a);o.stop("Latest Dependencies:");for(let l in u)if(Object.prototype.hasOwnProperty.call(u,l)){let c=u[l];O.info(` ${l}: ${c}`)}JSON.stringify(a)!==JSON.stringify(u)&&(O.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),(0,n1.exit)(1)),O.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),(0,n1.exit)()}var y4e=require("node:process");async function v4e(e,t,r){se("Delete bundle"),r.apikey=r.apikey||Ae();let i=await ge();t=t||i?.config?.appId,r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(r.apikey);await xe(n,r.apikey,["write","all"]),await tt(n,r.apikey,t,3),r.apikey||(O.error("Missing API key, you need to provide an API key to delete your app"),B.error("")),e||(O.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error("")),O.info(`Deleting bundle ${t}@${e} from Capgo`),await s5(n,t,e),O.success(`Bundle ${t}@${e} deleted in Capgo`),ee("Done"),(0,y4e.exit)()}var _4e=require("node:process");var w4e=["major","minor","metadata","patch","none"];async function D4e(e,t,r){se("Set channel"),r.apikey=r.apikey||Ae();let i=await ge();t=t||i?.config?.appId;let n=Ht();r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let s=await Ee(r.apikey),a=await xe(s,r.apikey,["write","all"]);await tt(s,r.apikey,t,4);let o=await zn(s,t),{bundle:u,state:l,downgrade:c,latest:d,upgrade:p,ios:f,android:h,selfAssign:g,disableAutoUpdate:v,dev:y,emulator:x}=r;e||(O.error("Missing argument, you need to provide a channel"),B.error("")),d&&u&&(O.error("Cannot set latest and bundle at the same time"),B.error("")),u==null&&l==null&&d==null&&c==null&&p==null&&f==null&&h==null&&g==null&&y==null&&x==null&&v==null&&(O.error("Missing argument, you need to provide a option to set"),B.error(""));try{await Sf(s,o,r.apikey,t);let D={created_by:a,app_id:t,name:e,owner_org:o,version:void 0},w=await Ui(),_=d?w?.version:u;if(_!=null){let{data:A,error:C}=await s.from("app_versions").select().eq("app_id",t).eq("name",_).eq("user_id",a).eq("deleted",!1).single();(C||!A)&&(O.error(`Cannot find version ${_}`),B.error("")),O.info(`Set ${t} channel: ${e} to @${_}`),D.version=A.id}if(l!=null&&((l==="public"||l==="private")&&O.info(`Set ${t} channel: ${e} to public or private is deprecated, use default or normal instead`),O.info(`Set ${t} channel: ${e} to ${l==="public"||l==="default"?"default":"normal"}`),D.public=l==="public"||l==="default"),c!=null&&(O.info(`Set ${t} channel: ${e} to ${c?"allow":"disallow"} downgrade`),D.disable_auto_update_under_native=!c),f!=null&&(O.info(`Set ${t} channel: ${e} to ${f?"allow":"disallow"} ios update`),D.ios=!!f),h!=null&&(O.info(`Set ${t} channel: ${e} to ${h?"allow":"disallow"} android update`),D.android=!!h),g!=null&&(O.info(`Set ${t} channel: ${e} to ${g?"allow":"disallow"} self assign to this channel`),D.allow_device_self_set=!!g),v!=null){let A=v.toLocaleLowerCase();w4e.includes(A)||(O.error(`Channel strategy ${A} is not known. The possible values are: ${w4e.join(", ")}.`),B.error("")),A==="metadata"&&(A="version_number"),D.disable_auto_update=A,O.info(`Set ${t} channel: ${e} to ${A} disable update strategy to this channel`)}try{let{error:A}=await G9(s,D);A&&(O.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),B.error(""))}catch{O.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),B.error("")}await n.track({channel:"channel",event:"Set channel",icon:"\u2705",user_id:o,tags:{"app-id":t},notify:!1}).catch()}catch(D){O.error(`Unknow error ${ue(D)}`),B.error("")}ee("Done \u2705"),(0,_4e.exit)()}var b4e=require("node:process");async function E4e(e,t,r){let{quiet:i}=r;i||se("List current bundle"),r.apikey=r.apikey||Ae(i);let n=await ge();t=t||n?.config?.appId,r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let s=await Ee(r.apikey),a=await xe(s,r.apikey,["write","all","read"]);await tt(s,r.apikey,t,1),e||(O.error("Please provide a channel to get the bundle from."),B.error(""));let{data:o,error:u}=await s.from("channels").select("version ( name )").eq("name",e).eq("app_id",t).limit(1);(u||o.length===0)&&(O.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),B.error(""));let{version:l}=o[0];l||(O.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),B.error("")),i?O.info(l.name):O.info(`Current bundle for channel ${e} is ${l.name}`),(0,b4e.exit)()}var CN=require("node:process");var x4e=me(P2());function lat(e){e.length||(O.error("No apps found"),(0,CN.exit)(1));let t=new x4e.Table({title:"Apps",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Name:r.name,id:r.app_id,Created:Tf(r.created_at)})}),O.success(t.render())}async function cat(e){let{data:t,error:r}=await e.from("apps").select().order("created_at",{ascending:!1});return r&&(O.error("Apps not found"),B.error("")),t}async function S4e(e){se("List apps in Capgo"),await ct(),e.apikey=e.apikey||Ae();let t=await Ee(e.apikey);await xe(t,e.apikey,["write","all","read","upload"]),O.info("Getting active bundle in Capgo");let r=await cat(t);O.info(`Active app in Capgo: ${r?.length}`),lat(r),ee("Done \u2705"),(0,CN.exit)()}var AN=require("node:process");var l5=me(A4e());async function dat(e,t,r){for await(let i of e)O.warn(`Removing ${i.name} created on ${Tf(i.created_at)}`),await s5(t,r,i.name)}function pat(e,t,r){let i=[];return e?.forEach(n=>{l5.default.gte(n.name,t)&&l5.default.lt(n.name,`${r}`)&&i.push(n)}),i}async function T4e(e,t){se("Cleanup versions in Capgo"),await ct(),t.apikey=t.apikey||Ae();let{bundle:r,keep:i=4}=t,n=t.force||!1,s=await ge();e=e||s?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide an API key to delete your app"),B.error("")),e||(O.error("Missing argument, you need to provide a appid, or be in a capacitor project"),B.error(""));let a=await Ee(t.apikey);await xe(a,t.apikey,["write","all"]),await tt(a,t.apikey,e,3),O.info("Querying all available versions in Capgo");let o=await o5(a,e),u=await o4e(a,e);if(O.info(`Total active versions in Capgo: ${o?.length}`),o?.length===0){O.error("No versions found, aborting cleanup");return}if(r){let d=`${l5.default.inc(r,"major")}`;O.info(`Querying available versions in Capgo between ${r} and ${d}`),o=pat(o,r,d),O.info(`Active versions in Capgo between ${r} and ${d}: ${o?.length}`)}let l=[],c=0;if(o.forEach(d=>{let p=u.find(f=>f===d.id);c<i||p?(p?d.keep="\u2705 (Linked to channel)":d.keep="\u2705",c+=1):(d.keep="\u274C",l.push(d))}),l.length===0){O.warn("Nothing to be removed, aborting removal...");return}if(a5(o),!n){let d=await Xe({message:"Do you want to continue removing the versions specified?"});(Gi(d)||!d)&&(O.warn("Not confirmed, aborting removal..."),(0,AN.exit)())}O.success("You have confirmed removal, removing versions now"),await dat(l,a,e),ee("Done \u2705"),(0,AN.exit)()}var O4e=require("node:process");async function F4e(e,t,r){se("Delete channel"),r.apikey=r.apikey||Ae();let i=await ge();t=t||i?.config?.appId;let n=Ht();r.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),t||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let s=await Ee(r.apikey),a=await xe(s,r.apikey,["write","all"]);await tt(s,r.apikey,t,4),O.info(`Deleting channel ${t}#${e} from Capgo`);try{let o=await v6e(s,e,t,a);o.error&&(O.error(`Cannot delete Channel \u{1F640} ${ue(o.error)}`),B.error(""));let u=await zn(s,t);O.success("Channel deleted"),await n.track({channel:"channel",event:"Delete channel",icon:"\u2705",user_id:u,tags:{"user-id":a,"app-id":t,channel:e},notify:!1}).catch()}catch{O.error("Cannot delete Channel \u{1F640}")}ee("Done \u2705"),(0,O4e.exit)()}var N4e=require("node:process");async function k4e(e,t){se("List channels"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let i=Ht();t.apikey||O.error("Missing API key, you need to provide a API key to upload your bundle"),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey),s=await xe(n,t.apikey,["write","all","read","upload"]);await tt(n,t.apikey,e,1),O.info("Querying available channels in Capgo");let a=await _6e(n,e);O.info(`Active channels in Capgo: ${a?.length}`),w6e(a),await i.track({channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(),ee("Done \u2705"),(0,N4e.exit)()}var R4e=require("node:crypto"),s1=require("node:fs"),P4e=require("node:process");async function I4e(e,t){se("Set app"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId,t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let i=await Ee(t.apikey),s=(await Cf(i,["admin","super_admin"])).gid,a=await xe(i,t.apikey,["write","all"]);await tt(i,t.apikey,e,4);let{name:o,icon:u,retention:l}=t;l&&Number.isNaN(Number(l))?(O.error("retention value must be a number"),B.error("")):l&&l<0&&(O.error("retention value cannot be less than 0"),B.error(""));let c,d,p=`icon_${(0,R4e.randomUUID)()}`,f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(u&&(0,s1.existsSync)(u)?(c=(0,s1.readFileSync)(u),d=t1.getType(u)||"image/png",O.warn(`Found app icon ${u}`)):(0,s1.existsSync)(Kn)?(c=(0,s1.readFileSync)(Kn),d=t1.getType(Kn)||"image/png",O.warn(`Found app icon ${Kn}`)):O.warn(`Cannot find app icon in any of the following locations: ${u}, ${Kn}`),c&&d){let{error:g}=await i.storage.from(`images/org/${s}/${e}`).upload(p,c,{contentType:d});g&&(O.error(`Could not set app ${ue(g)}`),B.error(""));let{data:v}=await i.storage.from(`images/org/${s}/${e}`).getPublicUrl(p);f=v?.publicUrl||f}let{error:h}=await i.from("apps").update({icon_url:f,name:o,retention:l?l*24*60*60:void 0}).eq("app_id",e).eq("user_id",a);h&&(O.error(`Could not set app ${ue(h)}`),B.error("")),ee("Done \u2705"),(0,P4e.exit)()}var L4e=require("node:process");async function B4e(e,t){se("Deleting"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let i=Ht();t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey),s=await xe(n,t.apikey,["write","all"]);await tt(n,t.apikey,e,5);let{data:a,error:o}=await n.from("apps").select("owner_org ( created_by, id )").eq("app_id",e).single(),u=a;if(!o&&(u?.owner_org.created_by??"")!==s){O.warn("Deleting the app is not recomended for users that are not the organization owner"),O.warn("You are invited as a super_admin but your are not the owner"),O.warn("It's strongly recomended that you do not continue!");let f=await rd({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});(Gi(f)||f==="no")&&(O.error("Canceled deleting the app, exiting"),B.error(""))}else o&&O.warn(`Cannot get the app owner ${ue(o)}`);let{error:l}=await n.storage.from("images").remove([`org/${u?.owner_org.id}/${e}/icon`]);l&&(console.error(l,`images/org/${u?.owner_org.id}/${e}`),O.error("Could not delete app logo"));let{error:c}=await n.storage.from(`apps/${e}/${s}`).remove(["versions"]);c&&O.error("Could not delete app version");let{error:d}=await n.from("apps").delete().eq("app_id",e);d&&(O.error("Could not delete app"),B.error(""));let p=await zn(n,e);await i.track({channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:p,tags:{"app-id":e},notify:!1}).catch(),O.success("App deleted in Capgo"),ee("Done \u2705"),(0,L4e.exit)()}var q4e=me(P2());async function j4e(e,t){se("Check compatibility"),t.apikey=t.apikey||Ae();let r=await ge();e=e||r?.config?.appId;let{channel:i}=t;i||(O.error("Missing argument, you need to provide a channel"),B.error("")),t.apikey||(O.error("Missing API key, you need to provide a API key to upload your bundle"),B.error("")),e||(O.error("Missing argument, you need to provide a appId, or be in a capacitor project"),B.error(""));let n=await Ee(t.apikey);await xe(n,t.apikey,["write","all","read","upload"]),await tt(n,t.apikey,e,1);let{finalCompatibility:s}=await W9(n,e,i),a=new q4e.Table({title:"Compatibility",charLength:{"\u274C":2,"\u2705":2}}),o=t.text?"Yes":"\u2705",u=t.text?"No":"\u274C";s.forEach(l=>{let{name:c,localVersion:d,remoteVersion:p}=l;a.addRow({Package:c,"Local version":d??"None","Remote version":p??"None",Compatible:p===d?o:u})}),O.success(a.render())}B.name(Vo.name).description("Manage packages and bundle versions in Capgo Cloud").version(Vo.version);B.command("login [apikey]").alias("l").description("Save apikey to your machine or folder").action(G6e).option("--local","Only save in local folder");B.command("doctor").description("Get info about your Capgo app install").action(g4e);B.command("init [apikey] [appId]").description("Init a new app").action(r4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");var V2=B.command("app").description("Manage app");V2.command("add [appId]").alias("a").description("Add a new app in Capgo Cloud").action(Z6e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");V2.command("delete [appId]").description("Delete an app in Capgo Cloud").action(B4e).option("-a, --apikey <apikey>","apikey to link to your account");V2.command("list").alias("l").description("list apps in Capgo Cloud").action(S4e).option("-a, --apikey <apikey>","apikey to link to your account");V2.command("debug [appId]").description("Listen for live updates event in Capgo Cloud to debug your app").option("-a, --apikey <apikey>","apikey to link to your account").option("-d, --device <device>","the specific device to debug").action(V2e);V2.command("set [appId]").alias("s").description("Set an app in Capgo Cloud").action(I4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account").option("-r, --retention <retention>","retention period of app bundle in days");var ll=B.command("bundle").description("Manage bundle");ll.command("upload [appId]").alias("u").description("Upload a new bundle in Capgo Cloud").action(V6e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the iv and session key for bundle url external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","Apikey for your S3 endpoint").option("--s3-apisecret <apisecret>","Api secret for your S3 endpoint").option("--s3-endoint <s3Endpoint>","Url of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","base64 public signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the bundle to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","Uses multipart protocol to upload data to S3").option("--ignore-partial","Does not upload partial files to S3");ll.command("compatibility [appId]").action(j4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-c, --channel <channel>","channel to check the compatibility with").option("--text","output text instead of emojis");ll.command("delete [bundleId] [appId]").alias("d").description("Delete a bundle in Capgo Cloud").action(v4e).option("-a, --apikey <apikey>","apikey to link to your account");ll.command("list [appId]").alias("l").description("List bundle in Capgo Cloud").action(l4e).option("-a, --apikey <apikey>","apikey to link to your account");ll.command("cleanup [appId]").alias("c").action(T4e).description("Cleanup bundle in Capgo Cloud").option("-b, --bundle <bundle>","bundle version number of the app to delete").option("-a, --apikey <apikey>","apikey to link to your account").option("-k, --keep <keep>","number of version to keep").option("-f, --force","force removal");ll.command("decrypt [zipPath] [sessionKey]").description("Decrypt a signed zip bundle").action(d4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","base64 private signing key");ll.command("encrypt [zipPath]").description("Encrypt a zip bundle").action(h4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","base64 private signing key");ll.command("zip [appId]").description("Zip a bundle").action(S2e).option("-p, --path <path>","path of the folder to upload").option("-b, --bundle <bundle>","bundle version number to name the zip file").option("-n, --name <name>","name of the zip file").option("-j, --json","output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder");var H2=B.command("channel").description("Manage channel");H2.command("add [channelId] [appId]").alias("a").description("Create channel").action(b6e).option("-d, --default","set the channel as default").option("-a, --apikey <apikey>","apikey to link to your account");H2.command("delete [channelId] [appId]").alias("d").description("Delete channel").action(F4e).option("-a, --apikey <apikey>","apikey to link to your account");H2.command("list [appId]").alias("l").description("List channel").action(k4e).option("-a, --apikey <apikey>","apikey to link to your account");H2.command("currentBundle [channel] [appId]").description("Get current bundle for specific channel in Capgo Cloud").action(E4e).option("-c, --channel <channel>","channel to get the current bundle from").option("-a, --apikey <apikey>","apikey to link to your account").option("--quiet","only print the bundle version");H2.command("set [channelId] [appId]").alias("s").description("Set channel").action(D4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-b, --bundle <bundle>","bundle version number of the file to set").option("-s, --state <state>","set the state of the channel, default or normal").option("--latest","get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--upgrade","Allow to upgrade to version above native one").option("--no-upgrade","Disable upgrade to version above native one").option("--ios","Allow sending update to ios devices").option("--no-ios","Disable sending update to ios devices").option("--android","Allow sending update to android devices").option("--no-android","Disable sending update to android devices").option("--self-assign","Allow to device to self assign to this channel").option("--no-self-assign","Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices");var $4e=B.command("key").description("Manage key");$4e.command("save").description("Save base64 signing key in capacitor config, usefull for CI").action(Y2e).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");$4e.command("create").description("Create a new signing key").action(K2e).option("-f, --force","force generate a new one");B.command("upload [appId]").alias("u").description("(Deprecated) Upload a new bundle to Capgo Cloud").action(H6e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","base64 public signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the file to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel");var fat=B.command("account").description("Manage account");fat.command("id").description("Get your account ID").action(vpe).option("-a, --apikey <apikey>","apikey to link to your account");B.parseAsync();
398
398
  /*! Bundled license information:
399
399
 
400
400
  is-extglob/index.js: