@capgo/cli 7.54.0 → 7.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/sdk.js CHANGED
@@ -5,7 +5,7 @@ ${f.stack}`)}else d=(l=s?.stack)!==null&&l!==void 0?l:"";return{error:{message:`
5
5
  import ws from "ws"
6
6
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
7
7
 
8
- Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){let n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}};Cu.WebSocketFactory=Yl;Cu.default=Yl});var mC=_(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.version=void 0;Jl.version="2.84.0"});var Zl=_(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.CONNECTION_STATE=ke.TRANSPORTS=ke.CHANNEL_EVENTS=ke.CHANNEL_STATES=ke.SOCKET_STATES=ke.MAX_PUSH_BUFFER_SIZE=ke.WS_CLOSE_NORMAL=ke.DEFAULT_TIMEOUT=ke.VERSION=ke.DEFAULT_VSN=ke.VSN_2_0_0=ke.VSN_1_0_0=ke.DEFAULT_VERSION=void 0;var EC=mC();ke.DEFAULT_VERSION=`realtime-js/${EC.version}`;ke.VSN_1_0_0="1.0.0";ke.VSN_2_0_0="2.0.0";ke.DEFAULT_VSN=ke.VSN_1_0_0;ke.VERSION=EC.version;ke.DEFAULT_TIMEOUT=1e4;ke.WS_CLOSE_NORMAL=1e3;ke.MAX_PUSH_BUFFER_SIZE=100;var gC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(gC||(ke.SOCKET_STATES=gC={}));var yC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(yC||(ke.CHANNEL_STATES=yC={}));var DC;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(DC||(ke.CHANNEL_EVENTS=DC={}));var wC;(function(t){t.websocket="websocket"})(wC||(ke.TRANSPORTS=wC={}));var vC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(vC||(ke.CONNECTION_STATE=vC={}))});var bC=_(_g=>{"use strict";Object.defineProperty(_g,"__esModule",{value:!0});var bg=class{constructor(){this.HEADER_LENGTH=1,this.META_LENGTH=4,this.USER_BROADCAST_PUSH_META_LENGTH=5,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast"}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:new ArrayBuffer(0),h=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,d=new ArrayBuffer(this.HEADER_LENGTH+h),f=new DataView(d),m=0;f.setUint8(m++,this.KINDS.userBroadcastPush),f.setUint8(m++,u.length),f.setUint8(m++,a.length),f.setUint8(m++,o.length),f.setUint8(m++,c.length),f.setUint8(m++,this.BINARY_ENCODING),Array.from(u,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(a,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(o,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(c,v=>f.setUint8(m++,v.charCodeAt(0)));var y=new Uint8Array(d.byteLength+l.byteLength);return y.set(new Uint8Array(d),0),y.set(new Uint8Array(l),d.byteLength),y.buffer}_encodeJsonUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:{},d=new TextEncoder().encode(JSON.stringify(l)).buffer,f=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,m=new ArrayBuffer(this.HEADER_LENGTH+f),y=new DataView(m),v=0;y.setUint8(v++,this.KINDS.userBroadcastPush),y.setUint8(v++,u.length),y.setUint8(v++,a.length),y.setUint8(v++,o.length),y.setUint8(v++,c.length),y.setUint8(v++,this.JSON_ENCODING),Array.from(u,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(a,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(o,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(c,A=>y.setUint8(v++,A.charCodeAt(0)));var E=new Uint8Array(m.byteLength+d.byteLength);return E.set(new Uint8Array(m),0),E.set(new Uint8Array(d),m.byteLength),E.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){let n=JSON.parse(e),[i,s,o,a,u]=n;return r({join_ref:i,ref:s,topic:o,event:a,payload:u})}return r({})}_binaryDecode(e){let r=new DataView(e),n=r.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,i)}}_decodeUserBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4),u=this.HEADER_LENGTH+4,c=n.decode(e.slice(u,u+i));u=u+i;let l=n.decode(e.slice(u,u+s));u=u+s;let h=n.decode(e.slice(u,u+o));u=u+o;let d=e.slice(u,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,m={type:this.BROADCAST_EVENT,event:l,payload:f};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}};_g.default=bg});var Ag=_(Sg=>{"use strict";Object.defineProperty(Sg,"__esModule",{value:!0});var Cg=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};Sg.default=Cg});var Ql=_(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.httpEndpointURL=Pe.toTimestampString=Pe.toArray=Pe.toJson=Pe.toNumber=Pe.toBoolean=Pe.convertCell=Pe.convertColumn=Pe.convertChangeData=Pe.PostgresTypes=void 0;var Ke;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ke||(Pe.PostgresTypes=Ke={}));var U4=(t,e,r={})=>{var n;let i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((s,o)=>(s[o]=(0,Pe.convertColumn)(o,t,e,i),s),{}):{}};Pe.convertChangeData=U4;var q4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Pe.convertCell)(s,o):Og(o)};Pe.convertColumn=q4;var H4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Pe.toArray)(e,r)}switch(t){case Ke.bool:return(0,Pe.toBoolean)(e);case Ke.float4:case Ke.float8:case Ke.int2:case Ke.int4:case Ke.int8:case Ke.numeric:case Ke.oid:return(0,Pe.toNumber)(e);case Ke.json:case Ke.jsonb:return(0,Pe.toJson)(e);case Ke.timestamp:return(0,Pe.toTimestampString)(e);case Ke.abstime:case Ke.date:case Ke.daterange:case Ke.int4range:case Ke.int8range:case Ke.money:case Ke.reltime:case Ke.text:case Ke.time:case Ke.timestamptz:case Ke.timetz:case Ke.tsrange:case Ke.tstzrange:return Og(e);default:return Og(e)}};Pe.convertCell=H4;var Og=t=>t,V4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Pe.toBoolean=V4;var z4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Pe.toNumber=z4;var K4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Pe.toJson=K4;var G4=(t,e)=>{if(typeof t!="string")return t;let r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let s,o=t.slice(1,r);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>(0,Pe.convertCell)(e,a))}return t};Pe.toArray=G4;var W4=t=>typeof t=="string"?t.replace(" ","T"):t;Pe.toTimestampString=W4;var X4=t=>{let e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};Pe.httpEndpointURL=X4});var _C=_(Tg=>{"use strict";Object.defineProperty(Tg,"__esModule",{value:!0});var Y4=Zl(),xg=class{constructor(e,r,n={},i=Y4.DEFAULT_TIMEOUT){this.channel=e,this.event=r,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}};Tg.default=xg});var Pg=_(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var CC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(CC||(Su.REALTIME_PRESENCE_LISTEN_EVENTS=CC={}));var Ig=class t{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=t.syncState(this.state,i,s,o),this.pendingDiffs.forEach(u=>{this.state=t.syncDiff(this.state,u,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(n.diff,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=t.syncDiff(this.state,i,s,o),a())}),this.onJoin((i,s,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:o})}),this.onLeave((i,s,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,i){let s=this.cloneDeep(e),o=this.transformState(r),a={},u={};return this.map(s,(c,l)=>{o[c]||(u[c]=l)}),this.map(o,(c,l)=>{let h=s[c];if(h){let d=l.map(v=>v.presence_ref),f=h.map(v=>v.presence_ref),m=l.filter(v=>f.indexOf(v.presence_ref)<0),y=h.filter(v=>d.indexOf(v.presence_ref)<0);m.length>0&&(a[c]=m),y.length>0&&(u[c]=y)}else a[c]=l}),this.syncDiff(s,{joins:a,leaves:u},n,i)}static syncDiff(e,r,n,i){let{joins:s,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(a,u)=>{var c;let l=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(u),l.length>0){let h=e[a].map(f=>f.presence_ref),d=l.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}n(a,l,u)}),this.map(o,(a,u)=>{let c=e[a];if(!c)return;let l=u.map(h=>h.presence_ref);c=c.filter(h=>l.indexOf(h.presence_ref)<0),e[a]=c,i(a,c,u),c.length===0&&delete e[a]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{let i=e[n];return"metas"in i?r[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):r[n]=i,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};Su.default=Ig});var kg=_(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.REALTIME_CHANNEL_STATES=nn.REALTIME_SUBSCRIBE_STATES=nn.REALTIME_LISTEN_TYPES=nn.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var ef=(he(),ce(fe)),Ge=Zl(),Fg=ef.__importDefault(_C()),J4=ef.__importDefault(Ag()),Z4=ef.__importDefault(Pg()),SC=ef.__importStar(Ql()),Q4=Ql(),AC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(AC||(nn.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=AC={}));var Au;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Au||(nn.REALTIME_LISTEN_TYPES=Au={}));var Wn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Wn||(nn.REALTIME_SUBSCRIBE_STATES=Wn={}));nn.REALTIME_CHANNEL_STATES=Ge.CHANNEL_STATES;var Rg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ge.CHANNEL_STATES.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new Fg.default(this,Ge.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new J4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ge.CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ge.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ge.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new Z4.default(this),this.broadcastEndpointURL=(0,Q4.httpEndpointURL)(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ge.CHANNEL_STATES.closed){let{config:{broadcast:o,presence:a,private:u}}=this.params,c=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&i!==void 0?i:[],l=!!this.bindings[Au.PRESENCE]&&this.bindings[Au.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:l}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(Wn.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Wn.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e?.(Wn.SUBSCRIBED);return}else{let y=this.bindings.postgres_changes,v=(m=y?.length)!==null&&m!==void 0?m:0,E=[];for(let A=0;A<v;A++){let p=y[A],{filter:{event:D,schema:w,table:C,filter:F}}=p,b=f&&f[A];if(b&&b.event===D&&b.schema===w&&b.table===C&&b.filter===F)E.push(Object.assign(Object.assign({},p),{id:b.id}));else{this.unsubscribe(),this.state=Ge.CHANNEL_STATES.errored,e?.(Wn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(Wn.SUBSCRIBED);return}}).receive("error",f=>{this.state=Ge.CHANNEL_STATES.errored,e?.(Wn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Wn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===Ge.CHANNEL_STATES.joined&&e===Au.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var i;let s=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");let o={method:"POST",headers:{Authorization:s,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let u=a.statusText;try{let c=await a.json();u=c.error||c.message||u}catch{}return Promise.reject(new Error(u))}async send(e,r={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:s,payload:o}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{let c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,u;let c=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||u===void 0)&&u.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ge.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ge.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new Fg.default(this,Ge.CHANNEL_EVENTS.leave,{},e),n.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ge.CHANNEL_STATES.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){let i=new AbortController,s=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(s),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Fg.default(this,e,r,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Ge.MAX_PUSH_BUFFER_SIZE){let r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var i,s;let o=e.toLocaleLowerCase(),{close:a,error:u,leave:c,join:l}=Ge.CHANNEL_EVENTS;if(n&&[a,u,c,l].indexOf(o)>=0&&n!==this._joinRef())return;let d=this._onMessage(o,r,n);if(r&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(f=>{var m,y,v;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((v=(y=f.filter)===null||y===void 0?void 0:y.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,y,v,E,A,p;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){let D=f.id,w=(m=f.filter)===null||m===void 0?void 0:m.event;return D&&((y=r.ids)===null||y===void 0?void 0:y.includes(D))&&(w==="*"||w?.toLocaleLowerCase()===((v=r.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{let D=(A=(E=f?.filter)===null||E===void 0?void 0:E.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return D==="*"||D===((p=r?.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){let m=d.data,{schema:y,table:v,commit_timestamp:E,type:A,errors:p}=m;d=Object.assign(Object.assign({},{schema:y,table:v,commit_timestamp:E,eventType:A,new:{},old:{},errors:p}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===Ge.CHANNEL_STATES.closed}_isJoined(){return this.state===Ge.CHANNEL_STATES.joined}_isJoining(){return this.state===Ge.CHANNEL_STATES.joining}_isLeaving(){return this.state===Ge.CHANNEL_STATES.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){let i=e.toLocaleLowerCase(),s={type:i,filter:r,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,r){let n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&t.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(let n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ge.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(Ge.CHANNEL_EVENTS.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ge.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=SC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=SC.convertChangeData(e.columns,e.old_record)),r}};nn.default=Rg});var OC=_(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});var rf=(he(),ce(fe)),e5=rf.__importDefault(Eg()),St=Zl(),t5=rf.__importDefault(bC()),r5=rf.__importDefault(Ag()),n5=Ql(),i5=rf.__importDefault(kg()),Ng=()=>{},tf={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},s5=[1e3,2e3,5e3,1e4],o5=1e4,a5=`
8
+ Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){let n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}};Cu.WebSocketFactory=Yl;Cu.default=Yl});var mC=_(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.version=void 0;Jl.version="2.84.0"});var Zl=_(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.CONNECTION_STATE=ke.TRANSPORTS=ke.CHANNEL_EVENTS=ke.CHANNEL_STATES=ke.SOCKET_STATES=ke.MAX_PUSH_BUFFER_SIZE=ke.WS_CLOSE_NORMAL=ke.DEFAULT_TIMEOUT=ke.VERSION=ke.DEFAULT_VSN=ke.VSN_2_0_0=ke.VSN_1_0_0=ke.DEFAULT_VERSION=void 0;var EC=mC();ke.DEFAULT_VERSION=`realtime-js/${EC.version}`;ke.VSN_1_0_0="1.0.0";ke.VSN_2_0_0="2.0.0";ke.DEFAULT_VSN=ke.VSN_1_0_0;ke.VERSION=EC.version;ke.DEFAULT_TIMEOUT=1e4;ke.WS_CLOSE_NORMAL=1e3;ke.MAX_PUSH_BUFFER_SIZE=100;var gC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(gC||(ke.SOCKET_STATES=gC={}));var yC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(yC||(ke.CHANNEL_STATES=yC={}));var DC;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(DC||(ke.CHANNEL_EVENTS=DC={}));var wC;(function(t){t.websocket="websocket"})(wC||(ke.TRANSPORTS=wC={}));var vC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(vC||(ke.CONNECTION_STATE=vC={}))});var bC=_(_g=>{"use strict";Object.defineProperty(_g,"__esModule",{value:!0});var bg=class{constructor(){this.HEADER_LENGTH=1,this.META_LENGTH=4,this.USER_BROADCAST_PUSH_META_LENGTH=5,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast"}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:new ArrayBuffer(0),h=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,d=new ArrayBuffer(this.HEADER_LENGTH+h),f=new DataView(d),m=0;f.setUint8(m++,this.KINDS.userBroadcastPush),f.setUint8(m++,u.length),f.setUint8(m++,a.length),f.setUint8(m++,o.length),f.setUint8(m++,c.length),f.setUint8(m++,this.BINARY_ENCODING),Array.from(u,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(a,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(o,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(c,v=>f.setUint8(m++,v.charCodeAt(0)));var y=new Uint8Array(d.byteLength+l.byteLength);return y.set(new Uint8Array(d),0),y.set(new Uint8Array(l),d.byteLength),y.buffer}_encodeJsonUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:{},d=new TextEncoder().encode(JSON.stringify(l)).buffer,f=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,m=new ArrayBuffer(this.HEADER_LENGTH+f),y=new DataView(m),v=0;y.setUint8(v++,this.KINDS.userBroadcastPush),y.setUint8(v++,u.length),y.setUint8(v++,a.length),y.setUint8(v++,o.length),y.setUint8(v++,c.length),y.setUint8(v++,this.JSON_ENCODING),Array.from(u,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(a,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(o,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(c,A=>y.setUint8(v++,A.charCodeAt(0)));var E=new Uint8Array(m.byteLength+d.byteLength);return E.set(new Uint8Array(m),0),E.set(new Uint8Array(d),m.byteLength),E.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){let n=JSON.parse(e),[i,s,o,a,u]=n;return r({join_ref:i,ref:s,topic:o,event:a,payload:u})}return r({})}_binaryDecode(e){let r=new DataView(e),n=r.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,i)}}_decodeUserBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4),u=this.HEADER_LENGTH+4,c=n.decode(e.slice(u,u+i));u=u+i;let l=n.decode(e.slice(u,u+s));u=u+s;let h=n.decode(e.slice(u,u+o));u=u+o;let d=e.slice(u,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,m={type:this.BROADCAST_EVENT,event:l,payload:f};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}};_g.default=bg});var Ag=_(Sg=>{"use strict";Object.defineProperty(Sg,"__esModule",{value:!0});var Cg=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};Sg.default=Cg});var Ql=_(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.httpEndpointURL=Pe.toTimestampString=Pe.toArray=Pe.toJson=Pe.toNumber=Pe.toBoolean=Pe.convertCell=Pe.convertColumn=Pe.convertChangeData=Pe.PostgresTypes=void 0;var Ke;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ke||(Pe.PostgresTypes=Ke={}));var U4=(t,e,r={})=>{var n;let i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((s,o)=>(s[o]=(0,Pe.convertColumn)(o,t,e,i),s),{}):{}};Pe.convertChangeData=U4;var q4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Pe.convertCell)(s,o):Og(o)};Pe.convertColumn=q4;var H4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Pe.toArray)(e,r)}switch(t){case Ke.bool:return(0,Pe.toBoolean)(e);case Ke.float4:case Ke.float8:case Ke.int2:case Ke.int4:case Ke.int8:case Ke.numeric:case Ke.oid:return(0,Pe.toNumber)(e);case Ke.json:case Ke.jsonb:return(0,Pe.toJson)(e);case Ke.timestamp:return(0,Pe.toTimestampString)(e);case Ke.abstime:case Ke.date:case Ke.daterange:case Ke.int4range:case Ke.int8range:case Ke.money:case Ke.reltime:case Ke.text:case Ke.time:case Ke.timestamptz:case Ke.timetz:case Ke.tsrange:case Ke.tstzrange:return Og(e);default:return Og(e)}};Pe.convertCell=H4;var Og=t=>t,V4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Pe.toBoolean=V4;var z4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Pe.toNumber=z4;var K4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Pe.toJson=K4;var G4=(t,e)=>{if(typeof t!="string")return t;let r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let s,o=t.slice(1,r);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>(0,Pe.convertCell)(e,a))}return t};Pe.toArray=G4;var W4=t=>typeof t=="string"?t.replace(" ","T"):t;Pe.toTimestampString=W4;var X4=t=>{let e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};Pe.httpEndpointURL=X4});var _C=_(Tg=>{"use strict";Object.defineProperty(Tg,"__esModule",{value:!0});var Y4=Zl(),xg=class{constructor(e,r,n={},i=Y4.DEFAULT_TIMEOUT){this.channel=e,this.event=r,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}};Tg.default=xg});var Pg=_(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var CC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(CC||(Su.REALTIME_PRESENCE_LISTEN_EVENTS=CC={}));var Ig=class t{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=t.syncState(this.state,i,s,o),this.pendingDiffs.forEach(u=>{this.state=t.syncDiff(this.state,u,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(n.diff,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=t.syncDiff(this.state,i,s,o),a())}),this.onJoin((i,s,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:o})}),this.onLeave((i,s,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,i){let s=this.cloneDeep(e),o=this.transformState(r),a={},u={};return this.map(s,(c,l)=>{o[c]||(u[c]=l)}),this.map(o,(c,l)=>{let h=s[c];if(h){let d=l.map(v=>v.presence_ref),f=h.map(v=>v.presence_ref),m=l.filter(v=>f.indexOf(v.presence_ref)<0),y=h.filter(v=>d.indexOf(v.presence_ref)<0);m.length>0&&(a[c]=m),y.length>0&&(u[c]=y)}else a[c]=l}),this.syncDiff(s,{joins:a,leaves:u},n,i)}static syncDiff(e,r,n,i){let{joins:s,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(a,u)=>{var c;let l=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(u),l.length>0){let h=e[a].map(f=>f.presence_ref),d=l.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}n(a,l,u)}),this.map(o,(a,u)=>{let c=e[a];if(!c)return;let l=u.map(h=>h.presence_ref);c=c.filter(h=>l.indexOf(h.presence_ref)<0),e[a]=c,i(a,c,u),c.length===0&&delete e[a]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{let i=e[n];return"metas"in i?r[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):r[n]=i,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};Su.default=Ig});var kg=_(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.REALTIME_CHANNEL_STATES=on.REALTIME_SUBSCRIBE_STATES=on.REALTIME_LISTEN_TYPES=on.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var ef=(he(),ce(fe)),Ge=Zl(),Fg=ef.__importDefault(_C()),J4=ef.__importDefault(Ag()),Z4=ef.__importDefault(Pg()),SC=ef.__importStar(Ql()),Q4=Ql(),AC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(AC||(on.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=AC={}));var Au;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Au||(on.REALTIME_LISTEN_TYPES=Au={}));var Xn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Xn||(on.REALTIME_SUBSCRIBE_STATES=Xn={}));on.REALTIME_CHANNEL_STATES=Ge.CHANNEL_STATES;var Rg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ge.CHANNEL_STATES.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new Fg.default(this,Ge.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new J4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ge.CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ge.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ge.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new Z4.default(this),this.broadcastEndpointURL=(0,Q4.httpEndpointURL)(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ge.CHANNEL_STATES.closed){let{config:{broadcast:o,presence:a,private:u}}=this.params,c=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&i!==void 0?i:[],l=!!this.bindings[Au.PRESENCE]&&this.bindings[Au.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:l}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(Xn.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Xn.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e?.(Xn.SUBSCRIBED);return}else{let y=this.bindings.postgres_changes,v=(m=y?.length)!==null&&m!==void 0?m:0,E=[];for(let A=0;A<v;A++){let p=y[A],{filter:{event:D,schema:w,table:C,filter:F}}=p,b=f&&f[A];if(b&&b.event===D&&b.schema===w&&b.table===C&&b.filter===F)E.push(Object.assign(Object.assign({},p),{id:b.id}));else{this.unsubscribe(),this.state=Ge.CHANNEL_STATES.errored,e?.(Xn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(Xn.SUBSCRIBED);return}}).receive("error",f=>{this.state=Ge.CHANNEL_STATES.errored,e?.(Xn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Xn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===Ge.CHANNEL_STATES.joined&&e===Au.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var i;let s=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");let o={method:"POST",headers:{Authorization:s,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let u=a.statusText;try{let c=await a.json();u=c.error||c.message||u}catch{}return Promise.reject(new Error(u))}async send(e,r={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:s,payload:o}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{let c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,u;let c=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||u===void 0)&&u.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ge.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ge.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new Fg.default(this,Ge.CHANNEL_EVENTS.leave,{},e),n.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ge.CHANNEL_STATES.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){let i=new AbortController,s=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(s),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Fg.default(this,e,r,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Ge.MAX_PUSH_BUFFER_SIZE){let r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var i,s;let o=e.toLocaleLowerCase(),{close:a,error:u,leave:c,join:l}=Ge.CHANNEL_EVENTS;if(n&&[a,u,c,l].indexOf(o)>=0&&n!==this._joinRef())return;let d=this._onMessage(o,r,n);if(r&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(f=>{var m,y,v;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((v=(y=f.filter)===null||y===void 0?void 0:y.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,y,v,E,A,p;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){let D=f.id,w=(m=f.filter)===null||m===void 0?void 0:m.event;return D&&((y=r.ids)===null||y===void 0?void 0:y.includes(D))&&(w==="*"||w?.toLocaleLowerCase()===((v=r.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{let D=(A=(E=f?.filter)===null||E===void 0?void 0:E.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return D==="*"||D===((p=r?.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){let m=d.data,{schema:y,table:v,commit_timestamp:E,type:A,errors:p}=m;d=Object.assign(Object.assign({},{schema:y,table:v,commit_timestamp:E,eventType:A,new:{},old:{},errors:p}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===Ge.CHANNEL_STATES.closed}_isJoined(){return this.state===Ge.CHANNEL_STATES.joined}_isJoining(){return this.state===Ge.CHANNEL_STATES.joining}_isLeaving(){return this.state===Ge.CHANNEL_STATES.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){let i=e.toLocaleLowerCase(),s={type:i,filter:r,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,r){let n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&t.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(let n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ge.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(Ge.CHANNEL_EVENTS.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ge.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=SC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=SC.convertChangeData(e.columns,e.old_record)),r}};on.default=Rg});var OC=_(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});var rf=(he(),ce(fe)),e5=rf.__importDefault(Eg()),St=Zl(),t5=rf.__importDefault(bC()),r5=rf.__importDefault(Ag()),n5=Ql(),i5=rf.__importDefault(kg()),Ng=()=>{},tf={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},s5=[1e3,2e3,5e3,1e4],o5=1e4,a5=`
9
9
  addEventListener("message", (e) => {
10
10
  if (e.data.event === "start") {
11
11
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
@@ -23,7 +23,7 @@ Option 2: Install and provide the "ws" package:
23
23
  const client = new RealtimeClient(url, {
24
24
  ...options,
25
25
  transport: ws
26
- })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case St.SOCKET_STATES.connecting:return St.CONNECTION_STATE.Connecting;case St.SOCKET_STATES.open:return St.CONNECTION_STATE.Open;case St.SOCKET_STATES.closing:return St.CONNECTION_STATE.Closing;default:return St.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===St.CONNECTION_STATE.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){let n=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===n);if(i)return i;{let s=new i5.default(`realtime:${e}`,r,this);return this.channels.push(s),s}}push(e){let{topic:r,event:n,payload:i,ref:s}=e,o=()=>{this.encode(e,a=>{var u;(u=this.conn)===null||u===void 0||u.send(a)})};this.log("push",`${r} ${n} (${s})`,i),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(St.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},tf.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply")try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:n,event:i,payload:s,ref:o}=r,a=o?`(${o})`:"",u=s.status||"";this.log("receive",`${u} ${n} ${i} ${a}`.trim(),s),this.channels.filter(c=>c._isMember(n)).forEach(c=>c._trigger(i,s,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){if(this.conn){if(this.conn.readyState===St.SOCKET_STATES.open||this.conn.readyState===St.SOCKET_STATES.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(St.CHANNEL_EVENTS.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;let n=e.match(/\?/)?"&":"?",i=new URLSearchParams(r);return`${e}${n}${i}`}_workerObjectUrl(e){let r;if(e)r=e;else{let n=new Blob([a5],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r;e?r=e:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{let i={access_token:r,version:St.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(St.CHANNEL_EVENTS.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new r5.default(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},tf.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,i,s,o,a,u,c,l,h,d,f;switch(this.transport=(r=e?.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e?.timeout)!==null&&n!==void 0?n:St.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:tf.HEARTBEAT_INTERVAL,this.worker=(s=e?.worker)!==null&&s!==void 0?s:!1,this.accessToken=(o=e?.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e?.heartbeatCallback)!==null&&a!==void 0?a:Ng,this.vsn=(u=e?.vsn)!==null&&u!==void 0?u:St.DEFAULT_VSN,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e?.reconnectAfterMs)!==null&&c!==void 0?c:(m=>s5[m-1]||o5),this.vsn){case St.VSN_1_0_0:this.encode=(l=e?.encode)!==null&&l!==void 0?l:((m,y)=>y(JSON.stringify(m))),this.decode=(h=e?.decode)!==null&&h!==void 0?h:((m,y)=>y(JSON.parse(m)));break;case St.VSN_2_0_0:this.encode=(d=e?.encode)!==null&&d!==void 0?d:this.serializer.encode.bind(this.serializer),this.decode=(f=e?.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}};Lg.default=$g});var Bg=_(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.WebSocketFactory=Tt.REALTIME_CHANNEL_STATES=Tt.REALTIME_SUBSCRIBE_STATES=Tt.REALTIME_PRESENCE_LISTEN_EVENTS=Tt.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Tt.REALTIME_LISTEN_TYPES=Tt.RealtimeClient=Tt.RealtimeChannel=Tt.RealtimePresence=void 0;var nf=(he(),ce(fe)),u5=nf.__importDefault(OC());Tt.RealtimeClient=u5.default;var Ou=nf.__importStar(kg());Tt.RealtimeChannel=Ou.default;Object.defineProperty(Tt,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Ou.REALTIME_LISTEN_TYPES}});Object.defineProperty(Tt,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Ou.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Tt,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Tt,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_CHANNEL_STATES}});var xC=nf.__importStar(Pg());Tt.RealtimePresence=xC.default;Object.defineProperty(Tt,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return xC.REALTIME_PRESENCE_LISTEN_EVENTS}});var c5=nf.__importDefault(Eg());Tt.WebSocketFactory=c5.default});var Pi=_(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.StorageUnknownError=Xn.StorageApiError=Xn.StorageError=void 0;Xn.isStorageError=l5;var xu=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Xn.StorageError=xu;function l5(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var jg=class extends xu{constructor(e,r,n){super(e),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};Xn.StorageApiError=jg;var Mg=class extends xu{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Xn.StorageUnknownError=Mg});var Tu=_(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.isPlainObject=qr.recursiveToCamel=qr.resolveResponse=qr.resolveFetch=void 0;var f5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);qr.resolveFetch=f5;var h5=()=>Response;qr.resolveResponse=h5;var d5=t=>{if(Array.isArray(t))return t.map(r=>(0,qr.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let i=r.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=(0,qr.recursiveToCamel)(n)}),e};qr.recursiveToCamel=d5;var p5=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};qr.isPlainObject=p5});var sf=_(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.get=y5;ms.post=D5;ms.put=w5;ms.head=v5;ms.remove=E5;var ps=(he(),ce(fe)),Ug=Pi(),TC=Tu(),qg=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},m5=(t,e,r)=>ps.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,TC.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(i=>{let s=t.status||500,o=i?.statusCode||s+"";e(new Ug.StorageApiError(qg(i),s,o))}).catch(i=>{e(new Ug.StorageUnknownError(qg(i),i))}):e(new Ug.StorageUnknownError(qg(t),t))}),g5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,TC.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,e?.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),r))};function Iu(t,e,r,n,i,s){return ps.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,g5(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>m5(u,a,n))})})}function y5(t,e,r,n){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"GET",e,r,n)})}function D5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"POST",e,n,i,r)})}function w5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"PUT",e,n,i,r)})}function v5(t,e,r,n){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function E5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"DELETE",e,n,i,r)})}});var IC=_(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});var b5=(he(),ce(fe)),_5=Pi(),Hg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return b5.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,_5.isStorageError)(e))return{data:null,error:e};throw e}})}};Vg.default=Hg});var RC=_(Kg=>{"use strict";var PC;Object.defineProperty(Kg,"__esModule",{value:!0});var FC=(he(),ce(fe)),C5=Pi(),S5=FC.__importDefault(IC()),zg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[PC]="BlobDownloadBuilder",this.promise=null}asStream(){return new S5.default(this.downloadFn,this.shouldThrowOnError)}then(e,r){return this.getPromise().then(e,r)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return FC.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,C5.isStorageError)(e))return{data:null,error:e};throw e}})}};PC=Symbol.toStringTag;Kg.default=zg});var $C=_(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});var rr=(he(),ce(fe)),Dr=Pi(),wr=sf(),kC=Tu(),A5=rr.__importDefault(RC()),O5={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},NC={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Gg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,kC.resolveFetch)(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){try{let s,o=Object.assign(Object.assign({},NC),i),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)}),u=o.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),u&&s.append("metadata",this.encodeMetadata(u)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",o.cacheControl),u&&!s.has("metadata")&&s.append("metadata",this.encodeMetadata(u))):(s=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,u&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!o.duplex&&(o.duplex="half")),i?.headers&&(a=Object.assign(Object.assign({},a),i.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),h=yield(e=="PUT"?wr.put:wr.post)(this.fetch,`${this.url}/object/${l}`,s,Object.assign({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if((0,Dr.isStorageError)(s))return{data:null,error:s};throw s}})}upload(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(e),o=this._getFinalPath(s),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",r);try{let u,c=Object.assign({upsert:NC.upsert},i),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let h=yield(0,wr.put)(this.fetch,a.toString(),u,{headers:l});return{data:{path:s,fullPath:h.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Dr.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=Object.assign({},this.headers);r?.upsert&&(i["x-upsert"]="true");let s=yield(0,wr.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(this.url+s.url),a=o.searchParams.get("token");if(!a)throw new Dr.StorageError("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:a},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,wr.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}copy(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,wr.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrl(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),s=yield(0,wr.post)(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),o=n?.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrls(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=yield(0,wr.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),s=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${s}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}download(e,r){let i=typeof r?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(r?.transform||{}),o=s?`?${s}`:"",a=this._getFinalPath(e),u=()=>(0,wr.get)(this.fetch,`${this.url}/${i}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new A5.default(u,this.shouldThrowOnError)}info(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,wr.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,kC.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,wr.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n)&&n instanceof Dr.StorageUnknownError){let i=n.originalError;if([400,404].includes(i?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),i=[],s=r?.download?`download=${r.download===!0?"":r.download}`:"";s!==""&&i.push(s);let a=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&i.push(u);let c=i.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}${c}`)}}}remove(e){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,wr.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Dr.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},O5),r),{prefix:e||""});return{data:yield(0,wr.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},n),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}listV2(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,wr.post)(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}};Wg.default=Gg});var Xg=_(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.version=void 0;of.version="2.84.0"});var Yg=_(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.DEFAULT_HEADERS=void 0;var x5=Xg();af.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${x5.version}`}});var LC=_(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});var Po=(he(),ce(fe)),T5=Yg(),Fo=Pi(),Ro=sf(),I5=Tu(),Jg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1;let s=new URL(e);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},T5.DEFAULT_HEADERS),r),this.fetch=(0,I5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Po.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Po.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Ro.post)(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Fo.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.put)(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Fo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}listBucketOptionsToQueryString(e){let r={};return e&&("limit"in e&&(r.limit=String(e.limit)),"offset"in e&&(r.offset=String(e.offset)),e.search&&(r.search=e.search),e.sortColumn&&(r.sortColumn=e.sortColumn),e.sortOrder&&(r.sortOrder=e.sortOrder)),Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():""}};Zg.default=Jg});var iy=_(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});var Qg=(he(),ce(fe)),P5=Yg(),ey=Pi(),ty=sf(),F5=Tu(),ry=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},P5.DEFAULT_HEADERS),r),this.fetch=(0,F5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{let r=new URLSearchParams;e?.limit!==void 0&&r.set("limit",e.limit.toString()),e?.offset!==void 0&&r.set("offset",e.offset.toString()),e?.sortColumn&&r.set("sortColumn",e.sortColumn),e?.sortOrder&&r.set("sortOrder",e.sortOrder),e?.search&&r.set("search",e.search);let n=r.toString(),i=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,ty.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}};ny.default=ry});var cf=_(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.DEFAULT_HEADERS=void 0;var R5=Xg();uf.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${R5.version}`,"Content-Type":"application/json"}});var ko=_(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.StorageVectorsErrorCode=sn.StorageVectorsUnknownError=sn.StorageVectorsApiError=sn.StorageVectorsError=void 0;sn.isStorageVectorsError=k5;var Pu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};sn.StorageVectorsError=Pu;function k5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var sy=class extends Pu{constructor(e,r,n){super(e),this.name="StorageVectorsApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};sn.StorageVectorsApiError=sy;var oy=class extends Pu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};sn.StorageVectorsUnknownError=oy;var BC;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(BC||(sn.StorageVectorsErrorCode=BC={}))});var No=_(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.validateVectorDimension=Hr.normalizeToFloat32=Hr.isPlainObject=Hr.resolveResponse=Hr.resolveFetch=void 0;var N5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Hr.resolveFetch=N5;var $5=()=>Response;Hr.resolveResponse=$5;var L5=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};Hr.isPlainObject=L5;var B5=t=>Array.from(new Float32Array(t));Hr.normalizeToFloat32=B5;var j5=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};Hr.validateVectorDimension=j5});var hf=_(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.get=H5;Lo.post=V5;Lo.put=z5;Lo.remove=K5;var $o=(he(),ce(fe)),lf=ko(),M5=No(),jC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),U5=(t,e,r)=>$o.__awaiter(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let i=t.status||500,s=t;if(typeof s.json=="function")s.json().then(o=>{let a=o?.statusCode||o?.code||i+"";e(new lf.StorageVectorsApiError(jC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))}}else e(new lf.StorageVectorsUnknownError(jC(t),t))}),q5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,M5.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,Object.assign(Object.assign({},i),r))};function ff(t,e,r,n,i,s){return $o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,q5(e,n,i,s)).then(u=>{if(!u.ok)throw u;if(n?.noResolveJson)return u;let c=u.headers.get("content-type");return!c||!c.includes("application/json")?{}:u.json()}).then(u=>o(u)).catch(u=>U5(u,a,n))})})}function H5(t,e,r,n){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"GET",e,r,n)})}function V5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"POST",e,n,i,r)})}function z5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"PUT",e,n,i,r)})}function K5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"DELETE",e,n,i,r)})}});var cy=_(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});var df=(he(),ce(fe)),G5=cf(),pf=ko(),mf=hf(),W5=No(),ay=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},G5.DEFAULT_HEADERS),r),this.fetch=(0,W5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};uy.default=ay});var hy=_(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});var Fu=(he(),ce(fe)),X5=cf(),Ru=ko(),ku=hf(),Y5=No(),ly=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},X5.DEFAULT_HEADERS),r),this.fetch=(0,Y5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield(0,ku.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield(0,ku.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield(0,ku.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};fy.default=ly});var my=_(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});var gf=(he(),ce(fe)),J5=cf(),yf=ko(),Df=hf(),Z5=No(),dy=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},J5.DEFAULT_HEADERS),r),this.fetch=(0,Z5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return gf.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};py.default=dy});var MC=_(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.VectorIndexScope=Fi.VectorBucketScope=Fi.StorageVectorsClient=void 0;var Vr=(he(),ce(fe)),Q5=Vr.__importDefault(cy()),e9=Vr.__importDefault(hy()),t9=Vr.__importDefault(my()),gy=class extends t9.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new wf(this.url,this.headers,e,this.fetch)}};Fi.StorageVectorsClient=gy;var wf=class extends Q5.default{constructor(e,r,n,i){super(e,r,i),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Vr.__awaiter(this,arguments,void 0,function*(r={}){return e.listIndexes.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){let r=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){let r=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new vf(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Fi.VectorBucketScope=wf;var vf=class extends e9.default{constructor(e,r,n,i,s){super(e,r,s),this.vectorBucketName=n,this.indexName=i}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){let r=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Vr.__awaiter(this,arguments,void 0,function*(r={}){return e.listVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){let r=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){let r=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Fi.VectorIndexScope=vf});var wy=_(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var yy=(he(),ce(fe)),Dy=MC();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return Dy.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return Dy.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return Dy.VectorIndexScope}});var r9=my();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return yy.__importDefault(r9).default}});var n9=cy();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return yy.__importDefault(n9).default}});var i9=hy();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return yy.__importDefault(i9).default}});var Nu=ko();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return Nu.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return Nu.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Nu.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Nu.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return Nu.isStorageVectorsError}});var $u=No();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return $u.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return $u.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return $u.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return $u.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return $u.validateVectorDimension}})});var UC=_(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.StorageClient=void 0;var Ey=(he(),ce(fe)),s9=Ey.__importDefault($C()),o9=Ey.__importDefault(LC()),a9=Ey.__importDefault(iy()),u9=wy(),vy=class extends o9.default{constructor(e,r={},n,i){super(e,r,n,i)}from(e){return new s9.default(this.url,this.headers,e,this.fetch)}get vectors(){return new u9.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new a9.default(this.url+"/iceberg",this.headers,this.fetch)}};Ef.StorageClient=vy});var HC=_(qC=>{"use strict";Object.defineProperty(qC,"__esModule",{value:!0})});var VC=_(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.StorageAnalyticsClient=Yn.StorageClient=void 0;var bf=(he(),ce(fe)),c9=UC();Object.defineProperty(Yn,"StorageClient",{enumerable:!0,get:function(){return c9.StorageClient}});var l9=iy();Object.defineProperty(Yn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return bf.__importDefault(l9).default}});bf.__exportStar(HC(),Yn);bf.__exportStar(Pi(),Yn);bf.__exportStar(wy(),Yn)});var zC=_(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.version=void 0;_f.version="2.84.0"});var KC=_(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.DEFAULT_REALTIME_OPTIONS=Fr.DEFAULT_AUTH_OPTIONS=Fr.DEFAULT_DB_OPTIONS=Fr.DEFAULT_GLOBAL_OPTIONS=Fr.DEFAULT_HEADERS=void 0;var f9=zC(),Lu="";typeof Deno<"u"?Lu="deno":typeof document<"u"?Lu="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Lu="react-native":Lu="node";Fr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Lu}/${f9.version}`};Fr.DEFAULT_GLOBAL_OPTIONS={headers:Fr.DEFAULT_HEADERS};Fr.DEFAULT_DB_OPTIONS={schema:"public"};Fr.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Fr.DEFAULT_REALTIME_OPTIONS={}});var GC=_(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.fetchWithAuth=yn.resolveHeadersConstructor=yn.resolveFetch=void 0;var h9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);yn.resolveFetch=h9;var d9=()=>Headers;yn.resolveHeadersConstructor=d9;var p9=(t,e,r)=>{let n=(0,yn.resolveFetch)(r),i=(0,yn.resolveHeadersConstructor)();return async(s,o)=>{var a;let u=(a=await e())!==null&&a!==void 0?a:t,c=new i(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(s,Object.assign(Object.assign({},o),{headers:c}))}};yn.fetchWithAuth=p9});var XC=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.isBrowser=void 0;Ri.uuid=m9;Ri.ensureTrailingSlash=WC;Ri.applySettingDefaults=y9;Ri.validateSupabaseUrl=D9;function m9(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t=="x"?e:e&3|8;return r.toString(16)})}function WC(t){return t.endsWith("/")?t:t+"/"}var g9=()=>typeof window<"u";Ri.isBrowser=g9;function y9(t,e){var r,n;let{db:i,auth:s,realtime:o,global:a}=t,{db:u,auth:c,realtime:l,global:h}=e,d={db:Object.assign(Object.assign({},u),i),auth:Object.assign(Object.assign({},c),s),realtime:Object.assign(Object.assign({},l),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),a),{headers:Object.assign(Object.assign({},(r=h?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function D9(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(WC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var by=_(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.version=void 0;Cf.version="2.84.0"});var Sf=_(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.JWKS_TTL=Me.BASE64URL_REGEX=Me.API_VERSIONS=Me.API_VERSION_HEADER_NAME=Me.NETWORK_FAILURE=Me.DEFAULT_HEADERS=Me.AUDIENCE=Me.STORAGE_KEY=Me.GOTRUE_URL=Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD=Me.AUTO_REFRESH_TICK_DURATION_MS=void 0;var w9=by();Me.AUTO_REFRESH_TICK_DURATION_MS=30*1e3;Me.AUTO_REFRESH_TICK_THRESHOLD=3;Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD*Me.AUTO_REFRESH_TICK_DURATION_MS;Me.GOTRUE_URL="http://localhost:9999";Me.STORAGE_KEY="supabase.auth.token";Me.AUDIENCE="";Me.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${w9.version}`};Me.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};Me.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";Me.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};Me.BASE64URL_REGEX=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;Me.JWKS_TTL=600*1e3});var gs=_(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.AuthInvalidJwtError=Ae.AuthWeakPasswordError=Ae.AuthRetryableFetchError=Ae.AuthPKCEGrantCodeExchangeError=Ae.AuthImplicitGrantRedirectError=Ae.AuthInvalidCredentialsError=Ae.AuthInvalidTokenResponseError=Ae.AuthSessionMissingError=Ae.CustomAuthError=Ae.AuthUnknownError=Ae.AuthApiError=Ae.AuthError=void 0;Ae.isAuthError=jo;Ae.isAuthApiError=v9;Ae.isAuthSessionMissingError=E9;Ae.isAuthImplicitGrantRedirectError=b9;Ae.isAuthRetryableFetchError=_9;Ae.isAuthWeakPasswordError=C9;var Bo=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Ae.AuthError=Bo;function jo(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var _y=class extends Bo{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Ae.AuthApiError=_y;function v9(t){return jo(t)&&t.name==="AuthApiError"}var Cy=class extends Bo{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Ae.AuthUnknownError=Cy;var on=class extends Bo{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Ae.CustomAuthError=on;var Sy=class extends on{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Ae.AuthSessionMissingError=Sy;function E9(t){return jo(t)&&t.name==="AuthSessionMissingError"}var Ay=class extends on{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Ae.AuthInvalidTokenResponseError=Ay;var Oy=class extends on{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Ae.AuthInvalidCredentialsError=Oy;var xy=class extends on{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Ae.AuthImplicitGrantRedirectError=xy;function b9(t){return jo(t)&&t.name==="AuthImplicitGrantRedirectError"}var Ty=class extends on{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Ae.AuthPKCEGrantCodeExchangeError=Ty;var Iy=class extends on{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Ae.AuthRetryableFetchError=Iy;function _9(t){return jo(t)&&t.name==="AuthRetryableFetchError"}var Py=class extends on{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Ae.AuthWeakPasswordError=Py;function C9(t){return jo(t)&&t.name==="AuthWeakPasswordError"}var Fy=class extends on{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Ae.AuthInvalidJwtError=Fy});var Of=_(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.byteToBase64URL=Bu;zr.byteFromBase64URL=Ry;zr.stringToBase64URL=A9;zr.stringFromBase64URL=O9;zr.codepointToUTF8=JC;zr.stringToUTF8=ky;zr.stringFromUTF8=ZC;zr.base64UrlToUint8Array=x9;zr.stringToUint8Array=T9;zr.bytesToBase64URL=I9;var Af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),YC=`
26
+ })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case St.SOCKET_STATES.connecting:return St.CONNECTION_STATE.Connecting;case St.SOCKET_STATES.open:return St.CONNECTION_STATE.Open;case St.SOCKET_STATES.closing:return St.CONNECTION_STATE.Closing;default:return St.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===St.CONNECTION_STATE.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){let n=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===n);if(i)return i;{let s=new i5.default(`realtime:${e}`,r,this);return this.channels.push(s),s}}push(e){let{topic:r,event:n,payload:i,ref:s}=e,o=()=>{this.encode(e,a=>{var u;(u=this.conn)===null||u===void 0||u.send(a)})};this.log("push",`${r} ${n} (${s})`,i),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(St.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},tf.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply")try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:n,event:i,payload:s,ref:o}=r,a=o?`(${o})`:"",u=s.status||"";this.log("receive",`${u} ${n} ${i} ${a}`.trim(),s),this.channels.filter(c=>c._isMember(n)).forEach(c=>c._trigger(i,s,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){if(this.conn){if(this.conn.readyState===St.SOCKET_STATES.open||this.conn.readyState===St.SOCKET_STATES.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(St.CHANNEL_EVENTS.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;let n=e.match(/\?/)?"&":"?",i=new URLSearchParams(r);return`${e}${n}${i}`}_workerObjectUrl(e){let r;if(e)r=e;else{let n=new Blob([a5],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r;e?r=e:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{let i={access_token:r,version:St.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(St.CHANNEL_EVENTS.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new r5.default(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},tf.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,i,s,o,a,u,c,l,h,d,f;switch(this.transport=(r=e?.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e?.timeout)!==null&&n!==void 0?n:St.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:tf.HEARTBEAT_INTERVAL,this.worker=(s=e?.worker)!==null&&s!==void 0?s:!1,this.accessToken=(o=e?.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e?.heartbeatCallback)!==null&&a!==void 0?a:Ng,this.vsn=(u=e?.vsn)!==null&&u!==void 0?u:St.DEFAULT_VSN,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e?.reconnectAfterMs)!==null&&c!==void 0?c:(m=>s5[m-1]||o5),this.vsn){case St.VSN_1_0_0:this.encode=(l=e?.encode)!==null&&l!==void 0?l:((m,y)=>y(JSON.stringify(m))),this.decode=(h=e?.decode)!==null&&h!==void 0?h:((m,y)=>y(JSON.parse(m)));break;case St.VSN_2_0_0:this.encode=(d=e?.encode)!==null&&d!==void 0?d:this.serializer.encode.bind(this.serializer),this.decode=(f=e?.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}};Lg.default=$g});var Bg=_(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.WebSocketFactory=Tt.REALTIME_CHANNEL_STATES=Tt.REALTIME_SUBSCRIBE_STATES=Tt.REALTIME_PRESENCE_LISTEN_EVENTS=Tt.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Tt.REALTIME_LISTEN_TYPES=Tt.RealtimeClient=Tt.RealtimeChannel=Tt.RealtimePresence=void 0;var nf=(he(),ce(fe)),u5=nf.__importDefault(OC());Tt.RealtimeClient=u5.default;var Ou=nf.__importStar(kg());Tt.RealtimeChannel=Ou.default;Object.defineProperty(Tt,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Ou.REALTIME_LISTEN_TYPES}});Object.defineProperty(Tt,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Ou.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Tt,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Tt,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_CHANNEL_STATES}});var xC=nf.__importStar(Pg());Tt.RealtimePresence=xC.default;Object.defineProperty(Tt,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return xC.REALTIME_PRESENCE_LISTEN_EVENTS}});var c5=nf.__importDefault(Eg());Tt.WebSocketFactory=c5.default});var Pi=_(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.StorageUnknownError=Yn.StorageApiError=Yn.StorageError=void 0;Yn.isStorageError=l5;var xu=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Yn.StorageError=xu;function l5(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var jg=class extends xu{constructor(e,r,n){super(e),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};Yn.StorageApiError=jg;var Mg=class extends xu{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Yn.StorageUnknownError=Mg});var Tu=_(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.isPlainObject=qr.recursiveToCamel=qr.resolveResponse=qr.resolveFetch=void 0;var f5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);qr.resolveFetch=f5;var h5=()=>Response;qr.resolveResponse=h5;var d5=t=>{if(Array.isArray(t))return t.map(r=>(0,qr.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let i=r.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=(0,qr.recursiveToCamel)(n)}),e};qr.recursiveToCamel=d5;var p5=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};qr.isPlainObject=p5});var sf=_(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.get=y5;ms.post=D5;ms.put=w5;ms.head=v5;ms.remove=E5;var ps=(he(),ce(fe)),Ug=Pi(),TC=Tu(),qg=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},m5=(t,e,r)=>ps.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,TC.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(i=>{let s=t.status||500,o=i?.statusCode||s+"";e(new Ug.StorageApiError(qg(i),s,o))}).catch(i=>{e(new Ug.StorageUnknownError(qg(i),i))}):e(new Ug.StorageUnknownError(qg(t),t))}),g5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,TC.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,e?.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),r))};function Iu(t,e,r,n,i,s){return ps.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,g5(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>m5(u,a,n))})})}function y5(t,e,r,n){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"GET",e,r,n)})}function D5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"POST",e,n,i,r)})}function w5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"PUT",e,n,i,r)})}function v5(t,e,r,n){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function E5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Iu(t,"DELETE",e,n,i,r)})}});var IC=_(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});var b5=(he(),ce(fe)),_5=Pi(),Hg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return b5.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,_5.isStorageError)(e))return{data:null,error:e};throw e}})}};Vg.default=Hg});var RC=_(Kg=>{"use strict";var PC;Object.defineProperty(Kg,"__esModule",{value:!0});var FC=(he(),ce(fe)),C5=Pi(),S5=FC.__importDefault(IC()),zg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[PC]="BlobDownloadBuilder",this.promise=null}asStream(){return new S5.default(this.downloadFn,this.shouldThrowOnError)}then(e,r){return this.getPromise().then(e,r)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return FC.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,C5.isStorageError)(e))return{data:null,error:e};throw e}})}};PC=Symbol.toStringTag;Kg.default=zg});var $C=_(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});var rr=(he(),ce(fe)),Dr=Pi(),wr=sf(),kC=Tu(),A5=rr.__importDefault(RC()),O5={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},NC={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Gg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,kC.resolveFetch)(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){try{let s,o=Object.assign(Object.assign({},NC),i),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)}),u=o.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),u&&s.append("metadata",this.encodeMetadata(u)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",o.cacheControl),u&&!s.has("metadata")&&s.append("metadata",this.encodeMetadata(u))):(s=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,u&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!o.duplex&&(o.duplex="half")),i?.headers&&(a=Object.assign(Object.assign({},a),i.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),h=yield(e=="PUT"?wr.put:wr.post)(this.fetch,`${this.url}/object/${l}`,s,Object.assign({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if((0,Dr.isStorageError)(s))return{data:null,error:s};throw s}})}upload(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(e),o=this._getFinalPath(s),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",r);try{let u,c=Object.assign({upsert:NC.upsert},i),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let h=yield(0,wr.put)(this.fetch,a.toString(),u,{headers:l});return{data:{path:s,fullPath:h.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Dr.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=Object.assign({},this.headers);r?.upsert&&(i["x-upsert"]="true");let s=yield(0,wr.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(this.url+s.url),a=o.searchParams.get("token");if(!a)throw new Dr.StorageError("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:a},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,wr.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}copy(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,wr.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrl(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),s=yield(0,wr.post)(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),o=n?.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrls(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=yield(0,wr.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),s=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${s}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}download(e,r){let i=typeof r?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(r?.transform||{}),o=s?`?${s}`:"",a=this._getFinalPath(e),u=()=>(0,wr.get)(this.fetch,`${this.url}/${i}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new A5.default(u,this.shouldThrowOnError)}info(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,wr.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,kC.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,wr.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n)&&n instanceof Dr.StorageUnknownError){let i=n.originalError;if([400,404].includes(i?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),i=[],s=r?.download?`download=${r.download===!0?"":r.download}`:"";s!==""&&i.push(s);let a=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&i.push(u);let c=i.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}${c}`)}}}remove(e){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,wr.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Dr.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},O5),r),{prefix:e||""});return{data:yield(0,wr.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},n),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Dr.isStorageError)(i))return{data:null,error:i};throw i}})}listV2(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,wr.post)(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}};Wg.default=Gg});var Xg=_(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.version=void 0;of.version="2.84.0"});var Yg=_(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.DEFAULT_HEADERS=void 0;var x5=Xg();af.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${x5.version}`}});var LC=_(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});var Po=(he(),ce(fe)),T5=Yg(),Fo=Pi(),Ro=sf(),I5=Tu(),Jg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1;let s=new URL(e);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},T5.DEFAULT_HEADERS),r),this.fetch=(0,I5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Po.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Po.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Ro.post)(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Fo.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.put)(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Fo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}listBucketOptionsToQueryString(e){let r={};return e&&("limit"in e&&(r.limit=String(e.limit)),"offset"in e&&(r.offset=String(e.offset)),e.search&&(r.search=e.search),e.sortColumn&&(r.sortColumn=e.sortColumn),e.sortOrder&&(r.sortOrder=e.sortOrder)),Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():""}};Zg.default=Jg});var iy=_(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});var Qg=(he(),ce(fe)),P5=Yg(),ey=Pi(),ty=sf(),F5=Tu(),ry=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},P5.DEFAULT_HEADERS),r),this.fetch=(0,F5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{let r=new URLSearchParams;e?.limit!==void 0&&r.set("limit",e.limit.toString()),e?.offset!==void 0&&r.set("offset",e.offset.toString()),e?.sortColumn&&r.set("sortColumn",e.sortColumn),e?.sortOrder&&r.set("sortOrder",e.sortOrder),e?.search&&r.set("search",e.search);let n=r.toString(),i=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,ty.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}};ny.default=ry});var cf=_(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.DEFAULT_HEADERS=void 0;var R5=Xg();uf.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${R5.version}`,"Content-Type":"application/json"}});var ko=_(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.StorageVectorsErrorCode=an.StorageVectorsUnknownError=an.StorageVectorsApiError=an.StorageVectorsError=void 0;an.isStorageVectorsError=k5;var Pu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};an.StorageVectorsError=Pu;function k5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var sy=class extends Pu{constructor(e,r,n){super(e),this.name="StorageVectorsApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};an.StorageVectorsApiError=sy;var oy=class extends Pu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};an.StorageVectorsUnknownError=oy;var BC;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(BC||(an.StorageVectorsErrorCode=BC={}))});var No=_(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.validateVectorDimension=Hr.normalizeToFloat32=Hr.isPlainObject=Hr.resolveResponse=Hr.resolveFetch=void 0;var N5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Hr.resolveFetch=N5;var $5=()=>Response;Hr.resolveResponse=$5;var L5=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};Hr.isPlainObject=L5;var B5=t=>Array.from(new Float32Array(t));Hr.normalizeToFloat32=B5;var j5=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};Hr.validateVectorDimension=j5});var hf=_(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.get=H5;Lo.post=V5;Lo.put=z5;Lo.remove=K5;var $o=(he(),ce(fe)),lf=ko(),M5=No(),jC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),U5=(t,e,r)=>$o.__awaiter(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let i=t.status||500,s=t;if(typeof s.json=="function")s.json().then(o=>{let a=o?.statusCode||o?.code||i+"";e(new lf.StorageVectorsApiError(jC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))}}else e(new lf.StorageVectorsUnknownError(jC(t),t))}),q5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,M5.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,Object.assign(Object.assign({},i),r))};function ff(t,e,r,n,i,s){return $o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,q5(e,n,i,s)).then(u=>{if(!u.ok)throw u;if(n?.noResolveJson)return u;let c=u.headers.get("content-type");return!c||!c.includes("application/json")?{}:u.json()}).then(u=>o(u)).catch(u=>U5(u,a,n))})})}function H5(t,e,r,n){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"GET",e,r,n)})}function V5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"POST",e,n,i,r)})}function z5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"PUT",e,n,i,r)})}function K5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"DELETE",e,n,i,r)})}});var cy=_(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});var df=(he(),ce(fe)),G5=cf(),pf=ko(),mf=hf(),W5=No(),ay=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},G5.DEFAULT_HEADERS),r),this.fetch=(0,W5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};uy.default=ay});var hy=_(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});var Fu=(he(),ce(fe)),X5=cf(),Ru=ko(),ku=hf(),Y5=No(),ly=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},X5.DEFAULT_HEADERS),r),this.fetch=(0,Y5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield(0,ku.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield(0,ku.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield(0,ku.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};fy.default=ly});var my=_(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});var gf=(he(),ce(fe)),J5=cf(),yf=ko(),Df=hf(),Z5=No(),dy=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},J5.DEFAULT_HEADERS),r),this.fetch=(0,Z5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return gf.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};py.default=dy});var MC=_(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.VectorIndexScope=Fi.VectorBucketScope=Fi.StorageVectorsClient=void 0;var Vr=(he(),ce(fe)),Q5=Vr.__importDefault(cy()),e9=Vr.__importDefault(hy()),t9=Vr.__importDefault(my()),gy=class extends t9.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new wf(this.url,this.headers,e,this.fetch)}};Fi.StorageVectorsClient=gy;var wf=class extends Q5.default{constructor(e,r,n,i){super(e,r,i),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Vr.__awaiter(this,arguments,void 0,function*(r={}){return e.listIndexes.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){let r=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){let r=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new vf(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Fi.VectorBucketScope=wf;var vf=class extends e9.default{constructor(e,r,n,i,s){super(e,r,s),this.vectorBucketName=n,this.indexName=i}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){let r=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Vr.__awaiter(this,arguments,void 0,function*(r={}){return e.listVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){let r=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){let r=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Fi.VectorIndexScope=vf});var wy=_(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var yy=(he(),ce(fe)),Dy=MC();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return Dy.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return Dy.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return Dy.VectorIndexScope}});var r9=my();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return yy.__importDefault(r9).default}});var n9=cy();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return yy.__importDefault(n9).default}});var i9=hy();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return yy.__importDefault(i9).default}});var Nu=ko();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return Nu.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return Nu.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Nu.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Nu.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return Nu.isStorageVectorsError}});var $u=No();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return $u.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return $u.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return $u.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return $u.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return $u.validateVectorDimension}})});var UC=_(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.StorageClient=void 0;var Ey=(he(),ce(fe)),s9=Ey.__importDefault($C()),o9=Ey.__importDefault(LC()),a9=Ey.__importDefault(iy()),u9=wy(),vy=class extends o9.default{constructor(e,r={},n,i){super(e,r,n,i)}from(e){return new s9.default(this.url,this.headers,e,this.fetch)}get vectors(){return new u9.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new a9.default(this.url+"/iceberg",this.headers,this.fetch)}};Ef.StorageClient=vy});var HC=_(qC=>{"use strict";Object.defineProperty(qC,"__esModule",{value:!0})});var VC=_(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.StorageAnalyticsClient=Jn.StorageClient=void 0;var bf=(he(),ce(fe)),c9=UC();Object.defineProperty(Jn,"StorageClient",{enumerable:!0,get:function(){return c9.StorageClient}});var l9=iy();Object.defineProperty(Jn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return bf.__importDefault(l9).default}});bf.__exportStar(HC(),Jn);bf.__exportStar(Pi(),Jn);bf.__exportStar(wy(),Jn)});var zC=_(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.version=void 0;_f.version="2.84.0"});var KC=_(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.DEFAULT_REALTIME_OPTIONS=Fr.DEFAULT_AUTH_OPTIONS=Fr.DEFAULT_DB_OPTIONS=Fr.DEFAULT_GLOBAL_OPTIONS=Fr.DEFAULT_HEADERS=void 0;var f9=zC(),Lu="";typeof Deno<"u"?Lu="deno":typeof document<"u"?Lu="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Lu="react-native":Lu="node";Fr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Lu}/${f9.version}`};Fr.DEFAULT_GLOBAL_OPTIONS={headers:Fr.DEFAULT_HEADERS};Fr.DEFAULT_DB_OPTIONS={schema:"public"};Fr.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Fr.DEFAULT_REALTIME_OPTIONS={}});var GC=_(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.fetchWithAuth=yn.resolveHeadersConstructor=yn.resolveFetch=void 0;var h9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);yn.resolveFetch=h9;var d9=()=>Headers;yn.resolveHeadersConstructor=d9;var p9=(t,e,r)=>{let n=(0,yn.resolveFetch)(r),i=(0,yn.resolveHeadersConstructor)();return async(s,o)=>{var a;let u=(a=await e())!==null&&a!==void 0?a:t,c=new i(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(s,Object.assign(Object.assign({},o),{headers:c}))}};yn.fetchWithAuth=p9});var XC=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.isBrowser=void 0;Ri.uuid=m9;Ri.ensureTrailingSlash=WC;Ri.applySettingDefaults=y9;Ri.validateSupabaseUrl=D9;function m9(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t=="x"?e:e&3|8;return r.toString(16)})}function WC(t){return t.endsWith("/")?t:t+"/"}var g9=()=>typeof window<"u";Ri.isBrowser=g9;function y9(t,e){var r,n;let{db:i,auth:s,realtime:o,global:a}=t,{db:u,auth:c,realtime:l,global:h}=e,d={db:Object.assign(Object.assign({},u),i),auth:Object.assign(Object.assign({},c),s),realtime:Object.assign(Object.assign({},l),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),a),{headers:Object.assign(Object.assign({},(r=h?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function D9(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(WC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var by=_(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.version=void 0;Cf.version="2.84.0"});var Sf=_(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.JWKS_TTL=Me.BASE64URL_REGEX=Me.API_VERSIONS=Me.API_VERSION_HEADER_NAME=Me.NETWORK_FAILURE=Me.DEFAULT_HEADERS=Me.AUDIENCE=Me.STORAGE_KEY=Me.GOTRUE_URL=Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD=Me.AUTO_REFRESH_TICK_DURATION_MS=void 0;var w9=by();Me.AUTO_REFRESH_TICK_DURATION_MS=30*1e3;Me.AUTO_REFRESH_TICK_THRESHOLD=3;Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD*Me.AUTO_REFRESH_TICK_DURATION_MS;Me.GOTRUE_URL="http://localhost:9999";Me.STORAGE_KEY="supabase.auth.token";Me.AUDIENCE="";Me.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${w9.version}`};Me.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};Me.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";Me.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};Me.BASE64URL_REGEX=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;Me.JWKS_TTL=600*1e3});var gs=_(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.AuthInvalidJwtError=Ae.AuthWeakPasswordError=Ae.AuthRetryableFetchError=Ae.AuthPKCEGrantCodeExchangeError=Ae.AuthImplicitGrantRedirectError=Ae.AuthInvalidCredentialsError=Ae.AuthInvalidTokenResponseError=Ae.AuthSessionMissingError=Ae.CustomAuthError=Ae.AuthUnknownError=Ae.AuthApiError=Ae.AuthError=void 0;Ae.isAuthError=jo;Ae.isAuthApiError=v9;Ae.isAuthSessionMissingError=E9;Ae.isAuthImplicitGrantRedirectError=b9;Ae.isAuthRetryableFetchError=_9;Ae.isAuthWeakPasswordError=C9;var Bo=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Ae.AuthError=Bo;function jo(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var _y=class extends Bo{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Ae.AuthApiError=_y;function v9(t){return jo(t)&&t.name==="AuthApiError"}var Cy=class extends Bo{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Ae.AuthUnknownError=Cy;var un=class extends Bo{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Ae.CustomAuthError=un;var Sy=class extends un{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Ae.AuthSessionMissingError=Sy;function E9(t){return jo(t)&&t.name==="AuthSessionMissingError"}var Ay=class extends un{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Ae.AuthInvalidTokenResponseError=Ay;var Oy=class extends un{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Ae.AuthInvalidCredentialsError=Oy;var xy=class extends un{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Ae.AuthImplicitGrantRedirectError=xy;function b9(t){return jo(t)&&t.name==="AuthImplicitGrantRedirectError"}var Ty=class extends un{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Ae.AuthPKCEGrantCodeExchangeError=Ty;var Iy=class extends un{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Ae.AuthRetryableFetchError=Iy;function _9(t){return jo(t)&&t.name==="AuthRetryableFetchError"}var Py=class extends un{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Ae.AuthWeakPasswordError=Py;function C9(t){return jo(t)&&t.name==="AuthWeakPasswordError"}var Fy=class extends un{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Ae.AuthInvalidJwtError=Fy});var Of=_(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.byteToBase64URL=Bu;zr.byteFromBase64URL=Ry;zr.stringToBase64URL=A9;zr.stringFromBase64URL=O9;zr.codepointToUTF8=JC;zr.stringToUTF8=ky;zr.stringFromUTF8=ZC;zr.base64UrlToUint8Array=x9;zr.stringToUint8Array=T9;zr.bytesToBase64URL=I9;var Af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),YC=`
27
27
  \r=`.split(""),S9=(()=>{let t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<YC.length;e+=1)t[YC[e].charCodeAt(0)]=-2;for(let e=0;e<Af.length;e+=1)t[Af[e].charCodeAt(0)]=e;return t})();function Bu(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){let n=e.queue>>e.queuedBits-6&63;r(Af[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){let n=e.queue>>e.queuedBits-6&63;r(Af[n]),e.queuedBits-=6}}function Ry(t,e,r){let n=S9[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function A9(t){let e=[],r=i=>{e.push(i)},n={queue:0,queuedBits:0};return ky(t,i=>{Bu(i,n,r)}),Bu(null,n,r),e.join("")}function O9(t){let e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=o=>{ZC(o,n,r)};for(let o=0;o<t.length;o+=1)Ry(t.charCodeAt(o),i,s);return e.join("")}function JC(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function ky(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){let i=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}JC(n,e)}}function ZC(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function x9(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)Ry(t.charCodeAt(i),r,n);return new Uint8Array(e)}function T9(t){let e=[];return ky(t,r=>e.push(r)),new Uint8Array(e)}function I9(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};return t.forEach(i=>Bu(i,r,n)),Bu(null,r,n),e.join("")}});var Mo=_(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.Deferred=be.removeItemAsync=be.getItemAsync=be.setItemAsync=be.looksLikeFetchResponse=be.resolveFetch=be.supportsLocalStorage=be.isBrowser=void 0;be.expiresAt=P9;be.generateCallbackId=F9;be.parseParametersFromURL=N9;be.decodeJWT=U9;be.sleep=q9;be.retryable=H9;be.generatePKCEVerifier=tS;be.generatePKCEChallenge=rS;be.getCodeChallengeAndMethod=K9;be.parseResponseAPIVersion=W9;be.validateExp=X9;be.getAlgorithm=Y9;be.validateUUID=Z9;be.userNotAvailableProxy=Q9;be.insecureUserWarningProxy=eH;be.deepClone=tH;var eS=Sf(),QC=gs(),Ny=Of();function P9(t){return Math.round(Date.now()/1e3)+t}function F9(){return Symbol("auth-callback")}var R9=()=>typeof window<"u"&&typeof document<"u";be.isBrowser=R9;var ys={tested:!1,writable:!1},k9=()=>{if(!(0,be.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ys.tested)return ys.writable;let t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),ys.tested=!0,ys.writable=!0}catch{ys.tested=!0,ys.writable=!1}return ys.writable};be.supportsLocalStorage=k9;function N9(t){let e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return r.searchParams.forEach((n,i)=>{e[i]=n}),e}var $9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);be.resolveFetch=$9;var L9=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function";be.looksLikeFetchResponse=L9;var B9=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))};be.setItemAsync=B9;var j9=async(t,e)=>{let r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}};be.getItemAsync=j9;var M9=async(t,e)=>{await t.removeItem(e)};be.removeItemAsync=M9;var xf=class t{constructor(){this.promise=new t.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}};be.Deferred=xf;xf.promiseConstructor=Promise;function U9(t){let e=t.split(".");if(e.length!==3)throw new QC.AuthInvalidJwtError("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!eS.BASE64URL_REGEX.test(e[n]))throw new QC.AuthInvalidJwtError("JWT not in base64url format");return{header:JSON.parse((0,Ny.stringFromBase64URL)(e[0])),payload:JSON.parse((0,Ny.stringFromBase64URL)(e[1])),signature:(0,Ny.base64UrlToUint8Array)(e[2]),raw:{header:e[0],payload:e[1]}}}async function q9(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function H9(t,e){return new Promise((n,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{let o=await t(s);if(!e(s,null,o)){n(o);return}}catch(o){if(!e(s,o)){i(o);return}}})()})}function V9(t){return("0"+t.toString(16)).substr(-2)}function tS(){let e=new Uint32Array(56);if(typeof crypto>"u"){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length,i="";for(let s=0;s<56;s++)i+=r.charAt(Math.floor(Math.random()*n));return i}return crypto.getRandomValues(e),Array.from(e,V9).join("")}async function z9(t){let r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(n);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function rS(t){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."),t;let r=await z9(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function K9(t,e,r=!1){let n=tS(),i=n;r&&(i+="/PASSWORD_RECOVERY"),await(0,be.setItemAsync)(t,`${e}-code-verifier`,i);let s=await rS(n);return[s,n===s?"plain":"s256"]}var G9=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function W9(t){let e=t.headers.get(eS.API_VERSION_HEADER_NAME);if(!e||!e.match(G9))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function X9(t){if(!t)throw new Error("Missing exp claim");let e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Y9(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}var J9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Z9(t){if(!J9.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Q9(){let t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){let n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function eH(t,e){return new Proxy(t,{get:(r,n,i)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){let s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,i)}return!e.value&&typeof n=="string"&&(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 may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,i)}})}function tH(t){return JSON.parse(JSON.stringify(t))}});var By=_(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.handleError=Ly;Dn._request=sH;Dn._sessionResponse=nS;Dn._sessionResponsePassword=aH;Dn._userResponse=uH;Dn._ssoResponse=cH;Dn._generateLinkResponse=lH;Dn._noResolveJsonResponse=fH;var rH=(he(),ce(fe)),Tf=Sf(),$y=Mo(),ki=gs(),Ds=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),nH=[502,503,504];async function Ly(t){var e;if(!(0,$y.looksLikeFetchResponse)(t))throw new ki.AuthRetryableFetchError(Ds(t),0);if(nH.includes(t.status))throw new ki.AuthRetryableFetchError(Ds(t),t.status);let r;try{r=await t.json()}catch(s){throw new ki.AuthUnknownError(Ds(s),s)}let n,i=(0,$y.parseResponseAPIVersion)(t);if(i&&i.getTime()>=Tf.API_VERSIONS["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new ki.AuthWeakPasswordError(Ds(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new ki.AuthSessionMissingError}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,o)=>s&&typeof o=="string",!0))throw new ki.AuthWeakPasswordError(Ds(r),t.status,r.weak_password.reasons);throw new ki.AuthApiError(Ds(r),t.status||500,n)}var iH=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};async function sH(t,e,r,n){var i;let s=Object.assign({},n?.headers);s[Tf.API_VERSION_HEADER_NAME]||(s[Tf.API_VERSION_HEADER_NAME]=Tf.API_VERSIONS["2024-01-01"].name),n?.jwt&&(s.Authorization=`Bearer ${n.jwt}`);let o=(i=n?.query)!==null&&i!==void 0?i:{};n?.redirectTo&&(o.redirect_to=n.redirectTo);let a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",u=await oH(t,e,r+a,{headers:s,noResolveJson:n?.noResolveJson},{},n?.body);return n?.xform?n?.xform(u):{data:Object.assign({},u),error:null}}async function oH(t,e,r,n,i,s){let o=iH(e,n,i,s),a;try{a=await t(r,Object.assign({},o))}catch(u){throw console.error(u),new ki.AuthRetryableFetchError(Ds(u),0)}if(a.ok||await Ly(a),n?.noResolveJson)return a;try{return await a.json()}catch(u){await Ly(u)}}function nS(t){var e;let r=null;hH(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=(0,$y.expiresAt)(t.expires_in)));let n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function aH(t){let e=nS(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function uH(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function cH(t){return{data:t,error:null}}function lH(t){let{action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=t,o=rH.__rest(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s},u=Object.assign({},o);return{data:{properties:a,user:u},error:null}}function fH(t){return t}function hH(t){return t.access_token&&t.refresh_token&&t.expires_in}});var jy=_(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.SIGN_OUT_SCOPES=void 0;If.SIGN_OUT_SCOPES=["global","local","others"]});var Pf=_(qy=>{"use strict";Object.defineProperty(qy,"__esModule",{value:!0});var dH=(he(),ce(fe)),ot=By(),ws=Mo(),My=jy(),Kt=gs(),Uy=class{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=(0,ws.resolveFetch)(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,r=My.SIGN_OUT_SCOPES[0]){if(My.SIGN_OUT_SCOPES.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${My.SIGN_OUT_SCOPES.join(", ")}`);try{return await(0,ot._request)(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if((0,Kt.isAuthError)(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await(0,ot._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ot._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{let{options:r}=e,n=dH.__rest(e,["options"]),i=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(i.new_email=n?.newEmail,delete i.newEmail),await(0,ot._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:ot._generateLinkResponse,redirectTo:r?.redirectTo})}catch(r){if((0,Kt.isAuthError)(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await(0,ot._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ot._userResponse})}catch(r){if((0,Kt.isAuthError)(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,i,s,o,a,u;try{let c={nextPage:null,lastPage:0,total:0},l=await(0,ot._request)(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e?.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(s=(i=e?.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:ot._noResolveJsonResponse});if(l.error)throw l.error;let h=await l.json(),d=(o=l.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(u=(a=l.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(m=>{let y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(m.split(";")[1].split("=")[1]);c[`${v}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if((0,Kt.isAuthError)(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){(0,ws.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ot._userResponse})}catch(r){if((0,Kt.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){(0,ws.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:ot._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){(0,ws.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:ot._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){(0,ws.validateUUID)(e.userId);try{let{data:r,error:n}=await(0,ot._request)(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:n}}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _deleteFactor(e){(0,ws.validateUUID)(e.userId),(0,ws.validateUUID)(e.id);try{return{data:await(0,ot._request)(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,i,s,o,a,u;try{let c={nextPage:null,lastPage:0,total:0},l=await(0,ot._request)(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e?.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(s=(i=e?.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:ot._noResolveJsonResponse});if(l.error)throw l.error;let h=await l.json(),d=(o=l.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(u=(a=l.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(m=>{let y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(m.split(";")[1].split("=")[1]);c[`${v}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if((0,Kt.isAuthError)(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await(0,ot._request)(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await(0,ot._request)(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await(0,ot._request)(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if((0,Kt.isAuthError)(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await(0,ot._request)(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await(0,ot._request)(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}};qy.default=Uy});var iS=_(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});Hy.memoryLocalStorageAdapter=pH;function pH(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}});var Vy=_(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.ProcessLockAcquireTimeoutError=Rt.NavigatorLockAcquireTimeoutError=Rt.LockAcquireTimeoutError=Rt.internals=void 0;Rt.navigatorLock=gH;Rt.processLock=yH;var mH=Mo();Rt.internals={debug:!!(globalThis&&(0,mH.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var ju=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}};Rt.LockAcquireTimeoutError=ju;var Ff=class extends ju{};Rt.NavigatorLockAcquireTimeoutError=Ff;var Rf=class extends ju{};Rt.ProcessLockAcquireTimeoutError=Rf;async function gH(t,e,r){Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);let n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Ff(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Rt.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()}}))}var sS={};async function yH(t,e,r){var n;let i=(n=sS[t])!==null&&n!==void 0?n:Promise.resolve(),s=Promise.race([i.catch(()=>null),e>=0?new Promise((o,a)=>{setTimeout(()=>{a(new Rf(`Acquring process lock with name "${t}" timed out`))},e)}):null].filter(o=>o)).catch(o=>{if(o&&o.isAcquireTimeout)throw o;return null}).then(async()=>await r());return sS[t]=s.catch(async o=>{if(o&&o.isAcquireTimeout)return await i,null;throw o}),await s}});var oS=_(zy=>{"use strict";Object.defineProperty(zy,"__esModule",{value:!0});zy.polyfillGlobalThis=DH;function DH(){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)}}});var uS=_(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.getAddress=aS;Uo.fromHex=wH;Uo.toHex=vH;Uo.createSiweMessage=EH;function aS(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function wH(t){return parseInt(t,16)}function vH(t){let e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function EH(t){var e;let{chainId:r,domain:n,expirationTime:i,issuedAt:s=new Date,nonce:o,notBefore:a,requestId:u,resources:c,scheme:l,uri:h,version:d}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
28
28
  `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}let f=aS(t.address),m=l?`${l}://${n}`:n,y=t.statement?`${t.statement}
29
29
  `:"",v=`${m} wants you to sign in with your Ethereum account:
@@ -39,8 +39,8 @@ Not Before: ${a.toISOString()}`),u&&(E+=`
39
39
  Request ID: ${u}`),c){let A=`
40
40
  Resources:`;for(let p of c){if(!p||typeof p!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${p}`);A+=`
41
41
  - ${p}`}E+=A}return`${v}
42
- ${E}`}});var lS=_(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.WebAuthnUnknownError=Jn.WebAuthnError=void 0;Jn.isWebAuthnError=bH;Jn.identifyRegistrationError=_H;Jn.identifyAuthenticationError=CH;var cS=Gy(),ft=class extends Error{constructor({message:e,code:r,cause:n,name:i}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(s=i??(n instanceof Error?n.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=r}};Jn.WebAuthnError=ft;var Ky=class extends ft{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};Jn.WebAuthnUnknownError=Ky;function bH(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function _H({error:t,options:e}){var r,n,i;let{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ft({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ft({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ft({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new ft({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ft({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ft({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ft({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){let o=window.location.hostname;if((0,cS.isValidDomain)(o)){if(s.rp.id!==o)return new ft({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new ft({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function CH({error:t,options:e}){let{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ft({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,cS.isValidDomain)(n)){if(r.rpId!==n)return new ft({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var Gy=_(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.WebAuthnApi=Oe.DEFAULT_REQUEST_OPTIONS=Oe.DEFAULT_CREATION_OPTIONS=Oe.webAuthnAbortService=Oe.WebAuthnAbortService=Oe.identifyAuthenticationError=Oe.identifyRegistrationError=Oe.isWebAuthnError=Oe.WebAuthnError=void 0;Oe.deserializeCredentialCreationOptions=AH;Oe.deserializeCredentialRequestOptions=OH;Oe.serializeCredentialCreationResponse=xH;Oe.serializeCredentialRequestResponse=TH;Oe.isValidDomain=IH;Oe.createCredential=dS;Oe.getCredential=pS;Oe.mergeCredentialCreationOptions=mS;Oe.mergeCredentialRequestOptions=gS;var hS=(he(),ce(fe)),an=Of(),wn=gs(),SH=Mo(),vn=lS();Object.defineProperty(Oe,"identifyAuthenticationError",{enumerable:!0,get:function(){return vn.identifyAuthenticationError}});Object.defineProperty(Oe,"identifyRegistrationError",{enumerable:!0,get:function(){return vn.identifyRegistrationError}});Object.defineProperty(Oe,"isWebAuthnError",{enumerable:!0,get:function(){return vn.isWebAuthnError}});Object.defineProperty(Oe,"WebAuthnError",{enumerable:!0,get:function(){return vn.WebAuthnError}});var kf=class{createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};Oe.WebAuthnAbortService=kf;Oe.webAuthnAbortService=new kf;function AH(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);let{challenge:e,user:r,excludeCredentials:n}=t,i=hS.__rest(t,["challenge","user","excludeCredentials"]),s=(0,an.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,an.base64UrlToUint8Array)(r.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){let c=n[u];a.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:(0,an.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function OH(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);let{challenge:e,allowCredentials:r}=t,n=hS.__rest(t,["challenge","allowCredentials"]),i=(0,an.base64UrlToUint8Array)(e).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){let a=r[o];s.allowCredentials[o]=Object.assign(Object.assign({},a),{id:(0,an.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function xH(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t;return{id:t.id,rawId:t.id,response:{attestationObject:(0,an.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,an.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function TH(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:(0,an.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,an.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,an.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,an.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function IH(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function fS(){var t,e;return!!((0,SH.isBrowser)()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function dS(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyRegistrationError)({error:e,options:t})}}}async function pS(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyAuthenticationError)({error:e,options:t})}}}Oe.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"};Oe.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Nf(...t){let e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(let i of t)if(i)for(let s in i){let o=i[s];if(o!==void 0)if(Array.isArray(o))n[s]=o;else if(r(o))n[s]=o;else if(e(o)){let a=n[s];e(a)?n[s]=Nf(a,o):n[s]=Nf(o)}else n[s]=o}return n}function mS(t,e){return Nf(Oe.DEFAULT_CREATION_OPTIONS,t,e||{})}function gS(t,e){return Nf(Oe.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Wy=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},s){try{let{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!o)return{data:null,error:a};let u=i??Oe.webAuthnAbortService.createNewAbortSignal();if(o.webauthn.type==="create"){let{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${n}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{let c=mS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await dS({publicKey:c,signal:u});return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}case"request":{let c=gS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await pS(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:u}));return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}}}catch(o){return(0,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!r)return{data:null,error:new wn.AuthError("rpId is required for WebAuthn authentication")};try{if(!fS())return{data:null,error:new wn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:s});if(!o)return{data:null,error:a};let{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return(0,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!r)return{data:null,error:new wn.AuthError("rpId is required for WebAuthn registration")};try{if(!fS())return{data:null,error:new wn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(l=>{var h;return(h=l.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(l=>l?this.client.mfa.unenroll({factorId:l?.id}):void 0),{data:null,error:a};let{data:u,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:s});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(o){return(0,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in register",o)}}}};Oe.WebAuthnApi=Wy});var Yy=_(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});var PH=(he(),ce(fe)),FH=PH.__importDefault(Pf()),vr=Sf(),X=gs(),ue=By(),se=Mo(),yS=iS(),DS=Vy(),RH=oS(),kH=by(),wS=Of(),$f=uS(),Mu=Gy();(0,RH.polyfillGlobalThis)();var NH={url:vr.GOTRUE_URL,storageKey:vr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function vS(t,e,r){return await r()}var qo={},Lf=class t{get jwks(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,i;this.userStorage=null,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;let s=Object.assign(Object.assign({},NH),e);if(this.storageKey=s.storageKey,this.instanceID=(r=t.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,t.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&(0,se.isBrowser)()){let o=`${this._logPrefix()} 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.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new FH.default({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=(0,se.resolveFetch)(s.fetch),this.lock=s.lock||vS,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,s.lock?this.lock=s.lock:(0,se.isBrowser)()&&(!((n=globalThis?.navigator)===null||n===void 0)&&n.locks)?this.lock=DS.navigatorLock:this.lock=vS,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),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),webauthn:new Mu.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,yS.memoryLocalStorageAdapter)(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=(0,yS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${kH.version}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),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(){var e;try{let r={},n="none";if((0,se.isBrowser)()&&(r=(0,se.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),(0,se.isBrowser)()&&this.detectSessionInUrl&&n!=="none"){let{data:i,error:s}=await this._getSessionFromURL(r,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),(0,X.isAuthImplicitGrantRedirectError)(s)){let u=(e=s.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:o,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return(0,X.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new X.AuthUnknownError("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{let s=await(0,ue._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e?.options)===null||i===void 0?void 0:i.captchaToken}},xform:ue._sessionResponse}),{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,n,i;try{let s;if("email"in e){let{email:l,password:h,options:d}=e,f=null,m=null;this.flowType==="pkce"&&([f,m]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,ue._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:l,password:h,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:m},xform:ue._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,ue._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:l,password:h,data:(n=d?.data)!==null&&n!==void 0?n:{},channel:(i=d?.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ue._sessionResponse})}else throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){let{email:s,password:o,options:a}=e;r=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:ue._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:ue._sessionResponsePassword})}else throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){let s=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:s})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,s,o,a,u,c,l,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{let{chain:y,wallet:v,statement:E,options:A}=e,p;if((0,se.isBrowser)())if(typeof v=="object")p=v;else{let k=window;if("ethereum"in k&&typeof k.ethereum=="object"&&"request"in k.ethereum&&typeof k.ethereum.request=="function")p=k.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=v}let D=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),w=await p.request({method:"eth_requestAccounts"}).then(k=>k).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||w.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let C=(0,$f.getAddress)(w[0]),F=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!F){let k=await p.request({method:"eth_chainId"});F=(0,$f.fromHex)(k)}let b={domain:D.host,address:C,statement:E,uri:D.href,version:"1",chainId:F,nonce:(i=A?.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(s=A?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=A?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(u=A?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=A?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(l=A?.signInWithEthereum)===null||l===void 0?void 0:l.resources};f=(0,$f.createSiweMessage)(b),m=await p.request({method:"personal_sign",params:[(0,$f.toHex)(f),C]})}try{let{data:y,error:v}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:ue._sessionResponse});if(v)throw v;if(!y||!y.session||!y.user){let E=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:E})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:v})}catch(y){if((0,X.isAuthError)(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,i,s,o,a,u,c,l,h,d,f;let m,y;if("message"in e)m=e.message,y=e.signature;else{let{chain:v,wallet:E,statement:A,options:p}=e,D;if((0,se.isBrowser)())if(typeof E=="object")D=E;else{let C=window;if("solana"in C&&typeof C.solana=="object"&&("signIn"in C.solana&&typeof C.solana.signIn=="function"||"signMessage"in C.solana&&typeof C.solana.signMessage=="function"))D=C.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!p?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=E}let w=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){let C=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},p?.signInWithSolana),{version:"1",domain:w.host,uri:w.href}),A?{statement:A}:null)),F;if(Array.isArray(C)&&C[0]&&typeof C[0]=="object")F=C[0];else if(C&&typeof C=="object"&&"signedMessage"in C&&"signature"in C)F=C;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in F&&"signature"in F&&(typeof F.signedMessage=="string"||F.signedMessage instanceof Uint8Array)&&F.signature instanceof Uint8Array)m=typeof F.signedMessage=="string"?F.signedMessage:new TextDecoder().decode(F.signedMessage),y=F.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${w.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${w.href}`,`Issued At: ${(i=(n=p?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=p?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${p.signInWithSolana.notBefore}`]:[],...!((o=p?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${p.signInWithSolana.expirationTime}`]:[],...!((a=p?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${p.signInWithSolana.chainId}`]:[],...!((u=p?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${p.signInWithSolana.nonce}`]:[],...!((c=p?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${p.signInWithSolana.requestId}`]:[],...!((h=(l=p?.signInWithSolana)===null||l===void 0?void 0:l.resources)===null||h===void 0)&&h.length?["Resources",...p.signInWithSolana.resources.map(F=>`- ${F}`)]:[]].join(`
43
- `);let C=await D.signMessage(new TextEncoder().encode(m),"utf8");if(!C||!(C instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=C}}try{let{data:v,error:E}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:(0,wS.bytesToBase64URL)(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ue._sessionResponse});if(E)throw E;if(!v||!v.session||!v.user){let A=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:E})}catch(v){if((0,X.isAuthError)(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async _exchangeCodeForSession(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{let{data:s,error:o}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ue._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:o})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{let{options:r,provider:n,token:i,access_token:s,nonce:o}=e,a=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:ue._sessionResponse}),{data:u,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){let l=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:l})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,s,o;try{if("email"in e){let{email:a,options:u}=e,c=null,l=null;this.flowType==="pkce"&&([c,l]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:h}=await(0,ue._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(n=u?.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:c,code_challenge_method:l},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){let{phone:a,options:u}=e,{data:c,error:l}=await(0,ue._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=u?.data)!==null&&i!==void 0?i:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(o=u?.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c?.message_id},error:l})}throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,X.isAuthError)(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let i,s;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:o,error:a}=await(0,ue._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:ue._sessionResponse});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");let u=o.session,c=o.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if((0,X.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i,s,o;try{let a=null,u=null;this.flowType==="pkce"&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let c=await(0,ue._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e?.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:u}),headers:this.headers,xform:ue._ssoResponse});return!((s=c.data)===null||s===void 0)&&s.url&&(0,se.isBrowser)()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if((0,X.isAuthError)(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new X.AuthSessionMissingError;let{error:i}=await(0,ue._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if((0,X.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let r=`${this.url}/resend`;if("email"in e){let{email:n,type:i,options:s}=e,{error:o}=await(0,ue._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){let{phone:n,type:i,options:s}=e,{data:o,error:a}=await(0,ue._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:a})}throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,X.isAuthError)(r))return this._returnResult({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(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){let i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await e(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 e=null,r=await(0,se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<vr.EXPIRY_MARGIN_MS:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=(0,se.userNotAvailableProxy)()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let o={value:this.suppressGetSessionWarning};e.user=(0,se.insecureUserWarningProxy)(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await(0,ue._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ue._userResponse}):await this._useSession(async r=>{var n,i,s;let{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new X.AuthSessionMissingError}:await(0,ue._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:ue._userResponse})})}catch(r){if((0,X.isAuthError)(r))return(0,X.isAuthSessionMissingError)(r)&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new X.AuthSessionMissingError;let o=i.session,a=null,u=null;this.flowType==="pkce"&&e.email!=null&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:c,error:l}=await(0,ue._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:u}),jwt:o.access_token,xform:ue._userResponse});if(l)throw l;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new X.AuthSessionMissingError;let r=Date.now()/1e3,n=r,i=!0,s=null,{payload:o}=(0,se.decodeJWT)(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){let{data:a,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!a)return{data:{user:null,session:null},error:null};s=a}else{let{data:a,error:u}=await this._getUser(e.access_token);if(u)throw u;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){let{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!e?.refresh_token)throw new X.AuthSessionMissingError;let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!(0,se.isBrowser)())throw new X.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new X.AuthImplicitGrantRedirectError(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new X.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new X.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new X.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:A,error:p}=await this._exchangeCodeForSession(e.code);if(p)throw p;let D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:A.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:u,token_type:c}=e;if(!s||!a||!o||!c)throw new X.AuthImplicitGrantRedirectError("No session defined in URL");let l=Math.round(Date.now()/1e3),h=parseInt(a),d=l+h;u&&(d=parseInt(u));let f=d-l;f*1e3<=vr.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);let m=d-h;l-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,l):l-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,d,l);let{data:y,error:v}=await this._getUser(s);if(v)throw v;let E={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:c,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:E,redirectType:e.type},error:null})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({error:s});let o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){let{error:a}=await this.admin.signOut(o,e);if(a&&!((0,X.isAuthApiError)(a)&&(a.status===404||a.status===401||a.status===403)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let r=(0,se.generateCallbackId)(),n={id:r,callback:e,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,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{let{data:{session:s},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,ue._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{let{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{let{data:n,error:i}=await this._useSession(async s=>{var o,a,u,c,l;let{data:h,error:d}=s;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,ue._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(l=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&l!==void 0?l:void 0})});if(i)throw i;return(0,se.isBrowser)()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url},error:null})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{let{error:i,data:{session:s}}=r;if(i)throw i;let{options:o,provider:a,token:u,access_token:c,nonce:l}=e,h=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=s?.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:u,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:ue._sessionResponse}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new X.AuthInvalidTokenResponseError}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(i){if((0,X.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)throw o;return await(0,ue._request)(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){let r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{let n=Date.now();return await(0,se.retryable)(async i=>(i>0&&await(0,se.sleep)(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ue._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,X.isAuthRetryableFetchError)(s)&&Date.now()+o-n<vr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,X.isAuthError)(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),(0,se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;let n="#_recoverAndRefresh()";this._debug(n,"begin");try{let i=await(0,se.getItemAsync)(this.storage,this.storageKey);if(i&&this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o?.user)!==null&&e!==void 0?e:(0,se.userNotAvailableProxy)()}else if(i&&!i.user&&!i.user){let o=await(0,se.getItemAsync)(this.storage,this.storageKey+"-user");o&&o?.user?(i.user=o.user,await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),await(0,se.setItemAsync)(this.storage,this.storageKey,i)):i.user=(0,se.userNotAvailableProxy)()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}let s=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<vr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${vr.EXPIRY_MARGIN_MS}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),(0,X.isAuthRetryableFetchError)(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{let{data:o,error:a}=await this._getUser(i.access_token);!a&&o?.user?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new X.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new se.Deferred;let{data:s,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!s.session)throw new X.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let a={data:s.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(s){if(this._debug(i,"error",s),(0,X.isAuthError)(s)){let o={data:null,error:s};return(0,X.isAuthRetryableFetchError)(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});let s=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(u){s.push(u)}});if(await Promise.all(o),s.length>0){for(let a=0;a<s.length;a+=1)console.error(s[a]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",{user:r.user});let i=Object.assign({},r);delete i.user;let s=(0,se.deepClone)(i);await(0,se.setItemAsync)(this.storage,this.storageKey,s)}else{let i=(0,se.deepClone)(r);await(0,se.setItemAsync)(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),await(0,se.removeItemAsync)(this.storage,this.storageKey),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-code-verifier"),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),this.userStorage&&await(0,se.removeItemAsync)(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&(0,se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),vr.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}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 e=Date.now();try{return await this._useSession(async r=>{let{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let i=Math.floor((n.expires_at*1e3-e)/vr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${vr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${vr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=vr.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(n.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(e){if(e.isAcquireTimeout||e instanceof DS.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw e}}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(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(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(e,r,n){let i=[`provider=${encodeURIComponent(r)}`];if(n?.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(a.toString())}if(n?.queryParams){let s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n?.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;return s?this._returnResult({data:null,error:s}):await(0,ue._request)(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:c}=await(0,ue._request)(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u?.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?(0,Mu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Mu.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,ue._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:u}))})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=await(0,ue._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;let{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Mu.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Mu.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){let{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;let{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};let i={all:[],phone:[],totp:[],webauthn:[]};for(let s of(e=r?.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;let{data:{session:n},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=(0,se.decodeJWT)(n.access_token),o=null;s.aal&&(o=s.aal);let a=o;((r=(e=n.user.factors)===null||e===void 0?void 0:e.filter(l=>l.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,ue._request)(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new X.AuthSessionMissingError});let o=await(0,ue._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new X.AuthSessionMissingError});let o=await(0,ue._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await(0,ue._request)(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(e){if((0,X.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,ue._request)(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},xform:()=>({data:{},error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;let i=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+vr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,ue._request)(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,n=s.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){let{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});n=f.session.access_token}let{header:i,payload:s,signature:o,raw:{header:a,payload:u}}=(0,se.decodeJWT)(n);r?.allowExpired||(0,se.validateExp)(s.exp);let c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!c){let{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:s,header:i,signature:o},error:null}}let l=(0,se.getAlgorithm)(i.alg),h=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!await crypto.subtle.verify(l,h,o,(0,wS.stringToUint8Array)(`${a}.${u}`)))throw new X.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};Lf.nextInstanceID={};Xy.default=Lf});var ES=_(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});var $H=(he(),ce(fe)),LH=$H.__importDefault(Pf()),BH=LH.default;Jy.default=BH});var bS=_(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var jH=(he(),ce(fe)),MH=jH.__importDefault(Yy()),UH=MH.default;Zy.default=UH});var Qy=_(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.processLock=It.lockInternals=It.NavigatorLockAcquireTimeoutError=It.navigatorLock=It.AuthClient=It.AuthAdminApi=It.GoTrueClient=It.GoTrueAdminApi=void 0;var Ho=(he(),ce(fe)),qH=Ho.__importDefault(Pf());It.GoTrueAdminApi=qH.default;var HH=Ho.__importDefault(Yy());It.GoTrueClient=HH.default;var VH=Ho.__importDefault(ES());It.AuthAdminApi=VH.default;var zH=Ho.__importDefault(bS());It.AuthClient=zH.default;Ho.__exportStar(jy(),It);Ho.__exportStar(gs(),It);var Bf=Vy();Object.defineProperty(It,"navigatorLock",{enumerable:!0,get:function(){return Bf.navigatorLock}});Object.defineProperty(It,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Bf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(It,"lockInternals",{enumerable:!0,get:function(){return Bf.internals}});Object.defineProperty(It,"processLock",{enumerable:!0,get:function(){return Bf.processLock}})});var _S=_(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.SupabaseAuthClient=void 0;var KH=Qy(),eD=class extends KH.AuthClient{constructor(e){super(e)}};jf.SupabaseAuthClient=eD});var nD=_(rD=>{"use strict";Object.defineProperty(rD,"__esModule",{value:!0});var GH=ng(),WH=vg(),XH=Bg(),YH=VC(),Mf=KC(),JH=GC(),CS=XC(),ZH=_S(),tD=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,CS.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let u=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:Mf.DEFAULT_DB_OPTIONS,realtime:Mf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Mf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Mf.DEFAULT_GLOBAL_OPTIONS},l=(0,CS.applySettingDefaults)(n??{},c);this.storageKey=(i=l.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(h,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=l.auth)!==null&&o!==void 0?o:{},this.headers,l.global.fetch),this.fetch=(0,JH.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(h=>this.realtime.setAuth(h)).catch(h=>console.warn("Failed to set initial Realtime auth token:",h)),this.rest=new WH.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new YH.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new GH.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,storageKey:o,flowType:a,lock:u,debug:c,throwOnError:l},h,d){let f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ZH.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),h),storageKey:o,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,flowType:a,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new XH.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};rD.default=tD});var OS=_(We=>{"use strict";var QH=We&&We.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),SS=We&&We.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QH(e,t,r)},AS=We&&We.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(We,"__esModule",{value:!0});We.createClient=We.SupabaseClient=We.FunctionRegion=We.FunctionsError=We.FunctionsRelayError=We.FunctionsFetchError=We.FunctionsHttpError=We.PostgrestError=void 0;var e7=AS(nD());SS(Qy(),We);var t7=vg();Object.defineProperty(We,"PostgrestError",{enumerable:!0,get:function(){return t7.PostgrestError}});var Uu=ng();Object.defineProperty(We,"FunctionsHttpError",{enumerable:!0,get:function(){return Uu.FunctionsHttpError}});Object.defineProperty(We,"FunctionsFetchError",{enumerable:!0,get:function(){return Uu.FunctionsFetchError}});Object.defineProperty(We,"FunctionsRelayError",{enumerable:!0,get:function(){return Uu.FunctionsRelayError}});Object.defineProperty(We,"FunctionsError",{enumerable:!0,get:function(){return Uu.FunctionsError}});Object.defineProperty(We,"FunctionRegion",{enumerable:!0,get:function(){return Uu.FunctionRegion}});SS(Bg(),We);var r7=nD();Object.defineProperty(We,"SupabaseClient",{enumerable:!0,get:function(){return AS(r7).default}});var n7=(t,e,r)=>new e7.default(t,e,r);We.createClient=n7;function i7(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}i7()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var iD=_((yye,xS)=>{xS.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Uf=_(IS=>{var TS={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function s7(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(TS))IS[t]=s7(TS[t])});var NS=_((wye,kS)=>{var o7=require("fs"),Ft=require("path"),PS=iD(),a7=Uf(),u7=typeof process=="object"&&process.platform==="win32",FS=t=>typeof t=="object"&&t!==null,RS=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function yt(t){this.sep=Ft.sep,this.fs=o7,FS(t)&&FS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}kS.exports=yt;yt.prototype.makeDir=function(t){let e=this;function r(n){let i=n.split(e.sep)[0];n.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var o;try{o=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(o&&o.isFile())throw a7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};yt.prototype.writeFileTo=function(t,e,r,n){let i=this;if(i.fs.existsSync(t)){if(!r)return!1;var s=i.fs.statSync(t);if(s.isDirectory())return!1}var o=Ft.dirname(t);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(t,"w",438)}catch{i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0};yt.prototype.writeFileToAsync=function(t,e,r,n,i){typeof n=="function"&&(i=n,n=void 0);let s=this;s.fs.exists(t,function(o){if(o&&!r)return i(!1);s.fs.stat(t,function(a,u){if(o&&u.isDirectory())return i(!1);var c=Ft.dirname(t);s.fs.exists(c,function(l){l||s.makeDir(c),s.fs.open(t,"w",438,function(h,d){h?s.fs.chmod(t,438,function(){s.fs.open(t,"w",438,function(f,m){s.fs.write(m,e,0,e.length,0,function(){s.fs.close(m,function(){s.fs.chmod(t,n||438,function(){i(!0)})})})})}):d?s.fs.write(d,e,0,e.length,0,function(){s.fs.close(d,function(){s.fs.chmod(t,n||438,function(){i(!0)})})}):s.fs.chmod(t,n||438,function(){i(!0)})})})})})};yt.prototype.findFiles=function(t){let e=this;function r(n,i,s){typeof i=="boolean"&&(s=i,i=void 0);let o=[];return e.fs.readdirSync(n).forEach(function(a){let u=Ft.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(Ft.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};yt.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(i,s){if(i)return e(i);let o=s.length;if(!o)return e(null,n);s.forEach(function(a){a=Ft.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(Ft.normalize(a)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(a,function(l,h){if(l)return e(l);n=n.concat(h),--o||e(null,n)}):--o||e(null,n))})})})};yt.prototype.getAttributes=function(){};yt.prototype.setAttributes=function(){};yt.crc32update=function(t,e){return RS[(t^e)&255]^t>>>8};yt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=yt.crc32update(r,t[n++]);return~r>>>0};yt.methodToString=function(t){switch(t){case PS.STORED:return"STORED ("+t+")";case PS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};yt.canonical=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.join(".",e)};yt.zipnamefix=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.posix.join(".",e)};yt.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};yt.sanitize=function(t,e){t=Ft.resolve(Ft.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=Ft.normalize(Ft.join(t,r.slice(n,i).join(Ft.sep)));if(s.indexOf(t)===0)return s}return Ft.normalize(Ft.join(t,Ft.basename(e)))};yt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};yt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};yt.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};yt.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};yt.isWin=u7;yt.crcTable=RS});var LS=_((vye,$S)=>{var c7=require("path");$S.exports=function(t,{fs:e}){var r=t||"",n=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(i=e.statSync(r),n.directory=i.isDirectory(),n.mtime=i.mtime,n.atime=i.atime,n.executable=(73&i.mode)!==0,n.readonly=(128&i.mode)===0,n.hidden=c7.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var jS=_((Eye,BS)=>{BS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var zo=_((bye,Vo)=>{Vo.exports=NS();Vo.exports.Constants=iD();Vo.exports.Errors=Uf();Vo.exports.FileAttr=LS();Vo.exports.decoder=jS()});var US=_((_ye,MS)=>{var Ni=zo(),Y=Ni.Constants;MS.exports=function(){var t=20,e=10,r=0,n=0,i=0,s=0,o=0,a=0,u=0,c=0,l=0,h=0,d=0,f=0,m=0;t|=Ni.isWin?2560:768,r|=Y.FLG_EFS;let y={extraLen:0},v=p=>Math.max(0,p)>>>0,E=p=>Math.max(0,p)&65535,A=p=>Math.max(0,p)&255;return i=Ni.fromDate2DOS(new Date),{get made(){return t},set made(p){t=p},get version(){return e},set version(p){e=p},get flags(){return r},set flags(p){r=p},get flags_efs(){return(r&Y.FLG_EFS)>0},set flags_efs(p){p?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(p){p?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(p){switch(p){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=p},get time(){return Ni.fromDOS2Date(this.timeval)},set time(p){this.timeval=Ni.fromDate2DOS(p)},get timeval(){return i},set timeval(p){i=v(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=v(p)},get compressedSize(){return o},set compressedSize(p){o=v(p)},get size(){return a},set size(p){a=v(p)},get fileNameLength(){return u},set fileNameLength(p){u=p},get extraLength(){return c},set extraLength(p){c=p},get extraLocalLength(){return y.extraLen},set extraLocalLength(p){y.extraLen=p},get commentLength(){return l},set commentLength(p){l=p},get diskNumStart(){return h},set diskNumStart(p){h=v(p)},get inAttr(){return d},set inAttr(p){d=v(p)},get attr(){return f},set attr(p){f=v(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=v(p)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+l},get realDataOffset(){return m+Y.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(p){var D=p.slice(m,m+Y.LOCHDR);if(D.readUInt32LE(0)!==Y.LOCSIG)throw Ni.Errors.INVALID_LOC();y.version=D.readUInt16LE(Y.LOCVER),y.flags=D.readUInt16LE(Y.LOCFLG),y.method=D.readUInt16LE(Y.LOCHOW),y.time=D.readUInt32LE(Y.LOCTIM),y.crc=D.readUInt32LE(Y.LOCCRC),y.compressedSize=D.readUInt32LE(Y.LOCSIZ),y.size=D.readUInt32LE(Y.LOCLEN),y.fnameLen=D.readUInt16LE(Y.LOCNAM),y.extraLen=D.readUInt16LE(Y.LOCEXT);let w=m+Y.LOCHDR+y.fnameLen,C=w+y.extraLen;return p.slice(w,C)},loadFromBinary:function(p){if(p.length!==Y.CENHDR||p.readUInt32LE(0)!==Y.CENSIG)throw Ni.Errors.INVALID_CEN();t=p.readUInt16LE(Y.CENVEM),e=p.readUInt16LE(Y.CENVER),r=p.readUInt16LE(Y.CENFLG),n=p.readUInt16LE(Y.CENHOW),i=p.readUInt32LE(Y.CENTIM),s=p.readUInt32LE(Y.CENCRC),o=p.readUInt32LE(Y.CENSIZ),a=p.readUInt32LE(Y.CENLEN),u=p.readUInt16LE(Y.CENNAM),c=p.readUInt16LE(Y.CENEXT),l=p.readUInt16LE(Y.CENCOM),h=p.readUInt16LE(Y.CENDSK),d=p.readUInt16LE(Y.CENATT),f=p.readUInt32LE(Y.CENATX),m=p.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var p=Buffer.alloc(Y.LOCHDR);return p.writeUInt32LE(Y.LOCSIG,0),p.writeUInt16LE(e,Y.LOCVER),p.writeUInt16LE(r,Y.LOCFLG),p.writeUInt16LE(n,Y.LOCHOW),p.writeUInt32LE(i,Y.LOCTIM),p.writeUInt32LE(s,Y.LOCCRC),p.writeUInt32LE(o,Y.LOCSIZ),p.writeUInt32LE(a,Y.LOCLEN),p.writeUInt16LE(u,Y.LOCNAM),p.writeUInt16LE(y.extraLen,Y.LOCEXT),p},centralHeaderToBinary:function(){var p=Buffer.alloc(Y.CENHDR+u+c+l);return p.writeUInt32LE(Y.CENSIG,0),p.writeUInt16LE(t,Y.CENVEM),p.writeUInt16LE(e,Y.CENVER),p.writeUInt16LE(r,Y.CENFLG),p.writeUInt16LE(n,Y.CENHOW),p.writeUInt32LE(i,Y.CENTIM),p.writeUInt32LE(s,Y.CENCRC),p.writeUInt32LE(o,Y.CENSIZ),p.writeUInt32LE(a,Y.CENLEN),p.writeUInt16LE(u,Y.CENNAM),p.writeUInt16LE(c,Y.CENEXT),p.writeUInt16LE(l,Y.CENCOM),p.writeUInt16LE(h,Y.CENDSK),p.writeUInt16LE(d,Y.CENATT),p.writeUInt32LE(f,Y.CENATX),p.writeUInt32LE(m,Y.CENOFF),p},toJSON:function(){let p=function(D){return D+" bytes"};return{made:t,version:e,flags:r,method:Ni.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:p(o),size:p(a),fileNameLength:p(u),extraLength:p(c),commentLength:p(l),diskNumStart:h,inAttr:d,attr:f,offset:m,centralHeaderSize:p(Y.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var HS=_((Cye,qS)=>{var Ko=zo(),ht=Ko.Constants;qS.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return ht.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ht.ENDHDR||s.readUInt32LE(0)!==ht.ENDSIG)&&(s.length<ht.ZIP64HDR||s.readUInt32LE(0)!==ht.ZIP64SIG))throw Ko.Errors.INVALID_END();s.readUInt32LE(0)===ht.ENDSIG?(t=s.readUInt16LE(ht.ENDSUB),e=s.readUInt16LE(ht.ENDTOT),r=s.readUInt32LE(ht.ENDSIZ),n=s.readUInt32LE(ht.ENDOFF),i=s.readUInt16LE(ht.ENDCOM)):(t=Ko.readBigUInt64LE(s,ht.ZIP64SUB),e=Ko.readBigUInt64LE(s,ht.ZIP64TOT),r=Ko.readBigUInt64LE(s,ht.ZIP64SIZE),n=Ko.readBigUInt64LE(s,ht.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ht.ENDHDR+i);return s.writeUInt32LE(ht.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ht.ENDSUB),s.writeUInt16LE(e,ht.ENDTOT),s.writeUInt32LE(r,ht.ENDSIZ),s.writeUInt32LE(n,ht.ENDOFF),s.writeUInt16LE(i,ht.ENDCOM),s.fill(" ",ht.ENDHDR),s},toJSON:function(){let s=function(o,a){let u=o.toString(16).toUpperCase();for(;u.length<a;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:s(n,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var oD=_(sD=>{sD.EntryHeader=US();sD.MainHeader=HS()});var zS=_((Aye,VS)=>{VS.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var i=e.createDeflateRaw(r),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),u=0;a.fill(0);for(var c=0;c<s.length;c++){var l=s[c];l.copy(a,u),u+=l.length}n&&n(a)}),i.end(t)}}}});var GS=_((Oye,KS)=>{var l7=+(process.versions?process.versions.node:"").split(".")[0]||0;KS.exports=function(t,e){var r=require("zlib");let n=l7>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(i){var s=r.createInflateRaw(n),o=[],a=0;s.on("data",function(u){o.push(u),a+=u.length}),s.on("end",function(){var u=Buffer.alloc(a),c=0;u.fill(0);for(var l=0;l<o.length;l++){var h=o[l];h.copy(u,c),c+=h.length}i&&i(u)}),s.end(t)}}}});var ZS=_((xye,JS)=>{"use strict";var{randomFillSync:WS}=require("crypto"),f7=Uf(),h7=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),YS=(t,e)=>Math.imul(t,e)>>>0,XS=(t,e)=>h7[(t^e)&255]^t>>>8,qu=()=>typeof WS=="function"?WS(Buffer.alloc(12)):qu.node();qu.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var qf={genSalt:qu};function Hf(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}Hf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=XS(e[0],t),e[1]+=e[0]&255,e[1]=YS(e[1],134775813)+1,e[2]=XS(e[2],e[1]>>>24),t};Hf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return YS(t,t^1)>>8&255};function d7(t){let e=new Hf(t);return function(r){let n=Buffer.alloc(r.length),i=0;for(let s of r)n[i++]=e.updateKeys(s^e.next());return n}}function p7(t){let e=new Hf(t);return function(r,n,i=0){n||(n=Buffer.alloc(r.length));for(let s of r){let o=e.next();n[i++]=s^o,e.updateKeys(s)}return n}}function m7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=d7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw f7.WRONG_PASSWORD();return n(t.slice(12))}function g7(t){Buffer.isBuffer(t)&&t.length>=12?qf.genSalt=function(){return t.slice(0,12)}:t==="node"?qf.genSalt=qu.node:qf.genSalt=qu}function y7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=p7(r),s=qf.genSalt();s[11]=e.crc>>>24&255,n&&(s[10]=e.crc>>>16&255);let o=Buffer.alloc(t.length+12);return i(s,o),i(t,o,12)}JS.exports={decrypt:m7,encrypt:y7,_salter:g7}});var QS=_(Vf=>{Vf.Deflater=zS();Vf.Inflater=GS();Vf.ZipCrypto=ZS()});var uD=_((Iye,eA)=>{var Ne=zo(),D7=oD(),Dt=Ne.Constants,aD=QS();eA.exports=function(t,e){var r=new D7.EntryHeader,n=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,h=typeof l.decoder=="object"?l.decoder:Ne.decoder;c=h.hasOwnProperty("efs")?h.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function f(p){if(r.flags_desc){let D={},w=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(w)==Dt.LOCSIG||e.readUInt32LE(w)==Dt.CENSIG)throw Ne.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==Dt.EXTSIG)D.crc=e.readUInt32LE(w+Dt.EXTCRC),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ),D.size=e.readUInt32LE(w+Dt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)D.crc=e.readUInt32LE(w+Dt.EXTCRC-4),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ-4),D.size=e.readUInt32LE(w+Dt.EXTLEN-4);else throw Ne.Errors.DESCRIPTOR_UNKNOWN();if(D.compressedSize!==r.compressedSize||D.size!==r.size||D.crc!==r.crc)throw Ne.Errors.DESCRIPTOR_FAULTY();if(Ne.crc32(p)!==D.crc)return!1}else if(Ne.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,D,w){if(typeof D>"u"&&typeof p=="string"&&(w=p,p=void 0),s)return p&&D&&D(Buffer.alloc(0),Ne.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var C=d();if(C.length===0)return p&&D&&D(C),C;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw Ne.Errors.INVALID_PASS_PARAM();C=aD.ZipCrypto.decrypt(C,r,w)}var F=Buffer.alloc(r.size);switch(r.method){case Ne.Constants.STORED:if(C.copy(F),f(F))return p&&D&&D(F),F;throw p&&D&&D(F,Ne.Errors.BAD_CRC()),Ne.Errors.BAD_CRC();case Ne.Constants.DEFLATED:var b=new aD.Inflater(C,r.size);if(p)b.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,Ne.Errors.BAD_CRC()))});else{if(b.inflate(F).copy(F,0),!f(F))throw Ne.Errors.BAD_CRC(`"${h.decode(n)}"`);return F}break;default:throw p&&D&&D(Buffer.alloc(0),Ne.Errors.UNKNOWN_METHOD()),Ne.Errors.UNKNOWN_METHOD()}}function y(p,D){if((!o||!o.length)&&Buffer.isBuffer(e))return p&&D&&D(d()),d();if(o.length&&!s){var w;switch(r.method){case Ne.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),p&&D&&D(w),w;default:case Ne.Constants.DEFLATED:var C=new aD.Deflater(o);if(p)C.deflateAsync(function(b){w=Buffer.alloc(b.length),r.compressedSize=b.length,b.copy(w),D&&D(w)});else{var F=C.deflate();return r.compressedSize=F.length,F}C=null;break}}else if(p&&D)D(Buffer.alloc(0));else return Buffer.alloc(0)}function v(p,D){return(p.readUInt32LE(D+4)<<4)+p.readUInt32LE(D)}function E(p){try{for(var D=0,w,C,F;D+4<p.length;)w=p.readUInt16LE(D),D+=2,C=p.readUInt16LE(D),D+=2,F=p.slice(D,D+C),D+=C,Dt.ID_ZIP64===w&&A(F)}catch{throw Ne.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var D,w,C,F;p.length>=Dt.EF_ZIP64_SCOMP&&(D=v(p,Dt.EF_ZIP64_SUNCOMP),r.size===Dt.EF_ZIP64_OR_32&&(r.size=D)),p.length>=Dt.EF_ZIP64_RHO&&(w=v(p,Dt.EF_ZIP64_SCOMP),r.compressedSize===Dt.EF_ZIP64_OR_32&&(r.compressedSize=w)),p.length>=Dt.EF_ZIP64_DSN&&(C=v(p,Dt.EF_ZIP64_RHO),r.offset===Dt.EF_ZIP64_OR_32&&(r.offset=C)),p.length>=Dt.EF_ZIP64_DSN+4&&(F=p.readUInt32LE(Dt.EF_ZIP64_DSN),r.diskNumStart===Dt.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=Ne.toBuffer(p,h.encode);var D=n[n.length-1];s=D===47||D===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return a},set extra(p){a=p,r.extraLength=p.length,E(p)},get comment(){return h.decode(i)},set comment(p){if(i=Ne.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw Ne.Errors.COMMENT_TOO_LONG()},get name(){var p=h.decode(n);return s?p.substr(p.length-1).split("/").pop():p.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(p){y(!0,p)},setData:function(p){o=Ne.toBuffer(p,Ne.decoder.encode),!s&&o.length?(r.size=o.length,r.method=Ne.Constants.DEFLATED,r.crc=Ne.crc32(p),r.changed=!0):r.method=Ne.Constants.STORED},getData:function(p){return r.changed?o:m(!1,null,p)},getDataAsync:function(p,D){r.changed?p(o):m(!0,p,D)},set attr(p){r.attr=p},get attr(){return r.attr},set header(p){r.loadFromBinary(p)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=a.length;var p=r.centralHeaderToBinary(),D=Ne.Constants.CENHDR;return n.copy(p,D),D+=n.length,a.copy(p,D),D+=r.extraLength,i.copy(p,D),p},packLocalHeader:function(){let p=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let D=r.localHeaderToBinary(),w=Buffer.alloc(D.length+n.length+r.extraLocalLength);return D.copy(w,p),p+=D.length,n.copy(w,p),p+=n.length,u.copy(w,p),p+=u.length,w},toJSON:function(){let p=function(D){return"<"+(D&&D.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:p(e),data:p(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var nA=_((Pye,rA)=>{var tA=uD(),w7=oD(),qt=zo();rA.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new w7.MainHeader,o=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:h}=c;t?m(c.readEntries):o=!0;function d(){let v=new Set;for(let E of Object.keys(n)){let A=E.split("/");if(A.pop(),!!A.length)for(let p=0;p<A.length;p++){let D=A.slice(0,p+1).join("/")+"/";v.add(D)}}for(let E of v)if(!(E in n)){let A=new tA(c);A.entryName=E,A.attr=16,A.temporary=!0,r.push(A),n[A.entryName]=A,u.add(A)}}function f(){if(o=!0,n={},s.diskEntries>(t.length-s.offset)/qt.Constants.CENHDR)throw qt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var v=s.offset,E=0;E<r.length;E++){var A=v,p=new tA(c,t);p.header=t.slice(A,A+=qt.Constants.CENHDR),p.entryName=t.slice(A,A+=p.header.fileNameLength),p.header.extraLength&&(p.extra=t.slice(A,A+=p.header.extraLength)),p.header.commentLength&&(p.comment=t.slice(A,A+p.header.commentLength)),v+=p.header.centralHeaderSize,r[E]=p,n[p.entryName]=p}u.clear(),d()}function m(v){var E=t.length-qt.Constants.ENDHDR,A=Math.max(0,E-65535),p=A,D=t.length,w=-1,C=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(A=0),E;E>=p;E--)if(t[E]===80){if(t.readUInt32LE(E)===qt.Constants.ENDSIG){w=E,C=E,D=E+qt.Constants.ENDHDR,p=E-qt.Constants.END64HDR;continue}if(t.readUInt32LE(E)===qt.Constants.END64SIG){p=A;continue}if(t.readUInt32LE(E)===qt.Constants.ZIP64SIG){w=E,D=E+qt.readBigUInt64LE(t,E+qt.Constants.ZIP64SIZE)+qt.Constants.ZIP64LEAD;break}}if(w==-1)throw qt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,D)),s.commentLength&&(i=t.slice(C+qt.Constants.ENDHDR)),v&&f()}function y(){r.length>1&&!l&&r.sort((v,E)=>v.entryName.toLowerCase().localeCompare(E.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(v=>!u.has(v))},get comment(){return h.decode(i)},set comment(v){i=qt.toBuffer(v,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(v){this.entries.forEach(v)},getEntry:function(v){return o||f(),n[v]||null},setEntry:function(v){o||f(),r.push(v),n[v.entryName]=v,s.totalEntries=r.length},deleteFile:function(v,E=!0){o||f();let A=n[v];this.getEntryChildren(A,E).map(D=>D.entryName).forEach(this.deleteEntry)},deleteEntry:function(v){o||f();let E=n[v],A=r.indexOf(E);A>=0&&(r.splice(A,1),delete n[v],s.totalEntries=r.length)},getEntryChildren:function(v,E=!0){if(o||f(),typeof v=="object")if(v.isDirectory&&E){let A=[],p=v.entryName;for(let D of r)D.entryName.startsWith(p)&&A.push(D);return A}else return[v];return[]},getChildCount:function(v){if(v&&v.isDirectory){let E=this.getEntryChildren(v);return E.includes(v)?E.length-1:E.length}return 0},compressToBuffer:function(){o||f(),y();let v=[],E=[],A=0,p=0;s.size=0,s.offset=0;let D=0;for(let F of this.entries){let b=F.getCompressedData();F.header.offset=p;let k=F.packLocalHeader(),R=k.length+b.length;p+=R,v.push(k),v.push(b);let I=F.packCentralHeader();E.push(I),s.size+=I.length,A+=R+I.length,D++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=D,p=0;let w=Buffer.alloc(A);for(let F of v)F.copy(w,p),p+=F.length;for(let F of E)F.copy(w,p),p+=F.length;let C=s.toBinary();return i&&i.copy(C,qt.Constants.ENDHDR),C.copy(w,p),t=w,o=!1,w},toAsyncBuffer:function(v,E,A,p){try{o||f(),y();let D=[],w=[],C=0,F=0,b=0;s.size=0,s.offset=0;let k=function(R){if(R.length>0){let I=R.shift(),B=I.entryName+I.extra.toString();A&&A(B),I.getCompressedDataAsync(function(j){p&&p(B),I.header.offset=F;let z=I.packLocalHeader(),L=z.length+j.length;F+=L,D.push(z),D.push(j);let S=I.packCentralHeader();w.push(S),s.size+=S.length,C+=L+S.length,b++,k(R)})}else{C+=s.mainHeaderSize,s.offset=F,s.totalEntries=b,F=0;let I=Buffer.alloc(C);D.forEach(function(j){j.copy(I,F),F+=j.length}),w.forEach(function(j){j.copy(I,F),F+=j.length});let B=s.toBinary();i&&i.copy(B,qt.Constants.ENDHDR),B.copy(I,F),t=I,o=!1,v(I)}};k(Array.from(this.entries))}catch(D){E(D)}}}}});var cD=_((Fye,sA)=>{var dt=zo(),wt=require("path"),v7=uD(),E7=nA(),vs=(...t)=>dt.findLast(t,e=>typeof e=="boolean"),iA=(...t)=>dt.findLast(t,e=>typeof e=="string"),b7=(...t)=>dt.findLast(t,e=>typeof e=="function"),_7={noSort:!1,readEntries:!1,method:dt.Constants.NONE,fs:null};sA.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),_7);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=dt.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new dt(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=dt.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=dt.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw dt.Errors.INVALID_FILENAME();let s=new E7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=dt;function c(f){if(f&&s){var m;if(typeof f=="string"&&(m=s.getEntry(wt.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=s.getEntry(f.entryName)),m)return m}return null}function l(f){let{join:m,normalize:y,sep:v}=wt.posix;return m(".",y(v+f.split("\\").join(v)+v))}function h(f){return f instanceof RegExp?(function(m){return function(y){return m.test(y)}})(f):typeof f!="function"?()=>!0:f}let d=(f,m)=>{let y=m.slice(-1);return y=y===i.sep?i.sep:"",wt.relative(f,m)+y};return{readFile:function(f,m){var y=c(f);return y&&y.getData(m)||null},childCount:function(f){let m=c(f);if(m)return s.getChildCount(m)},readFileAsync:function(f,m){var y=c(f);y?y.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var y=c(f);if(y){var v=y.getData();if(v&&v.length)return v.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,y){var v=c(f);v?v.getDataAsync(function(E,A){if(A){m(E,A);return}E&&E.length?m(E.toString(y||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var y=c(f);y&&s.deleteFile(y.entryName,m)},deleteEntry:function(f){var m=c(f);m&&s.deleteEntry(m.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,m){var y=c(f);y&&(y.comment=m)},getZipEntryComment:function(f){var m=c(f);return m&&m.comment||""},updateFile:function(f,m){var y=c(f);y&&y.setData(m)},addLocalFile:function(f,m,y,v){if(i.fs.existsSync(f)){m=m?l(m):"";let E=wt.win32.basename(wt.win32.normalize(f));m+=y||E;let A=i.fs.statSync(f),p=A.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);A.isDirectory()&&(m+=i.sep),this.addFile(m,p,v,A)}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let y=wt.resolve(f.localPath),{comment:v}=f,{zipPath:E,zipName:A}=f,p=this;i.fs.stat(y,function(D,w){if(D)return m(D,!1);E=E?l(E):"";let C=wt.win32.basename(wt.win32.normalize(y));if(E+=A||C,w.isFile())i.fs.readFile(y,function(F,b){return F?m(F,!1):(p.addFile(E,b,v,w),setImmediate(m,void 0,!0))});else if(w.isDirectory())return E+=i.sep,p.addFile(E,Buffer.alloc(0),v,w),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,y){if(y=h(y),m=m?l(m):"",f=wt.normalize(f),i.fs.existsSync(f)){let v=i.findFiles(f),E=this;if(v.length)for(let A of v){let p=wt.join(m,d(f,A));y(p)&&E.addLocalFile(A,wt.dirname(p))}}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,y,v){v=h(v),y=y?l(y):"",f=wt.normalize(f);var E=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")m(void 0,dt.Errors.FILE_NOT_FOUND(f));else if(A)m(void 0,A);else{var p=i.findFiles(f),D=-1,w=function(){if(D+=1,D<p.length){var C=p[D],F=d(f,C).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(F)?i.fs.stat(C,function(b,k){b&&m(void 0,b),k.isFile()?i.fs.readFile(C,function(R,I){R?m(void 0,R):(E.addFile(y+F,I,"",k),w())}):(E.addFile(y+F+"/",Buffer.alloc(0),"",k),w())}):process.nextTick(()=>{w()})}else m(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,m){let y=this;f=typeof f=="object"?f:{localPath:f},localPath=wt.resolve(l(f.localPath));let{zipPath:v,filter:E,namefix:A}=f;E instanceof RegExp?E=(function(w){return function(C){return w.test(C)}})(E):typeof E!="function"&&(E=function(){return!0}),v=v?l(v):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let p=w=>wt.join(v,A(d(localPath,w))),D=w=>wt.win32.basename(wt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?m(void 0,dt.Errors.FILE_NOT_FOUND(localPath)):w?m(void 0,w):i.findFilesAsync(localPath,function(C,F){if(C)return m(C);F=F.filter(b=>E(p(b))),F.length||m(void 0,!1),setImmediate(F.reverse().reduce(function(b,k){return function(R,I){if(R||I===!1)return setImmediate(b,R,!1);y.addLocalFileAsync({localPath:k,zipPath:wt.dirname(p(k)),zipName:D(k)},b)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((y,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(E,A)=>{E&&v(E),A&&y(this)})})},addFile:function(f,m,y,v){f=u(f);let E=c(f),A=E!=null;A||(E=new v7(n),E.entryName=f),E.comment=y||"";let p=typeof v=="object"&&v instanceof i.fs.Stats;p&&(E.header.time=v.mtime);var D=E.isDirectory?16:0;let w=E.isDirectory?16384:32768;return p?w|=4095&v.mode:typeof v=="number"?w|=4095&v:w|=E.isDirectory?493:420,D=(D|w<<16)>>>0,E.attr=D,E.setData(m),A||s.setEntry(E),E},getEntries:function(f){return s.password=f,s?s.entries:[]},getEntry:function(f){return c(f)},getEntryCount:function(){return s.getEntryCount()},forEach:function(f){return s.forEach(f)},extractEntryTo:function(f,m,y,v,E,A){v=vs(!1,v),E=vs(!1,E),y=vs(!0,y),A=iA(E,A);var p=c(f);if(!p)throw dt.Errors.NO_ENTRY();var D=o(p.entryName),w=a(m,A&&!p.isDirectory?A:y?D:wt.basename(D));if(p.isDirectory){var C=s.getEntryChildren(p);return C.forEach(function(k){if(k.isDirectory)return;var R=k.getData();if(!R)throw dt.Errors.CANT_EXTRACT_FILE();var I=o(k.entryName),B=a(m,y?I:wt.basename(I));let j=E?k.header.fileAttr:void 0;i.writeFileTo(B,R,v,j)}),!0}var F=p.getData(s.password);if(!F)throw dt.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!v)throw dt.Errors.CANT_OVERRIDE();let b=E?f.header.fileAttr:void 0;return i.writeFileTo(w,F,v,b),!0},test:function(f){if(!s)return!1;for(var m in s.entries)try{if(m.isDirectory)continue;var y=s.entries[m].getData(f);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(f,m,y,v){if(y=vs(!1,y),v=iA(y,v),m=vs(!1,m),!s)throw dt.Errors.NO_ZIP();s.entries.forEach(function(E){var A=a(f,o(E.entryName));if(E.isDirectory){i.makeDir(A);return}var p=E.getData(v);if(!p)throw dt.Errors.CANT_EXTRACT_FILE();let D=y?E.header.fileAttr:void 0;i.writeFileTo(A,p,m,D);try{i.fs.utimesSync(A,E.header.time,E.header.time)}catch{throw dt.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,m,y,v){if(v=b7(m,y,v),y=vs(!1,y),m=vs(!1,m),!v)return new Promise((w,C)=>{this.extractAllToAsync(f,m,y,function(F){F?C(F):w(this)})});if(!s){v(dt.Errors.NO_ZIP());return}f=wt.resolve(f);let E=w=>a(f,wt.normalize(o(w.entryName))),A=(w,C)=>new Error(w+': "'+C+'"'),p=[],D=[];s.entries.forEach(w=>{w.isDirectory?p.push(w):D.push(w)});for(let w of p){let C=E(w),F=y?w.header.fileAttr:void 0;try{i.makeDir(C),F&&i.fs.chmodSync(C,F),i.fs.utimesSync(C,w.header.time,w.header.time)}catch{v(A("Unable to create folder",C))}}D.reverse().reduce(function(w,C){return function(F){if(F)w(F);else{let b=wt.normalize(o(C.entryName)),k=a(f,b);C.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(dt.Errors.CANT_EXTRACT_FILE());else{let B=y?C.header.fileAttr:void 0;i.writeFileToAsync(k,R,m,B,function(j){j||w(A("Unable to write file",k)),i.fs.utimes(k,C.header.time,C.header.time,function(z){z?w(A("Unable to set times",k)):w()})})}})}}},v)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var y=s.compressToBuffer();if(y){var v=i.writeFileTo(f,y,!0);typeof m=="function"&&m(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:y,perm:v}=Object.assign({overwrite:!0},m);return new Promise((E,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(p=>{let D=w=>w?E(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,y,v,D)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,y,v){return typeof f=="function"?(s.toAsyncBuffer(f,m,y,v),null):s.compressToBuffer()}}}});var cA=_((Rye,uA)=>{var aA={};uA.exports=aA;var oA={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(oA).forEach(function(t){var e=oA[t],r=aA[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var fA=_((kye,lA)=>{"use strict";lA.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var dA=_((Nye,hA)=>{"use strict";var C7=require("os"),un=fA(),nr=process.env,Go=void 0;un("no-color")||un("no-colors")||un("color=false")?Go=!1:(un("color")||un("colors")||un("color=true")||un("color=always"))&&(Go=!0);"FORCE_COLOR"in nr&&(Go=nr.FORCE_COLOR.length===0||parseInt(nr.FORCE_COLOR,10)!==0);function S7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function A7(t){if(Go===!1)return 0;if(un("color=16m")||un("color=full")||un("color=truecolor"))return 3;if(un("color=256"))return 2;if(t&&!t.isTTY&&Go!==!0)return 0;var e=Go?1:0;if(process.platform==="win32"){var r=C7.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 nr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in nr})||nr.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in nr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(nr.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in nr){var n=parseInt((nr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(nr.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(nr.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(nr.TERM)||"COLORTERM"in nr?1:(nr.TERM==="dumb",e)}function lD(t){var e=A7(t);return S7(e)}hA.exports={supportsColor:lD,stdout:lD(process.stdout),stderr:lD(process.stderr)}});var mA=_(($ye,pA)=>{pA.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={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 e.forEach(function(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var yA=_((Lye,gA)=>{gA.exports=function(e,r){e=e||" he is here ";var n={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"]},i=[].concat(n.up,n.down,n.mid);function s(u){var c=Math.floor(Math.random()*u);return c}function o(u){var c=!1;return i.filter(function(l){c=l===u}),c}function a(u,c){var l="",h,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(l=l+u[d],h={up:0,down:0,mid:0},c.size){case"mini":h.up=s(8),h.mid=s(2),h.down=s(8);break;case"maxi":h.up=s(16)+3,h.mid=s(4)+1,h.down=s(64)+3;break;default:h.up=s(8)+1,h.mid=s(6)/2,h.down=s(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var y=f[m],v=0;v<=h[y];v++)c[y]&&(l=l+n[y][s(n[y].length)])}return l}return a(e,r)}});var wA=_((Bye,DA)=>{DA.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var EA=_((jye,vA)=>{vA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var _A=_((Mye,bA)=>{bA.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var SA=_((Uye,CA)=>{CA.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var PA=_((Hye,IA)=>{var Ee={};IA.exports=Ee;Ee.themes={};var O7=require("util"),Es=Ee.styles=cA(),OA=Object.defineProperties,x7=new RegExp(/[\r\n]+/g);Ee.supportsColor=dA().supportsColor;typeof Ee.enabled>"u"&&(Ee.enabled=Ee.supportsColor()!==!1);Ee.enable=function(){Ee.enabled=!0};Ee.disable=function(){Ee.enabled=!1};Ee.stripColors=Ee.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var qye=Ee.stylize=function(e,r){if(!Ee.enabled)return e+"";var n=Es[r];return!n&&r in Ee?Ee[r](e):n.open+e+n.close},T7=/[|\\{}()[\]^$+*?.]/g,I7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(T7,"\\$&")};function xA(t){var e=function r(){return F7.apply(r,arguments)};return e._styles=t,e.__proto__=P7,e}var TA=(function(){var t={};return Es.grey=Es.gray,Object.keys(Es).forEach(function(e){Es[e].closeRe=new RegExp(I7(Es[e].close),"g"),t[e]={get:function(){return xA(this._styles.concat(e))}}}),t})(),P7=OA(function(){},TA);function F7(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:O7.inspect(o)}).join(" ");if(!Ee.enabled||!e)return e;for(var r=e.indexOf(`
42
+ ${E}`}});var lS=_(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.WebAuthnUnknownError=Zn.WebAuthnError=void 0;Zn.isWebAuthnError=bH;Zn.identifyRegistrationError=_H;Zn.identifyAuthenticationError=CH;var cS=Gy(),ft=class extends Error{constructor({message:e,code:r,cause:n,name:i}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(s=i??(n instanceof Error?n.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=r}};Zn.WebAuthnError=ft;var Ky=class extends ft{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};Zn.WebAuthnUnknownError=Ky;function bH(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function _H({error:t,options:e}){var r,n,i;let{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ft({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ft({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ft({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new ft({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ft({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ft({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ft({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){let o=window.location.hostname;if((0,cS.isValidDomain)(o)){if(s.rp.id!==o)return new ft({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new ft({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function CH({error:t,options:e}){let{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ft({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,cS.isValidDomain)(n)){if(r.rpId!==n)return new ft({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var Gy=_(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.WebAuthnApi=Oe.DEFAULT_REQUEST_OPTIONS=Oe.DEFAULT_CREATION_OPTIONS=Oe.webAuthnAbortService=Oe.WebAuthnAbortService=Oe.identifyAuthenticationError=Oe.identifyRegistrationError=Oe.isWebAuthnError=Oe.WebAuthnError=void 0;Oe.deserializeCredentialCreationOptions=AH;Oe.deserializeCredentialRequestOptions=OH;Oe.serializeCredentialCreationResponse=xH;Oe.serializeCredentialRequestResponse=TH;Oe.isValidDomain=IH;Oe.createCredential=dS;Oe.getCredential=pS;Oe.mergeCredentialCreationOptions=mS;Oe.mergeCredentialRequestOptions=gS;var hS=(he(),ce(fe)),cn=Of(),wn=gs(),SH=Mo(),vn=lS();Object.defineProperty(Oe,"identifyAuthenticationError",{enumerable:!0,get:function(){return vn.identifyAuthenticationError}});Object.defineProperty(Oe,"identifyRegistrationError",{enumerable:!0,get:function(){return vn.identifyRegistrationError}});Object.defineProperty(Oe,"isWebAuthnError",{enumerable:!0,get:function(){return vn.isWebAuthnError}});Object.defineProperty(Oe,"WebAuthnError",{enumerable:!0,get:function(){return vn.WebAuthnError}});var kf=class{createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};Oe.WebAuthnAbortService=kf;Oe.webAuthnAbortService=new kf;function AH(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);let{challenge:e,user:r,excludeCredentials:n}=t,i=hS.__rest(t,["challenge","user","excludeCredentials"]),s=(0,cn.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,cn.base64UrlToUint8Array)(r.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){let c=n[u];a.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:(0,cn.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function OH(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);let{challenge:e,allowCredentials:r}=t,n=hS.__rest(t,["challenge","allowCredentials"]),i=(0,cn.base64UrlToUint8Array)(e).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){let a=r[o];s.allowCredentials[o]=Object.assign(Object.assign({},a),{id:(0,cn.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function xH(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t;return{id:t.id,rawId:t.id,response:{attestationObject:(0,cn.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,cn.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function TH(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:(0,cn.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,cn.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,cn.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,cn.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function IH(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function fS(){var t,e;return!!((0,SH.isBrowser)()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function dS(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyRegistrationError)({error:e,options:t})}}}async function pS(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyAuthenticationError)({error:e,options:t})}}}Oe.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"};Oe.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Nf(...t){let e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(let i of t)if(i)for(let s in i){let o=i[s];if(o!==void 0)if(Array.isArray(o))n[s]=o;else if(r(o))n[s]=o;else if(e(o)){let a=n[s];e(a)?n[s]=Nf(a,o):n[s]=Nf(o)}else n[s]=o}return n}function mS(t,e){return Nf(Oe.DEFAULT_CREATION_OPTIONS,t,e||{})}function gS(t,e){return Nf(Oe.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Wy=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},s){try{let{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!o)return{data:null,error:a};let u=i??Oe.webAuthnAbortService.createNewAbortSignal();if(o.webauthn.type==="create"){let{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${n}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{let c=mS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await dS({publicKey:c,signal:u});return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}case"request":{let c=gS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await pS(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:u}));return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}}}catch(o){return(0,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!r)return{data:null,error:new wn.AuthError("rpId is required for WebAuthn authentication")};try{if(!fS())return{data:null,error:new wn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:s});if(!o)return{data:null,error:a};let{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return(0,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!r)return{data:null,error:new wn.AuthError("rpId is required for WebAuthn registration")};try{if(!fS())return{data:null,error:new wn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(l=>{var h;return(h=l.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(l=>l?this.client.mfa.unenroll({factorId:l?.id}):void 0),{data:null,error:a};let{data:u,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:s});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(o){return(0,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in register",o)}}}};Oe.WebAuthnApi=Wy});var Yy=_(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});var PH=(he(),ce(fe)),FH=PH.__importDefault(Pf()),vr=Sf(),X=gs(),ue=By(),se=Mo(),yS=iS(),DS=Vy(),RH=oS(),kH=by(),wS=Of(),$f=uS(),Mu=Gy();(0,RH.polyfillGlobalThis)();var NH={url:vr.GOTRUE_URL,storageKey:vr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function vS(t,e,r){return await r()}var qo={},Lf=class t{get jwks(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,i;this.userStorage=null,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;let s=Object.assign(Object.assign({},NH),e);if(this.storageKey=s.storageKey,this.instanceID=(r=t.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,t.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&(0,se.isBrowser)()){let o=`${this._logPrefix()} 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.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new FH.default({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=(0,se.resolveFetch)(s.fetch),this.lock=s.lock||vS,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,s.lock?this.lock=s.lock:(0,se.isBrowser)()&&(!((n=globalThis?.navigator)===null||n===void 0)&&n.locks)?this.lock=DS.navigatorLock:this.lock=vS,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),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),webauthn:new Mu.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,yS.memoryLocalStorageAdapter)(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=(0,yS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${kH.version}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),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(){var e;try{let r={},n="none";if((0,se.isBrowser)()&&(r=(0,se.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),(0,se.isBrowser)()&&this.detectSessionInUrl&&n!=="none"){let{data:i,error:s}=await this._getSessionFromURL(r,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),(0,X.isAuthImplicitGrantRedirectError)(s)){let u=(e=s.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:o,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return(0,X.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new X.AuthUnknownError("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{let s=await(0,ue._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e?.options)===null||i===void 0?void 0:i.captchaToken}},xform:ue._sessionResponse}),{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,n,i;try{let s;if("email"in e){let{email:l,password:h,options:d}=e,f=null,m=null;this.flowType==="pkce"&&([f,m]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,ue._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:l,password:h,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:m},xform:ue._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,ue._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:l,password:h,data:(n=d?.data)!==null&&n!==void 0?n:{},channel:(i=d?.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ue._sessionResponse})}else throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){let{email:s,password:o,options:a}=e;r=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:ue._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:ue._sessionResponsePassword})}else throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){let s=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:s})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,s,o,a,u,c,l,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{let{chain:y,wallet:v,statement:E,options:A}=e,p;if((0,se.isBrowser)())if(typeof v=="object")p=v;else{let k=window;if("ethereum"in k&&typeof k.ethereum=="object"&&"request"in k.ethereum&&typeof k.ethereum.request=="function")p=k.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=v}let D=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),w=await p.request({method:"eth_requestAccounts"}).then(k=>k).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||w.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let C=(0,$f.getAddress)(w[0]),F=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!F){let k=await p.request({method:"eth_chainId"});F=(0,$f.fromHex)(k)}let b={domain:D.host,address:C,statement:E,uri:D.href,version:"1",chainId:F,nonce:(i=A?.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(s=A?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=A?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(u=A?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=A?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(l=A?.signInWithEthereum)===null||l===void 0?void 0:l.resources};f=(0,$f.createSiweMessage)(b),m=await p.request({method:"personal_sign",params:[(0,$f.toHex)(f),C]})}try{let{data:y,error:v}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:ue._sessionResponse});if(v)throw v;if(!y||!y.session||!y.user){let E=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:E})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:v})}catch(y){if((0,X.isAuthError)(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,i,s,o,a,u,c,l,h,d,f;let m,y;if("message"in e)m=e.message,y=e.signature;else{let{chain:v,wallet:E,statement:A,options:p}=e,D;if((0,se.isBrowser)())if(typeof E=="object")D=E;else{let C=window;if("solana"in C&&typeof C.solana=="object"&&("signIn"in C.solana&&typeof C.solana.signIn=="function"||"signMessage"in C.solana&&typeof C.solana.signMessage=="function"))D=C.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!p?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=E}let w=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){let C=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},p?.signInWithSolana),{version:"1",domain:w.host,uri:w.href}),A?{statement:A}:null)),F;if(Array.isArray(C)&&C[0]&&typeof C[0]=="object")F=C[0];else if(C&&typeof C=="object"&&"signedMessage"in C&&"signature"in C)F=C;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in F&&"signature"in F&&(typeof F.signedMessage=="string"||F.signedMessage instanceof Uint8Array)&&F.signature instanceof Uint8Array)m=typeof F.signedMessage=="string"?F.signedMessage:new TextDecoder().decode(F.signedMessage),y=F.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${w.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${w.href}`,`Issued At: ${(i=(n=p?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=p?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${p.signInWithSolana.notBefore}`]:[],...!((o=p?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${p.signInWithSolana.expirationTime}`]:[],...!((a=p?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${p.signInWithSolana.chainId}`]:[],...!((u=p?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${p.signInWithSolana.nonce}`]:[],...!((c=p?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${p.signInWithSolana.requestId}`]:[],...!((h=(l=p?.signInWithSolana)===null||l===void 0?void 0:l.resources)===null||h===void 0)&&h.length?["Resources",...p.signInWithSolana.resources.map(F=>`- ${F}`)]:[]].join(`
43
+ `);let C=await D.signMessage(new TextEncoder().encode(m),"utf8");if(!C||!(C instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=C}}try{let{data:v,error:E}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:(0,wS.bytesToBase64URL)(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ue._sessionResponse});if(E)throw E;if(!v||!v.session||!v.user){let A=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:E})}catch(v){if((0,X.isAuthError)(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async _exchangeCodeForSession(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{let{data:s,error:o}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ue._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:o})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{let{options:r,provider:n,token:i,access_token:s,nonce:o}=e,a=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:ue._sessionResponse}),{data:u,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){let l=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:l})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,s,o;try{if("email"in e){let{email:a,options:u}=e,c=null,l=null;this.flowType==="pkce"&&([c,l]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:h}=await(0,ue._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(n=u?.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:c,code_challenge_method:l},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){let{phone:a,options:u}=e,{data:c,error:l}=await(0,ue._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=u?.data)!==null&&i!==void 0?i:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(o=u?.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c?.message_id},error:l})}throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,X.isAuthError)(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let i,s;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:o,error:a}=await(0,ue._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:ue._sessionResponse});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");let u=o.session,c=o.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if((0,X.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i,s,o;try{let a=null,u=null;this.flowType==="pkce"&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let c=await(0,ue._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e?.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:u}),headers:this.headers,xform:ue._ssoResponse});return!((s=c.data)===null||s===void 0)&&s.url&&(0,se.isBrowser)()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if((0,X.isAuthError)(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new X.AuthSessionMissingError;let{error:i}=await(0,ue._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if((0,X.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let r=`${this.url}/resend`;if("email"in e){let{email:n,type:i,options:s}=e,{error:o}=await(0,ue._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){let{phone:n,type:i,options:s}=e,{data:o,error:a}=await(0,ue._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:a})}throw new X.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,X.isAuthError)(r))return this._returnResult({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(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){let i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await e(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 e=null,r=await(0,se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<vr.EXPIRY_MARGIN_MS:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=(0,se.userNotAvailableProxy)()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let o={value:this.suppressGetSessionWarning};e.user=(0,se.insecureUserWarningProxy)(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await(0,ue._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ue._userResponse}):await this._useSession(async r=>{var n,i,s;let{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new X.AuthSessionMissingError}:await(0,ue._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:ue._userResponse})})}catch(r){if((0,X.isAuthError)(r))return(0,X.isAuthSessionMissingError)(r)&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new X.AuthSessionMissingError;let o=i.session,a=null,u=null;this.flowType==="pkce"&&e.email!=null&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:c,error:l}=await(0,ue._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:u}),jwt:o.access_token,xform:ue._userResponse});if(l)throw l;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new X.AuthSessionMissingError;let r=Date.now()/1e3,n=r,i=!0,s=null,{payload:o}=(0,se.decodeJWT)(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){let{data:a,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!a)return{data:{user:null,session:null},error:null};s=a}else{let{data:a,error:u}=await this._getUser(e.access_token);if(u)throw u;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){let{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!e?.refresh_token)throw new X.AuthSessionMissingError;let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!(0,se.isBrowser)())throw new X.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new X.AuthImplicitGrantRedirectError(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new X.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new X.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new X.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:A,error:p}=await this._exchangeCodeForSession(e.code);if(p)throw p;let D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:A.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:u,token_type:c}=e;if(!s||!a||!o||!c)throw new X.AuthImplicitGrantRedirectError("No session defined in URL");let l=Math.round(Date.now()/1e3),h=parseInt(a),d=l+h;u&&(d=parseInt(u));let f=d-l;f*1e3<=vr.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);let m=d-h;l-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,l):l-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,d,l);let{data:y,error:v}=await this._getUser(s);if(v)throw v;let E={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:c,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:E,redirectType:e.type},error:null})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({error:s});let o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){let{error:a}=await this.admin.signOut(o,e);if(a&&!((0,X.isAuthApiError)(a)&&(a.status===404||a.status===401||a.status===403)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let r=(0,se.generateCallbackId)(),n={id:r,callback:e,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,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{let{data:{session:s},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,ue._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,X.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{let{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{let{data:n,error:i}=await this._useSession(async s=>{var o,a,u,c,l;let{data:h,error:d}=s;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,ue._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(l=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&l!==void 0?l:void 0})});if(i)throw i;return(0,se.isBrowser)()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url},error:null})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{let{error:i,data:{session:s}}=r;if(i)throw i;let{options:o,provider:a,token:u,access_token:c,nonce:l}=e,h=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=s?.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:u,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:ue._sessionResponse}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new X.AuthInvalidTokenResponseError}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(i){if((0,X.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)throw o;return await(0,ue._request)(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){let r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{let n=Date.now();return await(0,se.retryable)(async i=>(i>0&&await(0,se.sleep)(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ue._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,X.isAuthRetryableFetchError)(s)&&Date.now()+o-n<vr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,X.isAuthError)(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),(0,se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;let n="#_recoverAndRefresh()";this._debug(n,"begin");try{let i=await(0,se.getItemAsync)(this.storage,this.storageKey);if(i&&this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o?.user)!==null&&e!==void 0?e:(0,se.userNotAvailableProxy)()}else if(i&&!i.user&&!i.user){let o=await(0,se.getItemAsync)(this.storage,this.storageKey+"-user");o&&o?.user?(i.user=o.user,await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),await(0,se.setItemAsync)(this.storage,this.storageKey,i)):i.user=(0,se.userNotAvailableProxy)()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}let s=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<vr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${vr.EXPIRY_MARGIN_MS}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),(0,X.isAuthRetryableFetchError)(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{let{data:o,error:a}=await this._getUser(i.access_token);!a&&o?.user?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new X.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new se.Deferred;let{data:s,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!s.session)throw new X.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let a={data:s.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(s){if(this._debug(i,"error",s),(0,X.isAuthError)(s)){let o={data:null,error:s};return(0,X.isAuthRetryableFetchError)(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});let s=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(u){s.push(u)}});if(await Promise.all(o),s.length>0){for(let a=0;a<s.length;a+=1)console.error(s[a]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",{user:r.user});let i=Object.assign({},r);delete i.user;let s=(0,se.deepClone)(i);await(0,se.setItemAsync)(this.storage,this.storageKey,s)}else{let i=(0,se.deepClone)(r);await(0,se.setItemAsync)(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),await(0,se.removeItemAsync)(this.storage,this.storageKey),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-code-verifier"),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),this.userStorage&&await(0,se.removeItemAsync)(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&(0,se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),vr.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}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 e=Date.now();try{return await this._useSession(async r=>{let{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let i=Math.floor((n.expires_at*1e3-e)/vr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${vr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${vr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=vr.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(n.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(e){if(e.isAcquireTimeout||e instanceof DS.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw e}}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(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(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(e,r,n){let i=[`provider=${encodeURIComponent(r)}`];if(n?.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(a.toString())}if(n?.queryParams){let s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n?.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;return s?this._returnResult({data:null,error:s}):await(0,ue._request)(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:c}=await(0,ue._request)(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u?.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?(0,Mu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Mu.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,ue._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:u}))})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=await(0,ue._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;let{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Mu.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Mu.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){let{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;let{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};let i={all:[],phone:[],totp:[],webauthn:[]};for(let s of(e=r?.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;let{data:{session:n},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=(0,se.decodeJWT)(n.access_token),o=null;s.aal&&(o=s.aal);let a=o;((r=(e=n.user.factors)===null||e===void 0?void 0:e.filter(l=>l.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,ue._request)(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new X.AuthSessionMissingError});let o=await(0,ue._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new X.AuthSessionMissingError});let o=await(0,ue._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await(0,ue._request)(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(e){if((0,X.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,ue._request)(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},xform:()=>({data:{},error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;let i=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+vr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,ue._request)(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,n=s.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){let{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});n=f.session.access_token}let{header:i,payload:s,signature:o,raw:{header:a,payload:u}}=(0,se.decodeJWT)(n);r?.allowExpired||(0,se.validateExp)(s.exp);let c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!c){let{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:s,header:i,signature:o},error:null}}let l=(0,se.getAlgorithm)(i.alg),h=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!await crypto.subtle.verify(l,h,o,(0,wS.stringToUint8Array)(`${a}.${u}`)))throw new X.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};Lf.nextInstanceID={};Xy.default=Lf});var ES=_(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});var $H=(he(),ce(fe)),LH=$H.__importDefault(Pf()),BH=LH.default;Jy.default=BH});var bS=_(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var jH=(he(),ce(fe)),MH=jH.__importDefault(Yy()),UH=MH.default;Zy.default=UH});var Qy=_(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.processLock=It.lockInternals=It.NavigatorLockAcquireTimeoutError=It.navigatorLock=It.AuthClient=It.AuthAdminApi=It.GoTrueClient=It.GoTrueAdminApi=void 0;var Ho=(he(),ce(fe)),qH=Ho.__importDefault(Pf());It.GoTrueAdminApi=qH.default;var HH=Ho.__importDefault(Yy());It.GoTrueClient=HH.default;var VH=Ho.__importDefault(ES());It.AuthAdminApi=VH.default;var zH=Ho.__importDefault(bS());It.AuthClient=zH.default;Ho.__exportStar(jy(),It);Ho.__exportStar(gs(),It);var Bf=Vy();Object.defineProperty(It,"navigatorLock",{enumerable:!0,get:function(){return Bf.navigatorLock}});Object.defineProperty(It,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Bf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(It,"lockInternals",{enumerable:!0,get:function(){return Bf.internals}});Object.defineProperty(It,"processLock",{enumerable:!0,get:function(){return Bf.processLock}})});var _S=_(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.SupabaseAuthClient=void 0;var KH=Qy(),eD=class extends KH.AuthClient{constructor(e){super(e)}};jf.SupabaseAuthClient=eD});var nD=_(rD=>{"use strict";Object.defineProperty(rD,"__esModule",{value:!0});var GH=ng(),WH=vg(),XH=Bg(),YH=VC(),Mf=KC(),JH=GC(),CS=XC(),ZH=_S(),tD=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,CS.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let u=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:Mf.DEFAULT_DB_OPTIONS,realtime:Mf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Mf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Mf.DEFAULT_GLOBAL_OPTIONS},l=(0,CS.applySettingDefaults)(n??{},c);this.storageKey=(i=l.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(h,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=l.auth)!==null&&o!==void 0?o:{},this.headers,l.global.fetch),this.fetch=(0,JH.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(h=>this.realtime.setAuth(h)).catch(h=>console.warn("Failed to set initial Realtime auth token:",h)),this.rest=new WH.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new YH.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new GH.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,storageKey:o,flowType:a,lock:u,debug:c,throwOnError:l},h,d){let f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ZH.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),h),storageKey:o,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,flowType:a,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new XH.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};rD.default=tD});var OS=_(We=>{"use strict";var QH=We&&We.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),SS=We&&We.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QH(e,t,r)},AS=We&&We.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(We,"__esModule",{value:!0});We.createClient=We.SupabaseClient=We.FunctionRegion=We.FunctionsError=We.FunctionsRelayError=We.FunctionsFetchError=We.FunctionsHttpError=We.PostgrestError=void 0;var e7=AS(nD());SS(Qy(),We);var t7=vg();Object.defineProperty(We,"PostgrestError",{enumerable:!0,get:function(){return t7.PostgrestError}});var Uu=ng();Object.defineProperty(We,"FunctionsHttpError",{enumerable:!0,get:function(){return Uu.FunctionsHttpError}});Object.defineProperty(We,"FunctionsFetchError",{enumerable:!0,get:function(){return Uu.FunctionsFetchError}});Object.defineProperty(We,"FunctionsRelayError",{enumerable:!0,get:function(){return Uu.FunctionsRelayError}});Object.defineProperty(We,"FunctionsError",{enumerable:!0,get:function(){return Uu.FunctionsError}});Object.defineProperty(We,"FunctionRegion",{enumerable:!0,get:function(){return Uu.FunctionRegion}});SS(Bg(),We);var r7=nD();Object.defineProperty(We,"SupabaseClient",{enumerable:!0,get:function(){return AS(r7).default}});var n7=(t,e,r)=>new e7.default(t,e,r);We.createClient=n7;function i7(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}i7()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var iD=_((yye,xS)=>{xS.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Uf=_(IS=>{var TS={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function s7(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(TS))IS[t]=s7(TS[t])});var NS=_((wye,kS)=>{var o7=require("fs"),Ft=require("path"),PS=iD(),a7=Uf(),u7=typeof process=="object"&&process.platform==="win32",FS=t=>typeof t=="object"&&t!==null,RS=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function yt(t){this.sep=Ft.sep,this.fs=o7,FS(t)&&FS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}kS.exports=yt;yt.prototype.makeDir=function(t){let e=this;function r(n){let i=n.split(e.sep)[0];n.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var o;try{o=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(o&&o.isFile())throw a7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};yt.prototype.writeFileTo=function(t,e,r,n){let i=this;if(i.fs.existsSync(t)){if(!r)return!1;var s=i.fs.statSync(t);if(s.isDirectory())return!1}var o=Ft.dirname(t);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(t,"w",438)}catch{i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0};yt.prototype.writeFileToAsync=function(t,e,r,n,i){typeof n=="function"&&(i=n,n=void 0);let s=this;s.fs.exists(t,function(o){if(o&&!r)return i(!1);s.fs.stat(t,function(a,u){if(o&&u.isDirectory())return i(!1);var c=Ft.dirname(t);s.fs.exists(c,function(l){l||s.makeDir(c),s.fs.open(t,"w",438,function(h,d){h?s.fs.chmod(t,438,function(){s.fs.open(t,"w",438,function(f,m){s.fs.write(m,e,0,e.length,0,function(){s.fs.close(m,function(){s.fs.chmod(t,n||438,function(){i(!0)})})})})}):d?s.fs.write(d,e,0,e.length,0,function(){s.fs.close(d,function(){s.fs.chmod(t,n||438,function(){i(!0)})})}):s.fs.chmod(t,n||438,function(){i(!0)})})})})})};yt.prototype.findFiles=function(t){let e=this;function r(n,i,s){typeof i=="boolean"&&(s=i,i=void 0);let o=[];return e.fs.readdirSync(n).forEach(function(a){let u=Ft.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(Ft.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};yt.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(i,s){if(i)return e(i);let o=s.length;if(!o)return e(null,n);s.forEach(function(a){a=Ft.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(Ft.normalize(a)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(a,function(l,h){if(l)return e(l);n=n.concat(h),--o||e(null,n)}):--o||e(null,n))})})})};yt.prototype.getAttributes=function(){};yt.prototype.setAttributes=function(){};yt.crc32update=function(t,e){return RS[(t^e)&255]^t>>>8};yt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=yt.crc32update(r,t[n++]);return~r>>>0};yt.methodToString=function(t){switch(t){case PS.STORED:return"STORED ("+t+")";case PS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};yt.canonical=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.join(".",e)};yt.zipnamefix=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.posix.join(".",e)};yt.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};yt.sanitize=function(t,e){t=Ft.resolve(Ft.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=Ft.normalize(Ft.join(t,r.slice(n,i).join(Ft.sep)));if(s.indexOf(t)===0)return s}return Ft.normalize(Ft.join(t,Ft.basename(e)))};yt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};yt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};yt.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};yt.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};yt.isWin=u7;yt.crcTable=RS});var LS=_((vye,$S)=>{var c7=require("path");$S.exports=function(t,{fs:e}){var r=t||"",n=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(i=e.statSync(r),n.directory=i.isDirectory(),n.mtime=i.mtime,n.atime=i.atime,n.executable=(73&i.mode)!==0,n.readonly=(128&i.mode)===0,n.hidden=c7.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var jS=_((Eye,BS)=>{BS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var zo=_((bye,Vo)=>{Vo.exports=NS();Vo.exports.Constants=iD();Vo.exports.Errors=Uf();Vo.exports.FileAttr=LS();Vo.exports.decoder=jS()});var US=_((_ye,MS)=>{var Ni=zo(),Y=Ni.Constants;MS.exports=function(){var t=20,e=10,r=0,n=0,i=0,s=0,o=0,a=0,u=0,c=0,l=0,h=0,d=0,f=0,m=0;t|=Ni.isWin?2560:768,r|=Y.FLG_EFS;let y={extraLen:0},v=p=>Math.max(0,p)>>>0,E=p=>Math.max(0,p)&65535,A=p=>Math.max(0,p)&255;return i=Ni.fromDate2DOS(new Date),{get made(){return t},set made(p){t=p},get version(){return e},set version(p){e=p},get flags(){return r},set flags(p){r=p},get flags_efs(){return(r&Y.FLG_EFS)>0},set flags_efs(p){p?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(p){p?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(p){switch(p){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=p},get time(){return Ni.fromDOS2Date(this.timeval)},set time(p){this.timeval=Ni.fromDate2DOS(p)},get timeval(){return i},set timeval(p){i=v(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=v(p)},get compressedSize(){return o},set compressedSize(p){o=v(p)},get size(){return a},set size(p){a=v(p)},get fileNameLength(){return u},set fileNameLength(p){u=p},get extraLength(){return c},set extraLength(p){c=p},get extraLocalLength(){return y.extraLen},set extraLocalLength(p){y.extraLen=p},get commentLength(){return l},set commentLength(p){l=p},get diskNumStart(){return h},set diskNumStart(p){h=v(p)},get inAttr(){return d},set inAttr(p){d=v(p)},get attr(){return f},set attr(p){f=v(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=v(p)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+l},get realDataOffset(){return m+Y.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(p){var D=p.slice(m,m+Y.LOCHDR);if(D.readUInt32LE(0)!==Y.LOCSIG)throw Ni.Errors.INVALID_LOC();y.version=D.readUInt16LE(Y.LOCVER),y.flags=D.readUInt16LE(Y.LOCFLG),y.method=D.readUInt16LE(Y.LOCHOW),y.time=D.readUInt32LE(Y.LOCTIM),y.crc=D.readUInt32LE(Y.LOCCRC),y.compressedSize=D.readUInt32LE(Y.LOCSIZ),y.size=D.readUInt32LE(Y.LOCLEN),y.fnameLen=D.readUInt16LE(Y.LOCNAM),y.extraLen=D.readUInt16LE(Y.LOCEXT);let w=m+Y.LOCHDR+y.fnameLen,C=w+y.extraLen;return p.slice(w,C)},loadFromBinary:function(p){if(p.length!==Y.CENHDR||p.readUInt32LE(0)!==Y.CENSIG)throw Ni.Errors.INVALID_CEN();t=p.readUInt16LE(Y.CENVEM),e=p.readUInt16LE(Y.CENVER),r=p.readUInt16LE(Y.CENFLG),n=p.readUInt16LE(Y.CENHOW),i=p.readUInt32LE(Y.CENTIM),s=p.readUInt32LE(Y.CENCRC),o=p.readUInt32LE(Y.CENSIZ),a=p.readUInt32LE(Y.CENLEN),u=p.readUInt16LE(Y.CENNAM),c=p.readUInt16LE(Y.CENEXT),l=p.readUInt16LE(Y.CENCOM),h=p.readUInt16LE(Y.CENDSK),d=p.readUInt16LE(Y.CENATT),f=p.readUInt32LE(Y.CENATX),m=p.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var p=Buffer.alloc(Y.LOCHDR);return p.writeUInt32LE(Y.LOCSIG,0),p.writeUInt16LE(e,Y.LOCVER),p.writeUInt16LE(r,Y.LOCFLG),p.writeUInt16LE(n,Y.LOCHOW),p.writeUInt32LE(i,Y.LOCTIM),p.writeUInt32LE(s,Y.LOCCRC),p.writeUInt32LE(o,Y.LOCSIZ),p.writeUInt32LE(a,Y.LOCLEN),p.writeUInt16LE(u,Y.LOCNAM),p.writeUInt16LE(y.extraLen,Y.LOCEXT),p},centralHeaderToBinary:function(){var p=Buffer.alloc(Y.CENHDR+u+c+l);return p.writeUInt32LE(Y.CENSIG,0),p.writeUInt16LE(t,Y.CENVEM),p.writeUInt16LE(e,Y.CENVER),p.writeUInt16LE(r,Y.CENFLG),p.writeUInt16LE(n,Y.CENHOW),p.writeUInt32LE(i,Y.CENTIM),p.writeUInt32LE(s,Y.CENCRC),p.writeUInt32LE(o,Y.CENSIZ),p.writeUInt32LE(a,Y.CENLEN),p.writeUInt16LE(u,Y.CENNAM),p.writeUInt16LE(c,Y.CENEXT),p.writeUInt16LE(l,Y.CENCOM),p.writeUInt16LE(h,Y.CENDSK),p.writeUInt16LE(d,Y.CENATT),p.writeUInt32LE(f,Y.CENATX),p.writeUInt32LE(m,Y.CENOFF),p},toJSON:function(){let p=function(D){return D+" bytes"};return{made:t,version:e,flags:r,method:Ni.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:p(o),size:p(a),fileNameLength:p(u),extraLength:p(c),commentLength:p(l),diskNumStart:h,inAttr:d,attr:f,offset:m,centralHeaderSize:p(Y.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var HS=_((Cye,qS)=>{var Ko=zo(),ht=Ko.Constants;qS.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return ht.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ht.ENDHDR||s.readUInt32LE(0)!==ht.ENDSIG)&&(s.length<ht.ZIP64HDR||s.readUInt32LE(0)!==ht.ZIP64SIG))throw Ko.Errors.INVALID_END();s.readUInt32LE(0)===ht.ENDSIG?(t=s.readUInt16LE(ht.ENDSUB),e=s.readUInt16LE(ht.ENDTOT),r=s.readUInt32LE(ht.ENDSIZ),n=s.readUInt32LE(ht.ENDOFF),i=s.readUInt16LE(ht.ENDCOM)):(t=Ko.readBigUInt64LE(s,ht.ZIP64SUB),e=Ko.readBigUInt64LE(s,ht.ZIP64TOT),r=Ko.readBigUInt64LE(s,ht.ZIP64SIZE),n=Ko.readBigUInt64LE(s,ht.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ht.ENDHDR+i);return s.writeUInt32LE(ht.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ht.ENDSUB),s.writeUInt16LE(e,ht.ENDTOT),s.writeUInt32LE(r,ht.ENDSIZ),s.writeUInt32LE(n,ht.ENDOFF),s.writeUInt16LE(i,ht.ENDCOM),s.fill(" ",ht.ENDHDR),s},toJSON:function(){let s=function(o,a){let u=o.toString(16).toUpperCase();for(;u.length<a;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:s(n,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var oD=_(sD=>{sD.EntryHeader=US();sD.MainHeader=HS()});var zS=_((Aye,VS)=>{VS.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var i=e.createDeflateRaw(r),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),u=0;a.fill(0);for(var c=0;c<s.length;c++){var l=s[c];l.copy(a,u),u+=l.length}n&&n(a)}),i.end(t)}}}});var GS=_((Oye,KS)=>{var l7=+(process.versions?process.versions.node:"").split(".")[0]||0;KS.exports=function(t,e){var r=require("zlib");let n=l7>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(i){var s=r.createInflateRaw(n),o=[],a=0;s.on("data",function(u){o.push(u),a+=u.length}),s.on("end",function(){var u=Buffer.alloc(a),c=0;u.fill(0);for(var l=0;l<o.length;l++){var h=o[l];h.copy(u,c),c+=h.length}i&&i(u)}),s.end(t)}}}});var ZS=_((xye,JS)=>{"use strict";var{randomFillSync:WS}=require("crypto"),f7=Uf(),h7=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),YS=(t,e)=>Math.imul(t,e)>>>0,XS=(t,e)=>h7[(t^e)&255]^t>>>8,qu=()=>typeof WS=="function"?WS(Buffer.alloc(12)):qu.node();qu.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var qf={genSalt:qu};function Hf(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}Hf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=XS(e[0],t),e[1]+=e[0]&255,e[1]=YS(e[1],134775813)+1,e[2]=XS(e[2],e[1]>>>24),t};Hf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return YS(t,t^1)>>8&255};function d7(t){let e=new Hf(t);return function(r){let n=Buffer.alloc(r.length),i=0;for(let s of r)n[i++]=e.updateKeys(s^e.next());return n}}function p7(t){let e=new Hf(t);return function(r,n,i=0){n||(n=Buffer.alloc(r.length));for(let s of r){let o=e.next();n[i++]=s^o,e.updateKeys(s)}return n}}function m7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=d7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw f7.WRONG_PASSWORD();return n(t.slice(12))}function g7(t){Buffer.isBuffer(t)&&t.length>=12?qf.genSalt=function(){return t.slice(0,12)}:t==="node"?qf.genSalt=qu.node:qf.genSalt=qu}function y7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=p7(r),s=qf.genSalt();s[11]=e.crc>>>24&255,n&&(s[10]=e.crc>>>16&255);let o=Buffer.alloc(t.length+12);return i(s,o),i(t,o,12)}JS.exports={decrypt:m7,encrypt:y7,_salter:g7}});var QS=_(Vf=>{Vf.Deflater=zS();Vf.Inflater=GS();Vf.ZipCrypto=ZS()});var uD=_((Iye,eA)=>{var Ne=zo(),D7=oD(),Dt=Ne.Constants,aD=QS();eA.exports=function(t,e){var r=new D7.EntryHeader,n=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,h=typeof l.decoder=="object"?l.decoder:Ne.decoder;c=h.hasOwnProperty("efs")?h.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function f(p){if(r.flags_desc){let D={},w=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(w)==Dt.LOCSIG||e.readUInt32LE(w)==Dt.CENSIG)throw Ne.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==Dt.EXTSIG)D.crc=e.readUInt32LE(w+Dt.EXTCRC),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ),D.size=e.readUInt32LE(w+Dt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)D.crc=e.readUInt32LE(w+Dt.EXTCRC-4),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ-4),D.size=e.readUInt32LE(w+Dt.EXTLEN-4);else throw Ne.Errors.DESCRIPTOR_UNKNOWN();if(D.compressedSize!==r.compressedSize||D.size!==r.size||D.crc!==r.crc)throw Ne.Errors.DESCRIPTOR_FAULTY();if(Ne.crc32(p)!==D.crc)return!1}else if(Ne.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,D,w){if(typeof D>"u"&&typeof p=="string"&&(w=p,p=void 0),s)return p&&D&&D(Buffer.alloc(0),Ne.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var C=d();if(C.length===0)return p&&D&&D(C),C;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw Ne.Errors.INVALID_PASS_PARAM();C=aD.ZipCrypto.decrypt(C,r,w)}var F=Buffer.alloc(r.size);switch(r.method){case Ne.Constants.STORED:if(C.copy(F),f(F))return p&&D&&D(F),F;throw p&&D&&D(F,Ne.Errors.BAD_CRC()),Ne.Errors.BAD_CRC();case Ne.Constants.DEFLATED:var b=new aD.Inflater(C,r.size);if(p)b.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,Ne.Errors.BAD_CRC()))});else{if(b.inflate(F).copy(F,0),!f(F))throw Ne.Errors.BAD_CRC(`"${h.decode(n)}"`);return F}break;default:throw p&&D&&D(Buffer.alloc(0),Ne.Errors.UNKNOWN_METHOD()),Ne.Errors.UNKNOWN_METHOD()}}function y(p,D){if((!o||!o.length)&&Buffer.isBuffer(e))return p&&D&&D(d()),d();if(o.length&&!s){var w;switch(r.method){case Ne.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),p&&D&&D(w),w;default:case Ne.Constants.DEFLATED:var C=new aD.Deflater(o);if(p)C.deflateAsync(function(b){w=Buffer.alloc(b.length),r.compressedSize=b.length,b.copy(w),D&&D(w)});else{var F=C.deflate();return r.compressedSize=F.length,F}C=null;break}}else if(p&&D)D(Buffer.alloc(0));else return Buffer.alloc(0)}function v(p,D){return(p.readUInt32LE(D+4)<<4)+p.readUInt32LE(D)}function E(p){try{for(var D=0,w,C,F;D+4<p.length;)w=p.readUInt16LE(D),D+=2,C=p.readUInt16LE(D),D+=2,F=p.slice(D,D+C),D+=C,Dt.ID_ZIP64===w&&A(F)}catch{throw Ne.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var D,w,C,F;p.length>=Dt.EF_ZIP64_SCOMP&&(D=v(p,Dt.EF_ZIP64_SUNCOMP),r.size===Dt.EF_ZIP64_OR_32&&(r.size=D)),p.length>=Dt.EF_ZIP64_RHO&&(w=v(p,Dt.EF_ZIP64_SCOMP),r.compressedSize===Dt.EF_ZIP64_OR_32&&(r.compressedSize=w)),p.length>=Dt.EF_ZIP64_DSN&&(C=v(p,Dt.EF_ZIP64_RHO),r.offset===Dt.EF_ZIP64_OR_32&&(r.offset=C)),p.length>=Dt.EF_ZIP64_DSN+4&&(F=p.readUInt32LE(Dt.EF_ZIP64_DSN),r.diskNumStart===Dt.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=Ne.toBuffer(p,h.encode);var D=n[n.length-1];s=D===47||D===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return a},set extra(p){a=p,r.extraLength=p.length,E(p)},get comment(){return h.decode(i)},set comment(p){if(i=Ne.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw Ne.Errors.COMMENT_TOO_LONG()},get name(){var p=h.decode(n);return s?p.substr(p.length-1).split("/").pop():p.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(p){y(!0,p)},setData:function(p){o=Ne.toBuffer(p,Ne.decoder.encode),!s&&o.length?(r.size=o.length,r.method=Ne.Constants.DEFLATED,r.crc=Ne.crc32(p),r.changed=!0):r.method=Ne.Constants.STORED},getData:function(p){return r.changed?o:m(!1,null,p)},getDataAsync:function(p,D){r.changed?p(o):m(!0,p,D)},set attr(p){r.attr=p},get attr(){return r.attr},set header(p){r.loadFromBinary(p)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=a.length;var p=r.centralHeaderToBinary(),D=Ne.Constants.CENHDR;return n.copy(p,D),D+=n.length,a.copy(p,D),D+=r.extraLength,i.copy(p,D),p},packLocalHeader:function(){let p=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let D=r.localHeaderToBinary(),w=Buffer.alloc(D.length+n.length+r.extraLocalLength);return D.copy(w,p),p+=D.length,n.copy(w,p),p+=n.length,u.copy(w,p),p+=u.length,w},toJSON:function(){let p=function(D){return"<"+(D&&D.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:p(e),data:p(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var nA=_((Pye,rA)=>{var tA=uD(),w7=oD(),qt=zo();rA.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new w7.MainHeader,o=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:h}=c;t?m(c.readEntries):o=!0;function d(){let v=new Set;for(let E of Object.keys(n)){let A=E.split("/");if(A.pop(),!!A.length)for(let p=0;p<A.length;p++){let D=A.slice(0,p+1).join("/")+"/";v.add(D)}}for(let E of v)if(!(E in n)){let A=new tA(c);A.entryName=E,A.attr=16,A.temporary=!0,r.push(A),n[A.entryName]=A,u.add(A)}}function f(){if(o=!0,n={},s.diskEntries>(t.length-s.offset)/qt.Constants.CENHDR)throw qt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var v=s.offset,E=0;E<r.length;E++){var A=v,p=new tA(c,t);p.header=t.slice(A,A+=qt.Constants.CENHDR),p.entryName=t.slice(A,A+=p.header.fileNameLength),p.header.extraLength&&(p.extra=t.slice(A,A+=p.header.extraLength)),p.header.commentLength&&(p.comment=t.slice(A,A+p.header.commentLength)),v+=p.header.centralHeaderSize,r[E]=p,n[p.entryName]=p}u.clear(),d()}function m(v){var E=t.length-qt.Constants.ENDHDR,A=Math.max(0,E-65535),p=A,D=t.length,w=-1,C=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(A=0),E;E>=p;E--)if(t[E]===80){if(t.readUInt32LE(E)===qt.Constants.ENDSIG){w=E,C=E,D=E+qt.Constants.ENDHDR,p=E-qt.Constants.END64HDR;continue}if(t.readUInt32LE(E)===qt.Constants.END64SIG){p=A;continue}if(t.readUInt32LE(E)===qt.Constants.ZIP64SIG){w=E,D=E+qt.readBigUInt64LE(t,E+qt.Constants.ZIP64SIZE)+qt.Constants.ZIP64LEAD;break}}if(w==-1)throw qt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,D)),s.commentLength&&(i=t.slice(C+qt.Constants.ENDHDR)),v&&f()}function y(){r.length>1&&!l&&r.sort((v,E)=>v.entryName.toLowerCase().localeCompare(E.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(v=>!u.has(v))},get comment(){return h.decode(i)},set comment(v){i=qt.toBuffer(v,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(v){this.entries.forEach(v)},getEntry:function(v){return o||f(),n[v]||null},setEntry:function(v){o||f(),r.push(v),n[v.entryName]=v,s.totalEntries=r.length},deleteFile:function(v,E=!0){o||f();let A=n[v];this.getEntryChildren(A,E).map(D=>D.entryName).forEach(this.deleteEntry)},deleteEntry:function(v){o||f();let E=n[v],A=r.indexOf(E);A>=0&&(r.splice(A,1),delete n[v],s.totalEntries=r.length)},getEntryChildren:function(v,E=!0){if(o||f(),typeof v=="object")if(v.isDirectory&&E){let A=[],p=v.entryName;for(let D of r)D.entryName.startsWith(p)&&A.push(D);return A}else return[v];return[]},getChildCount:function(v){if(v&&v.isDirectory){let E=this.getEntryChildren(v);return E.includes(v)?E.length-1:E.length}return 0},compressToBuffer:function(){o||f(),y();let v=[],E=[],A=0,p=0;s.size=0,s.offset=0;let D=0;for(let F of this.entries){let b=F.getCompressedData();F.header.offset=p;let k=F.packLocalHeader(),R=k.length+b.length;p+=R,v.push(k),v.push(b);let I=F.packCentralHeader();E.push(I),s.size+=I.length,A+=R+I.length,D++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=D,p=0;let w=Buffer.alloc(A);for(let F of v)F.copy(w,p),p+=F.length;for(let F of E)F.copy(w,p),p+=F.length;let C=s.toBinary();return i&&i.copy(C,qt.Constants.ENDHDR),C.copy(w,p),t=w,o=!1,w},toAsyncBuffer:function(v,E,A,p){try{o||f(),y();let D=[],w=[],C=0,F=0,b=0;s.size=0,s.offset=0;let k=function(R){if(R.length>0){let I=R.shift(),B=I.entryName+I.extra.toString();A&&A(B),I.getCompressedDataAsync(function(j){p&&p(B),I.header.offset=F;let z=I.packLocalHeader(),L=z.length+j.length;F+=L,D.push(z),D.push(j);let S=I.packCentralHeader();w.push(S),s.size+=S.length,C+=L+S.length,b++,k(R)})}else{C+=s.mainHeaderSize,s.offset=F,s.totalEntries=b,F=0;let I=Buffer.alloc(C);D.forEach(function(j){j.copy(I,F),F+=j.length}),w.forEach(function(j){j.copy(I,F),F+=j.length});let B=s.toBinary();i&&i.copy(B,qt.Constants.ENDHDR),B.copy(I,F),t=I,o=!1,v(I)}};k(Array.from(this.entries))}catch(D){E(D)}}}}});var cD=_((Fye,sA)=>{var dt=zo(),wt=require("path"),v7=uD(),E7=nA(),vs=(...t)=>dt.findLast(t,e=>typeof e=="boolean"),iA=(...t)=>dt.findLast(t,e=>typeof e=="string"),b7=(...t)=>dt.findLast(t,e=>typeof e=="function"),_7={noSort:!1,readEntries:!1,method:dt.Constants.NONE,fs:null};sA.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),_7);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=dt.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new dt(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=dt.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=dt.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw dt.Errors.INVALID_FILENAME();let s=new E7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=dt;function c(f){if(f&&s){var m;if(typeof f=="string"&&(m=s.getEntry(wt.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=s.getEntry(f.entryName)),m)return m}return null}function l(f){let{join:m,normalize:y,sep:v}=wt.posix;return m(".",y(v+f.split("\\").join(v)+v))}function h(f){return f instanceof RegExp?(function(m){return function(y){return m.test(y)}})(f):typeof f!="function"?()=>!0:f}let d=(f,m)=>{let y=m.slice(-1);return y=y===i.sep?i.sep:"",wt.relative(f,m)+y};return{readFile:function(f,m){var y=c(f);return y&&y.getData(m)||null},childCount:function(f){let m=c(f);if(m)return s.getChildCount(m)},readFileAsync:function(f,m){var y=c(f);y?y.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var y=c(f);if(y){var v=y.getData();if(v&&v.length)return v.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,y){var v=c(f);v?v.getDataAsync(function(E,A){if(A){m(E,A);return}E&&E.length?m(E.toString(y||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var y=c(f);y&&s.deleteFile(y.entryName,m)},deleteEntry:function(f){var m=c(f);m&&s.deleteEntry(m.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,m){var y=c(f);y&&(y.comment=m)},getZipEntryComment:function(f){var m=c(f);return m&&m.comment||""},updateFile:function(f,m){var y=c(f);y&&y.setData(m)},addLocalFile:function(f,m,y,v){if(i.fs.existsSync(f)){m=m?l(m):"";let E=wt.win32.basename(wt.win32.normalize(f));m+=y||E;let A=i.fs.statSync(f),p=A.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);A.isDirectory()&&(m+=i.sep),this.addFile(m,p,v,A)}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let y=wt.resolve(f.localPath),{comment:v}=f,{zipPath:E,zipName:A}=f,p=this;i.fs.stat(y,function(D,w){if(D)return m(D,!1);E=E?l(E):"";let C=wt.win32.basename(wt.win32.normalize(y));if(E+=A||C,w.isFile())i.fs.readFile(y,function(F,b){return F?m(F,!1):(p.addFile(E,b,v,w),setImmediate(m,void 0,!0))});else if(w.isDirectory())return E+=i.sep,p.addFile(E,Buffer.alloc(0),v,w),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,y){if(y=h(y),m=m?l(m):"",f=wt.normalize(f),i.fs.existsSync(f)){let v=i.findFiles(f),E=this;if(v.length)for(let A of v){let p=wt.join(m,d(f,A));y(p)&&E.addLocalFile(A,wt.dirname(p))}}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,y,v){v=h(v),y=y?l(y):"",f=wt.normalize(f);var E=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")m(void 0,dt.Errors.FILE_NOT_FOUND(f));else if(A)m(void 0,A);else{var p=i.findFiles(f),D=-1,w=function(){if(D+=1,D<p.length){var C=p[D],F=d(f,C).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(F)?i.fs.stat(C,function(b,k){b&&m(void 0,b),k.isFile()?i.fs.readFile(C,function(R,I){R?m(void 0,R):(E.addFile(y+F,I,"",k),w())}):(E.addFile(y+F+"/",Buffer.alloc(0),"",k),w())}):process.nextTick(()=>{w()})}else m(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,m){let y=this;f=typeof f=="object"?f:{localPath:f},localPath=wt.resolve(l(f.localPath));let{zipPath:v,filter:E,namefix:A}=f;E instanceof RegExp?E=(function(w){return function(C){return w.test(C)}})(E):typeof E!="function"&&(E=function(){return!0}),v=v?l(v):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let p=w=>wt.join(v,A(d(localPath,w))),D=w=>wt.win32.basename(wt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?m(void 0,dt.Errors.FILE_NOT_FOUND(localPath)):w?m(void 0,w):i.findFilesAsync(localPath,function(C,F){if(C)return m(C);F=F.filter(b=>E(p(b))),F.length||m(void 0,!1),setImmediate(F.reverse().reduce(function(b,k){return function(R,I){if(R||I===!1)return setImmediate(b,R,!1);y.addLocalFileAsync({localPath:k,zipPath:wt.dirname(p(k)),zipName:D(k)},b)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((y,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(E,A)=>{E&&v(E),A&&y(this)})})},addFile:function(f,m,y,v){f=u(f);let E=c(f),A=E!=null;A||(E=new v7(n),E.entryName=f),E.comment=y||"";let p=typeof v=="object"&&v instanceof i.fs.Stats;p&&(E.header.time=v.mtime);var D=E.isDirectory?16:0;let w=E.isDirectory?16384:32768;return p?w|=4095&v.mode:typeof v=="number"?w|=4095&v:w|=E.isDirectory?493:420,D=(D|w<<16)>>>0,E.attr=D,E.setData(m),A||s.setEntry(E),E},getEntries:function(f){return s.password=f,s?s.entries:[]},getEntry:function(f){return c(f)},getEntryCount:function(){return s.getEntryCount()},forEach:function(f){return s.forEach(f)},extractEntryTo:function(f,m,y,v,E,A){v=vs(!1,v),E=vs(!1,E),y=vs(!0,y),A=iA(E,A);var p=c(f);if(!p)throw dt.Errors.NO_ENTRY();var D=o(p.entryName),w=a(m,A&&!p.isDirectory?A:y?D:wt.basename(D));if(p.isDirectory){var C=s.getEntryChildren(p);return C.forEach(function(k){if(k.isDirectory)return;var R=k.getData();if(!R)throw dt.Errors.CANT_EXTRACT_FILE();var I=o(k.entryName),B=a(m,y?I:wt.basename(I));let j=E?k.header.fileAttr:void 0;i.writeFileTo(B,R,v,j)}),!0}var F=p.getData(s.password);if(!F)throw dt.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!v)throw dt.Errors.CANT_OVERRIDE();let b=E?f.header.fileAttr:void 0;return i.writeFileTo(w,F,v,b),!0},test:function(f){if(!s)return!1;for(var m in s.entries)try{if(m.isDirectory)continue;var y=s.entries[m].getData(f);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(f,m,y,v){if(y=vs(!1,y),v=iA(y,v),m=vs(!1,m),!s)throw dt.Errors.NO_ZIP();s.entries.forEach(function(E){var A=a(f,o(E.entryName));if(E.isDirectory){i.makeDir(A);return}var p=E.getData(v);if(!p)throw dt.Errors.CANT_EXTRACT_FILE();let D=y?E.header.fileAttr:void 0;i.writeFileTo(A,p,m,D);try{i.fs.utimesSync(A,E.header.time,E.header.time)}catch{throw dt.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,m,y,v){if(v=b7(m,y,v),y=vs(!1,y),m=vs(!1,m),!v)return new Promise((w,C)=>{this.extractAllToAsync(f,m,y,function(F){F?C(F):w(this)})});if(!s){v(dt.Errors.NO_ZIP());return}f=wt.resolve(f);let E=w=>a(f,wt.normalize(o(w.entryName))),A=(w,C)=>new Error(w+': "'+C+'"'),p=[],D=[];s.entries.forEach(w=>{w.isDirectory?p.push(w):D.push(w)});for(let w of p){let C=E(w),F=y?w.header.fileAttr:void 0;try{i.makeDir(C),F&&i.fs.chmodSync(C,F),i.fs.utimesSync(C,w.header.time,w.header.time)}catch{v(A("Unable to create folder",C))}}D.reverse().reduce(function(w,C){return function(F){if(F)w(F);else{let b=wt.normalize(o(C.entryName)),k=a(f,b);C.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(dt.Errors.CANT_EXTRACT_FILE());else{let B=y?C.header.fileAttr:void 0;i.writeFileToAsync(k,R,m,B,function(j){j||w(A("Unable to write file",k)),i.fs.utimes(k,C.header.time,C.header.time,function(z){z?w(A("Unable to set times",k)):w()})})}})}}},v)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var y=s.compressToBuffer();if(y){var v=i.writeFileTo(f,y,!0);typeof m=="function"&&m(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:y,perm:v}=Object.assign({overwrite:!0},m);return new Promise((E,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(p=>{let D=w=>w?E(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,y,v,D)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,y,v){return typeof f=="function"?(s.toAsyncBuffer(f,m,y,v),null):s.compressToBuffer()}}}});var cA=_((Rye,uA)=>{var aA={};uA.exports=aA;var oA={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(oA).forEach(function(t){var e=oA[t],r=aA[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var fA=_((kye,lA)=>{"use strict";lA.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var dA=_((Nye,hA)=>{"use strict";var C7=require("os"),ln=fA(),nr=process.env,Go=void 0;ln("no-color")||ln("no-colors")||ln("color=false")?Go=!1:(ln("color")||ln("colors")||ln("color=true")||ln("color=always"))&&(Go=!0);"FORCE_COLOR"in nr&&(Go=nr.FORCE_COLOR.length===0||parseInt(nr.FORCE_COLOR,10)!==0);function S7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function A7(t){if(Go===!1)return 0;if(ln("color=16m")||ln("color=full")||ln("color=truecolor"))return 3;if(ln("color=256"))return 2;if(t&&!t.isTTY&&Go!==!0)return 0;var e=Go?1:0;if(process.platform==="win32"){var r=C7.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 nr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in nr})||nr.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in nr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(nr.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in nr){var n=parseInt((nr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(nr.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(nr.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(nr.TERM)||"COLORTERM"in nr?1:(nr.TERM==="dumb",e)}function lD(t){var e=A7(t);return S7(e)}hA.exports={supportsColor:lD,stdout:lD(process.stdout),stderr:lD(process.stderr)}});var mA=_(($ye,pA)=>{pA.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={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 e.forEach(function(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var yA=_((Lye,gA)=>{gA.exports=function(e,r){e=e||" he is here ";var n={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"]},i=[].concat(n.up,n.down,n.mid);function s(u){var c=Math.floor(Math.random()*u);return c}function o(u){var c=!1;return i.filter(function(l){c=l===u}),c}function a(u,c){var l="",h,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(l=l+u[d],h={up:0,down:0,mid:0},c.size){case"mini":h.up=s(8),h.mid=s(2),h.down=s(8);break;case"maxi":h.up=s(16)+3,h.mid=s(4)+1,h.down=s(64)+3;break;default:h.up=s(8)+1,h.mid=s(6)/2,h.down=s(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var y=f[m],v=0;v<=h[y];v++)c[y]&&(l=l+n[y][s(n[y].length)])}return l}return a(e,r)}});var wA=_((Bye,DA)=>{DA.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var EA=_((jye,vA)=>{vA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var _A=_((Mye,bA)=>{bA.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var SA=_((Uye,CA)=>{CA.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var PA=_((Hye,IA)=>{var Ee={};IA.exports=Ee;Ee.themes={};var O7=require("util"),Es=Ee.styles=cA(),OA=Object.defineProperties,x7=new RegExp(/[\r\n]+/g);Ee.supportsColor=dA().supportsColor;typeof Ee.enabled>"u"&&(Ee.enabled=Ee.supportsColor()!==!1);Ee.enable=function(){Ee.enabled=!0};Ee.disable=function(){Ee.enabled=!1};Ee.stripColors=Ee.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var qye=Ee.stylize=function(e,r){if(!Ee.enabled)return e+"";var n=Es[r];return!n&&r in Ee?Ee[r](e):n.open+e+n.close},T7=/[|\\{}()[\]^$+*?.]/g,I7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(T7,"\\$&")};function xA(t){var e=function r(){return F7.apply(r,arguments)};return e._styles=t,e.__proto__=P7,e}var TA=(function(){var t={};return Es.grey=Es.gray,Object.keys(Es).forEach(function(e){Es[e].closeRe=new RegExp(I7(Es[e].close),"g"),t[e]={get:function(){return xA(this._styles.concat(e))}}}),t})(),P7=OA(function(){},TA);function F7(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:O7.inspect(o)}).join(" ");if(!Ee.enabled||!e)return e;for(var r=e.indexOf(`
44
44
  `)!=-1,n=this._styles,i=n.length;i--;){var s=Es[n[i]];e=s.open+e.replace(s.closeRe,s.open)+s.close,r&&(e=e.replace(x7,function(o){return s.close+o+s.open}))}return e}Ee.setTheme=function(t){if(typeof t=="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 e in t)(function(r){Ee[r]=function(n){if(typeof t[r]=="object"){var i=n;for(var s in t[r])i=Ee[t[r][s]](i);return i}return Ee[t[r]](n)}})(e)};function R7(){var t={};return Object.keys(TA).forEach(function(e){t[e]={get:function(){return xA([e])}}}),t}var k7=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};Ee.trap=mA();Ee.zalgo=yA();Ee.maps={};Ee.maps.america=wA()(Ee);Ee.maps.zebra=EA()(Ee);Ee.maps.rainbow=_A()(Ee);Ee.maps.random=SA()(Ee);for(AA in Ee.maps)(function(t){Ee[t]=function(e){return k7(Ee.maps[t],e)}})(AA);var AA;OA(Ee,R7())});var RA=_((Vye,FA)=>{var N7=PA();FA.exports=N7});var kA=_(fD=>{"use strict";fD.indent=function(e){return new Array(e+1).join(" ")};fD.getMaxIndexLength=function(t){var e=0;return Object.getOwnPropertyNames(t).forEach(function(r){t[r]!==void 0&&(e=Math.max(e,r.length))}),e}});var NA=_((Kye,$7)=>{$7.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 $A=_(Hu=>{"use strict";var En=RA(),$i=kA(),L7=/[^\w\s\n\r\v\t\.,]/i;Hu.version=NA().version;var hD=function(t,e){return t!==void 0||e.renderUndefined},zf=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
45
45
  `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&zf(t[0],!0,r))},B7=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?En[e.stringColor](t):t;var r=t+"";return t===!0?En.green(r):t===!1?En.red(r):t==null?En.grey(r):typeof t=="number"?t>=0?En[e.positiveNumberColor](r):En[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},dD=function(t,e){return t.multilineStringColor===null||t.noColor?e:En[t.multilineStringColor](e)},j7=function(t,e,r){var n=t.split(`
46
46
  `);return n=n.map(function(i){return $i.indent(e)+dD(r,i)}),n.join(`
@@ -52,29 +52,29 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52
52
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function hO(t,e){if(t){if(typeof t=="string")return nO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nO(t,e)}}function nO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function iO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Yo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?iO(Object(r),!0).forEach(function(n){_V(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):iO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function _V(t,e,r){return e=dO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,dO(n.key),n)}}function SV(t,e,r){return e&&sO(t.prototype,e),r&&sO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dO(t){var e=AV(t,"string");return _s(e)=="symbol"?e:e+""}function AV(t,e){if(_s(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(_s(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Jf="tus-v1",Zf="ietf-draft-03",Gu="ietf-draft-05",OV={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:mO,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:Jf},pO=(function(){function t(e,r){CV(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return SV(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![Jf,Zf,Gu].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var i=this.options.retryDelays;if(i!=null&&Object.prototype.toString.call(i)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var a=o[s];if(this.options[a]){this._emitError(new Error("tus: cannot use the ".concat(a," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,bs.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,bs.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,i=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,a=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:TV(this._source.size,o);this._parallelUploadUrls&&a.forEach(function(l,h){l.uploadUrl=n._parallelUploadUrls[h]||null}),this._parallelUploadUrls=new Array(a.length);var u=a.map(function(l,h){var d=0;return n._source.slice(l.start,l.end).then(function(f){var m=f.value;return new Promise(function(y,v){var E=Yo(Yo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Yo(Yo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:v,onProgress:function(D){s=s-d+D,d=D,n._emitProgress(s,i)},onUploadUrlAvailable:function(){n._parallelUploadUrls[h]=A.url,n._parallelUploadUrls.filter(function(D){return!!D}).length===a.length&&n._saveUploadInUrlStorage()}}),A=new t(m,E);A.start(),n._parallelUploads.push(A)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=oO(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!Jo(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var h=l.getHeader("Location");if(h==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=lO(n.options.endpoint,h),(0,bs.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,bs.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,bs.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,bs.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=bV(this._parallelUploads),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;o.abort(r)}}catch(a){i.e(a)}finally{i.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,i,s){this._emitError(new Yf.default(i,s,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var i=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(i&&(this._retryAttempt=0),cO(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},s);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r})}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n)}},{key:"_emitChunkComplete",value:function(r,n,i){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,i)}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var i=oO(this.options.metadata);i!==""&&n.setHeader("Upload-Metadata",i);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):((this.options.protocol===Zf||this.options.protocol===Gu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Jo(o.getStatus(),200)){r._emitHttpError(n,o,"tus: unexpected response while creating upload");return}var a=o.getHeader("Location");if(a==null){r._emitHttpError(n,o,"tus: invalid or missing Location header");return}if(r.url=lO(r.options.endpoint,a),(0,bs.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(o),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,o):(r._offset=0,r._performUpload())})}).catch(function(o){r._emitHttpError(n,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),i=this._sendRequest(n,null);i.then(function(s){var o=s.getStatus();if(!Jo(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Jo(o,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var a=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var u=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===Jf){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(a===u){r._emitProgress(u,u),r._emitSuccess(s);return}r._offset=a,r._performUpload()})}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var i=this._addChunkToRequest(n);i.then(function(s){if(!Jo(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s)}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,i=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(o){n._emitProgress(i+o,n._size)}),this.options.protocol===Jf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Gu&&r.setHeader("Content-Type","application/partial-upload"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(i,s).then(function(o){var a=o.value,u=o.done,c=a!=null&&a.size?a.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):a===null?n._sendRequest(r):((n.options.protocol===Zf||n.options.protocol===Gu)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,a))})}},{key:"_handleUploadResponse",value:function(r,n){var i=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(i)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(i,this._size),this._emitChunkComplete(i-this._offset,i,this._size),this._offset=i,i===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var i=aO(r,n,this.options);return this._req=i,i}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(i){r._urlStorageKey=i})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return uO(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=aO("DELETE",r,n);return uO(i,null,n).then(function(s){if(s.getStatus()!==204)throw new Yf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof Yf.default||(s=new Yf.default("tus: failed to terminate upload",s,i,null)),!cO(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=Yo(Yo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function oO(t){return Object.entries(t).map(function(e){var r=fO(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(mV.Base64.encode(String(i)))}).join(",")}function Jo(t,e){return t>=e&&t<e+100}function aO(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Zf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Gu?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var i=r.headers||{},s=0,o=Object.entries(i);s<o.length;s++){var a=fO(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,yV.default)();n.setHeader("X-Request-ID",l)}return n}function uO(t,e,r){return SD.apply(this,arguments)}function SD(){return SD=DV(CD().mark(function t(e,r,n){var i;return CD().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof n.onBeforeRequest!="function"){o.next=3;break}return o.next=3,n.onBeforeRequest(e);case 3:return o.next=5,e.send(r);case 5:if(i=o.sent,typeof n.onAfterResponse!="function"){o.next=9;break}return o.next=9,n.onAfterResponse(e,i);case 9:return o.abrupt("return",i);case 10:case"end":return o.stop()}},t)})),SD.apply(this,arguments)}function xV(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function cO(t,e,r){return r.retryDelays==null||e>=r.retryDelays.length||t.originalRequest==null?!1:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(t,e,r):mO(t)}function mO(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!Jo(e,400)||e===409||e===423)&&xV()}function lO(t,e){return new gV.default(e,t).toString()}function TV(t,e){for(var r=Math.floor(t/e),n=[],i=0;i<e;i++)n.push({start:r*i,end:r*(i+1)});return n[e-1].end=t,n}pO.defaultOptions=OV;var nDe=Qf.default=pO});var DO=_((sDe,yO)=>{"use strict";var Cn=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Cn.writable=t=>Cn(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Cn.readable=t=>Cn(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Cn.duplex=t=>Cn.writable(t)&&Cn.readable(t);Cn.transform=t=>Cn.duplex(t)&&typeof t._transform=="function";yO.exports=Cn});var vO=_(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.default=void 0;function Wu(t){"@babel/helpers - typeof";return Wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wu(t)}function IV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,FV(n.key),n)}}function PV(t,e,r){return e&&wO(t.prototype,e),r&&wO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function FV(t){var e=RV(t,"string");return Wu(e)=="symbol"?e:e+""}function RV(t,e){if(Wu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var oDe=eh.default=(function(){function t(e){IV(this,t),this._buffer=e,this.size=e.length}return PV(t,[{key:"slice",value:function(r,n){var i=this._buffer.slice(r,n);i.size=i.length;var s=n>=this.size;return Promise.resolve({value:i,done:s})}},{key:"close",value:function(){}}])})()});var CO=_(TD=>{"use strict";Object.defineProperty(TD,"__esModule",{value:!0});TD.default=jV;var _O=require("fs");function Cs(t){"@babel/helpers - typeof";return Cs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cs(t)}function OD(){"use strict";OD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",v={};function E(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=p.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&Cs(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===m)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=m;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(S){var T={tryLoc:S[0]};1 in S&&(T.catchLoc=S[1]),2 in S&&(T.finallyLoc=S[2],T.afterLoc=S[3]),this.tryEntries.push(T)}function j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,this),this.reset(!0)}function L(S){if(S||S===""){var T=S[o];if(T)return T.call(S);if(typeof S.next=="function")return S;if(!isNaN(S.length)){var P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Cs(S)+" is not iterable")}return A.prototype=p,i(F,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(S){var T=typeof S=="function"&&S.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,p):(S.__proto__=p,c(S,u,"GeneratorFunction")),S.prototype=Object.create(F),S},e.awrap=function(S){return{__await:S}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(S,T,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function kV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function EO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$V(n.key),n)}}function NV(t,e,r){return e&&EO(t.prototype,e),r&&EO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function $V(t){var e=LV(t,"string");return Cs(e)=="symbol"?e:e+""}function LV(t,e){if(Cs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Cs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function BV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){bO(s,n,i,o,a,"next",u)}function a(u){bO(s,n,i,o,a,"throw",u)}o(void 0)})}}function jV(t){return xD.apply(this,arguments)}function xD(){return xD=BV(OD().mark(function t(e){var r,n,i,s,o,a,u;return OD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,_O.promises.stat(n);case 3:return i=l.sent,s=i.size,o=(r=e.start)!==null&&r!==void 0?r:0,a=Number.isFinite(e.end)?e.end+1:s,u=a-o,l.abrupt("return",new MV(e,n,u));case 9:case"end":return l.stop()}},t)})),xD.apply(this,arguments)}var MV=(function(){function t(e,r,n){kV(this,t),this._stream=e,this._path=r,this.size=n}return NV(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,_O.createReadStream)(this._path,{start:s+r,end:s+n-1,autoClose:!0});o.size=Math.min(n-r,this.size);var a=o.size>=this.size;return Promise.resolve({value:o,done:a})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var PD=_(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.default=void 0;function Ss(t){"@babel/helpers - typeof";return Ss=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ss(t)}function Xu(){"use strict";Xu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",v={};function E(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=p.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&Ss(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===m)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=m;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(S){var T={tryLoc:S[0]};1 in S&&(T.catchLoc=S[1]),2 in S&&(T.finallyLoc=S[2],T.afterLoc=S[3]),this.tryEntries.push(T)}function j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,this),this.reset(!0)}function L(S){if(S||S===""){var T=S[o];if(T)return T.call(S);if(typeof S.next=="function")return S;if(!isNaN(S.length)){var P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Ss(S)+" is not iterable")}return A.prototype=p,i(F,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(S){var T=typeof S=="function"&&S.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,p):(S.__proto__=p,c(S,u,"GeneratorFunction")),S.prototype=Object.create(F),S},e.awrap=function(S){return{__await:S}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(S,T,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function UV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function SO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,HV(n.key),n)}}function qV(t,e,r){return e&&SO(t.prototype,e),r&&SO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function HV(t){var e=VV(t,"string");return Ss(e)=="symbol"?e:e+""}function VV(t,e){if(Ss(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ss(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function OO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){AO(s,n,i,o,a,"next",u)}function a(u){AO(s,n,i,o,a,"throw",u)}o(void 0)})}}function zV(t,e){return ID.apply(this,arguments)}function ID(){return ID=OO(Xu().mark(function t(e,r){return Xu().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",new Promise(function(s,o){var a=function(l){e.off("readable",u),o(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",a),e.off("readable",c),s(l))};e.once("error",a),e.on("readable",u)}));case 1:case"end":return i.stop()}},t)})),ID.apply(this,arguments)}var cDe=th.default=(function(){function t(e){var r=this;UV(this,t),this._stream=e,this.size=null,this._buf=Buffer.alloc(0),this._bufPos=0,this._ended=!1,this._error=null,e.pause(),e.on("end",function(){r._ended=!0}),e.on("error",function(n){r._error=n})}return qV(t,[{key:"slice",value:(function(){var e=OO(Xu().mark(function n(i,s){var o,a,u,c,l;return Xu().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(i<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(i>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(i<this._bufPos+this._buf.length?(a=i-this._bufPos,u=Math.min(this._buf.length,s-this._bufPos),o=this._buf.slice(a,u)):o=Buffer.alloc(0),!this._ended){d.next=10;break}return o.size=o.length,d.abrupt("return",{value:o,done:!0});case 10:if(c=s-i,!(c>o.length)){d.next=16;break}return d.next=14,zV(this._stream,c-o.length);case 14:l=d.sent,o=Buffer.concat([o,l]);case 16:return this._buf=o,this._bufPos=i,o.size=o.length,d.abrupt("return",{value:o,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,i){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var TO=_(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.default=void 0;var KV=require("fs"),GV=rh(DO()),WV=rh(vO()),XV=rh(CO()),YV=rh(PD());function rh(t){return t&&t.__esModule?t:{default:t}}function Yu(t){"@babel/helpers - typeof";return Yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yu(t)}function JV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,QV(n.key),n)}}function ZV(t,e,r){return e&&xO(t.prototype,e),r&&xO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function QV(t){var e=ez(t,"string");return Yu(e)=="symbol"?e:e+""}function ez(t,e){if(Yu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Yu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var fDe=nh.default=(function(){function t(){JV(this,t)}return ZV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new WV.default(r)):r instanceof KV.ReadStream&&r.path!=null?(0,XV.default)(r):GV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new YV.default(r)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption"))):Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment"))}}])})()});var RO=_(FD=>{"use strict";Object.defineProperty(FD,"__esModule",{value:!0});FD.default=nz;var tz=require("crypto"),IO=FO(require("fs")),rz=FO(require("path"));function PO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(PO=function(n){return n?r:e})(t)}function FO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=PO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function nz(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,tz.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof IO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=rz.resolve(t.path);IO.stat(t.path,function(c,l){if(c){a(c);return}var h=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");o(h)})}):Promise.resolve(null)}});var BO=_((pDe,LO)=>{var $O="Expected a function",kO=NaN,iz="[object Symbol]",sz=/^\s+|\s+$/g,oz=/^[-+]0x[0-9a-f]+$/i,az=/^0b[01]+$/i,uz=/^0o[0-7]+$/i,cz=parseInt,lz=typeof global=="object"&&global&&global.Object===Object&&global,fz=typeof self=="object"&&self&&self.Object===Object&&self,hz=lz||fz||Function("return this")(),dz=Object.prototype,pz=dz.toString,mz=Math.max,gz=Math.min,RD=function(){return hz.Date.now()};function yz(t,e,r){var n,i,s,o,a,u,c=0,l=!1,h=!1,d=!0;if(typeof t!="function")throw new TypeError($O);e=NO(e)||0,ih(r)&&(l=!!r.leading,h="maxWait"in r,s=h?mz(NO(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(C){var F=n,b=i;return n=i=void 0,c=C,o=t.apply(b,F),o}function m(C){return c=C,a=setTimeout(E,e),l?f(C):o}function y(C){var F=C-u,b=C-c,k=e-F;return h?gz(k,s-b):k}function v(C){var F=C-u,b=C-c;return u===void 0||F>=e||F<0||h&&b>=s}function E(){var C=RD();if(v(C))return A(C);a=setTimeout(E,y(C))}function A(C){return a=void 0,d&&n?f(C):(n=i=void 0,o)}function p(){a!==void 0&&clearTimeout(a),c=0,n=u=i=a=void 0}function D(){return a===void 0?o:A(RD())}function w(){var C=RD(),F=v(C);if(n=arguments,i=this,u=C,F){if(a===void 0)return m(u);if(h)return a=setTimeout(E,e),f(u)}return a===void 0&&(a=setTimeout(E,e)),o}return w.cancel=p,w.flush=D,w}function Dz(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError($O);return ih(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),yz(t,e,{leading:n,maxWait:e,trailing:i})}function ih(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function wz(t){return!!t&&typeof t=="object"}function vz(t){return typeof t=="symbol"||wz(t)&&pz.call(t)==iz}function NO(t){if(typeof t=="number")return t;if(vz(t))return kO;if(ih(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ih(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(sz,"");var r=az.test(t);return r||uz.test(t)?cz(t.slice(2),r?2:8):oz.test(t)?kO:+t}LO.exports=Dz});var GO=_(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.default=void 0;var Ez=VO(require("http")),bz=VO(require("https")),UO=require("stream"),_z=require("url"),qO=Cz(BO());function Cz(t){return t&&t.__esModule?t:{default:t}}function HO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(HO=function(n){return n?r:e})(t)}function VO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=HO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Sz(t,e,r){return e=sh(e),Az(t,zO()?Reflect.construct(e,r||[],sh(t).constructor):e.apply(t,r))}function Az(t,e){if(e&&(Zo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oz(t)}function Oz(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zO=function(){return!!t})()}function sh(t){return sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sh(t)}function xz(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&kD(t,e)}function kD(t,e){return kD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},kD(t,e)}function jO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ju(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jO(Object(r),!0).forEach(function(n){Tz(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Tz(t,e,r){return e=KO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zo(t){"@babel/helpers - typeof";return Zo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zo(t)}function oh(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,KO(n.key),n)}}function ah(t,e,r){return e&&MO(t.prototype,e),r&&MO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function KO(t){var e=Iz(t,"string");return Zo(e)=="symbol"?e:e+""}function Iz(t,e){if(Zo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Zo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var mDe=uh.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};oh(this,t),this._requestOptions=e}return ah(t,[{key:"createRequest",value:function(r,n){return new Pz(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),Pz=(function(){function t(e,r,n){oh(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return ah(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(i,s){var o=Ju(Ju(Ju({},(0,_z.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Ju(Ju({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?bz:Ez;r._request=a.request(o);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(h){l.push(h)}),c.on("end",function(){var h=Buffer.concat(l).toString("utf8");i(new Fz(c,h))})}),u.on("error",function(c){s(c)}),n instanceof UO.Readable?n.pipe(new Rz(r._progressHandler)).pipe(u):n instanceof Uint8Array?kz(u,n,r._progressHandler):u.end(n)})}},{key:"abort",value:function(){return this._request!==null&&this._request.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._request}}])})(),Fz=(function(){function t(e,r){oh(this,t),this._response=e,this._body=r}return ah(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),Rz=(function(t){function e(r){var n;return oh(this,e),n=Sz(this,e),n._onprogress=(0,qO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return xz(e,t),ah(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(UO.Transform),kz=function(e,r,n){n=(0,qO.default)(n,100,{leading:!0,trailing:!1});var i=0;function s(){var o=Math.min(e.writableHighWaterMark,r.length-i),a=r.subarray(i,i+o);i+=a.length;var u=e.write(a);u?i<r.length?s():e.end():(e.once("drain",s),n(i))}s()}});var WO=_(ND=>{"use strict";ND.expectReceive=function(t,e,r){var n;r.root(t,e,r),n=this.message,t.hasOwnProperty("expected")&&(n+=" Expected "+t.expected+"."),t.hasOwnProperty("received")&&(n+=" Received: "+t.received+"."),this.message=n};ND.root=function(t,e,r){var n=this,i,s={stackLength:Error.stackTraceLimit,rootOnly:!0},o="",a=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
53
53
  `)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(s.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(s.rootOnly=e.rootOnly),(!s.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(l){switch(l){case"code":i=t.code||void 0;break;case"message":o=t.message||"";break;default:n[l]=t[l]}}),Error.stackTraceLimit=s.stackLength+2,u=new Error().stack.split(`
54
54
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=a,this.stack=u.join(`
55
- `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return i},set:function(l){i=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),c())}});var JO=_((DDe,YO)=>{"use strict";YO.exports=As;As.factory=WO();var BD=As("CustomError");BD.order=As(BD,{message:"Arguments out of order.",code:"EOARG"});function As(t,e,r,n){var i,s;return e=ch(arguments,1,Error,XO,[$D,lh]),r=ch(arguments,2,{},$D,[lh]),n=ch(arguments,3,LD,lh,[]),t=ch(arguments,0,e===Error?"Error":e.prototype.CustomError.name,Nz,[XO,$D,lh]),s=e===Error,s&&n===LD&&(n=As.factory.root),i=function(o,a){var u,c,l,h,d,f;if(!(this instanceof i))return new i(o,a);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof o=="string"&&(o={message:o}),o||(o={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(o),c.unshift({}),f=Object.assign.apply(Object,c),u=this,l={},Object.keys(As.factory).forEach(function(m){l[m]=function(y,v){As.factory[m].call(u,y,v,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==LD&&d.factory.call(this,f,a,l)},i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.name=t,i.prototype.CustomError={chain:s?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},i.prototype.CustomError.chain.unshift(i.prototype.CustomError),i.prototype.toString=function(){var o=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(o+=" "+this.code),this.message&&(o+=": "+this.message),o},i}function ch(t,e,r,n,i){var s=-1,o=-1,a,u,c=e<t.length?e:t.length,l;for(a=0;a<=c;a++){if(l=t[a],s===-1)for(u=0;u<i.length;u++)i[u](l)&&(s=a);o===-1&&n(l)&&(o=a)}if(o!==-1&&s!==-1&&s<o)throw new BD.order;return o!==-1?t[o]:r}function lh(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function Nz(t){return typeof t=="string"}function XO(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function $D(t){return t&&typeof t=="object"}function LD(){}});var QO=_((wDe,ZO)=>{ZO.exports=JO()});var ix=_((Os,Qo)=>{var $z=1/0,Lz="[object Symbol]",Zu={function:!0,object:!0},Bz=Zu[typeof Os]&&Os&&!Os.nodeType?Os:void 0,jz=Zu[typeof Qo]&&Qo&&!Qo.nodeType?Qo:void 0,Mz=fh(Bz&&jz&&typeof global=="object"&&global),Uz=fh(Zu[typeof self]&&self),ex=fh(Zu[typeof window]&&window),jD=fh(Zu[typeof Os]&&Os),qz=Mz||ex!==(jD&&jD.window)&&ex||Uz||jD||Function("return this")();function fh(t){return t&&t.Object===Object?t:null}var Hz=Object.prototype,Vz=Hz.toString,tx=qz.Symbol,rx=tx?tx.prototype:void 0,nx=rx?rx.toString:void 0;function zz(t){if(typeof t=="string")return t;if(Gz(t))return nx?nx.call(t):"";var e=t+"";return e=="0"&&1/t==-$z?"-0":e}function Kz(t){return!!t&&typeof t=="object"}function Gz(t){return typeof t=="symbol"||Kz(t)&&Vz.call(t)==Lz}Qo.exports=zz});var fx=_((xs,ea)=>{var Wz=ix(),Xz="Expected a function",ox="__lodash_hash_undefined__",Yz="[object Function]",Jz="[object GeneratorFunction]",Zz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,Qz=/[\\^$.*+?()[\]{}|]/g,eK=/\\(\\)?/g,tK=/^\[object .+?Constructor\]$/,ec={function:!0,object:!0},rK=ec[typeof xs]&&xs&&!xs.nodeType?xs:void 0,nK=ec[typeof ea]&&ea&&!ea.nodeType?ea:void 0,iK=hh(rK&&nK&&typeof global=="object"&&global),sK=hh(ec[typeof self]&&self),sx=hh(ec[typeof window]&&window),MD=hh(ec[typeof xs]&&xs),oK=iK||sx!==(MD&&MD.window)&&sx||sK||MD||Function("return this")();function hh(t){return t&&t.Object===Object?t:null}function aK(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var uK=Array.prototype,ax=Object.prototype,ux=Function.prototype.toString,UD=ax.hasOwnProperty,cK=ax.toString,lK=RegExp("^"+ux.call(UD).replace(Qz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fK=uK.splice,hK=cx(oK,"Map"),Qu=cx(Object,"create");function Ts(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function dK(){this.__data__=Qu?Qu(null):{}}function pK(t){return this.has(t)&&delete this.__data__[t]}function mK(t){var e=this.__data__;if(Qu){var r=e[t];return r===ox?void 0:r}return UD.call(e,t)?e[t]:void 0}function gK(t){var e=this.__data__;return Qu?e[t]!==void 0:UD.call(e,t)}function yK(t,e){var r=this.__data__;return r[t]=Qu&&e===void 0?ox:e,this}Ts.prototype.clear=dK;Ts.prototype.delete=pK;Ts.prototype.get=mK;Ts.prototype.has=gK;Ts.prototype.set=yK;function ta(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function DK(){this.__data__=[]}function wK(t){var e=this.__data__,r=dh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():fK.call(e,r,1),!0}function vK(t){var e=this.__data__,r=dh(e,t);return r<0?void 0:e[r][1]}function EK(t){return dh(this.__data__,t)>-1}function bK(t,e){var r=this.__data__,n=dh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ta.prototype.clear=DK;ta.prototype.delete=wK;ta.prototype.get=vK;ta.prototype.has=EK;ta.prototype.set=bK;function Is(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function _K(){this.__data__={hash:new Ts,map:new(hK||ta),string:new Ts}}function CK(t){return ph(this,t).delete(t)}function SK(t){return ph(this,t).get(t)}function AK(t){return ph(this,t).has(t)}function OK(t,e){return ph(this,t).set(t,e),this}Is.prototype.clear=_K;Is.prototype.delete=CK;Is.prototype.get=SK;Is.prototype.has=AK;Is.prototype.set=OK;function dh(t,e){for(var r=t.length;r--;)if(PK(t[r][0],e))return r;return-1}function ph(t,e){var r=t.__data__;return xK(e)?r[typeof e=="string"?"string":"hash"]:r.map}function cx(t,e){var r=t[e];return RK(r)?r:void 0}function xK(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var TK=qD(function(t){var e=[];return kK(t).replace(Zz,function(r,n,i,s){e.push(i?s.replace(eK,"$1"):n||r)}),e});function IK(t){if(t!=null){try{return ux.call(t)}catch{}try{return t+""}catch{}}return""}function qD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Xz);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new(qD.Cache||Is),r}qD.Cache=Is;function PK(t,e){return t===e||t!==t&&e!==e}function FK(t){var e=lx(t)?cK.call(t):"";return e==Yz||e==Jz}function lx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function RK(t){if(!lx(t))return!1;var e=FK(t)||aK(t)?lK:tK;return e.test(IK(t))}function kK(t){return t==null?"":Wz(t)}ea.exports=TK});var Ux=_((Ps,na)=>{var NK=fx(),$K=200,QD="__lodash_hash_undefined__",wh=1,ia=2,LK=1/0,yx=9007199254740991,mh="[object Arguments]",zD="[object Array]",Dx="[object Boolean]",wx="[object Date]",vx="[object Error]",Ex="[object Function]",BK="[object GeneratorFunction]",tc="[object Map]",bx="[object Number]",ra="[object Object]",hx="[object Promise]",_x="[object RegExp]",rc="[object Set]",e0="[object String]",Cx="[object Symbol]",KD="[object WeakMap]",Sx="[object ArrayBuffer]",gh="[object DataView]",jK="[object Float32Array]",MK="[object Float64Array]",UK="[object Int8Array]",qK="[object Int16Array]",HK="[object Int32Array]",VK="[object Uint8Array]",zK="[object Uint8ClampedArray]",KK="[object Uint16Array]",GK="[object Uint32Array]",WK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,XK=/^\w*$/,YK=/[\\^$.*+?()[\]{}|]/g,JK=/^\[object .+?Constructor\]$/,ZK=/^(?:0|[1-9]\d*)$/,Qe={};Qe[jK]=Qe[MK]=Qe[UK]=Qe[qK]=Qe[HK]=Qe[VK]=Qe[zK]=Qe[KK]=Qe[GK]=!0;Qe[mh]=Qe[zD]=Qe[Sx]=Qe[Dx]=Qe[gh]=Qe[wx]=Qe[vx]=Qe[Ex]=Qe[tc]=Qe[bx]=Qe[ra]=Qe[_x]=Qe[rc]=Qe[e0]=Qe[KD]=!1;var ic={function:!0,object:!0},QK=ic[typeof Ps]&&Ps&&!Ps.nodeType?Ps:void 0,eG=ic[typeof na]&&na&&!na.nodeType?na:void 0,tG=vh(QK&&eG&&typeof global=="object"&&global),rG=vh(ic[typeof self]&&self),dx=vh(ic[typeof window]&&window),HD=vh(ic[typeof Ps]&&Ps),ks=tG||dx!==(HD&&HD.window)&&dx||rG||HD||Function("return this")();function nG(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function iG(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function sG(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function oG(t,e){return nG(e,function(r){return[r,t[r]]})}function vh(t){return t&&t.Object===Object?t:null}function GD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Ax(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function aG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function uG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var cG=Array.prototype,Eh=Object.prototype,Ox=Function.prototype.toString,Fs=Eh.hasOwnProperty,Ns=Eh.toString,lG=RegExp("^"+Ox.call(Fs).replace(YK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),px=ks.Symbol,mx=ks.Uint8Array,fG=Eh.propertyIsEnumerable,hG=cG.splice,dG=Object.getPrototypeOf,pG=Object.keys,WD=sa(ks,"DataView"),yh=sa(ks,"Map"),XD=sa(ks,"Promise"),YD=sa(ks,"Set"),JD=sa(ks,"WeakMap"),nc=sa(Object,"create"),mG=Ls(WD),gG=Ls(yh),yG=Ls(XD),DG=Ls(YD),wG=Ls(JD),gx=px?px.prototype:void 0,VD=gx?gx.valueOf:void 0;function Rs(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function vG(){this.__data__=nc?nc(null):{}}function EG(t){return this.has(t)&&delete this.__data__[t]}function bG(t){var e=this.__data__;if(nc){var r=e[t];return r===QD?void 0:r}return Fs.call(e,t)?e[t]:void 0}function _G(t){var e=this.__data__;return nc?e[t]!==void 0:Fs.call(e,t)}function CG(t,e){var r=this.__data__;return r[t]=nc&&e===void 0?QD:e,this}Rs.prototype.clear=vG;Rs.prototype.delete=EG;Rs.prototype.get=bG;Rs.prototype.has=_G;Rs.prototype.set=CG;function ei(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function SG(){this.__data__=[]}function AG(t){var e=this.__data__,r=bh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():hG.call(e,r,1),!0}function OG(t){var e=this.__data__,r=bh(e,t);return r<0?void 0:e[r][1]}function xG(t){return bh(this.__data__,t)>-1}function TG(t,e){var r=this.__data__,n=bh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ei.prototype.clear=SG;ei.prototype.delete=AG;ei.prototype.get=OG;ei.prototype.has=xG;ei.prototype.set=TG;function $s(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function IG(){this.__data__={hash:new Rs,map:new(yh||ei),string:new Rs}}function PG(t){return _h(this,t).delete(t)}function FG(t){return _h(this,t).get(t)}function RG(t){return _h(this,t).has(t)}function kG(t,e){return _h(this,t).set(t,e),this}$s.prototype.clear=IG;$s.prototype.delete=PG;$s.prototype.get=FG;$s.prototype.has=RG;$s.prototype.set=kG;function Dh(t){var e=-1,r=t?t.length:0;for(this.__data__=new $s;++e<r;)this.add(t[e])}function NG(t){return this.__data__.set(t,QD),this}function $G(t){return this.__data__.has(t)}Dh.prototype.add=Dh.prototype.push=NG;Dh.prototype.has=$G;function Qn(t){this.__data__=new ei(t)}function LG(){this.__data__=new ei}function BG(t){return this.__data__.delete(t)}function jG(t){return this.__data__.get(t)}function MG(t){return this.__data__.has(t)}function UG(t,e){var r=this.__data__;return r instanceof ei&&r.__data__.length==$K&&(r=this.__data__=new $s(r.__data__)),r.set(t,e),this}Qn.prototype.clear=LG;Qn.prototype.delete=BG;Qn.prototype.get=jG;Qn.prototype.has=MG;Qn.prototype.set=UG;function bh(t,e){for(var r=t.length;r--;)if(oW(t[r][0],e))return r;return-1}function xx(t,e){e=Ch(e,t)?[e]:Px(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Sh(e[r++])];return r&&r==n?t:void 0}function Tx(t,e){return Fs.call(t,e)||typeof t=="object"&&e in t&&tW(t)===null}function qG(t,e){return e in Object(t)}function t0(t,e,r,n,i){return t===e?!0:t==null||e==null||!Oh(t)&&!sc(e)?t!==t&&e!==e:HG(t,e,t0,r,n,i)}function HG(t,e,r,n,i,s){var o=Li(t),a=Li(e),u=zD,c=zD;o||(u=Zn(t),u=u==mh?ra:u),a||(c=Zn(e),c=c==mh?ra:c);var l=u==ra&&!GD(t),h=c==ra&&!GD(e),d=u==c;if(d&&!l)return s||(s=new Qn),o||cW(t)?Fx(t,e,r,n,i,s):JG(t,e,u,r,n,i,s);if(!(i&ia)){var f=l&&Fs.call(t,"__wrapped__"),m=h&&Fs.call(e,"__wrapped__");if(f||m){var y=f?t.value():t,v=m?e.value():e;return s||(s=new Qn),r(y,v,n,i,s)}}return d?(s||(s=new Qn),ZG(t,e,r,n,i,s)):!1}function VG(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var u=a[0],c=t[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in t))return!1}else{var h=new Qn;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?t0(l,c,n,wh|ia,h):d))return!1}}return!0}function zG(t){return typeof t=="function"?t:t==null?dW:typeof t=="object"?Li(t)?WG(t[0],t[1]):GG(t):pW(t)}function KG(t){return pG(Object(t))}function GG(t){var e=eW(t);return e.length==1&&e[0][2]?Nx(e[0][0],e[0][1]):function(r){return r===t||VG(r,t,e)}}function WG(t,e){return Ch(t)&&kx(e)?Nx(Sh(t),e):function(r){var n=lW(r,t);return n===void 0&&n===e?fW(r,t):t0(e,n,void 0,wh|ia)}}function Ix(t){return function(e){return e?.[t]}}function XG(t){return function(e){return xx(e,t)}}function Px(t){return Li(t)?t:NK(t)}function YG(t){return function(e){var r=Zn(e);return r==tc?Ax(e):r==rc?uG(e):oG(e,t(e))}}function Fx(t,e,r,n,i,s){var o=i&ia,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t);if(c)return c==e;var l=-1,h=!0,d=i&wh?new Dh:void 0;for(s.set(t,e);++l<a;){var f=t[l],m=e[l];if(n)var y=o?n(m,f,l,e,t,s):n(f,m,l,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(d){if(!iG(e,function(v,E){if(!d.has(E)&&(f===v||r(f,v,n,i,s)))return d.add(E)})){h=!1;break}}else if(!(f===m||r(f,m,n,i,s))){h=!1;break}}return s.delete(t),h}function JG(t,e,r,n,i,s,o){switch(r){case gh:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Sx:return!(t.byteLength!=e.byteLength||!n(new mx(t),new mx(e)));case Dx:case wx:return+t==+e;case vx:return t.name==e.name&&t.message==e.message;case bx:return t!=+t?e!=+e:t==+e;case _x:case e0:return t==e+"";case tc:var a=Ax;case rc:var u=s&ia;if(a||(a=aG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=wh,o.set(t,e),Fx(a(t),a(e),n,i,s,o));case Cx:if(VD)return VD.call(t)==VD.call(e)}return!1}function ZG(t,e,r,n,i,s){var o=i&ia,a=ZD(t),u=a.length,c=ZD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:Tx(e,d)))return!1}var f=s.get(t);if(f)return f==e;var m=!0;s.set(t,e);for(var y=o;++h<u;){d=a[h];var v=t[d],E=e[d];if(n)var A=o?n(E,v,d,e,t,s):n(v,E,d,t,e,s);if(!(A===void 0?v===E||r(v,E,n,i,s):A)){m=!1;break}y||(y=d=="constructor")}if(m&&!y){var p=t.constructor,D=e.constructor;p!=D&&"constructor"in t&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof D=="function"&&D instanceof D)&&(m=!1)}return s.delete(t),m}var QG=Ix("length");function _h(t,e){var r=t.__data__;return iW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function eW(t){for(var e=hW(t),r=e.length;r--;)e[r][2]=kx(e[r][1]);return e}function sa(t,e){var r=t[e];return uW(r)?r:void 0}function tW(t){return dG(Object(t))}function Zn(t){return Ns.call(t)}(WD&&Zn(new WD(new ArrayBuffer(1)))!=gh||yh&&Zn(new yh)!=tc||XD&&Zn(XD.resolve())!=hx||YD&&Zn(new YD)!=rc||JD&&Zn(new JD)!=KD)&&(Zn=function(t){var e=Ns.call(t),r=e==ra?t.constructor:void 0,n=r?Ls(r):void 0;if(n)switch(n){case mG:return gh;case gG:return tc;case yG:return hx;case DG:return rc;case wG:return KD}return e});function rW(t,e,r){e=Ch(e,t)?[e]:Px(e);for(var n,i=-1,o=e.length;++i<o;){var s=Sh(e[i]);if(!(n=t!=null&&r(t,s)))break;t=t[s]}if(n)return n;var o=t?t.length:0;return!!o&&Ah(o)&&Rx(s,o)&&(Li(t)||jx(t)||$x(t))}function nW(t){var e=t?t.length:void 0;return Ah(e)&&(Li(t)||jx(t)||$x(t))?sG(e,String):null}function Rx(t,e){return e=e??yx,!!e&&(typeof t=="number"||ZK.test(t))&&t>-1&&t%1==0&&t<e}function Ch(t,e){if(Li(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Mx(t)?!0:XK.test(t)||!WK.test(t)||e!=null&&t in Object(e)}function iW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function sW(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Eh;return t===r}function kx(t){return t===t&&!Oh(t)}function Nx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Sh(t){if(typeof t=="string"||Mx(t))return t;var e=t+"";return e=="0"&&1/t==-LK?"-0":e}function Ls(t){if(t!=null){try{return Ox.call(t)}catch{}try{return t+""}catch{}}return""}function oW(t,e){return t===e||t!==t&&e!==e}function $x(t){return aW(t)&&Fs.call(t,"callee")&&(!fG.call(t,"callee")||Ns.call(t)==mh)}var Li=Array.isArray;function Lx(t){return t!=null&&Ah(QG(t))&&!Bx(t)}function aW(t){return sc(t)&&Lx(t)}function Bx(t){var e=Oh(t)?Ns.call(t):"";return e==Ex||e==BK}function Ah(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=yx}function Oh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function sc(t){return!!t&&typeof t=="object"}function uW(t){if(!Oh(t))return!1;var e=Bx(t)||GD(t)?lG:JK;return e.test(Ls(t))}function jx(t){return typeof t=="string"||!Li(t)&&sc(t)&&Ns.call(t)==e0}function Mx(t){return typeof t=="symbol"||sc(t)&&Ns.call(t)==Cx}function cW(t){return sc(t)&&Ah(t.length)&&!!Qe[Ns.call(t)]}function lW(t,e,r){var n=t==null?void 0:xx(t,e);return n===void 0?r:n}function fW(t,e){return t!=null&&rW(t,e,qG)}function ZD(t){var e=sW(t);if(!(e||Lx(t)))return KG(t);var r=nW(t),n=!!r,i=r||[],s=i.length;for(var o in t)Tx(t,o)&&!(n&&(o=="length"||Rx(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var hW=YG(ZD);function dW(t){return t}function pW(t){return Ch(t)?Ix(Sh(t)):XG(t)}na.exports=zG});var Kx=_((Bs,oa)=>{var mW=1/0,gW="[object Function]",yW="[object GeneratorFunction]",DW=/[\\^$.*+?()[\]{}|]/g,wW=/^\[object .+?Constructor\]$/,oc={function:!0,object:!0},vW=oc[typeof Bs]&&Bs&&!Bs.nodeType?Bs:void 0,EW=oc[typeof oa]&&oa&&!oa.nodeType?oa:void 0,bW=xh(vW&&EW&&typeof global=="object"&&global),_W=xh(oc[typeof self]&&self),qx=xh(oc[typeof window]&&window),r0=xh(oc[typeof Bs]&&Bs),CW=bW||qx!==(r0&&r0.window)&&qx||_W||r0||Function("return this")();function xh(t){return t&&t.Object===Object?t:null}function SW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function AW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Hx=Object.prototype,Vx=Function.prototype.toString,OW=Hx.hasOwnProperty,xW=Hx.toString,TW=RegExp("^"+Vx.call(OW).replace(DW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),n0=PW(CW,"Set"),IW=n0&&1/AW(new n0([,-0]))[1]==mW?function(t){return new n0(t)}:NW;function PW(t,e){var r=t[e];return kW(r)?r:void 0}function FW(t){if(t!=null){try{return Vx.call(t)}catch{}try{return t+""}catch{}}return""}function RW(t){var e=zx(t)?xW.call(t):"";return e==gW||e==yW}function zx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function kW(t){if(!zx(t))return!1;var e=RW(t)||SW(t)?TW:wW;return e.test(FW(t))}function NW(){}oa.exports=IW});var Wx=_((js,aa)=>{var ac={function:!0,object:!0},$W=ac[typeof js]&&js&&!js.nodeType?js:void 0,LW=ac[typeof aa]&&aa&&!aa.nodeType?aa:void 0,BW=Th($W&&LW&&typeof global=="object"&&global),jW=Th(ac[typeof self]&&self),Gx=Th(ac[typeof window]&&window),i0=Th(ac[typeof js]&&js),MW=BW||Gx!==(i0&&i0.window)&&Gx||jW||i0||Function("return this")();function Th(t){return t&&t.Object===Object?t:null}aa.exports=MW});var eT=_((vDe,Qx)=>{var UW=Kx(),qW=Wx(),HW=200,s0="__lodash_hash_undefined__",VW="[object Function]",zW="[object GeneratorFunction]",KW=/[\\^$.*+?()[\]{}|]/g,GW=/^\[object .+?Constructor\]$/;function WW(t,e){return!!t.length&&YW(t,e,0)>-1}function XW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function YW(t,e,r){if(e!==e)return ZW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function JW(t,e){return t.has(e)}function ZW(t,e,r){for(var n=t.length,i=e+(r?0:-1);r?i--:++i<n;){var s=t[i];if(s!==s)return i}return-1}function QW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function eX(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var tX=Array.prototype,Xx=Object.prototype,Yx=Function.prototype.toString,o0=Xx.hasOwnProperty,rX=Xx.toString,nX=RegExp("^"+Yx.call(o0).replace(KW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),iX=tX.splice,sX=Jx(qW,"Map"),uc=Jx(Object,"create");function Ms(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function oX(){this.__data__=uc?uc(null):{}}function aX(t){return this.has(t)&&delete this.__data__[t]}function uX(t){var e=this.__data__;if(uc){var r=e[t];return r===s0?void 0:r}return o0.call(e,t)?e[t]:void 0}function cX(t){var e=this.__data__;return uc?e[t]!==void 0:o0.call(e,t)}function lX(t,e){var r=this.__data__;return r[t]=uc&&e===void 0?s0:e,this}Ms.prototype.clear=oX;Ms.prototype.delete=aX;Ms.prototype.get=uX;Ms.prototype.has=cX;Ms.prototype.set=lX;function ua(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function fX(){this.__data__=[]}function hX(t){var e=this.__data__,r=Ph(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():iX.call(e,r,1),!0}function dX(t){var e=this.__data__,r=Ph(e,t);return r<0?void 0:e[r][1]}function pX(t){return Ph(this.__data__,t)>-1}function mX(t,e){var r=this.__data__,n=Ph(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ua.prototype.clear=fX;ua.prototype.delete=hX;ua.prototype.get=dX;ua.prototype.has=pX;ua.prototype.set=mX;function ca(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function gX(){this.__data__={hash:new Ms,map:new(sX||ua),string:new Ms}}function yX(t){return Fh(this,t).delete(t)}function DX(t){return Fh(this,t).get(t)}function wX(t){return Fh(this,t).has(t)}function vX(t,e){return Fh(this,t).set(t,e),this}ca.prototype.clear=gX;ca.prototype.delete=yX;ca.prototype.get=DX;ca.prototype.has=wX;ca.prototype.set=vX;function Ih(t){var e=-1,r=t?t.length:0;for(this.__data__=new ca;++e<r;)this.add(t[e])}function EX(t){return this.__data__.set(t,s0),this}function bX(t){return this.__data__.has(t)}Ih.prototype.add=Ih.prototype.push=EX;Ih.prototype.has=bX;function Ph(t,e){for(var r=t.length;r--;)if(AX(t[r][0],e))return r;return-1}function _X(t,e,r){var n=-1,i=WW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=XW;else if(s>=HW){var c=e?null:UW(t);if(c)return eX(c);o=!1,i=JW,u=new Ih}else u=e?[]:a;e:for(;++n<s;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,o&&h===h){for(var d=u.length;d--;)if(u[d]===h)continue e;e&&u.push(h),a.push(l)}else i(u,h,r)||(u!==a&&u.push(h),a.push(l))}return a}function Fh(t,e){var r=t.__data__;return CX(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Jx(t,e){var r=t[e];return xX(r)?r:void 0}function CX(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function SX(t){if(t!=null){try{return Yx.call(t)}catch{}try{return t+""}catch{}}return""}function AX(t,e){return t===e||t!==t&&e!==e}function OX(t){var e=Zx(t)?rX.call(t):"";return e==VW||e==zW}function Zx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function xX(t){if(!Zx(t))return!1;var e=OX(t)||QW(t)?nX:GW;return e.test(SX(t))}Qx.exports=_X});var rT=_((EDe,tT)=>{var TX=Ux(),IX=eT();function PX(t,e){return t&&t.length?IX(t,TX(e)):[]}tT.exports=PX});var iT=_((bDe,nT)=>{"use strict";var FX=QO(),RX=rT(),kX=FX("MultiError");nT.exports=a0;function a0(t){if(!(this instanceof a0))return new a0(t);if(t=Array.isArray(t)?t:[t],t=RX(t,function(r){return r.stack}),t.length===1)return t[0];var e=new kX({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
55
+ `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return i},set:function(l){i=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),c())}});var JO=_((DDe,YO)=>{"use strict";YO.exports=As;As.factory=WO();var BD=As("CustomError");BD.order=As(BD,{message:"Arguments out of order.",code:"EOARG"});function As(t,e,r,n){var i,s;return e=ch(arguments,1,Error,XO,[$D,lh]),r=ch(arguments,2,{},$D,[lh]),n=ch(arguments,3,LD,lh,[]),t=ch(arguments,0,e===Error?"Error":e.prototype.CustomError.name,Nz,[XO,$D,lh]),s=e===Error,s&&n===LD&&(n=As.factory.root),i=function(o,a){var u,c,l,h,d,f;if(!(this instanceof i))return new i(o,a);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof o=="string"&&(o={message:o}),o||(o={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(o),c.unshift({}),f=Object.assign.apply(Object,c),u=this,l={},Object.keys(As.factory).forEach(function(m){l[m]=function(y,v){As.factory[m].call(u,y,v,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==LD&&d.factory.call(this,f,a,l)},i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.name=t,i.prototype.CustomError={chain:s?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},i.prototype.CustomError.chain.unshift(i.prototype.CustomError),i.prototype.toString=function(){var o=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(o+=" "+this.code),this.message&&(o+=": "+this.message),o},i}function ch(t,e,r,n,i){var s=-1,o=-1,a,u,c=e<t.length?e:t.length,l;for(a=0;a<=c;a++){if(l=t[a],s===-1)for(u=0;u<i.length;u++)i[u](l)&&(s=a);o===-1&&n(l)&&(o=a)}if(o!==-1&&s!==-1&&s<o)throw new BD.order;return o!==-1?t[o]:r}function lh(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function Nz(t){return typeof t=="string"}function XO(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function $D(t){return t&&typeof t=="object"}function LD(){}});var QO=_((wDe,ZO)=>{ZO.exports=JO()});var ix=_((Os,Qo)=>{var $z=1/0,Lz="[object Symbol]",Zu={function:!0,object:!0},Bz=Zu[typeof Os]&&Os&&!Os.nodeType?Os:void 0,jz=Zu[typeof Qo]&&Qo&&!Qo.nodeType?Qo:void 0,Mz=fh(Bz&&jz&&typeof global=="object"&&global),Uz=fh(Zu[typeof self]&&self),ex=fh(Zu[typeof window]&&window),jD=fh(Zu[typeof Os]&&Os),qz=Mz||ex!==(jD&&jD.window)&&ex||Uz||jD||Function("return this")();function fh(t){return t&&t.Object===Object?t:null}var Hz=Object.prototype,Vz=Hz.toString,tx=qz.Symbol,rx=tx?tx.prototype:void 0,nx=rx?rx.toString:void 0;function zz(t){if(typeof t=="string")return t;if(Gz(t))return nx?nx.call(t):"";var e=t+"";return e=="0"&&1/t==-$z?"-0":e}function Kz(t){return!!t&&typeof t=="object"}function Gz(t){return typeof t=="symbol"||Kz(t)&&Vz.call(t)==Lz}Qo.exports=zz});var fx=_((xs,ea)=>{var Wz=ix(),Xz="Expected a function",ox="__lodash_hash_undefined__",Yz="[object Function]",Jz="[object GeneratorFunction]",Zz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,Qz=/[\\^$.*+?()[\]{}|]/g,eK=/\\(\\)?/g,tK=/^\[object .+?Constructor\]$/,ec={function:!0,object:!0},rK=ec[typeof xs]&&xs&&!xs.nodeType?xs:void 0,nK=ec[typeof ea]&&ea&&!ea.nodeType?ea:void 0,iK=hh(rK&&nK&&typeof global=="object"&&global),sK=hh(ec[typeof self]&&self),sx=hh(ec[typeof window]&&window),MD=hh(ec[typeof xs]&&xs),oK=iK||sx!==(MD&&MD.window)&&sx||sK||MD||Function("return this")();function hh(t){return t&&t.Object===Object?t:null}function aK(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var uK=Array.prototype,ax=Object.prototype,ux=Function.prototype.toString,UD=ax.hasOwnProperty,cK=ax.toString,lK=RegExp("^"+ux.call(UD).replace(Qz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fK=uK.splice,hK=cx(oK,"Map"),Qu=cx(Object,"create");function Ts(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function dK(){this.__data__=Qu?Qu(null):{}}function pK(t){return this.has(t)&&delete this.__data__[t]}function mK(t){var e=this.__data__;if(Qu){var r=e[t];return r===ox?void 0:r}return UD.call(e,t)?e[t]:void 0}function gK(t){var e=this.__data__;return Qu?e[t]!==void 0:UD.call(e,t)}function yK(t,e){var r=this.__data__;return r[t]=Qu&&e===void 0?ox:e,this}Ts.prototype.clear=dK;Ts.prototype.delete=pK;Ts.prototype.get=mK;Ts.prototype.has=gK;Ts.prototype.set=yK;function ta(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function DK(){this.__data__=[]}function wK(t){var e=this.__data__,r=dh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():fK.call(e,r,1),!0}function vK(t){var e=this.__data__,r=dh(e,t);return r<0?void 0:e[r][1]}function EK(t){return dh(this.__data__,t)>-1}function bK(t,e){var r=this.__data__,n=dh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ta.prototype.clear=DK;ta.prototype.delete=wK;ta.prototype.get=vK;ta.prototype.has=EK;ta.prototype.set=bK;function Is(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function _K(){this.__data__={hash:new Ts,map:new(hK||ta),string:new Ts}}function CK(t){return ph(this,t).delete(t)}function SK(t){return ph(this,t).get(t)}function AK(t){return ph(this,t).has(t)}function OK(t,e){return ph(this,t).set(t,e),this}Is.prototype.clear=_K;Is.prototype.delete=CK;Is.prototype.get=SK;Is.prototype.has=AK;Is.prototype.set=OK;function dh(t,e){for(var r=t.length;r--;)if(PK(t[r][0],e))return r;return-1}function ph(t,e){var r=t.__data__;return xK(e)?r[typeof e=="string"?"string":"hash"]:r.map}function cx(t,e){var r=t[e];return RK(r)?r:void 0}function xK(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var TK=qD(function(t){var e=[];return kK(t).replace(Zz,function(r,n,i,s){e.push(i?s.replace(eK,"$1"):n||r)}),e});function IK(t){if(t!=null){try{return ux.call(t)}catch{}try{return t+""}catch{}}return""}function qD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Xz);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new(qD.Cache||Is),r}qD.Cache=Is;function PK(t,e){return t===e||t!==t&&e!==e}function FK(t){var e=lx(t)?cK.call(t):"";return e==Yz||e==Jz}function lx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function RK(t){if(!lx(t))return!1;var e=FK(t)||aK(t)?lK:tK;return e.test(IK(t))}function kK(t){return t==null?"":Wz(t)}ea.exports=TK});var Ux=_((Ps,na)=>{var NK=fx(),$K=200,QD="__lodash_hash_undefined__",wh=1,ia=2,LK=1/0,yx=9007199254740991,mh="[object Arguments]",zD="[object Array]",Dx="[object Boolean]",wx="[object Date]",vx="[object Error]",Ex="[object Function]",BK="[object GeneratorFunction]",tc="[object Map]",bx="[object Number]",ra="[object Object]",hx="[object Promise]",_x="[object RegExp]",rc="[object Set]",e0="[object String]",Cx="[object Symbol]",KD="[object WeakMap]",Sx="[object ArrayBuffer]",gh="[object DataView]",jK="[object Float32Array]",MK="[object Float64Array]",UK="[object Int8Array]",qK="[object Int16Array]",HK="[object Int32Array]",VK="[object Uint8Array]",zK="[object Uint8ClampedArray]",KK="[object Uint16Array]",GK="[object Uint32Array]",WK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,XK=/^\w*$/,YK=/[\\^$.*+?()[\]{}|]/g,JK=/^\[object .+?Constructor\]$/,ZK=/^(?:0|[1-9]\d*)$/,Qe={};Qe[jK]=Qe[MK]=Qe[UK]=Qe[qK]=Qe[HK]=Qe[VK]=Qe[zK]=Qe[KK]=Qe[GK]=!0;Qe[mh]=Qe[zD]=Qe[Sx]=Qe[Dx]=Qe[gh]=Qe[wx]=Qe[vx]=Qe[Ex]=Qe[tc]=Qe[bx]=Qe[ra]=Qe[_x]=Qe[rc]=Qe[e0]=Qe[KD]=!1;var ic={function:!0,object:!0},QK=ic[typeof Ps]&&Ps&&!Ps.nodeType?Ps:void 0,eG=ic[typeof na]&&na&&!na.nodeType?na:void 0,tG=vh(QK&&eG&&typeof global=="object"&&global),rG=vh(ic[typeof self]&&self),dx=vh(ic[typeof window]&&window),HD=vh(ic[typeof Ps]&&Ps),ks=tG||dx!==(HD&&HD.window)&&dx||rG||HD||Function("return this")();function nG(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function iG(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function sG(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function oG(t,e){return nG(e,function(r){return[r,t[r]]})}function vh(t){return t&&t.Object===Object?t:null}function GD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Ax(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function aG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function uG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var cG=Array.prototype,Eh=Object.prototype,Ox=Function.prototype.toString,Fs=Eh.hasOwnProperty,Ns=Eh.toString,lG=RegExp("^"+Ox.call(Fs).replace(YK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),px=ks.Symbol,mx=ks.Uint8Array,fG=Eh.propertyIsEnumerable,hG=cG.splice,dG=Object.getPrototypeOf,pG=Object.keys,WD=sa(ks,"DataView"),yh=sa(ks,"Map"),XD=sa(ks,"Promise"),YD=sa(ks,"Set"),JD=sa(ks,"WeakMap"),nc=sa(Object,"create"),mG=Ls(WD),gG=Ls(yh),yG=Ls(XD),DG=Ls(YD),wG=Ls(JD),gx=px?px.prototype:void 0,VD=gx?gx.valueOf:void 0;function Rs(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function vG(){this.__data__=nc?nc(null):{}}function EG(t){return this.has(t)&&delete this.__data__[t]}function bG(t){var e=this.__data__;if(nc){var r=e[t];return r===QD?void 0:r}return Fs.call(e,t)?e[t]:void 0}function _G(t){var e=this.__data__;return nc?e[t]!==void 0:Fs.call(e,t)}function CG(t,e){var r=this.__data__;return r[t]=nc&&e===void 0?QD:e,this}Rs.prototype.clear=vG;Rs.prototype.delete=EG;Rs.prototype.get=bG;Rs.prototype.has=_G;Rs.prototype.set=CG;function ti(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function SG(){this.__data__=[]}function AG(t){var e=this.__data__,r=bh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():hG.call(e,r,1),!0}function OG(t){var e=this.__data__,r=bh(e,t);return r<0?void 0:e[r][1]}function xG(t){return bh(this.__data__,t)>-1}function TG(t,e){var r=this.__data__,n=bh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ti.prototype.clear=SG;ti.prototype.delete=AG;ti.prototype.get=OG;ti.prototype.has=xG;ti.prototype.set=TG;function $s(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function IG(){this.__data__={hash:new Rs,map:new(yh||ti),string:new Rs}}function PG(t){return _h(this,t).delete(t)}function FG(t){return _h(this,t).get(t)}function RG(t){return _h(this,t).has(t)}function kG(t,e){return _h(this,t).set(t,e),this}$s.prototype.clear=IG;$s.prototype.delete=PG;$s.prototype.get=FG;$s.prototype.has=RG;$s.prototype.set=kG;function Dh(t){var e=-1,r=t?t.length:0;for(this.__data__=new $s;++e<r;)this.add(t[e])}function NG(t){return this.__data__.set(t,QD),this}function $G(t){return this.__data__.has(t)}Dh.prototype.add=Dh.prototype.push=NG;Dh.prototype.has=$G;function ei(t){this.__data__=new ti(t)}function LG(){this.__data__=new ti}function BG(t){return this.__data__.delete(t)}function jG(t){return this.__data__.get(t)}function MG(t){return this.__data__.has(t)}function UG(t,e){var r=this.__data__;return r instanceof ti&&r.__data__.length==$K&&(r=this.__data__=new $s(r.__data__)),r.set(t,e),this}ei.prototype.clear=LG;ei.prototype.delete=BG;ei.prototype.get=jG;ei.prototype.has=MG;ei.prototype.set=UG;function bh(t,e){for(var r=t.length;r--;)if(oW(t[r][0],e))return r;return-1}function xx(t,e){e=Ch(e,t)?[e]:Px(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Sh(e[r++])];return r&&r==n?t:void 0}function Tx(t,e){return Fs.call(t,e)||typeof t=="object"&&e in t&&tW(t)===null}function qG(t,e){return e in Object(t)}function t0(t,e,r,n,i){return t===e?!0:t==null||e==null||!Oh(t)&&!sc(e)?t!==t&&e!==e:HG(t,e,t0,r,n,i)}function HG(t,e,r,n,i,s){var o=Li(t),a=Li(e),u=zD,c=zD;o||(u=Qn(t),u=u==mh?ra:u),a||(c=Qn(e),c=c==mh?ra:c);var l=u==ra&&!GD(t),h=c==ra&&!GD(e),d=u==c;if(d&&!l)return s||(s=new ei),o||cW(t)?Fx(t,e,r,n,i,s):JG(t,e,u,r,n,i,s);if(!(i&ia)){var f=l&&Fs.call(t,"__wrapped__"),m=h&&Fs.call(e,"__wrapped__");if(f||m){var y=f?t.value():t,v=m?e.value():e;return s||(s=new ei),r(y,v,n,i,s)}}return d?(s||(s=new ei),ZG(t,e,r,n,i,s)):!1}function VG(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var u=a[0],c=t[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in t))return!1}else{var h=new ei;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?t0(l,c,n,wh|ia,h):d))return!1}}return!0}function zG(t){return typeof t=="function"?t:t==null?dW:typeof t=="object"?Li(t)?WG(t[0],t[1]):GG(t):pW(t)}function KG(t){return pG(Object(t))}function GG(t){var e=eW(t);return e.length==1&&e[0][2]?Nx(e[0][0],e[0][1]):function(r){return r===t||VG(r,t,e)}}function WG(t,e){return Ch(t)&&kx(e)?Nx(Sh(t),e):function(r){var n=lW(r,t);return n===void 0&&n===e?fW(r,t):t0(e,n,void 0,wh|ia)}}function Ix(t){return function(e){return e?.[t]}}function XG(t){return function(e){return xx(e,t)}}function Px(t){return Li(t)?t:NK(t)}function YG(t){return function(e){var r=Qn(e);return r==tc?Ax(e):r==rc?uG(e):oG(e,t(e))}}function Fx(t,e,r,n,i,s){var o=i&ia,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t);if(c)return c==e;var l=-1,h=!0,d=i&wh?new Dh:void 0;for(s.set(t,e);++l<a;){var f=t[l],m=e[l];if(n)var y=o?n(m,f,l,e,t,s):n(f,m,l,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(d){if(!iG(e,function(v,E){if(!d.has(E)&&(f===v||r(f,v,n,i,s)))return d.add(E)})){h=!1;break}}else if(!(f===m||r(f,m,n,i,s))){h=!1;break}}return s.delete(t),h}function JG(t,e,r,n,i,s,o){switch(r){case gh:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Sx:return!(t.byteLength!=e.byteLength||!n(new mx(t),new mx(e)));case Dx:case wx:return+t==+e;case vx:return t.name==e.name&&t.message==e.message;case bx:return t!=+t?e!=+e:t==+e;case _x:case e0:return t==e+"";case tc:var a=Ax;case rc:var u=s&ia;if(a||(a=aG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=wh,o.set(t,e),Fx(a(t),a(e),n,i,s,o));case Cx:if(VD)return VD.call(t)==VD.call(e)}return!1}function ZG(t,e,r,n,i,s){var o=i&ia,a=ZD(t),u=a.length,c=ZD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:Tx(e,d)))return!1}var f=s.get(t);if(f)return f==e;var m=!0;s.set(t,e);for(var y=o;++h<u;){d=a[h];var v=t[d],E=e[d];if(n)var A=o?n(E,v,d,e,t,s):n(v,E,d,t,e,s);if(!(A===void 0?v===E||r(v,E,n,i,s):A)){m=!1;break}y||(y=d=="constructor")}if(m&&!y){var p=t.constructor,D=e.constructor;p!=D&&"constructor"in t&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof D=="function"&&D instanceof D)&&(m=!1)}return s.delete(t),m}var QG=Ix("length");function _h(t,e){var r=t.__data__;return iW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function eW(t){for(var e=hW(t),r=e.length;r--;)e[r][2]=kx(e[r][1]);return e}function sa(t,e){var r=t[e];return uW(r)?r:void 0}function tW(t){return dG(Object(t))}function Qn(t){return Ns.call(t)}(WD&&Qn(new WD(new ArrayBuffer(1)))!=gh||yh&&Qn(new yh)!=tc||XD&&Qn(XD.resolve())!=hx||YD&&Qn(new YD)!=rc||JD&&Qn(new JD)!=KD)&&(Qn=function(t){var e=Ns.call(t),r=e==ra?t.constructor:void 0,n=r?Ls(r):void 0;if(n)switch(n){case mG:return gh;case gG:return tc;case yG:return hx;case DG:return rc;case wG:return KD}return e});function rW(t,e,r){e=Ch(e,t)?[e]:Px(e);for(var n,i=-1,o=e.length;++i<o;){var s=Sh(e[i]);if(!(n=t!=null&&r(t,s)))break;t=t[s]}if(n)return n;var o=t?t.length:0;return!!o&&Ah(o)&&Rx(s,o)&&(Li(t)||jx(t)||$x(t))}function nW(t){var e=t?t.length:void 0;return Ah(e)&&(Li(t)||jx(t)||$x(t))?sG(e,String):null}function Rx(t,e){return e=e??yx,!!e&&(typeof t=="number"||ZK.test(t))&&t>-1&&t%1==0&&t<e}function Ch(t,e){if(Li(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Mx(t)?!0:XK.test(t)||!WK.test(t)||e!=null&&t in Object(e)}function iW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function sW(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Eh;return t===r}function kx(t){return t===t&&!Oh(t)}function Nx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Sh(t){if(typeof t=="string"||Mx(t))return t;var e=t+"";return e=="0"&&1/t==-LK?"-0":e}function Ls(t){if(t!=null){try{return Ox.call(t)}catch{}try{return t+""}catch{}}return""}function oW(t,e){return t===e||t!==t&&e!==e}function $x(t){return aW(t)&&Fs.call(t,"callee")&&(!fG.call(t,"callee")||Ns.call(t)==mh)}var Li=Array.isArray;function Lx(t){return t!=null&&Ah(QG(t))&&!Bx(t)}function aW(t){return sc(t)&&Lx(t)}function Bx(t){var e=Oh(t)?Ns.call(t):"";return e==Ex||e==BK}function Ah(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=yx}function Oh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function sc(t){return!!t&&typeof t=="object"}function uW(t){if(!Oh(t))return!1;var e=Bx(t)||GD(t)?lG:JK;return e.test(Ls(t))}function jx(t){return typeof t=="string"||!Li(t)&&sc(t)&&Ns.call(t)==e0}function Mx(t){return typeof t=="symbol"||sc(t)&&Ns.call(t)==Cx}function cW(t){return sc(t)&&Ah(t.length)&&!!Qe[Ns.call(t)]}function lW(t,e,r){var n=t==null?void 0:xx(t,e);return n===void 0?r:n}function fW(t,e){return t!=null&&rW(t,e,qG)}function ZD(t){var e=sW(t);if(!(e||Lx(t)))return KG(t);var r=nW(t),n=!!r,i=r||[],s=i.length;for(var o in t)Tx(t,o)&&!(n&&(o=="length"||Rx(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var hW=YG(ZD);function dW(t){return t}function pW(t){return Ch(t)?Ix(Sh(t)):XG(t)}na.exports=zG});var Kx=_((Bs,oa)=>{var mW=1/0,gW="[object Function]",yW="[object GeneratorFunction]",DW=/[\\^$.*+?()[\]{}|]/g,wW=/^\[object .+?Constructor\]$/,oc={function:!0,object:!0},vW=oc[typeof Bs]&&Bs&&!Bs.nodeType?Bs:void 0,EW=oc[typeof oa]&&oa&&!oa.nodeType?oa:void 0,bW=xh(vW&&EW&&typeof global=="object"&&global),_W=xh(oc[typeof self]&&self),qx=xh(oc[typeof window]&&window),r0=xh(oc[typeof Bs]&&Bs),CW=bW||qx!==(r0&&r0.window)&&qx||_W||r0||Function("return this")();function xh(t){return t&&t.Object===Object?t:null}function SW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function AW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Hx=Object.prototype,Vx=Function.prototype.toString,OW=Hx.hasOwnProperty,xW=Hx.toString,TW=RegExp("^"+Vx.call(OW).replace(DW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),n0=PW(CW,"Set"),IW=n0&&1/AW(new n0([,-0]))[1]==mW?function(t){return new n0(t)}:NW;function PW(t,e){var r=t[e];return kW(r)?r:void 0}function FW(t){if(t!=null){try{return Vx.call(t)}catch{}try{return t+""}catch{}}return""}function RW(t){var e=zx(t)?xW.call(t):"";return e==gW||e==yW}function zx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function kW(t){if(!zx(t))return!1;var e=RW(t)||SW(t)?TW:wW;return e.test(FW(t))}function NW(){}oa.exports=IW});var Wx=_((js,aa)=>{var ac={function:!0,object:!0},$W=ac[typeof js]&&js&&!js.nodeType?js:void 0,LW=ac[typeof aa]&&aa&&!aa.nodeType?aa:void 0,BW=Th($W&&LW&&typeof global=="object"&&global),jW=Th(ac[typeof self]&&self),Gx=Th(ac[typeof window]&&window),i0=Th(ac[typeof js]&&js),MW=BW||Gx!==(i0&&i0.window)&&Gx||jW||i0||Function("return this")();function Th(t){return t&&t.Object===Object?t:null}aa.exports=MW});var eT=_((vDe,Qx)=>{var UW=Kx(),qW=Wx(),HW=200,s0="__lodash_hash_undefined__",VW="[object Function]",zW="[object GeneratorFunction]",KW=/[\\^$.*+?()[\]{}|]/g,GW=/^\[object .+?Constructor\]$/;function WW(t,e){return!!t.length&&YW(t,e,0)>-1}function XW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function YW(t,e,r){if(e!==e)return ZW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function JW(t,e){return t.has(e)}function ZW(t,e,r){for(var n=t.length,i=e+(r?0:-1);r?i--:++i<n;){var s=t[i];if(s!==s)return i}return-1}function QW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function eX(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var tX=Array.prototype,Xx=Object.prototype,Yx=Function.prototype.toString,o0=Xx.hasOwnProperty,rX=Xx.toString,nX=RegExp("^"+Yx.call(o0).replace(KW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),iX=tX.splice,sX=Jx(qW,"Map"),uc=Jx(Object,"create");function Ms(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function oX(){this.__data__=uc?uc(null):{}}function aX(t){return this.has(t)&&delete this.__data__[t]}function uX(t){var e=this.__data__;if(uc){var r=e[t];return r===s0?void 0:r}return o0.call(e,t)?e[t]:void 0}function cX(t){var e=this.__data__;return uc?e[t]!==void 0:o0.call(e,t)}function lX(t,e){var r=this.__data__;return r[t]=uc&&e===void 0?s0:e,this}Ms.prototype.clear=oX;Ms.prototype.delete=aX;Ms.prototype.get=uX;Ms.prototype.has=cX;Ms.prototype.set=lX;function ua(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function fX(){this.__data__=[]}function hX(t){var e=this.__data__,r=Ph(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():iX.call(e,r,1),!0}function dX(t){var e=this.__data__,r=Ph(e,t);return r<0?void 0:e[r][1]}function pX(t){return Ph(this.__data__,t)>-1}function mX(t,e){var r=this.__data__,n=Ph(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ua.prototype.clear=fX;ua.prototype.delete=hX;ua.prototype.get=dX;ua.prototype.has=pX;ua.prototype.set=mX;function ca(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function gX(){this.__data__={hash:new Ms,map:new(sX||ua),string:new Ms}}function yX(t){return Fh(this,t).delete(t)}function DX(t){return Fh(this,t).get(t)}function wX(t){return Fh(this,t).has(t)}function vX(t,e){return Fh(this,t).set(t,e),this}ca.prototype.clear=gX;ca.prototype.delete=yX;ca.prototype.get=DX;ca.prototype.has=wX;ca.prototype.set=vX;function Ih(t){var e=-1,r=t?t.length:0;for(this.__data__=new ca;++e<r;)this.add(t[e])}function EX(t){return this.__data__.set(t,s0),this}function bX(t){return this.__data__.has(t)}Ih.prototype.add=Ih.prototype.push=EX;Ih.prototype.has=bX;function Ph(t,e){for(var r=t.length;r--;)if(AX(t[r][0],e))return r;return-1}function _X(t,e,r){var n=-1,i=WW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=XW;else if(s>=HW){var c=e?null:UW(t);if(c)return eX(c);o=!1,i=JW,u=new Ih}else u=e?[]:a;e:for(;++n<s;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,o&&h===h){for(var d=u.length;d--;)if(u[d]===h)continue e;e&&u.push(h),a.push(l)}else i(u,h,r)||(u!==a&&u.push(h),a.push(l))}return a}function Fh(t,e){var r=t.__data__;return CX(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Jx(t,e){var r=t[e];return xX(r)?r:void 0}function CX(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function SX(t){if(t!=null){try{return Yx.call(t)}catch{}try{return t+""}catch{}}return""}function AX(t,e){return t===e||t!==t&&e!==e}function OX(t){var e=Zx(t)?rX.call(t):"";return e==VW||e==zW}function Zx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function xX(t){if(!Zx(t))return!1;var e=OX(t)||QW(t)?nX:GW;return e.test(SX(t))}Qx.exports=_X});var rT=_((EDe,tT)=>{var TX=Ux(),IX=eT();function PX(t,e){return t&&t.length?IX(t,TX(e)):[]}tT.exports=PX});var iT=_((bDe,nT)=>{"use strict";var FX=QO(),RX=rT(),kX=FX("MultiError");nT.exports=a0;function a0(t){if(!(this instanceof a0))return new a0(t);if(t=Array.isArray(t)?t:[t],t=RX(t,function(r){return r.stack}),t.length===1)return t[0];var e=new kX({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
56
56
 
57
57
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
58
58
 
59
59
  `)}),e}});var oT=_((_De,sT)=>{var Bi=require("constants"),NX=process.cwd,Rh=null,$X=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Rh||(Rh=NX.call(process)),Rh};try{process.cwd()}catch{}typeof process.chdir=="function"&&(u0=process.chdir,process.chdir=function(t){Rh=null,u0.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,u0));var u0;sT.exports=LX;function LX(t){Bi.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,h,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,h,d,f){f&&process.nextTick(f)},t.lchownSync=function(){}),$X==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function h(d,f,m){var y=Date.now(),v=0;l(d,f,function E(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(f,function(p,D){p&&p.code==="ENOENT"?l(d,f,E):m(A)})},v),v<100&&(v+=10);return}m&&m(A)})}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function h(d,f,m,y,v,E){var A;if(E&&typeof E=="function"){var p=0;A=function(D,w,C){if(D&&D.code==="EAGAIN"&&p<10)return p++,l.call(t,d,f,m,y,v,A);E.apply(this,arguments)}}return l.call(t,d,f,m,y,v,A)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(h,d,f,m,y){for(var v=0;;)try{return l.call(t,h,d,f,m,y)}catch(E){if(E.code==="EAGAIN"&&v<10){v++;continue}throw E}}})(t.readSync);function e(l){l.lchmod=function(h,d,f){l.open(h,Bi.O_WRONLY|Bi.O_SYMLINK,d,function(m,y){if(m){f&&f(m);return}l.fchmod(y,d,function(v){l.close(y,function(E){f&&f(v||E)})})})},l.lchmodSync=function(h,d){var f=l.openSync(h,Bi.O_WRONLY|Bi.O_SYMLINK,d),m=!0,y;try{y=l.fchmodSync(f,d),m=!1}finally{if(m)try{l.closeSync(f)}catch{}else l.closeSync(f)}return y}}function r(l){Bi.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(h,d,f,m){l.open(h,Bi.O_SYMLINK,function(y,v){if(y){m&&m(y);return}l.futimes(v,d,f,function(E){l.close(v,function(A){m&&m(E||A)})})})},l.lutimesSync=function(h,d,f){var m=l.openSync(h,Bi.O_SYMLINK),y,v=!0;try{y=l.futimesSync(m,d,f),v=!1}finally{if(v)try{l.closeSync(m)}catch{}else l.closeSync(m)}return y}):l.futimes&&(l.lutimes=function(h,d,f,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(h,d,f){return l.call(t,h,d,function(m){c(m)&&(m=null),f&&f.apply(this,arguments)})}}function i(l){return l&&function(h,d){try{return l.call(t,h,d)}catch(f){if(!c(f))throw f}}}function s(l){return l&&function(h,d,f,m){return l.call(t,h,d,f,function(y){c(y)&&(y=null),m&&m.apply(this,arguments)})}}function o(l){return l&&function(h,d,f){try{return l.call(t,h,d,f)}catch(m){if(!c(m))throw m}}}function a(l){return l&&function(h,d,f){typeof d=="function"&&(f=d,d=null);function m(y,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),f&&f.apply(this,arguments)}return d?l.call(t,h,d,m):l.call(t,h,m)}}function u(l){return l&&function(h,d){var f=d?l.call(t,h,d):l.call(t,h);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function c(l){if(!l||l.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var cT=_((CDe,uT)=>{var aT=require("stream").Stream;uT.exports=BX;function BX(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);aT.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),a=0,u=o.length;a<u;a++){var c=o[a];this[c]=i[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}t.open(this.path,this.flags,this.mode,function(l,h){if(l){s.emit("error",l),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);aT.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,a=s.length;o<a;o++){var u=s[o];this[u]=i[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var fT=_((SDe,lT)=>{"use strict";lT.exports=MX;var jX=Object.getPrototypeOf||function(t){return t.__proto__};function MX(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:jX(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var vt=_((ADe,f0)=>{var pt=require("fs"),UX=oT(),qX=cT(),HX=fT(),kh=require("util"),Ht,$h;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ht=Symbol.for("graceful-fs.queue"),$h=Symbol.for("graceful-fs.previous")):(Ht="___graceful-fs.queue",$h="___graceful-fs.previous");function VX(){}function pT(t,e){Object.defineProperty(t,Ht,{get:function(){return e}})}var Us=VX;kh.debuglog?Us=kh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Us=function(){var t=kh.format.apply(kh,arguments);t="GFS4: "+t.split(/\n/).join(`
60
- GFS4: `),console.error(t)});pt[Ht]||(hT=global[Ht]||[],pT(pt,hT),pt.close=(function(t){function e(r,n){return t.call(pt,r,function(i){i||dT(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,$h,{value:t}),e})(pt.close),pt.closeSync=(function(t){function e(r){t.apply(pt,arguments),dT()}return Object.defineProperty(e,$h,{value:t}),e})(pt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Us(pt[Ht]),require("assert").equal(pt[Ht].length,0)}));var hT;global[Ht]||pT(global,pt[Ht]);f0.exports=c0(HX(pt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!pt.__patched&&(f0.exports=c0(pt),pt.__patched=!0);function c0(t){UX(t),t.gracefulify=c0,t.createReadStream=w,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(k,R,I){return typeof R=="function"&&(I=R,R=null),B(k,R,I);function B(j,z,L,S){return e(j,z,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?la([B,[j,z,L],T,S||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return n(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return s(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(k,R,I,B){return typeof I=="function"&&(B=I,I=0),j(k,R,I,B);function j(z,L,S,T,P){return a(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var c=t.readdir;t.readdir=h;var l=/^v[0-5]\./;function h(k,R,I){typeof R=="function"&&(I=R,R=null);var B=l.test(process.version)?function(L,S,T,P){return c(L,j(L,S,T,P))}:function(L,S,T,P){return c(L,S,j(L,S,T,P))};return B(k,R,I);function j(z,L,S,T){return function(P,$){P&&(P.code==="EMFILE"||P.code==="ENFILE")?la([B,[z,L,S],P,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof S=="function"&&S.call(this,P,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=qX(t);E=d.ReadStream,p=d.WriteStream}var f=t.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.prototype.open=A);var m=t.WriteStream;m&&(p.prototype=Object.create(m.prototype),p.prototype.open=D),Object.defineProperty(t,"ReadStream",{get:function(){return E},set:function(k){E=k},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(k){p=k},enumerable:!0,configurable:!0});var y=E;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(k){y=k},enumerable:!0,configurable:!0});var v=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return v},set:function(k){v=k},enumerable:!0,configurable:!0});function E(k,R){return this instanceof E?(f.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function A(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.autoClose&&k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I),k.read())})}function p(k,R){return this instanceof p?(m.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function D(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I))})}function w(k,R){return new t.ReadStream(k,R)}function C(k,R){return new t.WriteStream(k,R)}var F=t.open;t.open=b;function b(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return F(z,L,S,function($,q){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function la(t){Us("ENQUEUE",t[0].name,t[1]),pt[Ht].push(t),l0()}var Nh;function dT(){for(var t=Date.now(),e=0;e<pt[Ht].length;++e)pt[Ht][e].length>2&&(pt[Ht][e][3]=t,pt[Ht][e][4]=t);l0()}function l0(){if(clearTimeout(Nh),Nh=void 0,pt[Ht].length!==0){var t=pt[Ht].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)Us("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Us("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,u=Math.max(s-i,1),c=Math.min(u*1.2,100);a>=c?(Us("RETRY",e.name,r),e.apply(null,r.concat([i]))):pt[Ht].push(t)}Nh===void 0&&(Nh=setTimeout(l0,0))}}});var gT=_((ODe,mT)=>{function Kr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}mT.exports=Kr;Kr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Kr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Kr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,i=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&i.unref(),!0};Kr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Kr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Kr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Kr.prototype.start=Kr.prototype.try;Kr.prototype.errors=function(){return this._errors};Kr.prototype.attempts=function(){return this._attempts};Kr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],s=i.message,o=(t[s]||0)+1;t[s]=o,o>=r&&(e=i,r=o)}return e}});var yT=_(qs=>{var zX=gT();qs.operation=function(t){var e=qs.timeouts(t);return new zX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};qs.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<e.retries;i++)n.push(this.createTimeout(i,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(i,e)),n.sort(function(s,o){return s-o}),n};qs.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};qs.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var i=0;i<r.length;i++){var s=r[i],o=t[s];t[s]=function(u){var c=qs.operation(e),l=Array.prototype.slice.call(arguments,1),h=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),h.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,o),t[s].options=e}}});var wT=_((TDe,DT)=>{DT.exports=yT()});var vT=_((IDe,Lh)=>{Lh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Lh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Lh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Uh=_((PDe,da)=>{var at=global.process,Hs=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};Hs(at)?(ET=require("assert"),fa=vT(),bT=/^win/i.test(at.platform),cc=require("events"),typeof cc!="function"&&(cc=cc.EventEmitter),at.__signal_exit_emitter__?kt=at.__signal_exit_emitter__:(kt=at.__signal_exit_emitter__=new cc,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),da.exports=function(t,e){if(!Hs(global.process))return function(){};ET.equal(typeof t,"function","a callback must be provided for exit handler"),ha===!1&&h0();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){kt.removeListener(r,t),kt.listeners("exit").length===0&&kt.listeners("afterexit").length===0&&Bh()};return kt.on(r,t),n},Bh=function(){!ha||!Hs(global.process)||(ha=!1,fa.forEach(function(e){try{at.removeListener(e,jh[e])}catch{}}),at.emit=Mh,at.reallyExit=d0,kt.count-=1)},da.exports.unload=Bh,Vs=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},jh={},fa.forEach(function(t){jh[t]=function(){if(Hs(global.process)){var r=at.listeners(t);r.length===kt.count&&(Bh(),Vs("exit",null,t),Vs("afterexit",null,t),bT&&t==="SIGHUP"&&(t="SIGINT"),at.kill(at.pid,t))}}}),da.exports.signals=function(){return fa},ha=!1,h0=function(){ha||!Hs(global.process)||(ha=!0,kt.count+=1,fa=fa.filter(function(e){try{return at.on(e,jh[e]),!0}catch{return!1}}),at.emit=CT,at.reallyExit=_T)},da.exports.load=h0,d0=at.reallyExit,_T=function(e){Hs(global.process)&&(at.exitCode=e||0,Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),d0.call(at,at.exitCode))},Mh=at.emit,CT=function(e,r){if(e==="exit"&&Hs(global.process)){r!==void 0&&(at.exitCode=r);var n=Mh.apply(this,arguments);return Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),n}else return Mh.apply(this,arguments)}):da.exports=function(){return function(){}};var ET,fa,bT,cc,kt,Bh,Vs,jh,ha,h0,d0,_T,Mh,CT});var AT=_((FDe,p0)=>{"use strict";var ST=Symbol();function KX(t,e,r){let n=e[ST];if(n)return e.stat(t,(s,o)=>{if(s)return r(s);r(null,o.mtime,n)});let i=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,i,i,s=>{if(s)return r(s);e.stat(t,(o,a)=>{if(o)return r(o);let u=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,ST,{value:u}),r(null,a.mtime,u)})})}function GX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}p0.exports.probe=KX;p0.exports.getMtime=GX});var PT=_((RDe,fc)=>{"use strict";var WX=require("path"),y0=vt(),XX=wT(),YX=Uh(),OT=AT(),ti={};function lc(t,e){return e.lockfilePath||`${t}.lock`}function D0(t,e,r){if(!e.realpath)return r(null,WX.resolve(t));e.fs.realpath(t,r)}function g0(t,e,r){let n=lc(t,e);e.fs.mkdir(n,i=>{if(!i)return OT.probe(n,e.fs,(s,o,a)=>{if(s)return e.fs.rmdir(n,()=>{}),r(s);r(null,o,a)});if(i.code!=="EEXIST")return r(i);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(s,o)=>{if(s)return s.code==="ENOENT"?g0(t,{...e,stale:0},r):r(s);if(!xT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));TT(t,e,a=>{if(a)return r(a);g0(t,{...e,stale:0},r)})})})}function xT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function TT(t,e,r){e.fs.rmdir(lc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function qh(t,e){let r=ti[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,i)=>{let s=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||s?m0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return m0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=OT.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?m0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,qh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function m0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),ti[t]===e&&delete ti[t],e.options.onCompromised(r)}function JX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:y0,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),D0(t,e,(n,i)=>{if(n)return r(n);let s=XX.operation(e.retries);s.attempt(()=>{g0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=ti[i]={lockfilePath:lc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};qh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));IT(i,{...e,realpath:!1},l)})})})})}function IT(t,e,r){e={fs:y0,realpath:!0,...e},D0(t,e,(n,i)=>{if(n)return r(n);let s=ti[i];if(!s)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));s.updateTimeout&&clearTimeout(s.updateTimeout),s.released=!0,delete ti[i],TT(i,e,r)})}function ZX(t,e,r){e={stale:1e4,realpath:!0,fs:y0,...e},e.stale=Math.max(e.stale||0,2e3),D0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(lc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!xT(o,e)))})}function QX(){return ti}YX(()=>{for(let t in ti){let e=ti[t].options;try{e.fs.rmdirSync(lc(t,e))}catch{}}});fc.exports.lock=JX;fc.exports.unlock=IT;fc.exports.check=ZX;fc.exports.getLocks=QX});var RT=_((kDe,FT)=>{"use strict";var eY=vt();function tY(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...i)=>{let s=i.pop(),o;try{o=t[`${n}Sync`](...i)}catch(a){return s(a)}s(null,o)}}),r}function rY(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function nY(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function iY(t){if(t={...t},t.fs=tY(t.fs||eY),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}FT.exports={toPromise:rY,toSync:nY,toSyncOptions:iY}});var NT=_((NDe,ji)=>{"use strict";var pa=PT(),{toPromise:Hh,toSync:Vh,toSyncOptions:w0}=RT();async function kT(t,e){let r=await Hh(pa.lock)(t,e);return Hh(r)}function sY(t,e){let r=Vh(pa.lock)(t,w0(e));return Vh(r)}function oY(t,e){return Hh(pa.unlock)(t,e)}function aY(t,e){return Vh(pa.unlock)(t,w0(e))}function uY(t,e){return Hh(pa.check)(t,e)}function cY(t,e){return Vh(pa.check)(t,w0(e))}ji.exports=kT;ji.exports.lock=kT;ji.exports.unlock=oY;ji.exports.lockSync=sY;ji.exports.unlockSync=aY;ji.exports.check=uY;ji.exports.checkSync=cY});var MT=_(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.canStoreURLs=ma.FileUrlStorage=void 0;var $T=require("fs"),lY=hY(iT()),LT=fY(NT());function jT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(jT=function(n){return n?r:e})(t)}function fY(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=jT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function hY(t){return t&&t.__esModule?t:{default:t}}function hc(t){"@babel/helpers - typeof";return hc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hc(t)}function dY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mY(n.key),n)}}function pY(t,e,r){return e&&BT(t.prototype,e),r&&BT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function mY(t){var e=gY(t,"string");return hc(e)=="symbol"?e:e+""}function gY(t,e){if(hc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $De=ma.canStoreURLs=!0,LDe=ma.FileUrlStorage=(function(){function t(e){dY(this,t),this.path=e}return pY(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,i){r._getItems("tus::",function(s,o){s?i(s):n(o)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(i,s){n._getItems("tus::".concat(r),function(o,a){o?s(o):i(a)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(i,s){n._removeItem(r,function(o){o?s(o):i()})})}},{key:"addUpload",value:function(r,n){var i=this,s=Math.round(Math.random()*1e12),o="tus::".concat(r,"::").concat(s);return new Promise(function(a,u){i._setItem(o,n,function(c){c?u(c):a(o)})})}},{key:"_setItem",value:function(r,n,i){var s=this;LT.lock(this.path,this._lockfileOptions()).then(function(o){i=s._releaseAndCb(o,i),s._getData(function(a,u){if(a){i(a);return}u[r]=n,s._writeData(u,function(c){return i(c)})})}).catch(i)}},{key:"_getItems",value:function(r,n){this._getData(function(i,s){if(i){n(i);return}var o=Object.keys(s).filter(function(a){return a.startsWith(r)}).map(function(a){var u=s[a];return u.urlStorageKey=a,u});n(null,o)})}},{key:"_removeItem",value:function(r,n){var i=this;LT.lock(this.path,this._lockfileOptions()).then(function(s){n=i._releaseAndCb(s,n),i._getData(function(o,a){if(o){n(o);return}delete a[r],i._writeData(a,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(i){if(i){r().then(function(){return n(i)}).catch(function(s){return n((0,lY.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,$T.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,$T.readFile)(this.path,"utf8",function(n,i){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{i=i.trim().length?JSON.parse(i):{}}catch(s){r(s);return}r(null,i)})}}])})()});var Kh=_(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Object.defineProperty(Er,"DefaultHttpStack",{enumerable:!0,get:function(){return VT.default}});Object.defineProperty(Er,"DetailedError",{enumerable:!0,get:function(){return yY.default}});Object.defineProperty(Er,"FileUrlStorage",{enumerable:!0,get:function(){return zT.FileUrlStorage}});Object.defineProperty(Er,"StreamSource",{enumerable:!0,get:function(){return bY.default}});Er.Upload=void 0;Object.defineProperty(Er,"canStoreURLs",{enumerable:!0,get:function(){return zT.canStoreURLs}});Er.defaultOptions=void 0;Object.defineProperty(Er,"enableDebugLog",{enumerable:!0,get:function(){return DY.enableDebugLog}});Er.isSupported=void 0;var yY=zs(gD()),DY=yD(),wY=zs(MA()),v0=zs(gO()),vY=zs(TO()),EY=zs(RO()),VT=zs(GO()),bY=zs(PD()),zT=MT();function zs(t){return t&&t.__esModule?t:{default:t}}function ya(t){"@babel/helpers - typeof";return ya=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ya(t)}function _Y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function UT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,GT(n.key),n)}}function CY(t,e,r){return e&&UT(t.prototype,e),r&&UT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function SY(t,e,r){return e=zh(e),AY(t,KT()?Reflect.construct(e,r||[],zh(t).constructor):e.apply(t,r))}function AY(t,e){if(e&&(ya(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OY(t)}function OY(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function KT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KT=function(){return!!t})()}function zh(t){return zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zh(t)}function xY(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E0(t,e)}function E0(t,e){return E0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},E0(t,e)}function qT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ga(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qT(Object(r),!0).forEach(function(n){TY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function TY(t,e,r){return e=GT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GT(t){var e=IY(t,"string");return ya(e)=="symbol"?e:e+""}function IY(t,e){if(ya(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ya(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var HT=Er.defaultOptions=ga(ga({},v0.default.defaultOptions),{},{httpStack:new VT.default,fileReader:new vY.default,urlStorage:new wY.default,fingerprint:EY.default}),jDe=Er.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return _Y(this,e),n=ga(ga({},HT),n),SY(this,e,[r,n])}return xY(e,t),CY(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=ga(ga({},HT),i),v0.default.terminate(n,i)}}])})(v0.default),MDe=Er.isSupported=!0});var JT=_((e0e,YT)=>{var Da=1e3,wa=Da*60,va=wa*60,Ks=va*24,kY=Ks*7,NY=Ks*365.25;YT.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return $Y(t);if(r==="number"&&isFinite(t))return e.long?BY(t):LY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function $Y(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*NY;case"weeks":case"week":case"w":return r*kY;case"days":case"day":case"d":return r*Ks;case"hours":case"hour":case"hrs":case"hr":case"h":return r*va;case"minutes":case"minute":case"mins":case"min":case"m":return r*wa;case"seconds":case"second":case"secs":case"sec":case"s":return r*Da;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function LY(t){var e=Math.abs(t);return e>=Ks?Math.round(t/Ks)+"d":e>=va?Math.round(t/va)+"h":e>=wa?Math.round(t/wa)+"m":e>=Da?Math.round(t/Da)+"s":t+"ms"}function BY(t){var e=Math.abs(t);return e>=Ks?Wh(t,e,Ks,"day"):e>=va?Wh(t,e,va,"hour"):e>=wa?Wh(t,e,wa,"minute"):e>=Da?Wh(t,e,Da,"second"):t+" ms"}function Wh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var _0=_((t0e,ZT)=>{function jY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=JT(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(l){let h,d=null,f,m;function y(...v){if(!y.enabled)return;let E=y,A=Number(new Date),p=A-(h||A);E.diff=p,E.prev=h,E.curr=A,h=A,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let D=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(C,F)=>{if(C==="%%")return"%";D++;let b=r.formatters[F];if(typeof b=="function"){let k=v[D];C=b.call(E,k),v.splice(D,1),D--}return C}),r.formatArgs.call(E,v),(E.log||r.log).apply(E,v)}return y.namespace=l,y.useColors=r.useColors(),y.color=r.selectColor(l),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==r.namespaces&&(f=r.namespaces,m=r.enabled(l)),m),set:v=>{d=v}}),typeof r.init=="function"&&r.init(y),y}function n(l,h){let d=r(this.namespace+(typeof h>"u"?":":h)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let h=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of h)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(l,h){let d=0,f=0,m=-1,y=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(m=f,y=d,f++):(d++,f++);else if(m!==-1)f=m+1,y++,d=y;else return!1;for(;f<h.length&&h[f]==="*";)f++;return f===h.length}function o(){let l=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),l}function a(l){for(let h of r.skips)if(s(l,h))return!1;for(let h of r.names)if(s(l,h))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}ZT.exports=jY});var QT=_((br,Xh)=>{br.formatArgs=UY;br.save=qY;br.load=HY;br.useColors=MY;br.storage=VY();br.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();br.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function MY(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function UY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Xh.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}br.log=console.debug||console.log||(()=>{});function qY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function HY(){let t;try{t=br.storage.getItem("debug")||br.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function VY(){try{return localStorage}catch{}}Xh.exports=_0()(br);var{formatters:zY}=Xh.exports;zY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var t1=_((r0e,e1)=>{"use strict";e1.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var i1=_((n0e,n1)=>{"use strict";var KY=require("os"),r1=require("tty"),Gr=t1(),{env:Nt}=process,Ui;Gr("no-color")||Gr("no-colors")||Gr("color=false")||Gr("color=never")?Ui=0:(Gr("color")||Gr("colors")||Gr("color=true")||Gr("color=always"))&&(Ui=1);"FORCE_COLOR"in Nt&&(Nt.FORCE_COLOR==="true"?Ui=1:Nt.FORCE_COLOR==="false"?Ui=0:Ui=Nt.FORCE_COLOR.length===0?1:Math.min(parseInt(Nt.FORCE_COLOR,10),3));function C0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function S0(t,e){if(Ui===0)return 0;if(Gr("color=16m")||Gr("color=full")||Gr("color=truecolor"))return 3;if(Gr("color=256"))return 2;if(t&&!e&&Ui===void 0)return 0;let r=Ui||0;if(Nt.TERM==="dumb")return r;if(process.platform==="win32"){let n=KY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Nt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Nt)||Nt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Nt.TEAMCITY_VERSION)?1:0;if(Nt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Nt){let n=parseInt((Nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Nt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Nt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Nt.TERM)||"COLORTERM"in Nt?1:r}function GY(t){let e=S0(t,t&&t.isTTY);return C0(e)}n1.exports={supportsColor:GY,stdout:C0(S0(!0,r1.isatty(1))),stderr:C0(S0(!0,r1.isatty(2)))}});var o1=_(($t,Jh)=>{var WY=require("tty"),Yh=require("util");$t.init=tJ;$t.log=ZY;$t.formatArgs=YY;$t.save=QY;$t.load=eJ;$t.useColors=XY;$t.destroy=Yh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");$t.colors=[6,2,3,4,5,1];try{let t=i1();t&&(t.stderr||t).level>=2&&($t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}$t.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function XY(){return"colors"in $t.inspectOpts?!!$t.inspectOpts.colors:WY.isatty(process.stderr.fd)}function YY(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
60
+ GFS4: `),console.error(t)});pt[Ht]||(hT=global[Ht]||[],pT(pt,hT),pt.close=(function(t){function e(r,n){return t.call(pt,r,function(i){i||dT(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,$h,{value:t}),e})(pt.close),pt.closeSync=(function(t){function e(r){t.apply(pt,arguments),dT()}return Object.defineProperty(e,$h,{value:t}),e})(pt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Us(pt[Ht]),require("assert").equal(pt[Ht].length,0)}));var hT;global[Ht]||pT(global,pt[Ht]);f0.exports=c0(HX(pt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!pt.__patched&&(f0.exports=c0(pt),pt.__patched=!0);function c0(t){UX(t),t.gracefulify=c0,t.createReadStream=w,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(k,R,I){return typeof R=="function"&&(I=R,R=null),B(k,R,I);function B(j,z,L,S){return e(j,z,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?la([B,[j,z,L],T,S||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return n(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return s(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(k,R,I,B){return typeof I=="function"&&(B=I,I=0),j(k,R,I,B);function j(z,L,S,T,P){return a(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var c=t.readdir;t.readdir=h;var l=/^v[0-5]\./;function h(k,R,I){typeof R=="function"&&(I=R,R=null);var B=l.test(process.version)?function(L,S,T,P){return c(L,j(L,S,T,P))}:function(L,S,T,P){return c(L,S,j(L,S,T,P))};return B(k,R,I);function j(z,L,S,T){return function(P,$){P&&(P.code==="EMFILE"||P.code==="ENFILE")?la([B,[z,L,S],P,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof S=="function"&&S.call(this,P,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=qX(t);E=d.ReadStream,p=d.WriteStream}var f=t.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.prototype.open=A);var m=t.WriteStream;m&&(p.prototype=Object.create(m.prototype),p.prototype.open=D),Object.defineProperty(t,"ReadStream",{get:function(){return E},set:function(k){E=k},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(k){p=k},enumerable:!0,configurable:!0});var y=E;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(k){y=k},enumerable:!0,configurable:!0});var v=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return v},set:function(k){v=k},enumerable:!0,configurable:!0});function E(k,R){return this instanceof E?(f.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function A(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.autoClose&&k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I),k.read())})}function p(k,R){return this instanceof p?(m.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function D(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I))})}function w(k,R){return new t.ReadStream(k,R)}function C(k,R){return new t.WriteStream(k,R)}var F=t.open;t.open=b;function b(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return F(z,L,S,function($,q){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function la(t){Us("ENQUEUE",t[0].name,t[1]),pt[Ht].push(t),l0()}var Nh;function dT(){for(var t=Date.now(),e=0;e<pt[Ht].length;++e)pt[Ht][e].length>2&&(pt[Ht][e][3]=t,pt[Ht][e][4]=t);l0()}function l0(){if(clearTimeout(Nh),Nh=void 0,pt[Ht].length!==0){var t=pt[Ht].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)Us("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Us("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,u=Math.max(s-i,1),c=Math.min(u*1.2,100);a>=c?(Us("RETRY",e.name,r),e.apply(null,r.concat([i]))):pt[Ht].push(t)}Nh===void 0&&(Nh=setTimeout(l0,0))}}});var gT=_((ODe,mT)=>{function Kr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}mT.exports=Kr;Kr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Kr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Kr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,i=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&i.unref(),!0};Kr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Kr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Kr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Kr.prototype.start=Kr.prototype.try;Kr.prototype.errors=function(){return this._errors};Kr.prototype.attempts=function(){return this._attempts};Kr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],s=i.message,o=(t[s]||0)+1;t[s]=o,o>=r&&(e=i,r=o)}return e}});var yT=_(qs=>{var zX=gT();qs.operation=function(t){var e=qs.timeouts(t);return new zX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};qs.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<e.retries;i++)n.push(this.createTimeout(i,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(i,e)),n.sort(function(s,o){return s-o}),n};qs.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};qs.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var i=0;i<r.length;i++){var s=r[i],o=t[s];t[s]=function(u){var c=qs.operation(e),l=Array.prototype.slice.call(arguments,1),h=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),h.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,o),t[s].options=e}}});var wT=_((TDe,DT)=>{DT.exports=yT()});var vT=_((IDe,Lh)=>{Lh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Lh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Lh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Uh=_((PDe,da)=>{var at=global.process,Hs=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};Hs(at)?(ET=require("assert"),fa=vT(),bT=/^win/i.test(at.platform),cc=require("events"),typeof cc!="function"&&(cc=cc.EventEmitter),at.__signal_exit_emitter__?kt=at.__signal_exit_emitter__:(kt=at.__signal_exit_emitter__=new cc,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),da.exports=function(t,e){if(!Hs(global.process))return function(){};ET.equal(typeof t,"function","a callback must be provided for exit handler"),ha===!1&&h0();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){kt.removeListener(r,t),kt.listeners("exit").length===0&&kt.listeners("afterexit").length===0&&Bh()};return kt.on(r,t),n},Bh=function(){!ha||!Hs(global.process)||(ha=!1,fa.forEach(function(e){try{at.removeListener(e,jh[e])}catch{}}),at.emit=Mh,at.reallyExit=d0,kt.count-=1)},da.exports.unload=Bh,Vs=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},jh={},fa.forEach(function(t){jh[t]=function(){if(Hs(global.process)){var r=at.listeners(t);r.length===kt.count&&(Bh(),Vs("exit",null,t),Vs("afterexit",null,t),bT&&t==="SIGHUP"&&(t="SIGINT"),at.kill(at.pid,t))}}}),da.exports.signals=function(){return fa},ha=!1,h0=function(){ha||!Hs(global.process)||(ha=!0,kt.count+=1,fa=fa.filter(function(e){try{return at.on(e,jh[e]),!0}catch{return!1}}),at.emit=CT,at.reallyExit=_T)},da.exports.load=h0,d0=at.reallyExit,_T=function(e){Hs(global.process)&&(at.exitCode=e||0,Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),d0.call(at,at.exitCode))},Mh=at.emit,CT=function(e,r){if(e==="exit"&&Hs(global.process)){r!==void 0&&(at.exitCode=r);var n=Mh.apply(this,arguments);return Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),n}else return Mh.apply(this,arguments)}):da.exports=function(){return function(){}};var ET,fa,bT,cc,kt,Bh,Vs,jh,ha,h0,d0,_T,Mh,CT});var AT=_((FDe,p0)=>{"use strict";var ST=Symbol();function KX(t,e,r){let n=e[ST];if(n)return e.stat(t,(s,o)=>{if(s)return r(s);r(null,o.mtime,n)});let i=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,i,i,s=>{if(s)return r(s);e.stat(t,(o,a)=>{if(o)return r(o);let u=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,ST,{value:u}),r(null,a.mtime,u)})})}function GX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}p0.exports.probe=KX;p0.exports.getMtime=GX});var PT=_((RDe,fc)=>{"use strict";var WX=require("path"),y0=vt(),XX=wT(),YX=Uh(),OT=AT(),ri={};function lc(t,e){return e.lockfilePath||`${t}.lock`}function D0(t,e,r){if(!e.realpath)return r(null,WX.resolve(t));e.fs.realpath(t,r)}function g0(t,e,r){let n=lc(t,e);e.fs.mkdir(n,i=>{if(!i)return OT.probe(n,e.fs,(s,o,a)=>{if(s)return e.fs.rmdir(n,()=>{}),r(s);r(null,o,a)});if(i.code!=="EEXIST")return r(i);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(s,o)=>{if(s)return s.code==="ENOENT"?g0(t,{...e,stale:0},r):r(s);if(!xT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));TT(t,e,a=>{if(a)return r(a);g0(t,{...e,stale:0},r)})})})}function xT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function TT(t,e,r){e.fs.rmdir(lc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function qh(t,e){let r=ri[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,i)=>{let s=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||s?m0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return m0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=OT.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?m0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,qh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function m0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),ri[t]===e&&delete ri[t],e.options.onCompromised(r)}function JX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:y0,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),D0(t,e,(n,i)=>{if(n)return r(n);let s=XX.operation(e.retries);s.attempt(()=>{g0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=ri[i]={lockfilePath:lc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};qh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));IT(i,{...e,realpath:!1},l)})})})})}function IT(t,e,r){e={fs:y0,realpath:!0,...e},D0(t,e,(n,i)=>{if(n)return r(n);let s=ri[i];if(!s)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));s.updateTimeout&&clearTimeout(s.updateTimeout),s.released=!0,delete ri[i],TT(i,e,r)})}function ZX(t,e,r){e={stale:1e4,realpath:!0,fs:y0,...e},e.stale=Math.max(e.stale||0,2e3),D0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(lc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!xT(o,e)))})}function QX(){return ri}YX(()=>{for(let t in ri){let e=ri[t].options;try{e.fs.rmdirSync(lc(t,e))}catch{}}});fc.exports.lock=JX;fc.exports.unlock=IT;fc.exports.check=ZX;fc.exports.getLocks=QX});var RT=_((kDe,FT)=>{"use strict";var eY=vt();function tY(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...i)=>{let s=i.pop(),o;try{o=t[`${n}Sync`](...i)}catch(a){return s(a)}s(null,o)}}),r}function rY(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function nY(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function iY(t){if(t={...t},t.fs=tY(t.fs||eY),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}FT.exports={toPromise:rY,toSync:nY,toSyncOptions:iY}});var NT=_((NDe,ji)=>{"use strict";var pa=PT(),{toPromise:Hh,toSync:Vh,toSyncOptions:w0}=RT();async function kT(t,e){let r=await Hh(pa.lock)(t,e);return Hh(r)}function sY(t,e){let r=Vh(pa.lock)(t,w0(e));return Vh(r)}function oY(t,e){return Hh(pa.unlock)(t,e)}function aY(t,e){return Vh(pa.unlock)(t,w0(e))}function uY(t,e){return Hh(pa.check)(t,e)}function cY(t,e){return Vh(pa.check)(t,w0(e))}ji.exports=kT;ji.exports.lock=kT;ji.exports.unlock=oY;ji.exports.lockSync=sY;ji.exports.unlockSync=aY;ji.exports.check=uY;ji.exports.checkSync=cY});var MT=_(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.canStoreURLs=ma.FileUrlStorage=void 0;var $T=require("fs"),lY=hY(iT()),LT=fY(NT());function jT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(jT=function(n){return n?r:e})(t)}function fY(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=jT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function hY(t){return t&&t.__esModule?t:{default:t}}function hc(t){"@babel/helpers - typeof";return hc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hc(t)}function dY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mY(n.key),n)}}function pY(t,e,r){return e&&BT(t.prototype,e),r&&BT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function mY(t){var e=gY(t,"string");return hc(e)=="symbol"?e:e+""}function gY(t,e){if(hc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $De=ma.canStoreURLs=!0,LDe=ma.FileUrlStorage=(function(){function t(e){dY(this,t),this.path=e}return pY(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,i){r._getItems("tus::",function(s,o){s?i(s):n(o)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(i,s){n._getItems("tus::".concat(r),function(o,a){o?s(o):i(a)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(i,s){n._removeItem(r,function(o){o?s(o):i()})})}},{key:"addUpload",value:function(r,n){var i=this,s=Math.round(Math.random()*1e12),o="tus::".concat(r,"::").concat(s);return new Promise(function(a,u){i._setItem(o,n,function(c){c?u(c):a(o)})})}},{key:"_setItem",value:function(r,n,i){var s=this;LT.lock(this.path,this._lockfileOptions()).then(function(o){i=s._releaseAndCb(o,i),s._getData(function(a,u){if(a){i(a);return}u[r]=n,s._writeData(u,function(c){return i(c)})})}).catch(i)}},{key:"_getItems",value:function(r,n){this._getData(function(i,s){if(i){n(i);return}var o=Object.keys(s).filter(function(a){return a.startsWith(r)}).map(function(a){var u=s[a];return u.urlStorageKey=a,u});n(null,o)})}},{key:"_removeItem",value:function(r,n){var i=this;LT.lock(this.path,this._lockfileOptions()).then(function(s){n=i._releaseAndCb(s,n),i._getData(function(o,a){if(o){n(o);return}delete a[r],i._writeData(a,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(i){if(i){r().then(function(){return n(i)}).catch(function(s){return n((0,lY.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,$T.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,$T.readFile)(this.path,"utf8",function(n,i){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{i=i.trim().length?JSON.parse(i):{}}catch(s){r(s);return}r(null,i)})}}])})()});var Kh=_(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Object.defineProperty(Er,"DefaultHttpStack",{enumerable:!0,get:function(){return VT.default}});Object.defineProperty(Er,"DetailedError",{enumerable:!0,get:function(){return yY.default}});Object.defineProperty(Er,"FileUrlStorage",{enumerable:!0,get:function(){return zT.FileUrlStorage}});Object.defineProperty(Er,"StreamSource",{enumerable:!0,get:function(){return bY.default}});Er.Upload=void 0;Object.defineProperty(Er,"canStoreURLs",{enumerable:!0,get:function(){return zT.canStoreURLs}});Er.defaultOptions=void 0;Object.defineProperty(Er,"enableDebugLog",{enumerable:!0,get:function(){return DY.enableDebugLog}});Er.isSupported=void 0;var yY=zs(gD()),DY=yD(),wY=zs(MA()),v0=zs(gO()),vY=zs(TO()),EY=zs(RO()),VT=zs(GO()),bY=zs(PD()),zT=MT();function zs(t){return t&&t.__esModule?t:{default:t}}function ya(t){"@babel/helpers - typeof";return ya=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ya(t)}function _Y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function UT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,GT(n.key),n)}}function CY(t,e,r){return e&&UT(t.prototype,e),r&&UT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function SY(t,e,r){return e=zh(e),AY(t,KT()?Reflect.construct(e,r||[],zh(t).constructor):e.apply(t,r))}function AY(t,e){if(e&&(ya(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OY(t)}function OY(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function KT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KT=function(){return!!t})()}function zh(t){return zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zh(t)}function xY(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E0(t,e)}function E0(t,e){return E0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},E0(t,e)}function qT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ga(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qT(Object(r),!0).forEach(function(n){TY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function TY(t,e,r){return e=GT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GT(t){var e=IY(t,"string");return ya(e)=="symbol"?e:e+""}function IY(t,e){if(ya(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ya(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var HT=Er.defaultOptions=ga(ga({},v0.default.defaultOptions),{},{httpStack:new VT.default,fileReader:new vY.default,urlStorage:new wY.default,fingerprint:EY.default}),jDe=Er.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return _Y(this,e),n=ga(ga({},HT),n),SY(this,e,[r,n])}return xY(e,t),CY(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=ga(ga({},HT),i),v0.default.terminate(n,i)}}])})(v0.default),MDe=Er.isSupported=!0});var JT=_((e0e,YT)=>{var Da=1e3,wa=Da*60,va=wa*60,Ks=va*24,kY=Ks*7,NY=Ks*365.25;YT.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return $Y(t);if(r==="number"&&isFinite(t))return e.long?BY(t):LY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function $Y(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*NY;case"weeks":case"week":case"w":return r*kY;case"days":case"day":case"d":return r*Ks;case"hours":case"hour":case"hrs":case"hr":case"h":return r*va;case"minutes":case"minute":case"mins":case"min":case"m":return r*wa;case"seconds":case"second":case"secs":case"sec":case"s":return r*Da;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function LY(t){var e=Math.abs(t);return e>=Ks?Math.round(t/Ks)+"d":e>=va?Math.round(t/va)+"h":e>=wa?Math.round(t/wa)+"m":e>=Da?Math.round(t/Da)+"s":t+"ms"}function BY(t){var e=Math.abs(t);return e>=Ks?Wh(t,e,Ks,"day"):e>=va?Wh(t,e,va,"hour"):e>=wa?Wh(t,e,wa,"minute"):e>=Da?Wh(t,e,Da,"second"):t+" ms"}function Wh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var _0=_((t0e,ZT)=>{function jY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=JT(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(l){let h,d=null,f,m;function y(...v){if(!y.enabled)return;let E=y,A=Number(new Date),p=A-(h||A);E.diff=p,E.prev=h,E.curr=A,h=A,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let D=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(C,F)=>{if(C==="%%")return"%";D++;let b=r.formatters[F];if(typeof b=="function"){let k=v[D];C=b.call(E,k),v.splice(D,1),D--}return C}),r.formatArgs.call(E,v),(E.log||r.log).apply(E,v)}return y.namespace=l,y.useColors=r.useColors(),y.color=r.selectColor(l),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==r.namespaces&&(f=r.namespaces,m=r.enabled(l)),m),set:v=>{d=v}}),typeof r.init=="function"&&r.init(y),y}function n(l,h){let d=r(this.namespace+(typeof h>"u"?":":h)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let h=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of h)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(l,h){let d=0,f=0,m=-1,y=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(m=f,y=d,f++):(d++,f++);else if(m!==-1)f=m+1,y++,d=y;else return!1;for(;f<h.length&&h[f]==="*";)f++;return f===h.length}function o(){let l=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),l}function a(l){for(let h of r.skips)if(s(l,h))return!1;for(let h of r.names)if(s(l,h))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}ZT.exports=jY});var QT=_((br,Xh)=>{br.formatArgs=UY;br.save=qY;br.load=HY;br.useColors=MY;br.storage=VY();br.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();br.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function MY(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function UY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Xh.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}br.log=console.debug||console.log||(()=>{});function qY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function HY(){let t;try{t=br.storage.getItem("debug")||br.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function VY(){try{return localStorage}catch{}}Xh.exports=_0()(br);var{formatters:zY}=Xh.exports;zY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var t1=_((r0e,e1)=>{"use strict";e1.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var i1=_((n0e,n1)=>{"use strict";var KY=require("os"),r1=require("tty"),Gr=t1(),{env:Nt}=process,Ui;Gr("no-color")||Gr("no-colors")||Gr("color=false")||Gr("color=never")?Ui=0:(Gr("color")||Gr("colors")||Gr("color=true")||Gr("color=always"))&&(Ui=1);"FORCE_COLOR"in Nt&&(Nt.FORCE_COLOR==="true"?Ui=1:Nt.FORCE_COLOR==="false"?Ui=0:Ui=Nt.FORCE_COLOR.length===0?1:Math.min(parseInt(Nt.FORCE_COLOR,10),3));function C0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function S0(t,e){if(Ui===0)return 0;if(Gr("color=16m")||Gr("color=full")||Gr("color=truecolor"))return 3;if(Gr("color=256"))return 2;if(t&&!e&&Ui===void 0)return 0;let r=Ui||0;if(Nt.TERM==="dumb")return r;if(process.platform==="win32"){let n=KY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Nt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Nt)||Nt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Nt.TEAMCITY_VERSION)?1:0;if(Nt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Nt){let n=parseInt((Nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Nt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Nt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Nt.TERM)||"COLORTERM"in Nt?1:r}function GY(t){let e=S0(t,t&&t.isTTY);return C0(e)}n1.exports={supportsColor:GY,stdout:C0(S0(!0,r1.isatty(1))),stderr:C0(S0(!0,r1.isatty(2)))}});var o1=_(($t,Jh)=>{var WY=require("tty"),Yh=require("util");$t.init=tJ;$t.log=ZY;$t.formatArgs=YY;$t.save=QY;$t.load=eJ;$t.useColors=XY;$t.destroy=Yh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");$t.colors=[6,2,3,4,5,1];try{let t=i1();t&&(t.stderr||t).level>=2&&($t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}$t.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function XY(){return"colors"in $t.inspectOpts?!!$t.inspectOpts.colors:WY.isatty(process.stderr.fd)}function YY(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
61
61
  `).join(`
62
62
  `+s),t.push(i+"m+"+Jh.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=JY()+e+" "+t[0]}function JY(){return $t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function ZY(...t){return process.stderr.write(Yh.formatWithOptions($t.inspectOpts,...t)+`
63
63
  `)}function QY(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function eJ(){return process.env.DEBUG}function tJ(t){t.inspectOpts={};let e=Object.keys($t.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=$t.inspectOpts[e[r]]}Jh.exports=_0()($t);var{formatters:s1}=Jh.exports;s1.o=function(t){return this.inspectOpts.colors=this.useColors,Yh.inspect(t,this.inspectOpts).split(`
64
- `).map(e=>e.trim()).join(" ")};s1.O=function(t){return this.inspectOpts.colors=this.useColors,Yh.inspect(t,this.inspectOpts)}});var Zh=_((i0e,A0)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?A0.exports=QT():A0.exports=o1()});var Fe=_(O0=>{"use strict";O0.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((i,s)=>i!=null?n(i):r(s)),t.apply(this,e)})},"name",{value:t.name})};O0.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var sr=_(ni=>{"use strict";var a1=Fe().fromCallback,ir=vt(),rJ=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ir[t]=="function");Object.assign(ni,ir);rJ.forEach(t=>{ni[t]=a1(ir[t])});ni.exists=function(t,e){return typeof e=="function"?ir.exists(t,e):new Promise(r=>ir.exists(t,r))};ni.read=function(t,e,r,n,i,s){return typeof s=="function"?ir.read(t,e,r,n,i,s):new Promise((o,a)=>{ir.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};ni.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.write(t,e,...r):new Promise((n,i)=>{ir.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};ni.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.readv(t,e,...r):new Promise((n,i)=>{ir.readv(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesRead:o,buffers:a})})})};ni.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.writev(t,e,...r):new Promise((n,i)=>{ir.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})};typeof ir.realpath.native=="function"?ni.realpath.native=a1(ir.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var c1=_((a0e,u1)=>{"use strict";var nJ=require("path");u1.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(nJ.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var d1=_((u0e,x0)=>{"use strict";var l1=sr(),{checkPath:f1}=c1(),h1=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};x0.exports.makeDir=async(t,e)=>(f1(t),l1.mkdir(t,{mode:h1(e),recursive:!0}));x0.exports.makeDirSync=(t,e)=>(f1(t),l1.mkdirSync(t,{mode:h1(e),recursive:!0}))});var cn=_((c0e,p1)=>{"use strict";var iJ=Fe().fromPromise,{makeDir:sJ,makeDirSync:T0}=d1(),I0=iJ(sJ);p1.exports={mkdirs:I0,mkdirsSync:T0,mkdirp:I0,mkdirpSync:T0,ensureDir:I0,ensureDirSync:T0}});var qi=_((l0e,g1)=>{"use strict";var oJ=Fe().fromPromise,m1=sr();function aJ(t){return m1.access(t).then(()=>!0).catch(()=>!1)}g1.exports={pathExists:oJ(aJ),pathExistsSync:m1.existsSync}});var P0=_((f0e,y1)=>{"use strict";var Ea=sr(),uJ=Fe().fromPromise;async function cJ(t,e,r){let n=await Ea.open(t,"r+"),i=null;try{await Ea.futimes(n,e,r)}finally{try{await Ea.close(n)}catch(s){i=s}}if(i)throw i}function lJ(t,e,r){let n=Ea.openSync(t,"r+");return Ea.futimesSync(n,e,r),Ea.closeSync(n)}y1.exports={utimesMillis:uJ(cJ),utimesMillisSync:lJ}});var Gs=_((h0e,E1)=>{"use strict";var ba=sr(),Lt=require("path"),D1=Fe().fromPromise;function fJ(t,e,r){let n=r.dereference?i=>ba.stat(i,{bigint:!0}):i=>ba.lstat(i,{bigint:!0});return Promise.all([n(t),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}function hJ(t,e,r){let n,i=r.dereference?o=>ba.statSync(o,{bigint:!0}):o=>ba.lstatSync(o,{bigint:!0}),s=i(t);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}async function dJ(t,e,r,n){let{srcStat:i,destStat:s}=await fJ(t,e,n);if(s){if(dc(i,s)){let o=Lt.basename(t),a=Lt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&F0(t,e))throw new Error(Qh(t,e,r));return{srcStat:i,destStat:s}}function pJ(t,e,r,n){let{srcStat:i,destStat:s}=hJ(t,e,n);if(s){if(dc(i,s)){let o=Lt.basename(t),a=Lt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&F0(t,e))throw new Error(Qh(t,e,r));return{srcStat:i,destStat:s}}async function w1(t,e,r,n){let i=Lt.resolve(Lt.dirname(t)),s=Lt.resolve(Lt.dirname(r));if(s===i||s===Lt.parse(s).root)return;let o;try{o=await ba.stat(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(dc(e,o))throw new Error(Qh(t,r,n));return w1(t,e,s,n)}function v1(t,e,r,n){let i=Lt.resolve(Lt.dirname(t)),s=Lt.resolve(Lt.dirname(r));if(s===i||s===Lt.parse(s).root)return;let o;try{o=ba.statSync(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(dc(e,o))throw new Error(Qh(t,r,n));return v1(t,e,s,n)}function dc(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function F0(t,e){let r=Lt.resolve(t).split(Lt.sep).filter(i=>i),n=Lt.resolve(e).split(Lt.sep).filter(i=>i);return r.every((i,s)=>n[s]===i)}function Qh(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}E1.exports={checkPaths:D1(dJ),checkPathsSync:pJ,checkParentPaths:D1(w1),checkParentPathsSync:v1,isSrcSubdir:F0,areIdentical:dc}});var _1=_((d0e,b1)=>{"use strict";async function mJ(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(r.map(n=>n.then(i=>{if(i!==null)throw i})))}b1.exports={asyncIteratorConcurrentProcess:mJ}});var x1=_((p0e,O1)=>{"use strict";var Gt=sr(),pc=require("path"),{mkdirs:gJ}=cn(),{pathExists:yJ}=qi(),{utimesMillis:DJ}=P0(),mc=Gs(),{asyncIteratorConcurrentProcess:wJ}=_1();async function vJ(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
64
+ `).map(e=>e.trim()).join(" ")};s1.O=function(t){return this.inspectOpts.colors=this.useColors,Yh.inspect(t,this.inspectOpts)}});var Zh=_((i0e,A0)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?A0.exports=QT():A0.exports=o1()});var Fe=_(O0=>{"use strict";O0.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((i,s)=>i!=null?n(i):r(s)),t.apply(this,e)})},"name",{value:t.name})};O0.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var sr=_(ii=>{"use strict";var a1=Fe().fromCallback,ir=vt(),rJ=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ir[t]=="function");Object.assign(ii,ir);rJ.forEach(t=>{ii[t]=a1(ir[t])});ii.exists=function(t,e){return typeof e=="function"?ir.exists(t,e):new Promise(r=>ir.exists(t,r))};ii.read=function(t,e,r,n,i,s){return typeof s=="function"?ir.read(t,e,r,n,i,s):new Promise((o,a)=>{ir.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};ii.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.write(t,e,...r):new Promise((n,i)=>{ir.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};ii.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.readv(t,e,...r):new Promise((n,i)=>{ir.readv(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesRead:o,buffers:a})})})};ii.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.writev(t,e,...r):new Promise((n,i)=>{ir.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})};typeof ir.realpath.native=="function"?ii.realpath.native=a1(ir.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var c1=_((a0e,u1)=>{"use strict";var nJ=require("path");u1.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(nJ.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var d1=_((u0e,x0)=>{"use strict";var l1=sr(),{checkPath:f1}=c1(),h1=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};x0.exports.makeDir=async(t,e)=>(f1(t),l1.mkdir(t,{mode:h1(e),recursive:!0}));x0.exports.makeDirSync=(t,e)=>(f1(t),l1.mkdirSync(t,{mode:h1(e),recursive:!0}))});var fn=_((c0e,p1)=>{"use strict";var iJ=Fe().fromPromise,{makeDir:sJ,makeDirSync:T0}=d1(),I0=iJ(sJ);p1.exports={mkdirs:I0,mkdirsSync:T0,mkdirp:I0,mkdirpSync:T0,ensureDir:I0,ensureDirSync:T0}});var qi=_((l0e,g1)=>{"use strict";var oJ=Fe().fromPromise,m1=sr();function aJ(t){return m1.access(t).then(()=>!0).catch(()=>!1)}g1.exports={pathExists:oJ(aJ),pathExistsSync:m1.existsSync}});var P0=_((f0e,y1)=>{"use strict";var Ea=sr(),uJ=Fe().fromPromise;async function cJ(t,e,r){let n=await Ea.open(t,"r+"),i=null;try{await Ea.futimes(n,e,r)}finally{try{await Ea.close(n)}catch(s){i=s}}if(i)throw i}function lJ(t,e,r){let n=Ea.openSync(t,"r+");return Ea.futimesSync(n,e,r),Ea.closeSync(n)}y1.exports={utimesMillis:uJ(cJ),utimesMillisSync:lJ}});var Gs=_((h0e,E1)=>{"use strict";var ba=sr(),Lt=require("path"),D1=Fe().fromPromise;function fJ(t,e,r){let n=r.dereference?i=>ba.stat(i,{bigint:!0}):i=>ba.lstat(i,{bigint:!0});return Promise.all([n(t),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}function hJ(t,e,r){let n,i=r.dereference?o=>ba.statSync(o,{bigint:!0}):o=>ba.lstatSync(o,{bigint:!0}),s=i(t);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}async function dJ(t,e,r,n){let{srcStat:i,destStat:s}=await fJ(t,e,n);if(s){if(dc(i,s)){let o=Lt.basename(t),a=Lt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&F0(t,e))throw new Error(Qh(t,e,r));return{srcStat:i,destStat:s}}function pJ(t,e,r,n){let{srcStat:i,destStat:s}=hJ(t,e,n);if(s){if(dc(i,s)){let o=Lt.basename(t),a=Lt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&F0(t,e))throw new Error(Qh(t,e,r));return{srcStat:i,destStat:s}}async function w1(t,e,r,n){let i=Lt.resolve(Lt.dirname(t)),s=Lt.resolve(Lt.dirname(r));if(s===i||s===Lt.parse(s).root)return;let o;try{o=await ba.stat(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(dc(e,o))throw new Error(Qh(t,r,n));return w1(t,e,s,n)}function v1(t,e,r,n){let i=Lt.resolve(Lt.dirname(t)),s=Lt.resolve(Lt.dirname(r));if(s===i||s===Lt.parse(s).root)return;let o;try{o=ba.statSync(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(dc(e,o))throw new Error(Qh(t,r,n));return v1(t,e,s,n)}function dc(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function F0(t,e){let r=Lt.resolve(t).split(Lt.sep).filter(i=>i),n=Lt.resolve(e).split(Lt.sep).filter(i=>i);return r.every((i,s)=>n[s]===i)}function Qh(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}E1.exports={checkPaths:D1(dJ),checkPathsSync:pJ,checkParentPaths:D1(w1),checkParentPathsSync:v1,isSrcSubdir:F0,areIdentical:dc}});var _1=_((d0e,b1)=>{"use strict";async function mJ(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(r.map(n=>n.then(i=>{if(i!==null)throw i})))}b1.exports={asyncIteratorConcurrentProcess:mJ}});var x1=_((p0e,O1)=>{"use strict";var Gt=sr(),pc=require("path"),{mkdirs:gJ}=fn(),{pathExists:yJ}=qi(),{utimesMillis:DJ}=P0(),mc=Gs(),{asyncIteratorConcurrentProcess:wJ}=_1();async function vJ(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
65
65
 
66
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await mc.checkPaths(t,e,"copy",r);if(await mc.checkParentPaths(t,n,e,"copy"),!await S1(t,e,r))return;let o=pc.dirname(e);await yJ(o)||await gJ(o),await A1(i,t,e,r)}async function S1(t,e,r){return r.filter?r.filter(t,e):!0}async function A1(t,e,r,n){let s=await(n.dereference?Gt.stat:Gt.lstat)(e);if(s.isDirectory())return CJ(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return EJ(s,t,e,r,n);if(s.isSymbolicLink())return SJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function EJ(t,e,r,n,i){if(!e)return C1(t,r,n,i);if(i.overwrite)return await Gt.unlink(n),C1(t,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}async function C1(t,e,r,n){if(await Gt.copyFile(e,r),n.preserveTimestamps){bJ(t.mode)&&await _J(r,t.mode);let i=await Gt.stat(e);await DJ(r,i.atime,i.mtime)}return Gt.chmod(r,t.mode)}function bJ(t){return(t&128)===0}function _J(t,e){return Gt.chmod(t,e|128)}async function CJ(t,e,r,n,i){e||await Gt.mkdir(n),await wJ(await Gt.opendir(r),async s=>{let o=pc.join(r,s.name),a=pc.join(n,s.name);if(await S1(o,a,i)){let{destStat:c}=await mc.checkPaths(o,a,"copy",i);await A1(c,o,a,i)}}),e||await Gt.chmod(n,t.mode)}async function SJ(t,e,r,n){let i=await Gt.readlink(e);if(n.dereference&&(i=pc.resolve(process.cwd(),i)),!t)return Gt.symlink(i,r);let s=null;try{s=await Gt.readlink(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Gt.symlink(i,r);throw o}if(n.dereference&&(s=pc.resolve(process.cwd(),s)),mc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(mc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Gt.unlink(r),Gt.symlink(i,r)}O1.exports=vJ});var R1=_((m0e,F1)=>{"use strict";var or=vt(),gc=require("path"),AJ=cn().mkdirsSync,OJ=P0().utimesMillisSync,yc=Gs();function xJ(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
66
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await mc.checkPaths(t,e,"copy",r);if(await mc.checkParentPaths(t,n,e,"copy"),!await S1(t,e,r))return;let o=pc.dirname(e);await yJ(o)||await gJ(o),await A1(i,t,e,r)}async function S1(t,e,r){return r.filter?r.filter(t,e):!0}async function A1(t,e,r,n){let s=await(n.dereference?Gt.stat:Gt.lstat)(e);if(s.isDirectory())return CJ(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return EJ(s,t,e,r,n);if(s.isSymbolicLink())return SJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function EJ(t,e,r,n,i){if(!e)return C1(t,r,n,i);if(i.overwrite)return await Gt.unlink(n),C1(t,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}async function C1(t,e,r,n){if(await Gt.copyFile(e,r),n.preserveTimestamps){bJ(t.mode)&&await _J(r,t.mode);let i=await Gt.stat(e);await DJ(r,i.atime,i.mtime)}return Gt.chmod(r,t.mode)}function bJ(t){return(t&128)===0}function _J(t,e){return Gt.chmod(t,e|128)}async function CJ(t,e,r,n,i){e||await Gt.mkdir(n),await wJ(await Gt.opendir(r),async s=>{let o=pc.join(r,s.name),a=pc.join(n,s.name);if(await S1(o,a,i)){let{destStat:c}=await mc.checkPaths(o,a,"copy",i);await A1(c,o,a,i)}}),e||await Gt.chmod(n,t.mode)}async function SJ(t,e,r,n){let i=await Gt.readlink(e);if(n.dereference&&(i=pc.resolve(process.cwd(),i)),!t)return Gt.symlink(i,r);let s=null;try{s=await Gt.readlink(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Gt.symlink(i,r);throw o}if(n.dereference&&(s=pc.resolve(process.cwd(),s)),mc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(mc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Gt.unlink(r),Gt.symlink(i,r)}O1.exports=vJ});var R1=_((m0e,F1)=>{"use strict";var or=vt(),gc=require("path"),AJ=fn().mkdirsSync,OJ=P0().utimesMillisSync,yc=Gs();function xJ(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
67
67
 
68
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=yc.checkPathsSync(t,e,"copy",r);if(yc.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let s=gc.dirname(e);return or.existsSync(s)||AJ(s),T1(i,t,e,r)}function T1(t,e,r,n){let s=(n.dereference?or.statSync:or.lstatSync)(e);if(s.isDirectory())return NJ(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return TJ(s,t,e,r,n);if(s.isSymbolicLink())return BJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function TJ(t,e,r,n,i){return e?IJ(t,r,n,i):I1(t,r,n,i)}function IJ(t,e,r,n){if(n.overwrite)return or.unlinkSync(r),I1(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function I1(t,e,r,n){return or.copyFileSync(e,r),n.preserveTimestamps&&PJ(t.mode,e,r),R0(r,t.mode)}function PJ(t,e,r){return FJ(t)&&RJ(r,t),kJ(e,r)}function FJ(t){return(t&128)===0}function RJ(t,e){return R0(t,e|128)}function R0(t,e){return or.chmodSync(t,e)}function kJ(t,e){let r=or.statSync(t);return OJ(e,r.atime,r.mtime)}function NJ(t,e,r,n,i){return e?P1(r,n,i):$J(t.mode,r,n,i)}function $J(t,e,r,n){return or.mkdirSync(r),P1(e,r,n),R0(r,t)}function P1(t,e,r){let n=or.opendirSync(t);try{let i;for(;(i=n.readSync())!==null;)LJ(i.name,t,e,r)}finally{n.closeSync()}}function LJ(t,e,r,n){let i=gc.join(e,t),s=gc.join(r,t);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=yc.checkPathsSync(i,s,"copy",n);return T1(o,i,s,n)}function BJ(t,e,r,n){let i=or.readlinkSync(e);if(n.dereference&&(i=gc.resolve(process.cwd(),i)),t){let s;try{s=or.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return or.symlinkSync(i,r);throw o}if(n.dereference&&(s=gc.resolve(process.cwd(),s)),yc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(yc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return jJ(i,r)}else return or.symlinkSync(i,r)}function jJ(t,e){return or.unlinkSync(e),or.symlinkSync(t,e)}F1.exports=xJ});var ed=_((g0e,k1)=>{"use strict";var MJ=Fe().fromPromise;k1.exports={copy:MJ(x1()),copySync:R1()}});var Dc=_((y0e,$1)=>{"use strict";var N1=vt(),UJ=Fe().fromCallback;function qJ(t,e){N1.rm(t,{recursive:!0,force:!0},e)}function HJ(t){N1.rmSync(t,{recursive:!0,force:!0})}$1.exports={remove:UJ(qJ),removeSync:HJ}});var V1=_((D0e,H1)=>{"use strict";var VJ=Fe().fromPromise,j1=sr(),M1=require("path"),U1=cn(),q1=Dc(),L1=VJ(async function(e){let r;try{r=await j1.readdir(e)}catch{return U1.mkdirs(e)}return Promise.all(r.map(n=>q1.remove(M1.join(e,n))))});function B1(t){let e;try{e=j1.readdirSync(t)}catch{return U1.mkdirsSync(t)}e.forEach(r=>{r=M1.join(t,r),q1.removeSync(r)})}H1.exports={emptyDirSync:B1,emptydirSync:B1,emptyDir:L1,emptydir:L1}});var W1=_((w0e,G1)=>{"use strict";var zJ=Fe().fromPromise,z1=require("path"),ii=sr(),K1=cn();async function KJ(t){let e;try{e=await ii.stat(t)}catch{}if(e&&e.isFile())return;let r=z1.dirname(t),n=null;try{n=await ii.stat(r)}catch(i){if(i.code==="ENOENT"){await K1.mkdirs(r),await ii.writeFile(t,"");return}else throw i}n.isDirectory()?await ii.writeFile(t,""):await ii.readdir(r)}function GJ(t){let e;try{e=ii.statSync(t)}catch{}if(e&&e.isFile())return;let r=z1.dirname(t);try{ii.statSync(r).isDirectory()||ii.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")K1.mkdirsSync(r);else throw n}ii.writeFileSync(t,"")}G1.exports={createFile:zJ(KJ),createFileSync:GJ}});var Q1=_((v0e,Z1)=>{"use strict";var WJ=Fe().fromPromise,X1=require("path"),Hi=sr(),Y1=cn(),{pathExists:XJ}=qi(),{areIdentical:J1}=Gs();async function YJ(t,e){let r;try{r=await Hi.lstat(e)}catch{}let n;try{n=await Hi.lstat(t)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(r&&J1(n,r))return;let i=X1.dirname(e);await XJ(i)||await Y1.mkdirs(i),await Hi.link(t,e)}function JJ(t,e){let r;try{r=Hi.lstatSync(e)}catch{}try{let s=Hi.lstatSync(t);if(r&&J1(s,r))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=X1.dirname(e);return Hi.existsSync(n)||Y1.mkdirsSync(n),Hi.linkSync(t,e)}Z1.exports={createLink:WJ(YJ),createLinkSync:JJ}});var tI=_((E0e,eI)=>{"use strict";var Vi=require("path"),wc=sr(),{pathExists:ZJ}=qi(),QJ=Fe().fromPromise;async function eZ(t,e){if(Vi.isAbsolute(t)){try{await wc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:t}}let r=Vi.dirname(e),n=Vi.join(r,t);if(await ZJ(n))return{toCwd:n,toDst:t};try{await wc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:Vi.relative(r,t)}}function tZ(t,e){if(Vi.isAbsolute(t)){if(!wc.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Vi.dirname(e),n=Vi.join(r,t);if(wc.existsSync(n))return{toCwd:n,toDst:t};if(!wc.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Vi.relative(r,t)}}eI.exports={symlinkPaths:QJ(eZ),symlinkPathsSync:tZ}});var iI=_((b0e,nI)=>{"use strict";var rI=sr(),rZ=Fe().fromPromise;async function nZ(t,e){if(e)return e;let r;try{r=await rI.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function iZ(t,e){if(e)return e;let r;try{r=rI.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}nI.exports={symlinkType:rZ(nZ),symlinkTypeSync:iZ}});var uI=_((_0e,aI)=>{"use strict";var sZ=Fe().fromPromise,sI=require("path"),An=sr(),{mkdirs:oZ,mkdirsSync:aZ}=cn(),{symlinkPaths:uZ,symlinkPathsSync:cZ}=tI(),{symlinkType:lZ,symlinkTypeSync:fZ}=iI(),{pathExists:hZ}=qi(),{areIdentical:oI}=Gs();async function dZ(t,e,r){let n;try{n=await An.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[a,u]=await Promise.all([An.stat(t),An.stat(e)]);if(oI(a,u))return}let i=await uZ(t,e);t=i.toDst;let s=await lZ(i.toCwd,r),o=sI.dirname(e);return await hZ(o)||await oZ(o),An.symlink(t,e,s)}function pZ(t,e,r){let n;try{n=An.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let a=An.statSync(t),u=An.statSync(e);if(oI(a,u))return}let i=cZ(t,e);t=i.toDst,r=fZ(i.toCwd,r);let s=sI.dirname(e);return An.existsSync(s)||aZ(s),An.symlinkSync(t,e,r)}aI.exports={createSymlink:sZ(dZ),createSymlinkSync:pZ}});var gI=_((C0e,mI)=>{"use strict";var{createFile:cI,createFileSync:lI}=W1(),{createLink:fI,createLinkSync:hI}=Q1(),{createSymlink:dI,createSymlinkSync:pI}=uI();mI.exports={createFile:cI,createFileSync:lI,ensureFile:cI,ensureFileSync:lI,createLink:fI,createLinkSync:hI,ensureLink:fI,ensureLinkSync:hI,createSymlink:dI,createSymlinkSync:pI,ensureSymlink:dI,ensureSymlinkSync:pI}});var _a=_((S0e,yI)=>{function mZ(t,{EOL:e=`
69
- `,finalEOL:r=!0,replacer:n=null,spaces:i}={}){let s=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+s}function gZ(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}yI.exports={stringify:mZ,stripBom:gZ}});var k0=_((A0e,vI)=>{var Ca;try{Ca=vt()}catch{Ca=require("fs")}var td=Fe(),{stringify:DI,stripBom:wI}=_a();async function yZ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ca,n="throws"in e?e.throws:!0,i=await td.fromCallback(r.readFile)(t,e);i=wI(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}return s}var DZ=td.fromPromise(yZ);function wZ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ca,n="throws"in e?e.throws:!0;try{let i=r.readFileSync(t,e);return i=wI(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${t}: ${i.message}`,i;return null}}async function vZ(t,e,r={}){let n=r.fs||Ca,i=DI(e,r);await td.fromCallback(n.writeFile)(t,i,r)}var EZ=td.fromPromise(vZ);function bZ(t,e,r={}){let n=r.fs||Ca,i=DI(e,r);return n.writeFileSync(t,i,r)}vI.exports={readFile:DZ,readFileSync:wZ,writeFile:EZ,writeFileSync:bZ}});var bI=_((O0e,EI)=>{"use strict";var rd=k0();EI.exports={readJson:rd.readFile,readJsonSync:rd.readFileSync,writeJson:rd.writeFile,writeJsonSync:rd.writeFileSync}});var nd=_((x0e,SI)=>{"use strict";var _Z=Fe().fromPromise,N0=sr(),_I=require("path"),CI=cn(),CZ=qi().pathExists;async function SZ(t,e,r="utf-8"){let n=_I.dirname(t);return await CZ(n)||await CI.mkdirs(n),N0.writeFile(t,e,r)}function AZ(t,...e){let r=_I.dirname(t);N0.existsSync(r)||CI.mkdirsSync(r),N0.writeFileSync(t,...e)}SI.exports={outputFile:_Z(SZ),outputFileSync:AZ}});var OI=_((T0e,AI)=>{"use strict";var{stringify:OZ}=_a(),{outputFile:xZ}=nd();async function TZ(t,e,r={}){let n=OZ(e,r);await xZ(t,n,r)}AI.exports=TZ});var TI=_((I0e,xI)=>{"use strict";var{stringify:IZ}=_a(),{outputFileSync:PZ}=nd();function FZ(t,e,r){let n=IZ(e,r);PZ(t,n,r)}xI.exports=FZ});var PI=_((P0e,II)=>{"use strict";var RZ=Fe().fromPromise,ar=bI();ar.outputJson=RZ(OI());ar.outputJsonSync=TI();ar.outputJSON=ar.outputJson;ar.outputJSONSync=ar.outputJsonSync;ar.writeJSON=ar.writeJson;ar.writeJSONSync=ar.writeJsonSync;ar.readJSON=ar.readJson;ar.readJSONSync=ar.readJsonSync;II.exports=ar});var $I=_((F0e,NI)=>{"use strict";var kZ=sr(),FI=require("path"),{copy:NZ}=ed(),{remove:kI}=Dc(),{mkdirp:$Z}=cn(),{pathExists:LZ}=qi(),RI=Gs();async function BZ(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await RI.checkPaths(t,e,"move",r);await RI.checkParentPaths(t,i,e,"move");let o=FI.dirname(e);return FI.parse(o).root!==o&&await $Z(o),jZ(t,e,n,s)}async function jZ(t,e,r,n){if(!n){if(r)await kI(e);else if(await LZ(e))throw new Error("dest already exists.")}try{await kZ.rename(t,e)}catch(i){if(i.code!=="EXDEV")throw i;await MZ(t,e,r)}}async function MZ(t,e,r){return await NZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),kI(t)}NI.exports=BZ});var UI=_((R0e,MI)=>{"use strict";var BI=vt(),L0=require("path"),UZ=ed().copySync,jI=Dc().removeSync,qZ=cn().mkdirpSync,LI=Gs();function HZ(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=LI.checkPathsSync(t,e,"move",r);return LI.checkParentPathsSync(t,i,e,"move"),VZ(e)||qZ(L0.dirname(e)),zZ(t,e,n,s)}function VZ(t){let e=L0.dirname(t);return L0.parse(e).root===e}function zZ(t,e,r,n){if(n)return $0(t,e,r);if(r)return jI(e),$0(t,e,r);if(BI.existsSync(e))throw new Error("dest already exists.");return $0(t,e,r)}function $0(t,e,r){try{BI.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return KZ(t,e,r)}}function KZ(t,e,r){return UZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),jI(t)}MI.exports=HZ});var HI=_((k0e,qI)=>{"use strict";var GZ=Fe().fromPromise;qI.exports={move:GZ($I()),moveSync:UI()}});var Sa=_((N0e,VI)=>{"use strict";VI.exports={...sr(),...ed(),...V1(),...gI(),...PI(),...cn(),...HI(),...nd(),...qi(),...Dc()}});var JI=_(($0e,YI)=>{"use strict";var B0,KI,GI,WI,XI=!0;typeof process<"u"&&({FORCE_COLOR:B0,NODE_DISABLE_COLORS:KI,NO_COLOR:GI,TERM:WI}=process.env||{},XI=process.stdout&&process.stdout.isTTY);var Le={enabled:!KI&&GI==null&&WI!=="dumb"&&(B0!=null&&B0!=="0"||XI),reset:Ye(0,0),bold:Ye(1,22),dim:Ye(2,22),italic:Ye(3,23),underline:Ye(4,24),inverse:Ye(7,27),hidden:Ye(8,28),strikethrough:Ye(9,29),black:Ye(30,39),red:Ye(31,39),green:Ye(32,39),yellow:Ye(33,39),blue:Ye(34,39),magenta:Ye(35,39),cyan:Ye(36,39),white:Ye(37,39),gray:Ye(90,39),grey:Ye(90,39),bgBlack:Ye(40,49),bgRed:Ye(41,49),bgGreen:Ye(42,49),bgYellow:Ye(43,49),bgBlue:Ye(44,49),bgMagenta:Ye(45,49),bgCyan:Ye(46,49),bgWhite:Ye(47,49)};function zI(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function WZ(t,e){let r={has:t,keys:e};return r.reset=Le.reset.bind(r),r.bold=Le.bold.bind(r),r.dim=Le.dim.bind(r),r.italic=Le.italic.bind(r),r.underline=Le.underline.bind(r),r.inverse=Le.inverse.bind(r),r.hidden=Le.hidden.bind(r),r.strikethrough=Le.strikethrough.bind(r),r.black=Le.black.bind(r),r.red=Le.red.bind(r),r.green=Le.green.bind(r),r.yellow=Le.yellow.bind(r),r.blue=Le.blue.bind(r),r.magenta=Le.magenta.bind(r),r.cyan=Le.cyan.bind(r),r.white=Le.white.bind(r),r.gray=Le.gray.bind(r),r.grey=Le.grey.bind(r),r.bgBlack=Le.bgBlack.bind(r),r.bgRed=Le.bgRed.bind(r),r.bgGreen=Le.bgGreen.bind(r),r.bgYellow=Le.bgYellow.bind(r),r.bgBlue=Le.bgBlue.bind(r),r.bgMagenta=Le.bgMagenta.bind(r),r.bgCyan=Le.bgCyan.bind(r),r.bgWhite=Le.bgWhite.bind(r),r}function Ye(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Le.enabled?zI(this.keys,n+""):n+""):n===void 0?WZ([t],[r]):Le.enabled?zI([r],n+""):n+""}}YI.exports=Le});var Aa=_(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.ancillary=At.failure=At.success=At.input=At.weak=At.strong=void 0;var XZ=(he(),ce(fe)),On=XZ.__importDefault(JI());At.strong=On.default.bold;At.weak=On.default.dim;At.input=On.default.cyan;At.success=On.default.green;At.failure=On.default.red;At.ancillary=On.default.cyan;var YZ={strong:At.strong,weak:At.weak,input:At.input,success:At.success,failure:At.failure,ancillary:At.ancillary,log:{DEBUG:On.default.magenta,INFO:On.default.cyan,WARN:On.default.yellow,ERROR:On.default.red}};At.default=YZ});var j0=_(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.EscapeCode=void 0;var ln="\x1B[",Bt=class{};id.EscapeCode=Bt;Bt.cursorLeft=()=>`${ln}G`;Bt.cursorUp=(t=1)=>`${ln}${t}A`;Bt.cursorDown=(t=1)=>`${ln}${t}B`;Bt.cursorForward=(t=1)=>`${ln}${t}C`;Bt.cursorBackward=(t=1)=>`${ln}${t}D`;Bt.cursorHide=()=>`${ln}?25l`;Bt.cursorShow=()=>`${ln}?25h`;Bt.eraseLine=()=>`${ln}2K`;Bt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=Bt.eraseLine(),r<t-1&&(e+=Bt.cursorUp());return`${e}${Bt.cursorLeft()}`};Bt.eraseUp=()=>`${ln}1J`;Bt.eraseDown=()=>`${ln}J`;Bt.eraseScreen=()=>`${ln}2J`});var QI=_(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.Cursor=void 0;var JZ=(he(),ce(fe)),ZZ=JZ.__importDefault(Uh()),ZI=j0(),Oa=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(ZI.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,ZZ.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(ZI.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};sd.Cursor=Oa;Oa.stream=process.stderr;Oa._isVisible=!0;Oa._listenerAttached=!1});var U0=_((M0e,M0)=>{"use strict";var eP=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);M0.exports=eP;M0.exports.default=eP});var nP=_((U0e,rP)=>{"use strict";var tP="[\uD800-\uDBFF][\uDC00-\uDFFF]",QZ=t=>t&&t.exact?new RegExp(`^${tP}$`):new RegExp(tP,"g");rP.exports=QZ});var sP=_((q0e,iP)=>{"use strict";iP.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var q0=_((H0e,aP)=>{var vc=sP(),oP={};for(let t of Object.keys(vc))oP[vc[t]]=t;var ie={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};aP.exports=ie;for(let t of Object.keys(ie)){if(!("channels"in ie[t]))throw new Error("missing channels property: "+t);if(!("labels"in ie[t]))throw new Error("missing channel labels property: "+t);if(ie[t].labels.length!==ie[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=ie[t];delete ie[t].channels,delete ie[t].labels,Object.defineProperty(ie[t],"channels",{value:e}),Object.defineProperty(ie[t],"labels",{value:r})}ie.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=s-i,a,u;s===i?a=0:e===s?a=(r-n)/o:r===s?a=2+(n-e)/o:n===s&&(a=4+(e-r)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+s)/2;return s===i?u=0:c<=.5?u=o/(s+i):u=o/(2-s-i),[a,u*100,c*100]};ie.rgb.hsv=function(t){let e,r,n,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(o,a,u),l=c-Math.min(o,a,u),h=function(d){return(c-d)/6/l+1/2};return l===0?(i=0,s=0):(s=l/c,e=h(o),r=h(a),n=h(u),o===c?i=n-r:a===c?i=1/3+e-n:u===c&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,c*100]};ie.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],i=ie.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,s*100,n*100]};ie.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(1-e,1-r,1-n),s=(1-e-i)/(1-i)||0,o=(1-r-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[s*100,o*100,a*100,i*100]};function eQ(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}ie.rgb.keyword=function(t){let e=oP[t];if(e)return e;let r=1/0,n;for(let i of Object.keys(vc)){let s=vc[i],o=eQ(t,s);o<r&&(r=o,n=i)}return n};ie.keyword.rgb=function(t){return vc[t]};ie.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let i=e*.4124+r*.3576+n*.1805,s=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[i*100,s*100,o*100]};ie.rgb.lab=function(t){let e=ie.rgb.xyz(t),r=e[0],n=e[1],i=e[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*n-16,o=500*(r-n),a=200*(n-i);return[s,o,a]};ie.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i,s,o;if(r===0)return o=n*255,[o,o,o];n<.5?i=n*(1+r):i=n+r-n*r;let a=2*n-i,u=[0,0,0];for(let c=0;c<3;c++)s=e+1/3*-(c-1),s<0&&s++,s>1&&s--,6*s<1?o=a+(i-a)*6*s:2*s<1?o=i:3*s<2?o=a+(i-a)*(2/3-s)*6:o=a,u[c]=o*255;return u};ie.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=r,s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s;let o=(n+r)/2,a=n===0?2*i/(s+i):2*r/(n+r);return[e,a*100,o*100]};ie.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*n*(1-r),a=255*n*(1-r*s),u=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,u,o];case 1:return[a,n,o];case 2:return[o,n,u];case 3:return[o,a,n];case 4:return[u,o,n];case 5:return[n,o,a]}};ie.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),s,o;o=(2-r)*n;let a=(2-r)*i;return s=r*i,s/=a<=1?a:2-a,s=s||0,o/=2,[e,s*100,o*100]};ie.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,s;i>1&&(r/=i,n/=i);let o=Math.floor(6*e),a=1-n;s=6*e-o,(o&1)!==0&&(s=1-s);let u=r+s*(a-r),c,l,h;switch(o){default:case 6:case 0:c=a,l=u,h=r;break;case 1:c=u,l=a,h=r;break;case 2:c=r,l=a,h=u;break;case 3:c=r,l=u,h=a;break;case 4:c=u,l=r,h=a;break;case 5:c=a,l=r,h=u;break}return[c*255,l*255,h*255]};ie.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[s*255,o*255,a*255]};ie.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i,s,o;return i=e*3.2406+r*-1.5372+n*-.4986,s=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};ie.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let i=116*r-16,s=500*(e-r),o=200*(r-n);return[i,s,o]};ie.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],i,s,o;s=(e+16)/116,i=r/500+s,o=s-n/200;let a=s**3,u=i**3,c=o**3;return s=a>.008856?a:(s-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};ie.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],i;i=Math.atan2(n,r)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(r*r+n*n);return[e,o,i]};ie.lch.lab=function(t){let e=t[0],r=t[1],i=t[2]/360*2*Math.PI,s=r*Math.cos(i),o=r*Math.sin(i);return[e,s,o]};ie.rgb.ansi16=function(t,e=null){let[r,n,i]=t,s=e===null?ie.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),s===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return s===2&&(o+=60),o};ie.hsv.ansi16=function(t){return ie.rgb.ansi16(ie.hsv.rgb(t),t[2])};ie.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};ie.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,s=(e>>2&1)*r*255;return[n,i,s]};ie.ansi256.rgb=function(t){if(t>=232){let s=(t-232)*10+8;return[s,s,s]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,i=e%6/5*255;return[r,n,i]};ie.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};ie.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let n=parseInt(r,16),i=n>>16&255,s=n>>8&255,o=n&255;return[i,s,o]};ie.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),o=i-s,a,u;return o<1?a=s/(1-o):a=0,o<=0?u=0:i===e?u=(r-n)/o%6:i===r?u=2+(n-e)/o:u=4+(e-r)/o,u/=6,u%=1,[u*360,o*100,a*100]};ie.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),i=0;return n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};ie.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};ie.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let i=[0,0,0],s=e%1*6,o=s%1,a=1-o,u=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return u=(1-r)*n,[(r*i[0]+u)*255,(r*i[1]+u)*255,(r*i[2]+u)*255]};ie.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};ie.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};ie.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};ie.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,i=n-e,s=0;return i<1&&(s=(n-i)/(1-i)),[t[0],i*100,s*100]};ie.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};ie.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};ie.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};ie.gray.hsl=function(t){return[0,0,t[0]]};ie.gray.hsv=ie.gray.hsl;ie.gray.hwb=function(t){return[0,100,t[0]]};ie.gray.cmyk=function(t){return[0,0,0,t[0]]};ie.gray.lab=function(t){return[t[0],0,0]};ie.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};ie.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var cP=_((V0e,uP)=>{var od=q0();function tQ(){let t={},e=Object.keys(od);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function rQ(t){let e=tQ(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),i=Object.keys(od[n]);for(let s=i.length,o=0;o<s;o++){let a=i[o],u=e[a];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(a))}}return e}function nQ(t,e){return function(r){return e(t(r))}}function iQ(t,e){let r=[e[t].parent,t],n=od[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)r.unshift(e[i].parent),n=nQ(od[e[i].parent][i],n),i=e[i].parent;return n.conversion=r,n}uP.exports=function(t){let e=rQ(t),r={},n=Object.keys(e);for(let i=n.length,s=0;s<i;s++){let o=n[s];e[o].parent!==null&&(r[o]=iQ(o,e))}return r}});var fP=_((z0e,lP)=>{var H0=q0(),sQ=cP(),xa={},oQ=Object.keys(H0);function aQ(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function uQ(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let i=t(r);if(typeof i=="object")for(let s=i.length,o=0;o<s;o++)i[o]=Math.round(i[o]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}oQ.forEach(t=>{xa[t]={},Object.defineProperty(xa[t],"channels",{value:H0[t].channels}),Object.defineProperty(xa[t],"labels",{value:H0[t].labels});let e=sQ(t);Object.keys(e).forEach(n=>{let i=e[n];xa[t][n]=uQ(i),xa[t][n].raw=aQ(i)})});lP.exports=xa});var z0=_((K0e,gP)=>{"use strict";var hP=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,dP=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},pP=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},ad=t=>t,mP=(t,e,r)=>[t,e,r],Ta=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},V0,Ia=(t,e,r,n)=>{V0===void 0&&(V0=fP());let i=n?10:0,s={};for(let[o,a]of Object.entries(V0)){let u=o==="ansi16"?"ansi":o;o===e?s[u]=t(r,i):typeof a=="object"&&(s[u]=t(a[e],i))}return s};function cQ(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[i,s]of Object.entries(n))e[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[i]=e[i],t.set(s[0],s[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Ta(e.color,"ansi",()=>Ia(hP,"ansi16",ad,!1)),Ta(e.color,"ansi256",()=>Ia(dP,"ansi256",ad,!1)),Ta(e.color,"ansi16m",()=>Ia(pP,"rgb",mP,!1)),Ta(e.bgColor,"ansi",()=>Ia(hP,"ansi16",ad,!0)),Ta(e.bgColor,"ansi256",()=>Ia(dP,"ansi256",ad,!0)),Ta(e.bgColor,"ansi16m",()=>Ia(pP,"rgb",mP,!0)),e}Object.defineProperty(gP,"exports",{enumerable:!0,get:cQ})});var EP=_((G0e,vP)=>{"use strict";var lQ=U0(),fQ=nP(),yP=z0(),wP=["\x1B","\x9B"],ud=t=>`${wP[0]}[${t}m`,DP=(t,e,r)=>{let n=[];t=[...t];for(let i of t){let s=i;i.includes(";")&&(i=i.split(";")[0][0]+"0");let o=yP.codes.get(Number.parseInt(i,10));if(o){let a=t.indexOf(o.toString());a===-1?n.push(ud(e?o:s)):t.splice(a,1)}else if(e){n.push(ud(0));break}else n.push(ud(s))}if(e&&(n=n.filter((i,s)=>n.indexOf(i)===s),r!==void 0)){let i=ud(yP.codes.get(Number.parseInt(r,10)));n=n.reduce((s,o)=>o===i?[o,...s]:[...s,o],[])}return n.join("")};vP.exports=(t,e,r)=>{let n=[...t],i=[],s=typeof r=="number"?r:n.length,o=!1,a,u=0,c="";for(let[l,h]of n.entries()){let d=!1;if(wP.includes(h)){let f=/\d[^m]*/.exec(t.slice(l,l+18));a=f&&f.length>0?f[0]:void 0,u<s&&(o=!0,a!==void 0&&i.push(a))}else o&&h==="m"&&(o=!1,d=!0);if(!o&&!d&&u++,!fQ({exact:!0}).test(h)&&lQ(h.codePointAt())&&(u++,typeof r!="number"&&s++),u>e&&u<=s)c+=h;else if(u===e&&!o&&a!==void 0)c=DP(i);else if(u>=s){c+=DP(i,!0,a);break}}return c}});var _P=_((W0e,bP)=>{"use strict";bP.exports=({onlyFirst:t=!1}={})=>{let e=["[\\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(e,t?void 0:"g")}});var cd=_((X0e,CP)=>{"use strict";var hQ=_P();CP.exports=t=>typeof t=="string"?t.replace(hQ(),""):t});var AP=_((Y0e,SP)=>{"use strict";SP.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var G0=_((J0e,K0)=>{"use strict";var dQ=cd(),pQ=U0(),mQ=AP(),OP=t=>{if(typeof t!="string"||t.length===0||(t=dQ(t),t.length===0))return 0;t=t.replace(mQ()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=pQ(n)?2:1)}return e};K0.exports=OP;K0.exports.default=OP});var RP=_((Z0e,FP)=>{"use strict";var Ec=G0(),gQ=cd(),yQ=z0(),ld=new Set(["\x1B","\x9B"]),DQ=39,X0="\x07",IP="[",wQ="]",PP="m",Y0=`${wQ}8;;`,xP=t=>`${ld.values().next().value}${IP}${t}${PP}`,TP=t=>`${ld.values().next().value}${Y0}${t}${X0}`,vQ=t=>t.split(" ").map(e=>Ec(e)),W0=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=Ec(gQ(t[t.length-1]));for(let[a,u]of n.entries()){let c=Ec(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),ld.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(Y0)),i){s?u===X0&&(i=!1,s=!1):u===PP&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},EQ=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Ec(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},bQ=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=vQ(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=Ec(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),W0(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){W0(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){W0(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(EQ));let u=[...a.join(`
68
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=yc.checkPathsSync(t,e,"copy",r);if(yc.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let s=gc.dirname(e);return or.existsSync(s)||AJ(s),T1(i,t,e,r)}function T1(t,e,r,n){let s=(n.dereference?or.statSync:or.lstatSync)(e);if(s.isDirectory())return NJ(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return TJ(s,t,e,r,n);if(s.isSymbolicLink())return BJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function TJ(t,e,r,n,i){return e?IJ(t,r,n,i):I1(t,r,n,i)}function IJ(t,e,r,n){if(n.overwrite)return or.unlinkSync(r),I1(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function I1(t,e,r,n){return or.copyFileSync(e,r),n.preserveTimestamps&&PJ(t.mode,e,r),R0(r,t.mode)}function PJ(t,e,r){return FJ(t)&&RJ(r,t),kJ(e,r)}function FJ(t){return(t&128)===0}function RJ(t,e){return R0(t,e|128)}function R0(t,e){return or.chmodSync(t,e)}function kJ(t,e){let r=or.statSync(t);return OJ(e,r.atime,r.mtime)}function NJ(t,e,r,n,i){return e?P1(r,n,i):$J(t.mode,r,n,i)}function $J(t,e,r,n){return or.mkdirSync(r),P1(e,r,n),R0(r,t)}function P1(t,e,r){let n=or.opendirSync(t);try{let i;for(;(i=n.readSync())!==null;)LJ(i.name,t,e,r)}finally{n.closeSync()}}function LJ(t,e,r,n){let i=gc.join(e,t),s=gc.join(r,t);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=yc.checkPathsSync(i,s,"copy",n);return T1(o,i,s,n)}function BJ(t,e,r,n){let i=or.readlinkSync(e);if(n.dereference&&(i=gc.resolve(process.cwd(),i)),t){let s;try{s=or.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return or.symlinkSync(i,r);throw o}if(n.dereference&&(s=gc.resolve(process.cwd(),s)),yc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(yc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return jJ(i,r)}else return or.symlinkSync(i,r)}function jJ(t,e){return or.unlinkSync(e),or.symlinkSync(t,e)}F1.exports=xJ});var ed=_((g0e,k1)=>{"use strict";var MJ=Fe().fromPromise;k1.exports={copy:MJ(x1()),copySync:R1()}});var Dc=_((y0e,$1)=>{"use strict";var N1=vt(),UJ=Fe().fromCallback;function qJ(t,e){N1.rm(t,{recursive:!0,force:!0},e)}function HJ(t){N1.rmSync(t,{recursive:!0,force:!0})}$1.exports={remove:UJ(qJ),removeSync:HJ}});var V1=_((D0e,H1)=>{"use strict";var VJ=Fe().fromPromise,j1=sr(),M1=require("path"),U1=fn(),q1=Dc(),L1=VJ(async function(e){let r;try{r=await j1.readdir(e)}catch{return U1.mkdirs(e)}return Promise.all(r.map(n=>q1.remove(M1.join(e,n))))});function B1(t){let e;try{e=j1.readdirSync(t)}catch{return U1.mkdirsSync(t)}e.forEach(r=>{r=M1.join(t,r),q1.removeSync(r)})}H1.exports={emptyDirSync:B1,emptydirSync:B1,emptyDir:L1,emptydir:L1}});var W1=_((w0e,G1)=>{"use strict";var zJ=Fe().fromPromise,z1=require("path"),si=sr(),K1=fn();async function KJ(t){let e;try{e=await si.stat(t)}catch{}if(e&&e.isFile())return;let r=z1.dirname(t),n=null;try{n=await si.stat(r)}catch(i){if(i.code==="ENOENT"){await K1.mkdirs(r),await si.writeFile(t,"");return}else throw i}n.isDirectory()?await si.writeFile(t,""):await si.readdir(r)}function GJ(t){let e;try{e=si.statSync(t)}catch{}if(e&&e.isFile())return;let r=z1.dirname(t);try{si.statSync(r).isDirectory()||si.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")K1.mkdirsSync(r);else throw n}si.writeFileSync(t,"")}G1.exports={createFile:zJ(KJ),createFileSync:GJ}});var Q1=_((v0e,Z1)=>{"use strict";var WJ=Fe().fromPromise,X1=require("path"),Hi=sr(),Y1=fn(),{pathExists:XJ}=qi(),{areIdentical:J1}=Gs();async function YJ(t,e){let r;try{r=await Hi.lstat(e)}catch{}let n;try{n=await Hi.lstat(t)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(r&&J1(n,r))return;let i=X1.dirname(e);await XJ(i)||await Y1.mkdirs(i),await Hi.link(t,e)}function JJ(t,e){let r;try{r=Hi.lstatSync(e)}catch{}try{let s=Hi.lstatSync(t);if(r&&J1(s,r))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=X1.dirname(e);return Hi.existsSync(n)||Y1.mkdirsSync(n),Hi.linkSync(t,e)}Z1.exports={createLink:WJ(YJ),createLinkSync:JJ}});var tI=_((E0e,eI)=>{"use strict";var Vi=require("path"),wc=sr(),{pathExists:ZJ}=qi(),QJ=Fe().fromPromise;async function eZ(t,e){if(Vi.isAbsolute(t)){try{await wc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:t}}let r=Vi.dirname(e),n=Vi.join(r,t);if(await ZJ(n))return{toCwd:n,toDst:t};try{await wc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:Vi.relative(r,t)}}function tZ(t,e){if(Vi.isAbsolute(t)){if(!wc.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Vi.dirname(e),n=Vi.join(r,t);if(wc.existsSync(n))return{toCwd:n,toDst:t};if(!wc.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Vi.relative(r,t)}}eI.exports={symlinkPaths:QJ(eZ),symlinkPathsSync:tZ}});var iI=_((b0e,nI)=>{"use strict";var rI=sr(),rZ=Fe().fromPromise;async function nZ(t,e){if(e)return e;let r;try{r=await rI.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function iZ(t,e){if(e)return e;let r;try{r=rI.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}nI.exports={symlinkType:rZ(nZ),symlinkTypeSync:iZ}});var uI=_((_0e,aI)=>{"use strict";var sZ=Fe().fromPromise,sI=require("path"),An=sr(),{mkdirs:oZ,mkdirsSync:aZ}=fn(),{symlinkPaths:uZ,symlinkPathsSync:cZ}=tI(),{symlinkType:lZ,symlinkTypeSync:fZ}=iI(),{pathExists:hZ}=qi(),{areIdentical:oI}=Gs();async function dZ(t,e,r){let n;try{n=await An.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[a,u]=await Promise.all([An.stat(t),An.stat(e)]);if(oI(a,u))return}let i=await uZ(t,e);t=i.toDst;let s=await lZ(i.toCwd,r),o=sI.dirname(e);return await hZ(o)||await oZ(o),An.symlink(t,e,s)}function pZ(t,e,r){let n;try{n=An.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let a=An.statSync(t),u=An.statSync(e);if(oI(a,u))return}let i=cZ(t,e);t=i.toDst,r=fZ(i.toCwd,r);let s=sI.dirname(e);return An.existsSync(s)||aZ(s),An.symlinkSync(t,e,r)}aI.exports={createSymlink:sZ(dZ),createSymlinkSync:pZ}});var gI=_((C0e,mI)=>{"use strict";var{createFile:cI,createFileSync:lI}=W1(),{createLink:fI,createLinkSync:hI}=Q1(),{createSymlink:dI,createSymlinkSync:pI}=uI();mI.exports={createFile:cI,createFileSync:lI,ensureFile:cI,ensureFileSync:lI,createLink:fI,createLinkSync:hI,ensureLink:fI,ensureLinkSync:hI,createSymlink:dI,createSymlinkSync:pI,ensureSymlink:dI,ensureSymlinkSync:pI}});var _a=_((S0e,yI)=>{function mZ(t,{EOL:e=`
69
+ `,finalEOL:r=!0,replacer:n=null,spaces:i}={}){let s=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+s}function gZ(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}yI.exports={stringify:mZ,stripBom:gZ}});var k0=_((A0e,vI)=>{var Ca;try{Ca=vt()}catch{Ca=require("fs")}var td=Fe(),{stringify:DI,stripBom:wI}=_a();async function yZ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ca,n="throws"in e?e.throws:!0,i=await td.fromCallback(r.readFile)(t,e);i=wI(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}return s}var DZ=td.fromPromise(yZ);function wZ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ca,n="throws"in e?e.throws:!0;try{let i=r.readFileSync(t,e);return i=wI(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${t}: ${i.message}`,i;return null}}async function vZ(t,e,r={}){let n=r.fs||Ca,i=DI(e,r);await td.fromCallback(n.writeFile)(t,i,r)}var EZ=td.fromPromise(vZ);function bZ(t,e,r={}){let n=r.fs||Ca,i=DI(e,r);return n.writeFileSync(t,i,r)}vI.exports={readFile:DZ,readFileSync:wZ,writeFile:EZ,writeFileSync:bZ}});var bI=_((O0e,EI)=>{"use strict";var rd=k0();EI.exports={readJson:rd.readFile,readJsonSync:rd.readFileSync,writeJson:rd.writeFile,writeJsonSync:rd.writeFileSync}});var nd=_((x0e,SI)=>{"use strict";var _Z=Fe().fromPromise,N0=sr(),_I=require("path"),CI=fn(),CZ=qi().pathExists;async function SZ(t,e,r="utf-8"){let n=_I.dirname(t);return await CZ(n)||await CI.mkdirs(n),N0.writeFile(t,e,r)}function AZ(t,...e){let r=_I.dirname(t);N0.existsSync(r)||CI.mkdirsSync(r),N0.writeFileSync(t,...e)}SI.exports={outputFile:_Z(SZ),outputFileSync:AZ}});var OI=_((T0e,AI)=>{"use strict";var{stringify:OZ}=_a(),{outputFile:xZ}=nd();async function TZ(t,e,r={}){let n=OZ(e,r);await xZ(t,n,r)}AI.exports=TZ});var TI=_((I0e,xI)=>{"use strict";var{stringify:IZ}=_a(),{outputFileSync:PZ}=nd();function FZ(t,e,r){let n=IZ(e,r);PZ(t,n,r)}xI.exports=FZ});var PI=_((P0e,II)=>{"use strict";var RZ=Fe().fromPromise,ar=bI();ar.outputJson=RZ(OI());ar.outputJsonSync=TI();ar.outputJSON=ar.outputJson;ar.outputJSONSync=ar.outputJsonSync;ar.writeJSON=ar.writeJson;ar.writeJSONSync=ar.writeJsonSync;ar.readJSON=ar.readJson;ar.readJSONSync=ar.readJsonSync;II.exports=ar});var $I=_((F0e,NI)=>{"use strict";var kZ=sr(),FI=require("path"),{copy:NZ}=ed(),{remove:kI}=Dc(),{mkdirp:$Z}=fn(),{pathExists:LZ}=qi(),RI=Gs();async function BZ(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await RI.checkPaths(t,e,"move",r);await RI.checkParentPaths(t,i,e,"move");let o=FI.dirname(e);return FI.parse(o).root!==o&&await $Z(o),jZ(t,e,n,s)}async function jZ(t,e,r,n){if(!n){if(r)await kI(e);else if(await LZ(e))throw new Error("dest already exists.")}try{await kZ.rename(t,e)}catch(i){if(i.code!=="EXDEV")throw i;await MZ(t,e,r)}}async function MZ(t,e,r){return await NZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),kI(t)}NI.exports=BZ});var UI=_((R0e,MI)=>{"use strict";var BI=vt(),L0=require("path"),UZ=ed().copySync,jI=Dc().removeSync,qZ=fn().mkdirpSync,LI=Gs();function HZ(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=LI.checkPathsSync(t,e,"move",r);return LI.checkParentPathsSync(t,i,e,"move"),VZ(e)||qZ(L0.dirname(e)),zZ(t,e,n,s)}function VZ(t){let e=L0.dirname(t);return L0.parse(e).root===e}function zZ(t,e,r,n){if(n)return $0(t,e,r);if(r)return jI(e),$0(t,e,r);if(BI.existsSync(e))throw new Error("dest already exists.");return $0(t,e,r)}function $0(t,e,r){try{BI.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return KZ(t,e,r)}}function KZ(t,e,r){return UZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),jI(t)}MI.exports=HZ});var HI=_((k0e,qI)=>{"use strict";var GZ=Fe().fromPromise;qI.exports={move:GZ($I()),moveSync:UI()}});var Sa=_((N0e,VI)=>{"use strict";VI.exports={...sr(),...ed(),...V1(),...gI(),...PI(),...fn(),...HI(),...nd(),...qi(),...Dc()}});var JI=_(($0e,YI)=>{"use strict";var B0,KI,GI,WI,XI=!0;typeof process<"u"&&({FORCE_COLOR:B0,NODE_DISABLE_COLORS:KI,NO_COLOR:GI,TERM:WI}=process.env||{},XI=process.stdout&&process.stdout.isTTY);var Le={enabled:!KI&&GI==null&&WI!=="dumb"&&(B0!=null&&B0!=="0"||XI),reset:Ye(0,0),bold:Ye(1,22),dim:Ye(2,22),italic:Ye(3,23),underline:Ye(4,24),inverse:Ye(7,27),hidden:Ye(8,28),strikethrough:Ye(9,29),black:Ye(30,39),red:Ye(31,39),green:Ye(32,39),yellow:Ye(33,39),blue:Ye(34,39),magenta:Ye(35,39),cyan:Ye(36,39),white:Ye(37,39),gray:Ye(90,39),grey:Ye(90,39),bgBlack:Ye(40,49),bgRed:Ye(41,49),bgGreen:Ye(42,49),bgYellow:Ye(43,49),bgBlue:Ye(44,49),bgMagenta:Ye(45,49),bgCyan:Ye(46,49),bgWhite:Ye(47,49)};function zI(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function WZ(t,e){let r={has:t,keys:e};return r.reset=Le.reset.bind(r),r.bold=Le.bold.bind(r),r.dim=Le.dim.bind(r),r.italic=Le.italic.bind(r),r.underline=Le.underline.bind(r),r.inverse=Le.inverse.bind(r),r.hidden=Le.hidden.bind(r),r.strikethrough=Le.strikethrough.bind(r),r.black=Le.black.bind(r),r.red=Le.red.bind(r),r.green=Le.green.bind(r),r.yellow=Le.yellow.bind(r),r.blue=Le.blue.bind(r),r.magenta=Le.magenta.bind(r),r.cyan=Le.cyan.bind(r),r.white=Le.white.bind(r),r.gray=Le.gray.bind(r),r.grey=Le.grey.bind(r),r.bgBlack=Le.bgBlack.bind(r),r.bgRed=Le.bgRed.bind(r),r.bgGreen=Le.bgGreen.bind(r),r.bgYellow=Le.bgYellow.bind(r),r.bgBlue=Le.bgBlue.bind(r),r.bgMagenta=Le.bgMagenta.bind(r),r.bgCyan=Le.bgCyan.bind(r),r.bgWhite=Le.bgWhite.bind(r),r}function Ye(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Le.enabled?zI(this.keys,n+""):n+""):n===void 0?WZ([t],[r]):Le.enabled?zI([r],n+""):n+""}}YI.exports=Le});var Aa=_(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.ancillary=At.failure=At.success=At.input=At.weak=At.strong=void 0;var XZ=(he(),ce(fe)),On=XZ.__importDefault(JI());At.strong=On.default.bold;At.weak=On.default.dim;At.input=On.default.cyan;At.success=On.default.green;At.failure=On.default.red;At.ancillary=On.default.cyan;var YZ={strong:At.strong,weak:At.weak,input:At.input,success:At.success,failure:At.failure,ancillary:At.ancillary,log:{DEBUG:On.default.magenta,INFO:On.default.cyan,WARN:On.default.yellow,ERROR:On.default.red}};At.default=YZ});var j0=_(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.EscapeCode=void 0;var hn="\x1B[",Bt=class{};id.EscapeCode=Bt;Bt.cursorLeft=()=>`${hn}G`;Bt.cursorUp=(t=1)=>`${hn}${t}A`;Bt.cursorDown=(t=1)=>`${hn}${t}B`;Bt.cursorForward=(t=1)=>`${hn}${t}C`;Bt.cursorBackward=(t=1)=>`${hn}${t}D`;Bt.cursorHide=()=>`${hn}?25l`;Bt.cursorShow=()=>`${hn}?25h`;Bt.eraseLine=()=>`${hn}2K`;Bt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=Bt.eraseLine(),r<t-1&&(e+=Bt.cursorUp());return`${e}${Bt.cursorLeft()}`};Bt.eraseUp=()=>`${hn}1J`;Bt.eraseDown=()=>`${hn}J`;Bt.eraseScreen=()=>`${hn}2J`});var QI=_(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.Cursor=void 0;var JZ=(he(),ce(fe)),ZZ=JZ.__importDefault(Uh()),ZI=j0(),Oa=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(ZI.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,ZZ.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(ZI.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};sd.Cursor=Oa;Oa.stream=process.stderr;Oa._isVisible=!0;Oa._listenerAttached=!1});var U0=_((M0e,M0)=>{"use strict";var eP=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);M0.exports=eP;M0.exports.default=eP});var nP=_((U0e,rP)=>{"use strict";var tP="[\uD800-\uDBFF][\uDC00-\uDFFF]",QZ=t=>t&&t.exact?new RegExp(`^${tP}$`):new RegExp(tP,"g");rP.exports=QZ});var sP=_((q0e,iP)=>{"use strict";iP.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var q0=_((H0e,aP)=>{var vc=sP(),oP={};for(let t of Object.keys(vc))oP[vc[t]]=t;var ie={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};aP.exports=ie;for(let t of Object.keys(ie)){if(!("channels"in ie[t]))throw new Error("missing channels property: "+t);if(!("labels"in ie[t]))throw new Error("missing channel labels property: "+t);if(ie[t].labels.length!==ie[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=ie[t];delete ie[t].channels,delete ie[t].labels,Object.defineProperty(ie[t],"channels",{value:e}),Object.defineProperty(ie[t],"labels",{value:r})}ie.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=s-i,a,u;s===i?a=0:e===s?a=(r-n)/o:r===s?a=2+(n-e)/o:n===s&&(a=4+(e-r)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+s)/2;return s===i?u=0:c<=.5?u=o/(s+i):u=o/(2-s-i),[a,u*100,c*100]};ie.rgb.hsv=function(t){let e,r,n,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(o,a,u),l=c-Math.min(o,a,u),h=function(d){return(c-d)/6/l+1/2};return l===0?(i=0,s=0):(s=l/c,e=h(o),r=h(a),n=h(u),o===c?i=n-r:a===c?i=1/3+e-n:u===c&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,c*100]};ie.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],i=ie.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,s*100,n*100]};ie.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(1-e,1-r,1-n),s=(1-e-i)/(1-i)||0,o=(1-r-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[s*100,o*100,a*100,i*100]};function eQ(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}ie.rgb.keyword=function(t){let e=oP[t];if(e)return e;let r=1/0,n;for(let i of Object.keys(vc)){let s=vc[i],o=eQ(t,s);o<r&&(r=o,n=i)}return n};ie.keyword.rgb=function(t){return vc[t]};ie.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let i=e*.4124+r*.3576+n*.1805,s=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[i*100,s*100,o*100]};ie.rgb.lab=function(t){let e=ie.rgb.xyz(t),r=e[0],n=e[1],i=e[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*n-16,o=500*(r-n),a=200*(n-i);return[s,o,a]};ie.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i,s,o;if(r===0)return o=n*255,[o,o,o];n<.5?i=n*(1+r):i=n+r-n*r;let a=2*n-i,u=[0,0,0];for(let c=0;c<3;c++)s=e+1/3*-(c-1),s<0&&s++,s>1&&s--,6*s<1?o=a+(i-a)*6*s:2*s<1?o=i:3*s<2?o=a+(i-a)*(2/3-s)*6:o=a,u[c]=o*255;return u};ie.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=r,s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s;let o=(n+r)/2,a=n===0?2*i/(s+i):2*r/(n+r);return[e,a*100,o*100]};ie.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*n*(1-r),a=255*n*(1-r*s),u=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,u,o];case 1:return[a,n,o];case 2:return[o,n,u];case 3:return[o,a,n];case 4:return[u,o,n];case 5:return[n,o,a]}};ie.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),s,o;o=(2-r)*n;let a=(2-r)*i;return s=r*i,s/=a<=1?a:2-a,s=s||0,o/=2,[e,s*100,o*100]};ie.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,s;i>1&&(r/=i,n/=i);let o=Math.floor(6*e),a=1-n;s=6*e-o,(o&1)!==0&&(s=1-s);let u=r+s*(a-r),c,l,h;switch(o){default:case 6:case 0:c=a,l=u,h=r;break;case 1:c=u,l=a,h=r;break;case 2:c=r,l=a,h=u;break;case 3:c=r,l=u,h=a;break;case 4:c=u,l=r,h=a;break;case 5:c=a,l=r,h=u;break}return[c*255,l*255,h*255]};ie.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[s*255,o*255,a*255]};ie.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i,s,o;return i=e*3.2406+r*-1.5372+n*-.4986,s=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};ie.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let i=116*r-16,s=500*(e-r),o=200*(r-n);return[i,s,o]};ie.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],i,s,o;s=(e+16)/116,i=r/500+s,o=s-n/200;let a=s**3,u=i**3,c=o**3;return s=a>.008856?a:(s-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};ie.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],i;i=Math.atan2(n,r)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(r*r+n*n);return[e,o,i]};ie.lch.lab=function(t){let e=t[0],r=t[1],i=t[2]/360*2*Math.PI,s=r*Math.cos(i),o=r*Math.sin(i);return[e,s,o]};ie.rgb.ansi16=function(t,e=null){let[r,n,i]=t,s=e===null?ie.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),s===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return s===2&&(o+=60),o};ie.hsv.ansi16=function(t){return ie.rgb.ansi16(ie.hsv.rgb(t),t[2])};ie.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};ie.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,s=(e>>2&1)*r*255;return[n,i,s]};ie.ansi256.rgb=function(t){if(t>=232){let s=(t-232)*10+8;return[s,s,s]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,i=e%6/5*255;return[r,n,i]};ie.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};ie.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let n=parseInt(r,16),i=n>>16&255,s=n>>8&255,o=n&255;return[i,s,o]};ie.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),o=i-s,a,u;return o<1?a=s/(1-o):a=0,o<=0?u=0:i===e?u=(r-n)/o%6:i===r?u=2+(n-e)/o:u=4+(e-r)/o,u/=6,u%=1,[u*360,o*100,a*100]};ie.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),i=0;return n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};ie.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};ie.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let i=[0,0,0],s=e%1*6,o=s%1,a=1-o,u=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return u=(1-r)*n,[(r*i[0]+u)*255,(r*i[1]+u)*255,(r*i[2]+u)*255]};ie.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};ie.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};ie.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};ie.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,i=n-e,s=0;return i<1&&(s=(n-i)/(1-i)),[t[0],i*100,s*100]};ie.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};ie.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};ie.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};ie.gray.hsl=function(t){return[0,0,t[0]]};ie.gray.hsv=ie.gray.hsl;ie.gray.hwb=function(t){return[0,100,t[0]]};ie.gray.cmyk=function(t){return[0,0,0,t[0]]};ie.gray.lab=function(t){return[t[0],0,0]};ie.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};ie.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var cP=_((V0e,uP)=>{var od=q0();function tQ(){let t={},e=Object.keys(od);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function rQ(t){let e=tQ(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),i=Object.keys(od[n]);for(let s=i.length,o=0;o<s;o++){let a=i[o],u=e[a];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(a))}}return e}function nQ(t,e){return function(r){return e(t(r))}}function iQ(t,e){let r=[e[t].parent,t],n=od[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)r.unshift(e[i].parent),n=nQ(od[e[i].parent][i],n),i=e[i].parent;return n.conversion=r,n}uP.exports=function(t){let e=rQ(t),r={},n=Object.keys(e);for(let i=n.length,s=0;s<i;s++){let o=n[s];e[o].parent!==null&&(r[o]=iQ(o,e))}return r}});var fP=_((z0e,lP)=>{var H0=q0(),sQ=cP(),xa={},oQ=Object.keys(H0);function aQ(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function uQ(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let i=t(r);if(typeof i=="object")for(let s=i.length,o=0;o<s;o++)i[o]=Math.round(i[o]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}oQ.forEach(t=>{xa[t]={},Object.defineProperty(xa[t],"channels",{value:H0[t].channels}),Object.defineProperty(xa[t],"labels",{value:H0[t].labels});let e=sQ(t);Object.keys(e).forEach(n=>{let i=e[n];xa[t][n]=uQ(i),xa[t][n].raw=aQ(i)})});lP.exports=xa});var z0=_((K0e,gP)=>{"use strict";var hP=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,dP=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},pP=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},ad=t=>t,mP=(t,e,r)=>[t,e,r],Ta=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},V0,Ia=(t,e,r,n)=>{V0===void 0&&(V0=fP());let i=n?10:0,s={};for(let[o,a]of Object.entries(V0)){let u=o==="ansi16"?"ansi":o;o===e?s[u]=t(r,i):typeof a=="object"&&(s[u]=t(a[e],i))}return s};function cQ(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[i,s]of Object.entries(n))e[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[i]=e[i],t.set(s[0],s[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Ta(e.color,"ansi",()=>Ia(hP,"ansi16",ad,!1)),Ta(e.color,"ansi256",()=>Ia(dP,"ansi256",ad,!1)),Ta(e.color,"ansi16m",()=>Ia(pP,"rgb",mP,!1)),Ta(e.bgColor,"ansi",()=>Ia(hP,"ansi16",ad,!0)),Ta(e.bgColor,"ansi256",()=>Ia(dP,"ansi256",ad,!0)),Ta(e.bgColor,"ansi16m",()=>Ia(pP,"rgb",mP,!0)),e}Object.defineProperty(gP,"exports",{enumerable:!0,get:cQ})});var EP=_((G0e,vP)=>{"use strict";var lQ=U0(),fQ=nP(),yP=z0(),wP=["\x1B","\x9B"],ud=t=>`${wP[0]}[${t}m`,DP=(t,e,r)=>{let n=[];t=[...t];for(let i of t){let s=i;i.includes(";")&&(i=i.split(";")[0][0]+"0");let o=yP.codes.get(Number.parseInt(i,10));if(o){let a=t.indexOf(o.toString());a===-1?n.push(ud(e?o:s)):t.splice(a,1)}else if(e){n.push(ud(0));break}else n.push(ud(s))}if(e&&(n=n.filter((i,s)=>n.indexOf(i)===s),r!==void 0)){let i=ud(yP.codes.get(Number.parseInt(r,10)));n=n.reduce((s,o)=>o===i?[o,...s]:[...s,o],[])}return n.join("")};vP.exports=(t,e,r)=>{let n=[...t],i=[],s=typeof r=="number"?r:n.length,o=!1,a,u=0,c="";for(let[l,h]of n.entries()){let d=!1;if(wP.includes(h)){let f=/\d[^m]*/.exec(t.slice(l,l+18));a=f&&f.length>0?f[0]:void 0,u<s&&(o=!0,a!==void 0&&i.push(a))}else o&&h==="m"&&(o=!1,d=!0);if(!o&&!d&&u++,!fQ({exact:!0}).test(h)&&lQ(h.codePointAt())&&(u++,typeof r!="number"&&s++),u>e&&u<=s)c+=h;else if(u===e&&!o&&a!==void 0)c=DP(i);else if(u>=s){c+=DP(i,!0,a);break}}return c}});var _P=_((W0e,bP)=>{"use strict";bP.exports=({onlyFirst:t=!1}={})=>{let e=["[\\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(e,t?void 0:"g")}});var cd=_((X0e,CP)=>{"use strict";var hQ=_P();CP.exports=t=>typeof t=="string"?t.replace(hQ(),""):t});var AP=_((Y0e,SP)=>{"use strict";SP.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var G0=_((J0e,K0)=>{"use strict";var dQ=cd(),pQ=U0(),mQ=AP(),OP=t=>{if(typeof t!="string"||t.length===0||(t=dQ(t),t.length===0))return 0;t=t.replace(mQ()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=pQ(n)?2:1)}return e};K0.exports=OP;K0.exports.default=OP});var RP=_((Z0e,FP)=>{"use strict";var Ec=G0(),gQ=cd(),yQ=z0(),ld=new Set(["\x1B","\x9B"]),DQ=39,X0="\x07",IP="[",wQ="]",PP="m",Y0=`${wQ}8;;`,xP=t=>`${ld.values().next().value}${IP}${t}${PP}`,TP=t=>`${ld.values().next().value}${Y0}${t}${X0}`,vQ=t=>t.split(" ").map(e=>Ec(e)),W0=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=Ec(gQ(t[t.length-1]));for(let[a,u]of n.entries()){let c=Ec(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),ld.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(Y0)),i){s?u===X0&&(i=!1,s=!1):u===PP&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},EQ=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Ec(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},bQ=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=vQ(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=Ec(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),W0(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){W0(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){W0(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(EQ));let u=[...a.join(`
70
70
  `)];for(let[c,l]of u.entries()){if(n+=l,ld.has(l)){let{groups:d}=new RegExp(`(?:\\${IP}(?<code>\\d+)m|\\${Y0}(?<uri>.*)${X0})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===DQ?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=yQ.codes.get(Number(i));u[c+1]===`
71
71
  `?(s&&(n+=TP("")),i&&h&&(n+=xP(h))):l===`
72
72
  `&&(i&&h&&(n+=xP(i)),s&&(n+=TP(s)))}return n};FP.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
73
73
  `).split(`
74
74
  `).map(n=>bQ(n,e,r)).join(`
75
- `)});var $P=_((Q0e,NP)=>{"use strict";var _Q=require("os"),kP=_Q.homedir();NP.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return kP?t.replace(/^~(?=$|\/|\\)/,kP):t}});var qP=_(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.columnar=mt.generateFillSpaceStringList=mt.expandPath=mt.prettyPath=mt.wordWrap=mt.indent=mt.TTY_WIDTH=mt.stripAnsi=mt.stringWidth=mt.sliceAnsi=void 0;var LP=(he(),ce(fe)),CQ=LP.__importStar(require("os")),si=LP.__importStar(require("path")),BP=EP();mt.sliceAnsi=BP;var fd=G0();mt.stringWidth=fd;var SQ=cd();mt.stripAnsi=SQ;var AQ=RP(),OQ=$P(),xQ=80,TQ=120;mt.TTY_WIDTH=process.stdout.columns?Math.max(xQ,Math.min(process.stdout.columns,TQ)):1/0;function jP(t=4){return" ".repeat(t)}mt.indent=jP;function IQ(t,{width:e=mt.TTY_WIDTH,indentation:r=0,append:n=""}){return AQ(t,e-r-n.length,{trim:!0}).split(`
75
+ `)});var $P=_((Q0e,NP)=>{"use strict";var _Q=require("os"),kP=_Q.homedir();NP.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return kP?t.replace(/^~(?=$|\/|\\)/,kP):t}});var qP=_(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.columnar=mt.generateFillSpaceStringList=mt.expandPath=mt.prettyPath=mt.wordWrap=mt.indent=mt.TTY_WIDTH=mt.stripAnsi=mt.stringWidth=mt.sliceAnsi=void 0;var LP=(he(),ce(fe)),CQ=LP.__importStar(require("os")),oi=LP.__importStar(require("path")),BP=EP();mt.sliceAnsi=BP;var fd=G0();mt.stringWidth=fd;var SQ=cd();mt.stripAnsi=SQ;var AQ=RP(),OQ=$P(),xQ=80,TQ=120;mt.TTY_WIDTH=process.stdout.columns?Math.max(xQ,Math.min(process.stdout.columns,TQ)):1/0;function jP(t=4){return" ".repeat(t)}mt.indent=jP;function IQ(t,{width:e=mt.TTY_WIDTH,indentation:r=0,append:n=""}){return AQ(t,e-r-n.length,{trim:!0}).split(`
76
76
  `).join(`${n}
77
- ${jP(r)}`)}mt.wordWrap=IQ;function PQ(t){t=MP(t);let e=process.cwd(),r=si.dirname(t),n=CQ.homedir(),i=Math.abs(r.split(si.sep).length-e.split(si.sep).length);if(e===r)return"."+si.sep+si.basename(t);if(r.startsWith(e))return"."+si.sep+t.substring(e.length+1);if(i<=2){let s=si.relative(e,t);return s||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+si.sep+t.substring(n.length+1)}return t}mt.prettyPath=PQ;function MP(t){return si.resolve(OQ(t))}mt.expandPath=MP;function UP(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(o=>fd(o))),i=n>e?n+1:e,s=r.repeat(i);return t.map(o=>BP(s,0,i-fd(o)))}mt.generateFillSpaceStringList=UP;function FQ(t,{hsep:e="-",vsep:r="|",headers:n}){let i=!!n;if(!t[0])return"";let s=n?n.length:t[0].length,o=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let h=0,d=l.map(f=>{let m=f.split(`
77
+ ${jP(r)}`)}mt.wordWrap=IQ;function PQ(t){t=MP(t);let e=process.cwd(),r=oi.dirname(t),n=CQ.homedir(),i=Math.abs(r.split(oi.sep).length-e.split(oi.sep).length);if(e===r)return"."+oi.sep+oi.basename(t);if(r.startsWith(e))return"."+oi.sep+t.substring(e.length+1);if(i<=2){let s=oi.relative(e,t);return s||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+oi.sep+t.substring(n.length+1)}return t}mt.prettyPath=PQ;function MP(t){return oi.resolve(OQ(t))}mt.expandPath=MP;function UP(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(o=>fd(o))),i=n>e?n+1:e,s=r.repeat(i);return t.map(o=>BP(s,0,i-fd(o)))}mt.generateFillSpaceStringList=UP;function FQ(t,{hsep:e="-",vsep:r="|",headers:n}){let i=!!n;if(!t[0])return"";let s=n?n.length:t[0].length,o=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let h=0,d=l.map(f=>{let m=f.split(`
78
78
  `);return h=Math.max(h,m.length),m});for(let f in l)o[f]&&o[f].push(...d[f],...Array(h-d[f].length).fill(""))}let a=o.map((l,h)=>{if(h<s-1){let d=UP(l);return l.map((f,m)=>`${f}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=a.reduce((l,h)=>l.map((d,f)=>{let m=l[f]+h[f];return u=Math.max(u,fd(m)),m}));return i&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
79
79
  `)}mt.columnar=FQ});var HP=_(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.TERMINAL_INFO=Wr.CI_ENVIRONMENT_VARIABLES_DETECTED=Wr.CI_ENVIRONMENT_VARIABLES=void 0;var RQ=(he(),ce(fe)),kQ=Zh(),NQ=RQ.__importStar(require("os")),$Q=(0,kQ.debug)("ionic:utils-terminal:info");Wr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];Wr.CI_ENVIRONMENT_VARIABLES_DETECTED=Wr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function LQ(){let{shell:t}=NQ.userInfo();return t||(process.env.SHELL?process.env.SHELL:process.platform==="darwin"?"/bin/bash":process.platform==="win32"?process.env.COMSPEC?process.env.COMSPEC:"cmd.exe":"/bin/sh")}Wr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&$Q(`Environment variables for CI detected: ${Wr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);Wr.TERMINAL_INFO=Object.freeze({ci:Wr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:LQ(),tty:!!(process.stdin.isTTY&&process.stdout.isTTY&&process.stderr.isTTY),windows:process.platform==="win32"||!!(process.env.OSTYPE&&/^(msys|cygwin)$/.test(process.env.OSTYPE)||process.env.MSYSTEM&&/^MINGW(32|64)$/.test(process.env.MSYSTEM))})});var zi=_(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var hd=(he(),ce(fe));hd.__exportStar(j0(),Pa);hd.__exportStar(QI(),Pa);hd.__exportStar(qP(),Pa);hd.__exportStar(HP(),Pa)});var pd=_(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.isFatal=xn.fatal=xn.FatalException=xn.BaseException=void 0;var dd=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};xn.BaseException=dd;var bc=class extends dd{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};xn.FatalException=bc;function BQ(t){throw new bc(t)}xn.fatal=BQ;function jQ(t){return t&&t instanceof bc}xn.isFatal=jQ});var md=_(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.formatHrTime=Tn.dropWhile=Tn.enforceLF=Tn.identity=void 0;function MQ(t){return t}Tn.identity=MQ;function UQ(t){return t.match(/[\r\n]$/)?t:t+`
80
80
  `}Tn.enforceLF=UQ;function qQ(t,e=r=>!!r){let r=!1;return t.filter(n=>r?!0:e(n)?!1:(r=!0,!0))}Tn.dropWhile=qQ;var VP=["s","ms","\u03BCs"];function HQ(t){let e=t[0]+t[1]/1e9,r=0;for(;r<VP.length-1&&!(e>=1);r++,e*=1e3);return e.toFixed(2)+VP[r]}Tn.formatHrTime=HQ});var _c=_(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.NO_COLORS=void 0;var In=md();gd.NO_COLORS=Object.freeze({strong:In.identity,weak:In.identity,input:In.identity,success:In.identity,failure:In.identity,ancillary:In.identity,log:Object.freeze({DEBUG:In.identity,INFO:In.identity,WARN:In.identity,ERROR:In.identity})})});var ew=_(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.createPrefixedFormatter=Se.createTaggedFormatter=Se.Logger=Se.DEFAULT_LOGGER_HANDLERS=Se.StreamHandler=Se.getLoggerLevelColor=Se.getLoggerLevelName=Se.LOGGER_LEVEL_NAMES=Se.LOGGER_LEVELS=void 0;var VQ=(he(),ce(fe)),zP=zi(),zQ=require("stream"),KQ=VQ.__importStar(require("util")),GQ=_c(),KP=md();Se.LOGGER_LEVELS=Object.freeze({DEBUG:10,INFO:20,WARN:30,ERROR:40});Se.LOGGER_LEVEL_NAMES=new Map([[Se.LOGGER_LEVELS.DEBUG,"DEBUG"],[Se.LOGGER_LEVELS.INFO,"INFO"],[Se.LOGGER_LEVELS.WARN,"WARN"],[Se.LOGGER_LEVELS.ERROR,"ERROR"]]);function Q0(t){if(t){let e=Se.LOGGER_LEVEL_NAMES.get(t);if(e)return e}}Se.getLoggerLevelName=Q0;function J0(t,e){let r=Q0(e);if(r)return t.log[r]}Se.getLoggerLevelColor=J0;var Cc=class t{constructor({stream:e,filter:r,formatter:n}){this.stream=e,this.filter=r,this.formatter=n}clone(e){let{stream:r,filter:n,formatter:i}=this;return new t({stream:r,filter:n,formatter:i,...e})}handle(e){if(this.filter&&!this.filter(e))return;let r=this.formatter&&e.format!==!1?this.formatter(e):e.msg;this.stream.write((0,KP.enforceLF)(r))}};Se.StreamHandler=Cc;var WQ=t=>!t.level||t.level===Se.LOGGER_LEVELS.INFO,XQ=t=>!!t.level&&t.level!==Se.LOGGER_LEVELS.INFO;Se.DEFAULT_LOGGER_HANDLERS=new Set([new Cc({stream:process.stdout,filter:WQ}),new Cc({stream:process.stderr,filter:XQ})]);var Z0=class t{constructor({level:e=Se.LOGGER_LEVELS.INFO,handlers:r}={}){this.level=e,this.handlers=r||t.cloneHandlers(Se.DEFAULT_LOGGER_HANDLERS)}static cloneHandlers(e){return new Set([...e].map(r=>r.clone()))}clone(e={}){let{level:r,handlers:n}=this;return new t({level:r,handlers:t.cloneHandlers(n),...e})}msg(e){this.log(this.createRecord(e))}debug(e){this.log(this.createRecord(e,Se.LOGGER_LEVELS.DEBUG))}info(e){this.log(this.createRecord(e,Se.LOGGER_LEVELS.INFO))}warn(e){this.log(this.createRecord(e,Se.LOGGER_LEVELS.WARN))}error(e){this.log(this.createRecord(e,Se.LOGGER_LEVELS.ERROR))}createRecord(e,r,n){return{msg:KQ.format(e),level:r,logger:this,format:n}}nl(e=1,r){this.log({...this.createRecord(`
@@ -90,26 +90,26 @@ ${jP(r)}`)}mt.wordWrap=IQ;function PQ(t){t=MP(t);let e=process.cwd(),r=si.dirnam
90
90
  Run the command with ${nee.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Xs.checkInteractive=see;var oee=()=>YP.TERMINAL_INFO.tty&&!YP.TERMINAL_INFO.ci;Xs.isInteractive=oee});var gt=_((hwe,QP)=>{"use strict";var{FORCE_COLOR:aee,NODE_DISABLE_COLORS:uee,TERM:cee}=process.env,Be={enabled:!uee&&cee!=="dumb"&&aee!=="0",reset:Je(0,0),bold:Je(1,22),dim:Je(2,22),italic:Je(3,23),underline:Je(4,24),inverse:Je(7,27),hidden:Je(8,28),strikethrough:Je(9,29),black:Je(30,39),red:Je(31,39),green:Je(32,39),yellow:Je(33,39),blue:Je(34,39),magenta:Je(35,39),cyan:Je(36,39),white:Je(37,39),gray:Je(90,39),grey:Je(90,39),bgBlack:Je(40,49),bgRed:Je(41,49),bgGreen:Je(42,49),bgYellow:Je(43,49),bgBlue:Je(44,49),bgMagenta:Je(45,49),bgCyan:Je(46,49),bgWhite:Je(47,49)};function ZP(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,e.includes(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function lee(t,e){let r={has:t,keys:e};return r.reset=Be.reset.bind(r),r.bold=Be.bold.bind(r),r.dim=Be.dim.bind(r),r.italic=Be.italic.bind(r),r.underline=Be.underline.bind(r),r.inverse=Be.inverse.bind(r),r.hidden=Be.hidden.bind(r),r.strikethrough=Be.strikethrough.bind(r),r.black=Be.black.bind(r),r.red=Be.red.bind(r),r.green=Be.green.bind(r),r.yellow=Be.yellow.bind(r),r.blue=Be.blue.bind(r),r.magenta=Be.magenta.bind(r),r.cyan=Be.cyan.bind(r),r.white=Be.white.bind(r),r.gray=Be.gray.bind(r),r.grey=Be.grey.bind(r),r.bgBlack=Be.bgBlack.bind(r),r.bgRed=Be.bgRed.bind(r),r.bgGreen=Be.bgGreen.bind(r),r.bgYellow=Be.bgYellow.bind(r),r.bgBlue=Be.bgBlue.bind(r),r.bgMagenta=Be.bgMagenta.bind(r),r.bgCyan=Be.bgCyan.bind(r),r.bgWhite=Be.bgWhite.bind(r),r}function Je(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(this.has.includes(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Be.enabled?ZP(this.keys,n+""):n+""):n===void 0?lee([t],[r]):Be.enabled?ZP([r],n+""):n+""}}QP.exports=Be});var tF=_((dwe,eF)=>{"use strict";eF.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var bd=_((pwe,rF)=>{"use strict";rF.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var aF=_((mwe,oF)=>{"use strict";function fee(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=hee(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
91
91
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function hee(t,e){if(t){if(typeof t=="string")return nF(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nF(t,e)}}function nF(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var dee=bd(),sF=Ze(),iF=sF.erase,pee=sF.cursor,mee=t=>[...dee(t)].length;oF.exports=function(t,e){if(!e)return iF.line+pee.to(0);let r=0,n=t.split(/\r?\n/);var i=fee(n),s;try{for(i.s();!(s=i.n()).done;){let o=s.value;r+=1+Math.floor(Math.max(mee(o)-1,0)/e)}}catch(o){i.e(o)}finally{i.f()}return iF.lines(r)}});var cw=_((gwe,uF)=>{"use strict";var Ac={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},gee={arrowUp:Ac.arrowUp,arrowDown:Ac.arrowDown,arrowLeft:Ac.arrowLeft,arrowRight:Ac.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},yee=process.platform==="win32"?gee:Ac;uF.exports=yee});var lF=_((ywe,cF)=>{"use strict";var Ra=gt(),Ys=cw(),lw=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),Dee=t=>lw[t]||lw.default,Oc=Object.freeze({aborted:Ra.red(Ys.cross),done:Ra.green(Ys.tick),exited:Ra.yellow(Ys.cross),default:Ra.cyan("?")}),wee=(t,e,r)=>e?Oc.aborted:r?Oc.exited:t?Oc.done:Oc.default,vee=t=>Ra.gray(t?Ys.ellipsis:Ys.pointerSmall),Eee=(t,e)=>Ra.gray(t?e?Ys.pointerSmall:"+":Ys.line);cF.exports={styles:lw,render:Dee,symbols:Oc,symbol:wee,delimiter:vee,item:Eee}});var hF=_((Dwe,fF)=>{"use strict";var bee=bd();fF.exports=function(t,e){let r=String(bee(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var pF=_((wwe,dF)=>{"use strict";dF.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(i=>i.split(/\s+/g).reduce((s,o)=>(o.length+r.length>=n||s[s.length-1].length+o.length+1<n?s[s.length-1]+=` ${o}`:s.push(`${r}${o}`),s),[r]).join(`
92
92
  `)).join(`
93
- `)}});var gF=_((vwe,mF)=>{"use strict";mF.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let i=Math.min(n+r,e);return{startIndex:n,endIndex:i}}});var fn=_((Ewe,yF)=>{"use strict";yF.exports={action:tF(),clear:aF(),style:lF(),strip:bd(),figures:cw(),lines:hF(),wrap:pF(),entriesToDisplay:gF()}});var oi=_((bwe,vF)=>{"use strict";var DF=require("readline"),_ee=fn(),Cee=_ee.action,See=require("events"),wF=Ze(),Aee=wF.beep,Oee=wF.cursor,xee=gt(),fw=class extends See{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=DF.createInterface({input:this.in,escapeCodeTimeout:50});DF.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,i=(s,o)=>{let a=Cee(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(Oee.show),this.in.removeListener("keypress",i),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",i)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Aee)}render(){this.onRender(xee),this.firstRender&&(this.firstRender=!1)}};vF.exports=fw});var SF=_((_we,CF)=>{"use strict";function EF(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function bF(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){EF(s,n,i,o,a,"next",u)}function a(u){EF(s,n,i,o,a,"throw",u)}o(void 0)})}}var _d=gt(),Tee=oi(),_F=Ze(),Iee=_F.erase,xc=_F.cursor,Cd=fn(),hw=Cd.style,dw=Cd.clear,Pee=Cd.lines,Fee=Cd.figures,pw=class extends Tee{constructor(e={}){super(e),this.transform=hw.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=dw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=_d.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
93
+ `)}});var gF=_((vwe,mF)=>{"use strict";mF.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let i=Math.min(n+r,e);return{startIndex:n,endIndex:i}}});var dn=_((Ewe,yF)=>{"use strict";yF.exports={action:tF(),clear:aF(),style:lF(),strip:bd(),figures:cw(),lines:hF(),wrap:pF(),entriesToDisplay:gF()}});var ai=_((bwe,vF)=>{"use strict";var DF=require("readline"),_ee=dn(),Cee=_ee.action,See=require("events"),wF=Ze(),Aee=wF.beep,Oee=wF.cursor,xee=gt(),fw=class extends See{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=DF.createInterface({input:this.in,escapeCodeTimeout:50});DF.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,i=(s,o)=>{let a=Cee(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(Oee.show),this.in.removeListener("keypress",i),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",i)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Aee)}render(){this.onRender(xee),this.firstRender&&(this.firstRender=!1)}};vF.exports=fw});var SF=_((_we,CF)=>{"use strict";function EF(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function bF(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){EF(s,n,i,o,a,"next",u)}function a(u){EF(s,n,i,o,a,"throw",u)}o(void 0)})}}var _d=gt(),Tee=ai(),_F=Ze(),Iee=_F.erase,xc=_F.cursor,Cd=dn(),hw=Cd.style,dw=Cd.clear,Pee=Cd.lines,Fee=Cd.figures,pw=class extends Tee{constructor(e={}){super(e),this.transform=hw.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=dw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=_d.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
94
94
  `),this.close()}validate(){var e=this;return bF(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return bF(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
95
95
  `),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.value=`${n}${e}${i}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(xc.down(Pee(this.outputError,this.out.columns)-1)+dw(this.outputError,this.out.columns)),this.out.write(dw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[hw.symbol(this.done,this.aborted),_d.bold(this.msg),hw.delimiter(this.done),this.red?_d.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
96
96
  `).reduce((e,r,n)=>e+`
97
- ${n?" ":Fee.pointerSmall} ${_d.red().italic(r)}`,"")),this.out.write(Iee.line+xc.to(0)+this.outputText+xc.save+this.outputError+xc.restore+xc.move(this.cursorOffset,0)))}};CF.exports=pw});var TF=_((Cwe,xF)=>{"use strict";var ai=gt(),Ree=oi(),Tc=fn(),AF=Tc.style,OF=Tc.clear,Sd=Tc.figures,kee=Tc.wrap,Nee=Tc.entriesToDisplay,$ee=Ze(),Lee=$ee.cursor,mw=class extends Ree{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=OF("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
97
+ ${n?" ":Fee.pointerSmall} ${_d.red().italic(r)}`,"")),this.out.write(Iee.line+xc.to(0)+this.outputText+xc.save+this.outputError+xc.restore+xc.move(this.cursorOffset,0)))}};CF.exports=pw});var TF=_((Cwe,xF)=>{"use strict";var ui=gt(),Ree=ai(),Tc=dn(),AF=Tc.style,OF=Tc.clear,Sd=Tc.figures,kee=Tc.wrap,Nee=Tc.entriesToDisplay,$ee=Ze(),Lee=$ee.cursor,mw=class extends Ree{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=OF("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
98
98
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
99
- `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Lee.hide):this.out.write(OF(this.outputText,this.out.columns)),super.render();let e=Nee(this.cursor,this.choices.length,this.optionsPerPage),r=e.startIndex,n=e.endIndex;if(this.outputText=[AF.symbol(this.done,this.aborted),ai.bold(this.msg),AF.delimiter(!1),this.done?this.selection.title:this.selection.disabled?ai.yellow(this.warn):ai.gray(this.hint)].join(" "),!this.done){this.outputText+=`
100
- `;for(let i=r;i<n;i++){let s,o,a="",u=this.choices[i];i===r&&r>0?o=Sd.arrowUp:i===n-1&&n<this.choices.length?o=Sd.arrowDown:o=" ",u.disabled?(s=this.cursor===i?ai.gray().underline(u.title):ai.strikethrough().gray(u.title),o=(this.cursor===i?ai.bold().gray(Sd.pointer)+" ":" ")+o):(s=this.cursor===i?ai.cyan().underline(u.title):u.title,o=(this.cursor===i?ai.cyan(Sd.pointer)+" ":" ")+o,u.description&&this.cursor===i&&(a=` - ${u.description}`,(o.length+s.length+a.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(a=`
101
- `+kee(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${s}${ai.gray(a)}
102
- `}}this.out.write(this.outputText)}};xF.exports=mw});var NF=_((Swe,kF)=>{"use strict";var Ad=gt(),Bee=oi(),FF=fn(),IF=FF.style,jee=FF.clear,RF=Ze(),PF=RF.cursor,Mee=RF.erase,gw=class extends Bee{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
99
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Lee.hide):this.out.write(OF(this.outputText,this.out.columns)),super.render();let e=Nee(this.cursor,this.choices.length,this.optionsPerPage),r=e.startIndex,n=e.endIndex;if(this.outputText=[AF.symbol(this.done,this.aborted),ui.bold(this.msg),AF.delimiter(!1),this.done?this.selection.title:this.selection.disabled?ui.yellow(this.warn):ui.gray(this.hint)].join(" "),!this.done){this.outputText+=`
100
+ `;for(let i=r;i<n;i++){let s,o,a="",u=this.choices[i];i===r&&r>0?o=Sd.arrowUp:i===n-1&&n<this.choices.length?o=Sd.arrowDown:o=" ",u.disabled?(s=this.cursor===i?ui.gray().underline(u.title):ui.strikethrough().gray(u.title),o=(this.cursor===i?ui.bold().gray(Sd.pointer)+" ":" ")+o):(s=this.cursor===i?ui.cyan().underline(u.title):u.title,o=(this.cursor===i?ui.cyan(Sd.pointer)+" ":" ")+o,u.description&&this.cursor===i&&(a=` - ${u.description}`,(o.length+s.length+a.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(a=`
101
+ `+kee(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${s}${ui.gray(a)}
102
+ `}}this.out.write(this.outputText)}};xF.exports=mw});var NF=_((Swe,kF)=>{"use strict";var Ad=gt(),Bee=ai(),FF=dn(),IF=FF.style,jee=FF.clear,RF=Ze(),PF=RF.cursor,Mee=RF.erase,gw=class extends Bee{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
103
103
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
104
- `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(PF.hide):this.out.write(jee(this.outputText,this.out.columns)),super.render(),this.outputText=[IF.symbol(this.done,this.aborted),Ad.bold(this.msg),IF.delimiter(this.done),this.value?this.inactive:Ad.cyan().underline(this.inactive),Ad.gray("/"),this.value?Ad.cyan().underline(this.active):this.active].join(" "),this.out.write(Mee.line+PF.to(0)+this.outputText))}};kF.exports=gw});var Pn=_((Awe,$F)=>{"use strict";var yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};$F.exports=yw});var BF=_((Owe,LF)=>{"use strict";var Uee=Pn(),Dw=class extends Uee{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};LF.exports=Dw});var MF=_((xwe,jF)=>{"use strict";var qee=Pn(),Hee=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),ww=class extends qee{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Hee(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};jF.exports=ww});var qF=_((Twe,UF)=>{"use strict";var Vee=Pn(),vw=class extends Vee{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};UF.exports=vw});var VF=_((Iwe,HF)=>{"use strict";var zee=Pn(),Ew=class extends zee{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};HF.exports=Ew});var KF=_((Pwe,zF)=>{"use strict";var Kee=Pn(),bw=class extends Kee{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};zF.exports=bw});var WF=_((Fwe,GF)=>{"use strict";var Gee=Pn(),_w=class extends Gee{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};GF.exports=_w});var YF=_((Rwe,XF)=>{"use strict";var Wee=Pn(),Cw=class extends Wee{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};XF.exports=Cw});var ZF=_((kwe,JF)=>{"use strict";var Xee=Pn(),Sw=class extends Xee{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};JF.exports=Sw});var eR=_((Nwe,QF)=>{"use strict";QF.exports={DatePart:Pn(),Meridiem:BF(),Day:MF(),Hours:qF(),Milliseconds:VF(),Minutes:KF(),Month:WF(),Seconds:YF(),Year:ZF()}});var lR=_(($we,cR)=>{"use strict";function tR(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function rR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){tR(s,n,i,o,a,"next",u)}function a(u){tR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Aw=gt(),Yee=oi(),xw=fn(),nR=xw.style,iR=xw.clear,Jee=xw.figures,uR=Ze(),Zee=uR.erase,sR=uR.cursor,ui=eR(),oR=ui.DatePart,Qee=ui.Meridiem,ete=ui.Day,tte=ui.Hours,rte=ui.Milliseconds,nte=ui.Minutes,ite=ui.Month,ste=ui.Seconds,ote=ui.Year,ate=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,aR={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new ete(t),3:t=>new ite(t),4:t=>new ote(t),5:t=>new Qee(t),6:t=>new tte(t),7:t=>new nte(t),8:t=>new ste(t),9:t=>new rte(t)},ute={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Ow=class extends Yee{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(ute,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=iR("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=ate.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in aR?aR[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof oR)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
104
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(PF.hide):this.out.write(jee(this.outputText,this.out.columns)),super.render(),this.outputText=[IF.symbol(this.done,this.aborted),Ad.bold(this.msg),IF.delimiter(this.done),this.value?this.inactive:Ad.cyan().underline(this.inactive),Ad.gray("/"),this.value?Ad.cyan().underline(this.active):this.active].join(" "),this.out.write(Mee.line+PF.to(0)+this.outputText))}};kF.exports=gw});var Pn=_((Awe,$F)=>{"use strict";var yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};$F.exports=yw});var BF=_((Owe,LF)=>{"use strict";var Uee=Pn(),Dw=class extends Uee{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};LF.exports=Dw});var MF=_((xwe,jF)=>{"use strict";var qee=Pn(),Hee=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),ww=class extends qee{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Hee(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};jF.exports=ww});var qF=_((Twe,UF)=>{"use strict";var Vee=Pn(),vw=class extends Vee{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};UF.exports=vw});var VF=_((Iwe,HF)=>{"use strict";var zee=Pn(),Ew=class extends zee{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};HF.exports=Ew});var KF=_((Pwe,zF)=>{"use strict";var Kee=Pn(),bw=class extends Kee{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};zF.exports=bw});var WF=_((Fwe,GF)=>{"use strict";var Gee=Pn(),_w=class extends Gee{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};GF.exports=_w});var YF=_((Rwe,XF)=>{"use strict";var Wee=Pn(),Cw=class extends Wee{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};XF.exports=Cw});var ZF=_((kwe,JF)=>{"use strict";var Xee=Pn(),Sw=class extends Xee{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};JF.exports=Sw});var eR=_((Nwe,QF)=>{"use strict";QF.exports={DatePart:Pn(),Meridiem:BF(),Day:MF(),Hours:qF(),Milliseconds:VF(),Minutes:KF(),Month:WF(),Seconds:YF(),Year:ZF()}});var lR=_(($we,cR)=>{"use strict";function tR(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function rR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){tR(s,n,i,o,a,"next",u)}function a(u){tR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Aw=gt(),Yee=ai(),xw=dn(),nR=xw.style,iR=xw.clear,Jee=xw.figures,uR=Ze(),Zee=uR.erase,sR=uR.cursor,ci=eR(),oR=ci.DatePart,Qee=ci.Meridiem,ete=ci.Day,tte=ci.Hours,rte=ci.Milliseconds,nte=ci.Minutes,ite=ci.Month,ste=ci.Seconds,ote=ci.Year,ate=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,aR={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new ete(t),3:t=>new ite(t),4:t=>new ote(t),5:t=>new Qee(t),6:t=>new tte(t),7:t=>new nte(t),8:t=>new ste(t),9:t=>new rte(t)},ute={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Ow=class extends Yee{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(ute,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=iR("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=ate.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in aR?aR[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof oR)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
105
105
  `),this.close()}validate(){var e=this;return rR(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return rR(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
106
106
  `),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof oR)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(sR.hide):this.out.write(iR(this.outputText,this.out.columns)),super.render(),this.outputText=[nR.symbol(this.done,this.aborted),Aw.bold(this.msg),nR.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?Aw.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
107
107
  `).reduce((e,r,n)=>e+`
108
- ${n?" ":Jee.pointerSmall} ${Aw.red().italic(r)}`,"")),this.out.write(Zee.line+sR.to(0)+this.outputText))}};cR.exports=Ow});var yR=_((Lwe,gR)=>{"use strict";function fR(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function hR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){fR(s,n,i,o,a,"next",u)}function a(u){fR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Od=gt(),cte=oi(),mR=Ze(),xd=mR.cursor,lte=mR.erase,Td=fn(),Tw=Td.style,fte=Td.figures,dR=Td.clear,hte=Td.lines,dte=/[0-9]/,Iw=t=>t!==void 0,pR=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},Pw=class extends cte{constructor(e={}){super(e),this.transform=Tw.render(e.style),this.msg=e.message,this.initial=Iw(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Iw(e.min)?e.min:-1/0,this.max=Iw(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Od.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${pR(e,this.round)}`),this._value=pR(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||dte.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
108
+ ${n?" ":Jee.pointerSmall} ${Aw.red().italic(r)}`,"")),this.out.write(Zee.line+sR.to(0)+this.outputText))}};cR.exports=Ow});var yR=_((Lwe,gR)=>{"use strict";function fR(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function hR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){fR(s,n,i,o,a,"next",u)}function a(u){fR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Od=gt(),cte=ai(),mR=Ze(),xd=mR.cursor,lte=mR.erase,Td=dn(),Tw=Td.style,fte=Td.figures,dR=Td.clear,hte=Td.lines,dte=/[0-9]/,Iw=t=>t!==void 0,pR=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},Pw=class extends cte{constructor(e={}){super(e),this.transform=Tw.render(e.style),this.msg=e.message,this.initial=Iw(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Iw(e.min)?e.min:-1/0,this.max=Iw(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Od.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${pR(e,this.round)}`),this._value=pR(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||dte.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
109
109
  `),this.close()}validate(){var e=this;return hR(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return hR(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let r=e.value;e.value=r!==""?r:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
110
110
  `),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(xd.down(hte(this.outputError,this.out.columns)-1)+dR(this.outputError,this.out.columns)),this.out.write(dR(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Tw.symbol(this.done,this.aborted),Od.bold(this.msg),Tw.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Od[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
111
111
  `).reduce((e,r,n)=>e+`
112
- ${n?" ":fte.pointerSmall} ${Od.red().italic(r)}`,"")),this.out.write(lte.line+xd.to(0)+this.outputText+xd.save+this.outputError+xd.restore))}};gR.exports=Pw});var Rw=_((Bwe,vR)=>{"use strict";var Fn=gt(),pte=Ze(),mte=pte.cursor,gte=oi(),Ic=fn(),DR=Ic.clear,Gi=Ic.figures,wR=Ic.style,yte=Ic.wrap,Dte=Ic.entriesToDisplay,Fw=class extends gte{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=DR("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
112
+ ${n?" ":fte.pointerSmall} ${Od.red().italic(r)}`,"")),this.out.write(lte.line+xd.to(0)+this.outputText+xd.save+this.outputError+xd.restore))}};gR.exports=Pw});var Rw=_((Bwe,vR)=>{"use strict";var Fn=gt(),pte=Ze(),mte=pte.cursor,gte=ai(),Ic=dn(),DR=Ic.clear,Gi=Ic.figures,wR=Ic.style,yte=Ic.wrap,Dte=Ic.entriesToDisplay,Fw=class extends gte{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=DR("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
113
113
  `),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
114
114
  `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
115
115
  Instructions:
@@ -119,45 +119,45 @@ Instructions:
119
119
  `:"")+" enter/return: Complete answer":""}renderOption(e,r,n,i){let s=(r.selected?Fn.green(Gi.radioOn):Gi.radioOff)+" "+i+" ",o,a;return r.disabled?o=e===n?Fn.gray().underline(r.title):Fn.strikethrough().gray(r.title):(o=e===n?Fn.cyan().underline(r.title):r.title,e===n&&r.description&&(a=` - ${r.description}`,(s.length+o.length+a.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(a=`
120
120
  `+yte(r.description,{margin:s.length,width:this.out.columns})))),s+o+Fn.gray(a||"")}paginateOptions(e){if(e.length===0)return Fn.red("No matches for this query.");let r=Dte(this.cursor,e.length,this.optionsPerPage),n=r.startIndex,i=r.endIndex,s,o=[];for(let a=n;a<i;a++)a===n&&n>0?s=Gi.arrowUp:a===i-1&&i<e.length?s=Gi.arrowDown:s=" ",o.push(this.renderOption(this.cursor,e[a],a,s));return`
121
121
  `+o.join(`
122
- `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Fn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Fn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(mte.hide),super.render();let e=[wR.symbol(this.done,this.aborted),Fn.bold(this.msg),wR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Fn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=DR(e,this.out.columns)}};vR.exports=Fw});var OR=_((jwe,AR)=>{"use strict";function ER(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function wte(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){ER(s,n,i,o,a,"next",u)}function a(u){ER(s,n,i,o,a,"throw",u)}o(void 0)})}}var Pc=gt(),vte=oi(),SR=Ze(),Ete=SR.erase,bR=SR.cursor,Fc=fn(),kw=Fc.style,_R=Fc.clear,Nw=Fc.figures,bte=Fc.wrap,_te=Fc.entriesToDisplay,CR=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Cte=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Ste=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},$w=class extends vte{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Ste(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=kw.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=_R("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=CR(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var r=this;return wte(function*(){let n=r.completing=r.suggest(r.input,r.choices),i=yield n;if(r.completing!==n)return;r.suggestions=i.map((o,a,u)=>({title:Cte(u,a),value:CR(u,a),description:o.description})),r.completing=!1;let s=Math.max(i.length-1,0);r.moveSelect(Math.min(s,r.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
122
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Fn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Fn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(mte.hide),super.render();let e=[wR.symbol(this.done,this.aborted),Fn.bold(this.msg),wR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Fn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=DR(e,this.out.columns)}};vR.exports=Fw});var OR=_((jwe,AR)=>{"use strict";function ER(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function wte(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){ER(s,n,i,o,a,"next",u)}function a(u){ER(s,n,i,o,a,"throw",u)}o(void 0)})}}var Pc=gt(),vte=ai(),SR=Ze(),Ete=SR.erase,bR=SR.cursor,Fc=dn(),kw=Fc.style,_R=Fc.clear,Nw=Fc.figures,bte=Fc.wrap,_te=Fc.entriesToDisplay,CR=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Cte=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Ste=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},$w=class extends vte{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Ste(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=kw.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=_R("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=CR(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var r=this;return wte(function*(){let n=r.completing=r.suggest(r.input,r.choices),i=yield n;if(r.completing!==n)return;r.suggestions=i.map((o,a,u)=>({title:Cte(u,a),value:CR(u,a),description:o.description})),r.completing=!1;let s=Math.max(i.length-1,0);r.moveSelect(Math.min(s,r.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
123
123
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
124
124
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
125
125
  `),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor);this.input=`${n}${e}${i}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,i){let s,o=n?Nw.arrowUp:i?Nw.arrowDown:" ",a=r?Pc.cyan().underline(e.title):e.title;return o=(r?Pc.cyan(Nw.pointer)+" ":" ")+o,e.description&&(s=` - ${e.description}`,(o.length+a.length+s.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(s=`
126
126
  `+bte(e.description,{margin:3,width:this.out.columns}))),o+" "+a+Pc.gray(s||"")}render(){if(this.closed)return;this.firstRender?this.out.write(bR.hide):this.out.write(_R(this.outputText,this.out.columns)),super.render();let e=_te(this.select,this.choices.length,this.limit),r=e.startIndex,n=e.endIndex;if(this.outputText=[kw.symbol(this.done,this.aborted,this.exited),Pc.bold(this.msg),kw.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let i=this.suggestions.slice(r,n).map((s,o)=>this.renderOption(s,this.select===o+r,o===0&&r>0,o+r===n-1&&n<this.choices.length)).join(`
127
127
  `);this.outputText+=`
128
- `+(i||Pc.gray(this.fallback.title))}this.out.write(Ete.line+bR.to(0)+this.outputText)}};AR.exports=$w});var PR=_((Mwe,IR)=>{"use strict";var ci=gt(),Ate=Ze(),Ote=Ate.cursor,xte=Rw(),Bw=fn(),xR=Bw.clear,TR=Bw.style,ka=Bw.figures,Lw=class extends xte{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=xR("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
128
+ `+(i||Pc.gray(this.fallback.title))}this.out.write(Ete.line+bR.to(0)+this.outputText)}};AR.exports=$w});var PR=_((Mwe,IR)=>{"use strict";var li=gt(),Ate=Ze(),Ote=Ate.cursor,xte=Rw(),Bw=dn(),xR=Bw.clear,TR=Bw.style,ka=Bw.figures,Lw=class extends xte{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=xR("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
129
129
  Instructions:
130
130
  ${ka.arrowUp}/${ka.arrowDown}: Highlight option
131
131
  ${ka.arrowLeft}/${ka.arrowRight}/[space]: Toggle selection
132
132
  [a,b,c]/delete: Filter choices
133
133
  enter/return: Complete answer
134
134
  `:""}renderCurrentInput(){return`
135
- Filtered results for: ${this.inputValue?this.inputValue:ci.gray("Enter something to filter")}
136
- `}renderOption(e,r,n){let i;return r.disabled?i=e===n?ci.gray().underline(r.title):ci.strikethrough().gray(r.title):i=e===n?ci.cyan().underline(r.title):r.title,(r.selected?ci.green(ka.radioOn):ka.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[ci.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(ci.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ote.hide),super.render();let e=[TR.symbol(this.done,this.aborted),ci.bold(this.msg),TR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=ci.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=xR(e,this.out.columns)}};IR.exports=Lw});var BR=_((Uwe,LR)=>{"use strict";var FR=gt(),Tte=oi(),NR=fn(),RR=NR.style,Ite=NR.clear,$R=Ze(),Pte=$R.erase,kR=$R.cursor,jw=class extends Tte{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
135
+ Filtered results for: ${this.inputValue?this.inputValue:li.gray("Enter something to filter")}
136
+ `}renderOption(e,r,n){let i;return r.disabled?i=e===n?li.gray().underline(r.title):li.strikethrough().gray(r.title):i=e===n?li.cyan().underline(r.title):r.title,(r.selected?li.green(ka.radioOn):ka.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[li.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(li.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ote.hide),super.render();let e=[TR.symbol(this.done,this.aborted),li.bold(this.msg),TR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=li.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=xR(e,this.out.columns)}};IR.exports=Lw});var BR=_((Uwe,LR)=>{"use strict";var FR=gt(),Tte=ai(),NR=dn(),RR=NR.style,Ite=NR.clear,$R=Ze(),Pte=$R.erase,kR=$R.cursor,jw=class extends Tte{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
137
137
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
138
138
  `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(kR.hide):this.out.write(Ite(this.outputText,this.out.columns)),super.render(),this.outputText=[RR.symbol(this.done,this.aborted),FR.bold(this.msg),RR.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:FR.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Pte.line+kR.to(0)+this.outputText))}};LR.exports=jw});var MR=_((qwe,jR)=>{"use strict";jR.exports={TextPrompt:SF(),SelectPrompt:TF(),TogglePrompt:NF(),DatePrompt:lR(),NumberPrompt:yR(),MultiselectPrompt:Rw(),AutocompletePrompt:OR(),AutocompleteMultiselectPrompt:PR(),ConfirmPrompt:BR()}});var qR=_(UR=>{"use strict";var _r=UR,Fte=MR(),Id=t=>t;function Rn(t,e,r={}){return new Promise((n,i)=>{let s=new Fte[t](e),o=r.onAbort||Id,a=r.onSubmit||Id,u=r.onExit||Id;s.on("state",e.onState||Id),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}_r.text=t=>Rn("TextPrompt",t);_r.password=t=>(t.style="password",_r.text(t));_r.invisible=t=>(t.style="invisible",_r.text(t));_r.number=t=>Rn("NumberPrompt",t);_r.date=t=>Rn("DatePrompt",t);_r.confirm=t=>Rn("ConfirmPrompt",t);_r.list=t=>{let e=t.separator||",";return Rn("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};_r.toggle=t=>Rn("TogglePrompt",t);_r.select=t=>Rn("SelectPrompt",t);_r.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return Rn("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};_r.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return Rn("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var Rte=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));_r.autocomplete=t=>(t.suggest=t.suggest||Rte,t.choices=[].concat(t.choices||[]),Rn("AutocompletePrompt",t))});var YR=_((Vwe,XR)=>{"use strict";function HR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function VR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?HR(Object(r),!0).forEach(function(n){kte(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):HR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function kte(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nte(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=$te(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
139
139
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function $te(t,e){if(t){if(typeof t=="string")return zR(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zR(t,e)}}function zR(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function KR(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function GR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){KR(s,n,i,o,a,"next",u)}function a(u){KR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Mw=qR(),Lte=["suggest","format","onState","validate","onRender","type"],WR=()=>{};function Wi(){return Uw.apply(this,arguments)}function Uw(){return Uw=GR(function*(t=[],{onSubmit:e=WR,onCancel:r=WR}={}){let n={},i=Wi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=(function(){var v=GR(function*(E,A,p=!1){if(!(!p&&E.validate&&E.validate(A)!==!0))return E.format?yield E.format(A,n):A});return function(A,p){return v.apply(this,arguments)}})();var d=Nte(t),f;try{for(d.s();!(f=d.n()).done;){o=f.value;var m=o;if(u=m.name,c=m.type,typeof c=="function"&&(c=yield c(s,VR({},n),o),o.type=c),!!c){for(let v in o){if(Lte.includes(v))continue;let E=o[v];o[v]=typeof E=="function"?yield E(s,VR({},n),l):E}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");var y=o;if(u=y.name,c=y.type,Mw[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=yield h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=Wi._injected?Bte(Wi._injected,o.initial):yield Mw[c](o),n[u]=s=yield h(o,s,!0),a=yield e(o,s,n)}catch{a=!(yield r(o,n))}if(a)return n}}}catch(v){d.e(v)}finally{d.f()}return n}),Uw.apply(this,arguments)}function Bte(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function jte(t){Wi._injected=(Wi._injected||[]).concat(t)}function Mte(t){Wi._override=Object.assign({},t)}XR.exports=Object.assign(Wi,{prompt:Wi,prompts:Mw,inject:jte,override:Mte})});var ZR=_((zwe,JR)=>{"use strict";JR.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var Pd=_((Kwe,QR)=>{"use strict";QR.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var r2=_((Gwe,t2)=>{"use strict";var Ute=Pd(),{erase:e2,cursor:qte}=Ze(),Hte=t=>[...Ute(t)].length;t2.exports=function(t,e){if(!e)return e2.line+qte.to(0);let r=0,n=t.split(/\r?\n/);for(let i of n)r+=1+Math.floor(Math.max(Hte(i)-1,0)/e);return e2.lines(r)}});var qw=_((Wwe,n2)=>{"use strict";var Rc={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Vte={arrowUp:Rc.arrowUp,arrowDown:Rc.arrowDown,arrowLeft:Rc.arrowLeft,arrowRight:Rc.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},zte=process.platform==="win32"?Vte:Rc;n2.exports=zte});var s2=_((Xwe,i2)=>{"use strict";var Na=gt(),Js=qw(),Hw=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),Kte=t=>Hw[t]||Hw.default,kc=Object.freeze({aborted:Na.red(Js.cross),done:Na.green(Js.tick),exited:Na.yellow(Js.cross),default:Na.cyan("?")}),Gte=(t,e,r)=>e?kc.aborted:r?kc.exited:t?kc.done:kc.default,Wte=t=>Na.gray(t?Js.ellipsis:Js.pointerSmall),Xte=(t,e)=>Na.gray(t?e?Js.pointerSmall:"+":Js.line);i2.exports={styles:Hw,render:Kte,symbols:kc,symbol:Gte,delimiter:Wte,item:Xte}});var a2=_((Ywe,o2)=>{"use strict";var Yte=Pd();o2.exports=function(t,e){let r=String(Yte(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var c2=_((Jwe,u2)=>{"use strict";u2.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(i=>i.split(/\s+/g).reduce((s,o)=>(o.length+r.length>=n||s[s.length-1].length+o.length+1<n?s[s.length-1]+=` ${o}`:s.push(`${r}${o}`),s),[r]).join(`
140
140
  `)).join(`
141
- `)}});var f2=_((Zwe,l2)=>{"use strict";l2.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let i=Math.min(n+r,e);return{startIndex:n,endIndex:i}}});var hn=_((Qwe,h2)=>{"use strict";h2.exports={action:ZR(),clear:r2(),style:s2(),strip:Pd(),figures:qw(),lines:a2(),wrap:c2(),entriesToDisplay:f2()}});var li=_((eve,p2)=>{"use strict";var d2=require("readline"),{action:Jte}=hn(),Zte=require("events"),{beep:Qte,cursor:ere}=Ze(),tre=gt(),Vw=class extends Zte{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=d2.createInterface({input:this.in,escapeCodeTimeout:50});d2.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,i=(s,o)=>{let a=Jte(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(ere.show),this.in.removeListener("keypress",i),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",i)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Qte)}render(){this.onRender(tre),this.firstRender&&(this.firstRender=!1)}};p2.exports=Vw});var g2=_((tve,m2)=>{var Fd=gt(),rre=li(),{erase:nre,cursor:Nc}=Ze(),{style:zw,clear:Kw,lines:ire,figures:sre}=hn(),Gw=class extends rre{constructor(e={}){super(e),this.transform=zw.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Kw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Fd.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
141
+ `)}});var f2=_((Zwe,l2)=>{"use strict";l2.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let i=Math.min(n+r,e);return{startIndex:n,endIndex:i}}});var pn=_((Qwe,h2)=>{"use strict";h2.exports={action:ZR(),clear:r2(),style:s2(),strip:Pd(),figures:qw(),lines:a2(),wrap:c2(),entriesToDisplay:f2()}});var fi=_((eve,p2)=>{"use strict";var d2=require("readline"),{action:Jte}=pn(),Zte=require("events"),{beep:Qte,cursor:ere}=Ze(),tre=gt(),Vw=class extends Zte{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=d2.createInterface({input:this.in,escapeCodeTimeout:50});d2.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,i=(s,o)=>{let a=Jte(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(ere.show),this.in.removeListener("keypress",i),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",i)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Qte)}render(){this.onRender(tre),this.firstRender&&(this.firstRender=!1)}};p2.exports=Vw});var g2=_((tve,m2)=>{var Fd=gt(),rre=fi(),{erase:nre,cursor:Nc}=Ze(),{style:zw,clear:Kw,lines:ire,figures:sre}=pn(),Gw=class extends rre{constructor(e={}){super(e),this.transform=zw.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Kw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Fd.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
142
142
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
143
143
  `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.value=`${n}${e}${i}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Nc.down(ire(this.outputError,this.out.columns)-1)+Kw(this.outputError,this.out.columns)),this.out.write(Kw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[zw.symbol(this.done,this.aborted),Fd.bold(this.msg),zw.delimiter(this.done),this.red?Fd.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
144
144
  `).reduce((e,r,n)=>e+`
145
- ${n?" ":sre.pointerSmall} ${Fd.red().italic(r)}`,"")),this.out.write(nre.line+Nc.to(0)+this.outputText+Nc.save+this.outputError+Nc.restore+Nc.move(this.cursorOffset,0)))}};m2.exports=Gw});var v2=_((rve,w2)=>{"use strict";var fi=gt(),ore=li(),{style:y2,clear:D2,figures:Rd,wrap:are,entriesToDisplay:ure}=hn(),{cursor:cre}=Ze(),Ww=class extends ore{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=D2("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
145
+ ${n?" ":sre.pointerSmall} ${Fd.red().italic(r)}`,"")),this.out.write(nre.line+Nc.to(0)+this.outputText+Nc.save+this.outputError+Nc.restore+Nc.move(this.cursorOffset,0)))}};m2.exports=Gw});var v2=_((rve,w2)=>{"use strict";var hi=gt(),ore=fi(),{style:y2,clear:D2,figures:Rd,wrap:are,entriesToDisplay:ure}=pn(),{cursor:cre}=Ze(),Ww=class extends ore{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=D2("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
146
146
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
147
- `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(cre.hide):this.out.write(D2(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=ure(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[y2.symbol(this.done,this.aborted),fi.bold(this.msg),y2.delimiter(!1),this.done?this.selection.title:this.selection.disabled?fi.yellow(this.warn):fi.gray(this.hint)].join(" "),!this.done){this.outputText+=`
148
- `;for(let n=e;n<r;n++){let i,s,o="",a=this.choices[n];n===e&&e>0?s=Rd.arrowUp:n===r-1&&r<this.choices.length?s=Rd.arrowDown:s=" ",a.disabled?(i=this.cursor===n?fi.gray().underline(a.title):fi.strikethrough().gray(a.title),s=(this.cursor===n?fi.bold().gray(Rd.pointer)+" ":" ")+s):(i=this.cursor===n?fi.cyan().underline(a.title):a.title,s=(this.cursor===n?fi.cyan(Rd.pointer)+" ":" ")+s,a.description&&this.cursor===n&&(o=` - ${a.description}`,(s.length+i.length+o.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(o=`
149
- `+are(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${s} ${i}${fi.gray(o)}
150
- `}}this.out.write(this.outputText)}};w2.exports=Ww});var C2=_((nve,_2)=>{var kd=gt(),lre=li(),{style:E2,clear:fre}=hn(),{cursor:b2,erase:hre}=Ze(),Xw=class extends lre{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
147
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(cre.hide):this.out.write(D2(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=ure(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[y2.symbol(this.done,this.aborted),hi.bold(this.msg),y2.delimiter(!1),this.done?this.selection.title:this.selection.disabled?hi.yellow(this.warn):hi.gray(this.hint)].join(" "),!this.done){this.outputText+=`
148
+ `;for(let n=e;n<r;n++){let i,s,o="",a=this.choices[n];n===e&&e>0?s=Rd.arrowUp:n===r-1&&r<this.choices.length?s=Rd.arrowDown:s=" ",a.disabled?(i=this.cursor===n?hi.gray().underline(a.title):hi.strikethrough().gray(a.title),s=(this.cursor===n?hi.bold().gray(Rd.pointer)+" ":" ")+s):(i=this.cursor===n?hi.cyan().underline(a.title):a.title,s=(this.cursor===n?hi.cyan(Rd.pointer)+" ":" ")+s,a.description&&this.cursor===n&&(o=` - ${a.description}`,(s.length+i.length+o.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(o=`
149
+ `+are(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${s} ${i}${hi.gray(o)}
150
+ `}}this.out.write(this.outputText)}};w2.exports=Ww});var C2=_((nve,_2)=>{var kd=gt(),lre=fi(),{style:E2,clear:fre}=pn(),{cursor:b2,erase:hre}=Ze(),Xw=class extends lre{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
151
151
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
152
- `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(b2.hide):this.out.write(fre(this.outputText,this.out.columns)),super.render(),this.outputText=[E2.symbol(this.done,this.aborted),kd.bold(this.msg),E2.delimiter(this.done),this.value?this.inactive:kd.cyan().underline(this.inactive),kd.gray("/"),this.value?kd.cyan().underline(this.active):this.active].join(" "),this.out.write(hre.line+b2.to(0)+this.outputText))}};_2.exports=Xw});var kn=_((ive,S2)=>{"use strict";var Yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};S2.exports=Yw});var O2=_((sve,A2)=>{"use strict";var dre=kn(),Jw=class extends dre{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};A2.exports=Jw});var T2=_((ove,x2)=>{"use strict";var pre=kn(),mre=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),Zw=class extends pre{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+mre(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};x2.exports=Zw});var P2=_((ave,I2)=>{"use strict";var gre=kn(),Qw=class extends gre{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};I2.exports=Qw});var R2=_((uve,F2)=>{"use strict";var yre=kn(),ev=class extends yre{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};F2.exports=ev});var N2=_((cve,k2)=>{"use strict";var Dre=kn(),tv=class extends Dre{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};k2.exports=tv});var L2=_((lve,$2)=>{"use strict";var wre=kn(),rv=class extends wre{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};$2.exports=rv});var j2=_((fve,B2)=>{"use strict";var vre=kn(),nv=class extends vre{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};B2.exports=nv});var U2=_((hve,M2)=>{"use strict";var Ere=kn(),iv=class extends Ere{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};M2.exports=iv});var H2=_((dve,q2)=>{"use strict";q2.exports={DatePart:kn(),Meridiem:O2(),Day:T2(),Hours:P2(),Milliseconds:R2(),Minutes:N2(),Month:L2(),Seconds:j2(),Year:U2()}});var Y2=_((pve,X2)=>{"use strict";var sv=gt(),bre=li(),{style:V2,clear:z2,figures:_re}=hn(),{erase:Cre,cursor:K2}=Ze(),{DatePart:G2,Meridiem:Sre,Day:Are,Hours:Ore,Milliseconds:xre,Minutes:Tre,Month:Ire,Seconds:Pre,Year:Fre}=H2(),Rre=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,W2={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new Are(t),3:t=>new Ire(t),4:t=>new Fre(t),5:t=>new Sre(t),6:t=>new Ore(t),7:t=>new Tre(t),8:t=>new Pre(t),9:t=>new xre(t)},kre={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},ov=class extends bre{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(kre,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=z2("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=Rre.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in W2?W2[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof G2)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
152
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(b2.hide):this.out.write(fre(this.outputText,this.out.columns)),super.render(),this.outputText=[E2.symbol(this.done,this.aborted),kd.bold(this.msg),E2.delimiter(this.done),this.value?this.inactive:kd.cyan().underline(this.inactive),kd.gray("/"),this.value?kd.cyan().underline(this.active):this.active].join(" "),this.out.write(hre.line+b2.to(0)+this.outputText))}};_2.exports=Xw});var kn=_((ive,S2)=>{"use strict";var Yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};S2.exports=Yw});var O2=_((sve,A2)=>{"use strict";var dre=kn(),Jw=class extends dre{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};A2.exports=Jw});var T2=_((ove,x2)=>{"use strict";var pre=kn(),mre=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),Zw=class extends pre{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+mre(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};x2.exports=Zw});var P2=_((ave,I2)=>{"use strict";var gre=kn(),Qw=class extends gre{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};I2.exports=Qw});var R2=_((uve,F2)=>{"use strict";var yre=kn(),ev=class extends yre{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};F2.exports=ev});var N2=_((cve,k2)=>{"use strict";var Dre=kn(),tv=class extends Dre{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};k2.exports=tv});var L2=_((lve,$2)=>{"use strict";var wre=kn(),rv=class extends wre{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};$2.exports=rv});var j2=_((fve,B2)=>{"use strict";var vre=kn(),nv=class extends vre{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};B2.exports=nv});var U2=_((hve,M2)=>{"use strict";var Ere=kn(),iv=class extends Ere{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};M2.exports=iv});var H2=_((dve,q2)=>{"use strict";q2.exports={DatePart:kn(),Meridiem:O2(),Day:T2(),Hours:P2(),Milliseconds:R2(),Minutes:N2(),Month:L2(),Seconds:j2(),Year:U2()}});var Y2=_((pve,X2)=>{"use strict";var sv=gt(),bre=fi(),{style:V2,clear:z2,figures:_re}=pn(),{erase:Cre,cursor:K2}=Ze(),{DatePart:G2,Meridiem:Sre,Day:Are,Hours:Ore,Milliseconds:xre,Minutes:Tre,Month:Ire,Seconds:Pre,Year:Fre}=H2(),Rre=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,W2={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new Are(t),3:t=>new Ire(t),4:t=>new Fre(t),5:t=>new Sre(t),6:t=>new Ore(t),7:t=>new Tre(t),8:t=>new Pre(t),9:t=>new xre(t)},kre={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},ov=class extends bre{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(kre,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=z2("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=Rre.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in W2?W2[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof G2)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
153
153
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
154
154
  `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof G2)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(K2.hide):this.out.write(z2(this.outputText,this.out.columns)),super.render(),this.outputText=[V2.symbol(this.done,this.aborted),sv.bold(this.msg),V2.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?sv.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
155
155
  `).reduce((e,r,n)=>e+`
156
- ${n?" ":_re.pointerSmall} ${sv.red().italic(r)}`,"")),this.out.write(Cre.line+K2.to(0)+this.outputText))}};X2.exports=ov});var ek=_((mve,Q2)=>{var Nd=gt(),Nre=li(),{cursor:$d,erase:$re}=Ze(),{style:av,figures:Lre,clear:J2,lines:Bre}=hn(),jre=/[0-9]/,uv=t=>t!==void 0,Z2=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},cv=class extends Nre{constructor(e={}){super(e),this.transform=av.render(e.style),this.msg=e.message,this.initial=uv(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=uv(e.min)?e.min:-1/0,this.max=uv(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Nd.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Z2(e,this.round)}`),this._value=Z2(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||jre.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
156
+ ${n?" ":_re.pointerSmall} ${sv.red().italic(r)}`,"")),this.out.write(Cre.line+K2.to(0)+this.outputText))}};X2.exports=ov});var ek=_((mve,Q2)=>{var Nd=gt(),Nre=fi(),{cursor:$d,erase:$re}=Ze(),{style:av,figures:Lre,clear:J2,lines:Bre}=pn(),jre=/[0-9]/,uv=t=>t!==void 0,Z2=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},cv=class extends Nre{constructor(e={}){super(e),this.transform=av.render(e.style),this.msg=e.message,this.initial=uv(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=uv(e.min)?e.min:-1/0,this.max=uv(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Nd.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Z2(e,this.round)}`),this._value=Z2(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||jre.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
157
157
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
158
158
  `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write($d.down(Bre(this.outputError,this.out.columns)-1)+J2(this.outputError,this.out.columns)),this.out.write(J2(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[av.symbol(this.done,this.aborted),Nd.bold(this.msg),av.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Nd[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
159
159
  `).reduce((e,r,n)=>e+`
160
- ${n?" ":Lre.pointerSmall} ${Nd.red().italic(r)}`,"")),this.out.write($re.line+$d.to(0)+this.outputText+$d.save+this.outputError+$d.restore))}};Q2.exports=cv});var fv=_((gve,nk)=>{"use strict";var Nn=gt(),{cursor:Mre}=Ze(),Ure=li(),{clear:tk,figures:Xi,style:rk,wrap:qre,entriesToDisplay:Hre}=hn(),lv=class extends Ure{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=tk("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
160
+ ${n?" ":Lre.pointerSmall} ${Nd.red().italic(r)}`,"")),this.out.write($re.line+$d.to(0)+this.outputText+$d.save+this.outputError+$d.restore))}};Q2.exports=cv});var fv=_((gve,nk)=>{"use strict";var Nn=gt(),{cursor:Mre}=Ze(),Ure=fi(),{clear:tk,figures:Xi,style:rk,wrap:qre,entriesToDisplay:Hre}=pn(),lv=class extends Ure{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=tk("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
161
161
  `),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
162
162
  `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
163
163
  Instructions:
@@ -167,21 +167,21 @@ Instructions:
167
167
  `:"")+" enter/return: Complete answer":""}renderOption(e,r,n,i){let s=(r.selected?Nn.green(Xi.radioOn):Xi.radioOff)+" "+i+" ",o,a;return r.disabled?o=e===n?Nn.gray().underline(r.title):Nn.strikethrough().gray(r.title):(o=e===n?Nn.cyan().underline(r.title):r.title,e===n&&r.description&&(a=` - ${r.description}`,(s.length+o.length+a.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(a=`
168
168
  `+qre(r.description,{margin:s.length,width:this.out.columns})))),s+o+Nn.gray(a||"")}paginateOptions(e){if(e.length===0)return Nn.red("No matches for this query.");let{startIndex:r,endIndex:n}=Hre(this.cursor,e.length,this.optionsPerPage),i,s=[];for(let o=r;o<n;o++)o===r&&r>0?i=Xi.arrowUp:o===n-1&&n<e.length?i=Xi.arrowDown:i=" ",s.push(this.renderOption(this.cursor,e[o],o,i));return`
169
169
  `+s.join(`
170
- `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Nn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Mre.hide),super.render();let e=[rk.symbol(this.done,this.aborted),Nn.bold(this.msg),rk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=tk(e,this.out.columns)}};nk.exports=lv});var uk=_((yve,ak)=>{"use strict";var $c=gt(),Vre=li(),{erase:zre,cursor:ik}=Ze(),{style:hv,clear:sk,figures:dv,wrap:Kre,entriesToDisplay:Gre}=hn(),ok=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Wre=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Xre=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},pv=class extends Vre{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Xre(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=hv.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=sk("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=ok(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let r=this.completing=this.suggest(this.input,this.choices),n=await r;if(this.completing!==r)return;this.suggestions=n.map((s,o,a)=>({title:Wre(a,o),value:ok(a,o),description:s.description})),this.completing=!1;let i=Math.max(n.length-1,0);this.moveSelect(Math.min(i,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
170
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Nn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Mre.hide),super.render();let e=[rk.symbol(this.done,this.aborted),Nn.bold(this.msg),rk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=tk(e,this.out.columns)}};nk.exports=lv});var uk=_((yve,ak)=>{"use strict";var $c=gt(),Vre=fi(),{erase:zre,cursor:ik}=Ze(),{style:hv,clear:sk,figures:dv,wrap:Kre,entriesToDisplay:Gre}=pn(),ok=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Wre=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Xre=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},pv=class extends Vre{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Xre(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=hv.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=sk("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=ok(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let r=this.completing=this.suggest(this.input,this.choices),n=await r;if(this.completing!==r)return;this.suggestions=n.map((s,o,a)=>({title:Wre(a,o),value:ok(a,o),description:s.description})),this.completing=!1;let i=Math.max(n.length-1,0);this.moveSelect(Math.min(i,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
171
171
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
172
172
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
173
173
  `),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor);this.input=`${n}${e}${i}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,i){let s,o=n?dv.arrowUp:i?dv.arrowDown:" ",a=r?$c.cyan().underline(e.title):e.title;return o=(r?$c.cyan(dv.pointer)+" ":" ")+o,e.description&&(s=` - ${e.description}`,(o.length+a.length+s.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(s=`
174
174
  `+Kre(e.description,{margin:3,width:this.out.columns}))),o+" "+a+$c.gray(s||"")}render(){if(this.closed)return;this.firstRender?this.out.write(ik.hide):this.out.write(sk(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=Gre(this.select,this.choices.length,this.limit);if(this.outputText=[hv.symbol(this.done,this.aborted,this.exited),$c.bold(this.msg),hv.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let n=this.suggestions.slice(e,r).map((i,s)=>this.renderOption(i,this.select===s+e,s===0&&e>0,s+e===r-1&&r<this.choices.length)).join(`
175
175
  `);this.outputText+=`
176
- `+(n||$c.gray(this.fallback.title))}this.out.write(zre.line+ik.to(0)+this.outputText)}};ak.exports=pv});var hk=_((Dve,fk)=>{"use strict";var hi=gt(),{cursor:Yre}=Ze(),Jre=fv(),{clear:ck,style:lk,figures:$a}=hn(),mv=class extends Jre{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=ck("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
176
+ `+(n||$c.gray(this.fallback.title))}this.out.write(zre.line+ik.to(0)+this.outputText)}};ak.exports=pv});var hk=_((Dve,fk)=>{"use strict";var di=gt(),{cursor:Yre}=Ze(),Jre=fv(),{clear:ck,style:lk,figures:$a}=pn(),mv=class extends Jre{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=ck("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
177
177
  Instructions:
178
178
  ${$a.arrowUp}/${$a.arrowDown}: Highlight option
179
179
  ${$a.arrowLeft}/${$a.arrowRight}/[space]: Toggle selection
180
180
  [a,b,c]/delete: Filter choices
181
181
  enter/return: Complete answer
182
182
  `:""}renderCurrentInput(){return`
183
- Filtered results for: ${this.inputValue?this.inputValue:hi.gray("Enter something to filter")}
184
- `}renderOption(e,r,n){let i;return r.disabled?i=e===n?hi.gray().underline(r.title):hi.strikethrough().gray(r.title):i=e===n?hi.cyan().underline(r.title):r.title,(r.selected?hi.green($a.radioOn):$a.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[hi.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(hi.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Yre.hide),super.render();let e=[lk.symbol(this.done,this.aborted),hi.bold(this.msg),lk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=hi.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=ck(e,this.out.columns)}};fk.exports=mv});var yk=_((wve,gk)=>{var dk=gt(),Zre=li(),{style:pk,clear:Qre}=hn(),{erase:ene,cursor:mk}=Ze(),gv=class extends Zre{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
183
+ Filtered results for: ${this.inputValue?this.inputValue:di.gray("Enter something to filter")}
184
+ `}renderOption(e,r,n){let i;return r.disabled?i=e===n?di.gray().underline(r.title):di.strikethrough().gray(r.title):i=e===n?di.cyan().underline(r.title):r.title,(r.selected?di.green($a.radioOn):$a.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[di.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(di.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Yre.hide),super.render();let e=[lk.symbol(this.done,this.aborted),di.bold(this.msg),lk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=di.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=ck(e,this.out.columns)}};fk.exports=mv});var yk=_((wve,gk)=>{var dk=gt(),Zre=fi(),{style:pk,clear:Qre}=pn(),{erase:ene,cursor:mk}=Ze(),gv=class extends Zre{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
185
185
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
186
186
  `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(mk.hide):this.out.write(Qre(this.outputText,this.out.columns)),super.render(),this.outputText=[pk.symbol(this.done,this.aborted),dk.bold(this.msg),pk.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:dk.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(ene.line+mk.to(0)+this.outputText))}};gk.exports=gv});var wk=_((vve,Dk)=>{"use strict";Dk.exports={TextPrompt:g2(),SelectPrompt:v2(),TogglePrompt:C2(),DatePrompt:Y2(),NumberPrompt:ek(),MultiselectPrompt:fv(),AutocompletePrompt:uk(),AutocompleteMultiselectPrompt:hk(),ConfirmPrompt:yk()}});var Ek=_(vk=>{"use strict";var Cr=vk,tne=wk(),Ld=t=>t;function $n(t,e,r={}){return new Promise((n,i)=>{let s=new tne[t](e),o=r.onAbort||Ld,a=r.onSubmit||Ld,u=r.onExit||Ld;s.on("state",e.onState||Ld),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}Cr.text=t=>$n("TextPrompt",t);Cr.password=t=>(t.style="password",Cr.text(t));Cr.invisible=t=>(t.style="invisible",Cr.text(t));Cr.number=t=>$n("NumberPrompt",t);Cr.date=t=>$n("DatePrompt",t);Cr.confirm=t=>$n("ConfirmPrompt",t);Cr.list=t=>{let e=t.separator||",";return $n("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};Cr.toggle=t=>$n("TogglePrompt",t);Cr.select=t=>$n("SelectPrompt",t);Cr.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return $n("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};Cr.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return $n("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var rne=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));Cr.autocomplete=t=>(t.suggest=t.suggest||rne,t.choices=[].concat(t.choices||[]),$n("AutocompletePrompt",t))});var Ck=_((bve,_k)=>{"use strict";var yv=Ek(),nne=["suggest","format","onState","validate","onRender","type"],bk=()=>{};async function Yi(t=[],{onSubmit:e=bk,onCancel:r=bk}={}){let n={},i=Yi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=async(d,f,m=!1)=>{if(!(!m&&d.validate&&d.validate(f)!==!0))return d.format?await d.format(f,n):f};for(o of t)if({name:u,type:c}=o,typeof c=="function"&&(c=await c(s,{...n},o),o.type=c),!!c){for(let d in o){if(nne.includes(d))continue;let f=o[d];o[d]=typeof f=="function"?await f(s,{...n},l):f}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:c}=o,yv[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=await h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=Yi._injected?ine(Yi._injected,o.initial):await yv[c](o),n[u]=s=await h(o,s,!0),a=await e(o,s,n)}catch{a=!await r(o,n)}if(a)return n}return n}function ine(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function sne(t){Yi._injected=(Yi._injected||[]).concat(t)}function one(t){Yi._override=Object.assign({},t)}_k.exports=Object.assign(Yi,{prompt:Yi,prompts:yv,inject:sne,override:one})});var Bd=_((_ve,Sk)=>{function ane(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,r=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(r[e]>t[e])return!1;if(t[e]>r[e])return!0}return!1}Sk.exports=ane("8.6.0")?YR():Ck()});var Sc=_(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.logSuccess=Sr.logPrompt=Sr.logger=Sr.output=void 0;var Dv=(he(),ce(fe)),Zs=uw(),Qs=Dv.__importDefault(Aa()),une=JP(),Ak={colors:Qs.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Sr.output=(0,une.isInteractive)()?new Zs.TTYOutputStrategy(Ak):new Zs.StreamOutputStrategy(Ak);Sr.logger=(0,Zs.createDefaultLogger)({output:Sr.output,formatterOptions:{titleize:!1,tags:new Map([[Zs.LOGGER_LEVELS.DEBUG,Qs.default.log.DEBUG("[debug]")],[Zs.LOGGER_LEVELS.INFO,Qs.default.log.INFO("[info]")],[Zs.LOGGER_LEVELS.WARN,Qs.default.log.WARN("[warn]")],[Zs.LOGGER_LEVELS.ERROR,Qs.default.log.ERROR("[error]")]])}});async function cne(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Dv.__importStar(uw())),{prompt:n}=await Promise.resolve().then(()=>Dv.__importStar(Bd()));return Sr.logger.log({msg:`${Qs.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Sr.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Sr.logPrompt=cne;function lne(t){Sr.logger.msg(`${Qs.default.success("[success]")} ${t}`)}Sr.logSuccess=lne});var jd=_(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.resolveNode=La.requireTS=void 0;var fne=require("fs"),hne=Sa(),dne=require("path"),pne=(t,e)=>{let r=(0,dne.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(i,s)=>{var o;let a=(0,hne.readFileSync)(s,"utf8");s.endsWith(".ts")?a=t.transpileModule(a,{fileName:s,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:a=a.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(o=i._compile)===null||o===void 0||o.call(i,a,s)};let n=require(r);return delete require.extensions[".ts"],n};La.requireTS=pne;function mne(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,fne.existsSync)(n)?n:null}}La.resolveNode=mne});var Md=_(wv=>{(function(){wv.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
187
187
  `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(wv)});var Ln=_((Ok,Ji)=>{(function(){var t,e,r,n,i,s,o,a=[].slice,u={}.hasOwnProperty;t=function(){var c,l,h,d,f,m;if(m=arguments[0],f=2<=arguments.length?a.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(c=0,h=f.length;c<h;c++)if(d=f[c],d!=null)for(l in d)u.call(d,l)&&(m[l]=d[l]);return m},i=function(c){return!!c&&Object.prototype.toString.call(c)==="[object Function]"},s=function(c){var l;return!!c&&((l=typeof c)=="function"||l==="object")},r=function(c){return i(Array.isArray)?Array.isArray(c):Object.prototype.toString.call(c)==="[object Array]"},n=function(c){var l;if(r(c))return!c.length;for(l in c)if(u.call(c,l))return!1;return!0},o=function(c){var l,h;return s(c)&&(h=Object.getPrototypeOf(c))&&(l=h.constructor)&&typeof l=="function"&&l instanceof l&&Function.prototype.toString.call(l)===Function.prototype.toString.call(Object)},e=function(c){return i(c.valueOf)?c.valueOf():c},Ji.exports.assign=t,Ji.exports.isFunction=i,Ji.exports.isObject=s,Ji.exports.isArray=r,Ji.exports.isEmpty=n,Ji.exports.isPlainObject=o,Ji.exports.getValue=e}).call(Ok)});var vv=_((xk,Tk)=>{(function(){var t;Tk.exports=t=(function(){function e(){}return e.prototype.hasFeature=function(r,n){return!0},e.prototype.createDocumentType=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(xk)});var Fk=_((Ik,Pk)=>{(function(){var t;Pk.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(Ik)});var Nk=_((Rk,kk)=>{(function(){var t;kk.exports=t=(function(){function e(r){this.arr=r||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(r){return this.arr[r]||null},e.prototype.contains=function(r){return this.arr.indexOf(r)!==-1},e})()}).call(Rk)});var Bk=_(($k,Lk)=>{(function(){var t,e,r;e=Fk(),r=Nk(),Lk.exports=t=(function(){function n(){var i;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=i=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new r(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(i){return this.params.hasOwnProperty(i)?this.params[i]:null},n.prototype.canSetParameter=function(i,s){return!0},n.prototype.setParameter=function(i,s){return s!=null?this.params[i]=s:delete this.params[i]},n})()}).call($k)});var Ot=_((jk,Mk)=>{(function(){Mk.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(jk)});var Ev=_((Uk,qk)=>{(function(){var t,e,r;t=Ot(),r=kr(),qk.exports=e=(function(){function n(i,s,o){if(this.parent=i,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),s==null)throw new Error("Missing attribute name. "+this.debugInfo(s));this.name=this.stringify.name(s),this.value=this.stringify.attValue(o),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(n.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(n.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(n.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(n.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(n.prototype,"specified",{get:function(){return!0}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(i){return this.options.writer.attribute(this,this.options.writer.filterOptions(i))},n.prototype.debugInfo=function(i){return i=i||this.name,i==null?"parent: <"+this.parent.name+">":"attribute: {"+i+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(i){return!(i.namespaceURI!==this.namespaceURI||i.prefix!==this.prefix||i.localName!==this.localName||i.value!==this.value)},n})()}).call(Uk)});var Ud=_((Hk,Vk)=>{(function(){var t;Vk.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(r){return this.nodes[r]},e.prototype.setNamedItem=function(r){var n;return n=this.nodes[r.nodeName],this.nodes[r.nodeName]=r,n||null},e.prototype.removeNamedItem=function(r){var n;return n=this.nodes[r],delete this.nodes[r],n||null},e.prototype.item=function(r){return this.nodes[Object.keys(this.nodes)[r]]||null},e.prototype.getNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(Hk)});var qd=_((zk,Kk)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Ln(),a=u.isObject,o=u.isFunction,s=u.getValue,i=kr(),t=Ot(),e=Ev(),n=Ud(),Kk.exports=r=(function(h){c(d,h);function d(f,m,y){var v,E,A,p;if(d.__super__.constructor.call(this,f),m==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(m),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,y!=null&&this.attribute(y),f.type===t.Document&&(this.isRoot=!0,this.documentObject=f,f.rootObject=this,f.children)){for(p=f.children,E=0,A=p.length;E<A;E++)if(v=p[E],v.type===t.DocType){v.name=this.name;break}}}return Object.defineProperty(d.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(d.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(d.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),d.prototype.clone=function(){var f,m,y,v;y=Object.create(this),y.isRoot&&(y.documentObject=null),y.attribs={},v=this.attribs;for(m in v)l.call(v,m)&&(f=v[m],y.attribs[m]=f.clone());return y.children=[],this.children.forEach(function(E){var A;return A=E.clone(),A.parent=y,y.children.push(A)}),y},d.prototype.attribute=function(f,m){var y,v;if(f!=null&&(f=s(f)),a(f))for(y in f)l.call(f,y)&&(v=f[y],this.attribute(y,v));else o(m)&&(m=m.apply()),this.options.keepNullAttributes&&m==null?this.attribs[f]=new e(this,f,""):m!=null&&(this.attribs[f]=new e(this,f,m));return this},d.prototype.removeAttribute=function(f){var m,y,v;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(y=0,v=f.length;y<v;y++)m=f[y],delete this.attribs[m];else delete this.attribs[f];return this},d.prototype.toString=function(f){return this.options.writer.element(this,this.options.writer.filterOptions(f))},d.prototype.att=function(f,m){return this.attribute(f,m)},d.prototype.a=function(f,m){return this.attribute(f,m)},d.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},d.prototype.setAttribute=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNode=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f]:null},d.prototype.setAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNS=function(f,m,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNodeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNodeNS=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.hasAttribute=function(f){return this.attribs.hasOwnProperty(f)},d.prototype.hasAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttribute=function(f,m){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:m},d.prototype.setIdAttributeNS=function(f,m,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttributeNode=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.isEqualNode=function(f){var m,y,v;if(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.namespaceURI!==this.namespaceURI||f.prefix!==this.prefix||f.localName!==this.localName||f.attribs.length!==this.attribs.length)return!1;for(m=y=0,v=this.attribs.length-1;0<=v?y<=v:y>=v;m=0<=v?++y:--y)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(zk)});var Lc=_((Gk,Wk)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=kr(),Wk.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(s.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(s.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(s.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),s.prototype.clone=function(){return Object.create(this)},s.prototype.substringData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.insertData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.deleteData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.replaceData=function(o,a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.isEqualNode=function(o){return!(!s.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},s})(e)}).call(Gk)});var Hd=_((Xk,Yk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Ot(),r=Lc(),Yk.exports=e=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.cdata(this,this.options.writer.filterOptions(a))},o})(r)}).call(Xk)});var Vd=_((Jk,Zk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Ot(),e=Lc(),Zk.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.comment(this,this.options.writer.filterOptions(a))},o})(e)}).call(Jk)});var zd=_((Qk,eN)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=Ln().isObject,r=kr(),t=Ot(),eN.exports=e=(function(o){i(a,o);function a(u,c,l,h){var d;a.__super__.constructor.call(this,u),n(c)&&(d=c,c=d.version,l=d.encoding,h=d.standalone),c||(c="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(c),l!=null&&(this.encoding=this.stringify.xmlEncoding(l)),h!=null&&(this.standalone=this.stringify.xmlStandalone(h))}return a.prototype.toString=function(u){return this.options.writer.declaration(this,this.options.writer.filterOptions(u))},a})(r)}).call(Qk)});var Kd=_((tN,rN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=kr(),t=Ot(),rN.exports=e=(function(s){n(o,s);function o(a,u,c,l,h,d){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(u));if(!l)throw new Error("Missing DTD attribute type. "+this.debugInfo(u));if(!h)throw new Error("Missing DTD attribute default. "+this.debugInfo(u));if(h.indexOf("#")!==0&&(h="#"+h),!h.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(u));if(d&&!h.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(u));this.elementName=this.stringify.name(u),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(l),d&&(this.defaultValue=this.stringify.dtdAttDefault(d)),this.defaultValueType=h}return o.prototype.toString=function(a){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(a))},o})(r)}).call(tN)});var Gd=_((nN,iN)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=Ln().isObject,r=kr(),t=Ot(),iN.exports=e=(function(o){i(a,o);function a(u,c,l,h){if(a.__super__.constructor.call(this,u),l==null)throw new Error("Missing DTD entity name. "+this.debugInfo(l));if(h==null)throw new Error("Missing DTD entity value. "+this.debugInfo(l));if(this.pe=!!c,this.name=this.stringify.name(l),this.type=t.EntityDeclaration,!n(h))this.value=this.stringify.dtdEntityValue(h),this.internal=!0;else{if(!h.pubID&&!h.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(l));if(h.pubID&&!h.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(l));if(this.internal=!1,h.pubID!=null&&(this.pubID=this.stringify.dtdPubID(h.pubID)),h.sysID!=null&&(this.sysID=this.stringify.dtdSysID(h.sysID)),h.nData!=null&&(this.nData=this.stringify.dtdNData(h.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(l))}}return Object.defineProperty(a.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(a.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(a.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(a.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlVersion",{get:function(){return null}}),a.prototype.toString=function(u){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(u))},a})(r)}).call(nN)});var Wd=_((sN,oN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=kr(),t=Ot(),oN.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(u),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return o.prototype.toString=function(a){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(a))},o})(r)}).call(sN)});var Xd=_((aN,uN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=kr(),t=Ot(),uN.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD notation name. "+this.debugInfo(u));if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(u));this.name=this.stringify.name(u),this.type=t.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(a){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(a))},o})(r)}).call(aN)});var Yd=_((cN,lN)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Ln().isObject,a=kr(),t=Ot(),e=Kd(),n=Gd(),r=Wd(),i=Xd(),o=Ud(),lN.exports=s=(function(h){c(d,h);function d(f,m,y){var v,E,A,p,D,w;if(d.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(p=f.children,E=0,A=p.length;E<A;E++)if(v=p[E],v.type===t.Element){this.name=v.name;break}}this.documentObject=f,u(m)&&(D=m,m=D.pubID,y=D.sysID),y==null&&(w=[m,y],y=w[0],m=w[1]),m!=null&&(this.pubID=this.stringify.dtdPubID(m)),y!=null&&(this.sysID=this.stringify.dtdSysID(y))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,m,y,v,E;for(v={},E=this.children,m=0,y=E.length;m<y;m++)f=E[m],f.type===t.EntityDeclaration&&!f.pe&&(v[f.name]=f);return new o(v)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,y,v,E;for(v={},E=this.children,m=0,y=E.length;m<y;m++)f=E[m],f.type===t.NotationDeclaration&&(v[f.name]=f);return new o(v)}}),Object.defineProperty(d.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(d.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(d.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),d.prototype.element=function(f,m){var y;return y=new r(this,f,m),this.children.push(y),this},d.prototype.attList=function(f,m,y,v,E){var A;return A=new e(this,f,m,y,v,E),this.children.push(A),this},d.prototype.entity=function(f,m){var y;return y=new n(this,!1,f,m),this.children.push(y),this},d.prototype.pEntity=function(f,m){var y;return y=new n(this,!0,f,m),this.children.push(y),this},d.prototype.notation=function(f,m){var y;return y=new i(this,f,m),this.children.push(y),this},d.prototype.toString=function(f){return this.options.writer.docType(this,this.options.writer.filterOptions(f))},d.prototype.ele=function(f,m){return this.element(f,m)},d.prototype.att=function(f,m,y,v,E){return this.attList(f,m,y,v,E)},d.prototype.ent=function(f,m){return this.entity(f,m)},d.prototype.pent=function(f,m){return this.pEntity(f,m)},d.prototype.not=function(f,m){return this.notation(f,m)},d.prototype.up=function(){return this.root()||this.documentObject},d.prototype.isEqualNode=function(f){return!(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.name!==this.name||f.publicId!==this.publicId||f.systemId!==this.systemId)},d})(a)}).call(cN)});var Jd=_((fN,hN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Ot(),e=kr(),hN.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.raw(this,this.options.writer.filterOptions(a))},o})(e)}).call(fN)});var Zd=_((dN,pN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Ot(),e=Lc(),pN.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(u)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var a,u,c;for(c="",u=this.previousSibling;u;)c=u.data+c,u=u.previousSibling;for(c+=this.data,a=this.nextSibling;a;)c=c+a.data,a=a.nextSibling;return c}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.text(this,this.options.writer.filterOptions(a))},o.prototype.splitText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o})(e)}).call(dN)});var Qd=_((mN,gN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Ot(),e=Lc(),gN.exports=r=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(u),this.name=this.target,c&&(this.value=this.stringify.insValue(c))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(a))},o.prototype.isEqualNode=function(a){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.target!==this.target)},o})(e)}).call(mN)});var bv=_((yN,DN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=kr(),t=Ot(),DN.exports=e=(function(s){n(o,s);function o(a){o.__super__.constructor.call(this,a),this.type=t.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return""},o})(r)}).call(yN)});var EN=_((wN,vN)=>{(function(){var t;vN.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(r){return this.nodes[r]||null},e})()}).call(wN)});var CN=_((bN,_N)=>{(function(){_N.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(bN)});var kr=_((SN,AN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,v,E,A,p={}.hasOwnProperty;A=Ln(),E=A.isObject,v=A.isFunction,y=A.isEmpty,m=A.getValue,a=null,r=null,n=null,i=null,s=null,d=null,f=null,h=null,o=null,e=null,l=null,u=null,t=null,AN.exports=c=(function(){function D(w){this.parent=w,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=qd(),r=Hd(),n=Vd(),i=zd(),s=Yd(),d=Jd(),f=Zd(),h=Qd(),o=bv(),e=Ot(),l=EN(),u=Ud(),t=CN())}return Object.defineProperty(D.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(D.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(D.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(D.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(D.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(D.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(D.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(D.prototype,"previousSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w-1]||null}}),Object.defineProperty(D.prototype,"nextSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w+1]||null}}),Object.defineProperty(D.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(D.prototype,"textContent",{get:function(){var w,C,F,b,k;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(k="",b=this.children,C=0,F=b.length;C<F;C++)w=b[C],w.textContent&&(k+=w.textContent);return k}else return null},set:function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),D.prototype.setParent=function(w){var C,F,b,k,R;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),k=this.children,R=[],F=0,b=k.length;F<b;F++)C=k[F],R.push(C.setParent(this));return R},D.prototype.element=function(w,C,F){var b,k,R,I,B,j,z,L,S,T,P;if(j=null,C===null&&F==null&&(S=[{},null],C=S[0],F=S[1]),C==null&&(C={}),C=m(C),E(C)||(T=[C,F],F=T[0],C=T[1]),w!=null&&(w=m(w)),Array.isArray(w))for(R=0,z=w.length;R<z;R++)k=w[R],j=this.element(k);else if(v(w))j=this.element(w.apply());else if(E(w)){for(B in w)if(p.call(w,B))if(P=w[B],v(P)&&(P=P.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&B.indexOf(this.stringify.convertAttKey)===0)j=this.attribute(B.substr(this.stringify.convertAttKey.length),P);else if(!this.options.separateArrayItems&&Array.isArray(P)&&y(P))j=this.dummy();else if(E(P)&&y(P))j=this.element(B);else if(!this.options.keepNullNodes&&P==null)j=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(P))for(I=0,L=P.length;I<L;I++)k=P[I],b={},b[B]=k,j=this.element(b);else E(P)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&B.indexOf(this.stringify.convertTextKey)===0?j=this.element(P):(j=this.element(B),j.element(P)):j=this.element(B,P)}else!this.options.keepNullNodes&&F===null?j=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&w.indexOf(this.stringify.convertTextKey)===0?j=this.text(F):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&w.indexOf(this.stringify.convertCDataKey)===0?j=this.cdata(F):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&w.indexOf(this.stringify.convertCommentKey)===0?j=this.comment(F):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&w.indexOf(this.stringify.convertRawKey)===0?j=this.raw(F):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&w.indexOf(this.stringify.convertPIKey)===0?j=this.instruction(w.substr(this.stringify.convertPIKey.length),F):j=this.node(w,C,F);if(j==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return j},D.prototype.insertBefore=function(w,C,F){var b,k,R,I,B;if(w?.type)return R=w,I=C,R.setParent(this),I?(k=children.indexOf(I),B=children.splice(k),children.push(R),Array.prototype.push.apply(children,B)):children.push(R),R;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return k=this.parent.children.indexOf(this),B=this.parent.children.splice(k),b=this.parent.element(w,C,F),Array.prototype.push.apply(this.parent.children,B),b},D.prototype.insertAfter=function(w,C,F){var b,k,R;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return k=this.parent.children.indexOf(this),R=this.parent.children.splice(k+1),b=this.parent.element(w,C,F),Array.prototype.push.apply(this.parent.children,R),b},D.prototype.remove=function(){var w,C;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return w=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[w,w-w+1].concat(C=[])),this.parent},D.prototype.node=function(w,C,F){var b,k;return w!=null&&(w=m(w)),C||(C={}),C=m(C),E(C)||(k=[C,F],F=k[0],C=k[1]),b=new a(this,w,C),F!=null&&b.text(F),this.children.push(b),b},D.prototype.text=function(w){var C;return E(w)&&this.element(w),C=new f(this,w),this.children.push(C),this},D.prototype.cdata=function(w){var C;return C=new r(this,w),this.children.push(C),this},D.prototype.comment=function(w){var C;return C=new n(this,w),this.children.push(C),this},D.prototype.commentBefore=function(w){var C,F,b;return F=this.parent.children.indexOf(this),b=this.parent.children.splice(F),C=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.commentAfter=function(w){var C,F,b;return F=this.parent.children.indexOf(this),b=this.parent.children.splice(F+1),C=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.raw=function(w){var C;return C=new d(this,w),this.children.push(C),this},D.prototype.dummy=function(){var w;return w=new o(this),w},D.prototype.instruction=function(w,C){var F,b,k,R,I;if(w!=null&&(w=m(w)),C!=null&&(C=m(C)),Array.isArray(w))for(R=0,I=w.length;R<I;R++)F=w[R],this.instruction(F);else if(E(w))for(F in w)p.call(w,F)&&(b=w[F],this.instruction(F,b));else v(C)&&(C=C.apply()),k=new h(this,w,C),this.children.push(k);return this},D.prototype.instructionBefore=function(w,C){var F,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b),F=this.parent.instruction(w,C),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.instructionAfter=function(w,C){var F,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b+1),F=this.parent.instruction(w,C),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.declaration=function(w,C,F){var b,k;return b=this.document(),k=new i(b,w,C,F),b.children.length===0?b.children.unshift(k):b.children[0].type===e.Declaration?b.children[0]=k:b.children.unshift(k),b.root()||b},D.prototype.dtd=function(w,C){var F,b,k,R,I,B,j,z,L,S;for(b=this.document(),k=new s(b,w,C),L=b.children,R=I=0,j=L.length;I<j;R=++I)if(F=L[R],F.type===e.DocType)return b.children[R]=k,k;for(S=b.children,R=B=0,z=S.length;B<z;R=++B)if(F=S[R],F.isRoot)return b.children.splice(R,0,k),k;return b.children.push(k),k},D.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},D.prototype.root=function(){var w;for(w=this;w;){if(w.type===e.Document)return w.rootObject;if(w.isRoot)return w;w=w.parent}},D.prototype.document=function(){var w;for(w=this;w;){if(w.type===e.Document)return w;w=w.parent}},D.prototype.end=function(w){return this.document().end(w)},D.prototype.prev=function(){var w;if(w=this.parent.children.indexOf(this),w<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[w-1]},D.prototype.next=function(){var w;if(w=this.parent.children.indexOf(this),w===-1||w===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[w+1]},D.prototype.importDocument=function(w){var C;return C=w.root().clone(),C.parent=this,C.isRoot=!1,this.children.push(C),this},D.prototype.debugInfo=function(w){var C,F;return w=w||this.name,w==null&&!((C=this.parent)!=null&&C.name)?"":w==null?"parent: <"+this.parent.name+">":(F=this.parent)!=null&&F.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},D.prototype.ele=function(w,C,F){return this.element(w,C,F)},D.prototype.nod=function(w,C,F){return this.node(w,C,F)},D.prototype.txt=function(w){return this.text(w)},D.prototype.dat=function(w){return this.cdata(w)},D.prototype.com=function(w){return this.comment(w)},D.prototype.ins=function(w,C){return this.instruction(w,C)},D.prototype.doc=function(){return this.document()},D.prototype.dec=function(w,C,F){return this.declaration(w,C,F)},D.prototype.e=function(w,C,F){return this.element(w,C,F)},D.prototype.n=function(w,C,F){return this.node(w,C,F)},D.prototype.t=function(w){return this.text(w)},D.prototype.d=function(w){return this.cdata(w)},D.prototype.c=function(w){return this.comment(w)},D.prototype.r=function(w){return this.raw(w)},D.prototype.i=function(w,C){return this.instruction(w,C)},D.prototype.u=function(){return this.up()},D.prototype.importXMLBuilder=function(w){return this.importDocument(w)},D.prototype.replaceChild=function(w,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.removeChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.appendChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.hasChildNodes=function(){return this.children.length!==0},D.prototype.cloneNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isSupported=function(w,C){return!0},D.prototype.hasAttributes=function(){return this.attribs.length!==0},D.prototype.compareDocumentPosition=function(w){var C,F;return C=this,C===w?0:this.document()!==w.document()?(F=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?F|=t.Preceding:F|=t.Following,F):C.isAncestor(w)?t.Contains|t.Preceding:C.isDescendant(w)?t.Contains|t.Following:C.isPreceding(w)?t.Preceding:t.Following},D.prototype.isSameNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupPrefix=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isDefaultNamespace=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupNamespaceURI=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isEqualNode=function(w){var C,F,b;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(C=F=0,b=this.children.length-1;0<=b?F<=b:F>=b;C=0<=b?++F:--F)if(!this.children[C].isEqualNode(w.children[C]))return!1;return!0},D.prototype.getFeature=function(w,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setUserData=function(w,C,F){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getUserData=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.contains=function(w){return w?w===this||this.isDescendant(w):!1},D.prototype.isDescendant=function(w){var C,F,b,k,R;for(R=this.children,b=0,k=R.length;b<k;b++)if(C=R[b],w===C||(F=C.isDescendant(w),F))return!0;return!1},D.prototype.isAncestor=function(w){return w.isDescendant(this)},D.prototype.isPreceding=function(w){var C,F;return C=this.treePosition(w),F=this.treePosition(this),C===-1||F===-1?!1:C<F},D.prototype.isFollowing=function(w){var C,F;return C=this.treePosition(w),F=this.treePosition(this),C===-1||F===-1?!1:C>F},D.prototype.treePosition=function(w){var C,F;return F=0,C=!1,this.foreachTreeNode(this.document(),function(b){if(F++,!C&&b===w)return C=!0}),C?F:-1},D.prototype.foreachTreeNode=function(w,C){var F,b,k,R,I;for(w||(w=this.document()),R=w.children,b=0,k=R.length;b<k;b++){if(F=R[b],I=C(F))return I;if(I=this.foreachTreeNode(F,C),I)return I}},D})()}).call(SN)});var _v=_((ON,xN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;xN.exports=t=(function(){function n(i){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var s,o,a;i||(i={}),this.options=i,this.options.version||(this.options.version="1.0"),o=i.stringify||{};for(s in o)r.call(o,s)&&(a=o[s],this[s]=a)}return n.prototype.name=function(i){return this.options.noValidation?i:this.assertLegalName(""+i||"")},n.prototype.text=function(i){return this.options.noValidation?i:this.assertLegalChar(this.textEscape(""+i||""))},n.prototype.cdata=function(i){return this.options.noValidation?i:(i=""+i||"",i=i.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(i))},n.prototype.comment=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+i);return this.assertLegalChar(i)},n.prototype.raw=function(i){return this.options.noValidation?i:""+i||""},n.prototype.attValue=function(i){return this.options.noValidation?i:this.assertLegalChar(this.attEscape(i=""+i||""))},n.prototype.insTarget=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.insValue=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/\?>/))throw new Error("Invalid processing instruction value: "+i);return this.assertLegalChar(i)},n.prototype.xmlVersion=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+i);return i},n.prototype.xmlEncoding=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+i);return this.assertLegalChar(i)},n.prototype.xmlStandalone=function(i){return this.options.noValidation?i:i?"yes":"no"},n.prototype.dtdPubID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdSysID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdElementValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttType=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttDefault=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdEntityValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdNData=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(i){var s,o;if(this.options.noValidation)return i;if(s="",this.options.version==="1.0"){if(s=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s))throw new Error("Invalid character in string: "+i+" at index "+o.index)}else if(this.options.version==="1.1"&&(s=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s)))throw new Error("Invalid character in string: "+i+" at index "+o.index);return i},n.prototype.assertLegalName=function(i){var s;if(this.options.noValidation)return i;if(this.assertLegalChar(i),s=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!i.match(s))throw new Error("Invalid character in name");return i},n.prototype.textEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n})()}).call(ON)});var Bc=_((TN,IN)=>{(function(){IN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(TN)});var Cv=_((PN,FN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,v,E={}.hasOwnProperty;v=Ln().assign,t=Ot(),u=zd(),c=Yd(),r=Hd(),n=Vd(),h=qd(),f=Jd(),m=Zd(),d=Qd(),l=bv(),i=Kd(),s=Wd(),o=Gd(),a=Xd(),e=Bc(),FN.exports=y=(function(){function A(p){var D,w,C;p||(p={}),this.options=p,w=p.writer||{};for(D in w)E.call(w,D)&&(C=w[D],this["_"+D]=this[D],this[D]=C)}return A.prototype.filterOptions=function(p){var D,w,C,F,b,k,R,I;return p||(p={}),p=v({},this.options,p),D={writer:this},D.pretty=p.pretty||!1,D.allowEmpty=p.allowEmpty||!1,D.indent=(w=p.indent)!=null?w:" ",D.newline=(C=p.newline)!=null?C:`
@@ -194,16 +194,16 @@ Actual: `+x.attribValue);else if(N==="xmlns"&&x.attribValue!==f)S(x,"xmlns: pref
194
194
  Actual: `+x.attribValue);else{var ne=x.tag,K=x.tags[x.tags.length-1]||x;ne.ns===K.ns&&(ne.ns=Object.create(K.ns)),ne.ns[N]=x.attribValue}x.attribList.push([x.attribName,x.attribValue])}else x.tag.attributes[x.attribName]=x.attribValue,I(x,"onattribute",{name:x.attribName,value:x.attribValue});x.attribName=x.attribValue=""}function q(x,O){if(x.opt.xmlns){var V=x.tag,N=P(x.tagName);V.prefix=N.prefix,V.local=N.local,V.uri=V.ns[N.prefix]||"",V.prefix&&!V.uri&&(S(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),V.uri=N.prefix);var ne=x.tags[x.tags.length-1]||x;V.ns&&ne.ns!==V.ns&&Object.keys(V.ns).forEach(function(Gb){I(x,"onopennamespace",{prefix:Gb,uri:V.ns[Gb]})});for(var K=0,oe=x.attribList.length;K<oe;K++){var we=x.attribList[K],Ie=we[0],Ve=we[1],bt=P(Ie,!0),pr=bt.prefix,hq=bt.local,Kb=pr===""?"":V.ns[pr]||"",Cm={name:Ie,value:Ve,prefix:pr,local:hq,uri:Kb};pr&&pr!=="xmlns"&&!Kb&&(S(x,"Unbound namespace prefix: "+JSON.stringify(pr)),Cm.uri=pr),x.tag.attributes[Ie]=Cm,I(x,"onattribute",Cm)}x.attribList.length=0}x.tag.isSelfClosing=!!O,x.sawRoot=!0,x.tags.push(x.tag),I(x,"onopentag",x.tag),O||(!x.noscript&&x.tagName.toLowerCase()==="script"?x.state=b.SCRIPT:x.state=b.TEXT,x.tag=null,x.tagName=""),x.attribName=x.attribValue="",x.attribList.length=0}function M(x){if(!x.tagName){S(x,"Weird empty close tag."),x.textNode+="</>",x.state=b.TEXT;return}if(x.script){if(x.tagName!=="script"){x.script+="</"+x.tagName+">",x.tagName="",x.state=b.SCRIPT;return}I(x,"onscript",x.script),x.script=""}var O=x.tags.length,V=x.tagName;x.strict||(V=V[x.looseCase]());for(var N=V;O--;){var ne=x.tags[O];if(ne.name!==N)S(x,"Unexpected close tag");else break}if(O<0){S(x,"Unmatched closing tag: "+x.tagName),x.textNode+="</"+x.tagName+">",x.state=b.TEXT;return}x.tagName=V;for(var K=x.tags.length;K-- >O;){var oe=x.tag=x.tags.pop();x.tagName=x.tag.name,I(x,"onclosetag",x.tagName);var we={};for(var Ie in oe.ns)we[Ie]=oe.ns[Ie];var Ve=x.tags[x.tags.length-1]||x;x.opt.xmlns&&oe.ns!==Ve.ns&&Object.keys(oe.ns).forEach(function(bt){var pr=oe.ns[bt];I(x,"onclosenamespace",{prefix:bt,uri:pr})})}O===0&&(x.closedRoot=!0),x.tagName=x.attribValue=x.attribName="",x.attribList.length=0,x.state=b.TEXT}function G(x){var O=x.entity,V=O.toLowerCase(),N,ne="";return x.ENTITIES[O]?x.ENTITIES[O]:x.ENTITIES[V]?x.ENTITIES[V]:(O=V,O.charAt(0)==="#"&&(O.charAt(1)==="x"?(O=O.slice(2),N=parseInt(O,16),ne=N.toString(16)):(O=O.slice(1),N=parseInt(O,10),ne=N.toString(10))),O=O.replace(/^0+/,""),isNaN(N)||ne.toLowerCase()!==O||N<0||N>1114111?(S(x,"Invalid character entity"),"&"+x.entity+";"):String.fromCodePoint(N))}function U(x,O){O==="<"?(x.state=b.OPEN_WAKA,x.startTagPosition=x.position):p(O)||(S(x,"Non-whitespace before first tag."),x.textNode=O,x.state=b.TEXT)}function H(x,O){var V="";return O<x.length&&(V=x.charAt(O)),V}function te(x){var O=this;if(this.error)throw this.error;if(O.closed)return z(O,"Cannot write after close. Assign an onready handler.");if(x===null)return L(O);typeof x=="object"&&(x=x.toString());for(var V=0,N="";N=H(x,V++),O.c=N,!!N;)switch(O.trackPosition&&(O.position++,N===`
195
195
  `?(O.line++,O.column=0):O.column++),O.state){case b.BEGIN:if(O.state=b.BEGIN_WHITESPACE,N==="\uFEFF")continue;U(O,N);continue;case b.BEGIN_WHITESPACE:U(O,N);continue;case b.TEXT:if(O.sawRoot&&!O.closedRoot){for(var K=V-1;N&&N!=="<"&&N!=="&";)N=H(x,V++),N&&O.trackPosition&&(O.position++,N===`
196
196
  `?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(K,V-1)}N==="<"&&!(O.sawRoot&&O.closedRoot&&!O.strict)?(O.state=b.OPEN_WAKA,O.startTagPosition=O.position):(!p(N)&&(!O.sawRoot||O.closedRoot)&&S(O,"Text data outside of root node."),N==="&"?O.state=b.TEXT_ENTITY:O.textNode+=N);continue;case b.SCRIPT:N==="<"?O.state=b.SCRIPT_ENDING:O.script+=N;continue;case b.SCRIPT_ENDING:N==="/"?O.state=b.CLOSE_TAG:(O.script+="<"+N,O.state=b.SCRIPT);continue;case b.OPEN_WAKA:if(N==="!")O.state=b.SGML_DECL,O.sgmlDecl="";else if(!p(N))if(C(y,N))O.state=b.OPEN_TAG,O.tagName=N;else if(N==="/")O.state=b.CLOSE_TAG,O.tagName="";else if(N==="?")O.state=b.PROC_INST,O.procInstName=O.procInstBody="";else{if(S(O,"Unencoded <"),O.startTagPosition+1<O.position){var ne=O.position-O.startTagPosition;N=new Array(ne).join(" ")+N}O.textNode+="<"+N,O.state=b.TEXT}continue;case b.SGML_DECL:if(O.sgmlDecl+N==="--"){O.state=b.COMMENT,O.comment="",O.sgmlDecl="";continue}O.doctype&&O.doctype!==!0&&O.sgmlDecl?(O.state=b.DOCTYPE_DTD,O.doctype+="<!"+O.sgmlDecl+N,O.sgmlDecl=""):(O.sgmlDecl+N).toUpperCase()===l?(I(O,"onopencdata"),O.state=b.CDATA,O.sgmlDecl="",O.cdata=""):(O.sgmlDecl+N).toUpperCase()===h?(O.state=b.DOCTYPE,(O.doctype||O.sawRoot)&&S(O,"Inappropriately located doctype declaration"),O.doctype="",O.sgmlDecl=""):N===">"?(I(O,"onsgmldeclaration",O.sgmlDecl),O.sgmlDecl="",O.state=b.TEXT):(D(N)&&(O.state=b.SGML_DECL_QUOTED),O.sgmlDecl+=N);continue;case b.SGML_DECL_QUOTED:N===O.q&&(O.state=b.SGML_DECL,O.q=""),O.sgmlDecl+=N;continue;case b.DOCTYPE:N===">"?(O.state=b.TEXT,I(O,"ondoctype",O.doctype),O.doctype=!0):(O.doctype+=N,N==="["?O.state=b.DOCTYPE_DTD:D(N)&&(O.state=b.DOCTYPE_QUOTED,O.q=N));continue;case b.DOCTYPE_QUOTED:O.doctype+=N,N===O.q&&(O.q="",O.state=b.DOCTYPE);continue;case b.DOCTYPE_DTD:N==="]"?(O.doctype+=N,O.state=b.DOCTYPE):N==="<"?(O.state=b.OPEN_WAKA,O.startTagPosition=O.position):D(N)?(O.doctype+=N,O.state=b.DOCTYPE_DTD_QUOTED,O.q=N):O.doctype+=N;continue;case b.DOCTYPE_DTD_QUOTED:O.doctype+=N,N===O.q&&(O.state=b.DOCTYPE_DTD,O.q="");continue;case b.COMMENT:N==="-"?O.state=b.COMMENT_ENDING:O.comment+=N;continue;case b.COMMENT_ENDING:N==="-"?(O.state=b.COMMENT_ENDED,O.comment=j(O.opt,O.comment),O.comment&&I(O,"oncomment",O.comment),O.comment=""):(O.comment+="-"+N,O.state=b.COMMENT);continue;case b.COMMENT_ENDED:N!==">"?(S(O,"Malformed comment"),O.comment+="--"+N,O.state=b.COMMENT):O.doctype&&O.doctype!==!0?O.state=b.DOCTYPE_DTD:O.state=b.TEXT;continue;case b.CDATA:for(var K=V-1;N&&N!=="]";)N=H(x,V++),N&&O.trackPosition&&(O.position++,N===`
197
- `?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(K,V-1),N==="]"&&(O.state=b.CDATA_ENDING);continue;case b.CDATA_ENDING:N==="]"?O.state=b.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=b.CDATA);continue;case b.CDATA_ENDING_2:N===">"?(O.cdata&&I(O,"oncdata",O.cdata),I(O,"onclosecdata"),O.cdata="",O.state=b.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=b.CDATA);continue;case b.PROC_INST:N==="?"?O.state=b.PROC_INST_ENDING:p(N)?O.state=b.PROC_INST_BODY:O.procInstName+=N;continue;case b.PROC_INST_BODY:if(!O.procInstBody&&p(N))continue;N==="?"?O.state=b.PROC_INST_ENDING:O.procInstBody+=N;continue;case b.PROC_INST_ENDING:N===">"?(I(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=b.TEXT):(O.procInstBody+="?"+N,O.state=b.PROC_INST_BODY);continue;case b.OPEN_TAG:C(v,N)?O.tagName+=N:(T(O),N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:(p(N)||S(O,"Invalid character in tag name"),O.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:N===">"?(q(O,!0),M(O)):(S(O,"Forward-slash in opening tag not followed by >"),O.state=b.ATTRIB);continue;case b.ATTRIB:if(p(N))continue;N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(y,N)?(O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):S(O,"Invalid attribute name");continue;case b.ATTRIB_NAME:N==="="?O.state=b.ATTRIB_VALUE:N===">"?(S(O,"Attribute without value"),O.attribValue=O.attribName,$(O),q(O)):p(N)?O.state=b.ATTRIB_NAME_SAW_WHITE:C(v,N)?O.attribName+=N:S(O,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=b.ATTRIB_VALUE;else{if(p(N))continue;S(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",I(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?q(O):C(y,N)?(O.attribName=N,O.state=b.ATTRIB_NAME):(S(O,"Invalid attribute name"),O.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(p(N))continue;D(N)?(O.q=N,O.state=b.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||z(O,"Unquoted attribute value"),O.state=b.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case b.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:p(N)?O.state=b.ATTRIB:N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(y,N)?(S(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):S(O,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?q(O):O.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(O.tagName)N===">"?M(O):C(v,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=b.SCRIPT):(p(N)||S(O,"Invalid tagname in closing tag"),O.state=b.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;F(y,N)?O.script?(O.script+="</"+N,O.state=b.SCRIPT):S(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case b.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?M(O):S(O,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var oe,we;switch(O.state){case b.TEXT_ENTITY:oe=b.TEXT,we="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:oe=b.ATTRIB_VALUE_QUOTED,we="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:oe=b.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var Ie=G(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(Ie)?(O.entity="",O.state=oe,O.write(Ie)):(O[we]+=Ie,O.entity="",O.state=oe)}else C(O.entity.length?A:E,N)?O.entity+=N:(S(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=oe);continue;default:throw new Error(O,"Unknown state: "+O.state)}return O.position>=O.bufferCheckPosition&&n(O),O}String.fromCodePoint||(function(){var x=String.fromCharCode,O=Math.floor,V=function(){var N=16384,ne=[],K,oe,we=-1,Ie=arguments.length;if(!Ie)return"";for(var Ve="";++we<Ie;){var bt=Number(arguments[we]);if(!isFinite(bt)||bt<0||bt>1114111||O(bt)!==bt)throw RangeError("Invalid code point: "+bt);bt<=65535?ne.push(bt):(bt-=65536,K=(bt>>10)+55296,oe=bt%1024+56320,ne.push(K,oe)),(we+1===Ie||ne.length>N)&&(Ve+=x.apply(null,ne),ne.length=0)}return Ve};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:V,configurable:!0,writable:!0}):String.fromCodePoint=V})()})(typeof tp>"u"?tp.sax={}:tp)});var GN=_(Ov=>{(function(){"use strict";Ov.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(Ov)});var xv=_(eo=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),eo.normalize=function(e){return e.toLowerCase()},eo.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},eo.stripPrefix=function(e){return e.replace(t,"")},eo.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},eo.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(eo)});var WN=_(di=>{(function(){"use strict";var t,e,r,n,i,s,o,a,u,c=function(d,f){return function(){return d.apply(f,arguments)}},l=function(d,f){for(var m in f)h.call(f,m)&&(d[m]=f[m]);function y(){this.constructor=d}return y.prototype=f.prototype,d.prototype=new y,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=KN(),n=require("events"),t=GN(),o=xv(),u=require("timers").setImmediate,e=Md().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var y,v,E;for(y=0,v=d.length;y<v;y++)E=d[y],f=E(f,m);return f},r=function(d,f,m){var y;return y=Object.create(null),y.value=m,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(d,f,y)},di.Parser=(function(d){l(f,d);function f(m){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var y,v,E;if(!(this instanceof di.Parser))return new di.Parser(m);this.options={},v=e["0.2"];for(y in v)h.call(v,y)&&(E=v[y],this.options[y]=E);for(y in m)h.call(m,y)&&(E=m[y],this.options[y]=E);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return f.prototype.processAsync=function(){var m,y;try{return this.remaining.length<=this.options.chunkSize?(m=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(m),this.saxParser.close()):(m=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(m),u(this.processAsync))}catch(v){if(y=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},f.prototype.assignOrPush=function(m,y,v){return y in m?(m[y]instanceof Array||r(m,y,[m[y]]),m[y].push(v)):this.options.explicitArray?r(m,y,[v]):r(m,y,v)},f.prototype.reset=function(){var m,y,v,E;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(A){return function(p){if(A.saxParser.resume(),!A.saxParser.errThrown)return A.saxParser.errThrown=!0,A.emit("error",p)}})(this),this.saxParser.onend=(function(A){return function(){if(!A.saxParser.ended)return A.saxParser.ended=!0,A.emit("end",A.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,E=[],m=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=(function(A){return function(p){var D,w,C,F,b;if(C={},C[y]="",!A.options.ignoreAttrs){b=p.attributes;for(D in b)h.call(b,D)&&(!(m in C)&&!A.options.mergeAttrs&&(C[m]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[D],D):p.attributes[D],F=A.options.attrNameProcessors?s(A.options.attrNameProcessors,D):D,A.options.mergeAttrs?A.assignOrPush(C,F,w):r(C[m],F,w))}return C["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(C[A.options.xmlnskey]={uri:p.uri,local:p.local}),E.push(C)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,D,w,C,F,b,k,R,I,B;if(b=E.pop(),F=b["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete b["#name"],b.cdata===!0&&(p=b.cdata,delete b.cdata),I=E[E.length-1],b[y].match(/^\s*$/)&&!p?(D=b[y],delete b[y]):(A.options.trim&&(b[y]=b[y].trim()),A.options.normalize&&(b[y]=b[y].replace(/\s{2,}/g," ").trim()),b[y]=A.options.valueProcessors?s(A.options.valueProcessors,b[y],F):b[y],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])),i(b)&&(typeof A.options.emptyTag=="function"?b=A.options.emptyTag():b=A.options.emptyTag!==""?A.options.emptyTag:D),A.options.validator!=null&&(B="/"+(function(){var j,z,L;for(L=[],j=0,z=E.length;j<z;j++)C=E[j],L.push(C["#name"]);return L})().concat(F).join("/"),(function(){var j;try{return b=A.options.validator(B,I&&I[F],b)}catch(z){return j=z,A.emit("error",j)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof b=="object"){if(!A.options.preserveChildrenOrder)C={},A.options.attrkey in b&&(C[A.options.attrkey]=b[A.options.attrkey],delete b[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in b&&(C[A.options.charkey]=b[A.options.charkey],delete b[A.options.charkey]),Object.getOwnPropertyNames(b).length>0&&(C[A.options.childkey]=b),b=C;else if(I){I[A.options.childkey]=I[A.options.childkey]||[],k={};for(w in b)h.call(b,w)&&r(k,w,b[w]);I[A.options.childkey].push(k),delete b["#name"],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])}}return E.length>0?A.assignOrPush(I,F,b):(A.options.explicitRoot&&(R=b,b={},r(b,F,R)),A.resultObject=b,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),v=(function(A){return function(p){var D,w;if(w=E[E.length-1],w)return w[y]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(w[A.options.childkey]=w[A.options.childkey]||[],D={"#name":"__text__"},D[y]=p,A.options.normalize&&(D[y]=D[y].replace(/\s{2,}/g," ").trim()),w[A.options.childkey].push(D)),w}})(this),this.saxParser.ontext=v,this.saxParser.oncdata=(function(A){return function(p){var D;if(D=v(p),D)return D.cdata=!0}})(this)},f.prototype.parseString=function(m,y){var v;y!=null&&typeof y=="function"&&(this.on("end",function(E){return this.reset(),y(null,E)}),this.on("error",function(E){return this.reset(),y(E)}));try{return m=m.toString(),m.trim()===""?(this.emit("end",null),!0):(m=t.stripBOM(m),this.options.async?(this.remaining=m,u(this.processAsync),this.saxParser):this.saxParser.write(m).close())}catch(E){if(v=E,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw v}else return this.emit("error",v),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(y){return function(v,E){return y.parseString(m,function(A,p){return A?E(A):v(p)})}})(this))},f})(n),di.parseString=function(d,f,m){var y,v,E;return m!=null?(typeof m=="function"&&(y=m),typeof f=="object"&&(v=f)):(typeof f=="function"&&(y=f),v={}),E=new di.Parser(v),E.parseString(d,y)},di.parseStringPromise=function(d,f){var m,y;return typeof f=="object"&&(m=f),y=new di.Parser(m),y.parseStringPromise(d)}}).call(di)});var XN=_(pi=>{(function(){"use strict";var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=Md(),t=zN(),r=WN(),n=xv(),pi.defaults=e.defaults,pi.processors=n,pi.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),pi.Builder=t.Builder,pi.Parser=r.Parser,pi.parseString=r.parseString,pi.parseStringPromise=r.parseStringPromise}).call(pi)});var YN=_(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.buildXmlElement=Bn.writeXML=Bn.parseXML=Bn.readXML=void 0;var gne=(he(),ce(fe)),yne=Sa(),jc=gne.__importDefault(XN());async function Dne(t){var e;try{let r=await(0,yne.readFile)(t,{encoding:"utf-8"});try{return await jc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Bn.readXML=Dne;function wne(t,e){let r=e!==void 0?new jc.default.Parser({...e}):new jc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Bn.parseXML=wne;async function vne(t){return new Promise(e=>{let n=new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Bn.writeXML=vne;function Ene(t,e){return new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Bn.buildXmlElement=Ene});var t$=_(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.getAllElements=Ue.getFilePath=Ue.getAssets=Ue.getJSModules=Ue.getPluginType=Ue.getPlatformElement=Ue.getPluginPlatform=Ue.printPlugins=Ue.fixName=Ue.getDependencies=Ue.resolvePlugin=Ue.getPlugins=Ue.getIncludedPluginPackages=void 0;var bne=(he(),ce(fe)),_ne=Sa(),Tv=require("path"),Ba=bne.__importDefault(Aa()),Cne=pd(),Sne=Sc(),JN=jd(),Ane=YN();function ZN(t,e){var r,n,i,s;let{extConfig:o}=t.app;switch(e){case"android":return(n=(r=o.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:o.includePlugins;case"ios":return(s=(i=o.ios)===null||i===void 0?void 0:i.includePlugins)!==null&&s!==void 0?s:o.includePlugins}}Ue.getIncludedPluginPackages=ZN;async function One(t,e){var r;let n=(r=ZN(t,e))!==null&&r!==void 0?r:e$(t);return(await Promise.all(n.map(async s=>QN(t,s)))).filter(s=>!!s)}Ue.getPlugins=One;async function QN(t,e){try{let r=(0,JN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Cne.fatal)(`Unable to find ${Ba.default.strong(`node_modules/${e}`)}.
197
+ `?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(K,V-1),N==="]"&&(O.state=b.CDATA_ENDING);continue;case b.CDATA_ENDING:N==="]"?O.state=b.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=b.CDATA);continue;case b.CDATA_ENDING_2:N===">"?(O.cdata&&I(O,"oncdata",O.cdata),I(O,"onclosecdata"),O.cdata="",O.state=b.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=b.CDATA);continue;case b.PROC_INST:N==="?"?O.state=b.PROC_INST_ENDING:p(N)?O.state=b.PROC_INST_BODY:O.procInstName+=N;continue;case b.PROC_INST_BODY:if(!O.procInstBody&&p(N))continue;N==="?"?O.state=b.PROC_INST_ENDING:O.procInstBody+=N;continue;case b.PROC_INST_ENDING:N===">"?(I(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=b.TEXT):(O.procInstBody+="?"+N,O.state=b.PROC_INST_BODY);continue;case b.OPEN_TAG:C(v,N)?O.tagName+=N:(T(O),N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:(p(N)||S(O,"Invalid character in tag name"),O.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:N===">"?(q(O,!0),M(O)):(S(O,"Forward-slash in opening tag not followed by >"),O.state=b.ATTRIB);continue;case b.ATTRIB:if(p(N))continue;N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(y,N)?(O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):S(O,"Invalid attribute name");continue;case b.ATTRIB_NAME:N==="="?O.state=b.ATTRIB_VALUE:N===">"?(S(O,"Attribute without value"),O.attribValue=O.attribName,$(O),q(O)):p(N)?O.state=b.ATTRIB_NAME_SAW_WHITE:C(v,N)?O.attribName+=N:S(O,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=b.ATTRIB_VALUE;else{if(p(N))continue;S(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",I(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?q(O):C(y,N)?(O.attribName=N,O.state=b.ATTRIB_NAME):(S(O,"Invalid attribute name"),O.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(p(N))continue;D(N)?(O.q=N,O.state=b.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||z(O,"Unquoted attribute value"),O.state=b.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case b.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:p(N)?O.state=b.ATTRIB:N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(y,N)?(S(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):S(O,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?q(O):O.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(O.tagName)N===">"?M(O):C(v,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=b.SCRIPT):(p(N)||S(O,"Invalid tagname in closing tag"),O.state=b.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;F(y,N)?O.script?(O.script+="</"+N,O.state=b.SCRIPT):S(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case b.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?M(O):S(O,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var oe,we;switch(O.state){case b.TEXT_ENTITY:oe=b.TEXT,we="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:oe=b.ATTRIB_VALUE_QUOTED,we="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:oe=b.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var Ie=G(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(Ie)?(O.entity="",O.state=oe,O.write(Ie)):(O[we]+=Ie,O.entity="",O.state=oe)}else C(O.entity.length?A:E,N)?O.entity+=N:(S(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=oe);continue;default:throw new Error(O,"Unknown state: "+O.state)}return O.position>=O.bufferCheckPosition&&n(O),O}String.fromCodePoint||(function(){var x=String.fromCharCode,O=Math.floor,V=function(){var N=16384,ne=[],K,oe,we=-1,Ie=arguments.length;if(!Ie)return"";for(var Ve="";++we<Ie;){var bt=Number(arguments[we]);if(!isFinite(bt)||bt<0||bt>1114111||O(bt)!==bt)throw RangeError("Invalid code point: "+bt);bt<=65535?ne.push(bt):(bt-=65536,K=(bt>>10)+55296,oe=bt%1024+56320,ne.push(K,oe)),(we+1===Ie||ne.length>N)&&(Ve+=x.apply(null,ne),ne.length=0)}return Ve};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:V,configurable:!0,writable:!0}):String.fromCodePoint=V})()})(typeof tp>"u"?tp.sax={}:tp)});var GN=_(Ov=>{(function(){"use strict";Ov.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(Ov)});var xv=_(eo=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),eo.normalize=function(e){return e.toLowerCase()},eo.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},eo.stripPrefix=function(e){return e.replace(t,"")},eo.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},eo.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(eo)});var WN=_(pi=>{(function(){"use strict";var t,e,r,n,i,s,o,a,u,c=function(d,f){return function(){return d.apply(f,arguments)}},l=function(d,f){for(var m in f)h.call(f,m)&&(d[m]=f[m]);function y(){this.constructor=d}return y.prototype=f.prototype,d.prototype=new y,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=KN(),n=require("events"),t=GN(),o=xv(),u=require("timers").setImmediate,e=Md().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var y,v,E;for(y=0,v=d.length;y<v;y++)E=d[y],f=E(f,m);return f},r=function(d,f,m){var y;return y=Object.create(null),y.value=m,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(d,f,y)},pi.Parser=(function(d){l(f,d);function f(m){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var y,v,E;if(!(this instanceof pi.Parser))return new pi.Parser(m);this.options={},v=e["0.2"];for(y in v)h.call(v,y)&&(E=v[y],this.options[y]=E);for(y in m)h.call(m,y)&&(E=m[y],this.options[y]=E);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return f.prototype.processAsync=function(){var m,y;try{return this.remaining.length<=this.options.chunkSize?(m=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(m),this.saxParser.close()):(m=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(m),u(this.processAsync))}catch(v){if(y=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},f.prototype.assignOrPush=function(m,y,v){return y in m?(m[y]instanceof Array||r(m,y,[m[y]]),m[y].push(v)):this.options.explicitArray?r(m,y,[v]):r(m,y,v)},f.prototype.reset=function(){var m,y,v,E;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(A){return function(p){if(A.saxParser.resume(),!A.saxParser.errThrown)return A.saxParser.errThrown=!0,A.emit("error",p)}})(this),this.saxParser.onend=(function(A){return function(){if(!A.saxParser.ended)return A.saxParser.ended=!0,A.emit("end",A.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,E=[],m=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=(function(A){return function(p){var D,w,C,F,b;if(C={},C[y]="",!A.options.ignoreAttrs){b=p.attributes;for(D in b)h.call(b,D)&&(!(m in C)&&!A.options.mergeAttrs&&(C[m]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[D],D):p.attributes[D],F=A.options.attrNameProcessors?s(A.options.attrNameProcessors,D):D,A.options.mergeAttrs?A.assignOrPush(C,F,w):r(C[m],F,w))}return C["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(C[A.options.xmlnskey]={uri:p.uri,local:p.local}),E.push(C)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,D,w,C,F,b,k,R,I,B;if(b=E.pop(),F=b["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete b["#name"],b.cdata===!0&&(p=b.cdata,delete b.cdata),I=E[E.length-1],b[y].match(/^\s*$/)&&!p?(D=b[y],delete b[y]):(A.options.trim&&(b[y]=b[y].trim()),A.options.normalize&&(b[y]=b[y].replace(/\s{2,}/g," ").trim()),b[y]=A.options.valueProcessors?s(A.options.valueProcessors,b[y],F):b[y],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])),i(b)&&(typeof A.options.emptyTag=="function"?b=A.options.emptyTag():b=A.options.emptyTag!==""?A.options.emptyTag:D),A.options.validator!=null&&(B="/"+(function(){var j,z,L;for(L=[],j=0,z=E.length;j<z;j++)C=E[j],L.push(C["#name"]);return L})().concat(F).join("/"),(function(){var j;try{return b=A.options.validator(B,I&&I[F],b)}catch(z){return j=z,A.emit("error",j)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof b=="object"){if(!A.options.preserveChildrenOrder)C={},A.options.attrkey in b&&(C[A.options.attrkey]=b[A.options.attrkey],delete b[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in b&&(C[A.options.charkey]=b[A.options.charkey],delete b[A.options.charkey]),Object.getOwnPropertyNames(b).length>0&&(C[A.options.childkey]=b),b=C;else if(I){I[A.options.childkey]=I[A.options.childkey]||[],k={};for(w in b)h.call(b,w)&&r(k,w,b[w]);I[A.options.childkey].push(k),delete b["#name"],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])}}return E.length>0?A.assignOrPush(I,F,b):(A.options.explicitRoot&&(R=b,b={},r(b,F,R)),A.resultObject=b,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),v=(function(A){return function(p){var D,w;if(w=E[E.length-1],w)return w[y]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(w[A.options.childkey]=w[A.options.childkey]||[],D={"#name":"__text__"},D[y]=p,A.options.normalize&&(D[y]=D[y].replace(/\s{2,}/g," ").trim()),w[A.options.childkey].push(D)),w}})(this),this.saxParser.ontext=v,this.saxParser.oncdata=(function(A){return function(p){var D;if(D=v(p),D)return D.cdata=!0}})(this)},f.prototype.parseString=function(m,y){var v;y!=null&&typeof y=="function"&&(this.on("end",function(E){return this.reset(),y(null,E)}),this.on("error",function(E){return this.reset(),y(E)}));try{return m=m.toString(),m.trim()===""?(this.emit("end",null),!0):(m=t.stripBOM(m),this.options.async?(this.remaining=m,u(this.processAsync),this.saxParser):this.saxParser.write(m).close())}catch(E){if(v=E,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw v}else return this.emit("error",v),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(y){return function(v,E){return y.parseString(m,function(A,p){return A?E(A):v(p)})}})(this))},f})(n),pi.parseString=function(d,f,m){var y,v,E;return m!=null?(typeof m=="function"&&(y=m),typeof f=="object"&&(v=f)):(typeof f=="function"&&(y=f),v={}),E=new pi.Parser(v),E.parseString(d,y)},pi.parseStringPromise=function(d,f){var m,y;return typeof f=="object"&&(m=f),y=new pi.Parser(m),y.parseStringPromise(d)}}).call(pi)});var XN=_(mi=>{(function(){"use strict";var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=Md(),t=zN(),r=WN(),n=xv(),mi.defaults=e.defaults,mi.processors=n,mi.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),mi.Builder=t.Builder,mi.Parser=r.Parser,mi.parseString=r.parseString,mi.parseStringPromise=r.parseStringPromise}).call(mi)});var YN=_(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.buildXmlElement=Bn.writeXML=Bn.parseXML=Bn.readXML=void 0;var gne=(he(),ce(fe)),yne=Sa(),jc=gne.__importDefault(XN());async function Dne(t){var e;try{let r=await(0,yne.readFile)(t,{encoding:"utf-8"});try{return await jc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Bn.readXML=Dne;function wne(t,e){let r=e!==void 0?new jc.default.Parser({...e}):new jc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Bn.parseXML=wne;async function vne(t){return new Promise(e=>{let n=new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Bn.writeXML=vne;function Ene(t,e){return new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Bn.buildXmlElement=Ene});var t$=_(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.getAllElements=Ue.getFilePath=Ue.getAssets=Ue.getJSModules=Ue.getPluginType=Ue.getPlatformElement=Ue.getPluginPlatform=Ue.printPlugins=Ue.fixName=Ue.getDependencies=Ue.resolvePlugin=Ue.getPlugins=Ue.getIncludedPluginPackages=void 0;var bne=(he(),ce(fe)),_ne=Sa(),Tv=require("path"),Ba=bne.__importDefault(Aa()),Cne=pd(),Sne=Sc(),JN=jd(),Ane=YN();function ZN(t,e){var r,n,i,s;let{extConfig:o}=t.app;switch(e){case"android":return(n=(r=o.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:o.includePlugins;case"ios":return(s=(i=o.ios)===null||i===void 0?void 0:i.includePlugins)!==null&&s!==void 0?s:o.includePlugins}}Ue.getIncludedPluginPackages=ZN;async function One(t,e){var r;let n=(r=ZN(t,e))!==null&&r!==void 0?r:e$(t);return(await Promise.all(n.map(async s=>QN(t,s)))).filter(s=>!!s)}Ue.getPlugins=One;async function QN(t,e){try{let r=(0,JN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Cne.fatal)(`Unable to find ${Ba.default.strong(`node_modules/${e}`)}.
198
198
  Are you sure ${Ba.default.strong(e)} is installed?`);let n=(0,Tv.dirname)(r),i=await(0,_ne.readJSON)(r);if(!i)return null;if(i.capacitor)return{id:e,name:Iv(e),version:i.version,rootPath:n,repository:i.repository,manifest:i.capacitor};let s=(0,Tv.join)(n,"plugin.xml"),o=await(0,Ane.readXML)(s);return{id:e,name:Iv(e),version:i.version,rootPath:n,repository:i.repository,xml:o.plugin}}catch{}return null}Ue.resolvePlugin=QN;function e$(t){var e,r;return[...Object.keys((e=t.app.package.dependencies)!==null&&e!==void 0?e:{}),...Object.keys((r=t.app.package.devDependencies)!==null&&r!==void 0?r:{})]}Ue.getDependencies=e$;function Iv(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Ue.fixName=Iv;function xne(t,e,r="capacitor"){if(t.length===0)return;let n,i=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${i} for ${Ba.default.strong(e)}:
199
199
  `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${i} for ${Ba.default.strong(e)}, skipped install:
200
200
  `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${i} for ${Ba.default.strong(e)}:
201
201
  `;break}n+=t.map(s=>`${s.id}${Ba.default.weak(`@${s.version}`)}`).join(`
202
- `),Sne.logger.info(n)}Ue.printPlugins=xne;function Pv(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Ue.getPluginPlatform=Pv;function Tne(t,e,r){let n=Pv(t,e);if(n){let i=n[r];if(i)return i}return[]}Ue.getPlatformElement=Tne;function Ine(t,e){var r,n,i,s;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}Ue.getPluginType=Ine;function Pne(t,e){return Fv(t,e,"js-module")}Ue.getJSModules=Pne;function Fne(t,e){return Fv(t,e,"asset")}Ue.getAssets=Fne;function Rne(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,JN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,Tv.join)(e.rootPath,r)}Ue.getFilePath=Rne;function Fv(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=Pv(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Ue.getAllElements=Fv});var r$=_(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.replace=jt.move=jt.splice=jt.reduce=jt.map=jt.filter=jt.concurrentFilter=jt.conform=void 0;function kne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}jt.conform=kne;async function Nne(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}jt.concurrentFilter=Nne;async function $ne(t,e){return Rv(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}jt.filter=$ne;async function Lne(t,e){return Rv(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}jt.map=Lne;async function Rv(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}jt.reduce=Rv;function rp(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}jt.splice=rp;function Bne(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:rp(rp(t,e,1),r,0,n)}jt.move=Bne;function jne(t,e,r){return e<0||e>t.length?[...t]:rp(t,e,1,r)}jt.replace=jne});var Mc=_(Qi=>{"use strict";var n$=Fe().fromCallback,ur=vt(),Mne=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ur[t]=="function");Object.keys(ur).forEach(t=>{t!=="promises"&&(Qi[t]=ur[t])});Mne.forEach(t=>{Qi[t]=n$(ur[t])});Qi.exists=function(t,e){return typeof e=="function"?ur.exists(t,e):new Promise(r=>ur.exists(t,r))};Qi.read=function(t,e,r,n,i,s){return typeof s=="function"?ur.read(t,e,r,n,i,s):new Promise((o,a)=>{ur.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};Qi.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.write(t,e,...r):new Promise((n,i)=>{ur.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ur.writev=="function"&&(Qi.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.writev(t,e,...r):new Promise((n,i)=>{ur.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ur.realpath.native=="function"&&(Qi.realpath.native=n$(ur.realpath.native))});var kv=_((Lve,i$)=>{i$.exports=t=>{let e=process.versions.node.split(".").map(r=>parseInt(r,10));return t=t.split(".").map(r=>parseInt(r,10)),e[0]>t[0]||e[0]===t[0]&&(e[1]>t[1]||e[1]===t[1]&&e[2]>=t[2])}});var c$=_((Bve,Nv)=>{"use strict";var ja=Mc(),mi=require("path"),Une=kv(),s$=Une("10.12.0"),o$=t=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(mi.parse(t).root,""))){let r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}},a$=t=>{let e={mode:511};return typeof t=="number"&&(t={mode:t}),{...e,...t}},u$=t=>{let e=new Error(`operation not permitted, mkdir '${t}'`);return e.code="EPERM",e.errno=-4048,e.path=t,e.syscall="mkdir",e};Nv.exports.makeDir=async(t,e)=>{if(o$(t),e=a$(e),s$){let n=mi.resolve(t);return ja.mkdir(n,{mode:e.mode,recursive:!0})}let r=async n=>{try{await ja.mkdir(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(mi.dirname(n)===n)throw u$(n);if(i.message.includes("null bytes"))throw i;return await r(mi.dirname(n)),r(n)}try{if(!(await ja.stat(n)).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(mi.resolve(t))};Nv.exports.makeDirSync=(t,e)=>{if(o$(t),e=a$(e),s$){let n=mi.resolve(t);return ja.mkdirSync(n,{mode:e.mode,recursive:!0})}let r=n=>{try{ja.mkdirSync(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(mi.dirname(n)===n)throw u$(n);if(i.message.includes("null bytes"))throw i;return r(mi.dirname(n)),r(n)}try{if(!ja.statSync(n).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(mi.resolve(t))}});var dn=_((jve,l$)=>{"use strict";var qne=Fe().fromPromise,{makeDir:Hne,makeDirSync:$v}=c$(),Lv=qne(Hne);l$.exports={mkdirs:Lv,mkdirsSync:$v,mkdirp:Lv,mkdirpSync:$v,ensureDir:Lv,ensureDirSync:$v}});var Bv=_((Mve,f$)=>{"use strict";var Ma=vt();function Vne(t,e,r,n){Ma.open(t,"r+",(i,s)=>{if(i)return n(i);Ma.futimes(s,e,r,o=>{Ma.close(s,a=>{n&&n(o||a)})})})}function zne(t,e,r){let n=Ma.openSync(t,"r+");return Ma.futimesSync(n,e,r),Ma.closeSync(n)}f$.exports={utimesMillis:Vne,utimesMillisSync:zne}});var Uc=_((Uve,m$)=>{"use strict";var Ua=Mc(),Ar=require("path"),Kne=require("util"),Gne=kv(),np=Gne("10.5.0"),h$=t=>np?Ua.stat(t,{bigint:!0}):Ua.stat(t),jv=t=>np?Ua.statSync(t,{bigint:!0}):Ua.statSync(t);function Wne(t,e){return Promise.all([h$(t),h$(e).catch(r=>{if(r.code==="ENOENT")return null;throw r})]).then(([r,n])=>({srcStat:r,destStat:n}))}function Xne(t,e){let r,n=jv(t);try{r=jv(e)}catch(i){if(i.code==="ENOENT")return{srcStat:n,destStat:null};throw i}return{srcStat:n,destStat:r}}function Yne(t,e,r,n){Kne.callbackify(Wne)(t,e,(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;return a&&ip(o,a)?n(new Error("Source and destination must not be the same.")):o.isDirectory()&&Mv(t,e)?n(new Error(sp(t,e,r))):n(null,{srcStat:o,destStat:a})})}function Jne(t,e,r){let{srcStat:n,destStat:i}=Xne(t,e);if(i&&ip(n,i))throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&Mv(t,e))throw new Error(sp(t,e,r));return{srcStat:n,destStat:i}}function d$(t,e,r,n,i){let s=Ar.resolve(Ar.dirname(t)),o=Ar.resolve(Ar.dirname(r));if(o===s||o===Ar.parse(o).root)return i();let a=(u,c)=>u?u.code==="ENOENT"?i():i(u):ip(e,c)?i(new Error(sp(t,r,n))):d$(t,e,o,n,i);np?Ua.stat(o,{bigint:!0},a):Ua.stat(o,a)}function p$(t,e,r,n){let i=Ar.resolve(Ar.dirname(t)),s=Ar.resolve(Ar.dirname(r));if(s===i||s===Ar.parse(s).root)return;let o;try{o=jv(s)}catch(a){if(a.code==="ENOENT")return;throw a}if(ip(e,o))throw new Error(sp(t,r,n));return p$(t,e,s,n)}function ip(t,e){return!!(e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev&&(np||e.ino<Number.MAX_SAFE_INTEGER||e.size===t.size&&e.mode===t.mode&&e.nlink===t.nlink&&e.atimeMs===t.atimeMs&&e.mtimeMs===t.mtimeMs&&e.ctimeMs===t.ctimeMs&&e.birthtimeMs===t.birthtimeMs))}function Mv(t,e){let r=Ar.resolve(t).split(Ar.sep).filter(i=>i),n=Ar.resolve(e).split(Ar.sep).filter(i=>i);return r.reduce((i,s,o)=>i&&n[o]===s,!0)}function sp(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}m$.exports={checkPaths:Yne,checkPathsSync:Jne,checkParentPaths:d$,checkParentPathsSync:p$,isSrcSubdir:Mv}});var v$=_((qve,w$)=>{"use strict";var Wt=vt(),qc=require("path"),Zne=dn().mkdirsSync,Qne=Bv().utimesMillisSync,Hc=Uc();function eie(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
202
+ `),Sne.logger.info(n)}Ue.printPlugins=xne;function Pv(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Ue.getPluginPlatform=Pv;function Tne(t,e,r){let n=Pv(t,e);if(n){let i=n[r];if(i)return i}return[]}Ue.getPlatformElement=Tne;function Ine(t,e){var r,n,i,s;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}Ue.getPluginType=Ine;function Pne(t,e){return Fv(t,e,"js-module")}Ue.getJSModules=Pne;function Fne(t,e){return Fv(t,e,"asset")}Ue.getAssets=Fne;function Rne(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,JN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,Tv.join)(e.rootPath,r)}Ue.getFilePath=Rne;function Fv(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=Pv(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Ue.getAllElements=Fv});var r$=_(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.replace=jt.move=jt.splice=jt.reduce=jt.map=jt.filter=jt.concurrentFilter=jt.conform=void 0;function kne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}jt.conform=kne;async function Nne(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}jt.concurrentFilter=Nne;async function $ne(t,e){return Rv(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}jt.filter=$ne;async function Lne(t,e){return Rv(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}jt.map=Lne;async function Rv(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}jt.reduce=Rv;function rp(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}jt.splice=rp;function Bne(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:rp(rp(t,e,1),r,0,n)}jt.move=Bne;function jne(t,e,r){return e<0||e>t.length?[...t]:rp(t,e,1,r)}jt.replace=jne});var Mc=_(Qi=>{"use strict";var n$=Fe().fromCallback,ur=vt(),Mne=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ur[t]=="function");Object.keys(ur).forEach(t=>{t!=="promises"&&(Qi[t]=ur[t])});Mne.forEach(t=>{Qi[t]=n$(ur[t])});Qi.exists=function(t,e){return typeof e=="function"?ur.exists(t,e):new Promise(r=>ur.exists(t,r))};Qi.read=function(t,e,r,n,i,s){return typeof s=="function"?ur.read(t,e,r,n,i,s):new Promise((o,a)=>{ur.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};Qi.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.write(t,e,...r):new Promise((n,i)=>{ur.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ur.writev=="function"&&(Qi.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.writev(t,e,...r):new Promise((n,i)=>{ur.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ur.realpath.native=="function"&&(Qi.realpath.native=n$(ur.realpath.native))});var kv=_((Lve,i$)=>{i$.exports=t=>{let e=process.versions.node.split(".").map(r=>parseInt(r,10));return t=t.split(".").map(r=>parseInt(r,10)),e[0]>t[0]||e[0]===t[0]&&(e[1]>t[1]||e[1]===t[1]&&e[2]>=t[2])}});var c$=_((Bve,Nv)=>{"use strict";var ja=Mc(),gi=require("path"),Une=kv(),s$=Une("10.12.0"),o$=t=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(gi.parse(t).root,""))){let r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}},a$=t=>{let e={mode:511};return typeof t=="number"&&(t={mode:t}),{...e,...t}},u$=t=>{let e=new Error(`operation not permitted, mkdir '${t}'`);return e.code="EPERM",e.errno=-4048,e.path=t,e.syscall="mkdir",e};Nv.exports.makeDir=async(t,e)=>{if(o$(t),e=a$(e),s$){let n=gi.resolve(t);return ja.mkdir(n,{mode:e.mode,recursive:!0})}let r=async n=>{try{await ja.mkdir(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(gi.dirname(n)===n)throw u$(n);if(i.message.includes("null bytes"))throw i;return await r(gi.dirname(n)),r(n)}try{if(!(await ja.stat(n)).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(gi.resolve(t))};Nv.exports.makeDirSync=(t,e)=>{if(o$(t),e=a$(e),s$){let n=gi.resolve(t);return ja.mkdirSync(n,{mode:e.mode,recursive:!0})}let r=n=>{try{ja.mkdirSync(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(gi.dirname(n)===n)throw u$(n);if(i.message.includes("null bytes"))throw i;return r(gi.dirname(n)),r(n)}try{if(!ja.statSync(n).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(gi.resolve(t))}});var mn=_((jve,l$)=>{"use strict";var qne=Fe().fromPromise,{makeDir:Hne,makeDirSync:$v}=c$(),Lv=qne(Hne);l$.exports={mkdirs:Lv,mkdirsSync:$v,mkdirp:Lv,mkdirpSync:$v,ensureDir:Lv,ensureDirSync:$v}});var Bv=_((Mve,f$)=>{"use strict";var Ma=vt();function Vne(t,e,r,n){Ma.open(t,"r+",(i,s)=>{if(i)return n(i);Ma.futimes(s,e,r,o=>{Ma.close(s,a=>{n&&n(o||a)})})})}function zne(t,e,r){let n=Ma.openSync(t,"r+");return Ma.futimesSync(n,e,r),Ma.closeSync(n)}f$.exports={utimesMillis:Vne,utimesMillisSync:zne}});var Uc=_((Uve,m$)=>{"use strict";var Ua=Mc(),Ar=require("path"),Kne=require("util"),Gne=kv(),np=Gne("10.5.0"),h$=t=>np?Ua.stat(t,{bigint:!0}):Ua.stat(t),jv=t=>np?Ua.statSync(t,{bigint:!0}):Ua.statSync(t);function Wne(t,e){return Promise.all([h$(t),h$(e).catch(r=>{if(r.code==="ENOENT")return null;throw r})]).then(([r,n])=>({srcStat:r,destStat:n}))}function Xne(t,e){let r,n=jv(t);try{r=jv(e)}catch(i){if(i.code==="ENOENT")return{srcStat:n,destStat:null};throw i}return{srcStat:n,destStat:r}}function Yne(t,e,r,n){Kne.callbackify(Wne)(t,e,(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;return a&&ip(o,a)?n(new Error("Source and destination must not be the same.")):o.isDirectory()&&Mv(t,e)?n(new Error(sp(t,e,r))):n(null,{srcStat:o,destStat:a})})}function Jne(t,e,r){let{srcStat:n,destStat:i}=Xne(t,e);if(i&&ip(n,i))throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&Mv(t,e))throw new Error(sp(t,e,r));return{srcStat:n,destStat:i}}function d$(t,e,r,n,i){let s=Ar.resolve(Ar.dirname(t)),o=Ar.resolve(Ar.dirname(r));if(o===s||o===Ar.parse(o).root)return i();let a=(u,c)=>u?u.code==="ENOENT"?i():i(u):ip(e,c)?i(new Error(sp(t,r,n))):d$(t,e,o,n,i);np?Ua.stat(o,{bigint:!0},a):Ua.stat(o,a)}function p$(t,e,r,n){let i=Ar.resolve(Ar.dirname(t)),s=Ar.resolve(Ar.dirname(r));if(s===i||s===Ar.parse(s).root)return;let o;try{o=jv(s)}catch(a){if(a.code==="ENOENT")return;throw a}if(ip(e,o))throw new Error(sp(t,r,n));return p$(t,e,s,n)}function ip(t,e){return!!(e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev&&(np||e.ino<Number.MAX_SAFE_INTEGER||e.size===t.size&&e.mode===t.mode&&e.nlink===t.nlink&&e.atimeMs===t.atimeMs&&e.mtimeMs===t.mtimeMs&&e.ctimeMs===t.ctimeMs&&e.birthtimeMs===t.birthtimeMs))}function Mv(t,e){let r=Ar.resolve(t).split(Ar.sep).filter(i=>i),n=Ar.resolve(e).split(Ar.sep).filter(i=>i);return r.reduce((i,s,o)=>i&&n[o]===s,!0)}function sp(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}m$.exports={checkPaths:Yne,checkPathsSync:Jne,checkParentPaths:d$,checkParentPathsSync:p$,isSrcSubdir:Mv}});var v$=_((qve,w$)=>{"use strict";var Wt=vt(),qc=require("path"),Zne=mn().mkdirsSync,Qne=Bv().utimesMillisSync,Hc=Uc();function eie(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
203
203
 
204
- see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=Hc.checkPathsSync(t,e,"copy");return Hc.checkParentPathsSync(t,n,e,"copy"),tie(i,t,e,r)}function tie(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let i=qc.dirname(r);return Wt.existsSync(i)||Zne(i),g$(t,e,r,n)}function g$(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return rie(t,e,r,n)}function rie(t,e,r,n){let s=(n.dereference?Wt.statSync:Wt.lstatSync)(e);if(s.isDirectory())return cie(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return nie(s,t,e,r,n);if(s.isSymbolicLink())return hie(t,e,r,n)}function nie(t,e,r,n,i){return e?iie(t,r,n,i):y$(t,r,n,i)}function iie(t,e,r,n){if(n.overwrite)return Wt.unlinkSync(r),y$(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function y$(t,e,r,n){return Wt.copyFileSync(e,r),n.preserveTimestamps&&sie(t.mode,e,r),Uv(r,t.mode)}function sie(t,e,r){return oie(t)&&aie(r,t),uie(e,r)}function oie(t){return(t&128)===0}function aie(t,e){return Uv(t,e|128)}function Uv(t,e){return Wt.chmodSync(t,e)}function uie(t,e){let r=Wt.statSync(t);return Qne(e,r.atime,r.mtime)}function cie(t,e,r,n,i){if(!e)return lie(t.mode,r,n,i);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return D$(r,n,i)}function lie(t,e,r,n){return Wt.mkdirSync(r),D$(e,r,n),Uv(r,t)}function D$(t,e,r){Wt.readdirSync(t).forEach(n=>fie(n,t,e,r))}function fie(t,e,r,n){let i=qc.join(e,t),s=qc.join(r,t),{destStat:o}=Hc.checkPathsSync(i,s,"copy");return g$(o,i,s,n)}function hie(t,e,r,n){let i=Wt.readlinkSync(e);if(n.dereference&&(i=qc.resolve(process.cwd(),i)),t){let s;try{s=Wt.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Wt.symlinkSync(i,r);throw o}if(n.dereference&&(s=qc.resolve(process.cwd(),s)),Hc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Wt.statSync(r).isDirectory()&&Hc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return die(i,r)}else return Wt.symlinkSync(i,r)}function die(t,e){return Wt.unlinkSync(e),Wt.symlinkSync(t,e)}w$.exports=eie});var qv=_((Hve,E$)=>{"use strict";E$.exports={copySync:v$()}});var es=_((Vve,_$)=>{"use strict";var pie=Fe().fromPromise,b$=Mc();function mie(t){return b$.access(t).then(()=>!0).catch(()=>!1)}_$.exports={pathExists:pie(mie),pathExistsSync:b$.existsSync}});var F$=_((zve,P$)=>{"use strict";var Or=vt(),Vc=require("path"),gie=dn().mkdirs,yie=es().pathExists,Die=Bv().utimesMillis,zc=Uc();function wie(t,e,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
204
+ see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=Hc.checkPathsSync(t,e,"copy");return Hc.checkParentPathsSync(t,n,e,"copy"),tie(i,t,e,r)}function tie(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let i=qc.dirname(r);return Wt.existsSync(i)||Zne(i),g$(t,e,r,n)}function g$(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return rie(t,e,r,n)}function rie(t,e,r,n){let s=(n.dereference?Wt.statSync:Wt.lstatSync)(e);if(s.isDirectory())return cie(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return nie(s,t,e,r,n);if(s.isSymbolicLink())return hie(t,e,r,n)}function nie(t,e,r,n,i){return e?iie(t,r,n,i):y$(t,r,n,i)}function iie(t,e,r,n){if(n.overwrite)return Wt.unlinkSync(r),y$(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function y$(t,e,r,n){return Wt.copyFileSync(e,r),n.preserveTimestamps&&sie(t.mode,e,r),Uv(r,t.mode)}function sie(t,e,r){return oie(t)&&aie(r,t),uie(e,r)}function oie(t){return(t&128)===0}function aie(t,e){return Uv(t,e|128)}function Uv(t,e){return Wt.chmodSync(t,e)}function uie(t,e){let r=Wt.statSync(t);return Qne(e,r.atime,r.mtime)}function cie(t,e,r,n,i){if(!e)return lie(t.mode,r,n,i);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return D$(r,n,i)}function lie(t,e,r,n){return Wt.mkdirSync(r),D$(e,r,n),Uv(r,t)}function D$(t,e,r){Wt.readdirSync(t).forEach(n=>fie(n,t,e,r))}function fie(t,e,r,n){let i=qc.join(e,t),s=qc.join(r,t),{destStat:o}=Hc.checkPathsSync(i,s,"copy");return g$(o,i,s,n)}function hie(t,e,r,n){let i=Wt.readlinkSync(e);if(n.dereference&&(i=qc.resolve(process.cwd(),i)),t){let s;try{s=Wt.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Wt.symlinkSync(i,r);throw o}if(n.dereference&&(s=qc.resolve(process.cwd(),s)),Hc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Wt.statSync(r).isDirectory()&&Hc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return die(i,r)}else return Wt.symlinkSync(i,r)}function die(t,e){return Wt.unlinkSync(e),Wt.symlinkSync(t,e)}w$.exports=eie});var qv=_((Hve,E$)=>{"use strict";E$.exports={copySync:v$()}});var es=_((Vve,_$)=>{"use strict";var pie=Fe().fromPromise,b$=Mc();function mie(t){return b$.access(t).then(()=>!0).catch(()=>!1)}_$.exports={pathExists:pie(mie),pathExistsSync:b$.existsSync}});var F$=_((zve,P$)=>{"use strict";var Or=vt(),Vc=require("path"),gie=mn().mkdirs,yie=es().pathExists,Die=Bv().utimesMillis,zc=Uc();function wie(t,e,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
205
205
 
206
- see https://github.com/jprichardson/node-fs-extra/issues/269`),zc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;zc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?O$(C$,a,t,e,r,n):C$(a,t,e,r,n))})}function C$(t,e,r,n,i){let s=Vc.dirname(r);yie(s,(o,a)=>{if(o)return i(o);if(a)return Hv(t,e,r,n,i);gie(s,u=>u?i(u):Hv(t,e,r,n,i))})}function O$(t,e,r,n,i,s){Promise.resolve(i.filter(r,n)).then(o=>o?t(e,r,n,i,s):s(),o=>s(o))}function Hv(t,e,r,n,i){return n.filter?O$(S$,t,e,r,n,i):S$(t,e,r,n,i)}function S$(t,e,r,n,i){(n.dereference?Or.stat:Or.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Aie(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return vie(a,t,e,r,n,i);if(a.isSymbolicLink())return Tie(t,e,r,n,i)})}function vie(t,e,r,n,i,s){return e?Eie(t,r,n,i,s):x$(t,r,n,i,s)}function Eie(t,e,r,n,i){if(n.overwrite)Or.unlink(r,s=>s?i(s):x$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function x$(t,e,r,n,i){Or.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?bie(t.mode,e,r,i):op(r,t.mode,i))}function bie(t,e,r,n){return _ie(t)?Cie(r,t,i=>i?n(i):A$(t,e,r,n)):A$(t,e,r,n)}function _ie(t){return(t&128)===0}function Cie(t,e,r){return op(t,e|128,r)}function A$(t,e,r,n){Sie(e,r,i=>i?n(i):op(r,t,n))}function op(t,e,r){return Or.chmod(t,e,r)}function Sie(t,e,r){Or.stat(t,(n,i)=>n?r(n):Die(e,i.atime,i.mtime,r))}function Aie(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):T$(r,n,i,s):Oie(t.mode,r,n,i,s)}function Oie(t,e,r,n,i){Or.mkdir(r,s=>{if(s)return i(s);T$(e,r,n,o=>o?i(o):op(r,t,i))})}function T$(t,e,r,n){Or.readdir(t,(i,s)=>i?n(i):I$(s,t,e,r,n))}function I$(t,e,r,n,i){let s=t.pop();return s?xie(t,s,e,r,n,i):i()}function xie(t,e,r,n,i,s){let o=Vc.join(r,e),a=Vc.join(n,e);zc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Hv(l,o,a,i,h=>h?s(h):I$(t,r,n,i,s))})}function Tie(t,e,r,n,i){Or.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=Vc.resolve(process.cwd(),o)),t)Or.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Or.symlink(o,r,i):i(a):(n.dereference&&(u=Vc.resolve(process.cwd(),u)),zc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&zc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Iie(o,r,i)));else return Or.symlink(o,r,i)})}function Iie(t,e,r){Or.unlink(e,n=>n?r(n):Or.symlink(t,e,r))}P$.exports=wie});var Vv=_((Kve,R$)=>{"use strict";var Pie=Fe().fromCallback;R$.exports={copy:Pie(F$())}});var q$=_((Gve,U$)=>{"use strict";var k$=vt(),B$=require("path"),He=require("assert"),Kc=process.platform==="win32";function j$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||k$[r],r=r+"Sync",t[r]=t[r]||k$[r]}),t.maxBusyTries=t.maxBusyTries||3}function zv(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He.strictEqual(typeof r,"function","rimraf: callback function required"),He(e,"rimraf: invalid options argument provided"),He.strictEqual(typeof e,"object","rimraf: options should be object"),j$(e),N$(t,e,function i(s){if(s){if((s.code==="EBUSY"||s.code==="ENOTEMPTY"||s.code==="EPERM")&&n<e.maxBusyTries){n++;let o=n*100;return setTimeout(()=>N$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function N$(t,e,r){He(t),He(e),He(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Kc)return $$(t,e,n,r);if(i&&i.isDirectory())return ap(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return Kc?$$(t,e,s,r):ap(t,e,s,r);if(s.code==="EISDIR")return ap(t,e,s,r)}return r(s)})})}function $$(t,e,r,n){He(t),He(e),He(typeof n=="function"),e.chmod(t,438,i=>{i?n(i.code==="ENOENT"?null:r):e.stat(t,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?ap(t,e,r,n):e.unlink(t,n)})})}function L$(t,e,r){let n;He(t),He(e);try{e.chmodSync(t,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=e.statSync(t)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?up(t,e,r):e.unlinkSync(t)}function ap(t,e,r,n){He(t),He(e),He(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?Fie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function Fie(t,e,r){He(t),He(e),He(typeof r=="function"),e.readdir(t,(n,i)=>{if(n)return r(n);let s=i.length,o;if(s===0)return e.rmdir(t,r);i.forEach(a=>{zv(B$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function M$(t,e){let r;e=e||{},j$(e),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He(e,"rimraf: missing options"),He.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Kc&&L$(t,e,n)}try{r&&r.isDirectory()?up(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Kc?L$(t,e,n):up(t,e,n);if(n.code!=="EISDIR")throw n;up(t,e,n)}}function up(t,e,r){He(t),He(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")Rie(t,e);else if(n.code!=="ENOENT")throw n}}function Rie(t,e){if(He(t),He(e),e.readdirSync(t).forEach(r=>M$(B$.join(t,r),e)),Kc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}U$.exports=zv;zv.sync=M$});var Gc=_((Wve,V$)=>{"use strict";var kie=Fe().fromCallback,H$=q$();V$.exports={remove:kie(H$),removeSync:H$.sync}});var Z$=_((Xve,J$)=>{"use strict";var Nie=Fe().fromCallback,G$=vt(),W$=require("path"),X$=dn(),Y$=Gc(),z$=Nie(function(e,r){r=r||function(){},G$.readdir(e,(n,i)=>{if(n)return X$.mkdirs(e,r);i=i.map(o=>W$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();Y$.remove(o,a=>{if(a)return r(a);s()})}})});function K$(t){let e;try{e=G$.readdirSync(t)}catch{return X$.mkdirsSync(t)}e.forEach(r=>{r=W$.join(t,r),Y$.removeSync(r)})}J$.exports={emptyDirSync:K$,emptydirSync:K$,emptyDir:z$,emptydir:z$}});var rL=_((Yve,tL)=>{"use strict";var $ie=Fe().fromCallback,Q$=require("path"),ts=vt(),eL=dn();function Lie(t,e){function r(){ts.writeFile(t,"",n=>{if(n)return e(n);e()})}ts.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=Q$.dirname(t);ts.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?eL.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():ts.readdir(s,u=>{if(u)return e(u)})})})}function Bie(t){let e;try{e=ts.statSync(t)}catch{}if(e&&e.isFile())return;let r=Q$.dirname(t);try{ts.statSync(r).isDirectory()||ts.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")eL.mkdirsSync(r);else throw n}ts.writeFileSync(t,"")}tL.exports={createFile:$ie(Lie),createFileSync:Bie}});var aL=_((Jve,oL)=>{"use strict";var jie=Fe().fromCallback,iL=require("path"),to=vt(),sL=dn(),nL=es().pathExists;function Mie(t,e,r){function n(i,s){to.link(i,s,o=>{if(o)return r(o);r(null)})}nL(e,(i,s)=>{if(i)return r(i);if(s)return r(null);to.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=iL.dirname(e);nL(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);sL.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function Uie(t,e){if(to.existsSync(e))return;try{to.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=iL.dirname(e);return to.existsSync(n)||sL.mkdirsSync(n),to.linkSync(t,e)}oL.exports={createLink:jie(Mie),createLinkSync:Uie}});var cL=_((Zve,uL)=>{"use strict";var rs=require("path"),Wc=vt(),qie=es().pathExists;function Hie(t,e,r){if(rs.isAbsolute(t))return Wc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=rs.dirname(e),i=rs.join(n,t);return qie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Wc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:rs.relative(n,t)})))}}function Vie(t,e){let r;if(rs.isAbsolute(t)){if(r=Wc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=rs.dirname(e),i=rs.join(n,t);if(r=Wc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Wc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:rs.relative(n,t)}}}uL.exports={symlinkPaths:Hie,symlinkPathsSync:Vie}});var hL=_((Qve,fL)=>{"use strict";var lL=vt();function zie(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);lL.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function Kie(t,e){let r;if(e)return e;try{r=lL.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}fL.exports={symlinkType:zie,symlinkTypeSync:Kie}});var wL=_((eEe,DL)=>{"use strict";var Gie=Fe().fromCallback,pL=require("path"),qa=vt(),mL=dn(),Wie=mL.mkdirs,Xie=mL.mkdirsSync,gL=cL(),Yie=gL.symlinkPaths,Jie=gL.symlinkPathsSync,yL=hL(),Zie=yL.symlinkType,Qie=yL.symlinkTypeSync,dL=es().pathExists;function ese(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,dL(e,(i,s)=>{if(i)return n(i);if(s)return n(null);Yie(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,Zie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=pL.dirname(e);dL(l,(h,d)=>{if(h)return n(h);if(d)return qa.symlink(t,e,c,n);Wie(l,f=>{if(f)return n(f);qa.symlink(t,e,c,n)})})})})})}function tse(t,e,r){if(qa.existsSync(e))return;let i=Jie(t,e);t=i.toDst,r=Qie(i.toCwd,r);let s=pL.dirname(e);return qa.existsSync(s)||Xie(s),qa.symlinkSync(t,e,r)}DL.exports={createSymlink:Gie(ese),createSymlinkSync:tse}});var EL=_((tEe,vL)=>{"use strict";var cp=rL(),lp=aL(),fp=wL();vL.exports={createFile:cp.createFile,createFileSync:cp.createFileSync,ensureFile:cp.createFile,ensureFileSync:cp.createFileSync,createLink:lp.createLink,createLinkSync:lp.createLinkSync,ensureLink:lp.createLink,ensureLinkSync:lp.createLinkSync,createSymlink:fp.createSymlink,createSymlinkSync:fp.createSymlinkSync,ensureSymlink:fp.createSymlink,ensureSymlinkSync:fp.createSymlinkSync}});var _L=_((rEe,bL)=>{"use strict";var hp=k0();bL.exports={readJson:hp.readFile,readJsonSync:hp.readFileSync,writeJson:hp.writeFile,writeJsonSync:hp.writeFileSync}});var dp=_((nEe,AL)=>{"use strict";var rse=Fe().fromCallback,Xc=vt(),CL=require("path"),SL=dn(),nse=es().pathExists;function ise(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=CL.dirname(t);nse(i,(s,o)=>{if(s)return n(s);if(o)return Xc.writeFile(t,e,r,n);SL.mkdirs(i,a=>{if(a)return n(a);Xc.writeFile(t,e,r,n)})})}function sse(t,...e){let r=CL.dirname(t);if(Xc.existsSync(r))return Xc.writeFileSync(t,...e);SL.mkdirsSync(r),Xc.writeFileSync(t,...e)}AL.exports={outputFile:rse(ise),outputFileSync:sse}});var xL=_((iEe,OL)=>{"use strict";var{stringify:ose}=_a(),{outputFile:ase}=dp();async function use(t,e,r={}){let n=ose(e,r);await ase(t,n,r)}OL.exports=use});var IL=_((sEe,TL)=>{"use strict";var{stringify:cse}=_a(),{outputFileSync:lse}=dp();function fse(t,e,r){let n=cse(e,r);lse(t,n,r)}TL.exports=fse});var FL=_((oEe,PL)=>{"use strict";var hse=Fe().fromPromise,cr=_L();cr.outputJson=hse(xL());cr.outputJsonSync=IL();cr.outputJSON=cr.outputJson;cr.outputJSONSync=cr.outputJsonSync;cr.writeJSON=cr.writeJson;cr.writeJSONSync=cr.writeJsonSync;cr.readJSON=cr.readJson;cr.readJSONSync=cr.readJsonSync;PL.exports=cr});var BL=_((aEe,LL)=>{"use strict";var NL=vt(),dse=require("path"),pse=qv().copySync,$L=Gc().removeSync,mse=dn().mkdirpSync,RL=Uc();function gse(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=RL.checkPathsSync(t,e,"move");return RL.checkParentPathsSync(t,i,e,"move"),mse(dse.dirname(e)),yse(t,e,n)}function yse(t,e,r){if(r)return $L(e),kL(t,e,r);if(NL.existsSync(e))throw new Error("dest already exists.");return kL(t,e,r)}function kL(t,e,r){try{NL.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Dse(t,e,r)}}function Dse(t,e,r){return pse(t,e,{overwrite:r,errorOnExist:!0}),$L(t)}LL.exports=gse});var ML=_((uEe,jL)=>{"use strict";jL.exports={moveSync:BL()}});var zL=_((cEe,VL)=>{"use strict";var wse=vt(),vse=require("path"),Ese=Vv().copy,HL=Gc().remove,bse=dn().mkdirp,_se=es().pathExists,UL=Uc();function Cse(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;UL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;UL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);bse(vse.dirname(e),c=>c?n(c):Sse(t,e,i,n))})})}function Sse(t,e,r,n){if(r)return HL(e,i=>i?n(i):qL(t,e,r,n));_se(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):qL(t,e,r,n))}function qL(t,e,r,n){wse.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Ase(t,e,r,n):n())}function Ase(t,e,r,n){Ese(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):HL(t,n))}VL.exports=Cse});var GL=_((lEe,KL)=>{"use strict";var Ose=Fe().fromCallback;KL.exports={move:Ose(zL())}});var pp=_((fEe,Kv)=>{"use strict";Kv.exports={...Mc(),...qv(),...Vv(),...Z$(),...EL(),...FL(),...dn(),...ML(),...GL(),...dp(),...es(),...Gc()};var WL=require("fs");Object.getOwnPropertyDescriptor(WL,"promises")&&Object.defineProperty(Kv.exports,"promises",{get(){return WL.promises}})});var Gv=_(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.readdir=Ha.stat=void 0;var XL=pp();async function xse(t){try{return await XL.stat(t)}catch{}}Ha.stat=xse;async function Tse(t){try{return await XL.readdir(t)}catch{return[]}}Ha.readdir=Tse});var t3=_(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.walk=me.Walker=me.compilePaths=me.tmpfilepath=me.findBaseDirectory=me.isExecutableFile=me.pathExecutable=me.pathWritable=me.pathReadable=me.pathExists=me.pathAccessible=me.writeStreamToFile=me.cacheFileChecksum=me.getFileChecksums=me.getFileChecksum=me.fileToString=me.getFileTree=me.readdirp=me.readdirSafe=me.statSafe=void 0;var Ise=(he(),ce(fe)),Yr=pp(),Pse=require("os"),gi=require("path"),YL=require("stream"),JL=Gv();Ise.__exportStar(pp(),me);var ZL=Gv();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return ZL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return ZL.readdir}});async function Fse(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=Xv(t,n);e&&(a=a.pipe(new YL.Transform({objectMode:!0,transform(u,c,l){(!e||e(u))&&this.push(u),l()}}))),a.on("error",u=>r?r(u):s(u)).on("data",u=>o.push(u.path)).on("end",()=>i(o))})}me.readdirp=Fse;async function Rse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=gi.dirname(u.path),l=s.get(c);return l&&l.type==="directory"?l:n({path:c,type:"directory",children:[]})},a=(u,c)=>{let l={path:u.path,parent:c};return u.stats.isDirectory()?n({...l,type:"directory",children:[]}):r({...l,type:"file"})};return new Promise((u,c)=>{t=gi.resolve(t),Xv(t,i).on("error",h=>e?e(h):c(h)).on("data",h=>{let d=o(h),f=a(h,d);d.children.push(f),s.set(h.path,f),s.set(d.path,d)}).on("end",()=>{let h=s.get(t);if(!h)return c(new Error("No root node found after walking directory structure."));delete h.parent,u(h)})})}me.getFileTree=Rse;async function kse(t){try{return await Yr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=kse;async function Wv(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Yr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=Wv;async function Nse(t){return Promise.all([Wv(t),(async()=>{try{return(await Yr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=Nse;async function $se(t,e){let r=await Wv(t);await Yr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=$se;function Lse(t,e){return new Promise((r,n)=>{let i=Yr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=Lse;async function Yc(t,e){try{await Yr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Yc;async function Bse(t){return Yc(t,Yr.constants.F_OK)}me.pathExists=Bse;async function jse(t){return Yc(t,Yr.constants.R_OK)}me.pathReadable=jse;async function Mse(t){return Yc(t,Yr.constants.W_OK)}me.pathWritable=Mse;async function QL(t){return Yc(t,Yr.constants.X_OK)}me.pathExecutable=QL;async function Use(t){let[e,r]=await Promise.all([JL.stat(t),QL(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=Use;async function qse(t,e){if(!(!t||!e)){for(let r of e3(t))if((await JL.readdir(r)).includes(e))return r}}me.findBaseDirectory=qse;function Hse(t){let e=Math.random().toString(16).substring(2,8);return gi.resolve(Pse.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=Hse;function e3(t){if(t=gi.normalize(t),!gi.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=gi.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(gi.sep).map((r,n,i)=>e.root+gi.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=e3;var mp=class extends YL.Readable{constructor(e,r={}){super({objectMode:!0}),this.p=e,this.options=r,this.paths=[this.p]}_read(){let e=this.paths.shift(),{pathFilter:r}=this.options;if(!e){this.push(null);return}Yr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Yr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>gi.join(e,c));r&&(u=u.filter(c=>r(c.substring(this.p.length+1)))),this.paths.push(...u),this.push(s)}):this.push(s)})}};me.Walker=mp;function Xv(t,e={}){return new mp(t,e)}me.walk=Xv});var r3=_(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.AliasedMap=yi.CaseInsensitiveProxyHandler=yi.createCaseInsensitiveObject=void 0;function Vse(){return new Proxy({},yi.CaseInsensitiveProxyHandler)}yi.createCaseInsensitiveObject=Vse;yi.CaseInsensitiveProxyHandler={has:(t,e)=>gp(e)in t,get:(t,e)=>t[gp(e)],set:(t,e,r)=>(t[gp(e)]=r,!0),deleteProperty:(t,e)=>delete t[gp(e)]};var gp=t=>typeof t=="string"?t.toLowerCase():t,Yv=class extends Map{getAliases(){let e=new Map;return[...this.entries()].filter(([,n])=>typeof n=="string"||typeof n=="symbol").forEach(([n,i])=>{let s=e.get(i)||[];s.push(n),e.set(i,s)}),e}resolveAlias(e){let r=this.get(e);return typeof r!="string"&&typeof r!="symbol"?r:this.resolveAlias(r)}keysWithoutAliases(){return[...this.entries()].filter(e=>typeof e[1]!="string"&&typeof e[1]!="symbol").map(([e,r])=>e)}};yi.AliasedMap=Yv});var u3=_((mEe,a3)=>{"use strict";var o3=require("child_process"),n3=o3.spawn,zse=o3.exec;a3.exports=function(t,e,r){if(typeof e=="function"&&r===void 0&&(r=e,e=void 0),t=parseInt(t),Number.isNaN(t)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[t]=[],i[t]=1,process.platform){case"win32":zse("taskkill /pid "+t+" /T /F",r);break;case"darwin":Jv(t,n,i,function(s){return n3("pgrep",["-P",s])},function(){i3(n,e,r)});break;default:Jv(t,n,i,function(s){return n3("ps",["-o","pid","--no-headers","--ppid",s])},function(){i3(n,e,r)});break}};function i3(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(s3(s,e),n[s]=1)}),n[i]||(s3(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function s3(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function Jv(t,e,r,n,i){var s=n(t),o="";s.stdout.on("data",function(c){var c=c.toString("ascii");o+=c});var a=function(u){if(delete r[t],u!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(c){c=parseInt(c,10),e[t].push(c),e[c]=[],r[c]=1,Jv(c,e,r,n,i)})};s.on("close",a)}});var f3=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.processExit=et.offBeforeExit=et.onBeforeExit=et.onExit=et.sleepForever=et.sleepUntil=et.sleep=et.getPathParts=et.createProcessEnv=et.killProcessTree=et.ERROR_TIMEOUT_REACHED=void 0;var Zv=(he(),ce(fe)),Kse=r3(),Gse=zi(),Wse=Zh(),Xse=Zv.__importStar(require("path")),Yse=Zv.__importDefault(Uh()),Jse=Zv.__importDefault(u3()),ro=(0,Wse.debug)("ionic:utils-process");et.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function Zse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,Jse.default)(t,e,i=>{if(i)return ro("error while killing process tree for %d: %O",t,i),n(i);r()})})}et.killProcessTree=Zse;function Qse(...t){return Object.assign(Gse.TERMINAL_INFO.windows?(0,Kse.createCaseInsensitiveObject)():{},...t)}et.createProcessEnv=Qse;function eoe(t=process.env.PATH||""){return t.split(Xse.delimiter)}et.getPathParts=eoe;async function c3(t){return new Promise(e=>{setTimeout(e,t)})}et.sleep=c3;async function toe(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await c3(e),n+=e,n>r)throw et.ERROR_TIMEOUT_REACHED}et.sleepUntil=toe;async function roe(){return new Promise(()=>{setInterval(()=>{},1e3)})}et.sleepForever=roe;function noe(t){(0,Yse.default)(()=>{ro("onExit: process.exit/normal shutdown"),t()})}et.onExit=noe;var yp=new Set;function ioe(t){yp.add(t)}et.onBeforeExit=ioe;function soe(t){yp.delete(t)}et.offBeforeExit=soe;var ooe=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Jc=t=>ooe(async()=>{ro("onBeforeExit handler: %O received",t),ro("onBeforeExit handler: running %O functions",yp.size),await Promise.all([...yp.values()].map(async e=>{try{await e()}catch(r){ro("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(ro("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,l3[t]),process.kill(process.pid,t))}),l3={SIGINT:Jc("SIGINT"),SIGTERM:Jc("SIGTERM"),SIGHUP:Jc("SIGHUP"),SIGBREAK:Jc("SIGBREAK")};for(let[t,e]of Object.entries(l3))process.on(t,e);var aoe=Jc("process.exit");async function uoe(t=0){process.exitCode=t,await aoe(),ro("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}et.processExit=uoe});var p3=_(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.growBufferForAppendedData=jn.WritableStreamBuffer=jn.ReadableStreamBuffer=jn.NullStream=void 0;var rE=require("stream"),coe=4,h3=32,d3=16,Qv=class extends rE.Writable{_write(e,r,n){n()}};jn.NullStream=Qv;var eE=class extends rE.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:h3),this.chunkSize=e&&e.chunkSize?e.chunkSize:coe,this.growSize=e&&e.growSize?e.growSize:d3}get size(){return this._size}get stopped(){return this._stopped}_read(){this._send()}feed(e,r="utf8"){if(this._stopped)throw new Error("ReadableStreamBuffer is stopped. Can no longer feed.");let n=typeof e=="string"?Buffer.byteLength(e):e.length;this.buffer=nE(this.buffer,this._size,Math.ceil(n/this.growSize)*this.growSize),typeof e=="string"?this.buffer.write(e,this._size,n,r):this.buffer.copy(e,this._size,0),this._size+=n}stop(){this._stopped||(this._stopped=!0,this._size===0&&this.push(null))}_send(){let e=Math.min(this.chunkSize,this._size),r=!1;if(e>0){let n=Buffer.alloc(e);this.buffer.copy(n,0,0,e),r=!this.push(n),this.buffer.copy(this.buffer,0,e,this._size),this._size-=e}this._size===0&&this._stopped&&this.push(null),r||setTimeout(()=>this._send(),1)}};jn.ReadableStreamBuffer=eE;var tE=class extends rE.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:h3),this.growSize=e&&e.growSize?e.growSize:d3}get size(){return this._size}_write(e,r,n){this.buffer=nE(this.buffer,this._size,Math.ceil(e.length/this.growSize)*this.growSize),e.copy(this.buffer,this._size,0),this._size+=e.length,n()}consume(e){e=typeof e=="number"?e:this._size;let r=Buffer.alloc(e);return this.buffer.copy(r,0,0,r.length),this.buffer.copy(this.buffer,0,r.length),this._size-=r.length,r}};jn.WritableStreamBuffer=tE;function nE(t,e,r){if(t.length-e>=r)return t;let n=Buffer.alloc(t.length+r);return t.copy(n,0,0,e),n}jn.growBufferForAppendedData=nE});var w3=_((DEe,D3)=>{D3.exports=y3;y3.sync=foe;var m3=require("fs");function loe(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function g3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:loe(e,r)}function y3(t,e,r){m3.stat(t,function(n,i){r(n,n?!1:g3(i,t,e))})}function foe(t,e){return g3(m3.statSync(t),t,e)}});var C3=_((wEe,_3)=>{_3.exports=E3;E3.sync=hoe;var v3=require("fs");function E3(t,e,r){v3.stat(t,function(n,i){r(n,n?!1:b3(i,e))})}function hoe(t,e){return b3(v3.statSync(t),e)}function b3(t,e){return t.isFile()&&doe(t,e)}function doe(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,h=r&c||r&u&&i===o||r&a&&n===s||r&l&&s===0;return h}});var A3=_((EEe,S3)=>{var vEe=require("fs"),Dp;process.platform==="win32"||global.TESTING_WINDOWS?Dp=w3():Dp=C3();S3.exports=iE;iE.sync=poe;function iE(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){iE(t,e||{},function(s,o){s?i(s):n(o)})})}Dp(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function poe(t,e){try{return Dp.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var R3=_((bEe,F3)=>{var Va=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",O3=require("path"),moe=Va?";":":",x3=A3(),T3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),I3=(t,e)=>{let r=e.colon||moe,n=t.match(/\//)||Va&&t.match(/\\/)?[""]:[...Va?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Va?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Va?i.split(r):[""];return Va&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},P3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=I3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(T3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,m=O3.join(f,t),y=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;l(u(y,c,0))}),u=(c,l,h)=>new Promise((d,f)=>{if(h===i.length)return d(a(l+1));let m=i[h];x3(c+m,{pathExt:s},(y,v)=>{if(!y&&v)if(e.all)o.push(c+m);else return d(c+m);return d(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},goe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=I3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=O3.join(u,t),l=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let h=0;h<n.length;h++){let d=l+n[h];try{if(x3.sync(d,{pathExt:i}))if(e.all)s.push(d);else return d}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw T3(t)};F3.exports=P3;P3.sync=goe});var N3=_((_Ee,sE)=>{"use strict";var k3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};sE.exports=k3;sE.exports.default=k3});var j3=_((CEe,B3)=>{"use strict";var $3=require("path"),yoe=R3(),Doe=N3();function L3(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=yoe.sync(t.command,{path:r[Doe({env:r})],pathExt:e?$3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=$3.resolve(i?t.options.cwd:"",o)),o}function woe(t){return L3(t)||L3(t,!0)}B3.exports=woe});var M3=_((SEe,aE)=>{"use strict";var oE=/([()\][%!^"`<>&|;, *?])/g;function voe(t){return t=t.replace(oE,"^$1"),t}function Eoe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(oE,"^$1"),e&&(t=t.replace(oE,"^$1")),t}aE.exports.command=voe;aE.exports.argument=Eoe});var q3=_((AEe,U3)=>{"use strict";U3.exports=/^#!(.*)/});var V3=_((OEe,H3)=>{"use strict";var boe=q3();H3.exports=(t="")=>{let e=t.match(boe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var K3=_((xEe,z3)=>{"use strict";var uE=require("fs"),_oe=V3();function Coe(t){let r=Buffer.alloc(150),n;try{n=uE.openSync(t,"r"),uE.readSync(n,r,0,150,0),uE.closeSync(n)}catch{}return _oe(r.toString())}z3.exports=Coe});var Y3=_((TEe,X3)=>{"use strict";var Soe=require("path"),G3=j3(),W3=M3(),Aoe=K3(),Ooe=process.platform==="win32",xoe=/\.(?:com|exe)$/i,Toe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ioe(t){t.file=G3(t);let e=t.file&&Aoe(t.file);return e?(t.args.unshift(t.file),t.command=e,G3(t)):t.file}function Poe(t){if(!Ooe)return t;let e=Ioe(t),r=!xoe.test(e);if(t.options.forceShell||r){let n=Toe.test(e);t.command=Soe.normalize(t.command),t.command=W3.command(t.command),t.args=t.args.map(s=>W3.argument(s,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Foe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Poe(n)}X3.exports=Foe});var Q3=_((IEe,Z3)=>{"use strict";var cE=process.platform==="win32";function lE(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Roe(t,e){if(!cE)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=J3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function J3(t,e){return cE&&t===1&&!e.file?lE(e.original,"spawn"):null}function koe(t,e){return cE&&t===1&&!e.file?lE(e.original,"spawnSync"):null}Z3.exports={hookChildProcess:Roe,verifyENOENT:J3,verifyENOENTSync:koe,notFoundError:lE}});var rB=_((PEe,za)=>{"use strict";var eB=require("child_process"),fE=Y3(),hE=Q3();function tB(t,e,r){let n=fE(t,e,r),i=eB.spawn(n.command,n.args,n.options);return hE.hookChildProcess(i,n),i}function Noe(t,e,r){let n=fE(t,e,r),i=eB.spawnSync(n.command,n.args,n.options);return i.error=i.error||hE.verifyENOENTSync(i.status,n),i}za.exports=tB;za.exports.spawn=tB;za.exports.sync=Noe;za.exports._parse=fE;za.exports._enoent=hE});var cB=_(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.findExecutables=Re.which=Re.fork=Re.spawn=Re.Subprocess=Re.SubprocessError=Re.convertPATH=Re.expandTildePath=Re.TILDE_PATH_REGEX=Re.ERROR_SIGNAL_EXIT=Re.ERROR_NON_ZERO_EXIT=Re.ERROR_COMMAND_NOT_FOUND=void 0;var mE=(he(),ce(fe)),nB=r$(),$oe=t3(),dE=f3(),wp=p3(),iB=zi(),Loe=require("child_process"),Boe=mE.__importDefault(rB()),joe=mE.__importStar(require("os")),io=mE.__importStar(require("path"));Re.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";Re.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";Re.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";Re.TILDE_PATH_REGEX=/^~($|\/|\\)/;function sB(t){let e=joe.homedir();return t.replace(Re.TILDE_PATH_REGEX,`${e}$1`)}Re.expandTildePath=sB;function oB(t=process.env.PATH||""){return t.split(io.delimiter).map(sB).join(io.delimiter)}Re.convertPATH=oB;var no=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};Re.SubprocessError=no;var pE=class{constructor(e,r,n={}){this.name=e,this.args=r;let i=this.maskArg(e);i!==e&&(this.name=i,this.path=e),this._options=n}get options(){let e=this._options;e.env||(e.env=process.env);let r=(0,dE.createProcessEnv)(e.env||{},{PATH:oB(typeof e.env.PATH=="string"?e.env.PATH:process.env.PATH)});return{...e,env:r}}async output(){this._options.stdio="pipe";let e=this.run(),r=new wp.WritableStreamBuffer,n=new wp.WritableStreamBuffer,i=new wp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stdout?.pipe(i),e.p.stderr?.pipe(n),e.p.stderr?.pipe(i);try{await e}catch(s){throw r.end(),n.end(),s.output=i.consume().toString(),s}return n.end(),i.end(),r.consume().toString()}async combinedOutput(){this._options.stdio="pipe";let e=this.run(),r=new wp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stderr?.pipe(r);try{await e}catch(n){throw n.output=r.consume().toString(),n}return r.consume().toString()}run(){let e=this.spawn(),r=new Promise((n,i)=>{e.on("error",s=>{let o;s.code==="ENOENT"?(o=new no("Command not found.",{cause:s}),o.code=Re.ERROR_COMMAND_NOT_FOUND):o=new no("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new no("Signal exit from subprocess."),a.code=Re.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new no("Non-zero exit from subprocess."),a.code=Re.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return aB(this.path?this.path:this.name,this.args,this.options)}bashify({maskArgv0:e=!0,maskArgv1:r=!1,shiftArgv0:n=!1}={}){let i=[this.path?this.path:this.name,...this.args];return n&&i.shift(),i[0]&&e&&(i[0]=this.maskArg(i[0])),i[1]&&r&&(i[1]=this.maskArg(i[1])),i.length>0?i.map(s=>this.bashifyArg(s)).join(" "):""}bashifyArg(e){return e.includes(" ")?`"${e.replace(/\"/g,'\\"')}"`:e}maskArg(e){let r=e.lastIndexOf(io.sep);return r>=0?e.substring(r+1):e}};Re.Subprocess=pE;function aB(t,e=[],r){return(0,Boe.default)(t,[...e],r)}Re.spawn=aB;function Moe(t,e=[],r={}){return(0,Loe.fork)(t,[...e],r)}Re.fork=Moe;var gE=iB.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function Uoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){if(t.includes(io.sep))return t;let n=await uB(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}Re.which=Uoe;async function qoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){return t.includes(io.sep)?[t]:uB(t,{PATH:e})}Re.findExecutables=qoe;async function uB(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){let n=(0,dE.getPathParts)(e),i;if(iB.TERMINAL_INFO.windows){let s=(0,dE.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(io.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,nB.map)(i,async s=>(0,nB.concurrentFilter)(n.map(o=>io.join(o,s)),async o=>(0,$oe.isExecutableFile)(o))))}});var vp=_(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.isInstalled=ns.getCommandOutput=ns.runCommand=void 0;var yE=cB();async function lB(t,e,r={}){let n=new yE.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof yE.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}ns.runCommand=lB;async function Hoe(t,e,r={}){try{return(await lB(t,e,r)).trim()}catch{return null}}ns.getCommandOutput=Hoe;async function Voe(t){try{await(0,yE.which)(t)}catch{return!1}return!0}ns.isInstalled=Voe});var Zc=_((kEe,fB)=>{"use strict";var zoe="2.0.0",Koe=Number.MAX_SAFE_INTEGER||9007199254740991,Goe=16,Woe=250,Xoe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];fB.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Goe,MAX_SAFE_BUILD_LENGTH:Woe,MAX_SAFE_INTEGER:Koe,RELEASE_TYPES:Xoe,SEMVER_SPEC_VERSION:zoe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Qc=_((NEe,hB)=>{"use strict";var Yoe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};hB.exports=Yoe});var Ka=_((Mn,dB)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:DE,MAX_SAFE_BUILD_LENGTH:Joe,MAX_LENGTH:Zoe}=Zc(),Qoe=Qc();Mn=dB.exports={};var eae=Mn.re=[],tae=Mn.safeRe=[],Z=Mn.src=[],rae=Mn.safeSrc=[],Q=Mn.t={},nae=0,wE="[a-zA-Z0-9-]",iae=[["\\s",1],["\\d",Zoe],[wE,Joe]],sae=t=>{for(let[e,r]of iae)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=sae(e),i=nae++;Qoe(t,i,e),Q[t]=i,Z[i]=e,rae[i]=n,eae[i]=new RegExp(e,r?"g":void 0),tae[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${wE}*`);ge("MAINVERSION",`(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${Z[Q.PRERELEASEIDENTIFIER]}(?:\\.${Z[Q.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${Z[Q.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Z[Q.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${wE}+`);ge("BUILD",`(?:\\+(${Z[Q.BUILDIDENTIFIER]}(?:\\.${Z[Q.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${Z[Q.MAINVERSION]}${Z[Q.PRERELEASE]}?${Z[Q.BUILD]}?`);ge("FULL",`^${Z[Q.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${Z[Q.MAINVERSIONLOOSE]}${Z[Q.PRERELEASELOOSE]}?${Z[Q.BUILD]}?`);ge("LOOSE",`^${Z[Q.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${Z[Q.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${Z[Q.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:${Z[Q.PRERELEASE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:${Z[Q.PRERELEASELOOSE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${DE}})(?:\\.(\\d{1,${DE}}))?(?:\\.(\\d{1,${DE}}))?`);ge("COERCE",`${Z[Q.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",Z[Q.COERCEPLAIN]+`(?:${Z[Q.PRERELEASE]})?(?:${Z[Q.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",Z[Q.COERCE],!0);ge("COERCERTLFULL",Z[Q.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${Z[Q.LONETILDE]}\\s+`,!0);Mn.tildeTrimReplace="$1~";ge("TILDE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${Z[Q.LONECARET]}\\s+`,!0);Mn.caretTrimReplace="$1^";ge("CARET",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${Z[Q.GTLT]}\\s*(${Z[Q.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]}|${Z[Q.XRANGEPLAIN]})`,!0);Mn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${Z[Q.XRANGEPLAIN]})\\s+-\\s+(${Z[Q.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${Z[Q.XRANGEPLAINLOOSE]})\\s+-\\s+(${Z[Q.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ep=_(($Ee,pB)=>{"use strict";var oae=Object.freeze({loose:!0}),aae=Object.freeze({}),uae=t=>t?typeof t!="object"?oae:t:aae;pB.exports=uae});var vE=_((LEe,yB)=>{"use strict";var mB=/^[0-9]+$/,gB=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=mB.test(t),n=mB.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},cae=(t,e)=>gB(e,t);yB.exports={compareIdentifiers:gB,rcompareIdentifiers:cae}});var Xt=_((BEe,wB)=>{"use strict";var bp=Qc(),{MAX_LENGTH:DB,MAX_SAFE_INTEGER:_p}=Zc(),{safeRe:Cp,t:Sp}=Ka(),lae=Ep(),{compareIdentifiers:EE}=vE(),bE=class t{constructor(e,r){if(r=lae(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>DB)throw new TypeError(`version is longer than ${DB} characters`);bp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Cp[Sp.LOOSE]:Cp[Sp.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>_p||this.major<0)throw new TypeError("Invalid major version");if(this.minor>_p||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>_p||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<_p)return s}return i}):this.prerelease=[],this.build=n[5]?n[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(e){if(bp("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(bp("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return EE(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(bp("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return EE(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?Cp[Sp.PRERELEASELOOSE]:Cp[Sp.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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 i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];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(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),EE(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};wB.exports=bE});var so=_((jEe,EB)=>{"use strict";var vB=Xt(),fae=(t,e,r=!1)=>{if(t instanceof vB)return t;try{return new vB(t,e)}catch(n){if(!r)return null;throw n}};EB.exports=fae});var _B=_((MEe,bB)=>{"use strict";var hae=so(),dae=(t,e)=>{let r=hae(t,e);return r?r.version:null};bB.exports=dae});var SB=_((UEe,CB)=>{"use strict";var pae=so(),mae=(t,e)=>{let r=pae(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};CB.exports=mae});var xB=_((qEe,OB)=>{"use strict";var AB=Xt(),gae=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new AB(t instanceof AB?t.version:t,r).inc(e,n,i).version}catch{return null}};OB.exports=gae});var PB=_((HEe,IB)=>{"use strict";var TB=so(),yae=(t,e)=>{let r=TB(t,null,!0),n=TB(e,null,!0),i=r.compare(n);if(i===0)return null;let s=i>0,o=s?r:n,a=s?n:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};IB.exports=yae});var RB=_((VEe,FB)=>{"use strict";var Dae=Xt(),wae=(t,e)=>new Dae(t,e).major;FB.exports=wae});var NB=_((zEe,kB)=>{"use strict";var vae=Xt(),Eae=(t,e)=>new vae(t,e).minor;kB.exports=Eae});var LB=_((KEe,$B)=>{"use strict";var bae=Xt(),_ae=(t,e)=>new bae(t,e).patch;$B.exports=_ae});var jB=_((GEe,BB)=>{"use strict";var Cae=so(),Sae=(t,e)=>{let r=Cae(t,e);return r&&r.prerelease.length?r.prerelease:null};BB.exports=Sae});var Jr=_((WEe,UB)=>{"use strict";var MB=Xt(),Aae=(t,e,r)=>new MB(t,r).compare(new MB(e,r));UB.exports=Aae});var HB=_((XEe,qB)=>{"use strict";var Oae=Jr(),xae=(t,e,r)=>Oae(e,t,r);qB.exports=xae});var zB=_((YEe,VB)=>{"use strict";var Tae=Jr(),Iae=(t,e)=>Tae(t,e,!0);VB.exports=Iae});var Ap=_((JEe,GB)=>{"use strict";var KB=Xt(),Pae=(t,e,r)=>{let n=new KB(t,r),i=new KB(e,r);return n.compare(i)||n.compareBuild(i)};GB.exports=Pae});var XB=_((ZEe,WB)=>{"use strict";var Fae=Ap(),Rae=(t,e)=>t.sort((r,n)=>Fae(r,n,e));WB.exports=Rae});var JB=_((QEe,YB)=>{"use strict";var kae=Ap(),Nae=(t,e)=>t.sort((r,n)=>kae(n,r,e));YB.exports=Nae});var el=_((ebe,ZB)=>{"use strict";var $ae=Jr(),Lae=(t,e,r)=>$ae(t,e,r)>0;ZB.exports=Lae});var Op=_((tbe,QB)=>{"use strict";var Bae=Jr(),jae=(t,e,r)=>Bae(t,e,r)<0;QB.exports=jae});var _E=_((rbe,ej)=>{"use strict";var Mae=Jr(),Uae=(t,e,r)=>Mae(t,e,r)===0;ej.exports=Uae});var CE=_((nbe,tj)=>{"use strict";var qae=Jr(),Hae=(t,e,r)=>qae(t,e,r)!==0;tj.exports=Hae});var xp=_((ibe,rj)=>{"use strict";var Vae=Jr(),zae=(t,e,r)=>Vae(t,e,r)>=0;rj.exports=zae});var Tp=_((sbe,nj)=>{"use strict";var Kae=Jr(),Gae=(t,e,r)=>Kae(t,e,r)<=0;nj.exports=Gae});var SE=_((obe,ij)=>{"use strict";var Wae=_E(),Xae=CE(),Yae=el(),Jae=xp(),Zae=Op(),Qae=Tp(),eue=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return Wae(t,r,n);case"!=":return Xae(t,r,n);case">":return Yae(t,r,n);case">=":return Jae(t,r,n);case"<":return Zae(t,r,n);case"<=":return Qae(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};ij.exports=eue});var oj=_((abe,sj)=>{"use strict";var tue=Xt(),rue=so(),{safeRe:Ip,t:Pp}=Ka(),nue=(t,e)=>{if(t instanceof tue)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Ip[Pp.COERCEFULL]:Ip[Pp.COERCE]);else{let u=e.includePrerelease?Ip[Pp.COERCERTLFULL]:Ip[Pp.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",s=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return rue(`${n}.${i}.${s}${o}${a}`,e)};sj.exports=nue});var uj=_((ube,aj)=>{"use strict";var AE=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};aj.exports=AE});var Zr=_((cbe,hj)=>{"use strict";var iue=/\s+/g,OE=class t{constructor(e,r){if(r=oue(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof xE)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(iue," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!lj(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&due(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&fue)|(this.options.loose&&hue))+":"+e,i=cj.get(n);if(i)return i;let s=this.options.loose,o=s?lr[Yt.HYPHENRANGELOOSE]:lr[Yt.HYPHENRANGE];e=e.replace(o,_ue(this.options.includePrerelease)),tt("hyphen replace",e),e=e.replace(lr[Yt.COMPARATORTRIM],uue),tt("comparator trim",e),e=e.replace(lr[Yt.TILDETRIM],cue),tt("tilde trim",e),e=e.replace(lr[Yt.CARETTRIM],lue),tt("caret trim",e);let a=e.split(" ").map(h=>pue(h,this.options)).join(" ").split(/\s+/).map(h=>bue(h,this.options));s&&(a=a.filter(h=>(tt("loose invalid filter",h,this.options),!!h.match(lr[Yt.COMPARATORLOOSE])))),tt("range list",a);let u=new Map,c=a.map(h=>new xE(h,this.options));for(let h of c){if(lj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return cj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>fj(n,r)&&e.set.some(i=>fj(i,r)&&n.every(s=>i.every(o=>s.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new aue(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Cue(this.set[r],e,this.options))return!0;return!1}};hj.exports=OE;var sue=uj(),cj=new sue,oue=Ep(),xE=tl(),tt=Qc(),aue=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:uue,tildeTrimReplace:cue,caretTrimReplace:lue}=Ka(),{FLAG_INCLUDE_PRERELEASE:fue,FLAG_LOOSE:hue}=Zc(),lj=t=>t.value==="<0.0.0-0",due=t=>t.value==="",fj=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(s=>i.intersects(s,e)),i=n.pop();return r},pue=(t,e)=>(t=t.replace(lr[Yt.BUILD],""),tt("comp",t,e),t=yue(t,e),tt("caret",t),t=mue(t,e),tt("tildes",t),t=wue(t,e),tt("xrange",t),t=Eue(t,e),tt("stars",t),t),fr=t=>!t||t.toLowerCase()==="x"||t==="*",mue=(t,e)=>t.trim().split(/\s+/).map(r=>gue(r,e)).join(" "),gue=(t,e)=>{let r=e.loose?lr[Yt.TILDELOOSE]:lr[Yt.TILDE];return t.replace(r,(n,i,s,o,a)=>{tt("tilde",t,n,i,s,o,a);let u;return fr(i)?u="":fr(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:fr(o)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(tt("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,tt("tilde return",u),u})},yue=(t,e)=>t.trim().split(/\s+/).map(r=>Due(r,e)).join(" "),Due=(t,e)=>{tt("caret",t,e);let r=e.loose?lr[Yt.CARETLOOSE]:lr[Yt.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,s,o,a,u)=>{tt("caret",t,i,s,o,a,u);let c;return fr(s)?c="":fr(o)?c=`>=${s}.0.0${n} <${+s+1}.0.0-0`:fr(a)?s==="0"?c=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:u?(tt("replaceCaret pr",u),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${u} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${u} <${+s+1}.0.0-0`):(tt("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),tt("caret return",c),c})},wue=(t,e)=>(tt("replaceXRanges",t,e),t.split(/\s+/).map(r=>vue(r,e)).join(" ")),vue=(t,e)=>{t=t.trim();let r=e.loose?lr[Yt.XRANGELOOSE]:lr[Yt.XRANGE];return t.replace(r,(n,i,s,o,a,u)=>{tt("xRange",t,n,i,s,o,a,u);let c=fr(s),l=c||fr(o),h=l||fr(a),d=h;return i==="="&&d&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(o=0),a=0,i===">"?(i=">=",l?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",l?s=+s+1:o=+o+1),i==="<"&&(u="-0"),n=`${i+s}.${o}.${a}${u}`):l?n=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(n=`>=${s}.${o}.0${u} <${s}.${+o+1}.0-0`),tt("xRange return",n),n})},Eue=(t,e)=>(tt("replaceStars",t,e),t.trim().replace(lr[Yt.STAR],"")),bue=(t,e)=>(tt("replaceGTE0",t,e),t.trim().replace(lr[e.includePrerelease?Yt.GTE0PRE:Yt.GTE0],"")),_ue=t=>(e,r,n,i,s,o,a,u,c,l,h,d)=>(fr(n)?r="":fr(i)?r=`>=${n}.0.0${t?"-0":""}`:fr(s)?r=`>=${n}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,fr(c)?u="":fr(l)?u=`<${+c+1}.0.0-0`:fr(h)?u=`<${c}.${+l+1}.0-0`:d?u=`<=${c}.${l}.${h}-${d}`:t?u=`<${c}.${l}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Cue=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(tt(t[n].semver),t[n].semver!==xE.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var tl=_((lbe,Dj)=>{"use strict";var rl=Symbol("SemVer ANY"),PE=class t{static get ANY(){return rl}constructor(e,r){if(r=dj(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),IE("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===rl?this.value="":this.value=this.operator+this.semver.version,IE("comp",this)}parse(e){let r=this.options.loose?pj[mj.COMPARATORLOOSE]:pj[mj.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new gj(n[2],this.options.loose):this.semver=rl}toString(){return this.value}test(e){if(IE("Comparator.test",e,this.options.loose),this.semver===rl||e===rl)return!0;if(typeof e=="string")try{e=new gj(e,this.options)}catch{return!1}return TE(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new yj(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new yj(this.value,r).test(e.semver):(r=dj(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||TE(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||TE(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Dj.exports=PE;var dj=Ep(),{safeRe:pj,t:mj}=Ka(),TE=SE(),IE=Qc(),gj=Xt(),yj=Zr()});var nl=_((fbe,wj)=>{"use strict";var Sue=Zr(),Aue=(t,e,r)=>{try{e=new Sue(e,r)}catch{return!1}return e.test(t)};wj.exports=Aue});var Ej=_((hbe,vj)=>{"use strict";var Oue=Zr(),xue=(t,e)=>new Oue(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));vj.exports=xue});var _j=_((dbe,bj)=>{"use strict";var Tue=Xt(),Iue=Zr(),Pue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Iue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Tue(n,r))}),n};bj.exports=Pue});var Sj=_((pbe,Cj)=>{"use strict";var Fue=Xt(),Rue=Zr(),kue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Rue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new Fue(n,r))}),n};Cj.exports=kue});var xj=_((mbe,Oj)=>{"use strict";var FE=Xt(),Nue=Zr(),Aj=el(),$ue=(t,e)=>{t=new Nue(t,e);let r=new FE("0.0.0");if(t.test(r)||(r=new FE("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],s=null;i.forEach(o=>{let a=new FE(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Aj(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Aj(r,s))&&(r=s)}return r&&t.test(r)?r:null};Oj.exports=$ue});var Ij=_((gbe,Tj)=>{"use strict";var Lue=Zr(),Bue=(t,e)=>{try{return new Lue(t,e).range||"*"}catch{return null}};Tj.exports=Bue});var Fp=_((ybe,kj)=>{"use strict";var jue=Xt(),Rj=tl(),{ANY:Mue}=Rj,Uue=Zr(),que=nl(),Pj=el(),Fj=Op(),Hue=Tp(),Vue=xp(),zue=(t,e,r,n)=>{t=new jue(t,n),e=new Uue(e,n);let i,s,o,a,u;switch(r){case">":i=Pj,s=Hue,o=Fj,a=">",u=">=";break;case"<":i=Fj,s=Vue,o=Pj,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(que(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],h=null,d=null;if(l.forEach(f=>{f.semver===Mue&&(f=new Rj(">=0.0.0")),h=h||f,d=d||f,i(f.semver,h.semver,n)?h=f:o(f.semver,d.semver,n)&&(d=f)}),h.operator===a||h.operator===u||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===u&&o(t,d.semver))return!1}return!0};kj.exports=zue});var $j=_((Dbe,Nj)=>{"use strict";var Kue=Fp(),Gue=(t,e,r)=>Kue(t,e,">",r);Nj.exports=Gue});var Bj=_((wbe,Lj)=>{"use strict";var Wue=Fp(),Xue=(t,e,r)=>Wue(t,e,"<",r);Lj.exports=Xue});var Uj=_((vbe,Mj)=>{"use strict";var jj=Zr(),Yue=(t,e,r)=>(t=new jj(t,r),e=new jj(e,r),t.intersects(e,r));Mj.exports=Yue});var Hj=_((Ebe,qj)=>{"use strict";var Jue=nl(),Zue=Jr();qj.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>Zue(l,h,r));for(let l of o)Jue(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,h]of n)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var Xj=_((bbe,Wj)=>{"use strict";var Vj=Zr(),kE=tl(),{ANY:RE}=kE,il=nl(),NE=Jr(),Que=(t,e,r={})=>{if(t===e)return!0;t=new Vj(t,r),e=new Vj(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=tce(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},ece=[new kE(">=0.0.0-0")],zj=[new kE(">=0.0.0")],tce=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===RE){if(e.length===1&&e[0].semver===RE)return!0;r.includePrerelease?t=ece:t=zj}if(e.length===1&&e[0].semver===RE){if(r.includePrerelease)return!0;e=zj}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=Kj(i,f,r):f.operator==="<"||f.operator==="<="?s=Gj(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=NE(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let f of n){if(i&&!il(f,String(i),r)||s&&!il(f,String(s),r))return null;for(let m of e)if(!il(f,String(m),r))return!1;return!0}let a,u,c,l,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",i){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(a=Kj(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!il(i.semver,String(f),r))return!1}if(s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(u=Gj(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!il(s.semver,String(f),r))return!1}if(!f.operator&&(s||i)&&o!==0)return!1}return!(i&&c&&!s&&o!==0||s&&l&&!i&&o!==0||d||h)},Kj=(t,e,r)=>{if(!t)return e;let n=NE(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Gj=(t,e,r)=>{if(!t)return e;let n=NE(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Wj.exports=Que});var Qj=_((_be,Zj)=>{"use strict";var $E=Ka(),Yj=Zc(),rce=Xt(),Jj=vE(),nce=so(),ice=_B(),sce=SB(),oce=xB(),ace=PB(),uce=RB(),cce=NB(),lce=LB(),fce=jB(),hce=Jr(),dce=HB(),pce=zB(),mce=Ap(),gce=XB(),yce=JB(),Dce=el(),wce=Op(),vce=_E(),Ece=CE(),bce=xp(),_ce=Tp(),Cce=SE(),Sce=oj(),Ace=tl(),Oce=Zr(),xce=nl(),Tce=Ej(),Ice=_j(),Pce=Sj(),Fce=xj(),Rce=Ij(),kce=Fp(),Nce=$j(),$ce=Bj(),Lce=Uj(),Bce=Hj(),jce=Xj();Zj.exports={parse:nce,valid:ice,clean:sce,inc:oce,diff:ace,major:uce,minor:cce,patch:lce,prerelease:fce,compare:hce,rcompare:dce,compareLoose:pce,compareBuild:mce,sort:gce,rsort:yce,gt:Dce,lt:wce,eq:vce,neq:Ece,gte:bce,lte:_ce,cmp:Cce,coerce:Sce,Comparator:Ace,Range:Oce,satisfies:xce,toComparators:Tce,maxSatisfying:Ice,minSatisfying:Pce,minVersion:Fce,validRange:Rce,outside:kce,gtr:Nce,ltr:$ce,intersects:Lce,simplifyRange:Bce,subset:jce,SemVer:rce,re:$E.re,src:$E.src,tokens:$E.t,SEMVER_SPEC_VERSION:Yj.SEMVER_SPEC_VERSION,RELEASE_TYPES:Yj.RELEASE_TYPES,compareIdentifiers:Jj.compareIdentifiers,rcompareIdentifiers:Jj.rcompareIdentifiers}});var fM=_(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.parseApkNameFromFlavor=ee.checkJDKMajorVersion=ee.resolvePlatform=ee.checkPlatformVersions=ee.getAddedPlatforms=ee.getPlatformTargetName=ee.promptForPlatformTarget=ee.promptForPlatform=ee.isValidEnterprisePlatform=ee.getKnownEnterprisePlatforms=ee.isValidCommunityPlatform=ee.getKnownCommunityPlatforms=ee.isValidPlatform=ee.getKnownPlatforms=ee.selectPlatforms=ee.getProjectPlatformDirectory=ee.getCLIVersion=ee.getCoreVersion=ee.getCapacitorPackageVersion=ee.requireCapacitorPackage=ee.getCapacitorPackage=ee.runTask=ee.runPlatformHook=ee.runHooks=ee.wait=ee.checkAppName=ee.checkAppId=ee.checkAppDir=ee.checkAppConfig=ee.checkCapacitorPlatform=ee.checkPackage=ee.checkWebDir=ee.check=void 0;var ol=(he(),ce(fe)),eM=zi(),is=Sa(),oo=require("path"),qe=ol.__importDefault(Aa()),Ga=pd(),rM=Sc(),Mce=t$(),tM=Ll(),sl=jd(),Uce=vp();async function qce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
206
+ see https://github.com/jprichardson/node-fs-extra/issues/269`),zc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;zc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?O$(C$,a,t,e,r,n):C$(a,t,e,r,n))})}function C$(t,e,r,n,i){let s=Vc.dirname(r);yie(s,(o,a)=>{if(o)return i(o);if(a)return Hv(t,e,r,n,i);gie(s,u=>u?i(u):Hv(t,e,r,n,i))})}function O$(t,e,r,n,i,s){Promise.resolve(i.filter(r,n)).then(o=>o?t(e,r,n,i,s):s(),o=>s(o))}function Hv(t,e,r,n,i){return n.filter?O$(S$,t,e,r,n,i):S$(t,e,r,n,i)}function S$(t,e,r,n,i){(n.dereference?Or.stat:Or.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Aie(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return vie(a,t,e,r,n,i);if(a.isSymbolicLink())return Tie(t,e,r,n,i)})}function vie(t,e,r,n,i,s){return e?Eie(t,r,n,i,s):x$(t,r,n,i,s)}function Eie(t,e,r,n,i){if(n.overwrite)Or.unlink(r,s=>s?i(s):x$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function x$(t,e,r,n,i){Or.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?bie(t.mode,e,r,i):op(r,t.mode,i))}function bie(t,e,r,n){return _ie(t)?Cie(r,t,i=>i?n(i):A$(t,e,r,n)):A$(t,e,r,n)}function _ie(t){return(t&128)===0}function Cie(t,e,r){return op(t,e|128,r)}function A$(t,e,r,n){Sie(e,r,i=>i?n(i):op(r,t,n))}function op(t,e,r){return Or.chmod(t,e,r)}function Sie(t,e,r){Or.stat(t,(n,i)=>n?r(n):Die(e,i.atime,i.mtime,r))}function Aie(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):T$(r,n,i,s):Oie(t.mode,r,n,i,s)}function Oie(t,e,r,n,i){Or.mkdir(r,s=>{if(s)return i(s);T$(e,r,n,o=>o?i(o):op(r,t,i))})}function T$(t,e,r,n){Or.readdir(t,(i,s)=>i?n(i):I$(s,t,e,r,n))}function I$(t,e,r,n,i){let s=t.pop();return s?xie(t,s,e,r,n,i):i()}function xie(t,e,r,n,i,s){let o=Vc.join(r,e),a=Vc.join(n,e);zc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Hv(l,o,a,i,h=>h?s(h):I$(t,r,n,i,s))})}function Tie(t,e,r,n,i){Or.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=Vc.resolve(process.cwd(),o)),t)Or.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Or.symlink(o,r,i):i(a):(n.dereference&&(u=Vc.resolve(process.cwd(),u)),zc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&zc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Iie(o,r,i)));else return Or.symlink(o,r,i)})}function Iie(t,e,r){Or.unlink(e,n=>n?r(n):Or.symlink(t,e,r))}P$.exports=wie});var Vv=_((Kve,R$)=>{"use strict";var Pie=Fe().fromCallback;R$.exports={copy:Pie(F$())}});var q$=_((Gve,U$)=>{"use strict";var k$=vt(),B$=require("path"),He=require("assert"),Kc=process.platform==="win32";function j$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||k$[r],r=r+"Sync",t[r]=t[r]||k$[r]}),t.maxBusyTries=t.maxBusyTries||3}function zv(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He.strictEqual(typeof r,"function","rimraf: callback function required"),He(e,"rimraf: invalid options argument provided"),He.strictEqual(typeof e,"object","rimraf: options should be object"),j$(e),N$(t,e,function i(s){if(s){if((s.code==="EBUSY"||s.code==="ENOTEMPTY"||s.code==="EPERM")&&n<e.maxBusyTries){n++;let o=n*100;return setTimeout(()=>N$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function N$(t,e,r){He(t),He(e),He(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Kc)return $$(t,e,n,r);if(i&&i.isDirectory())return ap(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return Kc?$$(t,e,s,r):ap(t,e,s,r);if(s.code==="EISDIR")return ap(t,e,s,r)}return r(s)})})}function $$(t,e,r,n){He(t),He(e),He(typeof n=="function"),e.chmod(t,438,i=>{i?n(i.code==="ENOENT"?null:r):e.stat(t,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?ap(t,e,r,n):e.unlink(t,n)})})}function L$(t,e,r){let n;He(t),He(e);try{e.chmodSync(t,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=e.statSync(t)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?up(t,e,r):e.unlinkSync(t)}function ap(t,e,r,n){He(t),He(e),He(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?Fie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function Fie(t,e,r){He(t),He(e),He(typeof r=="function"),e.readdir(t,(n,i)=>{if(n)return r(n);let s=i.length,o;if(s===0)return e.rmdir(t,r);i.forEach(a=>{zv(B$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function M$(t,e){let r;e=e||{},j$(e),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He(e,"rimraf: missing options"),He.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Kc&&L$(t,e,n)}try{r&&r.isDirectory()?up(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Kc?L$(t,e,n):up(t,e,n);if(n.code!=="EISDIR")throw n;up(t,e,n)}}function up(t,e,r){He(t),He(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")Rie(t,e);else if(n.code!=="ENOENT")throw n}}function Rie(t,e){if(He(t),He(e),e.readdirSync(t).forEach(r=>M$(B$.join(t,r),e)),Kc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}U$.exports=zv;zv.sync=M$});var Gc=_((Wve,V$)=>{"use strict";var kie=Fe().fromCallback,H$=q$();V$.exports={remove:kie(H$),removeSync:H$.sync}});var Z$=_((Xve,J$)=>{"use strict";var Nie=Fe().fromCallback,G$=vt(),W$=require("path"),X$=mn(),Y$=Gc(),z$=Nie(function(e,r){r=r||function(){},G$.readdir(e,(n,i)=>{if(n)return X$.mkdirs(e,r);i=i.map(o=>W$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();Y$.remove(o,a=>{if(a)return r(a);s()})}})});function K$(t){let e;try{e=G$.readdirSync(t)}catch{return X$.mkdirsSync(t)}e.forEach(r=>{r=W$.join(t,r),Y$.removeSync(r)})}J$.exports={emptyDirSync:K$,emptydirSync:K$,emptyDir:z$,emptydir:z$}});var rL=_((Yve,tL)=>{"use strict";var $ie=Fe().fromCallback,Q$=require("path"),ts=vt(),eL=mn();function Lie(t,e){function r(){ts.writeFile(t,"",n=>{if(n)return e(n);e()})}ts.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=Q$.dirname(t);ts.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?eL.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():ts.readdir(s,u=>{if(u)return e(u)})})})}function Bie(t){let e;try{e=ts.statSync(t)}catch{}if(e&&e.isFile())return;let r=Q$.dirname(t);try{ts.statSync(r).isDirectory()||ts.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")eL.mkdirsSync(r);else throw n}ts.writeFileSync(t,"")}tL.exports={createFile:$ie(Lie),createFileSync:Bie}});var aL=_((Jve,oL)=>{"use strict";var jie=Fe().fromCallback,iL=require("path"),to=vt(),sL=mn(),nL=es().pathExists;function Mie(t,e,r){function n(i,s){to.link(i,s,o=>{if(o)return r(o);r(null)})}nL(e,(i,s)=>{if(i)return r(i);if(s)return r(null);to.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=iL.dirname(e);nL(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);sL.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function Uie(t,e){if(to.existsSync(e))return;try{to.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=iL.dirname(e);return to.existsSync(n)||sL.mkdirsSync(n),to.linkSync(t,e)}oL.exports={createLink:jie(Mie),createLinkSync:Uie}});var cL=_((Zve,uL)=>{"use strict";var rs=require("path"),Wc=vt(),qie=es().pathExists;function Hie(t,e,r){if(rs.isAbsolute(t))return Wc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=rs.dirname(e),i=rs.join(n,t);return qie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Wc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:rs.relative(n,t)})))}}function Vie(t,e){let r;if(rs.isAbsolute(t)){if(r=Wc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=rs.dirname(e),i=rs.join(n,t);if(r=Wc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Wc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:rs.relative(n,t)}}}uL.exports={symlinkPaths:Hie,symlinkPathsSync:Vie}});var hL=_((Qve,fL)=>{"use strict";var lL=vt();function zie(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);lL.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function Kie(t,e){let r;if(e)return e;try{r=lL.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}fL.exports={symlinkType:zie,symlinkTypeSync:Kie}});var wL=_((eEe,DL)=>{"use strict";var Gie=Fe().fromCallback,pL=require("path"),qa=vt(),mL=mn(),Wie=mL.mkdirs,Xie=mL.mkdirsSync,gL=cL(),Yie=gL.symlinkPaths,Jie=gL.symlinkPathsSync,yL=hL(),Zie=yL.symlinkType,Qie=yL.symlinkTypeSync,dL=es().pathExists;function ese(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,dL(e,(i,s)=>{if(i)return n(i);if(s)return n(null);Yie(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,Zie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=pL.dirname(e);dL(l,(h,d)=>{if(h)return n(h);if(d)return qa.symlink(t,e,c,n);Wie(l,f=>{if(f)return n(f);qa.symlink(t,e,c,n)})})})})})}function tse(t,e,r){if(qa.existsSync(e))return;let i=Jie(t,e);t=i.toDst,r=Qie(i.toCwd,r);let s=pL.dirname(e);return qa.existsSync(s)||Xie(s),qa.symlinkSync(t,e,r)}DL.exports={createSymlink:Gie(ese),createSymlinkSync:tse}});var EL=_((tEe,vL)=>{"use strict";var cp=rL(),lp=aL(),fp=wL();vL.exports={createFile:cp.createFile,createFileSync:cp.createFileSync,ensureFile:cp.createFile,ensureFileSync:cp.createFileSync,createLink:lp.createLink,createLinkSync:lp.createLinkSync,ensureLink:lp.createLink,ensureLinkSync:lp.createLinkSync,createSymlink:fp.createSymlink,createSymlinkSync:fp.createSymlinkSync,ensureSymlink:fp.createSymlink,ensureSymlinkSync:fp.createSymlinkSync}});var _L=_((rEe,bL)=>{"use strict";var hp=k0();bL.exports={readJson:hp.readFile,readJsonSync:hp.readFileSync,writeJson:hp.writeFile,writeJsonSync:hp.writeFileSync}});var dp=_((nEe,AL)=>{"use strict";var rse=Fe().fromCallback,Xc=vt(),CL=require("path"),SL=mn(),nse=es().pathExists;function ise(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=CL.dirname(t);nse(i,(s,o)=>{if(s)return n(s);if(o)return Xc.writeFile(t,e,r,n);SL.mkdirs(i,a=>{if(a)return n(a);Xc.writeFile(t,e,r,n)})})}function sse(t,...e){let r=CL.dirname(t);if(Xc.existsSync(r))return Xc.writeFileSync(t,...e);SL.mkdirsSync(r),Xc.writeFileSync(t,...e)}AL.exports={outputFile:rse(ise),outputFileSync:sse}});var xL=_((iEe,OL)=>{"use strict";var{stringify:ose}=_a(),{outputFile:ase}=dp();async function use(t,e,r={}){let n=ose(e,r);await ase(t,n,r)}OL.exports=use});var IL=_((sEe,TL)=>{"use strict";var{stringify:cse}=_a(),{outputFileSync:lse}=dp();function fse(t,e,r){let n=cse(e,r);lse(t,n,r)}TL.exports=fse});var FL=_((oEe,PL)=>{"use strict";var hse=Fe().fromPromise,cr=_L();cr.outputJson=hse(xL());cr.outputJsonSync=IL();cr.outputJSON=cr.outputJson;cr.outputJSONSync=cr.outputJsonSync;cr.writeJSON=cr.writeJson;cr.writeJSONSync=cr.writeJsonSync;cr.readJSON=cr.readJson;cr.readJSONSync=cr.readJsonSync;PL.exports=cr});var BL=_((aEe,LL)=>{"use strict";var NL=vt(),dse=require("path"),pse=qv().copySync,$L=Gc().removeSync,mse=mn().mkdirpSync,RL=Uc();function gse(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=RL.checkPathsSync(t,e,"move");return RL.checkParentPathsSync(t,i,e,"move"),mse(dse.dirname(e)),yse(t,e,n)}function yse(t,e,r){if(r)return $L(e),kL(t,e,r);if(NL.existsSync(e))throw new Error("dest already exists.");return kL(t,e,r)}function kL(t,e,r){try{NL.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Dse(t,e,r)}}function Dse(t,e,r){return pse(t,e,{overwrite:r,errorOnExist:!0}),$L(t)}LL.exports=gse});var ML=_((uEe,jL)=>{"use strict";jL.exports={moveSync:BL()}});var zL=_((cEe,VL)=>{"use strict";var wse=vt(),vse=require("path"),Ese=Vv().copy,HL=Gc().remove,bse=mn().mkdirp,_se=es().pathExists,UL=Uc();function Cse(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;UL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;UL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);bse(vse.dirname(e),c=>c?n(c):Sse(t,e,i,n))})})}function Sse(t,e,r,n){if(r)return HL(e,i=>i?n(i):qL(t,e,r,n));_se(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):qL(t,e,r,n))}function qL(t,e,r,n){wse.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Ase(t,e,r,n):n())}function Ase(t,e,r,n){Ese(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):HL(t,n))}VL.exports=Cse});var GL=_((lEe,KL)=>{"use strict";var Ose=Fe().fromCallback;KL.exports={move:Ose(zL())}});var pp=_((fEe,Kv)=>{"use strict";Kv.exports={...Mc(),...qv(),...Vv(),...Z$(),...EL(),...FL(),...mn(),...ML(),...GL(),...dp(),...es(),...Gc()};var WL=require("fs");Object.getOwnPropertyDescriptor(WL,"promises")&&Object.defineProperty(Kv.exports,"promises",{get(){return WL.promises}})});var Gv=_(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.readdir=Ha.stat=void 0;var XL=pp();async function xse(t){try{return await XL.stat(t)}catch{}}Ha.stat=xse;async function Tse(t){try{return await XL.readdir(t)}catch{return[]}}Ha.readdir=Tse});var t3=_(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.walk=me.Walker=me.compilePaths=me.tmpfilepath=me.findBaseDirectory=me.isExecutableFile=me.pathExecutable=me.pathWritable=me.pathReadable=me.pathExists=me.pathAccessible=me.writeStreamToFile=me.cacheFileChecksum=me.getFileChecksums=me.getFileChecksum=me.fileToString=me.getFileTree=me.readdirp=me.readdirSafe=me.statSafe=void 0;var Ise=(he(),ce(fe)),Yr=pp(),Pse=require("os"),yi=require("path"),YL=require("stream"),JL=Gv();Ise.__exportStar(pp(),me);var ZL=Gv();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return ZL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return ZL.readdir}});async function Fse(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=Xv(t,n);e&&(a=a.pipe(new YL.Transform({objectMode:!0,transform(u,c,l){(!e||e(u))&&this.push(u),l()}}))),a.on("error",u=>r?r(u):s(u)).on("data",u=>o.push(u.path)).on("end",()=>i(o))})}me.readdirp=Fse;async function Rse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=yi.dirname(u.path),l=s.get(c);return l&&l.type==="directory"?l:n({path:c,type:"directory",children:[]})},a=(u,c)=>{let l={path:u.path,parent:c};return u.stats.isDirectory()?n({...l,type:"directory",children:[]}):r({...l,type:"file"})};return new Promise((u,c)=>{t=yi.resolve(t),Xv(t,i).on("error",h=>e?e(h):c(h)).on("data",h=>{let d=o(h),f=a(h,d);d.children.push(f),s.set(h.path,f),s.set(d.path,d)}).on("end",()=>{let h=s.get(t);if(!h)return c(new Error("No root node found after walking directory structure."));delete h.parent,u(h)})})}me.getFileTree=Rse;async function kse(t){try{return await Yr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=kse;async function Wv(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Yr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=Wv;async function Nse(t){return Promise.all([Wv(t),(async()=>{try{return(await Yr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=Nse;async function $se(t,e){let r=await Wv(t);await Yr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=$se;function Lse(t,e){return new Promise((r,n)=>{let i=Yr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=Lse;async function Yc(t,e){try{await Yr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Yc;async function Bse(t){return Yc(t,Yr.constants.F_OK)}me.pathExists=Bse;async function jse(t){return Yc(t,Yr.constants.R_OK)}me.pathReadable=jse;async function Mse(t){return Yc(t,Yr.constants.W_OK)}me.pathWritable=Mse;async function QL(t){return Yc(t,Yr.constants.X_OK)}me.pathExecutable=QL;async function Use(t){let[e,r]=await Promise.all([JL.stat(t),QL(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=Use;async function qse(t,e){if(!(!t||!e)){for(let r of e3(t))if((await JL.readdir(r)).includes(e))return r}}me.findBaseDirectory=qse;function Hse(t){let e=Math.random().toString(16).substring(2,8);return yi.resolve(Pse.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=Hse;function e3(t){if(t=yi.normalize(t),!yi.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=yi.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(yi.sep).map((r,n,i)=>e.root+yi.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=e3;var mp=class extends YL.Readable{constructor(e,r={}){super({objectMode:!0}),this.p=e,this.options=r,this.paths=[this.p]}_read(){let e=this.paths.shift(),{pathFilter:r}=this.options;if(!e){this.push(null);return}Yr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Yr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>yi.join(e,c));r&&(u=u.filter(c=>r(c.substring(this.p.length+1)))),this.paths.push(...u),this.push(s)}):this.push(s)})}};me.Walker=mp;function Xv(t,e={}){return new mp(t,e)}me.walk=Xv});var r3=_(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.AliasedMap=Di.CaseInsensitiveProxyHandler=Di.createCaseInsensitiveObject=void 0;function Vse(){return new Proxy({},Di.CaseInsensitiveProxyHandler)}Di.createCaseInsensitiveObject=Vse;Di.CaseInsensitiveProxyHandler={has:(t,e)=>gp(e)in t,get:(t,e)=>t[gp(e)],set:(t,e,r)=>(t[gp(e)]=r,!0),deleteProperty:(t,e)=>delete t[gp(e)]};var gp=t=>typeof t=="string"?t.toLowerCase():t,Yv=class extends Map{getAliases(){let e=new Map;return[...this.entries()].filter(([,n])=>typeof n=="string"||typeof n=="symbol").forEach(([n,i])=>{let s=e.get(i)||[];s.push(n),e.set(i,s)}),e}resolveAlias(e){let r=this.get(e);return typeof r!="string"&&typeof r!="symbol"?r:this.resolveAlias(r)}keysWithoutAliases(){return[...this.entries()].filter(e=>typeof e[1]!="string"&&typeof e[1]!="symbol").map(([e,r])=>e)}};Di.AliasedMap=Yv});var u3=_((mEe,a3)=>{"use strict";var o3=require("child_process"),n3=o3.spawn,zse=o3.exec;a3.exports=function(t,e,r){if(typeof e=="function"&&r===void 0&&(r=e,e=void 0),t=parseInt(t),Number.isNaN(t)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[t]=[],i[t]=1,process.platform){case"win32":zse("taskkill /pid "+t+" /T /F",r);break;case"darwin":Jv(t,n,i,function(s){return n3("pgrep",["-P",s])},function(){i3(n,e,r)});break;default:Jv(t,n,i,function(s){return n3("ps",["-o","pid","--no-headers","--ppid",s])},function(){i3(n,e,r)});break}};function i3(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(s3(s,e),n[s]=1)}),n[i]||(s3(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function s3(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function Jv(t,e,r,n,i){var s=n(t),o="";s.stdout.on("data",function(c){var c=c.toString("ascii");o+=c});var a=function(u){if(delete r[t],u!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(c){c=parseInt(c,10),e[t].push(c),e[c]=[],r[c]=1,Jv(c,e,r,n,i)})};s.on("close",a)}});var f3=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.processExit=et.offBeforeExit=et.onBeforeExit=et.onExit=et.sleepForever=et.sleepUntil=et.sleep=et.getPathParts=et.createProcessEnv=et.killProcessTree=et.ERROR_TIMEOUT_REACHED=void 0;var Zv=(he(),ce(fe)),Kse=r3(),Gse=zi(),Wse=Zh(),Xse=Zv.__importStar(require("path")),Yse=Zv.__importDefault(Uh()),Jse=Zv.__importDefault(u3()),ro=(0,Wse.debug)("ionic:utils-process");et.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function Zse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,Jse.default)(t,e,i=>{if(i)return ro("error while killing process tree for %d: %O",t,i),n(i);r()})})}et.killProcessTree=Zse;function Qse(...t){return Object.assign(Gse.TERMINAL_INFO.windows?(0,Kse.createCaseInsensitiveObject)():{},...t)}et.createProcessEnv=Qse;function eoe(t=process.env.PATH||""){return t.split(Xse.delimiter)}et.getPathParts=eoe;async function c3(t){return new Promise(e=>{setTimeout(e,t)})}et.sleep=c3;async function toe(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await c3(e),n+=e,n>r)throw et.ERROR_TIMEOUT_REACHED}et.sleepUntil=toe;async function roe(){return new Promise(()=>{setInterval(()=>{},1e3)})}et.sleepForever=roe;function noe(t){(0,Yse.default)(()=>{ro("onExit: process.exit/normal shutdown"),t()})}et.onExit=noe;var yp=new Set;function ioe(t){yp.add(t)}et.onBeforeExit=ioe;function soe(t){yp.delete(t)}et.offBeforeExit=soe;var ooe=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Jc=t=>ooe(async()=>{ro("onBeforeExit handler: %O received",t),ro("onBeforeExit handler: running %O functions",yp.size),await Promise.all([...yp.values()].map(async e=>{try{await e()}catch(r){ro("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(ro("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,l3[t]),process.kill(process.pid,t))}),l3={SIGINT:Jc("SIGINT"),SIGTERM:Jc("SIGTERM"),SIGHUP:Jc("SIGHUP"),SIGBREAK:Jc("SIGBREAK")};for(let[t,e]of Object.entries(l3))process.on(t,e);var aoe=Jc("process.exit");async function uoe(t=0){process.exitCode=t,await aoe(),ro("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}et.processExit=uoe});var p3=_(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.growBufferForAppendedData=jn.WritableStreamBuffer=jn.ReadableStreamBuffer=jn.NullStream=void 0;var rE=require("stream"),coe=4,h3=32,d3=16,Qv=class extends rE.Writable{_write(e,r,n){n()}};jn.NullStream=Qv;var eE=class extends rE.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:h3),this.chunkSize=e&&e.chunkSize?e.chunkSize:coe,this.growSize=e&&e.growSize?e.growSize:d3}get size(){return this._size}get stopped(){return this._stopped}_read(){this._send()}feed(e,r="utf8"){if(this._stopped)throw new Error("ReadableStreamBuffer is stopped. Can no longer feed.");let n=typeof e=="string"?Buffer.byteLength(e):e.length;this.buffer=nE(this.buffer,this._size,Math.ceil(n/this.growSize)*this.growSize),typeof e=="string"?this.buffer.write(e,this._size,n,r):this.buffer.copy(e,this._size,0),this._size+=n}stop(){this._stopped||(this._stopped=!0,this._size===0&&this.push(null))}_send(){let e=Math.min(this.chunkSize,this._size),r=!1;if(e>0){let n=Buffer.alloc(e);this.buffer.copy(n,0,0,e),r=!this.push(n),this.buffer.copy(this.buffer,0,e,this._size),this._size-=e}this._size===0&&this._stopped&&this.push(null),r||setTimeout(()=>this._send(),1)}};jn.ReadableStreamBuffer=eE;var tE=class extends rE.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:h3),this.growSize=e&&e.growSize?e.growSize:d3}get size(){return this._size}_write(e,r,n){this.buffer=nE(this.buffer,this._size,Math.ceil(e.length/this.growSize)*this.growSize),e.copy(this.buffer,this._size,0),this._size+=e.length,n()}consume(e){e=typeof e=="number"?e:this._size;let r=Buffer.alloc(e);return this.buffer.copy(r,0,0,r.length),this.buffer.copy(this.buffer,0,r.length),this._size-=r.length,r}};jn.WritableStreamBuffer=tE;function nE(t,e,r){if(t.length-e>=r)return t;let n=Buffer.alloc(t.length+r);return t.copy(n,0,0,e),n}jn.growBufferForAppendedData=nE});var w3=_((DEe,D3)=>{D3.exports=y3;y3.sync=foe;var m3=require("fs");function loe(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function g3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:loe(e,r)}function y3(t,e,r){m3.stat(t,function(n,i){r(n,n?!1:g3(i,t,e))})}function foe(t,e){return g3(m3.statSync(t),t,e)}});var C3=_((wEe,_3)=>{_3.exports=E3;E3.sync=hoe;var v3=require("fs");function E3(t,e,r){v3.stat(t,function(n,i){r(n,n?!1:b3(i,e))})}function hoe(t,e){return b3(v3.statSync(t),e)}function b3(t,e){return t.isFile()&&doe(t,e)}function doe(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,h=r&c||r&u&&i===o||r&a&&n===s||r&l&&s===0;return h}});var A3=_((EEe,S3)=>{var vEe=require("fs"),Dp;process.platform==="win32"||global.TESTING_WINDOWS?Dp=w3():Dp=C3();S3.exports=iE;iE.sync=poe;function iE(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){iE(t,e||{},function(s,o){s?i(s):n(o)})})}Dp(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function poe(t,e){try{return Dp.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var R3=_((bEe,F3)=>{var Va=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",O3=require("path"),moe=Va?";":":",x3=A3(),T3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),I3=(t,e)=>{let r=e.colon||moe,n=t.match(/\//)||Va&&t.match(/\\/)?[""]:[...Va?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Va?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Va?i.split(r):[""];return Va&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},P3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=I3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(T3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,m=O3.join(f,t),y=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;l(u(y,c,0))}),u=(c,l,h)=>new Promise((d,f)=>{if(h===i.length)return d(a(l+1));let m=i[h];x3(c+m,{pathExt:s},(y,v)=>{if(!y&&v)if(e.all)o.push(c+m);else return d(c+m);return d(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},goe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=I3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=O3.join(u,t),l=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let h=0;h<n.length;h++){let d=l+n[h];try{if(x3.sync(d,{pathExt:i}))if(e.all)s.push(d);else return d}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw T3(t)};F3.exports=P3;P3.sync=goe});var N3=_((_Ee,sE)=>{"use strict";var k3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};sE.exports=k3;sE.exports.default=k3});var j3=_((CEe,B3)=>{"use strict";var $3=require("path"),yoe=R3(),Doe=N3();function L3(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=yoe.sync(t.command,{path:r[Doe({env:r})],pathExt:e?$3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=$3.resolve(i?t.options.cwd:"",o)),o}function woe(t){return L3(t)||L3(t,!0)}B3.exports=woe});var M3=_((SEe,aE)=>{"use strict";var oE=/([()\][%!^"`<>&|;, *?])/g;function voe(t){return t=t.replace(oE,"^$1"),t}function Eoe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(oE,"^$1"),e&&(t=t.replace(oE,"^$1")),t}aE.exports.command=voe;aE.exports.argument=Eoe});var q3=_((AEe,U3)=>{"use strict";U3.exports=/^#!(.*)/});var V3=_((OEe,H3)=>{"use strict";var boe=q3();H3.exports=(t="")=>{let e=t.match(boe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var K3=_((xEe,z3)=>{"use strict";var uE=require("fs"),_oe=V3();function Coe(t){let r=Buffer.alloc(150),n;try{n=uE.openSync(t,"r"),uE.readSync(n,r,0,150,0),uE.closeSync(n)}catch{}return _oe(r.toString())}z3.exports=Coe});var Y3=_((TEe,X3)=>{"use strict";var Soe=require("path"),G3=j3(),W3=M3(),Aoe=K3(),Ooe=process.platform==="win32",xoe=/\.(?:com|exe)$/i,Toe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ioe(t){t.file=G3(t);let e=t.file&&Aoe(t.file);return e?(t.args.unshift(t.file),t.command=e,G3(t)):t.file}function Poe(t){if(!Ooe)return t;let e=Ioe(t),r=!xoe.test(e);if(t.options.forceShell||r){let n=Toe.test(e);t.command=Soe.normalize(t.command),t.command=W3.command(t.command),t.args=t.args.map(s=>W3.argument(s,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Foe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Poe(n)}X3.exports=Foe});var Q3=_((IEe,Z3)=>{"use strict";var cE=process.platform==="win32";function lE(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Roe(t,e){if(!cE)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=J3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function J3(t,e){return cE&&t===1&&!e.file?lE(e.original,"spawn"):null}function koe(t,e){return cE&&t===1&&!e.file?lE(e.original,"spawnSync"):null}Z3.exports={hookChildProcess:Roe,verifyENOENT:J3,verifyENOENTSync:koe,notFoundError:lE}});var rB=_((PEe,za)=>{"use strict";var eB=require("child_process"),fE=Y3(),hE=Q3();function tB(t,e,r){let n=fE(t,e,r),i=eB.spawn(n.command,n.args,n.options);return hE.hookChildProcess(i,n),i}function Noe(t,e,r){let n=fE(t,e,r),i=eB.spawnSync(n.command,n.args,n.options);return i.error=i.error||hE.verifyENOENTSync(i.status,n),i}za.exports=tB;za.exports.spawn=tB;za.exports.sync=Noe;za.exports._parse=fE;za.exports._enoent=hE});var cB=_(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.findExecutables=Re.which=Re.fork=Re.spawn=Re.Subprocess=Re.SubprocessError=Re.convertPATH=Re.expandTildePath=Re.TILDE_PATH_REGEX=Re.ERROR_SIGNAL_EXIT=Re.ERROR_NON_ZERO_EXIT=Re.ERROR_COMMAND_NOT_FOUND=void 0;var mE=(he(),ce(fe)),nB=r$(),$oe=t3(),dE=f3(),wp=p3(),iB=zi(),Loe=require("child_process"),Boe=mE.__importDefault(rB()),joe=mE.__importStar(require("os")),io=mE.__importStar(require("path"));Re.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";Re.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";Re.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";Re.TILDE_PATH_REGEX=/^~($|\/|\\)/;function sB(t){let e=joe.homedir();return t.replace(Re.TILDE_PATH_REGEX,`${e}$1`)}Re.expandTildePath=sB;function oB(t=process.env.PATH||""){return t.split(io.delimiter).map(sB).join(io.delimiter)}Re.convertPATH=oB;var no=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};Re.SubprocessError=no;var pE=class{constructor(e,r,n={}){this.name=e,this.args=r;let i=this.maskArg(e);i!==e&&(this.name=i,this.path=e),this._options=n}get options(){let e=this._options;e.env||(e.env=process.env);let r=(0,dE.createProcessEnv)(e.env||{},{PATH:oB(typeof e.env.PATH=="string"?e.env.PATH:process.env.PATH)});return{...e,env:r}}async output(){this._options.stdio="pipe";let e=this.run(),r=new wp.WritableStreamBuffer,n=new wp.WritableStreamBuffer,i=new wp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stdout?.pipe(i),e.p.stderr?.pipe(n),e.p.stderr?.pipe(i);try{await e}catch(s){throw r.end(),n.end(),s.output=i.consume().toString(),s}return n.end(),i.end(),r.consume().toString()}async combinedOutput(){this._options.stdio="pipe";let e=this.run(),r=new wp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stderr?.pipe(r);try{await e}catch(n){throw n.output=r.consume().toString(),n}return r.consume().toString()}run(){let e=this.spawn(),r=new Promise((n,i)=>{e.on("error",s=>{let o;s.code==="ENOENT"?(o=new no("Command not found.",{cause:s}),o.code=Re.ERROR_COMMAND_NOT_FOUND):o=new no("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new no("Signal exit from subprocess."),a.code=Re.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new no("Non-zero exit from subprocess."),a.code=Re.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return aB(this.path?this.path:this.name,this.args,this.options)}bashify({maskArgv0:e=!0,maskArgv1:r=!1,shiftArgv0:n=!1}={}){let i=[this.path?this.path:this.name,...this.args];return n&&i.shift(),i[0]&&e&&(i[0]=this.maskArg(i[0])),i[1]&&r&&(i[1]=this.maskArg(i[1])),i.length>0?i.map(s=>this.bashifyArg(s)).join(" "):""}bashifyArg(e){return e.includes(" ")?`"${e.replace(/\"/g,'\\"')}"`:e}maskArg(e){let r=e.lastIndexOf(io.sep);return r>=0?e.substring(r+1):e}};Re.Subprocess=pE;function aB(t,e=[],r){return(0,Boe.default)(t,[...e],r)}Re.spawn=aB;function Moe(t,e=[],r={}){return(0,Loe.fork)(t,[...e],r)}Re.fork=Moe;var gE=iB.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function Uoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){if(t.includes(io.sep))return t;let n=await uB(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}Re.which=Uoe;async function qoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){return t.includes(io.sep)?[t]:uB(t,{PATH:e})}Re.findExecutables=qoe;async function uB(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){let n=(0,dE.getPathParts)(e),i;if(iB.TERMINAL_INFO.windows){let s=(0,dE.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(io.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,nB.map)(i,async s=>(0,nB.concurrentFilter)(n.map(o=>io.join(o,s)),async o=>(0,$oe.isExecutableFile)(o))))}});var vp=_(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.isInstalled=ns.getCommandOutput=ns.runCommand=void 0;var yE=cB();async function lB(t,e,r={}){let n=new yE.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof yE.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}ns.runCommand=lB;async function Hoe(t,e,r={}){try{return(await lB(t,e,r)).trim()}catch{return null}}ns.getCommandOutput=Hoe;async function Voe(t){try{await(0,yE.which)(t)}catch{return!1}return!0}ns.isInstalled=Voe});var Zc=_((kEe,fB)=>{"use strict";var zoe="2.0.0",Koe=Number.MAX_SAFE_INTEGER||9007199254740991,Goe=16,Woe=250,Xoe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];fB.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Goe,MAX_SAFE_BUILD_LENGTH:Woe,MAX_SAFE_INTEGER:Koe,RELEASE_TYPES:Xoe,SEMVER_SPEC_VERSION:zoe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Qc=_((NEe,hB)=>{"use strict";var Yoe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};hB.exports=Yoe});var Ka=_((Mn,dB)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:DE,MAX_SAFE_BUILD_LENGTH:Joe,MAX_LENGTH:Zoe}=Zc(),Qoe=Qc();Mn=dB.exports={};var eae=Mn.re=[],tae=Mn.safeRe=[],Z=Mn.src=[],rae=Mn.safeSrc=[],Q=Mn.t={},nae=0,wE="[a-zA-Z0-9-]",iae=[["\\s",1],["\\d",Zoe],[wE,Joe]],sae=t=>{for(let[e,r]of iae)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=sae(e),i=nae++;Qoe(t,i,e),Q[t]=i,Z[i]=e,rae[i]=n,eae[i]=new RegExp(e,r?"g":void 0),tae[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${wE}*`);ge("MAINVERSION",`(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${Z[Q.PRERELEASEIDENTIFIER]}(?:\\.${Z[Q.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${Z[Q.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Z[Q.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${wE}+`);ge("BUILD",`(?:\\+(${Z[Q.BUILDIDENTIFIER]}(?:\\.${Z[Q.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${Z[Q.MAINVERSION]}${Z[Q.PRERELEASE]}?${Z[Q.BUILD]}?`);ge("FULL",`^${Z[Q.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${Z[Q.MAINVERSIONLOOSE]}${Z[Q.PRERELEASELOOSE]}?${Z[Q.BUILD]}?`);ge("LOOSE",`^${Z[Q.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${Z[Q.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${Z[Q.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:${Z[Q.PRERELEASE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:${Z[Q.PRERELEASELOOSE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${DE}})(?:\\.(\\d{1,${DE}}))?(?:\\.(\\d{1,${DE}}))?`);ge("COERCE",`${Z[Q.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",Z[Q.COERCEPLAIN]+`(?:${Z[Q.PRERELEASE]})?(?:${Z[Q.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",Z[Q.COERCE],!0);ge("COERCERTLFULL",Z[Q.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${Z[Q.LONETILDE]}\\s+`,!0);Mn.tildeTrimReplace="$1~";ge("TILDE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${Z[Q.LONECARET]}\\s+`,!0);Mn.caretTrimReplace="$1^";ge("CARET",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${Z[Q.GTLT]}\\s*(${Z[Q.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]}|${Z[Q.XRANGEPLAIN]})`,!0);Mn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${Z[Q.XRANGEPLAIN]})\\s+-\\s+(${Z[Q.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${Z[Q.XRANGEPLAINLOOSE]})\\s+-\\s+(${Z[Q.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ep=_(($Ee,pB)=>{"use strict";var oae=Object.freeze({loose:!0}),aae=Object.freeze({}),uae=t=>t?typeof t!="object"?oae:t:aae;pB.exports=uae});var vE=_((LEe,yB)=>{"use strict";var mB=/^[0-9]+$/,gB=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=mB.test(t),n=mB.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},cae=(t,e)=>gB(e,t);yB.exports={compareIdentifiers:gB,rcompareIdentifiers:cae}});var Xt=_((BEe,wB)=>{"use strict";var bp=Qc(),{MAX_LENGTH:DB,MAX_SAFE_INTEGER:_p}=Zc(),{safeRe:Cp,t:Sp}=Ka(),lae=Ep(),{compareIdentifiers:EE}=vE(),bE=class t{constructor(e,r){if(r=lae(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>DB)throw new TypeError(`version is longer than ${DB} characters`);bp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Cp[Sp.LOOSE]:Cp[Sp.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>_p||this.major<0)throw new TypeError("Invalid major version");if(this.minor>_p||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>_p||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<_p)return s}return i}):this.prerelease=[],this.build=n[5]?n[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(e){if(bp("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(bp("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return EE(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(bp("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return EE(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?Cp[Sp.PRERELEASELOOSE]:Cp[Sp.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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 i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];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(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),EE(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};wB.exports=bE});var so=_((jEe,EB)=>{"use strict";var vB=Xt(),fae=(t,e,r=!1)=>{if(t instanceof vB)return t;try{return new vB(t,e)}catch(n){if(!r)return null;throw n}};EB.exports=fae});var _B=_((MEe,bB)=>{"use strict";var hae=so(),dae=(t,e)=>{let r=hae(t,e);return r?r.version:null};bB.exports=dae});var SB=_((UEe,CB)=>{"use strict";var pae=so(),mae=(t,e)=>{let r=pae(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};CB.exports=mae});var xB=_((qEe,OB)=>{"use strict";var AB=Xt(),gae=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new AB(t instanceof AB?t.version:t,r).inc(e,n,i).version}catch{return null}};OB.exports=gae});var PB=_((HEe,IB)=>{"use strict";var TB=so(),yae=(t,e)=>{let r=TB(t,null,!0),n=TB(e,null,!0),i=r.compare(n);if(i===0)return null;let s=i>0,o=s?r:n,a=s?n:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};IB.exports=yae});var RB=_((VEe,FB)=>{"use strict";var Dae=Xt(),wae=(t,e)=>new Dae(t,e).major;FB.exports=wae});var NB=_((zEe,kB)=>{"use strict";var vae=Xt(),Eae=(t,e)=>new vae(t,e).minor;kB.exports=Eae});var LB=_((KEe,$B)=>{"use strict";var bae=Xt(),_ae=(t,e)=>new bae(t,e).patch;$B.exports=_ae});var jB=_((GEe,BB)=>{"use strict";var Cae=so(),Sae=(t,e)=>{let r=Cae(t,e);return r&&r.prerelease.length?r.prerelease:null};BB.exports=Sae});var Jr=_((WEe,UB)=>{"use strict";var MB=Xt(),Aae=(t,e,r)=>new MB(t,r).compare(new MB(e,r));UB.exports=Aae});var HB=_((XEe,qB)=>{"use strict";var Oae=Jr(),xae=(t,e,r)=>Oae(e,t,r);qB.exports=xae});var zB=_((YEe,VB)=>{"use strict";var Tae=Jr(),Iae=(t,e)=>Tae(t,e,!0);VB.exports=Iae});var Ap=_((JEe,GB)=>{"use strict";var KB=Xt(),Pae=(t,e,r)=>{let n=new KB(t,r),i=new KB(e,r);return n.compare(i)||n.compareBuild(i)};GB.exports=Pae});var XB=_((ZEe,WB)=>{"use strict";var Fae=Ap(),Rae=(t,e)=>t.sort((r,n)=>Fae(r,n,e));WB.exports=Rae});var JB=_((QEe,YB)=>{"use strict";var kae=Ap(),Nae=(t,e)=>t.sort((r,n)=>kae(n,r,e));YB.exports=Nae});var el=_((ebe,ZB)=>{"use strict";var $ae=Jr(),Lae=(t,e,r)=>$ae(t,e,r)>0;ZB.exports=Lae});var Op=_((tbe,QB)=>{"use strict";var Bae=Jr(),jae=(t,e,r)=>Bae(t,e,r)<0;QB.exports=jae});var _E=_((rbe,ej)=>{"use strict";var Mae=Jr(),Uae=(t,e,r)=>Mae(t,e,r)===0;ej.exports=Uae});var CE=_((nbe,tj)=>{"use strict";var qae=Jr(),Hae=(t,e,r)=>qae(t,e,r)!==0;tj.exports=Hae});var xp=_((ibe,rj)=>{"use strict";var Vae=Jr(),zae=(t,e,r)=>Vae(t,e,r)>=0;rj.exports=zae});var Tp=_((sbe,nj)=>{"use strict";var Kae=Jr(),Gae=(t,e,r)=>Kae(t,e,r)<=0;nj.exports=Gae});var SE=_((obe,ij)=>{"use strict";var Wae=_E(),Xae=CE(),Yae=el(),Jae=xp(),Zae=Op(),Qae=Tp(),eue=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return Wae(t,r,n);case"!=":return Xae(t,r,n);case">":return Yae(t,r,n);case">=":return Jae(t,r,n);case"<":return Zae(t,r,n);case"<=":return Qae(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};ij.exports=eue});var oj=_((abe,sj)=>{"use strict";var tue=Xt(),rue=so(),{safeRe:Ip,t:Pp}=Ka(),nue=(t,e)=>{if(t instanceof tue)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Ip[Pp.COERCEFULL]:Ip[Pp.COERCE]);else{let u=e.includePrerelease?Ip[Pp.COERCERTLFULL]:Ip[Pp.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",s=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return rue(`${n}.${i}.${s}${o}${a}`,e)};sj.exports=nue});var uj=_((ube,aj)=>{"use strict";var AE=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};aj.exports=AE});var Zr=_((cbe,hj)=>{"use strict";var iue=/\s+/g,OE=class t{constructor(e,r){if(r=oue(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof xE)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(iue," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!lj(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&due(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&fue)|(this.options.loose&&hue))+":"+e,i=cj.get(n);if(i)return i;let s=this.options.loose,o=s?lr[Yt.HYPHENRANGELOOSE]:lr[Yt.HYPHENRANGE];e=e.replace(o,_ue(this.options.includePrerelease)),tt("hyphen replace",e),e=e.replace(lr[Yt.COMPARATORTRIM],uue),tt("comparator trim",e),e=e.replace(lr[Yt.TILDETRIM],cue),tt("tilde trim",e),e=e.replace(lr[Yt.CARETTRIM],lue),tt("caret trim",e);let a=e.split(" ").map(h=>pue(h,this.options)).join(" ").split(/\s+/).map(h=>bue(h,this.options));s&&(a=a.filter(h=>(tt("loose invalid filter",h,this.options),!!h.match(lr[Yt.COMPARATORLOOSE])))),tt("range list",a);let u=new Map,c=a.map(h=>new xE(h,this.options));for(let h of c){if(lj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return cj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>fj(n,r)&&e.set.some(i=>fj(i,r)&&n.every(s=>i.every(o=>s.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new aue(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Cue(this.set[r],e,this.options))return!0;return!1}};hj.exports=OE;var sue=uj(),cj=new sue,oue=Ep(),xE=tl(),tt=Qc(),aue=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:uue,tildeTrimReplace:cue,caretTrimReplace:lue}=Ka(),{FLAG_INCLUDE_PRERELEASE:fue,FLAG_LOOSE:hue}=Zc(),lj=t=>t.value==="<0.0.0-0",due=t=>t.value==="",fj=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(s=>i.intersects(s,e)),i=n.pop();return r},pue=(t,e)=>(t=t.replace(lr[Yt.BUILD],""),tt("comp",t,e),t=yue(t,e),tt("caret",t),t=mue(t,e),tt("tildes",t),t=wue(t,e),tt("xrange",t),t=Eue(t,e),tt("stars",t),t),fr=t=>!t||t.toLowerCase()==="x"||t==="*",mue=(t,e)=>t.trim().split(/\s+/).map(r=>gue(r,e)).join(" "),gue=(t,e)=>{let r=e.loose?lr[Yt.TILDELOOSE]:lr[Yt.TILDE];return t.replace(r,(n,i,s,o,a)=>{tt("tilde",t,n,i,s,o,a);let u;return fr(i)?u="":fr(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:fr(o)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(tt("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,tt("tilde return",u),u})},yue=(t,e)=>t.trim().split(/\s+/).map(r=>Due(r,e)).join(" "),Due=(t,e)=>{tt("caret",t,e);let r=e.loose?lr[Yt.CARETLOOSE]:lr[Yt.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,s,o,a,u)=>{tt("caret",t,i,s,o,a,u);let c;return fr(s)?c="":fr(o)?c=`>=${s}.0.0${n} <${+s+1}.0.0-0`:fr(a)?s==="0"?c=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:u?(tt("replaceCaret pr",u),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${u} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${u} <${+s+1}.0.0-0`):(tt("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),tt("caret return",c),c})},wue=(t,e)=>(tt("replaceXRanges",t,e),t.split(/\s+/).map(r=>vue(r,e)).join(" ")),vue=(t,e)=>{t=t.trim();let r=e.loose?lr[Yt.XRANGELOOSE]:lr[Yt.XRANGE];return t.replace(r,(n,i,s,o,a,u)=>{tt("xRange",t,n,i,s,o,a,u);let c=fr(s),l=c||fr(o),h=l||fr(a),d=h;return i==="="&&d&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(o=0),a=0,i===">"?(i=">=",l?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",l?s=+s+1:o=+o+1),i==="<"&&(u="-0"),n=`${i+s}.${o}.${a}${u}`):l?n=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(n=`>=${s}.${o}.0${u} <${s}.${+o+1}.0-0`),tt("xRange return",n),n})},Eue=(t,e)=>(tt("replaceStars",t,e),t.trim().replace(lr[Yt.STAR],"")),bue=(t,e)=>(tt("replaceGTE0",t,e),t.trim().replace(lr[e.includePrerelease?Yt.GTE0PRE:Yt.GTE0],"")),_ue=t=>(e,r,n,i,s,o,a,u,c,l,h,d)=>(fr(n)?r="":fr(i)?r=`>=${n}.0.0${t?"-0":""}`:fr(s)?r=`>=${n}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,fr(c)?u="":fr(l)?u=`<${+c+1}.0.0-0`:fr(h)?u=`<${c}.${+l+1}.0-0`:d?u=`<=${c}.${l}.${h}-${d}`:t?u=`<${c}.${l}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Cue=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(tt(t[n].semver),t[n].semver!==xE.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var tl=_((lbe,Dj)=>{"use strict";var rl=Symbol("SemVer ANY"),PE=class t{static get ANY(){return rl}constructor(e,r){if(r=dj(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),IE("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===rl?this.value="":this.value=this.operator+this.semver.version,IE("comp",this)}parse(e){let r=this.options.loose?pj[mj.COMPARATORLOOSE]:pj[mj.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new gj(n[2],this.options.loose):this.semver=rl}toString(){return this.value}test(e){if(IE("Comparator.test",e,this.options.loose),this.semver===rl||e===rl)return!0;if(typeof e=="string")try{e=new gj(e,this.options)}catch{return!1}return TE(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new yj(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new yj(this.value,r).test(e.semver):(r=dj(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||TE(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||TE(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Dj.exports=PE;var dj=Ep(),{safeRe:pj,t:mj}=Ka(),TE=SE(),IE=Qc(),gj=Xt(),yj=Zr()});var nl=_((fbe,wj)=>{"use strict";var Sue=Zr(),Aue=(t,e,r)=>{try{e=new Sue(e,r)}catch{return!1}return e.test(t)};wj.exports=Aue});var Ej=_((hbe,vj)=>{"use strict";var Oue=Zr(),xue=(t,e)=>new Oue(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));vj.exports=xue});var _j=_((dbe,bj)=>{"use strict";var Tue=Xt(),Iue=Zr(),Pue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Iue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Tue(n,r))}),n};bj.exports=Pue});var Sj=_((pbe,Cj)=>{"use strict";var Fue=Xt(),Rue=Zr(),kue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Rue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new Fue(n,r))}),n};Cj.exports=kue});var xj=_((mbe,Oj)=>{"use strict";var FE=Xt(),Nue=Zr(),Aj=el(),$ue=(t,e)=>{t=new Nue(t,e);let r=new FE("0.0.0");if(t.test(r)||(r=new FE("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],s=null;i.forEach(o=>{let a=new FE(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Aj(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Aj(r,s))&&(r=s)}return r&&t.test(r)?r:null};Oj.exports=$ue});var Ij=_((gbe,Tj)=>{"use strict";var Lue=Zr(),Bue=(t,e)=>{try{return new Lue(t,e).range||"*"}catch{return null}};Tj.exports=Bue});var Fp=_((ybe,kj)=>{"use strict";var jue=Xt(),Rj=tl(),{ANY:Mue}=Rj,Uue=Zr(),que=nl(),Pj=el(),Fj=Op(),Hue=Tp(),Vue=xp(),zue=(t,e,r,n)=>{t=new jue(t,n),e=new Uue(e,n);let i,s,o,a,u;switch(r){case">":i=Pj,s=Hue,o=Fj,a=">",u=">=";break;case"<":i=Fj,s=Vue,o=Pj,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(que(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],h=null,d=null;if(l.forEach(f=>{f.semver===Mue&&(f=new Rj(">=0.0.0")),h=h||f,d=d||f,i(f.semver,h.semver,n)?h=f:o(f.semver,d.semver,n)&&(d=f)}),h.operator===a||h.operator===u||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===u&&o(t,d.semver))return!1}return!0};kj.exports=zue});var $j=_((Dbe,Nj)=>{"use strict";var Kue=Fp(),Gue=(t,e,r)=>Kue(t,e,">",r);Nj.exports=Gue});var Bj=_((wbe,Lj)=>{"use strict";var Wue=Fp(),Xue=(t,e,r)=>Wue(t,e,"<",r);Lj.exports=Xue});var Uj=_((vbe,Mj)=>{"use strict";var jj=Zr(),Yue=(t,e,r)=>(t=new jj(t,r),e=new jj(e,r),t.intersects(e,r));Mj.exports=Yue});var Hj=_((Ebe,qj)=>{"use strict";var Jue=nl(),Zue=Jr();qj.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>Zue(l,h,r));for(let l of o)Jue(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,h]of n)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var Xj=_((bbe,Wj)=>{"use strict";var Vj=Zr(),kE=tl(),{ANY:RE}=kE,il=nl(),NE=Jr(),Que=(t,e,r={})=>{if(t===e)return!0;t=new Vj(t,r),e=new Vj(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=tce(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},ece=[new kE(">=0.0.0-0")],zj=[new kE(">=0.0.0")],tce=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===RE){if(e.length===1&&e[0].semver===RE)return!0;r.includePrerelease?t=ece:t=zj}if(e.length===1&&e[0].semver===RE){if(r.includePrerelease)return!0;e=zj}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=Kj(i,f,r):f.operator==="<"||f.operator==="<="?s=Gj(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=NE(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let f of n){if(i&&!il(f,String(i),r)||s&&!il(f,String(s),r))return null;for(let m of e)if(!il(f,String(m),r))return!1;return!0}let a,u,c,l,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",i){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(a=Kj(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!il(i.semver,String(f),r))return!1}if(s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(u=Gj(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!il(s.semver,String(f),r))return!1}if(!f.operator&&(s||i)&&o!==0)return!1}return!(i&&c&&!s&&o!==0||s&&l&&!i&&o!==0||d||h)},Kj=(t,e,r)=>{if(!t)return e;let n=NE(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Gj=(t,e,r)=>{if(!t)return e;let n=NE(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Wj.exports=Que});var Qj=_((_be,Zj)=>{"use strict";var $E=Ka(),Yj=Zc(),rce=Xt(),Jj=vE(),nce=so(),ice=_B(),sce=SB(),oce=xB(),ace=PB(),uce=RB(),cce=NB(),lce=LB(),fce=jB(),hce=Jr(),dce=HB(),pce=zB(),mce=Ap(),gce=XB(),yce=JB(),Dce=el(),wce=Op(),vce=_E(),Ece=CE(),bce=xp(),_ce=Tp(),Cce=SE(),Sce=oj(),Ace=tl(),Oce=Zr(),xce=nl(),Tce=Ej(),Ice=_j(),Pce=Sj(),Fce=xj(),Rce=Ij(),kce=Fp(),Nce=$j(),$ce=Bj(),Lce=Uj(),Bce=Hj(),jce=Xj();Zj.exports={parse:nce,valid:ice,clean:sce,inc:oce,diff:ace,major:uce,minor:cce,patch:lce,prerelease:fce,compare:hce,rcompare:dce,compareLoose:pce,compareBuild:mce,sort:gce,rsort:yce,gt:Dce,lt:wce,eq:vce,neq:Ece,gte:bce,lte:_ce,cmp:Cce,coerce:Sce,Comparator:Ace,Range:Oce,satisfies:xce,toComparators:Tce,maxSatisfying:Ice,minSatisfying:Pce,minVersion:Fce,validRange:Rce,outside:kce,gtr:Nce,ltr:$ce,intersects:Lce,simplifyRange:Bce,subset:jce,SemVer:rce,re:$E.re,src:$E.src,tokens:$E.t,SEMVER_SPEC_VERSION:Yj.SEMVER_SPEC_VERSION,RELEASE_TYPES:Yj.RELEASE_TYPES,compareIdentifiers:Jj.compareIdentifiers,rcompareIdentifiers:Jj.rcompareIdentifiers}});var fM=_(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.parseApkNameFromFlavor=ee.checkJDKMajorVersion=ee.resolvePlatform=ee.checkPlatformVersions=ee.getAddedPlatforms=ee.getPlatformTargetName=ee.promptForPlatformTarget=ee.promptForPlatform=ee.isValidEnterprisePlatform=ee.getKnownEnterprisePlatforms=ee.isValidCommunityPlatform=ee.getKnownCommunityPlatforms=ee.isValidPlatform=ee.getKnownPlatforms=ee.selectPlatforms=ee.getProjectPlatformDirectory=ee.getCLIVersion=ee.getCoreVersion=ee.getCapacitorPackageVersion=ee.requireCapacitorPackage=ee.getCapacitorPackage=ee.runTask=ee.runPlatformHook=ee.runHooks=ee.wait=ee.checkAppName=ee.checkAppId=ee.checkAppDir=ee.checkAppConfig=ee.checkCapacitorPlatform=ee.checkPackage=ee.checkWebDir=ee.check=void 0;var ol=(he(),ce(fe)),eM=zi(),is=Sa(),oo=require("path"),qe=ol.__importDefault(Aa()),Ga=pd(),rM=Sc(),Mce=t$(),tM=Ll(),sl=jd(),Uce=vp();async function qce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
207
207
  `)}ee.check=qce;async function Hce(t){var e;return!((e=t.app.extConfig.server)===null||e===void 0)&&e.url?null:["",".","..","../","./"].includes(t.app.webDir)?`"${t.app.webDir}" is not a valid value for webDir`:await(0,is.pathExists)(t.app.webDirAbs)?await(0,is.pathExists)((0,oo.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${qe.default.strong((0,eM.prettyPath)(t.app.webDirAbs))}) must contain an ${qe.default.strong("index.html")} file.
208
208
  It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${qe.default.strong((0,eM.prettyPath)(t.app.webDirAbs))}.
209
209
  Please create it and make sure it has an ${qe.default.strong("index.html")} file. You can change the path of this directory in ${qe.default.strong(t.app.extConfigName)} (${qe.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${qe.default.input("npm run build")}). More info: ${qe.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}ee.checkWebDir=Hce;async function Vce(){return await(0,is.pathExists)("package.json")||await(0,is.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
@@ -236,9 +236,9 @@ Please follow the Upgrade Guide to move ${ao.default.strong("public")} inside th
236
236
  const config: CapacitorConfig = ${(0,yle.formatJSObject)(t)};
237
237
 
238
238
  export default config;
239
- `}});function kle(){try{return zE.default.statSync("/.dockerenv"),!0}catch{return!1}}function Nle(){try{return zE.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function KE(){return VE===void 0&&(VE=kle()||Nle()),VE}var zE,VE,vM=mr(()=>{zE=ve(require("node:fs"),1)});function Ya(){return GE===void 0&&(GE=$le()||KE()),GE}var EM,GE,$le,WE=mr(()=>{EM=ve(require("node:fs"),1);vM();$le=()=>{try{return EM.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var XE,_M,CM,bM,Di,YE=mr(()=>{XE=ve(require("node:process"),1),_M=ve(require("node:os"),1),CM=ve(require("node:fs"),1);WE();bM=()=>{if(XE.default.platform!=="linux")return!1;if(_M.default.release().toLowerCase().includes("microsoft"))return!Ya();try{return CM.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ya():!1}catch{return!1}},Di=XE.default.env.__IS_WSL_TEST__?bM:bM()});var JE,SM,AM,OM,Lle,ZE,Nr,QE=mr(()=>{JE=ve(require("node:process"),1),SM=require("node:buffer"),AM=require("node:util"),OM=ve(require("node:child_process"),1),Lle=(0,AM.promisify)(OM.default.execFile),ZE=()=>`${JE.default.env.SYSTEMROOT||JE.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,Nr=async(t,e={})=>{let{powerShellPath:r,...n}=e,i=Nr.encodeCommand(t);return Lle(r??ZE(),[...Nr.argumentsPrefix,i],{encoding:"utf8",...n})};Nr.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];Nr.encodeCommand=t=>SM.Buffer.from(t,"utf16le").toString("base64");Nr.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var TM,IM,uo,Ble,jle,Mle,jp,xM,PM,FM,RM,kM=mr(()=>{TM=require("node:util"),IM=ve(require("node:child_process"),1),uo=ve(require("node:fs/promises"),1);YE();QE();YE();Ble=(0,TM.promisify)(IM.default.execFile),jle=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await uo.default.access(r,uo.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await uo.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),Mle=async()=>`${await jle()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,jp=Di?Mle:ZE,PM=async()=>(xM??=(async()=>{try{let t=await jp();return await uo.default.access(t,uo.constants.X_OK),!0}catch{return!1}})(),xM),FM=async()=>{let t=await jp(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await Nr(e,{powerShellPath:t});return r.trim()},RM=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await Ble("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function co(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var NM=mr(()=>{});async function eb(){if(LM.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await Ule("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var $M,LM,BM,Ule,jM=mr(()=>{$M=require("node:util"),LM=ve(require("node:process"),1),BM=require("node:child_process"),Ule=(0,$M.promisify)(BM.execFile)});async function qM(t,{humanReadableOutput:e=!0,signal:r}={}){if(MM.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:s}=await qle("osascript",["-e",t,n],i);return s.trim()}var MM,UM,tb,qle,HM=mr(()=>{MM=ve(require("node:process"),1),UM=require("node:util"),tb=require("node:child_process"),qle=(0,UM.promisify)(tb.execFile)});async function rb(t){return qM(`tell application "Finder" to set app_path to application file id "${t}" as string
240
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var VM=mr(()=>{HM()});async function ib(t=Hle){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new Mp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=GM[n];if(!i)throw new Mp(`Unknown browser ID: ${n}`);return i}var zM,KM,Hle,GM,nb,Mp,sb=mr(()=>{zM=require("node:util"),KM=require("node:child_process"),Hle=(0,zM.promisify)(KM.execFile),GM={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},nb=new Map(Object.entries(GM)),Mp=class extends Error{}});async function ob(){if(Up.default.platform==="darwin"){let t=await eb();return{name:await rb(t),id:t}}if(Up.default.platform==="linux"){let{stdout:t}=await Vle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:zle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Up.default.platform==="win32")return ib();throw new Error("Only macOS, Linux, and Windows are supported")}var WM,Up,XM,Vle,zle,YM=mr(()=>{WM=require("node:util"),Up=ve(require("node:process"),1),XM=require("node:child_process");jM();VM();sb();sb();Vle=(0,WM.promisify)(XM.execFile),zle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var qp,Kle,JM,ZM=mr(()=>{qp=ve(require("node:process"),1),Kle=!!(qp.default.env.SSH_CONNECTION||qp.default.env.SSH_CLIENT||qp.default.env.SSH_TTY),JM=Kle});var lb={};Sm(lb,{apps:()=>lo,default:()=>Xle,openApp:()=>Wle});function r8(t){if(typeof t=="string"||Array.isArray(t))return t;let{[e8]:e}=t;if(!e)throw new Error(`${e8} is not supported`);return e}function cl({[Ja]:t},{wsl:e}={}){if(e&&Di)return r8(e);if(!t)throw new Error(`${Ja} is not supported`);return r8(t)}var ub,cb,i8,s8,Vp,n8,Hp,ab,QM,Ja,e8,t8,ul,Gle,Wle,lo,Xle,fb=mr(()=>{ub=ve(require("node:process"),1),cb=ve(require("node:path"),1),i8=require("node:url"),s8=ve(require("node:child_process"),1),Vp=ve(require("node:fs/promises"),1);kM();QE();NM();YM();WE();ZM();n8={},Hp=Symbol("fallbackAttempt"),ab=n8.url?cb.default.dirname((0,i8.fileURLToPath)(n8.url)):"",QM=cb.default.join(ab,"xdg-open"),{platform:Ja,arch:e8}=ub.default,t8=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(i){r.push(i)}throw new AggregateError(r,"Failed to open in all supported apps")},ul=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Hp]===!0;if(delete t[Hp],Array.isArray(t.app))return t8(t.app,c=>ul({...t,app:c,[Hp]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return t8(r,c=>ul({...t,app:{name:c,arguments:n},[Hp]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},h;if(Di){let d=await FM();h=nb.get(d)??{}}else h=await ob();if(h.id in c){let d=c[h.id.toLowerCase()];if(r==="browserPrivate"){if(d==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(l[d])}return ul({...t,app:{name:lo[d],arguments:n}})}throw new Error(`${h.name} is not supported as a default browser`)}let i,s=[],o={},a=!1;if(Di&&!Ya()&&!JM&&!r&&(a=await PM()),Ja==="darwin")i="open",t.wait&&s.push("--wait-apps"),t.background&&s.push("--background"),t.newInstance&&s.push("--new"),r&&s.push("-a",r);else if(Ja==="win32"||a){i=await jp(),s.push(...Nr.argumentsPrefix),Di||(o.windowsVerbatimArguments=!0),Di&&t.target&&(t.target=await RM(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(Nr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(Nr.escapeArgument(t.target)),n.length>0&&(n=n.map(l=>Nr.escapeArgument(l)),c.push("-ArgumentList",n.join(","))),t.target=Nr.encodeCommand(c.join(" ")),t.wait||(o.stdio="ignore")}else{if(r)i=r;else{let c=!ab||ab==="/",l=!1;try{await Vp.default.access(QM,Vp.constants.X_OK),l=!0}catch{}i=ub.default.versions.electron??(Ja==="android"||c||!l)?"xdg-open":QM}n.length>0&&s.push(...n),t.wait||(o.stdio="ignore",o.detached=!0)}Ja==="darwin"&&n.length>0&&s.push("--args",...n),t.target&&s.push(t.target);let u=s8.default.spawn(i,s,o);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",h=>{if(!t.allowNonzeroExitCode&&h!==0){l(new Error(`Exited with code ${h}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",h=>{if(u.off("error",l),h!==0){l(new Error(`Exited with code ${h}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},Gle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return ul({...e,target:t})},Wle=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return ul({...e,app:{name:t,arguments:r}})};lo={browser:"browser",browserPrivate:"browserPrivate"};co(lo,"chrome",()=>cl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));co(lo,"brave",()=>cl({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));co(lo,"firefox",()=>cl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));co(lo,"edge",()=>cl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));co(lo,"safari",()=>cl({darwin:"Safari"}));Xle=Gle});var pm=_(en=>{"use strict";en.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;en.find=(t,e)=>t.nodes.find(r=>r.type===e);en.exceedsLimit=(t,e,r=1,n)=>n===!1||!en.isInteger(t)||!en.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;en.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};en.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;en.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;en.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;en.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);en.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var mm=_((ZCe,T6)=>{"use strict";var x6=pm();T6.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&x6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&x6.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var P6=_((QCe,I6)=>{"use strict";I6.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var M6=_((eSe,j6)=>{"use strict";var F6=P6(),wo=(t,e,r)=>{if(F6(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(F6(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+i+s+o+a;if(wo.cache.hasOwnProperty(u))return wo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let h=B6(t)||B6(e),d={min:t,max:e,a:c,b:l},f=[],m=[];if(h&&(d.isPadded=h,d.maxLen=String(d.max).length),c<0){let y=l<0?Math.abs(l):1;m=R6(y,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=R6(c,l,d,n)),d.negatives=m,d.positives=f,d.result=Bfe(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),wo.cache[u]=d,d.result};function Bfe(t,e,r){let n=Tb(t,e,"-",!1,r)||[],i=Tb(e,t,"",!1,r)||[],s=Tb(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function jfe(t,e){let r=1,n=1,i=N6(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=N6(t,r);for(i=$6(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=$6(e+1,n)-1;return s=[...s],s.sort(qfe),s}function Mfe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=Ufe(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[u,c]=n[a];u===c?s+=u:u!=="0"||c!=="9"?s+=Hfe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function R6(t,e,r,n){let i=jfe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=Mfe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+L6(a.count),o=c+1;continue}r.isPadded&&(h=Vfe(c,r,n)),l.string=h+l.pattern+L6(l.count),s.push(l),o=c+1,a=l}return s}function Tb(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!k6(e,"string",a)&&s.push(r+a),n&&k6(e,"string",a)&&s.push(r+a)}return s}function Ufe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function qfe(t,e){return t>e?1:e>t?-1:0}function k6(t,e,r){return t.some(n=>n[e]===r)}function N6(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function $6(t,e){return t-t%Math.pow(10,e)}function L6(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function Hfe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function B6(t){return/^-?(0+)\d/.test(t)}function Vfe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}wo.cache={};wo.clearCache=()=>wo.cache={};j6.exports=wo});var Fb=_((tSe,G6)=>{"use strict";var zfe=require("util"),q6=M6(),U6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Kfe=t=>e=>t===!0?Number(e):String(e),Ib=t=>typeof t=="number"||typeof t=="string"&&t!=="",El=t=>Number.isInteger(+t),Pb=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},Gfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Wfe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},ym=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Xfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>ym(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>ym(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},H6=(t,e,r,n)=>{if(r)return q6(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},V6=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return q6(t,e,r)},z6=(...t)=>new RangeError("Invalid range arguments: "+zfe.inspect(...t)),K6=(t,e,r)=>{if(r.strictRanges===!0)throw z6([t,e]);return[]},Yfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Jfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw z6([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Pb(a)||Pb(u)||Pb(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&Gfe(t,e,n)===!1,f=n.transform||Kfe(d);if(n.toRegex&&r===1)return H6(ym(t,h),ym(e,h),!0,n);let m={negatives:[],positives:[]},y=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),v=[],E=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?y(i):v.push(Wfe(f(i,E),h,d)),i=o?i-r:i+r,E++;return n.toRegex===!0?r>1?Xfe(m,n,h):V6(v,null,{wrap:!1,...n}):v},Zfe=(t,e,r=1,n={})=>{if(!El(t)&&t.length>1||!El(e)&&e.length>1)return K6(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,u=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return H6(u,c,!1,n);let l=[],h=0;for(;a?s>=o:s<=o;)l.push(i(s,h)),s=a?s-r:s+r,h++;return n.toRegex===!0?V6(l,null,{wrap:!1,options:n}):l},gm=(t,e,r,n={})=>{if(e==null&&Ib(t))return[t];if(!Ib(t)||!Ib(e))return K6(t,e,n);if(typeof r=="function")return gm(t,e,1,{transform:r});if(U6(r))return gm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,El(r)?El(t)&&El(e)?Jfe(t,e,r,i):Zfe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!U6(r)?Yfe(r,i):gm(t,e,1,r)};G6.exports=gm});var Y6=_((rSe,X6)=>{"use strict";var Qfe=Fb(),W6=pm(),ehe=(t,e={})=>{let r=(n,i={})=>{let s=W6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=W6.reduce(n.nodes),h=Qfe(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(h.length!==0)return l.length>1&&h.length>1?`(${h})`:h}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};X6.exports=ehe});var Q6=_((nSe,Z6)=>{"use strict";var the=Fb(),J6=mm(),fu=pm(),vo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?fu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(vo(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?vo(i,s,r):i+s);return fu.flatten(n)},rhe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(vo(a.pop(),J6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(vo(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=fu.reduce(i.nodes);if(fu.exceedsLimit(...h,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=the(...h,e);d.length===0&&(d=J6(i,e)),a.push(vo(a.pop(),d)),i.nodes=[];return}let u=fu.encloseBrace(i),c=i.queue,l=i;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let h=0;h<i.nodes.length;h++){let d=i.nodes[h];if(d.type==="comma"&&i.type==="brace"){h===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(vo(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(vo(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return fu.flatten(n(t))};Z6.exports=rhe});var tU=_((iSe,eU)=>{"use strict";eU.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
241
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var oU=_((sSe,sU)=>{"use strict";var nhe=mm(),{MAX_LENGTH:rU,CHAR_BACKSLASH:Rb,CHAR_BACKTICK:ihe,CHAR_COMMA:she,CHAR_DOT:ohe,CHAR_LEFT_PARENTHESES:ahe,CHAR_RIGHT_PARENTHESES:uhe,CHAR_LEFT_CURLY_BRACE:che,CHAR_RIGHT_CURLY_BRACE:lhe,CHAR_LEFT_SQUARE_BRACKET:nU,CHAR_RIGHT_SQUARE_BRACKET:iU,CHAR_DOUBLE_QUOTE:fhe,CHAR_SINGLE_QUOTE:hhe,CHAR_NO_BREAK_SPACE:dhe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:phe}=tU(),mhe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(rU,r.maxLength):rU;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,u=0,c=t.length,l=0,h=0,d,f=()=>t[l++],m=y=>{if(y.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&y.type==="text"){a.value+=y.value;return}return o.nodes.push(y),y.parent=o,y.prev=a,a=y,y};for(m({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===phe||d===dhe)){if(d===Rb){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===iU){m({type:"text",value:"\\"+d});continue}if(d===nU){u++;let y;for(;l<c&&(y=f());){if(d+=y,y===nU){u++;continue}if(y===Rb){d+=f();continue}if(y===iU&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===ahe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===uhe){if(o.type!=="paren"){m({type:"text",value:d});continue}o=s.pop(),m({type:"text",value:d}),o=s[s.length-1];continue}if(d===fhe||d===hhe||d===ihe){let y=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===Rb){d+=v+f();continue}if(v===y){e.keepQuotes===!0&&(d+=v);break}d+=v}m({type:"text",value:d});continue}if(d===che){h++;let v={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};o=m(v),s.push(o),m({type:"open",value:d});continue}if(d===lhe){if(o.type!=="brace"){m({type:"text",value:d});continue}let y="close";o=s.pop(),o.close=!0,m({type:y,value:d}),h--,o=s[s.length-1];continue}if(d===she&&h>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:nhe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===ohe&&h>0&&o.commas===0){let y=o.nodes;if(h===0||y.length===0){m({type:"text",value:d});continue}if(a.type==="dot"){if(o.range=[],a.value+=d,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){y.pop();let v=y[y.length-1];v.value+=a.value+d,a=v,o.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let y=s[s.length-1],v=y.nodes.indexOf(o);y.nodes.splice(v,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};sU.exports=mhe});var cU=_((oSe,uU)=>{"use strict";var aU=mm(),ghe=Y6(),yhe=Q6(),Dhe=oU(),Br=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Br.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Br.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Br.parse=(t,e={})=>Dhe(t,e);Br.stringify=(t,e={})=>aU(typeof t=="string"?Br.parse(t,e):t,e);Br.compile=(t,e={})=>(typeof t=="string"&&(t=Br.parse(t,e)),ghe(t,e));Br.expand=(t,e={})=>{typeof t=="string"&&(t=Br.parse(t,e));let r=yhe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Br.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Br.compile(t,e):Br.expand(t,e);uU.exports=Br});var bl=_((aSe,pU)=>{"use strict";var whe=require("path"),zn="\\\\/",lU=`[^${zn}]`,Ai="\\.",vhe="\\+",Ehe="\\?",Dm="\\/",bhe="(?=.)",fU="[^/]",kb=`(?:${Dm}|$)`,hU=`(?:^|${Dm})`,Nb=`${Ai}{1,2}${kb}`,_he=`(?!${Ai})`,Che=`(?!${hU}${Nb})`,She=`(?!${Ai}{0,1}${kb})`,Ahe=`(?!${Nb})`,Ohe=`[^.${Dm}]`,xhe=`${fU}*?`,dU={DOT_LITERAL:Ai,PLUS_LITERAL:vhe,QMARK_LITERAL:Ehe,SLASH_LITERAL:Dm,ONE_CHAR:bhe,QMARK:fU,END_ANCHOR:kb,DOTS_SLASH:Nb,NO_DOT:_he,NO_DOTS:Che,NO_DOT_SLASH:She,NO_DOTS_SLASH:Ahe,QMARK_NO_DOT:Ohe,STAR:xhe,START_ANCHOR:hU},The={...dU,SLASH_LITERAL:`[${zn}]`,QMARK:lU,STAR:`${lU}*?`,DOTS_SLASH:`${Ai}{1,2}(?:[${zn}]|$)`,NO_DOT:`(?!${Ai})`,NO_DOTS:`(?!(?:^|[${zn}])${Ai}{1,2}(?:[${zn}]|$))`,NO_DOT_SLASH:`(?!${Ai}{0,1}(?:[${zn}]|$))`,NO_DOTS_SLASH:`(?!${Ai}{1,2}(?:[${zn}]|$))`,QMARK_NO_DOT:`[^.${zn}]`,START_ANCHOR:`(?:^|[${zn}])`,END_ANCHOR:`(?:[${zn}]|$)`},Ihe={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};pU.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ihe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:whe.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?The:dU}}});var _l=_(Tr=>{"use strict";var Phe=require("path"),Fhe=process.platform==="win32",{REGEX_BACKSLASH:Rhe,REGEX_REMOVE_BACKSLASH:khe,REGEX_SPECIAL_CHARS:Nhe,REGEX_SPECIAL_CHARS_GLOBAL:$he}=bl();Tr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Tr.hasRegexChars=t=>Nhe.test(t);Tr.isRegexChar=t=>t.length===1&&Tr.hasRegexChars(t);Tr.escapeRegex=t=>t.replace($he,"\\$1");Tr.toPosixSlashes=t=>t.replace(Rhe,"/");Tr.removeBackslashes=t=>t.replace(khe,e=>e==="\\"?"":e);Tr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Tr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Fhe===!0||Phe.sep==="\\";Tr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Tr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Tr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Tr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var bU=_((cSe,EU)=>{"use strict";var mU=_l(),{CHAR_ASTERISK:$b,CHAR_AT:Lhe,CHAR_BACKWARD_SLASH:Cl,CHAR_COMMA:Bhe,CHAR_DOT:Lb,CHAR_EXCLAMATION_MARK:Bb,CHAR_FORWARD_SLASH:vU,CHAR_LEFT_CURLY_BRACE:jb,CHAR_LEFT_PARENTHESES:Mb,CHAR_LEFT_SQUARE_BRACKET:jhe,CHAR_PLUS:Mhe,CHAR_QUESTION_MARK:gU,CHAR_RIGHT_CURLY_BRACE:Uhe,CHAR_RIGHT_PARENTHESES:yU,CHAR_RIGHT_SQUARE_BRACKET:qhe}=bl(),DU=t=>t===vU||t===Cl,wU=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Hhe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],u=t,c=-1,l=0,h=0,d=!1,f=!1,m=!1,y=!1,v=!1,E=!1,A=!1,p=!1,D=!1,w=!1,C=0,F,b,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),B=()=>(F=b,u.charCodeAt(++c));for(;c<n;){b=B();let T;if(b===Cl){A=k.backslashes=!0,b=B(),b===jb&&(E=!0);continue}if(E===!0||b===jb){for(C++;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,B();continue}if(b===jb){C++;continue}if(E!==!0&&b===Lb&&(b=B())===Lb){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(E!==!0&&b===Bhe){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===Uhe&&(C--,C===0)){E=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(b===vU){if(s.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},w===!0)continue;if(F===Lb&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(b===Mhe||b===Lhe||b===$b||b===gU||b===Bb)===!0&&I()===Mb){if(m=k.isGlob=!0,y=k.isExtglob=!0,w=!0,b===Bb&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,b=B();continue}if(b===yU){m=k.isGlob=!0,w=!0;break}}continue}break}if(b===$b){if(F===$b&&(v=k.isGlobstar=!0),m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===gU){if(m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===jhe){for(;R()!==!0&&(T=B());){if(T===Cl){A=k.backslashes=!0,B();continue}if(T===qhe){f=k.isBracket=!0,m=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&b===Bb&&c===l){p=k.negated=!0,l++;continue}if(r.noparen!==!0&&b===Mb){if(m=k.isGlob=!0,i===!0){for(;R()!==!0&&(b=B());){if(b===Mb){A=k.backslashes=!0,b=B();continue}if(b===yU){w=!0;break}}continue}break}if(m===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let j=u,z="",L="";l>0&&(z=u.slice(0,l),u=u.slice(l),h-=l),j&&m===!0&&h>0?(j=u.slice(0,h),L=u.slice(h)):m===!0?(j="",L=u):j=u,j&&j!==""&&j!=="/"&&j!==u&&DU(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),r.unescape===!0&&(L&&(L=mU.removeBackslashes(L)),j&&A===!0&&(j=mU.removeBackslashes(j)));let S={prefix:z,input:t,start:l,base:j,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:y,isGlobstar:v,negated:p,negatedExtglob:D};if(r.tokens===!0&&(S.maxDepth=0,DU(b)||o.push(k),S.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let P=0;P<s.length;P++){let $=T?T+1:l,q=s[P],M=t.slice($,q);r.tokens&&(P===0&&l!==0?(o[P].isPrefix=!0,o[P].value=z):o[P].value=M,wU(o[P]),S.maxDepth+=o[P].depth),(P!==0||M!=="")&&a.push(M),T=q}if(T&&T+1<t.length){let P=t.slice(T+1);a.push(P),r.tokens&&(o[o.length-1].value=P,wU(o[o.length-1]),S.maxDepth+=o[o.length-1].depth)}S.slashes=s,S.parts=a}return S};EU.exports=Hhe});var SU=_((lSe,CU)=>{"use strict";var wm=bl(),jr=_l(),{MAX_LENGTH:vm,POSIX_REGEX_SOURCE:Vhe,REGEX_NON_SPECIAL_CHARS:zhe,REGEX_SPECIAL_CHARS_BACKREF:Khe,REPLACEMENTS:_U}=wm,Ghe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>jr.escapeRegex(i)).join("..")}return r},hu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ub=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=_U[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(vm,r.maxLength):vm,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",u=jr.isWindows(e),c=wm.globChars(u),l=wm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:v,NO_DOT_SLASH:E,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:C}=c,F=N=>`(${a}(?:(?!${C}${N.dot?y:h}).)*?)`,b=r.dot?"":v,k=r.dot?p:D,R=r.bash===!0?F(r):w;r.capture&&(R=`(${R})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let I={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=jr.removePrefix(t,I),i=t.length;let B=[],j=[],z=[],L=s,S,T=()=>I.index===i-1,P=I.peek=(N=1)=>t[I.index+N],$=I.advance=()=>t[++I.index]||"",q=()=>t.slice(I.index+1),M=(N="",ne=0)=>{I.consumed+=N,I.index+=ne},G=N=>{I.output+=N.output!=null?N.output:N.value,M(N.value)},U=()=>{let N=1;for(;P()==="!"&&(P(2)!=="("||P(3)==="?");)$(),I.start++,N++;return N%2===0?!1:(I.negated=!0,I.start++,!0)},H=N=>{I[N]++,z.push(N)},te=N=>{I[N]--,z.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),K=N.extglob===!0||B.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!K&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(B.length&&N.type!=="paren"&&(B[B.length-1].inner+=N.value),(N.value||N.output)&&G(N),L&&L.type==="text"&&N.type==="text"){L.value+=N.value,L.output=(L.output||"")+N.value;return}N.prev=L,o.push(N),L=N},O=(N,ne)=>{let K={...l[ne],conditions:1,inner:""};K.prev=L,K.parens=I.parens,K.output=I.output;let oe=(r.capture?"(":"")+K.open;H("parens"),x({type:N,value:ne,output:I.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:oe}),B.push(K)},V=N=>{let ne=N.close+(r.capture?")":""),K;if(N.type==="negate"){let oe=R;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(oe=F(r)),(oe!==R||T()||/^\)+$/.test(q()))&&(ne=N.close=`)$))${oe}`),N.inner.includes("*")&&(K=q())&&/^\.[^\\/.]+$/.test(K)){let we=Ub(K,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${oe})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:S,output:ne}),te("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(Khe,(K,oe,we,Ie,Ve,bt)=>Ie==="\\"?(N=!0,K):Ie==="?"?oe?oe+Ie+(Ve?p.repeat(Ve.length):""):bt===0?k+(Ve?p.repeat(Ve.length):""):p.repeat(we.length):Ie==="."?h.repeat(we.length):Ie==="*"?oe?oe+Ie+(Ve?R:""):R:oe?K:`\\${K}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,K=>K.length%2===0?"\\\\":K?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=jr.wrapOutput(ne,I,e),I)}for(;!T();){if(S=$(),S==="\0")continue;if(S==="\\"){let K=P();if(K==="/"&&r.bash!==!0||K==="."||K===";")continue;if(!K){S+="\\",x({type:"text",value:S});continue}let oe=/^\\+/.exec(q()),we=0;if(oe&&oe[0].length>2&&(we=oe[0].length,I.index+=we,we%2!==0&&(S+="\\")),r.unescape===!0?S=$():S+=$(),I.brackets===0){x({type:"text",value:S});continue}}if(I.brackets>0&&(S!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&S===":"){let K=L.value.slice(1);if(K.includes("[")&&(L.posix=!0,K.includes(":"))){let oe=L.value.lastIndexOf("["),we=L.value.slice(0,oe),Ie=L.value.slice(oe+2),Ve=Vhe[Ie];if(Ve){L.value=we+Ve,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(S==="["&&P()!==":"||S==="-"&&P()==="]")&&(S=`\\${S}`),S==="]"&&(L.value==="["||L.value==="[^")&&(S=`\\${S}`),r.posix===!0&&S==="!"&&L.value==="["&&(S="^"),L.value+=S,G({value:S});continue}if(I.quotes===1&&S!=='"'){S=jr.escapeRegex(S),L.value+=S,G({value:S});continue}if(S==='"'){I.quotes=I.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:S});continue}if(S==="("){H("parens"),x({type:"paren",value:S});continue}if(S===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(hu("opening","("));let K=B[B.length-1];if(K&&I.parens===K.parens+1){V(B.pop());continue}x({type:"paren",value:S,output:I.parens?")":"\\)"}),te("parens");continue}if(S==="["){if(r.nobracket===!0||!q().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));S=`\\${S}`}else H("brackets");x({type:"bracket",value:S});continue}if(S==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:S,output:`\\${S}`});continue}if(I.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(hu("opening","["));x({type:"text",value:S,output:`\\${S}`});continue}te("brackets");let K=L.value.slice(1);if(L.posix!==!0&&K[0]==="^"&&!K.includes("/")&&(S=`/${S}`),L.value+=S,G({value:S}),r.literalBrackets===!1||jr.hasRegexChars(K))continue;let oe=jr.escapeRegex(L.value);if(I.output=I.output.slice(0,-L.value.length),r.literalBrackets===!0){I.output+=oe,L.value=oe;continue}L.value=`(${a}${oe}|${L.value})`,I.output+=L.value;continue}if(S==="{"&&r.nobrace!==!0){H("braces");let K={type:"brace",value:S,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};j.push(K),x(K);continue}if(S==="}"){let K=j[j.length-1];if(r.nobrace===!0||!K){x({type:"text",value:S,output:S});continue}let oe=")";if(K.dots===!0){let we=o.slice(),Ie=[];for(let Ve=we.length-1;Ve>=0&&(o.pop(),we[Ve].type!=="brace");Ve--)we[Ve].type!=="dots"&&Ie.unshift(we[Ve].value);oe=Ghe(Ie,r),I.backtrack=!0}if(K.comma!==!0&&K.dots!==!0){let we=I.output.slice(0,K.outputIndex),Ie=I.tokens.slice(K.tokensIndex);K.value=K.output="\\{",S=oe="\\}",I.output=we;for(let Ve of Ie)I.output+=Ve.output||Ve.value}x({type:"brace",value:S,output:oe}),te("braces"),j.pop();continue}if(S==="|"){B.length>0&&B[B.length-1].conditions++,x({type:"text",value:S});continue}if(S===","){let K=S,oe=j[j.length-1];oe&&z[z.length-1]==="braces"&&(oe.comma=!0,K="|"),x({type:"comma",value:S,output:K});continue}if(S==="/"){if(L.type==="dot"&&I.index===I.start+1){I.start=I.index+1,I.consumed="",I.output="",o.pop(),L=s;continue}x({type:"slash",value:S,output:f});continue}if(S==="."){if(I.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let K=j[j.length-1];L.type="dots",L.output+=S,L.value+=S,K.dots=!0;continue}if(I.braces+I.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:S,output:h});continue}x({type:"dot",value:S,output:h});continue}if(S==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("qmark",S);continue}if(L&&L.type==="paren"){let oe=P(),we=S;if(oe==="<"&&!jr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(oe)||oe==="<"&&!/<([!=]|\w+>)/.test(q()))&&(we=`\\${S}`),x({type:"text",value:S,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:S,output:D});continue}x({type:"qmark",value:S,output:p});continue}if(S==="!"){if(r.noextglob!==!0&&P()==="("&&(P(2)!=="?"||!/[!=<:]/.test(P(3)))){O("negate",S);continue}if(r.nonegate!==!0&&I.index===0){U();continue}}if(S==="+"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("plus",S);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:S,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||I.parens>0){x({type:"plus",value:S});continue}x({type:"plus",value:d});continue}if(S==="@"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){x({type:"at",extglob:!0,value:S,output:""});continue}x({type:"text",value:S});continue}if(S!=="*"){(S==="$"||S==="^")&&(S=`\\${S}`);let K=zhe.exec(q());K&&(S+=K[0],I.index+=K[0].length),x({type:"text",value:S});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=S,L.output=R,I.backtrack=!0,I.globstar=!0,M(S);continue}let N=q();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",S);continue}if(L.type==="star"){if(r.noglobstar===!0){M(S);continue}let K=L.prev,oe=K.prev,we=K.type==="slash"||K.type==="bos",Ie=oe&&(oe.type==="star"||oe.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:S,output:""});continue}let Ve=I.braces>0&&(K.type==="comma"||K.type==="brace"),bt=B.length&&(K.type==="pipe"||K.type==="paren");if(!we&&K.type!=="paren"&&!Ve&&!bt){x({type:"star",value:S,output:""});continue}for(;N.slice(0,3)==="/**";){let pr=t[I.index+4];if(pr&&pr!=="/")break;N=N.slice(3),M("/**",3)}if(K.type==="bos"&&T()){L.type="globstar",L.value+=S,L.output=F(r),I.output=L.output,I.globstar=!0,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&!Ie&&T()){I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=F(r)+(r.strictSlashes?")":"|$)"),L.value+=S,I.globstar=!0,I.output+=K.output+L.output,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=`${F(r)}${f}|${f}${pr})`,L.value+=S,I.output+=K.output+L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}if(K.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=S,L.output=`(?:^|${f}|${F(r)}${f})`,I.output=L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=F(r),L.value+=S,I.output+=L.output,I.globstar=!0,M(S);continue}let ne={type:"star",value:S,output:R};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=b+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=S,x(ne);continue}(I.index===I.start||L.type==="slash"||L.type==="dot")&&(L.type==="dot"?(I.output+=E,L.output+=E):r.dot===!0?(I.output+=A,L.output+=A):(I.output+=b,L.output+=b),P()!=="*"&&(I.output+=m,L.output+=m)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));I.output=jr.escapeLast(I.output,"["),te("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing",")"));I.output=jr.escapeLast(I.output,"("),te("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","}"));I.output=jr.escapeLast(I.output,"{"),te("braces")}if(r.strictSlashes!==!0&&(L.type==="star"||L.type==="bracket")&&x({type:"maybe_slash",value:"",output:`${f}?`}),I.backtrack===!0){I.output="";for(let N of I.tokens)I.output+=N.output!=null?N.output:N.value,N.suffix&&(I.output+=N.suffix)}return I};Ub.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(vm,r.maxLength):vm,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=_U[t]||t;let s=jr.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:h,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:m}=wm.globChars(s),y=r.dot?h:l,v=r.dot?d:l,E=r.capture?"":"?:",A={negated:!1,prefix:""},p=r.bash===!0?".*?":f;r.capture&&(p=`(${p})`);let D=b=>b.noglobstar===!0?p:`(${E}(?:(?!${m}${b.dot?c:o}).)*?)`,w=b=>{switch(b){case"*":return`${y}${u}${p}`;case".*":return`${o}${u}${p}`;case"*.*":return`${y}${p}${o}${u}${p}`;case"*/*":return`${y}${p}${a}${u}${v}${p}`;case"**":return y+D(r);case"**/*":return`(?:${y}${D(r)}${a})?${v}${u}${p}`;case"**/*.*":return`(?:${y}${D(r)}${a})?${v}${p}${o}${u}${p}`;case"**/.*":return`(?:${y}${D(r)}${a})?${o}${u}${p}`;default:{let k=/^(.*?)\.(\w+)$/.exec(b);if(!k)return;let R=w(k[1]);return R?R+o+k[2]:void 0}}},C=jr.removePrefix(t,A),F=w(C);return F&&r.strictSlashes!==!0&&(F+=`${a}?`),F};CU.exports=Ub});var OU=_((fSe,AU)=>{"use strict";var Whe=require("path"),Xhe=bU(),qb=SU(),Hb=_l(),Yhe=bl(),Jhe=t=>t&&typeof t=="object"&&!Array.isArray(t),xt=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>xt(d,e,r));return d=>{for(let f of l){let m=f(d);if(m)return m}return!1}}let n=Jhe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=Hb.isWindows(e),o=n?xt.compileRe(t,e):xt.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=xt(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=xt.test(l,o,e,{glob:t,posix:s}),y={glob:t,state:a,regex:o,posix:s,input:l,output:m,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(y),d===!1?(y.isMatch=!1,h?y:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(y),y.isMatch=!1,h?y:!1):(typeof i.onMatch=="function"&&i.onMatch(y),h?y:!0)};return r&&(c.state=a),c};xt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?Hb.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=xt.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};xt.matchBase=(t,e,r,n=Hb.isWindows(r))=>(e instanceof RegExp?e:xt.makeRe(e,r)).test(Whe.basename(t));xt.isMatch=(t,e,r)=>xt(e,r)(t);xt.parse=(t,e)=>Array.isArray(t)?t.map(r=>xt.parse(r,e)):qb(t,{...e,fastpaths:!1});xt.scan=(t,e)=>Xhe(t,e);xt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=xt.toRegex(a,e);return n===!0&&(u.state=t),u};xt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=qb.fastpaths(t,e)),i.output||(i=qb(t,e)),xt.compileRe(i,e,r,n)};xt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};xt.constants=Yhe;AU.exports=xt});var TU=_((hSe,xU)=>{"use strict";xU.exports=OU()});var NU=_((dSe,kU)=>{"use strict";var PU=require("util"),FU=cU(),Kn=TU(),Vb=_l(),IU=t=>t===""||t==="./",RU=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},rt=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=l=>{s.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let h=Kn(String(e[l]),{...r,onResult:a},!0),d=h.state.negated||h.state.negatedExtglob;d&&o++;for(let f of t){let m=h(f,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),i.add(m.output)))}}let c=(o===e.length?[...s]:[...i]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};rt.match=rt;rt.matcher=(t,e)=>Kn(t,e);rt.isMatch=(t,e,r)=>Kn(e,r)(t);rt.any=rt.isMatch;rt.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(rt(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};rt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${PU.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>rt.contains(t,n,r));if(typeof e=="string"){if(IU(t)||IU(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return rt.isMatch(t,e,{...r,contains:!0})};rt.matchKeys=(t,e,r)=>{if(!Vb.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=rt(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};rt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Kn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};rt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Kn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};rt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${PU.inspect(t)}"`);return[].concat(e).every(n=>Kn(n,r)(t))};rt.capture=(t,e,r)=>{let n=Vb.isWindows(r),s=Kn.makeRe(String(t),{...r,capture:!0}).exec(n?Vb.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};rt.makeRe=(...t)=>Kn.makeRe(...t);rt.scan=(...t)=>Kn.scan(...t);rt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of FU(String(n),e))r.push(Kn.parse(i,e));return r};rt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!RU(t)?[t]:FU(t,e)};rt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return rt.braces(t,{...e,expand:!0})};rt.hasBraces=RU;kU.exports=rt});var qde={};Sm(qde,{CapgoSDK:()=>nt,addApp:()=>$de,addChannel:()=>Bde,addOrganization:()=>Rde,checkBundleCompatibility:()=>bde,createSupabaseClient:()=>pe,decryptBundle:()=>Cde,deleteLegacyEncryptionKey:()=>xde,deleteOrganization:()=>Nde,doctor:()=>Ede,encryptBundle:()=>_de,generateEncryptionKeys:()=>Ade,getAccountId:()=>Pde,getCapacitorConfig:()=>Ude,getCurrentBundle:()=>Tde,getStats:()=>Mde,listBundles:()=>Lde,listOrganizations:()=>Fde,login:()=>vde,requestBuild:()=>jde,saveEncryptionKey:()=>Ode,updateAppSetting:()=>Ide,updateOrganization:()=>kde,uploadBundle:()=>wde,zipBundle:()=>Sde});module.exports=ce(qde);var Vt=ve(Ze(),1),Co=require("node:process"),Oi=ve(require("node:readline"),1),Pm=ve(require("node:readline"),1),s_=require("node:stream"),o_=ve(xm(),1);function _q({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var Cq=_q();function a_(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Cq,"")}function u_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c_={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,o=i<<10|s,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),s=0,o=0;o<i.length;o++)s=s+this.characterLength(i[o]);return s},e.slice=function(n,i,s){textLen=e.length(n),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var o="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],h=e.length(l);if(a>=i-(h==2?1:0))if(a+h<=s)o+=l;else break;a+=h}return o}})(c_);var Sq=c_.exports,Aq=u_(Sq),Oq=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},xq=u_(Oq);function pu(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=a_(t),t.length===0))return 0;t=t.replace(xq()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(Aq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Tm=10,Zb=(t=0)=>e=>`\x1B[${e+t}m`,Qb=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,e_=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,it={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(it.modifier);var Tq=Object.keys(it.color),Iq=Object.keys(it.bgColor);[...Tq,...Iq];function Pq(){let t=new Map;for(let[e,r]of Object.entries(it)){for(let[n,i]of Object.entries(r))it[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=it[n],t.set(i[0],i[1]);Object.defineProperty(it,e,{value:r,enumerable:!1})}return Object.defineProperty(it,"codes",{value:t,enumerable:!1}),it.color.close="\x1B[39m",it.bgColor.close="\x1B[49m",it.color.ansi=Zb(),it.color.ansi256=Qb(),it.color.ansi16m=e_(),it.bgColor.ansi=Zb(Tm),it.bgColor.ansi256=Qb(Tm),it.bgColor.ansi16m=e_(Tm),Object.defineProperties(it,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>it.rgbToAnsi256(...it.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>it.ansi256ToAnsi(it.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>it.ansi256ToAnsi(it.hexToAnsi256(e)),enumerable:!1}}),it}var Fq=Pq(),kl=new Set(["\x1B","\x9B"]),Rq=39,Rm="\x07",l_="[",kq="]",f_="m",km=`${kq}8;;`,t_=t=>`${kl.values().next().value}${l_}${t}${f_}`,r_=t=>`${kl.values().next().value}${km}${t}${Rm}`,Nq=t=>t.split(" ").map(e=>pu(e)),Im=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=pu(a_(t[t.length-1]));for(let[a,u]of n.entries()){let c=pu(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),kl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(km)),i){s?u===Rm&&(i=!1,s=!1):u===f_&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},$q=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(pu(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Lq=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=Nq(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=pu(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),Im(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){Im(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){Im(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>$q(c)));let u=[...a.join(`
239
+ `}});function kle(){try{return zE.default.statSync("/.dockerenv"),!0}catch{return!1}}function Nle(){try{return zE.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function KE(){return VE===void 0&&(VE=kle()||Nle()),VE}var zE,VE,vM=mr(()=>{zE=ve(require("node:fs"),1)});function Ya(){return GE===void 0&&(GE=$le()||KE()),GE}var EM,GE,$le,WE=mr(()=>{EM=ve(require("node:fs"),1);vM();$le=()=>{try{return EM.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var XE,_M,CM,bM,wi,YE=mr(()=>{XE=ve(require("node:process"),1),_M=ve(require("node:os"),1),CM=ve(require("node:fs"),1);WE();bM=()=>{if(XE.default.platform!=="linux")return!1;if(_M.default.release().toLowerCase().includes("microsoft"))return!Ya();try{return CM.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ya():!1}catch{return!1}},wi=XE.default.env.__IS_WSL_TEST__?bM:bM()});var JE,SM,AM,OM,Lle,ZE,Nr,QE=mr(()=>{JE=ve(require("node:process"),1),SM=require("node:buffer"),AM=require("node:util"),OM=ve(require("node:child_process"),1),Lle=(0,AM.promisify)(OM.default.execFile),ZE=()=>`${JE.default.env.SYSTEMROOT||JE.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,Nr=async(t,e={})=>{let{powerShellPath:r,...n}=e,i=Nr.encodeCommand(t);return Lle(r??ZE(),[...Nr.argumentsPrefix,i],{encoding:"utf8",...n})};Nr.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];Nr.encodeCommand=t=>SM.Buffer.from(t,"utf16le").toString("base64");Nr.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var TM,IM,uo,Ble,jle,Mle,jp,xM,PM,FM,RM,kM=mr(()=>{TM=require("node:util"),IM=ve(require("node:child_process"),1),uo=ve(require("node:fs/promises"),1);YE();QE();YE();Ble=(0,TM.promisify)(IM.default.execFile),jle=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await uo.default.access(r,uo.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await uo.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),Mle=async()=>`${await jle()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,jp=wi?Mle:ZE,PM=async()=>(xM??=(async()=>{try{let t=await jp();return await uo.default.access(t,uo.constants.X_OK),!0}catch{return!1}})(),xM),FM=async()=>{let t=await jp(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await Nr(e,{powerShellPath:t});return r.trim()},RM=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await Ble("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function co(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var NM=mr(()=>{});async function eb(){if(LM.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await Ule("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var $M,LM,BM,Ule,jM=mr(()=>{$M=require("node:util"),LM=ve(require("node:process"),1),BM=require("node:child_process"),Ule=(0,$M.promisify)(BM.execFile)});async function qM(t,{humanReadableOutput:e=!0,signal:r}={}){if(MM.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:s}=await qle("osascript",["-e",t,n],i);return s.trim()}var MM,UM,tb,qle,HM=mr(()=>{MM=ve(require("node:process"),1),UM=require("node:util"),tb=require("node:child_process"),qle=(0,UM.promisify)(tb.execFile)});async function rb(t){return qM(`tell application "Finder" to set app_path to application file id "${t}" as string
240
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var VM=mr(()=>{HM()});async function ib(t=Hle){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new Mp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=GM[n];if(!i)throw new Mp(`Unknown browser ID: ${n}`);return i}var zM,KM,Hle,GM,nb,Mp,sb=mr(()=>{zM=require("node:util"),KM=require("node:child_process"),Hle=(0,zM.promisify)(KM.execFile),GM={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},nb=new Map(Object.entries(GM)),Mp=class extends Error{}});async function ob(){if(Up.default.platform==="darwin"){let t=await eb();return{name:await rb(t),id:t}}if(Up.default.platform==="linux"){let{stdout:t}=await Vle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:zle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Up.default.platform==="win32")return ib();throw new Error("Only macOS, Linux, and Windows are supported")}var WM,Up,XM,Vle,zle,YM=mr(()=>{WM=require("node:util"),Up=ve(require("node:process"),1),XM=require("node:child_process");jM();VM();sb();sb();Vle=(0,WM.promisify)(XM.execFile),zle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var qp,Kle,JM,ZM=mr(()=>{qp=ve(require("node:process"),1),Kle=!!(qp.default.env.SSH_CONNECTION||qp.default.env.SSH_CLIENT||qp.default.env.SSH_TTY),JM=Kle});var lb={};Sm(lb,{apps:()=>lo,default:()=>Xle,openApp:()=>Wle});function r8(t){if(typeof t=="string"||Array.isArray(t))return t;let{[e8]:e}=t;if(!e)throw new Error(`${e8} is not supported`);return e}function cl({[Ja]:t},{wsl:e}={}){if(e&&wi)return r8(e);if(!t)throw new Error(`${Ja} is not supported`);return r8(t)}var ub,cb,i8,s8,Vp,n8,Hp,ab,QM,Ja,e8,t8,ul,Gle,Wle,lo,Xle,fb=mr(()=>{ub=ve(require("node:process"),1),cb=ve(require("node:path"),1),i8=require("node:url"),s8=ve(require("node:child_process"),1),Vp=ve(require("node:fs/promises"),1);kM();QE();NM();YM();WE();ZM();n8={},Hp=Symbol("fallbackAttempt"),ab=n8.url?cb.default.dirname((0,i8.fileURLToPath)(n8.url)):"",QM=cb.default.join(ab,"xdg-open"),{platform:Ja,arch:e8}=ub.default,t8=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(i){r.push(i)}throw new AggregateError(r,"Failed to open in all supported apps")},ul=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Hp]===!0;if(delete t[Hp],Array.isArray(t.app))return t8(t.app,c=>ul({...t,app:c,[Hp]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return t8(r,c=>ul({...t,app:{name:c,arguments:n},[Hp]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},h;if(wi){let d=await FM();h=nb.get(d)??{}}else h=await ob();if(h.id in c){let d=c[h.id.toLowerCase()];if(r==="browserPrivate"){if(d==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(l[d])}return ul({...t,app:{name:lo[d],arguments:n}})}throw new Error(`${h.name} is not supported as a default browser`)}let i,s=[],o={},a=!1;if(wi&&!Ya()&&!JM&&!r&&(a=await PM()),Ja==="darwin")i="open",t.wait&&s.push("--wait-apps"),t.background&&s.push("--background"),t.newInstance&&s.push("--new"),r&&s.push("-a",r);else if(Ja==="win32"||a){i=await jp(),s.push(...Nr.argumentsPrefix),wi||(o.windowsVerbatimArguments=!0),wi&&t.target&&(t.target=await RM(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(Nr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(Nr.escapeArgument(t.target)),n.length>0&&(n=n.map(l=>Nr.escapeArgument(l)),c.push("-ArgumentList",n.join(","))),t.target=Nr.encodeCommand(c.join(" ")),t.wait||(o.stdio="ignore")}else{if(r)i=r;else{let c=!ab||ab==="/",l=!1;try{await Vp.default.access(QM,Vp.constants.X_OK),l=!0}catch{}i=ub.default.versions.electron??(Ja==="android"||c||!l)?"xdg-open":QM}n.length>0&&s.push(...n),t.wait||(o.stdio="ignore",o.detached=!0)}Ja==="darwin"&&n.length>0&&s.push("--args",...n),t.target&&s.push(t.target);let u=s8.default.spawn(i,s,o);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",h=>{if(!t.allowNonzeroExitCode&&h!==0){l(new Error(`Exited with code ${h}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",h=>{if(u.off("error",l),h!==0){l(new Error(`Exited with code ${h}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},Gle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return ul({...e,target:t})},Wle=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return ul({...e,app:{name:t,arguments:r}})};lo={browser:"browser",browserPrivate:"browserPrivate"};co(lo,"chrome",()=>cl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));co(lo,"brave",()=>cl({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));co(lo,"firefox",()=>cl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));co(lo,"edge",()=>cl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));co(lo,"safari",()=>cl({darwin:"Safari"}));Xle=Gle});var pm=_(rn=>{"use strict";rn.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;rn.find=(t,e)=>t.nodes.find(r=>r.type===e);rn.exceedsLimit=(t,e,r=1,n)=>n===!1||!rn.isInteger(t)||!rn.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;rn.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};rn.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;rn.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;rn.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;rn.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);rn.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var mm=_((ZCe,T6)=>{"use strict";var x6=pm();T6.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&x6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&x6.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var P6=_((QCe,I6)=>{"use strict";I6.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var M6=_((eSe,j6)=>{"use strict";var F6=P6(),wo=(t,e,r)=>{if(F6(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(F6(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+i+s+o+a;if(wo.cache.hasOwnProperty(u))return wo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let h=B6(t)||B6(e),d={min:t,max:e,a:c,b:l},f=[],m=[];if(h&&(d.isPadded=h,d.maxLen=String(d.max).length),c<0){let y=l<0?Math.abs(l):1;m=R6(y,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=R6(c,l,d,n)),d.negatives=m,d.positives=f,d.result=Bfe(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),wo.cache[u]=d,d.result};function Bfe(t,e,r){let n=Tb(t,e,"-",!1,r)||[],i=Tb(e,t,"",!1,r)||[],s=Tb(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function jfe(t,e){let r=1,n=1,i=N6(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=N6(t,r);for(i=$6(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=$6(e+1,n)-1;return s=[...s],s.sort(qfe),s}function Mfe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=Ufe(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[u,c]=n[a];u===c?s+=u:u!=="0"||c!=="9"?s+=Hfe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function R6(t,e,r,n){let i=jfe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=Mfe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+L6(a.count),o=c+1;continue}r.isPadded&&(h=Vfe(c,r,n)),l.string=h+l.pattern+L6(l.count),s.push(l),o=c+1,a=l}return s}function Tb(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!k6(e,"string",a)&&s.push(r+a),n&&k6(e,"string",a)&&s.push(r+a)}return s}function Ufe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function qfe(t,e){return t>e?1:e>t?-1:0}function k6(t,e,r){return t.some(n=>n[e]===r)}function N6(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function $6(t,e){return t-t%Math.pow(10,e)}function L6(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function Hfe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function B6(t){return/^-?(0+)\d/.test(t)}function Vfe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}wo.cache={};wo.clearCache=()=>wo.cache={};j6.exports=wo});var Fb=_((tSe,G6)=>{"use strict";var zfe=require("util"),q6=M6(),U6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Kfe=t=>e=>t===!0?Number(e):String(e),Ib=t=>typeof t=="number"||typeof t=="string"&&t!=="",El=t=>Number.isInteger(+t),Pb=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},Gfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Wfe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},ym=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Xfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>ym(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>ym(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},H6=(t,e,r,n)=>{if(r)return q6(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},V6=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return q6(t,e,r)},z6=(...t)=>new RangeError("Invalid range arguments: "+zfe.inspect(...t)),K6=(t,e,r)=>{if(r.strictRanges===!0)throw z6([t,e]);return[]},Yfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Jfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw z6([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Pb(a)||Pb(u)||Pb(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&Gfe(t,e,n)===!1,f=n.transform||Kfe(d);if(n.toRegex&&r===1)return H6(ym(t,h),ym(e,h),!0,n);let m={negatives:[],positives:[]},y=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),v=[],E=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?y(i):v.push(Wfe(f(i,E),h,d)),i=o?i-r:i+r,E++;return n.toRegex===!0?r>1?Xfe(m,n,h):V6(v,null,{wrap:!1,...n}):v},Zfe=(t,e,r=1,n={})=>{if(!El(t)&&t.length>1||!El(e)&&e.length>1)return K6(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,u=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return H6(u,c,!1,n);let l=[],h=0;for(;a?s>=o:s<=o;)l.push(i(s,h)),s=a?s-r:s+r,h++;return n.toRegex===!0?V6(l,null,{wrap:!1,options:n}):l},gm=(t,e,r,n={})=>{if(e==null&&Ib(t))return[t];if(!Ib(t)||!Ib(e))return K6(t,e,n);if(typeof r=="function")return gm(t,e,1,{transform:r});if(U6(r))return gm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,El(r)?El(t)&&El(e)?Jfe(t,e,r,i):Zfe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!U6(r)?Yfe(r,i):gm(t,e,1,r)};G6.exports=gm});var Y6=_((rSe,X6)=>{"use strict";var Qfe=Fb(),W6=pm(),ehe=(t,e={})=>{let r=(n,i={})=>{let s=W6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=W6.reduce(n.nodes),h=Qfe(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(h.length!==0)return l.length>1&&h.length>1?`(${h})`:h}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};X6.exports=ehe});var Q6=_((nSe,Z6)=>{"use strict";var the=Fb(),J6=mm(),fu=pm(),vo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?fu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(vo(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?vo(i,s,r):i+s);return fu.flatten(n)},rhe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(vo(a.pop(),J6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(vo(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=fu.reduce(i.nodes);if(fu.exceedsLimit(...h,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=the(...h,e);d.length===0&&(d=J6(i,e)),a.push(vo(a.pop(),d)),i.nodes=[];return}let u=fu.encloseBrace(i),c=i.queue,l=i;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let h=0;h<i.nodes.length;h++){let d=i.nodes[h];if(d.type==="comma"&&i.type==="brace"){h===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(vo(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(vo(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return fu.flatten(n(t))};Z6.exports=rhe});var tU=_((iSe,eU)=>{"use strict";eU.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
241
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var oU=_((sSe,sU)=>{"use strict";var nhe=mm(),{MAX_LENGTH:rU,CHAR_BACKSLASH:Rb,CHAR_BACKTICK:ihe,CHAR_COMMA:she,CHAR_DOT:ohe,CHAR_LEFT_PARENTHESES:ahe,CHAR_RIGHT_PARENTHESES:uhe,CHAR_LEFT_CURLY_BRACE:che,CHAR_RIGHT_CURLY_BRACE:lhe,CHAR_LEFT_SQUARE_BRACKET:nU,CHAR_RIGHT_SQUARE_BRACKET:iU,CHAR_DOUBLE_QUOTE:fhe,CHAR_SINGLE_QUOTE:hhe,CHAR_NO_BREAK_SPACE:dhe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:phe}=tU(),mhe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(rU,r.maxLength):rU;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,u=0,c=t.length,l=0,h=0,d,f=()=>t[l++],m=y=>{if(y.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&y.type==="text"){a.value+=y.value;return}return o.nodes.push(y),y.parent=o,y.prev=a,a=y,y};for(m({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===phe||d===dhe)){if(d===Rb){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===iU){m({type:"text",value:"\\"+d});continue}if(d===nU){u++;let y;for(;l<c&&(y=f());){if(d+=y,y===nU){u++;continue}if(y===Rb){d+=f();continue}if(y===iU&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===ahe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===uhe){if(o.type!=="paren"){m({type:"text",value:d});continue}o=s.pop(),m({type:"text",value:d}),o=s[s.length-1];continue}if(d===fhe||d===hhe||d===ihe){let y=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===Rb){d+=v+f();continue}if(v===y){e.keepQuotes===!0&&(d+=v);break}d+=v}m({type:"text",value:d});continue}if(d===che){h++;let v={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};o=m(v),s.push(o),m({type:"open",value:d});continue}if(d===lhe){if(o.type!=="brace"){m({type:"text",value:d});continue}let y="close";o=s.pop(),o.close=!0,m({type:y,value:d}),h--,o=s[s.length-1];continue}if(d===she&&h>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:nhe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===ohe&&h>0&&o.commas===0){let y=o.nodes;if(h===0||y.length===0){m({type:"text",value:d});continue}if(a.type==="dot"){if(o.range=[],a.value+=d,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){y.pop();let v=y[y.length-1];v.value+=a.value+d,a=v,o.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let y=s[s.length-1],v=y.nodes.indexOf(o);y.nodes.splice(v,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};sU.exports=mhe});var cU=_((oSe,uU)=>{"use strict";var aU=mm(),ghe=Y6(),yhe=Q6(),Dhe=oU(),Br=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Br.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Br.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Br.parse=(t,e={})=>Dhe(t,e);Br.stringify=(t,e={})=>aU(typeof t=="string"?Br.parse(t,e):t,e);Br.compile=(t,e={})=>(typeof t=="string"&&(t=Br.parse(t,e)),ghe(t,e));Br.expand=(t,e={})=>{typeof t=="string"&&(t=Br.parse(t,e));let r=yhe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Br.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Br.compile(t,e):Br.expand(t,e);uU.exports=Br});var bl=_((aSe,pU)=>{"use strict";var whe=require("path"),Kn="\\\\/",lU=`[^${Kn}]`,Ai="\\.",vhe="\\+",Ehe="\\?",Dm="\\/",bhe="(?=.)",fU="[^/]",kb=`(?:${Dm}|$)`,hU=`(?:^|${Dm})`,Nb=`${Ai}{1,2}${kb}`,_he=`(?!${Ai})`,Che=`(?!${hU}${Nb})`,She=`(?!${Ai}{0,1}${kb})`,Ahe=`(?!${Nb})`,Ohe=`[^.${Dm}]`,xhe=`${fU}*?`,dU={DOT_LITERAL:Ai,PLUS_LITERAL:vhe,QMARK_LITERAL:Ehe,SLASH_LITERAL:Dm,ONE_CHAR:bhe,QMARK:fU,END_ANCHOR:kb,DOTS_SLASH:Nb,NO_DOT:_he,NO_DOTS:Che,NO_DOT_SLASH:She,NO_DOTS_SLASH:Ahe,QMARK_NO_DOT:Ohe,STAR:xhe,START_ANCHOR:hU},The={...dU,SLASH_LITERAL:`[${Kn}]`,QMARK:lU,STAR:`${lU}*?`,DOTS_SLASH:`${Ai}{1,2}(?:[${Kn}]|$)`,NO_DOT:`(?!${Ai})`,NO_DOTS:`(?!(?:^|[${Kn}])${Ai}{1,2}(?:[${Kn}]|$))`,NO_DOT_SLASH:`(?!${Ai}{0,1}(?:[${Kn}]|$))`,NO_DOTS_SLASH:`(?!${Ai}{1,2}(?:[${Kn}]|$))`,QMARK_NO_DOT:`[^.${Kn}]`,START_ANCHOR:`(?:^|[${Kn}])`,END_ANCHOR:`(?:[${Kn}]|$)`},Ihe={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};pU.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ihe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:whe.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?The:dU}}});var _l=_(Tr=>{"use strict";var Phe=require("path"),Fhe=process.platform==="win32",{REGEX_BACKSLASH:Rhe,REGEX_REMOVE_BACKSLASH:khe,REGEX_SPECIAL_CHARS:Nhe,REGEX_SPECIAL_CHARS_GLOBAL:$he}=bl();Tr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Tr.hasRegexChars=t=>Nhe.test(t);Tr.isRegexChar=t=>t.length===1&&Tr.hasRegexChars(t);Tr.escapeRegex=t=>t.replace($he,"\\$1");Tr.toPosixSlashes=t=>t.replace(Rhe,"/");Tr.removeBackslashes=t=>t.replace(khe,e=>e==="\\"?"":e);Tr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Tr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Fhe===!0||Phe.sep==="\\";Tr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Tr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Tr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Tr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var bU=_((cSe,EU)=>{"use strict";var mU=_l(),{CHAR_ASTERISK:$b,CHAR_AT:Lhe,CHAR_BACKWARD_SLASH:Cl,CHAR_COMMA:Bhe,CHAR_DOT:Lb,CHAR_EXCLAMATION_MARK:Bb,CHAR_FORWARD_SLASH:vU,CHAR_LEFT_CURLY_BRACE:jb,CHAR_LEFT_PARENTHESES:Mb,CHAR_LEFT_SQUARE_BRACKET:jhe,CHAR_PLUS:Mhe,CHAR_QUESTION_MARK:gU,CHAR_RIGHT_CURLY_BRACE:Uhe,CHAR_RIGHT_PARENTHESES:yU,CHAR_RIGHT_SQUARE_BRACKET:qhe}=bl(),DU=t=>t===vU||t===Cl,wU=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Hhe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],u=t,c=-1,l=0,h=0,d=!1,f=!1,m=!1,y=!1,v=!1,E=!1,A=!1,p=!1,D=!1,w=!1,C=0,F,b,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),B=()=>(F=b,u.charCodeAt(++c));for(;c<n;){b=B();let T;if(b===Cl){A=k.backslashes=!0,b=B(),b===jb&&(E=!0);continue}if(E===!0||b===jb){for(C++;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,B();continue}if(b===jb){C++;continue}if(E!==!0&&b===Lb&&(b=B())===Lb){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(E!==!0&&b===Bhe){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===Uhe&&(C--,C===0)){E=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(b===vU){if(s.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},w===!0)continue;if(F===Lb&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(b===Mhe||b===Lhe||b===$b||b===gU||b===Bb)===!0&&I()===Mb){if(m=k.isGlob=!0,y=k.isExtglob=!0,w=!0,b===Bb&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,b=B();continue}if(b===yU){m=k.isGlob=!0,w=!0;break}}continue}break}if(b===$b){if(F===$b&&(v=k.isGlobstar=!0),m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===gU){if(m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===jhe){for(;R()!==!0&&(T=B());){if(T===Cl){A=k.backslashes=!0,B();continue}if(T===qhe){f=k.isBracket=!0,m=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&b===Bb&&c===l){p=k.negated=!0,l++;continue}if(r.noparen!==!0&&b===Mb){if(m=k.isGlob=!0,i===!0){for(;R()!==!0&&(b=B());){if(b===Mb){A=k.backslashes=!0,b=B();continue}if(b===yU){w=!0;break}}continue}break}if(m===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let j=u,z="",L="";l>0&&(z=u.slice(0,l),u=u.slice(l),h-=l),j&&m===!0&&h>0?(j=u.slice(0,h),L=u.slice(h)):m===!0?(j="",L=u):j=u,j&&j!==""&&j!=="/"&&j!==u&&DU(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),r.unescape===!0&&(L&&(L=mU.removeBackslashes(L)),j&&A===!0&&(j=mU.removeBackslashes(j)));let S={prefix:z,input:t,start:l,base:j,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:y,isGlobstar:v,negated:p,negatedExtglob:D};if(r.tokens===!0&&(S.maxDepth=0,DU(b)||o.push(k),S.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let P=0;P<s.length;P++){let $=T?T+1:l,q=s[P],M=t.slice($,q);r.tokens&&(P===0&&l!==0?(o[P].isPrefix=!0,o[P].value=z):o[P].value=M,wU(o[P]),S.maxDepth+=o[P].depth),(P!==0||M!=="")&&a.push(M),T=q}if(T&&T+1<t.length){let P=t.slice(T+1);a.push(P),r.tokens&&(o[o.length-1].value=P,wU(o[o.length-1]),S.maxDepth+=o[o.length-1].depth)}S.slashes=s,S.parts=a}return S};EU.exports=Hhe});var SU=_((lSe,CU)=>{"use strict";var wm=bl(),jr=_l(),{MAX_LENGTH:vm,POSIX_REGEX_SOURCE:Vhe,REGEX_NON_SPECIAL_CHARS:zhe,REGEX_SPECIAL_CHARS_BACKREF:Khe,REPLACEMENTS:_U}=wm,Ghe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>jr.escapeRegex(i)).join("..")}return r},hu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ub=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=_U[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(vm,r.maxLength):vm,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",u=jr.isWindows(e),c=wm.globChars(u),l=wm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:v,NO_DOT_SLASH:E,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:C}=c,F=N=>`(${a}(?:(?!${C}${N.dot?y:h}).)*?)`,b=r.dot?"":v,k=r.dot?p:D,R=r.bash===!0?F(r):w;r.capture&&(R=`(${R})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let I={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=jr.removePrefix(t,I),i=t.length;let B=[],j=[],z=[],L=s,S,T=()=>I.index===i-1,P=I.peek=(N=1)=>t[I.index+N],$=I.advance=()=>t[++I.index]||"",q=()=>t.slice(I.index+1),M=(N="",ne=0)=>{I.consumed+=N,I.index+=ne},G=N=>{I.output+=N.output!=null?N.output:N.value,M(N.value)},U=()=>{let N=1;for(;P()==="!"&&(P(2)!=="("||P(3)==="?");)$(),I.start++,N++;return N%2===0?!1:(I.negated=!0,I.start++,!0)},H=N=>{I[N]++,z.push(N)},te=N=>{I[N]--,z.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),K=N.extglob===!0||B.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!K&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(B.length&&N.type!=="paren"&&(B[B.length-1].inner+=N.value),(N.value||N.output)&&G(N),L&&L.type==="text"&&N.type==="text"){L.value+=N.value,L.output=(L.output||"")+N.value;return}N.prev=L,o.push(N),L=N},O=(N,ne)=>{let K={...l[ne],conditions:1,inner:""};K.prev=L,K.parens=I.parens,K.output=I.output;let oe=(r.capture?"(":"")+K.open;H("parens"),x({type:N,value:ne,output:I.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:oe}),B.push(K)},V=N=>{let ne=N.close+(r.capture?")":""),K;if(N.type==="negate"){let oe=R;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(oe=F(r)),(oe!==R||T()||/^\)+$/.test(q()))&&(ne=N.close=`)$))${oe}`),N.inner.includes("*")&&(K=q())&&/^\.[^\\/.]+$/.test(K)){let we=Ub(K,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${oe})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:S,output:ne}),te("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(Khe,(K,oe,we,Ie,Ve,bt)=>Ie==="\\"?(N=!0,K):Ie==="?"?oe?oe+Ie+(Ve?p.repeat(Ve.length):""):bt===0?k+(Ve?p.repeat(Ve.length):""):p.repeat(we.length):Ie==="."?h.repeat(we.length):Ie==="*"?oe?oe+Ie+(Ve?R:""):R:oe?K:`\\${K}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,K=>K.length%2===0?"\\\\":K?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=jr.wrapOutput(ne,I,e),I)}for(;!T();){if(S=$(),S==="\0")continue;if(S==="\\"){let K=P();if(K==="/"&&r.bash!==!0||K==="."||K===";")continue;if(!K){S+="\\",x({type:"text",value:S});continue}let oe=/^\\+/.exec(q()),we=0;if(oe&&oe[0].length>2&&(we=oe[0].length,I.index+=we,we%2!==0&&(S+="\\")),r.unescape===!0?S=$():S+=$(),I.brackets===0){x({type:"text",value:S});continue}}if(I.brackets>0&&(S!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&S===":"){let K=L.value.slice(1);if(K.includes("[")&&(L.posix=!0,K.includes(":"))){let oe=L.value.lastIndexOf("["),we=L.value.slice(0,oe),Ie=L.value.slice(oe+2),Ve=Vhe[Ie];if(Ve){L.value=we+Ve,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(S==="["&&P()!==":"||S==="-"&&P()==="]")&&(S=`\\${S}`),S==="]"&&(L.value==="["||L.value==="[^")&&(S=`\\${S}`),r.posix===!0&&S==="!"&&L.value==="["&&(S="^"),L.value+=S,G({value:S});continue}if(I.quotes===1&&S!=='"'){S=jr.escapeRegex(S),L.value+=S,G({value:S});continue}if(S==='"'){I.quotes=I.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:S});continue}if(S==="("){H("parens"),x({type:"paren",value:S});continue}if(S===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(hu("opening","("));let K=B[B.length-1];if(K&&I.parens===K.parens+1){V(B.pop());continue}x({type:"paren",value:S,output:I.parens?")":"\\)"}),te("parens");continue}if(S==="["){if(r.nobracket===!0||!q().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));S=`\\${S}`}else H("brackets");x({type:"bracket",value:S});continue}if(S==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:S,output:`\\${S}`});continue}if(I.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(hu("opening","["));x({type:"text",value:S,output:`\\${S}`});continue}te("brackets");let K=L.value.slice(1);if(L.posix!==!0&&K[0]==="^"&&!K.includes("/")&&(S=`/${S}`),L.value+=S,G({value:S}),r.literalBrackets===!1||jr.hasRegexChars(K))continue;let oe=jr.escapeRegex(L.value);if(I.output=I.output.slice(0,-L.value.length),r.literalBrackets===!0){I.output+=oe,L.value=oe;continue}L.value=`(${a}${oe}|${L.value})`,I.output+=L.value;continue}if(S==="{"&&r.nobrace!==!0){H("braces");let K={type:"brace",value:S,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};j.push(K),x(K);continue}if(S==="}"){let K=j[j.length-1];if(r.nobrace===!0||!K){x({type:"text",value:S,output:S});continue}let oe=")";if(K.dots===!0){let we=o.slice(),Ie=[];for(let Ve=we.length-1;Ve>=0&&(o.pop(),we[Ve].type!=="brace");Ve--)we[Ve].type!=="dots"&&Ie.unshift(we[Ve].value);oe=Ghe(Ie,r),I.backtrack=!0}if(K.comma!==!0&&K.dots!==!0){let we=I.output.slice(0,K.outputIndex),Ie=I.tokens.slice(K.tokensIndex);K.value=K.output="\\{",S=oe="\\}",I.output=we;for(let Ve of Ie)I.output+=Ve.output||Ve.value}x({type:"brace",value:S,output:oe}),te("braces"),j.pop();continue}if(S==="|"){B.length>0&&B[B.length-1].conditions++,x({type:"text",value:S});continue}if(S===","){let K=S,oe=j[j.length-1];oe&&z[z.length-1]==="braces"&&(oe.comma=!0,K="|"),x({type:"comma",value:S,output:K});continue}if(S==="/"){if(L.type==="dot"&&I.index===I.start+1){I.start=I.index+1,I.consumed="",I.output="",o.pop(),L=s;continue}x({type:"slash",value:S,output:f});continue}if(S==="."){if(I.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let K=j[j.length-1];L.type="dots",L.output+=S,L.value+=S,K.dots=!0;continue}if(I.braces+I.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:S,output:h});continue}x({type:"dot",value:S,output:h});continue}if(S==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("qmark",S);continue}if(L&&L.type==="paren"){let oe=P(),we=S;if(oe==="<"&&!jr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(oe)||oe==="<"&&!/<([!=]|\w+>)/.test(q()))&&(we=`\\${S}`),x({type:"text",value:S,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:S,output:D});continue}x({type:"qmark",value:S,output:p});continue}if(S==="!"){if(r.noextglob!==!0&&P()==="("&&(P(2)!=="?"||!/[!=<:]/.test(P(3)))){O("negate",S);continue}if(r.nonegate!==!0&&I.index===0){U();continue}}if(S==="+"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("plus",S);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:S,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||I.parens>0){x({type:"plus",value:S});continue}x({type:"plus",value:d});continue}if(S==="@"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){x({type:"at",extglob:!0,value:S,output:""});continue}x({type:"text",value:S});continue}if(S!=="*"){(S==="$"||S==="^")&&(S=`\\${S}`);let K=zhe.exec(q());K&&(S+=K[0],I.index+=K[0].length),x({type:"text",value:S});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=S,L.output=R,I.backtrack=!0,I.globstar=!0,M(S);continue}let N=q();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",S);continue}if(L.type==="star"){if(r.noglobstar===!0){M(S);continue}let K=L.prev,oe=K.prev,we=K.type==="slash"||K.type==="bos",Ie=oe&&(oe.type==="star"||oe.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:S,output:""});continue}let Ve=I.braces>0&&(K.type==="comma"||K.type==="brace"),bt=B.length&&(K.type==="pipe"||K.type==="paren");if(!we&&K.type!=="paren"&&!Ve&&!bt){x({type:"star",value:S,output:""});continue}for(;N.slice(0,3)==="/**";){let pr=t[I.index+4];if(pr&&pr!=="/")break;N=N.slice(3),M("/**",3)}if(K.type==="bos"&&T()){L.type="globstar",L.value+=S,L.output=F(r),I.output=L.output,I.globstar=!0,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&!Ie&&T()){I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=F(r)+(r.strictSlashes?")":"|$)"),L.value+=S,I.globstar=!0,I.output+=K.output+L.output,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=`${F(r)}${f}|${f}${pr})`,L.value+=S,I.output+=K.output+L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}if(K.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=S,L.output=`(?:^|${f}|${F(r)}${f})`,I.output=L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=F(r),L.value+=S,I.output+=L.output,I.globstar=!0,M(S);continue}let ne={type:"star",value:S,output:R};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=b+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=S,x(ne);continue}(I.index===I.start||L.type==="slash"||L.type==="dot")&&(L.type==="dot"?(I.output+=E,L.output+=E):r.dot===!0?(I.output+=A,L.output+=A):(I.output+=b,L.output+=b),P()!=="*"&&(I.output+=m,L.output+=m)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));I.output=jr.escapeLast(I.output,"["),te("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing",")"));I.output=jr.escapeLast(I.output,"("),te("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","}"));I.output=jr.escapeLast(I.output,"{"),te("braces")}if(r.strictSlashes!==!0&&(L.type==="star"||L.type==="bracket")&&x({type:"maybe_slash",value:"",output:`${f}?`}),I.backtrack===!0){I.output="";for(let N of I.tokens)I.output+=N.output!=null?N.output:N.value,N.suffix&&(I.output+=N.suffix)}return I};Ub.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(vm,r.maxLength):vm,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=_U[t]||t;let s=jr.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:h,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:m}=wm.globChars(s),y=r.dot?h:l,v=r.dot?d:l,E=r.capture?"":"?:",A={negated:!1,prefix:""},p=r.bash===!0?".*?":f;r.capture&&(p=`(${p})`);let D=b=>b.noglobstar===!0?p:`(${E}(?:(?!${m}${b.dot?c:o}).)*?)`,w=b=>{switch(b){case"*":return`${y}${u}${p}`;case".*":return`${o}${u}${p}`;case"*.*":return`${y}${p}${o}${u}${p}`;case"*/*":return`${y}${p}${a}${u}${v}${p}`;case"**":return y+D(r);case"**/*":return`(?:${y}${D(r)}${a})?${v}${u}${p}`;case"**/*.*":return`(?:${y}${D(r)}${a})?${v}${p}${o}${u}${p}`;case"**/.*":return`(?:${y}${D(r)}${a})?${o}${u}${p}`;default:{let k=/^(.*?)\.(\w+)$/.exec(b);if(!k)return;let R=w(k[1]);return R?R+o+k[2]:void 0}}},C=jr.removePrefix(t,A),F=w(C);return F&&r.strictSlashes!==!0&&(F+=`${a}?`),F};CU.exports=Ub});var OU=_((fSe,AU)=>{"use strict";var Whe=require("path"),Xhe=bU(),qb=SU(),Hb=_l(),Yhe=bl(),Jhe=t=>t&&typeof t=="object"&&!Array.isArray(t),xt=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>xt(d,e,r));return d=>{for(let f of l){let m=f(d);if(m)return m}return!1}}let n=Jhe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=Hb.isWindows(e),o=n?xt.compileRe(t,e):xt.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=xt(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=xt.test(l,o,e,{glob:t,posix:s}),y={glob:t,state:a,regex:o,posix:s,input:l,output:m,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(y),d===!1?(y.isMatch=!1,h?y:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(y),y.isMatch=!1,h?y:!1):(typeof i.onMatch=="function"&&i.onMatch(y),h?y:!0)};return r&&(c.state=a),c};xt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?Hb.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=xt.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};xt.matchBase=(t,e,r,n=Hb.isWindows(r))=>(e instanceof RegExp?e:xt.makeRe(e,r)).test(Whe.basename(t));xt.isMatch=(t,e,r)=>xt(e,r)(t);xt.parse=(t,e)=>Array.isArray(t)?t.map(r=>xt.parse(r,e)):qb(t,{...e,fastpaths:!1});xt.scan=(t,e)=>Xhe(t,e);xt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=xt.toRegex(a,e);return n===!0&&(u.state=t),u};xt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=qb.fastpaths(t,e)),i.output||(i=qb(t,e)),xt.compileRe(i,e,r,n)};xt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};xt.constants=Yhe;AU.exports=xt});var TU=_((hSe,xU)=>{"use strict";xU.exports=OU()});var NU=_((dSe,kU)=>{"use strict";var PU=require("util"),FU=cU(),Gn=TU(),Vb=_l(),IU=t=>t===""||t==="./",RU=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},rt=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=l=>{s.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let h=Gn(String(e[l]),{...r,onResult:a},!0),d=h.state.negated||h.state.negatedExtglob;d&&o++;for(let f of t){let m=h(f,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),i.add(m.output)))}}let c=(o===e.length?[...s]:[...i]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};rt.match=rt;rt.matcher=(t,e)=>Gn(t,e);rt.isMatch=(t,e,r)=>Gn(e,r)(t);rt.any=rt.isMatch;rt.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(rt(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};rt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${PU.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>rt.contains(t,n,r));if(typeof e=="string"){if(IU(t)||IU(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return rt.isMatch(t,e,{...r,contains:!0})};rt.matchKeys=(t,e,r)=>{if(!Vb.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=rt(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};rt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Gn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};rt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Gn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};rt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${PU.inspect(t)}"`);return[].concat(e).every(n=>Gn(n,r)(t))};rt.capture=(t,e,r)=>{let n=Vb.isWindows(r),s=Gn.makeRe(String(t),{...r,capture:!0}).exec(n?Vb.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};rt.makeRe=(...t)=>Gn.makeRe(...t);rt.scan=(...t)=>Gn.scan(...t);rt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of FU(String(n),e))r.push(Gn.parse(i,e));return r};rt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!RU(t)?[t]:FU(t,e)};rt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return rt.braces(t,{...e,expand:!0})};rt.hasBraces=RU;kU.exports=rt});var qde={};Sm(qde,{CapgoSDK:()=>nt,addApp:()=>$de,addChannel:()=>Bde,addOrganization:()=>Rde,checkBundleCompatibility:()=>bde,createSupabaseClient:()=>pe,decryptBundle:()=>Cde,deleteLegacyEncryptionKey:()=>xde,deleteOrganization:()=>Nde,doctor:()=>Ede,encryptBundle:()=>_de,generateEncryptionKeys:()=>Ade,getAccountId:()=>Pde,getCapacitorConfig:()=>Ude,getCurrentBundle:()=>Tde,getStats:()=>Mde,listBundles:()=>Lde,listOrganizations:()=>Fde,login:()=>vde,requestBuild:()=>jde,saveEncryptionKey:()=>Ode,updateAppSetting:()=>Ide,updateOrganization:()=>kde,uploadBundle:()=>wde,zipBundle:()=>Sde});module.exports=ce(qde);var Vt=ve(Ze(),1),Co=require("node:process"),Oi=ve(require("node:readline"),1),Pm=ve(require("node:readline"),1),s_=require("node:stream"),o_=ve(xm(),1);function _q({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var Cq=_q();function a_(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Cq,"")}function u_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c_={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,o=i<<10|s,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),s=0,o=0;o<i.length;o++)s=s+this.characterLength(i[o]);return s},e.slice=function(n,i,s){textLen=e.length(n),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var o="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],h=e.length(l);if(a>=i-(h==2?1:0))if(a+h<=s)o+=l;else break;a+=h}return o}})(c_);var Sq=c_.exports,Aq=u_(Sq),Oq=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},xq=u_(Oq);function pu(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=a_(t),t.length===0))return 0;t=t.replace(xq()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(Aq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Tm=10,Zb=(t=0)=>e=>`\x1B[${e+t}m`,Qb=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,e_=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,it={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(it.modifier);var Tq=Object.keys(it.color),Iq=Object.keys(it.bgColor);[...Tq,...Iq];function Pq(){let t=new Map;for(let[e,r]of Object.entries(it)){for(let[n,i]of Object.entries(r))it[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=it[n],t.set(i[0],i[1]);Object.defineProperty(it,e,{value:r,enumerable:!1})}return Object.defineProperty(it,"codes",{value:t,enumerable:!1}),it.color.close="\x1B[39m",it.bgColor.close="\x1B[49m",it.color.ansi=Zb(),it.color.ansi256=Qb(),it.color.ansi16m=e_(),it.bgColor.ansi=Zb(Tm),it.bgColor.ansi256=Qb(Tm),it.bgColor.ansi16m=e_(Tm),Object.defineProperties(it,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>it.rgbToAnsi256(...it.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>it.ansi256ToAnsi(it.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>it.ansi256ToAnsi(it.hexToAnsi256(e)),enumerable:!1}}),it}var Fq=Pq(),kl=new Set(["\x1B","\x9B"]),Rq=39,Rm="\x07",l_="[",kq="]",f_="m",km=`${kq}8;;`,t_=t=>`${kl.values().next().value}${l_}${t}${f_}`,r_=t=>`${kl.values().next().value}${km}${t}${Rm}`,Nq=t=>t.split(" ").map(e=>pu(e)),Im=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=pu(a_(t[t.length-1]));for(let[a,u]of n.entries()){let c=pu(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),kl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(km)),i){s?u===Rm&&(i=!1,s=!1):u===f_&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},$q=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(pu(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Lq=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=Nq(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=pu(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),Im(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){Im(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){Im(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>$q(c)));let u=[...a.join(`
242
242
  `)];for(let[c,l]of u.entries()){if(n+=l,kl.has(l)){let{groups:d}=new RegExp(`(?:\\${l_}(?<code>\\d+)m|\\${km}(?<uri>.*)${Rm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===Rq?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=Fq.codes.get(Number(i));u[c+1]===`
243
243
  `?(s&&(n+=r_("")),i&&h&&(n+=t_(h))):l===`
244
244
  `&&(i&&h&&(n+=t_(i)),s&&(n+=r_(s)))}return n};function n_(t,e,r){return String(t).normalize().replace(/\r\n/g,`
@@ -283,9 +283,9 @@ ${J.default.gray(gu)} ${t}
283
283
  `);let w=0,C=0;f(),s=setInterval(()=>{if(n&&a===u)return;y(),u=a;let F=J.default.magenta(e[w]);if(n)process.stdout.write(`${F} ${a}...`);else if(t==="timer")process.stdout.write(`${F} ${a} ${E(c)}`);else{let b=".".repeat(Math.floor(C)).slice(0,3);process.stdout.write(`${F} ${a}${b}`)}w=w+1<e.length?w+1:0,C=C<e.length?C+.125:0},r)},p=(D="",w=0)=>{o=!1,clearInterval(s),y();let C=w===0?J.default.green(jm):w===1?J.default.red(d_):J.default.red(p_);a=v(D??a),t==="timer"?process.stdout.write(`${C} ${a} ${E(c)}
284
284
  `):process.stdout.write(`${C} ${a}
285
285
  `),m(),i()};return{start:A,stop:p,message:(D="")=>{a=v(D??a)}}};function m_(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var zt=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let i=0;i<r.length;i++){let s=this.cast(n[i]).length;s>r[i]&&(r[i]=s)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let i=this.cast(e),s=n?m_("bold",i):i,o=r-i.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(o)+s;case"string":return s+a.repeat(o);case"boolean":case"object":return a.repeat(Math.ceil(o/2))+m_("italic",i)+a.repeat(Math.floor(o/2));default:return a.repeat(o)}}renderRow(e,r=!1){let n=this.theme.row,i=this.columnWidth();return n[0]+e.map((s,o)=>this.renderCell(s,i[o],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(i=>this.renderRow(i)),r||n?this.renderLine(e.bot):""].filter(i=>i.length>0).join(`
286
- `)}};var h8=require("node:child_process"),Te=require("node:fs"),Kp=require("node:os"),xe=ve(require("node:path")),Un=require("node:process"),os=ve(Ll());var Zt=require("fs"),Du=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},Bl=(t=Du(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},g_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function jl(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function w_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Vm(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var So="0|[1-9]\\d*",n4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",i4=`(?<major>${So})\\.(?<minor>${So})\\.(?<patch>${So})`,y_=`(?:${So}|${n4})`,v_=`(?:-(?<prerelease>${y_}(?:\\.${y_})*))`,D_="[0-9A-Za-z-]+",E_=`(?:\\+(?<buildmetadata>${D_}(?:\\.${D_})*))`,b_=`v?${i4}${v_}?${E_}?`,__=new RegExp(`^${b_}$`),C_="(?:<|>)?=?",s4="x|X|\\*",Hm=`${So}|${s4}`,Ml=`[v=\\s]*(?<major>${Hm})(?:\\.(?<minor>${Hm})(?:\\.(?<patch>${Hm})${v_}?${E_}?)?)?`,S_=new RegExp(`^(?<operator>~>?|\\^|${C_})\\s*${Ml}$`),A_=new RegExp(`^(?<operator>${C_})\\s*(${b_})$|^$`);function zm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Km=256;var o4=new RegExp(`^${So}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(o4.test(e)){let r=Number(e);if(zm(r))return r}return e})}function tn(t){return t.split(".").filter(Boolean)}function Ii(t,e){let r=Number(t);if(!zm(r))throw new TypeError(e);return r}function Gn(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function er(t,e){return t===e?0:jl(t.major,e.major)||jl(t.minor,e.minor)||jl(t.patch,e.patch)||w_(t.prerelease,e.prerelease)||Vm(t.prerelease,e.prerelease)}function Gm(t){return t.toFixed(0)}function rn(t){let e=Gm(t.major),r=Gm(t.minor),n=Gm(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function a4(t,e){if(Gn(e))return!0;let r=er(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function Ul(t,e){for(let r of e)if(!a4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Gn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function wu(t,e){return e.some(r=>Ul(t,r))}function u4(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function vu(t=[],e){let r=u4(t);if(!e)return r;let n=Qt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function Eu(t,e,r={}){let n=r.build!==void 0?tn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:vu(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:vu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var ql={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Ao={operator:void 0,...ql};function Wm(t,e){return er(t,e)>0}function ds(t,e){return er(t,e)<0}function c4(t){let r=t.match(A_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Ii(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Ii(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Ii(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?tn(s):[]}:ql;return{operator:n||void 0,...o}}function ze(t){return!t||t.toLowerCase()==="x"||t==="*"}function l4(t){if(!ze(t.major))return ze(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:ze(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?Qt(t.prerelease):[],build:[]}}function f4(t){if(!ze(t.major))return ze(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:ze(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function h4(t){let e=t.match(new RegExp(`^${Ml}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Ml}\\s*$`))?.groups;if(!a)return null;let u=l4(r),c=f4(a);return[u,c].filter(Boolean)}function d4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Qt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function p4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function m4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function g4(t){let e=ze(t.minor),r=ze(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Qt(t.prerelease??""),a=tn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function y4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function D4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function w4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function v4(t){let e=t.match(S_)?.groups;if(!e)return c4(t);switch(e.operator){case"^":return d4(e);case"~":case"~>":return p4(e);case"<":return m4(e);case"<=":return g4(e);case">":return y4(e);case">=":return D4(e);case"=":case"":return w4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function E4(t){return t.split(/\s+/).flatMap(v4)}function Hl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>h4(r)||E4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function lt(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Km)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Km}`);t=t.trim();let e=t.match(__)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Ii(e.major,`Cannot parse version ${t}: invalid major version`),n=Ii(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Ii(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?tn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function O_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Gn(t)?!0:wu(t,[[e]]);if(n===void 0)return Gn(e)?!0:wu(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function b4(t){return t.every(e=>e.some(r=>_4(r)))}function _4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!O_(r,n))return!1}return!0}function x_(t,e){return b4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>O_(i,s)))))}function T_(t){try{return lt(t),!0}catch{return!1}}function I_(t,e){return er(t,e)>=0}var Qa=ve(OS()),db=ve(cD()),d8=ve($A()),Gp=ve(Kh());var Mi={name:"@capgo/cli",version:"7.54.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#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","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function Gh(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function Xe(){let t=await Gh("@capgo/cli")??"",e=t?.split(".")[0];t!==Mi.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Mi.version} it's not the latest version.
287
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function WT(t,e,r,n,i,s="\u2705"){await _e(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var b0=require("node:buffer"),XT=require("node:crypto"),FY=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function RY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=FY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function ri(t,e="sha256"){let r=b0.Buffer.isBuffer(t)?t:b0.Buffer.from(t);if(e==="crc32")return RY(r);let n=(0,XT.createHash)(e);return n.update(r),n.digest("hex")}var al=ve(DM());async function wM(){let t=await(0,al.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function HE(t,e,r=!1){let n=await(0,al.loadConfig)(),{extConfig:i}=n.app;i&&(i.plugins||(i.plugins={extConfig:{},[t]:{}}),i.plugins[t]||(i.plugins[t]={}),r?i=e.config:i.plugins[t]=e.config.plugins?.[t],(0,al.writeConfig)(i,n.app.extConfigFilePath))}async function Xa(t,e=!1){await HE("CapacitorUpdater",t,e)}var tu=".capgo_key",$r=".capgo_key_v2",Wp=`${tu}.pub`,wi=`${$r}.pub`,o8="https://capgo.app",a8="https://files.capgo.app",u8="https://api.capgo.app",c8="https://console.capgo.app",pb=12e4,Yle=1024*1024*20,Jle=1024*1024*1024,Zle=1024*1024*99,eu="package.json",ru=/^(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,W=t=>t?`
288
- ${d8.default.render(t)}`:"";function zp(t){return new Promise(e=>{setTimeout(e,t)})}function Lr(t){return(0,os.isMonorepo)(t)?(0,os.findMonorepoRoot)(t):(0,os.isNXMonorepo)(t)?(0,os.findNXMonorepoRoot)(t):t}function Qle(t=Lr((0,Un.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Te.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,Te.readFileSync)(r??(0,xe.join)(t,eu));return JSON.parse(n)}function as(t=Lr((0,Un.cwd)()),e=void 0){return Qle(t,e).version??""}function l8(t){let e=t.replace("^","").replace("~","");if(T_(e))try{let r=lt(e);return rn(r)}catch{return e}return e}async function us(t,e=(0,Un.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;let n=r?(0,xe.dirname)(r):e;try{let u=`${t}/package.json`,{createRequire:c}=await import("node:module"),h=c((0,xe.join)(n,"package.json")).resolve(u),d=JSON.parse((0,Te.readFileSync)(h,"utf-8"));if(d.version)return d.version}catch{}let i=n,s=xe.default.parse(i).root;for(;i!==s;){let u=(0,xe.join)(i,"node_modules",t,eu);if((0,Te.existsSync)(u))try{let l=JSON.parse((0,Te.readFileSync)(u,"utf-8"));if(l.version)return l.version}catch{}let c=(0,xe.dirname)(i);if(c===i)break;i=c}let o=null,a=(0,xe.join)(e,"ios","App","Podfile");if((0,Te.existsSync)(a))try{let c=(0,Te.readFileSync)(a,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"ios","App",c[1])))}catch{}if(!o){let u=(0,xe.join)(e,"android","capacitor.settings.gradle");if((0,Te.existsSync)(u))try{let l=(0,Te.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);l?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"android",l[1])).replace(/\/android$/,""))}catch{}}if(o){let u=(0,xe.join)(o,eu);if((0,Te.existsSync)(u))try{let c=JSON.parse((0,Te.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}try{let c=(await Xp(e)).get(t);if(c)return c}catch{}return null}async function Xp(t=Lr((0,Un.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,xe.join)(t,eu)],r){for(let i of r)if(!(0,Te.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw g.error(s),new Error(s)}}let n=new Map;for(let i of r){let s=(0,Te.readFileSync)(i),o=JSON.parse(s);for(let a in o.dependencies)n.set(a,l8(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,l8(o.devDependencies[a]))}return n}async function de(){try{let t=await wM();if(!t){let e="No capacitor config file found, run `cap init` first";throw g.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw g.error(e),new Error(e)}}async function efe(t,e){let r=await de();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await HE(t,r)),r}async function p8(t){return efe("CapacitorUpdater",t)}async function Sn(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||o8,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||c8,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||a8,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||u8};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(g.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:o8,hostWeb:c8,hostFilesApi:a8,hostApi:u8}}}var tfe=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Yp(){let t=await Sn();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return g.info(`Local config ${W(t)}`),t}}async function m8(){let t=await Sn();try{let e=await fetch(`${t.hostFilesApi}/files/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:Jle,maxChunkSize:Zle,alertUploadSize:Yle}}}async function pe(t,e,r){let n=await Yp();if(e&&r&&(g.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw g.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Qa.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function rfe(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){g.error("Invalid API key or insufficient permissions.");let s=`Your key should be: ${r.map((o,a)=>r.length===1?`"${o}"`:a===r.length-1?`or "${o}"`:`"${o}", `).join("")} mode.`;throw g.error(s),new Error("Invalid API key or insufficient permissions.")}}async function g8(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function y8(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function nfe(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function ife(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var hr=(o=>(o[o.none=0]="none",o[o.read=1]="read",o[o.upload=2]="upload",o[o.write=3]="write",o[o.admin=4]="admin",o[o.super_admin=5]="super_admin",o))(hr||{}),nu=(t,e)=>t>=e;async function D8(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i)throw g.error("Cannot get permissions for organization!"),console.error(i),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(g.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(g.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let o=null;switch(n){case"INVALID_APIKEY":{o="INVALID_APIKEY";break}case"NO_APP":{o="NO_APP";break}case"NO_ORG":{o="NO_ORG";break}default:throw g.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:o}}async function w8(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){g.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){g.warn(`Found ${n.length} cli warnings for your organization.`);let s=null;for(let o of n){if(typeof o!="object"||typeof o.message!="string"||typeof o.fatal!="boolean"){g.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(g.error(`${a.message.replaceAll("\\n",`
286
+ `)}};var h8=require("node:child_process"),Te=require("node:fs"),Kp=require("node:os"),xe=ve(require("node:path")),Un=require("node:process"),os=ve(Ll());var Zt=require("fs"),Du=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},Bl=(t=Du(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},g_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function jl(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function w_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Vm(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var So="0|[1-9]\\d*",n4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",i4=`(?<major>${So})\\.(?<minor>${So})\\.(?<patch>${So})`,y_=`(?:${So}|${n4})`,v_=`(?:-(?<prerelease>${y_}(?:\\.${y_})*))`,D_="[0-9A-Za-z-]+",E_=`(?:\\+(?<buildmetadata>${D_}(?:\\.${D_})*))`,b_=`v?${i4}${v_}?${E_}?`,__=new RegExp(`^${b_}$`),C_="(?:<|>)?=?",s4="x|X|\\*",Hm=`${So}|${s4}`,Ml=`[v=\\s]*(?<major>${Hm})(?:\\.(?<minor>${Hm})(?:\\.(?<patch>${Hm})${v_}?${E_}?)?)?`,S_=new RegExp(`^(?<operator>~>?|\\^|${C_})\\s*${Ml}$`),A_=new RegExp(`^(?<operator>${C_})\\s*(${b_})$|^$`);function zm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Km=256;var o4=new RegExp(`^${So}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(o4.test(e)){let r=Number(e);if(zm(r))return r}return e})}function nn(t){return t.split(".").filter(Boolean)}function Ii(t,e){let r=Number(t);if(!zm(r))throw new TypeError(e);return r}function Wn(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function er(t,e){return t===e?0:jl(t.major,e.major)||jl(t.minor,e.minor)||jl(t.patch,e.patch)||w_(t.prerelease,e.prerelease)||Vm(t.prerelease,e.prerelease)}function Gm(t){return t.toFixed(0)}function sn(t){let e=Gm(t.major),r=Gm(t.minor),n=Gm(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function a4(t,e){if(Wn(e))return!0;let r=er(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function Ul(t,e){for(let r of e)if(!a4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Wn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function wu(t,e){return e.some(r=>Ul(t,r))}function u4(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function vu(t=[],e){let r=u4(t);if(!e)return r;let n=Qt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function Eu(t,e,r={}){let n=r.build!==void 0?nn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:vu(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:vu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var ql={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Ao={operator:void 0,...ql};function Wm(t,e){return er(t,e)>0}function ds(t,e){return er(t,e)<0}function c4(t){let r=t.match(A_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Ii(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Ii(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Ii(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?nn(s):[]}:ql;return{operator:n||void 0,...o}}function ze(t){return!t||t.toLowerCase()==="x"||t==="*"}function l4(t){if(!ze(t.major))return ze(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:ze(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?Qt(t.prerelease):[],build:[]}}function f4(t){if(!ze(t.major))return ze(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:ze(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function h4(t){let e=t.match(new RegExp(`^${Ml}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Ml}\\s*$`))?.groups;if(!a)return null;let u=l4(r),c=f4(a);return[u,c].filter(Boolean)}function d4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Qt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function p4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function m4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function g4(t){let e=ze(t.minor),r=ze(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Qt(t.prerelease??""),a=nn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function y4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function D4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function w4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=nn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function v4(t){let e=t.match(S_)?.groups;if(!e)return c4(t);switch(e.operator){case"^":return d4(e);case"~":case"~>":return p4(e);case"<":return m4(e);case"<=":return g4(e);case">":return y4(e);case">=":return D4(e);case"=":case"":return w4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function E4(t){return t.split(/\s+/).flatMap(v4)}function Hl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>h4(r)||E4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function lt(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Km)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Km}`);t=t.trim();let e=t.match(__)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Ii(e.major,`Cannot parse version ${t}: invalid major version`),n=Ii(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Ii(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?nn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function O_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Wn(t)?!0:wu(t,[[e]]);if(n===void 0)return Wn(e)?!0:wu(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function b4(t){return t.every(e=>e.some(r=>_4(r)))}function _4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!O_(r,n))return!1}return!0}function x_(t,e){return b4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>O_(i,s)))))}function T_(t){try{return lt(t),!0}catch{return!1}}function I_(t,e){return er(t,e)>=0}var Qa=ve(OS()),db=ve(cD()),d8=ve($A()),Gp=ve(Kh());var Mi={name:"@capgo/cli",version:"7.55.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#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","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function Gh(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function Xe(){let t=await Gh("@capgo/cli")??"",e=t?.split(".")[0];t!==Mi.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Mi.version} it's not the latest version.
287
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function WT(t,e,r,n,i,s="\u2705"){await _e(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var b0=require("node:buffer"),XT=require("node:crypto"),FY=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function RY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=FY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function ni(t,e="sha256"){let r=b0.Buffer.isBuffer(t)?t:b0.Buffer.from(t);if(e==="crc32")return RY(r);let n=(0,XT.createHash)(e);return n.update(r),n.digest("hex")}var al=ve(DM());async function wM(){let t=await(0,al.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function HE(t,e,r=!1){let n=await(0,al.loadConfig)(),{extConfig:i}=n.app;i&&(i.plugins||(i.plugins={extConfig:{},[t]:{}}),i.plugins[t]||(i.plugins[t]={}),r?i=e.config:i.plugins[t]=e.config.plugins?.[t],(0,al.writeConfig)(i,n.app.extConfigFilePath))}async function Xa(t,e=!1){await HE("CapacitorUpdater",t,e)}var tu=".capgo_key",$r=".capgo_key_v2",Wp=`${tu}.pub`,vi=`${$r}.pub`,o8="https://capgo.app",a8="https://files.capgo.app",u8="https://api.capgo.app",c8="https://console.capgo.app",pb=12e4,Yle=1024*1024*20,Jle=1024*1024*1024,Zle=1024*1024*99,eu="package.json",ru=/^(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,W=t=>t?`
288
+ ${d8.default.render(t)}`:"";function zp(t){return new Promise(e=>{setTimeout(e,t)})}function Lr(t){return(0,os.isMonorepo)(t)?(0,os.findMonorepoRoot)(t):(0,os.isNXMonorepo)(t)?(0,os.findNXMonorepoRoot)(t):t}function Qle(t=Lr((0,Un.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Te.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,Te.readFileSync)(r??(0,xe.join)(t,eu));return JSON.parse(n)}function as(t=Lr((0,Un.cwd)()),e=void 0){return Qle(t,e).version??""}function l8(t){let e=t.replace("^","").replace("~","");if(T_(e))try{let r=lt(e);return sn(r)}catch{return e}return e}async function us(t,e=(0,Un.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;let n=r?(0,xe.dirname)(r):e;try{let u=`${t}/package.json`,{createRequire:c}=await import("node:module"),h=c((0,xe.join)(n,"package.json")).resolve(u),d=JSON.parse((0,Te.readFileSync)(h,"utf-8"));if(d.version)return d.version}catch{}let i=n,s=xe.default.parse(i).root;for(;i!==s;){let u=(0,xe.join)(i,"node_modules",t,eu);if((0,Te.existsSync)(u))try{let l=JSON.parse((0,Te.readFileSync)(u,"utf-8"));if(l.version)return l.version}catch{}let c=(0,xe.dirname)(i);if(c===i)break;i=c}let o=null,a=(0,xe.join)(e,"ios","App","Podfile");if((0,Te.existsSync)(a))try{let c=(0,Te.readFileSync)(a,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"ios","App",c[1])))}catch{}if(!o){let u=(0,xe.join)(e,"android","capacitor.settings.gradle");if((0,Te.existsSync)(u))try{let l=(0,Te.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);l?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"android",l[1])).replace(/\/android$/,""))}catch{}}if(o){let u=(0,xe.join)(o,eu);if((0,Te.existsSync)(u))try{let c=JSON.parse((0,Te.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}try{let c=(await Xp(e)).get(t);if(c)return c}catch{}return null}async function Xp(t=Lr((0,Un.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,xe.join)(t,eu)],r){for(let i of r)if(!(0,Te.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw g.error(s),new Error(s)}}let n=new Map;for(let i of r){let s=(0,Te.readFileSync)(i),o=JSON.parse(s);for(let a in o.dependencies)n.set(a,l8(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,l8(o.devDependencies[a]))}return n}async function de(){try{let t=await wM();if(!t){let e="No capacitor config file found, run `cap init` first";throw g.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw g.error(e),new Error(e)}}async function efe(t,e){let r=await de();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await HE(t,r)),r}async function p8(t){return efe("CapacitorUpdater",t)}async function Sn(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||o8,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||c8,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||a8,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||u8};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(g.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:o8,hostWeb:c8,hostFilesApi:a8,hostApi:u8}}}var tfe=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Yp(){let t=await Sn();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return g.info(`Local config ${W(t)}`),t}}async function m8(){let t=await Sn();try{let e=await fetch(`${t.hostFilesApi}/files/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:Jle,maxChunkSize:Zle,alertUploadSize:Yle}}}async function pe(t,e,r){let n=await Yp();if(e&&r&&(g.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw g.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Qa.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function rfe(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){g.error("Invalid API key or insufficient permissions.");let s=`Your key should be: ${r.map((o,a)=>r.length===1?`"${o}"`:a===r.length-1?`or "${o}"`:`"${o}", `).join("")} mode.`;throw g.error(s),new Error("Invalid API key or insufficient permissions.")}}async function g8(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function y8(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function nfe(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function ife(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var hr=(o=>(o[o.none=0]="none",o[o.read=1]="read",o[o.upload=2]="upload",o[o.write=3]="write",o[o.admin=4]="admin",o[o.super_admin=5]="super_admin",o))(hr||{}),nu=(t,e)=>t>=e;async function D8(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i)throw g.error("Cannot get permissions for organization!"),console.error(i),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(g.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(g.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let o=null;switch(n){case"INVALID_APIKEY":{o="INVALID_APIKEY";break}case"NO_APP":{o="NO_APP";break}case"NO_ORG":{o="NO_ORG";break}default:throw g.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:o}}async function w8(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){g.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){g.warn(`Found ${n.length} cli warnings for your organization.`);let s=null;for(let o of n){if(typeof o!="object"||typeof o.message!="string"||typeof o.fatal!="boolean"){g.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(g.error(`${a.message.replaceAll("\\n",`
289
289
  `)}`),s=new Error(a.message)):g.warn(`${a.message.replaceAll("\\n",`
290
290
  `)}`)}if(s)throw g.error("Please fix the warnings and try again."),s;g.info("End of cli warnings.")}}async function v8(t,e,r,n,i=!0){let s=await Yp();if(!await(n?ife(t,n,r):nfe(t,e)))throw g.error(`You need to upgrade your plan to continue to use capgo.
291
291
  Upgrade here: ${s.hostWeb}/settings/organization/plans
@@ -295,7 +295,7 @@ Trial expires in ${a} days, upgrade here: ${s.hostWeb}/settings/organization/pla
295
295
  Upgrade here: ${s.hostWeb}/settings/organization/plans
296
296
  `),zp(100),Promise.resolve().then(()=>(fb(),lb)).then(c=>{c.default(`${s.hostWeb}/settings/organization/plans`)}),zp(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([y8(t,e),g8(t,e)]);a>0&&i&&!u&&g.warn(`WARNING !!
297
297
  Trial expires in ${a} days, upgrade here: ${s.hostWeb}/settings/organization/plans
298
- `)}function re(t=!1){let e=Un.env.CAPGO_TOKEN?.trim();if(e)return t||g.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Kp.homedir)(),n,i=`${r}/.capgo`;if((0,Te.existsSync)(i)&&(t||g.info(`Use global API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Te.existsSync)(i)&&(t||g.info(`Use local API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${qn().runner} @capgo/cli login`;throw g.error(s),new Error(s)}return n}function iu(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function mb(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function b8(t,e,r){let n={app_id:e,name:r,version:0};try{let s=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(s.error){if(s.error instanceof Qa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){g.error(`Cannot get upload url ${W(i)}`)}return""}async function*_8(t){let e=(0,Te.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,xe.join)(t,r.name);r.isDirectory()?yield*_8(n):yield n}}var C8="5.10.0",S8="6.25.0",fl="7.0.30";function cs(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&ds(t,lt(e))||t.major===6&&ds(t,lt(r))||t.major===7&&ds(t,lt(n)))}async function A8(t){let e=[],r=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let n of _8(t)){if(r.some(a=>n.includes(a))){g.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let i=(0,Te.readFileSync)(n);if(i.length===0){g.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let s=await ri(i,"sha256"),o=(0,xe.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function Jp(t){return(0,Kp.platform)()==="win32"?ofe(t):sfe(t)}function sfe(t){let e=new db.default;return e.addLocalFolder(t),e.toBuffer()}async function ofe(t){g.info("Zipping file windows mode");let e=new db.default,r=(n,i)=>{let s=(0,Te.readdirSync)(n);for(let o of s){let a=(0,xe.join)(n,o),u=(0,Te.statSync)(a);if(u.isFile()){let c=(0,Te.readFileSync)(a);e.addFile((0,xe.join)(i,o).split(xe.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,xe.join)(i,o))}};return r(t,""),e.toBuffer()}async function O8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{_e(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Gp.Upload(e,{endpoint:`${o.hostFilesApi}/files/upload/attachments/`,chunkSize:a,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(h){if(g.error(`Error uploading bundle: ${h.message}`),h instanceof Gp.DetailedError){let d=h.originalResponse?.getBody(),f=JSON.parse(d||'{"error": "unknown error"}');c(f.status||f.error||f.message||"unknown error")}else c(h.message||h.toString()||"unknown error")},onProgress(h,d){let f=(h/d*100).toFixed(2);s.message(`Uploaded ${f}%`)},async onSuccess(){await _e(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function x8(t,e,r){let n={app_id:e,name:r};try{let s=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(s.error){if(s.error instanceof Qa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Qa.FunctionsHttpError){let s=await i.context.json();g.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else g.error(`Cannot delete failed version: ${W(i)}`)}}async function Zp(t,e){if(!e.app_id||!e.name||!e.created_by)return g.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function _e(t,e,r){try{r&&g.info(`Get remove config: for ${e.event}`);let n=await Yp();r&&g.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let i=new AbortController,s=setTimeout(()=>i.abort(),1e4);try{let o=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:i.signal});if(clearTimeout(s),!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let a=await o.json();a.error&&g.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(g.error("Failed to send Stats event details:"),g.error(W(n)))}}async function Qp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw g.error("Cannot get the list of organizations - exiting"),g.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let i=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw g.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw g.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let s=i.length>1?await gn({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;if(st(s))throw g.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return g.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await rfe(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw g.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return s}async function Rr(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw g.error(`Cannot get organization id for app id ${e}`),W(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function su(t){return new Date(t||"").toLocaleString()}var f8=!1,Za="npm",ll="install",hb="npx";function qn(){if(f8)return{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:hb};let t=Lr((0,Un.cwd)());return Za=Du(t,"npm"),ll=Bl(Za),f8=!0,hb=g_(t),{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:hb}}function T8(t){return(0,Te.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,xe.join)(t,n.name);return n.isDirectory()?T8(i):i.split(`node_modules${xe.sep}`)[1]||i})}async function gb(t,e){let r=e?e.split(","):[],n;try{n=await Xp("",t)}catch(l){throw g.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let i=t?.split(",")[0],s=i?xe.default.resolve(i).replace(eu,""):Lr((0,Un.cwd)());if(!n)throw g.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,h]of Object.entries(n))if(typeof h!="string")throw g.error(`Invalid dependency ${l}: ${h}, expected string, got ${typeof h}`),new Error(`Invalid dependency ${l}: expected string version`);let o=r.length===0?[(0,xe.join)((0,Un.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Te.existsSync)(l))){let l=Du(s,"npm"),h=Bl(l);throw g.error(`Missing node_modules folder at ${o.join(", ")}, please run ${l} ${h}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,h])=>{let d=!1,f=!1,m=h;for(let y of o){let v=(0,xe.join)(y,l);if((0,Te.existsSync)(v)){d=!0;try{let E=(0,xe.join)(v,eu);if((0,Te.existsSync)(E)){let A=JSON.parse((0,Te.readFileSync)(E,"utf-8"));A.version&&(m=A.version)}}catch{}try{if(T8(v).some(A=>tfe.test(A))){f=!0;break}}catch(E){throw g.error(`Error reading node_modules files for ${l} package in ${y}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let y=Du(s,"npm"),v=Bl(y);return g.error(`Missing dependency ${l}, please run ${y} ${v}`),{name:l,version:h}}return{name:l,version:m,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw g.error("Missing dependencies or invalid dependencies"),g.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function afe(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),s=n;return i||s===null||!s.version||!s.version.checksum?null:s.version.checksum}function ufe(t){if(!t)throw g.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw g.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:i}=r;if(!n||typeof n!="string")throw g.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!i||typeof i!="string")throw g.error(`Invalid remote native package version: ${i}, expected string, got ${typeof i}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function I8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
298
+ `)}function re(t=!1){let e=Un.env.CAPGO_TOKEN?.trim();if(e)return t||g.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Kp.homedir)(),n,i=`${r}/.capgo`;if((0,Te.existsSync)(i)&&(t||g.info(`Use global API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Te.existsSync)(i)&&(t||g.info(`Use local API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${qn().runner} @capgo/cli login`;throw g.error(s),new Error(s)}return n}function iu(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function mb(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function b8(t,e,r){let n={app_id:e,name:r,version:0};try{let s=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(s.error){if(s.error instanceof Qa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){g.error(`Cannot get upload url ${W(i)}`)}return""}async function*_8(t){let e=(0,Te.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,xe.join)(t,r.name);r.isDirectory()?yield*_8(n):yield n}}var C8="5.10.0",S8="6.25.0",fl="7.0.30";function cs(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&ds(t,lt(e))||t.major===6&&ds(t,lt(r))||t.major===7&&ds(t,lt(n)))}async function A8(t){let e=[],r=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let n of _8(t)){if(r.some(a=>n.includes(a))){g.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let i=(0,Te.readFileSync)(n);if(i.length===0){g.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let s=await ni(i,"sha256"),o=(0,xe.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function Jp(t){return(0,Kp.platform)()==="win32"?ofe(t):sfe(t)}function sfe(t){let e=new db.default;return e.addLocalFolder(t),e.toBuffer()}async function ofe(t){g.info("Zipping file windows mode");let e=new db.default,r=(n,i)=>{let s=(0,Te.readdirSync)(n);for(let o of s){let a=(0,xe.join)(n,o),u=(0,Te.statSync)(a);if(u.isFile()){let c=(0,Te.readFileSync)(a);e.addFile((0,xe.join)(i,o).split(xe.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,xe.join)(i,o))}};return r(t,""),e.toBuffer()}async function O8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{_e(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Gp.Upload(e,{endpoint:`${o.hostFilesApi}/files/upload/attachments/`,chunkSize:a,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(h){if(g.error(`Error uploading bundle: ${h.message}`),h instanceof Gp.DetailedError){let d=h.originalResponse?.getBody(),f=JSON.parse(d||'{"error": "unknown error"}');c(f.status||f.error||f.message||"unknown error")}else c(h.message||h.toString()||"unknown error")},onProgress(h,d){let f=(h/d*100).toFixed(2);s.message(`Uploaded ${f}%`)},async onSuccess(){await _e(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function x8(t,e,r){let n={app_id:e,name:r};try{let s=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(s.error){if(s.error instanceof Qa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Qa.FunctionsHttpError){let s=await i.context.json();g.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else g.error(`Cannot delete failed version: ${W(i)}`)}}async function Zp(t,e){if(!e.app_id||!e.name||!e.created_by)return g.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function _e(t,e,r){try{r&&g.info(`Get remove config: for ${e.event}`);let n=await Yp();r&&g.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let i=new AbortController,s=setTimeout(()=>i.abort(),1e4);try{let o=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:i.signal});if(clearTimeout(s),!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let a=await o.json();a.error&&g.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(g.error("Failed to send Stats event details:"),g.error(W(n)))}}async function Qp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw g.error("Cannot get the list of organizations - exiting"),g.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let i=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw g.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw g.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let s=i.length>1?await gn({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;if(st(s))throw g.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return g.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await rfe(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw g.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return s}async function Rr(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw g.error(`Cannot get organization id for app id ${e}`),W(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function su(t){return new Date(t||"").toLocaleString()}var f8=!1,Za="npm",ll="install",hb="npx";function qn(){if(f8)return{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:hb};let t=Lr((0,Un.cwd)());return Za=Du(t,"npm"),ll=Bl(Za),f8=!0,hb=g_(t),{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:hb}}function T8(t){return(0,Te.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,xe.join)(t,n.name);return n.isDirectory()?T8(i):i.split(`node_modules${xe.sep}`)[1]||i})}async function gb(t,e){let r=e?e.split(","):[],n;try{n=await Xp("",t)}catch(l){throw g.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let i=t?.split(",")[0],s=i?xe.default.resolve(i).replace(eu,""):Lr((0,Un.cwd)());if(!n)throw g.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,h]of Object.entries(n))if(typeof h!="string")throw g.error(`Invalid dependency ${l}: ${h}, expected string, got ${typeof h}`),new Error(`Invalid dependency ${l}: expected string version`);let o=r.length===0?[(0,xe.join)((0,Un.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Te.existsSync)(l))){let l=Du(s,"npm"),h=Bl(l);throw g.error(`Missing node_modules folder at ${o.join(", ")}, please run ${l} ${h}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,h])=>{let d=!1,f=!1,m=h;for(let y of o){let v=(0,xe.join)(y,l);if((0,Te.existsSync)(v)){d=!0;try{let E=(0,xe.join)(v,eu);if((0,Te.existsSync)(E)){let A=JSON.parse((0,Te.readFileSync)(E,"utf-8"));A.version&&(m=A.version)}}catch{}try{if(T8(v).some(A=>tfe.test(A))){f=!0;break}}catch(E){throw g.error(`Error reading node_modules files for ${l} package in ${y}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let y=Du(s,"npm"),v=Bl(y);return g.error(`Missing dependency ${l}, please run ${y} ${v}`),{name:l,version:h}}return{name:l,version:m,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw g.error("Missing dependencies or invalid dependencies"),g.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function afe(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),s=n;return i||s===null||!s.version||!s.version.checksum?null:s.version.checksum}function ufe(t){if(!t)throw g.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw g.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:i}=r;if(!n||typeof n!="string")throw g.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!i||typeof i!="string")throw g.error(`Invalid remote native package version: ${i}, expected string, got ${typeof i}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function I8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
299
299
  native_packages
300
300
  )`).eq("name",r).eq("app_id",e).single();if(i)throw g.error(`Error fetching native packages: ${i.message}`),new Error(`Error fetching native packages: ${i.message}`);return ufe(n.version.native_packages??[])}async function P8(t,e,r,n){let i=Ct();i.start(`Checking bundle checksum compatibility with channel ${r}`);let s=await afe(t,e,r);if(!s){i.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(s&&s===n)throw i.stop("Checksum check failed"),g.error(`Cannot upload the same bundle content.
301
301
  Current bundle checksum matches remote bundle for channel ${r}
@@ -319,13 +319,13 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
319
319
  created_by,
320
320
  app_id,
321
321
  version (id, name)
322
- `).eq("app_id",e).order("created_at",{ascending:!1});if(i)throw r||g.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function wb(t,e,r,n={}){let{silent:i=!1}=n,{error:s}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(s){let o=`App version ${e}@${r} not found in database`;throw i||g.error(o),new Error(`${o}: ${W(s)}`)}}async function tm(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await cfe(t,e,r,{silent:i});await R8(t,e,o,{silent:i,autoUnlink:s}),await wb(t,e,r,{silent:i})}function U8(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new zt;r.theme=zt.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,su(n.created_at),n.keep??""]);g.success("Bundles"),g.success(r.toString())}async function rm(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return i??[]}async function q8(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("channels").select("version").eq("app_id",e);if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return(i??[]).map(o=>o.version)}async function cfe(t,e,r,n={}){let{silent:i=!1}=n,{data:s,error:o}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!s||o){let a=`App version ${e}@${r} doesn't exist`;throw i||g.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var ou=require("node:fs");async function H8(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Et(t,e,r,n,i=!1){let s=qn(),o=await D8(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||g.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${s.runner} @capgo/cli app add ${r}\` to create it`;throw i||g.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||g.error(c),new Error(c)}}let a=o.data;if(n>a){let c=`Insuficcent permissions for app ${r}. Current permission: ${hr[o.data]}, required for this action: ${hr[n]}.`;throw i||g.error(c),new Error(c)}return o.data}var Qr="assets/icon.png";var lfe=/^[a-z0-9]+(\.[\w-]+)+$/i;function ffe(t,e,r){if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||g.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!lfe.test(t))throw r||(g.error(`Invalid app ID format: "${t}"`),g.info("App ID must be in reverse domain notation (e.g., com.example.app)"),g.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),g.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function hfe(t,e,r){if(await H8(t,e))throw e==="io.ionic.starter"?(r||g.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||g.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function V8(t,e,r,n=!1){n||ae("Adding"),await Xe(),e.apikey=e.apikey||re();let i=await de(),s=$e(t,i?.config);ffe(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await hfe(o,s,n),r||(r=await Qp(o,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||i.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||g.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||g.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,ou.existsSync)(l)?(h=(0,ou.readFileSync)(l),d=iu(l)||"image/png",n||g.warn(`Found app icon ${l}`)):(0,ou.existsSync)(Qr)?(h=(0,ou.readFileSync)(Qr),d=iu(Qr)||"image/png",n||g.warn(`Found app icon ${Qr}`)):n||g.warn(`Cannot find app icon in any of the following locations: ${l}, ${Qr}`);let f="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:v}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(v)throw n||console.error(v),n||g.error(`Could not add app ${W(v)}`),new Error(`Could not add app ${W(v)}`);let{data:E}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);m=E?.publicUrl||m}let{error:y}=await o.from("apps").insert({icon_url:m,owner_org:u,user_id:a,name:c,app_id:s});if(y)throw n||g.error(`Could not add app ${W(y)}`),new Error(`Could not add app ${W(y)}`);return n||(g.success(`App ${s} added to Capgo. You can upload a bundle now`),le("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:m}}async function z8(t,e,r=!1,n=!1){r||ae("Deleting"),e.apikey=e.apikey||re();let i=await de(),s=$e(t,i?.config);if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Et(o,e.apikey,s,5,r);let{data:u,error:c}=await o.from("apps").select("owner_org ( created_by, id )").eq("app_id",s).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==a){if(r)throw new Error("Cannot delete app: you are not the organization owner");{g.warn("Deleting the app is not recommended for users that are not the organization owner"),g.warn("You are invited as a super_admin but your are not the owner"),g.warn("It's strongly recommended that you do not continue!");let y=await gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(y)||y==="no")throw g.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&g.warn(`Cannot get the app owner ${W(c)}`);let{error:h}=await o.storage.from("images").remove([`org/${l?.owner_org.id}/${s}/icon`]);h&&!r&&g.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&g.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||g.error("Could not delete app"),new Error(`Could not delete app: ${W(f)}`);let m=await Rr(o,s);return await _e(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":s},notify:!1}).catch(()=>{}),r||(g.success("App deleted in Capgo"),le("Done \u2705")),!0}var nm=require("node:os"),G8=require("node:process");async function K8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Gh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function dfe(){let t=await Xp(),e={"@capgo/cli":Mi.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function W8(t,e=!1){e||g.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=as("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=$e("",r?.config),a=r?.config?.webDir||"";e||(g.info(` App Name: ${s}`),g.info(` App ID: ${o}`),g.info(` App Version: ${i}`),g.info(` Web Dir: ${a}`),g.info(` OS: ${(0,nm.platform)()} ${(0,nm.version)()}`),g.info(` Node: ${G8.version}`),g.info(" Installed Dependencies:"));let u=await dfe();if(Object.keys(u).length===0)throw e||g.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))g.info(` ${l}: ${u[l]}`);let c={};if(e)c=await K8(u);else{let l=Ct();l.start("Running: Loading latest dependencies"),c=await K8(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))g.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||g.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||g.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:s,appId:o,appVersion:i,webDir:a,installedDependencies:u,latestDependencies:c}}function pfe(t){let e=new zt;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,su(r.created_at)]);g.success("Apps"),g.success(e.toString())}async function mfe(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||g.error("Apps not found"),new Error("Apps not found");return r??[]}async function X8(t,e=!1){e||ae("List apps in Capgo"),await Xe(),t.apikey=t.apikey||re();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||g.info("Getting active bundle in Capgo");let n=await mfe(r,e);if(!n.length)throw e||g.error("No apps found"),new Error("No apps found");return e||(g.info(`Active app in Capgo: ${n.length}`),pfe(n),le("Done \u2705")),n}var Y8=require("node:crypto"),au=require("node:fs");async function J8(t,e,r=!1){r||ae("Set app"),e.apikey=e.apikey||re();let n=await de();if(t=$e(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),o=(await Qp(i,["admin","super_admin"])).gid,a=await De(i,e.apikey,["write","all"]);await Et(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l,exposeMetadata:h}=e;if(l&&Number.isNaN(Number(l)))throw r||g.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||g.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||g.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let d,f,m=`icon_${(0,Y8.randomUUID)()}`,y="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,au.existsSync)(c)?(d=(0,au.readFileSync)(c),f=iu(c)||"image/png",r||g.warn(`Found app icon ${c}`)):(0,au.existsSync)(Qr)?(d=(0,au.readFileSync)(Qr),f=iu(Qr)||"image/png",r||g.warn(`Found app icon ${Qr}`)):r||g.warn(`Cannot find app icon in any of the following locations: ${c}, ${Qr}`),d&&f){let{error:E}=await i.storage.from(`images/org/${o}/${t}`).upload(m,d,{contentType:f});if(E)throw r||g.error(`Could not set app ${W(E)}`),new Error(`Could not set app: ${W(E)}`);let{data:A}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(m);y=A?.publicUrl||y}let{error:v}=await i.from("apps").update({icon_url:y,name:u,retention:l?l*24*60*60:void 0,expose_metadata:h}).eq("app_id",t).eq("user_id",a);if(v)throw r||g.error(`Could not set app ${W(v)}`),new Error(`Could not set app: ${W(v)}`);return r||le("Done \u2705"),!0}async function Z8(t,e,r=!1){if(r||ae("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||g.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||g.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||g.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await de(),i=n.config,s=t.split(".");if(s.length===0)throw r||g.error("Invalid path"),new Error("Invalid config path");for(let a of s.slice(0,-1))Object.prototype.hasOwnProperty.call(i,a)||(i[a]={}),i=i[a];let o=e.bool?e.bool==="true":e.string;i[s.at(-1)]=o,await Xa(n,!0),r||g.success(`Set "${t}" to "${o}"`)}catch(n){throw r||g.error(`Cannot set config in capacitor settings ${W(n)}`),new Error(`Cannot set capacitor config: ${W(n)}`)}r||le("Done \u2705")}var vi=require("node:fs"),pn=require("node:fs/promises"),r6=require("node:os"),mn=require("node:path"),ho=ve(require("node:process"));var n6=ve(cD()),sm=ve(Kh());var im=require("node:fs/promises"),Q8=require("node:os"),vb=require("node:path"),je=require("node:process"),gfe=(0,vb.join)((0,Q8.homedir)(),".capgo-credentials"),yfe=(0,vb.join)(gfe,"credentials.json");async function Dfe(){try{let t=await(0,im.readFile)(yfe,"utf-8");return JSON.parse(t)}catch{return{}}}async function wfe(t){let e=await Dfe();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}function vfe(){let t={};return je.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=je.env.BUILD_CERTIFICATE_BASE64),je.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=je.env.BUILD_PROVISION_PROFILE_BASE64),je.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=je.env.BUILD_PROVISION_PROFILE_BASE64_PROD),je.env.P12_PASSWORD&&(t.P12_PASSWORD=je.env.P12_PASSWORD),je.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=je.env.APPLE_KEY_ID),je.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=je.env.APPLE_ISSUER_ID),je.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=je.env.APPLE_KEY_CONTENT),je.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=je.env.APPLE_PROFILE_NAME),je.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=je.env.APP_STORE_CONNECT_TEAM_ID),je.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=je.env.ANDROID_KEYSTORE_FILE),je.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=je.env.KEYSTORE_KEY_ALIAS),je.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=je.env.KEYSTORE_KEY_PASSWORD),je.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=je.env.KEYSTORE_STORE_PASSWORD),je.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=je.env.PLAY_CONFIG_JSON),t}async function e6(t,e,r){let n=await wfe(t),i=vfe(),s={...n?.[e]||{}};if(Object.assign(s,i),r&&Object.assign(s,r),e==="android"){let o=!!s.KEYSTORE_KEY_PASSWORD,a=!!s.KEYSTORE_STORE_PASSWORD;o&&!a?s.KEYSTORE_STORE_PASSWORD=s.KEYSTORE_KEY_PASSWORD:!o&&a&&(s.KEYSTORE_KEY_PASSWORD=s.KEYSTORE_STORE_PASSWORD)}return Object.keys(s).length>0?s:void 0}async function Efe(t,e,r,n,i){try{i||g.warn(`
322
+ `).eq("app_id",e).order("created_at",{ascending:!1});if(i)throw r||g.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function wb(t,e,r,n={}){let{silent:i=!1}=n,{error:s}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(s){let o=`App version ${e}@${r} not found in database`;throw i||g.error(o),new Error(`${o}: ${W(s)}`)}}async function tm(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await cfe(t,e,r,{silent:i});await R8(t,e,o,{silent:i,autoUnlink:s}),await wb(t,e,r,{silent:i})}function U8(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new zt;r.theme=zt.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,su(n.created_at),n.keep??""]);g.success("Bundles"),g.success(r.toString())}async function rm(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return i??[]}async function q8(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("channels").select("version").eq("app_id",e);if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return(i??[]).map(o=>o.version)}async function cfe(t,e,r,n={}){let{silent:i=!1}=n,{data:s,error:o}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!s||o){let a=`App version ${e}@${r} doesn't exist`;throw i||g.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var ou=require("node:fs");async function H8(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Et(t,e,r,n,i=!1){let s=qn(),o=await D8(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||g.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${s.runner} @capgo/cli app add ${r}\` to create it`;throw i||g.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||g.error(c),new Error(c)}}let a=o.data;if(n>a){let c=`Insuficcent permissions for app ${r}. Current permission: ${hr[o.data]}, required for this action: ${hr[n]}.`;throw i||g.error(c),new Error(c)}return o.data}var Qr="assets/icon.png";var lfe=/^[a-z0-9]+(\.[\w-]+)+$/i;function ffe(t,e,r){if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||g.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!lfe.test(t))throw r||(g.error(`Invalid app ID format: "${t}"`),g.info("App ID must be in reverse domain notation (e.g., com.example.app)"),g.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),g.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function hfe(t,e,r){if(await H8(t,e))throw e==="io.ionic.starter"?(r||g.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||g.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function V8(t,e,r,n=!1){n||ae("Adding"),await Xe(),e.apikey=e.apikey||re();let i=await de(),s=$e(t,i?.config);ffe(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await hfe(o,s,n),r||(r=await Qp(o,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||i.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||g.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||g.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,ou.existsSync)(l)?(h=(0,ou.readFileSync)(l),d=iu(l)||"image/png",n||g.warn(`Found app icon ${l}`)):(0,ou.existsSync)(Qr)?(h=(0,ou.readFileSync)(Qr),d=iu(Qr)||"image/png",n||g.warn(`Found app icon ${Qr}`)):n||g.warn(`Cannot find app icon in any of the following locations: ${l}, ${Qr}`);let f="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:v}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(v)throw n||console.error(v),n||g.error(`Could not add app ${W(v)}`),new Error(`Could not add app ${W(v)}`);let{data:E}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);m=E?.publicUrl||m}let{error:y}=await o.from("apps").insert({icon_url:m,owner_org:u,user_id:a,name:c,app_id:s});if(y)throw n||g.error(`Could not add app ${W(y)}`),new Error(`Could not add app ${W(y)}`);return n||(g.success(`App ${s} added to Capgo. You can upload a bundle now`),le("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:m}}async function z8(t,e,r=!1,n=!1){r||ae("Deleting"),e.apikey=e.apikey||re();let i=await de(),s=$e(t,i?.config);if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Et(o,e.apikey,s,5,r);let{data:u,error:c}=await o.from("apps").select("owner_org ( created_by, id )").eq("app_id",s).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==a){if(r)throw new Error("Cannot delete app: you are not the organization owner");{g.warn("Deleting the app is not recommended for users that are not the organization owner"),g.warn("You are invited as a super_admin but your are not the owner"),g.warn("It's strongly recommended that you do not continue!");let y=await gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(y)||y==="no")throw g.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&g.warn(`Cannot get the app owner ${W(c)}`);let{error:h}=await o.storage.from("images").remove([`org/${l?.owner_org.id}/${s}/icon`]);h&&!r&&g.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&g.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||g.error("Could not delete app"),new Error(`Could not delete app: ${W(f)}`);let m=await Rr(o,s);return await _e(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":s},notify:!1}).catch(()=>{}),r||(g.success("App deleted in Capgo"),le("Done \u2705")),!0}var nm=require("node:os"),G8=require("node:process");async function K8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Gh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function dfe(){let t=await Xp(),e={"@capgo/cli":Mi.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function W8(t,e=!1){e||g.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=as("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=$e("",r?.config),a=r?.config?.webDir||"";e||(g.info(` App Name: ${s}`),g.info(` App ID: ${o}`),g.info(` App Version: ${i}`),g.info(` Web Dir: ${a}`),g.info(` OS: ${(0,nm.platform)()} ${(0,nm.version)()}`),g.info(` Node: ${G8.version}`),g.info(" Installed Dependencies:"));let u=await dfe();if(Object.keys(u).length===0)throw e||g.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))g.info(` ${l}: ${u[l]}`);let c={};if(e)c=await K8(u);else{let l=Ct();l.start("Running: Loading latest dependencies"),c=await K8(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))g.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||g.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||g.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:s,appId:o,appVersion:i,webDir:a,installedDependencies:u,latestDependencies:c}}function pfe(t){let e=new zt;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,su(r.created_at)]);g.success("Apps"),g.success(e.toString())}async function mfe(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||g.error("Apps not found"),new Error("Apps not found");return r??[]}async function X8(t,e=!1){e||ae("List apps in Capgo"),await Xe(),t.apikey=t.apikey||re();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||g.info("Getting active bundle in Capgo");let n=await mfe(r,e);if(!n.length)throw e||g.error("No apps found"),new Error("No apps found");return e||(g.info(`Active app in Capgo: ${n.length}`),pfe(n),le("Done \u2705")),n}var Y8=require("node:crypto"),au=require("node:fs");async function J8(t,e,r=!1){r||ae("Set app"),e.apikey=e.apikey||re();let n=await de();if(t=$e(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),o=(await Qp(i,["admin","super_admin"])).gid,a=await De(i,e.apikey,["write","all"]);await Et(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l,exposeMetadata:h}=e;if(l&&Number.isNaN(Number(l)))throw r||g.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||g.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||g.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let d,f,m=`icon_${(0,Y8.randomUUID)()}`,y="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,au.existsSync)(c)?(d=(0,au.readFileSync)(c),f=iu(c)||"image/png",r||g.warn(`Found app icon ${c}`)):(0,au.existsSync)(Qr)?(d=(0,au.readFileSync)(Qr),f=iu(Qr)||"image/png",r||g.warn(`Found app icon ${Qr}`)):r||g.warn(`Cannot find app icon in any of the following locations: ${c}, ${Qr}`),d&&f){let{error:E}=await i.storage.from(`images/org/${o}/${t}`).upload(m,d,{contentType:f});if(E)throw r||g.error(`Could not set app ${W(E)}`),new Error(`Could not set app: ${W(E)}`);let{data:A}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(m);y=A?.publicUrl||y}let{error:v}=await i.from("apps").update({icon_url:y,name:u,retention:l?l*24*60*60:void 0,expose_metadata:h}).eq("app_id",t).eq("user_id",a);if(v)throw r||g.error(`Could not set app ${W(v)}`),new Error(`Could not set app: ${W(v)}`);return r||le("Done \u2705"),!0}async function Z8(t,e,r=!1){if(r||ae("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||g.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||g.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||g.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await de(),i=n.config,s=t.split(".");if(s.length===0)throw r||g.error("Invalid path"),new Error("Invalid config path");for(let a of s.slice(0,-1))Object.prototype.hasOwnProperty.call(i,a)||(i[a]={}),i=i[a];let o=e.bool?e.bool==="true":e.string;i[s.at(-1)]=o,await Xa(n,!0),r||g.success(`Set "${t}" to "${o}"`)}catch(n){throw r||g.error(`Cannot set config in capacitor settings ${W(n)}`),new Error(`Cannot set capacitor config: ${W(n)}`)}r||le("Done \u2705")}var Hn=require("node:fs"),en=require("node:fs/promises"),r6=require("node:os"),tn=require("node:path"),ho=ve(require("node:process"));var n6=ve(cD()),sm=ve(Kh());var im=require("node:fs/promises"),Q8=require("node:os"),vb=require("node:path"),je=require("node:process"),gfe=(0,vb.join)((0,Q8.homedir)(),".capgo-credentials"),yfe=(0,vb.join)(gfe,"credentials.json");async function Dfe(){try{let t=await(0,im.readFile)(yfe,"utf-8");return JSON.parse(t)}catch{return{}}}async function wfe(t){let e=await Dfe();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}function vfe(){let t={};return je.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=je.env.BUILD_CERTIFICATE_BASE64),je.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=je.env.BUILD_PROVISION_PROFILE_BASE64),je.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=je.env.BUILD_PROVISION_PROFILE_BASE64_PROD),je.env.P12_PASSWORD&&(t.P12_PASSWORD=je.env.P12_PASSWORD),je.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=je.env.APPLE_KEY_ID),je.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=je.env.APPLE_ISSUER_ID),je.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=je.env.APPLE_KEY_CONTENT),je.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=je.env.APPLE_PROFILE_NAME),je.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=je.env.APP_STORE_CONNECT_TEAM_ID),je.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=je.env.ANDROID_KEYSTORE_FILE),je.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=je.env.KEYSTORE_KEY_ALIAS),je.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=je.env.KEYSTORE_KEY_PASSWORD),je.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=je.env.KEYSTORE_STORE_PASSWORD),je.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=je.env.PLAY_CONFIG_JSON),t}async function e6(t,e,r){let n=await wfe(t),i=vfe(),s={...n?.[e]||{}};if(Object.assign(s,i),r&&Object.assign(s,r),e==="android"){let o=!!s.KEYSTORE_KEY_PASSWORD,a=!!s.KEYSTORE_STORE_PASSWORD;o&&!a?s.KEYSTORE_STORE_PASSWORD=s.KEYSTORE_KEY_PASSWORD:!o&&a&&(s.KEYSTORE_KEY_PASSWORD=s.KEYSTORE_STORE_PASSWORD)}return Object.keys(s).length>0?s:void 0}async function Efe(t,e,r,n,i){try{i||g.warn(`
323
323
  \u26A0\uFE0F Cancelling build...`);let s=await fetch(`${t}/build/cancel/${e}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:n},body:JSON.stringify({app_id:r})});if(!s.ok){let a=await s.text();i||g.warn(`Could not cancel build: ${a}`);return}let o=await s.json();i||g.info(`Build cancelled (status: ${o.status})`)}catch(s){i||g.warn(`Failed to cancel build: ${s instanceof Error?s.message:String(s)}`)}}async function bfe(t,e,r,n,i){if(i)return null;let s=Ct(),o=null;try{let a=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!a.ok)return g.warn("Could not stream logs, continuing..."),null;let u=a.body?.getReader();if(!u)return null;s.start("Waiting for build logs...");let c=new TextDecoder,l="",h=d=>{if(!d.trim())return;let f=d.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(f){o=f[1].toLowerCase();return}o||(s.stop(d,0),s.start("Building..."))};for(;;){let{done:d,value:f}=await u.read();if(d)break;l+=c.decode(f,{stream:!0});let m=l.split(`
324
- `);l=m.pop()||"";for(let y of m)if(y.startsWith("data: ")){let v=y.slice(6);h(v)}}if(l.startsWith("data: ")){let d=l.slice(6);h(d)}return s.stop(),o}catch(a){return s.stop("Log streaming ended"),i||g.warn(`Log streaming interrupted${a instanceof Error?`: ${a.message}`:""}`),null}}async function _fe(t,e,r,n,i,s){let a=0;for(;a<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:i}});if(!u.ok){s||g.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),a++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),a++}catch(u){s||g.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),a++}return s||g.warn("Build status polling timed out"),"timeout"}async function Cfe(t,e){let r=new Set;if(e==="ios"){let n=(0,mn.join)(t,"ios/App/Podfile");if((0,vi.existsSync)(n)){let s=(await(0,pn.readFile)(n,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let o of s){let a=o[1];r.add(`node_modules/${a}/Package.swift`),r.add(`node_modules/${a}/*.podspec`),r.add(`node_modules/${a}/ios/`)}}}else if(e==="android"){let n=(0,mn.join)(t,"android/capacitor.settings.gradle");if((0,vi.existsSync)(n)){let s=(await(0,pn.readFile)(n,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let o of s){let u=o[1].replace(/\/android$/,"");r.add(`node_modules/${u}/android/`)}}}return r}function t6(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let i of r)if(n.startsWith(i))return!0;return!1}function hl(t,e,r,n,i){let s=(0,vi.readdirSync)(e);for(let o of s){let a=(0,mn.join)(e,o),u=r?`${r}/${o}`:o,c=(0,vi.statSync)(a);if(c.isDirectory()){if(o===".git"||o==="dist"||o==="build"||o===".angular"||o===".vite")continue;if(o===n){hl(t,a,u,n,i);continue}if(o==="node_modules"){hl(t,a,u,n,i);continue}if(o==="resources"){hl(t,a,u,n,i);continue}let l=u.replace(/\\/g,"/");(t6(u,n,i)||Array.from(i).some(d=>d.startsWith(`${l}/`)))&&hl(t,a,u,n,i)}else if(c.isFile()){if(o===".DS_Store"||o.endsWith(".log"))continue;t6(u,n,i)&&t.addLocalFile(a,r||void 0)}}}async function Sfe(t,e,r){let n=await Cfe(t,r),i=new n6.default;hl(i,t,"",r,n),await(0,pn.writeFile)(e,i.toBuffer())}async function i6(t,e,r=!1){let n=Date.now(),i=e.verbose??!1;try{e.apikey=e.apikey||re(r);let s=await de();if(t=t||s?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let o=(0,mn.resolve)(e.path||ho.default.cwd()),a=e.supaHost||"https://api.capgo.app",u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]);let c=await Rr(u,t);r||(g.info(`Requesting native build for ${t}`),g.info(`Platform: ${e.platform}`),g.info(`Project: ${o}`),g.info(`
324
+ `);l=m.pop()||"";for(let y of m)if(y.startsWith("data: ")){let v=y.slice(6);h(v)}}if(l.startsWith("data: ")){let d=l.slice(6);h(d)}return s.stop(),o}catch(a){return s.stop("Log streaming ended"),i||g.warn(`Log streaming interrupted${a instanceof Error?`: ${a.message}`:""}`),null}}async function _fe(t,e,r,n,i,s){let a=0;for(;a<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:i}});if(!u.ok){s||g.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),a++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),a++}catch(u){s||g.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),a++}return s||g.warn("Build status polling timed out"),"timeout"}async function Cfe(t,e){let r=new Set,n=!1;if(e==="ios"){let i=(0,tn.join)(t,"ios/App/CapApp-SPM/Package.swift");if((0,Hn.existsSync)(i)){n=!0;let o=(await(0,en.readFile)(i,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.\/)*node_modules\/([^"']+)["']\s*\)/g);for(let a of o)r.add(a[1])}else{let s=(0,tn.join)(t,"ios/App/Podfile");if((0,Hn.existsSync)(s)){let a=(await(0,en.readFile)(s,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let u of a)r.add(u[1])}}}else if(e==="android"){let i=(0,tn.join)(t,"android/capacitor.settings.gradle");if((0,Hn.existsSync)(i)){let o=(await(0,en.readFile)(i,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of o){let c=a[1].replace(/\/android$/,"");r.add(c)}}}return{packages:r,usesSPM:n}}function t6(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let i of r.packages){let s=`node_modules/${i}/`;if(e==="android"){if(n.startsWith(`${s}android/`))return!0}else if(e==="ios"){if(n.startsWith(`${s}ios/`))return!0;if(r.usesSPM){if(n===`${s}Package.swift`)return!0}else if(n.startsWith(s)&&n.endsWith(".podspec"))return!0}}return!1}function hl(t,e,r,n,i){let s=(0,Hn.readdirSync)(e);for(let o of s){let a=(0,tn.join)(e,o),u=r?`${r}/${o}`:o,c=(0,Hn.statSync)(a);if(c.isDirectory()){if(o===".git"||o==="dist"||o==="build"||o===".angular"||o===".vite")continue;if(o===n){hl(t,a,u,n,i);continue}if(o==="node_modules"){hl(t,a,u,n,i);continue}if(o==="resources"){hl(t,a,u,n,i);continue}let l=u.replace(/\\/g,"/");(t6(u,n,i)||Array.from(i.packages).some(d=>`node_modules/${d}/`.startsWith(`${l}/`)||l.startsWith(`node_modules/${d}`)))&&hl(t,a,u,n,i)}else if(c.isFile()){if(o===".DS_Store"||o.endsWith(".log"))continue;t6(u,n,i)&&t.addLocalFile(a,r||void 0)}}}async function Sfe(t,e,r){let n=await Cfe(t,r),i=new n6.default;hl(i,t,"",r,n),await(0,en.writeFile)(e,i.toBuffer())}async function i6(t,e,r=!1){let n=Date.now(),i=e.verbose??!1;try{e.apikey=e.apikey||re(r);let s=await de();if(t=t||s?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let o=(0,tn.resolve)(e.path||ho.default.cwd()),a=e.supaHost||"https://api.capgo.app",u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]);let c=await Rr(u,t);r||(g.info(`Requesting native build for ${t}`),g.info(`Platform: ${e.platform}`),g.info(`Project: ${o}`),g.info(`
325
325
  \u{1F512} Security: Credentials are never stored on Capgo servers`),g.info(" They are used only during build and deleted after (max 24h)"),g.info(` Builds sent directly to app stores - Capgo keeps nothing
326
- `)),i&&g.info(`API host: ${a}`);let l={};e.buildCertificateBase64&&(l.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(l.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(l.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(l.P12_PASSWORD=e.p12Password),e.appleKeyId&&(l.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(l.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(l.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(l.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(l.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(l.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(l.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let h=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;h&&!d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!h&&d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):h&&d&&(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(l.PLAY_CONFIG_JSON=e.playConfigJson);let f=await e6(t,e.platform,Object.keys(l).length>0?l:void 0),m={app_id:t,platform:e.platform};if(!f)throw r||(g.error("\u274C No credentials found for this app and platform"),g.error(""),g.error("You must provide credentials via:"),g.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),g.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),g.error(" 3. Saved credentials file:"),g.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),g.error(""),g.error("Documentation:"),g.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let y=[];if(e.platform==="ios"?(f.BUILD_CERTIFICATE_BASE64||y.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!f.P12_PASSWORD&&!r&&(g.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),g.warn(" If your certificate requires a password, provide it with --p12-password")),f.BUILD_PROVISION_PROFILE_BASE64||y.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),f.APPLE_KEY_ID||y.push("APPLE_KEY_ID (or --apple-key-id)"),f.APPLE_ISSUER_ID||y.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),f.APPLE_KEY_CONTENT||y.push("APPLE_KEY_CONTENT (or --apple-key-content)"),f.APP_STORE_CONNECT_TEAM_ID||y.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(f.ANDROID_KEYSTORE_FILE||y.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),f.KEYSTORE_KEY_ALIAS||y.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!f.KEYSTORE_KEY_PASSWORD&&!f.KEYSTORE_STORE_PASSWORD&&y.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!f.PLAY_CONFIG_JSON&&!r&&g.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),y.length>0){if(!r){g.error(`\u274C Missing required credentials for ${e.platform}:`),g.error("");for(let D of y)g.error(` \u2022 ${D}`);g.error(""),g.error("Provide credentials via:"),g.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),g.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),g.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),g.error(""),g.error("Documentation:"),g.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${y.join(", ")}`)}if(m.credentials=f,r||g.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),i){let D=Object.keys(f).filter(w=>f[w]);g.info(`Credentials provided: ${D.join(", ")}`)}r||g.info("Requesting build from Capgo...");let v=await fetch(`${a}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(m)});if(!v.ok){let D=await v.text();throw new Error(`Failed to request build: ${v.status} - ${D}`)}let E=await v.json();r||(g.success(`Build job created: ${E.job_id}`),g.info(`Status: ${E.status}`)),i&&(g.info(`Upload URL: ${E.upload_url}`),g.info(`Upload expires: ${E.upload_expires_at}`)),await _e(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let A=(0,mn.join)((0,r6.tmpdir)(),`capgo-build-${Date.now()}`);await(0,pn.mkdir)(A,{recursive:!0});let p=(0,mn.join)(A,`${(0,mn.basename)(o)}.zip`);try{r||g.info(`Zipping ${e.platform} project from ${o}...`),await Sfe(o,p,e.platform);let w=((await(0,pn.stat)(p)).size/1024/1024).toFixed(2);r||g.success(`Created zip: ${p} (${w} MB)`),r||g.info("Uploading to builder..."),i&&(g.info(`Upload endpoint: ${E.upload_url}`),g.info(`File size: ${w} MB`),g.info(`Job ID: ${E.job_id}`));let C=(0,vi.readFileSync)(p),F=Ct();r||F.start("Uploading bundle"),await new Promise((z,L)=>{let S=new sm.Upload(C,{endpoint:E.upload_url,chunkSize:5242880,metadata:{filename:(0,mn.basename)(p),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(T){if(i){g.info(`[TUS] ${T.getMethod()} ${T.getURL()}`);let P=T.getHeader("authorization");g.info(`[TUS] Authorization header present: ${!!P}`)}},onAfterResponse(T,P){if(i){g.info(`[TUS] Response status: ${P.getStatus()}`);let $=P.getHeader("upload-offset"),q=P.getHeader("tus-resumable");g.info(`[TUS] Upload-Offset: ${$}, Tus-Resumable: ${q}`)}},onError(T){if(r||(F.stop("Upload failed"),g.error(`Upload error: ${T.message}`)),T instanceof sm.DetailedError){let P=T.originalResponse?.getBody(),$=T.originalResponse?.getStatus(),q=T.originalRequest?.getURL();i&&(g.error(`[TUS] Request URL: ${q}`),g.error(`[TUS] Response status: ${$}`),g.error(`[TUS] Response body: ${P}`));let M="Unknown error";try{let G=JSON.parse(P||'{"error": "unknown error"}');M=G.status||G.error||G.message||"unknown error"}catch{M=P||T.message}L(new Error(`TUS upload failed: ${M}`))}else L(new Error(`TUS upload failed: ${T.message||T.toString()}`))},onProgress(T,P){let $=(T/P*100).toFixed(2);r||F.message(`Uploading ${$}%`)},onSuccess(){r||F.stop("Upload complete!"),i&&g.success("TUS upload completed successfully"),z()}});i&&g.info("[TUS] Starting upload..."),S.start()}),r||g.info("Starting build job...");let b=await fetch(`${a}/build/start/${E.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!b.ok){let z=await b.text();throw new Error(`Failed to start build: ${b.status} - ${z}`)}let k=await b.json();r||(g.success("Build started!"),g.info(`Streaming build logs...
326
+ `)),i&&g.info(`API host: ${a}`);let l={};e.buildCertificateBase64&&(l.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(l.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(l.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(l.P12_PASSWORD=e.p12Password),e.appleKeyId&&(l.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(l.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(l.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(l.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(l.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(l.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(l.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let h=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;h&&!d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!h&&d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):h&&d&&(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(l.PLAY_CONFIG_JSON=e.playConfigJson);let f=await e6(t,e.platform,Object.keys(l).length>0?l:void 0),m={app_id:t,platform:e.platform};if(!f)throw r||(g.error("\u274C No credentials found for this app and platform"),g.error(""),g.error("You must provide credentials via:"),g.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),g.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),g.error(" 3. Saved credentials file:"),g.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),g.error(""),g.error("Documentation:"),g.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let y=[];if(e.platform==="ios"?(f.BUILD_CERTIFICATE_BASE64||y.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!f.P12_PASSWORD&&!r&&(g.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),g.warn(" If your certificate requires a password, provide it with --p12-password")),f.BUILD_PROVISION_PROFILE_BASE64||y.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),f.APPLE_KEY_ID||y.push("APPLE_KEY_ID (or --apple-key-id)"),f.APPLE_ISSUER_ID||y.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),f.APPLE_KEY_CONTENT||y.push("APPLE_KEY_CONTENT (or --apple-key-content)"),f.APP_STORE_CONNECT_TEAM_ID||y.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(f.ANDROID_KEYSTORE_FILE||y.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),f.KEYSTORE_KEY_ALIAS||y.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!f.KEYSTORE_KEY_PASSWORD&&!f.KEYSTORE_STORE_PASSWORD&&y.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!f.PLAY_CONFIG_JSON&&!r&&g.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),y.length>0){if(!r){g.error(`\u274C Missing required credentials for ${e.platform}:`),g.error("");for(let D of y)g.error(` \u2022 ${D}`);g.error(""),g.error("Provide credentials via:"),g.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),g.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),g.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),g.error(""),g.error("Documentation:"),g.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${y.join(", ")}`)}if(m.credentials=f,r||g.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),i){let D=Object.keys(f).filter(w=>f[w]);g.info(`Credentials provided: ${D.join(", ")}`)}r||g.info("Requesting build from Capgo...");let v=await fetch(`${a}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(m)});if(!v.ok){let D=await v.text();throw new Error(`Failed to request build: ${v.status} - ${D}`)}let E=await v.json();r||(g.success(`Build job created: ${E.job_id}`),g.info(`Status: ${E.status}`)),i&&(g.info(`Upload URL: ${E.upload_url}`),g.info(`Upload expires: ${E.upload_expires_at}`)),await _e(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let A=(0,tn.join)((0,r6.tmpdir)(),`capgo-build-${Date.now()}`);await(0,en.mkdir)(A,{recursive:!0});let p=(0,tn.join)(A,`${(0,tn.basename)(o)}.zip`);try{r||g.info(`Zipping ${e.platform} project from ${o}...`),await Sfe(o,p,e.platform);let w=((await(0,en.stat)(p)).size/1024/1024).toFixed(2);r||g.success(`Created zip: ${p} (${w} MB)`),r||g.info("Uploading to builder..."),i&&(g.info(`Upload endpoint: ${E.upload_url}`),g.info(`File size: ${w} MB`),g.info(`Job ID: ${E.job_id}`));let C=(0,Hn.readFileSync)(p),F=Ct();r||F.start("Uploading bundle"),await new Promise((z,L)=>{let S=new sm.Upload(C,{endpoint:E.upload_url,chunkSize:5242880,metadata:{filename:(0,tn.basename)(p),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(T){if(i){g.info(`[TUS] ${T.getMethod()} ${T.getURL()}`);let P=T.getHeader("authorization");g.info(`[TUS] Authorization header present: ${!!P}`)}},onAfterResponse(T,P){if(i){g.info(`[TUS] Response status: ${P.getStatus()}`);let $=P.getHeader("upload-offset"),q=P.getHeader("tus-resumable");g.info(`[TUS] Upload-Offset: ${$}, Tus-Resumable: ${q}`)}},onError(T){if(r||(F.stop("Upload failed"),g.error(`Upload error: ${T.message}`)),T instanceof sm.DetailedError){let P=T.originalResponse?.getBody(),$=T.originalResponse?.getStatus(),q=T.originalRequest?.getURL();i&&(g.error(`[TUS] Request URL: ${q}`),g.error(`[TUS] Response status: ${$}`),g.error(`[TUS] Response body: ${P}`));let M="Unknown error";try{let G=JSON.parse(P||'{"error": "unknown error"}');M=G.status||G.error||G.message||"unknown error"}catch{M=P||T.message}L(new Error(`TUS upload failed: ${M}`))}else L(new Error(`TUS upload failed: ${T.message||T.toString()}`))},onProgress(T,P){let $=(T/P*100).toFixed(2);r||F.message(`Uploading ${$}%`)},onSuccess(){r||F.stop("Upload complete!"),i&&g.success("TUS upload completed successfully"),z()}});i&&g.info("[TUS] Starting upload..."),S.start()}),r||g.info("Starting build job...");let b=await fetch(`${a}/build/start/${E.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!b.ok){let z=await b.text();throw new Error(`Failed to start build: ${b.status} - ${z}`)}let k=await b.json();r||(g.success("Build started!"),g.info(`Streaming build logs...
327
327
  `),g.info(`Press Ctrl+C to cancel the build
328
- `));let R=!1,I=async()=>{R||(R=!0,await Efe(a,E.job_id,t,e.apikey,r),ho.default.exit(130))};ho.default.on("SIGINT",I),ho.default.on("SIGTERM",I);let B;try{let z=await bfe(a,E.job_id,t,e.apikey,r);z?B=z:B=await _fe(a,E.job_id,t,e.platform,e.apikey,r)}finally{ho.default.off("SIGINT",I),ho.default.off("SIGTERM",I)}r||(B==="succeeded"?g.success("Build completed successfully!"):B==="failed"?g.error("Build failed"):g.warn(`Build finished with status: ${B}`));let j=((Date.now()-n)/1e3).toFixed(2);return await _e(e.apikey,{channel:"native-builder",event:B==="succeeded"?"Build succeeded":"Build failed",icon:B==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:B||"unknown",time:j},notify:!1}).catch(),{success:B==="succeeded",jobId:E.job_id,uploadUrl:E.upload_url,status:B||k.status||E.status}}finally{await(0,pn.rm)(A,{recursive:!0,force:!0})}}catch(s){let o=s instanceof Error?s.message:String(s);return r||g.error(o),{success:!1,error:o}}}async function Afe(t,e,r,n){for await(let i of t)n||g.warn(`Removing ${i.name} created on ${su(i.created_at)}`),await tm(e,r,i.name)}function Ofe(t,e,r){let n=[];for(let i of t??[]){let s=lt(i.name);Wm(s,e)&&ds(s,r)&&n.push(i)}return n}async function s6(t,e,r=!1){r||ae("Cleanup versions in Capgo"),await Xe(),e.apikey=e.apikey||re();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=$e(t,a?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]),await Et(u,e.apikey,t,3,r),r||g.info("Querying all available versions in Capgo");let c=await rm(u,t),l=await q8(u,t);if(r||g.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||g.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=lt(n),m=Eu(f,"major");r||g.info(`Querying available versions in Capgo between ${rn(f)} and ${rn(m)}`),c=Ofe(c,f,m),r||g.info(`Active versions in Capgo between ${rn(f)} and ${rn(m)}: ${c?.length??0}`)}let h=[],d=0;for(let f of c){let m=l.find(y=>y===f.id);d<i||m&&!o?(f.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(f.keep="\u274C",h.push(f))}if(!h.length)return r||g.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||U8(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await Pr({message:"Do you want to continue removing the versions specified?"});if(st(f)||!f)throw g.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||g.success("You have confirmed removal, removing versions now"),await Afe(h,u,t,r),r||le("Done \u2705"),{removed:h.length,kept:d}}async function o6(t,e,r=!1){r||ae("Check compatibility");let n={...e,apikey:e.apikey||re()},i=await de(),s=$e(t,i?.config),o=n.channel;if(!o)throw r||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let a=await pe(n.apikey,n.supaHost,n.supaAnon);await De(a,n.apikey,["write","all","read","upload"]),await Et(a,n.apikey,s,1,r);let u=await em(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new zt;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=zt.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",h=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:f,localVersion:m,remoteVersion:y}=d,v=fo(d)?l:h;c.rows.push([f,m,y,v])}g.success("Compatibility"),g.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var _i=require("node:fs");var Ei=require("node:buffer"),Ut=require("node:crypto"),u6="aes-128-cbc",bi="base64",a6="hex",dl=Ut.constants.RSA_PKCS1_PADDING;function om(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(bi),i=(0,Ut.privateEncrypt)({key:t,padding:dl},r).toString(bi);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function uu(t,e,r){let[n]=r.split(":"),i=Ei.Buffer.from(n,bi),s=(0,Ut.createCipheriv)(u6,e,i);return s.setAutoPadding(!0),Ei.Buffer.concat([s.update(t),s.final()])}function c6(t,e,r){let[n,i]=e.split(":"),s=(0,Ut.publicDecrypt)({key:r,padding:dl},Ei.Buffer.from(i,bi)),o=Ei.Buffer.from(n,bi),a=(0,Ut.createDecipheriv)(u6,s,o);return a.setAutoPadding(!0),Ei.Buffer.concat([a.update(t),a.final()])}function cu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},Ei.Buffer.from(t,bi)).toString(bi)}function am(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},Ei.Buffer.from(t,a6)).toString(a6)}function l6(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,Ut.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function f6(t,e){return(0,Ut.publicDecrypt)({key:e,padding:dl},Ei.Buffer.from(t,bi)).toString(bi)}function h6(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,4):""}function xfe(t,e){let r=t.key||wi,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,_i.existsSync)(r)?n=(0,_i.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function d6(t,e,r,n=!1){n||ae("Decrypt zip file");try{if(await Xe(),!(0,_i.existsSync)(t)){let h=`Zip not found at the path ${t}`;throw n||g.error(h),new Error(h)}let i=await de();if(!r.key&&!(0,_i.existsSync)(wi)&&!i.config.plugins?.CapacitorUpdater?.publicKey){let h=`Public Key not found at the path ${wi} or in ${i.path}`;throw n||g.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=xfe(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||g.error(h),new Error(h)}let a=(0,_i.readFileSync)(t),u=c6(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,_i.writeFileSync)(c,u),n||g.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await ri(u,"sha256"),d=f6(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||g.error(f),new Error(f)}n||g.info("Checksum matches")}return n||le("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||g.error(`Error decrypting zip file ${W(i)}`),i instanceof Error?i:new Error(String(i))}}async function p6(t,e,r,n=!1){n||ae("Delete bundle"),r.apikey=r.apikey||re();let i=await de();if(e=$e(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);return await De(s,r.apikey,["write","all"]),await Et(s,r.apikey,e,3,n),n||(g.info(`Deleting bundle ${e}@${t} from Capgo`),g.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await tm(s,e,t),n||(g.success(`Bundle ${e}@${t} deleted in Capgo`),le("Done")),!0}var Ci=require("node:fs");function pl(t){console.error(W(t))}async function m6(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(ae("Encryption"),await Xe());try{let o=await de(),a=!!o.config.plugins?.CapacitorUpdater?.privateKey,u=!!o.config.plugins?.CapacitorUpdater?.publicKey;if(a&&s&&g.warning("There is still a privateKey in the config"),!(0,Ci.existsSync)(t)){let E=`Zip not found at the path ${t}`;throw n||(i?pl({error:"zip_not_found"}):g.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(i?pl({error:"missing_public_key"}):g.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||$r,l=r.keyData||"";if(!(0,Ci.existsSync)(c)&&!l)throw n||(i?pl({error:"missing_key"}):(g.warning(`Cannot find a private key at ${c} or as a keyData option`),g.error("Error: Missing key"))),new Error("Missing private key");if((0,Ci.existsSync)(c)&&(l=(0,Ci.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?pl({error:"invalid_private_key"}):g.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let h=(0,Ci.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=om(l),m=uu(h,d,f),y=cu(e,l),v=`${t}_encrypted.zip`;return(0,Ci.writeFileSync)(v,m),n||(i?console.log(JSON.stringify({checksum:y,filename:v,ivSessionKey:f},null,2)):(g.success(`Encoded Checksum: ${y}`),g.success(`ivSessionKey: ${f}`),g.success(`Encrypted zip saved at ${v}`),le("Done \u2705"))),{checksum:y,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?pl(o):g.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var zU=require("node:crypto"),bo=require("node:fs"),bm=require("node:process");var um=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(i,s){let o=0;for(;o<i.length;){let a=e-n,u=Math.min(a,i.length-o);r.set(i.subarray(o,o+u),n),o+=u,n+=u,n===e&&(s.enqueue(r),r=new Uint8Array(e),n=0)}},flush(i){n>0&&i.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function ls(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(c()||l("?>"));){let f=s();if(!f)return d;d.attributes[f.name]=f.value}return u(/\?>\s*/),d}function n(){let h=u(/^<([\w-:.]+)\s*/);if(!h)return;let d={name:h[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=s();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=i();let f;for(;f=n();)d.children.push(f);return u(/^<\/[\w-:.]+>\s*/),d}function i(){let h=u(/^([^<]*)/);return h?a(h[1]):""}function s(){let h=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(h)return{name:h[1],value:a(o(h[2]))}}function o(h){return h.replace(/^['"]|['"]$/g,"")}function a(h){return h.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(h){let d=t.match(h);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(h){return t.startsWith(h)}}var Hn=class extends Error{};var Jt=class extends Hn{},ml=class extends Hn{},cm=class extends Hn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Vn=class extends Hn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},fs=class extends Hn{constructor(){super("accessKey is required")}},lu=class extends Hn{constructor(){super("secretKey is required")}},gl=class extends Hn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},Si=class extends Hn{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,i={}){super(n),this.statusCode=e,this.code=r,this.key=i.key,this.bucketName=i.bucketName,this.resource=i.resource,this.region=i.region}};async function g6(t){try{let r=ls(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",i=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(c=>c.name==="Key")?.content,o=r.children.find(c=>c.name==="BucketName")?.content,a=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new Si(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new Si(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function y6(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function D6(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function hs(t){return!(!Tfe(t)||t.length===0)}function Tfe(t){return!(typeof t!="string"||t.length>1024)}function yl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function po(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function bb(t){return t.get("x-amz-version-id")??null}function mo(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function _b(t){return mo(t).slice(0,8)}function Cb(t,e){return`${_b(e)}/${t}/s3/aws4_request`}async function lm(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),yl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Ife=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],fm=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:i,metadata:s}){let o,a=1,u,c=[],l,h=[];super({start(){},async write(d,f){let y=a++;try{if(y==1&&d.length<i){let A=await e.makeRequest({method:"PUT",headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});o={etag:po(A.headers.get("etag")??void 0),versionId:bb(A.headers)};return}y===1&&(u=(await Pfe({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Ife){let p=s[A];p&&(v[A]=p)}let E=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(v),bucketName:r,objectName:n,payload:d}).then(A=>{let p=A.headers.get("etag")??"";return p&&(p=p.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:p}),A});h.push(E.catch(A=>{l||(l=A)}))}catch(v){throw v}},async close(){if(!o)if(u){if(await Promise.all(h),l)throw l;c.sort((d,f)=>d.part>f.part?1:-1),o=await Ffe({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(o===void 0)throw new Error("Result is not ready. await the stream first.");return o}}};async function Pfe(t){let e="POST",r=new Headers(t.metadata),s=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),o=ls(s).root;if(!o||o.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let a=o.children.find(u=>u.name==="UploadId")?.content;if(!a)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:a}}async function Ffe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
328
+ `));let R=!1,I=async()=>{R||(R=!0,await Efe(a,E.job_id,t,e.apikey,r),ho.default.exit(130))};ho.default.on("SIGINT",I),ho.default.on("SIGTERM",I);let B;try{let z=await bfe(a,E.job_id,t,e.apikey,r);z?B=z:B=await _fe(a,E.job_id,t,e.platform,e.apikey,r)}finally{ho.default.off("SIGINT",I),ho.default.off("SIGTERM",I)}r||(B==="succeeded"?g.success("Build completed successfully!"):B==="failed"?g.error("Build failed"):g.warn(`Build finished with status: ${B}`));let j=((Date.now()-n)/1e3).toFixed(2);return await _e(e.apikey,{channel:"native-builder",event:B==="succeeded"?"Build succeeded":"Build failed",icon:B==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:B||"unknown",time:j},notify:!1}).catch(),{success:B==="succeeded",jobId:E.job_id,uploadUrl:E.upload_url,status:B||k.status||E.status}}finally{await(0,en.rm)(A,{recursive:!0,force:!0})}}catch(s){let o=s instanceof Error?s.message:String(s);return r||g.error(o),{success:!1,error:o}}}async function Afe(t,e,r,n){for await(let i of t)n||g.warn(`Removing ${i.name} created on ${su(i.created_at)}`),await tm(e,r,i.name)}function Ofe(t,e,r){let n=[];for(let i of t??[]){let s=lt(i.name);Wm(s,e)&&ds(s,r)&&n.push(i)}return n}async function s6(t,e,r=!1){r||ae("Cleanup versions in Capgo"),await Xe(),e.apikey=e.apikey||re();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=$e(t,a?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]),await Et(u,e.apikey,t,3,r),r||g.info("Querying all available versions in Capgo");let c=await rm(u,t),l=await q8(u,t);if(r||g.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||g.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=lt(n),m=Eu(f,"major");r||g.info(`Querying available versions in Capgo between ${sn(f)} and ${sn(m)}`),c=Ofe(c,f,m),r||g.info(`Active versions in Capgo between ${sn(f)} and ${sn(m)}: ${c?.length??0}`)}let h=[],d=0;for(let f of c){let m=l.find(y=>y===f.id);d<i||m&&!o?(f.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(f.keep="\u274C",h.push(f))}if(!h.length)return r||g.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||U8(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await Pr({message:"Do you want to continue removing the versions specified?"});if(st(f)||!f)throw g.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||g.success("You have confirmed removal, removing versions now"),await Afe(h,u,t,r),r||le("Done \u2705"),{removed:h.length,kept:d}}async function o6(t,e,r=!1){r||ae("Check compatibility");let n={...e,apikey:e.apikey||re()},i=await de(),s=$e(t,i?.config),o=n.channel;if(!o)throw r||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let a=await pe(n.apikey,n.supaHost,n.supaAnon);await De(a,n.apikey,["write","all","read","upload"]),await Et(a,n.apikey,s,1,r);let u=await em(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new zt;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=zt.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",h=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:f,localVersion:m,remoteVersion:y}=d,v=fo(d)?l:h;c.rows.push([f,m,y,v])}g.success("Compatibility"),g.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var _i=require("node:fs");var Ei=require("node:buffer"),Ut=require("node:crypto"),u6="aes-128-cbc",bi="base64",a6="hex",dl=Ut.constants.RSA_PKCS1_PADDING;function om(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(bi),i=(0,Ut.privateEncrypt)({key:t,padding:dl},r).toString(bi);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function uu(t,e,r){let[n]=r.split(":"),i=Ei.Buffer.from(n,bi),s=(0,Ut.createCipheriv)(u6,e,i);return s.setAutoPadding(!0),Ei.Buffer.concat([s.update(t),s.final()])}function c6(t,e,r){let[n,i]=e.split(":"),s=(0,Ut.publicDecrypt)({key:r,padding:dl},Ei.Buffer.from(i,bi)),o=Ei.Buffer.from(n,bi),a=(0,Ut.createDecipheriv)(u6,s,o);return a.setAutoPadding(!0),Ei.Buffer.concat([a.update(t),a.final()])}function cu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},Ei.Buffer.from(t,bi)).toString(bi)}function am(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},Ei.Buffer.from(t,a6)).toString(a6)}function l6(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,Ut.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function f6(t,e){return(0,Ut.publicDecrypt)({key:e,padding:dl},Ei.Buffer.from(t,bi)).toString(bi)}function h6(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,4):""}function xfe(t,e){let r=t.key||vi,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,_i.existsSync)(r)?n=(0,_i.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function d6(t,e,r,n=!1){n||ae("Decrypt zip file");try{if(await Xe(),!(0,_i.existsSync)(t)){let h=`Zip not found at the path ${t}`;throw n||g.error(h),new Error(h)}let i=await de();if(!r.key&&!(0,_i.existsSync)(vi)&&!i.config.plugins?.CapacitorUpdater?.publicKey){let h=`Public Key not found at the path ${vi} or in ${i.path}`;throw n||g.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=xfe(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||g.error(h),new Error(h)}let a=(0,_i.readFileSync)(t),u=c6(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,_i.writeFileSync)(c,u),n||g.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await ni(u,"sha256"),d=f6(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||g.error(f),new Error(f)}n||g.info("Checksum matches")}return n||le("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||g.error(`Error decrypting zip file ${W(i)}`),i instanceof Error?i:new Error(String(i))}}async function p6(t,e,r,n=!1){n||ae("Delete bundle"),r.apikey=r.apikey||re();let i=await de();if(e=$e(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);return await De(s,r.apikey,["write","all"]),await Et(s,r.apikey,e,3,n),n||(g.info(`Deleting bundle ${e}@${t} from Capgo`),g.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await tm(s,e,t),n||(g.success(`Bundle ${e}@${t} deleted in Capgo`),le("Done")),!0}var Ci=require("node:fs");function pl(t){console.error(W(t))}async function m6(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(ae("Encryption"),await Xe());try{let o=await de(),a=!!o.config.plugins?.CapacitorUpdater?.privateKey,u=!!o.config.plugins?.CapacitorUpdater?.publicKey;if(a&&s&&g.warning("There is still a privateKey in the config"),!(0,Ci.existsSync)(t)){let E=`Zip not found at the path ${t}`;throw n||(i?pl({error:"zip_not_found"}):g.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(i?pl({error:"missing_public_key"}):g.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||$r,l=r.keyData||"";if(!(0,Ci.existsSync)(c)&&!l)throw n||(i?pl({error:"missing_key"}):(g.warning(`Cannot find a private key at ${c} or as a keyData option`),g.error("Error: Missing key"))),new Error("Missing private key");if((0,Ci.existsSync)(c)&&(l=(0,Ci.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?pl({error:"invalid_private_key"}):g.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let h=(0,Ci.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=om(l),m=uu(h,d,f),y=cu(e,l),v=`${t}_encrypted.zip`;return(0,Ci.writeFileSync)(v,m),n||(i?console.log(JSON.stringify({checksum:y,filename:v,ivSessionKey:f},null,2)):(g.success(`Encoded Checksum: ${y}`),g.success(`ivSessionKey: ${f}`),g.success(`Encrypted zip saved at ${v}`),le("Done \u2705"))),{checksum:y,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?pl(o):g.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var zU=require("node:crypto"),bo=require("node:fs"),bm=require("node:process");var um=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(i,s){let o=0;for(;o<i.length;){let a=e-n,u=Math.min(a,i.length-o);r.set(i.subarray(o,o+u),n),o+=u,n+=u,n===e&&(s.enqueue(r),r=new Uint8Array(e),n=0)}},flush(i){n>0&&i.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function ls(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(c()||l("?>"));){let f=s();if(!f)return d;d.attributes[f.name]=f.value}return u(/\?>\s*/),d}function n(){let h=u(/^<([\w-:.]+)\s*/);if(!h)return;let d={name:h[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=s();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=i();let f;for(;f=n();)d.children.push(f);return u(/^<\/[\w-:.]+>\s*/),d}function i(){let h=u(/^([^<]*)/);return h?a(h[1]):""}function s(){let h=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(h)return{name:h[1],value:a(o(h[2]))}}function o(h){return h.replace(/^['"]|['"]$/g,"")}function a(h){return h.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(h){let d=t.match(h);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(h){return t.startsWith(h)}}var Vn=class extends Error{};var Jt=class extends Vn{},ml=class extends Vn{},cm=class extends Vn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},zn=class extends Vn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},fs=class extends Vn{constructor(){super("accessKey is required")}},lu=class extends Vn{constructor(){super("secretKey is required")}},gl=class extends Vn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},Si=class extends Vn{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,i={}){super(n),this.statusCode=e,this.code=r,this.key=i.key,this.bucketName=i.bucketName,this.resource=i.resource,this.region=i.region}};async function g6(t){try{let r=ls(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",i=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(c=>c.name==="Key")?.content,o=r.children.find(c=>c.name==="BucketName")?.content,a=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new Si(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new Si(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function y6(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function D6(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function hs(t){return!(!Tfe(t)||t.length===0)}function Tfe(t){return!(typeof t!="string"||t.length>1024)}function yl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function po(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function bb(t){return t.get("x-amz-version-id")??null}function mo(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function _b(t){return mo(t).slice(0,8)}function Cb(t,e){return`${_b(e)}/${t}/s3/aws4_request`}async function lm(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),yl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Ife=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],fm=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:i,metadata:s}){let o,a=1,u,c=[],l,h=[];super({start(){},async write(d,f){let y=a++;try{if(y==1&&d.length<i){let A=await e.makeRequest({method:"PUT",headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});o={etag:po(A.headers.get("etag")??void 0),versionId:bb(A.headers)};return}y===1&&(u=(await Pfe({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Ife){let p=s[A];p&&(v[A]=p)}let E=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(v),bucketName:r,objectName:n,payload:d}).then(A=>{let p=A.headers.get("etag")??"";return p&&(p=p.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:p}),A});h.push(E.catch(A=>{l||(l=A)}))}catch(v){throw v}},async close(){if(!o)if(u){if(await Promise.all(h),l)throw l;c.sort((d,f)=>d.part>f.part?1:-1),o=await Ffe({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(o===void 0)throw new Error("Result is not ready. await the stream first.");return o}}};async function Pfe(t){let e="POST",r=new Headers(t.metadata),s=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),o=ls(s).root;if(!o||o.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let a=o.children.find(u=>u.name==="UploadId")?.content;if(!a)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:a}}async function Ffe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
329
329
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
330
330
  ${i.map(h=>` <Part><PartNumber>${h.part}</PartNumber><ETag>${h.etag}</ETag></Part>`).join(`
331
331
  `)}
@@ -334,19 +334,19 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
334
334
  `)+`
335
335
  `,n.join(";").toLowerCase(),i].join(`
336
336
  `)}async function _6(t,e,r){let n=await lm(t),i=Cb(r,e);return[Dl,mo(e),i,n].join(`
337
- `)}async function Ab(t,e,r){let n=_b(t),i=await yo("AWS4"+r,n),s=await yo(i,e),o=await yo(s,"s3");return await yo(o,"aws4_request")}function Ob(t,e,r){return`${t}/${Cb(e,r)}`}async function yo(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}async function C6(t){if(!t.accessKey)throw new fs;if(!t.secretKey)throw new lu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new gl;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Ob(t.accessKey,t.region,t.date),n=mo(t.date),i={"X-Amz-Algorithm":Dl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Dl},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&s.push(...t.conditions);for(let[f,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(f)||s.push({[f]:m});let o={expiration:e.toISOString(),conditions:s},a=new TextEncoder().encode(JSON.stringify(o)),u=btoa(String.fromCharCode(...a));i.policy=u;let c=u,l=await Ab(t.date,t.region,t.secretKey),h=yl(await yo(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var kfe=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","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"],Nfe=5*1024*1024,$fe=5*1024*1024*1024,xb=5*1024*1024*1024*1024,wl=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:i,...s}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||i!==void 0)throw new Jt("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let a=new URL(e);e=a.hostname,r=a.protocol==="https:",n=a.port?parseInt(a.port,10):r?443:80,a.pathname&&a.pathname!=="/"&&(i=a.pathname.endsWith("/")?a.pathname.slice(0,-1):a.pathname)}catch{throw new ml(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ml(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!y6(n))throw new Jt(`Invalid port: ${n}`);if(s.accessKey&&!s.secretKey)throw new Jt("If specifying access key, secret key must also be provided.");if(s.accessKey&&s.accessKey.startsWith("ASIA")&&!s.sessionToken)throw new Jt("If specifying temporary access key, session token must also be provided.");let o=r?443:80;if(this.port=n??o,this.host=e.toLowerCase()+(this.port!==o?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=s.accessKey,this.#e=s.secretKey??"",this.sessionToken=s.sessionToken,this.pathStyle=s.pathStyle??!0,this.pathPrefix=i??"",this.defaultBucket=s.bucket,this.region=s.region,this.pathPrefix){if(!this.pathStyle)throw new Jt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Jt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Jt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!D6(r))throw new cm(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let s=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,o=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,a=s?`?${s}`:"",u=o+a,c=o.split("/").map(l=>encodeURIComponent(l)).join("/")+a;return{headers:i,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:s,host:o,path:a,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="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 ${e} request.`);let l=await lm(r??new Uint8Array);s.set("x-amz-date",mo(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await w6({headers:s,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let h=`${this.protocol}//${o}${u}`,d=await fetch(h,{method:e,headers:s,body:r});if(d.status!==c)throw d.status>=400?await g6(d):d.status===301?new Si(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 Si(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!hs(e))throw new Vn(e);let i=r.versionId?{versionId:r.versionId}:{},s=new Headers;r.governanceBypass&&s.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:s,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof Si&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...i}){let s=this.getBucketName(i);if(!hs(e))throw new Vn(e);let o=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),o.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:s,objectName:e,headers:o,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new fs;if(!hs(r))throw new Vn(r);let{headers:i,path:s}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),o=n.requestDate??new Date,a=n.expirySeconds??1440*60*7;return v6({protocol:this.protocol,headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:o,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...s}=r,o={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:o,...s})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Jt("pageSize must be between 1 and 1,000.");let s=0;for(;;){let o=e.maxResults?Math.min(i,e.maxResults-s):i;if(o===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(o),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=ls(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),h=[];for(let f of l)h.push({type:"CommonPrefix",prefix:f.content??""}),s++;for(let f of c.children.filter(m=>m.name==="Contents"))h.push({type:"Object",key:f.children.find(m=>m.name==="Key")?.content??"",etag:po(f.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(f.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(m=>m.name==="LastModified")?.content??"invalid")}),s++;h.sort((f,m)=>{let y=f.type==="Object"?f.key:f.prefix,v=m.type==="Object"?m.key:m.prefix;return y>v?1:y<v?-1:0});for(let f of h)yield f;if(c.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=f}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!hs(e))throw new Vn(e);let s,o;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?o=ReadableStream.from([l]):o=new ReadableStream({start(h){h.enqueue(l),h.close()}}),s=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?o=ReadableStream.from([r]):o=new ReadableStream({start(l){l.enqueue(r),l.close()}}),s=r.byteLength;else if(r instanceof ReadableStream)o=r;else throw new Jt("Invalid stream/data type provided.");if(n?.size!==void 0){if(s!==void 0&&n?.size!==s)throw new Jt(`size was specified (${n.size}) but doesn't match auto-detected size (${s}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Jt(`invalid size specified: ${n.size}`);s=n.size}let a=n?.partSize??this.calculatePartSize(s);if(a<Nfe)throw new Jt("Part size should be greater than 5MB");if(a>$fe)throw new Jt("Part size should be less than 6MB");let u=new um(a),c=new fm({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await o.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=xb),e>xb)throw new TypeError(`size should not be more than ${xb}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!hs(e))throw new Vn(e);let i={};r?.versionId&&(i.versionId=r.versionId);let s=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i,headers:new Headers(r?.headers)}),o={};for(let a of kfe)s.headers.has(a)&&(o[a]=s.headers.get(a));return s.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(o[u]=s.headers.get(u))}),{type:"Object",key:e,size:parseInt(s.headers.get("content-length")??"",10),metadata:o,lastModified:new Date(s.headers.get("Last-Modified")??"error: missing last modified"),versionId:s.headers.get("x-amz-version-id")||null,etag:po(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!hs(r))throw new Vn(r);let o=`${s}/${e.sourceKey}`;e.sourceVersionId&&(o+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",o);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=ls(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let h=l.children.find(f=>f.name==="ETag")?.content??"",d=l.children.find(f=>f.name==="LastModified")?.content;if(d===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:po(h),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof Si&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}presignedPostObject(e,r={}){if(!hs(e))throw new Vn(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let i=r.requestDate||new Date,s=r.expirySeconds??3600;return C6({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:i,expirySeconds:s,conditions:r.conditions,fields:r.fields})}};function S6(t){try{let e=lt(t);return rn(Eu(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,i]=e;return`${r}.${n}.${Number.parseInt(i)+1}`}return"1.0.1"}}async function A6(t,e){let r=S6(t),n=e?` for ${e}`:"",i=await gn({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(st(i))return null;if(i==="auto")return g.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let s=await xi({message:`Current version is ${t}. Enter new version:`,validate:o=>{if(!o)return"Version is required";if(!o.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return st(s)?null:s}function O6(t){let e=S6(t);try{let r=lt(t);return[e,rn(Eu(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var Do=require("node:fs"),hm=require("node:path");function Lfe(t,e){return(0,Do.readFileSync)(t,"utf8").includes(e)}function vl(t,e){let r=(0,Do.readdirSync)(t);for(let n of r){let i=(0,hm.join)(t,n),s=(0,Do.statSync)(i);if(s.isDirectory()){if(vl(i,e))return!0}else if(s.isFile()&&(0,hm.extname)(i)===".js"&&Lfe(i,e))return!0}return!1}function dm(t){return(0,Do.readdirSync)(t).indexOf("index.html")>-1}var $U=require("node:buffer"),LU=require("node:crypto"),du=require("node:fs"),BU=require("node:os"),Eo=require("node:path"),jU=require("node:process"),Em=require("node:stream/consumers"),MU=require("node:zlib");var UU=ve(NU()),qU=ve(Kh());async function Zhe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var Qhe=8192;async function ede(t){let e=Lr((0,jU.cwd)()),r=await us("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?lt(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=!cs(n,void 0,void 0,fl);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:i}}function tde(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:UU.isMatch(t,r)}async function rde(t,e,r){let i=(0,du.statSync)(t).size,s=await(0,Em.buffer)((0,du.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(tde(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<Qhe)return{buffer:s,useBrotli:!1};try{let o=await(0,Em.buffer)((0,du.createReadStream)(t).pipe((0,MU.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return g.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function HU(t,e,r,n,i,s,o=!1){let a=Ct();a.start(i!=="v2"?"Generating the update manifest":`Generating the update manifest with ${o?"V3":"V2"} encryption`);let u=await A8(t);if(i==="v2")for(let c of u)c.hash=o?am(c.hash,s):cu(c.hash,s);return a.stop("Manifest generated successfully"),await _e(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function nde(t){return(0,BU.platform)()!=="win32"?t:Eo.win32.normalize(t).split(Eo.win32.sep).join(Eo.posix.sep)}function ide(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&g.warn(`File "${t}" contains spaces in its name.`),e}async function VU(t,e,r,n,i,s,o){let a=Ct();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await Sn(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await ede(o);if(d)o.disableBrotli?g.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&g.info(`Files matching patterns (${o.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${h||"unknown"}). To use Delta updates, please upgrade to version ${C8} (v5), ${S8} (v6) or ${fl} (v7) or higher.`);let f=e.filter(E=>E.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(E=>E.file).join(", ")}). Please rename the files.`);let m=0,y=e.length,v=0;try{a.message(`Uploading ${y} files using TUS protocol`);let E=async C=>{let F=(0,Eo.join)(r,C.file),b=nde(C.file),k,R=!1;if(o.disableBrotli)k=await(0,Em.buffer)((0,du.createReadStream)(F)),R=!1;else{let S=await rde(F,b,o);k=S.buffer,R=S.useBrotli}let I=k;s&&(I=uu(k,s.sessionKey,s.ivSessionKey));let B=b;R&&(B=`${b}.br`,v++);let j=ide(B),z=(0,LU.createHash)("sha256").update(C.hash).digest("hex"),L;if(s){let S=$U.Buffer.from(s.ivSessionKey).toString("hex");L=`orgs/${i}/apps/${n}/delta/${S}/${z}_${j}`}else L=`orgs/${i}/apps/${n}/delta/${z}_${j}`;return!s&&await Zhe(c,L)?(m++,Promise.resolve({file_name:j,s3_path:L,file_hash:C.hash})):new Promise((S,T)=>{a.message(`Prepare upload partial file: ${b}`),new qU.Upload(I,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:L},headers:{Authorization:t},onError:$=>{let q=$.toString(),M;try{let U=q.match(/response text: (\{.*?\})/);U&&U[1]&&(M=JSON.parse(U[1]).moreInfo?.requestId)}catch{}let G=M?` [requestId: ${M}]`:"";g.error(`Failed to upload ${b}: ${q}${G}`),T($)},onProgress(){let $=(m/y*100).toFixed(2);a.message(`Uploading partial update: ${$}%`)},onSuccess(){m++,S({file_name:j,s3_path:L,file_hash:C.hash})}}).start()})},A=500,p=[];for(let C=0;C<e.length;C+=A){let F=e.slice(C,C+A),b=Math.floor(C/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${b}/${k} (${F.length} files)`);let R=await Promise.all(F.map(I=>E(I)));p.push(...R)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),v>0&&g.info(`${v} of ${y} files were compressed with brotli and use .br extension`),await _e(t,{channel:"app",event:`App Partial TUS done${v>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await _e(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),p}catch(E){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw g.error(`Error uploading partial update: ${E}`),g.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),E;return g.info(`Error uploading partial update: ${E}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function ut(t){throw g.error(t),new Error(t)}async function sde(t,e){let r=as("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,zU.randomUUID)().split("-")[0]}`;return ru.test(n)||ut(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function ode(t){let e=t.apikey||re();return e||ut("Missing API key, you need to provide an API key to upload your bundle"),e}function ade(t,e,r){let n=$e(t,r),i=e.path||r?.webDir;return n||ut("Missing argument, you need to provide a appid or be in a capacitor project"),i||ut("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,bo.existsSync)(i)||ut(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function ude(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(vl(e,"notifyAppReady")||ut(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
338
- If you are sure your app has this code, you can use the --no-code-check option`),dm(e)||ut(`index.html is missing in the root folder of ${e}`))}async function cde(t,e,r,n,i,s){let o=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",i).single(),h=!!c&&c.disable_auto_update==="version_number",d,f;if(!l&&c&&c.version&&c.version.native_packages&&!o){let v=Ct();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:A}=await em(t,i,n,r.packageJson,r.nodeModules);if(f=E,d=A,f.find(p=>!fo(p)))v.stop(`Bundle NOT compatible with ${n} channel`),g.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,g.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:p}=c.version;(!p||!ru.test(p))&&ut("Invalid remote min update version, skipping auto setting compatibility"),u=p,v.stop(`Auto set min-update-version to ${u}`)}catch{ut(`Cannot auto set compatibility, invalid data ${c}`)}else v.stop(`Bundle compatible with ${n} channel`)}else o||(g.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await gb(r.packageJson,r.nodeModules),a&&(u=s,g.info(`Auto set min-update-version to ${u}`)));h&&!u&&!o&&ut("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ru.test(u)||ut(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([v,E])=>({name:v,version:E.version})):void 0,minUpdateVersion:u}}async function lde(t,e,r,n=!1,i=!1){let{data:s,error:o}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(s||o){if(n)return g.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),le("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(i){g.error(`\u274C Version ${r} already exists`);let a=O6(r);g.info("\u{1F4A1} Here are some suggestions:"),a.forEach((l,h)=>{g.info(` ${h+1}. ${l}`)});let u=await gn({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${a[0]}`},{value:"suggest2",label:`Use ${a[1]}`},{value:"suggest3",label:`Use ${a[2]}`},{value:"suggest4",label:`Use ${a[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(st(u)||u==="cancel")&&ut("Upload cancelled by user");let c;if(u==="custom"){let l=await A6(r,"upload");l||ut("Upload cancelled by user"),c=l}else{let l=Number.parseInt(u.replace("suggest",""))-1;c=a[l]}return g.info(`\u{1F504} Retrying with new version: ${c}`),c}ut(`Version ${r} already exists ${W(o)}`)}return!1}async function fde(t,e,r,n,i,s,o,a){let u,c,l="",h=null,d="none",f="",m="",y=e.keyV2,v=e.key===!1,E=Ct();E.start(`Zipping bundle from ${t}`),h=await Jp(t),E.message("Calculating checksum");let A=Lr((0,bm.cwd)()),p=await us("@capgo/capacitor-updater",A,e.packageJson),D=!1,w;try{w=p?lt(p):void 0}catch{w=void 0}if(p?w?D=!cs(w,fl):(p==="link:@capgo/capacitor-updater"||p==="file:.."||p==="file:../")&&(g.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),D=!0):ut("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(y||e.keyDataV2||(0,bo.existsSync)($r))&&!v||D?l=await ri(h,"sha256"):l=await ri(h,"crc32"),E.stop(`Checksum ${D?"SHA256":"CRC32"}: ${l}`),v)g.info("Encryption ignored");else if((y||(0,bo.existsSync)($r)||e.keyDataV2)&&!e.oldEncryption){let b=typeof y=="string"?y:$r,k=e.keyDataV2||"";!k&&!(0,bo.existsSync)(b)&&ut(`Cannot find private key ${b}`),await _e(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),k||(k=(0,bo.readFileSync)(b).toString());let R=w&&!cs(w,"5.30.0","6.30.0","7.30.0");g.info(`Encrypting your bundle with ${R?"V3":"V2"}`);let{sessionKey:I,ivSessionKey:B}=om(k),j=uu(h,I,B);l=R?am(l,k):cu(l,k),u=B,c=I,d="v2",f=k,a&&(m=h6(a),e.verbose&&g.info(`[Verbose] Encryption key_id: ${m}`)),e.displayIvSession&&g.info(`Your Iv Session key is ${u},
337
+ `)}async function Ab(t,e,r){let n=_b(t),i=await yo("AWS4"+r,n),s=await yo(i,e),o=await yo(s,"s3");return await yo(o,"aws4_request")}function Ob(t,e,r){return`${t}/${Cb(e,r)}`}async function yo(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}async function C6(t){if(!t.accessKey)throw new fs;if(!t.secretKey)throw new lu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new gl;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Ob(t.accessKey,t.region,t.date),n=mo(t.date),i={"X-Amz-Algorithm":Dl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Dl},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&s.push(...t.conditions);for(let[f,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(f)||s.push({[f]:m});let o={expiration:e.toISOString(),conditions:s},a=new TextEncoder().encode(JSON.stringify(o)),u=btoa(String.fromCharCode(...a));i.policy=u;let c=u,l=await Ab(t.date,t.region,t.secretKey),h=yl(await yo(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var kfe=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","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"],Nfe=5*1024*1024,$fe=5*1024*1024*1024,xb=5*1024*1024*1024*1024,wl=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:i,...s}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||i!==void 0)throw new Jt("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let a=new URL(e);e=a.hostname,r=a.protocol==="https:",n=a.port?parseInt(a.port,10):r?443:80,a.pathname&&a.pathname!=="/"&&(i=a.pathname.endsWith("/")?a.pathname.slice(0,-1):a.pathname)}catch{throw new ml(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ml(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!y6(n))throw new Jt(`Invalid port: ${n}`);if(s.accessKey&&!s.secretKey)throw new Jt("If specifying access key, secret key must also be provided.");if(s.accessKey&&s.accessKey.startsWith("ASIA")&&!s.sessionToken)throw new Jt("If specifying temporary access key, session token must also be provided.");let o=r?443:80;if(this.port=n??o,this.host=e.toLowerCase()+(this.port!==o?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=s.accessKey,this.#e=s.secretKey??"",this.sessionToken=s.sessionToken,this.pathStyle=s.pathStyle??!0,this.pathPrefix=i??"",this.defaultBucket=s.bucket,this.region=s.region,this.pathPrefix){if(!this.pathStyle)throw new Jt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Jt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Jt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!D6(r))throw new cm(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let s=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,o=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,a=s?`?${s}`:"",u=o+a,c=o.split("/").map(l=>encodeURIComponent(l)).join("/")+a;return{headers:i,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:s,host:o,path:a,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="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 ${e} request.`);let l=await lm(r??new Uint8Array);s.set("x-amz-date",mo(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await w6({headers:s,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let h=`${this.protocol}//${o}${u}`,d=await fetch(h,{method:e,headers:s,body:r});if(d.status!==c)throw d.status>=400?await g6(d):d.status===301?new Si(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 Si(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!hs(e))throw new zn(e);let i=r.versionId?{versionId:r.versionId}:{},s=new Headers;r.governanceBypass&&s.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:s,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof Si&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...i}){let s=this.getBucketName(i);if(!hs(e))throw new zn(e);let o=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),o.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:s,objectName:e,headers:o,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new fs;if(!hs(r))throw new zn(r);let{headers:i,path:s}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),o=n.requestDate??new Date,a=n.expirySeconds??1440*60*7;return v6({protocol:this.protocol,headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:o,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...s}=r,o={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:o,...s})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Jt("pageSize must be between 1 and 1,000.");let s=0;for(;;){let o=e.maxResults?Math.min(i,e.maxResults-s):i;if(o===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(o),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=ls(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),h=[];for(let f of l)h.push({type:"CommonPrefix",prefix:f.content??""}),s++;for(let f of c.children.filter(m=>m.name==="Contents"))h.push({type:"Object",key:f.children.find(m=>m.name==="Key")?.content??"",etag:po(f.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(f.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(m=>m.name==="LastModified")?.content??"invalid")}),s++;h.sort((f,m)=>{let y=f.type==="Object"?f.key:f.prefix,v=m.type==="Object"?m.key:m.prefix;return y>v?1:y<v?-1:0});for(let f of h)yield f;if(c.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=f}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!hs(e))throw new zn(e);let s,o;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?o=ReadableStream.from([l]):o=new ReadableStream({start(h){h.enqueue(l),h.close()}}),s=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?o=ReadableStream.from([r]):o=new ReadableStream({start(l){l.enqueue(r),l.close()}}),s=r.byteLength;else if(r instanceof ReadableStream)o=r;else throw new Jt("Invalid stream/data type provided.");if(n?.size!==void 0){if(s!==void 0&&n?.size!==s)throw new Jt(`size was specified (${n.size}) but doesn't match auto-detected size (${s}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Jt(`invalid size specified: ${n.size}`);s=n.size}let a=n?.partSize??this.calculatePartSize(s);if(a<Nfe)throw new Jt("Part size should be greater than 5MB");if(a>$fe)throw new Jt("Part size should be less than 6MB");let u=new um(a),c=new fm({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await o.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=xb),e>xb)throw new TypeError(`size should not be more than ${xb}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!hs(e))throw new zn(e);let i={};r?.versionId&&(i.versionId=r.versionId);let s=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i,headers:new Headers(r?.headers)}),o={};for(let a of kfe)s.headers.has(a)&&(o[a]=s.headers.get(a));return s.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(o[u]=s.headers.get(u))}),{type:"Object",key:e,size:parseInt(s.headers.get("content-length")??"",10),metadata:o,lastModified:new Date(s.headers.get("Last-Modified")??"error: missing last modified"),versionId:s.headers.get("x-amz-version-id")||null,etag:po(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!hs(r))throw new zn(r);let o=`${s}/${e.sourceKey}`;e.sourceVersionId&&(o+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",o);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=ls(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let h=l.children.find(f=>f.name==="ETag")?.content??"",d=l.children.find(f=>f.name==="LastModified")?.content;if(d===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:po(h),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof Si&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}presignedPostObject(e,r={}){if(!hs(e))throw new zn(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let i=r.requestDate||new Date,s=r.expirySeconds??3600;return C6({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:i,expirySeconds:s,conditions:r.conditions,fields:r.fields})}};function S6(t){try{let e=lt(t);return sn(Eu(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,i]=e;return`${r}.${n}.${Number.parseInt(i)+1}`}return"1.0.1"}}async function A6(t,e){let r=S6(t),n=e?` for ${e}`:"",i=await gn({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(st(i))return null;if(i==="auto")return g.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let s=await xi({message:`Current version is ${t}. Enter new version:`,validate:o=>{if(!o)return"Version is required";if(!o.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return st(s)?null:s}function O6(t){let e=S6(t);try{let r=lt(t);return[e,sn(Eu(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var Do=require("node:fs"),hm=require("node:path");function Lfe(t,e){return(0,Do.readFileSync)(t,"utf8").includes(e)}function vl(t,e){let r=(0,Do.readdirSync)(t);for(let n of r){let i=(0,hm.join)(t,n),s=(0,Do.statSync)(i);if(s.isDirectory()){if(vl(i,e))return!0}else if(s.isFile()&&(0,hm.extname)(i)===".js"&&Lfe(i,e))return!0}return!1}function dm(t){return(0,Do.readdirSync)(t).indexOf("index.html")>-1}var $U=require("node:buffer"),LU=require("node:crypto"),du=require("node:fs"),BU=require("node:os"),Eo=require("node:path"),jU=require("node:process"),Em=require("node:stream/consumers"),MU=require("node:zlib");var UU=ve(NU()),qU=ve(Kh());async function Zhe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var Qhe=8192;async function ede(t){let e=Lr((0,jU.cwd)()),r=await us("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?lt(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=!cs(n,void 0,void 0,fl);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:i}}function tde(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:UU.isMatch(t,r)}async function rde(t,e,r){let i=(0,du.statSync)(t).size,s=await(0,Em.buffer)((0,du.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(tde(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<Qhe)return{buffer:s,useBrotli:!1};try{let o=await(0,Em.buffer)((0,du.createReadStream)(t).pipe((0,MU.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return g.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function HU(t,e,r,n,i,s,o=!1){let a=Ct();a.start(i!=="v2"?"Generating the update manifest":`Generating the update manifest with ${o?"V3":"V2"} encryption`);let u=await A8(t);if(i==="v2")for(let c of u)c.hash=o?am(c.hash,s):cu(c.hash,s);return a.stop("Manifest generated successfully"),await _e(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function nde(t){return(0,BU.platform)()!=="win32"?t:Eo.win32.normalize(t).split(Eo.win32.sep).join(Eo.posix.sep)}function ide(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&g.warn(`File "${t}" contains spaces in its name.`),e}async function VU(t,e,r,n,i,s,o){let a=Ct();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await Sn(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await ede(o);if(d)o.disableBrotli?g.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&g.info(`Files matching patterns (${o.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${h||"unknown"}). To use Delta updates, please upgrade to version ${C8} (v5), ${S8} (v6) or ${fl} (v7) or higher.`);let f=e.filter(E=>E.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(E=>E.file).join(", ")}). Please rename the files.`);let m=0,y=e.length,v=0;try{a.message(`Uploading ${y} files using TUS protocol`);let E=async C=>{let F=(0,Eo.join)(r,C.file),b=nde(C.file),k,R=!1;if(o.disableBrotli)k=await(0,Em.buffer)((0,du.createReadStream)(F)),R=!1;else{let S=await rde(F,b,o);k=S.buffer,R=S.useBrotli}let I=k;s&&(I=uu(k,s.sessionKey,s.ivSessionKey));let B=b;R&&(B=`${b}.br`,v++);let j=ide(B),z=(0,LU.createHash)("sha256").update(C.hash).digest("hex"),L;if(s){let S=$U.Buffer.from(s.ivSessionKey).toString("hex");L=`orgs/${i}/apps/${n}/delta/${S}/${z}_${j}`}else L=`orgs/${i}/apps/${n}/delta/${z}_${j}`;return!s&&await Zhe(c,L)?(m++,Promise.resolve({file_name:j,s3_path:L,file_hash:C.hash})):new Promise((S,T)=>{a.message(`Prepare upload partial file: ${b}`),new qU.Upload(I,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:L},headers:{Authorization:t},onError:$=>{let q=$.toString(),M;try{let U=q.match(/response text: (\{.*?\})/);U&&U[1]&&(M=JSON.parse(U[1]).moreInfo?.requestId)}catch{}let G=M?` [requestId: ${M}]`:"";g.error(`Failed to upload ${b}: ${q}${G}`),T($)},onProgress(){let $=(m/y*100).toFixed(2);a.message(`Uploading partial update: ${$}%`)},onSuccess(){m++,S({file_name:j,s3_path:L,file_hash:C.hash})}}).start()})},A=500,p=[];for(let C=0;C<e.length;C+=A){let F=e.slice(C,C+A),b=Math.floor(C/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${b}/${k} (${F.length} files)`);let R=await Promise.all(F.map(I=>E(I)));p.push(...R)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),v>0&&g.info(`${v} of ${y} files were compressed with brotli and use .br extension`),await _e(t,{channel:"app",event:`App Partial TUS done${v>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await _e(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),p}catch(E){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw g.error(`Error uploading partial update: ${E}`),g.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),E;return g.info(`Error uploading partial update: ${E}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function ut(t){throw g.error(t),new Error(t)}async function sde(t,e){let r=as("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,zU.randomUUID)().split("-")[0]}`;return ru.test(n)||ut(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function ode(t){let e=t.apikey||re();return e||ut("Missing API key, you need to provide an API key to upload your bundle"),e}function ade(t,e,r){let n=$e(t,r),i=e.path||r?.webDir;return n||ut("Missing argument, you need to provide a appid or be in a capacitor project"),i||ut("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,bo.existsSync)(i)||ut(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function ude(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(vl(e,"notifyAppReady")||ut(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
338
+ If you are sure your app has this code, you can use the --no-code-check option`),dm(e)||ut(`index.html is missing in the root folder of ${e}`))}async function cde(t,e,r,n,i,s){let o=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",i).single(),h=!!c&&c.disable_auto_update==="version_number",d,f;if(!l&&c&&c.version&&c.version.native_packages&&!o){let v=Ct();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:A}=await em(t,i,n,r.packageJson,r.nodeModules);if(f=E,d=A,f.find(p=>!fo(p)))v.stop(`Bundle NOT compatible with ${n} channel`),g.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,g.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:p}=c.version;(!p||!ru.test(p))&&ut("Invalid remote min update version, skipping auto setting compatibility"),u=p,v.stop(`Auto set min-update-version to ${u}`)}catch{ut(`Cannot auto set compatibility, invalid data ${c}`)}else v.stop(`Bundle compatible with ${n} channel`)}else o||(g.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await gb(r.packageJson,r.nodeModules),a&&(u=s,g.info(`Auto set min-update-version to ${u}`)));h&&!u&&!o&&ut("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ru.test(u)||ut(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([v,E])=>({name:v,version:E.version})):void 0,minUpdateVersion:u}}async function lde(t,e,r,n=!1,i=!1){let{data:s,error:o}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(s||o){if(n)return g.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),le("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(i){g.error(`\u274C Version ${r} already exists`);let a=O6(r);g.info("\u{1F4A1} Here are some suggestions:"),a.forEach((l,h)=>{g.info(` ${h+1}. ${l}`)});let u=await gn({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${a[0]}`},{value:"suggest2",label:`Use ${a[1]}`},{value:"suggest3",label:`Use ${a[2]}`},{value:"suggest4",label:`Use ${a[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(st(u)||u==="cancel")&&ut("Upload cancelled by user");let c;if(u==="custom"){let l=await A6(r,"upload");l||ut("Upload cancelled by user"),c=l}else{let l=Number.parseInt(u.replace("suggest",""))-1;c=a[l]}return g.info(`\u{1F504} Retrying with new version: ${c}`),c}ut(`Version ${r} already exists ${W(o)}`)}return!1}async function fde(t,e,r,n,i,s,o,a){let u,c,l="",h=null,d="none",f="",m="",y=e.keyV2,v=e.key===!1,E=Ct();E.start(`Zipping bundle from ${t}`),h=await Jp(t),E.message("Calculating checksum");let A=Lr((0,bm.cwd)()),p=await us("@capgo/capacitor-updater",A,e.packageJson),D=!1,w;try{w=p?lt(p):void 0}catch{w=void 0}if(p?w?D=!cs(w,fl):(p==="link:@capgo/capacitor-updater"||p==="file:.."||p==="file:../")&&(g.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),D=!0):ut("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(y||e.keyDataV2||(0,bo.existsSync)($r))&&!v||D?l=await ni(h,"sha256"):l=await ni(h,"crc32"),E.stop(`Checksum ${D?"SHA256":"CRC32"}: ${l}`),v)g.info("Encryption ignored");else if((y||(0,bo.existsSync)($r)||e.keyDataV2)&&!e.oldEncryption){let b=typeof y=="string"?y:$r,k=e.keyDataV2||"";!k&&!(0,bo.existsSync)(b)&&ut(`Cannot find private key ${b}`),await _e(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),k||(k=(0,bo.readFileSync)(b).toString());let R=w&&!cs(w,"5.30.0","6.30.0","7.30.0");g.info(`Encrypting your bundle with ${R?"V3":"V2"}`);let{sessionKey:I,ivSessionKey:B}=om(k),j=uu(h,I,B);l=R?am(l,k):cu(l,k),u=B,c=I,d="v2",f=k,a&&(m=h6(a),e.verbose&&g.info(`[Verbose] Encryption key_id: ${m}`)),e.displayIvSession&&g.info(`Your Iv Session key is ${u},
339
339
  keep it safe, you will need it to decrypt your bundle.
340
340
  It will be also visible in your dashboard
341
341
  `),h=j}let C=Math.floor((h?.byteLength??0)/1024/1024),F=Math.floor(s/1024/1024);return h?.byteLength>s?ut(`The bundle size is ${C} Mb, this is greater than the maximum upload length ${F} Mb, please reduce the size of your bundle`):h?.byteLength>o?(g.warn(`WARNING !!
342
342
  The bundle size is ${C} Mb, this may take a while to download for users
343
343
  `),g.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
344
344
  `),e.verbose&&(g.info("[Verbose] Bundle size details:"),g.info(` - Actual size: ${C} MB (${h?.byteLength} bytes)`),g.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),g.info(` - Maximum allowed: ${F} MB`),g.info("[Verbose] Sending 'App Too Large' event to analytics...")),await _e(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),e.verbose&&g.info("[Verbose] Event sent successfully")):e.verbose&&g.info(`[Verbose] Bundle size OK: ${C} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&g.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:h,ivSessionKey:u,sessionKey:c,checksum:l,encryptionMethod:d,finalKeyData:f,keyId:m}}async function hde(t,e,r,n,i,s,o,a){let u=Ct();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(o.verbose&&(g.info("[Verbose] uploadBundleToCapgoCloud called:"),g.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),g.info(` - App ID: ${r}`),g.info(` - Bundle version: ${n}`),g.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),o.dryUpload){u.stop(`Dry run, bundle not uploaded
345
- Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&g.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await Sn();if(o.verbose&&g.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?g.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):g.info("Uploading bundle with TUS protocol"),o.verbose&&(g.info("[Verbose] Starting TUS resumable upload..."),g.info(` - Host: ${f.hostWeb}`),g.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await O8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&g.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${i}/apps/${r}/${n}.zip`,{error:y}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(y)return g.error(`Cannot finish TUS upload ${W(y)}`),o.verbose&&g.info(`[Verbose] Database update failed: ${W(y)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&g.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&g.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await b8(e,r,n);if(!m)return g.error("Cannot get upload url"),o.verbose&&g.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(g.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),g.info(` - Timeout: ${o.timeout||pb}ms`),g.info(" - Retry attempts: 5"),g.info(" - Content-Type: application/zip"));let y=new AbortController,v=setTimeout(()=>y.abort(),o.timeout||pb);try{let E=await fetch(m,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(v)}o.verbose&&g.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let y=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${y} seconds)`),o.verbose&&(g.info(`[Verbose] Upload failed after ${y} seconds`),g.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let v=f.message.match(/status: (\d+)/),E=v?v[1]:"unknown";g.error(`Upload failed with status ${E}: ${f.message}`)}catch{g.error(`Upload failed: ${f.message}`)}else o.verbose&&g.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?g.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):g.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&g.info("[Verbose] Cleaning up failed version from database..."),await x8(e,r,n),o.verbose&&g.info("[Verbose] Failed version cleaned up"),f instanceof Error?f:new Error(String(f))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),o.verbose&&(g.info("[Verbose] Upload successful:"),g.info(` - Upload time: ${d} seconds`),g.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),g.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),g.info("[Verbose] Sending performance event...")),await _e(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:d},notify:!1},o.verbose),o.verbose&&g.info("[Verbose] Performance event sent successfully")}async function dde(t,e,r){let{data:n,error:i}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(i){g.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){g.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){g.warn("The linked bundle is already deleted");return}let{error:o}=await t.from("app_versions").update({deleted:!0}).eq("id",s.id);if(o){g.error(`Cannot delete linked bundle on upload ${W(o)}`);return}g.info("Linked bundle deleted")}async function pde(t,e,r,n,i,s,o,a,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();l||ut("Cannot get version id, cannot set channel");let{data:h}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(h){let{error:d,data:f}=await Zp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&ut(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let m=`${u.hostWeb}/app/${a}/channel/${f.id}`;f?.public?g.info("Your update is now available in your public channel \u{1F389}"):f?.id&&g.info(`Link device to this bundle to try it: ${m}`),r&&g.info(`Bundle url: ${m}`)}else g.warn("The upload key is not allowed to set the version in the channel")}async function mde(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(g.warn("Cannot find default upload channel"),g.info(`You can set it here: ${r}/app/${t}/info`),null):i.default_upload_channel}async function zb(t,e,r=!1){r||ae(`Uploading with CLI version ${Mi.version}`);let n,i=qn();await Xe();let{s3Region:s,s3Apikey:o,s3Apisecret:a,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:h}=e;e.verbose&&(g.info("[Verbose] Starting upload process with options:"),g.info(` - API key: ${e.apikey?"provided":"from saved key"}`),g.info(` - Path: ${e.path||"from capacitor config"}`),g.info(` - Channel: ${e.channel||"from default upload channel"}`),g.info(` - Bundle: ${e.bundle||"auto-detected"}`),g.info(` - External: ${e.external||"false"}`),g.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),g.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),g.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=ode(e);e.verbose&&g.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&g.info("[Verbose] Capacitor config loaded successfully");let m=await m8();e.verbose&&(g.info("[Verbose] Remote file config retrieved:"),g.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),g.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),g.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),g.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),g.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),g.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:y,path:v}=ade(t,e,f.config);e.verbose&&g.info(`[Verbose] App ID: ${y}, Build path: ${v}`);let E=await sde(f.config,e);e.verbose&&g.info(`[Verbose] Bundle version: ${E}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await p8({version:E}),e.verbose&&g.info("[Verbose] Auto-set bundle version in capacitor.config.json")),ude(e,v),e.verbose&&g.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),g.info(`Upload ${y}@${E} started from path "${v}" to Capgo cloud`);let D=await Sn();e.verbose&&g.info(`[Verbose] Local config loaded: host=${D.hostWeb}`),e.supaHost&&e.supaAnon&&(g.info("Using custom supabase instance from provided options"),D.supaHost=e.supaHost,D.supaKey=e.supaAnon,e.verbose&&g.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&g.info("[Verbose] Supabase client created successfully");let C=await De(w,d,["write","all","upload"]);e.verbose&&g.info(`[Verbose] User verified successfully, user_id: ${C}`);let F=e.channel||await mde(y,w,D.hostWeb)||"production";e.verbose&&g.info(`[Verbose] Target channel: ${F}`);let b=await Rr(w,y);e.verbose&&g.info(`[Verbose] Organization ID: ${b}`),await w8(w,b,Mi.version),e.verbose&&g.info("[Verbose] Remote CLI messages checked"),await E8(w,b,d,y,!0),e.verbose&&g.info("[Verbose] Plan validation passed"),e.verbose&&g.info("[Verbose] Trial check completed"),e.verbose&&g.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:k,minUpdateVersion:R}=await cde(w,i,e,F,y,E);e.verbose&&(g.info("[Verbose] Compatibility check completed:"),g.info(` - Native packages: ${k?k.length:0}`),g.info(` - Min update version: ${R||"none"}`)),e.verbose&&g.info(`[Verbose] Checking if version ${E} already exists...`);let I=!r,B=await lde(w,y,E,e.versionExistsOk,I);if(e.verbose&&g.info(`[Verbose] Version exists check: ${B?typeof B=="string"?`retry with ${B}`:"yes (skipping)":"no (continuing)"}`),B===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:E,checksum:null,encryptionMethod:p,storageProvider:A};if(typeof B=="string")return g.info(`Retrying upload with new version: ${B}`),zb(t,{...e,bundle:B},r);e.external&&!e.external.startsWith("https://")&&ut(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(g.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),g.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:E,app_id:y,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:R,native_packages:k,owner_org:b,user_id:C,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0},z=null,L="";if(e.external)e.verbose&&g.info(`[Verbose] Using external URL: ${e.external}`),await _e(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:b,tags:{"app-id":y},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(g.info("[Verbose] External bundle configured:"),g.info(` - URL: ${e.external}`),g.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),g.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&g.info(`[Verbose] Preparing bundle file from path: ${v}`);let H=f.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:te,ivSessionKey:x,checksum:O,sessionKey:V,encryptionMethod:N,finalKeyData:ne,keyId:K}=await fde(v,e,d,b,y,m.maxUploadLength,m.alertUploadSize,H);j.session_key=x,j.checksum=O,j.key_id=K||void 0,n=V,z=te,p=N,L=ne,e.verbose&&(g.info("[Verbose] Bundle prepared:"),g.info(` - Size: ${Math.floor((te?.byteLength??0)/1024)} KB`),g.info(` - Checksum: ${O}`),g.info(` - Encryption: ${N}`),g.info(` - IV Session Key: ${x?"present":"none"}`),g.info(` - Key ID: ${K||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&g.info("[Verbose] Checking for duplicate checksum..."),await P8(w,y,F,O),e.verbose&&g.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&g.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&g.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&g.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&p==="v1"&&ut("You cannot encrypt the partial update if you are not using the v2 encryption method");let S="5.30.0",T="6.30.0",P="7.30.0",$=!1;if(e.delta&&p==="v2"&&!e.encryptPartial){let H=Lr((0,bm.cwd)()),te=await us("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&I_(x,lt("6.14.4"))&&(g.info(`Auto-enabling partial update encryption for updater version ${x} (> 6.14.4)`),e.verbose&&g.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||p==="v2")){let H=Lr((0,bm.cwd)()),te=await us("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&($=!cs(x,S,T,P),e.verbose&&$&&g.info(`[Verbose] Using hex checksum format for updater version ${x}`))}e.verbose&&e.delta&&g.info("[Verbose] Preparing delta/partial update manifest...");let q=e.delta?await HU(v,d,b,y,e.encryptPartial?p:"none",L,$):[];e.verbose&&e.delta&&g.info(`[Verbose] Delta manifest prepared with ${q.length} files`),e.verbose&&g.info("[Verbose] Creating version record in database...");let{error:M}=await mb(w,j);if(M&&ut(`Cannot add bundle ${W(M)}`),e.verbose&&g.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(g.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&g.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),z&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&ut("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),g.info("Uploading to S3"),e.verbose&&(g.info("[Verbose] S3 configuration:"),g.info(` - Endpoint: ${c}`),g.info(` - Region: ${s}`),g.info(` - Bucket: ${u}`),g.info(` - Port: ${l}`),g.info(` - SSL: ${h?"enabled":"disabled"}`));let H=h?`https://${c}`:`http://${c}`,te=new wl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),x=`${y}-${E}`,O=encodeURIComponent(x);e.verbose&&g.info(`[Verbose] Uploading to S3 as: ${x}`),await te.putObject(x,Uint8Array.from(z)),j.external_url=`${H}/${O}`,j.storage_provider="external",e.verbose&&g.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(z){!e.partialOnly&&!e.deltaOnly?(e.verbose&&g.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await hde(d,w,y,E,b,z,e,e.tusChunkSize)):e.verbose&&g.info("[Verbose] Skipping full bundle upload (delta-only mode)");let H=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&g.info("[Verbose] Dry upload mode: skipping delta upload"));let x=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(g.info("[Verbose] Starting delta/partial file upload..."),g.info(` - Manifest entries: ${q.length}`),g.info(` - Encryption: ${x?"enabled":"disabled"}`)),H=e.delta?await VU(d,q,v,y,b,x,e):null,e.verbose&&H&&g.info(`[Verbose] Delta upload complete with ${H.length} files`)}catch(x){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw x;g.info(`Failed to upload partial files to capgo cloud. Error: ${W(x)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&g.info(`[Verbose] Delta upload error details: ${W(x)}`)}j.storage_provider="r2",j.manifest=H,e.verbose&&g.info("[Verbose] Updating version record with storage provider and manifest...");let{error:te}=await mb(w,j);te&&ut(`Cannot update bundle ${W(te)}`),e.verbose&&g.info("[Verbose] Version record updated successfully")}e.verbose&&g.info("[Verbose] Checking app permissions...");let G=await Et(w,d,y,2);e.verbose&&(g.info("[Verbose] Permissions:"),g.info(` - Upload: ${nu(G,2)?"yes":"no"}`),g.info(` - Write: ${nu(G,3)?"yes":"no"}`),g.info(` - Admin: ${nu(G,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&nu(G,3)?(e.verbose&&g.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await dde(w,y,F)):e.deleteLinkedBundleOnUpload&&g.warn("Cannot delete linked bundle on upload as a upload organization member"),nu(G,3)?(e.verbose&&g.info(`[Verbose] Setting bundle ${E} to channel ${F}...`),await pde(w,d,!!e.bundleUrl,E,F,C,b,y,D,e.selfAssign),e.verbose&&g.info("[Verbose] Channel updated successfully")):g.warn("Cannot set channel as a upload organization member"),e.verbose&&g.info("[Verbose] Sending upload event..."),await _e(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:b,tags:{"app-id":y},notify:!1},e.verbose);let U={success:!0,bundle:E,checksum:j.checksum??null,encryptionMethod:p,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(g.info("[Verbose] Upload completed successfully:"),g.info(` - Bundle: ${U.bundle}`),g.info(` - Checksum: ${U.checksum}`),g.info(` - Encryption: ${U.encryptionMethod}`),g.info(` - Storage: ${U.storageProvider}`)),r&&!U.skipped&&le("Time to share your update to the world \u{1F30D}"),U}var KU=require("node:crypto"),_m=require("node:fs"),GU=require("node:process");var gde=20;function yde(t){console.log(JSON.stringify(t,null,2))}function Sl(t){console.error(W(t))}async function WU(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await Xe();let a=await de(),u=$e(t,a?.config),c=(0,KU.randomUUID)().split("-")[0],l=as("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&ae(`Zipping ${u}@${i}`),i&&!ru.test(i)){let C=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Sl({error:"invalid_semver"}):g.error(C)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let C="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Sl({error:"missing_argument"}):g.error(C)),new Error(C)}if(o&&g.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!vl(s,"notifyAppReady"))throw r||(n?Sl({error:"notifyAppReady_not_in_source_code"}):g.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!dm(s))throw r||(n?Sl({error:"index_html_not_found"}):g.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await Jp(s);o&&g.info(`Zipped ${d.byteLength} bytes`);let f=o?Ct():null;f&&f.start("Calculating checksum");let m=Lr((0,GU.cwd)()),y=await us("@capgo/capacitor-updater",m,e.packageJson);if(!y){let C="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||g.warn(C),new Error(C)}let v=!1,E;try{E=y?lt(y):void 0}catch{E=void 0}E?v=!cs(E,void 0,void 0,"7.0.0"):y==="link:@capgo/capacitor-updater"&&(r||g.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await ri(d,e.keyV2||(0,_m.existsSync)($r)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>gde&&o&&(g.warn(`WARNING !!
345
+ Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&g.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await Sn();if(o.verbose&&g.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?g.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):g.info("Uploading bundle with TUS protocol"),o.verbose&&(g.info("[Verbose] Starting TUS resumable upload..."),g.info(` - Host: ${f.hostWeb}`),g.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await O8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&g.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${i}/apps/${r}/${n}.zip`,{error:y}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(y)return g.error(`Cannot finish TUS upload ${W(y)}`),o.verbose&&g.info(`[Verbose] Database update failed: ${W(y)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&g.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&g.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await b8(e,r,n);if(!m)return g.error("Cannot get upload url"),o.verbose&&g.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(g.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),g.info(` - Timeout: ${o.timeout||pb}ms`),g.info(" - Retry attempts: 5"),g.info(" - Content-Type: application/zip"));let y=new AbortController,v=setTimeout(()=>y.abort(),o.timeout||pb);try{let E=await fetch(m,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(v)}o.verbose&&g.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let y=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${y} seconds)`),o.verbose&&(g.info(`[Verbose] Upload failed after ${y} seconds`),g.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let v=f.message.match(/status: (\d+)/),E=v?v[1]:"unknown";g.error(`Upload failed with status ${E}: ${f.message}`)}catch{g.error(`Upload failed: ${f.message}`)}else o.verbose&&g.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?g.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):g.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&g.info("[Verbose] Cleaning up failed version from database..."),await x8(e,r,n),o.verbose&&g.info("[Verbose] Failed version cleaned up"),f instanceof Error?f:new Error(String(f))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),o.verbose&&(g.info("[Verbose] Upload successful:"),g.info(` - Upload time: ${d} seconds`),g.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),g.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),g.info("[Verbose] Sending performance event...")),await _e(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:d},notify:!1},o.verbose),o.verbose&&g.info("[Verbose] Performance event sent successfully")}async function dde(t,e,r){let{data:n,error:i}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(i){g.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){g.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){g.warn("The linked bundle is already deleted");return}let{error:o}=await t.from("app_versions").update({deleted:!0}).eq("id",s.id);if(o){g.error(`Cannot delete linked bundle on upload ${W(o)}`);return}g.info("Linked bundle deleted")}async function pde(t,e,r,n,i,s,o,a,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();l||ut("Cannot get version id, cannot set channel");let{data:h}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(h){let{error:d,data:f}=await Zp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&ut(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let m=`${u.hostWeb}/app/${a}/channel/${f.id}`;f?.public?g.info("Your update is now available in your public channel \u{1F389}"):f?.id&&g.info(`Link device to this bundle to try it: ${m}`),r&&g.info(`Bundle url: ${m}`)}else g.warn("The upload key is not allowed to set the version in the channel")}async function mde(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(g.warn("Cannot find default upload channel"),g.info(`You can set it here: ${r}/app/${t}/info`),null):i.default_upload_channel}async function zb(t,e,r=!1){r||ae(`Uploading with CLI version ${Mi.version}`);let n,i=qn();await Xe();let{s3Region:s,s3Apikey:o,s3Apisecret:a,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:h}=e;e.verbose&&(g.info("[Verbose] Starting upload process with options:"),g.info(` - API key: ${e.apikey?"provided":"from saved key"}`),g.info(` - Path: ${e.path||"from capacitor config"}`),g.info(` - Channel: ${e.channel||"from default upload channel"}`),g.info(` - Bundle: ${e.bundle||"auto-detected"}`),g.info(` - External: ${e.external||"false"}`),g.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),g.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),g.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=ode(e);e.verbose&&g.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&g.info("[Verbose] Capacitor config loaded successfully");let m=await m8();e.verbose&&(g.info("[Verbose] Remote file config retrieved:"),g.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),g.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),g.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),g.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),g.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),g.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:y,path:v}=ade(t,e,f.config);e.verbose&&g.info(`[Verbose] App ID: ${y}, Build path: ${v}`);let E=await sde(f.config,e);e.verbose&&g.info(`[Verbose] Bundle version: ${E}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await p8({version:E}),e.verbose&&g.info("[Verbose] Auto-set bundle version in capacitor.config.json")),ude(e,v),e.verbose&&g.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),g.info(`Upload ${y}@${E} started from path "${v}" to Capgo cloud`);let D=await Sn();e.verbose&&g.info(`[Verbose] Local config loaded: host=${D.hostWeb}`),e.supaHost&&e.supaAnon&&(g.info("Using custom supabase instance from provided options"),D.supaHost=e.supaHost,D.supaKey=e.supaAnon,e.verbose&&g.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&g.info("[Verbose] Supabase client created successfully");let C=await De(w,d,["write","all","upload"]);e.verbose&&g.info(`[Verbose] User verified successfully, user_id: ${C}`);let F=e.channel||await mde(y,w,D.hostWeb)||"production";e.verbose&&g.info(`[Verbose] Target channel: ${F}`);let b=await Rr(w,y);e.verbose&&g.info(`[Verbose] Organization ID: ${b}`),await w8(w,b,Mi.version),e.verbose&&g.info("[Verbose] Remote CLI messages checked"),await E8(w,b,d,y,!0),e.verbose&&g.info("[Verbose] Plan validation passed"),e.verbose&&g.info("[Verbose] Trial check completed"),e.verbose&&g.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:k,minUpdateVersion:R}=await cde(w,i,e,F,y,E);e.verbose&&(g.info("[Verbose] Compatibility check completed:"),g.info(` - Native packages: ${k?k.length:0}`),g.info(` - Min update version: ${R||"none"}`)),e.verbose&&g.info(`[Verbose] Checking if version ${E} already exists...`);let I=!r,B=await lde(w,y,E,e.versionExistsOk,I);if(e.verbose&&g.info(`[Verbose] Version exists check: ${B?typeof B=="string"?`retry with ${B}`:"yes (skipping)":"no (continuing)"}`),B===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:E,checksum:null,encryptionMethod:p,storageProvider:A};if(typeof B=="string")return g.info(`Retrying upload with new version: ${B}`),zb(t,{...e,bundle:B},r);e.external&&!e.external.startsWith("https://")&&ut(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(g.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),g.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:E,app_id:y,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:R,native_packages:k,owner_org:b,user_id:C,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0},z=null,L="";if(e.external)e.verbose&&g.info(`[Verbose] Using external URL: ${e.external}`),await _e(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:b,tags:{"app-id":y},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(g.info("[Verbose] External bundle configured:"),g.info(` - URL: ${e.external}`),g.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),g.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&g.info(`[Verbose] Preparing bundle file from path: ${v}`);let H=f.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:te,ivSessionKey:x,checksum:O,sessionKey:V,encryptionMethod:N,finalKeyData:ne,keyId:K}=await fde(v,e,d,b,y,m.maxUploadLength,m.alertUploadSize,H);j.session_key=x,j.checksum=O,j.key_id=K||void 0,n=V,z=te,p=N,L=ne,e.verbose&&(g.info("[Verbose] Bundle prepared:"),g.info(` - Size: ${Math.floor((te?.byteLength??0)/1024)} KB`),g.info(` - Checksum: ${O}`),g.info(` - Encryption: ${N}`),g.info(` - IV Session Key: ${x?"present":"none"}`),g.info(` - Key ID: ${K||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&g.info("[Verbose] Checking for duplicate checksum..."),await P8(w,y,F,O),e.verbose&&g.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&g.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&g.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&g.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&p==="v1"&&ut("You cannot encrypt the partial update if you are not using the v2 encryption method");let S="5.30.0",T="6.30.0",P="7.30.0",$=!1;if(e.delta&&p==="v2"&&!e.encryptPartial){let H=Lr((0,bm.cwd)()),te=await us("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&I_(x,lt("6.14.4"))&&(g.info(`Auto-enabling partial update encryption for updater version ${x} (> 6.14.4)`),e.verbose&&g.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||p==="v2")){let H=Lr((0,bm.cwd)()),te=await us("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&($=!cs(x,S,T,P),e.verbose&&$&&g.info(`[Verbose] Using hex checksum format for updater version ${x}`))}e.verbose&&e.delta&&g.info("[Verbose] Preparing delta/partial update manifest...");let q=e.delta?await HU(v,d,b,y,e.encryptPartial?p:"none",L,$):[];e.verbose&&e.delta&&g.info(`[Verbose] Delta manifest prepared with ${q.length} files`),e.verbose&&g.info("[Verbose] Creating version record in database...");let{error:M}=await mb(w,j);if(M&&ut(`Cannot add bundle ${W(M)}`),e.verbose&&g.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(g.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&g.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),z&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&ut("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),g.info("Uploading to S3"),e.verbose&&(g.info("[Verbose] S3 configuration:"),g.info(` - Endpoint: ${c}`),g.info(` - Region: ${s}`),g.info(` - Bucket: ${u}`),g.info(` - Port: ${l}`),g.info(` - SSL: ${h?"enabled":"disabled"}`));let H=h?`https://${c}`:`http://${c}`,te=new wl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),x=`${y}-${E}`,O=encodeURIComponent(x);e.verbose&&g.info(`[Verbose] Uploading to S3 as: ${x}`),await te.putObject(x,Uint8Array.from(z)),j.external_url=`${H}/${O}`,j.storage_provider="external",e.verbose&&g.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(z){!e.partialOnly&&!e.deltaOnly?(e.verbose&&g.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await hde(d,w,y,E,b,z,e,e.tusChunkSize)):e.verbose&&g.info("[Verbose] Skipping full bundle upload (delta-only mode)");let H=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&g.info("[Verbose] Dry upload mode: skipping delta upload"));let x=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(g.info("[Verbose] Starting delta/partial file upload..."),g.info(` - Manifest entries: ${q.length}`),g.info(` - Encryption: ${x?"enabled":"disabled"}`)),H=e.delta?await VU(d,q,v,y,b,x,e):null,e.verbose&&H&&g.info(`[Verbose] Delta upload complete with ${H.length} files`)}catch(x){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw x;g.info(`Failed to upload partial files to capgo cloud. Error: ${W(x)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&g.info(`[Verbose] Delta upload error details: ${W(x)}`)}j.storage_provider="r2",j.manifest=H,e.verbose&&g.info("[Verbose] Updating version record with storage provider and manifest...");let{error:te}=await mb(w,j);te&&ut(`Cannot update bundle ${W(te)}`),e.verbose&&g.info("[Verbose] Version record updated successfully")}e.verbose&&g.info("[Verbose] Checking app permissions...");let G=await Et(w,d,y,2);e.verbose&&(g.info("[Verbose] Permissions:"),g.info(` - Upload: ${nu(G,2)?"yes":"no"}`),g.info(` - Write: ${nu(G,3)?"yes":"no"}`),g.info(` - Admin: ${nu(G,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&nu(G,3)?(e.verbose&&g.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await dde(w,y,F)):e.deleteLinkedBundleOnUpload&&g.warn("Cannot delete linked bundle on upload as a upload organization member"),nu(G,3)?(e.verbose&&g.info(`[Verbose] Setting bundle ${E} to channel ${F}...`),await pde(w,d,!!e.bundleUrl,E,F,C,b,y,D,e.selfAssign),e.verbose&&g.info("[Verbose] Channel updated successfully")):g.warn("Cannot set channel as a upload organization member"),e.verbose&&g.info("[Verbose] Sending upload event..."),await _e(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:b,tags:{"app-id":y},notify:!1},e.verbose);let U={success:!0,bundle:E,checksum:j.checksum??null,encryptionMethod:p,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(g.info("[Verbose] Upload completed successfully:"),g.info(` - Bundle: ${U.bundle}`),g.info(` - Checksum: ${U.checksum}`),g.info(` - Encryption: ${U.encryptionMethod}`),g.info(` - Storage: ${U.storageProvider}`)),r&&!U.skipped&&le("Time to share your update to the world \u{1F30D}"),U}var KU=require("node:crypto"),_m=require("node:fs"),GU=require("node:process");var gde=20;function yde(t){console.log(JSON.stringify(t,null,2))}function Sl(t){console.error(W(t))}async function WU(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await Xe();let a=await de(),u=$e(t,a?.config),c=(0,KU.randomUUID)().split("-")[0],l=as("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&ae(`Zipping ${u}@${i}`),i&&!ru.test(i)){let C=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Sl({error:"invalid_semver"}):g.error(C)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let C="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Sl({error:"missing_argument"}):g.error(C)),new Error(C)}if(o&&g.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!vl(s,"notifyAppReady"))throw r||(n?Sl({error:"notifyAppReady_not_in_source_code"}):g.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!dm(s))throw r||(n?Sl({error:"index_html_not_found"}):g.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await Jp(s);o&&g.info(`Zipped ${d.byteLength} bytes`);let f=o?Ct():null;f&&f.start("Calculating checksum");let m=Lr((0,GU.cwd)()),y=await us("@capgo/capacitor-updater",m,e.packageJson);if(!y){let C="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||g.warn(C),new Error(C)}let v=!1,E;try{E=y?lt(y):void 0}catch{E=void 0}E?v=!cs(E,void 0,void 0,"7.0.0"):y==="link:@capgo/capacitor-updater"&&(r||g.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await ni(d,e.keyV2||(0,_m.existsSync)($r)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>gde&&o&&(g.warn(`WARNING !!
346
346
  The bundle size is ${p} Mb, this may take a while to download for users
347
347
  `),g.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
348
348
  `));let D=o?Ct():null,w=e.name||`${u}_${i}.zip`;return D&&D.start(`Saving to ${w}`),(0,_m.writeFileSync)(w,d),D&&D.stop(`Saved to ${w}`),o&&le("Done \u2705"),!r&&n&&yde({bundle:i,filename:w,checksum:A}),{bundle:i,filename:w,checksum:A}}catch(a){throw r||(n?Sl(a):g.error(W(a))),a instanceof Error?a:new Error(String(a))}}async function XU(t,e,r,n=!1){n||ae("Create channel"),r.apikey=r.apikey||re();let i=await de().catch(()=>{});if(e=$e(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);await De(s,r.apikey,["write","all"]),await Et(s,r.apikey,e,4,n),n||g.info(`Creating channel ${e}#${t} to Capgo`);let o=await Db(s,e);if(!o)throw n||g.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let a=await Rr(s,e),u=await De(s,r.apikey,["write","all"]),c=await k8(s,{name:t,app_id:e,version:o.id,created_by:u,owner_org:a,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||g.error(`Cannot create Channel \u{1F640}
349
- ${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await _e(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:a,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel created \u2705"),le("Done \u2705")),c.data??!0}async function YU(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&ae("List current bundle"),r.apikey=r.apikey||re(i);let s=await de();if(e=$e(e,s?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(r.apikey,r.supaHost,r.supaAnon);if(await De(o,r.apikey,["write","all","read"]),await Et(o,r.apikey,e,1,n),!t)throw n||g.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:a,error:u}=await o.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!a?.length)throw n||g.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=a[0];if(!c)throw n||g.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(i?g.info(c.name):g.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function JU(t,e,r,n=!1){n||ae("Delete channel"),r.apikey=r.apikey||re();let i=await de();if(e=$e(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["all"]);if(await Et(s,r.apikey,e,4,n),r.deleteBundle&&!n&&g.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await B8(s,e,t);d?.name&&!n&&g.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await wb(s,e,d.name)}let{data:a,error:u}=await $8(s,e,t);if(u||!a){if(n||g.error(`Channel ${t} not found`),r.successIfNotFound)return n||g.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await L8(s,e,a.id);if(c)throw n||g.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||g.info(`Deleting channel ${e}#${t} from Capgo`);let l=await N8(s,t,e,o);if(l.error)throw n||g.error(`Cannot delete Channel \u{1F640} ${W(l.error)}`),new Error(`Cannot delete channel: ${W(l.error)}`);let h=await Rr(s,e);return await _e(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:h,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel deleted"),le("Done \u2705")),!0}async function ZU(t,e,r=!1){r||ae("List channels"),e.apikey=e.apikey||re();let n=await de();if(t=$e(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),s=await De(i,e.apikey,["write","all","read","upload"]);await Et(i,e.apikey,t,1,r),r||g.info("Querying available channels in Capgo");let o=await M8(i,t);return r||(g.info(`Active channels in Capgo: ${o?.length??0}`),j8(o)),await _e(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||le("Done \u2705"),o}var QU=["major","minor","metadata","patch","none"];async function eq(t,e,r,n=!1){n||ae("Set channel"),r.apikey=r.apikey||re();let i=await de();if(e=$e(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["write","all"]);await Et(s,r.apikey,e,4,n);let a=await Rr(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:m,selfAssign:y,disableAutoUpdate:v,dev:E,emulator:A}=r;if(h&&u)throw n||g.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||g.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&h)throw n||g.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&h==null&&d==null&&l==null&&f==null&&m==null&&y==null&&E==null&&A==null&&v==null)throw n||g.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await v8(s,a,r.apikey,e);let p={created_by:o,app_id:e,name:t,owner_org:a,version:void 0},{error:D}=await s.from("channels").select().eq("app_id",e).eq("name",t).single();if(D)throw n||g.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||as("",r.packageJson):u;if(w!=null){let{data:F,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(b||!F)throw n||g.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await yb(s,e,t,F.native_packages??[]),I=qn();if(R.length>0&&k.some(B=>!fo(B)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${I.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(R.length===0&&k.length>0?g.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):g.info(`Bundle is compatible with ${t} channel`))}n||g.info(`Set ${e} channel: ${t} to @${w}`),p.version=F.id}if(d){let{data:F,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(b||!F)throw n||g.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await yb(s,e,t,F.native_packages??[]),R=qn();if(k.some(I=>!fo(I)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${R.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||g.info(`Set ${e} channel: ${t} to @${F.name}`),p.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||g.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||g.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||g.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||g.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||g.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),y!=null&&(n||g.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!y),E!=null&&(n||g.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),p.allow_dev=!!E),A!=null&&(n||g.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),v!=null){let F=v.toLowerCase();if(!QU.includes(F))throw n||g.error(`Channel strategy ${F} is not known. The possible values are: ${QU.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),p.disable_auto_update=F,n||g.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:C}=await Zp(s,p);if(C)throw n||g.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await _e(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||le("Done \u2705"),!0}var dr=require("node:fs");function tq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function rq(t,e=!1){e||ae("Save keys \u{1F511}");let r=await de(),n=t.key||wi,i=t.keyData||"";if(!(0,dr.existsSync)(n)&&!i)throw e||g.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,dr.existsSync)(n)&&(i=(0,dr.readFileSync)(n,"utf8")),!i.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||g.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=tq(r.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=i,await Xa(r)}return e||(g.success(`Public key saved into ${r.path} file in local directory`),g.success("Your app will decode the zip archive with this key")),!0}async function nq(t,e=!1){e||ae("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Xa(r),(0,dr.existsSync)(tu))try{(0,dr.unlinkSync)(tu),e||g.success(`Old private key file deleted: ${tu}`)}catch(i){e||g.error(`Failed to delete old private key file: ${tu} (${String(i)})`)}if((0,dr.existsSync)(Wp))try{(0,dr.unlinkSync)(Wp),e||g.success(`Old public key file deleted: ${Wp}`)}catch(i){e||g.error(`Failed to delete old public key file: ${wi} (${String(i)})`)}return e||(g.success(`Old private key deleted from ${r.path} file`),le("Done \u2705")),!0}return e||g.info("No old private key found in config file"),!1}async function iq(t,e=!1){e||ae("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=l6();if((0,dr.existsSync)(wi)&&!t.force)throw e||g.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,dr.writeFileSync)(wi,r),(0,dr.existsSync)($r)&&!t.force)throw e||g.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,dr.writeFileSync)($r,n);let i=await de();if(i){let s=tq(i.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=r,await Xa(i)}if(!e){g.success("Your RSA key has been generated"),g.success(`Private key saved in ${$r}`),g.success("This key will be used to encrypt your bundle before sending it to Capgo"),g.success("Keep it safe"),g.success("Then make it unreadable by Capgo and unmodifiable by anyone"),g.success(`Public key saved in ${i.path}`),g.success("Your app will be the only one having it"),g.success("Only your users can decrypt your update"),g.success("Only you can send them an update");try{await F8(),le("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var _o=require("node:fs"),sq=require("node:os");async function oq(t,e,r=!1){if(r||ae("Login to Capgo"),!t)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Xe();let{local:n}=e;if(n){if(!(0,_o.existsSync)(".git"))throw r||g.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,_o.writeFileSync)(".capgo",`${t}
349
+ ${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await _e(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:a,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel created \u2705"),le("Done \u2705")),c.data??!0}async function YU(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&ae("List current bundle"),r.apikey=r.apikey||re(i);let s=await de();if(e=$e(e,s?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(r.apikey,r.supaHost,r.supaAnon);if(await De(o,r.apikey,["write","all","read"]),await Et(o,r.apikey,e,1,n),!t)throw n||g.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:a,error:u}=await o.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!a?.length)throw n||g.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=a[0];if(!c)throw n||g.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(i?g.info(c.name):g.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function JU(t,e,r,n=!1){n||ae("Delete channel"),r.apikey=r.apikey||re();let i=await de();if(e=$e(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["all"]);if(await Et(s,r.apikey,e,4,n),r.deleteBundle&&!n&&g.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await B8(s,e,t);d?.name&&!n&&g.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await wb(s,e,d.name)}let{data:a,error:u}=await $8(s,e,t);if(u||!a){if(n||g.error(`Channel ${t} not found`),r.successIfNotFound)return n||g.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await L8(s,e,a.id);if(c)throw n||g.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||g.info(`Deleting channel ${e}#${t} from Capgo`);let l=await N8(s,t,e,o);if(l.error)throw n||g.error(`Cannot delete Channel \u{1F640} ${W(l.error)}`),new Error(`Cannot delete channel: ${W(l.error)}`);let h=await Rr(s,e);return await _e(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:h,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel deleted"),le("Done \u2705")),!0}async function ZU(t,e,r=!1){r||ae("List channels"),e.apikey=e.apikey||re();let n=await de();if(t=$e(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),s=await De(i,e.apikey,["write","all","read","upload"]);await Et(i,e.apikey,t,1,r),r||g.info("Querying available channels in Capgo");let o=await M8(i,t);return r||(g.info(`Active channels in Capgo: ${o?.length??0}`),j8(o)),await _e(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||le("Done \u2705"),o}var QU=["major","minor","metadata","patch","none"];async function eq(t,e,r,n=!1){n||ae("Set channel"),r.apikey=r.apikey||re();let i=await de();if(e=$e(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["write","all"]);await Et(s,r.apikey,e,4,n);let a=await Rr(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:m,selfAssign:y,disableAutoUpdate:v,dev:E,emulator:A}=r;if(h&&u)throw n||g.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||g.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&h)throw n||g.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&h==null&&d==null&&l==null&&f==null&&m==null&&y==null&&E==null&&A==null&&v==null)throw n||g.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await v8(s,a,r.apikey,e);let p={created_by:o,app_id:e,name:t,owner_org:a,version:void 0},{error:D}=await s.from("channels").select().eq("app_id",e).eq("name",t).single();if(D)throw n||g.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||as("",r.packageJson):u;if(w!=null){let{data:F,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(b||!F)throw n||g.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await yb(s,e,t,F.native_packages??[]),I=qn();if(R.length>0&&k.some(B=>!fo(B)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${I.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(R.length===0&&k.length>0?g.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):g.info(`Bundle is compatible with ${t} channel`))}n||g.info(`Set ${e} channel: ${t} to @${w}`),p.version=F.id}if(d){let{data:F,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(b||!F)throw n||g.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await yb(s,e,t,F.native_packages??[]),R=qn();if(k.some(I=>!fo(I)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${R.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||g.info(`Set ${e} channel: ${t} to @${F.name}`),p.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||g.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||g.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||g.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||g.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||g.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),y!=null&&(n||g.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!y),E!=null&&(n||g.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),p.allow_dev=!!E),A!=null&&(n||g.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),v!=null){let F=v.toLowerCase();if(!QU.includes(F))throw n||g.error(`Channel strategy ${F} is not known. The possible values are: ${QU.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),p.disable_auto_update=F,n||g.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:C}=await Zp(s,p);if(C)throw n||g.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await _e(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||le("Done \u2705"),!0}var dr=require("node:fs");function tq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function rq(t,e=!1){e||ae("Save keys \u{1F511}");let r=await de(),n=t.key||vi,i=t.keyData||"";if(!(0,dr.existsSync)(n)&&!i)throw e||g.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,dr.existsSync)(n)&&(i=(0,dr.readFileSync)(n,"utf8")),!i.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||g.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=tq(r.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=i,await Xa(r)}return e||(g.success(`Public key saved into ${r.path} file in local directory`),g.success("Your app will decode the zip archive with this key")),!0}async function nq(t,e=!1){e||ae("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Xa(r),(0,dr.existsSync)(tu))try{(0,dr.unlinkSync)(tu),e||g.success(`Old private key file deleted: ${tu}`)}catch(i){e||g.error(`Failed to delete old private key file: ${tu} (${String(i)})`)}if((0,dr.existsSync)(Wp))try{(0,dr.unlinkSync)(Wp),e||g.success(`Old public key file deleted: ${Wp}`)}catch(i){e||g.error(`Failed to delete old public key file: ${vi} (${String(i)})`)}return e||(g.success(`Old private key deleted from ${r.path} file`),le("Done \u2705")),!0}return e||g.info("No old private key found in config file"),!1}async function iq(t,e=!1){e||ae("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=l6();if((0,dr.existsSync)(vi)&&!t.force)throw e||g.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,dr.writeFileSync)(vi,r),(0,dr.existsSync)($r)&&!t.force)throw e||g.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,dr.writeFileSync)($r,n);let i=await de();if(i){let s=tq(i.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=r,await Xa(i)}if(!e){g.success("Your RSA key has been generated"),g.success(`Private key saved in ${$r}`),g.success("This key will be used to encrypt your bundle before sending it to Capgo"),g.success("Keep it safe"),g.success("Then make it unreadable by Capgo and unmodifiable by anyone"),g.success(`Public key saved in ${i.path}`),g.success("Your app will be the only one having it"),g.success("Only your users can decrypt your update"),g.success("Only you can send them an update");try{await F8(),le("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var _o=require("node:fs"),sq=require("node:os");async function oq(t,e,r=!1){if(r||ae("Login to Capgo"),!t)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Xe();let{local:n}=e;if(n){if(!(0,_o.existsSync)(".git"))throw r||g.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,_o.writeFileSync)(".capgo",`${t}
350
350
  `),(0,_o.appendFileSync)(".gitignore",`.capgo
351
351
  `)}else{let o=(0,sq.homedir)();(0,_o.writeFileSync)(`${o}/.capgo`,`${t}
352
352
  `)}let i=await pe(t,e.supaHost,e.supaAnon),s=await De(i,t,["write","all","upload"]);await _e(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:s,notify:!1}).catch(),r||(g.success(`login saved into .capgo file in ${n?"local":"home"} directory`),le("Done \u2705"))}async function aq(t,e=!1){e||ae("Adding organization"),await Xe();let r={...t,apikey:t.apikey||re()};if(!r.apikey)throw e||g.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["write","all"]),{name:s,email:o}=r;if(!e&&!s){let c=await xi({message:"Organization name:",placeholder:"My Organization"});if(st(c))throw g.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await xi({message:"Management email:",placeholder:"admin@example.com"});if(st(c))throw g.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||g.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||g.info(`Adding organization "${s}" to Capgo`);let{data:a,error:u}=await n.from("orgs").insert({name:s,management_email:o,created_by:i}).select().single();if(u)throw e||g.error(`Could not add organization ${W(u)}`),new Error(`Could not add organization: ${W(u)}`);return await _e(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:a.id,tags:{"org-name":s},notify:!1}).catch(()=>{}),e||(g.success(`Organization "${s}" added to Capgo`),le("Done \u2705")),a}async function uq(t,e,r=!1){r||ae("Deleting organization"),await Xe();let n={...e,apikey:e.apikey||re()};if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon),s=await De(i,n.apikey,["write","all"]),{data:o,error:a}=await i.from("orgs").select("created_by, name").eq("id",t).single();if(a||!o)throw r||g.error(`Cannot get organization details ${W(a)}`),new Error(`Cannot get organization details: ${W(a)}`);if(o.created_by!==s){if(r)throw new Error("Deleting an organization is restricted to the organization owner");g.warn("Deleting an organization is restricted to the organization owner"),g.warn("You are not the owner of this organization"),g.warn("It's strongly recommended that you do not continue!");let c=await gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(c)||c==="no")throw g.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await Pr({message:`Are you sure you want to delete organization "${o.name}"? This action cannot be undone.`});if(st(c)||!c)throw g.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||g.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||g.error(`Could not delete organization ${W(u)}`),new Error(`Could not delete organization: ${W(u)}`);return await _e(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":o.name},notify:!1}).catch(()=>{}),r||(g.success(`Organization "${o.name}" deleted from Capgo`),le("Done \u2705")),!0}function Dde(t,e){if(e)return;if(!t.length){g.error("No organizations found");return}let r=new zt;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);g.success("Organizations"),g.success(r.toString())}async function cq(t,e=!1){e||ae("List organizations"),await Xe();let r={...t,apikey:t.apikey||re()};if(!r.apikey)throw e||g.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon);await De(n,r.apikey,["read","write","all"]),e||g.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||g.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(g.info(`Organizations found: ${o.length}`),Dde(o,e),le("Done \u2705")),o}async function lq(t,e,r=!1){r||ae("Updating organization"),await Xe();let n={...e,apikey:e.apikey||re()};if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon);await De(i,n.apikey,["write","all"]);let{data:s,error:o}=await i.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(o||!s)throw r||g.error(`Cannot get organization details ${W(o)}`),new Error(`Cannot get organization details: ${W(o)}`);let{name:a,email:u}=n;if(!r&&!a){let l=await xi({message:"New organization name:",placeholder:s.name||"My Organization"});if(st(l))throw g.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await xi({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(st(l))throw g.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||g.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||g.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||g.error(`Could not update organization ${W(c)}`),new Error(`Could not update organization: ${W(c)}`);return await _e(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":a},notify:!1}).catch(()=>{}),r||(g.success("Organization updated"),le("Done \u2705")),{orgId:t,name:a,email:u}}async function fq(t,e=!1){e||ae("Getting user id");let r={...t,apikey:t.apikey||re()};if(!r.apikey)throw e||g.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["read","all","write"]);return e||le(`Done \u2705: ${i}`),i}catch(n){throw e||g.error(`Error getting user id ${W(n)}`),n instanceof Error?n:new Error(String(n))}}var nt=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await oq(e.apikey,{local:e.local??!1,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async doctor(e){try{return{success:!0,data:await W8({packageJson:e?.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addApp(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await V8(e.appId,r,void 0,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateApp(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await J8(e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteApp(e,r=!1){try{let n={apikey:this.apikey||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await z8(e,n,!1,r),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async listApps(){try{let e={apikey:this.apikey||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await X8(e,!1)).map(i=>({appId:i.app_id,name:i.name||"Unknown",iconUrl:i.icon_url||void 0,createdAt:new Date(i.created_at||"")}))}}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}async getAccountId(e){try{let r={apikey:e?.apikey||this.apikey||re(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await fq(r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async checkBundleCompatibility(e){try{let r={apikey:e.apikey||this.apikey||re(!0),channel:e.channel,text:e.textOutput??!1,packageJson:e.packageJson,nodeModules:e.nodeModules,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon};return{success:!0,data:(await o6(e.appId,r,!0)).finalCompatibility}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async encryptBundle(e){try{return{success:!0,data:await m6(e.zipPath,e.checksum,{key:e.keyPath,keyData:e.keyData,json:e.json},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async decryptBundle(e){try{return{success:!0,data:await d6(e.zipPath,e.ivSessionKey,{key:e.keyPath,keyData:e.keyData,checksum:e.checksum},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async zipBundle(e){try{return{success:!0,data:await WU(e.appId,{apikey:this.apikey||re(!0),path:e.path,bundle:e.bundle,name:e.name,codeCheck:e.codeCheck,json:e.json,keyV2:e.keyV2,packageJson:e.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async uploadBundle(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,bundle:e.bundle,channel:e.channel,external:e.external,key:e.encrypt!==!1,keyV2:e.encryptionKey,timeout:e.timeout,tus:e.useTus,comment:e.comment,minUpdateVersion:e.minUpdateVersion,autoMinUpdateVersion:e.autoMinUpdateVersion,selfAssign:e.selfAssign,packageJson:e.packageJsonPaths,ignoreMetadataCheck:e.ignoreCompatibilityCheck,codeCheck:!e.disableCodeCheck,zip:e.useZip},n=await zb(e.appId,r,!0);return{success:n.success,bundleId:n.bundle,checksum:n.checksum??null,encryptionMethod:n.encryptionMethod,sessionKey:n.sessionKey,ivSessionKey:n.ivSessionKey,storageProvider:n.storageProvider,skipped:n.skipped,reason:n.reason}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listBundles(e){try{let r=this.apikey||re(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await rm(n,e)).map(o=>({id:o.id.toString(),version:o.name,uploadedAt:new Date(o.created_at||""),size:0,encrypted:o.session_key!==null}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteBundle(e,r){try{let n={apikey:this.apikey||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await p6(r,e,n,!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async cleanupBundles(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle||"",version:"",keep:e.keep||4,force:e.force||!1,ignoreChannel:e.ignoreChannel||!1};return{success:!0,data:await s6(e.appId,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async requestBuild(e){try{let r=e.credentials,n={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,platform:e.platform,userId:e.userId,buildCertificateBase64:r?.BUILD_CERTIFICATE_BASE64,buildProvisionProfileBase64:r?.BUILD_PROVISION_PROFILE_BASE64,buildProvisionProfileBase64Prod:r?.BUILD_PROVISION_PROFILE_BASE64_PROD,p12Password:r?.P12_PASSWORD,appleKeyId:r?.APPLE_KEY_ID,appleIssuerId:r?.APPLE_ISSUER_ID,appleKeyContent:r?.APPLE_KEY_CONTENT,appStoreConnectTeamId:r?.APP_STORE_CONNECT_TEAM_ID,androidKeystoreFile:r?.ANDROID_KEYSTORE_FILE,keystoreKeyAlias:r?.KEYSTORE_KEY_ALIAS,keystoreKeyPassword:r?.KEYSTORE_KEY_PASSWORD,keystoreStorePassword:r?.KEYSTORE_STORE_PASSWORD,playConfigJson:r?.PLAY_CONFIG_JSON},i=await i6(e.appId,n,!0);return i.success&&i.jobId?{success:!0,data:{jobId:i.jobId,uploadUrl:i.uploadUrl||"",status:i.status||"unknown"}}:{success:!1,error:i.error||"Unknown error during build request"}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async getCurrentBundle(e,r,n){try{let i={apikey:n?.apikey||this.apikey||re(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await YU(r,e,i,!0)}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async addChannel(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await XU(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateChannel(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle??void 0,state:e.state,downgrade:e.downgrade,ios:e.ios,android:e.android,selfAssign:e.selfAssign,disableAutoUpdate:e.disableAutoUpdate??void 0,dev:e.dev,emulator:e.emulator,latest:!1,latestRemote:!1,packageJson:void 0,ignoreMetadataCheck:!1};return await eq(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteChannel(e,r,n=!1){try{let i={apikey:this.apikey||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await JU(e,r,i,!0),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async listChannels(e){try{let r={apikey:this.apikey||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await ZU(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await iq({force:e?.force,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async saveEncryptionKey(e){try{return await rq({key:e?.keyPath,keyData:e?.keyData,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteLegacyEncryptionKey(e){try{return{success:!0,data:{deleted:await nq({force:e?.force,setupChannel:e?.setupChannel},!0)}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listOrganizations(e){try{let r={apikey:e?.apikey||this.apikey||re(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await cq(r,!0)).map(s=>({id:String(s.id??s.gid??""),name:s.name??"Unknown",role:s.role??void 0,appCount:typeof s.app_count=="number"?s.app_count:void 0,email:s.management_email??void 0,createdAt:s.created_at?new Date(s.created_at):void 0}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addOrganization(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await aq(r,!0);return{success:!0,data:{id:String(n.id??n.gid??""),name:n.name??e.name,role:"owner",appCount:0,email:n.management_email??e.email,createdAt:n.created_at?new Date(n.created_at):void 0}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateOrganization(e){try{let r={apikey:e.apikey||this.apikey||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await lq(e.orgId,r,!0);return{success:!0,data:{id:n.orgId,name:n.name,email:n.email}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteOrganization(e,r){try{let n={apikey:r?.apikey||this.apikey||re(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await uq(e,n,!0)}}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async getStats(e){try{let r=e.apikey||this.apikey||re(!0),n=await Sn(),i={appId:e.appId,devicesId:e.deviceIds,search:e.search,order:e.order,rangeStart:e.after||e.rangeStart,rangeEnd:e.rangeEnd,limit:e.limit},s=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:r},body:JSON.stringify(i)});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return{success:!0,data:(await s.json()).map(u=>({appId:u.app_id,deviceId:u.device_id,action:u.action,versionId:u.version_id,version:u.version,createdAt:u.created_at}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async setAppSetting(e,r){try{return await Z8(e,{apikey:r.apikey||this.apikey||re(!0),bool:r.bool,string:r.string},!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}};async function wde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function vde(t){return new nt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function Ede(t){return new nt().doctor(t)}async function bde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function _de(t){return new nt().encryptBundle(t)}async function Cde(t){return new nt().decryptBundle(t)}async function Sde(t){return new nt().zipBundle(t)}async function Ade(t){return new nt().generateEncryptionKeys(t)}async function Ode(t){return new nt().saveEncryptionKey(t)}async function xde(t){return new nt().deleteLegacyEncryptionKey(t)}async function Tde(t,e,r){return new nt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Ide(t,e){return new nt({apikey:e.apikey}).setAppSetting(t,e)}async function Pde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function Fde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function Rde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function kde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function Nde(t,e){return new nt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function $de(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function Lde(t,e){return new nt(e).listBundles(t)}async function Bde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function jde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function Mde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function Ude(){try{return await de()}catch{return null}}0&&(module.exports={CapgoSDK,addApp,addChannel,addOrganization,checkBundleCompatibility,createSupabaseClient,decryptBundle,deleteLegacyEncryptionKey,deleteOrganization,doctor,encryptBundle,generateEncryptionKeys,getAccountId,getCapacitorConfig,getCurrentBundle,getStats,listBundles,listOrganizations,login,requestBuild,saveEncryptionKey,updateAppSetting,updateOrganization,uploadBundle,zipBundle});