@capgo/cli 7.52.0 → 7.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -38
- package/dist/package.json +1 -1
- package/dist/src/build/request.d.ts.map +1 -1
- package/dist/src/sdk.js +21 -21
- package/package.json +1 -1
package/dist/src/sdk.js
CHANGED
|
@@ -5,12 +5,12 @@ ${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()),Ct=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=_(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=`
|
|
9
9
|
addEventListener("message", (e) => {
|
|
10
10
|
if (e.data.event === "start") {
|
|
11
11
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
12
12
|
}
|
|
13
|
-
});`,$g=class{constructor(e,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=
|
|
13
|
+
});`,$g=class{constructor(e,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=St.DEFAULT_TIMEOUT,this.transport=null,this.heartbeatIntervalMs=tf.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Ng,this.ref=0,this.reconnectTimer=null,this.vsn=St.DEFAULT_VSN,this.logger=Ng,this.conn=null,this.sendBuffer=[],this.serializer=new t5.default,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>i?(...s)=>i(...s):(...s)=>fetch(...s),!(!((n=r?.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${e}/${St.TRANSPORTS.websocket}`,this.httpEndpoint=(0,n5.httpEndpointURL)(e),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=e5.default.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");let r=e.message;throw r.includes("Node.js")?new Error(`${r}
|
|
14
14
|
|
|
15
15
|
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
16
16
|
|
|
@@ -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 Ct.SOCKET_STATES.connecting:return Ct.CONNECTION_STATE.Connecting;case Ct.SOCKET_STATES.open:return Ct.CONNECTION_STATE.Open;case Ct.SOCKET_STATES.closing:return Ct.CONNECTION_STATE.Closing;default:return Ct.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===Ct.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(Ct.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===Ct.SOCKET_STATES.open||this.conn.readyState===Ct.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(Ct.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:Ct.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(Ct.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:Ct.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:Ct.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 Ct.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 Ct.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=_(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=`
|
|
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:
|
|
@@ -66,7 +66,7 @@ GFS4: `),console.error(t)});pt[Ht]||(hT=global[Ht]||[],pT(pt,hT),pt.close=(funct
|
|
|
66
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;
|
|
67
67
|
|
|
68
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=_(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.ancillary=St.failure=St.success=St.input=St.weak=St.strong=void 0;var XZ=(he(),ce(fe)),On=XZ.__importDefault(JI());St.strong=On.default.bold;St.weak=On.default.dim;St.input=On.default.cyan;St.success=On.default.green;St.failure=On.default.red;St.ancillary=On.default.cyan;var YZ={strong:St.strong,weak:St.weak,input:St.input,success:St.success,failure:St.failure,ancillary:St.ancillary,log:{DEBUG:On.default.magenta,INFO:On.default.cyan,WARN:On.default.yellow,ERROR:On.default.red}};St.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(`
|
|
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(`
|
|
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,`
|
|
@@ -184,8 +184,8 @@ Filtered results for: ${this.inputValue?this.inputValue:hi.gray("Enter something
|
|
|
184
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(`
|
|
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
|
-
`},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 At=_((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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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=At(),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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},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=At(),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:`
|
|
188
|
-
`,D.offset=(F=p.offset)!=null?F:0,D.dontPrettyTextNodes=(b=(k=p.dontPrettyTextNodes)!=null?k:p.dontprettytextnodes)!=null?b:0,D.spaceBeforeSlash=(R=(I=p.spaceBeforeSlash)!=null?I:p.spacebeforeslash)!=null?R:"",D.spaceBeforeSlash===!0&&(D.spaceBeforeSlash=" "),D.suppressPrettyCount=0,D.user={},D.state=e.None,D},A.prototype.indent=function(p,D,w){var C;return!D.pretty||D.suppressPrettyCount?"":D.pretty&&(C=(w||0)+D.offset+1,C>0)?new Array(C).join(D.indent):""},A.prototype.endline=function(p,D,w){return!D.pretty||D.suppressPrettyCount?"":D.newline},A.prototype.attribute=function(p,D,w){var C;return this.openAttribute(p,D,w),C=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,D,w),C},A.prototype.cdata=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<![CDATA[",D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+="]]>"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.comment=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!-- ",D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=" -->"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.declaration=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<?xml",D.state=e.InsideTag,C+=' version="'+p.version+'"',p.encoding!=null&&(C+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(C+=' standalone="'+p.standalone+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.docType=function(p,D,w){var C,F,b,k,R;if(w||(w=0),this.openNode(p,D,w),D.state=e.OpenTag,k=this.indent(p,D,w),k+="<!DOCTYPE "+p.root().name,p.pubID&&p.sysID?k+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(k+=' SYSTEM "'+p.sysID+'"'),p.children.length>0){for(k+=" [",k+=this.endline(p,D,w),D.state=e.InsideTag,R=p.children,F=0,b=R.length;F<b;F++)C=R[F],k+=this.writeChildNode(C,D,w+1);D.state=e.CloseTag,k+="]"}return D.state=e.CloseTag,k+=D.spaceBeforeSlash+">",k+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),k},A.prototype.element=function(p,D,w){var C,F,b,k,R,I,B,j,z,L,S,T,P,$;w||(w=0),L=!1,S="",this.openNode(p,D,w),D.state=e.OpenTag,S+=this.indent(p,D,w)+"<"+p.name,T=p.attribs;for(z in T)E.call(T,z)&&(C=T[z],S+=this.attribute(C,D,w));if(b=p.children.length,k=b===0?null:p.children[0],b===0||p.children.every(function(q){return(q.type===t.Text||q.type===t.Raw)&&q.value===""}))D.allowEmpty?(S+=">",D.state=e.CloseTag,S+="</"+p.name+">"+this.endline(p,D,w)):(D.state=e.CloseTag,S+=D.spaceBeforeSlash+"/>"+this.endline(p,D,w));else if(D.pretty&&b===1&&(k.type===t.Text||k.type===t.Raw)&&k.value!=null)S+=">",D.state=e.InsideTag,D.suppressPrettyCount++,L=!0,S+=this.writeChildNode(k,D,w+1),D.suppressPrettyCount--,L=!1,D.state=e.CloseTag,S+="</"+p.name+">"+this.endline(p,D,w);else{if(D.dontPrettyTextNodes){for(P=p.children,R=0,B=P.length;R<B;R++)if(F=P[R],(F.type===t.Text||F.type===t.Raw)&&F.value!=null){D.suppressPrettyCount++,L=!0;break}}for(S+=">"+this.endline(p,D,w),D.state=e.InsideTag,$=p.children,I=0,j=$.length;I<j;I++)F=$[I],S+=this.writeChildNode(F,D,w+1);D.state=e.CloseTag,S+=this.indent(p,D,w)+"</"+p.name+">",L&&D.suppressPrettyCount--,S+=this.endline(p,D,w),D.state=e.None}return this.closeNode(p,D,w),S},A.prototype.writeChildNode=function(p,D,w){switch(p.type){case t.CData:return this.cdata(p,D,w);case t.Comment:return this.comment(p,D,w);case t.Element:return this.element(p,D,w);case t.Raw:return this.raw(p,D,w);case t.Text:return this.text(p,D,w);case t.ProcessingInstruction:return this.processingInstruction(p,D,w);case t.Dummy:return"";case t.Declaration:return this.declaration(p,D,w);case t.DocType:return this.docType(p,D,w);case t.AttributeDeclaration:return this.dtdAttList(p,D,w);case t.ElementDeclaration:return this.dtdElement(p,D,w);case t.EntityDeclaration:return this.dtdEntity(p,D,w);case t.NotationDeclaration:return this.dtdNotation(p,D,w);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<?",D.state=e.InsideTag,C+=p.target,p.value&&(C+=" "+p.value),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.raw=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w),D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.text=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w),D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdAttList=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ATTLIST",D.state=e.InsideTag,C+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(C+=" "+p.defaultValueType),p.defaultValue&&(C+=' "'+p.defaultValue+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdElement=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ELEMENT",D.state=e.InsideTag,C+=" "+p.name+" "+p.value,D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdEntity=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ENTITY",D.state=e.InsideTag,p.pe&&(C+=" %"),C+=" "+p.name,p.value?C+=' "'+p.value+'"':(p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),p.nData&&(C+=" NDATA "+p.nData)),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdNotation=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!NOTATION",D.state=e.InsideTag,C+=" "+p.name,p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?C+=' PUBLIC "'+p.pubID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.openNode=function(p,D,w){},A.prototype.closeNode=function(p,D,w){},A.prototype.openAttribute=function(p,D,w){},A.prototype.closeAttribute=function(p,D,w){},A})()}).call(PN)});var ep=_((RN,kN)=>{(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=Cv(),kN.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o)}return s.prototype.document=function(o,a){var u,c,l,h,d;for(a=this.filterOptions(a),h="",d=o.children,c=0,l=d.length;c<l;c++)u=d[c],h+=this.writeChildNode(u,a,0);return a.pretty&&h.slice(-a.newline.length)===a.newline&&(h=h.slice(0,-a.newline.length)),h},s})(e)}).call(RN)});var Sv=_((NN,$N)=>{(function(){var t,e,r,n,i,s,o,a,u=function(l,h){for(var d in h)c.call(h,d)&&(l[d]=h[d]);function f(){this.constructor=l}return f.prototype=h.prototype,l.prototype=new f,l.__super__=h.prototype,l},c={}.hasOwnProperty;a=Ln().isPlainObject,r=vv(),e=Bk(),i=kr(),t=At(),o=_v(),s=ep(),$N.exports=n=(function(l){u(h,l);function h(d){h.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,d||(d={}),d.writer||(d.writer=new s),this.options=d,this.stringify=new o(d)}return Object.defineProperty(h.prototype,"implementation",{value:new r}),Object.defineProperty(h.prototype,"doctype",{get:function(){var d,f,m,y;for(y=this.children,f=0,m=y.length;f<m;f++)if(d=y[f],d.type===t.DocType)return d;return null}}),Object.defineProperty(h.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(h.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(h.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(h.prototype,"origin",{get:function(){return null}}),Object.defineProperty(h.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(h.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(h.prototype,"contentType",{get:function(){return null}}),h.prototype.end=function(d){var f;return f={},d?a(d)&&(f=d,d=this.options.writer):d=this.options.writer,d.document(this,d.filterOptions(f))},h.prototype.toString=function(d){return this.options.writer.document(this,this.options.writer.filterOptions(d))},h.prototype.createElement=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTextNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createComment=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createCDATASection=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createProcessingInstruction=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttribute=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEntityReference=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.importNode=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createElementNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttributeNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementById=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.adoptNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.renameNode=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEvent=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createNodeIterator=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTreeWalker=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h})(i)}).call(NN)});var jN=_((LN,BN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,v,E,A,p,D,w,C,F,b={}.hasOwnProperty;F=Ln(),w=F.isObject,D=F.isFunction,C=F.isPlainObject,p=F.getValue,t=At(),h=Sv(),f=qd(),n=Hd(),i=Vd(),y=Jd(),A=Zd(),m=Qd(),c=zd(),l=Yd(),s=Kd(),a=Gd(),o=Wd(),u=Xd(),r=Ev(),E=_v(),v=ep(),e=Bc(),BN.exports=d=(function(){function k(R,I,B){var j;this.name="?xml",this.type=t.Document,R||(R={}),j={},R.writer?C(R.writer)&&(j=R.writer,R.writer=new v):R.writer=new v,this.options=R,this.writer=R.writer,this.writerOptions=this.writer.filterOptions(j),this.stringify=new E(R),this.onDataCallback=I||function(){},this.onEndCallback=B||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return k.prototype.createChildNode=function(R){var I,B,j,z,L,S,T,P;switch(R.type){case t.CData:this.cdata(R.value);break;case t.Comment:this.comment(R.value);break;case t.Element:j={},T=R.attribs;for(B in T)b.call(T,B)&&(I=T[B],j[B]=I.value);this.node(R.name,j);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(R.value);break;case t.Text:this.text(R.value);break;case t.ProcessingInstruction:this.instruction(R.target,R.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+R.constructor.name)}for(P=R.children,L=0,S=P.length;L<S;L++)z=P[L],this.createChildNode(z),z.type===t.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(R,I,B){var j;if(R==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(R));return this.openCurrent(),R=p(R),I==null&&(I={}),I=p(I),w(I)||(j=[I,B],B=j[0],I=j[1]),this.currentNode=new f(this,R,I),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,B!=null&&this.text(B),this},k.prototype.element=function(R,I,B){var j,z,L,S,T,P;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(R)||w(R)||D(R))for(S=this.options.noValidation,this.options.noValidation=!0,P=new h(this.options).element("TEMP_ROOT"),P.element(R),this.options.noValidation=S,T=P.children,z=0,L=T.length;z<L;z++)j=T[z],this.createChildNode(j),j.type===t.Element&&this.up();else this.node(R,I,B);return this},k.prototype.attribute=function(R,I){var B,j;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(R));if(R!=null&&(R=p(R)),w(R))for(B in R)b.call(R,B)&&(j=R[B],this.attribute(B,j));else D(I)&&(I=I.apply()),this.options.keepNullAttributes&&I==null?this.currentNode.attribs[R]=new r(this,R,""):I!=null&&(this.currentNode.attribs[R]=new r(this,R,I));return this},k.prototype.text=function(R){var I;return this.openCurrent(),I=new A(this,R),this.onData(this.writer.text(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.cdata=function(R){var I;return this.openCurrent(),I=new n(this,R),this.onData(this.writer.cdata(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.comment=function(R){var I;return this.openCurrent(),I=new i(this,R),this.onData(this.writer.comment(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.raw=function(R){var I;return this.openCurrent(),I=new y(this,R),this.onData(this.writer.raw(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.instruction=function(R,I){var B,j,z,L,S;if(this.openCurrent(),R!=null&&(R=p(R)),I!=null&&(I=p(I)),Array.isArray(R))for(B=0,L=R.length;B<L;B++)j=R[B],this.instruction(j);else if(w(R))for(j in R)b.call(R,j)&&(z=R[j],this.instruction(j,z));else D(I)&&(I=I.apply()),S=new m(this,R,I),this.onData(this.writer.processingInstruction(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},k.prototype.declaration=function(R,I,B){var j;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return j=new c(this,R,I,B),this.onData(this.writer.declaration(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(R,I,B){if(this.openCurrent(),R==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,I,B),this.currentNode.rootNodeName=R,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(R,I){var B;return this.openCurrent(),B=new o(this,R,I),this.onData(this.writer.dtdElement(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(R,I,B,j,z){var L;return this.openCurrent(),L=new s(this,R,I,B,j,z),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(R,I){var B;return this.openCurrent(),B=new a(this,!1,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(R,I){var B;return this.openCurrent(),B=new a(this,!0,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(R,I){var B;return this.openCurrent(),B=new u(this,R,I),this.onData(this.writer.dtdNotation(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},k.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},k.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},k.prototype.openNode=function(R){var I,B,j,z;if(!R.isOpen){if(!this.root&&this.currentLevel===0&&R.type===t.Element&&(this.root=R),B="",R.type===t.Element){this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<"+R.name,z=R.attribs;for(j in z)b.call(z,j)&&(I=z[j],B+=this.writer.attribute(I,this.writerOptions,this.currentLevel));B+=(R.children?">":"/>")+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+R.rootNodeName,R.pubID&&R.sysID?B+=' PUBLIC "'+R.pubID+'" "'+R.sysID+'"':R.sysID&&(B+=' SYSTEM "'+R.sysID+'"'),R.children?(B+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,B+=">"),B+=this.writer.endline(R,this.writerOptions,this.currentLevel);return this.onData(B,this.currentLevel),R.isOpen=!0}},k.prototype.closeNode=function(R){var I;if(!R.isClosed)return I="",this.writerOptions.state=e.CloseTag,R.type===t.Element?I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"</"+R.name+">"+this.writer.endline(R,this.writerOptions,this.currentLevel):I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(I,this.currentLevel),R.isClosed=!0},k.prototype.onData=function(R,I){return this.documentStarted=!0,this.onDataCallback(R,I+1)},k.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},k.prototype.debugInfo=function(R){return R==null?"":"node: <"+R+">"},k.prototype.ele=function(){return this.element.apply(this,arguments)},k.prototype.nod=function(R,I,B){return this.node(R,I,B)},k.prototype.txt=function(R){return this.text(R)},k.prototype.dat=function(R){return this.cdata(R)},k.prototype.com=function(R){return this.comment(R)},k.prototype.ins=function(R,I){return this.instruction(R,I)},k.prototype.dec=function(R,I,B){return this.declaration(R,I,B)},k.prototype.dtd=function(R,I,B){return this.doctype(R,I,B)},k.prototype.e=function(R,I,B){return this.element(R,I,B)},k.prototype.n=function(R,I,B){return this.node(R,I,B)},k.prototype.t=function(R){return this.text(R)},k.prototype.d=function(R){return this.cdata(R)},k.prototype.c=function(R){return this.comment(R)},k.prototype.r=function(R){return this.raw(R)},k.prototype.i=function(R,I){return this.instruction(R,I)},k.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.ent=function(R,I){return this.entity(R,I)},k.prototype.pent=function(R,I){return this.pEntity(R,I)},k.prototype.not=function(R,I){return this.notation(R,I)},k})()}).call(LN)});var qN=_((MN,UN)=>{(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;t=At(),n=Cv(),e=Bc(),UN.exports=r=(function(o){i(a,o);function a(u,c){this.stream=u,a.__super__.constructor.call(this,c)}return a.prototype.endline=function(u,c,l){return u.isLastRootNode&&c.state===e.CloseTag?"":a.__super__.endline.call(this,u,c,l)},a.prototype.document=function(u,c){var l,h,d,f,m,y,v,E,A;for(v=u.children,h=d=0,m=v.length;d<m;h=++d)l=v[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),E=u.children,A=[],f=0,y=E.length;f<y;f++)l=E[f],A.push(this.writeChildNode(l,c,0));return A},a.prototype.attribute=function(u,c,l){return this.stream.write(a.__super__.attribute.call(this,u,c,l))},a.prototype.cdata=function(u,c,l){return this.stream.write(a.__super__.cdata.call(this,u,c,l))},a.prototype.comment=function(u,c,l){return this.stream.write(a.__super__.comment.call(this,u,c,l))},a.prototype.declaration=function(u,c,l){return this.stream.write(a.__super__.declaration.call(this,u,c,l))},a.prototype.docType=function(u,c,l){var h,d,f,m;if(l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)),this.stream.write("<!DOCTYPE "+u.root().name),u.pubID&&u.sysID?this.stream.write(' PUBLIC "'+u.pubID+'" "'+u.sysID+'"'):u.sysID&&this.stream.write(' SYSTEM "'+u.sysID+'"'),u.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(u,c,l)),c.state=e.InsideTag,m=u.children,d=0,f=m.length;d<f;d++)h=m[d],this.writeChildNode(h,c,l+1);c.state=e.CloseTag,this.stream.write("]")}return c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.element=function(u,c,l){var h,d,f,m,y,v,E,A,p,D;l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)+"<"+u.name),p=u.attribs;for(E in p)s.call(p,E)&&(h=p[E],this.attribute(h,c,l));if(f=u.children.length,m=f===0?null:u.children[0],f===0||u.children.every(function(w){return(w.type===t.Text||w.type===t.Raw)&&w.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=e.CloseTag,this.stream.write("</"+u.name+">")):(c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&f===1&&(m.type===t.Text||m.type===t.Raw)&&m.value!=null)this.stream.write(">"),c.state=e.InsideTag,c.suppressPrettyCount++,A=!0,this.writeChildNode(m,c,l+1),c.suppressPrettyCount--,A=!1,c.state=e.CloseTag,this.stream.write("</"+u.name+">");else{for(this.stream.write(">"+this.endline(u,c,l)),c.state=e.InsideTag,D=u.children,y=0,v=D.length;y<v;y++)d=D[y],this.writeChildNode(d,c,l+1);c.state=e.CloseTag,this.stream.write(this.indent(u,c,l)+"</"+u.name+">")}return this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.processingInstruction=function(u,c,l){return this.stream.write(a.__super__.processingInstruction.call(this,u,c,l))},a.prototype.raw=function(u,c,l){return this.stream.write(a.__super__.raw.call(this,u,c,l))},a.prototype.text=function(u,c,l){return this.stream.write(a.__super__.text.call(this,u,c,l))},a.prototype.dtdAttList=function(u,c,l){return this.stream.write(a.__super__.dtdAttList.call(this,u,c,l))},a.prototype.dtdElement=function(u,c,l){return this.stream.write(a.__super__.dtdElement.call(this,u,c,l))},a.prototype.dtdEntity=function(u,c,l){return this.stream.write(a.__super__.dtdEntity.call(this,u,c,l))},a.prototype.dtdNotation=function(u,c,l){return this.stream.write(a.__super__.dtdNotation.call(this,u,c,l))},a})(n)}).call(MN)});var VN=_((HN,Zi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=Ln(),a=c.assign,u=c.isFunction,r=vv(),n=Sv(),i=jN(),o=ep(),s=qN(),t=At(),e=Bc(),Zi.exports.create=function(l,h,d,f){var m,y;if(l==null)throw new Error("Root element needs a name.");return f=a({},h,d,f),m=new n(f),y=m.element(l),f.headless||(m.declaration(f),(f.pubID!=null||f.sysID!=null)&&m.dtd(f)),y},Zi.exports.begin=function(l,h,d){var f;return u(l)&&(f=[l,h],h=f[0],d=f[1],l={}),h?new i(l,h,d):new n(l)},Zi.exports.stringWriter=function(l){return new o(l)},Zi.exports.streamWriter=function(l,h){return new s(l,h)},Zi.exports.implementation=new r,Zi.exports.nodeType=t,Zi.exports.writerState=e}).call(HN)});var zN=_(Av=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=VN(),e=Md().defaults,n=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},i=function(o){return"<![CDATA["+r(o)+"]]>"},r=function(o){return o.replace("]]>","]]]]><![CDATA[>")},Av.Builder=(function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)s.call(c,u)&&(l=c[u],this.options[u]=l);for(u in a)s.call(a,u)&&(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,h,d;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,l=(function(f){return function(m,y){var v,E,A,p,D,w;if(typeof y!="object")f.options.cdata&&n(y)?m.raw(i(y)):m.txt(y);else if(Array.isArray(y)){for(p in y)if(s.call(y,p)){E=y[p];for(D in E)A=E[D],m=l(m.ele(D),A).up()}}else for(D in y)if(s.call(y,D))if(E=y[D],D===u){if(typeof E=="object")for(v in E)w=E[v],m=m.att(v,w)}else if(D===c)f.options.cdata&&n(E)?m=m.raw(i(E)):m=m.txt(E);else if(Array.isArray(E))for(p in E)s.call(E,p)&&(A=E[p],typeof A=="string"?f.options.cdata&&n(A)?m=m.ele(D).raw(i(A)).up():m=m.ele(D,A).up():m=l(m.ele(D),A).up());else typeof E=="object"?m=l(m.ele(D),E).up():typeof E=="string"&&f.options.cdata&&n(E)?m=m.ele(D).raw(i(E)).up():(E==null&&(E=""),m=m.ele(D,E.toString()).up());return m}})(this),h=t.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(h,a).end(this.options.renderOpts)},o})()}).call(Av)});var KN=_(tp=>{(function(t){t.parser=function(x,O){return new r(x,O)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(x,O){if(!(this instanceof r))return new r(x,O);var V=this;i(V),V.q=V.c="",V.bufferCheckPosition=t.MAX_BUFFER_LENGTH,V.opt=O||{},V.opt.lowercase=V.opt.lowercase||V.opt.lowercasetags,V.looseCase=V.opt.lowercase?"toLowerCase":"toUpperCase",V.tags=[],V.closed=V.closedRoot=V.sawRoot=!1,V.tag=V.error=null,V.strict=!!x,V.noscript=!!(x||V.opt.noscript),V.state=b.BEGIN,V.strictEntities=V.opt.strictEntities,V.ENTITIES=V.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),V.attribList=[],V.opt.xmlns&&(V.ns=Object.create(m)),V.opt.unquotedAttributeValues===void 0&&(V.opt.unquotedAttributeValues=!x),V.trackPosition=V.opt.position!==!1,V.trackPosition&&(V.position=V.line=V.column=0),R(V,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var V=new O;return V}),Object.keys||(Object.keys=function(x){var O=[];for(var V in x)x.hasOwnProperty(V)&&O.push(V);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),V=0,N=0,ne=e.length;N<ne;N++){var K=x[e[N]].length;if(K>O)switch(e[N]){case"textNode":B(x);break;case"cdata":I(x,"oncdata",x.cdata),x.cdata="";break;case"script":I(x,"onscript",x.script),x.script="";break;default:z(x,"Max buffer length exceeded: "+e[N])}V=Math.max(V,K)}var oe=t.MAX_BUFFER_LENGTH-V;x.bufferCheckPosition=oe+x.position}function i(x){for(var O=0,V=e.length;O<V;O++)x[e[O]]=""}function s(x){B(x),x.cdata!==""&&(I(x,"oncdata",x.cdata),x.cdata=""),x.script!==""&&(I(x,"onscript",x.script),x.script="")}r.prototype={end:function(){L(this)},write:te,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var o;try{o=require("stream").Stream}catch{o=function(){}}o||(o=function(){});var a=t.EVENTS.filter(function(x){return x!=="error"&&x!=="end"});function u(x,O){return new c(x,O)}function c(x,O){if(!(this instanceof c))return new c(x,O);o.apply(this),this._parser=new r(x,O),this.writable=!0,this.readable=!0;var V=this;this._parser.onend=function(){V.emit("end")},this._parser.onerror=function(N){V.emit("error",N),V._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(V,"on"+N,{get:function(){return V._parser["on"+N]},set:function(ne){if(!ne)return V.removeAllListeners(N),V._parser["on"+N]=ne,ne;V.on(N,ne)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(o.prototype,{constructor:{value:c}}),c.prototype.write=function(x){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(x)){if(!this._decoder){var O=require("string_decoder").StringDecoder;this._decoder=new O("utf8")}x=this._decoder.write(x)}return this._parser.write(x.toString()),this.emit("data",x),!0},c.prototype.end=function(x){return x&&x.length&&this.write(x),this._parser.end(),!0},c.prototype.on=function(x,O){var V=this;return!V._parser["on"+x]&&a.indexOf(x)!==-1&&(V._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),V.emit.apply(V,N)}),o.prototype.on.call(V,x,O)};var l="[CDATA[",h="DOCTYPE",d="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",m={xml:d,xmlns:f},y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,v=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(x){return x===" "||x===`
|
|
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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},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:`
|
|
188
|
+
`,D.offset=(F=p.offset)!=null?F:0,D.dontPrettyTextNodes=(b=(k=p.dontPrettyTextNodes)!=null?k:p.dontprettytextnodes)!=null?b:0,D.spaceBeforeSlash=(R=(I=p.spaceBeforeSlash)!=null?I:p.spacebeforeslash)!=null?R:"",D.spaceBeforeSlash===!0&&(D.spaceBeforeSlash=" "),D.suppressPrettyCount=0,D.user={},D.state=e.None,D},A.prototype.indent=function(p,D,w){var C;return!D.pretty||D.suppressPrettyCount?"":D.pretty&&(C=(w||0)+D.offset+1,C>0)?new Array(C).join(D.indent):""},A.prototype.endline=function(p,D,w){return!D.pretty||D.suppressPrettyCount?"":D.newline},A.prototype.attribute=function(p,D,w){var C;return this.openAttribute(p,D,w),C=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,D,w),C},A.prototype.cdata=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<![CDATA[",D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+="]]>"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.comment=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!-- ",D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=" -->"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.declaration=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<?xml",D.state=e.InsideTag,C+=' version="'+p.version+'"',p.encoding!=null&&(C+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(C+=' standalone="'+p.standalone+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.docType=function(p,D,w){var C,F,b,k,R;if(w||(w=0),this.openNode(p,D,w),D.state=e.OpenTag,k=this.indent(p,D,w),k+="<!DOCTYPE "+p.root().name,p.pubID&&p.sysID?k+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(k+=' SYSTEM "'+p.sysID+'"'),p.children.length>0){for(k+=" [",k+=this.endline(p,D,w),D.state=e.InsideTag,R=p.children,F=0,b=R.length;F<b;F++)C=R[F],k+=this.writeChildNode(C,D,w+1);D.state=e.CloseTag,k+="]"}return D.state=e.CloseTag,k+=D.spaceBeforeSlash+">",k+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),k},A.prototype.element=function(p,D,w){var C,F,b,k,R,I,B,j,z,L,S,T,P,$;w||(w=0),L=!1,S="",this.openNode(p,D,w),D.state=e.OpenTag,S+=this.indent(p,D,w)+"<"+p.name,T=p.attribs;for(z in T)E.call(T,z)&&(C=T[z],S+=this.attribute(C,D,w));if(b=p.children.length,k=b===0?null:p.children[0],b===0||p.children.every(function(q){return(q.type===t.Text||q.type===t.Raw)&&q.value===""}))D.allowEmpty?(S+=">",D.state=e.CloseTag,S+="</"+p.name+">"+this.endline(p,D,w)):(D.state=e.CloseTag,S+=D.spaceBeforeSlash+"/>"+this.endline(p,D,w));else if(D.pretty&&b===1&&(k.type===t.Text||k.type===t.Raw)&&k.value!=null)S+=">",D.state=e.InsideTag,D.suppressPrettyCount++,L=!0,S+=this.writeChildNode(k,D,w+1),D.suppressPrettyCount--,L=!1,D.state=e.CloseTag,S+="</"+p.name+">"+this.endline(p,D,w);else{if(D.dontPrettyTextNodes){for(P=p.children,R=0,B=P.length;R<B;R++)if(F=P[R],(F.type===t.Text||F.type===t.Raw)&&F.value!=null){D.suppressPrettyCount++,L=!0;break}}for(S+=">"+this.endline(p,D,w),D.state=e.InsideTag,$=p.children,I=0,j=$.length;I<j;I++)F=$[I],S+=this.writeChildNode(F,D,w+1);D.state=e.CloseTag,S+=this.indent(p,D,w)+"</"+p.name+">",L&&D.suppressPrettyCount--,S+=this.endline(p,D,w),D.state=e.None}return this.closeNode(p,D,w),S},A.prototype.writeChildNode=function(p,D,w){switch(p.type){case t.CData:return this.cdata(p,D,w);case t.Comment:return this.comment(p,D,w);case t.Element:return this.element(p,D,w);case t.Raw:return this.raw(p,D,w);case t.Text:return this.text(p,D,w);case t.ProcessingInstruction:return this.processingInstruction(p,D,w);case t.Dummy:return"";case t.Declaration:return this.declaration(p,D,w);case t.DocType:return this.docType(p,D,w);case t.AttributeDeclaration:return this.dtdAttList(p,D,w);case t.ElementDeclaration:return this.dtdElement(p,D,w);case t.EntityDeclaration:return this.dtdEntity(p,D,w);case t.NotationDeclaration:return this.dtdNotation(p,D,w);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<?",D.state=e.InsideTag,C+=p.target,p.value&&(C+=" "+p.value),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.raw=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w),D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.text=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w),D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdAttList=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ATTLIST",D.state=e.InsideTag,C+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(C+=" "+p.defaultValueType),p.defaultValue&&(C+=' "'+p.defaultValue+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdElement=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ELEMENT",D.state=e.InsideTag,C+=" "+p.name+" "+p.value,D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdEntity=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ENTITY",D.state=e.InsideTag,p.pe&&(C+=" %"),C+=" "+p.name,p.value?C+=' "'+p.value+'"':(p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),p.nData&&(C+=" NDATA "+p.nData)),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdNotation=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!NOTATION",D.state=e.InsideTag,C+=" "+p.name,p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?C+=' PUBLIC "'+p.pubID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.openNode=function(p,D,w){},A.prototype.closeNode=function(p,D,w){},A.prototype.openAttribute=function(p,D,w){},A.prototype.closeAttribute=function(p,D,w){},A})()}).call(PN)});var ep=_((RN,kN)=>{(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=Cv(),kN.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o)}return s.prototype.document=function(o,a){var u,c,l,h,d;for(a=this.filterOptions(a),h="",d=o.children,c=0,l=d.length;c<l;c++)u=d[c],h+=this.writeChildNode(u,a,0);return a.pretty&&h.slice(-a.newline.length)===a.newline&&(h=h.slice(0,-a.newline.length)),h},s})(e)}).call(RN)});var Sv=_((NN,$N)=>{(function(){var t,e,r,n,i,s,o,a,u=function(l,h){for(var d in h)c.call(h,d)&&(l[d]=h[d]);function f(){this.constructor=l}return f.prototype=h.prototype,l.prototype=new f,l.__super__=h.prototype,l},c={}.hasOwnProperty;a=Ln().isPlainObject,r=vv(),e=Bk(),i=kr(),t=Ot(),o=_v(),s=ep(),$N.exports=n=(function(l){u(h,l);function h(d){h.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,d||(d={}),d.writer||(d.writer=new s),this.options=d,this.stringify=new o(d)}return Object.defineProperty(h.prototype,"implementation",{value:new r}),Object.defineProperty(h.prototype,"doctype",{get:function(){var d,f,m,y;for(y=this.children,f=0,m=y.length;f<m;f++)if(d=y[f],d.type===t.DocType)return d;return null}}),Object.defineProperty(h.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(h.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(h.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(h.prototype,"origin",{get:function(){return null}}),Object.defineProperty(h.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(h.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(h.prototype,"contentType",{get:function(){return null}}),h.prototype.end=function(d){var f;return f={},d?a(d)&&(f=d,d=this.options.writer):d=this.options.writer,d.document(this,d.filterOptions(f))},h.prototype.toString=function(d){return this.options.writer.document(this,this.options.writer.filterOptions(d))},h.prototype.createElement=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTextNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createComment=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createCDATASection=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createProcessingInstruction=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttribute=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEntityReference=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.importNode=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createElementNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttributeNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementById=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.adoptNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.renameNode=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEvent=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createNodeIterator=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTreeWalker=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h})(i)}).call(NN)});var jN=_((LN,BN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,v,E,A,p,D,w,C,F,b={}.hasOwnProperty;F=Ln(),w=F.isObject,D=F.isFunction,C=F.isPlainObject,p=F.getValue,t=Ot(),h=Sv(),f=qd(),n=Hd(),i=Vd(),y=Jd(),A=Zd(),m=Qd(),c=zd(),l=Yd(),s=Kd(),a=Gd(),o=Wd(),u=Xd(),r=Ev(),E=_v(),v=ep(),e=Bc(),BN.exports=d=(function(){function k(R,I,B){var j;this.name="?xml",this.type=t.Document,R||(R={}),j={},R.writer?C(R.writer)&&(j=R.writer,R.writer=new v):R.writer=new v,this.options=R,this.writer=R.writer,this.writerOptions=this.writer.filterOptions(j),this.stringify=new E(R),this.onDataCallback=I||function(){},this.onEndCallback=B||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return k.prototype.createChildNode=function(R){var I,B,j,z,L,S,T,P;switch(R.type){case t.CData:this.cdata(R.value);break;case t.Comment:this.comment(R.value);break;case t.Element:j={},T=R.attribs;for(B in T)b.call(T,B)&&(I=T[B],j[B]=I.value);this.node(R.name,j);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(R.value);break;case t.Text:this.text(R.value);break;case t.ProcessingInstruction:this.instruction(R.target,R.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+R.constructor.name)}for(P=R.children,L=0,S=P.length;L<S;L++)z=P[L],this.createChildNode(z),z.type===t.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(R,I,B){var j;if(R==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(R));return this.openCurrent(),R=p(R),I==null&&(I={}),I=p(I),w(I)||(j=[I,B],B=j[0],I=j[1]),this.currentNode=new f(this,R,I),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,B!=null&&this.text(B),this},k.prototype.element=function(R,I,B){var j,z,L,S,T,P;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(R)||w(R)||D(R))for(S=this.options.noValidation,this.options.noValidation=!0,P=new h(this.options).element("TEMP_ROOT"),P.element(R),this.options.noValidation=S,T=P.children,z=0,L=T.length;z<L;z++)j=T[z],this.createChildNode(j),j.type===t.Element&&this.up();else this.node(R,I,B);return this},k.prototype.attribute=function(R,I){var B,j;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(R));if(R!=null&&(R=p(R)),w(R))for(B in R)b.call(R,B)&&(j=R[B],this.attribute(B,j));else D(I)&&(I=I.apply()),this.options.keepNullAttributes&&I==null?this.currentNode.attribs[R]=new r(this,R,""):I!=null&&(this.currentNode.attribs[R]=new r(this,R,I));return this},k.prototype.text=function(R){var I;return this.openCurrent(),I=new A(this,R),this.onData(this.writer.text(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.cdata=function(R){var I;return this.openCurrent(),I=new n(this,R),this.onData(this.writer.cdata(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.comment=function(R){var I;return this.openCurrent(),I=new i(this,R),this.onData(this.writer.comment(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.raw=function(R){var I;return this.openCurrent(),I=new y(this,R),this.onData(this.writer.raw(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.instruction=function(R,I){var B,j,z,L,S;if(this.openCurrent(),R!=null&&(R=p(R)),I!=null&&(I=p(I)),Array.isArray(R))for(B=0,L=R.length;B<L;B++)j=R[B],this.instruction(j);else if(w(R))for(j in R)b.call(R,j)&&(z=R[j],this.instruction(j,z));else D(I)&&(I=I.apply()),S=new m(this,R,I),this.onData(this.writer.processingInstruction(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},k.prototype.declaration=function(R,I,B){var j;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return j=new c(this,R,I,B),this.onData(this.writer.declaration(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(R,I,B){if(this.openCurrent(),R==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,I,B),this.currentNode.rootNodeName=R,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(R,I){var B;return this.openCurrent(),B=new o(this,R,I),this.onData(this.writer.dtdElement(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(R,I,B,j,z){var L;return this.openCurrent(),L=new s(this,R,I,B,j,z),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(R,I){var B;return this.openCurrent(),B=new a(this,!1,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(R,I){var B;return this.openCurrent(),B=new a(this,!0,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(R,I){var B;return this.openCurrent(),B=new u(this,R,I),this.onData(this.writer.dtdNotation(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},k.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},k.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},k.prototype.openNode=function(R){var I,B,j,z;if(!R.isOpen){if(!this.root&&this.currentLevel===0&&R.type===t.Element&&(this.root=R),B="",R.type===t.Element){this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<"+R.name,z=R.attribs;for(j in z)b.call(z,j)&&(I=z[j],B+=this.writer.attribute(I,this.writerOptions,this.currentLevel));B+=(R.children?">":"/>")+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+R.rootNodeName,R.pubID&&R.sysID?B+=' PUBLIC "'+R.pubID+'" "'+R.sysID+'"':R.sysID&&(B+=' SYSTEM "'+R.sysID+'"'),R.children?(B+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,B+=">"),B+=this.writer.endline(R,this.writerOptions,this.currentLevel);return this.onData(B,this.currentLevel),R.isOpen=!0}},k.prototype.closeNode=function(R){var I;if(!R.isClosed)return I="",this.writerOptions.state=e.CloseTag,R.type===t.Element?I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"</"+R.name+">"+this.writer.endline(R,this.writerOptions,this.currentLevel):I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(I,this.currentLevel),R.isClosed=!0},k.prototype.onData=function(R,I){return this.documentStarted=!0,this.onDataCallback(R,I+1)},k.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},k.prototype.debugInfo=function(R){return R==null?"":"node: <"+R+">"},k.prototype.ele=function(){return this.element.apply(this,arguments)},k.prototype.nod=function(R,I,B){return this.node(R,I,B)},k.prototype.txt=function(R){return this.text(R)},k.prototype.dat=function(R){return this.cdata(R)},k.prototype.com=function(R){return this.comment(R)},k.prototype.ins=function(R,I){return this.instruction(R,I)},k.prototype.dec=function(R,I,B){return this.declaration(R,I,B)},k.prototype.dtd=function(R,I,B){return this.doctype(R,I,B)},k.prototype.e=function(R,I,B){return this.element(R,I,B)},k.prototype.n=function(R,I,B){return this.node(R,I,B)},k.prototype.t=function(R){return this.text(R)},k.prototype.d=function(R){return this.cdata(R)},k.prototype.c=function(R){return this.comment(R)},k.prototype.r=function(R){return this.raw(R)},k.prototype.i=function(R,I){return this.instruction(R,I)},k.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.ent=function(R,I){return this.entity(R,I)},k.prototype.pent=function(R,I){return this.pEntity(R,I)},k.prototype.not=function(R,I){return this.notation(R,I)},k})()}).call(LN)});var qN=_((MN,UN)=>{(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;t=Ot(),n=Cv(),e=Bc(),UN.exports=r=(function(o){i(a,o);function a(u,c){this.stream=u,a.__super__.constructor.call(this,c)}return a.prototype.endline=function(u,c,l){return u.isLastRootNode&&c.state===e.CloseTag?"":a.__super__.endline.call(this,u,c,l)},a.prototype.document=function(u,c){var l,h,d,f,m,y,v,E,A;for(v=u.children,h=d=0,m=v.length;d<m;h=++d)l=v[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),E=u.children,A=[],f=0,y=E.length;f<y;f++)l=E[f],A.push(this.writeChildNode(l,c,0));return A},a.prototype.attribute=function(u,c,l){return this.stream.write(a.__super__.attribute.call(this,u,c,l))},a.prototype.cdata=function(u,c,l){return this.stream.write(a.__super__.cdata.call(this,u,c,l))},a.prototype.comment=function(u,c,l){return this.stream.write(a.__super__.comment.call(this,u,c,l))},a.prototype.declaration=function(u,c,l){return this.stream.write(a.__super__.declaration.call(this,u,c,l))},a.prototype.docType=function(u,c,l){var h,d,f,m;if(l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)),this.stream.write("<!DOCTYPE "+u.root().name),u.pubID&&u.sysID?this.stream.write(' PUBLIC "'+u.pubID+'" "'+u.sysID+'"'):u.sysID&&this.stream.write(' SYSTEM "'+u.sysID+'"'),u.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(u,c,l)),c.state=e.InsideTag,m=u.children,d=0,f=m.length;d<f;d++)h=m[d],this.writeChildNode(h,c,l+1);c.state=e.CloseTag,this.stream.write("]")}return c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.element=function(u,c,l){var h,d,f,m,y,v,E,A,p,D;l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)+"<"+u.name),p=u.attribs;for(E in p)s.call(p,E)&&(h=p[E],this.attribute(h,c,l));if(f=u.children.length,m=f===0?null:u.children[0],f===0||u.children.every(function(w){return(w.type===t.Text||w.type===t.Raw)&&w.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=e.CloseTag,this.stream.write("</"+u.name+">")):(c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&f===1&&(m.type===t.Text||m.type===t.Raw)&&m.value!=null)this.stream.write(">"),c.state=e.InsideTag,c.suppressPrettyCount++,A=!0,this.writeChildNode(m,c,l+1),c.suppressPrettyCount--,A=!1,c.state=e.CloseTag,this.stream.write("</"+u.name+">");else{for(this.stream.write(">"+this.endline(u,c,l)),c.state=e.InsideTag,D=u.children,y=0,v=D.length;y<v;y++)d=D[y],this.writeChildNode(d,c,l+1);c.state=e.CloseTag,this.stream.write(this.indent(u,c,l)+"</"+u.name+">")}return this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.processingInstruction=function(u,c,l){return this.stream.write(a.__super__.processingInstruction.call(this,u,c,l))},a.prototype.raw=function(u,c,l){return this.stream.write(a.__super__.raw.call(this,u,c,l))},a.prototype.text=function(u,c,l){return this.stream.write(a.__super__.text.call(this,u,c,l))},a.prototype.dtdAttList=function(u,c,l){return this.stream.write(a.__super__.dtdAttList.call(this,u,c,l))},a.prototype.dtdElement=function(u,c,l){return this.stream.write(a.__super__.dtdElement.call(this,u,c,l))},a.prototype.dtdEntity=function(u,c,l){return this.stream.write(a.__super__.dtdEntity.call(this,u,c,l))},a.prototype.dtdNotation=function(u,c,l){return this.stream.write(a.__super__.dtdNotation.call(this,u,c,l))},a})(n)}).call(MN)});var VN=_((HN,Zi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=Ln(),a=c.assign,u=c.isFunction,r=vv(),n=Sv(),i=jN(),o=ep(),s=qN(),t=Ot(),e=Bc(),Zi.exports.create=function(l,h,d,f){var m,y;if(l==null)throw new Error("Root element needs a name.");return f=a({},h,d,f),m=new n(f),y=m.element(l),f.headless||(m.declaration(f),(f.pubID!=null||f.sysID!=null)&&m.dtd(f)),y},Zi.exports.begin=function(l,h,d){var f;return u(l)&&(f=[l,h],h=f[0],d=f[1],l={}),h?new i(l,h,d):new n(l)},Zi.exports.stringWriter=function(l){return new o(l)},Zi.exports.streamWriter=function(l,h){return new s(l,h)},Zi.exports.implementation=new r,Zi.exports.nodeType=t,Zi.exports.writerState=e}).call(HN)});var zN=_(Av=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=VN(),e=Md().defaults,n=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},i=function(o){return"<![CDATA["+r(o)+"]]>"},r=function(o){return o.replace("]]>","]]]]><![CDATA[>")},Av.Builder=(function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)s.call(c,u)&&(l=c[u],this.options[u]=l);for(u in a)s.call(a,u)&&(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,h,d;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,l=(function(f){return function(m,y){var v,E,A,p,D,w;if(typeof y!="object")f.options.cdata&&n(y)?m.raw(i(y)):m.txt(y);else if(Array.isArray(y)){for(p in y)if(s.call(y,p)){E=y[p];for(D in E)A=E[D],m=l(m.ele(D),A).up()}}else for(D in y)if(s.call(y,D))if(E=y[D],D===u){if(typeof E=="object")for(v in E)w=E[v],m=m.att(v,w)}else if(D===c)f.options.cdata&&n(E)?m=m.raw(i(E)):m=m.txt(E);else if(Array.isArray(E))for(p in E)s.call(E,p)&&(A=E[p],typeof A=="string"?f.options.cdata&&n(A)?m=m.ele(D).raw(i(A)).up():m=m.ele(D,A).up():m=l(m.ele(D),A).up());else typeof E=="object"?m=l(m.ele(D),E).up():typeof E=="string"&&f.options.cdata&&n(E)?m=m.ele(D).raw(i(E)).up():(E==null&&(E=""),m=m.ele(D,E.toString()).up());return m}})(this),h=t.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(h,a).end(this.options.renderOpts)},o})()}).call(Av)});var KN=_(tp=>{(function(t){t.parser=function(x,O){return new r(x,O)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(x,O){if(!(this instanceof r))return new r(x,O);var V=this;i(V),V.q=V.c="",V.bufferCheckPosition=t.MAX_BUFFER_LENGTH,V.opt=O||{},V.opt.lowercase=V.opt.lowercase||V.opt.lowercasetags,V.looseCase=V.opt.lowercase?"toLowerCase":"toUpperCase",V.tags=[],V.closed=V.closedRoot=V.sawRoot=!1,V.tag=V.error=null,V.strict=!!x,V.noscript=!!(x||V.opt.noscript),V.state=b.BEGIN,V.strictEntities=V.opt.strictEntities,V.ENTITIES=V.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),V.attribList=[],V.opt.xmlns&&(V.ns=Object.create(m)),V.opt.unquotedAttributeValues===void 0&&(V.opt.unquotedAttributeValues=!x),V.trackPosition=V.opt.position!==!1,V.trackPosition&&(V.position=V.line=V.column=0),R(V,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var V=new O;return V}),Object.keys||(Object.keys=function(x){var O=[];for(var V in x)x.hasOwnProperty(V)&&O.push(V);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),V=0,N=0,ne=e.length;N<ne;N++){var K=x[e[N]].length;if(K>O)switch(e[N]){case"textNode":B(x);break;case"cdata":I(x,"oncdata",x.cdata),x.cdata="";break;case"script":I(x,"onscript",x.script),x.script="";break;default:z(x,"Max buffer length exceeded: "+e[N])}V=Math.max(V,K)}var oe=t.MAX_BUFFER_LENGTH-V;x.bufferCheckPosition=oe+x.position}function i(x){for(var O=0,V=e.length;O<V;O++)x[e[O]]=""}function s(x){B(x),x.cdata!==""&&(I(x,"oncdata",x.cdata),x.cdata=""),x.script!==""&&(I(x,"onscript",x.script),x.script="")}r.prototype={end:function(){L(this)},write:te,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var o;try{o=require("stream").Stream}catch{o=function(){}}o||(o=function(){});var a=t.EVENTS.filter(function(x){return x!=="error"&&x!=="end"});function u(x,O){return new c(x,O)}function c(x,O){if(!(this instanceof c))return new c(x,O);o.apply(this),this._parser=new r(x,O),this.writable=!0,this.readable=!0;var V=this;this._parser.onend=function(){V.emit("end")},this._parser.onerror=function(N){V.emit("error",N),V._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(V,"on"+N,{get:function(){return V._parser["on"+N]},set:function(ne){if(!ne)return V.removeAllListeners(N),V._parser["on"+N]=ne,ne;V.on(N,ne)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(o.prototype,{constructor:{value:c}}),c.prototype.write=function(x){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(x)){if(!this._decoder){var O=require("string_decoder").StringDecoder;this._decoder=new O("utf8")}x=this._decoder.write(x)}return this._parser.write(x.toString()),this.emit("data",x),!0},c.prototype.end=function(x){return x&&x.length&&this.write(x),this._parser.end(),!0},c.prototype.on=function(x,O){var V=this;return!V._parser["on"+x]&&a.indexOf(x)!==-1&&(V._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),V.emit.apply(V,N)}),o.prototype.on.call(V,x,O)};var l="[CDATA[",h="DOCTYPE",d="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",m={xml:d,xmlns:f},y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,v=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(x){return x===" "||x===`
|
|
189
189
|
`||x==="\r"||x===" "}function D(x){return x==='"'||x==="'"}function w(x){return x===">"||p(x)}function C(x,O){return x.test(O)}function F(x,O){return!C(x,O)}var b=0;t.STATE={BEGIN:b++,BEGIN_WHITESPACE:b++,TEXT:b++,TEXT_ENTITY:b++,OPEN_WAKA:b++,SGML_DECL:b++,SGML_DECL_QUOTED:b++,DOCTYPE:b++,DOCTYPE_QUOTED:b++,DOCTYPE_DTD:b++,DOCTYPE_DTD_QUOTED:b++,COMMENT_STARTING:b++,COMMENT:b++,COMMENT_ENDING:b++,COMMENT_ENDED:b++,CDATA:b++,CDATA_ENDING:b++,CDATA_ENDING_2:b++,PROC_INST:b++,PROC_INST_BODY:b++,PROC_INST_ENDING:b++,OPEN_TAG:b++,OPEN_TAG_SLASH:b++,ATTRIB:b++,ATTRIB_NAME:b++,ATTRIB_NAME_SAW_WHITE:b++,ATTRIB_VALUE:b++,ATTRIB_VALUE_QUOTED:b++,ATTRIB_VALUE_CLOSED:b++,ATTRIB_VALUE_UNQUOTED:b++,ATTRIB_VALUE_ENTITY_Q:b++,ATTRIB_VALUE_ENTITY_U:b++,CLOSE_TAG:b++,CLOSE_TAG_SAW_WHITE:b++,SCRIPT:b++,SCRIPT_ENDING:b++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(x){var O=t.ENTITIES[x],V=typeof O=="number"?String.fromCharCode(O):O;t.ENTITIES[x]=V});for(var k in t.STATE)t.STATE[t.STATE[k]]=k;b=t.STATE;function R(x,O,V){x[O]&&x[O](V)}function I(x,O,V){x.textNode&&B(x),R(x,O,V)}function B(x){x.textNode=j(x.opt,x.textNode),x.textNode&&R(x,"ontext",x.textNode),x.textNode=""}function j(x,O){return x.trim&&(O=O.trim()),x.normalize&&(O=O.replace(/\s+/g," ")),O}function z(x,O){return B(x),x.trackPosition&&(O+=`
|
|
190
190
|
Line: `+x.line+`
|
|
191
191
|
Column: `+x.column+`
|
|
@@ -238,7 +238,7 @@ const config: CapacitorConfig = ${(0,yle.formatJSObject)(t)};
|
|
|
238
238
|
export default config;
|
|
239
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
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),Ot=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ot(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?Ot.compileRe(t,e):Ot.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=Ot(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=Ot.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};Ot.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=Ot.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};Ot.matchBase=(t,e,r,n=Hb.isWindows(r))=>(e instanceof RegExp?e:Ot.makeRe(e,r)).test(Whe.basename(t));Ot.isMatch=(t,e,r)=>Ot(e,r)(t);Ot.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ot.parse(r,e)):qb(t,{...e,fastpaths:!1});Ot.scan=(t,e)=>Xhe(t,e);Ot.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=Ot.toRegex(a,e);return n===!0&&(u.state=t),u};Ot.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)),Ot.compileRe(i,e,r,n)};Ot.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/$^/}};Ot.constants=Yhe;AU.exports=Ot});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(`
|
|
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(`
|
|
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,`
|
|
@@ -277,13 +277,13 @@ ${J.default.gray(gu)} ${t}
|
|
|
277
277
|
`)},g={message:(t="",{symbol:e=J.default.gray(ct)}={})=>{let r=[`${J.default.gray(ct)}`];if(t){let[n,...i]=t.split(`
|
|
278
278
|
`);r.push(`${e} ${n}`,...i.map(s=>`${J.default.gray(ct)} ${s}`))}process.stdout.write(`${r.join(`
|
|
279
279
|
`)}
|
|
280
|
-
`)},info:t=>{g.message(t,{symbol:J.default.blue(Xq)})},success:t=>{g.message(t,{symbol:J.default.green(Yq)})},step:t=>{g.message(t,{symbol:J.default.green(jm)})},warn:t=>{g.message(t,{symbol:J.default.yellow(Jq)})},warning:t=>{g.warn(t)},error:t=>{g.message(t,{symbol:J.default.red(Zq)})}},ape=`${J.default.gray(ct)} `;var
|
|
280
|
+
`)},info:t=>{g.message(t,{symbol:J.default.blue(Xq)})},success:t=>{g.message(t,{symbol:J.default.green(Yq)})},step:t=>{g.message(t,{symbol:J.default.green(jm)})},warn:t=>{g.message(t,{symbol:J.default.yellow(Jq)})},warning:t=>{g.warn(t)},error:t=>{g.message(t,{symbol:J.default.red(Zq)})}},ape=`${J.default.gray(ct)} `;var Ct=({indicator:t="dots"}={})=>{let e=$m?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=$m?80:120,n=process.env.CI==="true",i,s,o=!1,a="",u,c=performance.now(),l=D=>{let w=D>1?"Something went wrong":"Canceled";o&&p(w,D)},h=()=>l(2),d=()=>l(1),f=()=>{process.on("uncaughtExceptionMonitor",h),process.on("unhandledRejection",h),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",h),process.removeListener("unhandledRejection",h),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},y=()=>{if(u===void 0)return;n&&process.stdout.write(`
|
|
281
281
|
`);let D=u.split(`
|
|
282
282
|
`);process.stdout.write(Nl.cursor.move(-999,D.length-1)),process.stdout.write(Nl.erase.down(D.length))},v=D=>D.replace(/\.+$/,""),E=D=>{let w=(performance.now()-D)/1e3,C=Math.floor(w/60),F=Math.floor(w%60);return C>0?`[${C}m ${F}s]`:`[${F}s]`},A=(D="")=>{o=!0,i=h_(),a=v(D),c=performance.now(),process.stdout.write(`${J.default.gray(ct)}
|
|
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.52.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.
|
|
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
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
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",`
|
|
289
289
|
`)}`),s=new Error(a.message)):g.warn(`${a.message.replaceAll("\\n",`
|
|
@@ -297,10 +297,10 @@ Trial expires in ${a} days, upgrade here: ${s.hostWeb}/settings/organization/pla
|
|
|
297
297
|
Trial expires in ${a} days, upgrade here: ${s.hostWeb}/settings/organization/plans
|
|
298
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 (
|
|
299
299
|
native_packages
|
|
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=
|
|
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}
|
|
302
302
|
Did you build your app before uploading?
|
|
303
|
-
PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");i.stop(`Checksum compatible with ${r} channel`)}function $e(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function fo(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Hl(t.localVersion),r=Hl(t.remoteVersion);return x_(e,r)}catch{return!1}}async function em(t,e,r,n,i){let s=await gb(n,i),o=await I8(t,e,r),a=s.filter(c=>!!c.native).map(c=>{let l=o.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...o].filter(([c])=>s.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:s}}async function yb(t,e,r,n){let i=await I8(t,e,r),s=n.map(a=>{let u=i.get(a.name);return u?{name:a.name,localVersion:a.version,remoteVersion:u.version}:{name:a.name,localVersion:a.version,remoteVersion:void 0}}),o=[...i].filter(([a])=>n.find(u=>u.name===a)===void 0).map(([a,u])=>({name:a,localVersion:void 0,remoteVersion:u.version}));return s.push(...o),{finalCompatibility:s,localDependencies:n}}async function F8(t,e,r){let n=await Pr({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(st(n))throw t&&e&&r&&await WT("onboarding-v2",e,r,"canceled","\u{1F937}"),g.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let i=qn(),s=
|
|
303
|
+
PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");i.stop(`Checksum compatible with ${r} channel`)}function $e(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function fo(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Hl(t.localVersion),r=Hl(t.remoteVersion);return x_(e,r)}catch{return!1}}async function em(t,e,r,n,i){let s=await gb(n,i),o=await I8(t,e,r),a=s.filter(c=>!!c.native).map(c=>{let l=o.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...o].filter(([c])=>s.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:s}}async function yb(t,e,r,n){let i=await I8(t,e,r),s=n.map(a=>{let u=i.get(a.name);return u?{name:a.name,localVersion:a.version,remoteVersion:u.version}:{name:a.name,localVersion:a.version,remoteVersion:void 0}}),o=[...i].filter(([a])=>n.find(u=>u.name===a)===void 0).map(([a,u])=>({name:a,localVersion:void 0,remoteVersion:u.version}));return s.push(...o),{finalCompatibility:s,localDependencies:n}}async function F8(t,e,r){let n=await Pr({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(st(n))throw t&&e&&r&&await WT("onboarding-v2",e,r,"canceled","\u{1F937}"),g.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let i=qn(),s=Ct();s.start("Running the command...");try{await new Promise((o,a)=>{let u=(0,h8.spawn)(i.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?o():a(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{a(c)})}),s.stop("Capacitor sync completed \u2705")}catch(o){s.stop("Error"),g.error(`Failed to run Capacitor sync: ${o}`),g.warn(`Please run "${i.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let i=qn();g.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),g.info(`Remember to run "${i.runner} cap sync" before uploading encrypted bundles`)}}async function R8(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,{data:o,error:a}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(a)throw i||g.error(`Cannot check Version ${e}@${r.name}: ${W(a)}`),new Error(`Cannot check version ${e}@${r.name}: ${W(a)}`);if(!o?.length)return;if(i)throw new Error(`Version ${e}@${r.name} is used in ${o.length} channel(s)`);ae(`\u274C Version ${e}@${r.name} is used in ${o.length} channel${o.length>1?"s":""}`);let u=s;if(s||(u=await Pr({message:"unlink it?"})===!0),!u)throw g.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of o){let l=Ct();l.start(`Unlinking channel ${c.name}`);let h=await Db(t,e,{silent:i});if(!h)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:d}=await t.from("channels").update({version:h.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${W(d)}`),new Error(`Cannot update channel ${c.name}: ${W(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}le(`Version unlinked from ${o.length} channel${o.length>1?"s":""}`)}async function Db(t,e,r={}){let{silent:n=!1}=r,i=[3e3,7e3],s;for(let o=0;o<=2;o++){let{data:a,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return a;s=u,o<2&&await new Promise(c=>setTimeout(c,i[o]))}throw n||g.error(`Cannot call findUnknownVersion as it returned an error.
|
|
304
304
|
${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}function k8(t,e){return t.from("channels").insert(e).select().single()}function N8(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function $8(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function L8(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function B8(t,e,r){return t.from("channels").select(`
|
|
305
305
|
id,
|
|
306
306
|
version (id, name)
|
|
@@ -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=xt();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(`
|
|
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(
|
|
324
|
-
`);
|
|
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(`
|
|
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(`
|
|
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=
|
|
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...
|
|
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{await bfe(a,E.job_id,t,e.apikey,r),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("<","<").replaceAll(">",">").replaceAll("&","&")}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={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/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,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("<","<").replaceAll(">",">").replaceAll("&","&")}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={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/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,18 +334,18 @@ ${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=xt();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=xt();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=
|
|
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},
|
|
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
|
-
`),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=
|
|
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?xt():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 !!
|
|
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 !!
|
|
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
|
-
`));let D=o?
|
|
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
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}
|
|
350
350
|
`),(0,_o.appendFileSync)(".gitignore",`.capgo
|
|
351
351
|
`)}else{let o=(0,sq.homedir)();(0,_o.writeFileSync)(`${o}/.capgo`,`${t}
|